vskill 0.5.105 → 0.5.106

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.
@@ -1,102 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-6bfwsX0-.js","assets/fonts-i7Lkz2zN.css","assets/CommandPalette-DAWyTgXL.js","assets/CreateSkillPage-D5xmvnzV.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 c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const f of d.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&o(f)}).observe(document,{childList:!0,subtree:!0});function s(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function o(c){if(c.ep)return;c.ep=!0;const d=s(c);fetch(c.href,d)}})();function Qg(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var sd={exports:{}},Ss={};/**
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 Sx;function Yb(){if(Sx)return Ss;Sx=1;var n=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function s(o,c,d){var f=null;if(d!==void 0&&(f=""+d),c.key!==void 0&&(f=""+c.key),"key"in c){d={};for(var h in c)h!=="key"&&(d[h]=c[h])}else d=c;return c=d.ref,{$$typeof:n,type:o,key:f,ref:c!==void 0?c:null,props:d}}return Ss.Fragment=r,Ss.jsx=s,Ss.jsxs=s,Ss}var kx;function qb(){return kx||(kx=1,sd.exports=Yb()),sd.exports}var a=qb(),id={exports:{}},_e={};/**
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 wx;function Kb(){if(wx)return _e;wx=1;var n=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),f=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),j=Symbol.iterator;function S(D){return D===null||typeof D!="object"?null:(D=j&&D[j]||D["@@iterator"],typeof D=="function"?D:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,w={};function N(D,V,te){this.props=D,this.context=V,this.refs=w,this.updater=te||k}N.prototype.isReactComponent={},N.prototype.setState=function(D,V){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,V,"setState")},N.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function A(){}A.prototype=N.prototype;function z(D,V,te){this.props=D,this.context=V,this.refs=w,this.updater=te||k}var H=z.prototype=new A;H.constructor=z,E(H,N.prototype),H.isPureReactComponent=!0;var M=Array.isArray;function F(){}var T={H:null,A:null,T:null,S:null},O=Object.prototype.hasOwnProperty;function C(D,V,te){var se=te.ref;return{$$typeof:n,type:D,key:V,ref:se!==void 0?se:null,props:te}}function _(D,V){return C(D.type,V,D.props)}function $(D){return typeof D=="object"&&D!==null&&D.$$typeof===n}function K(D){var V={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(te){return V[te]})}var Z=/\/+/g;function q(D,V){return typeof D=="object"&&D!==null&&D.key!=null?K(""+D.key):V.toString(36)}function I(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(F,F):(D.status="pending",D.then(function(V){D.status==="pending"&&(D.status="fulfilled",D.value=V)},function(V){D.status==="pending"&&(D.status="rejected",D.reason=V)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function L(D,V,te,se,ge){var he=typeof D;(he==="undefined"||he==="boolean")&&(D=null);var be=!1;if(D===null)be=!0;else switch(he){case"bigint":case"string":case"number":be=!0;break;case"object":switch(D.$$typeof){case n:case r:be=!0;break;case y:return be=D._init,L(be(D._payload),V,te,se,ge)}}if(be)return ge=ge(D),be=se===""?"."+q(D,0):se,M(ge)?(te="",be!=null&&(te=be.replace(Z,"$&/")+"/"),L(ge,V,te,"",function(Be){return Be})):ge!=null&&($(ge)&&(ge=_(ge,te+(ge.key==null||D&&D.key===ge.key?"":(""+ge.key).replace(Z,"$&/")+"/")+be)),V.push(ge)),1;be=0;var ce=se===""?".":se+":";if(M(D))for(var je=0;je<D.length;je++)se=D[je],he=ce+q(se,je),be+=L(se,V,te,he,ge);else if(je=S(D),typeof je=="function")for(D=je.call(D),je=0;!(se=D.next()).done;)se=se.value,he=ce+q(se,je++),be+=L(se,V,te,he,ge);else if(he==="object"){if(typeof D.then=="function")return L(I(D),V,te,se,ge);throw V=String(D),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return be}function B(D,V,te){if(D==null)return D;var se=[],ge=0;return L(D,se,"","",function(he){return V.call(te,he,ge++)}),se}function P(D){if(D._status===-1){var V=D._result;V=V(),V.then(function(te){(D._status===0||D._status===-1)&&(D._status=1,D._result=te)},function(te){(D._status===0||D._status===-1)&&(D._status=2,D._result=te)}),D._status===-1&&(D._status=0,D._result=V)}if(D._status===1)return D._result.default;throw D._result}var W=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},ie={map:B,forEach:function(D,V,te){B(D,function(){V.apply(this,arguments)},te)},count:function(D){var V=0;return B(D,function(){V++}),V},toArray:function(D){return B(D,function(V){return V})||[]},only:function(D){if(!$(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return _e.Activity=v,_e.Children=ie,_e.Component=N,_e.Fragment=s,_e.Profiler=c,_e.PureComponent=z,_e.StrictMode=o,_e.Suspense=g,_e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,_e.__COMPILER_RUNTIME={__proto__:null,c:function(D){return T.H.useMemoCache(D)}},_e.cache=function(D){return function(){return D.apply(null,arguments)}},_e.cacheSignal=function(){return null},_e.cloneElement=function(D,V,te){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var se=E({},D.props),ge=D.key;if(V!=null)for(he in V.key!==void 0&&(ge=""+V.key),V)!O.call(V,he)||he==="key"||he==="__self"||he==="__source"||he==="ref"&&V.ref===void 0||(se[he]=V[he]);var he=arguments.length-2;if(he===1)se.children=te;else if(1<he){for(var be=Array(he),ce=0;ce<he;ce++)be[ce]=arguments[ce+2];se.children=be}return C(D.type,ge,se)},_e.createContext=function(D){return D={$$typeof:f,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:d,_context:D},D},_e.createElement=function(D,V,te){var se,ge={},he=null;if(V!=null)for(se in V.key!==void 0&&(he=""+V.key),V)O.call(V,se)&&se!=="key"&&se!=="__self"&&se!=="__source"&&(ge[se]=V[se]);var be=arguments.length-2;if(be===1)ge.children=te;else if(1<be){for(var ce=Array(be),je=0;je<be;je++)ce[je]=arguments[je+2];ge.children=ce}if(D&&D.defaultProps)for(se in be=D.defaultProps,be)ge[se]===void 0&&(ge[se]=be[se]);return C(D,he,ge)},_e.createRef=function(){return{current:null}},_e.forwardRef=function(D){return{$$typeof:h,render:D}},_e.isValidElement=$,_e.lazy=function(D){return{$$typeof:y,_payload:{_status:-1,_result:D},_init:P}},_e.memo=function(D,V){return{$$typeof:p,type:D,compare:V===void 0?null:V}},_e.startTransition=function(D){var V=T.T,te={};T.T=te;try{var se=D(),ge=T.S;ge!==null&&ge(te,se),typeof se=="object"&&se!==null&&typeof se.then=="function"&&se.then(F,W)}catch(he){W(he)}finally{V!==null&&te.types!==null&&(V.types=te.types),T.T=V}},_e.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},_e.use=function(D){return T.H.use(D)},_e.useActionState=function(D,V,te){return T.H.useActionState(D,V,te)},_e.useCallback=function(D,V){return T.H.useCallback(D,V)},_e.useContext=function(D){return T.H.useContext(D)},_e.useDebugValue=function(){},_e.useDeferredValue=function(D,V){return T.H.useDeferredValue(D,V)},_e.useEffect=function(D,V){return T.H.useEffect(D,V)},_e.useEffectEvent=function(D){return T.H.useEffectEvent(D)},_e.useId=function(){return T.H.useId()},_e.useImperativeHandle=function(D,V,te){return T.H.useImperativeHandle(D,V,te)},_e.useInsertionEffect=function(D,V){return T.H.useInsertionEffect(D,V)},_e.useLayoutEffect=function(D,V){return T.H.useLayoutEffect(D,V)},_e.useMemo=function(D,V){return T.H.useMemo(D,V)},_e.useOptimistic=function(D,V){return T.H.useOptimistic(D,V)},_e.useReducer=function(D,V,te){return T.H.useReducer(D,V,te)},_e.useRef=function(D){return T.H.useRef(D)},_e.useState=function(D){return T.H.useState(D)},_e.useSyncExternalStore=function(D,V,te){return T.H.useSyncExternalStore(D,V,te)},_e.useTransition=function(){return T.H.useTransition()},_e.version="19.2.4",_e}var Ex;function sf(){return Ex||(Ex=1,id.exports=Kb()),id.exports}var x=sf();const we=Qg(x);var od={exports:{}},ks={},cd={exports:{}},ud={};/**
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 Cx;function Xb(){return Cx||(Cx=1,(function(n){function r(L,B){var P=L.length;L.push(B);e:for(;0<P;){var W=P-1>>>1,ie=L[W];if(0<c(ie,B))L[W]=B,L[P]=ie,P=W;else break e}}function s(L){return L.length===0?null:L[0]}function o(L){if(L.length===0)return null;var B=L[0],P=L.pop();if(P!==B){L[0]=P;e:for(var W=0,ie=L.length,D=ie>>>1;W<D;){var V=2*(W+1)-1,te=L[V],se=V+1,ge=L[se];if(0>c(te,P))se<ie&&0>c(ge,te)?(L[W]=ge,L[se]=P,W=se):(L[W]=te,L[V]=P,W=V);else if(se<ie&&0>c(ge,P))L[W]=ge,L[se]=P,W=se;else break e}}return B}function c(L,B){var P=L.sortIndex-B.sortIndex;return P!==0?P:L.id-B.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;n.unstable_now=function(){return d.now()}}else{var f=Date,h=f.now();n.unstable_now=function(){return f.now()-h}}var g=[],p=[],y=1,v=null,j=3,S=!1,k=!1,E=!1,w=!1,N=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,z=typeof setImmediate<"u"?setImmediate:null;function H(L){for(var B=s(p);B!==null;){if(B.callback===null)o(p);else if(B.startTime<=L)o(p),B.sortIndex=B.expirationTime,r(g,B);else break;B=s(p)}}function M(L){if(E=!1,H(L),!k)if(s(g)!==null)k=!0,F||(F=!0,K());else{var B=s(p);B!==null&&I(M,B.startTime-L)}}var F=!1,T=-1,O=5,C=-1;function _(){return w?!0:!(n.unstable_now()-C<O)}function $(){if(w=!1,F){var L=n.unstable_now();C=L;var B=!0;try{e:{k=!1,E&&(E=!1,A(T),T=-1),S=!0;var P=j;try{t:{for(H(L),v=s(g);v!==null&&!(v.expirationTime>L&&_());){var W=v.callback;if(typeof W=="function"){v.callback=null,j=v.priorityLevel;var ie=W(v.expirationTime<=L);if(L=n.unstable_now(),typeof ie=="function"){v.callback=ie,H(L),B=!0;break t}v===s(g)&&o(g),H(L)}else o(g);v=s(g)}if(v!==null)B=!0;else{var D=s(p);D!==null&&I(M,D.startTime-L),B=!1}}break e}finally{v=null,j=P,S=!1}B=void 0}}finally{B?K():F=!1}}}var K;if(typeof z=="function")K=function(){z($)};else if(typeof MessageChannel<"u"){var Z=new MessageChannel,q=Z.port2;Z.port1.onmessage=$,K=function(){q.postMessage(null)}}else K=function(){N($,0)};function I(L,B){T=N(function(){L(n.unstable_now())},B)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(L){L.callback=null},n.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<L?Math.floor(1e3/L):5},n.unstable_getCurrentPriorityLevel=function(){return j},n.unstable_next=function(L){switch(j){case 1:case 2:case 3:var B=3;break;default:B=j}var P=j;j=B;try{return L()}finally{j=P}},n.unstable_requestPaint=function(){w=!0},n.unstable_runWithPriority=function(L,B){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var P=j;j=L;try{return B()}finally{j=P}},n.unstable_scheduleCallback=function(L,B,P){var W=n.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?W+P:W):P=W,L){case 1:var ie=-1;break;case 2:ie=250;break;case 5:ie=1073741823;break;case 4:ie=1e4;break;default:ie=5e3}return ie=P+ie,L={id:y++,callback:B,priorityLevel:L,startTime:P,expirationTime:ie,sortIndex:-1},P>W?(L.sortIndex=P,r(p,L),s(g)===null&&L===s(p)&&(E?(A(T),T=-1):E=!0,I(M,P-W))):(L.sortIndex=ie,r(g,L),k||S||(k=!0,F||(F=!0,K()))),L},n.unstable_shouldYield=_,n.unstable_wrapCallback=function(L){var B=j;return function(){var P=j;j=B;try{return L.apply(this,arguments)}finally{j=P}}}})(ud)),ud}var Nx;function Qb(){return Nx||(Nx=1,cd.exports=Xb()),cd.exports}var dd={exports:{}},Qt={};/**
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 Tx;function Zb(){if(Tx)return Qt;Tx=1;var n=sf();function r(g){var p="https://react.dev/errors/"+g;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)p+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+g+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var o={d:{f:s,r:function(){throw Error(r(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},c=Symbol.for("react.portal");function d(g,p,y){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:v==null?null:""+v,children:g,containerInfo:p,implementation:y}}var f=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(g,p){if(g==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Qt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Qt.createPortal=function(g,p){var y=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 d(g,p,null,y)},Qt.flushSync=function(g){var p=f.T,y=o.p;try{if(f.T=null,o.p=2,g)return g()}finally{f.T=p,o.p=y,o.d.f()}},Qt.preconnect=function(g,p){typeof g=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,o.d.C(g,p))},Qt.prefetchDNS=function(g){typeof g=="string"&&o.d.D(g)},Qt.preinit=function(g,p){if(typeof g=="string"&&p&&typeof p.as=="string"){var y=p.as,v=h(y,p.crossOrigin),j=typeof p.integrity=="string"?p.integrity:void 0,S=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;y==="style"?o.d.S(g,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:v,integrity:j,fetchPriority:S}):y==="script"&&o.d.X(g,{crossOrigin:v,integrity:j,fetchPriority:S,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Qt.preinitModule=function(g,p){if(typeof g=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var y=h(p.as,p.crossOrigin);o.d.M(g,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&o.d.M(g)},Qt.preload=function(g,p){if(typeof g=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,v=h(y,p.crossOrigin);o.d.L(g,y,{crossOrigin:v,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})}},Qt.preloadModule=function(g,p){if(typeof g=="string")if(p){var y=h(p.as,p.crossOrigin);o.d.m(g,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else o.d.m(g)},Qt.requestFormReset=function(g){o.d.r(g)},Qt.unstable_batchedUpdates=function(g,p){return g(p)},Qt.useFormState=function(g,p,y){return f.H.useFormState(g,p,y)},Qt.useFormStatus=function(){return f.H.useHostTransitionStatus()},Qt.version="19.2.4",Qt}var Rx;function Zg(){if(Rx)return dd.exports;Rx=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(r){console.error(r)}}return n(),dd.exports=Zb(),dd.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 Ax;function Jb(){if(Ax)return ks;Ax=1;var n=Qb(),r=sf(),s=Zg();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 c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(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 g(e){if(d(e)!==e)throw Error(o(188))}function p(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(o(188));return t!==e?null:e}for(var l=e,i=t;;){var u=l.return;if(u===null)break;var m=u.alternate;if(m===null){if(i=u.return,i!==null){l=i;continue}break}if(u.child===m.child){for(m=u.child;m;){if(m===l)return g(u),e;if(m===i)return g(u),t;m=m.sibling}throw Error(o(188))}if(l.return!==i.return)l=u,i=m;else{for(var b=!1,R=u.child;R;){if(R===l){b=!0,l=u,i=m;break}if(R===i){b=!0,i=u,l=m;break}R=R.sibling}if(!b){for(R=m.child;R;){if(R===l){b=!0,l=m,i=u;break}if(R===i){b=!0,i=m,l=u;break}R=R.sibling}if(!b)throw Error(o(189))}}if(l.alternate!==i)throw Error(o(190))}if(l.tag!==3)throw Error(o(188));return l.stateNode.current===l?e:t}function y(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=y(e),t!==null)return t;e=e.sibling}return null}var v=Object.assign,j=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),z=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),F=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),C=Symbol.for("react.activity"),_=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function K(e){return e===null||typeof e!="object"?null:(e=$&&e[$]||e["@@iterator"],typeof e=="function"?e:null)}var Z=Symbol.for("react.client.reference");function q(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Z?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case N:return"Profiler";case w:return"StrictMode";case M:return"Suspense";case F:return"SuspenseList";case C:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case z:return e.displayName||"Context";case A:return(e._context.displayName||"Context")+".Consumer";case H:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case T:return t=e.displayName||null,t!==null?t:q(e.type)||"Memo";case O:t=e._payload,e=e._init;try{return q(e(t))}catch{}}return null}var I=Array.isArray,L=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P={pending:!1,data:null,method:null,action:null},W=[],ie=-1;function D(e){return{current:e}}function V(e){0>ie||(e.current=W[ie],W[ie]=null,ie--)}function te(e,t){ie++,W[ie]=e.current,e.current=t}var se=D(null),ge=D(null),he=D(null),be=D(null);function ce(e,t){switch(te(he,t),te(ge,e),te(se,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Gh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Gh(t),e=Wh(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}V(se),te(se,e)}function je(){V(se),V(ge),V(he)}function Be(e){e.memoizedState!==null&&te(be,e);var t=se.current,l=Wh(t,e.type);t!==l&&(te(ge,e),te(se,l))}function ze(e){ge.current===e&&(V(se),V(ge)),be.current===e&&(V(be),vs._currentValue=P)}var re,fe;function pe(e){if(re===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);re=t&&t[1]||"",fe=-1<l.stack.indexOf(`
43
- at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
44
- `+re+e+fe}var xe=!1;function ve(e,t){if(!e||xe)return"";xe=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var ue=function(){throw Error()};if(Object.defineProperty(ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ue,[])}catch(ae){var J=ae}Reflect.construct(e,[],ue)}else{try{ue.call()}catch(ae){J=ae}e.call(ue.prototype)}}else{try{throw Error()}catch(ae){J=ae}(ue=e())&&typeof ue.catch=="function"&&ue.catch(function(){})}}catch(ae){if(ae&&J&&typeof ae.stack=="string")return[ae.stack,J.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var m=i.DetermineComponentFrameRoot(),b=m[0],R=m[1];if(b&&R){var U=b.split(`
45
- `),Q=R.split(`
46
- `);for(u=i=0;i<U.length&&!U[i].includes("DetermineComponentFrameRoot");)i++;for(;u<Q.length&&!Q[u].includes("DetermineComponentFrameRoot");)u++;if(i===U.length||u===Q.length)for(i=U.length-1,u=Q.length-1;1<=i&&0<=u&&U[i]!==Q[u];)u--;for(;1<=i&&0<=u;i--,u--)if(U[i]!==Q[u]){if(i!==1||u!==1)do if(i--,u--,0>u||U[i]!==Q[u]){var le=`
47
- `+U[i].replace(" at new "," at ");return e.displayName&&le.includes("<anonymous>")&&(le=le.replace("<anonymous>",e.displayName)),le}while(1<=i&&0<=u);break}}}finally{xe=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?pe(l):""}function Le(e,t){switch(e.tag){case 26:case 27:case 5:return pe(e.type);case 16:return pe("Lazy");case 13:return e.child!==t&&t!==null?pe("Suspense Fallback"):pe("Suspense");case 19:return pe("SuspenseList");case 0:case 15:return ve(e.type,!1);case 11:return ve(e.type.render,!1);case 1:return ve(e.type,!0);case 31:return pe("Activity");default:return""}}function De(e){try{var t="",l=null;do t+=Le(e,l),l=e,e=e.return;while(e);return t}catch(i){return`
48
- Error generating stack: `+i.message+`
49
- `+i.stack}}var ut=Object.prototype.hasOwnProperty,Bt=n.unstable_scheduleCallback,St=n.unstable_cancelCallback,Ct=n.unstable_shouldYield,It=n.unstable_requestPaint,Qe=n.unstable_now,tt=n.unstable_getCurrentPriorityLevel,ee=n.unstable_ImmediatePriority,Te=n.unstable_UserBlockingPriority,Pe=n.unstable_NormalPriority,en=n.unstable_LowPriority,Kn=n.unstable_IdlePriority,Xt=n.log,We=n.unstable_setDisableYieldValue,Mt=null,pt=null;function vt(e){if(typeof Xt=="function"&&We(e),pt&&typeof pt.setStrictMode=="function")try{pt.setStrictMode(Mt,e)}catch{}}var Nt=Math.clz32?Math.clz32:Aa,tn=Math.log,Ir=Math.LN2;function Aa(e){return e>>>=0,e===0?32:31-(tn(e)/Ir|0)|0}var kt=256,Tt=262144,Tn=4194304;function Rn(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 cr(e,t,l){var i=e.pendingLanes;if(i===0)return 0;var u=0,m=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var R=i&134217727;return R!==0?(i=R&~m,i!==0?u=Rn(i):(b&=R,b!==0?u=Rn(b):l||(l=R&~e,l!==0&&(u=Rn(l))))):(R=i&~m,R!==0?u=Rn(R):b!==0?u=Rn(b):l||(l=i&~e,l!==0&&(u=Rn(l)))),u===0?0:t!==0&&t!==u&&(t&m)===0&&(m=u&-u,l=t&-t,m>=l||m===32&&(l&4194048)!==0)?t:u}function Xn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function dt(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 ur(){var e=Tn;return Tn<<=1,(Tn&62914560)===0&&(Tn=4194304),e}function Qn(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function dr(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function nn(e,t,l,i,u,m){var b=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var R=e.entanglements,U=e.expirationTimes,Q=e.hiddenUpdates;for(l=b&~l;0<l;){var le=31-Nt(l),ue=1<<le;R[le]=0,U[le]=-1;var J=Q[le];if(J!==null)for(Q[le]=null,le=0;le<J.length;le++){var ae=J[le];ae!==null&&(ae.lane&=-536870913)}l&=~ue}i!==0&&qo(e,i,0),m!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=m&~(b&~t))}function qo(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-Nt(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|l&261930}function oa(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var i=31-Nt(l),u=1<<i;u&t|e[i]&t&&(e[i]|=t),l&=~u}}function Xs(e,t){var l=t&-t;return l=(l&42)!==0?1:Ko(l),(l&(e.suspendedLanes|t))!==0?0:l}function Ko(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 Xo(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Af(){var e=B.p;return e!==0?e:(e=window.event,e===void 0?32:hx(e.type))}function Mf(e,t){var l=B.p;try{return B.p=e,t()}finally{B.p=l}}var Ma=Math.random().toString(36).slice(2),Gt="__reactFiber$"+Ma,un="__reactProps$"+Ma,Hr="__reactContainer$"+Ma,Qo="__reactEvents$"+Ma,Oy="__reactListeners$"+Ma,By="__reactHandles$"+Ma,Lf="__reactResources$"+Ma,zl="__reactMarker$"+Ma;function Zo(e){delete e[Gt],delete e[un],delete e[Qo],delete e[Oy],delete e[By]}function Ur(e){var t=e[Gt];if(t)return t;for(var l=e.parentNode;l;){if(t=l[Hr]||l[Gt]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=Jh(e);e!==null;){if(l=e[Gt])return l;e=Jh(e)}return t}e=l,l=e.parentNode}return null}function $r(e){if(e=e[Gt]||e[Hr]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Dl(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function Vr(e){var t=e[Lf];return t||(t=e[Lf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Pt(e){e[zl]=!0}var zf=new Set,Df={};function fr(e,t){Pr(e,t),Pr(e+"Capture",t)}function Pr(e,t){for(Df[e]=t,e=0;e<t.length;e++)zf.add(t[e])}var Iy=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]*$"),_f={},Of={};function Hy(e){return ut.call(Of,e)?!0:ut.call(_f,e)?!1:Iy.test(e)?Of[e]=!0:(_f[e]=!0,!1)}function Qs(e,t,l){if(Hy(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var i=t.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="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 ca(e,t,l,i){if(i===null)e.removeAttribute(l);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+i)}}function An(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Bf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Uy(e,t,l){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var u=i.get,m=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(b){l=""+b,m.call(this,b)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return l},setValue:function(b){l=""+b},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Jo(e){if(!e._valueTracker){var t=Bf(e)?"checked":"value";e._valueTracker=Uy(e,t,""+e[t])}}function If(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),i="";return e&&(i=Bf(e)?e.checked?"true":"false":e.value),e=i,e!==l?(t.setValue(e),!0):!1}function Js(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 $y=/[\n"\\]/g;function Mn(e){return e.replace($y,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ec(e,t,l,i,u,m,b,R){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),t!=null?b==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+An(t)):e.value!==""+An(t)&&(e.value=""+An(t)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),t!=null?tc(e,b,An(t)):l!=null?tc(e,b,An(l)):i!=null&&e.removeAttribute("value"),u==null&&m!=null&&(e.defaultChecked=!!m),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?e.name=""+An(R):e.removeAttribute("name")}function Hf(e,t,l,i,u,m,b,R){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(e.type=m),t!=null||l!=null){if(!(m!=="submit"&&m!=="reset"||t!=null)){Jo(e);return}l=l!=null?""+An(l):"",t=t!=null?""+An(t):l,R||t===e.value||(e.value=t),e.defaultValue=t}i=i??u,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=R?e.checked:!!i,e.defaultChecked=!!i,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),Jo(e)}function tc(e,t,l){t==="number"&&Js(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Fr(e,t,l,i){if(e=e.options,t){t={};for(var u=0;u<l.length;u++)t["$"+l[u]]=!0;for(l=0;l<e.length;l++)u=t.hasOwnProperty("$"+e[l].value),e[l].selected!==u&&(e[l].selected=u),u&&i&&(e[l].defaultSelected=!0)}else{for(l=""+An(l),t=null,u=0;u<e.length;u++){if(e[u].value===l){e[u].selected=!0,i&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function Uf(e,t,l){if(t!=null&&(t=""+An(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+An(l):""}function $f(e,t,l,i){if(t==null){if(i!=null){if(l!=null)throw Error(o(92));if(I(i)){if(1<i.length)throw Error(o(93));i=i[0]}l=i}l==null&&(l=""),t=l}l=An(t),e.defaultValue=l,i=e.textContent,i===l&&i!==""&&i!==null&&(e.value=i),Jo(e)}function Gr(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var Vy=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 Vf(e,t,l){var i=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,l):typeof l!="number"||l===0||Vy.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function Pf(e,t,l){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,l!=null){for(var i in l)!l.hasOwnProperty(i)||t!=null&&t.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="");for(var u in t)i=t[u],t.hasOwnProperty(u)&&l[u]!==i&&Vf(e,u,i)}else for(var m in t)t.hasOwnProperty(m)&&Vf(e,m,t[m])}function nc(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 Py=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"]]),Fy=/^[\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 ei(e){return Fy.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ua(){}var ac=null;function rc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Wr=null,Yr=null;function Ff(e){var t=$r(e);if(t&&(e=t.stateNode)){var l=e[un]||null;e:switch(e=t.stateNode,t.type){case"input":if(ec(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="'+Mn(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var i=l[t];if(i!==e&&i.form===e.form){var u=i[un]||null;if(!u)throw Error(o(90));ec(i,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<l.length;t++)i=l[t],i.form===e.form&&If(i)}break e;case"textarea":Uf(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&Fr(e,!!l.multiple,t,!1)}}}var lc=!1;function Gf(e,t,l){if(lc)return e(t,l);lc=!0;try{var i=e(t);return i}finally{if(lc=!1,(Wr!==null||Yr!==null)&&($i(),Wr&&(t=Wr,e=Yr,Yr=Wr=null,Ff(t),e)))for(t=0;t<e.length;t++)Ff(e[t])}}function _l(e,t){var l=e.stateNode;if(l===null)return null;var i=l[un]||null;if(i===null)return null;l=i[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":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(o(231,t,typeof l));return l}var da=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),sc=!1;if(da)try{var Ol={};Object.defineProperty(Ol,"passive",{get:function(){sc=!0}}),window.addEventListener("test",Ol,Ol),window.removeEventListener("test",Ol,Ol)}catch{sc=!1}var La=null,ic=null,ti=null;function Wf(){if(ti)return ti;var e,t=ic,l=t.length,i,u="value"in La?La.value:La.textContent,m=u.length;for(e=0;e<l&&t[e]===u[e];e++);var b=l-e;for(i=1;i<=b&&t[l-i]===u[m-i];i++);return ti=u.slice(e,1<i?1-i:void 0)}function ni(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 ai(){return!0}function Yf(){return!1}function dn(e){function t(l,i,u,m,b){this._reactName=l,this._targetInst=u,this.type=i,this.nativeEvent=m,this.target=b,this.currentTarget=null;for(var R in e)e.hasOwnProperty(R)&&(l=e[R],this[R]=l?l(m):m[R]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?ai:Yf,this.isPropagationStopped=Yf,this}return v(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=ai)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=ai)},persist:function(){},isPersistent:ai}),t}var pr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ri=dn(pr),Bl=v({},pr,{view:0,detail:0}),Gy=dn(Bl),oc,cc,Il,li=v({},Bl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:dc,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!==Il&&(Il&&e.type==="mousemove"?(oc=e.screenX-Il.screenX,cc=e.screenY-Il.screenY):cc=oc=0,Il=e),oc)},movementY:function(e){return"movementY"in e?e.movementY:cc}}),qf=dn(li),Wy=v({},li,{dataTransfer:0}),Yy=dn(Wy),qy=v({},Bl,{relatedTarget:0}),uc=dn(qy),Ky=v({},pr,{animationName:0,elapsedTime:0,pseudoElement:0}),Xy=dn(Ky),Qy=v({},pr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Zy=dn(Qy),Jy=v({},pr,{data:0}),Kf=dn(Jy),e1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},t1={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"},n1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function a1(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=n1[e])?!!t[e]:!1}function dc(){return a1}var r1=v({},Bl,{key:function(e){if(e.key){var t=e1[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ni(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?t1[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:dc,charCode:function(e){return e.type==="keypress"?ni(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ni(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),l1=dn(r1),s1=v({},li,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Xf=dn(s1),i1=v({},Bl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:dc}),o1=dn(i1),c1=v({},pr,{propertyName:0,elapsedTime:0,pseudoElement:0}),u1=dn(c1),d1=v({},li,{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}),f1=dn(d1),p1=v({},pr,{newState:0,oldState:0}),m1=dn(p1),h1=[9,13,27,32],fc=da&&"CompositionEvent"in window,Hl=null;da&&"documentMode"in document&&(Hl=document.documentMode);var x1=da&&"TextEvent"in window&&!Hl,Qf=da&&(!fc||Hl&&8<Hl&&11>=Hl),Zf=" ",Jf=!1;function ep(e,t){switch(e){case"keyup":return h1.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function tp(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var qr=!1;function g1(e,t){switch(e){case"compositionend":return tp(t);case"keypress":return t.which!==32?null:(Jf=!0,Zf);case"textInput":return e=t.data,e===Zf&&Jf?null:e;default:return null}}function v1(e,t){if(qr)return e==="compositionend"||!fc&&ep(e,t)?(e=Wf(),ti=ic=La=null,qr=!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 Qf&&t.locale!=="ko"?null:t.data;default:return null}}var y1={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 np(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!y1[e.type]:t==="textarea"}function ap(e,t,l,i){Wr?Yr?Yr.push(i):Yr=[i]:Wr=i,t=qi(t,"onChange"),0<t.length&&(l=new ri("onChange","change",null,l,i),e.push({event:l,listeners:t}))}var Ul=null,$l=null;function b1(e){Hh(e,0)}function si(e){var t=Dl(e);if(If(t))return e}function rp(e,t){if(e==="change")return t}var lp=!1;if(da){var pc;if(da){var mc="oninput"in document;if(!mc){var sp=document.createElement("div");sp.setAttribute("oninput","return;"),mc=typeof sp.oninput=="function"}pc=mc}else pc=!1;lp=pc&&(!document.documentMode||9<document.documentMode)}function ip(){Ul&&(Ul.detachEvent("onpropertychange",op),$l=Ul=null)}function op(e){if(e.propertyName==="value"&&si($l)){var t=[];ap(t,$l,e,rc(e)),Gf(b1,t)}}function j1(e,t,l){e==="focusin"?(ip(),Ul=t,$l=l,Ul.attachEvent("onpropertychange",op)):e==="focusout"&&ip()}function S1(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return si($l)}function k1(e,t){if(e==="click")return si(t)}function w1(e,t){if(e==="input"||e==="change")return si(t)}function E1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var gn=typeof Object.is=="function"?Object.is:E1;function Vl(e,t){if(gn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),i=Object.keys(t);if(l.length!==i.length)return!1;for(i=0;i<l.length;i++){var u=l[i];if(!ut.call(t,u)||!gn(e[u],t[u]))return!1}return!0}function cp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function up(e,t){var l=cp(e);e=0;for(var i;l;){if(l.nodeType===3){if(i=e+l.textContent.length,e<=t&&i>=t)return{node:l,offset:t-e};e=i}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=cp(l)}}function dp(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?dp(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function fp(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Js(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=Js(e.document)}return t}function hc(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 C1=da&&"documentMode"in document&&11>=document.documentMode,Kr=null,xc=null,Pl=null,gc=!1;function pp(e,t,l){var i=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;gc||Kr==null||Kr!==Js(i)||(i=Kr,"selectionStart"in i&&hc(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Pl&&Vl(Pl,i)||(Pl=i,i=qi(xc,"onSelect"),0<i.length&&(t=new ri("onSelect","select",null,t,l),e.push({event:t,listeners:i}),t.target=Kr)))}function mr(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var Xr={animationend:mr("Animation","AnimationEnd"),animationiteration:mr("Animation","AnimationIteration"),animationstart:mr("Animation","AnimationStart"),transitionrun:mr("Transition","TransitionRun"),transitionstart:mr("Transition","TransitionStart"),transitioncancel:mr("Transition","TransitionCancel"),transitionend:mr("Transition","TransitionEnd")},vc={},mp={};da&&(mp=document.createElement("div").style,"AnimationEvent"in window||(delete Xr.animationend.animation,delete Xr.animationiteration.animation,delete Xr.animationstart.animation),"TransitionEvent"in window||delete Xr.transitionend.transition);function hr(e){if(vc[e])return vc[e];if(!Xr[e])return e;var t=Xr[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in mp)return vc[e]=t[l];return e}var hp=hr("animationend"),xp=hr("animationiteration"),gp=hr("animationstart"),N1=hr("transitionrun"),T1=hr("transitionstart"),R1=hr("transitioncancel"),vp=hr("transitionend"),yp=new Map,yc="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(" ");yc.push("scrollEnd");function Pn(e,t){yp.set(e,t),fr(t,[e])}var ii=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)},Ln=[],Qr=0,bc=0;function oi(){for(var e=Qr,t=bc=Qr=0;t<e;){var l=Ln[t];Ln[t++]=null;var i=Ln[t];Ln[t++]=null;var u=Ln[t];Ln[t++]=null;var m=Ln[t];if(Ln[t++]=null,i!==null&&u!==null){var b=i.pending;b===null?u.next=u:(u.next=b.next,b.next=u),i.pending=u}m!==0&&bp(l,u,m)}}function ci(e,t,l,i){Ln[Qr++]=e,Ln[Qr++]=t,Ln[Qr++]=l,Ln[Qr++]=i,bc|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function jc(e,t,l,i){return ci(e,t,l,i),ui(e)}function xr(e,t){return ci(e,null,null,t),ui(e)}function bp(e,t,l){e.lanes|=l;var i=e.alternate;i!==null&&(i.lanes|=l);for(var u=!1,m=e.return;m!==null;)m.childLanes|=l,i=m.alternate,i!==null&&(i.childLanes|=l),m.tag===22&&(e=m.stateNode,e===null||e._visibility&1||(u=!0)),e=m,m=m.return;return e.tag===3?(m=e.stateNode,u&&t!==null&&(u=31-Nt(l),e=m.hiddenUpdates,i=e[u],i===null?e[u]=[t]:i.push(t),t.lane=l|536870912),m):null}function ui(e){if(50<ds)throw ds=0,Au=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Zr={};function A1(e,t,l,i){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=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vn(e,t,l,i){return new A1(e,t,l,i)}function Sc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function fa(e,t){var l=e.alternate;return l===null?(l=vn(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 jp(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 di(e,t,l,i,u,m){var b=0;if(i=e,typeof e=="function")Sc(e)&&(b=1);else if(typeof e=="string")b=_b(e,l,se.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case C:return e=vn(31,l,t,u),e.elementType=C,e.lanes=m,e;case E:return gr(l.children,u,m,t);case w:b=8,u|=24;break;case N:return e=vn(12,l,t,u|2),e.elementType=N,e.lanes=m,e;case M:return e=vn(13,l,t,u),e.elementType=M,e.lanes=m,e;case F:return e=vn(19,l,t,u),e.elementType=F,e.lanes=m,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case z:b=10;break e;case A:b=9;break e;case H:b=11;break e;case T:b=14;break e;case O:b=16,i=null;break e}b=29,l=Error(o(130,e===null?"null":typeof e,"")),i=null}return t=vn(b,l,t,u),t.elementType=e,t.type=i,t.lanes=m,t}function gr(e,t,l,i){return e=vn(7,e,i,t),e.lanes=l,e}function kc(e,t,l){return e=vn(6,e,null,t),e.lanes=l,e}function Sp(e){var t=vn(18,null,null,0);return t.stateNode=e,t}function wc(e,t,l){return t=vn(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var kp=new WeakMap;function zn(e,t){if(typeof e=="object"&&e!==null){var l=kp.get(e);return l!==void 0?l:(t={value:e,source:t,stack:De(t)},kp.set(e,t),t)}return{value:e,source:t,stack:De(t)}}var Jr=[],el=0,fi=null,Fl=0,Dn=[],_n=0,za=null,Zn=1,Jn="";function pa(e,t){Jr[el++]=Fl,Jr[el++]=fi,fi=e,Fl=t}function wp(e,t,l){Dn[_n++]=Zn,Dn[_n++]=Jn,Dn[_n++]=za,za=e;var i=Zn;e=Jn;var u=32-Nt(i)-1;i&=~(1<<u),l+=1;var m=32-Nt(t)+u;if(30<m){var b=u-u%5;m=(i&(1<<b)-1).toString(32),i>>=b,u-=b,Zn=1<<32-Nt(t)+u|l<<u|i,Jn=m+e}else Zn=1<<m|l<<u|i,Jn=e}function Ec(e){e.return!==null&&(pa(e,1),wp(e,1,0))}function Cc(e){for(;e===fi;)fi=Jr[--el],Jr[el]=null,Fl=Jr[--el],Jr[el]=null;for(;e===za;)za=Dn[--_n],Dn[_n]=null,Jn=Dn[--_n],Dn[_n]=null,Zn=Dn[--_n],Dn[_n]=null}function Ep(e,t){Dn[_n++]=Zn,Dn[_n++]=Jn,Dn[_n++]=za,Zn=t.id,Jn=t.overflow,za=e}var Wt=null,mt=null,Ke=!1,Da=null,On=!1,Nc=Error(o(519));function _a(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Gl(zn(t,e)),Nc}function Cp(e){var t=e.stateNode,l=e.type,i=e.memoizedProps;switch(t[Gt]=e,t[un]=i,l){case"dialog":Ge("cancel",t),Ge("close",t);break;case"iframe":case"object":case"embed":Ge("load",t);break;case"video":case"audio":for(l=0;l<ps.length;l++)Ge(ps[l],t);break;case"source":Ge("error",t);break;case"img":case"image":case"link":Ge("error",t),Ge("load",t);break;case"details":Ge("toggle",t);break;case"input":Ge("invalid",t),Hf(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":Ge("invalid",t);break;case"textarea":Ge("invalid",t),$f(t,i.value,i.defaultValue,i.children)}l=i.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||i.suppressHydrationWarning===!0||Ph(t.textContent,l)?(i.popover!=null&&(Ge("beforetoggle",t),Ge("toggle",t)),i.onScroll!=null&&Ge("scroll",t),i.onScrollEnd!=null&&Ge("scrollend",t),i.onClick!=null&&(t.onclick=ua),t=!0):t=!1,t||_a(e,!0)}function Np(e){for(Wt=e.return;Wt;)switch(Wt.tag){case 5:case 31:case 13:On=!1;return;case 27:case 3:On=!0;return;default:Wt=Wt.return}}function tl(e){if(e!==Wt)return!1;if(!Ke)return Np(e),Ke=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||Gu(e.type,e.memoizedProps)),l=!l),l&&mt&&_a(e),Np(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));mt=Zh(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));mt=Zh(e)}else t===27?(t=mt,Ka(e.type)?(e=Xu,Xu=null,mt=e):mt=t):mt=Wt?In(e.stateNode.nextSibling):null;return!0}function vr(){mt=Wt=null,Ke=!1}function Tc(){var e=Da;return e!==null&&(hn===null?hn=e:hn.push.apply(hn,e),Da=null),e}function Gl(e){Da===null?Da=[e]:Da.push(e)}var Rc=D(null),yr=null,ma=null;function Oa(e,t,l){te(Rc,t._currentValue),t._currentValue=l}function ha(e){e._currentValue=Rc.current,V(Rc)}function Ac(e,t,l){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===l)break;e=e.return}}function Mc(e,t,l,i){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var m=u.dependencies;if(m!==null){var b=u.child;m=m.firstContext;e:for(;m!==null;){var R=m;m=u;for(var U=0;U<t.length;U++)if(R.context===t[U]){m.lanes|=l,R=m.alternate,R!==null&&(R.lanes|=l),Ac(m.return,l,e),i||(b=null);break e}m=R.next}}else if(u.tag===18){if(b=u.return,b===null)throw Error(o(341));b.lanes|=l,m=b.alternate,m!==null&&(m.lanes|=l),Ac(b,l,e),b=null}else b=u.child;if(b!==null)b.return=u;else for(b=u;b!==null;){if(b===e){b=null;break}if(u=b.sibling,u!==null){u.return=b.return,b=u;break}b=b.return}u=b}}function nl(e,t,l,i){e=null;for(var u=t,m=!1;u!==null;){if(!m){if((u.flags&524288)!==0)m=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var b=u.alternate;if(b===null)throw Error(o(387));if(b=b.memoizedProps,b!==null){var R=u.type;gn(u.pendingProps.value,b.value)||(e!==null?e.push(R):e=[R])}}else if(u===be.current){if(b=u.alternate,b===null)throw Error(o(387));b.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(vs):e=[vs])}u=u.return}e!==null&&Mc(t,e,l,i),t.flags|=262144}function pi(e){for(e=e.firstContext;e!==null;){if(!gn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function br(e){yr=e,ma=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Yt(e){return Tp(yr,e)}function mi(e,t){return yr===null&&br(e),Tp(e,t)}function Tp(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},ma===null){if(e===null)throw Error(o(308));ma=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ma=ma.next=t;return l}var M1=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},L1=n.unstable_scheduleCallback,z1=n.unstable_NormalPriority,Lt={$$typeof:z,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Lc(){return{controller:new M1,data:new Map,refCount:0}}function Wl(e){e.refCount--,e.refCount===0&&L1(z1,function(){e.controller.abort()})}var Yl=null,zc=0,al=0,rl=null;function D1(e,t){if(Yl===null){var l=Yl=[];zc=0,al=Ou(),rl={status:"pending",value:void 0,then:function(i){l.push(i)}}}return zc++,t.then(Rp,Rp),t}function Rp(){if(--zc===0&&Yl!==null){rl!==null&&(rl.status="fulfilled");var e=Yl;Yl=null,al=0,rl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function _1(e,t){var l=[],i={status:"pending",value:null,reason:null,then:function(u){l.push(u)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var u=0;u<l.length;u++)(0,l[u])(t)},function(u){for(i.status="rejected",i.reason=u,u=0;u<l.length;u++)(0,l[u])(void 0)}),i}var Ap=L.S;L.S=function(e,t){ph=Qe(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&D1(e,t),Ap!==null&&Ap(e,t)};var jr=D(null);function Dc(){var e=jr.current;return e!==null?e:ft.pooledCache}function hi(e,t){t===null?te(jr,jr.current):te(jr,t.pool)}function Mp(){var e=Dc();return e===null?null:{parent:Lt._currentValue,pool:e}}var ll=Error(o(460)),_c=Error(o(474)),xi=Error(o(542)),gi={then:function(){}};function Lp(e){return e=e.status,e==="fulfilled"||e==="rejected"}function zp(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(ua,ua),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,_p(e),e;default:if(typeof t.status=="string")t.then(ua,ua);else{if(e=ft,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=i}},function(i){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,_p(e),e}throw kr=t,ll}}function Sr(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(kr=l,ll):l}}var kr=null;function Dp(){if(kr===null)throw Error(o(459));var e=kr;return kr=null,e}function _p(e){if(e===ll||e===xi)throw Error(o(483))}var sl=null,ql=0;function vi(e){var t=ql;return ql+=1,sl===null&&(sl=[]),zp(sl,e,t)}function Kl(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function yi(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 Op(e){function t(Y,G){if(e){var X=Y.deletions;X===null?(Y.deletions=[G],Y.flags|=16):X.push(G)}}function l(Y,G){if(!e)return null;for(;G!==null;)t(Y,G),G=G.sibling;return null}function i(Y){for(var G=new Map;Y!==null;)Y.key!==null?G.set(Y.key,Y):G.set(Y.index,Y),Y=Y.sibling;return G}function u(Y,G){return Y=fa(Y,G),Y.index=0,Y.sibling=null,Y}function m(Y,G,X){return Y.index=X,e?(X=Y.alternate,X!==null?(X=X.index,X<G?(Y.flags|=67108866,G):X):(Y.flags|=67108866,G)):(Y.flags|=1048576,G)}function b(Y){return e&&Y.alternate===null&&(Y.flags|=67108866),Y}function R(Y,G,X,oe){return G===null||G.tag!==6?(G=kc(X,Y.mode,oe),G.return=Y,G):(G=u(G,X),G.return=Y,G)}function U(Y,G,X,oe){var Ne=X.type;return Ne===E?le(Y,G,X.props.children,oe,X.key):G!==null&&(G.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===O&&Sr(Ne)===G.type)?(G=u(G,X.props),Kl(G,X),G.return=Y,G):(G=di(X.type,X.key,X.props,null,Y.mode,oe),Kl(G,X),G.return=Y,G)}function Q(Y,G,X,oe){return G===null||G.tag!==4||G.stateNode.containerInfo!==X.containerInfo||G.stateNode.implementation!==X.implementation?(G=wc(X,Y.mode,oe),G.return=Y,G):(G=u(G,X.children||[]),G.return=Y,G)}function le(Y,G,X,oe,Ne){return G===null||G.tag!==7?(G=gr(X,Y.mode,oe,Ne),G.return=Y,G):(G=u(G,X),G.return=Y,G)}function ue(Y,G,X){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=kc(""+G,Y.mode,X),G.return=Y,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case S:return X=di(G.type,G.key,G.props,null,Y.mode,X),Kl(X,G),X.return=Y,X;case k:return G=wc(G,Y.mode,X),G.return=Y,G;case O:return G=Sr(G),ue(Y,G,X)}if(I(G)||K(G))return G=gr(G,Y.mode,X,null),G.return=Y,G;if(typeof G.then=="function")return ue(Y,vi(G),X);if(G.$$typeof===z)return ue(Y,mi(Y,G),X);yi(Y,G)}return null}function J(Y,G,X,oe){var Ne=G!==null?G.key:null;if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return Ne!==null?null:R(Y,G,""+X,oe);if(typeof X=="object"&&X!==null){switch(X.$$typeof){case S:return X.key===Ne?U(Y,G,X,oe):null;case k:return X.key===Ne?Q(Y,G,X,oe):null;case O:return X=Sr(X),J(Y,G,X,oe)}if(I(X)||K(X))return Ne!==null?null:le(Y,G,X,oe,null);if(typeof X.then=="function")return J(Y,G,vi(X),oe);if(X.$$typeof===z)return J(Y,G,mi(Y,X),oe);yi(Y,X)}return null}function ae(Y,G,X,oe,Ne){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return Y=Y.get(X)||null,R(G,Y,""+oe,Ne);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case S:return Y=Y.get(oe.key===null?X:oe.key)||null,U(G,Y,oe,Ne);case k:return Y=Y.get(oe.key===null?X:oe.key)||null,Q(G,Y,oe,Ne);case O:return oe=Sr(oe),ae(Y,G,X,oe,Ne)}if(I(oe)||K(oe))return Y=Y.get(X)||null,le(G,Y,oe,Ne,null);if(typeof oe.then=="function")return ae(Y,G,X,vi(oe),Ne);if(oe.$$typeof===z)return ae(Y,G,X,mi(G,oe),Ne);yi(G,oe)}return null}function Se(Y,G,X,oe){for(var Ne=null,Ze=null,ke=G,He=G=0,qe=null;ke!==null&&He<X.length;He++){ke.index>He?(qe=ke,ke=null):qe=ke.sibling;var Je=J(Y,ke,X[He],oe);if(Je===null){ke===null&&(ke=qe);break}e&&ke&&Je.alternate===null&&t(Y,ke),G=m(Je,G,He),Ze===null?Ne=Je:Ze.sibling=Je,Ze=Je,ke=qe}if(He===X.length)return l(Y,ke),Ke&&pa(Y,He),Ne;if(ke===null){for(;He<X.length;He++)ke=ue(Y,X[He],oe),ke!==null&&(G=m(ke,G,He),Ze===null?Ne=ke:Ze.sibling=ke,Ze=ke);return Ke&&pa(Y,He),Ne}for(ke=i(ke);He<X.length;He++)qe=ae(ke,Y,He,X[He],oe),qe!==null&&(e&&qe.alternate!==null&&ke.delete(qe.key===null?He:qe.key),G=m(qe,G,He),Ze===null?Ne=qe:Ze.sibling=qe,Ze=qe);return e&&ke.forEach(function(er){return t(Y,er)}),Ke&&pa(Y,He),Ne}function Re(Y,G,X,oe){if(X==null)throw Error(o(151));for(var Ne=null,Ze=null,ke=G,He=G=0,qe=null,Je=X.next();ke!==null&&!Je.done;He++,Je=X.next()){ke.index>He?(qe=ke,ke=null):qe=ke.sibling;var er=J(Y,ke,Je.value,oe);if(er===null){ke===null&&(ke=qe);break}e&&ke&&er.alternate===null&&t(Y,ke),G=m(er,G,He),Ze===null?Ne=er:Ze.sibling=er,Ze=er,ke=qe}if(Je.done)return l(Y,ke),Ke&&pa(Y,He),Ne;if(ke===null){for(;!Je.done;He++,Je=X.next())Je=ue(Y,Je.value,oe),Je!==null&&(G=m(Je,G,He),Ze===null?Ne=Je:Ze.sibling=Je,Ze=Je);return Ke&&pa(Y,He),Ne}for(ke=i(ke);!Je.done;He++,Je=X.next())Je=ae(ke,Y,He,Je.value,oe),Je!==null&&(e&&Je.alternate!==null&&ke.delete(Je.key===null?He:Je.key),G=m(Je,G,He),Ze===null?Ne=Je:Ze.sibling=Je,Ze=Je);return e&&ke.forEach(function(Wb){return t(Y,Wb)}),Ke&&pa(Y,He),Ne}function ot(Y,G,X,oe){if(typeof X=="object"&&X!==null&&X.type===E&&X.key===null&&(X=X.props.children),typeof X=="object"&&X!==null){switch(X.$$typeof){case S:e:{for(var Ne=X.key;G!==null;){if(G.key===Ne){if(Ne=X.type,Ne===E){if(G.tag===7){l(Y,G.sibling),oe=u(G,X.props.children),oe.return=Y,Y=oe;break e}}else if(G.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===O&&Sr(Ne)===G.type){l(Y,G.sibling),oe=u(G,X.props),Kl(oe,X),oe.return=Y,Y=oe;break e}l(Y,G);break}else t(Y,G);G=G.sibling}X.type===E?(oe=gr(X.props.children,Y.mode,oe,X.key),oe.return=Y,Y=oe):(oe=di(X.type,X.key,X.props,null,Y.mode,oe),Kl(oe,X),oe.return=Y,Y=oe)}return b(Y);case k:e:{for(Ne=X.key;G!==null;){if(G.key===Ne)if(G.tag===4&&G.stateNode.containerInfo===X.containerInfo&&G.stateNode.implementation===X.implementation){l(Y,G.sibling),oe=u(G,X.children||[]),oe.return=Y,Y=oe;break e}else{l(Y,G);break}else t(Y,G);G=G.sibling}oe=wc(X,Y.mode,oe),oe.return=Y,Y=oe}return b(Y);case O:return X=Sr(X),ot(Y,G,X,oe)}if(I(X))return Se(Y,G,X,oe);if(K(X)){if(Ne=K(X),typeof Ne!="function")throw Error(o(150));return X=Ne.call(X),Re(Y,G,X,oe)}if(typeof X.then=="function")return ot(Y,G,vi(X),oe);if(X.$$typeof===z)return ot(Y,G,mi(Y,X),oe);yi(Y,X)}return typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint"?(X=""+X,G!==null&&G.tag===6?(l(Y,G.sibling),oe=u(G,X),oe.return=Y,Y=oe):(l(Y,G),oe=kc(X,Y.mode,oe),oe.return=Y,Y=oe),b(Y)):l(Y,G)}return function(Y,G,X,oe){try{ql=0;var Ne=ot(Y,G,X,oe);return sl=null,Ne}catch(ke){if(ke===ll||ke===xi)throw ke;var Ze=vn(29,ke,null,Y.mode);return Ze.lanes=oe,Ze.return=Y,Ze}finally{}}}var wr=Op(!0),Bp=Op(!1),Ba=!1;function Oc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Bc(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 Ia(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ha(e,t,l){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(nt&2)!==0){var u=i.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),i.pending=t,t=ui(e),bp(e,null,l),t}return ci(e,i,t,l),ui(e)}function Xl(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,l|=i,t.lanes=l,oa(e,l)}}function Ic(e,t){var l=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,l===i)){var u=null,m=null;if(l=l.firstBaseUpdate,l!==null){do{var b={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};m===null?u=m=b:m=m.next=b,l=l.next}while(l!==null);m===null?u=m=t:m=m.next=t}else u=m=t;l={baseState:i.baseState,firstBaseUpdate:u,lastBaseUpdate:m,shared:i.shared,callbacks:i.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var Hc=!1;function Ql(){if(Hc){var e=rl;if(e!==null)throw e}}function Zl(e,t,l,i){Hc=!1;var u=e.updateQueue;Ba=!1;var m=u.firstBaseUpdate,b=u.lastBaseUpdate,R=u.shared.pending;if(R!==null){u.shared.pending=null;var U=R,Q=U.next;U.next=null,b===null?m=Q:b.next=Q,b=U;var le=e.alternate;le!==null&&(le=le.updateQueue,R=le.lastBaseUpdate,R!==b&&(R===null?le.firstBaseUpdate=Q:R.next=Q,le.lastBaseUpdate=U))}if(m!==null){var ue=u.baseState;b=0,le=Q=U=null,R=m;do{var J=R.lane&-536870913,ae=J!==R.lane;if(ae?(Ye&J)===J:(i&J)===J){J!==0&&J===al&&(Hc=!0),le!==null&&(le=le.next={lane:0,tag:R.tag,payload:R.payload,callback:null,next:null});e:{var Se=e,Re=R;J=t;var ot=l;switch(Re.tag){case 1:if(Se=Re.payload,typeof Se=="function"){ue=Se.call(ot,ue,J);break e}ue=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Re.payload,J=typeof Se=="function"?Se.call(ot,ue,J):Se,J==null)break e;ue=v({},ue,J);break e;case 2:Ba=!0}}J=R.callback,J!==null&&(e.flags|=64,ae&&(e.flags|=8192),ae=u.callbacks,ae===null?u.callbacks=[J]:ae.push(J))}else ae={lane:J,tag:R.tag,payload:R.payload,callback:R.callback,next:null},le===null?(Q=le=ae,U=ue):le=le.next=ae,b|=J;if(R=R.next,R===null){if(R=u.shared.pending,R===null)break;ae=R,R=ae.next,ae.next=null,u.lastBaseUpdate=ae,u.shared.pending=null}}while(!0);le===null&&(U=ue),u.baseState=U,u.firstBaseUpdate=Q,u.lastBaseUpdate=le,m===null&&(u.shared.lanes=0),Fa|=b,e.lanes=b,e.memoizedState=ue}}function Ip(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function Hp(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)Ip(l[e],t)}var il=D(null),bi=D(0);function Up(e,t){e=wa,te(bi,e),te(il,t),wa=e|t.baseLanes}function Uc(){te(bi,wa),te(il,il.current)}function $c(){wa=bi.current,V(il),V(bi)}var yn=D(null),Bn=null;function Ua(e){var t=e.alternate;te(Rt,Rt.current&1),te(yn,e),Bn===null&&(t===null||il.current!==null||t.memoizedState!==null)&&(Bn=e)}function Vc(e){te(Rt,Rt.current),te(yn,e),Bn===null&&(Bn=e)}function $p(e){e.tag===22?(te(Rt,Rt.current),te(yn,e),Bn===null&&(Bn=e)):$a()}function $a(){te(Rt,Rt.current),te(yn,yn.current)}function bn(e){V(yn),Bn===e&&(Bn=null),V(Rt)}var Rt=D(0);function ji(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||qu(l)||Ku(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 xa=0,Ie=null,st=null,zt=null,Si=!1,ol=!1,Er=!1,ki=0,Jl=0,cl=null,O1=0;function wt(){throw Error(o(321))}function Pc(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!gn(e[l],t[l]))return!1;return!0}function Fc(e,t,l,i,u,m){return xa=m,Ie=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,L.H=e===null||e.memoizedState===null?wm:lu,Er=!1,m=l(i,u),Er=!1,ol&&(m=Pp(t,l,i,u)),Vp(e),m}function Vp(e){L.H=ns;var t=st!==null&&st.next!==null;if(xa=0,zt=st=Ie=null,Si=!1,Jl=0,cl=null,t)throw Error(o(300));e===null||Dt||(e=e.dependencies,e!==null&&pi(e)&&(Dt=!0))}function Pp(e,t,l,i){Ie=e;var u=0;do{if(ol&&(cl=null),Jl=0,ol=!1,25<=u)throw Error(o(301));if(u+=1,zt=st=null,e.updateQueue!=null){var m=e.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}L.H=Em,m=t(l,i)}while(ol);return m}function B1(){var e=L.H,t=e.useState()[0];return t=typeof t.then=="function"?es(t):t,e=e.useState()[0],(st!==null?st.memoizedState:null)!==e&&(Ie.flags|=1024),t}function Gc(){var e=ki!==0;return ki=0,e}function Wc(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function Yc(e){if(Si){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Si=!1}xa=0,zt=st=Ie=null,ol=!1,Jl=ki=0,cl=null}function an(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return zt===null?Ie.memoizedState=zt=e:zt=zt.next=e,zt}function At(){if(st===null){var e=Ie.alternate;e=e!==null?e.memoizedState:null}else e=st.next;var t=zt===null?Ie.memoizedState:zt.next;if(t!==null)zt=t,st=e;else{if(e===null)throw Ie.alternate===null?Error(o(467)):Error(o(310));st=e,e={memoizedState:st.memoizedState,baseState:st.baseState,baseQueue:st.baseQueue,queue:st.queue,next:null},zt===null?Ie.memoizedState=zt=e:zt=zt.next=e}return zt}function wi(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function es(e){var t=Jl;return Jl+=1,cl===null&&(cl=[]),e=zp(cl,e,t),t=Ie,(zt===null?t.memoizedState:zt.next)===null&&(t=t.alternate,L.H=t===null||t.memoizedState===null?wm:lu),e}function Ei(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return es(e);if(e.$$typeof===z)return Yt(e)}throw Error(o(438,String(e)))}function qc(e){var t=null,l=Ie.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var i=Ie.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=wi(),Ie.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),i=0;i<e;i++)l[i]=_;return t.index++,l}function ga(e,t){return typeof t=="function"?t(e):t}function Ci(e){var t=At();return Kc(t,st,e)}function Kc(e,t,l){var i=e.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=l;var u=e.baseQueue,m=i.pending;if(m!==null){if(u!==null){var b=u.next;u.next=m.next,m.next=b}t.baseQueue=u=m,i.pending=null}if(m=e.baseState,u===null)e.memoizedState=m;else{t=u.next;var R=b=null,U=null,Q=t,le=!1;do{var ue=Q.lane&-536870913;if(ue!==Q.lane?(Ye&ue)===ue:(xa&ue)===ue){var J=Q.revertLane;if(J===0)U!==null&&(U=U.next={lane:0,revertLane:0,gesture:null,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null}),ue===al&&(le=!0);else if((xa&J)===J){Q=Q.next,J===al&&(le=!0);continue}else ue={lane:0,revertLane:Q.revertLane,gesture:null,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null},U===null?(R=U=ue,b=m):U=U.next=ue,Ie.lanes|=J,Fa|=J;ue=Q.action,Er&&l(m,ue),m=Q.hasEagerState?Q.eagerState:l(m,ue)}else J={lane:ue,revertLane:Q.revertLane,gesture:Q.gesture,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null},U===null?(R=U=J,b=m):U=U.next=J,Ie.lanes|=ue,Fa|=ue;Q=Q.next}while(Q!==null&&Q!==t);if(U===null?b=m:U.next=R,!gn(m,e.memoizedState)&&(Dt=!0,le&&(l=rl,l!==null)))throw l;e.memoizedState=m,e.baseState=b,e.baseQueue=U,i.lastRenderedState=m}return u===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function Xc(e){var t=At(),l=t.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=e;var i=l.dispatch,u=l.pending,m=t.memoizedState;if(u!==null){l.pending=null;var b=u=u.next;do m=e(m,b.action),b=b.next;while(b!==u);gn(m,t.memoizedState)||(Dt=!0),t.memoizedState=m,t.baseQueue===null&&(t.baseState=m),l.lastRenderedState=m}return[m,i]}function Fp(e,t,l){var i=Ie,u=At(),m=Ke;if(m){if(l===void 0)throw Error(o(407));l=l()}else l=t();var b=!gn((st||u).memoizedState,l);if(b&&(u.memoizedState=l,Dt=!0),u=u.queue,Jc(Yp.bind(null,i,u,e),[e]),u.getSnapshot!==t||b||zt!==null&&zt.memoizedState.tag&1){if(i.flags|=2048,ul(9,{destroy:void 0},Wp.bind(null,i,u,l,t),null),ft===null)throw Error(o(349));m||(xa&127)!==0||Gp(i,t,l)}return l}function Gp(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=Ie.updateQueue,t===null?(t=wi(),Ie.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function Wp(e,t,l,i){t.value=l,t.getSnapshot=i,qp(t)&&Kp(e)}function Yp(e,t,l){return l(function(){qp(t)&&Kp(e)})}function qp(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!gn(e,l)}catch{return!0}}function Kp(e){var t=xr(e,2);t!==null&&xn(t,e,2)}function Qc(e){var t=an();if(typeof e=="function"){var l=e;if(e=l(),Er){vt(!0);try{l()}finally{vt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ga,lastRenderedState:e},t}function Xp(e,t,l,i){return e.baseState=l,Kc(e,st,typeof i=="function"?i:ga)}function I1(e,t,l,i,u){if(Ri(e))throw Error(o(485));if(e=t.action,e!==null){var m={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){m.listeners.push(b)}};L.T!==null?l(!0):m.isTransition=!1,i(m),l=t.pending,l===null?(m.next=t.pending=m,Qp(t,m)):(m.next=l.next,t.pending=l.next=m)}}function Qp(e,t){var l=t.action,i=t.payload,u=e.state;if(t.isTransition){var m=L.T,b={};L.T=b;try{var R=l(u,i),U=L.S;U!==null&&U(b,R),Zp(e,t,R)}catch(Q){Zc(e,t,Q)}finally{m!==null&&b.types!==null&&(m.types=b.types),L.T=m}}else try{m=l(u,i),Zp(e,t,m)}catch(Q){Zc(e,t,Q)}}function Zp(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(i){Jp(e,t,i)},function(i){return Zc(e,t,i)}):Jp(e,t,l)}function Jp(e,t,l){t.status="fulfilled",t.value=l,em(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,Qp(e,l)))}function Zc(e,t,l){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=l,em(t),t=t.next;while(t!==i)}e.action=null}function em(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function tm(e,t){return t}function nm(e,t){if(Ke){var l=ft.formState;if(l!==null){e:{var i=Ie;if(Ke){if(mt){t:{for(var u=mt,m=On;u.nodeType!==8;){if(!m){u=null;break t}if(u=In(u.nextSibling),u===null){u=null;break t}}m=u.data,u=m==="F!"||m==="F"?u:null}if(u){mt=In(u.nextSibling),i=u.data==="F!";break e}}_a(i)}i=!1}i&&(t=l[0])}}return l=an(),l.memoizedState=l.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tm,lastRenderedState:t},l.queue=i,l=jm.bind(null,Ie,i),i.dispatch=l,i=Qc(!1),m=ru.bind(null,Ie,!1,i.queue),i=an(),u={state:t,dispatch:null,action:e,pending:null},i.queue=u,l=I1.bind(null,Ie,u,m,l),u.dispatch=l,i.memoizedState=e,[t,l,!1]}function am(e){var t=At();return rm(t,st,e)}function rm(e,t,l){if(t=Kc(e,t,tm)[0],e=Ci(ga)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=es(t)}catch(b){throw b===ll?xi:b}else i=t;t=At();var u=t.queue,m=u.dispatch;return l!==t.memoizedState&&(Ie.flags|=2048,ul(9,{destroy:void 0},H1.bind(null,u,l),null)),[i,m,e]}function H1(e,t){e.action=t}function lm(e){var t=At(),l=st;if(l!==null)return rm(t,l,e);At(),t=t.memoizedState,l=At();var i=l.queue.dispatch;return l.memoizedState=e,[t,i,!1]}function ul(e,t,l,i){return e={tag:e,create:l,deps:i,inst:t,next:null},t=Ie.updateQueue,t===null&&(t=wi(),Ie.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(i=l.next,l.next=e,e.next=i,t.lastEffect=e),e}function sm(){return At().memoizedState}function Ni(e,t,l,i){var u=an();Ie.flags|=e,u.memoizedState=ul(1|t,{destroy:void 0},l,i===void 0?null:i)}function Ti(e,t,l,i){var u=At();i=i===void 0?null:i;var m=u.memoizedState.inst;st!==null&&i!==null&&Pc(i,st.memoizedState.deps)?u.memoizedState=ul(t,m,l,i):(Ie.flags|=e,u.memoizedState=ul(1|t,m,l,i))}function im(e,t){Ni(8390656,8,e,t)}function Jc(e,t){Ti(2048,8,e,t)}function U1(e){Ie.flags|=4;var t=Ie.updateQueue;if(t===null)t=wi(),Ie.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function om(e){var t=At().memoizedState;return U1({ref:t,nextImpl:e}),function(){if((nt&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function cm(e,t){return Ti(4,2,e,t)}function um(e,t){return Ti(4,4,e,t)}function dm(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 fm(e,t,l){l=l!=null?l.concat([e]):null,Ti(4,4,dm.bind(null,t,e),l)}function eu(){}function pm(e,t){var l=At();t=t===void 0?null:t;var i=l.memoizedState;return t!==null&&Pc(t,i[1])?i[0]:(l.memoizedState=[e,t],e)}function mm(e,t){var l=At();t=t===void 0?null:t;var i=l.memoizedState;if(t!==null&&Pc(t,i[1]))return i[0];if(i=e(),Er){vt(!0);try{e()}finally{vt(!1)}}return l.memoizedState=[i,t],i}function tu(e,t,l){return l===void 0||(xa&1073741824)!==0&&(Ye&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=hh(),Ie.lanes|=e,Fa|=e,l)}function hm(e,t,l,i){return gn(l,t)?l:il.current!==null?(e=tu(e,l,i),gn(e,t)||(Dt=!0),e):(xa&42)===0||(xa&1073741824)!==0&&(Ye&261930)===0?(Dt=!0,e.memoizedState=l):(e=hh(),Ie.lanes|=e,Fa|=e,t)}function xm(e,t,l,i,u){var m=B.p;B.p=m!==0&&8>m?m:8;var b=L.T,R={};L.T=R,ru(e,!1,t,l);try{var U=u(),Q=L.S;if(Q!==null&&Q(R,U),U!==null&&typeof U=="object"&&typeof U.then=="function"){var le=_1(U,i);ts(e,t,le,kn(e))}else ts(e,t,i,kn(e))}catch(ue){ts(e,t,{then:function(){},status:"rejected",reason:ue},kn())}finally{B.p=m,b!==null&&R.types!==null&&(b.types=R.types),L.T=b}}function $1(){}function nu(e,t,l,i){if(e.tag!==5)throw Error(o(476));var u=gm(e).queue;xm(e,u,t,P,l===null?$1:function(){return vm(e),l(i)})}function gm(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:P,baseState:P,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ga,lastRenderedState:P},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ga,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function vm(e){var t=gm(e);t.next===null&&(t=e.alternate.memoizedState),ts(e,t.next.queue,{},kn())}function au(){return Yt(vs)}function ym(){return At().memoizedState}function bm(){return At().memoizedState}function V1(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=kn();e=Ia(l);var i=Ha(t,e,l);i!==null&&(xn(i,t,l),Xl(i,t,l)),t={cache:Lc()},e.payload=t;return}t=t.return}}function P1(e,t,l){var i=kn();l={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Ri(e)?Sm(t,l):(l=jc(e,t,l,i),l!==null&&(xn(l,e,i),km(l,t,i)))}function jm(e,t,l){var i=kn();ts(e,t,l,i)}function ts(e,t,l,i){var u={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Ri(e))Sm(t,u);else{var m=e.alternate;if(e.lanes===0&&(m===null||m.lanes===0)&&(m=t.lastRenderedReducer,m!==null))try{var b=t.lastRenderedState,R=m(b,l);if(u.hasEagerState=!0,u.eagerState=R,gn(R,b))return ci(e,t,u,0),ft===null&&oi(),!1}catch{}finally{}if(l=jc(e,t,u,i),l!==null)return xn(l,e,i),km(l,t,i),!0}return!1}function ru(e,t,l,i){if(i={lane:2,revertLane:Ou(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Ri(e)){if(t)throw Error(o(479))}else t=jc(e,l,i,2),t!==null&&xn(t,e,2)}function Ri(e){var t=e.alternate;return e===Ie||t!==null&&t===Ie}function Sm(e,t){ol=Si=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function km(e,t,l){if((l&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,l|=i,t.lanes=l,oa(e,l)}}var ns={readContext:Yt,use:Ei,useCallback:wt,useContext:wt,useEffect:wt,useImperativeHandle:wt,useLayoutEffect:wt,useInsertionEffect:wt,useMemo:wt,useReducer:wt,useRef:wt,useState:wt,useDebugValue:wt,useDeferredValue:wt,useTransition:wt,useSyncExternalStore:wt,useId:wt,useHostTransitionStatus:wt,useFormState:wt,useActionState:wt,useOptimistic:wt,useMemoCache:wt,useCacheRefresh:wt};ns.useEffectEvent=wt;var wm={readContext:Yt,use:Ei,useCallback:function(e,t){return an().memoizedState=[e,t===void 0?null:t],e},useContext:Yt,useEffect:im,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,Ni(4194308,4,dm.bind(null,t,e),l)},useLayoutEffect:function(e,t){return Ni(4194308,4,e,t)},useInsertionEffect:function(e,t){Ni(4,2,e,t)},useMemo:function(e,t){var l=an();t=t===void 0?null:t;var i=e();if(Er){vt(!0);try{e()}finally{vt(!1)}}return l.memoizedState=[i,t],i},useReducer:function(e,t,l){var i=an();if(l!==void 0){var u=l(t);if(Er){vt(!0);try{l(t)}finally{vt(!1)}}}else u=t;return i.memoizedState=i.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},i.queue=e,e=e.dispatch=P1.bind(null,Ie,e),[i.memoizedState,e]},useRef:function(e){var t=an();return e={current:e},t.memoizedState=e},useState:function(e){e=Qc(e);var t=e.queue,l=jm.bind(null,Ie,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:eu,useDeferredValue:function(e,t){var l=an();return tu(l,e,t)},useTransition:function(){var e=Qc(!1);return e=xm.bind(null,Ie,e.queue,!0,!1),an().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var i=Ie,u=an();if(Ke){if(l===void 0)throw Error(o(407));l=l()}else{if(l=t(),ft===null)throw Error(o(349));(Ye&127)!==0||Gp(i,t,l)}u.memoizedState=l;var m={value:l,getSnapshot:t};return u.queue=m,im(Yp.bind(null,i,m,e),[e]),i.flags|=2048,ul(9,{destroy:void 0},Wp.bind(null,i,m,l,t),null),l},useId:function(){var e=an(),t=ft.identifierPrefix;if(Ke){var l=Jn,i=Zn;l=(i&~(1<<32-Nt(i)-1)).toString(32)+l,t="_"+t+"R_"+l,l=ki++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=O1++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:au,useFormState:nm,useActionState:nm,useOptimistic:function(e){var t=an();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=ru.bind(null,Ie,!0,l),l.dispatch=t,[e,t]},useMemoCache:qc,useCacheRefresh:function(){return an().memoizedState=V1.bind(null,Ie)},useEffectEvent:function(e){var t=an(),l={impl:e};return t.memoizedState=l,function(){if((nt&2)!==0)throw Error(o(440));return l.impl.apply(void 0,arguments)}}},lu={readContext:Yt,use:Ei,useCallback:pm,useContext:Yt,useEffect:Jc,useImperativeHandle:fm,useInsertionEffect:cm,useLayoutEffect:um,useMemo:mm,useReducer:Ci,useRef:sm,useState:function(){return Ci(ga)},useDebugValue:eu,useDeferredValue:function(e,t){var l=At();return hm(l,st.memoizedState,e,t)},useTransition:function(){var e=Ci(ga)[0],t=At().memoizedState;return[typeof e=="boolean"?e:es(e),t]},useSyncExternalStore:Fp,useId:ym,useHostTransitionStatus:au,useFormState:am,useActionState:am,useOptimistic:function(e,t){var l=At();return Xp(l,st,e,t)},useMemoCache:qc,useCacheRefresh:bm};lu.useEffectEvent=om;var Em={readContext:Yt,use:Ei,useCallback:pm,useContext:Yt,useEffect:Jc,useImperativeHandle:fm,useInsertionEffect:cm,useLayoutEffect:um,useMemo:mm,useReducer:Xc,useRef:sm,useState:function(){return Xc(ga)},useDebugValue:eu,useDeferredValue:function(e,t){var l=At();return st===null?tu(l,e,t):hm(l,st.memoizedState,e,t)},useTransition:function(){var e=Xc(ga)[0],t=At().memoizedState;return[typeof e=="boolean"?e:es(e),t]},useSyncExternalStore:Fp,useId:ym,useHostTransitionStatus:au,useFormState:lm,useActionState:lm,useOptimistic:function(e,t){var l=At();return st!==null?Xp(l,st,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:qc,useCacheRefresh:bm};Em.useEffectEvent=om;function su(e,t,l,i){t=e.memoizedState,l=l(i,t),l=l==null?t:v({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var iu={enqueueSetState:function(e,t,l){e=e._reactInternals;var i=kn(),u=Ia(i);u.payload=t,l!=null&&(u.callback=l),t=Ha(e,u,i),t!==null&&(xn(t,e,i),Xl(t,e,i))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var i=kn(),u=Ia(i);u.tag=1,u.payload=t,l!=null&&(u.callback=l),t=Ha(e,u,i),t!==null&&(xn(t,e,i),Xl(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=kn(),i=Ia(l);i.tag=2,t!=null&&(i.callback=t),t=Ha(e,i,l),t!==null&&(xn(t,e,l),Xl(t,e,l))}};function Cm(e,t,l,i,u,m,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,m,b):t.prototype&&t.prototype.isPureReactComponent?!Vl(l,i)||!Vl(u,m):!0}function Nm(e,t,l,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,i),t.state!==e&&iu.enqueueReplaceState(t,t.state,null)}function Cr(e,t){var l=t;if("ref"in t){l={};for(var i in t)i!=="ref"&&(l[i]=t[i])}if(e=e.defaultProps){l===t&&(l=v({},l));for(var u in e)l[u]===void 0&&(l[u]=e[u])}return l}function Tm(e){ii(e)}function Rm(e){console.error(e)}function Am(e){ii(e)}function Ai(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function Mm(e,t,l){try{var i=e.onCaughtError;i(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function ou(e,t,l){return l=Ia(l),l.tag=3,l.payload={element:null},l.callback=function(){Ai(e,t)},l}function Lm(e){return e=Ia(e),e.tag=3,e}function zm(e,t,l,i){var u=l.type.getDerivedStateFromError;if(typeof u=="function"){var m=i.value;e.payload=function(){return u(m)},e.callback=function(){Mm(t,l,i)}}var b=l.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){Mm(t,l,i),typeof u!="function"&&(Ga===null?Ga=new Set([this]):Ga.add(this));var R=i.stack;this.componentDidCatch(i.value,{componentStack:R!==null?R:""})})}function F1(e,t,l,i,u){if(l.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=l.alternate,t!==null&&nl(t,l,u,!0),l=yn.current,l!==null){switch(l.tag){case 31:case 13:return Bn===null?Vi():l.alternate===null&&Et===0&&(Et=3),l.flags&=-257,l.flags|=65536,l.lanes=u,i===gi?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([i]):t.add(i),zu(e,i,u)),!1;case 22:return l.flags|=65536,i===gi?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([i]):l.add(i)),zu(e,i,u)),!1}throw Error(o(435,l.tag))}return zu(e,i,u),Vi(),!1}if(Ke)return t=yn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,i!==Nc&&(e=Error(o(422),{cause:i}),Gl(zn(e,l)))):(i!==Nc&&(t=Error(o(423),{cause:i}),Gl(zn(t,l))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,i=zn(i,l),u=ou(e.stateNode,i,u),Ic(e,u),Et!==4&&(Et=2)),!1;var m=Error(o(520),{cause:i});if(m=zn(m,l),us===null?us=[m]:us.push(m),Et!==4&&(Et=2),t===null)return!0;i=zn(i,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=u&-u,l.lanes|=e,e=ou(l.stateNode,i,e),Ic(l,e),!1;case 1:if(t=l.type,m=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(Ga===null||!Ga.has(m))))return l.flags|=65536,u&=-u,l.lanes|=u,u=Lm(u),zm(u,e,l,i),Ic(l,u),!1}l=l.return}while(l!==null);return!1}var cu=Error(o(461)),Dt=!1;function qt(e,t,l,i){t.child=e===null?Bp(t,null,l,i):wr(t,e.child,l,i)}function Dm(e,t,l,i,u){l=l.render;var m=t.ref;if("ref"in i){var b={};for(var R in i)R!=="ref"&&(b[R]=i[R])}else b=i;return br(t),i=Fc(e,t,l,b,m,u),R=Gc(),e!==null&&!Dt?(Wc(e,t,u),va(e,t,u)):(Ke&&R&&Ec(t),t.flags|=1,qt(e,t,i,u),t.child)}function _m(e,t,l,i,u){if(e===null){var m=l.type;return typeof m=="function"&&!Sc(m)&&m.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=m,Om(e,t,m,i,u)):(e=di(l.type,null,i,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(m=e.child,!gu(e,u)){var b=m.memoizedProps;if(l=l.compare,l=l!==null?l:Vl,l(b,i)&&e.ref===t.ref)return va(e,t,u)}return t.flags|=1,e=fa(m,i),e.ref=t.ref,e.return=t,t.child=e}function Om(e,t,l,i,u){if(e!==null){var m=e.memoizedProps;if(Vl(m,i)&&e.ref===t.ref)if(Dt=!1,t.pendingProps=i=m,gu(e,u))(e.flags&131072)!==0&&(Dt=!0);else return t.lanes=e.lanes,va(e,t,u)}return uu(e,t,l,i,u)}function Bm(e,t,l,i){var u=i.children,m=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((t.flags&128)!==0){if(m=m!==null?m.baseLanes|l:l,e!==null){for(i=t.child=e.child,u=0;i!==null;)u=u|i.lanes|i.childLanes,i=i.sibling;i=u&~m}else i=0,t.child=null;return Im(e,t,m,l,i)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&hi(t,m!==null?m.cachePool:null),m!==null?Up(t,m):Uc(),$p(t);else return i=t.lanes=536870912,Im(e,t,m!==null?m.baseLanes|l:l,l,i)}else m!==null?(hi(t,m.cachePool),Up(t,m),$a(),t.memoizedState=null):(e!==null&&hi(t,null),Uc(),$a());return qt(e,t,u,l),t.child}function as(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Im(e,t,l,i,u){var m=Dc();return m=m===null?null:{parent:Lt._currentValue,pool:m},t.memoizedState={baseLanes:l,cachePool:m},e!==null&&hi(t,null),Uc(),$p(t),e!==null&&nl(e,t,i,!0),t.childLanes=u,null}function Mi(e,t){return t=zi({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Hm(e,t,l){return wr(t,e.child,null,l),e=Mi(t,t.pendingProps),e.flags|=2,bn(t),t.memoizedState=null,e}function G1(e,t,l){var i=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ke){if(i.mode==="hidden")return e=Mi(t,i),t.lanes=536870912,as(null,e);if(Vc(t),(e=mt)?(e=Qh(e,On),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:za!==null?{id:Zn,overflow:Jn}:null,retryLane:536870912,hydrationErrors:null},l=Sp(e),l.return=t,t.child=l,Wt=t,mt=null)):e=null,e===null)throw _a(t);return t.lanes=536870912,null}return Mi(t,i)}var m=e.memoizedState;if(m!==null){var b=m.dehydrated;if(Vc(t),u)if(t.flags&256)t.flags&=-257,t=Hm(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||nl(e,t,l,!1),u=(l&e.childLanes)!==0,Dt||u){if(i=ft,i!==null&&(b=Xs(i,l),b!==0&&b!==m.retryLane))throw m.retryLane=b,xr(e,b),xn(i,e,b),cu;Vi(),t=Hm(e,t,l)}else e=m.treeContext,mt=In(b.nextSibling),Wt=t,Ke=!0,Da=null,On=!1,e!==null&&Ep(t,e),t=Mi(t,i),t.flags|=4096;return t}return e=fa(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Li(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 uu(e,t,l,i,u){return br(t),l=Fc(e,t,l,i,void 0,u),i=Gc(),e!==null&&!Dt?(Wc(e,t,u),va(e,t,u)):(Ke&&i&&Ec(t),t.flags|=1,qt(e,t,l,u),t.child)}function Um(e,t,l,i,u,m){return br(t),t.updateQueue=null,l=Pp(t,i,l,u),Vp(e),i=Gc(),e!==null&&!Dt?(Wc(e,t,m),va(e,t,m)):(Ke&&i&&Ec(t),t.flags|=1,qt(e,t,l,m),t.child)}function $m(e,t,l,i,u){if(br(t),t.stateNode===null){var m=Zr,b=l.contextType;typeof b=="object"&&b!==null&&(m=Yt(b)),m=new l(i,m),t.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=iu,t.stateNode=m,m._reactInternals=t,m=t.stateNode,m.props=i,m.state=t.memoizedState,m.refs={},Oc(t),b=l.contextType,m.context=typeof b=="object"&&b!==null?Yt(b):Zr,m.state=t.memoizedState,b=l.getDerivedStateFromProps,typeof b=="function"&&(su(t,l,b,i),m.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(b=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),b!==m.state&&iu.enqueueReplaceState(m,m.state,null),Zl(t,i,m,u),Ql(),m.state=t.memoizedState),typeof m.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){m=t.stateNode;var R=t.memoizedProps,U=Cr(l,R);m.props=U;var Q=m.context,le=l.contextType;b=Zr,typeof le=="object"&&le!==null&&(b=Yt(le));var ue=l.getDerivedStateFromProps;le=typeof ue=="function"||typeof m.getSnapshotBeforeUpdate=="function",R=t.pendingProps!==R,le||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(R||Q!==b)&&Nm(t,m,i,b),Ba=!1;var J=t.memoizedState;m.state=J,Zl(t,i,m,u),Ql(),Q=t.memoizedState,R||J!==Q||Ba?(typeof ue=="function"&&(su(t,l,ue,i),Q=t.memoizedState),(U=Ba||Cm(t,l,U,i,J,Q,b))?(le||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount()),typeof m.componentDidMount=="function"&&(t.flags|=4194308)):(typeof m.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=Q),m.props=i,m.state=Q,m.context=b,i=U):(typeof m.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{m=t.stateNode,Bc(e,t),b=t.memoizedProps,le=Cr(l,b),m.props=le,ue=t.pendingProps,J=m.context,Q=l.contextType,U=Zr,typeof Q=="object"&&Q!==null&&(U=Yt(Q)),R=l.getDerivedStateFromProps,(Q=typeof R=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(b!==ue||J!==U)&&Nm(t,m,i,U),Ba=!1,J=t.memoizedState,m.state=J,Zl(t,i,m,u),Ql();var ae=t.memoizedState;b!==ue||J!==ae||Ba||e!==null&&e.dependencies!==null&&pi(e.dependencies)?(typeof R=="function"&&(su(t,l,R,i),ae=t.memoizedState),(le=Ba||Cm(t,l,le,i,J,ae,U)||e!==null&&e.dependencies!==null&&pi(e.dependencies))?(Q||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(i,ae,U),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(i,ae,U)),typeof m.componentDidUpdate=="function"&&(t.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof m.componentDidUpdate!="function"||b===e.memoizedProps&&J===e.memoizedState||(t.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&J===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=ae),m.props=i,m.state=ae,m.context=U,i=le):(typeof m.componentDidUpdate!="function"||b===e.memoizedProps&&J===e.memoizedState||(t.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&J===e.memoizedState||(t.flags|=1024),i=!1)}return m=i,Li(e,t),i=(t.flags&128)!==0,m||i?(m=t.stateNode,l=i&&typeof l.getDerivedStateFromError!="function"?null:m.render(),t.flags|=1,e!==null&&i?(t.child=wr(t,e.child,null,u),t.child=wr(t,null,l,u)):qt(e,t,l,u),t.memoizedState=m.state,e=t.child):e=va(e,t,u),e}function Vm(e,t,l,i){return vr(),t.flags|=256,qt(e,t,l,i),t.child}var du={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function fu(e){return{baseLanes:e,cachePool:Mp()}}function pu(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=Sn),e}function Pm(e,t,l){var i=t.pendingProps,u=!1,m=(t.flags&128)!==0,b;if((b=m)||(b=e!==null&&e.memoizedState===null?!1:(Rt.current&2)!==0),b&&(u=!0,t.flags&=-129),b=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ke){if(u?Ua(t):$a(),(e=mt)?(e=Qh(e,On),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:za!==null?{id:Zn,overflow:Jn}:null,retryLane:536870912,hydrationErrors:null},l=Sp(e),l.return=t,t.child=l,Wt=t,mt=null)):e=null,e===null)throw _a(t);return Ku(e)?t.lanes=32:t.lanes=536870912,null}var R=i.children;return i=i.fallback,u?($a(),u=t.mode,R=zi({mode:"hidden",children:R},u),i=gr(i,u,l,null),R.return=t,i.return=t,R.sibling=i,t.child=R,i=t.child,i.memoizedState=fu(l),i.childLanes=pu(e,b,l),t.memoizedState=du,as(null,i)):(Ua(t),mu(t,R))}var U=e.memoizedState;if(U!==null&&(R=U.dehydrated,R!==null)){if(m)t.flags&256?(Ua(t),t.flags&=-257,t=hu(e,t,l)):t.memoizedState!==null?($a(),t.child=e.child,t.flags|=128,t=null):($a(),R=i.fallback,u=t.mode,i=zi({mode:"visible",children:i.children},u),R=gr(R,u,l,null),R.flags|=2,i.return=t,R.return=t,i.sibling=R,t.child=i,wr(t,e.child,null,l),i=t.child,i.memoizedState=fu(l),i.childLanes=pu(e,b,l),t.memoizedState=du,t=as(null,i));else if(Ua(t),Ku(R)){if(b=R.nextSibling&&R.nextSibling.dataset,b)var Q=b.dgst;b=Q,i=Error(o(419)),i.stack="",i.digest=b,Gl({value:i,source:null,stack:null}),t=hu(e,t,l)}else if(Dt||nl(e,t,l,!1),b=(l&e.childLanes)!==0,Dt||b){if(b=ft,b!==null&&(i=Xs(b,l),i!==0&&i!==U.retryLane))throw U.retryLane=i,xr(e,i),xn(b,e,i),cu;qu(R)||Vi(),t=hu(e,t,l)}else qu(R)?(t.flags|=192,t.child=e.child,t=null):(e=U.treeContext,mt=In(R.nextSibling),Wt=t,Ke=!0,Da=null,On=!1,e!==null&&Ep(t,e),t=mu(t,i.children),t.flags|=4096);return t}return u?($a(),R=i.fallback,u=t.mode,U=e.child,Q=U.sibling,i=fa(U,{mode:"hidden",children:i.children}),i.subtreeFlags=U.subtreeFlags&65011712,Q!==null?R=fa(Q,R):(R=gr(R,u,l,null),R.flags|=2),R.return=t,i.return=t,i.sibling=R,t.child=i,as(null,i),i=t.child,R=e.child.memoizedState,R===null?R=fu(l):(u=R.cachePool,u!==null?(U=Lt._currentValue,u=u.parent!==U?{parent:U,pool:U}:u):u=Mp(),R={baseLanes:R.baseLanes|l,cachePool:u}),i.memoizedState=R,i.childLanes=pu(e,b,l),t.memoizedState=du,as(e.child,i)):(Ua(t),l=e.child,e=l.sibling,l=fa(l,{mode:"visible",children:i.children}),l.return=t,l.sibling=null,e!==null&&(b=t.deletions,b===null?(t.deletions=[e],t.flags|=16):b.push(e)),t.child=l,t.memoizedState=null,l)}function mu(e,t){return t=zi({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function zi(e,t){return e=vn(22,e,null,t),e.lanes=0,e}function hu(e,t,l){return wr(t,e.child,null,l),e=mu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Fm(e,t,l){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),Ac(e.return,t,l)}function xu(e,t,l,i,u,m){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:l,tailMode:u,treeForkCount:m}:(b.isBackwards=t,b.rendering=null,b.renderingStartTime=0,b.last=i,b.tail=l,b.tailMode=u,b.treeForkCount=m)}function Gm(e,t,l){var i=t.pendingProps,u=i.revealOrder,m=i.tail;i=i.children;var b=Rt.current,R=(b&2)!==0;if(R?(b=b&1|2,t.flags|=128):b&=1,te(Rt,b),qt(e,t,i,l),i=Ke?Fl:0,!R&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Fm(e,l,t);else if(e.tag===19)Fm(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(u){case"forwards":for(l=t.child,u=null;l!==null;)e=l.alternate,e!==null&&ji(e)===null&&(u=l),l=l.sibling;l=u,l===null?(u=t.child,t.child=null):(u=l.sibling,l.sibling=null),xu(t,!1,u,l,m,i);break;case"backwards":case"unstable_legacy-backwards":for(l=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&ji(e)===null){t.child=u;break}e=u.sibling,u.sibling=l,l=u,u=e}xu(t,!0,l,null,m,i);break;case"together":xu(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function va(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),Fa|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(nl(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=fa(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=fa(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function gu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&pi(e)))}function W1(e,t,l){switch(t.tag){case 3:ce(t,t.stateNode.containerInfo),Oa(t,Lt,e.memoizedState.cache),vr();break;case 27:case 5:Be(t);break;case 4:ce(t,t.stateNode.containerInfo);break;case 10:Oa(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Vc(t),null;break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(Ua(t),t.flags|=128,null):(l&t.child.childLanes)!==0?Pm(e,t,l):(Ua(t),e=va(e,t,l),e!==null?e.sibling:null);Ua(t);break;case 19:var u=(e.flags&128)!==0;if(i=(l&t.childLanes)!==0,i||(nl(e,t,l,!1),i=(l&t.childLanes)!==0),u){if(i)return Gm(e,t,l);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),te(Rt,Rt.current),i)break;return null;case 22:return t.lanes=0,Bm(e,t,l,t.pendingProps);case 24:Oa(t,Lt,e.memoizedState.cache)}return va(e,t,l)}function Wm(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)Dt=!0;else{if(!gu(e,l)&&(t.flags&128)===0)return Dt=!1,W1(e,t,l);Dt=(e.flags&131072)!==0}else Dt=!1,Ke&&(t.flags&1048576)!==0&&wp(t,Fl,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=Sr(t.elementType),t.type=e,typeof e=="function")Sc(e)?(i=Cr(e,i),t.tag=1,t=$m(null,t,e,i,l)):(t.tag=0,t=uu(null,t,e,i,l));else{if(e!=null){var u=e.$$typeof;if(u===H){t.tag=11,t=Dm(null,t,e,i,l);break e}else if(u===T){t.tag=14,t=_m(null,t,e,i,l);break e}}throw t=q(e)||e,Error(o(306,t,""))}}return t;case 0:return uu(e,t,t.type,t.pendingProps,l);case 1:return i=t.type,u=Cr(i,t.pendingProps),$m(e,t,i,u,l);case 3:e:{if(ce(t,t.stateNode.containerInfo),e===null)throw Error(o(387));i=t.pendingProps;var m=t.memoizedState;u=m.element,Bc(e,t),Zl(t,i,null,l);var b=t.memoizedState;if(i=b.cache,Oa(t,Lt,i),i!==m.cache&&Mc(t,[Lt],l,!0),Ql(),i=b.element,m.isDehydrated)if(m={element:i,isDehydrated:!1,cache:b.cache},t.updateQueue.baseState=m,t.memoizedState=m,t.flags&256){t=Vm(e,t,i,l);break e}else if(i!==u){u=zn(Error(o(424)),t),Gl(u),t=Vm(e,t,i,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(mt=In(e.firstChild),Wt=t,Ke=!0,Da=null,On=!0,l=Bp(t,null,i,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(vr(),i===u){t=va(e,t,l);break e}qt(e,t,i,l)}t=t.child}return t;case 26:return Li(e,t),e===null?(l=ax(t.type,null,t.pendingProps,null))?t.memoizedState=l:Ke||(l=t.type,e=t.pendingProps,i=Ki(he.current).createElement(l),i[Gt]=t,i[un]=e,Kt(i,l,e),Pt(i),t.stateNode=i):t.memoizedState=ax(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Be(t),e===null&&Ke&&(i=t.stateNode=ex(t.type,t.pendingProps,he.current),Wt=t,On=!0,u=mt,Ka(t.type)?(Xu=u,mt=In(i.firstChild)):mt=u),qt(e,t,t.pendingProps.children,l),Li(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ke&&((u=i=mt)&&(i=Sb(i,t.type,t.pendingProps,On),i!==null?(t.stateNode=i,Wt=t,mt=In(i.firstChild),On=!1,u=!0):u=!1),u||_a(t)),Be(t),u=t.type,m=t.pendingProps,b=e!==null?e.memoizedProps:null,i=m.children,Gu(u,m)?i=null:b!==null&&Gu(u,b)&&(t.flags|=32),t.memoizedState!==null&&(u=Fc(e,t,B1,null,null,l),vs._currentValue=u),Li(e,t),qt(e,t,i,l),t.child;case 6:return e===null&&Ke&&((e=l=mt)&&(l=kb(l,t.pendingProps,On),l!==null?(t.stateNode=l,Wt=t,mt=null,e=!0):e=!1),e||_a(t)),null;case 13:return Pm(e,t,l);case 4:return ce(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=wr(t,null,i,l):qt(e,t,i,l),t.child;case 11:return Dm(e,t,t.type,t.pendingProps,l);case 7:return qt(e,t,t.pendingProps,l),t.child;case 8:return qt(e,t,t.pendingProps.children,l),t.child;case 12:return qt(e,t,t.pendingProps.children,l),t.child;case 10:return i=t.pendingProps,Oa(t,t.type,i.value),qt(e,t,i.children,l),t.child;case 9:return u=t.type._context,i=t.pendingProps.children,br(t),u=Yt(u),i=i(u),t.flags|=1,qt(e,t,i,l),t.child;case 14:return _m(e,t,t.type,t.pendingProps,l);case 15:return Om(e,t,t.type,t.pendingProps,l);case 19:return Gm(e,t,l);case 31:return G1(e,t,l);case 22:return Bm(e,t,l,t.pendingProps);case 24:return br(t),i=Yt(Lt),e===null?(u=Dc(),u===null&&(u=ft,m=Lc(),u.pooledCache=m,m.refCount++,m!==null&&(u.pooledCacheLanes|=l),u=m),t.memoizedState={parent:i,cache:u},Oc(t),Oa(t,Lt,u)):((e.lanes&l)!==0&&(Bc(e,t),Zl(t,null,null,l),Ql()),u=e.memoizedState,m=t.memoizedState,u.parent!==i?(u={parent:i,cache:i},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),Oa(t,Lt,i)):(i=m.cache,Oa(t,Lt,i),i!==u.cache&&Mc(t,[Lt],l,!0))),qt(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function ya(e){e.flags|=4}function vu(e,t,l,i,u){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(yh())e.flags|=8192;else throw kr=gi,_c}else e.flags&=-16777217}function Ym(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!ox(t))if(yh())e.flags|=8192;else throw kr=gi,_c}function Di(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?ur():536870912,e.lanes|=t,ml|=t)}function rs(e,t){if(!Ke)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 i=null;l!==null;)l.alternate!==null&&(i=l),l=l.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function ht(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,i=0;if(t)for(var u=e.child;u!==null;)l|=u.lanes|u.childLanes,i|=u.subtreeFlags&65011712,i|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)l|=u.lanes|u.childLanes,i|=u.subtreeFlags,i|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=i,e.childLanes=l,t}function Y1(e,t,l){var i=t.pendingProps;switch(Cc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ht(t),null;case 1:return ht(t),null;case 3:return l=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),ha(Lt),je(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(tl(t)?ya(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Tc())),ht(t),null;case 26:var u=t.type,m=t.memoizedState;return e===null?(ya(t),m!==null?(ht(t),Ym(t,m)):(ht(t),vu(t,u,null,i,l))):m?m!==e.memoizedState?(ya(t),ht(t),Ym(t,m)):(ht(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&ya(t),ht(t),vu(t,u,e,i,l)),null;case 27:if(ze(t),l=he.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&ya(t);else{if(!i){if(t.stateNode===null)throw Error(o(166));return ht(t),null}e=se.current,tl(t)?Cp(t):(e=ex(u,i,l),t.stateNode=e,ya(t))}return ht(t),null;case 5:if(ze(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&ya(t);else{if(!i){if(t.stateNode===null)throw Error(o(166));return ht(t),null}if(m=se.current,tl(t))Cp(t);else{var b=Ki(he.current);switch(m){case 1:m=b.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:m=b.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":m=b.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":m=b.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":m=b.createElement("div"),m.innerHTML="<script><\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof i.is=="string"?b.createElement("select",{is:i.is}):b.createElement("select"),i.multiple?m.multiple=!0:i.size&&(m.size=i.size);break;default:m=typeof i.is=="string"?b.createElement(u,{is:i.is}):b.createElement(u)}}m[Gt]=t,m[un]=i;e:for(b=t.child;b!==null;){if(b.tag===5||b.tag===6)m.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===t)break e;for(;b.sibling===null;){if(b.return===null||b.return===t)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}t.stateNode=m;e:switch(Kt(m,u,i),u){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&ya(t)}}return ht(t),vu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&ya(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(o(166));if(e=he.current,tl(t)){if(e=t.stateNode,l=t.memoizedProps,i=null,u=Wt,u!==null)switch(u.tag){case 27:case 5:i=u.memoizedProps}e[Gt]=t,e=!!(e.nodeValue===l||i!==null&&i.suppressHydrationWarning===!0||Ph(e.nodeValue,l)),e||_a(t,!0)}else e=Ki(e).createTextNode(i),e[Gt]=t,t.stateNode=e}return ht(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(i=tl(t),l!==null){if(e===null){if(!i)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[Gt]=t}else vr(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ht(t),e=!1}else l=Tc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(bn(t),t):(bn(t),null);if((t.flags&128)!==0)throw Error(o(558))}return ht(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=tl(t),i!==null&&i.dehydrated!==null){if(e===null){if(!u)throw Error(o(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(o(317));u[Gt]=t}else vr(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ht(t),u=!1}else u=Tc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(bn(t),t):(bn(t),null)}return bn(t),(t.flags&128)!==0?(t.lanes=l,t):(l=i!==null,e=e!==null&&e.memoizedState!==null,l&&(i=t.child,u=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(u=i.alternate.memoizedState.cachePool.pool),m=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(m=i.memoizedState.cachePool.pool),m!==u&&(i.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),Di(t,t.updateQueue),ht(t),null);case 4:return je(),e===null&&Uu(t.stateNode.containerInfo),ht(t),null;case 10:return ha(t.type),ht(t),null;case 19:if(V(Rt),i=t.memoizedState,i===null)return ht(t),null;if(u=(t.flags&128)!==0,m=i.rendering,m===null)if(u)rs(i,!1);else{if(Et!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(m=ji(e),m!==null){for(t.flags|=128,rs(i,!1),e=m.updateQueue,t.updateQueue=e,Di(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)jp(l,e),l=l.sibling;return te(Rt,Rt.current&1|2),Ke&&pa(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&Qe()>Hi&&(t.flags|=128,u=!0,rs(i,!1),t.lanes=4194304)}else{if(!u)if(e=ji(m),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,Di(t,e),rs(i,!0),i.tail===null&&i.tailMode==="hidden"&&!m.alternate&&!Ke)return ht(t),null}else 2*Qe()-i.renderingStartTime>Hi&&l!==536870912&&(t.flags|=128,u=!0,rs(i,!1),t.lanes=4194304);i.isBackwards?(m.sibling=t.child,t.child=m):(e=i.last,e!==null?e.sibling=m:t.child=m,i.last=m)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Qe(),e.sibling=null,l=Rt.current,te(Rt,u?l&1|2:l&1),Ke&&pa(t,i.treeForkCount),e):(ht(t),null);case 22:case 23:return bn(t),$c(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(l&536870912)!==0&&(t.flags&128)===0&&(ht(t),t.subtreeFlags&6&&(t.flags|=8192)):ht(t),l=t.updateQueue,l!==null&&Di(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==l&&(t.flags|=2048),e!==null&&V(jr),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),ha(Lt),ht(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function q1(e,t){switch(Cc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ha(Lt),je(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ze(t),null;case 31:if(t.memoizedState!==null){if(bn(t),t.alternate===null)throw Error(o(340));vr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(bn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));vr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(Rt),null;case 4:return je(),null;case 10:return ha(t.type),null;case 22:case 23:return bn(t),$c(),e!==null&&V(jr),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ha(Lt),null;case 25:return null;default:return null}}function qm(e,t){switch(Cc(t),t.tag){case 3:ha(Lt),je();break;case 26:case 27:case 5:ze(t);break;case 4:je();break;case 31:t.memoizedState!==null&&bn(t);break;case 13:bn(t);break;case 19:V(Rt);break;case 10:ha(t.type);break;case 22:case 23:bn(t),$c(),e!==null&&V(jr);break;case 24:ha(Lt)}}function ls(e,t){try{var l=t.updateQueue,i=l!==null?l.lastEffect:null;if(i!==null){var u=i.next;l=u;do{if((l.tag&e)===e){i=void 0;var m=l.create,b=l.inst;i=m(),b.destroy=i}l=l.next}while(l!==u)}}catch(R){lt(t,t.return,R)}}function Va(e,t,l){try{var i=t.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var m=u.next;i=m;do{if((i.tag&e)===e){var b=i.inst,R=b.destroy;if(R!==void 0){b.destroy=void 0,u=t;var U=l,Q=R;try{Q()}catch(le){lt(u,U,le)}}}i=i.next}while(i!==m)}}catch(le){lt(t,t.return,le)}}function Km(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{Hp(t,l)}catch(i){lt(e,e.return,i)}}}function Xm(e,t,l){l.props=Cr(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(i){lt(e,t,i)}}function ss(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof l=="function"?e.refCleanup=l(i):l.current=i}}catch(u){lt(e,t,u)}}function ea(e,t){var l=e.ref,i=e.refCleanup;if(l!==null)if(typeof i=="function")try{i()}catch(u){lt(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(u){lt(e,t,u)}else l.current=null}function Qm(e){var t=e.type,l=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&i.focus();break e;case"img":l.src?i.src=l.src:l.srcSet&&(i.srcset=l.srcSet)}}catch(u){lt(e,e.return,u)}}function yu(e,t,l){try{var i=e.stateNode;xb(i,e.type,l,t),i[un]=t}catch(u){lt(e,e.return,u)}}function Zm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ka(e.type)||e.tag===4}function bu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Zm(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&&Ka(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 ju(e,t,l){var i=e.tag;if(i===5||i===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=ua));else if(i!==4&&(i===27&&Ka(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(ju(e,t,l),e=e.sibling;e!==null;)ju(e,t,l),e=e.sibling}function _i(e,t,l){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(i!==4&&(i===27&&Ka(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(_i(e,t,l),e=e.sibling;e!==null;)_i(e,t,l),e=e.sibling}function Jm(e){var t=e.stateNode,l=e.memoizedProps;try{for(var i=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);Kt(t,i,l),t[Gt]=e,t[un]=l}catch(m){lt(e,e.return,m)}}var ba=!1,_t=!1,Su=!1,eh=typeof WeakSet=="function"?WeakSet:Set,Ft=null;function K1(e,t){if(e=e.containerInfo,Pu=no,e=fp(e),hc(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var i=l.getSelection&&l.getSelection();if(i&&i.rangeCount!==0){l=i.anchorNode;var u=i.anchorOffset,m=i.focusNode;i=i.focusOffset;try{l.nodeType,m.nodeType}catch{l=null;break e}var b=0,R=-1,U=-1,Q=0,le=0,ue=e,J=null;t:for(;;){for(var ae;ue!==l||u!==0&&ue.nodeType!==3||(R=b+u),ue!==m||i!==0&&ue.nodeType!==3||(U=b+i),ue.nodeType===3&&(b+=ue.nodeValue.length),(ae=ue.firstChild)!==null;)J=ue,ue=ae;for(;;){if(ue===e)break t;if(J===l&&++Q===u&&(R=b),J===m&&++le===i&&(U=b),(ae=ue.nextSibling)!==null)break;ue=J,J=ue.parentNode}ue=ae}l=R===-1||U===-1?null:{start:R,end:U}}else l=null}l=l||{start:0,end:0}}else l=null;for(Fu={focusedElem:e,selectionRange:l},no=!1,Ft=t;Ft!==null;)if(t=Ft,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ft=e;else for(;Ft!==null;){switch(t=Ft,m=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++)u=e[l],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&m!==null){e=void 0,l=t,u=m.memoizedProps,m=m.memoizedState,i=l.stateNode;try{var Se=Cr(l.type,u);e=i.getSnapshotBeforeUpdate(Se,m),i.__reactInternalSnapshotBeforeUpdate=e}catch(Re){lt(l,l.return,Re)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)Yu(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Yu(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,Ft=e;break}Ft=t.return}}function th(e,t,l){var i=l.flags;switch(l.tag){case 0:case 11:case 15:Sa(e,l),i&4&&ls(5,l);break;case 1:if(Sa(e,l),i&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(b){lt(l,l.return,b)}else{var u=Cr(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(b){lt(l,l.return,b)}}i&64&&Km(l),i&512&&ss(l,l.return);break;case 3:if(Sa(e,l),i&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{Hp(e,t)}catch(b){lt(l,l.return,b)}}break;case 27:t===null&&i&4&&Jm(l);case 26:case 5:Sa(e,l),t===null&&i&4&&Qm(l),i&512&&ss(l,l.return);break;case 12:Sa(e,l);break;case 31:Sa(e,l),i&4&&rh(e,l);break;case 13:Sa(e,l),i&4&&lh(e,l),i&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=rb.bind(null,l),wb(e,l))));break;case 22:if(i=l.memoizedState!==null||ba,!i){t=t!==null&&t.memoizedState!==null||_t,u=ba;var m=_t;ba=i,(_t=t)&&!m?ka(e,l,(l.subtreeFlags&8772)!==0):Sa(e,l),ba=u,_t=m}break;case 30:break;default:Sa(e,l)}}function nh(e){var t=e.alternate;t!==null&&(e.alternate=null,nh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Zo(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 yt=null,fn=!1;function ja(e,t,l){for(l=l.child;l!==null;)ah(e,t,l),l=l.sibling}function ah(e,t,l){if(pt&&typeof pt.onCommitFiberUnmount=="function")try{pt.onCommitFiberUnmount(Mt,l)}catch{}switch(l.tag){case 26:_t||ea(l,t),ja(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:_t||ea(l,t);var i=yt,u=fn;Ka(l.type)&&(yt=l.stateNode,fn=!1),ja(e,t,l),hs(l.stateNode),yt=i,fn=u;break;case 5:_t||ea(l,t);case 6:if(i=yt,u=fn,yt=null,ja(e,t,l),yt=i,fn=u,yt!==null)if(fn)try{(yt.nodeType===9?yt.body:yt.nodeName==="HTML"?yt.ownerDocument.body:yt).removeChild(l.stateNode)}catch(m){lt(l,t,m)}else try{yt.removeChild(l.stateNode)}catch(m){lt(l,t,m)}break;case 18:yt!==null&&(fn?(e=yt,Kh(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),Sl(e)):Kh(yt,l.stateNode));break;case 4:i=yt,u=fn,yt=l.stateNode.containerInfo,fn=!0,ja(e,t,l),yt=i,fn=u;break;case 0:case 11:case 14:case 15:Va(2,l,t),_t||Va(4,l,t),ja(e,t,l);break;case 1:_t||(ea(l,t),i=l.stateNode,typeof i.componentWillUnmount=="function"&&Xm(l,t,i)),ja(e,t,l);break;case 21:ja(e,t,l);break;case 22:_t=(i=_t)||l.memoizedState!==null,ja(e,t,l),_t=i;break;default:ja(e,t,l)}}function rh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Sl(e)}catch(l){lt(t,t.return,l)}}}function lh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Sl(e)}catch(l){lt(t,t.return,l)}}function X1(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new eh),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new eh),t;default:throw Error(o(435,e.tag))}}function Oi(e,t){var l=X1(e);t.forEach(function(i){if(!l.has(i)){l.add(i);var u=lb.bind(null,e,i);i.then(u,u)}})}function pn(e,t){var l=t.deletions;if(l!==null)for(var i=0;i<l.length;i++){var u=l[i],m=e,b=t,R=b;e:for(;R!==null;){switch(R.tag){case 27:if(Ka(R.type)){yt=R.stateNode,fn=!1;break e}break;case 5:yt=R.stateNode,fn=!1;break e;case 3:case 4:yt=R.stateNode.containerInfo,fn=!0;break e}R=R.return}if(yt===null)throw Error(o(160));ah(m,b,u),yt=null,fn=!1,m=u.alternate,m!==null&&(m.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)sh(t,e),t=t.sibling}var Fn=null;function sh(e,t){var l=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:pn(t,e),mn(e),i&4&&(Va(3,e,e.return),ls(3,e),Va(5,e,e.return));break;case 1:pn(t,e),mn(e),i&512&&(_t||l===null||ea(l,l.return)),i&64&&ba&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?i:l.concat(i))));break;case 26:var u=Fn;if(pn(t,e),mn(e),i&512&&(_t||l===null||ea(l,l.return)),i&4){var m=l!==null?l.memoizedState:null;if(i=e.memoizedState,l===null)if(i===null)if(e.stateNode===null){e:{i=e.type,l=e.memoizedProps,u=u.ownerDocument||u;t:switch(i){case"title":m=u.getElementsByTagName("title")[0],(!m||m[zl]||m[Gt]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=u.createElement(i),u.head.insertBefore(m,u.querySelector("head > title"))),Kt(m,i,l),m[Gt]=e,Pt(m),i=m;break e;case"link":var b=sx("link","href",u).get(i+(l.href||""));if(b){for(var R=0;R<b.length;R++)if(m=b[R],m.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&m.getAttribute("rel")===(l.rel==null?null:l.rel)&&m.getAttribute("title")===(l.title==null?null:l.title)&&m.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){b.splice(R,1);break t}}m=u.createElement(i),Kt(m,i,l),u.head.appendChild(m);break;case"meta":if(b=sx("meta","content",u).get(i+(l.content||""))){for(R=0;R<b.length;R++)if(m=b[R],m.getAttribute("content")===(l.content==null?null:""+l.content)&&m.getAttribute("name")===(l.name==null?null:l.name)&&m.getAttribute("property")===(l.property==null?null:l.property)&&m.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&m.getAttribute("charset")===(l.charSet==null?null:l.charSet)){b.splice(R,1);break t}}m=u.createElement(i),Kt(m,i,l),u.head.appendChild(m);break;default:throw Error(o(468,i))}m[Gt]=e,Pt(m),i=m}e.stateNode=i}else ix(u,e.type,e.stateNode);else e.stateNode=lx(u,i,e.memoizedProps);else m!==i?(m===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):m.count--,i===null?ix(u,e.type,e.stateNode):lx(u,i,e.memoizedProps)):i===null&&e.stateNode!==null&&yu(e,e.memoizedProps,l.memoizedProps)}break;case 27:pn(t,e),mn(e),i&512&&(_t||l===null||ea(l,l.return)),l!==null&&i&4&&yu(e,e.memoizedProps,l.memoizedProps);break;case 5:if(pn(t,e),mn(e),i&512&&(_t||l===null||ea(l,l.return)),e.flags&32){u=e.stateNode;try{Gr(u,"")}catch(Se){lt(e,e.return,Se)}}i&4&&e.stateNode!=null&&(u=e.memoizedProps,yu(e,u,l!==null?l.memoizedProps:u)),i&1024&&(Su=!0);break;case 6:if(pn(t,e),mn(e),i&4){if(e.stateNode===null)throw Error(o(162));i=e.memoizedProps,l=e.stateNode;try{l.nodeValue=i}catch(Se){lt(e,e.return,Se)}}break;case 3:if(Zi=null,u=Fn,Fn=Xi(t.containerInfo),pn(t,e),Fn=u,mn(e),i&4&&l!==null&&l.memoizedState.isDehydrated)try{Sl(t.containerInfo)}catch(Se){lt(e,e.return,Se)}Su&&(Su=!1,ih(e));break;case 4:i=Fn,Fn=Xi(e.stateNode.containerInfo),pn(t,e),mn(e),Fn=i;break;case 12:pn(t,e),mn(e);break;case 31:pn(t,e),mn(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Oi(e,i)));break;case 13:pn(t,e),mn(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Ii=Qe()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Oi(e,i)));break;case 22:u=e.memoizedState!==null;var U=l!==null&&l.memoizedState!==null,Q=ba,le=_t;if(ba=Q||u,_t=le||U,pn(t,e),_t=le,ba=Q,mn(e),i&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(l===null||U||ba||_t||Nr(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){U=l=t;try{if(m=U.stateNode,u)b=m.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{R=U.stateNode;var ue=U.memoizedProps.style,J=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;R.style.display=J==null||typeof J=="boolean"?"":(""+J).trim()}}catch(Se){lt(U,U.return,Se)}}}else if(t.tag===6){if(l===null){U=t;try{U.stateNode.nodeValue=u?"":U.memoizedProps}catch(Se){lt(U,U.return,Se)}}}else if(t.tag===18){if(l===null){U=t;try{var ae=U.stateNode;u?Xh(ae,!0):Xh(U.stateNode,!1)}catch(Se){lt(U,U.return,Se)}}}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}i&4&&(i=e.updateQueue,i!==null&&(l=i.retryQueue,l!==null&&(i.retryQueue=null,Oi(e,l))));break;case 19:pn(t,e),mn(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Oi(e,i)));break;case 30:break;case 21:break;default:pn(t,e),mn(e)}}function mn(e){var t=e.flags;if(t&2){try{for(var l,i=e.return;i!==null;){if(Zm(i)){l=i;break}i=i.return}if(l==null)throw Error(o(160));switch(l.tag){case 27:var u=l.stateNode,m=bu(e);_i(e,m,u);break;case 5:var b=l.stateNode;l.flags&32&&(Gr(b,""),l.flags&=-33);var R=bu(e);_i(e,R,b);break;case 3:case 4:var U=l.stateNode.containerInfo,Q=bu(e);ju(e,Q,U);break;default:throw Error(o(161))}}catch(le){lt(e,e.return,le)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ih(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ih(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Sa(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)th(e,t.alternate,t),t=t.sibling}function Nr(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Va(4,t,t.return),Nr(t);break;case 1:ea(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&Xm(t,t.return,l),Nr(t);break;case 27:hs(t.stateNode);case 26:case 5:ea(t,t.return),Nr(t);break;case 22:t.memoizedState===null&&Nr(t);break;case 30:Nr(t);break;default:Nr(t)}e=e.sibling}}function ka(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var i=t.alternate,u=e,m=t,b=m.flags;switch(m.tag){case 0:case 11:case 15:ka(u,m,l),ls(4,m);break;case 1:if(ka(u,m,l),i=m,u=i.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(Q){lt(i,i.return,Q)}if(i=m,u=i.updateQueue,u!==null){var R=i.stateNode;try{var U=u.shared.hiddenCallbacks;if(U!==null)for(u.shared.hiddenCallbacks=null,u=0;u<U.length;u++)Ip(U[u],R)}catch(Q){lt(i,i.return,Q)}}l&&b&64&&Km(m),ss(m,m.return);break;case 27:Jm(m);case 26:case 5:ka(u,m,l),l&&i===null&&b&4&&Qm(m),ss(m,m.return);break;case 12:ka(u,m,l);break;case 31:ka(u,m,l),l&&b&4&&rh(u,m);break;case 13:ka(u,m,l),l&&b&4&&lh(u,m);break;case 22:m.memoizedState===null&&ka(u,m,l),ss(m,m.return);break;case 30:break;default:ka(u,m,l)}t=t.sibling}}function ku(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&&Wl(l))}function wu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Wl(e))}function Gn(e,t,l,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)oh(e,t,l,i),t=t.sibling}function oh(e,t,l,i){var u=t.flags;switch(t.tag){case 0:case 11:case 15:Gn(e,t,l,i),u&2048&&ls(9,t);break;case 1:Gn(e,t,l,i);break;case 3:Gn(e,t,l,i),u&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Wl(e)));break;case 12:if(u&2048){Gn(e,t,l,i),e=t.stateNode;try{var m=t.memoizedProps,b=m.id,R=m.onPostCommit;typeof R=="function"&&R(b,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(U){lt(t,t.return,U)}}else Gn(e,t,l,i);break;case 31:Gn(e,t,l,i);break;case 13:Gn(e,t,l,i);break;case 23:break;case 22:m=t.stateNode,b=t.alternate,t.memoizedState!==null?m._visibility&2?Gn(e,t,l,i):is(e,t):m._visibility&2?Gn(e,t,l,i):(m._visibility|=2,dl(e,t,l,i,(t.subtreeFlags&10256)!==0||!1)),u&2048&&ku(b,t);break;case 24:Gn(e,t,l,i),u&2048&&wu(t.alternate,t);break;default:Gn(e,t,l,i)}}function dl(e,t,l,i,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var m=e,b=t,R=l,U=i,Q=b.flags;switch(b.tag){case 0:case 11:case 15:dl(m,b,R,U,u),ls(8,b);break;case 23:break;case 22:var le=b.stateNode;b.memoizedState!==null?le._visibility&2?dl(m,b,R,U,u):is(m,b):(le._visibility|=2,dl(m,b,R,U,u)),u&&Q&2048&&ku(b.alternate,b);break;case 24:dl(m,b,R,U,u),u&&Q&2048&&wu(b.alternate,b);break;default:dl(m,b,R,U,u)}t=t.sibling}}function is(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,i=t,u=i.flags;switch(i.tag){case 22:is(l,i),u&2048&&ku(i.alternate,i);break;case 24:is(l,i),u&2048&&wu(i.alternate,i);break;default:is(l,i)}t=t.sibling}}var os=8192;function fl(e,t,l){if(e.subtreeFlags&os)for(e=e.child;e!==null;)ch(e,t,l),e=e.sibling}function ch(e,t,l){switch(e.tag){case 26:fl(e,t,l),e.flags&os&&e.memoizedState!==null&&Ob(l,Fn,e.memoizedState,e.memoizedProps);break;case 5:fl(e,t,l);break;case 3:case 4:var i=Fn;Fn=Xi(e.stateNode.containerInfo),fl(e,t,l),Fn=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=os,os=16777216,fl(e,t,l),os=i):fl(e,t,l));break;default:fl(e,t,l)}}function uh(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 cs(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var i=t[l];Ft=i,fh(i,e)}uh(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)dh(e),e=e.sibling}function dh(e){switch(e.tag){case 0:case 11:case 15:cs(e),e.flags&2048&&Va(9,e,e.return);break;case 3:cs(e);break;case 12:cs(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Bi(e)):cs(e);break;default:cs(e)}}function Bi(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var i=t[l];Ft=i,fh(i,e)}uh(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Va(8,t,t.return),Bi(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,Bi(t));break;default:Bi(t)}e=e.sibling}}function fh(e,t){for(;Ft!==null;){var l=Ft;switch(l.tag){case 0:case 11:case 15:Va(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var i=l.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:Wl(l.memoizedState.cache)}if(i=l.child,i!==null)i.return=l,Ft=i;else e:for(l=e;Ft!==null;){i=Ft;var u=i.sibling,m=i.return;if(nh(i),i===l){Ft=null;break e}if(u!==null){u.return=m,Ft=u;break e}Ft=m}}}var Q1={getCacheForType:function(e){var t=Yt(Lt),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return Yt(Lt).controller.signal}},Z1=typeof WeakMap=="function"?WeakMap:Map,nt=0,ft=null,Fe=null,Ye=0,rt=0,jn=null,Pa=!1,pl=!1,Eu=!1,wa=0,Et=0,Fa=0,Tr=0,Cu=0,Sn=0,ml=0,us=null,hn=null,Nu=!1,Ii=0,ph=0,Hi=1/0,Ui=null,Ga=null,Ht=0,Wa=null,hl=null,Ea=0,Tu=0,Ru=null,mh=null,ds=0,Au=null;function kn(){return(nt&2)!==0&&Ye!==0?Ye&-Ye:L.T!==null?Ou():Af()}function hh(){if(Sn===0)if((Ye&536870912)===0||Ke){var e=Tt;Tt<<=1,(Tt&3932160)===0&&(Tt=262144),Sn=e}else Sn=536870912;return e=yn.current,e!==null&&(e.flags|=32),Sn}function xn(e,t,l){(e===ft&&(rt===2||rt===9)||e.cancelPendingCommit!==null)&&(xl(e,0),Ya(e,Ye,Sn,!1)),dr(e,l),((nt&2)===0||e!==ft)&&(e===ft&&((nt&2)===0&&(Tr|=l),Et===4&&Ya(e,Ye,Sn,!1)),ta(e))}function xh(e,t,l){if((nt&6)!==0)throw Error(o(327));var i=!l&&(t&127)===0&&(t&e.expiredLanes)===0||Xn(e,t),u=i?tb(e,t):Lu(e,t,!0),m=i;do{if(u===0){pl&&!i&&Ya(e,t,0,!1);break}else{if(l=e.current.alternate,m&&!J1(l)){u=Lu(e,t,!1),m=!1;continue}if(u===2){if(m=t,e.errorRecoveryDisabledLanes&m)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){t=b;e:{var R=e;u=us;var U=R.current.memoizedState.isDehydrated;if(U&&(xl(R,b).flags|=256),b=Lu(R,b,!1),b!==2){if(Eu&&!U){R.errorRecoveryDisabledLanes|=m,Tr|=m,u=4;break e}m=hn,hn=u,m!==null&&(hn===null?hn=m:hn.push.apply(hn,m))}u=b}if(m=!1,u!==2)continue}}if(u===1){xl(e,0),Ya(e,t,0,!0);break}e:{switch(i=e,m=u,m){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:Ya(i,t,Sn,!Pa);break e;case 2:hn=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(u=Ii+300-Qe(),10<u)){if(Ya(i,t,Sn,!Pa),cr(i,0,!0)!==0)break e;Ea=t,i.timeoutHandle=Yh(gh.bind(null,i,l,hn,Ui,Nu,t,Sn,Tr,ml,Pa,m,"Throttled",-0,0),u);break e}gh(i,l,hn,Ui,Nu,t,Sn,Tr,ml,Pa,m,null,-0,0)}}break}while(!0);ta(e)}function gh(e,t,l,i,u,m,b,R,U,Q,le,ue,J,ae){if(e.timeoutHandle=-1,ue=t.subtreeFlags,ue&8192||(ue&16785408)===16785408){ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ua},ch(t,m,ue);var Se=(m&62914560)===m?Ii-Qe():(m&4194048)===m?ph-Qe():0;if(Se=Bb(ue,Se),Se!==null){Ea=m,e.cancelPendingCommit=Se(Eh.bind(null,e,t,m,l,i,u,b,R,U,le,ue,null,J,ae)),Ya(e,m,b,!Q);return}}Eh(e,t,m,l,i,u,b,R,U)}function J1(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 i=0;i<l.length;i++){var u=l[i],m=u.getSnapshot;u=u.value;try{if(!gn(m(),u))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 Ya(e,t,l,i){t&=~Cu,t&=~Tr,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var u=t;0<u;){var m=31-Nt(u),b=1<<m;i[m]=-1,u&=~b}l!==0&&qo(e,l,t)}function $i(){return(nt&6)===0?(fs(0),!1):!0}function Mu(){if(Fe!==null){if(rt===0)var e=Fe.return;else e=Fe,ma=yr=null,Yc(e),sl=null,ql=0,e=Fe;for(;e!==null;)qm(e.alternate,e),e=e.return;Fe=null}}function xl(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,yb(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),Ea=0,Mu(),ft=e,Fe=l=fa(e.current,null),Ye=t,rt=0,jn=null,Pa=!1,pl=Xn(e,t),Eu=!1,ml=Sn=Cu=Tr=Fa=Et=0,hn=us=null,Nu=!1,(t&8)!==0&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0<i;){var u=31-Nt(i),m=1<<u;t|=e[u],i&=~m}return wa=t,oi(),l}function vh(e,t){Ie=null,L.H=ns,t===ll||t===xi?(t=Dp(),rt=3):t===_c?(t=Dp(),rt=4):rt=t===cu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,jn=t,Fe===null&&(Et=1,Ai(e,zn(t,e.current)))}function yh(){var e=yn.current;return e===null?!0:(Ye&4194048)===Ye?Bn===null:(Ye&62914560)===Ye||(Ye&536870912)!==0?e===Bn:!1}function bh(){var e=L.H;return L.H=ns,e===null?ns:e}function jh(){var e=L.A;return L.A=Q1,e}function Vi(){Et=4,Pa||(Ye&4194048)!==Ye&&yn.current!==null||(pl=!0),(Fa&134217727)===0&&(Tr&134217727)===0||ft===null||Ya(ft,Ye,Sn,!1)}function Lu(e,t,l){var i=nt;nt|=2;var u=bh(),m=jh();(ft!==e||Ye!==t)&&(Ui=null,xl(e,t)),t=!1;var b=Et;e:do try{if(rt!==0&&Fe!==null){var R=Fe,U=jn;switch(rt){case 8:Mu(),b=6;break e;case 3:case 2:case 9:case 6:yn.current===null&&(t=!0);var Q=rt;if(rt=0,jn=null,gl(e,R,U,Q),l&&pl){b=0;break e}break;default:Q=rt,rt=0,jn=null,gl(e,R,U,Q)}}eb(),b=Et;break}catch(le){vh(e,le)}while(!0);return t&&e.shellSuspendCounter++,ma=yr=null,nt=i,L.H=u,L.A=m,Fe===null&&(ft=null,Ye=0,oi()),b}function eb(){for(;Fe!==null;)Sh(Fe)}function tb(e,t){var l=nt;nt|=2;var i=bh(),u=jh();ft!==e||Ye!==t?(Ui=null,Hi=Qe()+500,xl(e,t)):pl=Xn(e,t);e:do try{if(rt!==0&&Fe!==null){t=Fe;var m=jn;t:switch(rt){case 1:rt=0,jn=null,gl(e,t,m,1);break;case 2:case 9:if(Lp(m)){rt=0,jn=null,kh(t);break}t=function(){rt!==2&&rt!==9||ft!==e||(rt=7),ta(e)},m.then(t,t);break e;case 3:rt=7;break e;case 4:rt=5;break e;case 7:Lp(m)?(rt=0,jn=null,kh(t)):(rt=0,jn=null,gl(e,t,m,7));break;case 5:var b=null;switch(Fe.tag){case 26:b=Fe.memoizedState;case 5:case 27:var R=Fe;if(b?ox(b):R.stateNode.complete){rt=0,jn=null;var U=R.sibling;if(U!==null)Fe=U;else{var Q=R.return;Q!==null?(Fe=Q,Pi(Q)):Fe=null}break t}}rt=0,jn=null,gl(e,t,m,5);break;case 6:rt=0,jn=null,gl(e,t,m,6);break;case 8:Mu(),Et=6;break e;default:throw Error(o(462))}}nb();break}catch(le){vh(e,le)}while(!0);return ma=yr=null,L.H=i,L.A=u,nt=l,Fe!==null?0:(ft=null,Ye=0,oi(),Et)}function nb(){for(;Fe!==null&&!Ct();)Sh(Fe)}function Sh(e){var t=Wm(e.alternate,e,wa);e.memoizedProps=e.pendingProps,t===null?Pi(e):Fe=t}function kh(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=Um(l,t,t.pendingProps,t.type,void 0,Ye);break;case 11:t=Um(l,t,t.pendingProps,t.type.render,t.ref,Ye);break;case 5:Yc(t);default:qm(l,t),t=Fe=jp(t,wa),t=Wm(l,t,wa)}e.memoizedProps=e.pendingProps,t===null?Pi(e):Fe=t}function gl(e,t,l,i){ma=yr=null,Yc(t),sl=null,ql=0;var u=t.return;try{if(F1(e,u,t,l,Ye)){Et=1,Ai(e,zn(l,e.current)),Fe=null;return}}catch(m){if(u!==null)throw Fe=u,m;Et=1,Ai(e,zn(l,e.current)),Fe=null;return}t.flags&32768?(Ke||i===1?e=!0:pl||(Ye&536870912)!==0?e=!1:(Pa=e=!0,(i===2||i===9||i===3||i===6)&&(i=yn.current,i!==null&&i.tag===13&&(i.flags|=16384))),wh(t,e)):Pi(t)}function Pi(e){var t=e;do{if((t.flags&32768)!==0){wh(t,Pa);return}e=t.return;var l=Y1(t.alternate,t,wa);if(l!==null){Fe=l;return}if(t=t.sibling,t!==null){Fe=t;return}Fe=t=e}while(t!==null);Et===0&&(Et=5)}function wh(e,t){do{var l=q1(e.alternate,e);if(l!==null){l.flags&=32767,Fe=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){Fe=e;return}Fe=e=l}while(e!==null);Et=6,Fe=null}function Eh(e,t,l,i,u,m,b,R,U){e.cancelPendingCommit=null;do Fi();while(Ht!==0);if((nt&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(m=t.lanes|t.childLanes,m|=bc,nn(e,l,m,b,R,U),e===ft&&(Fe=ft=null,Ye=0),hl=t,Wa=e,Ea=l,Tu=m,Ru=u,mh=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,sb(Pe,function(){return Ah(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=L.T,L.T=null,u=B.p,B.p=2,b=nt,nt|=4;try{K1(e,t,l)}finally{nt=b,B.p=u,L.T=i}}Ht=1,Ch(),Nh(),Th()}}function Ch(){if(Ht===1){Ht=0;var e=Wa,t=hl,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=L.T,L.T=null;var i=B.p;B.p=2;var u=nt;nt|=4;try{sh(t,e);var m=Fu,b=fp(e.containerInfo),R=m.focusedElem,U=m.selectionRange;if(b!==R&&R&&R.ownerDocument&&dp(R.ownerDocument.documentElement,R)){if(U!==null&&hc(R)){var Q=U.start,le=U.end;if(le===void 0&&(le=Q),"selectionStart"in R)R.selectionStart=Q,R.selectionEnd=Math.min(le,R.value.length);else{var ue=R.ownerDocument||document,J=ue&&ue.defaultView||window;if(J.getSelection){var ae=J.getSelection(),Se=R.textContent.length,Re=Math.min(U.start,Se),ot=U.end===void 0?Re:Math.min(U.end,Se);!ae.extend&&Re>ot&&(b=ot,ot=Re,Re=b);var Y=up(R,Re),G=up(R,ot);if(Y&&G&&(ae.rangeCount!==1||ae.anchorNode!==Y.node||ae.anchorOffset!==Y.offset||ae.focusNode!==G.node||ae.focusOffset!==G.offset)){var X=ue.createRange();X.setStart(Y.node,Y.offset),ae.removeAllRanges(),Re>ot?(ae.addRange(X),ae.extend(G.node,G.offset)):(X.setEnd(G.node,G.offset),ae.addRange(X))}}}}for(ue=[],ae=R;ae=ae.parentNode;)ae.nodeType===1&&ue.push({element:ae,left:ae.scrollLeft,top:ae.scrollTop});for(typeof R.focus=="function"&&R.focus(),R=0;R<ue.length;R++){var oe=ue[R];oe.element.scrollLeft=oe.left,oe.element.scrollTop=oe.top}}no=!!Pu,Fu=Pu=null}finally{nt=u,B.p=i,L.T=l}}e.current=t,Ht=2}}function Nh(){if(Ht===2){Ht=0;var e=Wa,t=hl,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=L.T,L.T=null;var i=B.p;B.p=2;var u=nt;nt|=4;try{th(e,t.alternate,t)}finally{nt=u,B.p=i,L.T=l}}Ht=3}}function Th(){if(Ht===4||Ht===3){Ht=0,It();var e=Wa,t=hl,l=Ea,i=mh;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Ht=5:(Ht=0,hl=Wa=null,Rh(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(Ga=null),Xo(l),t=t.stateNode,pt&&typeof pt.onCommitFiberRoot=="function")try{pt.onCommitFiberRoot(Mt,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=L.T,u=B.p,B.p=2,L.T=null;try{for(var m=e.onRecoverableError,b=0;b<i.length;b++){var R=i[b];m(R.value,{componentStack:R.stack})}}finally{L.T=t,B.p=u}}(Ea&3)!==0&&Fi(),ta(e),u=e.pendingLanes,(l&261930)!==0&&(u&42)!==0?e===Au?ds++:(ds=0,Au=e):ds=0,fs(0)}}function Rh(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Wl(t)))}function Fi(){return Ch(),Nh(),Th(),Ah()}function Ah(){if(Ht!==5)return!1;var e=Wa,t=Tu;Tu=0;var l=Xo(Ea),i=L.T,u=B.p;try{B.p=32>l?32:l,L.T=null,l=Ru,Ru=null;var m=Wa,b=Ea;if(Ht=0,hl=Wa=null,Ea=0,(nt&6)!==0)throw Error(o(331));var R=nt;if(nt|=4,dh(m.current),oh(m,m.current,b,l),nt=R,fs(0,!1),pt&&typeof pt.onPostCommitFiberRoot=="function")try{pt.onPostCommitFiberRoot(Mt,m)}catch{}return!0}finally{B.p=u,L.T=i,Rh(e,t)}}function Mh(e,t,l){t=zn(l,t),t=ou(e.stateNode,t,2),e=Ha(e,t,2),e!==null&&(dr(e,2),ta(e))}function lt(e,t,l){if(e.tag===3)Mh(e,e,l);else for(;t!==null;){if(t.tag===3){Mh(t,e,l);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Ga===null||!Ga.has(i))){e=zn(l,e),l=Lm(2),i=Ha(t,l,2),i!==null&&(zm(l,i,t,e),dr(i,2),ta(i));break}}t=t.return}}function zu(e,t,l){var i=e.pingCache;if(i===null){i=e.pingCache=new Z1;var u=new Set;i.set(t,u)}else u=i.get(t),u===void 0&&(u=new Set,i.set(t,u));u.has(l)||(Eu=!0,u.add(l),e=ab.bind(null,e,t,l),t.then(e,e))}function ab(e,t,l){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,ft===e&&(Ye&l)===l&&(Et===4||Et===3&&(Ye&62914560)===Ye&&300>Qe()-Ii?(nt&2)===0&&xl(e,0):Cu|=l,ml===Ye&&(ml=0)),ta(e)}function Lh(e,t){t===0&&(t=ur()),e=xr(e,t),e!==null&&(dr(e,t),ta(e))}function rb(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),Lh(e,l)}function lb(e,t){var l=0;switch(e.tag){case 31:case 13:var i=e.stateNode,u=e.memoizedState;u!==null&&(l=u.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(o(314))}i!==null&&i.delete(t),Lh(e,l)}function sb(e,t){return Bt(e,t)}var Gi=null,vl=null,Du=!1,Wi=!1,_u=!1,qa=0;function ta(e){e!==vl&&e.next===null&&(vl===null?Gi=vl=e:vl=vl.next=e),Wi=!0,Du||(Du=!0,ob())}function fs(e,t){if(!_u&&Wi){_u=!0;do for(var l=!1,i=Gi;i!==null;){if(e!==0){var u=i.pendingLanes;if(u===0)var m=0;else{var b=i.suspendedLanes,R=i.pingedLanes;m=(1<<31-Nt(42|e)+1)-1,m&=u&~(b&~R),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(l=!0,Oh(i,m))}else m=Ye,m=cr(i,i===ft?m:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(m&3)===0||Xn(i,m)||(l=!0,Oh(i,m));i=i.next}while(l);_u=!1}}function ib(){zh()}function zh(){Wi=Du=!1;var e=0;qa!==0&&vb()&&(e=qa);for(var t=Qe(),l=null,i=Gi;i!==null;){var u=i.next,m=Dh(i,t);m===0?(i.next=null,l===null?Gi=u:l.next=u,u===null&&(vl=l)):(l=i,(e!==0||(m&3)!==0)&&(Wi=!0)),i=u}Ht!==0&&Ht!==5||fs(e),qa!==0&&(qa=0)}function Dh(e,t){for(var l=e.suspendedLanes,i=e.pingedLanes,u=e.expirationTimes,m=e.pendingLanes&-62914561;0<m;){var b=31-Nt(m),R=1<<b,U=u[b];U===-1?((R&l)===0||(R&i)!==0)&&(u[b]=dt(R,t)):U<=t&&(e.expiredLanes|=R),m&=~R}if(t=ft,l=Ye,l=cr(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,l===0||e===t&&(rt===2||rt===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&St(i),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||Xn(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(i!==null&&St(i),Xo(l)){case 2:case 8:l=Te;break;case 32:l=Pe;break;case 268435456:l=Kn;break;default:l=Pe}return i=_h.bind(null,e),l=Bt(l,i),e.callbackPriority=t,e.callbackNode=l,t}return i!==null&&i!==null&&St(i),e.callbackPriority=2,e.callbackNode=null,2}function _h(e,t){if(Ht!==0&&Ht!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(Fi()&&e.callbackNode!==l)return null;var i=Ye;return i=cr(e,e===ft?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(xh(e,i,t),Dh(e,Qe()),e.callbackNode!=null&&e.callbackNode===l?_h.bind(null,e):null)}function Oh(e,t){if(Fi())return null;xh(e,t,!0)}function ob(){bb(function(){(nt&6)!==0?Bt(ee,ib):zh()})}function Ou(){if(qa===0){var e=al;e===0&&(e=kt,kt<<=1,(kt&261888)===0&&(kt=256)),qa=e}return qa}function Bh(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ei(""+e)}function Ih(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 cb(e,t,l,i,u){if(t==="submit"&&l&&l.stateNode===u){var m=Bh((u[un]||null).action),b=i.submitter;b&&(t=(t=b[un]||null)?Bh(t.formAction):b.getAttribute("formAction"),t!==null&&(m=t,b=null));var R=new ri("action","action",null,i,u);e.push({event:R,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(qa!==0){var U=b?Ih(u,b):new FormData(u);nu(l,{pending:!0,data:U,method:u.method,action:m},null,U)}}else typeof m=="function"&&(R.preventDefault(),U=b?Ih(u,b):new FormData(u),nu(l,{pending:!0,data:U,method:u.method,action:m},m,U))},currentTarget:u}]})}}for(var Bu=0;Bu<yc.length;Bu++){var Iu=yc[Bu],ub=Iu.toLowerCase(),db=Iu[0].toUpperCase()+Iu.slice(1);Pn(ub,"on"+db)}Pn(hp,"onAnimationEnd"),Pn(xp,"onAnimationIteration"),Pn(gp,"onAnimationStart"),Pn("dblclick","onDoubleClick"),Pn("focusin","onFocus"),Pn("focusout","onBlur"),Pn(N1,"onTransitionRun"),Pn(T1,"onTransitionStart"),Pn(R1,"onTransitionCancel"),Pn(vp,"onTransitionEnd"),Pr("onMouseEnter",["mouseout","mouseover"]),Pr("onMouseLeave",["mouseout","mouseover"]),Pr("onPointerEnter",["pointerout","pointerover"]),Pr("onPointerLeave",["pointerout","pointerover"]),fr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),fr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),fr("onBeforeInput",["compositionend","keypress","textInput","paste"]),fr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),fr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),fr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ps="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(" "),fb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ps));function Hh(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var i=e[l],u=i.event;i=i.listeners;e:{var m=void 0;if(t)for(var b=i.length-1;0<=b;b--){var R=i[b],U=R.instance,Q=R.currentTarget;if(R=R.listener,U!==m&&u.isPropagationStopped())break e;m=R,u.currentTarget=Q;try{m(u)}catch(le){ii(le)}u.currentTarget=null,m=U}else for(b=0;b<i.length;b++){if(R=i[b],U=R.instance,Q=R.currentTarget,R=R.listener,U!==m&&u.isPropagationStopped())break e;m=R,u.currentTarget=Q;try{m(u)}catch(le){ii(le)}u.currentTarget=null,m=U}}}}function Ge(e,t){var l=t[Qo];l===void 0&&(l=t[Qo]=new Set);var i=e+"__bubble";l.has(i)||(Uh(t,e,2,!1),l.add(i))}function Hu(e,t,l){var i=0;t&&(i|=4),Uh(l,e,i,t)}var Yi="_reactListening"+Math.random().toString(36).slice(2);function Uu(e){if(!e[Yi]){e[Yi]=!0,zf.forEach(function(l){l!=="selectionchange"&&(fb.has(l)||Hu(l,!1,e),Hu(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Yi]||(t[Yi]=!0,Hu("selectionchange",!1,t))}}function Uh(e,t,l,i){switch(hx(t)){case 2:var u=Ub;break;case 8:u=$b;break;default:u=td}l=u.bind(null,t,l,e),u=void 0,!sc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),i?u!==void 0?e.addEventListener(t,l,{capture:!0,passive:u}):e.addEventListener(t,l,!0):u!==void 0?e.addEventListener(t,l,{passive:u}):e.addEventListener(t,l,!1)}function $u(e,t,l,i,u){var m=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var b=i.tag;if(b===3||b===4){var R=i.stateNode.containerInfo;if(R===u)break;if(b===4)for(b=i.return;b!==null;){var U=b.tag;if((U===3||U===4)&&b.stateNode.containerInfo===u)return;b=b.return}for(;R!==null;){if(b=Ur(R),b===null)return;if(U=b.tag,U===5||U===6||U===26||U===27){i=m=b;continue e}R=R.parentNode}}i=i.return}Gf(function(){var Q=m,le=rc(l),ue=[];e:{var J=yp.get(e);if(J!==void 0){var ae=ri,Se=e;switch(e){case"keypress":if(ni(l)===0)break e;case"keydown":case"keyup":ae=l1;break;case"focusin":Se="focus",ae=uc;break;case"focusout":Se="blur",ae=uc;break;case"beforeblur":case"afterblur":ae=uc;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":ae=qf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ae=Yy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ae=o1;break;case hp:case xp:case gp:ae=Xy;break;case vp:ae=u1;break;case"scroll":case"scrollend":ae=Gy;break;case"wheel":ae=f1;break;case"copy":case"cut":case"paste":ae=Zy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ae=Xf;break;case"toggle":case"beforetoggle":ae=m1}var Re=(t&4)!==0,ot=!Re&&(e==="scroll"||e==="scrollend"),Y=Re?J!==null?J+"Capture":null:J;Re=[];for(var G=Q,X;G!==null;){var oe=G;if(X=oe.stateNode,oe=oe.tag,oe!==5&&oe!==26&&oe!==27||X===null||Y===null||(oe=_l(G,Y),oe!=null&&Re.push(ms(G,oe,X))),ot)break;G=G.return}0<Re.length&&(J=new ae(J,Se,null,l,le),ue.push({event:J,listeners:Re}))}}if((t&7)===0){e:{if(J=e==="mouseover"||e==="pointerover",ae=e==="mouseout"||e==="pointerout",J&&l!==ac&&(Se=l.relatedTarget||l.fromElement)&&(Ur(Se)||Se[Hr]))break e;if((ae||J)&&(J=le.window===le?le:(J=le.ownerDocument)?J.defaultView||J.parentWindow:window,ae?(Se=l.relatedTarget||l.toElement,ae=Q,Se=Se?Ur(Se):null,Se!==null&&(ot=d(Se),Re=Se.tag,Se!==ot||Re!==5&&Re!==27&&Re!==6)&&(Se=null)):(ae=null,Se=Q),ae!==Se)){if(Re=qf,oe="onMouseLeave",Y="onMouseEnter",G="mouse",(e==="pointerout"||e==="pointerover")&&(Re=Xf,oe="onPointerLeave",Y="onPointerEnter",G="pointer"),ot=ae==null?J:Dl(ae),X=Se==null?J:Dl(Se),J=new Re(oe,G+"leave",ae,l,le),J.target=ot,J.relatedTarget=X,oe=null,Ur(le)===Q&&(Re=new Re(Y,G+"enter",Se,l,le),Re.target=X,Re.relatedTarget=ot,oe=Re),ot=oe,ae&&Se)t:{for(Re=pb,Y=ae,G=Se,X=0,oe=Y;oe;oe=Re(oe))X++;oe=0;for(var Ne=G;Ne;Ne=Re(Ne))oe++;for(;0<X-oe;)Y=Re(Y),X--;for(;0<oe-X;)G=Re(G),oe--;for(;X--;){if(Y===G||G!==null&&Y===G.alternate){Re=Y;break t}Y=Re(Y),G=Re(G)}Re=null}else Re=null;ae!==null&&$h(ue,J,ae,Re,!1),Se!==null&&ot!==null&&$h(ue,ot,Se,Re,!0)}}e:{if(J=Q?Dl(Q):window,ae=J.nodeName&&J.nodeName.toLowerCase(),ae==="select"||ae==="input"&&J.type==="file")var Ze=rp;else if(np(J))if(lp)Ze=w1;else{Ze=S1;var ke=j1}else ae=J.nodeName,!ae||ae.toLowerCase()!=="input"||J.type!=="checkbox"&&J.type!=="radio"?Q&&nc(Q.elementType)&&(Ze=rp):Ze=k1;if(Ze&&(Ze=Ze(e,Q))){ap(ue,Ze,l,le);break e}ke&&ke(e,J,Q),e==="focusout"&&Q&&J.type==="number"&&Q.memoizedProps.value!=null&&tc(J,"number",J.value)}switch(ke=Q?Dl(Q):window,e){case"focusin":(np(ke)||ke.contentEditable==="true")&&(Kr=ke,xc=Q,Pl=null);break;case"focusout":Pl=xc=Kr=null;break;case"mousedown":gc=!0;break;case"contextmenu":case"mouseup":case"dragend":gc=!1,pp(ue,l,le);break;case"selectionchange":if(C1)break;case"keydown":case"keyup":pp(ue,l,le)}var He;if(fc)e:{switch(e){case"compositionstart":var qe="onCompositionStart";break e;case"compositionend":qe="onCompositionEnd";break e;case"compositionupdate":qe="onCompositionUpdate";break e}qe=void 0}else qr?ep(e,l)&&(qe="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(qe="onCompositionStart");qe&&(Qf&&l.locale!=="ko"&&(qr||qe!=="onCompositionStart"?qe==="onCompositionEnd"&&qr&&(He=Wf()):(La=le,ic="value"in La?La.value:La.textContent,qr=!0)),ke=qi(Q,qe),0<ke.length&&(qe=new Kf(qe,e,null,l,le),ue.push({event:qe,listeners:ke}),He?qe.data=He:(He=tp(l),He!==null&&(qe.data=He)))),(He=x1?g1(e,l):v1(e,l))&&(qe=qi(Q,"onBeforeInput"),0<qe.length&&(ke=new Kf("onBeforeInput","beforeinput",null,l,le),ue.push({event:ke,listeners:qe}),ke.data=He)),cb(ue,e,Q,l,le)}Hh(ue,t)})}function ms(e,t,l){return{instance:e,listener:t,currentTarget:l}}function qi(e,t){for(var l=t+"Capture",i=[];e!==null;){var u=e,m=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||m===null||(u=_l(e,l),u!=null&&i.unshift(ms(e,u,m)),u=_l(e,t),u!=null&&i.push(ms(e,u,m))),e.tag===3)return i;e=e.return}return[]}function pb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function $h(e,t,l,i,u){for(var m=t._reactName,b=[];l!==null&&l!==i;){var R=l,U=R.alternate,Q=R.stateNode;if(R=R.tag,U!==null&&U===i)break;R!==5&&R!==26&&R!==27||Q===null||(U=Q,u?(Q=_l(l,m),Q!=null&&b.unshift(ms(l,Q,U))):u||(Q=_l(l,m),Q!=null&&b.push(ms(l,Q,U)))),l=l.return}b.length!==0&&e.push({event:t,listeners:b})}var mb=/\r\n?/g,hb=/\u0000|\uFFFD/g;function Vh(e){return(typeof e=="string"?e:""+e).replace(mb,`
50
- `).replace(hb,"")}function Ph(e,t){return t=Vh(t),Vh(e)===t}function it(e,t,l,i,u,m){switch(l){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||Gr(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&Gr(e,""+i);break;case"className":Zs(e,"class",i);break;case"tabIndex":Zs(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":Zs(e,l,i);break;case"style":Pf(e,i,m);break;case"data":if(t!=="object"){Zs(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(l);break}i=ei(""+i),e.setAttribute(l,i);break;case"action":case"formAction":if(typeof i=="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 m=="function"&&(l==="formAction"?(t!=="input"&&it(e,t,"name",u.name,u,null),it(e,t,"formEncType",u.formEncType,u,null),it(e,t,"formMethod",u.formMethod,u,null),it(e,t,"formTarget",u.formTarget,u,null)):(it(e,t,"encType",u.encType,u,null),it(e,t,"method",u.method,u,null),it(e,t,"target",u.target,u,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(l);break}i=ei(""+i),e.setAttribute(l,i);break;case"onClick":i!=null&&(e.onclick=ua);break;case"onScroll":i!=null&&Ge("scroll",e);break;case"onScrollEnd":i!=null&&Ge("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(o(61));if(l=i.__html,l!=null){if(u.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}l=ei(""+i),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":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,""+i):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":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":i===!0?e.setAttribute(l,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,i):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(l,i):e.removeAttribute(l);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(l):e.setAttribute(l,i);break;case"popover":Ge("beforetoggle",e),Ge("toggle",e),Qs(e,"popover",i);break;case"xlinkActuate":ca(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":ca(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":ca(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":ca(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":ca(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":ca(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":ca(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":ca(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":ca(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":Qs(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Py.get(l)||l,Qs(e,l,i))}}function Vu(e,t,l,i,u,m){switch(l){case"style":Pf(e,i,m);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(o(61));if(l=i.__html,l!=null){if(u.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"children":typeof i=="string"?Gr(e,i):(typeof i=="number"||typeof i=="bigint")&&Gr(e,""+i);break;case"onScroll":i!=null&&Ge("scroll",e);break;case"onScrollEnd":i!=null&&Ge("scrollend",e);break;case"onClick":i!=null&&(e.onclick=ua);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Df.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(u=l.endsWith("Capture"),t=l.slice(2,u?l.length-7:void 0),m=e[un]||null,m=m!=null?m[l]:null,typeof m=="function"&&e.removeEventListener(t,m,u),typeof i=="function")){typeof m!="function"&&m!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,i,u);break e}l in e?e[l]=i:i===!0?e.setAttribute(l,""):Qs(e,l,i)}}}function Kt(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ge("error",e),Ge("load",e);var i=!1,u=!1,m;for(m in l)if(l.hasOwnProperty(m)){var b=l[m];if(b!=null)switch(m){case"src":i=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:it(e,t,m,b,l,null)}}u&&it(e,t,"srcSet",l.srcSet,l,null),i&&it(e,t,"src",l.src,l,null);return;case"input":Ge("invalid",e);var R=m=b=u=null,U=null,Q=null;for(i in l)if(l.hasOwnProperty(i)){var le=l[i];if(le!=null)switch(i){case"name":u=le;break;case"type":b=le;break;case"checked":U=le;break;case"defaultChecked":Q=le;break;case"value":m=le;break;case"defaultValue":R=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(o(137,t));break;default:it(e,t,i,le,l,null)}}Hf(e,m,R,U,Q,b,u,!1);return;case"select":Ge("invalid",e),i=b=m=null;for(u in l)if(l.hasOwnProperty(u)&&(R=l[u],R!=null))switch(u){case"value":m=R;break;case"defaultValue":b=R;break;case"multiple":i=R;default:it(e,t,u,R,l,null)}t=m,l=b,e.multiple=!!i,t!=null?Fr(e,!!i,t,!1):l!=null&&Fr(e,!!i,l,!0);return;case"textarea":Ge("invalid",e),m=u=i=null;for(b in l)if(l.hasOwnProperty(b)&&(R=l[b],R!=null))switch(b){case"value":i=R;break;case"defaultValue":u=R;break;case"children":m=R;break;case"dangerouslySetInnerHTML":if(R!=null)throw Error(o(91));break;default:it(e,t,b,R,l,null)}$f(e,i,u,m);return;case"option":for(U in l)if(l.hasOwnProperty(U)&&(i=l[U],i!=null))switch(U){case"selected":e.selected=i&&typeof i!="function"&&typeof i!="symbol";break;default:it(e,t,U,i,l,null)}return;case"dialog":Ge("beforetoggle",e),Ge("toggle",e),Ge("cancel",e),Ge("close",e);break;case"iframe":case"object":Ge("load",e);break;case"video":case"audio":for(i=0;i<ps.length;i++)Ge(ps[i],e);break;case"image":Ge("error",e),Ge("load",e);break;case"details":Ge("toggle",e);break;case"embed":case"source":case"link":Ge("error",e),Ge("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(Q in l)if(l.hasOwnProperty(Q)&&(i=l[Q],i!=null))switch(Q){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:it(e,t,Q,i,l,null)}return;default:if(nc(t)){for(le in l)l.hasOwnProperty(le)&&(i=l[le],i!==void 0&&Vu(e,t,le,i,l,void 0));return}}for(R in l)l.hasOwnProperty(R)&&(i=l[R],i!=null&&it(e,t,R,i,l,null))}function xb(e,t,l,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,m=null,b=null,R=null,U=null,Q=null,le=null;for(ae in l){var ue=l[ae];if(l.hasOwnProperty(ae)&&ue!=null)switch(ae){case"checked":break;case"value":break;case"defaultValue":U=ue;default:i.hasOwnProperty(ae)||it(e,t,ae,null,i,ue)}}for(var J in i){var ae=i[J];if(ue=l[J],i.hasOwnProperty(J)&&(ae!=null||ue!=null))switch(J){case"type":m=ae;break;case"name":u=ae;break;case"checked":Q=ae;break;case"defaultChecked":le=ae;break;case"value":b=ae;break;case"defaultValue":R=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(o(137,t));break;default:ae!==ue&&it(e,t,J,ae,i,ue)}}ec(e,b,R,U,Q,le,m,u);return;case"select":ae=b=R=J=null;for(m in l)if(U=l[m],l.hasOwnProperty(m)&&U!=null)switch(m){case"value":break;case"multiple":ae=U;default:i.hasOwnProperty(m)||it(e,t,m,null,i,U)}for(u in i)if(m=i[u],U=l[u],i.hasOwnProperty(u)&&(m!=null||U!=null))switch(u){case"value":J=m;break;case"defaultValue":R=m;break;case"multiple":b=m;default:m!==U&&it(e,t,u,m,i,U)}t=R,l=b,i=ae,J!=null?Fr(e,!!l,J,!1):!!i!=!!l&&(t!=null?Fr(e,!!l,t,!0):Fr(e,!!l,l?[]:"",!1));return;case"textarea":ae=J=null;for(R in l)if(u=l[R],l.hasOwnProperty(R)&&u!=null&&!i.hasOwnProperty(R))switch(R){case"value":break;case"children":break;default:it(e,t,R,null,i,u)}for(b in i)if(u=i[b],m=l[b],i.hasOwnProperty(b)&&(u!=null||m!=null))switch(b){case"value":J=u;break;case"defaultValue":ae=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(o(91));break;default:u!==m&&it(e,t,b,u,i,m)}Uf(e,J,ae);return;case"option":for(var Se in l)if(J=l[Se],l.hasOwnProperty(Se)&&J!=null&&!i.hasOwnProperty(Se))switch(Se){case"selected":e.selected=!1;break;default:it(e,t,Se,null,i,J)}for(U in i)if(J=i[U],ae=l[U],i.hasOwnProperty(U)&&J!==ae&&(J!=null||ae!=null))switch(U){case"selected":e.selected=J&&typeof J!="function"&&typeof J!="symbol";break;default:it(e,t,U,J,i,ae)}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 Re in l)J=l[Re],l.hasOwnProperty(Re)&&J!=null&&!i.hasOwnProperty(Re)&&it(e,t,Re,null,i,J);for(Q in i)if(J=i[Q],ae=l[Q],i.hasOwnProperty(Q)&&J!==ae&&(J!=null||ae!=null))switch(Q){case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(o(137,t));break;default:it(e,t,Q,J,i,ae)}return;default:if(nc(t)){for(var ot in l)J=l[ot],l.hasOwnProperty(ot)&&J!==void 0&&!i.hasOwnProperty(ot)&&Vu(e,t,ot,void 0,i,J);for(le in i)J=i[le],ae=l[le],!i.hasOwnProperty(le)||J===ae||J===void 0&&ae===void 0||Vu(e,t,le,J,i,ae);return}}for(var Y in l)J=l[Y],l.hasOwnProperty(Y)&&J!=null&&!i.hasOwnProperty(Y)&&it(e,t,Y,null,i,J);for(ue in i)J=i[ue],ae=l[ue],!i.hasOwnProperty(ue)||J===ae||J==null&&ae==null||it(e,t,ue,J,i,ae)}function Fh(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function gb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),i=0;i<l.length;i++){var u=l[i],m=u.transferSize,b=u.initiatorType,R=u.duration;if(m&&R&&Fh(b)){for(b=0,R=u.responseEnd,i+=1;i<l.length;i++){var U=l[i],Q=U.startTime;if(Q>R)break;var le=U.transferSize,ue=U.initiatorType;le&&Fh(ue)&&(U=U.responseEnd,b+=le*(U<R?1:(R-Q)/(U-Q)))}if(--i,t+=8*(m+b)/(u.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 Pu=null,Fu=null;function Ki(e){return e.nodeType===9?e:e.ownerDocument}function Gh(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 Wh(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 Gu(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 Wu=null;function vb(){var e=window.event;return e&&e.type==="popstate"?e===Wu?!1:(Wu=e,!0):(Wu=null,!1)}var Yh=typeof setTimeout=="function"?setTimeout:void 0,yb=typeof clearTimeout=="function"?clearTimeout:void 0,qh=typeof Promise=="function"?Promise:void 0,bb=typeof queueMicrotask=="function"?queueMicrotask:typeof qh<"u"?function(e){return qh.resolve(null).then(e).catch(jb)}:Yh;function jb(e){setTimeout(function(){throw e})}function Ka(e){return e==="head"}function Kh(e,t){var l=t,i=0;do{var u=l.nextSibling;if(e.removeChild(l),u&&u.nodeType===8)if(l=u.data,l==="/$"||l==="/&"){if(i===0){e.removeChild(u),Sl(t);return}i--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")i++;else if(l==="html")hs(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,hs(l);for(var m=l.firstChild;m;){var b=m.nextSibling,R=m.nodeName;m[zl]||R==="SCRIPT"||R==="STYLE"||R==="LINK"&&m.rel.toLowerCase()==="stylesheet"||l.removeChild(m),m=b}}else l==="body"&&hs(e.ownerDocument.body);l=u}while(l);Sl(t)}function Xh(e,t){var l=e;e=0;do{var i=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||""),i&&i.nodeType===8)if(l=i.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=i}while(l)}function Yu(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":Yu(l),Zo(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function Sb(e,t,l,i){for(;e.nodeType===1;){var u=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[zl])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(m=e.getAttribute("rel"),m==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(m!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(m=e.getAttribute("src"),(m!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&m&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var m=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===m)return e}else return e;if(e=In(e.nextSibling),e===null)break}return null}function kb(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=In(e.nextSibling),e===null))return null;return e}function Qh(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=In(e.nextSibling),e===null))return null;return e}function qu(e){return e.data==="$?"||e.data==="$~"}function Ku(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function wb(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var i=function(){t(),l.removeEventListener("DOMContentLoaded",i)};l.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function In(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 Xu=null;function Zh(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return In(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function Jh(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 ex(e,t,l){switch(t=Ki(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 hs(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Zo(e)}var Hn=new Map,tx=new Set;function Xi(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ca=B.d;B.d={f:Eb,r:Cb,D:Nb,C:Tb,L:Rb,m:Ab,X:Lb,S:Mb,M:zb};function Eb(){var e=Ca.f(),t=$i();return e||t}function Cb(e){var t=$r(e);t!==null&&t.tag===5&&t.type==="form"?vm(t):Ca.r(e)}var yl=typeof document>"u"?null:document;function nx(e,t,l){var i=yl;if(i&&typeof t=="string"&&t){var u=Mn(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof l=="string"&&(u+='[crossorigin="'+l+'"]'),tx.has(u)||(tx.add(u),e={rel:e,crossOrigin:l,href:t},i.querySelector(u)===null&&(t=i.createElement("link"),Kt(t,"link",e),Pt(t),i.head.appendChild(t)))}}function Nb(e){Ca.D(e),nx("dns-prefetch",e,null)}function Tb(e,t){Ca.C(e,t),nx("preconnect",e,t)}function Rb(e,t,l){Ca.L(e,t,l);var i=yl;if(i&&e&&t){var u='link[rel="preload"][as="'+Mn(t)+'"]';t==="image"&&l&&l.imageSrcSet?(u+='[imagesrcset="'+Mn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(u+='[imagesizes="'+Mn(l.imageSizes)+'"]')):u+='[href="'+Mn(e)+'"]';var m=u;switch(t){case"style":m=bl(e);break;case"script":m=jl(e)}Hn.has(m)||(e=v({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),Hn.set(m,e),i.querySelector(u)!==null||t==="style"&&i.querySelector(xs(m))||t==="script"&&i.querySelector(gs(m))||(t=i.createElement("link"),Kt(t,"link",e),Pt(t),i.head.appendChild(t)))}}function Ab(e,t){Ca.m(e,t);var l=yl;if(l&&e){var i=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Mn(i)+'"][href="'+Mn(e)+'"]',m=u;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=jl(e)}if(!Hn.has(m)&&(e=v({rel:"modulepreload",href:e},t),Hn.set(m,e),l.querySelector(u)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(gs(m)))return}i=l.createElement("link"),Kt(i,"link",e),Pt(i),l.head.appendChild(i)}}}function Mb(e,t,l){Ca.S(e,t,l);var i=yl;if(i&&e){var u=Vr(i).hoistableStyles,m=bl(e);t=t||"default";var b=u.get(m);if(!b){var R={loading:0,preload:null};if(b=i.querySelector(xs(m)))R.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},l),(l=Hn.get(m))&&Qu(e,l);var U=b=i.createElement("link");Pt(U),Kt(U,"link",e),U._p=new Promise(function(Q,le){U.onload=Q,U.onerror=le}),U.addEventListener("load",function(){R.loading|=1}),U.addEventListener("error",function(){R.loading|=2}),R.loading|=4,Qi(b,t,i)}b={type:"stylesheet",instance:b,count:1,state:R},u.set(m,b)}}}function Lb(e,t){Ca.X(e,t);var l=yl;if(l&&e){var i=Vr(l).hoistableScripts,u=jl(e),m=i.get(u);m||(m=l.querySelector(gs(u)),m||(e=v({src:e,async:!0},t),(t=Hn.get(u))&&Zu(e,t),m=l.createElement("script"),Pt(m),Kt(m,"link",e),l.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},i.set(u,m))}}function zb(e,t){Ca.M(e,t);var l=yl;if(l&&e){var i=Vr(l).hoistableScripts,u=jl(e),m=i.get(u);m||(m=l.querySelector(gs(u)),m||(e=v({src:e,async:!0,type:"module"},t),(t=Hn.get(u))&&Zu(e,t),m=l.createElement("script"),Pt(m),Kt(m,"link",e),l.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},i.set(u,m))}}function ax(e,t,l,i){var u=(u=he.current)?Xi(u):null;if(!u)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=bl(l.href),l=Vr(u).hoistableStyles,i=l.get(t),i||(i={type:"style",instance:null,count:0,state:null},l.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=bl(l.href);var m=Vr(u).hoistableStyles,b=m.get(e);if(b||(u=u.ownerDocument||u,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(e,b),(m=u.querySelector(xs(e)))&&!m._p&&(b.instance=m,b.state.loading=5),Hn.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},Hn.set(e,l),m||Db(u,e,l,b.state))),t&&i===null)throw Error(o(528,""));return b}if(t&&i!==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=jl(l),l=Vr(u).hoistableScripts,i=l.get(t),i||(i={type:"script",instance:null,count:0,state:null},l.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function bl(e){return'href="'+Mn(e)+'"'}function xs(e){return'link[rel="stylesheet"]['+e+"]"}function rx(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function Db(e,t,l,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),Kt(t,"link",l),Pt(t),e.head.appendChild(t))}function jl(e){return'[src="'+Mn(e)+'"]'}function gs(e){return"script[async]"+e}function lx(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+Mn(l.href)+'"]');if(i)return t.instance=i,Pt(i),i;var u=v({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),Pt(i),Kt(i,"style",u),Qi(i,l.precedence,e),t.instance=i;case"stylesheet":u=bl(l.href);var m=e.querySelector(xs(u));if(m)return t.state.loading|=4,t.instance=m,Pt(m),m;i=rx(l),(u=Hn.get(u))&&Qu(i,u),m=(e.ownerDocument||e).createElement("link"),Pt(m);var b=m;return b._p=new Promise(function(R,U){b.onload=R,b.onerror=U}),Kt(m,"link",i),t.state.loading|=4,Qi(m,l.precedence,e),t.instance=m;case"script":return m=jl(l.src),(u=e.querySelector(gs(m)))?(t.instance=u,Pt(u),u):(i=l,(u=Hn.get(m))&&(i=v({},l),Zu(i,u)),e=e.ownerDocument||e,u=e.createElement("script"),Pt(u),Kt(u,"link",i),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,Qi(i,l.precedence,e));return t.instance}function Qi(e,t,l){for(var i=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=i.length?i[i.length-1]:null,m=u,b=0;b<i.length;b++){var R=i[b];if(R.dataset.precedence===t)m=R;else if(m!==u)break}m?m.parentNode.insertBefore(e,m.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function Qu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Zu(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 sx(e,t,l){if(Zi===null){var i=new Map,u=Zi=new Map;u.set(l,i)}else u=Zi,i=u.get(l),i||(i=new Map,u.set(l,i));if(i.has(e))return i;for(i.set(e,null),l=l.getElementsByTagName(e),u=0;u<l.length;u++){var m=l[u];if(!(m[zl]||m[Gt]||e==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var b=m.getAttribute(t)||"";b=e+b;var R=i.get(b);R?R.push(m):i.set(b,[m])}}return i}function ix(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function _b(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 ox(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Ob(e,t,l,i){if(l.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var u=bl(i.href),m=t.querySelector(xs(u));if(m){t=m._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Ji.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=m,Pt(m);return}m=t.ownerDocument||t,i=rx(i),(u=Hn.get(u))&&Qu(i,u),m=m.createElement("link"),Pt(m);var b=m;b._p=new Promise(function(R,U){b.onload=R,b.onerror=U}),Kt(m,"link",i),l.instance=m}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=Ji.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var Ju=0;function Bb(e,t){return e.stylesheets&&e.count===0&&to(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var i=setTimeout(function(){if(e.stylesheets&&to(e,e.stylesheets),e.unsuspend){var m=e.unsuspend;e.unsuspend=null,m()}},6e4+t);0<e.imgBytes&&Ju===0&&(Ju=62500*gb());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&to(e,e.stylesheets),e.unsuspend)){var m=e.unsuspend;e.unsuspend=null,m()}},(e.imgBytes>Ju?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function Ji(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)to(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var eo=null;function to(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,eo=new Map,t.forEach(Ib,e),eo=null,Ji.call(e))}function Ib(e,t){if(!(t.state.loading&4)){var l=eo.get(e);if(l)var i=l.get(null);else{l=new Map,eo.set(e,l);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<u.length;m++){var b=u[m];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(l.set(b.dataset.precedence,b),i=b)}i&&l.set(null,i)}u=t.instance,b=u.getAttribute("data-precedence"),m=l.get(b)||i,m===i&&l.set(null,u),l.set(b,u),this.count++,i=Ji.bind(this),u.addEventListener("load",i),u.addEventListener("error",i),m?m.parentNode.insertBefore(u,m.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var vs={$$typeof:z,Provider:null,Consumer:null,_currentValue:P,_currentValue2:P,_threadCount:0};function Hb(e,t,l,i,u,m,b,R,U){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=Qn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qn(0),this.hiddenUpdates=Qn(null),this.identifierPrefix=i,this.onUncaughtError=u,this.onCaughtError=m,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=U,this.incompleteTransitions=new Map}function cx(e,t,l,i,u,m,b,R,U,Q,le,ue){return e=new Hb(e,t,l,b,U,Q,le,ue,R),t=1,m===!0&&(t|=24),m=vn(3,null,null,t),e.current=m,m.stateNode=e,t=Lc(),t.refCount++,e.pooledCache=t,t.refCount++,m.memoizedState={element:i,isDehydrated:l,cache:t},Oc(m),e}function ux(e){return e?(e=Zr,e):Zr}function dx(e,t,l,i,u,m){u=ux(u),i.context===null?i.context=u:i.pendingContext=u,i=Ia(t),i.payload={element:l},m=m===void 0?null:m,m!==null&&(i.callback=m),l=Ha(e,i,t),l!==null&&(xn(l,e,t),Xl(l,e,t))}function fx(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function ed(e,t){fx(e,t),(e=e.alternate)&&fx(e,t)}function px(e){if(e.tag===13||e.tag===31){var t=xr(e,67108864);t!==null&&xn(t,e,67108864),ed(e,67108864)}}function mx(e){if(e.tag===13||e.tag===31){var t=kn();t=Ko(t);var l=xr(e,t);l!==null&&xn(l,e,t),ed(e,t)}}var no=!0;function Ub(e,t,l,i){var u=L.T;L.T=null;var m=B.p;try{B.p=2,td(e,t,l,i)}finally{B.p=m,L.T=u}}function $b(e,t,l,i){var u=L.T;L.T=null;var m=B.p;try{B.p=8,td(e,t,l,i)}finally{B.p=m,L.T=u}}function td(e,t,l,i){if(no){var u=nd(i);if(u===null)$u(e,t,i,ao,l),xx(e,i);else if(Pb(u,e,t,l,i))i.stopPropagation();else if(xx(e,i),t&4&&-1<Vb.indexOf(e)){for(;u!==null;){var m=$r(u);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var b=Rn(m.pendingLanes);if(b!==0){var R=m;for(R.pendingLanes|=2,R.entangledLanes|=2;b;){var U=1<<31-Nt(b);R.entanglements[1]|=U,b&=~U}ta(m),(nt&6)===0&&(Hi=Qe()+500,fs(0))}}break;case 31:case 13:R=xr(m,2),R!==null&&xn(R,m,2),$i(),ed(m,2)}if(m=nd(i),m===null&&$u(e,t,i,ao,l),m===u)break;u=m}u!==null&&i.stopPropagation()}else $u(e,t,i,null,l)}}function nd(e){return e=rc(e),ad(e)}var ao=null;function ad(e){if(ao=null,e=Ur(e),e!==null){var t=d(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 ao=e,null}function hx(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(tt()){case ee:return 2;case Te:return 8;case Pe:case en:return 32;case Kn:return 268435456;default:return 32}default:return 32}}var rd=!1,Xa=null,Qa=null,Za=null,ys=new Map,bs=new Map,Ja=[],Vb="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 xx(e,t){switch(e){case"focusin":case"focusout":Xa=null;break;case"dragenter":case"dragleave":Qa=null;break;case"mouseover":case"mouseout":Za=null;break;case"pointerover":case"pointerout":ys.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":bs.delete(t.pointerId)}}function js(e,t,l,i,u,m){return e===null||e.nativeEvent!==m?(e={blockedOn:t,domEventName:l,eventSystemFlags:i,nativeEvent:m,targetContainers:[u]},t!==null&&(t=$r(t),t!==null&&px(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function Pb(e,t,l,i,u){switch(t){case"focusin":return Xa=js(Xa,e,t,l,i,u),!0;case"dragenter":return Qa=js(Qa,e,t,l,i,u),!0;case"mouseover":return Za=js(Za,e,t,l,i,u),!0;case"pointerover":var m=u.pointerId;return ys.set(m,js(ys.get(m)||null,e,t,l,i,u)),!0;case"gotpointercapture":return m=u.pointerId,bs.set(m,js(bs.get(m)||null,e,t,l,i,u)),!0}return!1}function gx(e){var t=Ur(e.target);if(t!==null){var l=d(t);if(l!==null){if(t=l.tag,t===13){if(t=f(l),t!==null){e.blockedOn=t,Mf(e.priority,function(){mx(l)});return}}else if(t===31){if(t=h(l),t!==null){e.blockedOn=t,Mf(e.priority,function(){mx(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 ro(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=nd(e.nativeEvent);if(l===null){l=e.nativeEvent;var i=new l.constructor(l.type,l);ac=i,l.target.dispatchEvent(i),ac=null}else return t=$r(l),t!==null&&px(t),e.blockedOn=l,!1;t.shift()}return!0}function vx(e,t,l){ro(e)&&l.delete(t)}function Fb(){rd=!1,Xa!==null&&ro(Xa)&&(Xa=null),Qa!==null&&ro(Qa)&&(Qa=null),Za!==null&&ro(Za)&&(Za=null),ys.forEach(vx),bs.forEach(vx)}function lo(e,t){e.blockedOn===t&&(e.blockedOn=null,rd||(rd=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Fb)))}var so=null;function yx(e){so!==e&&(so=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){so===e&&(so=null);for(var t=0;t<e.length;t+=3){var l=e[t],i=e[t+1],u=e[t+2];if(typeof i!="function"){if(ad(i||l)===null)continue;break}var m=$r(l);m!==null&&(e.splice(t,3),t-=3,nu(m,{pending:!0,data:u,method:l.method,action:i},i,u))}}))}function Sl(e){function t(U){return lo(U,e)}Xa!==null&&lo(Xa,e),Qa!==null&&lo(Qa,e),Za!==null&&lo(Za,e),ys.forEach(t),bs.forEach(t);for(var l=0;l<Ja.length;l++){var i=Ja[l];i.blockedOn===e&&(i.blockedOn=null)}for(;0<Ja.length&&(l=Ja[0],l.blockedOn===null);)gx(l),l.blockedOn===null&&Ja.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(i=0;i<l.length;i+=3){var u=l[i],m=l[i+1],b=u[un]||null;if(typeof m=="function")b||yx(l);else if(b){var R=null;if(m&&m.hasAttribute("formAction")){if(u=m,b=m[un]||null)R=b.formAction;else if(ad(u)!==null)continue}else R=b.action;typeof R=="function"?l[i+1]=R:(l.splice(i,3),i-=3),yx(l)}}}function bx(){function e(m){m.canIntercept&&m.info==="react-transition"&&m.intercept({handler:function(){return new Promise(function(b){return u=b})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),i||setTimeout(l,20)}function l(){if(!i&&!navigation.transition){var m=navigation.currentEntry;m&&m.url!=null&&navigation.navigate(m.url,{state:m.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function ld(e){this._internalRoot=e}io.prototype.render=ld.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var l=t.current,i=kn();dx(l,i,e,t,null,null)},io.prototype.unmount=ld.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dx(e.current,2,null,e,null,null),$i(),t[Hr]=null}};function io(e){this._internalRoot=e}io.prototype.unstable_scheduleHydration=function(e){if(e){var t=Af();e={blockedOn:null,target:e,priority:t};for(var l=0;l<Ja.length&&t!==0&&t<Ja[l].priority;l++);Ja.splice(l,0,e),l===0&&gx(e)}};var jx=r.version;if(jx!=="19.2.4")throw Error(o(527,jx,"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?y(e):null,e=e===null?null:e.stateNode,e};var Gb={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var oo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!oo.isDisabled&&oo.supportsFiber)try{Mt=oo.inject(Gb),pt=oo}catch{}}return ks.createRoot=function(e,t){if(!c(e))throw Error(o(299));var l=!1,i="",u=Tm,m=Rm,b=Am;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(m=t.onCaughtError),t.onRecoverableError!==void 0&&(b=t.onRecoverableError)),t=cx(e,1,!1,null,null,l,i,null,u,m,b,bx),e[Hr]=t.current,Uu(e),new ld(t)},ks.hydrateRoot=function(e,t,l){if(!c(e))throw Error(o(299));var i=!1,u="",m=Tm,b=Rm,R=Am,U=null;return l!=null&&(l.unstable_strictMode===!0&&(i=!0),l.identifierPrefix!==void 0&&(u=l.identifierPrefix),l.onUncaughtError!==void 0&&(m=l.onUncaughtError),l.onCaughtError!==void 0&&(b=l.onCaughtError),l.onRecoverableError!==void 0&&(R=l.onRecoverableError),l.formState!==void 0&&(U=l.formState)),t=cx(e,1,!0,t,l??null,i,u,U,m,b,R,bx),t.context=ux(null),l=t.current,i=kn(),i=Ko(i),u=Ia(i),u.callback=null,Ha(l,u,i),l=i,t.current.lanes=l,dr(t,l),ta(t),e[Hr]=t.current,Uu(e),new io(t)},ks.version="19.2.4",ks}var Mx;function e0(){if(Mx)return od.exports;Mx=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(r){console.error(r)}}return n(),od.exports=Jb(),od.exports}var t0=e0();/**
51
- * react-router v7.13.1
52
- *
53
- * Copyright (c) Remix Software Inc.
54
- *
55
- * This source code is licensed under the MIT license found in the
56
- * LICENSE.md file in the root directory of this source tree.
57
- *
58
- * @license MIT
59
- */var Lx="popstate";function zx(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function n0(n={}){function r(c,d){let{pathname:f="/",search:h="",hash:g=""}=Tl(c.location.hash.substring(1));return!f.startsWith("/")&&!f.startsWith(".")&&(f="/"+f),Pd("",{pathname:f,search:h,hash:g},d.state&&d.state.usr||null,d.state&&d.state.key||"default")}function s(c,d){let f=c.document.querySelector("base"),h="";if(f&&f.getAttribute("href")){let g=c.location.href,p=g.indexOf("#");h=p===-1?g:g.slice(0,p)}return h+"#"+(typeof d=="string"?d:_s(d))}function o(c,d){Yn(c.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(d)})`)}return r0(r,s,o,n)}function Vt(n,r){if(n===!1||n===null||typeof n>"u")throw new Error(r)}function Yn(n,r){if(!n){typeof console<"u"&&console.warn(r);try{throw new Error(r)}catch{}}}function a0(){return Math.random().toString(36).substring(2,10)}function Dx(n,r){return{usr:n.state,key:n.key,idx:r,masked:n.unstable_mask?{pathname:n.pathname,search:n.search,hash:n.hash}:void 0}}function Pd(n,r,s=null,o,c){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof r=="string"?Tl(r):r,state:s,key:r&&r.key||o||a0(),unstable_mask:c}}function _s({pathname:n="/",search:r="",hash:s=""}){return r&&r!=="?"&&(n+=r.charAt(0)==="?"?r:"?"+r),s&&s!=="#"&&(n+=s.charAt(0)==="#"?s:"#"+s),n}function Tl(n){let r={};if(n){let s=n.indexOf("#");s>=0&&(r.hash=n.substring(s),n=n.substring(0,s));let o=n.indexOf("?");o>=0&&(r.search=n.substring(o),n=n.substring(0,o)),n&&(r.pathname=n)}return r}function r0(n,r,s,o={}){let{window:c=document.defaultView,v5Compat:d=!1}=o,f=c.history,h="POP",g=null,p=y();p==null&&(p=0,f.replaceState({...f.state,idx:p},""));function y(){return(f.state||{idx:null}).idx}function v(){h="POP";let w=y(),N=w==null?null:w-p;p=w,g&&g({action:h,location:E.location,delta:N})}function j(w,N){h="PUSH";let A=zx(w)?w:Pd(E.location,w,N);s&&s(A,w),p=y()+1;let z=Dx(A,p),H=E.createHref(A.unstable_mask||A);try{f.pushState(z,"",H)}catch(M){if(M instanceof DOMException&&M.name==="DataCloneError")throw M;c.location.assign(H)}d&&g&&g({action:h,location:E.location,delta:1})}function S(w,N){h="REPLACE";let A=zx(w)?w:Pd(E.location,w,N);s&&s(A,w),p=y();let z=Dx(A,p),H=E.createHref(A.unstable_mask||A);f.replaceState(z,"",H),d&&g&&g({action:h,location:E.location,delta:0})}function k(w){return l0(w)}let E={get action(){return h},get location(){return n(c,f)},listen(w){if(g)throw new Error("A history only accepts one active listener");return c.addEventListener(Lx,v),g=w,()=>{c.removeEventListener(Lx,v),g=null}},createHref(w){return r(c,w)},createURL:k,encodeLocation(w){let N=k(w);return{pathname:N.pathname,search:N.search,hash:N.hash}},push:j,replace:S,go(w){return f.go(w)}};return E}function l0(n,r=!1){let s="http://localhost";typeof window<"u"&&(s=window.location.origin!=="null"?window.location.origin:window.location.href),Vt(s,"No window.location.(origin|href) available to create URL");let o=typeof n=="string"?n:_s(n);return o=o.replace(/ $/,"%20"),!r&&o.startsWith("//")&&(o=s+o),new URL(o,s)}function Jg(n,r,s="/"){return s0(n,r,s,!1)}function s0(n,r,s,o){let c=typeof r=="string"?Tl(r):r,d=Ta(c.pathname||"/",s);if(d==null)return null;let f=ev(n);i0(f);let h=null;for(let g=0;h==null&&g<f.length;++g){let p=v0(d);h=x0(f[g],p,o)}return h}function ev(n,r=[],s=[],o="",c=!1){let d=(f,h,g=c,p)=>{let y={relativePath:p===void 0?f.path||"":p,caseSensitive:f.caseSensitive===!0,childrenIndex:h,route:f};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(o)&&g)return;Vt(y.relativePath.startsWith(o),`Absolute route path "${y.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(o.length)}let v=la([o,y.relativePath]),j=s.concat(y);f.children&&f.children.length>0&&(Vt(f.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),ev(f.children,r,j,v,g)),!(f.path==null&&!f.index)&&r.push({path:v,score:m0(v,f.index),routesMeta:j})};return n.forEach((f,h)=>{var g;if(f.path===""||!((g=f.path)!=null&&g.includes("?")))d(f,h);else for(let p of tv(f.path))d(f,h,!0,p)}),r}function tv(n){let r=n.split("/");if(r.length===0)return[];let[s,...o]=r,c=s.endsWith("?"),d=s.replace(/\?$/,"");if(o.length===0)return c?[d,""]:[d];let f=tv(o.join("/")),h=[];return h.push(...f.map(g=>g===""?d:[d,g].join("/"))),c&&h.push(...f),h.map(g=>n.startsWith("/")&&g===""?"/":g)}function i0(n){n.sort((r,s)=>r.score!==s.score?s.score-r.score:h0(r.routesMeta.map(o=>o.childrenIndex),s.routesMeta.map(o=>o.childrenIndex)))}var o0=/^:[\w-]+$/,c0=3,u0=2,d0=1,f0=10,p0=-2,_x=n=>n==="*";function m0(n,r){let s=n.split("/"),o=s.length;return s.some(_x)&&(o+=p0),r&&(o+=u0),s.filter(c=>!_x(c)).reduce((c,d)=>c+(o0.test(d)?c0:d===""?d0:f0),o)}function h0(n,r){return n.length===r.length&&n.slice(0,-1).every((o,c)=>o===r[c])?n[n.length-1]-r[r.length-1]:0}function x0(n,r,s=!1){let{routesMeta:o}=n,c={},d="/",f=[];for(let h=0;h<o.length;++h){let g=o[h],p=h===o.length-1,y=d==="/"?r:r.slice(d.length)||"/",v=To({path:g.relativePath,caseSensitive:g.caseSensitive,end:p},y),j=g.route;if(!v&&p&&s&&!o[o.length-1].route.index&&(v=To({path:g.relativePath,caseSensitive:g.caseSensitive,end:!1},y)),!v)return null;Object.assign(c,v.params),f.push({params:c,pathname:la([d,v.pathname]),pathnameBase:S0(la([d,v.pathnameBase])),route:j}),v.pathnameBase!=="/"&&(d=la([d,v.pathnameBase]))}return f}function To(n,r){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[s,o]=g0(n.path,n.caseSensitive,n.end),c=r.match(s);if(!c)return null;let d=c[0],f=d.replace(/(.)\/+$/,"$1"),h=c.slice(1);return{params:o.reduce((p,{paramName:y,isOptional:v},j)=>{if(y==="*"){let k=h[j]||"";f=d.slice(0,d.length-k.length).replace(/(.)\/+$/,"$1")}const S=h[j];return v&&!S?p[y]=void 0:p[y]=(S||"").replace(/%2F/g,"/"),p},{}),pathname:d,pathnameBase:f,pattern:n}}function g0(n,r=!1,s=!0){Yn(n==="*"||!n.endsWith("*")||n.endsWith("/*"),`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`);let o=[],c="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(f,h,g,p,y)=>{if(o.push({paramName:h,isOptional:g!=null}),g){let v=y.charAt(p+f.length);return v&&v!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(o.push({paramName:"*"}),c+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?c+="\\/*$":n!==""&&n!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,r?void 0:"i"),o]}function v0(n){try{return n.split("/").map(r=>decodeURIComponent(r).replace(/\//g,"%2F")).join("/")}catch(r){return Yn(!1,`The URL path "${n}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${r}).`),n}}function Ta(n,r){if(r==="/")return n;if(!n.toLowerCase().startsWith(r.toLowerCase()))return null;let s=r.endsWith("/")?r.length-1:r.length,o=n.charAt(s);return o&&o!=="/"?null:n.slice(s)||"/"}var y0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function b0(n,r="/"){let{pathname:s,search:o="",hash:c=""}=typeof n=="string"?Tl(n):n,d;return s?(s=s.replace(/\/\/+/g,"/"),s.startsWith("/")?d=Ox(s.substring(1),"/"):d=Ox(s,r)):d=r,{pathname:d,search:k0(o),hash:w0(c)}}function Ox(n,r){let s=r.replace(/\/+$/,"").split("/");return n.split("/").forEach(c=>{c===".."?s.length>1&&s.pop():c!=="."&&s.push(c)}),s.length>1?s.join("/"):"/"}function fd(n,r,s,o){return`Cannot include a '${n}' character in a manually specified \`to.${r}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${s}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function j0(n){return n.filter((r,s)=>s===0||r.route.path&&r.route.path.length>0)}function nv(n){let r=j0(n);return r.map((s,o)=>o===r.length-1?s.pathname:s.pathnameBase)}function of(n,r,s,o=!1){let c;typeof n=="string"?c=Tl(n):(c={...n},Vt(!c.pathname||!c.pathname.includes("?"),fd("?","pathname","search",c)),Vt(!c.pathname||!c.pathname.includes("#"),fd("#","pathname","hash",c)),Vt(!c.search||!c.search.includes("#"),fd("#","search","hash",c)));let d=n===""||c.pathname==="",f=d?"/":c.pathname,h;if(f==null)h=s;else{let v=r.length-1;if(!o&&f.startsWith("..")){let j=f.split("/");for(;j[0]==="..";)j.shift(),v-=1;c.pathname=j.join("/")}h=v>=0?r[v]:"/"}let g=b0(c,h),p=f&&f!=="/"&&f.endsWith("/"),y=(d||f===".")&&s.endsWith("/");return!g.pathname.endsWith("/")&&(p||y)&&(g.pathname+="/"),g}var la=n=>n.join("/").replace(/\/\/+/g,"/"),S0=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),k0=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,w0=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,E0=class{constructor(n,r,s,o=!1){this.status=n,this.statusText=r||"",this.internal=o,s instanceof Error?(this.data=s.toString(),this.error=s):this.data=s}};function C0(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function N0(n){return n.map(r=>r.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var av=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function rv(n,r){let s=n;if(typeof s!="string"||!y0.test(s))return{absoluteURL:void 0,isExternal:!1,to:s};let o=s,c=!1;if(av)try{let d=new URL(window.location.href),f=s.startsWith("//")?new URL(d.protocol+s):new URL(s),h=Ta(f.pathname,r);f.origin===d.origin&&h!=null?s=h+f.search+f.hash:c=!0}catch{Yn(!1,`<Link to="${s}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:c,to:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var lv=["POST","PUT","PATCH","DELETE"];new Set(lv);var T0=["GET",...lv];new Set(T0);var Rl=x.createContext(null);Rl.displayName="DataRouter";var Do=x.createContext(null);Do.displayName="DataRouterState";var R0=x.createContext(!1),sv=x.createContext({isTransitioning:!1});sv.displayName="ViewTransition";var A0=x.createContext(new Map);A0.displayName="Fetchers";var M0=x.createContext(null);M0.displayName="Await";var Vn=x.createContext(null);Vn.displayName="Navigation";var _o=x.createContext(null);_o.displayName="Location";var Ra=x.createContext({outlet:null,matches:[],isDataRoute:!1});Ra.displayName="Route";var cf=x.createContext(null);cf.displayName="RouteError";var iv="REACT_ROUTER_ERROR",L0="REDIRECT",z0="ROUTE_ERROR_RESPONSE";function D0(n){if(n.startsWith(`${iv}:${L0}:{`))try{let r=JSON.parse(n.slice(28));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string"&&typeof r.location=="string"&&typeof r.reloadDocument=="boolean"&&typeof r.replace=="boolean")return r}catch{}}function _0(n){if(n.startsWith(`${iv}:${z0}:{`))try{let r=JSON.parse(n.slice(40));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string")return new E0(r.status,r.statusText,r.data)}catch{}}function O0(n,{relative:r}={}){Vt(Ps(),"useHref() may be used only in the context of a <Router> component.");let{basename:s,navigator:o}=x.useContext(Vn),{hash:c,pathname:d,search:f}=Fs(n,{relative:r}),h=d;return s!=="/"&&(h=d==="/"?s:la([s,d])),o.createHref({pathname:h,search:f,hash:c})}function Ps(){return x.useContext(_o)!=null}function lr(){return Vt(Ps(),"useLocation() may be used only in the context of a <Router> component."),x.useContext(_o).location}var ov="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function cv(n){x.useContext(Vn).static||x.useLayoutEffect(n)}function B0(){let{isDataRoute:n}=x.useContext(Ra);return n?X0():I0()}function I0(){Vt(Ps(),"useNavigate() may be used only in the context of a <Router> component.");let n=x.useContext(Rl),{basename:r,navigator:s}=x.useContext(Vn),{matches:o}=x.useContext(Ra),{pathname:c}=lr(),d=JSON.stringify(nv(o)),f=x.useRef(!1);return cv(()=>{f.current=!0}),x.useCallback((g,p={})=>{if(Yn(f.current,ov),!f.current)return;if(typeof g=="number"){s.go(g);return}let y=of(g,JSON.parse(d),c,p.relative==="path");n==null&&r!=="/"&&(y.pathname=y.pathname==="/"?r:la([r,y.pathname])),(p.replace?s.replace:s.push)(y,p.state,p)},[r,s,d,c,n])}x.createContext(null);function Fs(n,{relative:r}={}){let{matches:s}=x.useContext(Ra),{pathname:o}=lr(),c=JSON.stringify(nv(s));return x.useMemo(()=>of(n,JSON.parse(c),o,r==="path"),[n,c,o,r])}function H0(n,r,s){Vt(Ps(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=x.useContext(Vn),{matches:c}=x.useContext(Ra),d=c[c.length-1],f=d?d.params:{},h=d?d.pathname:"/",g=d?d.pathnameBase:"/",p=d&&d.route;{let w=p&&p.path||"";dv(h,!p||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${w}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
60
-
61
- Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let y=lr(),v;v=y;let j=v.pathname||"/",S=j;if(g!=="/"){let w=g.replace(/^\//,"").split("/");S="/"+j.replace(/^\//,"").split("/").slice(w.length).join("/")}let k=Jg(n,{pathname:S});return Yn(p||k!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),Yn(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${v.pathname}${v.search}${v.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),F0(k&&k.map(w=>Object.assign({},w,{params:Object.assign({},f,w.params),pathname:la([g,o.encodeLocation?o.encodeLocation(w.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?g:la([g,o.encodeLocation?o.encodeLocation(w.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),c,s)}function U0(){let n=K0(),r=C0(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),s=n instanceof Error?n.stack:null,o="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:o},d={padding:"2px 4px",backgroundColor:o},f=null;return console.error("Error handled by React Router default ErrorBoundary:",n),f=x.createElement(x.Fragment,null,x.createElement("p",null,"💿 Hey developer 👋"),x.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",x.createElement("code",{style:d},"ErrorBoundary")," or"," ",x.createElement("code",{style:d},"errorElement")," prop on your route.")),x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},r),s?x.createElement("pre",{style:c},s):null,f)}var $0=x.createElement(U0,null),uv=class extends x.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,r){return r.location!==n.location||r.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:r.error,location:r.location,revalidation:n.revalidation||r.revalidation}}componentDidCatch(n,r){this.props.onError?this.props.onError(n,r):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const s=_0(n.digest);s&&(n=s)}let r=n!==void 0?x.createElement(Ra.Provider,{value:this.props.routeContext},x.createElement(cf.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?x.createElement(V0,{error:n},r):r}};uv.contextType=R0;var pd=new WeakMap;function V0({children:n,error:r}){let{basename:s}=x.useContext(Vn);if(typeof r=="object"&&r&&"digest"in r&&typeof r.digest=="string"){let o=D0(r.digest);if(o){let c=pd.get(r);if(c)throw c;let d=rv(o.location,s);if(av&&!pd.get(r))if(d.isExternal||o.reloadDocument)window.location.href=d.absoluteURL||d.to;else{const f=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(d.to,{replace:o.replace}));throw pd.set(r,f),f}return x.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return n}function P0({routeContext:n,match:r,children:s}){let o=x.useContext(Rl);return o&&o.static&&o.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=r.route.id),x.createElement(Ra.Provider,{value:n},s)}function F0(n,r=[],s){let o=s==null?void 0:s.state;if(n==null){if(!o)return null;if(o.errors)n=o.matches;else if(r.length===0&&!o.initialized&&o.matches.length>0)n=o.matches;else return null}let c=n,d=o==null?void 0:o.errors;if(d!=null){let y=c.findIndex(v=>v.route.id&&(d==null?void 0:d[v.route.id])!==void 0);Vt(y>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(d).join(",")}`),c=c.slice(0,Math.min(c.length,y+1))}let f=!1,h=-1;if(s&&o){f=o.renderFallback;for(let y=0;y<c.length;y++){let v=c[y];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(h=y),v.route.id){let{loaderData:j,errors:S}=o,k=v.route.loader&&!j.hasOwnProperty(v.route.id)&&(!S||S[v.route.id]===void 0);if(v.route.lazy||k){s.isStatic&&(f=!0),h>=0?c=c.slice(0,h+1):c=[c[0]];break}}}}let g=s==null?void 0:s.onError,p=o&&g?(y,v)=>{var j,S;g(y,{location:o.location,params:((S=(j=o.matches)==null?void 0:j[0])==null?void 0:S.params)??{},unstable_pattern:N0(o.matches),errorInfo:v})}:void 0;return c.reduceRight((y,v,j)=>{let S,k=!1,E=null,w=null;o&&(S=d&&v.route.id?d[v.route.id]:void 0,E=v.route.errorElement||$0,f&&(h<0&&j===0?(dv("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,w=null):h===j&&(k=!0,w=v.route.hydrateFallbackElement||null)));let N=r.concat(c.slice(0,j+1)),A=()=>{let z;return S?z=E:k?z=w:v.route.Component?z=x.createElement(v.route.Component,null):v.route.element?z=v.route.element:z=y,x.createElement(P0,{match:v,routeContext:{outlet:y,matches:N,isDataRoute:o!=null},children:z})};return o&&(v.route.ErrorBoundary||v.route.errorElement||j===0)?x.createElement(uv,{location:o.location,revalidation:o.revalidation,component:E,error:S,children:A(),routeContext:{outlet:null,matches:N,isDataRoute:!0},onError:p}):A()},null)}function uf(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function G0(n){let r=x.useContext(Rl);return Vt(r,uf(n)),r}function W0(n){let r=x.useContext(Do);return Vt(r,uf(n)),r}function Y0(n){let r=x.useContext(Ra);return Vt(r,uf(n)),r}function df(n){let r=Y0(n),s=r.matches[r.matches.length-1];return Vt(s.route.id,`${n} can only be used on routes that contain a unique "id"`),s.route.id}function q0(){return df("useRouteId")}function K0(){var o;let n=x.useContext(cf),r=W0("useRouteError"),s=df("useRouteError");return n!==void 0?n:(o=r.errors)==null?void 0:o[s]}function X0(){let{router:n}=G0("useNavigate"),r=df("useNavigate"),s=x.useRef(!1);return cv(()=>{s.current=!0}),x.useCallback(async(c,d={})=>{Yn(s.current,ov),s.current&&(typeof c=="number"?await n.navigate(c):await n.navigate(c,{fromRouteId:r,...d}))},[n,r])}var Bx={};function dv(n,r,s){!r&&!Bx[n]&&(Bx[n]=!0,Yn(!1,s))}x.memo(Q0);function Q0({routes:n,future:r,state:s,isStatic:o,onError:c}){return H0(n,void 0,{state:s,isStatic:o,onError:c})}function Z0({basename:n="/",children:r=null,location:s,navigationType:o="POP",navigator:c,static:d=!1,unstable_useTransitions:f}){Vt(!Ps(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=n.replace(/^\/*/,"/"),g=x.useMemo(()=>({basename:h,navigator:c,static:d,unstable_useTransitions:f,future:{}}),[h,c,d,f]);typeof s=="string"&&(s=Tl(s));let{pathname:p="/",search:y="",hash:v="",state:j=null,key:S="default",unstable_mask:k}=s,E=x.useMemo(()=>{let w=Ta(p,h);return w==null?null:{location:{pathname:w,search:y,hash:v,state:j,key:S,unstable_mask:k},navigationType:o}},[h,p,y,v,j,S,o,k]);return Yn(E!=null,`<Router basename="${h}"> is not able to match the URL "${p}${y}${v}" because it does not start with the basename, so the <Router> won't render anything.`),E==null?null:x.createElement(Vn.Provider,{value:g},x.createElement(_o.Provider,{children:r,value:E}))}var jo="get",So="application/x-www-form-urlencoded";function Oo(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function J0(n){return Oo(n)&&n.tagName.toLowerCase()==="button"}function ej(n){return Oo(n)&&n.tagName.toLowerCase()==="form"}function tj(n){return Oo(n)&&n.tagName.toLowerCase()==="input"}function nj(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function aj(n,r){return n.button===0&&(!r||r==="_self")&&!nj(n)}var co=null;function rj(){if(co===null)try{new FormData(document.createElement("form"),0),co=!1}catch{co=!0}return co}var lj=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function md(n){return n!=null&&!lj.has(n)?(Yn(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${So}"`),null):n}function sj(n,r){let s,o,c,d,f;if(ej(n)){let h=n.getAttribute("action");o=h?Ta(h,r):null,s=n.getAttribute("method")||jo,c=md(n.getAttribute("enctype"))||So,d=new FormData(n)}else if(J0(n)||tj(n)&&(n.type==="submit"||n.type==="image")){let h=n.form;if(h==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let g=n.getAttribute("formaction")||h.getAttribute("action");if(o=g?Ta(g,r):null,s=n.getAttribute("formmethod")||h.getAttribute("method")||jo,c=md(n.getAttribute("formenctype"))||md(h.getAttribute("enctype"))||So,d=new FormData(h,n),!rj()){let{name:p,type:y,value:v}=n;if(y==="image"){let j=p?`${p}.`:"";d.append(`${j}x`,"0"),d.append(`${j}y`,"0")}else p&&d.append(p,v)}}else{if(Oo(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');s=jo,o=null,c=So,f=n}return d&&c==="text/plain"&&(f=d,d=void 0),{action:o,method:s.toLowerCase(),encType:c,formData:d,body:f}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function ff(n,r){if(n===!1||n===null||typeof n>"u")throw new Error(r)}function ij(n,r,s,o){let c=typeof n=="string"?new URL(n,typeof window>"u"?"server://singlefetch/":window.location.origin):n;return s?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${o}`:c.pathname=`${c.pathname}.${o}`:c.pathname==="/"?c.pathname=`_root.${o}`:r&&Ta(c.pathname,r)==="/"?c.pathname=`${r.replace(/\/$/,"")}/_root.${o}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${o}`,c}async function oj(n,r){if(n.id in r)return r[n.id];try{let s=await import(n.module);return r[n.id]=s,s}catch(s){return console.error(`Error loading route module \`${n.module}\`, reloading page...`),console.error(s),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function cj(n){return n==null?!1:n.href==null?n.rel==="preload"&&typeof n.imageSrcSet=="string"&&typeof n.imageSizes=="string":typeof n.rel=="string"&&typeof n.href=="string"}async function uj(n,r,s){let o=await Promise.all(n.map(async c=>{let d=r.routes[c.route.id];if(d){let f=await oj(d,s);return f.links?f.links():[]}return[]}));return mj(o.flat(1).filter(cj).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function Ix(n,r,s,o,c,d){let f=(g,p)=>s[p]?g.route.id!==s[p].route.id:!0,h=(g,p)=>{var y;return s[p].pathname!==g.pathname||((y=s[p].route.path)==null?void 0:y.endsWith("*"))&&s[p].params["*"]!==g.params["*"]};return d==="assets"?r.filter((g,p)=>f(g,p)||h(g,p)):d==="data"?r.filter((g,p)=>{var v;let y=o.routes[g.route.id];if(!y||!y.hasLoader)return!1;if(f(g,p)||h(g,p))return!0;if(g.route.shouldRevalidate){let j=g.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((v=s[0])==null?void 0:v.params)||{},nextUrl:new URL(n,window.origin),nextParams:g.params,defaultShouldRevalidate:!0});if(typeof j=="boolean")return j}return!0}):[]}function dj(n,r,{includeHydrateFallback:s}={}){return fj(n.map(o=>{let c=r.routes[o.route.id];if(!c)return[];let d=[c.module];return c.clientActionModule&&(d=d.concat(c.clientActionModule)),c.clientLoaderModule&&(d=d.concat(c.clientLoaderModule)),s&&c.hydrateFallbackModule&&(d=d.concat(c.hydrateFallbackModule)),c.imports&&(d=d.concat(c.imports)),d}).flat(1))}function fj(n){return[...new Set(n)]}function pj(n){let r={},s=Object.keys(n).sort();for(let o of s)r[o]=n[o];return r}function mj(n,r){let s=new Set;return new Set(r),n.reduce((o,c)=>{let d=JSON.stringify(pj(c));return s.has(d)||(s.add(d),o.push({key:d,link:c})),o},[])}function fv(){let n=x.useContext(Rl);return ff(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function hj(){let n=x.useContext(Do);return ff(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var pf=x.createContext(void 0);pf.displayName="FrameworkContext";function pv(){let n=x.useContext(pf);return ff(n,"You must render this element inside a <HydratedRouter> element"),n}function xj(n,r){let s=x.useContext(pf),[o,c]=x.useState(!1),[d,f]=x.useState(!1),{onFocus:h,onBlur:g,onMouseEnter:p,onMouseLeave:y,onTouchStart:v}=r,j=x.useRef(null);x.useEffect(()=>{if(n==="render"&&f(!0),n==="viewport"){let E=N=>{N.forEach(A=>{f(A.isIntersecting)})},w=new IntersectionObserver(E,{threshold:.5});return j.current&&w.observe(j.current),()=>{w.disconnect()}}},[n]),x.useEffect(()=>{if(o){let E=setTimeout(()=>{f(!0)},100);return()=>{clearTimeout(E)}}},[o]);let S=()=>{c(!0)},k=()=>{c(!1),f(!1)};return s?n!=="intent"?[d,j,{}]:[d,j,{onFocus:ws(h,S),onBlur:ws(g,k),onMouseEnter:ws(p,S),onMouseLeave:ws(y,k),onTouchStart:ws(v,S)}]:[!1,j,{}]}function ws(n,r){return s=>{n&&n(s),s.defaultPrevented||r(s)}}function gj({page:n,...r}){let{router:s}=fv(),o=x.useMemo(()=>Jg(s.routes,n,s.basename),[s.routes,n,s.basename]);return o?x.createElement(yj,{page:n,matches:o,...r}):null}function vj(n){let{manifest:r,routeModules:s}=pv(),[o,c]=x.useState([]);return x.useEffect(()=>{let d=!1;return uj(n,r,s).then(f=>{d||c(f)}),()=>{d=!0}},[n,r,s]),o}function yj({page:n,matches:r,...s}){let o=lr(),{future:c,manifest:d,routeModules:f}=pv(),{basename:h}=fv(),{loaderData:g,matches:p}=hj(),y=x.useMemo(()=>Ix(n,r,p,d,o,"data"),[n,r,p,d,o]),v=x.useMemo(()=>Ix(n,r,p,d,o,"assets"),[n,r,p,d,o]),j=x.useMemo(()=>{if(n===o.pathname+o.search+o.hash)return[];let E=new Set,w=!1;if(r.forEach(A=>{var H;let z=d.routes[A.route.id];!z||!z.hasLoader||(!y.some(M=>M.route.id===A.route.id)&&A.route.id in g&&((H=f[A.route.id])!=null&&H.shouldRevalidate)||z.hasClientLoader?w=!0:E.add(A.route.id))}),E.size===0)return[];let N=ij(n,h,c.unstable_trailingSlashAwareDataRequests,"data");return w&&E.size>0&&N.searchParams.set("_routes",r.filter(A=>E.has(A.route.id)).map(A=>A.route.id).join(",")),[N.pathname+N.search]},[h,c.unstable_trailingSlashAwareDataRequests,g,o,d,y,r,n,f]),S=x.useMemo(()=>dj(v,d),[v,d]),k=vj(v);return x.createElement(x.Fragment,null,j.map(E=>x.createElement("link",{key:E,rel:"prefetch",as:"fetch",href:E,...s})),S.map(E=>x.createElement("link",{key:E,rel:"modulepreload",href:E,...s})),k.map(({key:E,link:w})=>x.createElement("link",{key:E,nonce:s.nonce,...w,crossOrigin:w.crossOrigin??s.crossOrigin})))}function bj(...n){return r=>{n.forEach(s=>{typeof s=="function"?s(r):s!=null&&(s.current=r)})}}var jj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{jj&&(window.__reactRouterVersion="7.13.1")}catch{}function Sj({basename:n,children:r,unstable_useTransitions:s,window:o}){let c=x.useRef();c.current==null&&(c.current=n0({window:o,v5Compat:!0}));let d=c.current,[f,h]=x.useState({action:d.action,location:d.location}),g=x.useCallback(p=>{s===!1?h(p):x.startTransition(()=>h(p))},[s]);return x.useLayoutEffect(()=>d.listen(g),[d,g]),x.createElement(Z0,{basename:n,children:r,location:f.location,navigationType:f.action,navigator:d,unstable_useTransitions:s})}var mv=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,hv=x.forwardRef(function({onClick:r,discover:s="render",prefetch:o="none",relative:c,reloadDocument:d,replace:f,unstable_mask:h,state:g,target:p,to:y,preventScrollReset:v,viewTransition:j,unstable_defaultShouldRevalidate:S,...k},E){let{basename:w,navigator:N,unstable_useTransitions:A}=x.useContext(Vn),z=typeof y=="string"&&mv.test(y),H=rv(y,w);y=H.to;let M=O0(y,{relative:c}),F=lr(),T=null;if(h){let I=of(h,[],F.unstable_mask?F.unstable_mask.pathname:"/",!0);w!=="/"&&(I.pathname=I.pathname==="/"?w:la([w,I.pathname])),T=N.createHref(I)}let[O,C,_]=xj(o,k),$=Cj(y,{replace:f,unstable_mask:h,state:g,target:p,preventScrollReset:v,relative:c,viewTransition:j,unstable_defaultShouldRevalidate:S,unstable_useTransitions:A});function K(I){r&&r(I),I.defaultPrevented||$(I)}let Z=!(H.isExternal||d),q=x.createElement("a",{...k,..._,href:(Z?T:void 0)||H.absoluteURL||M,onClick:Z?K:r,ref:bj(E,C),target:p,"data-discover":!z&&s==="render"?"true":void 0});return O&&!z?x.createElement(x.Fragment,null,q,x.createElement(gj,{page:M})):q});hv.displayName="Link";var kj=x.forwardRef(function({"aria-current":r="page",caseSensitive:s=!1,className:o="",end:c=!1,style:d,to:f,viewTransition:h,children:g,...p},y){let v=Fs(f,{relative:p.relative}),j=lr(),S=x.useContext(Do),{navigator:k,basename:E}=x.useContext(Vn),w=S!=null&&Mj(v)&&h===!0,N=k.encodeLocation?k.encodeLocation(v).pathname:v.pathname,A=j.pathname,z=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;s||(A=A.toLowerCase(),z=z?z.toLowerCase():null,N=N.toLowerCase()),z&&E&&(z=Ta(z,E)||z);const H=N!=="/"&&N.endsWith("/")?N.length-1:N.length;let M=A===N||!c&&A.startsWith(N)&&A.charAt(H)==="/",F=z!=null&&(z===N||!c&&z.startsWith(N)&&z.charAt(N.length)==="/"),T={isActive:M,isPending:F,isTransitioning:w},O=M?r:void 0,C;typeof o=="function"?C=o(T):C=[o,M?"active":null,F?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let _=typeof d=="function"?d(T):d;return x.createElement(hv,{...p,"aria-current":O,className:C,ref:y,style:_,to:f,viewTransition:h},typeof g=="function"?g(T):g)});kj.displayName="NavLink";var wj=x.forwardRef(({discover:n="render",fetcherKey:r,navigate:s,reloadDocument:o,replace:c,state:d,method:f=jo,action:h,onSubmit:g,relative:p,preventScrollReset:y,viewTransition:v,unstable_defaultShouldRevalidate:j,...S},k)=>{let{unstable_useTransitions:E}=x.useContext(Vn),w=Rj(),N=Aj(h,{relative:p}),A=f.toLowerCase()==="get"?"get":"post",z=typeof h=="string"&&mv.test(h),H=M=>{if(g&&g(M),M.defaultPrevented)return;M.preventDefault();let F=M.nativeEvent.submitter,T=(F==null?void 0:F.getAttribute("formmethod"))||f,O=()=>w(F||M.currentTarget,{fetcherKey:r,method:T,navigate:s,replace:c,state:d,relative:p,preventScrollReset:y,viewTransition:v,unstable_defaultShouldRevalidate:j});E&&s!==!1?x.startTransition(()=>O()):O()};return x.createElement("form",{ref:k,method:A,action:N,onSubmit:o?g:H,...S,"data-discover":!z&&n==="render"?"true":void 0})});wj.displayName="Form";function Ej(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function xv(n){let r=x.useContext(Rl);return Vt(r,Ej(n)),r}function Cj(n,{target:r,replace:s,unstable_mask:o,state:c,preventScrollReset:d,relative:f,viewTransition:h,unstable_defaultShouldRevalidate:g,unstable_useTransitions:p}={}){let y=B0(),v=lr(),j=Fs(n,{relative:f});return x.useCallback(S=>{if(aj(S,r)){S.preventDefault();let k=s!==void 0?s:_s(v)===_s(j),E=()=>y(n,{replace:k,unstable_mask:o,state:c,preventScrollReset:d,relative:f,viewTransition:h,unstable_defaultShouldRevalidate:g});p?x.startTransition(()=>E()):E()}},[v,y,j,s,o,c,r,n,d,f,h,g,p])}var Nj=0,Tj=()=>`__${String(++Nj)}__`;function Rj(){let{router:n}=xv("useSubmit"),{basename:r}=x.useContext(Vn),s=q0(),o=n.fetch,c=n.navigate;return x.useCallback(async(d,f={})=>{let{action:h,method:g,encType:p,formData:y,body:v}=sj(d,r);if(f.navigate===!1){let j=f.fetcherKey||Tj();await o(j,s,f.action||h,{unstable_defaultShouldRevalidate:f.unstable_defaultShouldRevalidate,preventScrollReset:f.preventScrollReset,formData:y,body:v,formMethod:f.method||g,formEncType:f.encType||p,flushSync:f.flushSync})}else await c(f.action||h,{unstable_defaultShouldRevalidate:f.unstable_defaultShouldRevalidate,preventScrollReset:f.preventScrollReset,formData:y,body:v,formMethod:f.method||g,formEncType:f.encType||p,replace:f.replace,state:f.state,fromRouteId:s,flushSync:f.flushSync,viewTransition:f.viewTransition})},[o,c,r,s])}function Aj(n,{relative:r}={}){let{basename:s}=x.useContext(Vn),o=x.useContext(Ra);Vt(o,"useFormAction must be used inside a RouteContext");let[c]=o.matches.slice(-1),d={...Fs(n||".",{relative:r})},f=lr();if(n==null){d.search=f.search;let h=new URLSearchParams(d.search),g=h.getAll("index");if(g.some(y=>y==="")){h.delete("index"),g.filter(v=>v).forEach(v=>h.append("index",v));let y=h.toString();d.search=y?`?${y}`:""}}return(!n||n===".")&&c.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),s!=="/"&&(d.pathname=d.pathname==="/"?s:la([s,d.pathname])),_s(d)}function Mj(n,{relative:r}={}){let s=x.useContext(sv);Vt(s!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=xv("useViewTransitionState"),c=Fs(n,{relative:r});if(!s.isTransitioning)return!1;let d=Ta(s.currentLocation.pathname,o)||s.currentLocation.pathname,f=Ta(s.nextLocation.pathname,o)||s.nextLocation.pathname;return To(c.pathname,f)!=null||To(c.pathname,d)!=null}var Bo=Zg();const Lj=Qg(Bo),zj="modulepreload",Dj=function(n){return"/"+n},Hx={},Io=function(r,s,o){let c=Promise.resolve();if(s&&s.length>0){let f=function(p){return Promise.all(p.map(y=>Promise.resolve(y).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),g=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));c=f(s.map(p=>{if(p=Dj(p),p in Hx)return;Hx[p]=!0;const y=p.endsWith(".css"),v=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${v}`))return;const j=document.createElement("link");if(j.rel=y?"stylesheet":zj,y||(j.as="script"),j.crossOrigin="",j.href=p,g&&j.setAttribute("nonce",g),document.head.appendChild(j),y)return new Promise((S,k)=>{j.addEventListener("load",S),j.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${p}`)))})}))}function d(f){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=f,window.dispatchEvent(h),!h.defaultPrevented)throw f}return c.then(f=>{for(const h of f||[])h.status==="rejected"&&d(h.reason);return r().catch(d)})},Ux={own:"authoring-project",installed:"available-project",global:"available-personal"},Fd=new Set(["available-project","available-personal","available-plugin","authoring-project","authoring-plugin"]);function _j(n){if(typeof n=="string"){if(Fd.has(n))return n;if(Object.prototype.hasOwnProperty.call(Ux,n))return Ux[n]}return"authoring-project"}function Oj(n){return n.startsWith("available-")?"available":"authoring"}function Bj(n){const r=n.indexOf("-");return n.slice(r+1)}const na="";class Ms extends Error{constructor(r,s){super(r),this.name="ApiError",this.status=s}}async function Ue(n,r){const s=await fetch(`${na}${n}`,r);if(!s.ok){const o=await s.json().catch(()=>({error:s.statusText}));throw new Ms(o.error||`HTTP ${s.status}`,s.status)}return s.json()}function rn(n){return typeof n=="string"&&n.length>0?n:null}function Ij(n){return typeof n=="number"&&Number.isFinite(n)?n:null}function hd(n){if(!Array.isArray(n))return null;const r=n.filter(s=>typeof s=="string"&&s.length>0);return r.length>0?r:null}function Hj(n){const r=n??{};let s;r.origin==="source"||r.origin==="installed"?s=r.origin:(s="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=s==="installed"?"installed":"own";let c;r.installMethod==="authored"||r.installMethod==="copied"||r.installMethod==="symlinked"?c=r.installMethod:c=o==="own"?"authored":"copied";const d=typeof r.scopeV2=="string"&&Fd.has(r.scopeV2)?r.scopeV2:_j(r.scope),f=Oj(d),h=Bj(d),g=typeof r.precedenceRank=="number"?r.precedenceRank:void 0;let p;r.shadowedBy===null?p=null:typeof r.shadowedBy=="string"&&Fd.has(r.shadowedBy)?p=r.shadowedBy:p=void 0;const y={plugin:typeof r.plugin=="string"?r.plugin:"",skill:typeof r.skill=="string"?r.skill:"",dir:typeof r.dir=="string"?r.dir:"",hasEvals:!!r.hasEvals,hasBenchmark:!!r.hasBenchmark,evalCount:typeof r.evalCount=="number"?r.evalCount:0,assertionCount:typeof r.assertionCount=="number"?r.assertionCount:0,benchmarkStatus:r.benchmarkStatus==="pass"||r.benchmarkStatus==="fail"||r.benchmarkStatus==="pending"||r.benchmarkStatus==="stale"||r.benchmarkStatus==="missing"?r.benchmarkStatus:"missing",lastBenchmark:typeof r.lastBenchmark=="string"?r.lastBenchmark:null,origin:s,scope:o,isSymlink:typeof r.isSymlink=="boolean"?r.isSymlink:!1,symlinkTarget:rn(r.symlinkTarget),installMethod:c,scopeV2:d,group:f,source:h,pluginName:rn(r.pluginName),pluginNamespace:rn(r.pluginNamespace),pluginMarketplace:rn(r.pluginMarketplace),pluginManifestPath:rn(r.pluginManifestPath),pluginVersion:rn(r.pluginVersion),precedenceRank:g,shadowedBy:p,description:rn(r.description),version:rn(r.version),category:rn(r.category),author:rn(r.author),license:rn(r.license),homepage:rn(r.homepage),tags:hd(r.tags),deps:hd(r.deps),mcpDeps:hd(r.mcpDeps),entryPoint:rn(r.entryPoint),lastModified:rn(r.lastModified),sizeBytes:Ij(r.sizeBytes),sourceAgent:rn(r.sourceAgent)};if(r.provenance&&typeof r.provenance=="object"){const v=r.provenance;(v.promotedFrom==="installed"||v.promotedFrom==="global")&&typeof v.sourcePath=="string"&&typeof v.promotedAt=="number"?y.provenance={promotedFrom:v.promotedFrom,sourcePath:v.sourcePath,promotedAt:v.promotedAt,sourceSkillVersion:typeof v.sourceSkillVersion=="string"?v.sourceSkillVersion:void 0}:y.provenance=null}else r.provenance===null&&(y.provenance=null);return typeof r.updateAvailable=="boolean"&&(y.updateAvailable=r.updateAvailable),typeof r.currentVersion=="string"&&(y.currentVersion=r.currentVersion),typeof r.latestVersion=="string"&&(y.latestVersion=r.latestVersion),typeof r.pinnedVersion=="string"&&(y.pinnedVersion=r.pinnedVersion),y}const Ce={getConfig(){return Ue("/api/config")},setConfig(n,r){return Ue("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:n,model:r})})},async getSkills(n){const r=new URLSearchParams;n!=null&&n.scope&&r.set("scope",n.scope),n!=null&&n.agent&&r.set("agent",n.agent);const s=r.toString(),o=await Ue(`/api/skills${s?"?"+s:""}`);return Array.isArray(o)?o.map(Hj):[]},getAgents(){return Ue("/api/agents")},getSkillDetail(n,r){return Ue(`/api/skills/${n}/${r}`)},async getEvals(n,r){const s=await Ue(`/api/skills/${n}/${r}/evals`);if(s&&typeof s=="object"&&"exists"in s){if(s.exists===!1)return{skill_name:r,evals:[]};const{exists:o,...c}=s;return c}return s},getEvalsEnvelope(n,r){return Ue(`/api/skills/${n}/${r}/evals`)},getActivationHistoryEnvelope(n,r){return Ue(`/api/skills/${n}/${r}/activation-history`)},saveEvals(n,r,s){return Ue(`/api/skills/${n}/${r}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})},generateEvals(n,r){return Ue(`/api/skills/${n}/${r}/generate-evals`,{method:"POST"})},async getLatestBenchmark(n,r){const s=await fetch(`${na}/api/skills/${n}/${r}/benchmark/latest`);if(!s.ok){const o=await s.json().catch(()=>({error:s.statusText}));throw new Ms(o.error||`HTTP ${s.status}`,s.status)}return s.json()},getHistory(n,r,s){const o=new URLSearchParams;s!=null&&s.model&&o.set("model",s.model),s!=null&&s.type&&o.set("type",s.type),s!=null&&s.from&&o.set("from",s.from),s!=null&&s.to&&o.set("to",s.to);const c=o.toString();return Ue(`/api/skills/${n}/${r}/history${c?"?"+c:""}`)},getHistoryEntry(n,r,s){return Ue(`/api/skills/${n}/${r}/history/${encodeURIComponent(s)}`)},compareRuns(n,r,s,o){return Ue(`/api/skills/${n}/${r}/history-compare?a=${encodeURIComponent(s)}&b=${encodeURIComponent(o)}`)},getCaseHistory(n,r,s,o){const c=new URLSearchParams;o&&c.set("model",o);const d=c.toString();return Ue(`/api/skills/${n}/${r}/history/case/${s}${d?"?"+d:""}`)},deleteHistoryEntry(n,r,s){return Ue(`/api/skills/${n}/${r}/history/${encodeURIComponent(s)}`,{method:"DELETE"})},deleteSkill(n,r){return Ue(`/api/skills/${n}/${r}`,{method:"DELETE"})},improveSkill(n,r,s){return Ue(`/api/skills/${n}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})},instructEdit(n,r,s){return Ue(`/api/skills/${n}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"instruct",...s})})},applyImprovement(n,r,s){return Ue(`/api/skills/${n}/${r}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:s})})},getStats(n,r){return Ue(`/api/skills/${n}/${r}/stats`)},getDependencies(n,r){return Ue(`/api/skills/${n}/${r}/dependencies`)},getProjectLayout(){return Ue("/api/project-layout")},createSkill(n){return Ue("/api/skills/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})},saveDraft(n){return Ue("/api/skills/save-draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})},getSkillCreatorStatus(){return Ue("/api/skill-creator-status")},generateSkill(n){return Ue("/api/skills/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})},getSkillFiles(n,r){return Ue(`/api/skills/${n}/${r}/files`)},getSkillFile(n,r,s){return Ue(`/api/skills/${n}/${r}/file?path=${encodeURIComponent(s)}`)},saveSkillFile(n,r,s,o){return Ue(`/api/skills/${n}/${r}/file`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:s,content:o})})},getLeaderboard(n,r){return Ue(`/api/skills/${n}/${r}/leaderboard`)},getLeaderboardEntry(n,r,s){return Ue(`/api/skills/${n}/${r}/leaderboard/${encodeURIComponent(s)}`)},startSweep(n,r,s){const o=`${na}/api/skills/${n}/${r}/sweep`,c=new EventSource(o);return fetch(o,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(s)}),c},getCredentials(n,r){return Ue(`/api/credentials/${n}/${r}`)},setCredential(n,r,s,o){return Ue(`/api/credentials/${n}/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,value:o})})},getParams(n,r){return Ue(`/api/credentials/${n}/${r}/params`)},getParamsRevealed(n,r,s){const o=s?`reveal=true&key=${encodeURIComponent(s)}`:"reveal=true";return Ue(`/api/credentials/${n}/${r}/params?${o}`)},searchModels(){return Ue("/api/openrouter/models")},async getSkillVersions(n,r){const s=await Ue(`/api/skills/${n}/${r}/versions`);return Array.isArray(s)?s:Array.isArray(s.versions)?s.versions:[]},getSkillVersionsEnvelope(n,r){return Ue(`/api/skills/${n}/${r}/versions`)},getVersionDiff(n,r,s,o){return Ue(`/api/skills/${n}/${r}/versions/diff?from=${s}&to=${o}`)},startBatchUpdate(n){const r=`${na}/api/skills/batch-update`,s=new EventSource(r);return fetch(r,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({skills:n})}),s},startSkillUpdate(n,r){const s=`${na}/api/skills/${n}/${r}/update`,o=new EventSource(s);return fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"}}),o},async rescanSkill(n,r){const s=`${n}/${r}`,o=await fetch(`${na}/api/v1/skills/${encodeURIComponent(s)}/rescan`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!o.ok)throw new Error(`rescan failed: HTTP ${o.status}`);return await o.json()},async getSkillUpdates(){try{const n=await fetch(`${na}/api/skills/updates`);return n.ok?await n.json():[]}catch{return[]}},async checkSkillUpdates(n){if(n.length===0)return[];const r=encodeURIComponent([...n].sort().join(","));try{const s=await fetch(`${na}/api/v1/skills/check-updates?skills=${r}`);if(!s.ok)return[];const o=await s.json().catch(()=>null);return Array.isArray(o)?o:[]}catch{return[]}},promoteSkill(n,r,s){const o=s!=null&&s.overwrite?"?overwrite=true":"";return xd(`/api/skills/${n}/${r}/promote${o}`,s==null?void 0:s.onEvent,s==null?void 0:s.signal)},testInstallSkill(n,r,s){const o=new URLSearchParams;(s==null?void 0:s.dest)==="global"&&o.set("dest","global"),s!=null&&s.overwrite&&o.set("overwrite","true");const c=o.toString();return xd(`/api/skills/${n}/${r}/test-install${c?"?"+c:""}`,s==null?void 0:s.onEvent,s==null?void 0:s.signal)},revertSkill(n,r,s){return xd(`/api/skills/${n}/${r}/revert`,s==null?void 0:s.onEvent,s==null?void 0:s.signal)},listStudioOps(n){const r=new URLSearchParams;(n==null?void 0:n.before)!=null&&r.set("before",String(n.before)),(n==null?void 0:n.limit)!=null&&r.set("limit",String(n.limit));const s=r.toString();return Ue(`/api/studio/ops${s?"?"+s:""}`)},deleteStudioOp(n){return Ue(`/api/studio/ops/${encodeURIComponent(n)}`,{method:"DELETE"})},studioOpsStream(){return new EventSource(`${na}/api/studio/ops/stream`)}};async function xd(n,r,s){const o=await fetch(`${na}${n}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},signal:s});if(!o.ok||!o.body){let y=`HTTP ${o.status}`,v;try{const S=await o.json();S.error&&(y=S.error),typeof S.code=="string"&&(v=S.code)}catch{}const j=new Ms(y,o.status);throw v&&(j.code=v),j}const c=o.body.getReader(),d=new TextDecoder;let f="",h="",g=null,p=null;for(;;){const{done:y,value:v}=await c.read();if(y)break;f+=d.decode(v,{stream:!0});const j=f.split(`
62
- `);f=j.pop()??"";for(const S of j)if(S.startsWith("event: "))h=S.slice(7).trim();else if(S.startsWith("data: ")){let k={};try{k=JSON.parse(S.slice(6))}catch{h="";continue}if(h==="started"||h==="copied"||h==="deleted"||h==="indexed"||h==="done"||h==="error"){const E={type:h,...k};r==null||r(E),E.type==="done"&&(g=E),E.type==="error"&&(p=E)}h=""}}if(p){const y=new Ms(p.message,500);throw y.code=p.code,y}if(!g)throw new Ms("Transfer stream ended without 'done' event",500);return g}function Uj(n,r){if(!r.length)return n;const s=new Map;for(const o of r){const c=o.name.split("/").pop()||o.name;s.set(c,o)}return n.map(o=>{const c=s.get(o.skill);return c?{...o,updateAvailable:c.updateAvailable,currentVersion:c.installed,latestVersion:c.latest??void 0}:o})}function $j(n){const[r,s]=x.useState(()=>typeof window>"u"?!1:window.matchMedia(n).matches);return x.useEffect(()=>{const o=window.matchMedia(n);s(o.matches);const c=d=>s(d.matches);return o.addEventListener("change",c),()=>o.removeEventListener("change",c)},[n]),r}const Vj=500,Gd="vskill.updates.seenLastId";function Pj(){if(typeof window>"u")return null;try{return window.localStorage.getItem(Gd)}catch{return null}}function gd(n){if(!(typeof window>"u"))try{n==null?window.localStorage.removeItem(Gd):window.localStorage.setItem(Gd,n)}catch{}}function Fj(){let n=new Map;const r=new Set,s=new Set,o=[];let c=Pj();c&&(s.add(c),o.push(c));function d(){n=new Map(n);for(const h of Array.from(r))h()}function f(h){if(!s.has(h)){if(s.add(h),o.push(h),o.length>Vj){const g=o.shift();g&&s.delete(g)}c=h,gd(h)}}return{getSnapshot(){return n},subscribe(h){return r.add(h),()=>{r.delete(h)}},ingest(h){return s.has(h.eventId)?"duplicate":(f(h.eventId),n.set(h.skillId,{skillId:h.skillId,version:h.version,diffSummary:h.diffSummary,eventId:h.eventId,publishedAt:h.publishedAt,receivedAt:Date.now()}),d(),"stored")},dismiss(h){n.has(h)&&(n.delete(h),d())},clearSeen(){s.clear(),o.length=0,c=null,gd(null)},mergeBulk(h){if(h.length!==0){for(const g of h)n.set(g.skillId,g);d()}},getSeenLastId(){return c},reset(){n=new Map,s.clear(),o.length=0,c=null,gd(null),d()}}}const Rr=Fj(),Gj=3e5,Wj=500,Yj=15e3,qj=6e4,Kj=6e4,Xj="/api/v1/skills/stream";function Qj(n){const r=new Map;for(const s of n){const o=s.name.split("/").pop()||s.name;r.set(o,s)}return r}function Zj(n){let r=0;for(const s of n)s.updateAvailable&&r++;return r}function Jj(n){if(!n||typeof n!="object")return!1;const r=n;return r.type==="skill.updated"&&typeof r.eventId=="string"&&typeof r.skillId=="string"&&typeof r.version=="string"}function e2(n){const r=(n==null?void 0:n.intervalMs)??Gj,s=(n==null?void 0:n.debounceMs)??Wj,o=(n==null?void 0:n.timeoutMs)??Yj,c=(n==null?void 0:n.staleAfterMs)??qj,d=(n==null?void 0:n.disconnectFallbackMs)??Kj,f=(n==null?void 0:n.streamUrlBase)??Xj,h=x.useMemo(()=>!(n!=null&&n.skillIds)||n.skillIds.length===0?"":[...n.skillIds].sort().join(","),[n==null?void 0:n.skillIds]),[g,p]=x.useState([]),[y,v]=x.useState(()=>new Map),[j,S]=x.useState(0),[k,E]=x.useState(!1),[w,N]=x.useState(null),[A,z]=x.useState(null),H=x.useRef(null),M=x.useRef(null),F=x.useRef(null),T=x.useRef(null),O=x.useRef(!0),[C,_]=x.useState(()=>h?"connecting":"fallback"),$=x.useRef(C);$.current=C;const K=x.useSyncExternalStore(ie=>Rr.subscribe(ie),()=>Rr.getSnapshot(),()=>Rr.getSnapshot()),Z=K.size,q=x.useCallback(async()=>{E(!0);const ie=new AbortController,D=setTimeout(()=>ie.abort(),o);try{const V=await Promise.race([Ce.getSkillUpdates(),new Promise((te,se)=>{ie.signal.addEventListener("abort",()=>{se(new Error("TIMEOUT"))})})]);if(V==="TIMEOUT")throw new Error("TIMEOUT");if(!O.current)return;p(V),v(Qj(V)),S(Zj(V)),M.current=Date.now(),N(M.current),z(null)}catch(V){if(!O.current)return;z(V instanceof Error?V:new Error(String(V)))}finally{clearTimeout(D),O.current&&E(!1)}},[o]),I=x.useCallback(()=>{if(H.current)return H.current;const ie=q().finally(()=>{H.current=null});return H.current=ie,ie},[q]),L=x.useCallback(()=>{F.current==null&&(F.current=setInterval(()=>{I()},r))},[r,I]),B=x.useCallback(()=>{F.current!=null&&(clearInterval(F.current),F.current=null)},[]);x.useEffect(()=>{O.current=!0,(M.current==null||Date.now()-M.current>c)&&I(),(typeof document>"u"||document.visibilityState!=="hidden")&&L();const V=()=>{if(T.current&&(clearTimeout(T.current),T.current=null),document.visibilityState==="hidden"){B();return}T.current=setTimeout(()=>{T.current=null,(M.current==null||Date.now()-M.current>c)&&I(),L()},s)};return typeof document<"u"&&document.addEventListener("visibilitychange",V),()=>{O.current=!1,typeof document<"u"&&document.removeEventListener("visibilitychange",V),T.current&&clearTimeout(T.current),B()}},[]);const P=x.useCallback(async ie=>{if(ie.length!==0)try{const D=await Ce.checkSkillUpdates(ie);if(!O.current||D.length===0)return;const V=Date.now(),te=D.map(se=>({skillId:se.skillId,version:se.version,eventId:se.eventId,publishedAt:se.publishedAt,diffSummary:se.diffSummary,receivedAt:V}));Rr.mergeBulk(te)}catch{}},[]);x.useEffect(()=>{if(!h){_("fallback");return}if(typeof window>"u"||typeof EventSource>"u"){_("fallback");return}_("connecting");const ie=h.split(","),D=`${f}?skills=${encodeURIComponent(h)}`,V=new EventSource(D);let te=null;const se=()=>{te==null&&(te=setTimeout(()=>{te=null,O.current&&$.current!=="connected"&&_("fallback")},d))},ge=()=>{te!=null&&(clearTimeout(te),te=null)};se(),V.onopen=()=>{O.current&&(ge(),_("connected"))},V.onerror=()=>{O.current&&se()},V.onmessage=be=>{if(!O.current)return;let ce;try{ce=JSON.parse(be.data)}catch{return}if(!Jj(ce)||Rr.ingest(ce)==="duplicate")return;if(typeof document>"u"||document.visibilityState!=="hidden"){const ze=`${ce.skillId} updated to ${ce.version}`;window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:ze,severity:"info",skillId:ce.skillId,version:ce.version,eventId:ce.eventId}}))}};const he=()=>{O.current&&(Rr.clearSeen(),P(ie))};return V.addEventListener("gone",he),()=>{ge(),V.removeEventListener("gone",he),V.close()}},[h,f,d,P]);const W=x.useCallback(ie=>{Rr.dismiss(ie)},[]);return{updates:g,updatesMap:y,updateCount:j,isRefreshing:k,lastFetchAt:w,error:A,refresh:I,updatesById:K,pushUpdateCount:Z,status:C,dismiss:W}}const t2={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list",updateNotificationDismissed:!1,revealSkillId:null};function n2(n,r){switch(r.type){case"SELECT_SKILL":return{...n,selectedSkill:r.skill,mode:"browse",mobileView:n.isMobile?"detail":n.mobileView};case"CLEAR_SELECTION":return{...n,selectedSkill:null};case"SET_MODE":return{...n,mode:r.mode,selectedSkill:r.mode==="create"?null:n.selectedSkill};case"SET_SEARCH":return{...n,searchQuery:r.query};case"SET_SKILLS":return{...n,skills:r.skills,skillsLoading:!1,skillsError:null};case"SET_SKILLS_ERROR":return{...n,skillsError:r.error,skillsLoading:!1};case"SET_SKILLS_LOADING":return{...n,skillsLoading:r.loading};case"SET_MOBILE":return{...n,isMobile:r.isMobile};case"SET_MOBILE_VIEW":return{...n,mobileView:r.view};case"DISMISS_UPDATE_NOTIFICATION":return{...n,updateNotificationDismissed:!0};case"REVEAL_SKILL":return{...n,selectedSkill:r.skill,revealSkillId:`${r.skill.plugin}/${r.skill.skill}`,mode:"browse",mobileView:n.isMobile?"detail":n.mobileView};case"CLEAR_REVEAL":return{...n,revealSkillId:null};default:return n}}const gv=x.createContext(null),vv=gv;function sa(){const n=x.useContext(vv);if(!n)throw new Error("useStudio must be used within StudioProvider");return n}function a2({children:n}){const[r,s]=x.useReducer(n2,t2),o=$j("(max-width: 767px)");x.useEffect(()=>{s({type:"SET_MOBILE",isMobile:o})},[o]);const[c,d]=x.useState(()=>{try{const C=window.localStorage.getItem("vskill.studio.prefs");if(!C)return null;const _=JSON.parse(C);return typeof _.activeAgent=="string"?_.activeAgent:null}catch{return null}});x.useEffect(()=>{function C(_){if(!(_ instanceof CustomEvent))return;const $=_.detail;$!=null&&$.agentId&&d($.agentId)}return window.addEventListener("studio:agent-changed",C),()=>window.removeEventListener("studio:agent-changed",C)},[]);const f=x.useCallback(()=>{s({type:"SET_SKILLS_LOADING",loading:!0});const C=c?{agent:c}:void 0;Ce.getSkills(C).then(_=>{s({type:"SET_SKILLS",skills:_});const K=window.location.hash.match(/^#\/skills\/([^/]+)\/([^/?]+)/);if(K){const[,Z,q]=K,I=_.find(L=>L.plugin===Z&&L.skill===q);I&&s({type:"SELECT_SKILL",skill:{plugin:Z,skill:q,origin:I.origin}})}}).catch(_=>s({type:"SET_SKILLS_ERROR",error:_.message}))},[c]);x.useEffect(()=>{f()},[f]);const h=x.useCallback(C=>{s({type:"SELECT_SKILL",skill:C}),window.location.hash=`/skills/${C.plugin}/${C.skill}`},[]),g=x.useRef(r.skills);x.useEffect(()=>{g.current=r.skills},[r.skills]);const p=x.useCallback((C,_)=>{const $=g.current,K=C?$.find(I=>I.plugin===C&&I.skill===_):$.find(I=>I.skill===_&&I.source!=="plugin");if(!C&&!K){typeof console<"u"&&console.warn(`[StudioContext] revealSkill: no plugin provided and skill "${_}" not yet in state — skipping reveal`);return}const Z=(K==null?void 0:K.plugin)??C,q=(K==null?void 0:K.origin)??"source";s({type:"REVEAL_SKILL",skill:{plugin:Z,skill:_,origin:q}}),window.location.hash=`/skills/${Z}/${_}`},[]),y=x.useCallback(()=>{s({type:"CLEAR_REVEAL"})},[]),v=x.useCallback(()=>{s({type:"CLEAR_SELECTION"}),window.location.hash.startsWith("#/skills/")&&history.replaceState(null,"",window.location.pathname+window.location.search)},[]),j=x.useCallback(C=>{s({type:"SET_MODE",mode:C})},[]),S=x.useCallback(C=>{s({type:"SET_SEARCH",query:C})},[]),k=x.useCallback(C=>{s({type:"SET_MOBILE_VIEW",view:C})},[]),E=x.useCallback(()=>{s({type:"DISMISS_UPDATE_NOTIFICATION"})},[]),w=x.useMemo(()=>{const C=[];for(const _ of r.skills)_.origin==="installed"&&C.push(`${_.plugin}/${_.skill}`);return C},[r.skills]),N=e2({skillIds:w}),A=x.useMemo(()=>{const C=r.skills.map(_=>{if(!_.updateAvailable&&_.latestVersion===void 0)return _;const $={..._};return delete $.updateAvailable,delete $.currentVersion,delete $.latestVersion,$});return Uj(C,N.updates)},[r.skills,N.updates]),z=x.useMemo(()=>{const C={source:0,installed:0};for(const _ of A)_.updateAvailable&&(C[_.origin]+=1);return C},[A]),H=x.useMemo(()=>({...r,skills:A}),[r,A]),M=N.updateCount,F=N.refresh,T=N.isRefreshing,O=x.useMemo(()=>({state:H,selectSkill:h,clearSelection:v,setMode:j,setSearch:S,setMobileView:k,refreshSkills:f,updateCount:M,dismissUpdateNotification:E,updates:N.updates,outdatedByOrigin:z,isRefreshingUpdates:T,refreshUpdates:F,revealSkill:p,clearReveal:y,updatesById:N.updatesById,pushUpdateCount:N.pushUpdateCount,updateStreamStatus:N.status,dismissPushUpdate:N.dismiss}),[H,h,v,j,S,k,f,M,E,N.updates,z,T,F,p,y,N.updatesById,N.pushUpdateCount,N.status,N.dismiss]);return a.jsx(vv.Provider,{value:O,children:n})}const r2={config:null,loading:!0};function l2(n,r){switch(r.type){case"SET_CONFIG":return{config:r.config,loading:!1};case"SET_LOADING":return{...n,loading:!0};default:return n}}const yv=x.createContext(null);function _r(){const n=x.useContext(yv);if(!n)throw new Error("useConfig must be used within ConfigProvider");return n}function s2({children:n}){const[r,s]=x.useReducer(l2,r2),o=x.useCallback(()=>{Ce.getConfig().then(f=>s({type:"SET_CONFIG",config:f})).catch(()=>{})},[]);x.useEffect(()=>{o()},[o]);const c=x.useCallback(async(f,h)=>{const g=await Ce.setConfig(f,h);return s({type:"SET_CONFIG",config:g}),g},[]),d=x.useMemo(()=>({config:r.config,loading:r.loading,updateConfig:c,refreshConfig:o}),[r,c,o]);return a.jsx(yv.Provider,{value:d,children:n})}function i2({topRail:n,sidebar:r,main:s,statusBar:o,resizeHandle:c,banner:d,liveMessage:f,sidebarWidth:h=320,sidebarHidden:g=!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)"},y={display:"grid",gridTemplateColumns:g?"1fr":"var(--sidebar-width) auto 1fr",minHeight:0,overflow:"hidden"};return a.jsxs("div",{className:"studio-shell",style:p,children:[d,a.jsx("header",{style:{borderBottom:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:n}),a.jsxs("div",{style:y,children:[!g&&a.jsx("aside",{"aria-label":"Skills sidebar",style:{minHeight:0,overflow:"hidden",borderRight:c?"none":"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",flexDirection:"column"},children:r}),!g&&c,a.jsx("main",{style:{minHeight:0,overflow:"auto",background:"var(--bg-canvas)"},children:s})]}),a.jsx("footer",{role:"contentinfo",style:{borderTop:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:o}),a.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??""})]})}const $x=["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed","ollama","lm-studio"],o2={"claude-cli":".claude",cursor:".cursor","codex-cli":".codex","gemini-cli":".gemini",copilot:".github",zed:".zed"},c2={"claude-cli":"claude",cursor:"cursor","codex-cli":"codex","gemini-cli":"gemini"},u2={"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"},d2={"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 f2(n,r){var h,g;const s=o2[n.id]??null,o=c2[n.id]??null,c=s?!!((h=r==null?void 0:r.wrapperFolders)!=null&&h[s]):!1,d=o?!!((g=r==null?void 0:r.binaries)!=null&&g[o]):!0,f=n.models.map(p=>({id:p.id,displayName:p.label,billingMode:d2[n.id]??"per-token",...p.pricing?{pricing:p.pricing}:{}}));return{id:n.id,displayName:p2(n.id,n.label),wrapperFolder:s,wrapperFolderPresent:c,binaryAvailable:d,endpointReachable:n.id==="ollama"||n.id==="lm-studio"?n.available:null,available:n.available,ctaType:n.available?null:u2[n.id]??null,models:f,resolvedModel:n.resolvedModel??null}}function p2(n,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"}[n]??r}function m2(n){const r=new Map(n.map(o=>[o.id,o])),s=[];for(const o of $x){const c=r.get(o);c&&s.push(c)}for(const o of n)$x.includes(o.id)||s.push(o);return s}function h2(n){const[r,s]=x.useState(null),[o,c]=x.useState("loading"),[d,f]=x.useState(null),h=x.useRef(null),g=x.useRef(0),p=x.useCallback(async()=>{try{const k=await fetch("/api/config");if(!k.ok)throw new Error(`/api/config returned ${k.status}`);const E=await k.json(),w=m2((E.providers||[]).map(N=>f2(N,E.detection)));s({agents:w,activeAgent:E.provider??null,activeModel:E.model??null}),c("ready"),f(null)}catch(k){c("error"),f(k.message)}},[]);x.useEffect(()=>{p()},[p]);const y=x.useCallback(async()=>{const k=Date.now();if(!(k-g.current<5*6e4))try{const E=await fetch("/api/openrouter/models");if(!E.ok)return;const w=await E.json();g.current=k,s(N=>{if(!N)return N;const A=N.agents.map(z=>{if(z.id!=="openrouter")return z;const H=w.models.map(F=>({id:F.id,displayName:F.name,contextWindow:F.contextWindow,pricing:F.pricing,billingMode:"per-token"}));return{...z,models:H,catalogAgeMs:w.ageSec?w.ageSec*1e3:0,cacheStale:!!w.stale}});return{...N,agents:A}}),w.stale&&(n!=null&&n.onStaleCatalog)&&n.onStaleCatalog("openrouter",(w.ageSec??0)*1e3)}catch{}},[n]),v=x.useCallback(k=>{h.current=k,k==="openrouter"&&y()},[y]),j=x.useCallback(()=>{g.current=0,p()},[p]),S=x.useCallback(async(k,E)=>{(await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:k,model:E})})).ok&&s(N=>N&&{...N,activeAgent:k,activeModel:E})},[]);return{status:o,catalog:r,error:d,focusAgent:v,refresh:j,activeAgentId:(r==null?void 0:r.activeAgent)??null,activeModelId:(r==null?void 0:r.activeModel)??null,setActive:S}}function vd({variant:n,label:r,onActivate:s,installUrl:o,tooltip:c}){function d(h){if(h.stopPropagation(),n==="cli-install"&&o){window.open(o,"_blank","noopener,noreferrer");return}s()}function f(h){(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),d(h))}return a.jsx("button",{type:"button","data-testid":`locked-cta-${n}`,onClick:d,onKeyDown:f,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,...c?{title:c}:{},children:r})}function Wd({unlocked:n=!1,size:r=10}){return n?a.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:[a.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),a.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 3.5"})]}):a.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:[a.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),a.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 4.5V7"})]})}const x2={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:(n,r)=>`${n} of ${r}`},g2={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"},v2={tabOverview:"Overview",tabVersions:"Versions",tabBenchmark:"Benchmark",emptyHeadline:"Select a skill to see details.",emptyBody:"Pick one from the sidebar.",loadErrorHeadline:n=>`Couldn't load SKILL.md for ${n}.`,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:n=>`Viewing ${n} (Own)`,announceViewingInstalled:n=>`Viewing ${n} (Installed)`,moreFields:"More fields",sourceAgent:"Source agent",noMcpDependencies:"No MCP dependencies.",filesystemGroup:"Filesystem",benchmarkGroup:"Benchmark",metadataGroup:"Frontmatter"},y2={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."},b2={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"},j2={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"},S2={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."},k2={disconnected:"Disconnected — reconnecting…",reconnected:"Reconnected.",loading:"Loading skills…",loadingPlaceholderCount:"—"},w2={fieldRequired:"This field is required.",nameInvalid:"Use letters, numbers, and hyphens.",descriptionRequired:"Description is required.",saveFailed:"Save failed. Check the form for errors."},E2={boundaryHeadline:"Something broke in this view.",boundaryBody:"Reload the page to recover.",boundaryAction:"Reload"},C2={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:n=>`No models match "${n}"`,clearSearch:"Clear",currentlyActive:"Currently active"},N2={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-"},openai:{name:"OpenAI",caption:"GPT-4, GPT-5, and the o-series reasoning models.",addKeyCta:"Add API key →",keyIssuanceUrl:"https://platform.openai.com/api-keys",keyPrefix:"sk-",pastePlaceholder:"Paste OpenAI API key (sk-proj-...)"},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 LM Studio server →",startServiceTooltip:"Open LM Studio → Developer tab → Start Server (default port 1234)."}},T2={subscriptionBilling:"· subscription",free:"· free"},R2={title:"Settings",sectionApiKeys:"API Keys",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.",storagePath:n=>`Keys stored at ${n} · protected by file permissions (0600 on macOS/Linux)`,storagePathFallback:"Keys stored locally on this device.",copyPath:"Copy path",pathCopied:"Path copied.",show:"Show",hide:"Hide",paste:"Paste",save:"Save",remove:"Remove",removeConfirm:n=>`Remove ${n} API key?`,keyStoredAt:n=>`Key stored locally — updated ${n}`,noKey:"No key stored",enterNonEmpty:"Enter a non-empty key",prefixWarn:n=>`This doesn't look like a typical ${n} key. Save anyway?`,keySaved:n=>`${n} API key saved (local only, never synced)`,keyRemoved:n=>`${n} API key removed`},A2={providersLabel:"Providers",providerSummary:(n,r)=>`${n}/${r} providers`,locked:n=>`${n} — locked. Click to add a key.`,lockedCli:n=>`${n} — locked. Click for install instructions.`,unlocked:n=>`${n} — unlocked.`},M2={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:n=>`Set up ${n}`,sharedFolderBanner:n=>`Shared folder — consumed by ${n}`},L2={ownLabel:"Own",installedLabel:"Installed",globalLabel:"Global",emptyOwn:"No authored skills — run vskill new.",emptyInstalled:n=>`No skills installed for ${n} in this project — run vskill install.`,emptyGlobal:n=>`No global skills for ${n} — run vskill install --global.`},z2={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"},D2={title:n=>`Set up ${n}`,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."},_2={groupAvailable:"Available",groupAuthoring:"Authoring",sourceProject:"Project",sourcePersonal:"Personal",sourcePlugin:"Plugins",authoringSkills:"Skills"},O2={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"}},ne={sidebar:x2,shell:g2,detail:v2,actions:y2,palette:b2,shortcuts:j2,toasts:S2,connection:k2,forms:w2,errors:E2,picker:C2,providers:N2,models:T2,settings:R2,statusBar:A2,scopePicker:M2,scopeSection:L2,claudeCodeLabel:z2,setupDrawer:D2,setupProviders:O2,scopeLabels:_2},Vx=new Set(["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed"]);function B2({agents:n,activeAgentId:r,focusedAgentId:s,onFocus:o,onSelect:c,onOpenSettings:d}){const f=n.filter(g=>Vx.has(g.id)),h=n.filter(g=>!Vx.has(g.id));return a.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(g=>a.jsx(Px,{agent:g,isActive:g.id===r,isFocused:g.id===s,onFocus:o,onSelect:c,onOpenSettings:d},g.id)),h.length>0&&a.jsx("div",{style:{borderTop:"1px solid var(--border-default, var(--border-subtle))",margin:"4px 0"},"aria-hidden":"true"}),h.map(g=>a.jsx(Px,{agent:g,isActive:g.id===r,isFocused:g.id===s,onFocus:o,onSelect:c,onOpenSettings:d},g.id))]})}function Px({agent:n,isActive:r,isFocused:s,onFocus:o,onSelect:c,onOpenSettings:d}){const{providers:f}=ne,h={"claude-cli":f.claudeCli.caption,anthropic:f.anthropic.caption,openrouter:f.openrouter.caption},g={"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=n.id==="claude-cli"||n.id==="claude-code",y={minHeight:36,height:p?"auto":36,padding:p?"6px 12px":"0 12px",display:"flex",alignItems:"center",gap:8,cursor:"pointer",position:"relative",background:s?"var(--surface-muted, var(--surface-3))":"transparent",borderLeft:r?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",fontSize:13,fontWeight:r?500:400,color:"var(--text-primary)"};return r&&(y.background="color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)"),a.jsxs("div",{role:"option","aria-selected":r,"data-testid":`agent-row-${n.id}`,"data-focused":s||void 0,tabIndex:s?0:-1,onMouseEnter:()=>o(n.id),onFocus:()=>o(n.id),onClick:()=>c(n.id),style:y,children:[n.wrapperFolder&&a.jsx("span",{"data-testid":`wrapper-dot-${n.id}`,"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",flexShrink:0,background:n.wrapperFolderPresent?"var(--accent, var(--color-accent))":"transparent",border:n.wrapperFolderPresent?"none":"1px solid var(--border-default, var(--border-subtle))"}}),!n.wrapperFolder&&a.jsx("span",{style:{width:6,height:6,flexShrink:0},"aria-hidden":"true"}),a.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[a.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.displayName}),(n.id==="claude-cli"||n.id==="claude-code")&&a.jsx("span",{"data-testid":"claude-code-billing-label",title:ne.claudeCodeLabel.tooltip,style:{fontSize:10,color:"var(--text-secondary, var(--text-tertiary))",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:1},children:ne.claudeCodeLabel.compactLabel})]}),a.jsx("span",{"aria-label":n.available?"available":"locked",style:{color:n.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0},children:n.available?a.jsx(Wd,{unlocked:!0,size:10}):a.jsx(Wd,{size:10})}),r&&a.jsx("span",{style:{fontSize:10,textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600,color:"var(--accent-ink, var(--accent))",flexShrink:0},"data-testid":`active-badge-${n.id}`,children:ne.picker.currentlyActive}),!n.available&&n.ctaType==="api-key"&&a.jsx(vd,{variant:"api-key",label:n.id==="anthropic"?f.anthropic.addKeyCta:f.openrouter.addKeyCta,onActivate:()=>d(n.id)}),!n.available&&n.ctaType==="cli-install"&&g[n.id]&&a.jsx(vd,{variant:"cli-install",label:g[n.id].label,installUrl:g[n.id].url,onActivate:()=>{}}),!n.available&&n.ctaType==="start-service"&&a.jsx(vd,{variant:"start-service",label:n.id==="ollama"?f.ollama.startServiceCta:f.lmStudio.startServiceCta,onActivate:()=>d(n.id)}),h[n.id]&&a.jsx("span",{className:"sr-only","data-testid":`caption-${n.id}`,children:h[n.id]})]})}function I2(n,r,s,o){const f=n>=80,h=x.useRef(null),[g,p]=x.useState(0),y=x.useCallback(S=>{p(S.currentTarget.scrollTop)},[]),{visibleStart:v,visibleEnd:j}=x.useMemo(()=>{if(!f)return{visibleStart:0,visibleEnd:n};const S=Math.max(0,Math.floor(g/r)-4),k=Math.ceil(s/r)+8,E=Math.min(n,S+k);return{visibleStart:S,visibleEnd:E}},[f,g,r,s,n,4]);return{visibleStart:v,visibleEnd:j,totalHeight:n*r,offsetTop:v*r,virtualised:f,containerProps:{onScroll:y,ref:h,style:{overflowY:"auto",maxHeight:s,willChange:f?"transform":void 0}}}}const bv=44,H2=352,U2=60;function $2(n){var d,f;const r=n.contextWindow?n.contextWindow>=1e6?`${Math.round(n.contextWindow/1e6)}M`:n.contextWindow>=1e3?`${Math.round(n.contextWindow/1e3)}k`:String(n.contextWindow):null;if(n.billingMode==="subscription")return r?`${r} ctx ${ne.models.subscriptionBilling}`:ne.models.subscriptionBilling.trim();if(n.billingMode==="free")return r?`local · ${r} ctx · free`:"local · free";const s=((d=n.pricing)==null?void 0:d.prompt)??0,o=((f=n.pricing)==null?void 0:f.completion)??0,c=`$${s.toFixed(2)} / $${o.toFixed(2)} per 1M tokens`;return r?`${r} ctx · ${c}`:c}function V2(n,r){if(!r)return n;const s=r.toLowerCase();return n.filter(c=>c.displayName.toLowerCase().includes(s)).sort((c,d)=>{const f=c.displayName.toLowerCase().indexOf(s),h=d.displayName.toLowerCase().indexOf(s);return f!==h?f-h:c.displayName.length-d.displayName.length})}function P2({agent:n,activeModelId:r,onSelect:s,onOpenSettings:o}){const[c,d]=x.useState(""),[f,h]=x.useState(""),g=x.useRef(null);if(x.useEffect(()=>{const v=setTimeout(()=>h(c),U2);return()=>clearTimeout(v)},[c]),x.useEffect(()=>{n.id==="openrouter"&&n.available&&g.current&&g.current.focus()},[n.id,n.available]),n.id==="openrouter"&&!n.available)return a.jsxs("div",{"data-testid":"openrouter-empty-card",style:{width:360,padding:20,display:"flex",flexDirection:"column",gap:12},children:[a.jsx("p",{style:{margin:0,color:"var(--text-primary)",fontSize:13,lineHeight:1.5},children:ne.providers.openrouter.emptyCardBody}),a.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:ne.providers.openrouter.addKeyCta})]});const p=x.useMemo(()=>V2(n.models,f),[n.models,f]),y=I2(p.length,bv,H2);return a.jsxs("div",{role:"listbox","aria-label":"Model","data-testid":"model-list",style:{width:360,display:"flex",flexDirection:"column"},children:[n.id==="openrouter"&&a.jsx("div",{style:{padding:8,borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:a.jsx("input",{ref:g,type:"text",placeholder:ne.picker.searchPlaceholder,value:c,onChange:v=>d(v.target.value),"data-testid":"model-search-input","aria-label":ne.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?a.jsxs("div",{style:{padding:16},"data-testid":"no-matches",children:[a.jsx("div",{style:{color:"var(--text-muted, var(--text-tertiary))",fontSize:12,marginBottom:8},children:ne.picker.noMatches(f)}),a.jsx("button",{type:"button",onClick:()=>d(""),style:{padding:"4px 8px",background:"transparent",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:ne.picker.clearSearch})]}):p.length===0?a.jsx("div",{style:{padding:16,color:"var(--text-muted, var(--text-tertiary))",fontSize:12},children:ne.picker.noModelsYet}):a.jsx("div",{...y.containerProps,children:a.jsx("div",{style:{height:y.virtualised?y.totalHeight:"auto",position:"relative"},children:a.jsx("div",{style:{transform:y.virtualised?`translateY(${y.offsetTop}px)`:void 0},children:p.slice(y.visibleStart,y.visibleEnd).map(v=>a.jsx(G2,{model:v,isActive:v.id===r,onSelect:()=>s(v.id),resolvedModel:n.id==="claude-cli"?n.resolvedModel??null:null},v.id))})})})]})}function F2(n,r){return r?r.toLowerCase().includes(n.toLowerCase()):!1}function G2({model:n,isActive:r,onSelect:s,resolvedModel:o}){const c=$2(n),d=F2(n.id,o);return a.jsxs("button",{type:"button",role:"option","aria-selected":r,"data-testid":`model-row-${n.id}`,onClick:s,title:n.id,style:{width:"100%",minHeight:bv,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:[a.jsx("span",{style:{fontSize:14,fontWeight:500,color:"var(--text-primary)"},children:n.displayName}),a.jsx("span",{style:{fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace",fontVariantNumeric:"tabular-nums",color:"var(--text-muted, var(--text-tertiary))"},children:c}),d&&a.jsxs("span",{"data-testid":`model-row-${n.id}-resolved`,style:{fontSize:11,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace",color:"var(--text-muted, var(--text-tertiary))"},children:["routing to ",o]})]})}const Fx={anthropic:{stored:!1,updatedAt:null},openai:{stored:!1,updatedAt:null},openrouter:{stored:!1,updatedAt:null}};function W2(){const[n,r]=x.useState(null),[s,o]=x.useState(!0),[c,d]=x.useState(null),f=x.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 y=await p.json();r({...Fx,...y}),d(null)}catch(p){d(p.message),r(Fx)}finally{o(!1)}},[]);x.useEffect(()=>{f()},[f]);const h=x.useCallback(async(p,y)=>{const v=await fetch("/api/settings/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:p,key:y})});if(!v.ok){const S=await v.json().catch(()=>({error:v.statusText}));throw new Error(S.error||`POST /api/settings/keys returned ${v.status}`)}const j=await v.json();return await f(),j},[f]),g=x.useCallback(async p=>{const y=await fetch(`/api/settings/keys/${p}`,{method:"DELETE"});if(!y.ok)throw new Error(`DELETE /api/settings/keys/${p} returned ${y.status}`);await f()},[f]);return{state:n,loading:s,error:c,save:h,remove:g,refresh:f}}function Y2({onMigrated:n,fetchImpl:r}){const[s,o]=x.useState({kind:"loading"}),c=r??globalThis.fetch,d=x.useCallback(async()=>{var p;try{const y=await c("/api/settings/migration-status");if(!y.ok){o({kind:"hidden"});return}const v=await y.json();v.pending&&(((p=v.darwinKeys)==null?void 0:p.length)??0)>0?o({kind:"visible",darwinKeys:v.darwinKeys??[]}):o({kind:"hidden"})}catch{o({kind:"hidden"})}},[c]);x.useEffect(()=>{d()},[d]);const f=x.useCallback(async()=>{o({kind:"working"});try{const p=await c("/api/settings/migration-perform",{method:"POST",headers:{"Content-Type":"application/json"}});if(!p.ok){o({kind:"error",message:`Migration failed (${p.status})`});return}const y=await p.json().catch(()=>({migrated:[]}));n==null||n(y.migrated??[]),await d()}catch(p){o({kind:"error",message:p.message})}},[c,d,n]),h=x.useCallback(async()=>{o({kind:"hidden"});try{await c("/api/settings/migration-acknowledge",{method:"POST",headers:{"Content-Type":"application/json"}})}catch{}},[c]);if(s.kind==="loading"||s.kind==="hidden")return null;if(s.kind==="error")return a.jsxs("div",{role:"status","data-testid":"migration-banner",style:{padding:"10px 12px",borderRadius:6,background:"color-mix(in srgb, var(--danger, #b33) 15%, transparent)",color:"var(--text-primary)",fontSize:12,marginBottom:12,display:"flex",alignItems:"center",gap:8},children:[a.jsx("span",{style:{flex:1},children:s.message}),a.jsx("button",{type:"button",onClick:()=>void d(),"data-testid":"migration-retry",style:yd,children:"Retry"})]});const g=s.kind==="working";return a.jsxs("div",{role:"note","data-testid":"migration-banner",style:{padding:"10px 12px",borderRadius:6,background:"color-mix(in srgb, var(--accent, var(--color-accent)) 12%, transparent)",color:"var(--text-primary)",fontSize:12,marginBottom:12,display:"flex",alignItems:"center",gap:8},children:[a.jsxs("div",{style:{flex:1},children:[a.jsx("strong",{style:{display:"block",marginBottom:2},children:"Migrate from macOS Keychain"}),a.jsx("span",{style:{color:"var(--text-muted, var(--text-tertiary))"},children:"We found stored credentials from a previous vskill version. Import them into the new on-disk store."})]}),a.jsx("button",{type:"button",onClick:()=>void f(),disabled:g,"data-testid":"migration-migrate",style:{...yd,background:"var(--accent, var(--color-accent))",color:"white",opacity:g?.6:1},children:g?"Importing…":"Migrate"}),a.jsx("button",{type:"button",onClick:()=>void h(),"data-testid":"migration-dismiss",style:{...yd,background:"transparent",border:"none",color:"var(--text-muted, var(--text-tertiary))",textDecoration:"underline",padding:"4px 6px"},children:"Dismiss for 30 days"})]})}const yd={padding:"4px 10px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},q2=[{id:"anthropic",name:ne.providers.anthropic.name,keyIssuanceUrl:ne.providers.anthropic.keyIssuanceUrl,prefix:ne.providers.anthropic.keyPrefix,placeholder:`Paste ${ne.providers.anthropic.name} key`},{id:"openai",name:ne.providers.openai.name,keyIssuanceUrl:ne.providers.openai.keyIssuanceUrl,prefix:ne.providers.openai.keyPrefix,placeholder:ne.providers.openai.pastePlaceholder},{id:"openrouter",name:ne.providers.openrouter.name,keyIssuanceUrl:ne.providers.openrouter.keyIssuanceUrl,prefix:ne.providers.openrouter.keyPrefix,placeholder:`Paste ${ne.providers.openrouter.name} key`}];function K2(n){const r=Date.now()-new Date(n).getTime();return r<6e4?"just now":r<36e5?`${Math.round(r/6e4)}m ago`:r<864e5?`${Math.round(r/36e5)}h ago`:new Date(n).toLocaleString()}function jv({open:n,onClose:r,initialProvider:s,onToast:o}){const{state:c,save:d,remove:f,refresh:h}=W2(),g=x.useRef(null),p=x.useRef(null),[y,v]=x.useState(null);x.useEffect(()=>{if(!n)return;let S=!1;return(async()=>{try{const k=await fetch("/api/settings/storage-path");if(!k.ok)throw new Error(`GET /api/settings/storage-path returned ${k.status}`);const E=await k.json();S||v(E.path??null)}catch{S||v(null)}})(),()=>{S=!0}},[n]),x.useEffect(()=>{if(!n)return;const S=document.activeElement,k=setTimeout(()=>{var N;const E=s?`input[data-provider="${s}"]`:"input[data-provider]",w=(N=g.current)==null?void 0:N.querySelector(E);w==null||w.focus()},0);return()=>{var E;clearTimeout(k),(E=S==null?void 0:S.focus)==null||E.call(S)}},[n,s]),x.useEffect(()=>{if(!n)return;const S=k=>{if(k.key==="Escape"){k.preventDefault(),r();return}if(k.key==="Tab"&&g.current){const E=g.current.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(E.length===0)return;const w=E[0],N=E[E.length-1];k.shiftKey&&document.activeElement===w?(k.preventDefault(),N.focus()):!k.shiftKey&&document.activeElement===N&&(k.preventDefault(),w.focus())}};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[n,r]);const j=x.useCallback(async()=>{var S,k;if(y)try{await((k=(S=navigator.clipboard)==null?void 0:S.writeText)==null?void 0:k.call(S,y)),o==null||o(ne.settings.pathCopied)}catch{}},[o,y]);return n?a.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:S=>{S.target===S.currentTarget&&r()},children:a.jsxs("div",{ref:g,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:S=>S.stopPropagation(),children:[a.jsx("h2",{id:"settings-modal-title",style:{margin:"0 0 16px 0",fontSize:16,fontWeight:600},children:ne.settings.title}),a.jsx(Y2,{onMigrated:()=>{h()}}),a.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:ne.settings.banner}),a.jsxs("section",{"aria-labelledby":"settings-api-keys-title",style:{marginBottom:20},children:[a.jsx("h3",{id:"settings-api-keys-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:ne.settings.sectionApiKeys}),q2.map(S=>a.jsx(X2,{providerId:S.id,providerName:S.name,keyIssuanceUrl:S.keyIssuanceUrl,prefix:S.prefix,placeholder:S.placeholder,metadata:c==null?void 0:c[S.id],onSave:async k=>{const E=await d(S.id,k);return o==null||o(ne.settings.keySaved(S.name)),E},onRemove:async()=>{await f(S.id),o==null||o(ne.settings.keyRemoved(S.name))},inputRef:S.id===(s??"anthropic")?p:void 0},S.id))]}),a.jsxs("div",{"data-testid":"settings-storage-path",style:{fontSize:11,color:"var(--text-muted, var(--text-tertiary))",fontStyle:"italic",display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[a.jsx("span",{style:{flex:1},children:y?ne.settings.storagePath(y):ne.settings.storagePathFallback}),a.jsx("button",{type:"button",onClick:j,disabled:!y,"data-testid":"settings-copy-path",style:{...Mr,opacity:y?1:.5,cursor:y?"pointer":"not-allowed"},children:ne.settings.copyPath})]}),a.jsx("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end"},children:a.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"})})]})}):null}function X2({providerId:n,providerName:r,keyIssuanceUrl:s,prefix:o,placeholder:c,metadata:d,onSave:f,onRemove:h,inputRef:g}){const[p,y]=x.useState(""),[v,j]=x.useState(!1),[S,k]=x.useState(!1),[E,w]=x.useState(!1),[N,A]=x.useState(null),z=p.trim(),H=z.length===0,M=z.length>0&&!z.startsWith(o),F=x.useCallback(async()=>{if(H)return;k(!0);const C=z;y("");try{const _=await f(C);_.warning?A(_.warning):A(null)}finally{k(!1)}},[H,f,z]),T=x.useCallback(async()=>{var C;try{if(!((C=navigator.clipboard)!=null&&C.readText))return;const _=await navigator.clipboard.readText();y(_)}catch{}},[]),O=x.useCallback(async()=>{w(!1),await h()},[h]);return a.jsxs("div",{"data-testid":`provider-row-${n}`,style:{padding:12,border:"1px solid var(--border-subtle)",borderRadius:6,marginBottom:8,display:"flex",flexDirection:"column",gap:8},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a.jsx("strong",{style:{fontSize:13},children:r}),a.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",style:{fontSize:12,color:"var(--accent, var(--color-accent))"},children:"Get a key →"})]}),a.jsxs("div",{style:{display:"flex",gap:6},children:[a.jsx("input",{ref:g,type:v?"text":"password",value:p,onChange:C=>{y(C.target.value),A(null)},"data-provider":n,placeholder:c,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"}}),a.jsx("button",{type:"button",onClick:()=>j(!v),style:Mr,children:v?ne.settings.hide:ne.settings.show}),a.jsx("button",{type:"button",onClick:T,style:Mr,children:ne.settings.paste})]}),M&&a.jsx("div",{role:"status","data-testid":`prefix-warn-${n}`,style:Gx,children:ne.settings.prefixWarn(r)}),N&&a.jsx("div",{role:"status",style:Gx,children:N}),a.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[a.jsx("button",{type:"button",onClick:F,disabled:H||S,"data-testid":`save-${n}`,style:{...Mr,background:H?"var(--surface-2)":"var(--accent, var(--color-accent))",color:H?"var(--text-muted)":"white",cursor:H?"not-allowed":"pointer"},children:ne.settings.save}),(d==null?void 0:d.stored)&&a.jsx(a.Fragment,{children:E?a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{fontSize:12},children:ne.settings.removeConfirm(r)}),a.jsx("button",{type:"button",onClick:O,"data-testid":`remove-confirm-${n}`,style:{...Mr,background:"var(--danger, #b33)",color:"white"},children:"Confirm"}),a.jsx("button",{type:"button",onClick:()=>w(!1),style:Mr,children:"Cancel"})]}):a.jsx("button",{type:"button",onClick:()=>w(!0),"data-testid":`remove-${n}`,style:{...Mr,color:"var(--text-muted)"},children:ne.settings.remove})}),a.jsx("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},"data-testid":`status-${n}`,children:d!=null&&d.stored&&d.updatedAt?ne.settings.keyStoredAt(K2(d.updatedAt)):ne.settings.noKey})]})]})}const Mr={padding:"4px 8px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},Gx={fontSize:11,color:"var(--warning, var(--text-muted))"};function Q2(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Z2({onToast:n}){const{status:r,catalog:s,focusAgent:o,setActive:c}=h2({onStaleCatalog:(O,C)=>{const _=Math.round(C/6e4);n==null||n(`Using cached ${O} catalog (${_} min old)`)}}),[d,f]=x.useState(!1),[h,g]=x.useState(!1),[p,y]=x.useState(),[v,j]=x.useState(null),[S,k]=x.useState("agents"),E=x.useRef(null);x.useRef(null),x.useEffect(()=>{var O;s&&!v&&j(s.activeAgent??((O=s.agents[0])==null?void 0:O.id)??null)},[s,v]);const w=(s==null?void 0:s.agents)??[],N=x.useMemo(()=>w.find(O=>O.id===v)??w[0],[w,v]),A=x.useCallback(()=>{var O;f(!0),k("agents"),j((s==null?void 0:s.activeAgent)??((O=w[0])==null?void 0:O.id)??null)},[s,w]),z=x.useCallback(()=>{var O;f(!1),(O=E.current)==null||O.focus()},[]);x.useEffect(()=>{const O=C=>{var $;if(!(C.metaKey||C.ctrlKey)||C.key.toLowerCase()!=="k")return;const _=($=document.activeElement)==null?void 0:$.tagName;_==="INPUT"||_==="TEXTAREA"||(C.preventDefault(),f(K=>!K))};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[]),x.useEffect(()=>{if(!d)return;const O=_=>{if(_.key==="Escape"){_.preventDefault(),z();return}if(_.key==="ArrowDown"){_.preventDefault(),C(1);return}if(_.key==="ArrowUp"){_.preventDefault(),C(-1);return}if(_.key==="ArrowRight"&&S==="agents"){_.preventDefault(),k("models");return}if(_.key==="ArrowLeft"&&S==="models"){_.preventDefault(),k("agents");return}if(_.key==="Enter"){_.preventDefault(),S==="agents"&&N?k("models"):S==="models"&&N&&N.models[0]&&(c(N.id,N.models[0].id),z());return}};function C(_){if(S==="agents"){const $=w.findIndex(Z=>Z.id===v),K=w[Math.max(0,Math.min(w.length-1,$+_))];K&&(j(K.id),o(K.id))}}return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[d,S,w,v,N,z,o,c]);const H=x.useCallback(O=>{y(O==="anthropic"||O==="openrouter"?O:void 0),g(!0),f(!1)},[]),M=w.find(O=>O.id===(s==null?void 0:s.activeAgent)),F=M==null?void 0:M.models.find(O=>O.id===(s==null?void 0:s.activeModel)),T=x.useMemo(()=>{if(r!=="ready"||!s)return"Loading…";const O=(M==null?void 0:M.displayName)??"Agent",C=(F==null?void 0:F.displayName)??s.activeModel??"Model";return`${O} · ${C}`},[r,s,M,F]);return a.jsxs(a.Fragment,{children:[a.jsxs("button",{ref:E,type:"button","data-testid":"agent-model-picker-trigger",onClick:()=>d?z():A(),"aria-haspopup":"listbox","aria-expanded":d,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:[a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:M!=null&&M.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0}}),a.jsx("span",{children:T})]}),d&&typeof document<"u"&&Bo.createPortal(a.jsxs(J2,{reducedMotion:Q2(),onClickOutside:z,children:[a.jsxs("div",{style:{display:"flex",height:440,maxHeight:"60vh"},children:[a.jsx(B2,{agents:w,activeAgentId:(s==null?void 0:s.activeAgent)??null,focusedAgentId:v,onFocus:O=>{j(O),o(O)},onSelect:O=>{j(O),o(O),k("models")},onOpenSettings:H}),N&&a.jsx(P2,{agent:N,activeModelId:(s==null?void 0:s.activeModel)??null,onSelect:O=>{c(N.id,O),z()},onOpenSettings:H})]}),a.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:[a.jsx("button",{type:"button",onClick:()=>H(),"data-testid":"picker-footer-settings",style:{background:"transparent",border:"none",color:"var(--text-primary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:ne.picker.settingsButton}),a.jsx("span",{style:{fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"},children:ne.picker.footerHint})]})]}),document.body),a.jsx(jv,{open:h,onClose:()=>g(!1),initialProvider:p,onToast:n})]})}function J2({children:n,reducedMotion:r,onClickOutside:s}){const o=x.useRef(null);return x.useEffect(()=>{const c=d=>{o.current&&!o.current.contains(d.target)&&s()};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]),a.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:[n,a.jsx("style",{children:`@keyframes agentPickerFadeIn {
63
- from { opacity: 0; transform: translateX(-50%) translateY(2px); }
64
- to { opacity: 1; transform: translateX(-50%) translateY(0); }
65
- }`})]})}function Wx(){typeof window>"u"||(window.location.hash="#/")}function eS({onHome:n}){const[r,s]=x.useState(!1),[o,c]=x.useState(!1),d=h=>{h.metaKey||h.ctrlKey||h.shiftKey||h.button!==0||(h.preventDefault(),Wx(),n==null||n())},f=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),Wx(),n==null||n())};return a.jsxs("a",{href:"#/",role:"link","data-testid":"studio-logo","aria-label":"Skill Studio — home",onClick:d,onKeyDown:f,onFocus:()=>s(!0),onBlur:()=>s(!1),onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!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:[a.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:a.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:a.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}),a.jsx("span",{style:{fontSize:13,fontWeight:600,letterSpacing:"-0.01em",color:"var(--text-primary)"},children:"Skill Studio"})]})}const tS="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",nS=x.lazy(()=>Io(()=>import("./UpdateDropdown-6bfwsX0-.js"),__vite__mapDeps([0,1])));function aS(){const{updateCount:n,updates:r,isRefreshingUpdates:s,refreshUpdates:o,selectSkill:c,updatesById:d}=sa(),f=x.useMemo(()=>{if(!d||d.size===0)return;const k=new Map;for(const[E,w]of d)w.diffSummary&&k.set(E,w.diffSummary);return k.size>0?k:void 0},[d]),[h,g]=x.useState(!1),p=x.useRef(null),y=x.useCallback(()=>g(!1),[]),v=n>0?"var(--text-primary)":"var(--text-secondary)",j=n>9?"9+":String(n),S=n===0?"No updates available":`${n} updates available, open summary`;return a.jsxs("span",{"data-testid":"update-bell-anchor",style:{position:"relative",display:"inline-flex"},children:[a.jsxs("button",{ref:p,type:"button","data-testid":"update-bell","aria-label":S,"aria-haspopup":"dialog","aria-expanded":h,onClick:()=>g(k=>!k),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:v,cursor:"pointer"},children:[a.jsx("img",{src:tS,alt:"",width:18,height:18,style:{display:"block",opacity:n>0?1:.75}}),n>0&&a.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:j})]}),h&&a.jsx(x.Suspense,{fallback:a.jsx("span",{"data-testid":"update-bell-fallback",children:"Loading…"}),children:a.jsx(nS,{updates:r,isRefreshing:s,diffSummariesById:f,onRefresh:()=>o(),onSelectSkill:k=>{const E=k.name.split("/"),w=E.length>=2?E[E.length-2]:E[0],N=E[E.length-1];c({plugin:w,skill:N,origin:"installed"}),y()},onViewAll:()=>{window.location.hash="#/updates",y()},onClose:y,anchorRef:p})})]})}function Yx(n){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:navigate-scope",{detail:n}))}function rS({projectName:n,selected:r,onOpenPalette:s,onHome:o,projectPickerSlot:c,onRequestCreateSkill:d}){const f=r?r.origin==="installed"?"Project":"Skills":null;return a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,height:"100%",width:"100%",padding:"0 16px",fontFamily:"var(--font-sans)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexShrink:0},children:[a.jsx(eS,{onHome:o}),c?a.jsx("div",{style:{borderLeft:"1px solid var(--border-default)",paddingLeft:10,display:"flex",alignItems:"center"},children:c}):n&&a.jsx("span",{title:n,style:{fontSize:12,color:"var(--text-secondary)",borderLeft:"1px solid var(--border-default)",paddingLeft:10,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n})]}),a.jsx("nav",{"aria-label":"Breadcrumb",style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:6,fontSize:12,color:"var(--text-secondary)"},children:r&&f&&a.jsxs(a.Fragment,{children:[a.jsx(qx,{segment:"origin",onClick:()=>Yx({scope:"origin",origin:r.origin}),style:{textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:r.origin==="installed"?"var(--status-installed)":"var(--status-own)"},children:f}),a.jsx(Kx,{}),a.jsx(qx,{segment:"plugin",onClick:()=>Yx({scope:"plugin",plugin:r.plugin}),style:{fontFamily:"var(--font-mono)",fontSize:11},children:r.plugin}),a.jsx(Kx,{}),a.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})]})}),a.jsxs("div",{"data-toprail-right":"true",style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[d&&a.jsxs("button",{type:"button","data-slot":"create-skill-button",onClick:d,"aria-label":"Create a new skill",title:"Create a new skill",style:{display:"inline-flex",alignItems:"center",gap:6,height:28,padding:"0 12px",borderRadius:6,border:"1px solid var(--color-action, #2F5B8E)",background:"var(--color-action, #2F5B8E)",color:"var(--color-action-ink, #FFFFFF)",fontSize:12,fontWeight:600,fontFamily:"var(--font-sans)",cursor:"pointer",letterSpacing:"0.01em",boxShadow:"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"New Skill"]}),a.jsx("span",{"data-slot":"agent-model-picker",style:{minWidth:200},children:a.jsx(Z2,{})}),a.jsx("span",{"data-slot":"update-bell",style:{display:"inline-flex"},children:a.jsx(aS,{})}),a.jsx("button",{type:"button",onClick:s,"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:a.jsx("span",{children:"⌘K"})})]})]})}function qx({segment:n,onClick:r,style:s,children:o}){return a.jsx("button",{type:"button","data-breadcrumb-segment":n,onClick:r,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",color:"var(--text-secondary)",fontFamily:"inherit",...s},onMouseEnter:c=>{c.currentTarget.style.color="var(--color-accent-ink)"},onMouseLeave:c=>{const d=(s==null?void 0:s.color)??"var(--text-secondary)";c.currentTarget.style.color=d},children:o})}function Kx(){return a.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)",fontSize:10},children:"›"})}const Ho="vskill-theme";function Sv(n){return n==="light"||n==="dark"||n==="auto"?n:"auto"}function lS(n,r){return n==="light"||n==="dark"?n:r?"dark":"light"}function sS(n){try{const r=n.getItem(Ho);return Sv(r)}catch{return"auto"}}function iS(n,r){try{n.setItem(Ho,r)}catch{}}function oS(n,r,s){n.dataset.theme=s,n.dataset.themeMode=r}function cS(n){if(!n)return!1;try{return n("(prefers-color-scheme: dark)").matches}catch{return!1}}const kv=x.createContext(null);function uS({storage:n,matchMedia:r,target:s,children:o}){const c=n??(typeof window<"u"?window.localStorage:void 0),d=r??(typeof window<"u"?window.matchMedia.bind(window):void 0),f=s??(typeof document<"u"?document.documentElement:void 0),[h,g]=x.useState(()=>c?sS(c):"auto"),[p,y]=x.useState(()=>cS(d)),v=x.useMemo(()=>lS(h,p),[h,p]);x.useEffect(()=>{f&&oS(f,h,v)},[f,h,v]),x.useEffect(()=>{if(!d)return;const k=d("(prefers-color-scheme: dark)"),E=N=>y(N.matches);if(typeof k.addEventListener=="function")return k.addEventListener("change",E),()=>k.removeEventListener("change",E);const w=k;return w.addListener(E),()=>w.removeListener(E)},[d]),x.useEffect(()=>{if(typeof window>"u")return;const k=E=>{E.key===Ho&&g(Sv(E.newValue))};return window.addEventListener("storage",k),()=>window.removeEventListener("storage",k)},[]),x.useEffect(()=>{if(!d||!f)return;let k;try{k=d("(prefers-contrast: more)")}catch{return}const E=A=>{A?f.dataset.contrast="more":f.dataset.contrast==="more"&&delete f.dataset.contrast};E(k.matches);const w=A=>E(A.matches);if(typeof k.addEventListener=="function")return k.addEventListener("change",w),()=>k.removeEventListener("change",w);const N=k;return N.addListener(w),()=>N.removeListener(w)},[d,f]);const j=x.useCallback(k=>{g(k),c&&iS(c,k)},[c]),S=x.useMemo(()=>({mode:h,resolvedTheme:v,setTheme:j}),[h,v,j]);return a.jsx(kv.Provider,{value:S,children:o})}function wv(){const n=x.useContext(kv);if(!n)throw new Error("useTheme must be used inside <ThemeProvider>. Wrap the app root in main.tsx.");return n}const Xx=["claude-cli","anthropic","openrouter","ollama","lm-studio"];function dS(n){const r=new Map(n.map(o=>[o.id,o])),s=[];for(const o of Xx){const c=r.get(o);c&&s.push(c)}for(const o of n)Xx.includes(o.id)||s.push(o);return s}function fS(n){const[r,s]=x.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(`(max-width: ${n}px)`).matches);return x.useEffect(()=>{var d;if(typeof window>"u"||!window.matchMedia)return;const o=window.matchMedia(`(max-width: ${n}px)`),c=()=>s(o.matches);return(d=o.addEventListener)==null||d.call(o,"change",c),()=>{var f;return(f=o.removeEventListener)==null?void 0:f.call(o,"change",c)}},[n]),r}function pS({providers:n,onOpenSettings:r,onOpenInstallHelp:s}){const o=dS(n),c=fS(640),[d,f]=x.useState(!1),h=x.useCallback(g=>{g.available||g.kind==="api-key"?r==null||r(g.id):s==null||s(g.id)},[r,s]);if(c){const g=o.filter(p=>p.available).length;return a.jsxs("div",{"data-testid":"providers-segment",style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[a.jsx("button",{type:"button","data-testid":"providers-summary",onClick:()=>f(!d),"aria-label":ne.statusBar.providerSummary(g,o.length),style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:ne.statusBar.providerSummary(g,o.length)}),d&&a.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=>a.jsx(Qx,{p,onClick:h},p.id))})]})}return a.jsx("div",{"data-testid":"providers-segment",style:{display:"inline-flex",alignItems:"center",gap:4},children:o.map(g=>a.jsx(Qx,{p:g,onClick:h,compact:!0},g.id))})}function Qx({p:n,onClick:r,compact:s}){const o=n.available?ne.statusBar.unlocked(n.label):n.kind==="cli-install"?ne.statusBar.lockedCli(n.label):ne.statusBar.locked(n.label);return a.jsxs("button",{type:"button","data-testid":`provider-glyph-${n.id}`,"data-available":n.available,"aria-label":o,title:o,onClick:()=>r(n),style:{display:"inline-flex",alignItems:"center",gap:4,background:"transparent",border:"none",color:n.available?"var(--status-installed)":"var(--text-muted, var(--text-tertiary))",cursor:"pointer",padding:s?"2px":"4px 6px",fontSize:11},children:[a.jsx(Wd,{unlocked:n.available,size:10}),!s&&a.jsx("span",{children:n.label})]})}function mS(){try{return typeof localStorage>"u"?null:localStorage.getItem(Ho)}catch{return null}}function hS({projectPath:n,modelName:r,health:s="ok",onPathClick:o,providers:c,onOpenProviderSettings:d,onOpenProviderInstallHelp:f}){const{mode:h,resolvedTheme:g,setTheme:p}=wv(),v=mS()==="auto",j=xS(h,g,v),S=s==="down"||s==="degraded"?"var(--status-own)":"var(--status-installed)";return a.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:[a.jsx("span",{title:r??"",style:{fontFamily:"var(--font-mono)"},children:r??"—"}),a.jsx(Zx,{}),a.jsxs("span",{"aria-label":`Health: ${s}`,style:{display:"inline-flex",alignItems:"center",gap:6},children:[a.jsx(gS,{color:S}),a.jsx("span",{style:{textTransform:"capitalize"},children:s})]}),c&&c.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(Zx,{}),a.jsx(pS,{providers:c,onOpenSettings:d,onOpenInstallHelp:f})]}),a.jsx("div",{style:{flex:1}}),a.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:[a.jsx(vS,{mode:h}),a.jsx("span",{style:{textTransform:"capitalize"},children:h})]})]})}function xS(n,r,s){return n==="light"?"dark":n==="dark"?"auto":s?"light":r==="light"?"dark":"light"}function gS({color:n}){return a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:n,display:"inline-block",flexShrink:0}})}function Zx(){return a.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)"},children:"|"})}function vS({mode:n}){return n==="dark"?a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}):n==="light"?a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"4"}),a.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"})]}):a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"9"}),a.jsx("path",{d:"M12 3a9 9 0 0 0 0 18z",fill:"currentColor"})]})}const ko=new Map,Lr=new Map,Ts=new Map;function on(n){ko.delete(n),Lr.delete(n);const r=Ts.get(n);if(r)for(const s of r)s()}function Al(n,r,s={}){const{ttl:o=3e4,enabled:c=!0}=s,[,d]=x.useState(0),f=x.useRef(!0),h=x.useRef(n);h.current=n;const g=()=>on(n);x.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]),x.useEffect(()=>{if(!c)return;const j=()=>{f.current&&d(S=>S+1)};return Ts.has(n)||Ts.set(n,new Set),Ts.get(n).add(j),()=>{var S;(S=Ts.get(n))==null||S.delete(j)}},[n,c]),x.useEffect(()=>{if(!c)return;const j=ko.get(n);if(!(!j||Date.now()-j.fetchedAt>o))return;if(Lr.has(n)){const w=Lr.get(n),N=()=>{f.current&&h.current===n&&d(A=>A+1)};w.subscribers.push(N);return}const k={promise:Promise.resolve(),subscribers:[]},E=r().then(w=>{ko.set(n,{data:w,fetchedAt:Date.now()}),Lr.delete(n),f.current&&h.current===n&&d(N=>N+1);for(const N of k.subscribers)N()},w=>{Lr.delete(n),f.current&&h.current===n&&d(N=>N+1);for(const N of k.subscribers)N();throw w});k.promise=E,Lr.set(n,k)},[n,r,o,c]);const p=ko.get(n),y=c&&!p&&Lr.has(n);return{data:p==null?void 0:p.data,loading:y||c&&!p,error:void 0,revalidate:g}}const Uo=0,sr=1,Ml=2,Ev=4;function Jx(n){return()=>n}function yS(n){n()}function Cv(n,r){return s=>n(r(s))}function eg(n,r){return()=>n(r)}function bS(n,r){return s=>n(r,s)}function mf(n){return n!==void 0}function jS(...n){return()=>{n.map(yS)}}function Ll(){}function $o(n,r){return r(n),n}function SS(n,r){return r(n)}function gt(...n){return n}function at(n,r){return n(sr,r)}function $e(n,r){n(Uo,r)}function hf(n){n(Ml)}function jt(n){return n(Ev)}function Ee(n,r){return at(n,bS(r,Uo))}function Wn(n,r){const s=n(sr,o=>{s(),r(o)});return s}function tg(n){let r,s;return o=>c=>{r=c,s&&clearTimeout(s),s=setTimeout(()=>{o(r)},n)}}function Nv(n,r){return n===r}function xt(n=Nv){let r;return s=>o=>{n(r,o)||(r=o,s(o))}}function Me(n){return r=>s=>{n(s)&&r(s)}}function ye(n){return r=>Cv(r,n)}function aa(n){return r=>()=>{r(n)}}function de(n,...r){const s=kS(...r);return((o,c)=>{switch(o){case Ml:hf(n);return;case sr:return at(n,s(c))}})}function ra(n,r){return s=>o=>{s(r=n(r,o))}}function Dr(n){return r=>s=>{n>0?n--:r(s)}}function Na(n){let r=null,s;return o=>c=>{r=c,!s&&(s=setTimeout(()=>{s=void 0,o(r)},n))}}function Ve(...n){const r=new Array(n.length);let s=0,o=null;const c=2**n.length-1;return n.forEach((d,f)=>{const h=2**f;at(d,g=>{const p=s;s|=h,r[f]=g,p!==c&&s===c&&o&&(o(),o=null)})}),d=>f=>{const h=()=>{d([f].concat(r))};s===c?h():o=h}}function kS(...n){return r=>n.reduceRight(SS,r)}function wS(n){let r,s;const o=()=>r==null?void 0:r();return function(c,d){switch(c){case sr:return d?s===d?void 0:(o(),s=d,r=at(n,d),r):(o(),Ll);case Ml:o(),s=null;return}}}function me(n){let r=n;const s=Xe();return((o,c)=>{switch(o){case Uo:r=c;break;case sr:{c(r);break}case Ev:return r}return s(o,c)})}function Jt(n,r){return $o(me(r),s=>Ee(n,s))}function Xe(){const n=[];return((r,s)=>{switch(r){case Uo:n.slice().forEach(o=>{o(s)});return;case Ml:n.splice(0,n.length);return;case sr:return n.push(s),()=>{const o=n.indexOf(s);o>-1&&n.splice(o,1)}}})}function En(n){return $o(Xe(),r=>Ee(n,r))}function et(n,r=[],{singleton:s}={singleton:!0}){return{constructor:n,dependencies:r,id:ES(),singleton:s}}const ES=()=>Symbol();function CS(n){const r=new Map,s=({constructor:o,dependencies:c,id:d,singleton:f})=>{if(f&&r.has(d))return r.get(d);const h=o(c.map(g=>s(g)));return f&&r.set(d,h),h};return s(n)}function Ot(...n){const r=Xe(),s=new Array(n.length);let o=0;const c=2**n.length-1;return n.forEach((d,f)=>{const h=2**f;at(d,g=>{s[f]=g,o|=h,o===c&&$e(r,s)})}),function(d,f){switch(d){case Ml:{hf(r);return}case sr:return o===c&&f(s),at(r,f)}}}function Ae(n,r=Nv){return de(n,xt(r))}function Yd(...n){return function(r,s){switch(r){case Ml:return;case sr:return jS(...n.map(o=>at(o,s)))}}}const $t={DEBUG:0,INFO:1,WARN:2,ERROR:3},NS={[$t.DEBUG]:"debug",[$t.ERROR]:"error",[$t.INFO]:"log",[$t.WARN]:"warn"},TS=()=>typeof globalThis>"u"?window:globalThis,ir=et(()=>{const n=me($t.ERROR);return{log:me((r,s,o=$t.INFO)=>{const c=TS().VIRTUOSO_LOG_LEVEL??jt(n);o>=c&&console[NS[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",r,s)}),logLevel:n}},[],{singleton:!0});function Or(n,r,s){return xf(n,r,s).callbackRef}function xf(n,r,s){const o=we.useRef(null);let c=f=>{};const d=we.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(f=>{const h=()=>{const g=f[0].target;g.offsetParent!==null&&n(g)};s?h():requestAnimationFrame(h)}):null,[n,s]);return c=f=>{f&&r?(d==null||d.observe(f),o.current=f):(o.current&&(d==null||d.unobserve(o.current)),o.current=null)},{callbackRef:c,ref:o}}function RS(n,r,s,o,c,d,f,h,g){const p=we.useCallback(y=>{const v=AS(y.children,r,h?"offsetWidth":"offsetHeight",c);let j=y.parentElement;for(;j.dataset.virtuosoScroller===void 0;)j=j.parentElement;const S=j.lastElementChild.dataset.viewportType==="window";let k;S&&(k=j.ownerDocument.defaultView);const E=f?h?f.scrollLeft:f.scrollTop:S?h?k.scrollX||k.document.documentElement.scrollLeft:k.scrollY||k.document.documentElement.scrollTop:h?j.scrollLeft:j.scrollTop,w=f?h?f.scrollWidth:f.scrollHeight:S?h?k.document.documentElement.scrollWidth:k.document.documentElement.scrollHeight:h?j.scrollWidth:j.scrollHeight,N=f?h?f.offsetWidth:f.offsetHeight:S?h?k.innerWidth:k.innerHeight:h?j.offsetWidth:j.offsetHeight;o({scrollHeight:w,scrollTop:Math.max(E,0),viewportHeight:N}),d==null||d(h?ng("column-gap",getComputedStyle(y).columnGap,c):ng("row-gap",getComputedStyle(y).rowGap,c)),v!==null&&n(v)},[n,r,c,d,f,o,h]);return xf(p,s,g)}function AS(n,r,s,o){const c=n.length;if(c===0)return null;const d=[];for(let f=0;f<c;f++){const h=n.item(f);if(h.dataset.index===void 0)continue;const g=parseInt(h.dataset.index),p=parseFloat(h.dataset.knownSize),y=r(h,s);if(y===0&&o("Zero-sized element, this should not happen",{child:h},$t.ERROR),y===p)continue;const v=d[d.length-1];d.length===0||v.size!==y||v.endIndex!==g-1?d.push({endIndex:g,size:y,startIndex:g}):d[d.length-1].endIndex++}return d}function ng(n,r,s){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&s(`${n} was not resolved to pixel value correctly`,r,$t.WARN),r==="normal"?0:parseInt(r??"0",10)}function Tv(n,r,s){const o=we.useRef(null),c=we.useCallback(g=>{if(!(g!=null&&g.offsetParent))return;const p=g.getBoundingClientRect(),y=p.width;let v,j;if(r){const S=r.getBoundingClientRect(),k=p.top-S.top;j=S.height-Math.max(0,k),v=k+r.scrollTop}else{const S=f.current.ownerDocument.defaultView;j=S.innerHeight-Math.max(0,p.top),v=p.top+S.scrollY}o.current={listHeight:p.height,offsetTop:v,visibleHeight:j,visibleWidth:y},n(o.current)},[n,r]),{callbackRef:d,ref:f}=xf(c,!0,s),h=we.useCallback(()=>{c(f.current)},[c,f]);return we.useEffect(()=>{var p;if(r){r.addEventListener("scroll",h);const y=new ResizeObserver(()=>{requestAnimationFrame(h)});return y.observe(r),()=>{r.removeEventListener("scroll",h),y.unobserve(r)}}const g=(p=f.current)==null?void 0:p.ownerDocument.defaultView;return g==null||g.addEventListener("scroll",h),g==null||g.addEventListener("resize",h),()=>{g==null||g.removeEventListener("scroll",h),g==null||g.removeEventListener("resize",h)}},[h,r,f]),d}const cn=et(()=>{const n=Xe(),r=Xe(),s=me(0),o=Xe(),c=me(0),d=Xe(),f=Xe(),h=me(0),g=me(0),p=me(0),y=me(0),v=Xe(),j=Xe(),S=me(!1),k=me(!1),E=me(!1);return Ee(de(n,ye(({scrollTop:w})=>w)),r),Ee(de(n,ye(({scrollHeight:w})=>w)),f),Ee(r,c),{deviation:s,fixedFooterHeight:p,fixedHeaderHeight:g,footerHeight:y,headerHeight:h,horizontalDirection:k,scrollBy:j,scrollContainerState:n,scrollHeight:f,scrollingInProgress:S,scrollTo:v,scrollTop:r,skipAnimationFrameInResizeObserver:E,smoothScrollTargetReached:o,statefulScrollTop:c,viewportHeight:d}},[],{singleton:!0}),Os={lvl:0};function Rv(n,r){const s=n.length;if(s===0)return[];let{index:o,value:c}=r(n[0]);const d=[];for(let f=1;f<s;f++){const{index:h,value:g}=r(n[f]);d.push({end:h-1,start:o,value:c}),o=h,c=g}return d.push({end:1/0,start:o,value:c}),d}function ct(n){return n===Os}function Bs(n,r){if(!ct(n))return r===n.k?n.v:r<n.k?Bs(n.l,r):Bs(n.r,r)}function qn(n,r,s="k"){if(ct(n))return[-1/0,void 0];if(Number(n[s])===r)return[n.k,n.v];if(Number(n[s])<r){const o=qn(n.r,r,s);return o[0]===-1/0?[n.k,n.v]:o}return qn(n.l,r,s)}function wn(n,r,s){return ct(n)?Lv(r,s,1):r===n.k?Ut(n,{k:r,v:s}):r<n.k?ag(Ut(n,{l:wn(n.l,r,s)})):ag(Ut(n,{r:wn(n.r,r,s)}))}function wl(){return Os}function El(n,r,s){if(ct(n))return[];const o=qn(n,r)[0];return MS(Kd(n,o,s))}function qd(n,r){if(ct(n))return Os;const{k:s,l:o,r:c}=n;if(r===s){if(ct(o))return c;if(ct(c))return o;const[d,f]=Mv(o);return wo(Ut(n,{k:d,l:Av(o),v:f}))}return r<s?wo(Ut(n,{l:qd(o,r)})):wo(Ut(n,{r:qd(c,r)}))}function zr(n){return ct(n)?[]:[...zr(n.l),{k:n.k,v:n.v},...zr(n.r)]}function Kd(n,r,s){if(ct(n))return[];const{k:o,l:c,r:d,v:f}=n;let h=[];return o>r&&(h=h.concat(Kd(c,r,s))),o>=r&&o<=s&&h.push({k:o,v:f}),o<=s&&(h=h.concat(Kd(d,r,s))),h}function wo(n){const{l:r,lvl:s,r:o}=n;if(o.lvl>=s-1&&r.lvl>=s-1)return n;if(s>o.lvl+1){if(bd(r))return zv(Ut(n,{lvl:s-1}));if(!ct(r)&&!ct(r.r))return Ut(r.r,{l:Ut(r,{r:r.r.l}),lvl:s,r:Ut(n,{l:r.r.r,lvl:s-1})});throw new Error("Unexpected empty nodes")}if(bd(n))return Xd(Ut(n,{lvl:s-1}));if(!ct(o)&&!ct(o.l)){const c=o.l,d=bd(c)?o.lvl-1:o.lvl;return Ut(c,{l:Ut(n,{lvl:s-1,r:c.l}),lvl:c.lvl+1,r:Xd(Ut(o,{l:c.r,lvl:d}))})}throw new Error("Unexpected empty nodes")}function Ut(n,r){return Lv(r.k!==void 0?r.k:n.k,r.v!==void 0?r.v:n.v,r.lvl!==void 0?r.lvl:n.lvl,r.l!==void 0?r.l:n.l,r.r!==void 0?r.r:n.r)}function Av(n){return ct(n.r)?n.l:wo(Ut(n,{r:Av(n.r)}))}function bd(n){return ct(n)||n.lvl>n.r.lvl}function Mv(n){return ct(n.r)?[n.k,n.v]:Mv(n.r)}function Lv(n,r,s,o=Os,c=Os){return{k:n,l:o,lvl:s,r:c,v:r}}function ag(n){return Xd(zv(n))}function zv(n){const{l:r}=n;return!ct(r)&&r.lvl===n.lvl?Ut(r,{r:Ut(n,{l:r.r})}):n}function Xd(n){const{lvl:r,r:s}=n;return!ct(s)&&!ct(s.r)&&s.lvl===r&&s.r.lvl===r?Ut(s,{l:Ut(n,{r:s.l}),lvl:r+1}):n}function MS(n){return Rv(n,({k:r,v:s})=>({index:r,value:s}))}function Dv(n,r){return!!(n&&n.startIndex===r.startIndex&&n.endIndex===r.endIndex)}function Is(n,r){return!!(n&&n[0]===r[0]&&n[1]===r[1])}const gf=et(()=>({recalcInProgress:me(!1)}),[],{singleton:!0});function _v(n,r,s){return n[Ro(n,r,s)]}function Ro(n,r,s,o=0){let c=n.length-1;for(;o<=c;){const d=Math.floor((o+c)/2),f=n[d],h=s(f,r);if(h===0)return d;if(h===-1){if(c-o<2)return d-1;c=d-1}else{if(c===o)return d;o=d+1}}throw new Error(`Failed binary finding record in array - ${n.join(",")}, searched for ${r}`)}function LS(n,r,s,o){const c=Ro(n,r,o),d=Ro(n,s,o,c);return n.slice(c,d+1)}function rr(n,r){return Math.round(n.getBoundingClientRect()[r])}function Vo(n){return!ct(n.groupOffsetTree)}function vf({index:n},r){return r===n?0:r<n?-1:1}function zS(){return{groupIndices:[],groupOffsetTree:wl(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:wl()}}function DS(n,r){let s=ct(n)?0:1/0;for(const o of r){const{endIndex:c,size:d,startIndex:f}=o;if(s=Math.min(s,f),ct(n)){n=wn(n,0,d);continue}const h=El(n,f-1,c+1);if(h.some($S(o)))continue;let g=!1,p=!1;for(const{end:y,start:v,value:j}of h)g?(c>=v||d===j)&&(n=qd(n,v)):(p=j!==d,g=!0),y>c&&c>=v&&j!==d&&(n=wn(n,c+1,j));p&&(n=wn(n,f,d))}return[n,s]}function _S(n){return typeof n.groupIndex<"u"}function OS({offset:n},r){return r===n?0:r<n?-1:1}function Hs(n,r,s){if(r.length===0)return 0;const{index:o,offset:c,size:d}=_v(r,n,vf),f=n-o,h=d*f+(f-1)*s+c;return h>0?h+s:h}function Ov(n,r){if(!Vo(r))return n;let s=0;for(;r.groupIndices[s]<=n+s;)s++;return n+s}function Bv(n,r,s){if(_S(n))return r.groupIndices[n.groupIndex]+1;const o=n.index==="LAST"?s:n.index;let c=Ov(o,r);return c=Math.max(0,c,Math.min(s,c)),c}function BS(n,r,s,o=0){return o>0&&(r=Math.max(r,_v(n,o,vf).offset)),Rv(LS(n,r,s,OS),US)}function IS(n,[r,s,o,c]){r.length>0&&o("received item sizes",r,$t.DEBUG);const d=n.sizeTree;let f=d,h=0;if(s.length>0&&ct(d)&&r.length===2){const j=r[0].size,S=r[1].size;f=s.reduce((k,E)=>wn(wn(k,E,j),E+1,S),f)}else[f,h]=DS(f,r);if(f===d)return n;const{lastIndex:g,lastOffset:p,lastSize:y,offsetTree:v}=Qd(n.offsetTree,h,f,c);return{groupIndices:s,groupOffsetTree:s.reduce((j,S)=>wn(j,S,Hs(S,v,c)),wl()),lastIndex:g,lastOffset:p,lastSize:y,offsetTree:v,sizeTree:f}}function HS(n){return zr(n).map(({k:r,v:s},o,c)=>{const d=c[o+1];return{endIndex:d!==void 0?d.k-1:1/0,size:s,startIndex:r}})}function rg(n,r){let s=0,o=0;for(;s<n;)s+=r[o+1]-r[o]-1,o++;return o-(s===n?0:1)}function Qd(n,r,s,o){let c=n,d=0,f=0,h=0,g=0;if(r!==0){g=Ro(c,r-1,vf),h=c[g].offset;const p=qn(s,r-1);d=p[0],f=p[1],c.length&&c[g].size===qn(s,r)[1]&&(g-=1),c=c.slice(0,g+1)}else c=[];for(const{start:p,value:y}of El(s,r,1/0)){const v=p-d,j=v*f+h+v*o;c.push({index:p,offset:j,size:y}),d=p,h=j,f=y}return{lastIndex:d,lastOffset:h,lastSize:f,offsetTree:c}}function US(n){return{index:n.index,value:n}}function $S(n){const{endIndex:r,size:s,startIndex:o}=n;return c=>c.start===o&&(c.end===r||c.end===1/0)&&c.value===s}const VS={offsetHeight:"height",offsetWidth:"width"},ia=et(([{log:n},{recalcInProgress:r}])=>{const s=Xe(),o=Xe(),c=Jt(o,0),d=Xe(),f=Xe(),h=me(0),g=me([]),p=me(void 0),y=me(void 0),v=me(void 0),j=me(void 0),S=me((T,O)=>rr(T,VS[O])),k=me(void 0),E=me(0),w=zS(),N=Jt(de(s,Ve(g,n,E),ra(IS,w),xt()),w),A=Jt(de(g,xt(),ra((T,O)=>({current:O,prev:T.current}),{current:[],prev:[]}),ye(({prev:T})=>T)),[]);Ee(de(g,Me(T=>T.length>0),Ve(N,E),ye(([T,O,C])=>{const _=T.reduce(($,K,Z)=>wn($,K,Hs(K,O.offsetTree,C)||Z),wl());return{...O,groupIndices:T,groupOffsetTree:_}})),N),Ee(de(o,Ve(N),Me(([T,{lastIndex:O}])=>T<O),ye(([T,{lastIndex:O,lastSize:C}])=>[{endIndex:O,size:C,startIndex:T}])),s),Ee(p,y);const z=Jt(de(p,ye(T=>T===void 0)),!0);Ee(de(y,Me(T=>T!==void 0&&ct(jt(N).sizeTree)),ye(T=>{const O=jt(v),C=jt(g).length>0;return O!==void 0&&O!==0?C?[{endIndex:0,size:O,startIndex:0},{endIndex:1,size:T,startIndex:1}]:[]:[{endIndex:0,size:T,startIndex:0}]})),s),Ee(de(j,Me(T=>T!==void 0&&T.length>0&&ct(jt(N).sizeTree)),ye(T=>{const O=[];let C=T[0],_=0;for(let $=1;$<T.length;$++){const K=T[$];K!==C&&(O.push({endIndex:$-1,size:C,startIndex:_}),C=K,_=$)}return O.push({endIndex:T.length-1,size:C,startIndex:_}),O})),s),Ee(de(g,Ve(v,y),Me(([,T,O])=>T!==void 0&&O!==void 0),ye(([T,O,C])=>{const _=[];for(let $=0;$<T.length;$++){const K=T[$],Z=T[$+1];_.push({startIndex:K,endIndex:K,size:O}),Z!==void 0&&_.push({startIndex:K+1,endIndex:Z-1,size:C})}return _})),s);const H=En(de(s,Ve(N),ra(({sizes:T},[O,C])=>({changed:C!==T,sizes:C}),{changed:!1,sizes:w}),ye(T=>T.changed)));at(de(h,ra((T,O)=>({diff:T.prev-O,prev:O}),{diff:0,prev:0}),ye(T=>T.diff)),T=>{const{groupIndices:O}=jt(N);if(T>0)$e(r,!0),$e(d,T+rg(T,O));else if(T<0){const C=jt(A);C.length>0&&(T-=rg(-T,C)),$e(f,T)}}),at(de(h,Ve(n)),([T,O])=>{T<0&&O("`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},$t.ERROR)});const M=En(d);Ee(de(d,Ve(N),ye(([T,O])=>{const C=O.groupIndices.length>0,_=[],$=O.lastSize;if(C){const K=Bs(O.sizeTree,0);let Z=0,q=0;for(;Z<T;){const L=O.groupIndices[q],B=O.groupIndices.length===q+1?1/0:O.groupIndices[q+1]-L-1;_.push({endIndex:L,size:K,startIndex:L}),_.push({endIndex:L+1+B-1,size:$,startIndex:L+1}),q++,Z+=B+1}const I=zr(O.sizeTree);return Z!==T&&I.shift(),I.reduce((L,{k:B,v:P})=>{let W=L.ranges;return L.prevSize!==0&&(W=[...L.ranges,{endIndex:B+T-1,size:L.prevSize,startIndex:L.prevIndex}]),{prevIndex:B+T,prevSize:P,ranges:W}},{prevIndex:T,prevSize:0,ranges:_}).ranges}return zr(O.sizeTree).reduce((K,{k:Z,v:q})=>({prevIndex:Z+T,prevSize:q,ranges:[...K.ranges,{endIndex:Z+T-1,size:K.prevSize,startIndex:K.prevIndex}]}),{prevIndex:0,prevSize:$,ranges:[]}).ranges})),s);const F=En(de(f,Ve(N,E),ye(([T,{offsetTree:O},C])=>{const _=-T;return Hs(_,O,C)})));return Ee(de(f,Ve(N,E),ye(([T,O,C])=>{if(O.groupIndices.length>0){if(ct(O.sizeTree))return O;let $=wl();const K=jt(A);let Z=0,q=0,I=0;for(;Z<-T;){I=K[q];const L=K[q+1]-I-1;q++,Z+=L+1}if($=zr(O.sizeTree).reduce((L,{k:B,v:P})=>wn(L,Math.max(0,B+T),P),$),Z!==-T){const L=Bs(O.sizeTree,I);$=wn($,0,L);const B=qn(O.sizeTree,-T+1)[1];$=wn($,1,B)}return{...O,sizeTree:$,...Qd(O.offsetTree,0,$,C)}}const _=zr(O.sizeTree).reduce(($,{k:K,v:Z})=>wn($,Math.max(0,K+T),Z),wl());return{...O,sizeTree:_,...Qd(O.offsetTree,0,_,C)}})),N),{beforeUnshiftWith:M,data:k,defaultItemSize:y,firstItemIndex:h,fixedItemSize:p,fixedGroupSize:v,gap:E,groupIndices:g,heightEstimates:j,itemSize:S,listRefresh:H,shiftWith:f,shiftWithOffset:F,sizeRanges:s,sizes:N,statefulTotalCount:c,totalCount:o,trackItemSizes:z,unshiftWith:d}},gt(ir,gf),{singleton:!0});function PS(n){return n.reduce((r,s)=>(r.groupIndices.push(r.totalCount),r.totalCount+=s+1,r),{groupIndices:[],totalCount:0})}const Iv=et(([{groupIndices:n,sizes:r,totalCount:s},{headerHeight:o,scrollTop:c}])=>{const d=Xe(),f=Xe(),h=En(de(d,ye(PS)));return Ee(de(h,ye(g=>g.totalCount)),s),Ee(de(h,ye(g=>g.groupIndices)),n),Ee(de(Ot(c,r,o),Me(([g,p])=>Vo(p)),ye(([g,p,y])=>qn(p.groupOffsetTree,Math.max(g-y,0),"v")[0]),xt(),ye(g=>[g])),f),{groupCounts:d,topItemsIndexes:f}},gt(ia,cn)),or=et(([{log:n}])=>{const r=me(!1),s=En(de(r,Me(o=>o),xt()));return at(r,o=>{o&&jt(n)("props updated",{},$t.DEBUG)}),{didMount:s,propsReady:r}},gt(ir),{singleton:!0}),FS=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Hv(n){const r=typeof n=="number"?{index:n}:n;return r.align||(r.align="start"),(!r.behavior||!FS)&&(r.behavior="auto"),r.offset===void 0&&(r.offset=0),r}const Gs=et(([{gap:n,listRefresh:r,sizes:s,totalCount:o},{fixedFooterHeight:c,fixedHeaderHeight:d,footerHeight:f,headerHeight:h,scrollingInProgress:g,scrollTo:p,smoothScrollTargetReached:y,viewportHeight:v},{log:j}])=>{const S=Xe(),k=Xe(),E=me(0);let w=null,N=null,A=null;function z(){w!==null&&(w(),w=null),A!==null&&(A(),A=null),N&&(clearTimeout(N),N=null),$e(g,!1)}return Ee(de(S,Ve(s,v,o,E,h,f,j),Ve(n,d,c),ye(([[H,M,F,T,O,C,_,$],K,Z,q])=>{const I=Hv(H),{align:L,behavior:B,offset:P}=I,W=T-1,ie=Bv(I,M,W);let D=Hs(ie,M.offsetTree,K)+C;L==="end"?(D+=Z+qn(M.sizeTree,ie)[1]-F+q,ie===W&&(D+=_)):L==="center"?D+=(Z+qn(M.sizeTree,ie)[1]-F+q)/2:D-=O,P!==void 0&&P!==0&&(D+=P);const V=te=>{z(),te?($("retrying to scroll to",{location:H},$t.DEBUG),$e(S,H)):($e(k,!0),$("list did not change, scroll successful",{},$t.DEBUG))};if(z(),B==="smooth"){let te=!1;A=at(r,se=>{te=te||se}),w=Wn(y,()=>{V(te)})}else w=Wn(de(r,GS(150)),V);return N=setTimeout(()=>{z()},1200),$e(g,!0),$("scrolling from index to",{behavior:B,index:ie,top:D},$t.DEBUG),{behavior:B,top:D}})),p),{scrollTargetReached:k,scrollToIndex:S,topListHeight:E}},gt(ia,cn,ir),{singleton:!0});function GS(n){return r=>{const s=setTimeout(()=>{r(!1)},n);return o=>{o&&(r(!0),clearTimeout(s))}}}function yf(n,r){n===0?r():requestAnimationFrame(()=>{yf(n-1,r)})}function bf(n,r){const s=r-1;return typeof n=="number"?n:n.index==="LAST"?s:n.index}const Ws=et(([{defaultItemSize:n,listRefresh:r,sizes:s},{scrollTop:o},{scrollTargetReached:c,scrollToIndex:d},{didMount:f}])=>{const h=me(!0),g=me(0),p=me(!0);return Ee(de(f,Ve(g),Me(([y,v])=>v!==0),aa(!1)),h),Ee(de(f,Ve(g),Me(([y,v])=>v!==0),aa(!1)),p),at(de(Ot(r,f),Ve(h,s,n,p),Me(([[,y],v,{sizeTree:j},S,k])=>y&&(!ct(j)||mf(S))&&!v&&!k),Ve(g)),([,y])=>{Wn(c,()=>{$e(p,!0)}),yf(4,()=>{Wn(o,()=>{$e(h,!0)}),$e(d,y)})}),{initialItemFinalLocationReached:p,initialTopMostItemIndex:g,scrolledToInitialItem:h}},gt(ia,cn,Gs,or),{singleton:!0});function Uv(n,r){return Math.abs(n-r)<1.01}const Us="up",Ls="down",WS="none",YS={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},qS=0,Ys=et(([{footerHeight:n,headerHeight:r,scrollBy:s,scrollContainerState:o,scrollTop:c,viewportHeight:d}])=>{const f=me(!1),h=me(!0),g=Xe(),p=Xe(),y=me(4),v=me(qS),j=Jt(de(Yd(de(Ae(c),Dr(1),aa(!0)),de(Ae(c),Dr(1),aa(!1),tg(100))),xt()),!1),S=Jt(de(Yd(de(s,aa(!0)),de(s,aa(!1),tg(200))),xt()),!1);Ee(de(Ot(Ae(c),Ae(v)),ye(([A,z])=>A<=z),xt()),h),Ee(de(h,Na(50)),p);const k=En(de(Ot(o,Ae(d),Ae(r),Ae(n),Ae(y)),ra((A,[{scrollHeight:z,scrollTop:H},M,F,T,O])=>{const C=H+M-z>-O,_={scrollHeight:z,scrollTop:H,viewportHeight:M};if(C){let K,Z;return H>A.state.scrollTop?(K="SCROLLED_DOWN",Z=A.state.scrollTop-H):(K="SIZE_DECREASED",Z=A.state.scrollTop-H||A.scrollTopDelta),{atBottom:!0,atBottomBecause:K,scrollTopDelta:Z,state:_}}let $;return _.scrollHeight>A.state.scrollHeight?$="SIZE_INCREASED":M<A.state.viewportHeight?$="VIEWPORT_HEIGHT_DECREASING":H<A.state.scrollTop?$="SCROLLING_UPWARDS":$="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:$,state:_}},YS),xt((A,z)=>A!==void 0&&A.atBottom===z.atBottom))),E=Jt(de(o,ra((A,{scrollHeight:z,scrollTop:H,viewportHeight:M})=>{if(!Uv(A.scrollHeight,z)){const F=z-(H+M)<1;return A.scrollTop!==H&&F?{changed:!0,jump:A.scrollTop-H,scrollHeight:z,scrollTop:H}:{changed:!0,jump:0,scrollHeight:z,scrollTop:H}}return{changed:!1,jump:0,scrollHeight:z,scrollTop:H}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Me(A=>A.changed),ye(A=>A.jump)),0);Ee(de(k,ye(A=>A.atBottom)),f),Ee(de(f,Na(50)),g);const w=me(Ls);Ee(de(o,ye(({scrollTop:A})=>A),xt(),ra((A,z)=>jt(S)?{direction:A.direction,prevScrollTop:z}:{direction:z<A.prevScrollTop?Us:Ls,prevScrollTop:z},{direction:Ls,prevScrollTop:0}),ye(A=>A.direction)),w),Ee(de(o,Na(50),aa(WS)),w);const N=me(0);return Ee(de(j,Me(A=>!A),aa(0)),N),Ee(de(c,Na(100),Ve(j),Me(([A,z])=>z),ra(([A,z],[H])=>[z,H],[0,0]),ye(([A,z])=>z-A)),N),{atBottomState:k,atBottomStateChange:g,atBottomThreshold:y,atTopStateChange:p,atTopThreshold:v,isAtBottom:f,isAtTop:h,isScrolling:j,lastJumpDueToItemResize:E,scrollDirection:w,scrollVelocity:N}},gt(cn)),$s="top",Vs="bottom",lg="none";function sg(n,r,s){return typeof n=="number"?s===Us&&r===$s||s===Ls&&r===Vs?n:0:s===Us?r===$s?n.main:n.reverse:r===Vs?n.main:n.reverse}function ig(n,r){return typeof n=="number"?n:n[r]??0}const jf=et(([{deviation:n,fixedHeaderHeight:r,headerHeight:s,scrollTop:o,viewportHeight:c}])=>{const d=Xe(),f=me(0),h=me(0),g=me(0),p=Jt(de(Ot(Ae(o),Ae(c),Ae(s),Ae(d,Is),Ae(g),Ae(f),Ae(r),Ae(n),Ae(h)),ye(([y,v,j,[S,k],E,w,N,A,z])=>{const H=y-A,M=w+N,F=Math.max(j-H,0);let T=lg;const O=ig(z,$s),C=ig(z,Vs);return S-=A,S+=j+N,k+=j+N,k-=A,S>y+M-O&&(T=Us),k<y-F+v+C&&(T=Ls),T!==lg?[Math.max(H-j-sg(E,$s,T)-O,0),H-F-N+v+sg(E,Vs,T)+C]:null}),Me(y=>y!==null),xt(Is)),[0,0]);return{increaseViewportBy:h,listBoundary:d,overscan:g,topListHeight:f,visibleRange:p}},gt(cn),{singleton:!0});function KS(n,r,s){if(Vo(r)){const o=Ov(n,r);return[{index:qn(r.groupOffsetTree,o)[0],offset:0,size:0},{data:s==null?void 0:s[0],index:o,offset:0,size:0}]}return[{data:s==null?void 0:s[0],index:n,offset:0,size:0}]}const jd={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Eo(n,r,s,o,c,d){const{lastIndex:f,lastOffset:h,lastSize:g}=c;let p=0,y=0;if(n.length>0){p=n[0].offset;const E=n[n.length-1];y=E.offset+E.size}const v=s-f,j=h+v*g+(v-1)*o,S=p,k=j-y;return{bottom:y,firstItemIndex:d,items:og(n,c,d),offsetBottom:k,offsetTop:p,top:S,topItems:og(r,c,d),topListHeight:r.reduce((E,w)=>w.size+E,0),totalCount:s}}function $v(n,r,s,o,c,d){let f=0;if(s.groupIndices.length>0)for(const y of s.groupIndices){if(y-f>=n)break;f++}const h=n+f,g=bf(r,h),p=Array.from({length:h}).map((y,v)=>({data:d[v+g],index:v+g,offset:0,size:0}));return Eo(p,[],h,c,s,o)}function og(n,r,s){if(n.length===0)return[];if(!Vo(r))return n.map(p=>({...p,index:p.index+s,originalIndex:p.index}));const o=n[0].index,c=n[n.length-1].index,d=[],f=El(r.groupOffsetTree,o,c);let h,g=0;for(const p of n){(!h||h.end<p.index)&&(h=f.shift(),g=r.groupIndices.indexOf(h.start));let y;p.index===h.start?y={index:g,type:"group"}:y={groupIndex:g,index:p.index-(g+1)+s},d.push({...y,data:p.data,offset:p.offset,originalIndex:p.index,size:p.size})}return d}function cg(n,r){return n===void 0?0:typeof n=="number"?n:n[r]??0}const Br=et(([{data:n,firstItemIndex:r,gap:s,sizes:o,totalCount:c},d,{listBoundary:f,topListHeight:h,visibleRange:g},{initialTopMostItemIndex:p,scrolledToInitialItem:y},{topListHeight:v},j,{didMount:S},{recalcInProgress:k}])=>{const E=me([]),w=me(0),N=Xe(),A=me(0);Ee(d.topItemsIndexes,E);const z=Jt(de(Ot(S,k,Ae(g,Is),Ae(c),Ae(o),Ae(p),y,Ae(E),Ae(r),Ae(s),Ae(A),n),Me(([T,O,,C,,,,,,,,_])=>{const $=_!==void 0&&_.length!==C;return T&&!O&&!$}),ye(([,,[T,O],C,_,$,K,Z,q,I,L,B])=>{var je,Be;const P=_,{offsetTree:W,sizeTree:ie}=P,D=jt(w);if(C===0)return{...jd,totalCount:C};if(T===0&&O===0)return D===0?{...jd,totalCount:C}:$v(D,$,_,q,I,B||[]);if(ct(ie))return D>0?null:Eo(KS(bf($,C),P,B),[],C,I,P,q);const V=[];if(Z.length>0){const ze=Z[0],re=Z[Z.length-1];let fe=0;for(const pe of El(ie,ze,re)){const xe=pe.value,ve=Math.max(pe.start,ze),Le=Math.min(pe.end,re);for(let De=ve;De<=Le;De++)V.push({data:B==null?void 0:B[De],index:De,offset:fe,size:xe}),fe+=xe}}if(!K)return Eo([],V,C,I,P,q);const te=Z.length>0?Z[Z.length-1]+1:0,se=BS(W,T,O,te);if(se.length===0)return null;const ge=C-1,he=$o([],ze=>{for(const re of se){const fe=re.value;let pe=fe.offset,xe=re.start;const ve=fe.size;if(fe.offset<T){xe+=Math.floor((T-fe.offset+I)/(ve+I));const De=xe-re.start;pe+=De*ve+De*I}xe<te&&(pe+=(te-xe)*ve,xe=te);const Le=Math.min(re.end,ge);for(let De=xe;De<=Le&&!(pe>=O);De++)ze.push({data:B==null?void 0:B[De],index:De,offset:pe,size:ve}),pe+=ve+I}}),be=cg(L,$s),ce=cg(L,Vs);if(he.length>0&&(be>0||ce>0)){const ze=he[0],re=he[he.length-1];if(be>0&&ze.index>te){const fe=Math.min(be,ze.index-te),pe=[];let xe=ze.offset;for(let ve=ze.index-1;ve>=ze.index-fe;ve--){const Le=((je=El(ie,ve,ve)[0])==null?void 0:je.value)??ze.size;xe-=Le+I,pe.unshift({data:B==null?void 0:B[ve],index:ve,offset:xe,size:Le})}he.unshift(...pe)}if(ce>0&&re.index<ge){const fe=Math.min(ce,ge-re.index);let pe=re.offset+re.size+I;for(let xe=re.index+1;xe<=re.index+fe;xe++){const ve=((Be=El(ie,xe,xe)[0])==null?void 0:Be.value)??re.size;he.push({data:B==null?void 0:B[xe],index:xe,offset:pe,size:ve}),pe+=ve+I}}}return Eo(he,V,C,I,P,q)}),Me(T=>T!==null),xt()),jd);Ee(de(n,Me(mf),ye(T=>T==null?void 0:T.length)),c),Ee(de(z,ye(T=>T.topListHeight)),v),Ee(v,h),Ee(de(z,ye(T=>[T.top,T.bottom])),f),Ee(de(z,ye(T=>T.items)),N);const H=En(de(z,Me(({items:T})=>T.length>0),Ve(c,n),Me(([{items:T},O])=>T[T.length-1].originalIndex===O-1),ye(([,T,O])=>[T-1,O]),xt(Is),ye(([T])=>T))),M=En(de(z,Na(200),Me(({items:T,topItems:O})=>T.length>0&&T[0].originalIndex===O.length),ye(({items:T})=>T[0].index),xt())),F=En(de(z,Me(({items:T})=>T.length>0),ye(({items:T})=>{let O=0,C=T.length-1;for(;T[O].type==="group"&&O<C;)O++;for(;T[C].type==="group"&&C>O;)C--;return{endIndex:T[C].index,startIndex:T[O].index}}),xt(Dv)));return{endReached:H,initialItemCount:w,itemsRendered:N,listState:z,minOverscanItemCount:A,rangeChanged:F,startReached:M,topItemsIndexes:E,...j}},gt(ia,Iv,jf,Ws,Gs,Ys,or,gf),{singleton:!0}),Vv=et(([{fixedFooterHeight:n,fixedHeaderHeight:r,footerHeight:s,headerHeight:o},{listState:c}])=>{const d=Xe(),f=Jt(de(Ot(s,n,o,r,c),ye(([h,g,p,y,v])=>h+g+p+y+v.offsetBottom+v.bottom)),0);return Ee(Ae(f),d),{totalListHeight:f,totalListHeightChanged:d}},gt(cn,Br),{singleton:!0}),XS=et(([{viewportHeight:n},{totalListHeight:r}])=>{const s=me(!1),o=Jt(de(Ot(s,n,r),Me(([c])=>c),ye(([,c,d])=>Math.max(0,c-d)),Na(0),xt()),0);return{alignToBottom:s,paddingTopAddition:o}},gt(cn,Vv),{singleton:!0}),Pv=et(()=>({context:me(null)})),QS=({itemBottom:n,itemTop:r,locationParams:{align:s,behavior:o,...c},viewportBottom:d,viewportTop:f})=>r<f?{...c,align:s??"start",...o!==void 0?{behavior:o}:{}}:n>d?{...c,align:s??"end",...o!==void 0?{behavior:o}:{}}:null,Fv=et(([{gap:n,sizes:r,totalCount:s},{fixedFooterHeight:o,fixedHeaderHeight:c,headerHeight:d,scrollingInProgress:f,scrollTop:h,viewportHeight:g},{scrollToIndex:p}])=>{const y=Xe();return Ee(de(y,Ve(r,g,s,d,c,o,h),Ve(n),ye(([[v,j,S,k,E,w,N,A],z])=>{const{calculateViewLocation:H=QS,done:M,...F}=v,T=Bv(v,j,k-1),O=Hs(T,j.offsetTree,z)+E+w,C=O+qn(j.sizeTree,T)[1],_=A+w,$=A+S-N,K=H({itemBottom:C,itemTop:O,locationParams:F,viewportBottom:$,viewportTop:_});return K!==null?M&&Wn(de(f,Me(Z=>!Z),Dr(jt(f)?1:2)),M):M==null||M(),K}),Me(v=>v!==null)),p),{scrollIntoView:y}},gt(ia,cn,Gs,Br,ir),{singleton:!0});function ug(n){return n===!1?!1:n==="smooth"?"smooth":"auto"}const ZS=(n,r)=>typeof n=="function"?ug(n(r)):r&&ug(n),JS=et(([{listRefresh:n,totalCount:r,fixedItemSize:s,data:o},{atBottomState:c,isAtBottom:d},{scrollToIndex:f},{scrolledToInitialItem:h},{didMount:g,propsReady:p},{log:y},{scrollingInProgress:v},{context:j},{scrollIntoView:S}])=>{const k=me(!1),E=Xe();let w=null;function N(M){$e(f,{align:"end",behavior:M,index:"LAST"})}at(de(Ot(de(Ae(r),Dr(1)),g),Ve(Ae(k),d,h,v),ye(([[M,F],T,O,C,_])=>{let $=F&&C,K="auto";return $&&(K=ZS(T,O||_),$=$&&K!==!1),{followOutputBehavior:K,shouldFollow:$,totalCount:M}}),Me(({shouldFollow:M})=>M)),({followOutputBehavior:M,totalCount:F})=>{w!==null&&(w(),w=null),jt(s)!==void 0?requestAnimationFrame(()=>{jt(y)("following output to ",{totalCount:F},$t.DEBUG),N(M)}):w=Wn(n,()=>{jt(y)("following output to ",{totalCount:F},$t.DEBUG),N(M),w=null})});function A(M){const F=Wn(c,T=>{M&&!T.atBottom&&T.notAtBottomBecause==="SIZE_INCREASED"&&w===null&&(jt(y)("scrolling to bottom due to increased size",{},$t.DEBUG),N("auto"))});setTimeout(F,100)}at(de(Ot(Ae(k),r,p),Me(([M,,F])=>M!==!1&&F),ra(({value:M},[,F])=>({refreshed:M===F,value:F}),{refreshed:!1,value:0}),Me(({refreshed:M})=>M),Ve(k,r)),([,M])=>{jt(h)&&A(M!==!1)}),at(E,()=>{A(jt(k)!==!1)}),at(Ot(Ae(k),c),([M,F])=>{M!==!1&&!F.atBottom&&F.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&N("auto")});const z=me(null),H=Xe();return Ee(Yd(de(Ae(o),ye(M=>(M==null?void 0:M.length)??0)),de(Ae(r))),H),at(de(Ot(de(H,Dr(1)),g),Ve(Ae(z),h,v,j),ye(([[M,F],T,O,C,_])=>F&&O&&(T==null?void 0:T({context:_,totalCount:M,scrollingInProgress:C}))),Me(M=>!!M),Na(0)),M=>{w!==null&&(w(),w=null),jt(s)!==void 0?requestAnimationFrame(()=>{jt(y)("scrolling into view",{}),$e(S,M)}):w=Wn(n,()=>{jt(y)("scrolling into view",{}),$e(S,M),w=null})}),{autoscrollToBottom:E,followOutput:k,scrollIntoViewOnChange:z}},gt(ia,Ys,Gs,Ws,or,ir,cn,Pv,Fv)),ek=et(([{data:n,firstItemIndex:r,gap:s,sizes:o},{initialTopMostItemIndex:c},{initialItemCount:d,listState:f},{didMount:h}])=>(Ee(de(h,Ve(d),Me(([,g])=>g!==0),Ve(c,o,r,s,n),ye(([[,g],p,y,v,j,S=[]])=>$v(g,p,y,v,j,S))),f),{}),gt(ia,Ws,Br,or),{singleton:!0}),tk=et(([{didMount:n},{scrollTo:r},{listState:s}])=>{const o=me(0);return at(de(n,Ve(o),Me(([,c])=>c!==0),ye(([,c])=>({top:c}))),c=>{Wn(de(s,Dr(1),Me(d=>d.items.length>1)),()=>{requestAnimationFrame(()=>{$e(r,c)})})}),{initialScrollTop:o}},gt(or,cn,Br),{singleton:!0}),Gv=et(([{scrollVelocity:n}])=>{const r=me(!1),s=Xe(),o=me(!1);return Ee(de(n,Ve(o,r,s),Me(([c,d])=>d!==!1&&d!==void 0),ye(([c,d,f,h])=>{const{enter:g,exit:p}=d;if(f){if(p(c,h))return!1}else if(g(c,h))return!0;return f}),xt()),r),at(de(Ot(r,n,s),Ve(o)),([[c,d,f],h])=>{c&&h!==!1&&h!==void 0&&h.change&&h.change(d,f)}),{isSeeking:r,scrollSeekConfiguration:o,scrollSeekRangeChanged:s,scrollVelocity:n}},gt(Ys),{singleton:!0}),Sf=et(([{scrollContainerState:n,scrollTo:r}])=>{const s=Xe(),o=Xe(),c=Xe(),d=me(!1),f=me(void 0);return Ee(de(Ot(s,o),ye(([{scrollTop:h,viewportHeight:g},{offsetTop:p,listHeight:y}])=>({scrollHeight:y,scrollTop:Math.max(0,h-p),viewportHeight:g}))),n),Ee(de(r,Ve(o),ye(([h,{offsetTop:g}])=>({...h,top:h.top+g}))),c),{customScrollParent:f,useWindowScroll:d,windowScrollContainerState:s,windowScrollTo:c,windowViewportRect:o}},gt(cn)),nk=et(([{sizeRanges:n,sizes:r},{headerHeight:s,scrollTop:o},{initialTopMostItemIndex:c},{didMount:d},{useWindowScroll:f,windowScrollContainerState:h,windowViewportRect:g}])=>{const p=Xe(),y=me(void 0),v=me(null),j=me(null);return Ee(h,v),Ee(g,j),at(de(p,Ve(r,o,f,v,j,s)),([S,k,E,w,N,A,z])=>{const H=HS(k.sizeTree);w&&N!==null&&A!==null&&(E=N.scrollTop-A.offsetTop),E-=z,S({ranges:H,scrollTop:E})}),Ee(de(y,Me(mf),ye(ak)),c),Ee(de(d,Ve(y),Me(([,S])=>S!==void 0),xt(),ye(([,S])=>S.ranges)),n),{getState:p,restoreStateFrom:y}},gt(ia,cn,Ws,or,Sf));function ak(n){return{align:"start",index:0,offset:n.scrollTop}}const rk=et(([{topItemsIndexes:n}])=>{const r=me(0);return Ee(de(r,Me(s=>s>=0),ye(s=>Array.from({length:s}).map((o,c)=>c))),n),{topItemCount:r}},gt(Br));function Wv(n){let r=!1,s;return(()=>(r||(r=!0,s=n()),s))}const lk=Wv(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),sk=et(([{deviation:n,scrollBy:r,scrollingInProgress:s,scrollTop:o},{isAtBottom:c,isScrolling:d,lastJumpDueToItemResize:f,scrollDirection:h},{listState:g},{beforeUnshiftWith:p,gap:y,shiftWithOffset:v,sizes:j},{log:S},{recalcInProgress:k}])=>{const E=En(de(g,Ve(f),ra(([,N,A,z],[{bottom:H,items:M,offsetBottom:F,totalCount:T},O])=>{const C=H+F;let _=0;return A===T&&N.length>0&&M.length>0&&(M[0].originalIndex===0&&N[0].originalIndex===0||(_=C-z,_!==0&&(_+=O))),[_,M,T,C]},[0,[],0,0]),Me(([N])=>N!==0),Ve(o,h,s,c,S,k),Me(([,N,A,z,,,H])=>!H&&!z&&N!==0&&A===Us),ye(([[N],,,,,A])=>(A("Upward scrolling compensation",{amount:N},$t.DEBUG),N))));function w(N){N>0?($e(r,{behavior:"auto",top:-N}),$e(n,0)):($e(n,0),$e(r,{behavior:"auto",top:-N}))}return at(de(E,Ve(n,d)),([N,A,z])=>{z&&lk()?$e(n,A-N):w(-N)}),at(de(Ot(Jt(d,!1),n,k),Me(([N,A,z])=>!N&&!z&&A!==0),ye(([N,A])=>A),Na(1)),w),Ee(de(v,ye(N=>({top:-N}))),r),at(de(p,Ve(j,y),ye(([N,{groupIndices:A,lastSize:z,sizeTree:H},M])=>{function F($){return $*(z+M)}if(A.length===0)return F(N);let T=0;const O=Bs(H,0);let C=0,_=0;for(;C<N;){C++,T+=O;let $=A.length===_+1?1/0:A[_+1]-A[_]-1;C+$>N&&(T-=O,$=N-C+1),C+=$,T+=F($),_++}return T})),N=>{$e(n,N),requestAnimationFrame(()=>{$e(r,{top:N}),requestAnimationFrame(()=>{$e(n,0),$e(k,!1)})})}),{deviation:n}},gt(cn,Ys,Br,ia,ir,gf)),ik=et(([n,r,s,o,c,d,f,h,g,p,y])=>({...n,...r,...s,...o,...c,...d,...f,...h,...g,...p,...y}),gt(jf,ek,or,Gv,Vv,tk,XS,Sf,Fv,ir,Pv)),Yv=et(([{data:n,defaultItemSize:r,firstItemIndex:s,fixedItemSize:o,fixedGroupSize:c,gap:d,groupIndices:f,heightEstimates:h,itemSize:g,sizeRanges:p,sizes:y,statefulTotalCount:v,totalCount:j,trackItemSizes:S},{initialItemFinalLocationReached:k,initialTopMostItemIndex:E,scrolledToInitialItem:w},N,A,z,H,{scrollToIndex:M},F,{topItemCount:T},{groupCounts:O},C])=>{const{listState:_,minOverscanItemCount:$,topItemsIndexes:K,rangeChanged:Z,...q}=H;return Ee(Z,C.scrollSeekRangeChanged),Ee(de(C.windowViewportRect,ye(I=>I.visibleHeight)),N.viewportHeight),{data:n,defaultItemHeight:r,firstItemIndex:s,fixedItemHeight:o,fixedGroupHeight:c,gap:d,groupCounts:O,heightEstimates:h,initialItemFinalLocationReached:k,initialTopMostItemIndex:E,scrolledToInitialItem:w,sizeRanges:p,topItemCount:T,topItemsIndexes:K,totalCount:j,...z,groupIndices:f,itemSize:g,listState:_,minOverscanItemCount:$,scrollToIndex:M,statefulTotalCount:v,trackItemSizes:S,rangeChanged:Z,...q,...C,...N,sizes:y,...A}},gt(ia,Ws,cn,nk,JS,Br,Gs,sk,rk,Iv,ik));function ok(n,r){const s={},o={};let c=0;const d=n.length;for(;c<d;)o[n[c]]=1,c+=1;for(const f in r)Object.hasOwn(o,f)||(s[f]=r[f]);return s}const uo=typeof document<"u"?we.useLayoutEffect:we.useEffect;function qv(n,r,s){const o=Object.keys(r.required||{}),c=Object.keys(r.optional||{}),d=Object.keys(r.methods||{}),f=Object.keys(r.events||{}),h=we.createContext({});function g(w,N){w.propsReady!==void 0&&$e(w.propsReady,!1);for(const A of o){const z=w[r.required[A]];$e(z,N[A])}for(const A of c)if(A in N){const z=w[r.optional[A]];$e(z,N[A])}w.propsReady!==void 0&&$e(w.propsReady,!0)}function p(w){return d.reduce((N,A)=>(N[A]=z=>{const H=w[r.methods[A]];$e(H,z)},N),{})}function y(w){return f.reduce((N,A)=>(N[A]=wS(w[r.events[A]]),N),{})}const v=we.forwardRef(function(w,N){const{children:A,...z}=w,[H]=we.useState(()=>$o(CS(n),T=>{g(T,z)})),[M]=we.useState(eg(y,H));uo(()=>{for(const T of f)T in z&&at(M[T],z[T]);return()=>{Object.values(M).map(hf)}},[z,M,H]),uo(()=>{g(H,z)}),we.useImperativeHandle(N,Jx(p(H)));const F=s;return a.jsx(h.Provider,{value:H,children:s!==void 0?a.jsx(F,{...ok([...o,...c,...f],z),children:A}):A})}),j=w=>{const N=we.useContext(h);return we.useCallback(A=>{$e(N[w],A)},[N,w])},S=w=>{const N=we.useContext(h)[w],A=we.useCallback(z=>at(N,z),[N]);return we.useSyncExternalStore(A,()=>jt(N),()=>jt(N))},k=w=>{const N=we.useContext(h)[w],[A,z]=we.useState(eg(jt,N));return uo(()=>at(N,H=>{H!==A&&z(Jx(H))}),[N,A]),A},E=parseInt(we.version)>=18?S:k;return{Component:v,useEmitter:(w,N)=>{const A=we.useContext(h)[w];uo(()=>at(A,N),[N,A])},useEmitterValue:E,usePublisher:j}}const Kv=we.createContext(void 0),Xv=we.createContext(void 0),Sd="-webkit-sticky",dg="sticky",kf=Wv(()=>{if(typeof document>"u")return dg;const n=document.createElement("div");return n.style.position=Sd,n.style.position===Sd?Sd:dg}),Qv=typeof document<"u"?we.useLayoutEffect:we.useEffect;function kd(n){return"self"in n}function ck(n){return"body"in n}function Zv(n,r,s,o=Ll,c,d){const f=we.useRef(null),h=we.useRef(null),g=we.useRef(null),p=we.useCallback(j=>{let S,k,E;const w=j.target;if(ck(w)||kd(w)){const A=kd(w)?w:w.defaultView;E=d===!0?A.scrollX:A.scrollY,S=d===!0?A.document.documentElement.scrollWidth:A.document.documentElement.scrollHeight,k=d===!0?A.innerWidth:A.innerHeight}else E=d===!0?w.scrollLeft:w.scrollTop,S=d===!0?w.scrollWidth:w.scrollHeight,k=d===!0?w.offsetWidth:w.offsetHeight;const N=()=>{n({scrollHeight:S,scrollTop:Math.max(E,0),viewportHeight:k})};j.suppressFlushSync===!0?N():Lj.flushSync(N),h.current!==null&&(E===h.current||E<=0||E===S-k)&&(h.current=null,r(!0),g.current&&(clearTimeout(g.current),g.current=null))},[n,r,d]);we.useEffect(()=>{const j=c||f.current;return o(c||f.current),p({suppressFlushSync:!0,target:j}),j.addEventListener("scroll",p,{passive:!0}),()=>{o(null),j.removeEventListener("scroll",p)}},[f,p,s,o,c]);function y(j){const S=f.current;if(!S||(d===!0?"offsetWidth"in S&&S.offsetWidth===0:"offsetHeight"in S&&S.offsetHeight===0))return;const k=j.behavior==="smooth";let E,w,N;kd(S)?(w=Math.max(rr(S.document.documentElement,d===!0?"width":"height"),d===!0?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight),E=d===!0?S.innerWidth:S.innerHeight,N=d===!0?window.scrollX:window.scrollY):(w=S[d===!0?"scrollWidth":"scrollHeight"],E=rr(S,d===!0?"width":"height"),N=S[d===!0?"scrollLeft":"scrollTop"]);const A=w-E;if(j.top=Math.ceil(Math.max(Math.min(A,j.top),0)),Uv(E,w)||j.top===N){n({scrollHeight:w,scrollTop:N,viewportHeight:E}),k&&r(!0);return}k?(h.current=j.top,g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{g.current=null,h.current=null,r(!0)},1e3)):h.current=null,d===!0&&(j={...j.behavior!==void 0?{behavior:j.behavior}:{},left:j.top}),S.scrollTo(j)}function v(j){d===!0&&(j={...j.behavior!==void 0?{behavior:j.behavior}:{},...j.top!==void 0?{left:j.top}:{}}),f.current.scrollBy(j)}return{scrollByCallback:v,scrollerRef:f,scrollToCallback:y}}function wf(n){return n}const uk=et(()=>{const n=me(h=>`Item ${h}`),r=me(h=>`Group ${h}`),s=me({}),o=me(wf),c=me("div"),d=me(Ll),f=(h,g=null)=>Jt(de(s,ye(p=>p[h]),xt()),g);return{components:s,computeItemKey:o,EmptyPlaceholder:f("EmptyPlaceholder"),FooterComponent:f("Footer"),GroupComponent:f("Group","div"),groupContent:r,HeaderComponent:f("Header"),HeaderFooterTag:c,ItemComponent:f("Item","div"),itemContent:n,ListComponent:f("List","div"),ScrollerComponent:f("Scroller","div"),scrollerRef:d,ScrollSeekPlaceholder:f("ScrollSeekPlaceholder"),TopItemListComponent:f("TopItemList")}}),dk=et(([n,r])=>({...n,...r}),gt(Yv,uk)),fk=({height:n})=>a.jsx("div",{style:{height:n}}),pk={overflowAnchor:"none",position:kf(),zIndex:1},Jv={overflowAnchor:"none"},mk={...Jv,display:"inline-block",height:"100%"},fg=we.memo(function({showTopList:n=!1}){const r=Oe("listState"),s=Un("sizeRanges"),o=Oe("useWindowScroll"),c=Oe("customScrollParent"),d=Un("windowScrollContainerState"),f=Un("scrollContainerState"),h=c||o?d:f,g=Oe("itemContent"),p=Oe("context"),y=Oe("groupContent"),v=Oe("trackItemSizes"),j=Oe("itemSize"),S=Oe("log"),k=Un("gap"),E=Oe("horizontalDirection"),{callbackRef:w}=RS(s,j,v,n?Ll:h,S,k,c,E,Oe("skipAnimationFrameInResizeObserver")),[N,A]=we.useState(0);Ef("deviation",q=>{N!==q&&A(q)});const z=Oe("EmptyPlaceholder"),H=Oe("ScrollSeekPlaceholder")??fk,M=Oe("ListComponent"),F=Oe("ItemComponent"),T=Oe("GroupComponent"),O=Oe("computeItemKey"),C=Oe("isSeeking"),_=Oe("groupIndices").length>0,$=Oe("alignToBottom"),K=Oe("initialItemFinalLocationReached"),Z=n?{}:{boxSizing:"border-box",...E?{display:"inline-block",height:"100%",marginLeft:N!==0?N:$?"auto":0,paddingLeft:r.offsetTop,paddingRight:r.offsetBottom,whiteSpace:"nowrap"}:{marginTop:N!==0?N:$?"auto":0,paddingBottom:r.offsetBottom,paddingTop:r.offsetTop},...K?{}:{visibility:"hidden"}};return!n&&r.totalCount===0&&z!==null&&z!==void 0?a.jsx(z,{...Zt(z,p)}):a.jsx(M,{...Zt(M,p),"data-testid":n?"virtuoso-top-item-list":"virtuoso-item-list",ref:w,style:Z,children:(n?r.topItems:r.items).map(q=>{const I=q.originalIndex,L=O(I+r.firstItemIndex,q.data,p);return C?x.createElement(H,{...Zt(H,p),height:q.size,index:q.index,key:L,type:q.type||"item",...q.type==="group"?{}:{groupIndex:q.groupIndex}}):q.type==="group"?x.createElement(T,{...Zt(T,p),"data-index":I,"data-item-index":q.index,"data-known-size":q.size,key:L,style:pk},y(q.index,p)):x.createElement(F,{...Zt(F,p),...vk(F,q.data),"data-index":I,"data-item-group-index":q.groupIndex,"data-item-index":q.index,"data-known-size":q.size,key:L,style:E?mk:Jv},_?g(q.index,q.groupIndex,q.data,p):g(q.index,q.data,p))})})}),hk={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},xk={outline:"none",overflowX:"auto",position:"relative"},Po=n=>({height:"100%",position:"absolute",top:0,width:"100%",...n?{display:"flex",flexDirection:"column"}:void 0}),gk={position:kf(),top:0,width:"100%",zIndex:1};function Zt(n,r){if(typeof n!="string")return{context:r}}function vk(n,r){return{item:typeof n=="string"?void 0:r}}const yk=we.memo(function(){const n=Oe("HeaderComponent"),r=Un("headerHeight"),s=Oe("HeaderFooterTag"),o=Or(we.useMemo(()=>d=>{r(rr(d,"height"))},[r]),!0,Oe("skipAnimationFrameInResizeObserver")),c=Oe("context");return n!=null?a.jsx(s,{ref:o,children:a.jsx(n,{...Zt(n,c)})}):null}),bk=we.memo(function(){const n=Oe("FooterComponent"),r=Un("footerHeight"),s=Oe("HeaderFooterTag"),o=Or(we.useMemo(()=>d=>{r(rr(d,"height"))},[r]),!0,Oe("skipAnimationFrameInResizeObserver")),c=Oe("context");return n!=null?a.jsx(s,{ref:o,children:a.jsx(n,{...Zt(n,c)})}):null});function ey({useEmitter:n,useEmitterValue:r,usePublisher:s}){return we.memo(function({children:o,style:c,context:d,...f}){const h=s("scrollContainerState"),g=r("ScrollerComponent"),p=s("smoothScrollTargetReached"),y=r("scrollerRef"),v=r("horizontalDirection")||!1,{scrollByCallback:j,scrollerRef:S,scrollToCallback:k}=Zv(h,p,g,y,void 0,v);return n("scrollTo",k),n("scrollBy",j),a.jsx(g,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:S,style:{...v?xk:hk,...c},tabIndex:0,...f,...Zt(g,d),children:o})})}function ty({useEmitter:n,useEmitterValue:r,usePublisher:s}){return we.memo(function({children:o,style:c,context:d,...f}){const h=s("windowScrollContainerState"),g=r("ScrollerComponent"),p=s("smoothScrollTargetReached"),y=r("totalListHeight"),v=r("deviation"),j=r("customScrollParent"),S=we.useRef(null),k=r("scrollerRef"),{scrollByCallback:E,scrollerRef:w,scrollToCallback:N}=Zv(h,p,g,k,j);return Qv(()=>{var A;return w.current=j||((A=S.current)==null?void 0:A.ownerDocument.defaultView),()=>{w.current=null}},[w,j]),n("windowScrollTo",N),n("scrollBy",E),a.jsx(g,{ref:S,"data-virtuoso-scroller":!0,style:{position:"relative",...c,...y!==0?{height:y+v}:void 0},...f,...Zt(g,d),children:o})})}const jk=({children:n})=>{const r=we.useContext(Kv),s=Un("viewportHeight"),o=Un("fixedItemHeight"),c=Oe("alignToBottom"),d=Oe("horizontalDirection"),f=we.useMemo(()=>Cv(s,g=>rr(g,d?"width":"height")),[s,d]),h=Or(f,!0,Oe("skipAnimationFrameInResizeObserver"));return we.useEffect(()=>{r&&(s(r.viewportHeight),o(r.itemHeight))},[r,s,o]),a.jsx("div",{"data-viewport-type":"element",ref:h,style:Po(c),children:n})},Sk=({children:n})=>{const r=we.useContext(Kv),s=Un("windowViewportRect"),o=Un("fixedItemHeight"),c=Oe("customScrollParent"),d=Tv(s,c,Oe("skipAnimationFrameInResizeObserver")),f=Oe("alignToBottom");return we.useEffect(()=>{r&&(o(r.itemHeight),s({listHeight:0,offsetTop:0,visibleHeight:r.viewportHeight,visibleWidth:100}))},[r,s,o]),a.jsx("div",{"data-viewport-type":"window",ref:d,style:Po(f),children:n})},kk=({children:n})=>{const r=Oe("TopItemListComponent")??"div",s=Oe("headerHeight"),o={...gk,marginTop:`${s}px`},c=Oe("context");return a.jsx(r,{style:o,...Zt(r,c),children:n})},wk=we.memo(function(n){const r=Oe("useWindowScroll"),s=Oe("topItemsIndexes").length>0,o=Oe("customScrollParent"),c=Oe("context");return a.jsxs(o||r?Nk:Ck,{...n,context:c,children:[s&&a.jsx(kk,{children:a.jsx(fg,{showTopList:!0})}),a.jsxs(o||r?Sk:jk,{children:[a.jsx(yk,{}),a.jsx(fg,{}),a.jsx(bk,{})]})]})}),{Component:Ek,useEmitter:Ef,useEmitterValue:Oe,usePublisher:Un}=qv(dk,{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"}},wk),Ck=ey({useEmitter:Ef,useEmitterValue:Oe,usePublisher:Un}),Nk=ty({useEmitter:Ef,useEmitterValue:Oe,usePublisher:Un}),Tk=Ek,Rk=et(()=>{const n=me(p=>a.jsxs("td",{children:["Item $",p]})),r=me(null),s=me(p=>a.jsxs("td",{colSpan:1e3,children:["Group ",p]})),o=me(null),c=me(null),d=me({}),f=me(wf),h=me(Ll),g=(p,y=null)=>Jt(de(d,ye(v=>v[p]),xt()),y);return{components:d,computeItemKey:f,context:r,EmptyPlaceholder:g("EmptyPlaceholder"),FillerRow:g("FillerRow"),fixedFooterContent:c,fixedHeaderContent:o,itemContent:n,groupContent:s,ScrollerComponent:g("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:g("ScrollSeekPlaceholder"),TableBodyComponent:g("TableBody","tbody"),TableComponent:g("Table","table"),TableFooterComponent:g("TableFoot","tfoot"),TableHeadComponent:g("TableHead","thead"),TableRowComponent:g("TableRow","tr"),GroupComponent:g("Group","tr")}});gt(Yv,Rk);kf();const pg={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},Ak={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:mg,floor:Ao,max:zs,min:wd,round:hg}=Math;function xg(n,r,s){return Array.from({length:r-n+1}).map((o,c)=>({data:s===null?null:s[c+n],index:c+n}))}function Mk(n){return{...Ak,items:n}}function fo(n,r){return n!==void 0&&n.width===r.width&&n.height===r.height}function Lk(n,r){return n!==void 0&&n.column===r.column&&n.row===r.row}const zk=et(([{increaseViewportBy:n,listBoundary:r,overscan:s,visibleRange:o},{footerHeight:c,headerHeight:d,scrollBy:f,scrollContainerState:h,scrollTo:g,scrollTop:p,smoothScrollTargetReached:y,viewportHeight:v},j,S,{didMount:k,propsReady:E},{customScrollParent:w,useWindowScroll:N,windowScrollContainerState:A,windowScrollTo:z,windowViewportRect:H},M])=>{const F=me(0),T=me(0),O=me(pg),C=me({height:0,width:0}),_=me({height:0,width:0}),$=Xe(),K=Xe(),Z=me(0),q=me(null),I=me({column:0,row:0}),L=Xe(),B=Xe(),P=me(!1),W=me(0),ie=me(!0),D=me(!1),V=me(!1);at(de(k,Ve(W),Me(([ce,je])=>je!==0)),()=>{$e(ie,!1)}),at(de(Ot(k,ie,_,C,W,D),Me(([ce,je,Be,ze,,re])=>ce&&!je&&Be.height!==0&&ze.height!==0&&!re)),([,,,,ce])=>{$e(D,!0),yf(1,()=>{$e($,ce)}),Wn(de(p),()=>{$e(r,[0,0]),$e(ie,!0)})}),Ee(de(B,Me(ce=>ce!=null&&ce.scrollTop>0),aa(0)),T),at(de(k,Ve(B),Me(([,ce])=>ce!=null)),([,ce])=>{ce&&($e(C,ce.viewport),$e(_,ce.item),$e(I,ce.gap),ce.scrollTop>0&&($e(P,!0),Wn(de(p,Dr(1)),je=>{$e(P,!1)}),$e(g,{top:ce.scrollTop})))}),Ee(de(C,ye(({height:ce})=>ce)),v),Ee(de(Ot(Ae(C,fo),Ae(_,fo),Ae(I,(ce,je)=>ce!==void 0&&ce.column===je.column&&ce.row===je.row),Ae(p)),ye(([ce,je,Be,ze])=>({gap:Be,item:je,scrollTop:ze,viewport:ce}))),L),Ee(de(Ot(Ae(F),o,Ae(I,Lk),Ae(_,fo),Ae(C,fo),Ae(q),Ae(T),Ae(P),Ae(ie),Ae(W)),Me(([,,,,,,,ce])=>!ce),ye(([ce,[je,Be],ze,re,fe,pe,xe,,ve,Le])=>{const{column:De,row:ut}=ze,{height:Bt,width:St}=re,{width:Ct}=fe;if(xe===0&&(ce===0||Ct===0))return pg;if(St===0){const Xt=bf(Le,ce),We=Xt+Math.max(xe-1,0);return Mk(xg(Xt,We,pe))}const It=ny(Ct,St,De);let Qe,tt;ve?je===0&&Be===0&&xe>0?(Qe=0,tt=xe-1):(Qe=It*Ao((je+ut)/(Bt+ut)),tt=It*mg((Be+ut)/(Bt+ut))-1,tt=wd(ce-1,zs(tt,It-1)),Qe=wd(tt,zs(0,Qe))):(Qe=0,tt=-1);const ee=xg(Qe,tt,pe),{bottom:Te,top:Pe}=gg(fe,ze,re,ee),en=mg(ce/It),Kn=en*Bt+(en-1)*ut-Te;return{bottom:Te,itemHeight:Bt,items:ee,itemWidth:St,offsetBottom:Kn,offsetTop:Pe,top:Pe}})),O),Ee(de(q,Me(ce=>ce!==null),ye(ce=>ce.length)),F),Ee(de(Ot(C,_,O,I),Me(([ce,je,{items:Be}])=>Be.length>0&&je.height!==0&&ce.height!==0),ye(([ce,je,{items:Be},ze])=>{const{bottom:re,top:fe}=gg(ce,ze,je,Be);return[fe,re]}),xt(Is)),r);const te=me(!1);Ee(de(p,Ve(te),ye(([ce,je])=>je||ce!==0)),te);const se=En(de(Ot(O,F),Me(([{items:ce}])=>ce.length>0),Ve(te),Me(([[ce,je],Be])=>{const ze=ce.items[ce.items.length-1].index===je-1;return(Be||ce.bottom>0&&ce.itemHeight>0&&ce.offsetBottom===0&&ce.items.length===je)&&ze}),ye(([[,ce]])=>ce-1),xt())),ge=En(de(Ae(O),Me(({items:ce})=>ce.length>0&&ce[0].index===0),aa(0),xt())),he=En(de(Ae(O),Ve(P),Me(([{items:ce},je])=>ce.length>0&&!je),ye(([{items:ce}])=>({endIndex:ce[ce.length-1].index,startIndex:ce[0].index})),xt(Dv),Na(0)));Ee(he,S.scrollSeekRangeChanged),Ee(de($,Ve(C,_,F,I),ye(([ce,je,Be,ze,re])=>{const fe=Hv(ce),{align:pe,behavior:xe,offset:ve}=fe;let Le=fe.index;Le==="LAST"&&(Le=ze-1),Le=zs(0,Le,wd(ze-1,Le));let De=Zd(je,re,Be,Le);return pe==="end"?De=hg(De-je.height+Be.height):pe==="center"&&(De=hg(De-je.height/2+Be.height/2)),ve!==void 0&&ve!==0&&(De+=ve),{behavior:xe,top:De}})),g);const be=Jt(de(O,ye(ce=>ce.offsetBottom+ce.bottom)),0);return Ee(de(H,ye(ce=>({height:ce.visibleHeight,width:ce.visibleWidth}))),C),{customScrollParent:w,data:q,deviation:Z,footerHeight:c,gap:I,headerHeight:d,increaseViewportBy:n,initialItemCount:T,itemDimensions:_,overscan:s,restoreStateFrom:B,scrollBy:f,scrollContainerState:h,scrollHeight:K,scrollTo:g,scrollToIndex:$,scrollTop:p,smoothScrollTargetReached:y,totalCount:F,useWindowScroll:N,viewportDimensions:C,windowScrollContainerState:A,windowScrollTo:z,windowViewportRect:H,...S,gridState:O,horizontalDirection:V,initialTopMostItemIndex:W,totalListHeight:be,...j,endReached:se,propsReady:E,rangeChanged:he,startReached:ge,stateChanged:L,stateRestoreInProgress:P,...M}},gt(jf,cn,Ys,Gv,or,Sf,ir));function ny(n,r,s){return zs(1,Ao((n+s)/(Ao(r)+s)))}function gg(n,r,s,o){const{height:c}=s;if(c===void 0||o.length===0)return{bottom:0,top:0};const d=Zd(n,r,s,o[0].index);return{bottom:Zd(n,r,s,o[o.length-1].index)+c,top:d}}function Zd(n,r,s,o){const c=ny(n.width,s.width,r.column),d=Ao(o/c),f=d*s.height+zs(0,d-1)*r.row;return f>0?f+r.row:f}const Dk=et(()=>{const n=me(v=>`Item ${v}`),r=me({}),s=me(null),o=me("virtuoso-grid-item"),c=me("virtuoso-grid-list"),d=me(wf),f=me("div"),h=me(Ll),g=(v,j=null)=>Jt(de(r,ye(S=>S[v]),xt()),j),p=me(!1),y=me(!1);return Ee(Ae(y),p),{components:r,computeItemKey:d,context:s,FooterComponent:g("Footer"),HeaderComponent:g("Header"),headerFooterTag:f,itemClassName:o,ItemComponent:g("Item","div"),itemContent:n,listClassName:c,ListComponent:g("List","div"),readyStateChanged:p,reportReadyState:y,ScrollerComponent:g("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:g("ScrollSeekPlaceholder","div")}}),_k=et(([n,r])=>({...n,...r}),gt(zk,Dk)),Ok=we.memo(function(){const n=bt("gridState"),r=bt("listClassName"),s=bt("itemClassName"),o=bt("itemContent"),c=bt("computeItemKey"),d=bt("isSeeking"),f=$n("scrollHeight"),h=bt("ItemComponent"),g=bt("ListComponent"),p=bt("ScrollSeekPlaceholder"),y=bt("context"),v=$n("itemDimensions"),j=$n("gap"),S=bt("log"),k=bt("stateRestoreInProgress"),E=$n("reportReadyState"),w=Or(we.useMemo(()=>N=>{const A=N.parentElement.parentElement.scrollHeight;f(A);const z=N.firstChild;if(z!==null){const{height:H,width:M}=z.getBoundingClientRect();v({height:H,width:M})}j({column:vg("column-gap",getComputedStyle(N).columnGap,S),row:vg("row-gap",getComputedStyle(N).rowGap,S)})},[f,v,j,S]),!0,!1);return Qv(()=>{n.itemHeight>0&&n.itemWidth>0&&E(!0)},[n]),k?null:a.jsx(g,{className:r,ref:w,...Zt(g,y),"data-testid":"virtuoso-item-list",style:{paddingBottom:n.offsetBottom,paddingTop:n.offsetTop},children:n.items.map(N=>{const A=c(N.index,N.data,y);return d?a.jsx(p,{...Zt(p,y),height:n.itemHeight,index:N.index,width:n.itemWidth},A):x.createElement(h,{...Zt(h,y),className:s,"data-index":N.index,key:A},o(N.index,N.data,y))})})}),Bk=we.memo(function(){const n=bt("HeaderComponent"),r=$n("headerHeight"),s=bt("headerFooterTag"),o=Or(we.useMemo(()=>d=>{r(rr(d,"height"))},[r]),!0,!1),c=bt("context");return n!=null?a.jsx(s,{ref:o,children:a.jsx(n,{...Zt(n,c)})}):null}),Ik=we.memo(function(){const n=bt("FooterComponent"),r=$n("footerHeight"),s=bt("headerFooterTag"),o=Or(we.useMemo(()=>d=>{r(rr(d,"height"))},[r]),!0,!1),c=bt("context");return n!=null?a.jsx(s,{ref:o,children:a.jsx(n,{...Zt(n,c)})}):null}),Hk=({children:n})=>{const r=we.useContext(Xv),s=$n("itemDimensions"),o=$n("viewportDimensions"),c=Or(we.useMemo(()=>d=>{o(d.getBoundingClientRect())},[o]),!0,!1);return we.useEffect(()=>{r&&(o({height:r.viewportHeight,width:r.viewportWidth}),s({height:r.itemHeight,width:r.itemWidth}))},[r,o,s]),a.jsx("div",{ref:c,style:Po(!1),children:n})},Uk=({children:n})=>{const r=we.useContext(Xv),s=$n("windowViewportRect"),o=$n("itemDimensions"),c=bt("customScrollParent"),d=Tv(s,c,!1);return we.useEffect(()=>{r&&(o({height:r.itemHeight,width:r.itemWidth}),s({listHeight:0,offsetTop:0,visibleHeight:r.viewportHeight,visibleWidth:r.viewportWidth}))},[r,s,o]),a.jsx("div",{ref:d,style:Po(!1),children:n})},$k=we.memo(function({...n}){const r=bt("useWindowScroll"),s=bt("customScrollParent"),o=s||r?Pk:Vk,c=s||r?Uk:Hk,d=bt("context");return a.jsx(o,{...n,...Zt(o,d),children:a.jsxs(c,{children:[a.jsx(Bk,{}),a.jsx(Ok,{}),a.jsx(Ik,{})]})})}),{useEmitter:ay,useEmitterValue:bt,usePublisher:$n}=qv(_k,{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"}},$k),Vk=ey({useEmitter:ay,useEmitterValue:bt,usePublisher:$n}),Pk=ty({useEmitter:ay,useEmitterValue:bt,usePublisher:$n});function vg(n,r,s){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&s(`${n} was not resolved to pixel value correctly`,r,$t.WARN),r==="normal"?0:parseInt(r??"0",10)}const Fk={source:"vskill-sidebar-own-collapsed",installed:"vskill-sidebar-installed-collapsed"},ry={source:"Own",installed:"Installed"};function Gk(n){try{const r=localStorage.getItem(n);if(r!=null)return r==="true"}catch{}try{if(typeof sessionStorage<"u"){const r=sessionStorage.getItem(n);if(r!=null)return r==="true"}}catch{}return!1}function Wk(n,r){const s=r?"true":"false";try{localStorage.setItem(n,s)}catch{}try{typeof sessionStorage<"u"&&sessionStorage.setItem(n,s)}catch{}}function yg({origin:n,count:r,filteredCount:s,updateCount:o,children:c}){const d=Fk[n],[f,h]=x.useState(()=>Gk(d)),g=x.useCallback(()=>{h(j=>{const S=!j;return Wk(d,S),S})},[d]),p=ry[n],y=`sidebar-section-${n}-header`,v=`sidebar-section-${n}-group`;return a.jsxs("section",{"aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:[a.jsxs("button",{id:y,type:"button","data-testid":"sidebar-section-header","aria-expanded":!f,"aria-controls":v,onClick:g,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:[a.jsx(qk,{collapsed:f}),a.jsx("h2",{"aria-level":2,style:{fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)",margin:0},children:p}),a.jsx("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:s!=null&&s!==r?`(${s} of ${r})`:`(${r})`}),o!=null&&o>0&&a.jsx(Yk,{origin:n,updateCount:o})]}),!f&&a.jsx("div",{id:v,role:"group","aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:c})]})}function Yk({origin:n,updateCount:r}){const[s,o]=x.useState(!1),c=ry[n].toLowerCase(),d=`${r} updates available in ${c} section, view all`;return a.jsxs("span",{role:"link",tabIndex:0,"data-testid":"sidebar-section-update-chip","aria-label":d,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:s?"2px solid var(--border-focus)":"none",outlineOffset:2},children:[r," updates",a.jsx("span",{"aria-hidden":"true",style:{fontSize:9,marginLeft:2},children:"▾"})]})}function qk({collapsed:n}){return a.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:n?"rotate(0deg)":"rotate(90deg)",transition:"transform var(--duration-fast, 120ms) var(--ease-standard, ease)",flexShrink:0},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Cf(n,r){const s=r.trim().toLowerCase();return s?n.skill.toLowerCase().includes(s)||n.plugin.toLowerCase().includes(s)||n.dir.toLowerCase().includes(s):!0}function Kk({value:n,onChange:r,placeholder:s="Filter skills…",validationPattern:o,validationMessage:c="Invalid filter expression"}){const d=x.useRef(null),f=x.useId(),h=!!o&&n.trim()!==""&&!o.test(n);return x.useEffect(()=>{function g(p){var j;if(p.key!=="/")return;const y=p.target;if(!y)return;const v=y.tagName;v==="INPUT"||v==="TEXTAREA"||y.isContentEditable||(p.preventDefault(),(j=d.current)==null||j.focus())}return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[]),a.jsxs("div",{role:"search",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",borderBottom:"1px solid var(--border-default)"},children:[a.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:[a.jsx("circle",{cx:"11",cy:"11",r:"8"}),a.jsx("path",{d:"M21 21l-4.35-4.35"})]}),a.jsx("input",{ref:d,type:"search","aria-label":"Filter skills","aria-invalid":h?!0:void 0,"aria-describedby":h?f:void 0,value:n,placeholder:s,onChange:g=>r(g.currentTarget.value),onKeyDown:g=>{g.key==="Escape"&&(r(""),g.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&&a.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:c}),a.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:n?"none":"inline-block"},children:"/"})]})}function Xk({target:n}){const r=typeof n=="string"&&n.length>0,s=r?`symlinked → ${n}`:"symlinked — cycle detected or target unresolved",o=r?`symlinked from ${n}`:"symlinked, target unresolved";return a.jsx("span",{"data-testid":"symlink-chip",role:"img","aria-label":o,title:s,tabIndex:0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:14,height:14,borderRadius:3,color:"var(--text-secondary)",flexShrink:0},children:a.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:[a.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"}),a.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 Qk({skill:n}){if(!n.updateAvailable)return null;const r=n.currentVersion??"",s=n.latestVersion,o=s?`Update available: ${r} → ${s}`.trim():"Update available";return a.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:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 19V5"}),a.jsx("path",{d:"M5 12l7-7 7 7"})]})})}function Zk({skillId:n,trackedForUpdates:r}){let s=null;try{s=x.useContext(gv)}catch{s=null}const o=s==null?void 0:s.updatesById.get(n);if(o){const c=`Update available → ${o.version}${o.diffSummary?` — ${o.diffSummary}`:""}`;return a.jsx("span",{"data-testid":"update-chip-update-dot","aria-label":`Update available: ${o.version}`,title:c,style:{display:"inline-block",width:8,height:8,borderRadius:999,background:"var(--color-accent, #2563eb)",flexShrink:0}})}return r?null:a.jsx("span",{"data-testid":"update-chip-untracked-dot","aria-label":"Not tracked for updates",title:"Not tracked — run `vskill outdated` manually",style:{display:"inline-block",width:6,height:6,borderRadius:999,background:"var(--text-muted, var(--text-secondary))",opacity:.55,flexShrink:0}})}function qs(n){const{version:r,showPrefix:s=!0,size:o="md"}=n;if(!r||typeof r!="string"||r.trim()==="")return null;const c=s&&!r.startsWith("v")?`v${r}`:r,d=o==="sm"?10:12,f=o==="sm"?1:2,h=o==="sm"?5:8;return a.jsx("span",{"data-testid":n["data-testid"]??"version-badge","data-version":r,title:n.title,style:{display:"inline-flex",alignItems:"center",padding:`${f}px ${h}px`,border:"1px solid var(--border, var(--border-default))",borderRadius:4,background:"var(--bg-subtle, var(--surface-1, transparent))",color:"var(--text-secondary)",fontFamily:"var(--font-mono, var(--font-geist-mono))",fontSize:d,fontVariantNumeric:"tabular-nums",lineHeight:1.2,whiteSpace:"nowrap",flexShrink:0},children:c})}function Jk({skill:n,isSelected:r,onSelect:s,onContextMenu:o}){const c=n.origin==="installed"?"var(--status-installed)":"var(--status-own)";return a.jsxs("button",{type:"button",onClick:s,onContextMenu:o?d=>{d.preventDefault(),o(d,n)}:void 0,"aria-current":r?"true":void 0,"aria-selected":!!r,"data-testid":"skill-row","data-selected":r,"data-origin":n.origin,"data-skill-id":`${n.plugin}/${n.skill}`,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:[a.jsx("span",{"aria-hidden":"true","aria-label":n.updateAvailable?"Update available":void 0,title:n.updateAvailable?`Update available${n.latestVersion?` → ${n.latestVersion}`:""}`:void 0,style:{width:n.updateAvailable?10:6,height:n.updateAvailable?10:6,borderRadius:"50%",background:c,display:"inline-block",flexShrink:0,boxShadow:n.updateAvailable?"0 0 0 2px var(--color-own, #d97706)":"none",transition:"box-shadow 180ms ease, width 180ms ease, height 180ms ease"}}),a.jsx("span",{title:n.skill,style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.skill}),n.version&&a.jsx(qs,{version:n.version,size:"sm",showPrefix:!1,"data-testid":"skill-row-version"}),n.isSymlink&&a.jsx(Xk,{target:n.symlinkTarget??null}),a.jsx(Qk,{skill:n}),a.jsx(Zk,{skillId:`${n.plugin}/${n.skill}`,trackedForUpdates:n.trackedForUpdates??!0})]})}const Mo=x.memo(Jk);function ew({plugin:n,skills:r,selectedKey:s,onSelect:o,onContextMenu:c}){const d=[...r].sort((f,h)=>f.skill.localeCompare(h.skill));return a.jsxs("div",{role:"group","aria-label":`${n} (${r.length})`,children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[a.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:n,children:n}),a.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",r.length,")"]})]}),a.jsx("div",{role:"list",children:d.map(f=>{const h=!!s&&s.plugin===f.plugin&&s.skill===f.skill;return a.jsx("div",{role:"listitem",children:a.jsx(Mo,{skill:f,isSelected:h,onSelect:()=>o(f),onContextMenu:c})},`${f.plugin}/${f.skill}`)})})]})}function tw(n,r){if(!n||typeof window>"u")return r;try{const s=window.localStorage.getItem(n);return s===null?r:s==="true"}catch{return r}}function bg({skills:n,pluginName:r,initialCollapsed:s=!1,persistKey:o,renderSkill:c,headerActionSlot:d,forceOpen:f=!1}){var S;const h=r??((S=n[0])==null?void 0:S.pluginName)??"unknown-plugin",[g,p]=x.useState(()=>tw(o,s)),y=f?!1:g,v=x.useCallback(()=>{p(k=>{const E=!k;if(o&&typeof window<"u")try{window.localStorage.setItem(o,String(E))}catch{}return E})},[o]),j=y?"▸":"▾";return a.jsxs("div",{"data-vskill-plugin-tree":h,role:"group","aria-label":`${h} (${n.length})`,children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",paddingRight:6},children:[a.jsxs("button",{type:"button",onClick:v,"aria-expanded":!y,style:{display:"flex",alignItems:"center",gap:6,flex:1,padding:"4px 4px 4px 18px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",color:"var(--text-primary)",fontSize:12,fontWeight:500},children:[a.jsx("span",{"aria-hidden":!0,className:"vskill-chevron tabular-nums",style:{width:16,display:"inline-block",textAlign:"center",fontSize:14,fontWeight:700,color:"var(--color-ink, var(--text-primary))"},children:j}),a.jsx("span",{className:"vskill-plugin-name",style:{fontFamily:"var(--font-mono)"},children:h}),a.jsxs("span",{className:"vskill-plugin-count tabular-nums",style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:["(",n.length,")"]})]}),d&&a.jsx("div",{style:{display:"inline-flex",alignItems:"center",flexShrink:0},children:d})]}),!y&&a.jsx("div",{className:"vskill-plugin-tree-children",style:{paddingLeft:36,borderLeft:"1px solid var(--border-subtle, rgba(128,128,128,0.2))",marginLeft:24},children:n.map(k=>a.jsx("div",{"data-vskill-plugin-skill":k.pluginNamespace??k.skill,children:c(k)},`${k.pluginNamespace??k.skill}`))})]})}function nw({pluginName:n,enabled:r,onAfterAction:s}){const[o,c]=x.useState(!1),[d,f]=x.useState(null),[h,g]=x.useState(null),p=x.useRef(null);x.useEffect(()=>{if(!o)return;function v(j){p.current&&!p.current.contains(j.target)&&c(!1)}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]);async function y(v){f(v),g(null);try{if(v==="uninstall"&&!window.confirm(`Uninstall ${n}? This removes the plugin and its skills.`)){f(null);return}const j=await fetch(`/api/plugins/${encodeURIComponent(n)}/${v}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),S=await j.json().catch(()=>({}));if(!j.ok||!S.ok){g(S.error??`${v} failed (${j.status})`);return}on("skills"),on("plugins"),s==null||s(),c(!1)}catch(j){g(j instanceof Error?j.message:String(j))}finally{f(null)}}return a.jsxs("div",{ref:p,style:{position:"relative",display:"inline-flex"},children:[a.jsx("button",{type:"button","aria-label":`Manage ${n}`,title:`Manage ${n}`,onClick:v=>{v.stopPropagation(),c(j=>!j)},"data-vskill-plugin-action-trigger":n,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:22,height:22,padding:0,marginLeft:4,border:"none",background:o?"var(--surface-2, rgba(0,0,0,0.08))":"transparent",color:"var(--text-tertiary)",borderRadius:4,cursor:"pointer",fontSize:14,lineHeight:1},onMouseEnter:v=>{v.currentTarget.style.color="var(--text-primary)",v.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.06))"},onMouseLeave:v=>{v.currentTarget.style.color="var(--text-tertiary)",v.currentTarget.style.background=o?"var(--surface-2, rgba(0,0,0,0.08))":"transparent"},children:"⋯"}),o&&a.jsxs("div",{role:"menu",style:{position:"absolute",top:"calc(100% + 2px)",right:0,minWidth:160,background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,boxShadow:"0 4px 6px -1px rgba(0,0,0,0.08), 0 8px 14px -4px rgba(0,0,0,0.12)",padding:4,zIndex:30,fontFamily:"var(--font-sans)"},children:[r?a.jsx(Ed,{onClick:()=>void y("disable"),disabled:d!==null,busy:d==="disable",label:"Disable",hint:"Keep installed, turn off"}):a.jsx(Ed,{onClick:()=>void y("enable"),disabled:d!==null,busy:d==="enable",label:"Enable",hint:"Activate plugin"}),a.jsx(Ed,{onClick:()=>void y("uninstall"),disabled:d!==null,busy:d==="uninstall",label:"Uninstall",hint:"Remove plugin + skills",danger:!0}),h&&a.jsx("div",{style:{padding:"6px 8px",fontSize:11,color:"var(--color-error, #b91c1c)",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4,marginTop:4,lineHeight:1.4,maxWidth:240,wordBreak:"break-word"},children:h})]})]})}function Ed({onClick:n,disabled:r,busy:s,label:o,hint:c,danger:d}){return a.jsxs("button",{type:"button",onClick:f=>{f.stopPropagation(),n()},disabled:r,role:"menuitem",style:{display:"block",width:"100%",padding:"6px 10px",textAlign:"left",border:"none",background:"transparent",borderRadius:4,cursor:r?"not-allowed":"pointer",color:d?"var(--color-error, #b91c1c)":"var(--text-primary)",opacity:r&&!s?.5:1,fontFamily:"inherit"},onMouseEnter:f=>{r||(f.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.05))")},onMouseLeave:f=>{f.currentTarget.style.background="transparent"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:500},children:s?`${o}…`:o}),a.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)"},children:c})]})}function jg({name:n,count:r,className:s,variant:o,collapsed:c,onToggle:d,action:f}){const h=o==="authoring"?"var(--color-own, #f59e0b)":"var(--color-accent, #2f6f8f)",g=o==="authoring"?"color-mix(in oklch, var(--color-own, #f59e0b) 10%, var(--color-paper, #fff))":"color-mix(in oklch, var(--color-accent, #2f6f8f) 8%, var(--color-paper, #fff))",p=typeof d=="function",y={position:"sticky",top:0,zIndex:4,backdropFilter:"saturate(1.4) blur(10px)",WebkitBackdropFilter:"saturate(1.4) blur(10px)",background:g,borderLeft:`3px solid ${h}`,borderBottom:"1px solid var(--border-subtle, rgba(128,128,128,0.2))",padding:"7px 10px 7px 9px",fontFamily:"var(--font-serif, ui-serif)",fontSize:13,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-primary)",display:"flex",alignItems:"center",gap:8,width:"100%",cursor:p?"pointer":"default",border:"none",textAlign:"left"},v=c?"▸":"▾",j=a.jsxs(a.Fragment,{children:[p&&a.jsx("span",{"aria-hidden":!0,style:{fontSize:15,fontWeight:700,color:h,width:16,display:"inline-block",textAlign:"center",letterSpacing:0,textTransform:"none"},children:v}),a.jsx("span",{className:"vskill-group-header-name",children:n}),a.jsxs("span",{className:"vskill-group-header-count tabular-nums",style:{fontFamily:"var(--font-mono)",fontSize:11,fontWeight:500,color:"var(--text-secondary)",letterSpacing:0,textTransform:"none"},children:["(",r,")"]}),f&&a.jsx("span",{style:{marginLeft:"auto"},children:a.jsx(aw,{label:f.label,title:f.title,icon:f.icon,onClick:f.onClick,accent:h})})]});return p?a.jsx("button",{type:"button","data-vskill-group-header":n,className:["vskill-group-header select-none",s??""].join(" ").trim(),style:y,onClick:()=>d(!c),"aria-expanded":!c,children:j}):a.jsx("div",{"data-vskill-group-header":n,role:"heading","aria-level":3,className:["vskill-group-header select-none",s??""].join(" ").trim(),style:y,children:j})}function aw({label:n,title:r,icon:s,onClick:o,accent:c}){return a.jsxs("button",{type:"button","aria-label":n,title:r??n,onClick:d=>{d.stopPropagation(),o()},style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4,height:22,padding:"0 7px",border:`1px solid ${c}`,background:"transparent",color:c,borderRadius:4,fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",cursor:"pointer",fontFamily:"inherit"},onMouseEnter:d=>{d.currentTarget.style.background=`color-mix(in oklch, ${c} 15%, transparent)`},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},children:[s,n]})}function rw(){return a.jsxs("div",{"aria-hidden":"true",role:"presentation",style:{display:"flex",alignItems:"center",gap:8,height:36,padding:"0 12px 0 14px"},children:[a.jsx("span",{className:"placeholder",style:{width:6,height:6,borderRadius:"50%",flexShrink:0}}),a.jsx("span",{className:"placeholder",style:{height:10,flex:1,borderRadius:3,maxWidth:180}})]})}function lw(n){const r=n.key.split("+").map(h=>h.trim()).filter(Boolean);let s=!!n.meta,o=!!n.ctrl,c=!!n.shift,d=!!n.alt,f=n.key;if(r.length>1){for(const h of r.slice(0,-1)){const g=h.toLowerCase();g==="cmd"||g==="meta"||g==="⌘"?s=!0:g==="ctrl"||g==="control"?o=!0:g==="shift"?c=!0:(g==="alt"||g==="option")&&(d=!0)}f=r[r.length-1]}return{key:f.length===1?f.toLowerCase():f,meta:s,ctrl:o,shift:c,alt:d,allowInInputs:!!n.allowInInputs,handler:n.handler}}function sw(n){if(!n||!(n instanceof HTMLElement))return!1;const r=n.tagName;if(r==="INPUT"||r==="TEXTAREA"||n.isContentEditable)return!0;const s=n.getAttribute("contenteditable");return s!=null&&s!=="false"||n.getAttribute("role")==="textbox"}function iw(n,r){const s=!!n.metaKey,o=!!n.ctrlKey,c=!!n.shiftKey,d=!!n.altKey;return s!==r.meta||o!==r.ctrl||c!==r.shift||d!==r.alt?!1:(n.key.length===1?n.key.toLowerCase():n.key)===r.key}function Jd(n,r={}){const{enabled:s=!0,target:o}=r,c=x.useRef([]),d=Array.isArray(n)?n:[n];c.current=d.map(lw),x.useEffect(()=>{if(!s)return;const f=o??(typeof window<"u"?window:void 0);if(!f)return;function h(g){const p=g,y=sw(p.target);for(const v of c.current){if(!iw(p,v))continue;const j=v.meta||v.ctrl||v.alt;if(!(y&&!v.allowInInputs&&!j)){v.handler(p);return}}}return f.addEventListener("keydown",h),()=>{f.removeEventListener("keydown",h)}},[s,o])}const ow=200;function cw(n){return n.scope==="own"||n.scope==="installed"||n.scope==="global"?n.scope:n.origin==="installed"?"installed":"own"}function uw(n,r){const s={availableProject:[],availablePersonal:[],availablePlugin:[],authoringProject:[],authoringPlugin:[]};for(const c of n){const d=c.scopeV2??(c.scope==="installed"?"available-project":c.scope==="global"?"available-personal":"authoring-project");d==="available-project"?s.availableProject.push(c):d==="available-personal"?s.availablePersonal.push(c):d==="available-plugin"?s.availablePlugin.push(c):d==="authoring-plugin"?s.authoringPlugin.push(c):s.authoringProject.push(c)}function o(c){const d=c.filter(g=>Cf(g,r)),f={};for(const g of d){const p=g.pluginName??g.plugin;(f[p]||(f[p]=[])).push(g)}const h=Object.entries(f).sort((g,p)=>g[0].localeCompare(p[0]));return{total:c.length,filtered:d.length,byPlugin:h}}return{availableProject:o(s.availableProject),availablePersonal:o(s.availablePersonal),availablePlugin:o(s.availablePlugin),authoringProject:o(s.authoringProject),authoringPlugin:o(s.authoringPlugin)}}function dw(n,r){const s=[],o=[],c=[];for(const f of n){const h=cw(f);h==="global"?c.push(f):h==="installed"?o.push(f):s.push(f)}function d(f){var y;const h=f.filter(v=>Cf(v,r)),g={};for(const v of h)(g[y=v.plugin]||(g[y]=[])).push(v);const p=Object.entries(g).sort((v,j)=>v[0].localeCompare(j[0]));return{total:f.length,filtered:h.length,byPlugin:p}}return{own:d(s),installed:d(o),global:d(c)}}function fw(n,r){const s=[],o=[];for(const d of n)(d.origin==="installed"?o:s).push(d);function c(d){var p;const f=d.filter(y=>Cf(y,r)),h={};for(const y of f)(h[p=y.plugin]||(h[p]=[])).push(y);const g=Object.entries(h).sort((y,v)=>y[0].localeCompare(v[0]));return{total:d.length,filtered:f.length,byPlugin:g}}return{own:c(s),installed:c(o)}}function pw({skills:n,selectedKey:r,onSelect:s,isLoading:o,error:c,onRetry:d,onContextMenu:f,outdatedByOrigin:h,activeAgentId:g,outdatedByScope:p,topSlot:y,revealSkillId:v,onRevealComplete:j}){const S=!!g||n.some(V=>V.scope!==void 0&&V.scope!==null),k=g??"claude-cli",[E,w]=x.useState(""),N=x.useDeferredValue(E),A=x.useMemo(()=>dw(n,N),[n,N]),z=x.useMemo(()=>uw(n,N),[n,N]),H=k==="claude-code",{data:M}=Al("plugins",()=>fetch("/api/plugins").then(V=>V.json()),{enabled:H,ttl:6e4}),F=x.useMemo(()=>{const V=new Map;for(const te of(M==null?void 0:M.plugins)??[]){const se=V.get(te.name);V.set(te.name,!!se||!!te.enabled)}return V},[M==null?void 0:M.plugins]),[T,O]=x.useState(()=>ef(`vskill-sidebar-${k}-group-available-collapsed`)),[C,_]=x.useState(()=>ef(`vskill-sidebar-${k}-group-authoring-collapsed`)),$=x.useCallback(V=>{O(V);try{window.localStorage.setItem(`vskill-sidebar-${k}-group-available-collapsed`,String(V))}catch{}},[k]),K=x.useCallback(V=>{_(V);try{window.localStorage.setItem(`vskill-sidebar-${k}-group-authoring-collapsed`,String(V))}catch{}},[k]),{own:Z,installed:q}=x.useMemo(()=>fw(n,N),[n,N]),L=A.own.filtered+A.installed.filtered+A.global.filtered>=ow,B=x.useMemo(()=>{const V=te=>{const se=[];for(const[,ge]of te){const he=[...ge].sort((be,ce)=>be.skill.localeCompare(ce.skill));se.push(...he)}return se};return S?[...V(A.own.byPlugin),...V(A.installed.byPlugin),...V(A.global.byPlugin)]:[...V(Z.byPlugin),...V(q.byPlugin)]},[S,A.own.byPlugin,A.installed.byPlugin,A.global.byPlugin,Z.byPlugin,q.byPlugin]),P=x.useMemo(()=>r?B.findIndex(V=>V.plugin===r.plugin&&V.skill===r.skill):-1,[B,r]),W=x.useCallback(V=>{if(B.length===0)return;const te=P<0?V>0?0:B.length-1:Math.min(Math.max(P+V,0),B.length-1);s(B[te])},[B,P,s]),ie=x.useMemo(()=>{if(!v)return null;const[V,te]=v.split("/");if(!V||!te)return null;const se=n.find(be=>be.plugin===V&&be.skill===te);if(!se)return{plugin:V,skill:te,bucket:null,pluginName:null};const ge=se.source==="plugin"?"plugin":"project",he=ge==="plugin"?se.pluginName??V:null;return{plugin:V,skill:te,bucket:ge,pluginName:he}},[v,n]),D=x.useRef(null);return x.useEffect(()=>{if(!v){D.current=null;return}if(D.current===v)return;const V=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(v):v.replace(/["\\]/g,"\\$&"),te=document.querySelector(`[data-skill-id="${V}"]`);te&&(D.current=v,te.scrollIntoView({behavior:"smooth",block:"nearest"}),j==null||j())},[v,j,n]),Jd([{key:"j",handler:()=>W(1)},{key:"k",handler:()=>W(-1)},{key:"Enter",handler:()=>{P>=0&&s(B[P])}}],{enabled:!o&&!c}),a.jsxs("div",{"data-testid":"sidebar",style:{display:"flex",flexDirection:"column",minHeight:0,height:"100%",fontFamily:"var(--font-sans)"},children:[y,a.jsx(Kk,{value:E,onChange:w}),o&&a.jsx(vw,{}),!o&&c&&a.jsx(yw,{error:c,onRetry:d}),!o&&!c&&S&&a.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[a.jsx(jg,{name:ne.scopeLabels.groupAvailable.toUpperCase(),variant:"available",collapsed:T,onToggle:$,count:z.availableProject.total+z.availablePersonal.total+z.availablePlugin.total}),!T&&a.jsxs(a.Fragment,{children:[a.jsx(Es,{label:ne.scopeLabels.sourceProject,storageKey:`vskill-sidebar-${k}-available-project-collapsed`,count:z.availableProject.total,filteredCount:E?z.availableProject.filtered:null,updateCount:(p==null?void 0:p.installed)??(h==null?void 0:h.installed),children:z.availableProject.filtered===0?a.jsx(kg,{queryActive:!!E,agentId:k}):a.jsx(Cs,{items:z.availableProject.byPlugin,selectedKey:r,onSelect:s,onContextMenu:f,useVirtual:L})}),a.jsx(Es,{label:ne.scopeLabels.sourcePersonal,storageKey:`vskill-sidebar-${k}-available-personal-collapsed`,count:z.availablePersonal.total,filteredCount:E?z.availablePersonal.filtered:null,updateCount:p==null?void 0:p.global,children:z.availablePersonal.filtered===0?a.jsx(hw,{queryActive:!!E,agentId:k}):a.jsx(Cs,{items:z.availablePersonal.byPlugin,selectedKey:r,onSelect:s,onContextMenu:f,useVirtual:L})}),H&&a.jsxs(Es,{label:ne.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${k}-available-plugin-collapsed`,count:z.availablePlugin.total,filteredCount:E?z.availablePlugin.filtered:null,children:[a.jsxs("button",{type:"button",onClick:()=>window.dispatchEvent(new CustomEvent("studio:open-marketplace")),style:{display:"flex",alignItems:"center",gap:6,margin:"4px 14px 6px",padding:"4px 8px",fontSize:11,fontWeight:500,border:"1px dashed var(--color-accent, #2f6f8f)",borderRadius:4,background:"transparent",color:"var(--color-accent, #2f6f8f)",cursor:"pointer"},children:[a.jsx("span",{"aria-hidden":!0,children:"🛒"})," Browse marketplaces…"]}),z.availablePlugin.filtered===0?a.jsx("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:"No plugin skills installed yet."}):z.availablePlugin.byPlugin.map(([V,te])=>a.jsx(bg,{pluginName:V,skills:te,persistKey:`vskill-plugin-available-${V}-collapsed`,headerActionSlot:H?a.jsx(nw,{pluginName:V,enabled:F.get(V)??!0}):void 0,renderSkill:se=>a.jsx(Mo,{skill:se,isSelected:(r==null?void 0:r.plugin)===se.plugin&&(r==null?void 0:r.skill)===se.skill,onSelect:()=>s(se),onContextMenu:f})},`available-${V}`))]})]}),a.jsx(gw,{}),a.jsx(jg,{name:ne.scopeLabels.groupAuthoring.toUpperCase(),variant:"authoring",collapsed:ie?!1:C,onToggle:K,count:z.authoringProject.total+z.authoringPlugin.total,action:{label:"New",title:"Create a new skill (standalone or plugin)",icon:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),onClick:()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:request-create-skill",{detail:{mode:"standalone"}}))}}}),(!C||ie)&&a.jsxs(a.Fragment,{children:[a.jsx(Es,{label:ne.scopeLabels.authoringSkills,storageKey:`vskill-sidebar-${k}-authoring-project-collapsed`,count:z.authoringProject.total,filteredCount:E?z.authoringProject.filtered:null,updateCount:(p==null?void 0:p.own)??(h==null?void 0:h.source),forceOpen:(ie==null?void 0:ie.bucket)==="project",children:z.authoringProject.filtered===0?a.jsx(Sg,{queryActive:!!E}):a.jsx(Cs,{items:z.authoringProject.byPlugin,selectedKey:r,onSelect:s,onContextMenu:f,useVirtual:L})}),H&&a.jsx(Es,{label:ne.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${k}-authoring-plugin-collapsed`,count:z.authoringPlugin.total,filteredCount:E?z.authoringPlugin.filtered:null,forceOpen:(ie==null?void 0:ie.bucket)==="plugin",children:z.authoringPlugin.filtered===0?a.jsxs("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:["No plugin sources in this project. Add ",a.jsx("code",{children:"<plugin>/.claude-plugin/plugin.json"}),"."]}):z.authoringPlugin.byPlugin.map(([V,te])=>a.jsx(bg,{pluginName:V,skills:te,persistKey:`vskill-plugin-authoring-${V}-collapsed`,forceOpen:(ie==null?void 0:ie.bucket)==="plugin"&&ie.pluginName===V,renderSkill:se=>a.jsx(Mo,{skill:se,isSelected:(r==null?void 0:r.plugin)===se.plugin&&(r==null?void 0:r.skill)===se.skill,onSelect:()=>s(se),onContextMenu:f})},`authoring-${V}`))})]})]}),!o&&!c&&!S&&a.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[a.jsx(yg,{origin:"source",count:Z.total,filteredCount:E?Z.filtered:null,updateCount:h==null?void 0:h.source,children:Z.filtered===0?a.jsx(Sg,{queryActive:!!E}):a.jsx(Cs,{items:Z.byPlugin,selectedKey:r,onSelect:s,onContextMenu:f,useVirtual:L})}),a.jsx(xw,{}),a.jsx(yg,{origin:"installed",count:q.total,filteredCount:E?q.filtered:null,updateCount:h==null?void 0:h.installed,children:q.filtered===0?a.jsx(kg,{queryActive:!!E}):a.jsx(Cs,{items:q.byPlugin,selectedKey:r,onSelect:s,onContextMenu:f,useVirtual:L})})]})]})}function ef(n){if(typeof window>"u")return!1;try{return window.localStorage.getItem(n)==="true"}catch{return!1}}function Es({label:n,storageKey:r,count:s,filteredCount:o,updateCount:c,children:d,forceOpen:f=!1}){const[h,g]=x.useState(()=>ef(r)),p=f?!1:h,y=x.useCallback(()=>{g(j=>{const S=!j;if(typeof window<"u")try{window.localStorage.setItem(r,String(S))}catch{}return S})},[r]),v=o!=null&&o!==s?`${o} of ${s}`:String(s);return a.jsxs("section",{"data-vskill-named-scope":n,children:[a.jsxs("button",{type:"button",onClick:y,"aria-expanded":!p,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 12px",background:"transparent",border:"none",cursor:"pointer",fontFamily:"var(--font-sans)",textAlign:"left"},children:[a.jsx("span",{"aria-hidden":!0,style:{fontSize:14,fontWeight:700,color:"var(--color-ink, var(--text-primary))",width:16,display:"inline-block",textAlign:"center"},children:p?"▸":"▾"}),a.jsx("span",{style:{fontSize:12,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)"},children:n}),a.jsxs("span",{style:{fontSize:11,color:"var(--text-tertiary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",v,")"]}),c!=null&&c>0&&a.jsxs("span",{style:{marginLeft:"auto",fontSize:10,color:"var(--color-own, #f59e0b)"},children:[c," update",c!==1?"s":""]})]}),!p&&a.jsx("div",{style:{paddingLeft:18},children:d})]})}function mw(n){const r=[];for(const[s,o]of n){const c=[...o].sort((d,f)=>d.skill.localeCompare(f.skill));r.push({kind:"header",plugin:s,count:c.length});for(const d of c)r.push({kind:"row",skill:d})}return r}function Cs({items:n,selectedKey:r,onSelect:s,onContextMenu:o,useVirtual:c}){if(c){const d=mw(n);return a.jsx("div",{"data-virtualized":"true",style:{height:420,minHeight:200},children:a.jsx(Tk,{overscan:4,totalCount:d.length,itemContent:f=>{const h=d[f];if(!h)return null;if(h.kind==="header")return a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)"},children:h.plugin}),a.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",h.count,")"]})]});const g=h.skill,p=!!r&&r.plugin===g.plugin&&r.skill===g.skill;return a.jsx(Mo,{skill:g,isSelected:p,onSelect:()=>s(g),onContextMenu:o})}})})}return a.jsx("div",{"data-virtualized":"false",children:n.map(([d,f])=>a.jsx(ew,{plugin:d,skills:f,selectedKey:r,onSelect:s,onContextMenu:o},d))})}function Sg({queryActive:n}){return n?a.jsx(Cl,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):a.jsx(Cl,{headline:"No skills yet.",body:a.jsxs(a.Fragment,{children:["Create one with ",a.jsx(Nf,{children:"vskill new"})," or the"," ",a.jsx("strong",{style:{color:"var(--text-primary)"},children:"New skill"})," action in the top rail."]})})}function kg({queryActive:n,agentId:r}){return n?a.jsx(Cl,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):a.jsx(Cl,{headline:r?`No skills installed for ${r} in this project.`:"No installed skills.",body:a.jsxs(a.Fragment,{children:["Run ",a.jsx(Nf,{children:"vskill install <plugin>"})," to add one."]})})}function hw({queryActive:n,agentId:r}){return n?a.jsx(Cl,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):a.jsx(Cl,{headline:`No global skills for ${r}.`,body:a.jsxs(a.Fragment,{children:["Run ",a.jsx(Nf,{children:"vskill install --global <plugin>"})," to add one."]})})}function Cl({headline:n,body:r}){return a.jsxs("div",{style:{padding:"12px 14px 16px",fontSize:12,color:"var(--text-secondary)",lineHeight:1.5},children:[a.jsx("div",{style:{fontWeight:500,color:"var(--text-primary)",marginBottom:4},children:n}),a.jsx("div",{children:r})]})}function Nf({children:n}){return a.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:n})}function xw(){return a.jsx("div",{"aria-hidden":"true",style:{height:1,background:"var(--border-default)",margin:"4px 14px"}})}function gw(){return a.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 vw(){return a.jsx("div",{style:{padding:"8px 0"},children:[0,1,2,3,4,5].map(n=>a.jsx(rw,{},n))})}function yw({error:n,onRetry:r}){return a.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:[a.jsx("div",{style:{fontWeight:600,marginBottom:4},children:"Couldn't load skills."}),a.jsxs("details",{children:[a.jsx("summary",{style:{cursor:"pointer",color:"var(--text-secondary)",fontSize:11,marginBottom:4},children:bw(n)}),a.jsx("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",margin:"6px 0 0"},children:n})]}),r&&a.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 bw(n){const r=n.split(`
66
- `)[0]??n;return r.length>80?r.slice(0,77)+"…":r}const ly=240,sy=480,iy="vskill-sidebar-width",Ds=320;function Tf(n){return Number.isFinite(n)?Math.round(Math.max(ly,Math.min(sy,n))):Ds}function jw(){try{const n=localStorage.getItem(iy);if(!n)return Ds;const r=Number(n);return Number.isFinite(r)?Tf(r):Ds}catch{return Ds}}function Sw(n){try{localStorage.setItem(iy,String(Tf(n)))}catch{}}function kw({initialWidth:n,onChange:r}){const s=x.useRef({startX:0,startWidth:n,pointerId:null}),o=x.useRef(n);return x.useEffect(()=>{o.current=n},[n]),x.useEffect(()=>{function c(f){if(s.current.pointerId==null||f.pointerId!==s.current.pointerId)return;const h=f.clientX-s.current.startX,g=Tf(s.current.startWidth+h);o.current=g,r(g)}function d(f){s.current.pointerId==null||f.pointerId!==s.current.pointerId||(s.current.pointerId=null,Sw(o.current))}return window.addEventListener("pointermove",c),window.addEventListener("pointerup",d),window.addEventListener("pointercancel",d),()=>{window.removeEventListener("pointermove",c),window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",d)}},[r]),a.jsx("div",{role:"separator","aria-orientation":"vertical","aria-valuemin":ly,"aria-valuemax":sy,"aria-valuenow":n,"aria-label":"Resize sidebar",title:"Drag to resize sidebar",onPointerDown:c=>{const d=c.currentTarget;s.current.startX=c.clientX,s.current.startWidth=o.current,s.current.pointerId=c.pointerId;try{d.setPointerCapture(c.pointerId)}catch{}},style:{width:4,alignSelf:"stretch",cursor:"col-resize",background:"var(--border-default)",userSelect:"none",touchAction:"none"}})}function ww({connected:n,hint:r,onRetry:s}){return n?null:a.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:[a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--status-own)",display:"inline-block",flexShrink:0}}),a.jsx("span",{style:{fontWeight:500},children:"Disconnected — reconnecting…"}),r&&a.jsx("span",{style:{color:"var(--text-secondary)",fontSize:11},children:r}),a.jsx("div",{style:{flex:1}}),s&&a.jsx("button",{type:"button",onClick:s,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 oy(n,r){if(n!==401||typeof window>"u"||!r||typeof r!="object")return;const s=r;s.error==="invalid_api_key"&&(s.provider!=="anthropic"&&s.provider!=="openai"&&s.provider!=="openrouter"||window.dispatchEvent(new CustomEvent("studio:api-key-error",{detail:{provider:s.provider}})))}function cy(n){if(n!==void 0)try{return JSON.stringify(n)}catch(r){console.error("Failed to serialize request body:",r);try{const s=new WeakSet;return JSON.stringify(n,(o,c)=>{if(typeof c=="object"&&c!==null){if(s.has(c))return"[Circular]";s.add(c)}return c})}catch{return JSON.stringify({error:"Request body could not be serialized"})}}}function Cd(){const[n,r]=x.useState([]),[s,o]=x.useState(!1),[c,d]=x.useState(!1),[f,h]=x.useState(null),g=x.useRef(null),p=x.useCallback(async(v,j)=>{r([]),o(!0),d(!1),h(null);const S=new AbortController;g.current=S;try{const k=cy(j),E=await fetch(v,{method:"POST",headers:{"Content-Type":"application/json"},body:k,signal:S.signal});if(!E.ok||!E.body){let H=`HTTP ${E.status}`,M;try{M=await E.json(),M&&typeof M=="object"&&"error"in M&&typeof M.error=="string"&&(H=M.error)}catch{}throw oy(E.status,M),new Error(H)}const w=E.body.getReader(),N=new TextDecoder;let A="",z="";for(;;){const{done:H,value:M}=await w.read();if(H)break;A+=N.decode(M,{stream:!0});const F=A.split(`
67
- `);A=F.pop()||"";for(const T of F)if(T.startsWith("event: "))z=T.slice(7).trim();else if(T.startsWith("data: ")){try{const O=JSON.parse(T.slice(6)),C={event:z,data:O};z==="done"?(d(!0),r(_=>[..._,C])):r(_=>[..._,C])}catch{}z=""}}}catch(k){k.name!=="AbortError"&&h(k.message)}finally{o(!1),g.current=null}},[]),y=x.useCallback(()=>{var v;(v=g.current)==null||v.abort()},[]);return{events:n,running:s,done:c,error:f,start:p,stop:y}}function Ew(n){const r=x.useRef(n);r.current=n;const[s,o]=x.useState(new Set),c=x.useRef(new Map),d=x.useCallback(async(p,y,v)=>{var S;(S=c.current.get(p))==null||S.abort();const j=new AbortController;c.current.set(p,j),o(k=>{const E=new Set(k);return E.add(p),E});try{const k=cy(v),E=await fetch(y,{method:"POST",headers:{"Content-Type":"application/json"},body:k,signal:j.signal});if(!E.ok||!E.body){let H=`HTTP ${E.status}`,M;try{M=await E.json(),M&&typeof M=="object"&&"error"in M&&typeof M.error=="string"&&(H=M.error)}catch{}throw oy(E.status,M),new Error(H)}const w=E.body.getReader(),N=new TextDecoder;let A="",z="";for(;;){const{done:H,value:M}=await w.read();if(H)break;A+=N.decode(M,{stream:!0});const F=A.split(`
68
- `);A=F.pop()||"";for(const T of F)if(T.startsWith("event: "))z=T.slice(7).trim();else if(T.startsWith("data: ")){try{const O=JSON.parse(T.slice(6)),C={event:z,data:O};r.current.onEvent(p,C)}catch{}z=""}}r.current.onDone(p)}catch(k){k.name!=="AbortError"&&r.current.onError(p,k.message)}finally{o(k=>{const E=new Set(k);return E.delete(p),E}),c.current.delete(p)}},[]),f=x.useCallback(p=>{var y;(y=c.current.get(p))==null||y.abort()},[]),h=x.useCallback(()=>{for(const p of c.current.values())p.abort()},[]),g=s.size>0;return{runningSet:s,startCase:d,stopCase:f,stopAll:h,isAnyCaseRunning:g}}const Cw={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 Nw(n,r){var s,o;switch(r.type){case"SET_LOADING":return{...n,loading:r.loading};case"SET_ERROR":return{...n,error:r.error};case"INIT_DATA":{const c=new Map;if(r.benchmark)for(const f of r.benchmark.cases)c.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 d=((o=(s=r.evals)==null?void 0:s.evals[0])==null?void 0:o.id)??null;return{...n,skillContent:r.skillContent,savedContent:r.skillContent,isDirty:!1,evals:r.evals,evalsError:r.evalsError??null,latestBenchmark:r.benchmark,inlineResults:c,selectedCaseId:d,loading:!1,error:null}}case"SET_PANEL":return{...n,activePanel:r.panel};case"SET_CONTENT":return{...n,skillContent:r.content,isDirty:r.content!==n.savedContent};case"CONTENT_SAVED":return{...n,savedContent:n.skillContent,isDirty:!1};case"SET_EVALS":return{...n,evals:r.evals};case"SELECT_CASE":return{...n,selectedCaseId:r.caseId};case"CASE_RUN_START":{const c=new Map(n.caseRunStates);return c.set(r.caseId,{status:"running",startedAt:Date.now(),mode:r.mode}),{...n,caseRunStates:c,runMode:r.mode,activePanel:"run"}}case"CASE_RUN_COMPLETE":{const c=new Map(n.caseRunStates),d=c.get(r.caseId);c.set(r.caseId,{status:"complete",mode:d==null?void 0:d.mode});const f=new Map(n.inlineResults);return f.set(r.caseId,r.result),{...n,caseRunStates:c,inlineResults:f}}case"CASE_RUN_ERROR":{const c=new Map(n.caseRunStates),d=c.get(r.caseId);c.set(r.caseId,{status:"error",mode:d==null?void 0:d.mode});const f=new Map(n.inlineResults);return f.set(r.caseId,{status:"error",errorMessage:r.error,assertions:[]}),{...n,caseRunStates:c,inlineResults:f}}case"CASE_RUN_CANCEL":{const c=new Map(n.caseRunStates),d=c.get(r.caseId);return c.set(r.caseId,{status:"cancelled",mode:d==null?void 0:d.mode}),{...n,caseRunStates:c}}case"BULK_RUN_START":{const c=new Map(n.caseRunStates);for(const d of r.caseIds)c.set(d,{status:"queued",mode:r.mode});return{...n,caseRunStates:c,bulkRunActive:!0,runMode:r.mode,activePanel:"run"}}case"BULK_RUN_COMPLETE":return{...n,bulkRunActive:!1,latestBenchmark:r.benchmark??n.latestBenchmark,iterationCount:n.iterationCount+1};case"CANCEL_ALL":{const c=new Map(n.caseRunStates);for(const[d,f]of c)(f.status==="running"||f.status==="queued")&&c.set(d,{status:"cancelled"});return{...n,caseRunStates:c,bulkRunActive:!1}}case"UPDATE_INLINE_RESULT":{const c=new Map(n.inlineResults);return c.set(r.evalId,r.result),{...n,inlineResults:c}}case"OPEN_IMPROVE":return{...n,improveTarget:r.evalId,activePanel:"editor"};case"CLOSE_IMPROVE":return{...n,improveTarget:null};case"OPEN_AI_EDIT":return{...n,aiEditOpen:!0,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"CLOSE_AI_EDIT":return{...n,aiEditOpen:!1,aiEditLoading:!1,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"AI_EDIT_LOADING":return{...n,aiEditLoading:!0,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[]};case"AI_EDIT_PROGRESS":return{...n,aiEditProgress:[...n.aiEditProgress,r.entry]};case"AI_EDIT_RESULT":{const c=r.evalChanges??[],d=new Map;for(let f=0;f<c.length;f++)d.set(f,!0);return{...n,aiEditLoading:!1,aiEditResult:{improved:r.improved,reasoning:r.reasoning,evalChanges:c},aiEditEvalChanges:c,aiEditEvalSelections:d}}case"AI_EDIT_ERROR":return{...n,aiEditLoading:!1,aiEditError:r.message,aiEditClassifiedError:r.classified??null};case"GENERATE_EVALS_START":return{...n,generateEvalsLoading:!0,generateEvalsProgress:[],generateEvalsError:null};case"GENERATE_EVALS_PROGRESS":return{...n,generateEvalsProgress:[...n.generateEvalsProgress,r.entry]};case"GENERATE_EVALS_DONE":return{...n,generateEvalsLoading:!1,evals:r.evals};case"GENERATE_EVALS_ERROR":return{...n,generateEvalsLoading:!1,generateEvalsError:r.classified};case"TOGGLE_EVAL_CHANGE":{const c=new Map(n.aiEditEvalSelections);return c.set(r.index,!c.get(r.index)),{...n,aiEditEvalSelections:c}}case"SELECT_ALL_EVAL_CHANGES":{const c=new Map(n.aiEditEvalSelections);for(const d of c.keys())c.set(d,!0);return{...n,aiEditEvalSelections:c}}case"DESELECT_ALL_EVAL_CHANGES":{const c=new Map(n.aiEditEvalSelections);for(const d of c.keys())c.set(d,!1);return{...n,aiEditEvalSelections:c}}case"SET_EVALS_RETRY":return{...n,aiEditEvalsRetry:r.evalsFile};case"SET_REGRESSIONS":return{...n,regressions:r.regressions};case"INCREMENT_ITERATION":return{...n,iterationCount:n.iterationCount+1};case"SET_ACTIVATION_PROMPTS":return{...n,activationPrompts:r.prompts};case"ACTIVATION_START":return{...n,activationRunning:!0,activationResults:[],activationSummary:null,activationError:null,activationClassifyingStatus:null,activationStartedAt:Date.now()};case"ACTIVATION_RESULT":return{...n,activationResults:[...n.activationResults,r.result]};case"ACTIVATION_DONE":return{...n,activationRunning:!1,activationSummary:r.summary,activationClassifyingStatus:null};case"ACTIVATION_CLASSIFYING":return{...n,activationClassifyingStatus:`Classifying prompt ${r.index}/${r.total}...`};case"ACTIVATION_ERROR":return{...n,activationRunning:!1,activationError:r.error,activationClassifyingStatus:null};case"ACTIVATION_RESET":return{...n,activationResults:[],activationSummary:null,activationError:null};case"ACTIVATION_TIMEOUT":return{...n,activationRunning:!1,activationError:"Activation test timed out after 120 seconds"};case"ACTIVATION_CANCEL":return{...n,activationRunning:!1};case"GENERATE_PROMPTS_START":return{...n,generatingPrompts:!0,generatingPromptsError:null};case"GENERATE_PROMPTS_DONE":return{...n,generatingPrompts:!1};case"GENERATE_PROMPTS_ERROR":return{...n,generatingPrompts:!1,generatingPromptsError:r.error};case"ACTIVATION_HISTORY_LOADED":return{...n,activationHistory:r.runs,activationHistoryLoading:!1};default:return n}}function Tw(n){if(n==="unit"||n==="integration")return n}function Rw(n,r){const s=r.data;if(r.event==="output_ready"&&(n.output=s.output,s.durationMs!=null&&(n.durationMs=s.durationMs),s.tokens!=null&&(n.tokens=s.tokens)),r.event==="outputs_ready"&&(n.output=s.skillOutput,s.skillDurationMs!=null&&(n.durationMs=s.skillDurationMs),s.skillTokens!=null&&(n.tokens=s.skillTokens)),r.event==="assertion_result"){const o={assertion_id:s.assertion_id,text:s.text,pass:s.pass,reasoning:s.reasoning};n.assertions.find(c=>c.assertion_id===o.assertion_id)||n.assertions.push(o)}r.event==="case_complete"&&(n.status=s.status,n.passRate=s.pass_rate,n.errorMessage=s.error_message||void 0,n.classifiedError=s.classified_error||void 0)}const uy=x.createContext(null);function Nn(){const n=x.useContext(uy);if(!n)throw new Error("useWorkspace must be used within WorkspaceProvider");return n}function Aw({plugin:n,skill:r,origin:s,children:o}){const c=s==="installed",[d,f]=x.useReducer(Nw,{...Cw,plugin:n,skill:r}),h=x.useRef(new Set),g=x.useRef(new Set),p=x.useRef(new Map),y=x.useCallback((re,fe)=>{let pe=p.current.get(re);pe||(pe={assertions:[]},p.current.set(re,pe)),Rw(pe,fe),f({type:"UPDATE_INLINE_RESULT",evalId:re,result:{...pe,assertions:[...pe.assertions]}})},[]),v=x.useCallback(re=>{if(g.current.has(re))return;g.current.add(re);const fe=p.current.get(re)??{assertions:[]};f({type:"CASE_RUN_COMPLETE",caseId:re,result:{...fe,assertions:[...fe.assertions]}}),h.current.has(re)&&(h.current.delete(re),h.current.size===0&&Ce.getLatestBenchmark(n,r).then(pe=>f({type:"BULK_RUN_COMPLETE",benchmark:pe})).catch(()=>f({type:"BULK_RUN_COMPLETE",benchmark:null})))},[n,r]),j=x.useCallback((re,fe)=>{g.current.has(re)||(g.current.add(re),f({type:"CASE_RUN_ERROR",caseId:re,error:fe}),h.current.has(re)&&(h.current.delete(re),h.current.size===0&&Ce.getLatestBenchmark(n,r).then(pe=>f({type:"BULK_RUN_COMPLETE",benchmark:pe})).catch(()=>f({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[n,r]),{startCase:S,stopCase:k,stopAll:E}=Ew({onEvent:y,onDone:v,onError:j});x.useEffect(()=>()=>{E()},[E]);const w=x.useCallback(async()=>{try{const re=await fetch(`/api/skills/${n}/${r}/activation-history`);if(!re.ok){if(re.status===404){f({type:"ACTIVATION_HISTORY_LOADED",runs:[]});return}return}const fe=await re.json();f({type:"ACTIVATION_HISTORY_LOADED",runs:fe.runs||[]})}catch{}},[n,r]);x.useEffect(()=>{let re=!1;async function fe(){try{const[pe,xe,ve]=await Promise.allSettled([Ce.getSkillDetail(n,r),Ce.getEvals(n,r),Ce.getLatestBenchmark(n,r)]);if(re)return;let Le=null,De=null;if(xe.status==="fulfilled")Le=xe.value;else{const ut=xe.reason;De=(ut==null?void 0:ut.message)??"Failed to load test cases"}f({type:"INIT_DATA",skillContent:pe.status==="fulfilled"?pe.value.skillContent:"",evals:Le,evalsError:De,benchmark:ve.status==="fulfilled"?ve.value:null})}catch(pe){re||f({type:"SET_ERROR",error:pe.message})}}return fe(),w(),()=>{re=!0}},[n,r,w]);const N=x.useCallback(async()=>{if(!c)try{await Ce.applyImprovement(n,r,d.skillContent),f({type:"CONTENT_SAVED"})}catch(re){f({type:"SET_ERROR",error:re.message})}},[c,n,r,d.skillContent]),A=x.useCallback(async re=>{if(!c)try{const fe=await Ce.saveEvals(n,r,re);f({type:"SET_EVALS",evals:fe})}catch(fe){f({type:"SET_ERROR",error:fe.message})}},[c,n,r]),z=x.useCallback((re,fe="benchmark")=>{if(c)return;const pe=d.caseRunStates.get(re);if((pe==null?void 0:pe.status)!=="running")if(p.current.delete(re),g.current.delete(re),f({type:"CASE_RUN_START",caseId:re,mode:fe}),fe==="comparison"){const xe=`/api/skills/${n}/${r}/compare`;S(re,xe,{eval_ids:[re]})}else{const xe=`/api/skills/${n}/${r}/benchmark/case/${re}`;S(re,xe,fe==="baseline"?{baseline_only:!0}:void 0)}},[c,n,r,d.caseRunStates,S]),H=x.useCallback((re="benchmark")=>{var xe;if(c)return;const fe=((xe=d.evals)==null?void 0:xe.evals)??[];if(fe.length===0)return;const pe=fe.map(ve=>ve.id);for(const ve of pe)p.current.delete(ve),g.current.delete(ve);f({type:"BULK_RUN_START",caseIds:pe,mode:re}),h.current=new Set(pe);for(const ve of pe)if(re==="comparison")S(ve,`/api/skills/${n}/${r}/compare`,{eval_ids:[ve]});else{const Le=`/api/skills/${n}/${r}/benchmark/case/${ve}`;S(ve,Le,re==="baseline"?{baseline_only:!0}:void 0)}},[c,n,r,d.evals,S]),M=x.useCallback(re=>{k(re),f({type:"CASE_RUN_CANCEL",caseId:re}),h.current.delete(re),g.current.add(re)},[k]),F=x.useCallback(()=>{E(),f({type:"CANCEL_ALL"}),h.current.clear()},[E]),T=x.useCallback(async(re,fe)=>{f({type:"OPEN_IMPROVE",evalId:re})},[]),O=x.useCallback(async(re,fe)=>{try{await Ce.applyImprovement(n,r,fe),f({type:"SET_CONTENT",content:fe}),f({type:"CONTENT_SAVED"}),f({type:"CLOSE_IMPROVE"}),z(re,"benchmark")}catch(pe){f({type:"SET_ERROR",error:pe.message})}},[n,r,z]),C=Cd(),_=x.useRef(null),$=x.useRef(0);x.useEffect(()=>{const re=C.events;for(let fe=$.current;fe<re.length;fe++){const pe=re[fe],xe=pe.data;if(pe.event==="progress"&&f({type:"AI_EDIT_PROGRESS",entry:{timestamp:Date.now(),phase:xe.phase,message:xe.message}}),pe.event==="done"){const ve=xe.improved,Le=xe.reasoning,De=xe.evalChanges??[];f({type:"AI_EDIT_RESULT",improved:ve,reasoning:Le,evalChanges:De})}if(pe.event==="error"){const ve=xe;f({type:"AI_EDIT_ERROR",message:ve.description||"Unknown error",classified:ve})}}$.current=re.length},[C.events]),x.useEffect(()=>{C.error&&f({type:"AI_EDIT_ERROR",message:C.error})},[C.error]),x.useEffect(()=>()=>{C.stop()},[C.stop]);const K=x.useCallback(async(re,fe,pe)=>{c||($.current=0,f({type:"AI_EDIT_LOADING"}),_.current=C.stop,C.start(`/api/skills/${n}/${r}/improve?sse`,{mode:"instruct",instruction:re,content:d.skillContent,evals:d.evals??{skill_name:r,evals:[]},provider:fe,model:pe}))},[c,n,r,d.skillContent,d.evals,C]),Z=x.useCallback(()=>{C.stop(),f({type:"AI_EDIT_ERROR",message:"Cancelled"})},[C]),q=x.useCallback(async()=>{const re=d.aiEditResult;if(re!=null&&re.improved)try{if(await Ce.applyImprovement(n,r,re.improved),f({type:"SET_CONTENT",content:re.improved}),f({type:"CONTENT_SAVED"}),d.aiEditEvalChanges.length>0&&Array.from(d.aiEditEvalSelections.values()).some(Boolean)){const{mergeEvalChanges:pe}=await Io(async()=>{const{mergeEvalChanges:Le}=await import("./mergeEvalChanges-Dpbbs4d4.js");return{mergeEvalChanges:Le}},[]),xe=d.evals??{skill_name:r,evals:[]},ve=pe(xe,d.aiEditEvalChanges,d.aiEditEvalSelections);try{const Le=await Ce.saveEvals(n,r,ve);f({type:"SET_EVALS",evals:Le})}catch(Le){f({type:"SET_EVALS_RETRY",evalsFile:ve}),f({type:"SET_ERROR",error:`SKILL.md saved, but test cases failed to save: ${Le.message}. You can retry from the AI Edit panel.`});return}}f({type:"CLOSE_AI_EDIT"})}catch(fe){f({type:"SET_ERROR",error:fe.message})}},[n,r,d.aiEditResult,d.evals,d.aiEditEvalChanges,d.aiEditEvalSelections]),I=x.useCallback(()=>{f({type:"CLOSE_AI_EDIT"})},[]),L=x.useCallback(re=>{f({type:"TOGGLE_EVAL_CHANGE",index:re})},[]),B=x.useCallback(()=>{f({type:"SELECT_ALL_EVAL_CHANGES"})},[]),P=x.useCallback(()=>{f({type:"DESELECT_ALL_EVAL_CHANGES"})},[]),W=x.useCallback(async()=>{const re=d.aiEditEvalsRetry;if(re)try{const fe=await Ce.saveEvals(n,r,re);f({type:"SET_EVALS",evals:fe}),f({type:"SET_ERROR",error:null}),f({type:"CLOSE_AI_EDIT"})}catch(fe){f({type:"SET_ERROR",error:`Retry failed: ${fe.message}`})}},[n,r,d.aiEditEvalsRetry]),ie=x.useCallback(async()=>{try{const re=await Ce.getSkillDetail(n,r);f({type:"SET_CONTENT",content:re.skillContent}),f({type:"CONTENT_SAVED"})}catch{}},[n,r]),{config:D}=_r(),V=Cd(),te=x.useRef(0);x.useEffect(()=>{const re=V.events;for(let fe=te.current;fe<re.length;fe++){const pe=re[fe],xe=pe.data;if(pe.event==="progress"&&f({type:"GENERATE_EVALS_PROGRESS",entry:{timestamp:Date.now(),phase:xe.phase,message:xe.message}}),pe.event==="done"){const ve=xe;Ce.saveEvals(n,r,ve).then(Le=>f({type:"GENERATE_EVALS_DONE",evals:Le})).catch(Le=>f({type:"SET_ERROR",error:Le.message}))}pe.event==="error"&&f({type:"GENERATE_EVALS_ERROR",classified:xe})}te.current=re.length},[V.events,n,r]),x.useEffect(()=>{V.error&&f({type:"SET_ERROR",error:V.error})},[V.error]),x.useEffect(()=>()=>{V.stop()},[V.stop]);const se=x.useCallback(async re=>{if(c)return;te.current=0,f({type:"GENERATE_EVALS_START"});const fe={};D!=null&&D.provider&&(fe.provider=D.provider),D!=null&&D.model&&(fe.model=D.model);const pe=Tw(re==null?void 0:re.testType);pe&&(fe.testType=pe),V.start(`/api/skills/${n}/${r}/generate-evals?sse`,Object.keys(fe).length>0?fe:void 0)},[c,n,r,V,D]),ge=Cd(),he=x.useRef(0);x.useEffect(()=>()=>{ge.stop()},[ge.stop]),x.useEffect(()=>{const re=ge.events;for(let fe=he.current;fe<re.length;fe++){const pe=re[fe];if(pe.event==="classifying"){const xe=pe.data;f({type:"ACTIVATION_CLASSIFYING",index:xe.index,total:xe.total})}if(pe.event==="prompt_result"&&f({type:"ACTIVATION_RESULT",result:pe.data}),pe.event==="done"){be.current&&(clearTimeout(be.current),be.current=null);const xe=pe.data;if(xe.error)f({type:"ACTIVATION_ERROR",error:xe.error});else{f({type:"ACTIVATION_DONE",summary:xe});const ve={id:`run-${Date.now()}`,timestamp:new Date().toISOString(),model:(D==null?void 0:D.model)||"unknown",provider:(D==null?void 0:D.provider)||"unknown",promptCount:xe.total,summary:{precision:xe.precision,recall:xe.recall,reliability:xe.reliability,tp:xe.tp,tn:xe.tn,fp:xe.fp,fn:xe.fn}};f({type:"ACTIVATION_HISTORY_LOADED",runs:[ve,...d.activationHistory??[]]})}}}he.current=re.length},[ge.events,D,d.activationHistory]),x.useEffect(()=>{ge.error&&(be.current&&(clearTimeout(be.current),be.current=null),f({type:"ACTIVATION_ERROR",error:ge.error}))},[ge.error]);const be=x.useRef(null),ce=x.useCallback(()=>{be.current&&(clearTimeout(be.current),be.current=null),ge.stop(),f({type:"ACTIVATION_CANCEL",totalPrompts:0})},[ge]),je=x.useCallback(re=>{const pe=re.trim().split(`
69
- `).filter(Boolean).map(ve=>ve.startsWith("!")?{prompt:ve.slice(1).trim(),expected:"should_not_activate"}:ve.startsWith("+")?{prompt:ve.slice(1).trim(),expected:"should_activate"}:{prompt:ve.trim(),expected:"auto"});he.current=0,f({type:"ACTIVATION_START"}),f({type:"SET_ACTIVATION_PROMPTS",prompts:re});const xe={prompts:pe};D!=null&&D.provider&&(xe.provider=D.provider),D!=null&&D.model&&(xe.model=D.model),ge.start(`/api/skills/${n}/${r}/activation-test`,xe),be.current&&clearTimeout(be.current),be.current=setTimeout(()=>{ge.stop(),f({type:"ACTIVATION_TIMEOUT"}),be.current=null},12e4)},[n,r,ge,D]),Be=x.useCallback(async(re=8)=>{f({type:"GENERATE_PROMPTS_START"});try{const fe={count:re};D!=null&&D.provider&&(fe.provider=D.provider),D!=null&&D.model&&(fe.model=D.model);const pe=await fetch(`/api/skills/${n}/${r}/activation-prompts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(fe)});if(!pe.ok){let St=`HTTP ${pe.status}`;try{const Ct=await pe.json();Ct.error&&(St=Ct.error)}catch{}throw new Error(St)}const xe=pe.body.getReader(),ve=new TextDecoder;let Le="",De="",ut=[];for(;;){const{done:St,value:Ct}=await xe.read();if(St)break;Le+=ve.decode(Ct,{stream:!0});const It=Le.split(`
70
- `);Le=It.pop()||"";for(const Qe of It)if(Qe.startsWith("event: "))De=Qe.slice(7).trim();else if(Qe.startsWith("data: ")){try{const tt=JSON.parse(Qe.slice(6));if(De==="done"){if(tt.error)throw new Error(tt.error);ut=tt.prompts||[]}if(De==="error")throw new Error(tt.message||tt.description||"Generation failed")}catch(tt){if(!(tt instanceof SyntaxError))throw tt}De=""}}const Bt=ut.map(St=>`${St.expected==="should_activate"?"+":"!"}${St.prompt}`).join(`
71
- `);f({type:"SET_ACTIVATION_PROMPTS",prompts:Bt}),f({type:"GENERATE_PROMPTS_DONE"})}catch(fe){f({type:"GENERATE_PROMPTS_ERROR",error:fe.message})}},[n,r,D]),ze=x.useMemo(()=>({state:d,dispatch:f,isReadOnly:c,saveContent:N,saveEvals:A,runCase:z,runAll:H,cancelCase:M,cancelAll:F,improveForCase:T,applyImproveAndRerun:O,refreshSkillContent:ie,generateEvals:se,runActivationTest:je,cancelActivation:ce,generateActivationPrompts:Be,fetchActivationHistory:w,submitAiEdit:K,cancelAiEdit:Z,applyAiEdit:q,discardAiEdit:I,toggleEvalChange:L,selectAllEvalChanges:B,deselectAllEvalChanges:P,retryEvalsSave:W}),[d,c,N,A,z,H,M,F,T,O,ie,se,je,ce,Be,w,K,Z,q,I,L,B,P,W]);return a.jsx(uy.Provider,{value:ze,children:o})}function Mw(n){if(!n)return[];const r=n.split(`
72
- `),s=[];for(const o of r)if(!(o.startsWith("--- ")||o.startsWith("+++ "))){if(o.startsWith("@@")){s.push({type:"header",content:o});continue}if(o.startsWith("+")){s.push({type:"add",content:o.slice(1)});continue}if(o.startsWith("-")){s.push({type:"remove",content:o.slice(1)});continue}(o.startsWith(" ")||o===""&&s.length>0)&&s.push({type:"context",content:o.startsWith(" ")?o.slice(1):""})}return s}function Rf({contentDiff:n,fromLabel:r,toLabel:s,diffSummary:o,maxHeight:c=480,collapsible:d=!1,renderContext:f="inline",onRetry:h}){const[g,p]=x.useState(d),[y,v]=x.useState("unified"),j=x.useRef(null),S=x.useRef(null),k=x.useMemo(()=>Mw(n),[n]),E=x.useMemo(()=>{const M=k.filter(T=>T.type==="add").length,F=k.filter(T=>T.type==="remove").length;return{added:M,removed:F}},[k]),w=x.useMemo(()=>{let M=0,F=0;return k.filter(T=>T.type!=="header").map(T=>T.type==="remove"?(M++,{...T,origNum:M,newNum:null}):T.type==="add"?(F++,{...T,origNum:null,newNum:F}):(M++,F++,{...T,origNum:M,newNum:F}))},[k]),N=x.useMemo(()=>{const M=[],F=[];for(const T of w)if(T.type==="remove")M.push(T);else if(T.type==="add")F.push(T);else{for(;M.length<F.length;)M.push({type:"context",content:"",origNum:null,newNum:null});for(;F.length<M.length;)F.push({type:"context",content:"",origNum:null,newNum:null});M.push(T),F.push(T)}for(;M.length<F.length;)M.push({type:"context",content:"",origNum:null,newNum:null});for(;F.length<M.length;)F.push({type:"context",content:"",origNum:null,newNum:null});return{left:M,right:F}},[w]),A=x.useCallback(M=>{const F=M==="left"?j.current:S.current,T=M==="left"?S.current:j.current;F&&T&&(T.scrollTop=F.scrollTop)},[]);if(!n||k.length===0)return a.jsxs("div",{className:"rounded-lg p-6 text-center",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"Unable to load diff. Try again."}),h&&a.jsx("button",{onClick:h,className:"btn btn-secondary text-[12px]",children:"Retry"})]});const z=f==="modal"?"fixed inset-0 z-50 flex items-center justify-center bg-black/50":"",H=a.jsxs("div",{className:"rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:[r," → ",s]}),a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsxs("span",{style:{color:"var(--green)"},children:["+",E.added]}),a.jsxs("span",{style:{color:"var(--red)"},children:["-",E.removed]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>v(y==="unified"?"side-by-side":"unified"),className:"btn btn-ghost text-[11px]",children:y==="unified"?"Side-by-side":"Unified"}),d&&a.jsx("button",{onClick:()=>p(!g),className:"btn btn-ghost text-[11px]",children:g?"Expand":"Collapse"})]})]}),o&&a.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}),!g&&(y==="unified"?a.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:c,overflowY:"auto"},children:a.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:a.jsx("tbody",{children:w.map((M,F)=>a.jsxs("tr",{style:{background:M.type==="add"?"rgba(34,197,94,0.08)":M.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[a.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:M.type==="remove"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:M.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:M.origNum??""}),a.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:M.type==="add"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:M.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:M.newNum??""}),a.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:M.type==="add"?"var(--green)":M.type==="remove"?"var(--red)":"transparent",borderRight:M.type==="add"?"2px solid var(--green)":M.type==="remove"?"2px solid var(--red)":"2px solid transparent"},children:M.type==="add"?"+":M.type==="remove"?"-":" "}),a.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:M.type==="add"?"var(--green)":M.type==="remove"?"var(--red)":"var(--text-secondary)"},children:M.content||"​"})]},F))})})}):a.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:[a.jsx("div",{ref:j,style:{maxHeight:c,overflowY:"auto",borderRight:"1px solid var(--border-subtle)"},onScroll:()=>A("left"),children:a.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:a.jsx("tbody",{children:N.left.map((M,F)=>a.jsxs("tr",{style:{background:M.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[a.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:M.origNum??""}),a.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:M.type==="remove"?"var(--red)":"var(--text-secondary)"},children:M.content||"​"})]},F))})})}),a.jsx("div",{ref:S,style:{maxHeight:c,overflowY:"auto"},onScroll:()=>A("right"),children:a.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:a.jsx("tbody",{children:N.right.map((M,F)=>a.jsxs("tr",{style:{background:M.type==="add"?"rgba(34,197,94,0.08)":"transparent"},children:[a.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:M.newNum??""}),a.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:M.type==="add"?"var(--green)":"var(--text-secondary)"},children:M.content||"​"})]},F))})})})]}))]});return f==="modal"?a.jsx("div",{className:z,children:a.jsx("div",{style:{width:"80%",maxWidth:900},children:H})}):H}const wg={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 Lw(n,r){return n?n.length>r?n.slice(0,r)+"…":n:""}function zw(){const{state:n}=Nn(),{plugin:r,skill:s}=n,{refreshSkills:o,updateCount:c}=sa(),d=`versions/${r}/${s}`,f=x.useCallback(()=>Ce.getSkillVersions(r,s),[r,s]),{data:h,loading:g}=Al(d,f),[p,y]=x.useState(null),[v,j]=x.useState(null),[S,k]=x.useState(null),[E,w]=x.useState(!1),[N,A]=x.useState("idle"),[z,H]=x.useState(null),M=x.useRef(null),F=x.useRef(null),T=x.useMemo(()=>(h==null?void 0:h.find(q=>q.isInstalled))??null,[h]),O=x.useMemo(()=>(h==null?void 0:h[0])??null,[h]),C=T&&O&&T.version!==O.version,_=x.useCallback(q=>{p?!v&&q!==p?j(q):(y(q),j(null),k(null)):(y(q),k(null))},[p,v]),$=x.useCallback(async(q,I)=>{w(!0);try{const L=await Ce.getVersionDiff(r,s,q,I);k(L)}catch{k(null)}finally{w(!1)}},[r,s]);x.useEffect(()=>{if(p&&v){const q=h||[],I=q.findIndex(W=>W.version===p),L=q.findIndex(W=>W.version===v),[B,P]=I>L?[p,v]:[v,p];$(B,P)}},[p,v,h,$]);const K=x.useCallback(()=>{!T||!O||(y(T.version),j(O.version))},[T,O]),Z=x.useCallback(()=>{A("updating"),H(null);const q=Ce.startSkillUpdate(r,s);M.current=q,q.addEventListener("progress",I=>{try{switch(JSON.parse(I.data).status){case"scanning":A("scanning");break;case"installing":A("installing");break;case"done":A("done");break}}catch{A("error"),H("Unexpected response from server")}}),q.addEventListener("done",()=>{q.close(),M.current=null,o(),on(d),A("done")}),q.addEventListener("error",I=>{const L=I;let B="Connection lost";if(L.data)try{B=JSON.parse(L.data).error||"Update failed"}catch{}A("error"),H(B),q.close(),M.current=null})},[r,s,d,o]);return x.useEffect(()=>()=>{M.current&&(M.current.close(),M.current=null)},[]),g?a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"skeleton h-5 w-40 mb-4"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"skeleton h-14 rounded-lg"}),a.jsx("div",{className:"skeleton h-14 rounded-lg"}),a.jsx("div",{className:"skeleton h-14 rounded-lg"})]})]}):!h||h.length===0?a.jsx("div",{className:"flex flex-col items-center justify-center h-full py-16",children:a.jsx("div",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No version history available"})}):a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Version History"}),a.jsxs("div",{className:"flex items-center gap-2",children:[C&&a.jsx("button",{onClick:K,className:"btn btn-secondary text-[11px]",children:"View changes since installed"}),C&&N!=="done"&&(N==="error"?a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--red)"},children:z||"Update failed"}),a.jsx("button",{onClick:Z,className:"btn btn-secondary text-[11px]",children:"Retry"})]}):a.jsx("button",{onClick:Z,disabled:N!=="idle",className:"btn btn-primary text-[11px]",children:N==="idle"?`Update to ${O==null?void 0:O.version}`:N==="updating"?"Starting update...":N==="scanning"?"Scanning...":"Installing..."})),c>1&&a.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 (",c,")"]})]})]}),p&&!v&&a.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]}),a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute left-3 top-0 bottom-0",style:{width:2,background:"var(--border-subtle)"}}),a.jsx("div",{className:"space-y-1",children:h.map(q=>{const I=wg[q.certTier]||wg.COMMUNITY,L=q.version===p||q.version===v,B=q.isInstalled;return a.jsxs("button",{onClick:()=>_(q.version),className:"w-full text-left pl-8 pr-4 py-3 relative rounded-lg transition-all duration-150",style:{background:L?"var(--accent-muted)":"transparent",border:L?"1px solid var(--accent)":"1px solid transparent",cursor:"pointer"},onMouseEnter:P=>{L||(P.currentTarget.style.background="var(--surface-1)")},onMouseLeave:P=>{L||(P.currentTarget.style.background="transparent")},children:[a.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)"}}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:q.version}),a.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:I.bg,color:I.text},children:q.certTier}),B&&a.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"})]}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:new Date(q.createdAt).toLocaleDateString()})]}),q.diffSummary&&a.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:Lw(q.diffSummary,80)})]},q.version)})}),a.jsx("div",{ref:F,style:{height:1}})]}),E&&a.jsx("div",{className:"mt-4",children:a.jsx("div",{className:"skeleton h-48 rounded-xl"})}),S&&!E&&a.jsx("div",{className:"mt-4",children:a.jsx(Rf,{contentDiff:S.contentDiff,fromLabel:S.from,toLabel:S.to,diffSummary:S.diffSummary,renderContext:"inline",onRetry:()=>p&&v&&$(S.from,S.to)})})]})}function Dw(n){const r=n.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!r)return{metadata:{},body:n};const s=r[1],o=r[2].trim(),c={},d=s.split(`
73
- `);let f="",h=!1;for(const g of d){const p=g.match(/^[ \t]+([\w-]+):\s*(.*)$/);if(p&&f&&h){const j=p[1],S=p[2].trim();let k=c[f];if((typeof k!="object"||Array.isArray(k))&&(k={},c[f]=k),!S)k[j]=[];else{const E=S.match(/^\[(.+)\]$/);E?k[j]=E[1].split(",").map(w=>w.trim().replace(/^["']|["']$/g,"")).filter(Boolean):k[j]=S.replace(/^["']|["']$/g,"")}continue}const y=g.match(/^\s+-\s+(.+)$/);if(y&&f){h=!1;const j=c[f];Array.isArray(j)?j.push(y[1].trim().replace(/^["']|["']$/g,"")):c[f]=[y[1].trim().replace(/^["']|["']$/g,"")];continue}const v=g.match(/^([\w-]+):\s*(.*)$/);if(v){f=v[1];const j=v[2].trim();if(h=!1,!j){c[f]={},h=!0;continue}const S=j.match(/^\[(.+)\]$/);if(S){c[f]=S[1].split(",").map(k=>k.trim().replace(/^["']|["']$/g,"")).filter(Boolean);continue}c[f]=j.replace(/^["']|["']$/g,"")}}return{metadata:c,body:o}}function Fo(n){if(!n)return"";try{let r=n.replace(/^---\n[\s\S]*?\n---\n?/,""),s=_w(r);return s=s.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>'),s=s.replace(/^### (.+)$/gm,'<div style="font-weight:600;font-size:14px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),s=s.replace(/^## (.+)$/gm,'<div style="font-weight:700;font-size:15px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),s=s.replace(/^# (.+)$/gm,'<div style="font-weight:700;font-size:1rem;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),s=s.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer" style="color:var(--accent);text-decoration:underline">$1</a>'),s=s.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),s=s.replace(/\*([^*]+)\*/g,"<em>$1</em>"),s=s.replace(/`([^`]+)`/g,'<code style="background:var(--surface-3);padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em">$1</code>'),s=s.replace(/^- (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">• $1</div>'),s=s.replace(/^(\d+)\. (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">$1. $2</div>'),s=s.replace(/\n\n/g,'<div style="height:0.5rem"></div>'),s=s.replace(/\n/g,"<br/>"),s}catch{return`<pre style="white-space:pre-wrap;font-size:12px;line-height:1.5">${n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}</pre>`}}function _w(n){const r=n.split(`
74
- `),s=[];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 c=Eg(r[o]);o+=2;const d=[];for(;o<r.length&&r[o].trim().startsWith("|");)d.push(Eg(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 g='<table style="width:100%;border-collapse:collapse;margin:0.5rem 0;border:1px solid var(--border-subtle);border-radius:6px;overflow:hidden">';g+="<thead><tr>";for(const p of c)g+=`<th ${f}>${p}</th>`;g+="</tr></thead><tbody>";for(const p of d){g+="<tr>";for(const y of p)g+=`<td ${h}>${y}</td>`;g+="</tr>"}g+="</tbody></table>",s.push(g)}else s.push(r[o]),o++;return s.join(`
75
- `)}function Eg(n){return n.split("|").map(r=>r.trim()).filter(r=>r.length>0)}function Go(n,r){const s=n.split(`
76
- `),o=r.split(`
77
- `);if(s.length>1e3||o.length>1e3)return[...s.map(y=>({type:"unchanged",content:y}))];const c=s.length,d=o.length,f=Array.from({length:c+1},()=>new Array(d+1).fill(0));for(let y=1;y<=c;y++)for(let v=1;v<=d;v++)s[y-1]===o[v-1]?f[y][v]=f[y-1][v-1]+1:f[y][v]=Math.max(f[y-1][v],f[y][v-1]);const h=[];let g=c,p=d;for(;g>0||p>0;)g>0&&p>0&&s[g-1]===o[p-1]?(h.push({type:"unchanged",content:s[g-1]}),g--,p--):p>0&&(g===0||f[g][p-1]>=f[g-1][p])?(h.push({type:"added",content:o[p-1]}),p--):(h.push({type:"removed",content:s[g-1]}),g--);return h.reverse()}function Ow(n,r){if(r&&new Set(["generating","comparing","judging","judging_assertion","preparing","parsing","generating_skill","generating_baseline","scoring","action_items"]).has(n))return a.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 a.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{background:o.has(n)?"var(--accent)":"var(--green)"}})}function Ks({entries:n,isRunning:r}){const[s,o]=x.useState(!1),c=x.useRef(null);return x.useEffect(()=>{c.current&&!s&&(c.current.scrollTop=c.current.scrollHeight)},[n,s]),n.length===0&&!r?null:a.jsxs("div",{className:"mt-2 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsxs("button",{onClick:()=>o(!s),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:d=>{d.currentTarget.style.color="var(--text-primary)"},onMouseLeave:d=>{d.currentTarget.style.color="var(--text-tertiary)"},children:[a.jsxs("span",{className:"flex items-center gap-2",children:[r&&a.jsx("div",{className:"spinner",style:{width:10,height:10}}),"Progress Log (",n.length,")"]}),a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{transform:s?"rotate(0)":"rotate(180deg)",transition:"transform 0.2s ease"},children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),!s&&a.jsx("div",{ref:c,className:"px-3 pb-3 space-y-1 max-h-48 overflow-y-auto",children:n.map((d,f)=>{const h=f===n.length-1&&r,g=f===0?"0s":`+${((d.timestamp-n[0].timestamp)/1e3).toFixed(1)}s`;return a.jsxs("div",{className:"flex items-center gap-2 text-[11px] animate-fade-in",style:{opacity:h?1:.7},children:[Ow(d.phase,h),a.jsx("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)",width:40},children:g}),a.jsx("span",{style:{color:h?"var(--text-primary)":"var(--text-secondary)"},children:d.message}),d.current!=null&&d.total!=null&&a.jsxs("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)"},children:["[",d.current,"/",d.total,"]"]})]},f)})})]})}const Cg={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 Wo({error:n,onRetry:r,onDismiss:s}){const[o,c]=x.useState(null),d=x.useRef(null);x.useEffect(()=>(n.category==="rate_limit"&&n.retryAfterMs?c(Math.ceil(n.retryAfterMs/1e3)):c(null),()=>{d.current&&clearInterval(d.current)}),[n]),x.useEffect(()=>{if(!(o==null||o<=0))return d.current=setInterval(()=>{c(g=>g==null||g<=1?(d.current&&clearInterval(d.current),0):g-1)},1e3),()=>{d.current&&clearInterval(d.current)}},[o!=null&&o>0]);const f=Cg[n.category]||Cg.unknown,h=o!=null&&o>0;return a.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:[a.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{style:{fontSize:14},children:f.icon}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:f.color},children:n.title})]}),s&&a.jsx("button",{onClick:s,className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)"},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"px-3.5 pb-3",children:[a.jsx("p",{className:"text-[11.5px] mb-1.5",style:{color:"var(--text-secondary)"},children:n.description}),a.jsx("p",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:n.hint}),(r||o!=null)&&a.jsx("div",{className:"flex items-center gap-2 mt-2.5",children:r&&a.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"})})]})]})}function Bw({plugin:n,skill:r,skillContent:s,onApplied:o}){const[c,d]=x.useState("closed"),{config:f}=_r(),[h,g]=x.useState("claude-cli"),[p,y]=x.useState("opus"),[v,j]=x.useState([]),[S,k]=x.useState(""),[E,w]=x.useState(""),[N,A]=x.useState(null),[z,H]=x.useState(null),[M,F]=x.useState([]),[T,O]=x.useState(!1),C=x.useRef(null);x.useEffect(()=>{if(!f)return;f.providers.find(B=>B.id==="claude-cli"&&B.available)&&(g("claude-cli"),y("opus"))},[f]),x.useEffect(()=>()=>{var L;(L=C.current)==null||L.abort()},[]);function _(){return f==null?void 0:f.providers.find(L=>L.id===h&&L.available)}const $=x.useCallback(()=>{var L;(L=C.current)==null||L.abort(),d("open")},[]);async function K(){d("loading"),A(null),H(null),F([]);const L=new AbortController;C.current=L;try{const B=await fetch(`/api/skills/${encodeURIComponent(n)}/${encodeURIComponent(r)}/improve?sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:h,model:p}),signal:L.signal});if(!B.ok||!B.body){let V=`HTTP ${B.status}`;try{const te=await B.json();te.error&&(V=te.error)}catch{}throw new Error(V)}const P=B.body.getReader(),W=new TextDecoder;let ie="",D="";for(;;){const{done:V,value:te}=await P.read();if(V)break;ie+=W.decode(te,{stream:!0});const se=ie.split(`
78
- `);ie=se.pop()||"";for(const ge of se)if(ge.startsWith("event: "))D=ge.slice(7).trim();else if(ge.startsWith("data: ")){try{const he=JSON.parse(ge.slice(6));D==="progress"?F(be=>[...be,{phase:he.phase,message:he.message,timestamp:Date.now()}]):D==="done"||D==="complete"?(k(he.improved),w(he.reasoning||""),j(Go(he.original||s,he.improved)),d("diff_shown")):D==="error"&&(A(he.message||he.description||"Unknown error"),he.category&&H(he),d("open"))}catch{}D=""}}}catch(B){B.name!=="AbortError"&&(A(B.message),d("open"))}finally{C.current=null}}async function Z(){O(!0);try{await Ce.applyImprovement(n,r,S),o(S),d("closed")}catch(L){A(L.message)}finally{O(!1)}}function q(){d("closed"),j([]),k(""),w(""),A(null)}if(c==="closed")return a.jsxs("button",{onClick:()=>d("open"),className:"btn btn-secondary mb-5",disabled:!s,children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),a.jsx("path",{d:"M2 17l10 5 10-5"}),a.jsx("path",{d:"M2 12l10 5 10-5"})]}),"Improve Skill"]});const I=_();return a.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden animate-fade-in",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.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:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),a.jsx("path",{d:"M2 17l10 5 10-5"}),a.jsx("path",{d:"M2 12l10 5 10-5"})]})}),a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Skill Improvement"})]}),a.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:L=>{L.currentTarget.style.background="var(--surface-3)"},onMouseLeave:L=>{L.currentTarget.style.background="transparent"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"px-5 py-4",children:[(c==="open"||c==="loading")&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-end gap-3 mb-4",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),a.jsx("select",{className:"input-field text-[12px] py-1.5",value:h,onChange:L=>{g(L.target.value);const B=f==null?void 0:f.providers.find(P=>P.id===L.target.value);B!=null&&B.models[0]&&y(B.models[0].id)},disabled:c==="loading",children:f==null?void 0:f.providers.filter(L=>L.available).map(L=>a.jsx("option",{value:L.id,children:L.label},L.id))})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),a.jsx("select",{className:"input-field text-[12px] py-1.5",value:p,onChange:L=>y(L.target.value),disabled:c==="loading",children:I==null?void 0:I.models.map(L=>a.jsx("option",{value:L.id,children:L.label},L.id))})]}),c==="loading"?a.jsx("button",{onClick:$,className:"btn btn-secondary flex-shrink-0",children:"Cancel"}):a.jsx("button",{onClick:K,className:"btn btn-primary flex-shrink-0",children:"Improve"})]}),c==="loading"&&M.length>0&&a.jsx("div",{className:"mt-3",children:a.jsx(Ks,{entries:M,isRunning:!0})})]}),N&&a.jsx("div",{className:"mb-4",children:z?a.jsx(Wo,{error:z,onRetry:K,onDismiss:()=>{A(null),H(null)}}):a.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:N})}),c==="diff_shown"&&a.jsxs(a.Fragment,{children:[E&&a.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:[a.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),E]}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-4",style:{border:"1px solid var(--border-subtle)",maxHeight:"400px",overflowY:"auto"},children:v.map((L,B)=>a.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:L.type==="added"?"rgba(34,197,94,0.1)":L.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:L.type==="added"?"var(--green)":L.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:L.type==="added"?"3px solid var(--green)":L.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:L.type==="added"?"+":L.type==="removed"?"-":" "}),L.content]},B))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:Z,disabled:T,className:"btn btn-primary",children:T?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"spinner",style:{width:12,height:12}})," Applying..."]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})," Apply"]})}),a.jsx("button",{onClick:q,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}const Ng={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"}},Iw={remove:"var(--red)",modify:"#fbbf24",add:"var(--green)"};function Hw({change:n,index:r,selected:s,onToggle:o,originalEval:c}){var v;const[d,f]=x.useState(!1),h=Ng[n.action]??Ng.add,g=Iw[n.action]??"var(--border-subtle)",p=n.action==="remove"?(c==null?void 0:c.name)??`Eval #${n.evalId}`:((v=n.eval)==null?void 0:v.name)??"Unnamed",y=x.useCallback(()=>o(r),[o,r]);return a.jsxs("div",{className:"rounded-lg transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderLeft:`3px solid ${g}`,opacity:s?1:.5},children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[a.jsx("input",{type:"checkbox",checked:s,onChange:y,className:"flex-shrink-0",style:{accentColor:"var(--accent)"}}),a.jsx("span",{className:"pill text-[9px] font-bold flex-shrink-0",style:{background:h.bg,color:h.color,padding:"1px 6px"},children:h.label}),a.jsx("span",{className:"text-[12px] font-medium truncate",style:{color:"var(--text-primary)"},children:p}),a.jsx("span",{className:"text-[11px] truncate flex-1",style:{color:"var(--text-tertiary)"},children:n.reason}),a.jsx("button",{onClick:()=>f(!d),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:a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:d?"rotate(90deg)":"rotate(0)",transition:"transform 0.15s ease"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),d&&a.jsxs("div",{className:"px-4 pb-3 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.action==="add"&&n.eval&&a.jsx(Uw,{evalCase:n.eval}),n.action==="modify"&&n.eval&&c&&a.jsx($w,{original:c,proposed:n.eval}),n.action==="remove"&&c&&a.jsx(Vw,{evalCase:c})]})]})}function Uw({evalCase:n}){var r;return a.jsxs("div",{className:"pt-2.5 space-y-2",children:[a.jsx(tf,{label:"Prompt",value:n.prompt}),a.jsx(tf,{label:"Expected",value:n.expected_output}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((r=n.assertions)==null?void 0:r.length)??0,")"]}),a.jsx("div",{className:"mt-1 space-y-1",children:(n.assertions??[]).map(s=>a.jsxs("div",{className:"text-[11px] flex items-start gap-1.5",style:{color:"var(--text-secondary)"},children:[a.jsx("span",{style:{color:"var(--green)"},children:"+"})," ",s.text]},s.id))})]})]})}function $w({original:n,proposed:r}){const s=[];n.name!==r.name&&s.push({label:"Name",old:n.name,new:r.name}),n.prompt!==r.prompt&&s.push({label:"Prompt",old:n.prompt,new:r.prompt}),n.expected_output!==r.expected_output&&s.push({label:"Expected",old:n.expected_output,new:r.expected_output});const o=n.assertions??[],c=r.assertions??[],d=new Set(o.map(p=>p.text)),f=new Set(c.map(p=>p.text)),h=c.filter(p=>!d.has(p.text)),g=o.filter(p=>!f.has(p.text));return a.jsxs("div",{className:"pt-2.5 space-y-2",children:[s.map(p=>a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:p.label}),a.jsxs("div",{className:"mt-1 text-[11px] font-mono rounded p-2",style:{background:"var(--surface-1)"},children:[a.jsxs("div",{style:{color:"var(--red)",textDecoration:"line-through"},children:["- ",nf(p.old,120)]}),a.jsxs("div",{style:{color:"var(--green)"},children:["+ ",nf(p.new,120)]})]})]},p.label)),(h.length>0||g.length>0)&&a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Assertions"}),a.jsxs("div",{className:"mt-1 space-y-0.5",children:[g.map(p=>a.jsxs("div",{className:"text-[11px]",style:{color:"var(--red)"},children:["- ",p.text]},p.id)),h.map(p=>a.jsxs("div",{className:"text-[11px]",style:{color:"var(--green)"},children:["+ ",p.text]},p.id))]})]}),s.length===0&&h.length===0&&g.length===0&&a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"No visible field changes"})]})}function Vw({evalCase:n}){var r;return a.jsxs("div",{className:"pt-2.5 space-y-2",style:{opacity:.7},children:[a.jsx(tf,{label:"Prompt",value:n.prompt}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((r=n.assertions)==null?void 0:r.length)??0,")"]}),a.jsx("div",{className:"mt-1 space-y-0.5",children:(n.assertions??[]).map(s=>a.jsx("div",{className:"text-[11px]",style:{color:"var(--red)",textDecoration:"line-through"},children:s.text},s.id))})]})]})}function tf({label:n,value:r}){return a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:n}),a.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:nf(r,300)})]})}function nf(n,r){return n.length>r?n.slice(0,r)+"...":n}const Tg={remove:0,modify:1,add:2};function Pw({changes:n,selections:r,currentEvals:s,onToggle:o,onSelectAll:c,onDeselectAll:d}){if(n.length===0)return null;const f=n.map((g,p)=>({change:g,originalIndex:p}));f.sort((g,p)=>(Tg[g.change.action]??2)-(Tg[p.change.action]??2));const h=Array.from(r.values()).filter(Boolean).length;return a.jsxs("div",{className:"mt-3 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"Test Case Changes"}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",h,"/",n.length," selected)"]})]}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("button",{onClick:c,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--accent)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--accent-muted)"},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:"Select All"}),a.jsx("button",{onClick:d,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--surface-3)"},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:"Deselect All"})]})]}),a.jsx("div",{className:"space-y-1.5 overflow-auto",style:{maxHeight:240},children:f.map(({change:g,originalIndex:p})=>a.jsx(Hw,{change:g,index:p,selected:r.get(p)??!1,onToggle:o,originalEval:g.evalId!=null?s.find(y=>y.id===g.evalId):void 0},p))})]})}function Fw(){var L;const{state:n,dispatch:r,submitAiEdit:s,applyAiEdit:o,discardAiEdit:c,cancelAiEdit:d,toggleEvalChange:f,selectAllEvalChanges:h,deselectAllEvalChanges:g,retryEvalsSave:p}=Nn(),{aiEditLoading:y,aiEditResult:v,aiEditError:j,aiEditClassifiedError:S,aiEditProgress:k,aiEditEvalChanges:E,aiEditEvalSelections:w,aiEditEvalsRetry:N}=n,[A,z]=x.useState(""),{config:H}=_r(),[M,F]=x.useState("claude-cli"),[T,O]=x.useState("opus"),C=x.useRef(null);x.useEffect(()=>{var B;(B=C.current)==null||B.focus()},[]),x.useEffect(()=>{if(!H)return;H.providers.find(P=>P.id==="claude-cli"&&P.available)&&(F("claude-cli"),O("opus"))},[H]);const _=H==null?void 0:H.providers.find(B=>B.id===M&&B.available),$=x.useCallback(()=>{const B=A.trim();!B||y||s(B,M,T)},[A,y,s,M,T]),K=x.useCallback(B=>{B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),$()),B.key==="Escape"&&(B.preventDefault(),y?d():c())},[$,y,d,c]),Z=x.useCallback(()=>{r({type:"CLOSE_AI_EDIT"}),r({type:"OPEN_AI_EDIT"})},[r]),q=v?Go(n.skillContent,v.improved):[],I=((L=n.evals)==null?void 0:L.evals)??[];return a.jsxs("div",{className:"animate-fade-in",style:{background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[a.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:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M15 4V2"}),a.jsx("path",{d:"M15 16v-2"}),a.jsx("path",{d:"M8 9h2"}),a.jsx("path",{d:"M20 9h2"}),a.jsx("path",{d:"M17.8 11.8L19 13"}),a.jsx("path",{d:"M15 9h.01"}),a.jsx("path",{d:"M17.8 6.2L19 5"}),a.jsx("path",{d:"M11 6.2L9.7 5"}),a.jsx("path",{d:"M3 21l9-9"})]})}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Edit"}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:"Describe what to change — Enter to submit, Esc to dismiss"})]}),a.jsx("button",{onClick:c,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:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"px-4 py-3",children:[!v&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-end gap-2.5",children:[a.jsx("div",{className:"flex-1",children:a.jsx("textarea",{ref:C,value:A,onChange:B=>z(B.target.value),onKeyDown:K,placeholder:"e.g., Add an error handling section...",disabled:y,rows:1,className:"w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",borderRadius:6,padding:"8px 12px",fontSize:12.5,lineHeight:1.5,fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",minHeight:36,maxHeight:96},onInput:B=>{const P=B.currentTarget;P.style.height="auto",P.style.height=Math.min(P.scrollHeight,96)+"px"}})}),a.jsxs("div",{style:{minWidth:100},children:[a.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),a.jsx("select",{className:"input-field text-[11px] py-1",value:M,onChange:B=>{F(B.target.value);const P=H==null?void 0:H.providers.find(W=>W.id===B.target.value);P!=null&&P.models[0]&&O(P.models[0].id)},disabled:y,style:{width:"100%"},children:H==null?void 0:H.providers.filter(B=>B.available).map(B=>a.jsx("option",{value:B.id,children:B.label},B.id))})]}),a.jsxs("div",{style:{minWidth:80},children:[a.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Model"}),a.jsx("select",{className:"input-field text-[11px] py-1",value:T,onChange:B=>O(B.target.value),disabled:y,style:{width:"100%"},children:_==null?void 0:_.models.map(B=>a.jsx("option",{value:B.id,children:B.label},B.id))})]}),y?a.jsx("button",{onClick:d,className:"btn btn-secondary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Cancel"}):a.jsx("button",{onClick:$,disabled:!A.trim(),className:"btn btn-primary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Submit"})]}),y&&k.length>0&&a.jsx("div",{className:"mt-2.5",children:a.jsx(Ks,{entries:k,isRunning:!0})})]}),j&&a.jsx("div",{className:"mt-3",children:S?a.jsx(Wo,{error:S,onRetry:Z,onDismiss:c}):a.jsx("div",{className:"px-3 py-2.5 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:j})}),v&&a.jsxs("div",{className:"animate-fade-in",children:[v.reasoning&&a.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:[a.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),v.reasoning]}),a.jsx("div",{className:"mb-1",children:a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"})}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:300,overflowY:"auto"},children:q.map((B,P)=>a.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:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:B.type==="added"?"+":B.type==="removed"?"-":" "}),B.content]},P))}),a.jsx(Pw,{changes:E,selections:w,currentEvals:I,onToggle:f,onSelectAll:h,onDeselectAll:g}),N&&a.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:[a.jsx("span",{children:"Test case save failed. SKILL.md was saved successfully."}),a.jsx("button",{onClick:p,className:"btn text-[11px]",style:{background:"rgba(251,191,36,0.2)",color:"#fbbf24",padding:"3px 10px"},children:"Retry Save"})]}),a.jsxs("div",{className:"flex gap-2 mt-3",children:[a.jsxs("button",{onClick:o,className:"btn btn-primary text-[11px]",style:{padding:"5px 12px"},children:[a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),a.jsx("button",{onClick:c,className:"btn btn-secondary text-[11px]",style:{padding:"5px 12px"},children:"Discard"}),a.jsx("button",{onClick:Z,className:"btn btn-ghost text-[11px]",style:{padding:"5px 12px"},children:"Try Again"})]})]})]})]})}function Gw(n,r){const[s,o]=x.useState([]),[c,d]=x.useState("SKILL.md"),[f,h]=x.useState(null),[g,p]=x.useState(!1),[y,v]=x.useState(null),j=x.useCallback(async()=>{try{const E=await Ce.getSkillFiles(n,r);o(E.files)}catch{o([])}},[n,r]);x.useEffect(()=>{d("SKILL.md"),h(null),v(null),j()},[n,r,j]);const S=x.useCallback(async E=>{if(d(E),E==="SKILL.md"){h(null),v(null);return}p(!0),v(null);try{const w=await Ce.getSkillFile(n,r,E);h(w)}catch(w){v(`Unable to open file: ${w.message}`),h(null)}finally{p(!1)}},[n,r]),k=x.useCallback(()=>{j()},[j]);return{files:s,activeFile:c,secondaryContent:f,loading:g,error:y,selectFile:S,refresh:k,isSkillMd:c==="SKILL.md"}}function Ww(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}function Yw(n){const r=[],s=new Map;for(const o of n){const c=o.path.split("/"),f={name:c[c.length-1],path:o.path,type:o.type,size:o.size,children:[]};s.set(o.path,f)}for(const o of n){const c=o.path.split("/");if(c.length===1){const d=s.get(o.path);d&&r.push(d)}else{const d=c.slice(0,-1).join("/"),f=s.get(d),h=s.get(o.path);f&&h&&f.children.push(h)}}return r}function dy({expanded:n}){return a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:n?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})}function fy(){return a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.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 qw(){return a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function Kw(){return a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"23 4 23 10 17 10"}),a.jsx("polyline",{points:"1 20 1 14 7 14"}),a.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 py({node:n,depth:r,activeFile:s,onSelect:o}){const[c,d]=x.useState(!0),f=n.path===s;return n.type==="dir"?a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>d(!c),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:[a.jsx(dy,{expanded:c}),a.jsx(fy,{}),a.jsxs("span",{children:[n.name,"/"]})]}),c&&n.children.map(h=>a.jsx(py,{node:h,depth:r+1,activeFile:s,onSelect:o},h.path))]}):a.jsxs("button",{onClick:()=>o(n.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:[a.jsx("span",{style:{width:10}}),a.jsx(qw,{}),a.jsx("span",{style:{flex:1},children:n.name}),a.jsx("span",{style:{fontSize:9,color:"var(--text-tertiary)",marginRight:4,whiteSpace:"nowrap"},children:Ww(n.size)})]})}function Xw({files:n,activeFile:r,onSelect:s,onRefresh:o}){const[c,d]=x.useState(!1),f=x.useMemo(()=>Yw(n),[n]);return a.jsxs("div",{style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 8px",cursor:"pointer",userSelect:"none"},onClick:()=>d(!c),children:[a.jsx(dy,{expanded:c}),a.jsx(fy,{}),a.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r}),a.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:a.jsx(Kw,{})})]}),c&&a.jsx("div",{style:{maxHeight:240,overflowY:"auto",padding:"2px 4px 4px"},children:f.length===0?a.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 8px"},children:"No files found"}):f.map(h=>a.jsx(py,{node:h,depth:0,activeFile:r,onSelect:s},h.path))})]})}function po(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}function Qw(n){try{return JSON.stringify(JSON.parse(n),null,2)}catch{return n}}function Zw(n){const r=n.toLowerCase();return r.endsWith(".json")?"json":r.endsWith(".md")?"md":"other"}function Rg({content:n}){return a.jsx("textarea",{readOnly:!0,value:n,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 Ag({content:n,fileType:r}){if(r==="json"){const s=Qw(n);return a.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:s})}return r==="md"?a.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:Fo(n)}}):a.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:n})}function Mg(n){try{return JSON.stringify(JSON.parse(n),null,2).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"([^"\\]|\\.)*"\s*:/g,s=>`<span style="color:#6383ff">${s}</span>`).replace(/:\s*"([^"\\]|\\.)*"/g,s=>`<span style="color:#22c55e">${s.slice(0,2)}<span style="color:#22c55e">${s.slice(2)}</span></span>`).replace(/:\s*(-?\d+\.?\d*)/g,(s,o)=>`: <span style="color:#fb923c">${o}</span>`).replace(/:\s*(true|false|null)/g,(s,o)=>`: <span style="color:#a855f7">${o}</span>`)}catch{return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}}function Jw({file:n,loading:r,error:s,viewMode:o,plugin:c,skill:d,onSaved:f,onDirtyChange:h}){const[g,p]=x.useState(o),[y,v]=x.useState(!1),[j,S]=x.useState(""),[k,E]=x.useState(!1),[w,N]=x.useState(null),A=o!==g?o:g;x.useEffect(()=>{h==null||h(y)},[y,h]);const z=x.useCallback(()=>{(n==null?void 0:n.content)!=null&&(S(n.content),v(!0))},[n]),H=x.useCallback(()=>{v(!1)},[]),M=x.useCallback(async()=>{if(!(!c||!d||!n)){E(!0);try{await Ce.saveSkillFile(c,d,n.path,j),N("Saved"),v(!1),f==null||f(),setTimeout(()=>N(null),2e3)}catch(O){N(`Save failed: ${O.message}`),setTimeout(()=>N(null),3e3)}finally{E(!1)}}},[c,d,n,j,f]);if(x.useEffect(()=>{if(!y)return;const O=C=>{(C.ctrlKey||C.metaKey)&&C.key==="s"&&(C.preventDefault(),M())};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[y,M]),r)return a.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:"Loading…"});if(s)return a.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:a.jsxs("div",{style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"16px 20px",maxWidth:400,textAlign:"center"},children:[a.jsx("div",{style:{fontSize:13,color:"var(--text-primary)",fontWeight:600,marginBottom:6},children:"Unable to open file"}),a.jsx("div",{style:{fontSize:12,color:"var(--text-tertiary)"},children:s})]})});if(!n)return null;if(n.binary)return a.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:["Binary file (",po(n.size),") — cannot be displayed"]});const F=n.content??"",T=Zw(n.path);return a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[n.truncated&&a.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 ",po(512*1024)," — ",po(n.size)," total"]}),a.jsxs("div",{style:{display:"flex",gap:4,padding:"4px 8px",borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[(T==="md"||T==="json")&&["raw","split","preview"].map(O=>a.jsx("button",{onClick:()=>p(O),style:{padding:"2px 8px",fontSize:11,background:A===O?"var(--accent-muted)":"none",color:A===O?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer",textTransform:"capitalize"},children:O},O)),a.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",display:"flex",alignItems:"center",gap:6},children:[po(n.size),c&&d&&!n.binary&&!y&&a.jsx("button",{onClick:z,style:{padding:"1px 6px",fontSize:10,background:"var(--accent-muted)",color:"var(--accent)",border:"none",borderRadius:3,cursor:"pointer"},children:"Edit"}),y&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:M,disabled:k,style:{padding:"1px 6px",fontSize:10,background:"var(--accent)",color:"#fff",border:"none",borderRadius:3,cursor:"pointer",opacity:k?.6:1},children:k?"Saving...":"Save"}),a.jsx("button",{onClick:H,style:{padding:"1px 6px",fontSize:10,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer"},children:"Cancel"})]})]})]}),w&&a.jsx("div",{style:{padding:"4px 12px",background:w.startsWith("Save failed")?"var(--red-muted)":"var(--green-muted)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:w.startsWith("Save failed")?"var(--red)":"var(--green)"},children:w}),a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:y?a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:[a.jsx("textarea",{value:j,onChange:O=>S(O.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}}),a.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:[a.jsx("span",{style:{flex:1,fontSize:11,color:"var(--text-tertiary)"},children:"Unsaved changes"}),a.jsx("button",{onClick:M,disabled:k,style:{padding:"3px 12px",fontSize:11,background:"var(--accent)",color:"#fff",border:"none",borderRadius:4,cursor:"pointer",opacity:k?.6:1},children:k?"Saving...":"Save"}),a.jsx("button",{onClick:H,style:{padding:"3px 12px",fontSize:11,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer"},children:"Cancel"})]})]}):A==="split"&&T!=="other"?a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",borderRight:"1px solid var(--border-subtle)"},children:a.jsx(Rg,{content:F})}),a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:T==="json"?a.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:Mg(F)}}):a.jsx(Ag,{content:F,fileType:T})})]}):A==="preview"&&T!=="other"?T==="json"?a.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:Mg(F)}}):a.jsx(Ag,{content:F,fileType:T}):a.jsx(Rg,{content:F})})]})}function eE({size:n=15}){return a.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"16 18 22 12 16 6"}),a.jsx("polyline",{points:"8 6 2 12 8 18"})]})}function tE({size:n=15}){return a.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),a.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})}function nE({size:n=15}){return a.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function aE({size:n=15}){return a.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M15 4V2"}),a.jsx("path",{d:"M15 16v-2"}),a.jsx("path",{d:"M8 9h2"}),a.jsx("path",{d:"M20 9h2"}),a.jsx("path",{d:"M17.8 11.8L19 13"}),a.jsx("path",{d:"M15 9h.01"}),a.jsx("path",{d:"M17.8 6.2L19 5"}),a.jsx("path",{d:"M11 6.2L9.7 5"}),a.jsx("path",{d:"M3 21l9-9"})]})}function Nd({size:n=15}){return a.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 3l1.5 5.5L19 10l-5.5 1.5L12 17l-1.5-5.5L5 10l5.5-1.5L12 3z"})})}function rE(){const{state:n,dispatch:r,saveContent:s,isReadOnly:o}=Nn(),{plugin:c,skill:d,skillContent:f,isDirty:h,improveTarget:g,aiEditOpen:p}=n,[y,v]=x.useState("split"),[j,S]=x.useState(!1),k=x.useRef(null),[E,w]=x.useState(!1),[N,A]=x.useState(""),[z,H]=x.useState(!1),[M,F]=x.useState(null),[T,O]=x.useState([]),[C,_]=x.useState([]),[$,K]=x.useState(null),Z=x.useRef(null),{config:q}=_r(),{files:I,activeFile:L,secondaryContent:B,loading:P,error:W,selectFile:ie,refresh:D,isSkillMd:V}=Gw(c??"",d??""),[te,se]=x.useState(!1),ge=x.useCallback(ee=>{te&&!window.confirm("You have unsaved changes. Discard?")||ie(ee)},[te,ie]);x.useEffect(()=>()=>{var ee;(ee=Z.current)==null||ee.abort()},[]);const{metadata:he,body:be}=Dw(f),ce=he["allowed-tools"],je=Array.isArray(ce)?ce:typeof ce=="string"?[ce]:[],Be=he.name,ze=he.description,re=he.metadata,fe=typeof re=="object"&&!Array.isArray(re)?re:null,pe=he.version||(fe==null?void 0:fe.version),xe=he.tags||(fe==null?void 0:fe.tags),ve=Array.isArray(xe)?xe:typeof xe=="string"?xe.split(",").map(ee=>ee.trim()).filter(Boolean):[],Le=new Set(["name","description","metadata","allowed-tools","version","tags"]),De=Object.entries(he).filter(([ee])=>!Le.has(ee)),ut=x.useCallback(async()=>{S(!0),await s(),S(!1)},[s]),Bt=x.useCallback(ee=>{(ee.ctrlKey||ee.metaKey)&&ee.key==="s"&&(ee.preventDefault(),ee.stopPropagation(),h&&ut()),(ee.ctrlKey||ee.metaKey)&&ee.key==="k"&&(ee.preventDefault(),ee.stopPropagation(),r({type:p?"CLOSE_AI_EDIT":"OPEN_AI_EDIT"}))},[h,ut,p,r]),St=x.useCallback(async()=>{var Te,Pe;if(!N.trim())return;(Te=Z.current)==null||Te.abort();const ee=new AbortController;Z.current=ee,H(!0),K(null),_([]),F(null),O([]);try{const en=(q==null?void 0:q.provider)||"claude-cli",Kn=(q==null?void 0:q.model)||"sonnet",Xt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:N,provider:en,model:Kn}),signal:ee.signal});if(!Xt.ok||!Xt.body){let Nt=`HTTP ${Xt.status}`;try{const tn=await Xt.json();tn.error&&(Nt=tn.error)}catch{}throw new Error(Nt)}const We=Xt.body.getReader(),Mt=new TextDecoder;let pt="",vt="";for(;;){const{done:Nt,value:tn}=await We.read();if(Nt)break;pt+=Mt.decode(tn,{stream:!0});const Ir=pt.split(`
79
- `);pt=Ir.pop()||"";for(const Aa of Ir)if(Aa.startsWith("event: "))vt=Aa.slice(7).trim();else if(Aa.startsWith("data: ")){try{const kt=JSON.parse(Aa.slice(6));if(vt==="progress")_(Tt=>[...Tt,{phase:kt.phase,message:kt.message,timestamp:Date.now()}]);else if(vt==="done"||vt==="complete"){const Tt=["---"];kt.name&&Tt.push(`name: ${kt.name}`),kt.description&&Tt.push(`description: "${kt.description.replace(/"/g,'\\"')}"`),kt.model&&Tt.push(`model: ${kt.model}`),(Pe=kt.allowedTools)!=null&&Pe.trim()&&Tt.push(`allowed-tools: ${kt.allowedTools.trim()}`),Tt.push("---","",kt.body||"");const Tn=Tt.join(`
80
- `);F(Tn),O(Go(f,Tn)),H(!1)}else vt==="error"&&(K(kt.message||kt.description||"Generation failed"),H(!1))}catch{}vt=""}}}catch(en){en.name!=="AbortError"&&K(en.message)}finally{H(!1),Z.current=null}},[N,q,f]),Ct=x.useCallback(()=>{M&&r({type:"SET_CONTENT",content:M}),w(!1),F(null),O([]),A(""),_([])},[M,r]),It=x.useCallback(()=>{w(!1),F(null),O([]),A(""),_([]),K(null)},[]),Qe=x.useCallback(()=>{var ee;E?((ee=Z.current)==null||ee.abort(),It()):(p&&r({type:"CLOSE_AI_EDIT"}),w(!0))},[E,p,r,It]),tt=[{mode:"raw",icon:a.jsx(eE,{}),label:"Editor"},{mode:"split",icon:a.jsx(tE,{}),label:"Split"},{mode:"preview",icon:a.jsx(nE,{}),label:"Preview"}];return a.jsxs("div",{className:"flex flex-col h-full",onKeyDown:Bt,tabIndex:-1,children:[a.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:[a.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:tt.map(({mode:ee,icon:Te,label:Pe})=>a.jsxs("button",{onClick:()=>v(ee),title:Pe,className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"5px 10px",background:y===ee?"var(--surface-4)":"transparent",color:y===ee?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:y===ee?600:400,border:"none",cursor:"pointer"},children:[Te,a.jsx("span",{style:{letterSpacing:"0.01em"},children:Pe})]},ee))}),V?o?a.jsx("div",{className:"flex items-center gap-2",children:a.jsxs("span",{className:"flex items-center gap-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Read-only"]})}):a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>{p?r({type:"CLOSE_AI_EDIT"}):(E&&It(),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:[a.jsx(aE,{size:13}),a.jsx("span",{children:"AI Edit"})]}),a.jsxs("button",{onClick:Qe,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:E?600:400,border:"none",cursor:"pointer",color:E?"var(--purple)":"var(--text-tertiary)",background:E?"var(--purple-muted)":"transparent"},children:[a.jsx(Nd,{size:13}),a.jsx("span",{children:"Regenerate"})]}),a.jsx("div",{style:{width:1,height:16,background:"var(--border-subtle)"}}),h&&a.jsx("button",{onClick:()=>r({type:"SET_CONTENT",content:n.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),a.jsx("button",{onClick:ut,disabled:!h||j,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:j?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Saving..."]}):"Save"})]}):null]}),c&&d&&a.jsx(Xw,{files:I,activeFile:L,onSelect:ge,onRefresh:D}),!V&&a.jsx(Jw,{file:B,loading:P,error:W,viewMode:y,plugin:c??void 0,skill:d??void 0,onSaved:()=>{ie(L),D()},onDirtyChange:se}),V&&a.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:y==="raw"||y==="preview"?"1fr":"1fr 1fr"},children:[y!=="preview"&&a.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:y==="split"?"1px solid var(--border-subtle)":"none"},children:a.jsx("textarea",{ref:k,value:f,onChange:ee=>{o||r({type:"SET_CONTENT",content:ee.target.value})},onKeyDown:Bt,spellCheck:!1,readOnly:o,className:"flex-1 w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",fontSize:12.5,lineHeight:1.7,tabSize:2,border:"none",padding:"16px 20px",opacity:o?.7:1}})}),y!=="raw"&&a.jsx("div",{className:"overflow-auto",style:{background:"var(--surface-0)"},children:a.jsxs("div",{className:"animate-fade-in",style:{padding:"20px 24px",maxWidth:720},children:[(Be||pe||ze)&&a.jsxs("div",{style:{marginBottom:20},children:[a.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[Be&&a.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:Be}),pe&&a.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",pe]})]}),ze&&a.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:ze})]}),ve.length>0&&a.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:ve.map(ee=>a.jsx("span",{style:{fontSize:10,fontWeight:500,color:"var(--text-tertiary)",background:"var(--surface-2)",padding:"3px 8px",borderRadius:4,letterSpacing:"0.02em"},children:ee},ee))}),je.length>0&&a.jsx("div",{style:{marginBottom:16},children:a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",marginRight:4},children:"Tools"}),je.map(ee=>a.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:ee},ee))]})}),De.length>0&&a.jsx("div",{style:{marginBottom:16,padding:"8px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:De.map(([ee,Te],Pe)=>{const en=Array.isArray(Te)?Te.join(", "):typeof Te=="object"?Object.entries(Te).map(([Kn,Xt])=>`${Kn}: ${Array.isArray(Xt)?Xt.join(", "):Xt}`).join(" | "):Te;return a.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:Pe>0?"1px solid var(--border-subtle)":"none"},children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",minWidth:80,flexShrink:0},children:ee}),a.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:en})]},ee)})}),(Be||ze||ve.length>0||je.length>0||De.length>0)&&be&&a.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),be&&a.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Fo(be)}})]})})]}),V&&p&&a.jsx(Fw,{}),V&&E&&a.jsx("div",{className:"animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:a.jsxs("div",{className:"px-4 py-3",children:[!M&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Nd,{size:14}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerate Skill"})]}),a.jsx("div",{className:"flex gap-2 mb-2",children:a.jsx("textarea",{value:N,onChange:ee=>A(ee.target.value),placeholder:"Describe what this skill should do...",rows:2,disabled:z,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:z?.5:1},onKeyDown:ee=>{ee.key==="Enter"&&(ee.ctrlKey||ee.metaKey)&&N.trim()&&!z&&(ee.preventDefault(),St())}})}),a.jsxs("div",{className:"flex items-center gap-2",children:[z?a.jsx("button",{onClick:()=>{var ee;(ee=Z.current)==null||ee.abort(),H(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):a.jsx("button",{onClick:St,disabled:!N.trim(),className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:"Generate"}),a.jsx("button",{onClick:It,className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Close"})]}),z&&C.length>0&&a.jsx("div",{className:"mt-2",children:a.jsx(Ks,{entries:C,isRunning:!0})}),$&&a.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:[$,a.jsx("button",{onClick:St,className:"ml-2 underline",style:{color:"var(--red)"},children:"Retry"})]})]}),M&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Nd,{size:14}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerated — Review Changes"})]}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:"300px",overflowY:"auto"},children:T.map((ee,Te)=>a.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:ee.type==="added"?"var(--green-muted)":ee.type==="removed"?"var(--red-muted)":"transparent",color:ee.type==="added"?"var(--green)":ee.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:ee.type==="added"?"3px solid var(--green)":ee.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:ee.type==="added"?"+":ee.type==="removed"?"-":" "}),ee.content]},Te))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:Ct,className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),a.jsx("button",{onClick:It,className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Discard"})]})]})]})}),V&&g!==null&&c&&d&&a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(Bw,{plugin:c,skill:d,skillContent:f,onApplied:ee=>{r({type:"SET_CONTENT",content:ee}),r({type:"CONTENT_SAVED"}),r({type:"CLOSE_IMPROVE"})}})})]})}function kl(n){return n.testType==="integration"?"integration":"unit"}function Nl(n){return n>=.8?"var(--green)":n>=.5?"var(--yellow)":"var(--red)"}function my(n){const r=new Date(n);return r.toLocaleDateString(void 0,{month:"short",day:"numeric"})+", "+r.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function hy(n){return n==null?"--":n>=1e3?`${(n/1e3).toFixed(1)}s`:`${n}ms`}const lE=new Set(["benchmark","comparison","baseline"]);function Lg(n,r,s,o){return n.map(({rate:c,idx:d,total:f})=>{const h=o+d/(f-1)*(r-o*2),g=o+(s-o*2)-c*(s-o*2);return`${h},${g}`})}function xy({entries:n}){const r=n.filter(v=>lE.has(v.type)).slice().reverse(),s=r.map((v,j,S)=>({rate:v.pass_rate,idx:j,total:S.length})).filter((v,j)=>{const S=r[j].type;return S==="benchmark"||S==="comparison"}),o=r.flatMap((v,j)=>v.type==="baseline"?[{rate:v.pass_rate,idx:j,total:r.length}]:v.type==="comparison"&&v.baselinePassRate!=null?[{rate:v.baselinePassRate,idx:j,total:r.length}]:[]);if(s.length<2&&o.length<2)return null;const c=80,d=24,f=2,h=s.length>=2?Lg(s,c,d,f):[],g=o.length>=2?Lg(o,c,d,f):[],p=h[h.length-1],y=g[g.length-1];return a.jsxs("svg",{width:c,height:d,style:{display:"block",flexShrink:0},children:[g.length>0&&a.jsx("polyline",{points:g.join(" "),fill:"none",stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:"3 2"}),h.length>0&&a.jsx("polyline",{points:h.join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),y&&a.jsx("circle",{cx:parseFloat(y.split(",")[0]),cy:parseFloat(y.split(",")[1]),r:2.5,fill:"var(--text-tertiary)"}),p&&a.jsx("circle",{cx:parseFloat(p.split(",")[0]),cy:parseFloat(p.split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function gy(n,r,s){const o=isNaN(r)?0:r,c=[],d=[],f=[];if((n==="PASS"||n==="EFFECTIVE")&&o>=.7){const p=c.length>0?` Met criteria: ${c.map(y=>y.criterion).join(", ")}.`:"";return{explanation:`${n} (score ${o.toFixed(2)}): evaluation met expectations.${p}`}}if(n==="FAIL"||n==="DEGRADING"){const p=d.length>0?` Failed criteria: ${d.map(v=>v.criterion).join(", ")}.`:"",y=[...d.map(v=>`Improve "${v.criterion}" (score: ${v.score.toFixed(2)})`),...f.map(v=>`Strengthen "${v.criterion}" (score: ${v.score.toFixed(2)})`)];return y.length===0&&y.push("Review prompt instructions and add more specific guidance"),{explanation:`${n} (score ${o.toFixed(2)}): evaluation did not meet expectations.${p}`,recommendations:y}}if(n==="INEFFECTIVE"){if(o<.2){const y=[...d.map(v=>`Rework "${v.criterion}" — currently at ${v.score.toFixed(2)}`),"Consider adding examples to your system prompt","Review the rubric criteria for achievability"];return{explanation:`${n} (score ${o.toFixed(2)}): evaluation is significantly below expectations.`,recommendations:y}}const p=[...d.map(y=>`Rework "${y.criterion}" — currently at ${y.score.toFixed(2)}`),...f.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return p.length===0&&p.push("Consider restructuring your prompt approach"),{explanation:`${n} (score ${o.toFixed(2)}): below expectations but showing some capability.`,recommendations:p}}if(n==="MARGINAL"){const p=[...f.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`),...d.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return p.length===0&&p.push(c.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Review prompt instructions for areas of improvement"),{explanation:`${n} (score ${o.toFixed(2)}): moderate improvement detected.`,recommendations:p}}if(n==="EMERGING"){const p=[...d.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`),...f.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return p.length===0&&p.push(c.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:`${n} (score ${o.toFixed(2)}): early promise — focus on weak areas to improve.`,recommendations:p}}const h=c.length>0?` Passing: ${c.map(p=>p.criterion).join(", ")}.`:"",g=f.length>0?` Needs improvement: ${f.map(p=>p.criterion).join(", ")}.`:"";return{explanation:`${n} (score ${o.toFixed(2)}): mixed results.${h}${g}`}}const vy={EFFECTIVE:"Strong Improvement",MARGINAL:"Moderate Improvement",EMERGING:"Early Promise",INEFFECTIVE:"Needs Work",DEGRADING:"Regression"};function sE(n){return Object.hasOwn(vy,n)}function iE(n){return sE(n)?vy[n]:n}function oE(){const{state:n}=Nn(),{plugin:r,skill:s}=n,[o,c]=x.useState([]),[d,f]=x.useState([]),[h,g]=x.useState(!0),[p,y]=x.useState(null),[v,j]=x.useState(new Set),[S,k]=x.useState({}),[E,w]=x.useState(null),[N,A]=x.useState(""),[z,H]=x.useState(!1),[M,F]=x.useState(""),[T,O]=x.useState(""),C=x.useCallback(async()=>{g(!0),y(null);try{const[I,L]=await Promise.all([Ce.getCredentials(r,s),Ce.getParams(r,s)]);c(I.credentials),f(L.params)}catch(I){y(I instanceof Error?I.message:"Failed to load parameters"),c([]),f([])}finally{g(!1)}},[r,s]);x.useEffect(()=>{C()},[C]);const _=x.useCallback(async(I,L)=>{H(!0),y(null);try{await Ce.setCredential(r,s,I,L),w(null),A(""),await C()}catch(B){y(B instanceof Error?B.message:`Failed to save ${I}`)}finally{H(!1)}},[r,s,C]),$=x.useCallback(async()=>{const I=M.trim().toUpperCase(),L=T.trim();if(!(!I||!L)){H(!0),y(null);try{await Ce.setCredential(r,s,I,L),F(""),O(""),await C()}catch(B){y(B instanceof Error?B.message:`Failed to add ${I}`)}finally{H(!1)}}},[r,s,M,T,C]),K=x.useCallback(async I=>{if(v.has(I)){j(L=>{const B=new Set(L);return B.delete(I),B}),k(L=>{const B={...L};return delete B[I],B});return}try{const B=(await Ce.getParamsRevealed(r,s,I)).params.find(P=>P.name===I);B!=null&&B.value&&(k(P=>({...P,[I]:B.value})),j(P=>new Set(P).add(I)))}catch{}},[r,s,v]),Z=new Set(o.map(I=>I.name)),q=[...o.map(I=>{const L=d.find(B=>B.name===I.name);return{name:I.name,status:I.status,maskedValue:(L==null?void 0:L.maskedValue)??""}}),...d.filter(I=>!Z.has(I.name)).map(I=>({name:I.name,status:I.status,maskedValue:I.maskedValue}))];return a.jsxs("div",{className:"py-2 px-3",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters"}),p&&a.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&&a.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!h&&q.length===0&&!p&&a.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),q.map(I=>a.jsxs("div",{className:"flex items-center gap-2 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("span",{className:"text-[10px] font-mono flex-1 truncate",style:{color:"var(--text-primary)"},children:I.name}),a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:I.status==="ready"?"var(--green-muted)":"var(--red-muted)",color:I.status==="ready"?"var(--green)":"var(--red)"},children:I.status}),(I.maskedValue||I.status==="ready")&&a.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[v.has(I.name)?S[I.name]??I.maskedValue:I.maskedValue||"***",a.jsx("button",{onClick:()=>K(I.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${v.has(I.name)?"Hide":"Reveal"} value for ${I.name}`,children:v.has(I.name)?"hide":"show"})]}),E===I.name?a.jsxs("div",{className:"flex gap-1",children:[a.jsx("input",{value:N,onChange:L=>A(L.target.value),onKeyDown:L=>{L.key==="Enter"&&N.trim()&&_(I.name,N)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${I.name}`,autoFocus:!0}),a.jsx("button",{onClick:()=>_(I.name,N),disabled:z||!N.trim(),className:"text-[10px] font-medium",style:{color:"var(--green)",background:"none",border:"none",cursor:"pointer"},children:"Save"}),a.jsx("button",{onClick:()=>{w(null),A("")},className:"text-[10px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]}):a.jsx("button",{onClick:()=>{w(I.name),A("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},I.name)),a.jsxs("div",{className:"mt-3 pt-2",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[10px] font-medium mb-1.5",style:{color:"var(--text-secondary)"},children:"Add New Parameter"}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:M,onChange:I=>F(I.target.value),className:"input-field text-[10px] font-mono flex-1",placeholder:"KEY_NAME","aria-label":"Parameter key name"}),a.jsx("input",{value:T,onChange:I=>O(I.target.value),onKeyDown:I=>{I.key==="Enter"&&M.trim()&&T.trim()&&$()},className:"input-field text-[10px] font-mono flex-1",placeholder:"value",type:"password","aria-label":"Parameter value"}),a.jsx("button",{onClick:$,disabled:z||!M.trim()||!T.trim(),className:"text-[10px] font-medium px-2 py-1 rounded",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"none",cursor:z?"not-allowed":"pointer"},children:"Add"})]})]})]})}function cE(n,r,s){const[o,c]=x.useState(null),[d,f]=x.useState(!1),h=x.useRef("");x.useEffect(()=>{const p=`${n}/${r}/${s}`;h.current!==p&&(h.current=p,f(!0),Ce.getCaseHistory(n,r,s).then(y=>c(y)).catch(()=>c([])).finally(()=>f(!1)))},[n,r,s]);const g=x.useCallback(()=>{f(!0),h.current="",Ce.getCaseHistory(n,r,s).then(p=>c(p)).catch(()=>c([])).finally(()=>f(!1))},[n,r,s]);return{entries:o,loading:d,refetch:g}}function uE(n,r,s){const o={flaky:!1,nonDiscriminating:!1,regression:!1};if(!s||s.length===0)return o;const d=s.slice(0,10).map(g=>g.assertions.find(p=>p.id===n)).filter(Boolean);if(d.length>=2){const p=d.filter(y=>y.pass).length/d.length;p>=.3&&p<=.7&&(o.flaky=!0)}const f=s.find(g=>g.type==="benchmark"),h=s.find(g=>g.type==="baseline");if(f&&h){const g=f.assertions.find(y=>y.id===n),p=h.assertions.find(y=>y.id===n);g!=null&&g.pass&&(p!=null&&p.pass)&&(o.nonDiscriminating=!0)}if(r&&!r.pass&&s.length>=1){const p=s[0].assertions.find(y=>y.id===n);p!=null&&p.pass&&(o.regression=!0)}return o}function dE(){var P;const{state:n,dispatch:r,saveEvals:s,runCase:o,runAll:c,cancelCase:d,cancelAll:f,generateEvals:h,isReadOnly:g}=Nn(),{evals:p,evalsError:y,selectedCaseId:v,inlineResults:j,caseRunStates:S,generateEvalsLoading:k,generateEvalsProgress:E,generateEvalsError:w}=n,N=x.useMemo(()=>{for(const W of S.values())if(W.status==="running"||W.status==="queued")return!0;return!1},[S]),[A,z]=x.useState(!1),[H,M]=x.useState("all"),F={skill_name:n.skill,evals:[]},T=p??F,O=T.evals,C=x.useMemo(()=>H==="all"?O:O.filter(W=>kl(W)===H),[H,O]),_=C.find(W=>W.id===v)??null;x.useEffect(()=>{v!==null&&!C.find(W=>W.id===v)&&r({type:"SELECT_CASE",caseId:C.length>0?C[0].id:null})},[C,v,r]);const[$,K]=x.useState([]),Z=x.useMemo(()=>O.some(W=>kl(W)==="integration"),[O]);x.useEffect(()=>{Z&&Ce.getCredentials(n.plugin,n.skill).then(W=>K(W.credentials)).catch(()=>K([]))},[n.plugin,n.skill,Z]);const q=x.useMemo(()=>new Set($.filter(W=>W.status==="missing").map(W=>W.name)),[$]),[I,L]=x.useState(!1),B=x.useCallback(W=>{L(!1),h(W?{testType:W}:void 0)},[h]);return!p||O.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:y?"var(--red-muted)":"var(--accent-muted)"},children:y?a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),a.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}):a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M9 11l3 3L22 4"}),a.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),a.jsx("div",{className:"text-center",children:y?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--red)"},children:"Invalid evals.json"}),a.jsx("div",{className:"text-[11px] font-mono px-3 py-2 rounded mt-1 max-w-sm text-left break-words",style:{color:"var(--text-secondary)",background:"var(--surface-2)"},children:y}),a.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"})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No test cases yet"}),a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Create test cases to start evaluating your skill"})]})}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>z(!0),disabled:g,className:"btn btn-primary text-[12px]",children:"Create Test Case"}),a.jsxs("div",{style:{position:"relative"},children:[a.jsxs("div",{className:"flex",children:[a.jsx("button",{onClick:()=>B("unit"),disabled:k||g,className:"btn btn-secondary text-[12px]",style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:k?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}})," Generating..."]}):"Generate Unit Tests"}),a.jsx("button",{onClick:()=>L(!I),disabled:k||g,className:"btn btn-secondary text-[12px]",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid var(--border-default)",padding:"4px 6px"},children:a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),I&&a.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:a.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:W=>{W.currentTarget.style.background="var(--surface-2)"},onMouseLeave:W=>{W.currentTarget.style.background="transparent"},children:"Generate Integration Tests"})})]})]}),k&&E.length>0&&a.jsx("div",{className:"w-full max-w-md mt-3",children:a.jsx(Ks,{entries:E,isRunning:!0})}),w&&a.jsx("div",{className:"w-full max-w-md mt-3",children:a.jsx(Wo,{error:w,onRetry:()=>B()})}),A&&a.jsx(zg,{evals:T,onSave:W=>{s(W),z(!1)},onCancel:()=>z(!1)})]}):a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"280px 1fr",height:"100%",overflow:"hidden"},children:[a.jsxs("div",{className:"overflow-auto",style:{borderRight:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Test Cases (",C.length,")"]}),a.jsx("div",{className:"flex items-center gap-1.5",children:N?a.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"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>c("benchmark"),disabled:C.length===0||g,className:"btn btn-primary text-[10px] px-2 py-0.5",children:"Run All"}),a.jsx("button",{onClick:()=>c("comparison"),disabled:C.length===0||g,className:"btn btn-purple text-[10px] px-2 py-0.5",children:"Compare All"})]})})]}),a.jsx("div",{className:"flex px-3 py-1.5 gap-1",style:{borderBottom:"1px solid var(--border-subtle)"},children:["all","unit","integration"].map(W=>a.jsx("button",{onClick:()=>M(W),style:{padding:"2px 8px",fontSize:10,fontWeight:H===W?600:400,background:H===W?"var(--accent-muted)":"transparent",color:H===W?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:W==="all"?`All (${O.length})`:W==="unit"?`Unit (${O.filter(ie=>kl(ie)==="unit").length})`:`Integration (${O.filter(ie=>kl(ie)==="integration").length})`},W))}),a.jsxs("div",{className:"py-1",children:[C.length===0&&O.length>0&&a.jsxs("div",{className:"flex items-center justify-center py-8 px-3 text-[12px]",style:{color:"var(--text-tertiary)"},children:["No ",H==="all"?"":H+" ","tests yet"]}),C.map(W=>{var te;const ie=j.get(W.id),D=v===W.id,V=kl(W);return a.jsxs("button",{onClick:()=>r({type:"SELECT_CASE",caseId:W.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:D?"var(--accent-muted)":"transparent",borderLeft:D?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:se=>{D||(se.currentTarget.style.background="var(--surface-2)")},onMouseLeave:se=>{D||(se.currentTarget.style.background="transparent")},children:[a.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[a.jsxs("span",{className:"text-[12px] font-medium truncate flex items-center gap-1.5",style:{color:D?"var(--text-primary)":"var(--text-secondary)"},children:["#",W.id," ",W.name,a.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:9999,background:V==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:V==="unit"?"var(--accent)":"var(--orange)",whiteSpace:"nowrap"},children:V==="unit"?"U":"I"}),V==="integration"&&((te=W.requiredCredentials)==null?void 0:te.some(se=>q.has(se)))&&a.jsx("span",{title:"Configure credentials to run",children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})})]}),a.jsx(yy,{result:ie})]}),a.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[W.assertions.length," assertion",W.assertions.length!==1?"s":"",(ie==null?void 0:ie.passRate)!=null&&a.jsx(mE,{passRate:ie.passRate})]})]},W.id)})]}),a.jsx("div",{className:"px-3 py-2",children:!g&&a.jsx("button",{onClick:()=>z(!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:W=>{W.currentTarget.style.borderColor="var(--accent)",W.currentTarget.style.color="var(--accent)"},onMouseLeave:W=>{W.currentTarget.style.borderColor="var(--border-default)",W.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})}),a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(oE,{})})]}),a.jsx("div",{className:"overflow-auto",children:_?a.jsx(fE,{evalCase:_,result:j.get(_.id),evals:p,caseStatus:((P=S.get(_.id))==null?void 0:P.status)??"idle",onSaveEvals:s,onRun:W=>o(W,"benchmark"),onCompare:W=>o(W,"comparison"),onCancel:W=>d(W),onImprove:W=>r({type:"OPEN_IMPROVE",evalId:W})}):a.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"Select a test case"})}),A&&a.jsx(zg,{evals:T,onSave:W=>{s(W),z(!1)},onCancel:()=>z(!1)})]})}function fE({evalCase:n,result:r,evals:s,caseStatus:o,onSaveEvals:c,onRun:d,onCompare:f,onCancel:h,onImprove:g}){const{state:p,isReadOnly:y}=Nn(),{plugin:v,skill:j}=p,{entries:S,loading:k}=cE(v,j,n.id),[E,w]=x.useState(!1),[N,A]=x.useState(n.prompt),[z,H]=x.useState(!1),[M,F]=x.useState(n.expected_output);x.useState(()=>{A(n.prompt),F(n.expected_output)});const T=x.useCallback(W=>{c({...s,evals:s.evals.map(ie=>ie.id===W.id?W:ie)})},[s,c]),O=x.useCallback(()=>{T({...n,prompt:N}),w(!1)},[n,N,T]),C=x.useCallback(()=>{T({...n,expected_output:M}),H(!1)},[n,M,T]),_=x.useCallback(()=>{T({...n,assertions:[...n.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[n,T]),$=x.useCallback((W,ie)=>{T({...n,assertions:n.assertions.map(D=>D.id===W?{...D,text:ie}:D)})},[n,T]),K=x.useCallback(W=>{T({...n,assertions:n.assertions.filter(ie=>ie.id!==W)})},[n,T]),Z=x.useCallback(()=>{confirm("Delete this test case?")&&c({...s,evals:s.evals.filter(W=>W.id!==n.id)})},[s,n.id,c]),q=r&&r.assertions.length>0&&r.assertions.every(W=>W.pass),I=r&&r.assertions.some(W=>!W.pass),L=kl(n),B=n.requiredCredentials??[],P=L==="integration"&&B.length>0;return a.jsxs("div",{className:"p-5 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["#",n.id," ",n.name]}),y?a.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:L==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:L==="unit"?"var(--accent)":"var(--orange)"},children:L==="unit"?"Unit":"Integration"}):a.jsx("button",{onClick:()=>{if((L==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:ie,requirements:D,cleanup:V,...te}=n;T({...te,testType:"unit"})}else T({...n,testType:"integration"})},title:`Click to switch to ${L==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:L==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:L==="unit"?"var(--accent)":"var(--orange)",border:"none",cursor:"pointer"},children:L==="unit"?"Unit":"Integration"}),a.jsx(yy,{result:r})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[o==="running"||o==="queued"?a.jsxs("button",{onClick:()=>h(n.id),className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel"]}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>d(n.id),disabled:y,className:"btn btn-primary text-[12px]",children:"Run"}),a.jsx("button",{onClick:()=>f(n.id),disabled:y,className:"btn btn-purple text-[12px]",children:"A/B Compare"})]}),I&&!y&&o!=="running"&&o!=="queued"&&a.jsx("button",{onClick:()=>g(n.id),className:"btn btn-secondary text-[12px]",children:"Fix with AI"}),!y&&o!=="running"&&o!=="queued"&&a.jsx("button",{onClick:Z,className:"btn btn-ghost text-[12px]",style:{color:"var(--red)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("polyline",{points:"3 6 5 6 21 6"}),a.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})]}),y&&L==="integration"&&a.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:[a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),a.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),a.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--accent)"},children:"Run locally in vSkill Studio"})]}),q&&a.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:[a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",children:[a.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),a.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--green)"},children:"All assertions passing"})]}),P&&a.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--orange)"},children:"Required Credentials"})]}),a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:"This integration test requires the following environment variables:"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:B.map(W=>a.jsx("span",{style:{fontSize:10,fontFamily:"var(--font-mono, monospace)",padding:"2px 6px",borderRadius:4,background:"var(--orange-muted)",color:"var(--orange)"},children:W},W))})]}),!y&&L==="integration"&&a.jsx(gE,{evalCase:n,onUpdate:T}),a.jsx(mo,{title:"Prompt",children:E?a.jsxs("div",{children:[a.jsx("textarea",{value:N,onChange:W=>A(W.target.value),className:"input-field w-full",rows:4,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),a.jsxs("div",{className:"flex gap-2 mt-2",children:[a.jsx("button",{onClick:O,className:"btn btn-primary text-[12px]",children:"Save"}),a.jsx("button",{onClick:()=>{A(n.prompt),w(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):a.jsx("div",{className:"p-3 rounded-lg text-[12px] transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-secondary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)",maxHeight:200,overflowY:"auto",cursor:y?"default":"pointer"},onClick:()=>{y||w(!0)},onMouseEnter:W=>{y||(W.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:W=>{W.currentTarget.style.borderColor="var(--border-subtle)"},children:n.prompt||a.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:y?"No prompt":"Click to edit prompt..."})})}),a.jsx(mo,{title:"Expected Output",children:z?a.jsxs("div",{children:[a.jsx("textarea",{value:M,onChange:W=>F(W.target.value),className:"input-field w-full",rows:3,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),a.jsxs("div",{className:"flex gap-2 mt-2",children:[a.jsx("button",{onClick:C,className:"btn btn-primary text-[12px]",children:"Save"}),a.jsx("button",{onClick:()=>{F(n.expected_output),H(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):a.jsx("div",{className:"p-3 rounded-lg text-[12px] transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)",maxHeight:200,overflowY:"auto",cursor:y?"default":"pointer"},onClick:()=>{y||H(!0)},onMouseEnter:W=>{y||(W.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:W=>{W.currentTarget.style.borderColor="var(--border-subtle)"},children:n.expected_output||a.jsx("span",{style:{fontStyle:"italic"},children:y?"No expected output":"Click to edit expected output..."})})}),a.jsx(mo,{title:`Assertions (${n.assertions.length})`,action:y?void 0:a.jsx("button",{onClick:_,className:"btn btn-ghost text-[11px]",children:"+ Add"}),children:n.assertions.length===0?a.jsx("div",{className:"text-[12px] text-center py-4",style:{color:"var(--text-tertiary)"},children:'No assertions. Click "+ Add" to create one.'}):a.jsx("div",{className:"space-y-2",children:n.assertions.map(W=>{const ie=r==null?void 0:r.assertions.find(V=>V.assertion_id===W.id),D=uE(W.id,ie,S);return a.jsx(pE,{assertion:W,result:ie,badges:D,isReadOnly:y,onUpdate:V=>$(W.id,V),onDelete:()=>K(W.id)},W.id)})})}),(r==null?void 0:r.output)&&a.jsx(hE,{output:r.output,durationMs:r.durationMs,tokens:r.tokens}),r&&r.passRate!=null&&r.passRate<.2&&(()=>{const W=gy("INEFFECTIVE",r.passRate);return W.recommendations&&W.recommendations.length>0?a.jsx(mo,{title:"Recommendations",children:a.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),a.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--orange)"},children:"This eval is significantly below expectations"})]}),a.jsx("ul",{className:"space-y-1.5 ml-1",children:W.recommendations.map((ie,D)=>a.jsxs("li",{className:"flex items-start gap-2 text-[12px]",style:{color:"var(--text-secondary)"},children:[a.jsx("span",{style:{color:"var(--orange)",fontWeight:600,flexShrink:0},children:"•"}),ie]},D))})]})}):null})(),a.jsx(xE,{evalId:n.id,sharedEntries:S,sharedLoading:k})]},n.id)}function pE({assertion:n,result:r,badges:s,isReadOnly:o,onUpdate:c,onDelete:d}){const[f,h]=x.useState(!1),[g,p]=x.useState(n.text),[y,v]=x.useState(!1),j=()=>{c(g),h(!1)};return a.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:a.jsxs("div",{className:"flex items-start gap-2",children:[r?a.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?a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):a.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"}),(s==null?void 0:s.regression)&&a.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:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("polyline",{points:"19 12 12 19 5 12"})]})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:"text-[10px] font-mono font-semibold",style:{color:"var(--text-tertiary)"},children:n.id}),(s==null?void 0:s.flaky)&&a.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"}),(s==null?void 0:s.nonDiscriminating)&&a.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?a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{value:g,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}),a.jsx("button",{onClick:j,className:"btn btn-primary text-[11px]",children:"Save"})]}):a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-secondary)",cursor:o?"default":"pointer"},onClick:()=>{o||(p(n.text),h(!0))},children:n.text}),(r==null?void 0:r.reasoning)&&a.jsx("button",{onClick:()=>v(!y),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:y?"Hide reasoning":"Show reasoning"}),y&&(r==null?void 0:r.reasoning)&&a.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:r.reasoning})]}),!o&&a.jsx("button",{onClick:d,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:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})}function mo({title:n,action:r,children:s}){return a.jsxs("div",{className:"mb-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:n}),r]}),s]})}function yy({result:n}){const[r,s]=x.useState(!1);if(!n||n.status==null)return a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"--"});const o=n.status==="pass",c=n.passRate??0,f=gy(o?"PASS":"FAIL",c);return a.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:()=>s(!0),onMouseLeave:()=>s(!1),"aria-describedby":r?"verdict-tooltip":void 0,children:[n.passRate!=null?`${Math.round(n.passRate*100)}%`:n.status,r&&a.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 mE({passRate:n}){const r=Math.round(n*100);return a.jsx("div",{className:"flex items-center gap-1",children:a.jsx("div",{className:"rounded-full overflow-hidden",style:{width:32,height:4,background:"var(--surface-4)"},children:a.jsx("div",{className:"h-full rounded-full",style:{width:`${r}%`,background:r>=80?"var(--green)":r>=50?"var(--yellow)":"var(--red)"}})})})}function hE({output:n,durationMs:r,tokens:s}){const[o,c]=x.useState(!1);return a.jsxs("div",{className:"mb-5",children:[a.jsxs("button",{onClick:()=>c(!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:[a.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:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),"LLM Output",r!=null&&a.jsxs("span",{style:{fontWeight:400},children:["(",(r/1e3).toFixed(1),"s)"]}),s!=null&&a.jsxs("span",{style:{fontWeight:400},children:["(",s," tokens)"]})]}),o&&a.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:n})]})}function Td(n){return n==="baseline"?"right":n==="comparison"?"full":"left"}function Rd({entry:n}){return a.jsxs("div",{className:"rounded-lg px-3 py-2.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:my(n.timestamp)}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:n.model}),a.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:n.type==="benchmark"?"var(--accent-muted)":n.type==="comparison"?"var(--purple-muted)":"var(--orange-muted)",color:n.type==="benchmark"?"var(--accent)":n.type==="comparison"?"var(--purple)":"var(--orange)"},children:n.type}),a.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:Nl(n.pass_rate)},children:[Math.round(n.pass_rate*100),"%"]})]}),a.jsxs("div",{className:"flex items-center gap-4 mb-1.5 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[n.durationMs!=null&&a.jsx("span",{children:hy(n.durationMs)}),n.tokens!=null&&a.jsxs("span",{children:[n.tokens>=1e3?`${(n.tokens/1e3).toFixed(1)}k`:n.tokens," tok"]})]}),n.type==="comparison"&&n.baselinePassRate!=null&&(()=>{const r=n.pass_rate-n.baselinePassRate,s=r>.001?"skill":r<-.001?"baseline":"tie",o=r>0?"+":"",c=s==="skill"?"var(--green)":s==="baseline"?"var(--red)":"var(--text-tertiary)";return a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"vs baseline:"}),a.jsxs("span",{className:"text-[11px] font-semibold",style:{color:r>=0?"var(--green)":"var(--red)"},children:[o,(r*100).toFixed(1),"%"]}),a.jsx("span",{className:"pill text-[9px]",style:{padding:"1px 5px",background:"var(--surface-3)",color:c},children:s})]})})(),a.jsx("div",{className:"space-y-0.5",children:n.assertions.map(r=>a.jsxs("div",{className:"flex items-start gap-1.5",children:[a.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?a.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:r.text})]},r.id))})]})}function xE({evalId:n,sharedEntries:r,sharedLoading:s}){const{state:o,dispatch:c}=Nn(),{plugin:d,skill:f}=o,[h,g]=x.useState(!0),p=r??null,y=s??!1,v=x.useCallback(()=>{g(E=>!E)},[]),j=p?p.slice(0,10):[],S=j.some(E=>{const w=Td(E.type);return w==="left"||w==="full"}),k=j.some(E=>{const w=Td(E.type);return w==="right"||w==="full"});return a.jsxs("div",{className:"mb-5",children:[a.jsxs("button",{onClick:v,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:[a.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:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Execution History",p&&p.length>0&&a.jsxs("span",{style:{fontWeight:400},children:["(",p.length," run",p.length!==1?"s":"",")"]})]}),h&&a.jsx("div",{className:"animate-fade-in",children:y?a.jsxs("div",{className:"flex items-center gap-2 py-3",children:[a.jsx("div",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),a.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):!p||p.length===0?a.jsx("div",{className:"text-[12px] py-3",style:{color:"var(--text-tertiary)"},children:"No history for this case"}):a.jsxs("div",{children:[j.length>=2&&a.jsx("div",{className:"mb-2",children:a.jsx(xy,{entries:j})}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"1"},children:"Skill"}),a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"2"},children:"Baseline"}),!S&&a.jsx("div",{style:{gridColumn:"1",fontSize:12,color:"var(--text-tertiary)"},children:"No skill runs"}),!k&&a.jsx("div",{style:{gridColumn:"2",fontSize:12,color:"var(--text-tertiary)"},children:"No baseline runs"}),j.map((E,w)=>{const N=Td(E.type);return N==="full"?a.jsx("div",{style:{gridColumn:"1 / -1"},children:a.jsx(Rd,{entry:E})},w):N==="left"?a.jsxs(x.Fragment,{children:[a.jsx("div",{style:{gridColumn:"1"},children:a.jsx(Rd,{entry:E})}),a.jsx("div",{style:{gridColumn:"2"}})]},w):a.jsxs(x.Fragment,{children:[a.jsx("div",{style:{gridColumn:"1"}}),a.jsx("div",{style:{gridColumn:"2"},children:a.jsx(Rd,{entry:E})})]},w)})]}),a.jsx("button",{onClick:()=>c({type:"SET_PANEL",panel:"history"}),className:"mt-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--accent)"},onMouseEnter:E=>{E.currentTarget.style.textDecoration="underline"},onMouseLeave:E=>{E.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function zg({evals:n,onSave:r,onCancel:s}){const[o,c]=x.useState(""),[d,f]=x.useState(""),[h,g]=x.useState(""),[p,y]=x.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[v,j]=x.useState("unit"),[S,k]=x.useState(""),[E,w]=x.useState([]),[N,A]=x.useState(""),[z,H]=x.useState(""),M=Math.max(0,...n.evals.map(C=>C.id))+1,F=C=>{j(C),C==="unit"&&(w([]),k(""),A(""),H(""))},T=()=>{const C=S.trim().toUpperCase();C&&!E.includes(C)&&w([...E,C]),k("")},O=()=>{if(!o.trim()||!d.trim())return;const C={id:M,name:o.trim(),prompt:d.trim(),expected_output:h.trim(),files:[],assertions:p.filter(_=>_.text.trim()),...v==="integration"?{testType:"integration",...E.length>0?{requiredCredentials:E}:{},...N||z?{requirements:{...N?{platform:N}:{},...z?{chromeProfile:z}:{}}}:{}}:{}};r({...n,evals:[...n.evals,C]})};return a.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:a.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:[a.jsx("div",{className:"text-[15px] font-semibold mb-4",style:{color:"var(--text-primary)"},children:"New Test Case"}),a.jsxs("div",{className:"mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1.5 block",style:{color:"var(--text-tertiary)"},children:"Type"}),a.jsx("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)",display:"inline-flex"},children:["unit","integration"].map(C=>a.jsx("button",{onClick:()=>F(C),className:"px-3 py-1 rounded-md text-[12px] font-medium transition-all duration-150",style:{background:v===C?C==="unit"?"var(--accent-muted)":"var(--orange-muted)":"transparent",color:v===C?C==="unit"?"var(--accent)":"var(--orange)":"var(--text-tertiary)",border:"none",cursor:"pointer",textTransform:"capitalize"},children:C},C))})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Name"}),a.jsx("input",{value:o,onChange:C=>c(C.target.value),className:"input-field",placeholder:"e.g., auth-check",autoFocus:!0})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Prompt"}),a.jsx("textarea",{value:d,onChange:C=>f(C.target.value),className:"input-field",rows:3,placeholder:"User prompt to test..."})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Expected Output"}),a.jsx("textarea",{value:h,onChange:C=>g(C.target.value),className:"input-field",rows:2,placeholder:"Description of expected behavior..."})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Assertions"}),p.map((C,_)=>a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx("input",{value:C.text,onChange:$=>y(p.map((K,Z)=>Z===_?{...K,text:$.target.value}:K)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),p.length>1&&a.jsx("button",{onClick:()=>y(p.filter(($,K)=>K!==_)),className:"btn btn-ghost p-1",style:{color:"var(--text-tertiary)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},C.id)),a.jsx("button",{onClick:()=>y([...p,{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--accent)"},children:"+ Add Assertion"})]}),v==="integration"&&a.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},children:"Integration Settings"}),a.jsxs("div",{className:"mb-3",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:E.map(C=>a.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:[C,a.jsx("button",{onClick:()=>w(E.filter(_=>_!==C)),style:{color:"var(--orange)",lineHeight:1},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},C))}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:S,onChange:C=>k(C.target.value),onKeyDown:C=>{C.key==="Enter"&&(C.preventDefault(),T())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., SLACK_BOT_TOKEN"}),a.jsx("button",{onClick:T,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),a.jsx("input",{value:N,onChange:C=>A(C.target.value),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),a.jsx("input",{value:z,onChange:C=>H(C.target.value),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{onClick:s,className:"btn btn-secondary text-[12px]",children:"Cancel"}),a.jsx("button",{onClick:O,disabled:!o.trim()||!d.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function gE({evalCase:n,onUpdate:r}){var f,h;const[s,o]=x.useState(""),c=()=>{const g=s.trim().toUpperCase();g&&!(n.requiredCredentials??[]).includes(g)&&r({...n,requiredCredentials:[...n.requiredCredentials??[],g]}),o("")},d=g=>{const p=(n.requiredCredentials??[]).filter(y=>y!==g);r({...n,requiredCredentials:p.length>0?p:void 0})};return a.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},children:"Integration Settings"}),a.jsxs("div",{className:"mb-2.5",children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:(n.requiredCredentials??[]).map(g=>a.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:[g,a.jsx("button",{onClick:()=>d(g),style:{color:"var(--orange)",lineHeight:1},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g))}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:s,onChange:g=>o(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),c())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., GITHUB_TOKEN"}),a.jsx("button",{onClick:c,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),a.jsxs("div",{className:"mb-2.5",children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),a.jsx("input",{value:((f=n.requirements)==null?void 0:f.platform)??"",onChange:g=>r({...n,requirements:{...n.requirements,platform:g.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),a.jsx("input",{value:((h=n.requirements)==null?void 0:h.chromeProfile)??"",onChange:g=>r({...n,requirements:{...n.requirements,chromeProfile:g.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]})}function Cn(n,r){return r==="free"?"Free":r==="subscription"&&n==null?"Subscription":n==null?"N/A":n>=1?`$${n.toFixed(2)}`:n===0?"$0.00":n>=.001?`$${n.toFixed(4)}`:`$${n.toPrecision(3).replace(/0+$/,"").replace(/\.$/,"")}`}function by(n,r){return n==null||r==null?"N/A":`${n.toLocaleString("en-US")} in / ${r.toLocaleString("en-US")} out`}function vE(n){return n==="baseline"?"Baseline Pass Rate":"Skill Pass Rate"}function yE(n,r){let s="";if(r){const c=new Date(r);isNaN(c.getTime())||(s=c.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}))}return[n,s].filter(Boolean).join(" · ")}function bE(n,r,s){const o=s===1?"test case":"test cases";if(n===0)return`Your skill performs the same as the baseline across ${s} ${o}`;const c=Math.round(Math.abs(n)*r);if(c===0)return`Your skill performs the same as the baseline across ${s} ${o}`;const d=n>0?"more":"fewer";return`Your skill passes ${c} ${d} assertions across ${s} ${o}`}function Dg(n,r){const s=o=>{const c=o/5*100;return isFinite(c)?Math.round(Math.min(100,Math.max(0,c))):0};return{skill:s(n),baseline:s(r)}}function jE(n){return n==="skill"?{text:"Skill wins",isSkill:!0}:n==="baseline"?{text:"Baseline wins",isSkill:!1}:{text:"Tie",isSkill:!1}}function SE(n,r){const s=n+r,o=s*10,c=s*25,d=f=>f>=60?`${Math.round(f/60)}m`:`${f}s`;return`${d(o)}–${d(c)}`}const kE={anthropic:.01,openrouter:.01,ollama:0,"lm-studio":0,"claude-cli":0,"codex-cli":0,"gemini-cli":0};function wE(n,r){if(!n)return null;const s=kE[n];if(s==null||s===0)return null;const o=s*r*.5,c=s*r*2;return`${Cn(o)}–${Cn(c)}`}function EE(){const{state:n,runCase:r,runAll:s,cancelCase:o,cancelAll:c,isReadOnly:d}=Nn(),{evals:f,caseRunStates:h,bulkRunActive:g,latestBenchmark:p,inlineResults:y}=n,{config:v}=_r(),j=(f==null?void 0:f.evals)??[],S=x.useMemo(()=>{for(const T of h.values())if(T.status==="running"||T.status==="queued")return!0;return!1},[h]),k=j.filter(T=>{const O=h.get(T.id);return O&&(O.status==="complete"||O.status==="error"||O.status==="cancelled")}).length,E=j.filter(T=>{const O=h.get(T.id);return O&&(O.status==="running"||O.status==="queued")}).length,w=x.useRef(null),[N,A]=x.useState(0);x.useEffect(()=>{if(S&&!w.current&&(w.current=Date.now()),!S){w.current=null,A(0);return}const T=setInterval(()=>{w.current&&A(Math.round((Date.now()-w.current)/1e3))},1e3);return()=>clearInterval(T)},[S]);const z=j.reduce((T,O)=>T+O.assertions.length,0),H=j.length+z,M=x.useMemo(()=>SE(j.length,z),[j.length,z]),F=x.useMemo(()=>wE((v==null?void 0:v.provider)??null,H),[v==null?void 0:v.provider,H]);return a.jsxs("div",{className:"p-5",children:[d&&a.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:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Installed skill — benchmarking is disabled. Edit the source skill to run benchmarks."]}),a.jsxs("div",{className:"rounded-xl p-4 mb-5",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Benchmark"}),S&&a.jsxs("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:[E," running"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[S&&a.jsxs("button",{onClick:c,className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel All"]}),a.jsx("button",{onClick:()=>s("comparison"),disabled:j.length===0||S||d,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"}),a.jsx("button",{onClick:()=>s("benchmark"),disabled:j.length===0||S||d,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using your skill only",children:"Test Skill"}),a.jsx("button",{onClick:()=>s("baseline"),disabled:j.length===0||S||d,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using the baseline (no skill) for reference",children:"Test Baseline"})]}),!S&&j.length>0&&a.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[10px]",style:{color:"var(--text-tertiary)"},children:[a.jsxs("span",{children:["Est. duration: ",M]}),F&&a.jsxs("span",{children:["Est. cost: ",F]}),!F&&(v==null?void 0:v.provider)&&(v.provider==="claude-cli"||v.provider==="codex-cli")&&a.jsx("span",{children:"Cost: Subscription"}),!F&&(v==null?void 0:v.provider)&&(v.provider==="ollama"||v.provider==="lm-studio"||v.provider==="gemini-cli")&&a.jsx("span",{children:"Cost: Free"})]})]}),S&&j.length>0&&a.jsxs("div",{className:"mb-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("span",{className:"text-[12px] font-medium",style:{color:"var(--text-secondary)"},children:["Progress: ",k,"/",j.length," cases"]}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(k/j.length*100),"%"]})]}),a.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${k/j.length*100}%`,background:"var(--accent)"}})}),a.jsxs("div",{className:"flex items-center justify-between mt-1.5",children:[a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Elapsed: ",N>=60?`${Math.floor(N/60)}m ${N%60}s`:`${N}s`]}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Est. total: ",M]})]})]}),a.jsx("div",{className:"space-y-3 stagger-children",children:j.map(T=>{const O=y.get(T.id),C=h.get(T.id),_=(C==null?void 0:C.status)??"idle",$=p==null?void 0:p.cases.find(K=>K.eval_id===T.id);return a.jsx(NE,{name:T.name,evalId:T.id,result:O,caseCost:$==null?void 0:$.cost,caseBillingMode:$==null?void 0:$.billingMode,caseInputTokens:$==null?void 0:$.inputTokens,caseOutputTokens:$==null?void 0:$.outputTokens,caseStatus:_,runMode:(C==null?void 0:C.mode)??null,comparisonDetail:$==null?void 0:$.comparisonDetail,isReadOnly:d,onRun:K=>r(K,"benchmark"),onBaseline:K=>r(K,"baseline"),onCompare:K=>r(K,"comparison"),onCancel:K=>o(K)},T.id)})}),!S&&p&&p.cases.length>0&&a.jsxs("div",{className:"mt-5",children:[a.jsxs("div",{className:"rounded-xl p-4 mb-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:vE(p.type)}),a.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&&a.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: ${by(p.totalInputTokens,p.totalOutputTokens)}`,p.totalCost!=null&&` | Cost: ${Cn(p.totalCost)}`]}),p.overall_pass_rate>=.9999&&!p.comparison&&a.jsx("button",{onClick:()=>s("comparison"),disabled:j.length===0||d,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&&a.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Skill vs Baseline"}),(()=>{const T=yE(p.model,p.timestamp);return T?a.jsx("div",{className:"text-[10px] mt-0.5 mb-3",style:{color:"var(--text-tertiary)"},children:T}):a.jsx("div",{className:"mb-3"})})(),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(_g,{label:"Skill",value:p.comparison.skillPassRate,color:"var(--accent)"}),a.jsx(_g,{label:"Baseline",value:p.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),a.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&&` | ${iE(p.verdict)}`]}),(()=>{const T=p.cases.reduce((C,_)=>C+_.assertions.length,0),O=bE(p.comparison.delta,T,p.cases.length);return a.jsx("div",{className:"mt-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:O})})()]})]})]})}const CE={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 NE({name:n,evalId:r,result:s,caseCost:o,caseBillingMode:c,caseInputTokens:d,caseOutputTokens:f,caseStatus:h,runMode:g,comparisonDetail:p,isReadOnly:y,onRun:v,onBaseline:j,onCompare:S,onCancel:k}){const[E,w]=x.useState(!1),N=h==="running"||h==="queued",A=h==="complete"||h==="error";return a.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:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[h==="running"&&a.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),h==="queued"&&a.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--text-tertiary)"},children:"queued"}),a.jsxs("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:["#",r," ",n]}),g&&(N||A)&&(()=>{const z=CE[g];return z?a.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:z.bg,color:z.color,padding:"1px 6px"},children:z.label}):null})()]}),a.jsxs("div",{className:"flex items-center gap-2",children:[N?a.jsx("button",{onClick:()=>k(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"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>S(r),disabled:y,className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),a.jsx("button",{onClick:()=>v(r),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),a.jsx("button",{onClick:()=>j(r),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Base"})]}),s&&s.status!=null&&a.jsx("span",{className:"pill text-[10px]",style:{background:s.status==="pass"?"var(--green-muted)":"var(--red-muted)",color:s.status==="pass"?"var(--green)":"var(--red)"},children:s.passRate!=null?`${Math.round(s.passRate*100)}%`:s.status}),d!=null&&f!=null&&a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:by(d,f)}),o!=null&&a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:Cn(o,c)}),h==="cancelled"&&a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"cancelled"})]})]}),s&&s.assertions.length>0&&a.jsxs("div",{className:"px-4 pb-3",children:[a.jsx("div",{className:"space-y-1",children:s.assertions.map(z=>a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsx("span",{style:{color:z.pass?"var(--green)":"var(--red)"},children:z.pass?"PASS":"FAIL"}),a.jsx("span",{style:{color:"var(--text-secondary)"},children:z.text})]},z.assertion_id))}),s.output&&a.jsx("button",{onClick:()=>w(!E),className:"text-[11px] mt-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:E?"Hide output":"Show output"}),E&&s.output&&a.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:s.output})]}),p&&a.jsx("div",{className:"px-4 pb-3",children:a.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:a.jsx("div",{className:"flex items-center gap-4 text-[11px] flex-wrap",children:(()=>{const z=Dg(p.skillContentScore,p.baselineContentScore),H=Dg(p.skillStructureScore,p.baselineStructureScore),M=jE(p.winner);return a.jsxs(a.Fragment,{children:[a.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Content: Skill ",z.skill,"% / Baseline ",z.baseline,"%"]}),a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),a.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Structure: Skill ",H.skill,"% / Baseline ",H.baseline,"%"]}),a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),a.jsx("span",{style:{color:M.isSkill?"var(--accent)":"var(--text-tertiary)",fontWeight:500},children:M.text})]})})()})})}),s&&s.errorMessage&&a.jsx(TE,{errorMessage:s.errorMessage,classifiedError:s.classifiedError})]})}const Ad={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function TE({errorMessage:n,classifiedError:r}){const[s,o]=x.useState(!1),c=(r==null?void 0:r.title)??"Error",d=r==null?void 0:r.hint,f=r?Ad[r.category]??Ad.unknown:Ad.unknown;return a.jsx("div",{className:"px-4 pb-3",children:a.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:"var(--red-muted)",border:"1px solid var(--red-muted)"},children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[a.jsx("span",{style:{fontSize:12},children:f}),a.jsx("span",{className:"text-[11.5px] font-semibold flex-1",style:{color:"var(--red)"},children:c}),a.jsx("button",{onClick:()=>o(!s),className:"text-[10px] px-1.5 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},children:s?"Hide details":"Details"})]}),d&&a.jsx("div",{className:"px-3 pb-2 text-[10.5px]",style:{color:"var(--text-secondary)"},children:d}),s&&a.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:n})]})})}function _g({label:n,value:r,color:s}){return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:n}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:s},children:[Math.round(r*100),"%"]})]}),a.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${r*100}%`,background:s}})})]})}const Og={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 RE(){var B;const{state:n,dispatch:r,runActivationTest:s,cancelActivation:o,generateActivationPrompts:c}=Nn(),{plugin:d,skill:f,activationPrompts:h,activationResults:g,activationSummary:p,activationRunning:y,activationError:v,activationStartedAt:j,activationClassifyingStatus:S,generatingPrompts:k,generatingPromptsError:E,activationHistory:w}=n,{state:N}=sa(),A=((B=N.skills.find(P=>P.plugin===d&&P.skill===f))==null?void 0:B.version)??null,[z,H]=x.useState(h),[M,F]=x.useState(null),[T,O]=x.useState(!1);x.useEffect(()=>{h&&h!==z&&H(h)},[h]),x.useEffect(()=>{r({type:"SET_ACTIVATION_PROMPTS",prompts:z})},[z,r]),x.useEffect(()=>{fetch(`/api/skills/${d}/${f}/description`).then(P=>P.json()).then(P=>F(P.rawContent||P.description||null)).catch(()=>F(null))},[d,f]);function C(){s(z)}function _(){c(8)}const $=z.trim().split(`
81
- `).filter(Boolean).length,K=g.filter(P=>P.classification==="TP"||P.classification==="TN"),Z=g.filter(P=>P.classification==="FP"||P.classification==="FN"),q=(M==null?void 0:M.replace(/^---[\s\S]*?---\s*/,"").trim())??null,I=z.trim().length>0,L=q?Fo(q):"";return a.jsxs("div",{className:"p-5 space-y-5",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Activation Test"}),a.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."})]}),a.jsxs("div",{className:"grid grid-cols-[3fr_2fr] gap-4 items-stretch",children:[a.jsxs("div",{className:"glass-card p-4 flex flex-col gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Test Prompts"}),a.jsx("div",{className:"flex gap-1.5",children:a.jsx("button",{onClick:_,disabled:k||!q||y,className:"text-[10px] px-2.5 py-1 rounded-md transition-colors duration-150 flex items-center gap-1.5",style:{background:k?"var(--surface-3)":"var(--surface-2)",color:q?"var(--accent)":"var(--text-tertiary)",border:"1px solid var(--border-subtle)",opacity:q?1:.5,cursor:q?"pointer":"not-allowed"},title:q?void 0:"No skill description available",onMouseEnter:P=>{q&&!k&&(P.currentTarget.style.background="var(--surface-3)")},onMouseLeave:P=>{k||(P.currentTarget.style.background="var(--surface-2)")},children:k?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"spinner",style:{borderTopColor:"var(--accent)",borderColor:"var(--border-subtle)",width:10,height:10}}),"Generating..."]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.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"})}),I?"Regenerate":"Generate"," Test Prompts"]})})})]}),!q&&!y&&a.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."}),E&&a.jsx("div",{className:"text-[11px] px-2 py-1 rounded",style:{color:"var(--red)",background:"var(--red-muted)"},children:E}),a.jsx("textarea",{className:"input-field resize-y font-mono text-[12px]",style:{minHeight:140,height:140},value:z,onChange:P=>H(P.target.value),placeholder:`How do I write a unit test?
82
- What edge cases should I test?
83
- +Deploy this to production
84
- !What's the weather like today?
85
- !Write me a poem about flowers`}),a.jsxs("div",{className:"flex items-center flex-wrap gap-x-3 gap-y-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsx("span",{children:"One prompt per line"}),a.jsx(ho,{}),a.jsx("span",{children:"No prefix = auto-classify"}),a.jsx(ho,{}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"+"}),"= must activate"]}),a.jsx(ho,{}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"!"}),"= must NOT activate"]}),a.jsx(ho,{}),a.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[$," prompt",$!==1?"s":""]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:C,disabled:y||!z.trim(),className:"btn btn-primary",children:y?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"spinner",style:{borderTopColor:"var(--color-paper)",borderColor:"var(--border-default)",width:14,height:14}}),"Testing..."]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("circle",{cx:"12",cy:"12",r:"6"}),a.jsx("circle",{cx:"12",cy:"12",r:"2"})]}),"Run Activation Test"]})}),y&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:o,className:"btn btn-secondary text-[12px]",children:"Cancel"}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[S||`${g.length} / ${$} prompts tested`,j&&a.jsx(zE,{startedAt:j})]})]})]})]}),a.jsxs("div",{className:"glass-card flex flex-col overflow-hidden",children:[a.jsx("div",{className:"px-4 pt-3.5 pb-2.5 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Skill Description"})}),a.jsx("div",{className:"flex-1 overflow-auto px-4 py-3",style:{minHeight:0},children:q?a.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:L}}):a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No description available"})})]})]}),v&&a.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:v}),y&&g.length===0&&a.jsxs("div",{className:"text-center py-12 animate-fade-in",children:[a.jsx("div",{className:"spinner-lg mx-auto mb-4"}),a.jsx("p",{className:"text-[14px]",style:{color:"var(--text-secondary)"},children:"Testing activation against skill description..."})]}),g.length>0&&a.jsxs("div",{className:"space-y-5",children:[Z.length>0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),a.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--red)"},children:["Incorrect (",Z.length,")"]}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"— These need attention"})]}),a.jsx("div",{className:"space-y-1.5 stagger-children",children:Z.map((P,W)=>a.jsx(Bg,{result:P},`incorrect-${W}`))})]}),K.length>0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("polyline",{points:"16 10 11 15 8 12"})]}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--green)"},children:["Correct (",K.length,")"]})]}),a.jsx("div",{className:"space-y-1.5 stagger-children",children:K.map((P,W)=>a.jsx(Bg,{result:P},`correct-${W}`))})]})]}),p&&a.jsxs("div",{className:"glass-card p-6 animate-fade-in-scale",style:{borderColor:"var(--border-active)",borderWidth:2},children:[a.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&&a.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"]}),a.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[a.jsx(Md,{label:"Precision",value:p.precision,description:"Of all activations, how many were correct?",detail:`${p.tp} true / ${p.tp+p.fp} total activations`}),a.jsx(Md,{label:"Recall",value:p.recall,description:"Of expected activations, how many fired?",detail:`${p.tp} activated / ${p.tp+p.fn} expected`}),a.jsx(Md,{label:"Reliability",value:p.reliability,description:"Overall correct classification rate",detail:`${p.tp+p.tn} correct / ${p.total} total`})]}),a.jsxs("div",{className:"pt-4",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-3 text-center",style:{color:"var(--text-tertiary)"},children:"Confusion Matrix"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 max-w-xs mx-auto",children:[a.jsx(xo,{label:"True Positive",abbr:"TP",count:p.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),a.jsx(xo,{label:"False Positive",abbr:"FP",count:p.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),a.jsx(xo,{label:"False Negative",abbr:"FN",count:p.fn,bg:"var(--red-muted)",color:"var(--red)",description:"Missed activation"}),a.jsx(xo,{label:"True Negative",abbr:"TN",count:p.tn,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly silent"})]})]})]}),a.jsx(AE,{history:w,expanded:T,onToggle:()=>O(!T),skillVersion:A})]})}function AE({history:n,expanded:r,onToggle:s,skillVersion:o}){return n===null?null:a.jsxs("div",{className:"glass-card overflow-hidden",children:[a.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:s,children:[a.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:["Test History",n.length>0&&a.jsxs("span",{className:"ml-2 font-normal",style:{color:"var(--text-tertiary)"},children:["(",n.length," run",n.length!==1?"s":"",")"]})]}),a.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:a.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),r&&a.jsx("div",{className:"px-4 py-3",children:n.length===0?a.jsx("div",{className:"text-[12px] py-4 text-center",style:{color:"var(--text-tertiary)"},children:"No test runs yet"}):a.jsx("div",{className:"space-y-2",children:n.map(c=>a.jsx(ME,{run:c,skillVersion:o},c.id))})})]})}function ME({run:n,skillVersion:r}){const s=Math.round(n.summary.reliability*100),o=s>=80?"var(--green)":s>=60?"var(--yellow)":"var(--red)",c=s>=80?"Good":s>=60?"Needs Work":"Poor",d=o;return a.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{background:"var(--surface-1)"},children:[a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:LE(n.timestamp)}),a.jsx(qs,{version:r??null,size:"sm","data-testid":"activation-row-version"}),a.jsx("span",{className:"pill text-[9px] px-1.5",style:{background:"var(--surface-2)",color:"var(--text-tertiary)"},children:n.model||n.provider}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[n.promptCount," prompts"]})]})}),a.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:o,fontVariantNumeric:"tabular-nums"},children:[s,"%"]}),a.jsx("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded",style:{color:d,background:`color-mix(in srgb, ${d} 10%, transparent)`},children:c})]})]})}function LE(n){const r=Date.now(),s=new Date(n).getTime(),o=Math.floor((r-s)/1e3);if(o<60)return"just now";const c=Math.floor(o/60);if(c<60)return`${c}m ago`;const d=Math.floor(c/60);if(d<24)return`${d}h ago`;const f=Math.floor(d/24);return f<7?`${f}d ago`:new Date(n).toLocaleDateString()}function ho(){return a.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function Bg({result:n}){const r=Og[n.classification]||Og.FN,s=n.classification==="TP"||n.classification==="TN";return a.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:[a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:a.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:s?a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:r.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:r.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center gap-2 mb-1",children:a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:n.prompt})}),a.jsxs("div",{className:"flex items-center gap-3 text-[12px]",children:[a.jsx("span",{className:"pill",style:{background:"var(--surface-3)",color:r.text,fontWeight:700,fontSize:"10px",padding:"1px 6px"},children:n.classification}),a.jsx("span",{style:{color:n.activate?"var(--green)":"var(--text-tertiary)"},children:n.activate?"Activated":"Silent"}),a.jsxs("span",{style:{color:"var(--text-tertiary)"},children:["Expected: ",n.expected==="should_activate"?"activate":"stay silent"]}),a.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[n.confidence," confidence"]}),n.autoClassified&&a.jsx("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)",fontSize:"9px",padding:"1px 5px"},children:"auto"})]}),n.reasoning&&a.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--text-tertiary)"},children:n.reasoning})]})]})}function Md({label:n,value:r,description:s,detail:o}){const c=Math.round(r*100),d=c>=80?"var(--green)":c>=60?"var(--yellow)":"var(--red)";return a.jsxs("div",{className:"text-center",children:[a.jsxs("div",{className:"text-[28px] font-bold tracking-tight",style:{color:d},children:[c,"%"]}),a.jsx("div",{className:"text-[12px] font-medium mt-0.5",style:{color:"var(--text-secondary)"},children:n}),a.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--text-tertiary)"},children:s}),a.jsx("div",{className:"text-[10px] mt-0.5 font-mono",style:{color:"var(--text-tertiary)"},children:o})]})}function xo({abbr:n,count:r,bg:s,color:o,description:c}){return a.jsxs("div",{className:"text-center p-3 rounded-lg",style:{background:s},children:[a.jsx("div",{className:"text-[20px] font-bold",style:{color:o},children:r}),a.jsx("div",{className:"text-[11px] font-semibold",style:{color:o},children:n}),a.jsx("div",{className:"text-[9px] mt-0.5",style:{color:"var(--text-tertiary)"},children:c})]})}function zE({startedAt:n}){const[r,s]=x.useState(0);return x.useEffect(()=>{const o=setInterval(()=>s(Math.floor((Date.now()-n)/1e3)),1e3);return()=>clearInterval(o)},[n]),a.jsxs("span",{className:"ml-2",children:["(",r,"s)"]})}const Ld={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},Ig={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},af=600,rf=180,ln=40,zd=af-ln*2,tr=rf-ln*2,DE=[25,50,75,100];function Hg(n){return new Date(n).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function _E(n){return n==null?"--":`${(n/1e3).toFixed(1)}s`}function OE({entries:n,onPointClick:r}){const[s,o]=x.useState(null),c=x.useMemo(()=>[...n].reverse(),[n]);if(c.length<2)return null;const d=c.length,f=c.map((p,y)=>{const v=ln+y/(d-1)*zd,j=p.passRate*100,S=ln+tr-j/100*tr;return{x:v,y:S,pct:j,entry:p}}),h=f.map(p=>`${p.x},${p.y}`).join(" "),g=Array.from(new Set(c.map(p=>p.type)));return a.jsxs("div",{className:"glass-card p-5 animate-fade-in",style:{position:"relative",overflowX:d>=20?"auto":void 0},children:[a.jsx("div",{className:"text-[13px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"Pass Rate Trend"}),a.jsx("div",{className:"flex items-center gap-5 mb-3",children:g.map(p=>a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:Ld[p]??"var(--text-tertiary)"}}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:Ig[p]??p})]},p))}),a.jsxs("svg",{width:af,height:rf,viewBox:`0 0 ${af} ${rf}`,style:{display:"block",overflow:"visible"},children:[DE.map(p=>{const y=ln+tr-p/100*tr;return a.jsxs("g",{children:[a.jsx("line",{x1:ln,y1:y,x2:ln+zd,y2:y,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),a.jsxs("text",{x:ln-8,y:y+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[p,"%"]})]},p)}),a.jsx("line",{x1:ln,y1:ln+tr,x2:ln+zd,y2:ln+tr,stroke:"var(--border-subtle)",strokeWidth:1}),a.jsx("text",{x:ln-8,y:ln+tr+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:"0%"}),a.jsx("polyline",{points:h,fill:"none",stroke:"var(--border-subtle)",strokeWidth:1.5,strokeLinejoin:"round"}),f.map((p,y)=>a.jsx("circle",{cx:p.x,cy:p.y,r:5,fill:Ld[p.entry.type]??"var(--text-tertiary)",stroke:"var(--surface-2)",strokeWidth:2,style:{cursor:"pointer",transition:"r 0.15s ease"},onMouseEnter:v=>{v.currentTarget.setAttribute("r","7"),o({x:p.x,y:p.y,entry:p.entry})},onMouseLeave:v=>{v.currentTarget.setAttribute("r","5"),o(null)},onClick:()=>r==null?void 0:r(p.entry)},y)),BE(d).map(p=>a.jsx("text",{x:f[p].x,y:ln+tr+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:Hg(c[p].timestamp)},p))]}),s&&a.jsxs("div",{style:{position:"absolute",left:s.x,top:s.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:[a.jsx("div",{className:"text-[11px] font-medium",style:{color:"var(--text-primary)"},children:Hg(s.entry.timestamp)}),a.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-tertiary)"},children:s.entry.model}),a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:Ld[s.entry.type]??"var(--text-tertiary)",color:"#fff"},children:Ig[s.entry.type]??s.entry.type}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:[Math.round(s.entry.passRate*100),"%"]})]}),a.jsxs("div",{className:"text-[10px] mt-1.5 flex items-center gap-3",style:{color:"var(--text-tertiary)"},children:[a.jsx("span",{children:_E(s.entry.totalDurationMs)}),a.jsx("span",{children:s.entry.totalTokens!=null?`${s.entry.totalTokens} tokens`:"--"})]})]})]})}function BE(n){if(n<=3)return Array.from({length:n},(o,c)=>c);if(n<=6)return[0,Math.floor(n/2),n-1];if(n<20)return[0,Math.floor(n/3),Math.floor(2*n/3),n-1];const r=Math.ceil(n/10),s=[0];for(let o=r;o<n-1;o+=r)s.push(o);return s.push(n-1),s}const Rs=new Map;let sn=null,Co=null,go=1e3,As=0;function jy(){if(sn)return;sn=new EventSource("/api/events");const n=r=>s=>{let o={};try{o=s.data?JSON.parse(s.data):{}}catch{}const c=Rs.get(r);if(c)for(const d of c)d(o)};sn.addEventListener("benchmark:complete",n("benchmark:complete")),sn.addEventListener("history:written",n("history:written")),sn.addEventListener("leaderboard:updated",n("leaderboard:updated")),sn.onerror=()=>{sn==null||sn.close(),sn=null,As>0&&(Co=setTimeout(()=>{go=Math.min(go*2,3e4),jy()},go))},sn.onopen=()=>{go=1e3}}function IE(){Co!=null&&(clearTimeout(Co),Co=null),sn==null||sn.close(),sn=null}function HE(n,r){return Rs.has(n)||Rs.set(n,new Set),Rs.get(n).add(r),As++,jy(),()=>{var s;(s=Rs.get(n))==null||s.delete(r),As--,As<=0&&(As=0,IE())}}function Lo(n,r){const s=x.useRef(r);s.current=r,x.useEffect(()=>HE(n,c=>s.current(c)),[n])}function zo(n){return n>=.8?"var(--green)":n>=.5?"var(--yellow)":"var(--red)"}function UE(n){return n>=1e3?`${(n/1e3).toFixed(1)}s`:`${Math.round(n)}ms`}function $E({rate:n,label:r}){const s=Math.round(n*100);return a.jsx("div",{className:"flex items-center gap-3",children:a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-primary)",maxWidth:"70%"},children:r}),a.jsxs("span",{className:"text-[11px] font-semibold",style:{color:zo(n)},children:[s,"%"]})]}),a.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${s}%`,background:zo(n)}})})]})})}function VE({points:n}){if(n.length<2)return null;const r=200,s=48,o=4,c=n.length,d=n.map((g,p)=>{const y=o+p/(c-1)*(r-o*2),v=o+(s-o*2)-g.passRate*(s-o*2);return{x:y,y:v}}),f=`M ${d[0].x},${s-o} `+d.map(g=>`L ${g.x},${g.y}`).join(" ")+` L ${d[d.length-1].x},${s-o} Z`,h=d.map((g,p)=>`${p===0?"M":"L"} ${g.x},${g.y}`).join(" ");return a.jsxs("svg",{width:r,height:s,style:{display:"block"},children:[a.jsx("path",{d:f,fill:"var(--accent-muted)"}),a.jsx("path",{d:h,fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),a.jsx("circle",{cx:d[d.length-1].x,cy:d[d.length-1].y,r:3,fill:"var(--accent)"})]})}function PE({plugin:n,skill:r}){const s=`stats/${n}/${r}`,o=x.useCallback(()=>Ce.getStats(n,r),[n,r]),{data:c,loading:d}=Al(s,o),f=x.useCallback(()=>on(s),[s]);if(Lo("benchmark:complete",f),Lo("history:written",f),d)return a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"skeleton h-24 rounded-xl"}),a.jsx("div",{className:"skeleton h-48 rounded-xl"}),a.jsx("div",{className:"skeleton h-36 rounded-xl"})]});if(!c||c.totalRuns===0)return a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center mx-auto mb-3",style:{background:"var(--surface-2)"},children:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",children:[a.jsx("path",{d:"M18 20V10"}),a.jsx("path",{d:"M12 20V4"}),a.jsx("path",{d:"M6 20v-6"})]})}),a.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark data yet"}),a.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"Run some benchmarks to see statistics"})]});const h=c.trendPoints.length>0?c.trendPoints[c.trendPoints.length-1].passRate:0,g=c.trendPoints.length>0?c.trendPoints[0].passRate:0,p=h-g,y=c.assertionStats.slice(0,10);return a.jsxs("div",{className:"space-y-4 stagger-children",children:[a.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Runs"}),a.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:c.totalRuns})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Latest Pass Rate"}),a.jsxs("div",{className:"text-[24px] font-bold",style:{color:zo(h)},children:[Math.round(h*100),"%"]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Trend"}),a.jsxs("div",{className:"text-[24px] font-bold",style:{color:p>=0?"var(--green)":"var(--red)"},children:[p>=0?"+":"",Math.round(p*100),"%"]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Models Tested"}),a.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:c.modelStats.length})]}),c.totalCost!=null&&a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Cost"}),a.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:Cn(c.totalCost)})]}),c.costPerRun!=null&&a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Avg Cost/Run"}),a.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:Cn(c.costPerRun)})]})]}),c.trendPoints.length>=2&&a.jsxs("div",{className:"glass-card p-5",children:[a.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Pass Rate Over Time"}),a.jsx(VE,{points:c.trendPoints})]}),c.modelStats.length>0&&a.jsxs("div",{className:"glass-card p-5",children:[a.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Model Performance"}),a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[a.jsx("thead",{children:a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("th",{style:{textAlign:"left",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Model"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Runs"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Pass Rate"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Duration"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Cost"})]})}),a.jsx("tbody",{children:c.modelStats.map(v=>a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("td",{style:{padding:"8px",color:"var(--text-primary)",fontWeight:500},children:v.model}),a.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:v.runs}),a.jsx("td",{style:{padding:"8px",textAlign:"center"},children:a.jsxs("span",{className:"font-semibold",style:{color:zo(v.avgPassRate)},children:[Math.round(v.avgPassRate*100),"%"]})}),a.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:UE(v.avgDurationMs)}),a.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:v.avgCost!=null?Cn(v.avgCost):"N/A"})]},v.model))})]})]}),y.length>0&&a.jsxs("div",{className:"glass-card p-5",children:[a.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Weakest Assertions"}),a.jsx("div",{className:"space-y-3",children:y.map(v=>a.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:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.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:["#",v.evalId]}),a.jsx("span",{className:"text-[10px] truncate",style:{color:"var(--text-tertiary)"},children:v.evalName}),a.jsxs("span",{className:"text-[10px] ml-auto flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[v.totalRuns," runs"]})]}),a.jsx($E,{rate:v.passRate,label:v.text})]},`${v.evalId}:${v.id}`))})]})]})}function FE({plugin:n,skill:r}){const[s,o]=x.useState(null),[c,d]=x.useState(null),[f,h]=x.useState({}),[g,p]=x.useState({});x.useEffect(()=>{Ce.getEvals(n,r).then(o).catch(()=>o(null))},[n,r]);async function y(v){if(c===v){d(null);return}if(d(v),!f[v]){p(j=>({...j,[v]:!0}));try{const j=await Ce.getCaseHistory(n,r,v);h(S=>({...S,[v]:j}))}catch{h(j=>({...j,[v]:[]}))}finally{p(j=>({...j,[v]:!1}))}}}return s?a.jsx("div",{className:"space-y-2 stagger-children",children:s.evals.map(v=>{const j=f[v.id]||[],S=c===v.id,k=g[v.id],E=j.length>0?j[0].pass_rate:null;return a.jsxs("div",{className:"glass-card overflow-hidden",children:[a.jsxs("button",{onClick:()=>y(v.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:w=>{S||(w.currentTarget.style.background="var(--surface-2)")},onMouseLeave:w=>{S||(w.currentTarget.style.background="transparent")},children:[a.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:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),a.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:["#",v.id]}),a.jsx("span",{className:"text-[13px] font-medium flex-1 truncate",style:{color:"var(--text-primary)"},children:v.name}),j.length>=2&&a.jsx(xy,{entries:j}),E!=null&&a.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:Nl(E)},children:[Math.round(E*100),"%"]}),j.length>0&&a.jsxs("span",{className:"text-[10px] flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[j.length," runs"]})]}),S&&a.jsx("div",{className:"border-t animate-fade-in",style:{borderColor:"var(--border-subtle)"},children:k?a.jsxs("div",{className:"p-4 flex items-center gap-2",children:[a.jsx("div",{className:"spinner",style:{width:14,height:14}}),a.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):j.length===0?a.jsx("div",{className:"p-4",children:a.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No history for this eval case"})}):a.jsx("div",{className:"divide-y",style:{borderColor:"var(--border-subtle)"},children:j.map((w,N)=>a.jsxs("div",{className:"p-4",style:{background:N===0?"var(--surface-2)":"transparent"},children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:my(w.timestamp)}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:w.model}),a.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:w.type==="benchmark"?"rgba(99,131,255,0.15)":w.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:w.type==="benchmark"?"#6383ff":w.type==="comparison"?"var(--purple)":"#fb923c"},children:w.type}),a.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:Nl(w.pass_rate)},children:[Math.round(w.pass_rate*100),"%"]})]}),a.jsxs("div",{className:"flex items-center gap-4 mb-2 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[w.durationMs!=null&&a.jsx("span",{children:hy(w.durationMs)}),w.tokens!=null&&a.jsxs("span",{children:[w.tokens>=1e3?`${(w.tokens/1e3).toFixed(1)}k`:w.tokens," tok"]})]}),a.jsx("div",{className:"space-y-1",children:w.assertions.map(A=>a.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[a.jsx("div",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:A.pass?"var(--green)":"var(--red)"},children:a.jsx("svg",{width:"7",height:"7",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",children:A.pass?a.jsx("polyline",{points:"20 6 9 17 4 12"}):a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-primary)"},children:A.text}),A.reasoning&&a.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:A.reasoning})]})]},A.id))})]},N))})})]},v.id)})}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No eval cases found"})})}function GE(){const{state:n,dispatch:r}=Nn(),{plugin:s,skill:o}=n,{state:c}=sa(),d=c.skills.find(P=>P.plugin===s&&P.skill===o),f=(d==null?void 0:d.version)??null,[h,g]=x.useState("timeline"),[p,y]=x.useState(""),[v,j]=x.useState(""),[S,k]=x.useState(!1),[E,w]=x.useState([]),[N,A]=x.useState(null),[z,H]=x.useState(!1),[M,F]=x.useState(null),[T,O]=x.useState(!1),C=`history/${s}/${o}?model=${p}&type=${v}`,_=x.useCallback(()=>Ce.getHistory(s,o,{model:p||void 0,type:v||void 0}),[s,o,p,v]),{data:$,loading:K}=Al(C,_),Z=$??[];x.useEffect(()=>{!$||$.length<2||Ce.compareRuns(s,o,$[0].timestamp,$[1].timestamp).then(P=>{const W=P.regressions.filter(ie=>ie.change==="regression");r({type:"SET_REGRESSIONS",regressions:W})}).catch(()=>{})},[$,s,o,r]);const q=x.useCallback(()=>on(C),[C]);Lo("history:written",q);const I=x.useCallback(async P=>{if(S){w(W=>W.includes(P)?W.filter(ie=>ie!==P):W.length>=2?[W[1],P]:[...W,P]);return}O(!0);try{const W=await Ce.getHistoryEntry(s,o,P);F(W)}catch{}finally{O(!1)}},[s,o,S]),L=x.useCallback(async()=>{if(E.length===2){H(!0);try{const P=await Ce.compareRuns(s,o,E[0],E[1]);A(P)}catch{}finally{H(!1)}}},[s,o,E]),B=[...new Set(Z.map(P=>P.model))];return K?a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),a.jsx("div",{className:"skeleton h-48 rounded-xl mb-4"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"skeleton h-12 rounded-lg"}),a.jsx("div",{className:"skeleton h-12 rounded-lg"})]})]}):a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"flex items-center gap-1 mb-4",children:["timeline","per-eval","statistics"].map(P=>a.jsx("button",{onClick:()=>g(P),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:h===P?"var(--accent-muted)":"transparent",color:h===P?"var(--accent)":"var(--text-tertiary)"},children:P==="timeline"?"Timeline":P==="per-eval"?"Per Eval":"Statistics"},P))}),h==="timeline"&&a.jsxs("div",{children:[Z.length>0&&a.jsx("div",{className:"mb-5 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:a.jsx(OE,{entries:Z,onPointClick:P=>I(P.timestamp)})}),a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("select",{value:p,onChange:P=>y(P.target.value),className:"input-field text-[12px]",style:{width:150},children:[a.jsx("option",{value:"",children:"All Models"}),B.map(P=>a.jsx("option",{value:P,children:P},P))]}),a.jsxs("select",{value:v,onChange:P=>j(P.target.value),className:"input-field text-[12px]",style:{width:150},children:[a.jsx("option",{value:"",children:"All Types"}),a.jsx("option",{value:"benchmark",children:"Benchmark"}),a.jsx("option",{value:"comparison",children:"Comparison"}),a.jsx("option",{value:"baseline",children:"Baseline"}),a.jsx("option",{value:"model-compare",children:"Model Compare"}),a.jsx("option",{value:"improve",children:"AI Improve"}),a.jsx("option",{value:"instruct",children:"AI Edit"}),a.jsx("option",{value:"ai-generate",children:"AI Generate"}),a.jsx("option",{value:"eval-generate",children:"Eval Generate"})]}),a.jsx("div",{className:"flex-1"}),a.jsx("button",{onClick:()=>{k(!S),w([]),A(null)},className:`btn text-[12px] ${S?"btn-primary":"btn-secondary"}`,children:S?"Exit Compare":"Compare Runs"}),S&&E.length===2&&a.jsx("button",{onClick:L,disabled:z,className:"btn btn-primary text-[12px]",children:z?"Comparing...":"Compare"})]}),a.jsx("div",{className:"space-y-2",children:Z.length===0?a.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):Z.map(P=>{const W=E.includes(P.timestamp);return a.jsx("button",{onClick:()=>I(P.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:W?"var(--accent-muted)":"var(--surface-1)",border:W?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:ie=>{W||(ie.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:ie=>{W||(ie.currentTarget.style.borderColor="var(--border-subtle)")},children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[S&&a.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:W?"var(--accent)":"var(--border-default)",background:W?"var(--accent)":"transparent"},children:W&&a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})}),a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:new Date(P.timestamp).toLocaleString()}),a.jsx("span",{className:"pill text-[9px]",style:{background:P.type==="comparison"?"var(--purple-muted)":P.type==="baseline"?"var(--surface-3)":P.type==="model-compare"?"var(--accent-muted)":P.type==="improve"||P.type==="instruct"?"var(--purple-muted)":P.type==="ai-generate"?"var(--green-muted)":P.type==="eval-generate"?"var(--orange-muted)":"var(--accent-muted)",color:P.type==="comparison"?"var(--purple)":P.type==="baseline"?"var(--text-tertiary)":P.type==="model-compare"?"var(--accent)":P.type==="improve"||P.type==="instruct"?"var(--purple)":P.type==="ai-generate"?"var(--green)":P.type==="eval-generate"?"var(--orange)":"var(--accent)"},children:P.type==="model-compare"?"model compare":P.type==="improve"?"ai improve":P.type==="instruct"?"ai edit":P.type==="ai-generate"?"ai generate":P.type==="eval-generate"?"eval generate":P.type})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(qs,{version:f,size:"sm","data-testid":"history-row-version"}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:P.model}),P.totalCost!=null&&P.totalCost>0&&a.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--text-tertiary)"},children:Cn(P.totalCost)}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:P.passRate>=.8?"var(--green)":P.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(P.passRate*100),"%"]})]})]})},P.timestamp)})}),N&&a.jsx(WE,{result:N}),M&&!S&&a.jsx(YE,{run:M,onClose:()=>F(null)})]}),h==="per-eval"&&a.jsx(FE,{plugin:s,skill:o}),h==="statistics"&&a.jsx(PE,{plugin:s,skill:o})]})}function WE({result:n}){const r=n.regressions.filter(o=>o.change==="regression"),s=n.regressions.filter(o=>o.change==="improvement");return a.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Comparison: ",new Date(n.runA.timestamp).toLocaleDateString()," vs ",new Date(n.runB.timestamp).toLocaleDateString()]}),(n.runA.totalCost!=null||n.runB.totalCost!=null)&&a.jsxs("div",{className:"flex items-center gap-4 mb-3 text-[11px]",style:{color:"var(--text-secondary)"},children:[a.jsxs("span",{children:["Run A cost: ",Cn(n.runA.totalCost??null)]}),a.jsxs("span",{children:["Run B cost: ",Cn(n.runB.totalCost??null)]}),n.runA.totalCost!=null&&n.runB.totalCost!=null&&a.jsxs("span",{style:{color:n.runB.totalCost<=n.runA.totalCost?"var(--green)":"var(--red)"},children:["Delta: ",Cn(n.runB.totalCost-n.runA.totalCost)]})]}),r.length>0&&a.jsxs("div",{className:"mb-3",children:[a.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--red)"},children:["Regressions (",r.length,")"]}),r.map(o=>a.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",a.jsx("span",{style:{color:"var(--red)"},children:o.assertionId})," (was passing, now failing)"]},`${o.evalId}-${o.assertionId}`))]}),s.length>0&&a.jsxs("div",{className:"mb-3",children:[a.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--green)"},children:["Improvements (",s.length,")"]}),s.map(o=>a.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",a.jsx("span",{style:{color:"var(--green)"},children:o.assertionId})," (was failing, now passing)"]},`${o.evalId}-${o.assertionId}`))]}),a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 mt-3",style:{color:"var(--text-tertiary)"},children:"Case Diffs"}),a.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:a.jsxs("table",{className:"w-full text-[12px]",children:[a.jsx("thead",{children:a.jsxs("tr",{style:{background:"var(--surface-2)"},children:[a.jsx("th",{className:"text-left px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Case"}),a.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run A"}),a.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run B"})]})}),a.jsx("tbody",{children:n.caseDiffs.map(o=>a.jsxs("tr",{style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsxs("td",{className:"px-3 py-2",style:{color:"var(--text-secondary)"},children:["#",o.eval_id," ",o.eval_name]}),a.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}),a.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 YE({run:n,onClose:r}){return(n.type==="improve"||n.type==="instruct")&&n.improve?a.jsx(qE,{run:n,onClose:r}):a.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:["Run: ",new Date(n.timestamp).toLocaleString()]}),a.jsx("button",{onClick:r,className:"btn btn-ghost text-[11px]",children:"Close"})]}),a.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:["Model: ",n.model," | Cases: ",n.cases.length," | Pass Rate: ",n.overall_pass_rate!=null?`${Math.round(n.overall_pass_rate*100)}%`:"--",n.totalCost!=null&&n.totalCost>0&&` | Cost: ${Cn(n.totalCost)}`]}),a.jsx("div",{className:"space-y-2",children:n.cases.map(s=>a.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)"},children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-[12px]",style:{color:"var(--text-secondary)"},children:["#",s.eval_id," ",s.eval_name]}),a.jsxs("div",{className:"flex items-center gap-2",children:[s.cost!=null&&s.cost>0&&a.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--text-tertiary)"},children:Cn(s.cost)}),a.jsx("span",{className:"text-[11px] font-semibold",style:{color:s.status==="pass"?"var(--green)":"var(--red)"},children:s.pass_rate!=null?`${Math.round(s.pass_rate*100)}%`:s.status})]})]})},s.eval_id))})]})}function qE({run:n,onClose:r}){var d;const s=x.useMemo(()=>n.improve?Go(n.improve.original,n.improve.improved):[],[n.improve]),o=x.useMemo(()=>{const f=s.filter(g=>g.type==="added").length,h=s.filter(g=>g.type==="removed").length;return{added:f,removed:h}},[s]),c=x.useMemo(()=>{let f=0,h=0;return s.map(g=>g.type==="removed"?(f++,{...g,origNum:f,newNum:null}):g.type==="added"?(h++,{...g,origNum:null,newNum:h}):(f++,h++,{...g,origNum:f,newNum:h}))},[s]);return a.jsxs("div",{className:"mt-4 rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.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:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{background:"var(--purple-muted)"},children:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--purple)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),a.jsx("path",{d:"M2 17l10 5 10-5"}),a.jsx("path",{d:"M2 12l10 5 10-5"})]})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"}),a.jsxs("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[new Date(n.timestamp).toLocaleString()," · ",n.model]})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsxs("span",{style:{color:"var(--green)"},children:["+",o.added]}),a.jsxs("span",{style:{color:"var(--red)"},children:["-",o.removed]})]}),a.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:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),((d=n.improve)==null?void 0:d.reasoning)&&a.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:[a.jsx("span",{className:"font-semibold",style:{color:"var(--purple)"},children:"AI Reasoning: "}),n.improve.reasoning]}),a.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:480,overflowY:"auto"},children:a.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:a.jsx("tbody",{children:c.map((f,h)=>a.jsxs("tr",{style:{background:f.type==="added"?"var(--green-muted)":f.type==="removed"?"var(--red-muted)":"transparent"},children:[a.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??""}),a.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??""}),a.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"?"-":" "}),a.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 Sy({data:n}){if(n.length<2)return a.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:"--"});const r=n.slice(-10),s=80,o=24,c=2,d=s-c*2,f=o-c*2,h=r.length,g=Math.min(...r),y=Math.max(...r)-g||1,v=r.map((k,E)=>{const w=c+E/(h-1)*d,N=c+f-(k-g)/y*f;return`${w.toFixed(1)},${N.toFixed(1)}`}),j=r[r.length-1],S=Nl(j);return a.jsxs("svg",{width:s,height:o,viewBox:`0 0 ${s} ${o}`,style:{display:"block"},children:[a.jsx("polyline",{points:v.join(" "),fill:"none",stroke:S,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),(()=>{const[k,E]=v[v.length-1].split(",");return a.jsx("circle",{cx:k,cy:E,r:2.5,fill:S})})()]})}function KE(){return a.jsxs("span",{className:"pill",style:{background:"var(--yellow-muted)",color:"var(--yellow)",fontSize:9,fontWeight:700,gap:3},children:[a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"var(--yellow)",stroke:"none",children:a.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 XE({pct:n}){const r=n>=10?"var(--green)":n>=0?"var(--yellow)":"var(--red)",s=n>=10?"var(--green-muted)":n>=0?"var(--yellow-muted)":"var(--red-muted)",o=n>=0?"+":"";return a.jsxs("span",{className:"pill",style:{background:s,color:r,fontSize:10,fontWeight:600},children:[o,n.toFixed(1),"%"]})}function QE({score:n,rating:r}){const s={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=s[r]??s.minimal,c=n>=0?"+":"";return a.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"Skill Quality:"}),a.jsxs("span",{className:"pill",style:{background:o.bg,color:o.fg,fontSize:11,fontWeight:600},children:[c,n.toFixed(1),"% (",r.toUpperCase(),")"]})]})}function ZE({warning:n}){return a.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:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--yellow)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.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"}),a.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),a.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--yellow)"},children:n})]})}function JE({active:n,onChange:r,hasBaseline:s}){return a.jsxs("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)"},children:[a.jsx("button",{onClick:()=>r("rankings"),className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:n==="rankings"?"var(--surface-3)":"transparent",color:n==="rankings"?"var(--text-primary)":"var(--text-tertiary)"},children:"Rankings"}),a.jsx("button",{onClick:()=>r("amplification"),disabled:!s,className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:n==="amplification"?"var(--surface-3)":"transparent",color:s&&n==="amplification"?"var(--text-primary)":"var(--text-tertiary)",opacity:s?1:.5,cursor:s?"pointer":"not-allowed"},title:s?"View skill amplification data":"Run sweep with --baseline to see amplification data",children:"Skill Amplification"})]})}function eC(n){var o,c,d;if(n.length===0)return[];const r=new Map;for(const f of n)for(const h of f.models){if(h.status==="error")continue;const g=`${h.provider}/${h.model}`;r.has(g)||r.set(g,{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(g);p.passRates.push(h.passRate.mean),p.lastRubric=((o=h.rubricScore)==null?void 0:o.mean)??null,p.lastDuration=h.duration.mean,p.lastCost=((c=h.cost)==null?void 0:c.total)??null,p.lastCompositeScore=h.compositeScore,h.baselinePassRate!=null&&(p.lastBaselinePassRate=h.baselinePassRate.mean,p.lastSkillDelta=(d=h.skillDelta)==null?void 0:d.mean,p.lastAmplificationPct=h.amplificationPct,p.hasBaseline=!0)}const s=[];for(const[f,h]of r){const[g,...p]=f.split("/");s.push({rank:0,model:p.join("/"),provider:g,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 s.sort((f,h)=>{const g=f.compositeScore??f.passRate;return(h.compositeScore??h.passRate)-g}),s.forEach((f,h)=>{f.rank=h+1}),s.length>0&&(s[0].isBest=!0),s}const ky=(n="left")=>({padding:"10px 12px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary)",textAlign:n,whiteSpace:"nowrap"});function tC({entries:n}){return a.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","Pass Rate","Rubric","Duration","Cost","Trend"].map(r=>a.jsx("th",{style:ky(r==="#"?"center":"left"),children:r},r))})}),a.jsx("tbody",{children:n.map(r=>a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:s=>{s.currentTarget.style.background="var(--surface-2)"},onMouseLeave:s=>{s.currentTarget.style.background="transparent"},children:[a.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:r.rank}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:r.model}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:r.provider}),r.isBest&&a.jsx(KE,{})]})}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("span",{className:"pill",style:{background:r.passRate>=.7?"var(--green-muted)":r.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:Nl(r.passRate),fontSize:11,fontWeight:600},children:[Math.round(r.passRate*100),"%"]})}),a.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.rubricScore!=null?r.rubricScore.toFixed(1):"--"}),a.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`}),a.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.cost!=null?`$${r.cost.toFixed(4)}`:"N/A"}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsx(Sy,{data:r.sparklineData})})]},`${r.provider}/${r.model}`))})]})})}function nC({entries:n}){const r=[...n].filter(s=>s.hasBaseline).sort((s,o)=>(o.amplificationPct??0)-(s.amplificationPct??0));return r.length===0?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("div",{className:"text-center",children:a.jsxs("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:["No baseline data available. Run sweep with ",a.jsx("code",{children:"--baseline"})," flag."]})})}):a.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","With Skill","Without Skill","Delta","Amplification","Trend"].map(s=>a.jsx("th",{style:ky(s==="#"?"center":"left"),children:s},s))})}),a.jsx("tbody",{children:r.map((s,o)=>a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:c=>{c.currentTarget.style.background="var(--surface-2)"},onMouseLeave:c=>{c.currentTarget.style.background="transparent"},children:[a.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:o+1}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:s.model}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:s.provider})]})}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("span",{className:"pill",style:{background:s.passRate>=.7?"var(--green-muted)":s.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:Nl(s.passRate),fontSize:11,fontWeight:600},children:[Math.round(s.passRate*100),"%"]})}),a.jsx("td",{style:{padding:"10px 12px"},children:s.baselinePassRate!=null?a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:[Math.round(s.baselinePassRate*100),"%"]}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:s.skillDelta!=null?a.jsxs("span",{className:"text-[11px] font-medium",style:{color:s.skillDelta>=0?"var(--green)":"var(--red)"},children:[s.skillDelta>=0?"+":"",(s.skillDelta*100).toFixed(1),"pp"]}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:s.amplificationPct!=null&&isFinite(s.amplificationPct)?a.jsx(XE,{pct:s.amplificationPct}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsx(Sy,{data:s.sparklineData})})]},`${s.provider}/${s.model}`))})]})})}function aC(){const{state:n}=Nn(),{plugin:r,skill:s}=n,[o,c]=x.useState("rankings"),d=`leaderboard/${r}/${s}`,f=x.useCallback(()=>Ce.getLeaderboard(r,s),[r,s]),{data:h,loading:g}=Al(d,f),p=(h==null?void 0:h.entries)??[];x.useEffect(()=>{c("rankings")},[r,s]);const y=x.useCallback(()=>on(d),[d]);Lo("leaderboard:updated",y);const v=x.useMemo(()=>eC(p),[p]),j=v.some(E=>E.hasBaseline),S=p[0],k=S==null?void 0:S.judgeBiasWarning;return g?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"spinner spinner-lg"})}):v.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:"var(--accent-muted)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M18 20V10"}),a.jsx("path",{d:"M12 20V4"}),a.jsx("path",{d:"M6 20v-6"})]})}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No sweep results yet"}),a.jsx("div",{className:"text-[12px] mb-3",style:{color:"var(--text-tertiary)"},children:"Run your first model sweep to compare performance across models:"}),a.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"'}),a.jsxs("div",{className:"text-[11px] mt-2",style:{color:"var(--text-tertiary)"},children:["Add ",a.jsx("code",{children:"--baseline"})," to measure skill amplification per model."]})]})]}):a.jsxs("div",{className:"p-5 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"text-[15px] font-semibold",style:{color:"var(--text-primary)"},children:"Model Leaderboard"}),a.jsx(JE,{active:o,onChange:c,hasBaseline:j})]}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[p.length," sweep",p.length!==1?"s":""," · ",v.length," model",v.length!==1?"s":""]})]}),k&&a.jsx(ZE,{warning:k}),o==="rankings"?a.jsx(tC,{entries:v}):a.jsx(nC,{entries:v}),o==="amplification"&&(S==null?void 0:S.skillQualityScore)!=null&&(S==null?void 0:S.skillQualityRating)&&a.jsx(QE,{score:S.skillQualityScore,rating:S.skillQualityRating})]})}function rC({plugin:n,skill:r}){const[s,o]=x.useState([]),[c,d]=x.useState([]),[f,h]=x.useState(!0),[g,p]=x.useState(null);x.useEffect(()=>{Ce.getDependencies(n,r).then(v=>{o(v.mcpDependencies),d(v.skillDependencies)}).catch(()=>{}).finally(()=>h(!1))},[n,r]);async function y(v,j){try{await navigator.clipboard.writeText(j),p(v),setTimeout(()=>p(null),2e3)}catch{}}return f?null:s.length===0&&c.length===0?a.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"}):a.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.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:[a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(234,179,8,0.15)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#eab308",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.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"}),a.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"})]})}),a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Dependencies"}),a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:s.length+c.length})]}),a.jsxs("div",{className:"px-5 py-4",children:[s.length>0&&a.jsxs("div",{className:"space-y-3 mb-4",children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"MCP Servers"}),s.map(v=>a.jsxs("div",{className:"p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:v.server}),a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:v.transport})]}),a.jsx("button",{onClick:()=>y(v.server,v.configSnippet),className:"btn btn-ghost text-[11px] py-1 px-2",style:{color:g===v.server?"var(--green)":"var(--accent)"},children:g===v.server?a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})," Copied!"]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),a.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"]})})]}),a.jsx("div",{className:"text-[11px] mb-2 font-mono",style:{color:"var(--text-tertiary)"},children:v.url}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:v.matchedTools.map(j=>a.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))})]},v.server))]}),c.length>0&&a.jsxs("div",{children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Skill Dependencies"}),a.jsx("div",{className:"space-y-1.5",children:c.map(v=>a.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:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.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"})}),a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:v.name}),a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:v.source==="frontmatter"?"frontmatter":"referenced"})]},v.name))})]})]})]})}function Ug({plugin:n,skill:r}){const[s,o]=x.useState([]),[c,d]=x.useState(!0),[f,h]=x.useState(null),[g,p]=x.useState(""),[y,v]=x.useState(!1),[j,S]=x.useState(null),[k,E]=x.useState(""),[w,N]=x.useState(""),[A,z]=x.useState(!1),[H,M]=x.useState(new Set),F=x.useCallback(async()=>{d(!0);try{const[_,$]=await Promise.all([Ce.getCredentials(n,r).catch(()=>({credentials:[]})),Ce.getParams(n,r).catch(()=>({params:[]}))]),K=new Map($.params.map(I=>[I.name,I])),Z=new Set,q=[];for(const I of _.credentials){Z.add(I.name);const L=K.get(I.name);q.push({name:I.name,status:I.status==="ready"||I.status==="resolved"?"ready":"missing",source:I.source,maskedValue:L==null?void 0:L.maskedValue})}for(const I of $.params)Z.has(I.name)||q.push({name:I.name,status:I.status,maskedValue:I.maskedValue});o(q)}finally{d(!1)}},[n,r]);x.useEffect(()=>{F()},[F]);const T=x.useCallback(async _=>{if(H.has(_)){M($=>{const K=new Set($);return K.delete(_),K}),o($=>$.map(K=>K.name===_?{...K,revealedValue:void 0}:K));return}try{const K=(await Ce.getParamsRevealed(n,r,_)).params.find(Z=>Z.name===_);K&&(o(Z=>Z.map(q=>q.name===_?{...q,revealedValue:K.value}:q)),M(Z=>new Set(Z).add(_)))}catch{}},[n,r,H]),O=async(_,$)=>{if(!(!_.trim()||!$.trim())){v(!0),S(null);try{await Ce.setCredential(n,r,_,$),h(null),p(""),M(new Set),F()}catch(K){S(K.message)}finally{v(!1)}}},C=async()=>{if(!(!k.trim()||!w.trim())){v(!0),S(null);try{await Ce.setCredential(n,r,k.trim().toUpperCase(),w),E(""),N(""),z(!1),F()}catch(_){S(_.message)}finally{v(!1)}}};return c?a.jsxs("div",{className:"mt-6",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),a.jsx("div",{className:"skeleton h-20 rounded-xl"})]}):a.jsxs("div",{className:"mt-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),a.jsx("button",{onClick:()=>z(!A),className:"text-[11px] transition-colors duration-150",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"+ Add Parameter"})]}),j&&a.jsx("div",{className:"mb-2 px-3 py-2 rounded-lg text-[11px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:j}),s.length===0&&!A?a.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"}):a.jsx("div",{className:"rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:s.map(_=>a.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:[a.jsx("span",{className:"text-[11px] font-mono font-medium truncate",style:{color:"var(--text-primary)",minWidth:80},children:_.name}),_.maskedValue&&a.jsx("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)",maxWidth:120},children:H.has(_.name)&&_.revealedValue!=null?_.revealedValue:_.maskedValue}),_.maskedValue&&a.jsx("button",{onClick:()=>T(_.name),className:"btn btn-ghost px-1",title:H.has(_.name)?"Hide value":"Reveal value",style:{color:"var(--text-tertiary)",lineHeight:1},children:H.has(_.name)?a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.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"}),a.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"}),a.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),a.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:_.status==="ready"?"var(--green-muted)":"var(--orange-muted)",color:_.status==="ready"?"var(--green)":"var(--orange)"},children:_.status==="ready"?"ready":"missing"}),_.source&&a.jsx("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:_.source}),f===_.name?a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("input",{value:g,onChange:$=>p($.target.value),onKeyDown:$=>{$.key==="Enter"&&O(_.name,g)},className:"input-field text-[11px] font-mono",style:{width:160},placeholder:"Value...",autoFocus:!0}),a.jsx("button",{onClick:()=>O(_.name,g),disabled:y||!g.trim(),className:"btn btn-primary text-[10px] px-2 py-0.5",children:y?"...":"Save"}),a.jsx("button",{onClick:()=>{h(null),p("")},className:"btn btn-ghost text-[10px] px-1",children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}):a.jsx("button",{onClick:()=>{h(_.name),p("")},className:"btn btn-ghost text-[10px] px-2 py-0.5",style:{color:"var(--accent)"},children:"Edit"})]},_.name))}),A&&a.jsxs("div",{className:"mt-2 p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx("input",{value:k,onChange:_=>E(_.target.value),className:"input-field flex-1 text-[11px] font-mono",placeholder:"KEY_NAME",autoFocus:!0}),a.jsx("input",{value:w,onChange:_=>N(_.target.value),onKeyDown:_=>{_.key==="Enter"&&C()},className:"input-field flex-1 text-[11px] font-mono",placeholder:"Value",type:"password"})]}),a.jsxs("div",{className:"flex justify-end gap-1.5",children:[a.jsx("button",{onClick:()=>{z(!1),E(""),N("")},className:"btn btn-ghost text-[10px]",children:"Cancel"}),a.jsx("button",{onClick:C,disabled:y||!k.trim()||!w.trim(),className:"btn btn-primary text-[10px]",children:y?"Saving...":"Save"})]})]})]})}function lC(){const{state:n}=Nn(),{plugin:r,skill:s}=n,[o,c]=x.useState(null),[d,f]=x.useState(!0);return x.useEffect(()=>{Ce.getDependencies(r,s).then(c).catch(()=>{}).finally(()=>f(!1))},[r,s]),d?a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),a.jsx("div",{className:"skeleton h-32 rounded-xl"})]}):o?a.jsxs("div",{className:"p-5 max-w-3xl",children:[a.jsx(rC,{plugin:r,skill:s}),a.jsx(Ug,{plugin:r,skill:s})]}):a.jsxs("div",{className:"p-5 max-w-3xl",children:[a.jsx("div",{className:"text-[13px] mb-4",style:{color:"var(--text-tertiary)"},children:"No MCP dependency information available"}),a.jsx(Ug,{plugin:r,skill:s})]})}function sC(n){const r={prompt:n.prompt,provider:n.provider,model:n.model};return n.targetAgents&&n.targetAgents.length>0&&(r.targetAgents=n.targetAgents),r}function iC(n){var o;const r=n.userName.trim().length>0,s=n.userPlugin.trim().length>0||n.userNewPlugin.trim().length>0;return{applyName:r?null:n.aiName??null,applySuggestedPlugin:!s&&!!((o=n.aiSuggestedPlugin)!=null&&o.plugin),suggestedPluginValue:s?null:n.aiSuggestedPlugin??null}}function lf(n,r=!0){let s=n.toLowerCase().replace(/[^a-z0-9]+/g,"-");return r&&(s=s.replace(/^-+|-+$/g,"")),s}function oC(n,r,s,o){const d=`.../${n.split("/").slice(-2).join("/")}`;switch(r){case 1:return`${d}/${s}/skills/${o}/SKILL.md`;case 2:return`${d}/plugins/${s}/skills/${o}/SKILL.md`;case 3:return`${d}/skills/${o}/SKILL.md`}}function cC({onCreated:n,resolveAiConfigOverride:r}){const[s,o]=x.useState("ai"),[c,d]=x.useState(null),[f,h]=x.useState(!0),{config:g}=_r(),[p,y]=x.useState(""),[v,j]=x.useState(3),[S,k]=x.useState(""),[E,w]=x.useState(""),[N,A]=x.useState(""),[z,H]=x.useState(""),[M,F]=x.useState(""),[T,O]=x.useState(""),[C,_]=x.useState("write"),[$,K]=x.useState([]),[Z,q]=x.useState(!1),[I,L]=x.useState(null),[B,P]=x.useState(""),[W,ie]=x.useState(!1),[D,V]=x.useState(!1),[te,se]=x.useState(null),[ge,he]=x.useState(null),[be,ce]=x.useState([]),je=x.useRef(null),Be=x.useRef(null),ze=x.useRef(null),re=x.useRef(null),fe=x.useRef(null),[pe,xe]=x.useState(!1),[ve,Le]=x.useState(!1),De=x.useRef(p),ut=x.useRef(S),Bt=x.useRef(E);x.useEffect(()=>{De.current=p},[p]),x.useEffect(()=>{ut.current=S},[S]),x.useEffect(()=>{Bt.current=E},[E]),x.useEffect(()=>{Ce.getProjectLayout().then(We=>{d(We),j(We.suggestedLayout);const Mt=We.detectedLayouts.find(pt=>pt.layout===We.suggestedLayout);Mt!=null&&Mt.existingPlugins.length&&k(Mt.existingPlugins[0])}).catch(()=>{}).finally(()=>h(!1))},[]),x.useEffect(()=>{var We;s==="ai"&&((We=je.current)==null||We.focus())},[s]),x.useEffect(()=>()=>{var We;(We=Be.current)==null||We.abort()},[]);const St=x.useMemo(()=>{var We;return c?((We=c.detectedLayouts.find(Mt=>Mt.layout===v))==null?void 0:We.existingPlugins)||[]:[]},[c,v]),Ct=S==="__new__"?E:S,It=c?oC(c.root,v,Ct||"{plugin}",p||"{skill}"):"",Qe=x.useMemo(()=>c?c.detectedLayouts.filter(We=>We.layout!==4):[],[c]),tt=x.useMemo(()=>{if(!c)return null;const We=c.detectedLayouts.find(vt=>vt.layout===2&&vt.existingPlugins.length>0),Mt=c.detectedLayouts.find(vt=>vt.layout===1&&vt.existingPlugins.length>0),pt=We||Mt;return pt?{layout:pt.layout,plugins:pt.existingPlugins}:null},[c]),ee=x.useCallback(()=>{if(r)return r();if(!g)return{provider:"claude-cli",model:"sonnet"};const We=g.provider||"claude-cli",Mt=g.model||"sonnet";return{provider:We,model:Mt}},[g,r]),Te=x.useCallback(()=>{var We;(We=Be.current)==null||We.abort(),ie(!1)},[]),Pe=x.useCallback(()=>{se(null),he(null)},[]),en=x.useCallback(async()=>{var vt,Nt;if(se(null),he(null),ce([]),ze.current=null,re.current=null,!B.trim()){se("Describe what your skill should do");return}ie(!0);const We=new AbortController;Be.current=We;const{provider:Mt,model:pt}=ee();try{const tn=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(sC({prompt:B.trim(),provider:Mt,model:pt,targetAgents:$})),signal:We.signal});if(!tn.ok||!tn.body){let Tn=`HTTP ${tn.status}`;try{const Rn=await tn.json();Rn.error&&(Tn=Rn.error)}catch{}throw new Error(Tn)}const Ir=tn.body.getReader(),Aa=new TextDecoder;let kt="",Tt="";for(;;){const{done:Tn,value:Rn}=await Ir.read();if(Tn)break;kt+=Aa.decode(Rn,{stream:!0});const cr=kt.split(`
86
- `);kt=cr.pop()||"";for(const Xn of cr)if(Xn.startsWith("event: "))Tt=Xn.slice(7).trim();else if(Xn.startsWith("data: ")){try{const dt=JSON.parse(Xn.slice(6));if(Tt==="progress")ce(ur=>[...ur,{phase:dt.phase,message:dt.message,timestamp:Date.now()}]);else if(Tt==="provenance")re.current={resolvedModelId:typeof dt.resolvedModelId=="string"?dt.resolvedModelId:null,snapshotDate:typeof dt.snapshotDate=="string"?dt.snapshotDate:null};else if(Tt==="done"||Tt==="complete"){const ur={prompt:B.trim(),provider:ee().provider,model:ee().model,resolvedModelId:((vt=re.current)==null?void 0:vt.resolvedModelId)??null,snapshotDate:((Nt=re.current)==null?void 0:Nt.snapshotDate)??null,reasoning:dt.reasoning||""},Qn=iC({userName:De.current,userPlugin:ut.current,userNewPlugin:Bt.current,aiName:dt.name,aiSuggestedPlugin:dt.suggestedPlugin&&dt.suggestedPlugin.plugin?{plugin:dt.suggestedPlugin.plugin,layout:dt.suggestedPlugin.layout}:null});if(Qn.applyName!==null&&y(Qn.applyName),A(dt.description),H(dt.model||""),F(dt.allowedTools||""),O(dt.body),V(!0),ze.current=ur,o("manual"),Qn.applySuggestedPlugin&&Qn.suggestedPluginValue){const nn=Qn.suggestedPluginValue;if(((c==null?void 0:c.detectedLayouts.flatMap(oa=>oa.existingPlugins))??[]).includes(nn.plugin))if(k(nn.plugin),nn.layout&&(nn.layout===1||nn.layout===2))j(nn.layout);else{const oa=c==null?void 0:c.detectedLayouts.find(Xs=>Xs.existingPlugins.includes(nn.plugin));oa&&(oa.layout===1||oa.layout===2)&&j(oa.layout)}else k("__new__"),w(nn.plugin)}else!Qn.applySuggestedPlugin&&ut.current.trim().length===0&&Bt.current.trim().length===0&&v===3&&tt&&Le(!0);const dr={name:dt.name,plugin:Ct||"",layout:v,description:dt.description,model:dt.model||void 0,allowedTools:dt.allowedTools||void 0,body:dt.body,aiMeta:ur};Ce.saveDraft(dr).then(nn=>{xe(!0),nn!=null&&nn.dir&&(fe.current=nn.dir)}).catch(()=>{})}else Tt==="error"&&(se(dt.message||dt.description||"Unknown error"),dt.category&&he(dt))}catch{}Tt=""}}}catch(tn){tn.name!=="AbortError"&&se(tn.message)}finally{ie(!1),Be.current=null}},[B,ee,v,tt,Ct,c,$]),Kn=x.useCallback(async()=>{if(L(null),!p.trim()){L("Skill name is required");return}if(!N.trim()){L("Description is required");return}if(v!==3&&!Ct.trim()){L("Plugin name is required");return}q(!0);try{const We=await Ce.createSkill({name:lf(p),plugin:Ct||"",layout:v,description:N,model:z||void 0,allowedTools:M||void 0,body:T,aiMeta:ze.current||void 0,draftDir:fe.current||void 0});fe.current=null,n(We.plugin,We.skill)}catch(We){L(We.message)}finally{q(!1)}},[p,N,v,Ct,z,M,T,n]),Xt=x.useCallback(()=>{tt&&(j(tt.layout),k(tt.plugins[0]),Le(!1))},[tt]);return{mode:s,setMode:o,layout:c,layoutLoading:f,selectedLayout:v,setSelectedLayout:j,creatableLayouts:Qe,availablePlugins:St,pathPreview:It,plugin:S,setPlugin:k,newPlugin:E,setNewPlugin:w,effectivePlugin:Ct,name:p,setName:y,description:N,setDescription:A,model:z,setModel:H,allowedTools:M,setAllowedTools:F,body:T,setBody:O,bodyViewMode:C,setBodyViewMode:_,aiPrompt:B,setAiPrompt:P,generating:W,aiGenerated:D,aiError:te,aiClassifiedError:ge,aiProgress:be,promptRef:je,handleGenerate:en,handleCancelGenerate:Te,clearAiError:Pe,targetAgents:$,setTargetAgents:K,draftSaved:pe,showPluginRecommendation:ve,setShowPluginRecommendation:Le,pluginLayoutInfo:tt,applyPluginRecommendation:Xt,creating:Z,error:I,handleCreate:Kn}}function wy(){return a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.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 uC(){return a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function Ey({node:n,depth:r=0}){var s;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",style:{paddingLeft:`${r*16}px`,color:n.type==="dir"?"var(--text-secondary)":"var(--text-tertiary)",fontSize:12,fontFamily:"var(--font-mono, monospace)"},children:[n.type==="dir"?a.jsx(wy,{}):a.jsx(uC,{}),a.jsxs("span",{children:[n.name,n.type==="dir"?"/":""]})]}),(s=n.children)==null?void 0:s.map(o=>a.jsx(Ey,{node:o,depth:r+1},o.name))]})}function dC(n,r,s){const o=[];r&&o.push({name:"evals.json",type:"file"}),o.push({name:"history",type:"dir"});const c=[{name:"SKILL.md",type:"file"},{name:"evals",type:"dir",children:o}];return s&&c.push({name:"draft.json",type:"file"}),{name:n||"{skill}",type:"dir",children:c}}function fC({skillName:n,hasEvals:r,isDraft:s}){const o=dC(n,r,s);return a.jsxs("div",{className:"glass-card p-4",children:[a.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[a.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"var(--accent-muted)"},children:a.jsx(wy,{})}),"Skill Structure"]}),a.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-0)",border:"1px solid var(--border-subtle)"},children:a.jsx(Ey,{node:o})})]})}const nr={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function Dd({size:n=14,color:r="currentColor"}){return a.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.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 pC({onCreated:n,onCancel:r}){const s=cC({onCreated:n});return a.jsxs("div",{className:"px-8 py-6 max-w-4xl animate-fade-in overflow-auto h-full",children:[a.jsxs("div",{className:"mb-5",children:[a.jsx("h2",{className:"text-[20px] font-semibold tracking-tight",style:{color:"var(--text-primary)"},children:"Create a New Skill"}),a.jsx("div",{className:"flex items-center justify-between mt-2",children:a.jsxs("div",{className:"inline-flex rounded-lg p-0.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsx("button",{onClick:()=>s.setMode("ai"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:s.mode==="ai"?"rgba(168,85,247,0.15)":"transparent",color:s.mode==="ai"?"#a855f7":"var(--text-tertiary)",boxShadow:s.mode==="ai"?"0 1px 3px rgba(168,85,247,0.15)":"none",cursor:"pointer",border:"none"},children:a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(Dd,{size:12}),"AI-Assisted"]})}),a.jsx("button",{onClick:()=>s.setMode("manual"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:s.mode==="manual"?"var(--surface-4, var(--surface-3))":"transparent",color:s.mode==="manual"?"var(--text-primary)":"var(--text-tertiary)",boxShadow:s.mode==="manual"?"0 1px 3px rgba(0,0,0,0.1)":"none",cursor:"pointer",border:"none"},children:"Manual"})]})})]}),s.layoutLoading&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"skeleton h-10 w-full rounded-lg"}),a.jsx("div",{className:"skeleton h-10 w-full rounded-lg"})]}),!s.layoutLoading&&s.layout&&s.mode==="ai"&&a.jsxs("div",{className:"space-y-4 animate-fade-in",children:[a.jsxs("div",{className:"glass-card p-4",children:[a.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[a.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsx(Dd,{size:11,color:"#a855f7"})}),"Describe Your Skill"]}),a.jsx("textarea",{ref:s.promptRef,value:s.aiPrompt,onChange:o=>s.setAiPrompt(o.target.value),placeholder:`e.g., A skill that helps format SQL queries, optimize them for performance, and explain query execution plans.
87
-
88
- Include any specific behaviors, constraints, or output formats you want.`,rows:5,disabled:s.generating,className:"w-full px-3 py-2.5 rounded-lg text-[13px] resize-y",style:{...nr,minHeight:"120px"},onKeyDown:o=>{o.key==="Enter"&&(o.metaKey||o.ctrlKey)&&(o.preventDefault(),s.handleGenerate())}}),a.jsx("p",{className:"text-[11px] mt-2",style:{color:"var(--text-quaternary, var(--text-tertiary))"},children:"Cmd+Enter to generate"})]}),s.generating&&s.aiProgress.length>0&&a.jsx(Ks,{entries:s.aiProgress,isRunning:!0}),s.aiError&&a.jsx("div",{children:s.aiClassifiedError?a.jsx(Wo,{error:s.aiClassifiedError,onRetry:s.handleGenerate,onDismiss:s.clearAiError}):a.jsxs("div",{children:[a.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:s.aiError}),a.jsx("button",{onClick:s.handleGenerate,className:"mt-2 text-[12px] font-medium",style:{color:"#a855f7",background:"none",border:"none",cursor:"pointer"},children:"Retry"})]})}),a.jsxs("div",{className:"flex items-center gap-3",children:[s.generating?a.jsx("button",{onClick:s.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"}):a.jsxs("button",{onClick:s.handleGenerate,disabled:!s.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:s.aiPrompt.trim()?"#a855f7":"var(--surface-3)",color:s.aiPrompt.trim()?"#fff":"var(--text-tertiary)",cursor:s.aiPrompt.trim()?"pointer":"not-allowed",border:"none"},children:[a.jsx(Dd,{size:14}),"Generate"]}),a.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"}),!s.generating&&a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:["or fill in the form manually",a.jsx("button",{onClick:()=>s.setMode("manual"),className:"ml-1 font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"below"})]})]})]}),!s.layoutLoading&&s.layout&&s.mode==="manual"&&a.jsxs("div",{className:"space-y-4 animate-fade-in",children:[a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Location"}),s.creatableLayouts.length>1&&a.jsxs("div",{className:"mb-3",children:[a.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Layout"}),a.jsx("div",{className:"flex gap-2",children:s.creatableLayouts.map(o=>a.jsx("button",{onClick:()=>{s.setSelectedLayout(o.layout),s.setPlugin(o.existingPlugins[0]||""),s.setNewPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:s.selectedLayout===o.layout?"var(--accent)":"var(--surface-3)",color:s.selectedLayout===o.layout?"#fff":"var(--text-secondary)",border:`1px solid ${s.selectedLayout===o.layout?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},children:o.label},o.layout))})]}),s.selectedLayout!==3&&a.jsxs("div",{className:"mb-3",children:[a.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Plugin"}),a.jsxs("select",{value:s.plugin,onChange:o=>{s.setPlugin(o.target.value),s.setNewPlugin("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:nr,children:[s.availablePlugins.map(o=>a.jsx("option",{value:o,children:o},o)),a.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),s.plugin==="__new__"&&a.jsx("input",{type:"text",value:s.newPlugin,onChange:o=>s.setNewPlugin(lf(o.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:nr})]}),a.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:s.pathPreview})]}),s.showPluginRecommendation&&s.pluginLayoutInfo&&s.selectedLayout===3&&a.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:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#3b82f6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),a.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),a.jsxs("span",{children:["Plugins detected (",a.jsx("strong",{children:s.pluginLayoutInfo.plugins.slice(0,3).join(", ")}),"). Add this skill to a plugin for better organization."]})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[a.jsx("button",{onClick:s.applyPluginRecommendation,className:"px-3 py-1 rounded-md text-[11px] font-medium",style:{background:"#3b82f6",color:"#fff",border:"none",cursor:"pointer"},children:"Use plugin"}),a.jsx("button",{onClick:()=>s.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:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Skill Details"}),a.jsxs("div",{className:"mb-3",children:[a.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Name ",a.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),a.jsx("input",{type:"text",value:s.name,onChange:o=>s.setName(lf(o.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:nr})]}),a.jsxs("div",{className:"mb-3",children:[a.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Description ",a.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),a.jsx("textarea",{value:s.description,onChange:o=>s.setDescription(o.target.value),placeholder:"Brief description",rows:3,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-y",style:{...nr,minHeight:"72px"}})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),a.jsxs("select",{value:s.model,onChange:o=>s.setModel(o.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:nr,children:[a.jsx("option",{value:"",children:"Any"}),a.jsx("option",{value:"opus",children:"Opus"}),a.jsx("option",{value:"sonnet",children:"Sonnet"}),a.jsx("option",{value:"haiku",children:"Haiku"})]})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Allowed Tools"}),a.jsx("input",{type:"text",value:s.allowedTools,onChange:o=>s.setAllowedTools(o.target.value),placeholder:"Read, Write, Edit...",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:nr})]})]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--accent-muted)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"}),a.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),a.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md"}),a.jsx("span",{className:"text-[11px] ml-2",style:{color:"var(--text-tertiary)"},children:"Skill Definition"})]})]}),a.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:["write","preview"].map(o=>a.jsxs("button",{onClick:()=>s.setBodyViewMode(o),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:s.bodyViewMode===o?"var(--surface-4)":"transparent",color:s.bodyViewMode===o?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:s.bodyViewMode===o?600:400,border:"none",cursor:"pointer"},children:[o==="write"?a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"16 18 22 12 16 6"}),a.jsx("polyline",{points:"8 6 2 12 8 18"})]}):a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),a.jsx("span",{children:o==="write"?"Write":"Preview"})]},o))})]}),s.bodyViewMode==="write"?a.jsx("textarea",{value:s.body,onChange:o=>s.setBody(o.target.value),placeholder:`# /my-skill
89
-
90
- You are an expert at...
91
- `,rows:8,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{...nr,minHeight:"150px"}}):s.body.trim()?a.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:Fo(s.body)}}):a.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:a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Start writing to see preview"})})]}),a.jsx(fC,{skillName:s.name||"{skill}",hasEvals:!1,isDraft:s.draftSaved}),s.error&&a.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:s.error}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:s.handleCreate,disabled:s.creating||!s.name||!s.description,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:s.creating||!s.name||!s.description?"var(--surface-3)":"var(--accent)",color:s.creating||!s.name||!s.description?"var(--text-tertiary)":"#fff",cursor:s.creating||!s.name||!s.description?"not-allowed":"pointer",border:"none"},children:s.creating?"Creating...":"Create Skill"}),a.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 mC(){return a.jsx("div",{className:"w-16 h-16 rounded-2xl flex items-center justify-center",style:{background:"var(--surface-2)"},children:a.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:[a.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"}),a.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),a.jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]})})}function No({variant:n,message:r,onRetry:s}){const{setMode:o,setSearch:c}=sa(),[d,f]=x.useState(!1);return n==="no-selection"?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:[a.jsx("div",{className:"mb-5",children:d?a.jsx(mC,{}):a.jsx("img",{src:"/images/empty-studio.webp",width:128,height:128,alt:"",onError:()=>f(!0),style:{objectFit:"contain"}})}),a.jsx("p",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Select a skill to view details"}),a.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Choose a skill from the list to edit, test, and evaluate"})]}):n==="no-skills"?a.jsxs("div",{className:"text-center py-12 px-4 animate-fade-in-scale",children:[a.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mx-auto mb-4",style:{background:"var(--surface-2)"},children:a.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:a.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"})})}),a.jsx("p",{className:"text-[14px] font-medium",style:{color:"var(--text-secondary)"},children:"No skills found"}),a.jsxs("p",{className:"text-[12px] mt-1 mb-4",style:{color:"var(--text-tertiary)"},children:["Check your ",a.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"]}),a.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:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Create Your First Skill"]})]}):n==="error"?a.jsx("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:a.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:[a.jsx("p",{className:"text-[13px] mb-3",style:{color:"var(--red)"},children:r||"Failed to load skill data"}),s&&a.jsx("button",{onClick:s,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"})]})}):a.jsxs("div",{className:"px-4 py-8 text-center animate-fade-in",children:[a.jsx("p",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"No skills match your search"}),a.jsx("button",{onClick:()=>c(""),className:"text-[12px] font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer",textDecoration:"underline"},children:"Clear search"})]})}function hC(n,r){const[s,o]=n.split(".").map(Number),[c,d]=r.split(".").map(Number);return c>s?"major":d>o?"minor":"patch"}const xC={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 gC(){const[n,r]=x.useState([]),[s,o]=x.useState(!0),[c,d]=x.useState(new Set),[f,h]=x.useState(new Map),[g,p]=x.useState(!1),[y,v]=x.useState(new Set),[j,S]=x.useState(null),[k,E]=x.useState(null),[w,N]=x.useState(!1),A=x.useCallback(async()=>{o(!0);try{const C=await Ce.getSkillUpdates();r(C.filter(_=>_.updateAvailable))}catch{r([])}finally{o(!1)}},[]);x.useEffect(()=>{A()},[A]);const z=x.useMemo(()=>n.filter(C=>!C.pinned),[n]),H=x.useCallback(C=>{d(_=>{const $=new Set(_);return $.has(C)?$.delete(C):$.add(C),$})},[]),M=x.useCallback(()=>{c.size===z.length?d(new Set):d(new Set(z.map(C=>C.name)))},[c,z]),F=x.useCallback(()=>{const C=[...c];if(!C.length)return;p(!0),h(new Map(C.map($=>[$,{skill:$,status:"pending"}])));const _=Ce.startBatchUpdate(C);_.addEventListener("progress",$=>{try{const K=JSON.parse($.data);h(Z=>new Map(Z).set(K.skill,K))}catch{}}),_.addEventListener("done",$=>{_.close(),p(!1);try{const K=JSON.parse($.data);S(`Updated ${K.updated??0} skills, ${K.failed??0} failed`),setTimeout(()=>S(null),5e3)}catch{}A()}),_.addEventListener("error",()=>{_.close(),p(!1),S("Batch update failed"),setTimeout(()=>S(null),5e3)})},[c,A]),T=x.useCallback(C=>{C.name.split("/").pop()||C.name;const _=C.name.split("/"),$=_.length>=3?_[_.length-2]:_[0],K=_[_.length-1];v(q=>new Set(q).add(C.name));const Z=Ce.startSkillUpdate($,K);Z.addEventListener("done",()=>{Z.close(),v(q=>{const I=new Set(q);return I.delete(C.name),I}),A()}),Z.addEventListener("error",()=>{Z.close(),v(q=>{const I=new Set(q);return I.delete(C.name),I})})},[A]),O=x.useCallback(async C=>{if(!C.latest)return;const _=C.name.split("/"),$=_.length>=3?_[_.length-2]:_[0],K=_[_.length-1];N(!0);try{const Z=await Ce.getVersionDiff($,K,C.installed,C.latest);E({skill:C,diff:Z})}catch{E(null)}finally{N(!1)}},[]);return s?a.jsxs("div",{className:"p-6",children:[a.jsx("div",{className:"skeleton h-6 w-48 mb-4"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"skeleton h-16 rounded-lg"}),a.jsx("div",{className:"skeleton h-16 rounded-lg"})]})]}):n.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-16",children:[a.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:[a.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),a.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),a.jsx("div",{className:"text-[15px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"All skills are up to date"}),a.jsx("div",{className:"text-[12px] mb-4",style:{color:"var(--text-tertiary)"},children:"No updates available for installed skills."}),a.jsx("button",{onClick:A,className:"btn btn-secondary text-[12px]",children:"Refresh"})]}):a.jsxs("div",{className:"p-6",children:[j&&a.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}),a.jsxs("div",{className:"flex items-center justify-between mb-5",children:[a.jsxs("div",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["Available Updates (",z.length,")"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:A,className:"btn btn-ghost text-[12px]",disabled:g,children:"Refresh"}),a.jsx("button",{onClick:F,disabled:c.size===0||g,className:"btn btn-primary text-[12px]",children:g?"Updating...":`Update Selected (${c.size})`})]})]}),a.jsx("div",{className:"flex items-center gap-2 mb-3",children:a.jsxs("button",{onClick:M,className:"flex items-center gap-2 text-[12px] font-medium",style:{color:"var(--text-secondary)",background:"transparent",border:"none",cursor:"pointer"},children:[a.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:c.size===z.length&&z.length>0?"var(--accent)":"var(--border-default)",background:c.size===z.length&&z.length>0?"var(--accent)":"transparent"},children:c.size===z.length&&z.length>0&&a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})}),"Select All"]})}),a.jsx("div",{className:"space-y-2",children:n.map(C=>{const _=C.name.split("/").pop()||C.name,$=C.latest?hC(C.installed,C.latest):"patch",K=xC[$],Z=!!C.pinned,q=y.has(C.name),I=f.get(C.name),L=c.has(C.name);return a.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:Z?.7:1},children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:()=>!Z&&H(C.name),disabled:Z,className:"flex-shrink-0",style:{background:"transparent",border:"none",cursor:Z?"not-allowed":"pointer"},children:a.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:L?"var(--accent)":"var(--border-default)",background:L?"var(--accent)":"transparent",opacity:Z?.4:1},children:L&&a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:_}),Z&&a.jsx("span",{className:"text-[10px]",title:"Pinned — unpin from CLI to update",children:"📌"}),a.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:K.bg,color:K.text},children:$})]}),a.jsxs("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[C.installed," → ",C.latest||"?",Z&&` (pinned at ${C.pinnedVersion||C.installed})`]})]}),I&&a.jsxs("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:I.status==="done"?"var(--green-muted)":I.status==="error"?"var(--red-muted)":"var(--yellow-muted)",color:I.status==="done"?"var(--green)":I.status==="error"?"var(--red)":"var(--yellow)"},children:[I.status,I.error&&`: ${I.error}`]}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[a.jsx("button",{onClick:()=>O(C),className:"btn btn-ghost text-[11px]",disabled:w,children:"View Changes"}),a.jsx("button",{onClick:()=>T(C),disabled:Z||q||g,title:Z?"Pinned — unpin from CLI to update":"",className:`btn ${Z?"btn-ghost":"btn-primary"} text-[11px]`,children:q?a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"spinner spinner-sm"})," Updating"]}):(I==null?void 0:I.status)==="done"?a.jsx("span",{style:{color:"var(--green)"},children:"✓"}):"Update"})]})]})},C.name)})}),k&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>E(null),children:a.jsxs("div",{style:{width:"80%",maxWidth:900},onClick:C=>C.stopPropagation(),children:[a.jsx("div",{className:"mb-2 flex justify-end",children:a.jsx("button",{onClick:()=>E(null),className:"btn btn-ghost text-[12px]",children:"Close"})}),a.jsx(Rf,{contentDiff:k.diff.contentDiff,fromLabel:k.diff.from,toLabel:k.diff.to,diffSummary:k.diff.diffSummary,renderContext:"inline"})]})})]})}function vC(n){return n==null?"var(--text-tertiary)":n>=.7?"var(--green)":n>=.4?"var(--yellow)":"var(--red)"}function yC(n){return n==null?"var(--surface-3)":n>=.7?"var(--green-muted)":n>=.4?"var(--yellow-muted)":"var(--red-muted)"}function bC(n){if(!n||typeof n!="string")return null;const r=n.trim();if(!r)return null;if(!r.includes("://")){const[s]=r.split("/");return s&&/^[A-Za-z0-9][A-Za-z0-9-]{0,38}$/.test(s)?s:null}try{const s=new URL(r),o=s.hostname.toLowerCase();if(o!=="github.com"&&o!=="www.github.com"&&o!=="raw.githubusercontent.com")return null;const d=s.pathname.split("/").filter(Boolean)[0];return!d||!/^[A-Za-z0-9][A-Za-z0-9-]{0,38}$/.test(d)?null:d}catch{return null}}function Cy(n){const{author:r,repoUrl:s}=n,o=bC(s??null),c=r&&r.trim()!==""?r:o??"—",[d,f]=x.useState(!1),h=x.useCallback(async()=>{var g;try{await((g=navigator.clipboard)==null?void 0:g.writeText(c)),f(!0),setTimeout(()=>f(!1),1500)}catch{}},[c]);return o?a.jsx("a",{"data-testid":n["data-testid"]??"author-link",href:`https://github.com/${o}`,target:"_blank",rel:"noopener noreferrer",style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-accent, var(--text-primary))",textDecoration:"none",borderBottom:"1px dotted var(--border-default, var(--border))",whiteSpace:"nowrap"},children:c}):!r||r.trim()===""?a.jsx("span",{"data-testid":n["data-testid"]??"author-link-empty",style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)"},children:"—"}):a.jsxs("button",{type:"button","data-testid":n["data-testid"]??"author-copy",title:`Copy "${c}"`,onClick:h,style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 6px",border:"1px solid var(--border-default, var(--border))",borderRadius:4,background:"transparent",fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",cursor:"pointer",whiteSpace:"nowrap"},children:[c,a.jsx("span",{"aria-hidden":"true",style:{fontSize:10,opacity:.7},children:d?"✓":"⧉"})]})}function jC(n){let r=n.split("#")[0].split("?")[0].replace(/\/+$/,"");return r=r.replace(/\/(?:tree|blob)\/[^/]+(?:\/.*)?$/,""),r}function SC(n,r){const s=jC(n),o=(r??"").replace(/^\/+/,"").replace(/\/+$/,"");return o?`${s}/blob/HEAD/${o}`:`${s}/blob/HEAD/`}function $g(n){if(!n)return"source";const r=n.replace(/\/+$/,""),s=r.lastIndexOf("/");return s===-1?r:r.slice(s+1)}function Ny(n){const{repoUrl:r,skillPath:s,absolutePath:o}=n,[c,d]=x.useState(!1),f=typeof r=="string"&&r.trim()!==""&&/^https?:\/\//.test(r.trim()),h=s?$g(s):o?$g(o):"source",g=x.useCallback(async()=>{var v;const y=o??s??"";if(y)try{await((v=navigator.clipboard)==null?void 0:v.writeText(y)),d(!0),setTimeout(()=>d(!1),1500)}catch{}},[o,s]);if(f){const y=SC(r,s);return a.jsxs("a",{"data-testid":n["data-testid"]??"source-file-link",href:y,target:"_blank",rel:"noopener noreferrer",title:y,style:{display:"inline-flex",alignItems:"center",gap:4,fontFamily:"var(--font-mono, var(--font-geist-mono))",fontSize:12,color:"var(--text-accent, var(--text-primary))",textDecoration:"none",whiteSpace:"nowrap",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis"},children:[a.jsx("span",{children:h}),a.jsx("span",{"aria-hidden":"true",children:"↗"})]})}if(!o&&!s)return a.jsx("span",{"data-testid":n["data-testid"]??"source-file-empty",style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)"},children:"—"});const p=o??s??"";return a.jsxs("button",{type:"button","data-testid":n["data-testid"]??"source-file-copy",title:`Copy ${p}`,onClick:g,style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 6px",border:"1px solid var(--border-default, var(--border))",borderRadius:4,background:"transparent",fontFamily:"var(--font-mono, var(--font-geist-mono))",fontSize:12,color:"var(--text-secondary)",cursor:"pointer",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[a.jsx("span",{children:h}),a.jsx("span",{"aria-hidden":"true",style:{fontSize:10,opacity:.7},children:c?"✓":"⧉"})]})}function Vg(n,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:n,severity:r}}))}function Ty(n){return n.skill?wC({skill:n.skill}):CC({state:n.state,isReadOnly:n.isReadOnly,onDelete:n.onDelete})}function kC(n,r=48){if(n.length<=r)return n;const s=n.slice(0,12),o=n.slice(n.length-(r-12-1));return`${s}…${o}`}function wC({skill:n}){const[r,s]=x.useState(!1),o=x.useCallback(async()=>{var f;try{await((f=navigator.clipboard)==null?void 0:f.writeText(n.dir)),s(!0),setTimeout(()=>s(!1),1500),Vg(ne.toasts.pathCopied,"info")}catch{Vg(ne.toasts.permissionDenied,"error")}},[n.dir]),c=n.origin==="installed"?"Project":"Skills",d=n.origin==="installed"?"var(--status-installed)":"var(--status-own)";return a.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:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",marginBottom:4},children:[a.jsx("span",{"data-testid":"detail-header-plugin",children:n.plugin}),a.jsx("span",{"aria-hidden":"true",style:{color:"var(--text-secondary)"},children:"›"}),a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--text-secondary)",fontSize:11,letterSpacing:.3,textTransform:"uppercase"},children:[a.jsx("span",{"data-origin-dot":n.origin,"aria-label":`Origin: ${c}`,style:{display:"inline-block",width:7,height:7,borderRadius:999,background:d}}),c]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,marginBottom:8},children:[a.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:n.skill}),a.jsx("span",{"data-testid":"detail-header-version",children:a.jsx(qs,{version:n.version??null})})]}),a.jsxs("div",{"data-testid":"detail-header-byline",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:10,margin:"0 0 8px",fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)"},children:[a.jsx(Cy,{author:n.author??null,repoUrl:n.homepage??null}),a.jsx(Ny,{repoUrl:n.homepage??null,skillPath:null,absolutePath:n.dir})]}),a.jsx(EC,{skill:n}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("button",{type:"button","data-testid":"detail-header-path-chip",title:n.dir,"aria-label":`Copy path ${n.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:kC(n.dir||"—")}),a.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:[a.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),a.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 EC({skill:n}){const r=n.installMethod,s=n.symlinkTarget;if(!r)return null;let o="";switch(r){case"symlinked":o=s?`Symlinked from ${s}`:"Symlinked (target unresolved)";break;case"copied":o="Copied (independent)";break;case"authored":o="Authored";break;default:return null}return a.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:[a.jsx("span",{style:{fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",fontSize:10,color:"var(--text-tertiary)"},children:"Install method"}),a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:o})]})}function CC({state:n,isReadOnly:r,onDelete:s}){const{plugin:o,skill:c,evals:d,latestBenchmark:f,isDirty:h,caseRunStates:g,regressions:p,iterationCount:y}=n,v=Array.from(g.values()).some(N=>N.status==="running"||N.status==="queued"),j=f==null?void 0:f.overall_pass_rate,S=(d==null?void 0:d.evals.reduce((N,A)=>N+A.assertions.length,0))??0,k=(d==null?void 0:d.evals.length)??0,E=vC(j),w=yC(j);return a.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:[a.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[a.jsx("span",{style:{color:"var(--text-tertiary)"},children:o}),a.jsx(NC,{}),a.jsx("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:c}),r&&a.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:[a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"installed"]}),h&&a.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"}),v&&a.jsxs("span",{className:"ml-2 flex items-center gap-1.5 text-[11px]",style:{color:"var(--accent)"},children:[a.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}}),"Running..."]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[!r&&s&&a.jsx("button",{disabled:v,onClick:()=>{window.confirm(`Delete skill "${c}"? This cannot be undone.`)&&s()},title:"Delete skill",className:"flex items-center justify-center transition-colors duration-150",style:{background:"none",border:"none",cursor:v?"not-allowed":"pointer",color:"var(--text-tertiary)",padding:4,opacity:v?.4:1,borderRadius:4},onMouseEnter:N=>{v||(N.currentTarget.style.color="var(--red)")},onMouseLeave:N=>{N.currentTarget.style.color="var(--text-tertiary)"},children:a.jsx(TC,{})}),p.length>0&&a.jsxs("span",{className:"pill",style:{background:"var(--red-muted)",color:"var(--red)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[a.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"}),a.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),a.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),p.length," regression",p.length>1?"s":""]}),y>0&&a.jsxs("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)"},children:["Iter ",y]}),a.jsx("span",{className:"pill",style:{background:w,color:E},children:j!=null?`${Math.round(j*100)}%`:"--"}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[k," case",k!==1?"s":""," / ",S," assert",S!==1?"s":""]})]})]})}function NC(){return a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})}function TC(){return a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"3 6 5 6 21 6"}),a.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"}),a.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),a.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}function ar(n){const{title:r,label:s,value:o,subtitle:c,description:d,linkLabel:f,children:h,onClick:g}=n,p=r??s??"",y=typeof g=="function",v=j=>{y&&(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),g==null||g())};return a.jsxs("div",{className:y?"metric-card metric-card-link":"metric-card","data-testid":n["data-testid"],role:y?"button":void 0,tabIndex:y?0:void 0,onClick:y?()=>g==null?void 0:g():void 0,onKeyDown:y?v:void 0,style:{background:"var(--card-bg, var(--bg-surface))",border:"1px solid var(--border, var(--border-default))",borderRadius:6,padding:"1rem",display:"flex",flexDirection:"column",gap:"0.375rem",minWidth:0,height:"100%",cursor:y?"pointer":void 0,wordBreak:"break-word",overflowWrap:"anywhere"},children:[p?a.jsx("div",{"data-testid":n["data-testid"]?`${n["data-testid"]}-title`:void 0,style:{fontFamily:"var(--font-geist-mono, var(--font-mono))",fontSize:"0.5625rem",fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--card-text-muted, var(--text-secondary))"},children:p}):null,a.jsx("div",{"data-testid":n["data-testid"]?`${n["data-testid"]}-value`:void 0,style:{fontFamily:"var(--font-geist-mono, var(--font-mono))",fontSize:"1.375rem",fontWeight:700,color:"var(--card-text, var(--text-primary))",lineHeight:1,fontVariantNumeric:"tabular-nums"},children:String(o)}),c?a.jsx("div",{style:{fontFamily:"var(--font-geist-mono, var(--font-mono))",fontSize:"0.625rem",color:"var(--card-text-muted, var(--text-secondary))"},children:c}):null,d?a.jsx("div",{style:{fontFamily:"var(--font-geist-mono, var(--font-mono))",fontSize:"0.5625rem",color:"var(--card-text-muted, var(--text-secondary))",lineHeight:1.4,opacity:.7},children:d}):null,h?a.jsx("div",{style:{flex:1,marginTop:"0.25rem"},children:h}):null,f?a.jsx("div",{style:{marginTop:"auto",paddingTop:"0.375rem",borderTop:"1px solid var(--border, var(--border-default))",fontFamily:"var(--font-geist-mono, var(--font-mono))",fontSize:"0.625rem",color:"var(--card-text-muted, var(--text-secondary))"},children:f}):null]})}const RC="Benchmarks are the aggregated score of this skill's evals (evals.yaml) run against its tests (tests/). Each test case produces a verdict; the benchmark is the mean pass rate.";function AC(n){const{onNavigate:r}=n,[s,o]=x.useState(n.open??!1),c=x.useCallback(()=>o(!1),[]);x.useEffect(()=>{if(!s)return;const f=h=>{h.key==="Escape"&&c()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[s,c]);const d=x.useCallback(f=>{r==null||r(f),o(!1)},[r]);return a.jsxs("span",{"data-testid":n["data-testid"]??"benchmark-info",style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[a.jsx("button",{type:"button","data-testid":"benchmark-info-trigger","aria-label":"About benchmarks","aria-expanded":!!s,onClick:()=>o(f=>!f),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:18,height:18,padding:0,border:"1px solid var(--border-default, var(--border))",borderRadius:999,background:"transparent",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-sans)",cursor:"pointer",lineHeight:1},children:"ℹ"}),s&&a.jsxs("div",{role:"dialog","data-testid":"benchmark-info-popover",style:{position:"absolute",top:"100%",right:0,marginTop:6,zIndex:20,width:280,padding:"10px 12px",background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border))",borderRadius:6,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-primary)",boxShadow:"0 4px 16px rgba(0,0,0,0.08)"},children:[a.jsx("p",{style:{margin:"0 0 8px",lineHeight:1.45},children:RC}),a.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[a.jsx("button",{type:"button","data-testid":"benchmark-info-link-tests",onClick:()=>d("tests"),style:_d,children:"Tests →"}),a.jsx("button",{type:"button","data-testid":"benchmark-info-link-run",onClick:()=>d("run"),style:_d,children:"Run →"}),a.jsx("button",{type:"button","data-testid":"benchmark-info-close",onClick:c,style:{..._d,marginLeft:"auto",color:"var(--text-secondary)"},children:"Close"})]})]})]})}const _d={background:"transparent",border:"none",padding:0,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-accent, var(--text-primary))",cursor:"pointer",textDecoration:"underline"};function MC(n){if(n==null||!Number.isFinite(n))return"—";if(n<1024)return`${n} B`;const r=n/1024;if(r<1024)return r>=10?`${Math.round(r)} KB`:`${r.toFixed(1).replace(/\.0$/,"")} KB`;const s=r/1024;return s>=10?`${Math.round(s)} MB`:`${s.toFixed(1).replace(/\.0$/,"")} MB`}function Ns(n){if(!n)return"—";const r=new Date(n);if(Number.isNaN(r.getTime()))return n;const s=Date.now()-r.getTime(),o=Math.floor(s/1e3);if(o<60)return"just now";const c=Math.floor(o/60);if(c<60)return`${c} min ago`;const d=Math.floor(c/60);if(d<24)return`${d} hr ago`;const f=Math.floor(d/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 g=Math.floor(h/12);return`${g} year${g===1?"":"s"} ago`}function LC(n){switch(n.benchmarkStatus){case"pass":case"fail":case"stale":return n.benchmarkStatus==="pass"?"100%":n.benchmarkStatus==="fail"?"0%":"—";default:return"—"}}function zC(n){const r=n.installMethod;if(!r)return null;const s=r==="authored"?"Authored":r==="copied"?"Copied":"Symlinked";return a.jsx("span",{"data-testid":"overview-install-method",style:{display:"inline-flex",alignItems:"center",padding:"1px 6px",border:"1px solid var(--border-default, var(--border))",borderRadius:4,fontFamily:"var(--font-mono, var(--font-geist-mono))",fontSize:10,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:.4},children:s})}function DC(n){var y,v;const{skill:r,onNavigate:s,activationsCount:o=0,lastRunIso:c=null,repoUrl:d,skillPathInRepo:f}=n,h=d??(_C(r.homepage)?r.homepage??null:null),g=((y=r.mcpDeps)==null?void 0:y.length)??0,p=((v=r.deps)==null?void 0:v.length)??0;return a.jsxs("div",{"data-testid":"skill-overview",className:"skill-overview",style:{display:"flex",flexDirection:"column",gap:12,padding:16},children:[a.jsxs("header",{"data-testid":"skill-overview-header",style:{position:"sticky",top:0,zIndex:5,display:"flex",flexDirection:"column",gap:6,padding:"10px 12px",background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border))",borderRadius:8},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap"},children:[a.jsx("h2",{"data-testid":"skill-overview-name",style:{fontFamily:"var(--font-serif, var(--font-sans))",fontSize:18,fontWeight:500,color:"var(--text-primary)",margin:0,lineHeight:1.2},children:r.skill}),a.jsx(qs,{version:r.version??null}),zC(r)]}),a.jsxs("div",{"data-testid":"skill-overview-byline",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:10,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)"},children:[a.jsx(Cy,{author:r.author??null,repoUrl:h}),r.category?a.jsxs("span",{children:["· ",r.category]}):null,a.jsx(Ny,{repoUrl:h,skillPath:f??null,absolutePath:r.dir}),r.lastModified?a.jsxs("span",{title:r.lastModified,children:["· Updated ",Ns(r.lastModified)]}):null]})]}),a.jsxs("div",{"data-testid":"skill-overview-grid",className:"skill-overview-grid",style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:"0.75rem",alignItems:"stretch"},children:[a.jsx(ar,{title:"Benchmark",value:LC(r),subtitle:r.lastBenchmark?Ns(r.lastBenchmark):"Never run","data-testid":"metric-benchmark",onClick:s?()=>s("run"):void 0,children:a.jsx("div",{style:{marginTop:4,display:"inline-flex",alignItems:"center"},children:a.jsx(AC,{onNavigate:s})})}),a.jsx(ar,{title:"Tests",value:r.evalCount??0,subtitle:`${r.assertionCount??0} assertions`,"data-testid":"metric-tests",onClick:s?()=>s("tests"):void 0}),a.jsx(ar,{title:"Activations",value:o,subtitle:c?`Last: ${Ns(c)}`:"Never","data-testid":"metric-activations",onClick:s?()=>s("activation"):void 0}),a.jsx(ar,{title:"Last run",value:Ns(c??r.lastBenchmark??null),"data-testid":"metric-last-run",onClick:s?()=>s("history"):void 0}),a.jsx(ar,{title:"MCP deps",value:g,subtitle:g>0&&r.mcpDeps?r.mcpDeps.slice(0,3).join(", "):"None","data-testid":"metric-mcp-deps",onClick:s?()=>s("deps"):void 0}),a.jsx(ar,{title:"Skill deps",value:p,subtitle:p>0&&r.deps?r.deps.slice(0,3).join(", "):"None","data-testid":"metric-skill-deps",onClick:s?()=>s("deps"):void 0}),a.jsx(ar,{title:"Size",value:MC(r.sizeBytes),"data-testid":"metric-size"}),a.jsx(ar,{title:"Last modified",value:Ns(r.lastModified),subtitle:r.lastModified??void 0,"data-testid":"metric-last-modified"})]})]})}function _C(n){return n?/^https?:\/\/(?:www\.)?(?:github\.com|raw\.githubusercontent\.com)\//.test(n):!1}const Pg=x.memo(function({message:r,politeness:s="polite",role:o}){const c=o??(s==="assertive"?"alert":"status");return a.jsx("div",{"aria-live":s,"aria-atomic":"true",role:c,"data-testid":"aria-live","data-politeness":s,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 OC({toast:n,onDismiss:r}){const[s,o]=x.useState(!0),c=x.useRef(null);x.useEffect(()=>(c.current=requestAnimationFrame(()=>{c.current=requestAnimationFrame(()=>o(!1))}),()=>{c.current!=null&&cancelAnimationFrame(c.current)}),[]);const d={success:"var(--status-installed)",info:"var(--text-secondary)",error:"var(--color-accent, var(--accent-surface))"};return a.jsxs("div",{role:n.severity==="error"?"alert":"status","data-testid":"toast-item","data-severity":n.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 ${d[n.severity]}`,borderRadius:6,boxShadow:"0 8px 24px rgba(0,0,0,0.12)",fontFamily:"var(--font-sans)",fontSize:12,transform:s?"translateY(8px)":"translateY(0)",opacity:s?0:1,transition:"transform var(--duration-base, 180ms) var(--ease-standard, ease), opacity var(--duration-base, 180ms) var(--ease-standard, ease)"},children:[a.jsx("span",{style:{flex:1,minWidth:0},children:n.message}),n.action&&a.jsx("button",{type:"button",onClick:()=>{n.action.onInvoke(),r(n.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:n.action.label}),a.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>r(n.id),style:{background:"transparent",border:"none",padding:2,color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1},children:"×"})]})}function BC({toasts:n,onDismiss:r,liveMessage:s,liveAssertiveMessage:o}){return a.jsxs(a.Fragment,{children:[a.jsx(Pg,{politeness:"polite",message:s}),a.jsx(Pg,{politeness:"assertive",message:o}),n.length>0&&a.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:n.map(c=>a.jsx("div",{style:{pointerEvents:"auto"},children:a.jsx(OC,{toast:c,onDismiss:r})},c.id))})]})}const Ry=x.createContext(null);function Yo(){const n=x.useContext(Ry);if(!n)throw new Error("useToast must be used inside <ToastProvider>.");return n}function IC({children:n,maxVisible:r=4,defaultDurationMs:s=4e3}){const[o,c]=x.useState([]),[d,f]=x.useState(""),[h,g]=x.useState(""),p=x.useRef(new Map),y=x.useCallback(w=>{const N=p.current.get(w);N&&(clearTimeout(N),p.current.delete(w)),c(A=>A.filter(z=>z.id!==w))},[]),v=x.useCallback((w,N)=>{if(N<=0)return;const A=setTimeout(()=>{y(w)},N);p.current.set(w,A)},[y]),j=x.useCallback(w=>{const N=w.id??`toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,A={id:N,message:w.message,severity:w.severity??"info",durationMs:w.durationMs??s,action:w.action};return c(z=>[...z,A]),A.severity==="error"?g(A.message):f(A.message),v(N,A.durationMs),N},[s,v]),S=x.useCallback(()=>{for(const w of p.current.values())clearTimeout(w);p.current.clear(),c([])},[]);x.useEffect(()=>{function w(N){N.key==="Escape"&&c(A=>{if(A.length===0)return A;const z=A.slice(0,r),H=z[z.length-1],M=p.current.get(H.id);return M&&(clearTimeout(M),p.current.delete(H.id)),A.filter(F=>F.id!==H.id)})}return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[r]),x.useEffect(()=>()=>{for(const w of p.current.values())clearTimeout(w);p.current.clear()},[]);const k=o.slice(0,r),E=x.useMemo(()=>({toast:j,dismiss:y,clear:S}),[j,y,S]);return a.jsxs(Ry.Provider,{value:E,children:[n,a.jsx(BC,{toasts:k,onDismiss:y,liveMessage:d,liveAssertiveMessage:h})]})}function HC(n){const{toast:r}=Yo(),s=x.useRef(n);s.current=n;const o=x.useCallback(async(...c)=>{const d=s.current,f=d.snapshot();d.apply(...c),d.confirmGraceMs;const h=d.timeoutMs??5e3;let g=!1,p,y=!1;const v=d.commit(...c).then(()=>{g=!0,y=!0},k=>{g=!0,p=k??new Error("Commit failed")}),j=new Promise(k=>{setTimeout(k,h)});if(await Promise.race([v,j]),!g)p=new Error("TIMEOUT");else if(y)return;d.rollback(f);const S=typeof d.failureMessage=="function"?d.failureMessage(p):d.failureMessage??"Couldn't complete that action.";r({message:S,severity:"error",durationMs:0,action:{label:"Retry",onInvoke:()=>{o(...c)}}})},[r]);return{run:o}}const Fg=6e4;function UC({skill:n}){const{refreshUpdates:r,dismissPushUpdate:s}=sa(),{toast:o}=Yo(),[c,d]=x.useState("idle"),[f,h]=x.useState(null),[g,p]=x.useState(!1),[y,v]=x.useState(null),[j,S]=x.useState(!1),k=x.useRef(null),E=x.useRef(null),w=x.useCallback(()=>new Promise((M,F)=>{if(!n){F(new Error("No skill selected"));return}const T=Ce.startSkillUpdate(n.plugin,n.skill);k.current=T;const O=()=>{E.current&&(clearTimeout(E.current),E.current=null);try{T.close()}catch{}k.current=null};E.current=setTimeout(()=>{O(),F(new Error("TIMEOUT"))},Fg),T.addEventListener("progress",C=>{try{const _=JSON.parse(C.data);typeof(_==null?void 0:_.status)=="string"&&h(_.status)}catch{}}),T.addEventListener("done",()=>{O(),d("done"),h(null),r(),s(`${n.plugin}/${n.skill}`),o({message:`Updated ${n.skill}.`,severity:"success",durationMs:4e3}),M()}),T.addEventListener("error",C=>{O();let _="Stream error";try{const $=typeof C.data=="string"?JSON.parse(C.data):null;$!=null&&$.error&&(_=String($.error))}catch{}F(new Error(_))})}),[n,r,s,o]),N=HC({snapshot:()=>({status:c}),apply:()=>{d("updating"),h("updating")},commit:()=>w(),rollback:M=>{d(M.status==="updating"?"idle":M.status),h(null)},failureMessage:M=>`Couldn't update ${(n==null?void 0:n.skill)??"skill"} — ${M.message}`,timeoutMs:Fg+1e3});if(x.useEffect(()=>{if(!g||y!=null||!n||!n.latestVersion)return;let M=!1;return S(!0),Ce.getVersionDiff(n.plugin,n.skill,n.currentVersion??"",n.latestVersion).then(F=>{M||v(F)}).catch(()=>{M||v(null)}).finally(()=>{M||S(!1)}),()=>{M=!0}},[g,y,n==null?void 0:n.plugin,n==null?void 0:n.skill,n==null?void 0:n.latestVersion,n==null?void 0:n.currentVersion,n]),x.useEffect(()=>()=>{if(E.current&&clearTimeout(E.current),k.current)try{k.current.close()}catch{}},[]),!n||n.updateAvailable!==!0)return null;const A=n.latestVersion,z=c==="updating"?"Updating…":A?`Update to ${A}`:"Update",H=c==="updating";return a.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:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("button",{type:"button","data-testid":"update-action-button",onClick:()=>{N.run()},disabled:H,style:{height:36,padding:"0 14px",background:"var(--color-ink)",color:"var(--color-paper)",border:"none",borderRadius:4,cursor:H?"not-allowed":"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500},children:z}),a.jsx("button",{type:"button","data-testid":"update-action-toggle-changelog",onClick:()=>p(M=>!M),disabled:H||!A,style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:12,fontFamily:"var(--font-sans)",cursor:"pointer",textDecoration:"underline"},children:g?"Hide changelog":"Preview changelog"})]}),f&&a.jsx("div",{"data-testid":"update-action-progress",role:"status",style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-muted, var(--text-secondary))"},children:f}),g&&A&&a.jsxs("div",{"data-testid":"update-action-changelog",style:{paddingTop:8},children:[j&&a.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Loading changelog…"}),!j&&y&&a.jsx(Rf,{contentDiff:y.contentDiff,fromLabel:y.from,toLabel:y.to,diffSummary:y.diffSummary??void 0,renderContext:"inline"}),!j&&!y&&a.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Couldn't load changelog."})]})]})}const Ay=["overview","editor","tests","run","activation","history","leaderboard","deps","versions"],$C={overview:"Overview",editor:"Editor",tests:"Tests",run:"Run",activation:"Activation",history:"History",leaderboard:"Leaderboard",deps:"Deps",versions:"Versions"};function VC(n){return typeof n=="string"&&Ay.includes(n)}function PC(){if(typeof window>"u")return"overview";const r=new URLSearchParams(window.location.search).get("panel");return VC(r)?r:"overview"}function Od(){const{state:n,setMobileView:r}=sa();return n.isMobile?a.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:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back to skills"]}):null}function FC(n={}){if(n.selectedSkillInfo!==void 0||n.loadError!==void 0)return GC(n);const{state:r,selectSkill:s,setMode:o,refreshSkills:c}=sa(),[d,f]=x.useState(typeof window<"u"?window.location.hash:"");if(x.useEffect(()=>{const p=()=>f(window.location.hash);return window.addEventListener("hashchange",p),()=>window.removeEventListener("hashchange",p)},[]),d==="#/updates")return a.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[a.jsx(Od,{}),a.jsx(gC,{})]});if(r.mode==="create")return a.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[a.jsx(Od,{}),a.jsx(pC,{onCreated:(p,y)=>{o("browse"),c(),s({plugin:p,skill:y,origin:"source"})},onCancel:()=>o("browse")})]});if(!r.selectedSkill)return r.skillsError?a.jsx(No,{variant:"error",message:r.skillsError,onRetry:c}):!r.skillsLoading&&r.skills.length===0?a.jsx(No,{variant:"no-skills"}):a.jsx(No,{variant:"no-selection"});const h=r.selectedSkill,g=r.skills.find(p=>p.plugin===h.plugin&&p.skill===h.skill)??null;return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsx(Od,{}),a.jsx(WC,{skillInfo:g,allSkills:r.skills,onSelectSkill:p=>s(p)})]})}function GC(n){const r=n.selectedSkillInfo??null,s=n.activeDetailTab??"overview";if(r==null)return qC();if(n.loadError)return KC(r,n.loadError);const o=n.allSkills&&n.onSelectSkill?{allSkills:n.allSkills,onSelectSkill:n.onSelectSkill}:void 0;return My(r,s,n.onDetailTabChange,o)}function WC({skillInfo:n,allSkills:r,onSelectSkill:s}){const[o,c]=x.useState(PC());x.useEffect(()=>{if(typeof window>"u")return;const f=new URLSearchParams(window.location.search);o==="overview"?f.delete("panel"):f.set("panel",o);const h=f.toString(),g=`${window.location.pathname}${h?"?"+h:""}${window.location.hash}`;window.history.replaceState(null,"",g)},[o]);const d=x.useMemo(()=>n?My(n,o,c,{}):a.jsx(No,{variant:"no-selection"}),[n,o,r,s]);return a.jsx("div",{className:"flex flex-col h-full",style:{background:"var(--bg-canvas)"},children:d})}function YC(n,r){return a.jsx("div",{role:"tablist","aria-label":"Detail sections","data-testid":"detail-tab-bar",style:{display:"flex",alignItems:"stretch",gap:4,borderBottom:"1px solid var(--border-default)",padding:"0 16px",background:"var(--bg-canvas)",overflowX:"auto"},children:Ay.map(s=>{const o=s===n;return a.jsx("button",{type:"button",role:"tab","aria-selected":o,tabIndex:o?0:-1,id:`detail-tab-${s}`,"aria-controls":`detail-panel-${s}`,"data-testid":`detail-tab-${s}`,onClick:()=>r==null?void 0:r(s),style:{background:"transparent",border:"none",borderBottom:o?"2px solid var(--text-primary)":"2px solid transparent",padding:"10px 8px",marginBottom:-1,fontFamily:"var(--font-sans)",fontSize:13,fontWeight:o?500:400,color:o?"var(--text-primary)":"var(--text-secondary)",cursor:"pointer",whiteSpace:"nowrap"},children:$C[s]},s)})})}function qC(){return a.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:32,background:"var(--bg-canvas)"},children:[a.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"}),a.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 KC(n,r){return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:24,background:"var(--bg-canvas)",height:"100%"},children:[Ty({skill:n}),a.jsxs("section",{role:"alert",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px"},children:[a.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 ",n.skill]}),a.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:"0 0 12px",wordBreak:"break-word"},children:r})]})]})}function XC({active:n}){return n==="editor"?a.jsx(rE,{}):n==="tests"?a.jsx(dE,{}):n==="run"?a.jsx(EE,{}):n==="activation"?a.jsx(RE,{}):n==="history"?a.jsx(GE,{}):n==="leaderboard"?a.jsx(aC,{}):n==="deps"?a.jsx(lC,{}):n==="versions"?a.jsx(zw,{}):null}function QC({active:n}){const{state:r,dispatch:s}=Nn();return x.useEffect(()=>{n!=="overview"&&r.activePanel!==n&&s({type:"SET_PANEL",panel:n})},[n,r.activePanel,s]),null}function My(n,r,s,o){const c=h=>{s==null||s(h)},d=a.jsx(DC,{skill:n,onNavigate:c,repoUrl:n.homepage??null}),f=o!=null?a.jsxs(Aw,{plugin:n.plugin,skill:n.skill,origin:n.origin,children:[a.jsx(QC,{active:r}),a.jsx(XC,{active:r})]},`${n.plugin}/${n.skill}`):a.jsxs("div",{style:{padding:16,fontFamily:"var(--font-sans)",color:"var(--text-secondary)",fontSize:13},children:["Select a skill from the sidebar to load its ",r," view."]});return a.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--bg-canvas)"},children:[a.jsx("div",{style:{padding:16,paddingBottom:12},children:Ty({skill:n})}),a.jsx(UC,{skill:n}),YC(r,s),a.jsx("div",{role:"tabpanel",id:`detail-panel-${r}`,"aria-labelledby":`detail-tab-${r}`,"data-testid":`detail-panel-${r}`,style:{flex:1,minHeight:0,overflow:"auto"},children:r==="overview"?d:f})]})}function ZC(){const{updateCount:n,state:r,dismissUpdateNotification:s}=sa(),o=n>0&&!r.updateNotificationDismissed;return x.useEffect(()=>{if(!o)return;const c=setTimeout(()=>s(),1e4);return()=>clearTimeout(c)},[o,s]),o?a.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:[a.jsxs("span",{children:[n," update",n===1?"":"s"," available"]}),a.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"}),a.jsx("button",{onClick:s,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 JC=[{name:ne.shortcuts.groupNavigation,items:[{keys:"/",label:ne.shortcuts.search},{keys:"j",label:ne.shortcuts.moveDown},{keys:"k",label:ne.shortcuts.moveUp},{keys:"Enter",label:ne.shortcuts.openSelected},{keys:"Esc",label:"Close / clear"}]},{name:ne.shortcuts.groupActions,items:[{keys:"⌘K",label:ne.shortcuts.openPalette},{keys:"?",label:ne.shortcuts.openShortcuts},{keys:"⌘B",label:ne.shortcuts.toggleSidebar},{keys:"E",label:ne.actions.edit}]},{name:ne.shortcuts.groupTheme,items:[{keys:"⌘⇧D",label:ne.shortcuts.toggleTheme}]}];function eN({open:n,onClose:r,groups:s=JC,title:o=ne.shortcuts.title}){const c=x.useRef(null),d=x.useRef(null);return x.useEffect(()=>{var f;if(n)return c.current=document.activeElement??null,(f=d.current)==null||f.focus(),()=>{var h,g;(g=(h=c.current)==null?void 0:h.focus)==null||g.call(h),c.current=null}},[n]),x.useEffect(()=>{if(!n)return;function f(h){var g;if(h.key==="Escape"){h.preventDefault(),r();return}h.key==="Tab"&&(h.preventDefault(),(g=d.current)==null||g.focus())}return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)},[n,r]),n?a.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:a.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:[a.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[a.jsx("h2",{id:"shortcut-modal-title",style:{margin:0,fontFamily:"var(--font-serif)",fontWeight:500,fontSize:18},children:o}),a.jsx("button",{ref:d,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"})]}),s.map(f=>a.jsxs("section",{style:{marginBottom:12},children:[a.jsx("h3",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--text-secondary)",margin:"0 0 6px"},children:f.name}),a.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:f.items.map(h=>a.jsxs("li",{style:{display:"flex",justifyContent:"space-between",padding:"4px 0",borderTop:"1px solid var(--border-default)",fontSize:13},children:[a.jsx("span",{children:h.label}),a.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 tN(n){const r=ne.actions,s=[{action:"open",label:r.open},{action:"copy-path",label:r.copyPath},{action:"reveal",label:r.revealInEditor},{action:"run-benchmark",label:r.runBenchmark}];if(n.origin==="source")return[...s,{action:"edit",label:r.edit},{action:"duplicate",label:r.duplicate}];const o=[...s];return n.updateAvailable&&o.push({action:"update",label:r.update}),o.push({action:"uninstall",label:r.uninstall}),o}function nN({state:n,onClose:r,onAction:s,itemsOverride:o}){const c=x.useRef(null),d=x.useRef(null),[f,h]=x.useState(0),g=x.useMemo(()=>n.skill?o??tN(n.skill):[],[n.skill,o]),p=x.useMemo(()=>{if(typeof window>"u")return{left:n.x,top:n.y};const v=8,j=220,S=44+g.length*28;let k=n.x,E=n.y;return k+j+v>window.innerWidth&&(k=Math.max(v,n.x-j)),E+S+v>window.innerHeight&&(E=Math.max(v,n.y-S)),{left:k,top:E}},[n.x,n.y,g.length]);x.useEffect(()=>{if(n.open)return d.current=document.activeElement??null,h(0),requestAnimationFrame(()=>{var v;(v=c.current)==null||v.focus()}),()=>{var v,j;(j=(v=d.current)==null?void 0:v.focus)==null||j.call(v),d.current=null}},[n.open]);const y=x.useCallback(()=>{if(!n.skill)return;const v=g[f];!v||v.disabled||(s(v.action,n.skill),r())},[g,f,n.skill,s,r]);return x.useEffect(()=>{if(!n.open)return;function v(S){if(S.key==="Escape"){S.preventDefault(),r();return}if(S.key==="ArrowDown"){S.preventDefault(),h(k=>Math.min(k+1,Math.max(g.length-1,0)));return}if(S.key==="ArrowUp"){S.preventDefault(),h(k=>Math.max(k-1,0));return}if(S.key==="Enter"||S.key===" "){S.preventDefault(),y();return}}function j(S){c.current&&S.target instanceof Node&&(c.current.contains(S.target)||r())}return window.addEventListener("keydown",v,!0),window.addEventListener("mousedown",j,!0),()=>{window.removeEventListener("keydown",v,!0),window.removeEventListener("mousedown",j,!0)}},[n.open,r,g.length,y]),!n.open||!n.skill?null:a.jsx("div",{ref:c,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:g.map((v,j)=>a.jsx("div",{role:"menuitem","aria-disabled":v.disabled||void 0,"data-action":v.action,"data-selected":j===f||void 0,onMouseEnter:()=>h(j),onClick:()=>{v.disabled||(s(v.action,n.skill),r())},style:{padding:"5px 10px",borderRadius:4,cursor:v.disabled?"default":"pointer",opacity:v.disabled?.5:1,background:j===f?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent"},children:v.label},v.action))})}const aN={"anthropic-api":{name:ne.setupProviders.anthropic.name,description:ne.setupProviders.anthropic.description,envVars:ne.setupProviders.anthropic.envVars,keyUrl:ne.setupProviders.anthropic.keyUrl,learnMoreUrl:ne.setupProviders.anthropic.learnMoreUrl},openai:{name:ne.setupProviders.openai.name,description:ne.setupProviders.openai.description,envVars:ne.setupProviders.openai.envVars,keyUrl:ne.setupProviders.openai.keyUrl,learnMoreUrl:ne.setupProviders.openai.learnMoreUrl},openrouter:{name:ne.setupProviders.openrouter.name,description:ne.setupProviders.openrouter.description,envVars:ne.setupProviders.openrouter.envVars,keyUrl:ne.setupProviders.openrouter.keyUrl,learnMoreUrl:ne.setupProviders.openrouter.learnMoreUrl},gemini:{name:ne.setupProviders.gemini.name,description:ne.setupProviders.gemini.description,envVars:ne.setupProviders.gemini.envVars,keyUrl:ne.setupProviders.gemini.keyUrl,learnMoreUrl:ne.setupProviders.gemini.learnMoreUrl},ollama:{name:ne.setupProviders.ollama.name,description:ne.setupProviders.ollama.description,envVars:ne.setupProviders.ollama.envVars,install:[ne.setupProviders.ollama.installCmd],start:[ne.setupProviders.ollama.startCmd],pullExample:ne.setupProviders.ollama.pullExample,learnMoreUrl:ne.setupProviders.ollama.learnMoreUrl},"lm-studio":{name:ne.setupProviders.lmStudio.name,description:ne.setupProviders.lmStudio.description,envVars:ne.setupProviders.lmStudio.envVars,install:[ne.setupProviders.lmStudio.installCmd],start:[ne.setupProviders.lmStudio.startCmd],pullExample:ne.setupProviders.lmStudio.pullExample,learnMoreUrl:ne.setupProviders.lmStudio.learnMoreUrl},"claude-code":{name:ne.setupProviders.claudeCode.name,description:ne.setupProviders.claudeCode.description,envVars:[],notes:[ne.setupProviders.claudeCode.loginHint,ne.claudeCodeLabel.compactLabel],learnMoreUrl:ne.setupProviders.claudeCode.learnMoreUrl}};function rN(n){return n?aN[n]??null:null}function lN({open:n,providerKey:r,onClose:s}){const o=x.useRef(null);if(x.useEffect(()=>{if(!n)return;const f=h=>{h.key==="Escape"&&(h.preventDefault(),s())};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[n,s]),x.useEffect(()=>{if(!n)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()},[n]),!n||typeof document>"u")return null;const c=rN(r),d=(c==null?void 0:c.name)??ne.setupDrawer.fallbackTitle;return Bo.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("div",{"data-testid":"setup-drawer-backdrop","aria-hidden":"true",onClick:s,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:99,animation:"vskillDrawerBackdropIn 120ms ease"}}),a.jsxs("div",{"data-testid":"setup-drawer",ref:o,role:"dialog","aria-modal":"true","aria-label":ne.setupDrawer.title(d),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:[a.jsx(sN,{title:d,onClose:s}),a.jsx("div",{"data-testid":"setup-drawer-body",style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:c?a.jsx(iN,{content:c}):a.jsx(oN,{})}),a.jsx("style",{children:`@keyframes vskillDrawerIn {
92
- from { transform: translateX(100%); }
93
- to { transform: translateX(0); }
94
- }
95
- @keyframes vskillDrawerBackdropIn {
96
- from { opacity: 0; }
97
- to { opacity: 1; }
98
- }`})]})]}),document.body)}function sN({title:n,onClose:r}){return a.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 20px",borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:[a.jsx("h2",{style:{fontFamily:"var(--font-serif)",fontSize:18,fontWeight:500,margin:0,color:"var(--text-primary)"},children:ne.setupDrawer.title(n)}),a.jsx("button",{type:"button","data-testid":"setup-drawer-close",onClick:r,"aria-label":ne.setupDrawer.close,style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:18,padding:4,lineHeight:1},children:"×"})]})}function iN({content:n}){var r,s;return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[a.jsx("p",{style:{fontSize:14,lineHeight:1.5,color:"var(--text-primary)",margin:0},children:n.description}),n.notes&&n.notes.length>0&&a.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:6},children:n.notes.map(o=>a.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))}),n.envVars.length>0&&a.jsxs("section",{children:[a.jsx("h3",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",margin:"0 0 8px"},children:ne.setupDrawer.requiredEnv}),a.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:6},children:n.envVars.map(o=>a.jsx("li",{children:a.jsx(cN,{name:o})},o))})]}),n.keyUrl&&a.jsx(uN,{href:n.keyUrl,label:ne.setupDrawer.getKey,testId:"setup-drawer-get-key"}),(n.install||n.start||n.pullExample)&&a.jsxs("section",{children:[a.jsx("h3",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",margin:"0 0 8px"},children:ne.setupDrawer.installRun}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(r=n.install)==null?void 0:r.map((o,c)=>a.jsx(Bd,{code:o},`install-${c}`)),(s=n.start)==null?void 0:s.map((o,c)=>a.jsx(Bd,{code:o},`start-${c}`)),n.pullExample&&a.jsx(Bd,{code:n.pullExample})]})]}),a.jsx("footer",{style:{marginTop:8},children:a.jsxs("a",{href:n.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:[ne.setupDrawer.learnMore," →"]})})]})}function oN(){return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[a.jsx("h3",{style:{margin:0,fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:ne.setupDrawer.fallbackTitle}),a.jsx("p",{style:{margin:0,fontSize:13,color:"var(--text-secondary)",lineHeight:1.5},children:ne.setupDrawer.fallbackBody})]})}function cN({name:n}){const r=async()=>{var s;try{await((s=navigator.clipboard)==null?void 0:s.writeText(n))}catch{}};return a.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:[a.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",flex:1},children:n}),a.jsx("button",{type:"button",onClick:r,"aria-label":`Copy ${n} 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:ne.setupDrawer.copy})]})}function Bd({code:n}){return a.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:n})}function uN({href:n,label:r,testId:s}){return a.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer","data-testid":s,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 dN(){const[n,r]=x.useState(!1),[s,o]=x.useState(null),c=x.useRef(null),d=x.useCallback((h,g)=>{var p;c.current=typeof document<"u"?document.activeElement:null,(p=g==null?void 0:g.beforeOpen)==null||p.call(g),o(h),r(!0)},[]),f=x.useCallback(()=>{r(!1);const h=c.current;h&&"focus"in h&&typeof h.focus=="function"&&queueMicrotask(()=>h.focus())},[]);return{open:d,close:f,isOpen:n,providerKey:s}}function fN(n){const r=[],s=[],o=new Set;for(const c of n){if(c.presence==="absent"||c.health==="missing"){s.push({kind:"individual",key:c.id,agent:c});continue}if(c.sharedFolderGroup&&c.sharedFolderGroup.length>1){const d=[...c.sharedFolderGroup].sort().join("+");if(o.has(d))continue;o.add(d);const f=n.filter(h=>c.sharedFolderGroup.includes(h.id));r.push({kind:"aggregate",key:`shared:${d}`,consumers:f,sharedFolderPath:c.sharedFolderPath??"~/.config/agents/skills",combinedCount:f.reduce((h,g)=>h+g.globalCount,0)});continue}r.push({kind:"individual",key:c.id,agent:c})}return{detected:r,notDetected:s}}function pN({agents:n,activeAgentId:r,focusedAgentId:s,onFocusAgent:o,onSwitch:c,onOpenSetup:d,onClose:f}){const h=x.useRef(null);x.useEffect(()=>{const y=v=>{v.key==="Escape"&&(v.preventDefault(),f())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[f]),x.useEffect(()=>{const y=j=>{h.current&&!h.current.contains(j.target)&&f()},v=setTimeout(()=>{document.addEventListener("mousedown",y)},0);return()=>{clearTimeout(v),document.removeEventListener("mousedown",y)}},[f]);const g=x.useMemo(()=>fN(n),[n]),p=n.find(y=>y.id===s)??n.find(y=>y.id===r)??n[0];return typeof document>"u"?null:Bo.createPortal(a.jsxs("div",{ref:h,"data-testid":"agent-scope-picker-popover",role:"dialog","aria-label":ne.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:[a.jsxs("div",{style:{display:"flex",height:360,maxHeight:"60vh"},children:[a.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:[g.detected.length===0&&g.notDetected.length===0&&a.jsx(Gg,{}),g.detected.map(y=>y.kind==="aggregate"?a.jsx(hN,{row:y,onFocus:()=>{var v;return o(((v=y.consumers[0])==null?void 0:v.id)??r??"")}},y.key):a.jsx(mN,{agent:y.agent,focused:y.agent.id===s,active:y.agent.id===r,onClick:()=>o(y.agent.id)},y.key)),g.notDetected.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{"data-testid":"agent-scope-not-detected-subheading",title:"These agents were not found on this machine. Hover a row to see which folder detection looked for.",style:{padding:"10px 14px 4px",fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-tertiary)"},children:ne.scopePicker.notDetectedSubheading}),g.notDetected.map(y=>a.jsx(xN,{agent:y.agent},y.key))]})]}),a.jsx("section",{"data-testid":"agent-scope-picker-stats",style:{flex:1,overflowY:"auto",padding:"14px 16px"},children:p?a.jsx(gN,{agent:p,activeAgentId:r,onSwitch:()=>c(p.id)}):a.jsx(Gg,{})})]}),a.jsx("style",{children:`@keyframes scopePickerFadeIn {
99
- from { opacity: 0; transform: translateX(-50%) translateY(2px); }
100
- to { opacity: 1; transform: translateX(-50%) translateY(0); }
101
- }`})]}),document.body)}function mN({agent:n,focused:r,active:s,onClick:o}){const c=n.health==="ok"?"var(--color-ok, #22c55e)":n.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)";return a.jsxs("button",{type:"button","data-testid":"agent-scope-row","data-agent-id":n.id,"data-active":s?"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:[a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:c,flexShrink:0}}),a.jsx("span",{style:{flex:1,fontSize:13},children:n.displayName}),a.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[n.installedCount,"·",n.globalCount]})]})}function hN({row:n,onFocus:r}){return a.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:[a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)"},children:n.sharedFolderPath}),a.jsxs("span",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[n.consumers.map(s=>a.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:s.id},s.id)),a.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontFamily:"var(--font-mono)"},children:["· ",n.combinedCount," skills"]})]})]})}function xN({agent:n}){const r=n.isRemoteOnly?`${n.displayName} is a web-only product — no local CLI or folder to detect.`:n.resolvedGlobalDir?`Looked for ${n.resolvedGlobalDir} — not found.`:`${n.displayName} was not found on this machine.`;return a.jsxs("div",{"data-testid":`agent-scope-not-detected-row-${n.id}`,title:r,style:{display:"flex",alignItems:"center",gap:10,padding:"6px 14px",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:12},children:[a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--text-tertiary)",flexShrink:0}}),a.jsx("span",{style:{flex:1},children:n.displayName}),n.isRemoteOnly&&a.jsx("span",{"data-testid":`agent-scope-remote-badge-${n.id}`,"aria-label":"Remote-only agent",title:"Web-only agent — no local CLI to install skills into. Use the agent's web UI to load skills.",style:{background:"color-mix(in srgb, var(--text-tertiary) 18%, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:10,padding:"1px 8px",color:"var(--text-secondary)",fontSize:10,letterSpacing:"0.04em",textTransform:"uppercase"},children:"Remote"})]})}function gN({agent:n,activeAgentId:r,onSwitch:s}){const o=n.id===r,c=n.isRemoteOnly===!0,d=o||c,f=o?"Active":c?"Remote-only":ne.scopePicker.switchCta;return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:n.displayName}),a.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:2},children:c?"Remote service — no local install":yN(n.health)})]}),a.jsxs("dl",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"4px 12px",margin:0,fontSize:12},children:[a.jsx(Id,{label:ne.scopePicker.statsInstalled,value:String(n.installedCount)}),a.jsx(Id,{label:ne.scopePicker.statsGlobal,value:String(n.globalCount)}),a.jsx(Id,{label:ne.scopePicker.statsLastSync,value:n.lastSync?vN(n.lastSync):"—"})]}),a.jsx("button",{type:"button","data-testid":"agent-scope-switch",onClick:s,disabled:d,title:c?"This agent has no local CLI to switch to":void 0,style:{alignSelf:"flex-start",padding:"8px 14px",borderRadius:6,border:"1px solid var(--border-default, var(--border-subtle))",background:d?"transparent":"color-mix(in srgb, var(--accent-surface) 20%, transparent)",color:"var(--text-primary)",fontSize:12,fontWeight:500,fontFamily:"var(--font-sans)",cursor:d?"default":"pointer",opacity:d?.5:1},children:f})]})}function Id({label:n,value:r}){return a.jsxs(a.Fragment,{children:[a.jsx("dt",{style:{color:"var(--text-secondary)",margin:0},children:n}),a.jsx("dd",{style:{color:"var(--text-primary)",margin:0,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums"},children:r})]})}function Gg(){return a.jsx("div",{style:{padding:"16px 18px",fontSize:12,color:"var(--text-secondary)"},children:"No agents detected yet."})}function vN(n){try{const r=new Date(n).getTime(),s=Date.now()-r;if(Number.isNaN(r))return"—";const o=Math.round(s/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const c=Math.round(o/60);return c<24?`${c}h ago`:`${Math.round(c/24)}d ago`}catch{return"—"}}function yN(n){switch(n){case"ok":return ne.scopePicker.statsHealthOk;case"stale":return ne.scopePicker.statsHealthStale;case"missing":return ne.scopePicker.statsHealthMissing}}function bN(n){const r=new Map;for(const s of n.sharedFolders??[])for(const o of s.consumers)r.set(o,s);return n.agents.map(s=>{const o=r.get(s.id);return{id:s.id,displayName:s.displayName,presence:s.detected?"detected":"absent",installedCount:s.localSkillCount,globalCount:s.globalSkillCount,lastSync:s.lastSync,health:s.health,sharedFolderGroup:o?o.consumers:void 0,sharedFolderPath:o?o.path:void 0,isRemoteOnly:s.isRemoteOnly,resolvedGlobalDir:s.resolvedGlobalDir}})}function jN({agents:n,activeAgentId:r,onActiveAgentChange:s,onOpenSetup:o}){const[c,d]=x.useState(!1),[f,h]=x.useState(null),g=x.useRef(null),p=x.useMemo(()=>n.find(S=>S.id===r)??n[0]??null,[n,r]),y=x.useMemo(()=>p?p.health==="ok"?"var(--color-ok, #22c55e)":p.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)":"var(--text-tertiary)",[p]),v=x.useCallback(()=>{var S;d(!1),(S=g.current)==null||S.focus()},[]),j=x.useCallback(S=>{s(S),d(!1)},[s]);return a.jsxs(a.Fragment,{children:[a.jsxs("button",{ref:g,type:"button","data-testid":"agent-scope-picker-trigger","aria-haspopup":"dialog","aria-expanded":c,onClick:()=>d(S=>!S),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),d(!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:[a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:y,flexShrink:0}}),a.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(p==null?void 0:p.displayName)??"Select agent"}),a.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,")"]}),a.jsx("span",{"aria-hidden":"true",style:{fontSize:10,color:"var(--text-secondary)"},children:"▾"})]}),c&&a.jsx(pN,{agents:n,activeAgentId:r,focusedAgentId:f??r,onFocusAgent:h,onSwitch:j,onOpenSetup:S=>{o(S),v()},onClose:v})]})}const Ly="vskill-ccode-banner-dismissed",SN=new Set(["claude-cli","claude-code"]);function kN(){try{return sessionStorage.getItem(Ly)==="true"}catch{return!1}}function wN(){try{sessionStorage.setItem(Ly,"true")}catch{}}function EN({activeAgentId:n}){const[r,s]=x.useState(()=>kN()),o=x.useCallback(()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:open-setup-drawer",{detail:{provider:"claude-code"}}))},[]),c=x.useCallback(()=>{wN(),s(!0)},[]);return!n||!SN.has(n)||r?null:a.jsxs("div",{"data-testid":"claude-code-first-use-banner",role:"note","aria-label":"Claude Code subscription info",style:{display:"flex",alignItems:"flex-start",gap:10,padding:"8px 12px",borderBottom:"1px solid var(--border-default, var(--border-subtle))",background:"color-mix(in srgb, var(--accent-surface) 8%, transparent)",fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-primary)",lineHeight:1.45},children:[a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--color-ok, #22c55e)",marginTop:6,flexShrink:0}}),a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsxs("span",{children:[ne.claudeCodeLabel.firstUseBanner," "]}),a.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-learn-more",onClick:o,style:{background:"transparent",border:"none",padding:0,color:"var(--color-accent, var(--accent-surface))",cursor:"pointer",textDecoration:"underline",fontFamily:"inherit",fontSize:"inherit"},children:ne.claudeCodeLabel.learnMore})]}),a.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-dismiss",onClick:c,"aria-label":"Dismiss Claude Code info banner",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1,padding:2,flexShrink:0},children:"×"})]})}function CN(){const[n,r]=x.useState(null),[s,o]=x.useState("loading"),[c,d]=x.useState(null),f=x.useCallback(async()=>{try{const h=await Ce.getAgents();r(h),o("ready"),d(null)}catch(h){o("error"),d(h.message)}},[]);return x.useEffect(()=>{f()},[f]),x.useEffect(()=>{const h=()=>void f();return window.addEventListener("studio:agent-changed",h),()=>window.removeEventListener("studio:agent-changed",h)},[f]),{status:s,response:n,error:c,refresh:()=>void f()}}const vo="workspace",NN=["skills","agents"];async function TN(){const n=await fetch("/api/workspace");if(!n.ok)throw new Error(`GET /api/workspace failed: ${n.status}`);return await n.json()}async function RN(n){const r=await fetch("/api/workspace/active",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:n})});if(!r.ok){const s=await r.json().catch(()=>({}));throw new Error(s.error??`POST /api/workspace/active failed: ${r.status}`)}return await r.json()}async function AN(n){const r=await fetch("/api/workspace/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const s=await r.json().catch(()=>({}));throw new Error(s.error??`POST /api/workspace/projects failed: ${r.status}`)}return await r.json()}async function MN(n){const r=await fetch(`/api/workspace/projects/${encodeURIComponent(n)}`,{method:"DELETE"});if(!r.ok){const s=await r.json().catch(()=>({}));throw new Error(s.error??`DELETE /api/workspace/projects/${n} failed: ${r.status}`)}return await r.json()}function Hd(){for(const n of NN)on(n)}function LN(){const{data:n,loading:r,error:s,revalidate:o}=Al(vo,TN),c=n,d=c==null?void 0:c.projects.find(p=>p.id===c.activeProjectId),f=x.useCallback(async p=>{await RN(p),on(vo),Hd()},[]),h=x.useCallback(async p=>{await AN(p),on(vo),Hd()},[]),g=x.useCallback(async p=>{await MN(p),on(vo),Hd()},[]);return{workspace:c,activeProject:d,loading:r,error:s,switchProject:f,addProject:h,removeProject:g,revalidate:o}}function zN({workspace:n,onSwitch:r,onAdd:s,onRemove:o,isPathStale:c}){const[d,f]=x.useState(!1),[h,g]=x.useState(!1),[p,y]=x.useState(""),[v,j]=x.useState(null),[S,k]=x.useState(null),[E,w]=x.useState(null),[N,A]=x.useState(!1),z=x.useRef(null),H=(n==null?void 0:n.projects)??[],M=H.find(C=>C.id===(n==null?void 0:n.activeProjectId));x.useEffect(()=>{if(!d)return;function C(_){z.current&&!z.current.contains(_.target)&&(f(!1),g(!1),j(null))}return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[d]);async function F(){j(null);const C=p.trim();if(!C){j("Paste an absolute path (e.g. /Users/you/projects/my-skill)");return}if(!C.startsWith("/")&&!/^[A-Za-z]:[\\/]/.test(C)){j("Path must be absolute. In Terminal, cd to the folder and run: pwd — then paste the result here.");return}try{await s({path:C}),y(""),g(!1)}catch(_){const $=_ instanceof Error?_.message:String(_);/does not exist/i.test($)?j(`Path not found on disk: ${C}`):/Duplicate/i.test($)?j("That project is already registered."):j($)}}async function T(){if(j(null),typeof window<"u"&&"showDirectoryPicker"in window)try{const C=await window.showDirectoryPicker();y(C.name),g(!0)}catch{}else g(!0)}function O(C){if(C.length<=50)return C;const _=C.split("/");return _.length<=4?C:`${_.slice(0,3).join("/")}/…/${_.slice(-2).join("/")}`}return a.jsxs("div",{ref:z,"data-vskill-project-picker":!0,style:{position:"relative",display:"inline-block"},children:[a.jsxs("button",{type:"button",onClick:()=>f(C=>!C),"aria-expanded":d,"aria-haspopup":"menu",title:(M==null?void 0:M.path)??"No project selected",style:{display:"flex",alignItems:"center",gap:8,padding:"4px 10px",border:"1px solid transparent",borderRadius:6,background:d?"var(--surface-2, rgba(0,0,0,0.05))":"transparent",cursor:"pointer",fontFamily:"var(--font-mono)",fontSize:13,color:"var(--text-primary)",transition:"background-color 120ms ease"},children:[a.jsx("span",{"aria-hidden":!0,style:{width:8,height:8,borderRadius:"50%",flexShrink:0,backgroundColor:(M==null?void 0:M.colorDot)??"var(--text-tertiary, #999)"}}),a.jsx("span",{style:{maxWidth:180,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:M?M.name:"No project"}),a.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-tertiary, #999)",marginLeft:2},children:d?"▴":"▾"})]}),d&&a.jsxs("div",{role:"menu","aria-label":"Switch project",style:{position:"absolute",top:"calc(100% + 4px)",left:0,minWidth:280,maxWidth:420,width:"max-content",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:8,boxShadow:"0 4px 6px -1px rgba(0,0,0,0.08), 0 10px 20px -5px rgba(0,0,0,0.12)",overflow:"hidden",zIndex:50,fontFamily:"var(--font-sans)"},children:[H.length===0&&a.jsx("div",{style:{padding:"16px 16px 12px",fontSize:12,color:"var(--text-tertiary)",lineHeight:1.5},children:"No projects registered. Add one to get started."}),H.length>0&&a.jsx("ul",{role:"none",style:{listStyle:"none",margin:0,padding:4,maxHeight:320,overflowY:"auto"},children:H.map(C=>{const _=c?c(C.path):!1,$=C.id===(n==null?void 0:n.activeProjectId),K=S===C.id;return a.jsxs("li",{role:"menuitem","data-stale":_?"true":"false",onMouseEnter:()=>k(C.id),onMouseLeave:()=>k(Z=>Z===C.id?null:Z),onClick:()=>{if(!_){if($){f(!1);return}w(C)}},style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:6,cursor:_?"not-allowed":"pointer",background:K&&!_?"var(--surface-2, rgba(0,0,0,0.04))":$?"var(--surface-1, rgba(0,0,0,0.02))":"transparent",opacity:_?.5:1,transition:"background-color 120ms ease"},children:[a.jsx("span",{"aria-hidden":!0,style:{width:10,height:10,borderRadius:"50%",flexShrink:0,backgroundColor:C.colorDot,boxShadow:$?"0 0 0 2px color-mix(in oklch, currentColor 20%, transparent)":"none"}}),a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13,fontWeight:$?600:500,color:"var(--text-primary)",lineHeight:1.3},children:[a.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:C.name}),$&&a.jsx("span",{"aria-label":"Active",style:{fontSize:10,color:"var(--color-action, #2F5B8E)",letterSpacing:"0.05em",textTransform:"uppercase",fontWeight:600},children:"Active"})]}),a.jsx("div",{title:C.path,style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-tertiary)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:O(C.path)}),_&&a.jsx("div",{style:{fontSize:10,color:"var(--color-own, #b45309)",marginTop:2},children:"Path no longer exists"})]}),a.jsx("button",{type:"button","aria-label":`Remove ${C.name}`,onClick:Z=>{Z.stopPropagation(),o(C.id)},style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",borderRadius:4,cursor:"pointer",color:"var(--text-tertiary)",opacity:K?1:0,transition:"opacity 120ms ease, color 120ms ease, background-color 120ms ease",flexShrink:0},onMouseEnter:Z=>{Z.currentTarget.style.color="var(--color-error, #b91c1c)",Z.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-error, #b91c1c) 10%, transparent)"},onMouseLeave:Z=>{Z.currentTarget.style.color="var(--text-tertiary)",Z.currentTarget.style.backgroundColor="transparent"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[a.jsx("polyline",{points:"3 6 5 6 21 6"}),a.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),a.jsx("path",{d:"M10 11v6"}),a.jsx("path",{d:"M14 11v6"}),a.jsx("path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]})})]},C.id)})}),a.jsxs("div",{style:{borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",padding:h?8:6},children:[!h&&a.jsxs("button",{type:"button",onClick:()=>void T(),className:"vskill-project-add",style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 10px",border:"none",borderRadius:6,background:"transparent",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500,color:"var(--color-action, #2F5B8E)",transition:"background-color 120ms ease"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-action, #2F5B8E) 10%, transparent)"},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent"},children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add project"]}),h&&a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx("input",{type:"text",value:p,onChange:C=>y(C.target.value),onKeyDown:C=>{C.key==="Enter"&&F(),C.key==="Escape"&&(g(!1),j(null))},placeholder:"/absolute/path/to/project",autoFocus:!0,style:{width:"100%",padding:"6px 8px",fontFamily:"var(--font-mono)",fontSize:12,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none"}}),a.jsxs("div",{style:{display:"flex",gap:6,justifyContent:"flex-end"},children:[a.jsx("button",{type:"button",onClick:()=>{g(!1),j(null),y("")},style:{padding:"4px 10px",fontSize:12,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Cancel"}),a.jsx("button",{type:"button",onClick:()=>void F(),style:{padding:"4px 10px",fontSize:12,border:"none",borderRadius:4,background:"var(--color-action, #2F5B8E)",color:"var(--color-paper, #fff)",cursor:"pointer",fontWeight:500},children:"Add"})]}),v&&a.jsx("div",{style:{fontSize:11,color:"var(--color-error, #b91c1c)"},children:v})]})]})]}),E&&a.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Switch project instructions",style:{position:"fixed",inset:0,zIndex:80,display:"flex",alignItems:"center",justifyContent:"center"},onClick:()=>w(null),children:[a.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.40)"}}),a.jsxs("div",{onClick:C=>C.stopPropagation(),style:{position:"relative",width:"min(520px, 92vw)",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:10,boxShadow:"0 10px 15px -3px rgba(0,0,0,0.12), 0 20px 40px -8px rgba(0,0,0,0.18)",padding:18,fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[a.jsxs("h2",{style:{margin:0,fontSize:16,fontWeight:600,fontFamily:"var(--font-serif, ui-serif)",marginBottom:8},children:["Switch to ",E.name]}),a.jsx("p",{style:{fontSize:13,color:"var(--text-secondary)",lineHeight:1.5,margin:0,marginBottom:12},children:"Skill Studio's skill scanner reads from the folder it was launched in, so switching projects from the browser isn't possible. Quit this server and relaunch from the target folder:"}),a.jsx("div",{style:{background:"var(--surface-1, #0f0f10)",color:"var(--text-primary)",padding:"10px 12px",borderRadius:6,fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.55,whiteSpace:"pre-wrap",wordBreak:"break-all",border:"1px solid var(--border-subtle, rgba(255,255,255,0.08))"},children:`cd "${E.path}" && npx vskill@latest studio`}),a.jsxs("div",{style:{display:"flex",gap:8,marginTop:14,justifyContent:"flex-end"},children:[a.jsx("button",{type:"button",onClick:async()=>{try{await navigator.clipboard.writeText(`cd "${E.path}" && npx vskill@latest studio`),A(!0),setTimeout(()=>A(!1),1600)}catch{}},style:{padding:"7px 14px",fontSize:13,fontWeight:600,border:"1px solid var(--color-action, #2F5B8E)",borderRadius:6,background:"var(--color-action, #2F5B8E)",color:"#ffffff",cursor:"pointer",boxShadow:"0 1px 2px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.12)"},children:N?"Copied!":"Copy command"}),a.jsx("button",{type:"button",onClick:()=>w(null),style:{padding:"7px 12px",fontSize:13,fontWeight:500,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Close"})]})]})]})]})}function DN(n,r){const s=r.trim().toLowerCase().split(/\s+/).filter(Boolean);return s.length===0?n:n.filter(o=>{const c=`${o.name} ${o.path}`.toLowerCase();return s.every(d=>c.includes(d))})}function _N({open:n,projects:r,onSwitch:s,onClose:o}){const[c,d]=x.useState(""),[f,h]=x.useState(0),g=x.useMemo(()=>DN(r,c),[r,c]);x.useEffect(()=>{n||(d(""),h(0))},[n]),x.useEffect(()=>{f>=g.length&&h(0)},[g.length,f]);const p=y=>{if(y.key==="Escape"){y.preventDefault(),o();return}if(y.key==="ArrowDown"){y.preventDefault(),h(v=>Math.min(v+1,Math.max(g.length-1,0)));return}if(y.key==="ArrowUp"){y.preventDefault(),h(v=>Math.max(v-1,0));return}if(y.key==="Enter"){y.preventDefault();const v=g[f];v&&(s(v.id),o())}};return n?a.jsxs("div",{role:"dialog","aria-modal":"true","data-vskill-project-palette":!0,className:"vskill-project-palette fixed inset-0 z-50 flex items-start justify-center pt-24",children:[a.jsx("div",{className:"absolute inset-0 bg-black/30",onClick:o}),a.jsxs("div",{className:"relative w-[520px] max-w-[92vw] bg-background border rounded shadow-lg",children:[a.jsx("input",{type:"text",autoFocus:!0,value:c,onChange:y=>d(y.target.value),onKeyDown:p,placeholder:"Switch project…",className:"w-full px-3 py-2 text-sm border-b outline-none"}),a.jsxs("ul",{role:"listbox",className:"max-h-80 overflow-auto",children:[g.length===0&&a.jsx("li",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No matches."}),g.map((y,v)=>a.jsxs("li",{role:"option","aria-selected":v===f,"data-highlighted":v===f,className:["flex items-center gap-2 px-3 py-2 text-sm cursor-pointer",v===f?"bg-muted":""].join(" "),onMouseEnter:()=>h(v),onClick:()=>{s(y.id),o()},children:[a.jsx("span",{"aria-hidden":!0,className:"inline-block w-2 h-2 rounded-full",style:{backgroundColor:y.colorDot}}),a.jsxs("span",{className:"flex-1",children:[a.jsx("span",{className:"vskill-palette-name",children:y.name}),a.jsx("span",{className:"ml-2 vskill-palette-path text-xs font-mono text-muted-foreground",children:y.path})]})]},y.id))]})]})]}):null}const Wg=/^[a-z][a-z0-9-]{0,62}[a-z0-9]$/;function ON({open:n,onClose:r,initialMode:s="standalone",isClaudeCode:o,projectRoot:c,onCreated:d}){const[f,h]=x.useState("destination"),[g,p]=x.useState(s),[y,v]=x.useState(""),[j,S]=x.useState(""),[k,E]=x.useState(""),[w,N]=x.useState([]),[A,z]=x.useState(!1),[H,M]=x.useState(null);if(x.useEffect(()=>{n&&(h("destination"),p(s),v(""),S(""),E(""),M(null))},[n,s]),x.useEffect(()=>{if(!n)return;let I=!0;return fetch("/api/authoring/plugins").then(L=>L.json()).then(L=>{I&&N(L.plugins??[])}).catch(()=>{}),()=>{I=!1}},[n]),x.useEffect(()=>{if(!n)return;function I(L){L.key==="Escape"&&(L.preventDefault(),r())}return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[n,r]),!n)return null;const F=w.length>0,T=o&&F,O=o,C=Wg.test(y),_=g==="existing-plugin"?j.length>0:Wg.test(j),$=!A&&C&&(g==="standalone"||_),K=BN(c,g,j,y);async function Z(){M(null),z(!0);try{const B=new URLSearchParams;B.set("mode",g),B.set("skillName",y),j&&B.set("pluginName",j);const P=await fetch(`/api/authoring/skill-exists?${B.toString()}`),W=await P.json();if(!P.ok){M(W.error??`Check failed: ${P.status}`);return}if(W.exists){M(`Skill '${y}' already exists${W.path?` at ${W.path}`:""}`);return}}catch(B){M(B instanceof Error?B.message:String(B));return}finally{z(!1)}const I=new URLSearchParams;I.set("mode",g),I.set("skillName",y),k.trim()&&I.set("description",k.trim()),j&&I.set("pluginName",j);const L=`#/create?${I.toString()}`;typeof window<"u"&&(window.location.hash=L),r()}async function q(){M(null),z(!0);try{const I=await fetch("/api/authoring/create-skill",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:g,skillName:y,description:k.trim()||void 0,pluginName:g==="standalone"?void 0:j})}),L=await I.json();if(!I.ok||!L.ok){M(L.error??`Create failed: ${I.status}`);return}on("skills"),d==null||d({mode:g,skillName:y,pluginName:L.pluginName??null,skillMdPath:L.skillMdPath}),r()}catch(I){M(I instanceof Error?I.message:String(I))}finally{z(!1)}}return a.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Create skill","data-vskill-create-skill-modal":!0,style:{position:"fixed",inset:0,zIndex:100,display:"flex",alignItems:"center",justifyContent:"center"},children:[a.jsx("div",{onClick:r,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.45)"}}),a.jsxs("div",{style:{position:"relative",width:"min(560px, 92vw)",maxHeight:"86vh",overflow:"auto",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:10,boxShadow:"0 10px 15px -3px rgba(0,0,0,0.12), 0 20px 40px -8px rgba(0,0,0,0.18)",fontFamily:"var(--font-sans)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.08))"},children:[a.jsx("h2",{style:{margin:0,fontSize:16,fontWeight:600,color:"var(--text-primary)",fontFamily:"var(--font-serif, ui-serif)",letterSpacing:"0.01em"},children:f==="destination"?"Create a skill":"Name and describe"}),a.jsxs("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginLeft:"auto",fontVariantNumeric:"tabular-nums"},children:["Step ",f==="destination"?"1":"2"," of 2"]})]}),f==="destination"&&a.jsxs("div",{style:{padding:14,display:"flex",flexDirection:"column",gap:10},children:[a.jsx(Ud,{title:"Standalone skill",subtitle:"A single skill in this project",description:"Lives at <project>/skills/<name>/SKILL.md. Works with every agent.",icon:"📄",selected:g==="standalone",onClick:()=>p("standalone")}),a.jsx(Ud,{title:"Add to existing plugin",subtitle:T?`${w.length} plugin source${w.length===1?"":"s"} in this project`:o?"No plugin sources in this project yet":"Claude Code only",description:"Appends a skill to an existing <plugin>/.claude-plugin/plugin.json source.",icon:"🧩",disabled:!T,selected:g==="existing-plugin",onClick:()=>T&&p("existing-plugin")}),a.jsx(Ud,{title:"New plugin",subtitle:O?"Bundles one or more skills for distribution":"Claude Code only",description:"Scaffolds <plugin>/.claude-plugin/plugin.json and its first skill.",icon:"📦",disabled:!O,selected:g==="new-plugin",onClick:()=>O&&p("new-plugin")})]}),f==="details"&&a.jsxs("div",{style:{padding:16,display:"flex",flexDirection:"column",gap:12},children:[g==="new-plugin"&&a.jsx(yo,{label:"Plugin name",hint:"kebab-case",children:a.jsx("input",{type:"text",value:j,onChange:I=>S(I.target.value.trim()),placeholder:"my-first-plugin",autoFocus:!0,style:bo(!j||_)})}),g==="existing-plugin"&&a.jsx(yo,{label:"Plugin",children:a.jsxs("select",{value:j,onChange:I=>S(I.target.value),style:{...bo(!0),fontFamily:"var(--font-mono)"},children:[a.jsx("option",{value:"",children:"Select a plugin…"}),w.map(I=>a.jsx("option",{value:I.name,children:I.name},I.path))]})}),a.jsx(yo,{label:"Skill name",hint:"kebab-case",children:a.jsx("input",{type:"text",value:y,onChange:I=>v(I.target.value.trim()),placeholder:"my-new-skill",autoFocus:g!=="new-plugin",style:bo(!y||C)})}),a.jsx(yo,{label:"Description",hint:"One short sentence — shown in frontmatter",children:a.jsx("textarea",{value:k,onChange:I=>E(I.target.value),rows:2,placeholder:"Does a thing when Claude needs X",style:{...bo(!0),resize:"vertical",minHeight:52,fontFamily:"var(--font-sans)"}})}),K&&a.jsxs("div",{style:{padding:"8px 10px",fontSize:11,fontFamily:"var(--font-mono)",color:"var(--text-secondary)",background:"var(--surface-1, rgba(0,0,0,0.03))",border:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",borderRadius:4,wordBreak:"break-all"},children:[a.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginBottom:2,fontFamily:"var(--font-sans)"},children:"Will create:"}),K.map((I,L)=>a.jsx("div",{children:I},L))]}),H&&a.jsx("div",{style:{fontSize:12,color:"var(--color-error, #b91c1c)",padding:"6px 10px",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4},children:H})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,padding:"12px 16px",borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",background:"var(--surface-1, rgba(0,0,0,0.02))"},children:[a.jsx("button",{type:"button",onClick:r,style:$d,children:"Cancel"}),f==="destination"&&a.jsx("button",{type:"button",onClick:()=>h("details"),style:Yg,children:"Continue →"}),f==="details"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>h("destination"),style:$d,children:"← Back"}),a.jsx("button",{type:"button",onClick:()=>void Z(),disabled:!$,style:{...$d,opacity:$?1:.5,cursor:$?"pointer":"not-allowed"},title:"Opens the AI generation flow with this destination pre-selected (choose Claude Code, Anthropic API, OpenRouter, or local models)",children:"✨ Generate with AI"}),a.jsx("button",{type:"button",onClick:()=>void q(),disabled:!$,style:{...Yg,opacity:$?1:.5,cursor:$?"pointer":"not-allowed"},title:"Creates an empty SKILL.md scaffold you can fill in by hand",children:A?"Creating…":"Create empty scaffold"})]})]})]})]})}function Ud({title:n,subtitle:r,description:s,icon:o,selected:c,disabled:d,onClick:f}){return a.jsxs("button",{type:"button",onClick:f,disabled:d,"aria-pressed":c,style:{display:"flex",gap:12,padding:"12px 14px",textAlign:"left",borderRadius:8,border:c?"2px solid var(--color-accent, #2f6f8f)":"1px solid var(--border-default, rgba(0,0,0,0.12))",background:c?"color-mix(in oklch, var(--color-accent, #2f6f8f) 8%, var(--color-paper, #fff))":d?"var(--surface-1, rgba(0,0,0,0.02))":"var(--color-paper, #fff)",color:d?"var(--text-tertiary)":"var(--text-primary)",cursor:d?"not-allowed":"pointer",opacity:d?.6:1,fontFamily:"inherit",width:"100%",transition:"border-color 120ms ease, background-color 120ms ease"},children:[a.jsx("span",{"aria-hidden":!0,style:{fontSize:22,lineHeight:1,marginTop:2},children:o}),a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsx("div",{style:{fontSize:14,fontWeight:600,lineHeight:1.3},children:n}),a.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginTop:2,textTransform:"uppercase",letterSpacing:"0.04em"},children:r}),a.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",marginTop:6,lineHeight:1.5},children:s})]})]})}function yo({label:n,hint:r,children:s}){return a.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4},children:[a.jsxs("span",{style:{display:"flex",alignItems:"baseline",gap:8},children:[a.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-primary)"},children:n}),r&&a.jsx("span",{style:{fontSize:11,color:"var(--text-tertiary)"},children:r})]}),s]})}function bo(n){return{width:"100%",padding:"7px 10px",fontSize:13,fontFamily:"var(--font-mono)",border:`1px solid ${n?"var(--border-default, rgba(0,0,0,0.12))":"var(--color-error, #b91c1c)"}`,borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none",boxSizing:"border-box"}}const Yg={padding:"8px 16px",fontSize:13,fontWeight:600,border:"1px solid var(--color-action, #2F5B8E)",borderRadius:6,background:"var(--color-action, #2F5B8E)",color:"var(--color-action-ink, #FFFFFF)",cursor:"pointer",fontFamily:"inherit",boxShadow:"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)",letterSpacing:"0.01em"},$d={padding:"7px 12px",fontSize:13,fontWeight:500,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,background:"transparent",color:"var(--text-primary)",cursor:"pointer",fontFamily:"inherit"};function BN(n,r,s,o){const c=o||"<skill-name>",d=s||"<plugin-name>",f=n||"<project>";return r==="standalone"?[`${f}/skills/${c}/SKILL.md`]:r==="existing-plugin"?[`${f}/${d}/skills/${c}/SKILL.md`]:r==="new-plugin"?[`${f}/${d}/.claude-plugin/plugin.json`,`${f}/${d}/skills/${c}/SKILL.md`]:null}function IN({open:n,onClose:r,onInstall:s,installedNames:o}){const[c,d]=x.useState([]),[f,h]=x.useState(null),[g,p]=x.useState(null),[y,v]=x.useState(!1),[j,S]=x.useState(null);return x.useEffect(()=>{n&&(v(!0),S(null),fetch("/api/plugins/marketplaces").then(k=>k.json()).then(k=>{if(k.error)throw new Error(k.error);d(k.marketplaces??[])}).catch(k=>S(k instanceof Error?k.message:String(k))).finally(()=>v(!1)))},[n]),x.useEffect(()=>{if(!f){p(null);return}v(!0),S(null),fetch(`/api/plugins/marketplaces/${encodeURIComponent(f)}`).then(k=>k.json()).then(k=>{if(k.error)throw new Error(k.error);p(k)}).catch(k=>S(k instanceof Error?k.message:String(k))).finally(()=>v(!1))},[f]),x.useEffect(()=>{if(!n)return;function k(E){E.key==="Escape"&&r()}return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[n,r]),n?a.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Plugin marketplace","data-vskill-marketplace-drawer":!0,style:{position:"fixed",inset:0,zIndex:80},children:[a.jsx("div",{onClick:r,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.38)"}}),a.jsxs("aside",{style:{position:"absolute",top:0,right:0,bottom:0,width:"min(480px, 94vw)",background:"var(--color-paper, #fff)",borderLeft:"1px solid var(--border-default, rgba(0,0,0,0.12))",boxShadow:"-10px 0 30px -8px rgba(0,0,0,0.18)",display:"flex",flexDirection:"column",fontFamily:"var(--font-sans)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.08))"},children:[f&&a.jsx("button",{type:"button",onClick:()=>h(null),"aria-label":"Back to marketplaces",style:{border:"none",background:"transparent",fontSize:14,color:"var(--text-secondary)",cursor:"pointer",padding:0},children:"← Back"}),a.jsx("h2",{style:{margin:0,fontSize:15,fontWeight:600,color:"var(--text-primary)",fontFamily:"var(--font-serif, ui-serif)",flex:1},children:f?(g==null?void 0:g.name)??f:"Browse plugins"}),a.jsx("button",{type:"button",onClick:r,"aria-label":"Close",style:{border:"none",background:"transparent",fontSize:16,color:"var(--text-secondary)",cursor:"pointer",padding:"4px 6px"},children:"✕"})]}),a.jsxs("div",{style:{flex:1,overflowY:"auto",padding:12},children:[y&&a.jsx("div",{style:{padding:12,fontSize:12,color:"var(--text-tertiary)"},children:"Loading…"}),j&&a.jsx("div",{style:{padding:10,fontSize:12,color:"var(--color-error, #b91c1c)",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4},children:j}),!f&&!y&&c.length===0&&!j&&a.jsx(HN,{}),!f&&c.map(k=>a.jsxs("button",{type:"button",onClick:()=>h(k.name),style:$N,onMouseEnter:E=>{E.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.04))"},onMouseLeave:E=>{E.currentTarget.style.background="transparent"},children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)"},children:k.name}),a.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.source})]},k.name)),f&&g&&a.jsxs(a.Fragment,{children:[g.description&&a.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",padding:"0 6px 12px",lineHeight:1.5},children:g.description}),g.plugins.length===0&&a.jsx("div",{style:{padding:12,fontSize:12,color:"var(--text-tertiary)"},children:"This marketplace has no plugins catalogued yet."}),g.plugins.map(k=>{const E=o.has(k.name);return a.jsx("div",{style:{padding:"10px 8px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.05))"},children:a.jsxs("div",{style:{display:"flex",alignItems:"start",gap:8},children:[a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsxs("div",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)",display:"flex",alignItems:"baseline",gap:8},children:[k.name,k.version&&a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)"},children:k.version}),k.category&&a.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:10,background:"var(--surface-2, rgba(0,0,0,0.05))",color:"var(--text-secondary)"},children:k.category})]}),k.description&&a.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:4,lineHeight:1.5},children:k.description})]}),a.jsx("button",{type:"button",disabled:E,onClick:()=>s(k.name,f),style:{flexShrink:0,padding:"5px 12px",fontSize:12,fontWeight:600,border:E?"none":"1px solid var(--color-action, #2F5B8E)",borderRadius:4,background:E?"var(--surface-2, rgba(0,0,0,0.05))":"var(--color-action, #2F5B8E)",color:E?"var(--text-tertiary)":"var(--color-action-ink, #FFFFFF)",cursor:E?"default":"pointer",fontFamily:"inherit",boxShadow:E?"none":"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)"},children:E?"Installed":"Install"})]})},k.name)})]})]}),!f&&a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",padding:12},children:a.jsx(UN,{onAdded:()=>{on("marketplaces"),fetch("/api/plugins/marketplaces").then(k=>k.json()).then(k=>d(k.marketplaces??[]))}})})]})]}):null}function HN(){return a.jsxs("div",{style:{padding:20,fontSize:12,color:"var(--text-tertiary)",lineHeight:1.6},children:["No marketplaces configured yet. Add one below — examples:",a.jsxs("ul",{style:{marginTop:8,paddingLeft:16},children:[a.jsx("li",{children:a.jsx("code",{children:"anthropics/claude-plugins-official"})}),a.jsx("li",{children:a.jsx("code",{children:"openai/codex-plugin-cc"})})]})]})}function UN({onAdded:n}){const[r,s]=x.useState(""),[o,c]=x.useState(!1),[d,f]=x.useState(null);async function h(){const g=r.trim();if(g){c(!0),f(null);try{const p=await fetch("/api/plugins/marketplaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:g})}),y=await p.json().catch(()=>({}));if(!p.ok||!y.ok){f(y.error??`Add failed (${p.status})`);return}s(""),n()}catch(p){f(p instanceof Error?p.message:String(p))}finally{c(!1)}}}return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx("label",{style:{fontSize:11,color:"var(--text-tertiary)",fontWeight:500},children:"Add marketplace (GitHub owner/repo, URL, or path)"}),a.jsxs("div",{style:{display:"flex",gap:6},children:[a.jsx("input",{type:"text",value:r,onChange:g=>s(g.target.value),onKeyDown:g=>{g.key==="Enter"&&h()},placeholder:"anthropics/claude-plugins-official",disabled:o,style:{flex:1,padding:"6px 8px",fontSize:12,fontFamily:"var(--font-mono)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none"}}),a.jsx("button",{type:"button",onClick:()=>void h(),disabled:o||!r.trim(),style:{padding:"6px 14px",fontSize:12,fontWeight:600,border:"1px solid var(--color-action, #2F5B8E)",borderRadius:4,background:"var(--color-action, #2F5B8E)",color:"var(--color-action-ink, #FFFFFF)",cursor:o||!r.trim()?"not-allowed":"pointer",opacity:o||!r.trim()?.5:1,boxShadow:"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)",fontFamily:"inherit"},children:o?"Adding…":"Add"})]}),d&&a.jsx("div",{style:{fontSize:11,color:"var(--color-error, #b91c1c)"},children:d})]})}const $N={display:"block",width:"100%",textAlign:"left",padding:"10px 12px",border:"none",borderRadius:6,background:"transparent",cursor:"pointer",fontFamily:"inherit",marginBottom:2},Vd=12;function VN({job:n,onDone:r}){const[s,o]=x.useState([]),[c,d]=x.useState("running"),[f,h]=x.useState(!1);if(x.useEffect(()=>{if(!n)return;o([]),d("running"),h(!1);const v=new AbortController;let j=[],S="running";return(async()=>{try{const k=await fetch("/api/plugins/install/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({plugin:n.ref}),signal:v.signal});if(!k.ok||!k.body){d("failed"),r({ok:!1,code:k.status,lines:[`HTTP ${k.status}`]});return}const E=k.body.getReader(),w=new TextDecoder;let N="";for(;;){const{value:A,done:z}=await E.read();if(z)break;N+=w.decode(A,{stream:!0});const H=N.split(/\n\n/);N=H.pop()??"";for(const M of H){const F=M.match(/^data:\s*(.*)$/m);if(F)try{const T=JSON.parse(F[1]);T.type==="stdout"&&T.line?(j=[...j,T.line].slice(-Vd),o(j)):T.type==="stderr"&&T.line?(j=[...j,`⚠ ${T.line}`].slice(-Vd),o(j)):T.type==="done"?(S=T.ok?"ok":"failed",d(S),on("plugins"),on("skills"),r({ok:T.ok??!1,code:T.code??null,lines:j})):T.type==="error"&&T.error&&(j=[...j,`✘ ${T.error}`].slice(-Vd),o(j))}catch{}}}S==="running"&&r({ok:!0,code:0,lines:j})}catch(k){if(k.name==="AbortError")return;d("failed"),r({ok:!1,code:null,lines:[...j,k instanceof Error?k.message:String(k)]})}})(),()=>v.abort()},[n==null?void 0:n.ref]),!n)return null;const g=c==="ok"?"var(--color-installed, #2F6A4A)":c==="failed"?"var(--color-error, #b91c1c)":"var(--color-accent, #2f6f8f)",p=c==="ok"?"✔":c==="failed"?"✘":"…",y=c==="ok"?"Installed":c==="failed"?"Install failed":"Installing";return a.jsxs("div",{role:"status","aria-live":"polite","data-vskill-install-toast":!0,style:{position:"fixed",bottom:16,right:16,width:"min(420px, 92vw)",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderLeft:`3px solid ${g}`,borderRadius:6,boxShadow:"0 10px 20px -6px rgba(0,0,0,0.18)",zIndex:90,fontFamily:"var(--font-sans)",overflow:"hidden"},children:[a.jsxs("button",{type:"button",onClick:()=>h(v=>!v),style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"10px 12px",border:"none",background:"transparent",cursor:"pointer",textAlign:"left",fontFamily:"inherit"},children:[a.jsx("span",{"aria-hidden":!0,style:{fontSize:16,color:g,width:16,textAlign:"center"},children:c==="running"?a.jsx(PN,{}):p}),a.jsxs("span",{style:{flex:1,minWidth:0},children:[a.jsxs("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-primary)"},children:[y,": ",n.plugin,a.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)",marginLeft:4},children:["@",n.marketplace]})]}),!f&&s.length>0&&a.jsx("span",{style:{display:"block",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s[s.length-1]})]}),a.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-tertiary)"},children:f?"▾":"▸"})]}),f&&a.jsx("pre",{style:{margin:0,padding:"0 12px 12px",maxHeight:180,overflowY:"auto",fontFamily:"var(--font-mono)",fontSize:10,lineHeight:1.5,color:"var(--text-secondary)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:s.length===0?"Waiting for output…":s.join(`
102
- `)})]})}function PN(){return a.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:10,height:10,borderRadius:"50%",border:"2px solid var(--color-accent, #2f6f8f)",borderTopColor:"transparent",animation:"vskill-spin 800ms linear infinite"},children:a.jsx("style",{children:"@keyframes vskill-spin { to { transform: rotate(360deg); } }"})})}const FN=3e3,GN={anthropic:"Anthropic",openai:"OpenAI",openrouter:"OpenRouter"};function qg(n){return n==="anthropic"||n==="openai"||n==="openrouter"}function WN(){const{toast:n}=Yo(),r=x.useRef(new Map),s=x.useCallback(o=>{if(!qg(o.provider))return;const c=Date.now(),d=r.current.get(o.provider)??0;if(c-d<FN)return;r.current.set(o.provider,c);const f=GN[o.provider];n({message:`${f} API key invalid or missing. Open Settings →`,severity:"error",action:{label:"Open Settings",onInvoke:()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:open-settings",{detail:{provider:o.provider}}))}}})},[n]);return x.useEffect(()=>{function o(c){const d=c.detail;!d||!qg(d.provider)||s({provider:d.provider})}return window.addEventListener("studio:api-key-error",o),()=>window.removeEventListener("studio:api-key-error",o)},[s]),{report:s}}const zy="vskill.studio.prefs";function Dy(){try{return typeof window>"u"?null:window.localStorage??null}catch{return null}}function _y(){const n=Dy();if(!n)return{};try{const r=n.getItem(zy);if(!r)return{};const s=JSON.parse(r);return s&&typeof s=="object"&&!Array.isArray(s)?s:{}}catch{return{}}}function YN(n,r){const s=Dy();if(s)try{const c={..._y(),[n]:r};s.setItem(zy,JSON.stringify(c))}catch{}}function qN(n,r){const o=_y()[n];return o===void 0?r:o}const Kg={open:!1,x:0,y:0,skill:null};function KN(n,r){return{open:!0,x:n.clientX,y:n.clientY,skill:r}}function Ar(n,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:n,severity:r}}))}function XN(n,r){var s;switch(n){case"copy-path":try{(s=navigator.clipboard)==null||s.writeText(r.dir)}catch{Ar(ne.toasts.permissionDenied,"error");return}Ar(ne.toasts.pathCopied,"info");return;case"open":case"reveal":case"edit":Ar(ne.actions.editPlaceholder,"info");return;case"run-benchmark":Ar(ne.toasts.benchmarkQueued,"info");return;case"duplicate":Ar(ne.toasts.skillDuplicated,"info");return;case"update":Ar(ne.toasts.skillUpdated,"info");return;case"uninstall":Ar(ne.actions.editPlaceholder,"info");return;default:return}}const QN=x.lazy(()=>Io(()=>import("./CommandPalette-DAWyTgXL.js"),__vite__mapDeps([2,1]))),ZN=x.lazy(()=>Io(()=>import("./CreateSkillPage-D5xmvnzV.js"),__vite__mapDeps([3,1])).then(n=>({default:n.CreateSkillPage})));function JN(){const[n,r]=x.useState(()=>typeof window<"u"&&window.location.hash.startsWith("#/create"));return x.useEffect(()=>{function s(){r(window.location.hash.startsWith("#/create"))}return window.addEventListener("hashchange",s),s(),()=>window.removeEventListener("hashchange",s)},[]),n}function eT(){return a.jsx(s2,{children:a.jsx(a2,{children:a.jsxs(IC,{children:[a.jsx(tT,{}),a.jsx(ZC,{})]})})})}function tT(){var Qe,tt;const{state:n,selectSkill:r,clearSelection:s,refreshSkills:o,outdatedByOrigin:c,revealSkill:d,clearReveal:f}=sa(),{config:h}=_r(),{mode:g,resolvedTheme:p,setTheme:y}=wv(),{toast:v}=Yo(),[j,S]=x.useState(()=>jw()),[k]=x.useState(!0),[E,w]=x.useState(!1),[N,A]=x.useState(!1),[z,H]=x.useState(!1),[M,F]=x.useState("overview"),[T,O]=x.useState(Kg),C=x.useCallback((ee,Te)=>{O(KN(ee,Te))},[]),_=CN(),[$,K]=x.useState(()=>qN("activeAgent",null));x.useEffect(()=>{var ee;!$&&((ee=_.response)!=null&&ee.suggested)&&K(_.response.suggested)},[$,(Qe=_.response)==null?void 0:Qe.suggested]);const Z=x.useCallback(ee=>{K(ee),YN("activeAgent",ee),typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:agent-changed",{detail:{agentId:ee}}))},[]),q=x.useMemo(()=>_.response?bN(_.response):[],[_.response]),{workspace:I,switchProject:L,addProject:B,removeProject:P,activeProject:W}=LN(),[ie,D]=x.useState(!1),[V,te]=x.useState(!1),[se,ge]=x.useState("standalone"),he=x.useCallback((ee="standalone")=>{ge(ee),te(!0)},[]);x.useEffect(()=>{function ee(Te){if(!(Te instanceof CustomEvent))return;const Pe=Te.detail;he((Pe==null?void 0:Pe.mode)??"standalone")}return window.addEventListener("studio:request-create-skill",ee),()=>window.removeEventListener("studio:request-create-skill",ee)},[he]);const[be,ce]=x.useState(!1),[je,Be]=x.useState(null);x.useEffect(()=>{function ee(){ce(!0)}return window.addEventListener("studio:open-marketplace",ee),()=>window.removeEventListener("studio:open-marketplace",ee)},[]);const ze=x.useMemo(()=>{const ee=new Set;for(const Te of n.skills)Te.source==="plugin"&&Te.pluginName&&ee.add(Te.pluginName);return ee},[n.skills]);Jd([{key:"p",meta:!0,handler:ee=>{var Pe;const Te=typeof document<"u"?document.activeElement:null;Te&&Te.tagName==="INPUT"||((Pe=ee==null?void 0:ee.preventDefault)==null||Pe.call(ee),D(en=>!en))}}],{enabled:!0});const re=dN();x.useEffect(()=>{function ee(Te){if(!(Te instanceof CustomEvent))return;const Pe=Te.detail;Pe!=null&&Pe.provider&&re.open(Pe.provider)}return window.addEventListener("studio:open-setup-drawer",ee),()=>window.removeEventListener("studio:open-setup-drawer",ee)},[re]);const fe=x.useCallback(()=>{O(Kg)},[]);x.useEffect(()=>{function ee(Te){if(!(Te instanceof CustomEvent))return;const Pe=Te.detail;Pe!=null&&Pe.message&&v({message:Pe.message,severity:Pe.severity??"info"})}return window.addEventListener("studio:toast",ee),()=>window.removeEventListener("studio:toast",ee)},[v]),WN();const[pe,xe]=x.useState(!1),[ve,Le]=x.useState(void 0);x.useEffect(()=>{function ee(Te){if(!(Te instanceof CustomEvent))return;const Pe=Te.detail;Le(Pe==null?void 0:Pe.provider),xe(!0)}return window.addEventListener("studio:open-settings",ee),()=>window.removeEventListener("studio:open-settings",ee)},[]),x.useEffect(()=>{document.documentElement.style.setProperty("--sidebar-width",`${j}px`)},[j]);const De=x.useMemo(()=>n.selectedSkill?n.skills.find(ee=>ee.plugin===n.selectedSkill.plugin&&ee.skill===n.selectedSkill.skill)??null:null,[n.skills,n.selectedSkill]),ut=x.useCallback(ee=>{r({plugin:ee.plugin,skill:ee.skill,origin:ee.origin})},[r]),Bt=x.useMemo(()=>{if(!n.selectedSkill)return"";const ee=n.selectedSkill.origin==="installed"?"Installed":"Own";return`Viewing ${n.selectedSkill.skill} (${ee})`},[n.selectedSkill]),St=x.useMemo(()=>[{id:"switch-theme",label:ne.palette.actionSwitchTheme,description:"Cycle light / dark / auto",keywords:["theme","dark","light","mode"],onInvoke:()=>y(g==="light"?"dark":g==="dark"?"auto":"light")},{id:"toggle-sidebar",label:"Toggle sidebar",description:"Show or hide the skills sidebar",keywords:["sidebar","panel","hide","show","cmd+b"],onInvoke:()=>H(ee=>!ee)},{id:"show-shortcuts",label:"Show keyboard shortcuts",description:"Open the cheatsheet",keywords:["help","keys"],onInvoke:()=>A(!0)},{id:"refresh-skills",label:"Refresh skills",description:"Re-scan local + installed",keywords:["reload","scan"],onInvoke:()=>o()}],[g,y,o]);Jd([{key:"cmd+k",handler:()=>w(ee=>!ee)},{key:"ctrl+k",handler:()=>w(ee=>!ee)},{key:"?",handler:()=>A(ee=>!ee)},{key:"cmd+shift+d",handler:()=>y(p==="light"?"dark":"light")},{key:"ctrl+shift+d",handler:()=>y(p==="light"?"dark":"light")},{key:"cmd+b",handler:()=>H(ee=>!ee)},{key:"ctrl+b",handler:()=>H(ee=>!ee)},{key:"e",handler:()=>v({message:ne.actions.editPlaceholder,severity:"info"})}]);const It=JN()?a.jsx(x.Suspense,{fallback:a.jsx("div",{style:{padding:40},children:"Loading…"}),children:a.jsx(ZN,{})}):a.jsx(FC,{selectedSkillInfo:De,activeDetailTab:M,onDetailTabChange:F,allSkills:n.skills,onSelectSkill:ut});return a.jsxs(a.Fragment,{children:[a.jsx(i2,{sidebarWidth:j,sidebarHidden:z||n.isMobile&&n.mobileView==="detail",banner:a.jsx(ww,{connected:k}),liveMessage:Bt,topRail:a.jsx(rS,{projectName:(h==null?void 0:h.projectName)??null,selected:n.selectedSkill,onOpenPalette:()=>w(!0),onHome:s,onRequestCreateSkill:()=>he("standalone"),projectPickerSlot:I&&I.projects.length>0?a.jsx(zN,{workspace:I,onSwitch:L,onAdd:B,onRemove:P}):void 0}),sidebar:a.jsx(pw,{skills:n.skills,selectedKey:n.selectedSkill?{plugin:n.selectedSkill.plugin,skill:n.selectedSkill.skill}:null,onSelect:ut,isLoading:n.skillsLoading,error:n.skillsError??null,onRetry:o,onContextMenu:C,outdatedByOrigin:c,activeAgentId:$,revealSkillId:n.revealSkillId,onRevealComplete:f,topSlot:_.status==="ready"&&q.length>0?a.jsxs(a.Fragment,{children:[a.jsx(jN,{agents:q,activeAgentId:$,onActiveAgentChange:Z,onOpenSetup:ee=>re.open(ee)}),a.jsx(EN,{activeAgentId:$})]}):null}),resizeHandle:a.jsx(kw,{initialWidth:j??Ds,onChange:S}),main:It,statusBar:a.jsx(hS,{projectPath:(h==null?void 0:h.root)??null,modelName:(h==null?void 0:h.model)??null,health:h!=null&&h.error?"degraded":"ok",providers:(tt=h==null?void 0:h.providers)==null?void 0:tt.map(ee=>{const Te=ee.id;return{id:Te,label:ee.label,available:ee.available,kind:Te==="ollama"||Te==="lm-studio"?"start-service":Te==="anthropic"||Te==="openrouter"?"api-key":"cli-install"}})})}),a.jsx(eN,{open:N,onClose:()=>A(!1)}),a.jsx(lN,{open:re.isOpen,providerKey:re.providerKey,onClose:re.close}),a.jsx(nN,{state:T,onClose:fe,onAction:(ee,Te)=>XN(ee,Te)}),E&&a.jsx(x.Suspense,{fallback:null,children:a.jsx(QN,{open:E,onClose:()=>w(!1),commands:St})}),a.jsx(_N,{open:ie,projects:(I==null?void 0:I.projects)??[],onSwitch:ee=>{L(ee)},onClose:()=>D(!1)}),a.jsx(ON,{open:V,onClose:()=>te(!1),initialMode:se,isClaudeCode:$==="claude-code",projectRoot:(W==null?void 0:W.path)??(h==null?void 0:h.projectName)??"",onCreated:ee=>{o(),setTimeout(()=>{d(ee.pluginName??"",ee.skillName)},500)}}),a.jsx(IN,{open:be,onClose:()=>ce(!1),installedNames:ze,onInstall:(ee,Te)=>{Be({plugin:ee,marketplace:Te,ref:`${ee}@${Te}`}),ce(!1)}}),a.jsx(jv,{open:pe,onClose:()=>xe(!1),initialProvider:ve,onToast:ee=>v({message:ee,severity:"info"})}),a.jsx(VN,{job:je,onDone:ee=>{ee.ok&&setTimeout(()=>Be(null),3e3)}})]})}const Xg="vskill.migrations.scope-rename.v1",nT={own:"authoring-project",installed:"available-project",global:"available-personal"},aT=/^vskill-sidebar-(.+)-(own|installed|global)-collapsed$/;function rT(n){if(n.getItem(Xg)==="done")return;const r=[];for(let s=0;s<n.length;s++){const o=n.key(s);if(!o)continue;const c=o.match(aT);if(!c)continue;const[,d,f]=c,h=nT[f];if(!h)continue;const g=n.getItem(o);g!==null&&r.push({oldKey:o,newKey:`vskill-sidebar-${d}-${h}-collapsed`,value:g})}for(const{oldKey:s,newKey:o,value:c}of r)n.getItem(o)===null&&n.setItem(o,c),n.removeItem(s);n.setItem(Xg,"done")}if(typeof PerformanceObserver<"u")try{const n=new PerformanceObserver(r=>{for(const s of r.getEntries())if(s.name==="first-contentful-paint"){window.__vskillPaint=s.startTime,n.disconnect();return}});n.observe({type:"paint",buffered:!0})}catch{}if(typeof window<"u"&&window.localStorage)try{rT(window.localStorage)}catch{}t0.createRoot(document.getElementById("root")).render(a.jsx(x.StrictMode,{children:a.jsx(Sj,{children:a.jsx(uS,{children:a.jsx(eT,{})})})}));export{Wo as E,hv as L,Ks as P,we as R,fC as S,_r as a,_y as b,cC as c,Fo as d,qN as g,a as j,x as r,ne as s,lf as t,B0 as u,YN as w};