vskill 0.5.92 → 0.5.94

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,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-D-KJPEWg.js","assets/fonts-i7Lkz2zN.css","assets/CommandPalette-9-Hnt3XO.js"])))=>i.map(i=>d[i]);
2
- /* empty css */(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))o(u);new MutationObserver(u=>{for(const m of u)if(m.type==="childList")for(const f of m.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&o(f)}).observe(document,{childList:!0,subtree:!0});function i(u){const m={};return u.integrity&&(m.integrity=u.integrity),u.referrerPolicy&&(m.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?m.credentials="include":u.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function o(u){if(u.ep)return;u.ep=!0;const m=i(u);fetch(u.href,m)}})();function nv(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var zu={exports:{}},ds={};/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-J1iXSqe9.js","assets/fonts-i7Lkz2zN.css","assets/CommandPalette-BmFHPac6.js"])))=>i.map(i=>d[i]);
2
+ /* empty css */(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))o(u);new MutationObserver(u=>{for(const m of u)if(m.type==="childList")for(const f of m.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&o(f)}).observe(document,{childList:!0,subtree:!0});function i(u){const m={};return u.integrity&&(m.integrity=u.integrity),u.referrerPolicy&&(m.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?m.credentials="include":u.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function o(u){if(u.ep)return;u.ep=!0;const m=i(u);fetch(u.href,m)}})();function av(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var zu={exports:{}},ds={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
5
5
  *
@@ -7,7 +7,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-
7
7
  *
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
- */var Bh;function D1(){if(Bh)return ds;Bh=1;var a=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function i(o,u,m){var f=null;if(m!==void 0&&(f=""+m),u.key!==void 0&&(f=""+u.key),"key"in u){m={};for(var h in u)h!=="key"&&(m[h]=u[h])}else m=u;return u=m.ref,{$$typeof:a,type:o,key:f,ref:u!==void 0?u:null,props:m}}return ds.Fragment=r,ds.jsx=i,ds.jsxs=i,ds}var Uh;function z1(){return Uh||(Uh=1,zu.exports=D1()),zu.exports}var n=z1(),Lu={exports:{}},ze={};/**
10
+ */var Ih;function z1(){if(Ih)return ds;Ih=1;var a=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function i(o,u,m){var f=null;if(m!==void 0&&(f=""+m),u.key!==void 0&&(f=""+u.key),"key"in u){m={};for(var h in u)h!=="key"&&(m[h]=u[h])}else m=u;return u=m.ref,{$$typeof:a,type:o,key:f,ref:u!==void 0?u:null,props:m}}return ds.Fragment=r,ds.jsx=i,ds.jsxs=i,ds}var Hh;function L1(){return Hh||(Hh=1,zu.exports=z1()),zu.exports}var n=L1(),Lu={exports:{}},ze={};/**
11
11
  * @license React
12
12
  * react.production.js
13
13
  *
@@ -15,7 +15,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-
15
15
  *
16
16
  * This source code is licensed under the MIT license found in the
17
17
  * LICENSE file in the root directory of this source tree.
18
- */var Hh;function L1(){if(Hh)return ze;Hh=1;var a=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),f=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),j=Symbol.iterator;function S(z){return z===null||typeof z!="object"?null:(z=j&&z[j]||z["@@iterator"],typeof z=="function"?z:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},M=Object.assign,E={};function k(z,W,ie){this.props=z,this.context=W,this.refs=E,this.updater=ie||N}k.prototype.isReactComponent={},k.prototype.setState=function(z,W){if(typeof z!="object"&&typeof z!="function"&&z!=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,z,W,"setState")},k.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function T(){}T.prototype=k.prototype;function B(z,W,ie){this.props=z,this.context=W,this.refs=E,this.updater=ie||N}var I=B.prototype=new T;I.constructor=B,M(I,k.prototype),I.isPureReactComponent=!0;var L=Array.isArray;function V(){}var w={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function A(z,W,ie){var de=ie.ref;return{$$typeof:a,type:z,key:W,ref:de!==void 0?de:null,props:ie}}function O(z,W){return A(z.type,W,z.props)}function G(z){return typeof z=="object"&&z!==null&&z.$$typeof===a}function q(z){var W={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(ie){return W[ie]})}var te=/\/+/g;function X(z,W){return typeof z=="object"&&z!==null&&z.key!=null?q(""+z.key):W.toString(36)}function _(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(V,V):(z.status="pending",z.then(function(W){z.status==="pending"&&(z.status="fulfilled",z.value=W)},function(W){z.status==="pending"&&(z.status="rejected",z.reason=W)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function R(z,W,ie,de,ge){var xe=typeof z;(xe==="undefined"||xe==="boolean")&&(z=null);var oe=!1;if(z===null)oe=!0;else switch(xe){case"bigint":case"string":case"number":oe=!0;break;case"object":switch(z.$$typeof){case a:case r:oe=!0;break;case y:return oe=z._init,R(oe(z._payload),W,ie,de,ge)}}if(oe)return ge=ge(z),oe=de===""?"."+X(z,0):de,L(ge)?(ie="",oe!=null&&(ie=oe.replace(te,"$&/")+"/"),R(ge,W,ie,"",function(Ie){return Ie})):ge!=null&&(G(ge)&&(ge=O(ge,ie+(ge.key==null||z&&z.key===ge.key?"":(""+ge.key).replace(te,"$&/")+"/")+oe)),W.push(ge)),1;oe=0;var ae=de===""?".":de+":";if(L(z))for(var ve=0;ve<z.length;ve++)de=z[ve],xe=ae+X(de,ve),oe+=R(de,W,ie,xe,ge);else if(ve=S(z),typeof ve=="function")for(z=ve.call(z),ve=0;!(de=z.next()).done;)de=de.value,xe=ae+X(de,ve++),oe+=R(de,W,ie,xe,ge);else if(xe==="object"){if(typeof z.then=="function")return R(_(z),W,ie,de,ge);throw W=String(z),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return oe}function U(z,W,ie){if(z==null)return z;var de=[],ge=0;return R(z,de,"","",function(xe){return W.call(ie,xe,ge++)}),de}function se(z){if(z._status===-1){var W=z._result;W=W(),W.then(function(ie){(z._status===0||z._status===-1)&&(z._status=1,z._result=ie)},function(ie){(z._status===0||z._status===-1)&&(z._status=2,z._result=ie)}),z._status===-1&&(z._status=0,z._result=W)}if(z._status===1)return z._result.default;throw z._result}var Y=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}console.error(z)},me={map:U,forEach:function(z,W,ie){U(z,function(){W.apply(this,arguments)},ie)},count:function(z){var W=0;return U(z,function(){W++}),W},toArray:function(z){return U(z,function(W){return W})||[]},only:function(z){if(!G(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return ze.Activity=g,ze.Children=me,ze.Component=k,ze.Fragment=i,ze.Profiler=u,ze.PureComponent=B,ze.StrictMode=o,ze.Suspense=x,ze.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,ze.__COMPILER_RUNTIME={__proto__:null,c:function(z){return w.H.useMemoCache(z)}},ze.cache=function(z){return function(){return z.apply(null,arguments)}},ze.cacheSignal=function(){return null},ze.cloneElement=function(z,W,ie){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var de=M({},z.props),ge=z.key;if(W!=null)for(xe in W.key!==void 0&&(ge=""+W.key),W)!D.call(W,xe)||xe==="key"||xe==="__self"||xe==="__source"||xe==="ref"&&W.ref===void 0||(de[xe]=W[xe]);var xe=arguments.length-2;if(xe===1)de.children=ie;else if(1<xe){for(var oe=Array(xe),ae=0;ae<xe;ae++)oe[ae]=arguments[ae+2];de.children=oe}return A(z.type,ge,de)},ze.createContext=function(z){return z={$$typeof:f,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:m,_context:z},z},ze.createElement=function(z,W,ie){var de,ge={},xe=null;if(W!=null)for(de in W.key!==void 0&&(xe=""+W.key),W)D.call(W,de)&&de!=="key"&&de!=="__self"&&de!=="__source"&&(ge[de]=W[de]);var oe=arguments.length-2;if(oe===1)ge.children=ie;else if(1<oe){for(var ae=Array(oe),ve=0;ve<oe;ve++)ae[ve]=arguments[ve+2];ge.children=ae}if(z&&z.defaultProps)for(de in oe=z.defaultProps,oe)ge[de]===void 0&&(ge[de]=oe[de]);return A(z,xe,ge)},ze.createRef=function(){return{current:null}},ze.forwardRef=function(z){return{$$typeof:h,render:z}},ze.isValidElement=G,ze.lazy=function(z){return{$$typeof:y,_payload:{_status:-1,_result:z},_init:se}},ze.memo=function(z,W){return{$$typeof:p,type:z,compare:W===void 0?null:W}},ze.startTransition=function(z){var W=w.T,ie={};w.T=ie;try{var de=z(),ge=w.S;ge!==null&&ge(ie,de),typeof de=="object"&&de!==null&&typeof de.then=="function"&&de.then(V,Y)}catch(xe){Y(xe)}finally{W!==null&&ie.types!==null&&(W.types=ie.types),w.T=W}},ze.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},ze.use=function(z){return w.H.use(z)},ze.useActionState=function(z,W,ie){return w.H.useActionState(z,W,ie)},ze.useCallback=function(z,W){return w.H.useCallback(z,W)},ze.useContext=function(z){return w.H.useContext(z)},ze.useDebugValue=function(){},ze.useDeferredValue=function(z,W){return w.H.useDeferredValue(z,W)},ze.useEffect=function(z,W){return w.H.useEffect(z,W)},ze.useEffectEvent=function(z){return w.H.useEffectEvent(z)},ze.useId=function(){return w.H.useId()},ze.useImperativeHandle=function(z,W,ie){return w.H.useImperativeHandle(z,W,ie)},ze.useInsertionEffect=function(z,W){return w.H.useInsertionEffect(z,W)},ze.useLayoutEffect=function(z,W){return w.H.useLayoutEffect(z,W)},ze.useMemo=function(z,W){return w.H.useMemo(z,W)},ze.useOptimistic=function(z,W){return w.H.useOptimistic(z,W)},ze.useReducer=function(z,W,ie){return w.H.useReducer(z,W,ie)},ze.useRef=function(z){return w.H.useRef(z)},ze.useState=function(z){return w.H.useState(z)},ze.useSyncExternalStore=function(z,W,ie){return w.H.useSyncExternalStore(z,W,ie)},ze.useTransition=function(){return w.H.useTransition()},ze.version="19.2.4",ze}var Ih;function bd(){return Ih||(Ih=1,Lu.exports=L1()),Lu.exports}var v=bd();const we=nv(v);var _u={exports:{}},fs={},Ou={exports:{}},Bu={};/**
18
+ */var Uh;function _1(){if(Uh)return ze;Uh=1;var a=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),f=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),j=Symbol.iterator;function S(L){return L===null||typeof L!="object"?null:(L=j&&L[j]||L["@@iterator"],typeof L=="function"?L:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D=Object.assign,T={};function k(L,F,ie){this.props=L,this.context=F,this.refs=T,this.updater=ie||N}k.prototype.isReactComponent={},k.prototype.setState=function(L,F){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,F,"setState")},k.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function M(){}M.prototype=k.prototype;function B(L,F,ie){this.props=L,this.context=F,this.refs=T,this.updater=ie||N}var V=B.prototype=new M;V.constructor=B,D(V,k.prototype),V.isPureReactComponent=!0;var A=Array.isArray;function U(){}var C={H:null,A:null,T:null,S:null},z=Object.prototype.hasOwnProperty;function R(L,F,ie){var de=ie.ref;return{$$typeof:a,type:L,key:F,ref:de!==void 0?de:null,props:ie}}function I(L,F){return R(L.type,F,L.props)}function P(L){return typeof L=="object"&&L!==null&&L.$$typeof===a}function q(L){var F={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(ie){return F[ie]})}var ee=/\/+/g;function X(L,F){return typeof L=="object"&&L!==null&&L.key!=null?q(""+L.key):F.toString(36)}function _(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(U,U):(L.status="pending",L.then(function(F){L.status==="pending"&&(L.status="fulfilled",L.value=F)},function(F){L.status==="pending"&&(L.status="rejected",L.reason=F)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function E(L,F,ie,de,ge){var xe=typeof L;(xe==="undefined"||xe==="boolean")&&(L=null);var oe=!1;if(L===null)oe=!0;else switch(xe){case"bigint":case"string":case"number":oe=!0;break;case"object":switch(L.$$typeof){case a:case r:oe=!0;break;case y:return oe=L._init,E(oe(L._payload),F,ie,de,ge)}}if(oe)return ge=ge(L),oe=de===""?"."+X(L,0):de,A(ge)?(ie="",oe!=null&&(ie=oe.replace(ee,"$&/")+"/"),E(ge,F,ie,"",function(Ue){return Ue})):ge!=null&&(P(ge)&&(ge=I(ge,ie+(ge.key==null||L&&L.key===ge.key?"":(""+ge.key).replace(ee,"$&/")+"/")+oe)),F.push(ge)),1;oe=0;var le=de===""?".":de+":";if(A(L))for(var ve=0;ve<L.length;ve++)de=L[ve],xe=le+X(de,ve),oe+=E(de,F,ie,xe,ge);else if(ve=S(L),typeof ve=="function")for(L=ve.call(L),ve=0;!(de=L.next()).done;)de=de.value,xe=le+X(de,ve++),oe+=E(de,F,ie,xe,ge);else if(xe==="object"){if(typeof L.then=="function")return E(_(L),F,ie,de,ge);throw F=String(L),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.")}return oe}function O(L,F,ie){if(L==null)return L;var de=[],ge=0;return E(L,de,"","",function(xe){return F.call(ie,xe,ge++)}),de}function te(L){if(L._status===-1){var F=L._result;F=F(),F.then(function(ie){(L._status===0||L._status===-1)&&(L._status=1,L._result=ie)},function(ie){(L._status===0||L._status===-1)&&(L._status=2,L._result=ie)}),L._status===-1&&(L._status=0,L._result=F)}if(L._status===1)return L._result.default;throw L._result}var Y=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var F=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(F))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},me={map:O,forEach:function(L,F,ie){O(L,function(){F.apply(this,arguments)},ie)},count:function(L){var F=0;return O(L,function(){F++}),F},toArray:function(L){return O(L,function(F){return F})||[]},only:function(L){if(!P(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return ze.Activity=g,ze.Children=me,ze.Component=k,ze.Fragment=i,ze.Profiler=u,ze.PureComponent=B,ze.StrictMode=o,ze.Suspense=x,ze.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=C,ze.__COMPILER_RUNTIME={__proto__:null,c:function(L){return C.H.useMemoCache(L)}},ze.cache=function(L){return function(){return L.apply(null,arguments)}},ze.cacheSignal=function(){return null},ze.cloneElement=function(L,F,ie){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var de=D({},L.props),ge=L.key;if(F!=null)for(xe in F.key!==void 0&&(ge=""+F.key),F)!z.call(F,xe)||xe==="key"||xe==="__self"||xe==="__source"||xe==="ref"&&F.ref===void 0||(de[xe]=F[xe]);var xe=arguments.length-2;if(xe===1)de.children=ie;else if(1<xe){for(var oe=Array(xe),le=0;le<xe;le++)oe[le]=arguments[le+2];de.children=oe}return R(L.type,ge,de)},ze.createContext=function(L){return L={$$typeof:f,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:m,_context:L},L},ze.createElement=function(L,F,ie){var de,ge={},xe=null;if(F!=null)for(de in F.key!==void 0&&(xe=""+F.key),F)z.call(F,de)&&de!=="key"&&de!=="__self"&&de!=="__source"&&(ge[de]=F[de]);var oe=arguments.length-2;if(oe===1)ge.children=ie;else if(1<oe){for(var le=Array(oe),ve=0;ve<oe;ve++)le[ve]=arguments[ve+2];ge.children=le}if(L&&L.defaultProps)for(de in oe=L.defaultProps,oe)ge[de]===void 0&&(ge[de]=oe[de]);return R(L,xe,ge)},ze.createRef=function(){return{current:null}},ze.forwardRef=function(L){return{$$typeof:h,render:L}},ze.isValidElement=P,ze.lazy=function(L){return{$$typeof:y,_payload:{_status:-1,_result:L},_init:te}},ze.memo=function(L,F){return{$$typeof:p,type:L,compare:F===void 0?null:F}},ze.startTransition=function(L){var F=C.T,ie={};C.T=ie;try{var de=L(),ge=C.S;ge!==null&&ge(ie,de),typeof de=="object"&&de!==null&&typeof de.then=="function"&&de.then(U,Y)}catch(xe){Y(xe)}finally{F!==null&&ie.types!==null&&(F.types=ie.types),C.T=F}},ze.unstable_useCacheRefresh=function(){return C.H.useCacheRefresh()},ze.use=function(L){return C.H.use(L)},ze.useActionState=function(L,F,ie){return C.H.useActionState(L,F,ie)},ze.useCallback=function(L,F){return C.H.useCallback(L,F)},ze.useContext=function(L){return C.H.useContext(L)},ze.useDebugValue=function(){},ze.useDeferredValue=function(L,F){return C.H.useDeferredValue(L,F)},ze.useEffect=function(L,F){return C.H.useEffect(L,F)},ze.useEffectEvent=function(L){return C.H.useEffectEvent(L)},ze.useId=function(){return C.H.useId()},ze.useImperativeHandle=function(L,F,ie){return C.H.useImperativeHandle(L,F,ie)},ze.useInsertionEffect=function(L,F){return C.H.useInsertionEffect(L,F)},ze.useLayoutEffect=function(L,F){return C.H.useLayoutEffect(L,F)},ze.useMemo=function(L,F){return C.H.useMemo(L,F)},ze.useOptimistic=function(L,F){return C.H.useOptimistic(L,F)},ze.useReducer=function(L,F,ie){return C.H.useReducer(L,F,ie)},ze.useRef=function(L){return C.H.useRef(L)},ze.useState=function(L){return C.H.useState(L)},ze.useSyncExternalStore=function(L,F,ie){return C.H.useSyncExternalStore(L,F,ie)},ze.useTransition=function(){return C.H.useTransition()},ze.version="19.2.4",ze}var Vh;function jd(){return Vh||(Vh=1,Lu.exports=_1()),Lu.exports}var v=jd();const we=av(v);var _u={exports:{}},fs={},Ou={exports:{}},Bu={};/**
19
19
  * @license React
20
20
  * scheduler.production.js
21
21
  *
@@ -23,7 +23,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-
23
23
  *
24
24
  * This source code is licensed under the MIT license found in the
25
25
  * LICENSE file in the root directory of this source tree.
26
- */var Vh;function _1(){return Vh||(Vh=1,(function(a){function r(R,U){var se=R.length;R.push(U);e:for(;0<se;){var Y=se-1>>>1,me=R[Y];if(0<u(me,U))R[Y]=U,R[se]=me,se=Y;else break e}}function i(R){return R.length===0?null:R[0]}function o(R){if(R.length===0)return null;var U=R[0],se=R.pop();if(se!==U){R[0]=se;e:for(var Y=0,me=R.length,z=me>>>1;Y<z;){var W=2*(Y+1)-1,ie=R[W],de=W+1,ge=R[de];if(0>u(ie,se))de<me&&0>u(ge,ie)?(R[Y]=ge,R[de]=se,Y=de):(R[Y]=ie,R[W]=se,Y=W);else if(de<me&&0>u(ge,se))R[Y]=ge,R[de]=se,Y=de;else break e}}return U}function u(R,U){var se=R.sortIndex-U.sortIndex;return se!==0?se:R.id-U.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var m=performance;a.unstable_now=function(){return m.now()}}else{var f=Date,h=f.now();a.unstable_now=function(){return f.now()-h}}var x=[],p=[],y=1,g=null,j=3,S=!1,N=!1,M=!1,E=!1,k=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;function I(R){for(var U=i(p);U!==null;){if(U.callback===null)o(p);else if(U.startTime<=R)o(p),U.sortIndex=U.expirationTime,r(x,U);else break;U=i(p)}}function L(R){if(M=!1,I(R),!N)if(i(x)!==null)N=!0,V||(V=!0,q());else{var U=i(p);U!==null&&_(L,U.startTime-R)}}var V=!1,w=-1,D=5,A=-1;function O(){return E?!0:!(a.unstable_now()-A<D)}function G(){if(E=!1,V){var R=a.unstable_now();A=R;var U=!0;try{e:{N=!1,M&&(M=!1,T(w),w=-1),S=!0;var se=j;try{t:{for(I(R),g=i(x);g!==null&&!(g.expirationTime>R&&O());){var Y=g.callback;if(typeof Y=="function"){g.callback=null,j=g.priorityLevel;var me=Y(g.expirationTime<=R);if(R=a.unstable_now(),typeof me=="function"){g.callback=me,I(R),U=!0;break t}g===i(x)&&o(x),I(R)}else o(x);g=i(x)}if(g!==null)U=!0;else{var z=i(p);z!==null&&_(L,z.startTime-R),U=!1}}break e}finally{g=null,j=se,S=!1}U=void 0}}finally{U?q():V=!1}}}var q;if(typeof B=="function")q=function(){B(G)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,X=te.port2;te.port1.onmessage=G,q=function(){X.postMessage(null)}}else q=function(){k(G,0)};function _(R,U){w=k(function(){R(a.unstable_now())},U)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(R){R.callback=null},a.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<R?Math.floor(1e3/R):5},a.unstable_getCurrentPriorityLevel=function(){return j},a.unstable_next=function(R){switch(j){case 1:case 2:case 3:var U=3;break;default:U=j}var se=j;j=U;try{return R()}finally{j=se}},a.unstable_requestPaint=function(){E=!0},a.unstable_runWithPriority=function(R,U){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var se=j;j=R;try{return U()}finally{j=se}},a.unstable_scheduleCallback=function(R,U,se){var Y=a.unstable_now();switch(typeof se=="object"&&se!==null?(se=se.delay,se=typeof se=="number"&&0<se?Y+se:Y):se=Y,R){case 1:var me=-1;break;case 2:me=250;break;case 5:me=1073741823;break;case 4:me=1e4;break;default:me=5e3}return me=se+me,R={id:y++,callback:U,priorityLevel:R,startTime:se,expirationTime:me,sortIndex:-1},se>Y?(R.sortIndex=se,r(p,R),i(x)===null&&R===i(p)&&(M?(T(w),w=-1):M=!0,_(L,se-Y))):(R.sortIndex=me,r(x,R),N||S||(N=!0,V||(V=!0,q()))),R},a.unstable_shouldYield=O,a.unstable_wrapCallback=function(R){var U=j;return function(){var se=j;j=U;try{return R.apply(this,arguments)}finally{j=se}}}})(Bu)),Bu}var $h;function O1(){return $h||($h=1,Ou.exports=_1()),Ou.exports}var Uu={exports:{}},Wt={};/**
26
+ */var $h;function O1(){return $h||($h=1,(function(a){function r(E,O){var te=E.length;E.push(O);e:for(;0<te;){var Y=te-1>>>1,me=E[Y];if(0<u(me,O))E[Y]=O,E[te]=me,te=Y;else break e}}function i(E){return E.length===0?null:E[0]}function o(E){if(E.length===0)return null;var O=E[0],te=E.pop();if(te!==O){E[0]=te;e:for(var Y=0,me=E.length,L=me>>>1;Y<L;){var F=2*(Y+1)-1,ie=E[F],de=F+1,ge=E[de];if(0>u(ie,te))de<me&&0>u(ge,ie)?(E[Y]=ge,E[de]=te,Y=de):(E[Y]=ie,E[F]=te,Y=F);else if(de<me&&0>u(ge,te))E[Y]=ge,E[de]=te,Y=de;else break e}}return O}function u(E,O){var te=E.sortIndex-O.sortIndex;return te!==0?te:E.id-O.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var m=performance;a.unstable_now=function(){return m.now()}}else{var f=Date,h=f.now();a.unstable_now=function(){return f.now()-h}}var x=[],p=[],y=1,g=null,j=3,S=!1,N=!1,D=!1,T=!1,k=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;function V(E){for(var O=i(p);O!==null;){if(O.callback===null)o(p);else if(O.startTime<=E)o(p),O.sortIndex=O.expirationTime,r(x,O);else break;O=i(p)}}function A(E){if(D=!1,V(E),!N)if(i(x)!==null)N=!0,U||(U=!0,q());else{var O=i(p);O!==null&&_(A,O.startTime-E)}}var U=!1,C=-1,z=5,R=-1;function I(){return T?!0:!(a.unstable_now()-R<z)}function P(){if(T=!1,U){var E=a.unstable_now();R=E;var O=!0;try{e:{N=!1,D&&(D=!1,M(C),C=-1),S=!0;var te=j;try{t:{for(V(E),g=i(x);g!==null&&!(g.expirationTime>E&&I());){var Y=g.callback;if(typeof Y=="function"){g.callback=null,j=g.priorityLevel;var me=Y(g.expirationTime<=E);if(E=a.unstable_now(),typeof me=="function"){g.callback=me,V(E),O=!0;break t}g===i(x)&&o(x),V(E)}else o(x);g=i(x)}if(g!==null)O=!0;else{var L=i(p);L!==null&&_(A,L.startTime-E),O=!1}}break e}finally{g=null,j=te,S=!1}O=void 0}}finally{O?q():U=!1}}}var q;if(typeof B=="function")q=function(){B(P)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,X=ee.port2;ee.port1.onmessage=P,q=function(){X.postMessage(null)}}else q=function(){k(P,0)};function _(E,O){C=k(function(){E(a.unstable_now())},O)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(E){E.callback=null},a.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<E?Math.floor(1e3/E):5},a.unstable_getCurrentPriorityLevel=function(){return j},a.unstable_next=function(E){switch(j){case 1:case 2:case 3:var O=3;break;default:O=j}var te=j;j=O;try{return E()}finally{j=te}},a.unstable_requestPaint=function(){T=!0},a.unstable_runWithPriority=function(E,O){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var te=j;j=E;try{return O()}finally{j=te}},a.unstable_scheduleCallback=function(E,O,te){var Y=a.unstable_now();switch(typeof te=="object"&&te!==null?(te=te.delay,te=typeof te=="number"&&0<te?Y+te:Y):te=Y,E){case 1:var me=-1;break;case 2:me=250;break;case 5:me=1073741823;break;case 4:me=1e4;break;default:me=5e3}return me=te+me,E={id:y++,callback:O,priorityLevel:E,startTime:te,expirationTime:me,sortIndex:-1},te>Y?(E.sortIndex=te,r(p,E),i(x)===null&&E===i(p)&&(D?(M(C),C=-1):D=!0,_(A,te-Y))):(E.sortIndex=me,r(x,E),N||S||(N=!0,U||(U=!0,q()))),E},a.unstable_shouldYield=I,a.unstable_wrapCallback=function(E){var O=j;return function(){var te=j;j=O;try{return E.apply(this,arguments)}finally{j=te}}}})(Bu)),Bu}var Gh;function B1(){return Gh||(Gh=1,Ou.exports=O1()),Ou.exports}var Iu={exports:{}},Kt={};/**
27
27
  * @license React
28
28
  * react-dom.production.js
29
29
  *
@@ -31,7 +31,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-
31
31
  *
32
32
  * This source code is licensed under the MIT license found in the
33
33
  * LICENSE file in the root directory of this source tree.
34
- */var Gh;function B1(){if(Gh)return Wt;Gh=1;var a=bd();function r(x){var p="https://react.dev/errors/"+x;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 #"+x+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var o={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},u=Symbol.for("react.portal");function m(x,p,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u,key:g==null?null:""+g,children:x,containerInfo:p,implementation:y}}var f=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(x,p){if(x==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Wt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Wt.createPortal=function(x,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 m(x,p,null,y)},Wt.flushSync=function(x){var p=f.T,y=o.p;try{if(f.T=null,o.p=2,x)return x()}finally{f.T=p,o.p=y,o.d.f()}},Wt.preconnect=function(x,p){typeof x=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,o.d.C(x,p))},Wt.prefetchDNS=function(x){typeof x=="string"&&o.d.D(x)},Wt.preinit=function(x,p){if(typeof x=="string"&&p&&typeof p.as=="string"){var y=p.as,g=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(x,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:g,integrity:j,fetchPriority:S}):y==="script"&&o.d.X(x,{crossOrigin:g,integrity:j,fetchPriority:S,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Wt.preinitModule=function(x,p){if(typeof x=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var y=h(p.as,p.crossOrigin);o.d.M(x,{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(x)},Wt.preload=function(x,p){if(typeof x=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,g=h(y,p.crossOrigin);o.d.L(x,y,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Wt.preloadModule=function(x,p){if(typeof x=="string")if(p){var y=h(p.as,p.crossOrigin);o.d.m(x,{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(x)},Wt.requestFormReset=function(x){o.d.r(x)},Wt.unstable_batchedUpdates=function(x,p){return x(p)},Wt.useFormState=function(x,p,y){return f.H.useFormState(x,p,y)},Wt.useFormStatus=function(){return f.H.useHostTransitionStatus()},Wt.version="19.2.4",Wt}var Ph;function av(){if(Ph)return Uu.exports;Ph=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(r){console.error(r)}}return a(),Uu.exports=B1(),Uu.exports}/**
34
+ */var Ph;function I1(){if(Ph)return Kt;Ph=1;var a=jd();function r(x){var p="https://react.dev/errors/"+x;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 #"+x+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var o={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},u=Symbol.for("react.portal");function m(x,p,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u,key:g==null?null:""+g,children:x,containerInfo:p,implementation:y}}var f=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(x,p){if(x==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Kt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Kt.createPortal=function(x,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 m(x,p,null,y)},Kt.flushSync=function(x){var p=f.T,y=o.p;try{if(f.T=null,o.p=2,x)return x()}finally{f.T=p,o.p=y,o.d.f()}},Kt.preconnect=function(x,p){typeof x=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,o.d.C(x,p))},Kt.prefetchDNS=function(x){typeof x=="string"&&o.d.D(x)},Kt.preinit=function(x,p){if(typeof x=="string"&&p&&typeof p.as=="string"){var y=p.as,g=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(x,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:g,integrity:j,fetchPriority:S}):y==="script"&&o.d.X(x,{crossOrigin:g,integrity:j,fetchPriority:S,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Kt.preinitModule=function(x,p){if(typeof x=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var y=h(p.as,p.crossOrigin);o.d.M(x,{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(x)},Kt.preload=function(x,p){if(typeof x=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,g=h(y,p.crossOrigin);o.d.L(x,y,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Kt.preloadModule=function(x,p){if(typeof x=="string")if(p){var y=h(p.as,p.crossOrigin);o.d.m(x,{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(x)},Kt.requestFormReset=function(x){o.d.r(x)},Kt.unstable_batchedUpdates=function(x,p){return x(p)},Kt.useFormState=function(x,p,y){return f.H.useFormState(x,p,y)},Kt.useFormStatus=function(){return f.H.useHostTransitionStatus()},Kt.version="19.2.4",Kt}var qh;function lv(){if(qh)return Iu.exports;qh=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(r){console.error(r)}}return a(),Iu.exports=I1(),Iu.exports}/**
35
35
  * @license React
36
36
  * react-dom-client.production.js
37
37
  *
@@ -39,52 +39,52 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-
39
39
  *
40
40
  * This source code is licensed under the MIT license found in the
41
41
  * LICENSE file in the root directory of this source tree.
42
- */var qh;function U1(){if(qh)return fs;qh=1;var a=O1(),r=bd(),i=av();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)t+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function u(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function m(e){var t=e,l=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(l=t.return),e=t.return;while(e)}return t.tag===3?l:null}function f(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function h(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function x(e){if(m(e)!==e)throw Error(o(188))}function p(e){var t=e.alternate;if(!t){if(t=m(e),t===null)throw Error(o(188));return t!==e?null:e}for(var l=e,s=t;;){var c=l.return;if(c===null)break;var d=c.alternate;if(d===null){if(s=c.return,s!==null){l=s;continue}break}if(c.child===d.child){for(d=c.child;d;){if(d===l)return x(c),e;if(d===s)return x(c),t;d=d.sibling}throw Error(o(188))}if(l.return!==s.return)l=c,s=d;else{for(var b=!1,C=c.child;C;){if(C===l){b=!0,l=c,s=d;break}if(C===s){b=!0,s=c,l=d;break}C=C.sibling}if(!b){for(C=d.child;C;){if(C===l){b=!0,l=d,s=c;break}if(C===s){b=!0,s=d,l=c;break}C=C.sibling}if(!b)throw Error(o(189))}}if(l.alternate!==s)throw Error(o(190))}if(l.tag!==3)throw Error(o(188));return l.stateNode.current===l?e:t}function y(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=y(e),t!==null)return t;e=e.sibling}return null}var g=Object.assign,j=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),B=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),V=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),A=Symbol.for("react.activity"),O=Symbol.for("react.memo_cache_sentinel"),G=Symbol.iterator;function q(e){return e===null||typeof e!="object"?null:(e=G&&e[G]||e["@@iterator"],typeof e=="function"?e:null)}var te=Symbol.for("react.client.reference");function X(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case M:return"Fragment";case k:return"Profiler";case E:return"StrictMode";case L:return"Suspense";case V:return"SuspenseList";case A:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case N:return"Portal";case B:return e.displayName||"Context";case T:return(e._context.displayName||"Context")+".Consumer";case I:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case w:return t=e.displayName||null,t!==null?t:X(e.type)||"Memo";case D:t=e._payload,e=e._init;try{return X(e(t))}catch{}}return null}var _=Array.isArray,R=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se={pending:!1,data:null,method:null,action:null},Y=[],me=-1;function z(e){return{current:e}}function W(e){0>me||(e.current=Y[me],Y[me]=null,me--)}function ie(e,t){me++,Y[me]=e.current,e.current=t}var de=z(null),ge=z(null),xe=z(null),oe=z(null);function ae(e,t){switch(ie(xe,t),ie(ge,e),ie(de,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?sh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=sh(t),e=ih(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}W(de),ie(de,e)}function ve(){W(de),W(ge),W(xe)}function Ie(e){e.memoizedState!==null&&ie(oe,e);var t=de.current,l=ih(t,e.type);t!==l&&(ie(ge,e),ie(de,l))}function Be(e){ge.current===e&&(W(de),W(ge)),oe.current===e&&(W(oe),is._currentValue=se)}var ne,fe;function ue(e){if(ne===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);ne=t&&t[1]||"",fe=-1<l.stack.indexOf(`
42
+ */var Yh;function H1(){if(Yh)return fs;Yh=1;var a=B1(),r=jd(),i=lv();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)t+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function u(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function m(e){var t=e,l=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(l=t.return),e=t.return;while(e)}return t.tag===3?l:null}function f(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function h(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function x(e){if(m(e)!==e)throw Error(o(188))}function p(e){var t=e.alternate;if(!t){if(t=m(e),t===null)throw Error(o(188));return t!==e?null:e}for(var l=e,s=t;;){var c=l.return;if(c===null)break;var d=c.alternate;if(d===null){if(s=c.return,s!==null){l=s;continue}break}if(c.child===d.child){for(d=c.child;d;){if(d===l)return x(c),e;if(d===s)return x(c),t;d=d.sibling}throw Error(o(188))}if(l.return!==s.return)l=c,s=d;else{for(var b=!1,w=c.child;w;){if(w===l){b=!0,l=c,s=d;break}if(w===s){b=!0,s=c,l=d;break}w=w.sibling}if(!b){for(w=d.child;w;){if(w===l){b=!0,l=d,s=c;break}if(w===s){b=!0,s=d,l=c;break}w=w.sibling}if(!b)throw Error(o(189))}}if(l.alternate!==s)throw Error(o(190))}if(l.tag!==3)throw Error(o(188));return l.stateNode.current===l?e:t}function y(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=y(e),t!==null)return t;e=e.sibling}return null}var g=Object.assign,j=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),B=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),C=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),I=Symbol.for("react.memo_cache_sentinel"),P=Symbol.iterator;function q(e){return e===null||typeof e!="object"?null:(e=P&&e[P]||e["@@iterator"],typeof e=="function"?e:null)}var ee=Symbol.for("react.client.reference");function X(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ee?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case D:return"Fragment";case k:return"Profiler";case T:return"StrictMode";case A:return"Suspense";case U:return"SuspenseList";case R:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case N:return"Portal";case B:return e.displayName||"Context";case M:return(e._context.displayName||"Context")+".Consumer";case V:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case C:return t=e.displayName||null,t!==null?t:X(e.type)||"Memo";case z:t=e._payload,e=e._init;try{return X(e(t))}catch{}}return null}var _=Array.isArray,E=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te={pending:!1,data:null,method:null,action:null},Y=[],me=-1;function L(e){return{current:e}}function F(e){0>me||(e.current=Y[me],Y[me]=null,me--)}function ie(e,t){me++,Y[me]=e.current,e.current=t}var de=L(null),ge=L(null),xe=L(null),oe=L(null);function le(e,t){switch(ie(xe,t),ie(ge,e),ie(de,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?ih(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=ih(t),e=oh(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}F(de),ie(de,e)}function ve(){F(de),F(ge),F(xe)}function Ue(e){e.memoizedState!==null&&ie(oe,e);var t=de.current,l=oh(t,e.type);t!==l&&(ie(ge,e),ie(de,l))}function Be(e){ge.current===e&&(F(de),F(ge)),oe.current===e&&(F(oe),is._currentValue=te)}var ae,fe;function ue(e){if(ae===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);ae=t&&t[1]||"",fe=-1<l.stack.indexOf(`
43
43
  at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
44
- `+ne+e+fe}var he=!1;function be(e,t){if(!e||he)return"";he=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var re=function(){throw Error()};if(Object.defineProperty(re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(re,[])}catch(J){var Q=J}Reflect.construct(e,[],re)}else{try{re.call()}catch(J){Q=J}e.call(re.prototype)}}else{try{throw Error()}catch(J){Q=J}(re=e())&&typeof re.catch=="function"&&re.catch(function(){})}}catch(J){if(J&&Q&&typeof J.stack=="string")return[J.stack,Q.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=s.DetermineComponentFrameRoot(),b=d[0],C=d[1];if(b&&C){var H=b.split(`
45
- `),K=C.split(`
46
- `);for(c=s=0;s<H.length&&!H[s].includes("DetermineComponentFrameRoot");)s++;for(;c<K.length&&!K[c].includes("DetermineComponentFrameRoot");)c++;if(s===H.length||c===K.length)for(s=H.length-1,c=K.length-1;1<=s&&0<=c&&H[s]!==K[c];)c--;for(;1<=s&&0<=c;s--,c--)if(H[s]!==K[c]){if(s!==1||c!==1)do if(s--,c--,0>c||H[s]!==K[c]){var ee=`
47
- `+H[s].replace(" at new "," at ");return e.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",e.displayName)),ee}while(1<=s&&0<=c);break}}}finally{he=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?ue(l):""}function _e(e,t){switch(e.tag){case 26:case 27:case 5:return ue(e.type);case 16:return ue("Lazy");case 13:return e.child!==t&&t!==null?ue("Suspense Fallback"):ue("Suspense");case 19:return ue("SuspenseList");case 0:case 15:return be(e.type,!1);case 11:return be(e.type.render,!1);case 1:return be(e.type,!0);case 31:return ue("Activity");default:return""}}function Me(e){try{var t="",l=null;do t+=_e(e,l),l=e,e=e.return;while(e);return t}catch(s){return`
44
+ `+ae+e+fe}var he=!1;function be(e,t){if(!e||he)return"";he=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var se=function(){throw Error()};if(Object.defineProperty(se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(se,[])}catch(J){var Q=J}Reflect.construct(e,[],se)}else{try{se.call()}catch(J){Q=J}e.call(se.prototype)}}else{try{throw Error()}catch(J){Q=J}(se=e())&&typeof se.catch=="function"&&se.catch(function(){})}}catch(J){if(J&&Q&&typeof J.stack=="string")return[J.stack,Q.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=s.DetermineComponentFrameRoot(),b=d[0],w=d[1];if(b&&w){var H=b.split(`
45
+ `),K=w.split(`
46
+ `);for(c=s=0;s<H.length&&!H[s].includes("DetermineComponentFrameRoot");)s++;for(;c<K.length&&!K[c].includes("DetermineComponentFrameRoot");)c++;if(s===H.length||c===K.length)for(s=H.length-1,c=K.length-1;1<=s&&0<=c&&H[s]!==K[c];)c--;for(;1<=s&&0<=c;s--,c--)if(H[s]!==K[c]){if(s!==1||c!==1)do if(s--,c--,0>c||H[s]!==K[c]){var ne=`
47
+ `+H[s].replace(" at new "," at ");return e.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",e.displayName)),ne}while(1<=s&&0<=c);break}}}finally{he=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?ue(l):""}function _e(e,t){switch(e.tag){case 26:case 27:case 5:return ue(e.type);case 16:return ue("Lazy");case 13:return e.child!==t&&t!==null?ue("Suspense Fallback"):ue("Suspense");case 19:return ue("SuspenseList");case 0:case 15:return be(e.type,!1);case 11:return be(e.type.render,!1);case 1:return be(e.type,!0);case 31:return ue("Activity");default:return""}}function Me(e){try{var t="",l=null;do t+=_e(e,l),l=e,e=e.return;while(e);return t}catch(s){return`
48
48
  Error generating stack: `+s.message+`
49
- `+s.stack}}var dt=Object.prototype.hasOwnProperty,Zt=a.unstable_scheduleCallback,ct=a.unstable_cancelCallback,Vt=a.unstable_shouldYield,$t=a.unstable_requestPaint,tt=a.unstable_now,jt=a.unstable_getCurrentPriorityLevel,ye=a.unstable_ImmediatePriority,Rt=a.unstable_UserBlockingPriority,De=a.unstable_NormalPriority,xt=a.unstable_LowPriority,Kt=a.unstable_IdlePriority,nt=a.log,Xa=a.unstable_setDisableYieldValue,Xn=null,Ct=null;function St(e){if(typeof nt=="function"&&Xa(e),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(Xn,e)}catch{}}var bt=Math.clz32?Math.clz32:Un,Bn=Math.log,Za=Math.LN2;function Un(e){return e>>>=0,e===0?32:31-(Bn(e)/Za|0)|0}var Ve=256,Ut=262144,Zn=4194304;function Nt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function br(e,t,l){var s=e.pendingLanes;if(s===0)return 0;var c=0,d=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var C=s&134217727;return C!==0?(s=C&~d,s!==0?c=Nt(s):(b&=C,b!==0?c=Nt(b):l||(l=C&~e,l!==0&&(c=Nt(l))))):(C=s&~d,C!==0?c=Nt(C):b!==0?c=Nt(b):l||(l=s&~e,l!==0&&(c=Nt(l)))),c===0?0:t!==0&&t!==c&&(t&d)===0&&(d=c&-c,l=t&-t,d>=l||d===32&&(l&4194048)!==0)?t:c}function wn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function bo(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 Id(){var e=Zn;return Zn<<=1,(Zn&62914560)===0&&(Zn=4194304),e}function jo(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function jr(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function bg(e,t,l,s,c,d){var b=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var C=e.entanglements,H=e.expirationTimes,K=e.hiddenUpdates;for(l=b&~l;0<l;){var ee=31-bt(l),re=1<<ee;C[ee]=0,H[ee]=-1;var Q=K[ee];if(Q!==null)for(K[ee]=null,ee=0;ee<Q.length;ee++){var J=Q[ee];J!==null&&(J.lane&=-536870913)}l&=~re}s!==0&&Vd(e,s,0),d!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=d&~(b&~t))}function Vd(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-bt(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|l&261930}function $d(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var s=31-bt(l),c=1<<s;c&t|e[s]&t&&(e[s]|=t),l&=~c}}function Gd(e,t){var l=t&-t;return l=(l&42)!==0?1:So(l),(l&(e.suspendedLanes|t))!==0?0:l}function So(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 ko(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Pd(){var e=U.p;return e!==0?e:(e=window.event,e===void 0?32:Ah(e.type))}function qd(e,t){var l=U.p;try{return U.p=e,t()}finally{U.p=l}}var ba=Math.random().toString(36).slice(2),Gt="__reactFiber$"+ba,ln="__reactProps$"+ba,kl="__reactContainer$"+ba,wo="__reactEvents$"+ba,jg="__reactListeners$"+ba,Sg="__reactHandles$"+ba,Yd="__reactResources$"+ba,Sr="__reactMarker$"+ba;function Co(e){delete e[Gt],delete e[ln],delete e[wo],delete e[jg],delete e[Sg]}function wl(e){var t=e[Gt];if(t)return t;for(var l=e.parentNode;l;){if(t=l[kl]||l[Gt]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=mh(e);e!==null;){if(l=e[Gt])return l;e=mh(e)}return t}e=l,l=e.parentNode}return null}function Cl(e){if(e=e[Gt]||e[kl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function kr(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function Nl(e){var t=e[Yd];return t||(t=e[Yd]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ht(e){e[Sr]=!0}var Fd=new Set,Kd={};function Ja(e,t){El(e,t),El(e+"Capture",t)}function El(e,t){for(Kd[e]=t,e=0;e<t.length;e++)Fd.add(t[e])}var kg=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]*$"),Wd={},Qd={};function wg(e){return dt.call(Qd,e)?!0:dt.call(Wd,e)?!1:kg.test(e)?Qd[e]=!0:(Wd[e]=!0,!1)}function _s(e,t,l){if(wg(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+l)}}function Os(e,t,l){if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+l)}}function Jn(e,t,l,s){if(s===null)e.removeAttribute(l);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+s)}}function Cn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Xd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Cg(e,t,l){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var c=s.get,d=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(b){l=""+b,d.call(this,b)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return l},setValue:function(b){l=""+b},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function No(e){if(!e._valueTracker){var t=Xd(e)?"checked":"value";e._valueTracker=Cg(e,t,""+e[t])}}function Zd(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),s="";return e&&(s=Xd(e)?e.checked?"true":"false":e.value),e=s,e!==l?(t.setValue(e),!0):!1}function Bs(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Ng=/[\n"\\]/g;function Nn(e){return e.replace(Ng,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Eo(e,t,l,s,c,d,b,C){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),t!=null?b==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Cn(t)):e.value!==""+Cn(t)&&(e.value=""+Cn(t)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),t!=null?To(e,b,Cn(t)):l!=null?To(e,b,Cn(l)):s!=null&&e.removeAttribute("value"),c==null&&d!=null&&(e.defaultChecked=!!d),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?e.name=""+Cn(C):e.removeAttribute("name")}function Jd(e,t,l,s,c,d,b,C){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),t!=null||l!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){No(e);return}l=l!=null?""+Cn(l):"",t=t!=null?""+Cn(t):l,C||t===e.value||(e.value=t),e.defaultValue=t}s=s??c,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=C?e.checked:!!s,e.defaultChecked=!!s,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),No(e)}function To(e,t,l){t==="number"&&Bs(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Tl(e,t,l,s){if(e=e.options,t){t={};for(var c=0;c<l.length;c++)t["$"+l[c]]=!0;for(l=0;l<e.length;l++)c=t.hasOwnProperty("$"+e[l].value),e[l].selected!==c&&(e[l].selected=c),c&&s&&(e[l].defaultSelected=!0)}else{for(l=""+Cn(l),t=null,c=0;c<e.length;c++){if(e[c].value===l){e[c].selected=!0,s&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function ef(e,t,l){if(t!=null&&(t=""+Cn(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+Cn(l):""}function tf(e,t,l,s){if(t==null){if(s!=null){if(l!=null)throw Error(o(92));if(_(s)){if(1<s.length)throw Error(o(93));s=s[0]}l=s}l==null&&(l=""),t=l}l=Cn(t),e.defaultValue=l,s=e.textContent,s===l&&s!==""&&s!==null&&(e.value=s),No(e)}function Rl(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var Eg=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 nf(e,t,l){var s=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,l):typeof l!="number"||l===0||Eg.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function af(e,t,l){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,l!=null){for(var s in l)!l.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var c in t)s=t[c],t.hasOwnProperty(c)&&l[c]!==s&&nf(e,c,s)}else for(var d in t)t.hasOwnProperty(d)&&nf(e,d,t[d])}function Ro(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 Tg=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"]]),Rg=/^[\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 Us(e){return Rg.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ea(){}var Ao=null;function Mo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Al=null,Ml=null;function lf(e){var t=Cl(e);if(t&&(e=t.stateNode)){var l=e[ln]||null;e:switch(e=t.stateNode,t.type){case"input":if(Eo(e,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),t=l.name,l.type==="radio"&&t!=null){for(l=e;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Nn(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var s=l[t];if(s!==e&&s.form===e.form){var c=s[ln]||null;if(!c)throw Error(o(90));Eo(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<l.length;t++)s=l[t],s.form===e.form&&Zd(s)}break e;case"textarea":ef(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&Tl(e,!!l.multiple,t,!1)}}}var Do=!1;function rf(e,t,l){if(Do)return e(t,l);Do=!0;try{var s=e(t);return s}finally{if(Do=!1,(Al!==null||Ml!==null)&&(Ci(),Al&&(t=Al,e=Ml,Ml=Al=null,lf(t),e)))for(t=0;t<e.length;t++)lf(e[t])}}function wr(e,t){var l=e.stateNode;if(l===null)return null;var s=l[ln]||null;if(s===null)return null;l=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(o(231,t,typeof l));return l}var ta=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),zo=!1;if(ta)try{var Cr={};Object.defineProperty(Cr,"passive",{get:function(){zo=!0}}),window.addEventListener("test",Cr,Cr),window.removeEventListener("test",Cr,Cr)}catch{zo=!1}var ja=null,Lo=null,Hs=null;function sf(){if(Hs)return Hs;var e,t=Lo,l=t.length,s,c="value"in ja?ja.value:ja.textContent,d=c.length;for(e=0;e<l&&t[e]===c[e];e++);var b=l-e;for(s=1;s<=b&&t[l-s]===c[d-s];s++);return Hs=c.slice(e,1<s?1-s:void 0)}function Is(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Vs(){return!0}function of(){return!1}function rn(e){function t(l,s,c,d,b){this._reactName=l,this._targetInst=c,this.type=s,this.nativeEvent=d,this.target=b,this.currentTarget=null;for(var C in e)e.hasOwnProperty(C)&&(l=e[C],this[C]=l?l(d):d[C]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?Vs:of,this.isPropagationStopped=of,this}return g(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Vs)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Vs)},persist:function(){},isPersistent:Vs}),t}var el={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$s=rn(el),Nr=g({},el,{view:0,detail:0}),Ag=rn(Nr),_o,Oo,Er,Gs=g({},Nr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Uo,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Er&&(Er&&e.type==="mousemove"?(_o=e.screenX-Er.screenX,Oo=e.screenY-Er.screenY):Oo=_o=0,Er=e),_o)},movementY:function(e){return"movementY"in e?e.movementY:Oo}}),cf=rn(Gs),Mg=g({},Gs,{dataTransfer:0}),Dg=rn(Mg),zg=g({},Nr,{relatedTarget:0}),Bo=rn(zg),Lg=g({},el,{animationName:0,elapsedTime:0,pseudoElement:0}),_g=rn(Lg),Og=g({},el,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Bg=rn(Og),Ug=g({},el,{data:0}),uf=rn(Ug),Hg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ig={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"},Vg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $g(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Vg[e])?!!t[e]:!1}function Uo(){return $g}var Gg=g({},Nr,{key:function(e){if(e.key){var t=Hg[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Is(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ig[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Uo,charCode:function(e){return e.type==="keypress"?Is(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Is(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Pg=rn(Gg),qg=g({},Gs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),df=rn(qg),Yg=g({},Nr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Uo}),Fg=rn(Yg),Kg=g({},el,{propertyName:0,elapsedTime:0,pseudoElement:0}),Wg=rn(Kg),Qg=g({},Gs,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Xg=rn(Qg),Zg=g({},el,{newState:0,oldState:0}),Jg=rn(Zg),ey=[9,13,27,32],Ho=ta&&"CompositionEvent"in window,Tr=null;ta&&"documentMode"in document&&(Tr=document.documentMode);var ty=ta&&"TextEvent"in window&&!Tr,ff=ta&&(!Ho||Tr&&8<Tr&&11>=Tr),pf=" ",mf=!1;function hf(e,t){switch(e){case"keyup":return ey.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Dl=!1;function ny(e,t){switch(e){case"compositionend":return xf(t);case"keypress":return t.which!==32?null:(mf=!0,pf);case"textInput":return e=t.data,e===pf&&mf?null:e;default:return null}}function ay(e,t){if(Dl)return e==="compositionend"||!Ho&&hf(e,t)?(e=sf(),Hs=Lo=ja=null,Dl=!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 ff&&t.locale!=="ko"?null:t.data;default:return null}}var ly={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 vf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!ly[e.type]:t==="textarea"}function gf(e,t,l,s){Al?Ml?Ml.push(s):Ml=[s]:Al=s,t=Di(t,"onChange"),0<t.length&&(l=new $s("onChange","change",null,l,s),e.push({event:l,listeners:t}))}var Rr=null,Ar=null;function ry(e){eh(e,0)}function Ps(e){var t=kr(e);if(Zd(t))return e}function yf(e,t){if(e==="change")return t}var bf=!1;if(ta){var Io;if(ta){var Vo="oninput"in document;if(!Vo){var jf=document.createElement("div");jf.setAttribute("oninput","return;"),Vo=typeof jf.oninput=="function"}Io=Vo}else Io=!1;bf=Io&&(!document.documentMode||9<document.documentMode)}function Sf(){Rr&&(Rr.detachEvent("onpropertychange",kf),Ar=Rr=null)}function kf(e){if(e.propertyName==="value"&&Ps(Ar)){var t=[];gf(t,Ar,e,Mo(e)),rf(ry,t)}}function sy(e,t,l){e==="focusin"?(Sf(),Rr=t,Ar=l,Rr.attachEvent("onpropertychange",kf)):e==="focusout"&&Sf()}function iy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ps(Ar)}function oy(e,t){if(e==="click")return Ps(t)}function cy(e,t){if(e==="input"||e==="change")return Ps(t)}function uy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var fn=typeof Object.is=="function"?Object.is:uy;function Mr(e,t){if(fn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),s=Object.keys(t);if(l.length!==s.length)return!1;for(s=0;s<l.length;s++){var c=l[s];if(!dt.call(t,c)||!fn(e[c],t[c]))return!1}return!0}function wf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Cf(e,t){var l=wf(e);e=0;for(var s;l;){if(l.nodeType===3){if(s=e+l.textContent.length,e<=t&&s>=t)return{node:l,offset:t-e};e=s}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=wf(l)}}function Nf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Nf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ef(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Bs(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=Bs(e.document)}return t}function $o(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 dy=ta&&"documentMode"in document&&11>=document.documentMode,zl=null,Go=null,Dr=null,Po=!1;function Tf(e,t,l){var s=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Po||zl==null||zl!==Bs(s)||(s=zl,"selectionStart"in s&&$o(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Dr&&Mr(Dr,s)||(Dr=s,s=Di(Go,"onSelect"),0<s.length&&(t=new $s("onSelect","select",null,t,l),e.push({event:t,listeners:s}),t.target=zl)))}function tl(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var Ll={animationend:tl("Animation","AnimationEnd"),animationiteration:tl("Animation","AnimationIteration"),animationstart:tl("Animation","AnimationStart"),transitionrun:tl("Transition","TransitionRun"),transitionstart:tl("Transition","TransitionStart"),transitioncancel:tl("Transition","TransitionCancel"),transitionend:tl("Transition","TransitionEnd")},qo={},Rf={};ta&&(Rf=document.createElement("div").style,"AnimationEvent"in window||(delete Ll.animationend.animation,delete Ll.animationiteration.animation,delete Ll.animationstart.animation),"TransitionEvent"in window||delete Ll.transitionend.transition);function nl(e){if(qo[e])return qo[e];if(!Ll[e])return e;var t=Ll[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in Rf)return qo[e]=t[l];return e}var Af=nl("animationend"),Mf=nl("animationiteration"),Df=nl("animationstart"),fy=nl("transitionrun"),py=nl("transitionstart"),my=nl("transitioncancel"),zf=nl("transitionend"),Lf=new Map,Yo="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(" ");Yo.push("scrollEnd");function Hn(e,t){Lf.set(e,t),Ja(t,[e])}var qs=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},En=[],_l=0,Fo=0;function Ys(){for(var e=_l,t=Fo=_l=0;t<e;){var l=En[t];En[t++]=null;var s=En[t];En[t++]=null;var c=En[t];En[t++]=null;var d=En[t];if(En[t++]=null,s!==null&&c!==null){var b=s.pending;b===null?c.next=c:(c.next=b.next,b.next=c),s.pending=c}d!==0&&_f(l,c,d)}}function Fs(e,t,l,s){En[_l++]=e,En[_l++]=t,En[_l++]=l,En[_l++]=s,Fo|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Ko(e,t,l,s){return Fs(e,t,l,s),Ks(e)}function al(e,t){return Fs(e,null,null,t),Ks(e)}function _f(e,t,l){e.lanes|=l;var s=e.alternate;s!==null&&(s.lanes|=l);for(var c=!1,d=e.return;d!==null;)d.childLanes|=l,s=d.alternate,s!==null&&(s.childLanes|=l),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(c=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,c&&t!==null&&(c=31-bt(l),e=d.hiddenUpdates,s=e[c],s===null?e[c]=[t]:s.push(t),t.lane=l|536870912),d):null}function Ks(e){if(50<es)throw es=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 Ol={};function hy(e,t,l,s){this.tag=e,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function pn(e,t,l,s){return new hy(e,t,l,s)}function Wo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function na(e,t){var l=e.alternate;return l===null?(l=pn(e.tag,t,e.key,e.mode),l.elementType=e.elementType,l.type=e.type,l.stateNode=e.stateNode,l.alternate=e,e.alternate=l):(l.pendingProps=t,l.type=e.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=e.flags&65011712,l.childLanes=e.childLanes,l.lanes=e.lanes,l.child=e.child,l.memoizedProps=e.memoizedProps,l.memoizedState=e.memoizedState,l.updateQueue=e.updateQueue,t=e.dependencies,l.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},l.sibling=e.sibling,l.index=e.index,l.ref=e.ref,l.refCleanup=e.refCleanup,l}function Of(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 Ws(e,t,l,s,c,d){var b=0;if(s=e,typeof e=="function")Wo(e)&&(b=1);else if(typeof e=="string")b=b1(e,l,de.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case A:return e=pn(31,l,t,c),e.elementType=A,e.lanes=d,e;case M:return ll(l.children,c,d,t);case E:b=8,c|=24;break;case k:return e=pn(12,l,t,c|2),e.elementType=k,e.lanes=d,e;case L:return e=pn(13,l,t,c),e.elementType=L,e.lanes=d,e;case V:return e=pn(19,l,t,c),e.elementType=V,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case B:b=10;break e;case T:b=9;break e;case I:b=11;break e;case w:b=14;break e;case D:b=16,s=null;break e}b=29,l=Error(o(130,e===null?"null":typeof e,"")),s=null}return t=pn(b,l,t,c),t.elementType=e,t.type=s,t.lanes=d,t}function ll(e,t,l,s){return e=pn(7,e,s,t),e.lanes=l,e}function Qo(e,t,l){return e=pn(6,e,null,t),e.lanes=l,e}function Bf(e){var t=pn(18,null,null,0);return t.stateNode=e,t}function Xo(e,t,l){return t=pn(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Uf=new WeakMap;function Tn(e,t){if(typeof e=="object"&&e!==null){var l=Uf.get(e);return l!==void 0?l:(t={value:e,source:t,stack:Me(t)},Uf.set(e,t),t)}return{value:e,source:t,stack:Me(t)}}var Bl=[],Ul=0,Qs=null,zr=0,Rn=[],An=0,Sa=null,Pn=1,qn="";function aa(e,t){Bl[Ul++]=zr,Bl[Ul++]=Qs,Qs=e,zr=t}function Hf(e,t,l){Rn[An++]=Pn,Rn[An++]=qn,Rn[An++]=Sa,Sa=e;var s=Pn;e=qn;var c=32-bt(s)-1;s&=~(1<<c),l+=1;var d=32-bt(t)+c;if(30<d){var b=c-c%5;d=(s&(1<<b)-1).toString(32),s>>=b,c-=b,Pn=1<<32-bt(t)+c|l<<c|s,qn=d+e}else Pn=1<<d|l<<c|s,qn=e}function Zo(e){e.return!==null&&(aa(e,1),Hf(e,1,0))}function Jo(e){for(;e===Qs;)Qs=Bl[--Ul],Bl[Ul]=null,zr=Bl[--Ul],Bl[Ul]=null;for(;e===Sa;)Sa=Rn[--An],Rn[An]=null,qn=Rn[--An],Rn[An]=null,Pn=Rn[--An],Rn[An]=null}function If(e,t){Rn[An++]=Pn,Rn[An++]=qn,Rn[An++]=Sa,Pn=t.id,qn=t.overflow,Sa=e}var Pt=null,ft=null,Ke=!1,ka=null,Mn=!1,ec=Error(o(519));function wa(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Lr(Tn(t,e)),ec}function Vf(e){var t=e.stateNode,l=e.type,s=e.memoizedProps;switch(t[Gt]=e,t[ln]=s,l){case"dialog":qe("cancel",t),qe("close",t);break;case"iframe":case"object":case"embed":qe("load",t);break;case"video":case"audio":for(l=0;l<ns.length;l++)qe(ns[l],t);break;case"source":qe("error",t);break;case"img":case"image":case"link":qe("error",t),qe("load",t);break;case"details":qe("toggle",t);break;case"input":qe("invalid",t),Jd(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":qe("invalid",t);break;case"textarea":qe("invalid",t),tf(t,s.value,s.defaultValue,s.children)}l=s.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||s.suppressHydrationWarning===!0||lh(t.textContent,l)?(s.popover!=null&&(qe("beforetoggle",t),qe("toggle",t)),s.onScroll!=null&&qe("scroll",t),s.onScrollEnd!=null&&qe("scrollend",t),s.onClick!=null&&(t.onclick=ea),t=!0):t=!1,t||wa(e,!0)}function $f(e){for(Pt=e.return;Pt;)switch(Pt.tag){case 5:case 31:case 13:Mn=!1;return;case 27:case 3:Mn=!0;return;default:Pt=Pt.return}}function Hl(e){if(e!==Pt)return!1;if(!Ke)return $f(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&&ft&&wa(e),$f(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));ft=ph(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));ft=ph(e)}else t===27?(t=ft,Ua(e.type)?(e=ku,ku=null,ft=e):ft=t):ft=Pt?zn(e.stateNode.nextSibling):null;return!0}function rl(){ft=Pt=null,Ke=!1}function tc(){var e=ka;return e!==null&&(un===null?un=e:un.push.apply(un,e),ka=null),e}function Lr(e){ka===null?ka=[e]:ka.push(e)}var nc=z(null),sl=null,la=null;function Ca(e,t,l){ie(nc,t._currentValue),t._currentValue=l}function ra(e){e._currentValue=nc.current,W(nc)}function ac(e,t,l){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===l)break;e=e.return}}function lc(e,t,l,s){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var d=c.dependencies;if(d!==null){var b=c.child;d=d.firstContext;e:for(;d!==null;){var C=d;d=c;for(var H=0;H<t.length;H++)if(C.context===t[H]){d.lanes|=l,C=d.alternate,C!==null&&(C.lanes|=l),ac(d.return,l,e),s||(b=null);break e}d=C.next}}else if(c.tag===18){if(b=c.return,b===null)throw Error(o(341));b.lanes|=l,d=b.alternate,d!==null&&(d.lanes|=l),ac(b,l,e),b=null}else b=c.child;if(b!==null)b.return=c;else for(b=c;b!==null;){if(b===e){b=null;break}if(c=b.sibling,c!==null){c.return=b.return,b=c;break}b=b.return}c=b}}function Il(e,t,l,s){e=null;for(var c=t,d=!1;c!==null;){if(!d){if((c.flags&524288)!==0)d=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var b=c.alternate;if(b===null)throw Error(o(387));if(b=b.memoizedProps,b!==null){var C=c.type;fn(c.pendingProps.value,b.value)||(e!==null?e.push(C):e=[C])}}else if(c===oe.current){if(b=c.alternate,b===null)throw Error(o(387));b.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(is):e=[is])}c=c.return}e!==null&&lc(t,e,l,s),t.flags|=262144}function Xs(e){for(e=e.firstContext;e!==null;){if(!fn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function il(e){sl=e,la=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function qt(e){return Gf(sl,e)}function Zs(e,t){return sl===null&&il(e),Gf(e,t)}function Gf(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},la===null){if(e===null)throw Error(o(308));la=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else la=la.next=t;return l}var xy=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},vy=a.unstable_scheduleCallback,gy=a.unstable_NormalPriority,At={$$typeof:B,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function rc(){return{controller:new xy,data:new Map,refCount:0}}function _r(e){e.refCount--,e.refCount===0&&vy(gy,function(){e.controller.abort()})}var Or=null,sc=0,Vl=0,$l=null;function yy(e,t){if(Or===null){var l=Or=[];sc=0,Vl=cu(),$l={status:"pending",value:void 0,then:function(s){l.push(s)}}}return sc++,t.then(Pf,Pf),t}function Pf(){if(--sc===0&&Or!==null){$l!==null&&($l.status="fulfilled");var e=Or;Or=null,Vl=0,$l=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function by(e,t){var l=[],s={status:"pending",value:null,reason:null,then:function(c){l.push(c)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var c=0;c<l.length;c++)(0,l[c])(t)},function(c){for(s.status="rejected",s.reason=c,c=0;c<l.length;c++)(0,l[c])(void 0)}),s}var qf=R.S;R.S=function(e,t){Tm=tt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&yy(e,t),qf!==null&&qf(e,t)};var ol=z(null);function ic(){var e=ol.current;return e!==null?e:ut.pooledCache}function Js(e,t){t===null?ie(ol,ol.current):ie(ol,t.pool)}function Yf(){var e=ic();return e===null?null:{parent:At._currentValue,pool:e}}var Gl=Error(o(460)),oc=Error(o(474)),ei=Error(o(542)),ti={then:function(){}};function Ff(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Kf(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(ea,ea),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Qf(e),e;default:if(typeof t.status=="string")t.then(ea,ea);else{if(e=ut,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=s}},function(s){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Qf(e),e}throw ul=t,Gl}}function cl(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(ul=l,Gl):l}}var ul=null;function Wf(){if(ul===null)throw Error(o(459));var e=ul;return ul=null,e}function Qf(e){if(e===Gl||e===ei)throw Error(o(483))}var Pl=null,Br=0;function ni(e){var t=Br;return Br+=1,Pl===null&&(Pl=[]),Kf(Pl,e,t)}function Ur(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ai(e,t){throw t.$$typeof===j?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Xf(e){function t(P,$){if(e){var F=P.deletions;F===null?(P.deletions=[$],P.flags|=16):F.push($)}}function l(P,$){if(!e)return null;for(;$!==null;)t(P,$),$=$.sibling;return null}function s(P){for(var $=new Map;P!==null;)P.key!==null?$.set(P.key,P):$.set(P.index,P),P=P.sibling;return $}function c(P,$){return P=na(P,$),P.index=0,P.sibling=null,P}function d(P,$,F){return P.index=F,e?(F=P.alternate,F!==null?(F=F.index,F<$?(P.flags|=67108866,$):F):(P.flags|=67108866,$)):(P.flags|=1048576,$)}function b(P){return e&&P.alternate===null&&(P.flags|=67108866),P}function C(P,$,F,le){return $===null||$.tag!==6?($=Qo(F,P.mode,le),$.return=P,$):($=c($,F),$.return=P,$)}function H(P,$,F,le){var Ee=F.type;return Ee===M?ee(P,$,F.props.children,le,F.key):$!==null&&($.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===D&&cl(Ee)===$.type)?($=c($,F.props),Ur($,F),$.return=P,$):($=Ws(F.type,F.key,F.props,null,P.mode,le),Ur($,F),$.return=P,$)}function K(P,$,F,le){return $===null||$.tag!==4||$.stateNode.containerInfo!==F.containerInfo||$.stateNode.implementation!==F.implementation?($=Xo(F,P.mode,le),$.return=P,$):($=c($,F.children||[]),$.return=P,$)}function ee(P,$,F,le,Ee){return $===null||$.tag!==7?($=ll(F,P.mode,le,Ee),$.return=P,$):($=c($,F),$.return=P,$)}function re(P,$,F){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return $=Qo(""+$,P.mode,F),$.return=P,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case S:return F=Ws($.type,$.key,$.props,null,P.mode,F),Ur(F,$),F.return=P,F;case N:return $=Xo($,P.mode,F),$.return=P,$;case D:return $=cl($),re(P,$,F)}if(_($)||q($))return $=ll($,P.mode,F,null),$.return=P,$;if(typeof $.then=="function")return re(P,ni($),F);if($.$$typeof===B)return re(P,Zs(P,$),F);ai(P,$)}return null}function Q(P,$,F,le){var Ee=$!==null?$.key:null;if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return Ee!==null?null:C(P,$,""+F,le);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case S:return F.key===Ee?H(P,$,F,le):null;case N:return F.key===Ee?K(P,$,F,le):null;case D:return F=cl(F),Q(P,$,F,le)}if(_(F)||q(F))return Ee!==null?null:ee(P,$,F,le,null);if(typeof F.then=="function")return Q(P,$,ni(F),le);if(F.$$typeof===B)return Q(P,$,Zs(P,F),le);ai(P,F)}return null}function J(P,$,F,le,Ee){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return P=P.get(F)||null,C($,P,""+le,Ee);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case S:return P=P.get(le.key===null?F:le.key)||null,H($,P,le,Ee);case N:return P=P.get(le.key===null?F:le.key)||null,K($,P,le,Ee);case D:return le=cl(le),J(P,$,F,le,Ee)}if(_(le)||q(le))return P=P.get(F)||null,ee($,P,le,Ee,null);if(typeof le.then=="function")return J(P,$,F,ni(le),Ee);if(le.$$typeof===B)return J(P,$,F,Zs($,le),Ee);ai($,le)}return null}function Se(P,$,F,le){for(var Ee=null,Qe=null,ke=$,Ue=$=0,Fe=null;ke!==null&&Ue<F.length;Ue++){ke.index>Ue?(Fe=ke,ke=null):Fe=ke.sibling;var Xe=Q(P,ke,F[Ue],le);if(Xe===null){ke===null&&(ke=Fe);break}e&&ke&&Xe.alternate===null&&t(P,ke),$=d(Xe,$,Ue),Qe===null?Ee=Xe:Qe.sibling=Xe,Qe=Xe,ke=Fe}if(Ue===F.length)return l(P,ke),Ke&&aa(P,Ue),Ee;if(ke===null){for(;Ue<F.length;Ue++)ke=re(P,F[Ue],le),ke!==null&&($=d(ke,$,Ue),Qe===null?Ee=ke:Qe.sibling=ke,Qe=ke);return Ke&&aa(P,Ue),Ee}for(ke=s(ke);Ue<F.length;Ue++)Fe=J(ke,P,Ue,F[Ue],le),Fe!==null&&(e&&Fe.alternate!==null&&ke.delete(Fe.key===null?Ue:Fe.key),$=d(Fe,$,Ue),Qe===null?Ee=Fe:Qe.sibling=Fe,Qe=Fe);return e&&ke.forEach(function(Ga){return t(P,Ga)}),Ke&&aa(P,Ue),Ee}function Te(P,$,F,le){if(F==null)throw Error(o(151));for(var Ee=null,Qe=null,ke=$,Ue=$=0,Fe=null,Xe=F.next();ke!==null&&!Xe.done;Ue++,Xe=F.next()){ke.index>Ue?(Fe=ke,ke=null):Fe=ke.sibling;var Ga=Q(P,ke,Xe.value,le);if(Ga===null){ke===null&&(ke=Fe);break}e&&ke&&Ga.alternate===null&&t(P,ke),$=d(Ga,$,Ue),Qe===null?Ee=Ga:Qe.sibling=Ga,Qe=Ga,ke=Fe}if(Xe.done)return l(P,ke),Ke&&aa(P,Ue),Ee;if(ke===null){for(;!Xe.done;Ue++,Xe=F.next())Xe=re(P,Xe.value,le),Xe!==null&&($=d(Xe,$,Ue),Qe===null?Ee=Xe:Qe.sibling=Xe,Qe=Xe);return Ke&&aa(P,Ue),Ee}for(ke=s(ke);!Xe.done;Ue++,Xe=F.next())Xe=J(ke,P,Ue,Xe.value,le),Xe!==null&&(e&&Xe.alternate!==null&&ke.delete(Xe.key===null?Ue:Xe.key),$=d(Xe,$,Ue),Qe===null?Ee=Xe:Qe.sibling=Xe,Qe=Xe);return e&&ke.forEach(function(M1){return t(P,M1)}),Ke&&aa(P,Ue),Ee}function it(P,$,F,le){if(typeof F=="object"&&F!==null&&F.type===M&&F.key===null&&(F=F.props.children),typeof F=="object"&&F!==null){switch(F.$$typeof){case S:e:{for(var Ee=F.key;$!==null;){if($.key===Ee){if(Ee=F.type,Ee===M){if($.tag===7){l(P,$.sibling),le=c($,F.props.children),le.return=P,P=le;break e}}else if($.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===D&&cl(Ee)===$.type){l(P,$.sibling),le=c($,F.props),Ur(le,F),le.return=P,P=le;break e}l(P,$);break}else t(P,$);$=$.sibling}F.type===M?(le=ll(F.props.children,P.mode,le,F.key),le.return=P,P=le):(le=Ws(F.type,F.key,F.props,null,P.mode,le),Ur(le,F),le.return=P,P=le)}return b(P);case N:e:{for(Ee=F.key;$!==null;){if($.key===Ee)if($.tag===4&&$.stateNode.containerInfo===F.containerInfo&&$.stateNode.implementation===F.implementation){l(P,$.sibling),le=c($,F.children||[]),le.return=P,P=le;break e}else{l(P,$);break}else t(P,$);$=$.sibling}le=Xo(F,P.mode,le),le.return=P,P=le}return b(P);case D:return F=cl(F),it(P,$,F,le)}if(_(F))return Se(P,$,F,le);if(q(F)){if(Ee=q(F),typeof Ee!="function")throw Error(o(150));return F=Ee.call(F),Te(P,$,F,le)}if(typeof F.then=="function")return it(P,$,ni(F),le);if(F.$$typeof===B)return it(P,$,Zs(P,F),le);ai(P,F)}return typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint"?(F=""+F,$!==null&&$.tag===6?(l(P,$.sibling),le=c($,F),le.return=P,P=le):(l(P,$),le=Qo(F,P.mode,le),le.return=P,P=le),b(P)):l(P,$)}return function(P,$,F,le){try{Br=0;var Ee=it(P,$,F,le);return Pl=null,Ee}catch(ke){if(ke===Gl||ke===ei)throw ke;var Qe=pn(29,ke,null,P.mode);return Qe.lanes=le,Qe.return=P,Qe}finally{}}}var dl=Xf(!0),Zf=Xf(!1),Na=!1;function cc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function uc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ea(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ta(e,t,l){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Je&2)!==0){var c=s.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),s.pending=t,t=Ks(e),_f(e,null,l),t}return Fs(e,s,t,l),Ks(e)}function Hr(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,l|=s,t.lanes=l,$d(e,l)}}function dc(e,t){var l=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,l===s)){var c=null,d=null;if(l=l.firstBaseUpdate,l!==null){do{var b={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};d===null?c=d=b:d=d.next=b,l=l.next}while(l!==null);d===null?c=d=t:d=d.next=t}else c=d=t;l={baseState:s.baseState,firstBaseUpdate:c,lastBaseUpdate:d,shared:s.shared,callbacks:s.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var fc=!1;function Ir(){if(fc){var e=$l;if(e!==null)throw e}}function Vr(e,t,l,s){fc=!1;var c=e.updateQueue;Na=!1;var d=c.firstBaseUpdate,b=c.lastBaseUpdate,C=c.shared.pending;if(C!==null){c.shared.pending=null;var H=C,K=H.next;H.next=null,b===null?d=K:b.next=K,b=H;var ee=e.alternate;ee!==null&&(ee=ee.updateQueue,C=ee.lastBaseUpdate,C!==b&&(C===null?ee.firstBaseUpdate=K:C.next=K,ee.lastBaseUpdate=H))}if(d!==null){var re=c.baseState;b=0,ee=K=H=null,C=d;do{var Q=C.lane&-536870913,J=Q!==C.lane;if(J?(Ye&Q)===Q:(s&Q)===Q){Q!==0&&Q===Vl&&(fc=!0),ee!==null&&(ee=ee.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var Se=e,Te=C;Q=t;var it=l;switch(Te.tag){case 1:if(Se=Te.payload,typeof Se=="function"){re=Se.call(it,re,Q);break e}re=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Te.payload,Q=typeof Se=="function"?Se.call(it,re,Q):Se,Q==null)break e;re=g({},re,Q);break e;case 2:Na=!0}}Q=C.callback,Q!==null&&(e.flags|=64,J&&(e.flags|=8192),J=c.callbacks,J===null?c.callbacks=[Q]:J.push(Q))}else J={lane:Q,tag:C.tag,payload:C.payload,callback:C.callback,next:null},ee===null?(K=ee=J,H=re):ee=ee.next=J,b|=Q;if(C=C.next,C===null){if(C=c.shared.pending,C===null)break;J=C,C=J.next,J.next=null,c.lastBaseUpdate=J,c.shared.pending=null}}while(!0);ee===null&&(H=re),c.baseState=H,c.firstBaseUpdate=K,c.lastBaseUpdate=ee,d===null&&(c.shared.lanes=0),za|=b,e.lanes=b,e.memoizedState=re}}function Jf(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function ep(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)Jf(l[e],t)}var ql=z(null),li=z(0);function tp(e,t){e=ma,ie(li,e),ie(ql,t),ma=e|t.baseLanes}function pc(){ie(li,ma),ie(ql,ql.current)}function mc(){ma=li.current,W(ql),W(li)}var mn=z(null),Dn=null;function Ra(e){var t=e.alternate;ie(Et,Et.current&1),ie(mn,e),Dn===null&&(t===null||ql.current!==null||t.memoizedState!==null)&&(Dn=e)}function hc(e){ie(Et,Et.current),ie(mn,e),Dn===null&&(Dn=e)}function np(e){e.tag===22?(ie(Et,Et.current),ie(mn,e),Dn===null&&(Dn=e)):Aa()}function Aa(){ie(Et,Et.current),ie(mn,mn.current)}function hn(e){W(mn),Dn===e&&(Dn=null),W(Et)}var Et=z(0);function ri(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||ju(l)||Su(l)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var sa=0,Oe=null,rt=null,Mt=null,si=!1,Yl=!1,fl=!1,ii=0,$r=0,Fl=null,jy=0;function kt(){throw Error(o(321))}function xc(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!fn(e[l],t[l]))return!1;return!0}function vc(e,t,l,s,c,d){return sa=d,Oe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,R.H=e===null||e.memoizedState===null?Hp:Dc,fl=!1,d=l(s,c),fl=!1,Yl&&(d=lp(t,l,s,c)),ap(e),d}function ap(e){R.H=qr;var t=rt!==null&&rt.next!==null;if(sa=0,Mt=rt=Oe=null,si=!1,$r=0,Fl=null,t)throw Error(o(300));e===null||Dt||(e=e.dependencies,e!==null&&Xs(e)&&(Dt=!0))}function lp(e,t,l,s){Oe=e;var c=0;do{if(Yl&&(Fl=null),$r=0,Yl=!1,25<=c)throw Error(o(301));if(c+=1,Mt=rt=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}R.H=Ip,d=t(l,s)}while(Yl);return d}function Sy(){var e=R.H,t=e.useState()[0];return t=typeof t.then=="function"?Gr(t):t,e=e.useState()[0],(rt!==null?rt.memoizedState:null)!==e&&(Oe.flags|=1024),t}function gc(){var e=ii!==0;return ii=0,e}function yc(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function bc(e){if(si){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}si=!1}sa=0,Mt=rt=Oe=null,Yl=!1,$r=ii=0,Fl=null}function Jt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mt===null?Oe.memoizedState=Mt=e:Mt=Mt.next=e,Mt}function Tt(){if(rt===null){var e=Oe.alternate;e=e!==null?e.memoizedState:null}else e=rt.next;var t=Mt===null?Oe.memoizedState:Mt.next;if(t!==null)Mt=t,rt=e;else{if(e===null)throw Oe.alternate===null?Error(o(467)):Error(o(310));rt=e,e={memoizedState:rt.memoizedState,baseState:rt.baseState,baseQueue:rt.baseQueue,queue:rt.queue,next:null},Mt===null?Oe.memoizedState=Mt=e:Mt=Mt.next=e}return Mt}function oi(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Gr(e){var t=$r;return $r+=1,Fl===null&&(Fl=[]),e=Kf(Fl,e,t),t=Oe,(Mt===null?t.memoizedState:Mt.next)===null&&(t=t.alternate,R.H=t===null||t.memoizedState===null?Hp:Dc),e}function ci(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Gr(e);if(e.$$typeof===B)return qt(e)}throw Error(o(438,String(e)))}function jc(e){var t=null,l=Oe.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var s=Oe.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=oi(),Oe.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),s=0;s<e;s++)l[s]=O;return t.index++,l}function ia(e,t){return typeof t=="function"?t(e):t}function ui(e){var t=Tt();return Sc(t,rt,e)}function Sc(e,t,l){var s=e.queue;if(s===null)throw Error(o(311));s.lastRenderedReducer=l;var c=e.baseQueue,d=s.pending;if(d!==null){if(c!==null){var b=c.next;c.next=d.next,d.next=b}t.baseQueue=c=d,s.pending=null}if(d=e.baseState,c===null)e.memoizedState=d;else{t=c.next;var C=b=null,H=null,K=t,ee=!1;do{var re=K.lane&-536870913;if(re!==K.lane?(Ye&re)===re:(sa&re)===re){var Q=K.revertLane;if(Q===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),re===Vl&&(ee=!0);else if((sa&Q)===Q){K=K.next,Q===Vl&&(ee=!0);continue}else re={lane:0,revertLane:K.revertLane,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},H===null?(C=H=re,b=d):H=H.next=re,Oe.lanes|=Q,za|=Q;re=K.action,fl&&l(d,re),d=K.hasEagerState?K.eagerState:l(d,re)}else Q={lane:re,revertLane:K.revertLane,gesture:K.gesture,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},H===null?(C=H=Q,b=d):H=H.next=Q,Oe.lanes|=re,za|=re;K=K.next}while(K!==null&&K!==t);if(H===null?b=d:H.next=C,!fn(d,e.memoizedState)&&(Dt=!0,ee&&(l=$l,l!==null)))throw l;e.memoizedState=d,e.baseState=b,e.baseQueue=H,s.lastRenderedState=d}return c===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function kc(e){var t=Tt(),l=t.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=e;var s=l.dispatch,c=l.pending,d=t.memoizedState;if(c!==null){l.pending=null;var b=c=c.next;do d=e(d,b.action),b=b.next;while(b!==c);fn(d,t.memoizedState)||(Dt=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),l.lastRenderedState=d}return[d,s]}function rp(e,t,l){var s=Oe,c=Tt(),d=Ke;if(d){if(l===void 0)throw Error(o(407));l=l()}else l=t();var b=!fn((rt||c).memoizedState,l);if(b&&(c.memoizedState=l,Dt=!0),c=c.queue,Nc(op.bind(null,s,c,e),[e]),c.getSnapshot!==t||b||Mt!==null&&Mt.memoizedState.tag&1){if(s.flags|=2048,Kl(9,{destroy:void 0},ip.bind(null,s,c,l,t),null),ut===null)throw Error(o(349));d||(sa&127)!==0||sp(s,t,l)}return l}function sp(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=Oe.updateQueue,t===null?(t=oi(),Oe.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function ip(e,t,l,s){t.value=l,t.getSnapshot=s,cp(t)&&up(e)}function op(e,t,l){return l(function(){cp(t)&&up(e)})}function cp(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!fn(e,l)}catch{return!0}}function up(e){var t=al(e,2);t!==null&&dn(t,e,2)}function wc(e){var t=Jt();if(typeof e=="function"){var l=e;if(e=l(),fl){St(!0);try{l()}finally{St(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ia,lastRenderedState:e},t}function dp(e,t,l,s){return e.baseState=l,Sc(e,rt,typeof s=="function"?s:ia)}function ky(e,t,l,s,c){if(pi(e))throw Error(o(485));if(e=t.action,e!==null){var d={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){d.listeners.push(b)}};R.T!==null?l(!0):d.isTransition=!1,s(d),l=t.pending,l===null?(d.next=t.pending=d,fp(t,d)):(d.next=l.next,t.pending=l.next=d)}}function fp(e,t){var l=t.action,s=t.payload,c=e.state;if(t.isTransition){var d=R.T,b={};R.T=b;try{var C=l(c,s),H=R.S;H!==null&&H(b,C),pp(e,t,C)}catch(K){Cc(e,t,K)}finally{d!==null&&b.types!==null&&(d.types=b.types),R.T=d}}else try{d=l(c,s),pp(e,t,d)}catch(K){Cc(e,t,K)}}function pp(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(s){mp(e,t,s)},function(s){return Cc(e,t,s)}):mp(e,t,l)}function mp(e,t,l){t.status="fulfilled",t.value=l,hp(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,fp(e,l)))}function Cc(e,t,l){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=l,hp(t),t=t.next;while(t!==s)}e.action=null}function hp(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function xp(e,t){return t}function vp(e,t){if(Ke){var l=ut.formState;if(l!==null){e:{var s=Oe;if(Ke){if(ft){t:{for(var c=ft,d=Mn;c.nodeType!==8;){if(!d){c=null;break t}if(c=zn(c.nextSibling),c===null){c=null;break t}}d=c.data,c=d==="F!"||d==="F"?c:null}if(c){ft=zn(c.nextSibling),s=c.data==="F!";break e}}wa(s)}s=!1}s&&(t=l[0])}}return l=Jt(),l.memoizedState=l.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:xp,lastRenderedState:t},l.queue=s,l=Op.bind(null,Oe,s),s.dispatch=l,s=wc(!1),d=Mc.bind(null,Oe,!1,s.queue),s=Jt(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,l=ky.bind(null,Oe,c,d,l),c.dispatch=l,s.memoizedState=e,[t,l,!1]}function gp(e){var t=Tt();return yp(t,rt,e)}function yp(e,t,l){if(t=Sc(e,t,xp)[0],e=ui(ia)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=Gr(t)}catch(b){throw b===Gl?ei:b}else s=t;t=Tt();var c=t.queue,d=c.dispatch;return l!==t.memoizedState&&(Oe.flags|=2048,Kl(9,{destroy:void 0},wy.bind(null,c,l),null)),[s,d,e]}function wy(e,t){e.action=t}function bp(e){var t=Tt(),l=rt;if(l!==null)return yp(t,l,e);Tt(),t=t.memoizedState,l=Tt();var s=l.queue.dispatch;return l.memoizedState=e,[t,s,!1]}function Kl(e,t,l,s){return e={tag:e,create:l,deps:s,inst:t,next:null},t=Oe.updateQueue,t===null&&(t=oi(),Oe.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(s=l.next,l.next=e,e.next=s,t.lastEffect=e),e}function jp(){return Tt().memoizedState}function di(e,t,l,s){var c=Jt();Oe.flags|=e,c.memoizedState=Kl(1|t,{destroy:void 0},l,s===void 0?null:s)}function fi(e,t,l,s){var c=Tt();s=s===void 0?null:s;var d=c.memoizedState.inst;rt!==null&&s!==null&&xc(s,rt.memoizedState.deps)?c.memoizedState=Kl(t,d,l,s):(Oe.flags|=e,c.memoizedState=Kl(1|t,d,l,s))}function Sp(e,t){di(8390656,8,e,t)}function Nc(e,t){fi(2048,8,e,t)}function Cy(e){Oe.flags|=4;var t=Oe.updateQueue;if(t===null)t=oi(),Oe.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function kp(e){var t=Tt().memoizedState;return Cy({ref:t,nextImpl:e}),function(){if((Je&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function wp(e,t){return fi(4,2,e,t)}function Cp(e,t){return fi(4,4,e,t)}function Np(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 Ep(e,t,l){l=l!=null?l.concat([e]):null,fi(4,4,Np.bind(null,t,e),l)}function Ec(){}function Tp(e,t){var l=Tt();t=t===void 0?null:t;var s=l.memoizedState;return t!==null&&xc(t,s[1])?s[0]:(l.memoizedState=[e,t],e)}function Rp(e,t){var l=Tt();t=t===void 0?null:t;var s=l.memoizedState;if(t!==null&&xc(t,s[1]))return s[0];if(s=e(),fl){St(!0);try{e()}finally{St(!1)}}return l.memoizedState=[s,t],s}function Tc(e,t,l){return l===void 0||(sa&1073741824)!==0&&(Ye&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=Am(),Oe.lanes|=e,za|=e,l)}function Ap(e,t,l,s){return fn(l,t)?l:ql.current!==null?(e=Tc(e,l,s),fn(e,t)||(Dt=!0),e):(sa&42)===0||(sa&1073741824)!==0&&(Ye&261930)===0?(Dt=!0,e.memoizedState=l):(e=Am(),Oe.lanes|=e,za|=e,t)}function Mp(e,t,l,s,c){var d=U.p;U.p=d!==0&&8>d?d:8;var b=R.T,C={};R.T=C,Mc(e,!1,t,l);try{var H=c(),K=R.S;if(K!==null&&K(C,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var ee=by(H,s);Pr(e,t,ee,gn(e))}else Pr(e,t,s,gn(e))}catch(re){Pr(e,t,{then:function(){},status:"rejected",reason:re},gn())}finally{U.p=d,b!==null&&C.types!==null&&(b.types=C.types),R.T=b}}function Ny(){}function Rc(e,t,l,s){if(e.tag!==5)throw Error(o(476));var c=Dp(e).queue;Mp(e,c,t,se,l===null?Ny:function(){return zp(e),l(s)})}function Dp(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ia,lastRenderedState:se},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ia,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function zp(e){var t=Dp(e);t.next===null&&(t=e.alternate.memoizedState),Pr(e,t.next.queue,{},gn())}function Ac(){return qt(is)}function Lp(){return Tt().memoizedState}function _p(){return Tt().memoizedState}function Ey(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=gn();e=Ea(l);var s=Ta(t,e,l);s!==null&&(dn(s,t,l),Hr(s,t,l)),t={cache:rc()},e.payload=t;return}t=t.return}}function Ty(e,t,l){var s=gn();l={lane:s,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},pi(e)?Bp(t,l):(l=Ko(e,t,l,s),l!==null&&(dn(l,e,s),Up(l,t,s)))}function Op(e,t,l){var s=gn();Pr(e,t,l,s)}function Pr(e,t,l,s){var c={lane:s,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(pi(e))Bp(t,c);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var b=t.lastRenderedState,C=d(b,l);if(c.hasEagerState=!0,c.eagerState=C,fn(C,b))return Fs(e,t,c,0),ut===null&&Ys(),!1}catch{}finally{}if(l=Ko(e,t,c,s),l!==null)return dn(l,e,s),Up(l,t,s),!0}return!1}function Mc(e,t,l,s){if(s={lane:2,revertLane:cu(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},pi(e)){if(t)throw Error(o(479))}else t=Ko(e,l,s,2),t!==null&&dn(t,e,2)}function pi(e){var t=e.alternate;return e===Oe||t!==null&&t===Oe}function Bp(e,t){Yl=si=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function Up(e,t,l){if((l&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,l|=s,t.lanes=l,$d(e,l)}}var qr={readContext:qt,use:ci,useCallback:kt,useContext:kt,useEffect:kt,useImperativeHandle:kt,useLayoutEffect:kt,useInsertionEffect:kt,useMemo:kt,useReducer:kt,useRef:kt,useState:kt,useDebugValue:kt,useDeferredValue:kt,useTransition:kt,useSyncExternalStore:kt,useId:kt,useHostTransitionStatus:kt,useFormState:kt,useActionState:kt,useOptimistic:kt,useMemoCache:kt,useCacheRefresh:kt};qr.useEffectEvent=kt;var Hp={readContext:qt,use:ci,useCallback:function(e,t){return Jt().memoizedState=[e,t===void 0?null:t],e},useContext:qt,useEffect:Sp,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,di(4194308,4,Np.bind(null,t,e),l)},useLayoutEffect:function(e,t){return di(4194308,4,e,t)},useInsertionEffect:function(e,t){di(4,2,e,t)},useMemo:function(e,t){var l=Jt();t=t===void 0?null:t;var s=e();if(fl){St(!0);try{e()}finally{St(!1)}}return l.memoizedState=[s,t],s},useReducer:function(e,t,l){var s=Jt();if(l!==void 0){var c=l(t);if(fl){St(!0);try{l(t)}finally{St(!1)}}}else c=t;return s.memoizedState=s.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},s.queue=e,e=e.dispatch=Ty.bind(null,Oe,e),[s.memoizedState,e]},useRef:function(e){var t=Jt();return e={current:e},t.memoizedState=e},useState:function(e){e=wc(e);var t=e.queue,l=Op.bind(null,Oe,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:Ec,useDeferredValue:function(e,t){var l=Jt();return Tc(l,e,t)},useTransition:function(){var e=wc(!1);return e=Mp.bind(null,Oe,e.queue,!0,!1),Jt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var s=Oe,c=Jt();if(Ke){if(l===void 0)throw Error(o(407));l=l()}else{if(l=t(),ut===null)throw Error(o(349));(Ye&127)!==0||sp(s,t,l)}c.memoizedState=l;var d={value:l,getSnapshot:t};return c.queue=d,Sp(op.bind(null,s,d,e),[e]),s.flags|=2048,Kl(9,{destroy:void 0},ip.bind(null,s,d,l,t),null),l},useId:function(){var e=Jt(),t=ut.identifierPrefix;if(Ke){var l=qn,s=Pn;l=(s&~(1<<32-bt(s)-1)).toString(32)+l,t="_"+t+"R_"+l,l=ii++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=jy++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Ac,useFormState:vp,useActionState:vp,useOptimistic:function(e){var t=Jt();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=Mc.bind(null,Oe,!0,l),l.dispatch=t,[e,t]},useMemoCache:jc,useCacheRefresh:function(){return Jt().memoizedState=Ey.bind(null,Oe)},useEffectEvent:function(e){var t=Jt(),l={impl:e};return t.memoizedState=l,function(){if((Je&2)!==0)throw Error(o(440));return l.impl.apply(void 0,arguments)}}},Dc={readContext:qt,use:ci,useCallback:Tp,useContext:qt,useEffect:Nc,useImperativeHandle:Ep,useInsertionEffect:wp,useLayoutEffect:Cp,useMemo:Rp,useReducer:ui,useRef:jp,useState:function(){return ui(ia)},useDebugValue:Ec,useDeferredValue:function(e,t){var l=Tt();return Ap(l,rt.memoizedState,e,t)},useTransition:function(){var e=ui(ia)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Gr(e),t]},useSyncExternalStore:rp,useId:Lp,useHostTransitionStatus:Ac,useFormState:gp,useActionState:gp,useOptimistic:function(e,t){var l=Tt();return dp(l,rt,e,t)},useMemoCache:jc,useCacheRefresh:_p};Dc.useEffectEvent=kp;var Ip={readContext:qt,use:ci,useCallback:Tp,useContext:qt,useEffect:Nc,useImperativeHandle:Ep,useInsertionEffect:wp,useLayoutEffect:Cp,useMemo:Rp,useReducer:kc,useRef:jp,useState:function(){return kc(ia)},useDebugValue:Ec,useDeferredValue:function(e,t){var l=Tt();return rt===null?Tc(l,e,t):Ap(l,rt.memoizedState,e,t)},useTransition:function(){var e=kc(ia)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Gr(e),t]},useSyncExternalStore:rp,useId:Lp,useHostTransitionStatus:Ac,useFormState:bp,useActionState:bp,useOptimistic:function(e,t){var l=Tt();return rt!==null?dp(l,rt,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:jc,useCacheRefresh:_p};Ip.useEffectEvent=kp;function zc(e,t,l,s){t=e.memoizedState,l=l(s,t),l=l==null?t:g({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var Lc={enqueueSetState:function(e,t,l){e=e._reactInternals;var s=gn(),c=Ea(s);c.payload=t,l!=null&&(c.callback=l),t=Ta(e,c,s),t!==null&&(dn(t,e,s),Hr(t,e,s))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var s=gn(),c=Ea(s);c.tag=1,c.payload=t,l!=null&&(c.callback=l),t=Ta(e,c,s),t!==null&&(dn(t,e,s),Hr(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=gn(),s=Ea(l);s.tag=2,t!=null&&(s.callback=t),t=Ta(e,s,l),t!==null&&(dn(t,e,l),Hr(t,e,l))}};function Vp(e,t,l,s,c,d,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,d,b):t.prototype&&t.prototype.isPureReactComponent?!Mr(l,s)||!Mr(c,d):!0}function $p(e,t,l,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,s),t.state!==e&&Lc.enqueueReplaceState(t,t.state,null)}function pl(e,t){var l=t;if("ref"in t){l={};for(var s in t)s!=="ref"&&(l[s]=t[s])}if(e=e.defaultProps){l===t&&(l=g({},l));for(var c in e)l[c]===void 0&&(l[c]=e[c])}return l}function Gp(e){qs(e)}function Pp(e){console.error(e)}function qp(e){qs(e)}function mi(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Yp(e,t,l){try{var s=e.onCaughtError;s(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function _c(e,t,l){return l=Ea(l),l.tag=3,l.payload={element:null},l.callback=function(){mi(e,t)},l}function Fp(e){return e=Ea(e),e.tag=3,e}function Kp(e,t,l,s){var c=l.type.getDerivedStateFromError;if(typeof c=="function"){var d=s.value;e.payload=function(){return c(d)},e.callback=function(){Yp(t,l,s)}}var b=l.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){Yp(t,l,s),typeof c!="function"&&(La===null?La=new Set([this]):La.add(this));var C=s.stack;this.componentDidCatch(s.value,{componentStack:C!==null?C:""})})}function Ry(e,t,l,s,c){if(l.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=l.alternate,t!==null&&Il(t,l,c,!0),l=mn.current,l!==null){switch(l.tag){case 31:case 13:return Dn===null?Ni():l.alternate===null&&wt===0&&(wt=3),l.flags&=-257,l.flags|=65536,l.lanes=c,s===ti?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([s]):t.add(s),su(e,s,c)),!1;case 22:return l.flags|=65536,s===ti?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([s]):l.add(s)),su(e,s,c)),!1}throw Error(o(435,l.tag))}return su(e,s,c),Ni(),!1}if(Ke)return t=mn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,s!==ec&&(e=Error(o(422),{cause:s}),Lr(Tn(e,l)))):(s!==ec&&(t=Error(o(423),{cause:s}),Lr(Tn(t,l))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,s=Tn(s,l),c=_c(e.stateNode,s,c),dc(e,c),wt!==4&&(wt=2)),!1;var d=Error(o(520),{cause:s});if(d=Tn(d,l),Jr===null?Jr=[d]:Jr.push(d),wt!==4&&(wt=2),t===null)return!0;s=Tn(s,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=c&-c,l.lanes|=e,e=_c(l.stateNode,s,e),dc(l,e),!1;case 1:if(t=l.type,d=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(La===null||!La.has(d))))return l.flags|=65536,c&=-c,l.lanes|=c,c=Fp(c),Kp(c,e,l,s),dc(l,c),!1}l=l.return}while(l!==null);return!1}var Oc=Error(o(461)),Dt=!1;function Yt(e,t,l,s){t.child=e===null?Zf(t,null,l,s):dl(t,e.child,l,s)}function Wp(e,t,l,s,c){l=l.render;var d=t.ref;if("ref"in s){var b={};for(var C in s)C!=="ref"&&(b[C]=s[C])}else b=s;return il(t),s=vc(e,t,l,b,d,c),C=gc(),e!==null&&!Dt?(yc(e,t,c),oa(e,t,c)):(Ke&&C&&Zo(t),t.flags|=1,Yt(e,t,s,c),t.child)}function Qp(e,t,l,s,c){if(e===null){var d=l.type;return typeof d=="function"&&!Wo(d)&&d.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=d,Xp(e,t,d,s,c)):(e=Ws(l.type,null,s,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!Pc(e,c)){var b=d.memoizedProps;if(l=l.compare,l=l!==null?l:Mr,l(b,s)&&e.ref===t.ref)return oa(e,t,c)}return t.flags|=1,e=na(d,s),e.ref=t.ref,e.return=t,t.child=e}function Xp(e,t,l,s,c){if(e!==null){var d=e.memoizedProps;if(Mr(d,s)&&e.ref===t.ref)if(Dt=!1,t.pendingProps=s=d,Pc(e,c))(e.flags&131072)!==0&&(Dt=!0);else return t.lanes=e.lanes,oa(e,t,c)}return Bc(e,t,l,s,c)}function Zp(e,t,l,s){var c=s.children,d=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((t.flags&128)!==0){if(d=d!==null?d.baseLanes|l:l,e!==null){for(s=t.child=e.child,c=0;s!==null;)c=c|s.lanes|s.childLanes,s=s.sibling;s=c&~d}else s=0,t.child=null;return Jp(e,t,d,l,s)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Js(t,d!==null?d.cachePool:null),d!==null?tp(t,d):pc(),np(t);else return s=t.lanes=536870912,Jp(e,t,d!==null?d.baseLanes|l:l,l,s)}else d!==null?(Js(t,d.cachePool),tp(t,d),Aa(),t.memoizedState=null):(e!==null&&Js(t,null),pc(),Aa());return Yt(e,t,c,l),t.child}function Yr(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Jp(e,t,l,s,c){var d=ic();return d=d===null?null:{parent:At._currentValue,pool:d},t.memoizedState={baseLanes:l,cachePool:d},e!==null&&Js(t,null),pc(),np(t),e!==null&&Il(e,t,s,!0),t.childLanes=c,null}function hi(e,t){return t=vi({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function em(e,t,l){return dl(t,e.child,null,l),e=hi(t,t.pendingProps),e.flags|=2,hn(t),t.memoizedState=null,e}function Ay(e,t,l){var s=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ke){if(s.mode==="hidden")return e=hi(t,s),t.lanes=536870912,Yr(null,e);if(hc(t),(e=ft)?(e=fh(e,Mn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Sa!==null?{id:Pn,overflow:qn}:null,retryLane:536870912,hydrationErrors:null},l=Bf(e),l.return=t,t.child=l,Pt=t,ft=null)):e=null,e===null)throw wa(t);return t.lanes=536870912,null}return hi(t,s)}var d=e.memoizedState;if(d!==null){var b=d.dehydrated;if(hc(t),c)if(t.flags&256)t.flags&=-257,t=em(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||Il(e,t,l,!1),c=(l&e.childLanes)!==0,Dt||c){if(s=ut,s!==null&&(b=Gd(s,l),b!==0&&b!==d.retryLane))throw d.retryLane=b,al(e,b),dn(s,e,b),Oc;Ni(),t=em(e,t,l)}else e=d.treeContext,ft=zn(b.nextSibling),Pt=t,Ke=!0,ka=null,Mn=!1,e!==null&&If(t,e),t=hi(t,s),t.flags|=4096;return t}return e=na(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function xi(e,t){var l=t.ref;if(l===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(o(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function Bc(e,t,l,s,c){return il(t),l=vc(e,t,l,s,void 0,c),s=gc(),e!==null&&!Dt?(yc(e,t,c),oa(e,t,c)):(Ke&&s&&Zo(t),t.flags|=1,Yt(e,t,l,c),t.child)}function tm(e,t,l,s,c,d){return il(t),t.updateQueue=null,l=lp(t,s,l,c),ap(e),s=gc(),e!==null&&!Dt?(yc(e,t,d),oa(e,t,d)):(Ke&&s&&Zo(t),t.flags|=1,Yt(e,t,l,d),t.child)}function nm(e,t,l,s,c){if(il(t),t.stateNode===null){var d=Ol,b=l.contextType;typeof b=="object"&&b!==null&&(d=qt(b)),d=new l(s,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=Lc,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=s,d.state=t.memoizedState,d.refs={},cc(t),b=l.contextType,d.context=typeof b=="object"&&b!==null?qt(b):Ol,d.state=t.memoizedState,b=l.getDerivedStateFromProps,typeof b=="function"&&(zc(t,l,b,s),d.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(b=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),b!==d.state&&Lc.enqueueReplaceState(d,d.state,null),Vr(t,s,d,c),Ir(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){d=t.stateNode;var C=t.memoizedProps,H=pl(l,C);d.props=H;var K=d.context,ee=l.contextType;b=Ol,typeof ee=="object"&&ee!==null&&(b=qt(ee));var re=l.getDerivedStateFromProps;ee=typeof re=="function"||typeof d.getSnapshotBeforeUpdate=="function",C=t.pendingProps!==C,ee||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(C||K!==b)&&$p(t,d,s,b),Na=!1;var Q=t.memoizedState;d.state=Q,Vr(t,s,d,c),Ir(),K=t.memoizedState,C||Q!==K||Na?(typeof re=="function"&&(zc(t,l,re,s),K=t.memoizedState),(H=Na||Vp(t,l,H,s,Q,K,b))?(ee||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=K),d.props=s,d.state=K,d.context=b,s=H):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{d=t.stateNode,uc(e,t),b=t.memoizedProps,ee=pl(l,b),d.props=ee,re=t.pendingProps,Q=d.context,K=l.contextType,H=Ol,typeof K=="object"&&K!==null&&(H=qt(K)),C=l.getDerivedStateFromProps,(K=typeof C=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(b!==re||Q!==H)&&$p(t,d,s,H),Na=!1,Q=t.memoizedState,d.state=Q,Vr(t,s,d,c),Ir();var J=t.memoizedState;b!==re||Q!==J||Na||e!==null&&e.dependencies!==null&&Xs(e.dependencies)?(typeof C=="function"&&(zc(t,l,C,s),J=t.memoizedState),(ee=Na||Vp(t,l,ee,s,Q,J,H)||e!==null&&e.dependencies!==null&&Xs(e.dependencies))?(K||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(s,J,H),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(s,J,H)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||b===e.memoizedProps&&Q===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&Q===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=J),d.props=s,d.state=J,d.context=H,s=ee):(typeof d.componentDidUpdate!="function"||b===e.memoizedProps&&Q===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&Q===e.memoizedState||(t.flags|=1024),s=!1)}return d=s,xi(e,t),s=(t.flags&128)!==0,d||s?(d=t.stateNode,l=s&&typeof l.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&s?(t.child=dl(t,e.child,null,c),t.child=dl(t,null,l,c)):Yt(e,t,l,c),t.memoizedState=d.state,e=t.child):e=oa(e,t,c),e}function am(e,t,l,s){return rl(),t.flags|=256,Yt(e,t,l,s),t.child}var Uc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Hc(e){return{baseLanes:e,cachePool:Yf()}}function Ic(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=vn),e}function lm(e,t,l){var s=t.pendingProps,c=!1,d=(t.flags&128)!==0,b;if((b=d)||(b=e!==null&&e.memoizedState===null?!1:(Et.current&2)!==0),b&&(c=!0,t.flags&=-129),b=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ke){if(c?Ra(t):Aa(),(e=ft)?(e=fh(e,Mn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Sa!==null?{id:Pn,overflow:qn}:null,retryLane:536870912,hydrationErrors:null},l=Bf(e),l.return=t,t.child=l,Pt=t,ft=null)):e=null,e===null)throw wa(t);return Su(e)?t.lanes=32:t.lanes=536870912,null}var C=s.children;return s=s.fallback,c?(Aa(),c=t.mode,C=vi({mode:"hidden",children:C},c),s=ll(s,c,l,null),C.return=t,s.return=t,C.sibling=s,t.child=C,s=t.child,s.memoizedState=Hc(l),s.childLanes=Ic(e,b,l),t.memoizedState=Uc,Yr(null,s)):(Ra(t),Vc(t,C))}var H=e.memoizedState;if(H!==null&&(C=H.dehydrated,C!==null)){if(d)t.flags&256?(Ra(t),t.flags&=-257,t=$c(e,t,l)):t.memoizedState!==null?(Aa(),t.child=e.child,t.flags|=128,t=null):(Aa(),C=s.fallback,c=t.mode,s=vi({mode:"visible",children:s.children},c),C=ll(C,c,l,null),C.flags|=2,s.return=t,C.return=t,s.sibling=C,t.child=s,dl(t,e.child,null,l),s=t.child,s.memoizedState=Hc(l),s.childLanes=Ic(e,b,l),t.memoizedState=Uc,t=Yr(null,s));else if(Ra(t),Su(C)){if(b=C.nextSibling&&C.nextSibling.dataset,b)var K=b.dgst;b=K,s=Error(o(419)),s.stack="",s.digest=b,Lr({value:s,source:null,stack:null}),t=$c(e,t,l)}else if(Dt||Il(e,t,l,!1),b=(l&e.childLanes)!==0,Dt||b){if(b=ut,b!==null&&(s=Gd(b,l),s!==0&&s!==H.retryLane))throw H.retryLane=s,al(e,s),dn(b,e,s),Oc;ju(C)||Ni(),t=$c(e,t,l)}else ju(C)?(t.flags|=192,t.child=e.child,t=null):(e=H.treeContext,ft=zn(C.nextSibling),Pt=t,Ke=!0,ka=null,Mn=!1,e!==null&&If(t,e),t=Vc(t,s.children),t.flags|=4096);return t}return c?(Aa(),C=s.fallback,c=t.mode,H=e.child,K=H.sibling,s=na(H,{mode:"hidden",children:s.children}),s.subtreeFlags=H.subtreeFlags&65011712,K!==null?C=na(K,C):(C=ll(C,c,l,null),C.flags|=2),C.return=t,s.return=t,s.sibling=C,t.child=s,Yr(null,s),s=t.child,C=e.child.memoizedState,C===null?C=Hc(l):(c=C.cachePool,c!==null?(H=At._currentValue,c=c.parent!==H?{parent:H,pool:H}:c):c=Yf(),C={baseLanes:C.baseLanes|l,cachePool:c}),s.memoizedState=C,s.childLanes=Ic(e,b,l),t.memoizedState=Uc,Yr(e.child,s)):(Ra(t),l=e.child,e=l.sibling,l=na(l,{mode:"visible",children:s.children}),l.return=t,l.sibling=null,e!==null&&(b=t.deletions,b===null?(t.deletions=[e],t.flags|=16):b.push(e)),t.child=l,t.memoizedState=null,l)}function Vc(e,t){return t=vi({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function vi(e,t){return e=pn(22,e,null,t),e.lanes=0,e}function $c(e,t,l){return dl(t,e.child,null,l),e=Vc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function rm(e,t,l){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),ac(e.return,t,l)}function Gc(e,t,l,s,c,d){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:l,tailMode:c,treeForkCount:d}:(b.isBackwards=t,b.rendering=null,b.renderingStartTime=0,b.last=s,b.tail=l,b.tailMode=c,b.treeForkCount=d)}function sm(e,t,l){var s=t.pendingProps,c=s.revealOrder,d=s.tail;s=s.children;var b=Et.current,C=(b&2)!==0;if(C?(b=b&1|2,t.flags|=128):b&=1,ie(Et,b),Yt(e,t,s,l),s=Ke?zr:0,!C&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&rm(e,l,t);else if(e.tag===19)rm(e,l,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(l=t.child,c=null;l!==null;)e=l.alternate,e!==null&&ri(e)===null&&(c=l),l=l.sibling;l=c,l===null?(c=t.child,t.child=null):(c=l.sibling,l.sibling=null),Gc(t,!1,c,l,d,s);break;case"backwards":case"unstable_legacy-backwards":for(l=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&ri(e)===null){t.child=c;break}e=c.sibling,c.sibling=l,l=c,c=e}Gc(t,!0,l,null,d,s);break;case"together":Gc(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function oa(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),za|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(Il(e,t,l,!1),(l&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,l=na(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=na(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function Pc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Xs(e)))}function My(e,t,l){switch(t.tag){case 3:ae(t,t.stateNode.containerInfo),Ca(t,At,e.memoizedState.cache),rl();break;case 27:case 5:Ie(t);break;case 4:ae(t,t.stateNode.containerInfo);break;case 10:Ca(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,hc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(Ra(t),t.flags|=128,null):(l&t.child.childLanes)!==0?lm(e,t,l):(Ra(t),e=oa(e,t,l),e!==null?e.sibling:null);Ra(t);break;case 19:var c=(e.flags&128)!==0;if(s=(l&t.childLanes)!==0,s||(Il(e,t,l,!1),s=(l&t.childLanes)!==0),c){if(s)return sm(e,t,l);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),ie(Et,Et.current),s)break;return null;case 22:return t.lanes=0,Zp(e,t,l,t.pendingProps);case 24:Ca(t,At,e.memoizedState.cache)}return oa(e,t,l)}function im(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)Dt=!0;else{if(!Pc(e,l)&&(t.flags&128)===0)return Dt=!1,My(e,t,l);Dt=(e.flags&131072)!==0}else Dt=!1,Ke&&(t.flags&1048576)!==0&&Hf(t,zr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=cl(t.elementType),t.type=e,typeof e=="function")Wo(e)?(s=pl(e,s),t.tag=1,t=nm(null,t,e,s,l)):(t.tag=0,t=Bc(null,t,e,s,l));else{if(e!=null){var c=e.$$typeof;if(c===I){t.tag=11,t=Wp(null,t,e,s,l);break e}else if(c===w){t.tag=14,t=Qp(null,t,e,s,l);break e}}throw t=X(e)||e,Error(o(306,t,""))}}return t;case 0:return Bc(e,t,t.type,t.pendingProps,l);case 1:return s=t.type,c=pl(s,t.pendingProps),nm(e,t,s,c,l);case 3:e:{if(ae(t,t.stateNode.containerInfo),e===null)throw Error(o(387));s=t.pendingProps;var d=t.memoizedState;c=d.element,uc(e,t),Vr(t,s,null,l);var b=t.memoizedState;if(s=b.cache,Ca(t,At,s),s!==d.cache&&lc(t,[At],l,!0),Ir(),s=b.element,d.isDehydrated)if(d={element:s,isDehydrated:!1,cache:b.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=am(e,t,s,l);break e}else if(s!==c){c=Tn(Error(o(424)),t),Lr(c),t=am(e,t,s,l);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(ft=zn(e.firstChild),Pt=t,Ke=!0,ka=null,Mn=!0,l=Zf(t,null,s,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(rl(),s===c){t=oa(e,t,l);break e}Yt(e,t,s,l)}t=t.child}return t;case 26:return xi(e,t),e===null?(l=gh(t.type,null,t.pendingProps,null))?t.memoizedState=l:Ke||(l=t.type,e=t.pendingProps,s=zi(xe.current).createElement(l),s[Gt]=t,s[ln]=e,Ft(s,l,e),Ht(s),t.stateNode=s):t.memoizedState=gh(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ie(t),e===null&&Ke&&(s=t.stateNode=hh(t.type,t.pendingProps,xe.current),Pt=t,Mn=!0,c=ft,Ua(t.type)?(ku=c,ft=zn(s.firstChild)):ft=c),Yt(e,t,t.pendingProps.children,l),xi(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ke&&((c=s=ft)&&(s=i1(s,t.type,t.pendingProps,Mn),s!==null?(t.stateNode=s,Pt=t,ft=zn(s.firstChild),Mn=!1,c=!0):c=!1),c||wa(t)),Ie(t),c=t.type,d=t.pendingProps,b=e!==null?e.memoizedProps:null,s=d.children,gu(c,d)?s=null:b!==null&&gu(c,b)&&(t.flags|=32),t.memoizedState!==null&&(c=vc(e,t,Sy,null,null,l),is._currentValue=c),xi(e,t),Yt(e,t,s,l),t.child;case 6:return e===null&&Ke&&((e=l=ft)&&(l=o1(l,t.pendingProps,Mn),l!==null?(t.stateNode=l,Pt=t,ft=null,e=!0):e=!1),e||wa(t)),null;case 13:return lm(e,t,l);case 4:return ae(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=dl(t,null,s,l):Yt(e,t,s,l),t.child;case 11:return Wp(e,t,t.type,t.pendingProps,l);case 7:return Yt(e,t,t.pendingProps,l),t.child;case 8:return Yt(e,t,t.pendingProps.children,l),t.child;case 12:return Yt(e,t,t.pendingProps.children,l),t.child;case 10:return s=t.pendingProps,Ca(t,t.type,s.value),Yt(e,t,s.children,l),t.child;case 9:return c=t.type._context,s=t.pendingProps.children,il(t),c=qt(c),s=s(c),t.flags|=1,Yt(e,t,s,l),t.child;case 14:return Qp(e,t,t.type,t.pendingProps,l);case 15:return Xp(e,t,t.type,t.pendingProps,l);case 19:return sm(e,t,l);case 31:return Ay(e,t,l);case 22:return Zp(e,t,l,t.pendingProps);case 24:return il(t),s=qt(At),e===null?(c=ic(),c===null&&(c=ut,d=rc(),c.pooledCache=d,d.refCount++,d!==null&&(c.pooledCacheLanes|=l),c=d),t.memoizedState={parent:s,cache:c},cc(t),Ca(t,At,c)):((e.lanes&l)!==0&&(uc(e,t),Vr(t,null,null,l),Ir()),c=e.memoizedState,d=t.memoizedState,c.parent!==s?(c={parent:s,cache:s},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),Ca(t,At,s)):(s=d.cache,Ca(t,At,s),s!==c.cache&&lc(t,[At],l,!0))),Yt(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function ca(e){e.flags|=4}function qc(e,t,l,s,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(Lm())e.flags|=8192;else throw ul=ti,oc}else e.flags&=-16777217}function om(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!kh(t))if(Lm())e.flags|=8192;else throw ul=ti,oc}function gi(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Id():536870912,e.lanes|=t,Zl|=t)}function Fr(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 s=null;l!==null;)l.alternate!==null&&(s=l),l=l.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function pt(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,s=0;if(t)for(var c=e.child;c!==null;)l|=c.lanes|c.childLanes,s|=c.subtreeFlags&65011712,s|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)l|=c.lanes|c.childLanes,s|=c.subtreeFlags,s|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=s,e.childLanes=l,t}function Dy(e,t,l){var s=t.pendingProps;switch(Jo(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return pt(t),null;case 1:return pt(t),null;case 3:return l=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),ra(At),ve(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Hl(t)?ca(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,tc())),pt(t),null;case 26:var c=t.type,d=t.memoizedState;return e===null?(ca(t),d!==null?(pt(t),om(t,d)):(pt(t),qc(t,c,null,s,l))):d?d!==e.memoizedState?(ca(t),pt(t),om(t,d)):(pt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&ca(t),pt(t),qc(t,c,e,s,l)),null;case 27:if(Be(t),l=xe.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&ca(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return pt(t),null}e=de.current,Hl(t)?Vf(t):(e=hh(c,s,l),t.stateNode=e,ca(t))}return pt(t),null;case 5:if(Be(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&ca(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return pt(t),null}if(d=de.current,Hl(t))Vf(t);else{var b=zi(xe.current);switch(d){case 1:d=b.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:d=b.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":d=b.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":d=b.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":d=b.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof s.is=="string"?b.createElement("select",{is:s.is}):b.createElement("select"),s.multiple?d.multiple=!0:s.size&&(d.size=s.size);break;default:d=typeof s.is=="string"?b.createElement(c,{is:s.is}):b.createElement(c)}}d[Gt]=t,d[ln]=s;e:for(b=t.child;b!==null;){if(b.tag===5||b.tag===6)d.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===t)break e;for(;b.sibling===null;){if(b.return===null||b.return===t)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}t.stateNode=d;e:switch(Ft(d,c,s),c){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&ca(t)}}return pt(t),qc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&ca(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(o(166));if(e=xe.current,Hl(t)){if(e=t.stateNode,l=t.memoizedProps,s=null,c=Pt,c!==null)switch(c.tag){case 27:case 5:s=c.memoizedProps}e[Gt]=t,e=!!(e.nodeValue===l||s!==null&&s.suppressHydrationWarning===!0||lh(e.nodeValue,l)),e||wa(t,!0)}else e=zi(e).createTextNode(s),e[Gt]=t,t.stateNode=e}return pt(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(s=Hl(t),l!==null){if(e===null){if(!s)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[Gt]=t}else rl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pt(t),e=!1}else l=tc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(hn(t),t):(hn(t),null);if((t.flags&128)!==0)throw Error(o(558))}return pt(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Hl(t),s!==null&&s.dehydrated!==null){if(e===null){if(!c)throw Error(o(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(o(317));c[Gt]=t}else rl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pt(t),c=!1}else c=tc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(hn(t),t):(hn(t),null)}return hn(t),(t.flags&128)!==0?(t.lanes=l,t):(l=s!==null,e=e!==null&&e.memoizedState!==null,l&&(s=t.child,c=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(c=s.alternate.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==c&&(s.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),gi(t,t.updateQueue),pt(t),null);case 4:return ve(),e===null&&pu(t.stateNode.containerInfo),pt(t),null;case 10:return ra(t.type),pt(t),null;case 19:if(W(Et),s=t.memoizedState,s===null)return pt(t),null;if(c=(t.flags&128)!==0,d=s.rendering,d===null)if(c)Fr(s,!1);else{if(wt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=ri(e),d!==null){for(t.flags|=128,Fr(s,!1),e=d.updateQueue,t.updateQueue=e,gi(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)Of(l,e),l=l.sibling;return ie(Et,Et.current&1|2),Ke&&aa(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&tt()>ki&&(t.flags|=128,c=!0,Fr(s,!1),t.lanes=4194304)}else{if(!c)if(e=ri(d),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,gi(t,e),Fr(s,!0),s.tail===null&&s.tailMode==="hidden"&&!d.alternate&&!Ke)return pt(t),null}else 2*tt()-s.renderingStartTime>ki&&l!==536870912&&(t.flags|=128,c=!0,Fr(s,!1),t.lanes=4194304);s.isBackwards?(d.sibling=t.child,t.child=d):(e=s.last,e!==null?e.sibling=d:t.child=d,s.last=d)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=tt(),e.sibling=null,l=Et.current,ie(Et,c?l&1|2:l&1),Ke&&aa(t,s.treeForkCount),e):(pt(t),null);case 22:case 23:return hn(t),mc(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(l&536870912)!==0&&(t.flags&128)===0&&(pt(t),t.subtreeFlags&6&&(t.flags|=8192)):pt(t),l=t.updateQueue,l!==null&&gi(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==l&&(t.flags|=2048),e!==null&&W(ol),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),ra(At),pt(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function zy(e,t){switch(Jo(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ra(At),ve(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Be(t),null;case 31:if(t.memoizedState!==null){if(hn(t),t.alternate===null)throw Error(o(340));rl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(hn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));rl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return W(Et),null;case 4:return ve(),null;case 10:return ra(t.type),null;case 22:case 23:return hn(t),mc(),e!==null&&W(ol),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ra(At),null;case 25:return null;default:return null}}function cm(e,t){switch(Jo(t),t.tag){case 3:ra(At),ve();break;case 26:case 27:case 5:Be(t);break;case 4:ve();break;case 31:t.memoizedState!==null&&hn(t);break;case 13:hn(t);break;case 19:W(Et);break;case 10:ra(t.type);break;case 22:case 23:hn(t),mc(),e!==null&&W(ol);break;case 24:ra(At)}}function Kr(e,t){try{var l=t.updateQueue,s=l!==null?l.lastEffect:null;if(s!==null){var c=s.next;l=c;do{if((l.tag&e)===e){s=void 0;var d=l.create,b=l.inst;s=d(),b.destroy=s}l=l.next}while(l!==c)}}catch(C){lt(t,t.return,C)}}function Ma(e,t,l){try{var s=t.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var d=c.next;s=d;do{if((s.tag&e)===e){var b=s.inst,C=b.destroy;if(C!==void 0){b.destroy=void 0,c=t;var H=l,K=C;try{K()}catch(ee){lt(c,H,ee)}}}s=s.next}while(s!==d)}}catch(ee){lt(t,t.return,ee)}}function um(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{ep(t,l)}catch(s){lt(e,e.return,s)}}}function dm(e,t,l){l.props=pl(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(s){lt(e,t,s)}}function Wr(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof l=="function"?e.refCleanup=l(s):l.current=s}}catch(c){lt(e,t,c)}}function Yn(e,t){var l=e.ref,s=e.refCleanup;if(l!==null)if(typeof s=="function")try{s()}catch(c){lt(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(c){lt(e,t,c)}else l.current=null}function fm(e){var t=e.type,l=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&s.focus();break e;case"img":l.src?s.src=l.src:l.srcSet&&(s.srcset=l.srcSet)}}catch(c){lt(e,e.return,c)}}function Yc(e,t,l){try{var s=e.stateNode;t1(s,e.type,l,t),s[ln]=t}catch(c){lt(e,e.return,c)}}function pm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ua(e.type)||e.tag===4}function Fc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||pm(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&&Ua(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 Kc(e,t,l){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,t):(t=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,t.appendChild(e),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=ea));else if(s!==4&&(s===27&&Ua(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(Kc(e,t,l),e=e.sibling;e!==null;)Kc(e,t,l),e=e.sibling}function yi(e,t,l){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(s!==4&&(s===27&&Ua(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(yi(e,t,l),e=e.sibling;e!==null;)yi(e,t,l),e=e.sibling}function mm(e){var t=e.stateNode,l=e.memoizedProps;try{for(var s=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);Ft(t,s,l),t[Gt]=e,t[ln]=l}catch(d){lt(e,e.return,d)}}var ua=!1,zt=!1,Wc=!1,hm=typeof WeakSet=="function"?WeakSet:Set,It=null;function Ly(e,t){if(e=e.containerInfo,xu=Ii,e=Ef(e),$o(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var s=l.getSelection&&l.getSelection();if(s&&s.rangeCount!==0){l=s.anchorNode;var c=s.anchorOffset,d=s.focusNode;s=s.focusOffset;try{l.nodeType,d.nodeType}catch{l=null;break e}var b=0,C=-1,H=-1,K=0,ee=0,re=e,Q=null;t:for(;;){for(var J;re!==l||c!==0&&re.nodeType!==3||(C=b+c),re!==d||s!==0&&re.nodeType!==3||(H=b+s),re.nodeType===3&&(b+=re.nodeValue.length),(J=re.firstChild)!==null;)Q=re,re=J;for(;;){if(re===e)break t;if(Q===l&&++K===c&&(C=b),Q===d&&++ee===s&&(H=b),(J=re.nextSibling)!==null)break;re=Q,Q=re.parentNode}re=J}l=C===-1||H===-1?null:{start:C,end:H}}else l=null}l=l||{start:0,end:0}}else l=null;for(vu={focusedElem:e,selectionRange:l},Ii=!1,It=t;It!==null;)if(t=It,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,It=e;else for(;It!==null;){switch(t=It,d=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(l=0;l<e.length;l++)c=e[l],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&d!==null){e=void 0,l=t,c=d.memoizedProps,d=d.memoizedState,s=l.stateNode;try{var Se=pl(l.type,c);e=s.getSnapshotBeforeUpdate(Se,d),s.__reactInternalSnapshotBeforeUpdate=e}catch(Te){lt(l,l.return,Te)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)bu(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":bu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,It=e;break}It=t.return}}function xm(e,t,l){var s=l.flags;switch(l.tag){case 0:case 11:case 15:fa(e,l),s&4&&Kr(5,l);break;case 1:if(fa(e,l),s&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(b){lt(l,l.return,b)}else{var c=pl(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(b){lt(l,l.return,b)}}s&64&&um(l),s&512&&Wr(l,l.return);break;case 3:if(fa(e,l),s&64&&(e=l.updateQueue,e!==null)){if(t=null,l.child!==null)switch(l.child.tag){case 27:case 5:t=l.child.stateNode;break;case 1:t=l.child.stateNode}try{ep(e,t)}catch(b){lt(l,l.return,b)}}break;case 27:t===null&&s&4&&mm(l);case 26:case 5:fa(e,l),t===null&&s&4&&fm(l),s&512&&Wr(l,l.return);break;case 12:fa(e,l);break;case 31:fa(e,l),s&4&&ym(e,l);break;case 13:fa(e,l),s&4&&bm(e,l),s&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=Gy.bind(null,l),c1(e,l))));break;case 22:if(s=l.memoizedState!==null||ua,!s){t=t!==null&&t.memoizedState!==null||zt,c=ua;var d=zt;ua=s,(zt=t)&&!d?pa(e,l,(l.subtreeFlags&8772)!==0):fa(e,l),ua=c,zt=d}break;case 30:break;default:fa(e,l)}}function vm(e){var t=e.alternate;t!==null&&(e.alternate=null,vm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Co(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var vt=null,sn=!1;function da(e,t,l){for(l=l.child;l!==null;)gm(e,t,l),l=l.sibling}function gm(e,t,l){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(Xn,l)}catch{}switch(l.tag){case 26:zt||Yn(l,t),da(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:zt||Yn(l,t);var s=vt,c=sn;Ua(l.type)&&(vt=l.stateNode,sn=!1),da(e,t,l),ls(l.stateNode),vt=s,sn=c;break;case 5:zt||Yn(l,t);case 6:if(s=vt,c=sn,vt=null,da(e,t,l),vt=s,sn=c,vt!==null)if(sn)try{(vt.nodeType===9?vt.body:vt.nodeName==="HTML"?vt.ownerDocument.body:vt).removeChild(l.stateNode)}catch(d){lt(l,t,d)}else try{vt.removeChild(l.stateNode)}catch(d){lt(l,t,d)}break;case 18:vt!==null&&(sn?(e=vt,uh(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),sr(e)):uh(vt,l.stateNode));break;case 4:s=vt,c=sn,vt=l.stateNode.containerInfo,sn=!0,da(e,t,l),vt=s,sn=c;break;case 0:case 11:case 14:case 15:Ma(2,l,t),zt||Ma(4,l,t),da(e,t,l);break;case 1:zt||(Yn(l,t),s=l.stateNode,typeof s.componentWillUnmount=="function"&&dm(l,t,s)),da(e,t,l);break;case 21:da(e,t,l);break;case 22:zt=(s=zt)||l.memoizedState!==null,da(e,t,l),zt=s;break;default:da(e,t,l)}}function ym(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{sr(e)}catch(l){lt(t,t.return,l)}}}function bm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{sr(e)}catch(l){lt(t,t.return,l)}}function _y(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new hm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new hm),t;default:throw Error(o(435,e.tag))}}function bi(e,t){var l=_y(e);t.forEach(function(s){if(!l.has(s)){l.add(s);var c=Py.bind(null,e,s);s.then(c,c)}})}function on(e,t){var l=t.deletions;if(l!==null)for(var s=0;s<l.length;s++){var c=l[s],d=e,b=t,C=b;e:for(;C!==null;){switch(C.tag){case 27:if(Ua(C.type)){vt=C.stateNode,sn=!1;break e}break;case 5:vt=C.stateNode,sn=!1;break e;case 3:case 4:vt=C.stateNode.containerInfo,sn=!0;break e}C=C.return}if(vt===null)throw Error(o(160));gm(d,b,c),vt=null,sn=!1,d=c.alternate,d!==null&&(d.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)jm(t,e),t=t.sibling}var In=null;function jm(e,t){var l=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:on(t,e),cn(e),s&4&&(Ma(3,e,e.return),Kr(3,e),Ma(5,e,e.return));break;case 1:on(t,e),cn(e),s&512&&(zt||l===null||Yn(l,l.return)),s&64&&ua&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?s:l.concat(s))));break;case 26:var c=In;if(on(t,e),cn(e),s&512&&(zt||l===null||Yn(l,l.return)),s&4){var d=l!==null?l.memoizedState:null;if(s=e.memoizedState,l===null)if(s===null)if(e.stateNode===null){e:{s=e.type,l=e.memoizedProps,c=c.ownerDocument||c;t:switch(s){case"title":d=c.getElementsByTagName("title")[0],(!d||d[Sr]||d[Gt]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=c.createElement(s),c.head.insertBefore(d,c.querySelector("head > title"))),Ft(d,s,l),d[Gt]=e,Ht(d),s=d;break e;case"link":var b=jh("link","href",c).get(s+(l.href||""));if(b){for(var C=0;C<b.length;C++)if(d=b[C],d.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&d.getAttribute("rel")===(l.rel==null?null:l.rel)&&d.getAttribute("title")===(l.title==null?null:l.title)&&d.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){b.splice(C,1);break t}}d=c.createElement(s),Ft(d,s,l),c.head.appendChild(d);break;case"meta":if(b=jh("meta","content",c).get(s+(l.content||""))){for(C=0;C<b.length;C++)if(d=b[C],d.getAttribute("content")===(l.content==null?null:""+l.content)&&d.getAttribute("name")===(l.name==null?null:l.name)&&d.getAttribute("property")===(l.property==null?null:l.property)&&d.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&d.getAttribute("charset")===(l.charSet==null?null:l.charSet)){b.splice(C,1);break t}}d=c.createElement(s),Ft(d,s,l),c.head.appendChild(d);break;default:throw Error(o(468,s))}d[Gt]=e,Ht(d),s=d}e.stateNode=s}else Sh(c,e.type,e.stateNode);else e.stateNode=bh(c,s,e.memoizedProps);else d!==s?(d===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):d.count--,s===null?Sh(c,e.type,e.stateNode):bh(c,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Yc(e,e.memoizedProps,l.memoizedProps)}break;case 27:on(t,e),cn(e),s&512&&(zt||l===null||Yn(l,l.return)),l!==null&&s&4&&Yc(e,e.memoizedProps,l.memoizedProps);break;case 5:if(on(t,e),cn(e),s&512&&(zt||l===null||Yn(l,l.return)),e.flags&32){c=e.stateNode;try{Rl(c,"")}catch(Se){lt(e,e.return,Se)}}s&4&&e.stateNode!=null&&(c=e.memoizedProps,Yc(e,c,l!==null?l.memoizedProps:c)),s&1024&&(Wc=!0);break;case 6:if(on(t,e),cn(e),s&4){if(e.stateNode===null)throw Error(o(162));s=e.memoizedProps,l=e.stateNode;try{l.nodeValue=s}catch(Se){lt(e,e.return,Se)}}break;case 3:if(Oi=null,c=In,In=Li(t.containerInfo),on(t,e),In=c,cn(e),s&4&&l!==null&&l.memoizedState.isDehydrated)try{sr(t.containerInfo)}catch(Se){lt(e,e.return,Se)}Wc&&(Wc=!1,Sm(e));break;case 4:s=In,In=Li(e.stateNode.containerInfo),on(t,e),cn(e),In=s;break;case 12:on(t,e),cn(e);break;case 31:on(t,e),cn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,bi(e,s)));break;case 13:on(t,e),cn(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Si=tt()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,bi(e,s)));break;case 22:c=e.memoizedState!==null;var H=l!==null&&l.memoizedState!==null,K=ua,ee=zt;if(ua=K||c,zt=ee||H,on(t,e),zt=ee,ua=K,cn(e),s&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(l===null||H||ua||zt||ml(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){H=l=t;try{if(d=H.stateNode,c)b=d.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{C=H.stateNode;var re=H.memoizedProps.style,Q=re!=null&&re.hasOwnProperty("display")?re.display:null;C.style.display=Q==null||typeof Q=="boolean"?"":(""+Q).trim()}}catch(Se){lt(H,H.return,Se)}}}else if(t.tag===6){if(l===null){H=t;try{H.stateNode.nodeValue=c?"":H.memoizedProps}catch(Se){lt(H,H.return,Se)}}}else if(t.tag===18){if(l===null){H=t;try{var J=H.stateNode;c?dh(J,!0):dh(H.stateNode,!1)}catch(Se){lt(H,H.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}s&4&&(s=e.updateQueue,s!==null&&(l=s.retryQueue,l!==null&&(s.retryQueue=null,bi(e,l))));break;case 19:on(t,e),cn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,bi(e,s)));break;case 30:break;case 21:break;default:on(t,e),cn(e)}}function cn(e){var t=e.flags;if(t&2){try{for(var l,s=e.return;s!==null;){if(pm(s)){l=s;break}s=s.return}if(l==null)throw Error(o(160));switch(l.tag){case 27:var c=l.stateNode,d=Fc(e);yi(e,d,c);break;case 5:var b=l.stateNode;l.flags&32&&(Rl(b,""),l.flags&=-33);var C=Fc(e);yi(e,C,b);break;case 3:case 4:var H=l.stateNode.containerInfo,K=Fc(e);Kc(e,K,H);break;default:throw Error(o(161))}}catch(ee){lt(e,e.return,ee)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Sm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Sm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function fa(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)xm(e,t.alternate,t),t=t.sibling}function ml(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ma(4,t,t.return),ml(t);break;case 1:Yn(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&dm(t,t.return,l),ml(t);break;case 27:ls(t.stateNode);case 26:case 5:Yn(t,t.return),ml(t);break;case 22:t.memoizedState===null&&ml(t);break;case 30:ml(t);break;default:ml(t)}e=e.sibling}}function pa(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,c=e,d=t,b=d.flags;switch(d.tag){case 0:case 11:case 15:pa(c,d,l),Kr(4,d);break;case 1:if(pa(c,d,l),s=d,c=s.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(K){lt(s,s.return,K)}if(s=d,c=s.updateQueue,c!==null){var C=s.stateNode;try{var H=c.shared.hiddenCallbacks;if(H!==null)for(c.shared.hiddenCallbacks=null,c=0;c<H.length;c++)Jf(H[c],C)}catch(K){lt(s,s.return,K)}}l&&b&64&&um(d),Wr(d,d.return);break;case 27:mm(d);case 26:case 5:pa(c,d,l),l&&s===null&&b&4&&fm(d),Wr(d,d.return);break;case 12:pa(c,d,l);break;case 31:pa(c,d,l),l&&b&4&&ym(c,d);break;case 13:pa(c,d,l),l&&b&4&&bm(c,d);break;case 22:d.memoizedState===null&&pa(c,d,l),Wr(d,d.return);break;case 30:break;default:pa(c,d,l)}t=t.sibling}}function Qc(e,t){var l=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==l&&(e!=null&&e.refCount++,l!=null&&_r(l))}function Xc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&_r(e))}function Vn(e,t,l,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)km(e,t,l,s),t=t.sibling}function km(e,t,l,s){var c=t.flags;switch(t.tag){case 0:case 11:case 15:Vn(e,t,l,s),c&2048&&Kr(9,t);break;case 1:Vn(e,t,l,s);break;case 3:Vn(e,t,l,s),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&_r(e)));break;case 12:if(c&2048){Vn(e,t,l,s),e=t.stateNode;try{var d=t.memoizedProps,b=d.id,C=d.onPostCommit;typeof C=="function"&&C(b,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(H){lt(t,t.return,H)}}else Vn(e,t,l,s);break;case 31:Vn(e,t,l,s);break;case 13:Vn(e,t,l,s);break;case 23:break;case 22:d=t.stateNode,b=t.alternate,t.memoizedState!==null?d._visibility&2?Vn(e,t,l,s):Qr(e,t):d._visibility&2?Vn(e,t,l,s):(d._visibility|=2,Wl(e,t,l,s,(t.subtreeFlags&10256)!==0||!1)),c&2048&&Qc(b,t);break;case 24:Vn(e,t,l,s),c&2048&&Xc(t.alternate,t);break;default:Vn(e,t,l,s)}}function Wl(e,t,l,s,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,b=t,C=l,H=s,K=b.flags;switch(b.tag){case 0:case 11:case 15:Wl(d,b,C,H,c),Kr(8,b);break;case 23:break;case 22:var ee=b.stateNode;b.memoizedState!==null?ee._visibility&2?Wl(d,b,C,H,c):Qr(d,b):(ee._visibility|=2,Wl(d,b,C,H,c)),c&&K&2048&&Qc(b.alternate,b);break;case 24:Wl(d,b,C,H,c),c&&K&2048&&Xc(b.alternate,b);break;default:Wl(d,b,C,H,c)}t=t.sibling}}function Qr(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,s=t,c=s.flags;switch(s.tag){case 22:Qr(l,s),c&2048&&Qc(s.alternate,s);break;case 24:Qr(l,s),c&2048&&Xc(s.alternate,s);break;default:Qr(l,s)}t=t.sibling}}var Xr=8192;function Ql(e,t,l){if(e.subtreeFlags&Xr)for(e=e.child;e!==null;)wm(e,t,l),e=e.sibling}function wm(e,t,l){switch(e.tag){case 26:Ql(e,t,l),e.flags&Xr&&e.memoizedState!==null&&j1(l,In,e.memoizedState,e.memoizedProps);break;case 5:Ql(e,t,l);break;case 3:case 4:var s=In;In=Li(e.stateNode.containerInfo),Ql(e,t,l),In=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Xr,Xr=16777216,Ql(e,t,l),Xr=s):Ql(e,t,l));break;default:Ql(e,t,l)}}function Cm(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Zr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var s=t[l];It=s,Em(s,e)}Cm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Nm(e),e=e.sibling}function Nm(e){switch(e.tag){case 0:case 11:case 15:Zr(e),e.flags&2048&&Ma(9,e,e.return);break;case 3:Zr(e);break;case 12:Zr(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,ji(e)):Zr(e);break;default:Zr(e)}}function ji(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var s=t[l];It=s,Em(s,e)}Cm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ma(8,t,t.return),ji(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,ji(t));break;default:ji(t)}e=e.sibling}}function Em(e,t){for(;It!==null;){var l=It;switch(l.tag){case 0:case 11:case 15:Ma(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var s=l.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:_r(l.memoizedState.cache)}if(s=l.child,s!==null)s.return=l,It=s;else e:for(l=e;It!==null;){s=It;var c=s.sibling,d=s.return;if(vm(s),s===l){It=null;break e}if(c!==null){c.return=d,It=c;break e}It=d}}}var Oy={getCacheForType:function(e){var t=qt(At),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return qt(At).controller.signal}},By=typeof WeakMap=="function"?WeakMap:Map,Je=0,ut=null,Pe=null,Ye=0,at=0,xn=null,Da=!1,Xl=!1,Zc=!1,ma=0,wt=0,za=0,hl=0,Jc=0,vn=0,Zl=0,Jr=null,un=null,eu=!1,Si=0,Tm=0,ki=1/0,wi=null,La=null,_t=0,_a=null,Jl=null,ha=0,tu=0,nu=null,Rm=null,es=0,au=null;function gn(){return(Je&2)!==0&&Ye!==0?Ye&-Ye:R.T!==null?cu():Pd()}function Am(){if(vn===0)if((Ye&536870912)===0||Ke){var e=Ut;Ut<<=1,(Ut&3932160)===0&&(Ut=262144),vn=e}else vn=536870912;return e=mn.current,e!==null&&(e.flags|=32),vn}function dn(e,t,l){(e===ut&&(at===2||at===9)||e.cancelPendingCommit!==null)&&(er(e,0),Oa(e,Ye,vn,!1)),jr(e,l),((Je&2)===0||e!==ut)&&(e===ut&&((Je&2)===0&&(hl|=l),wt===4&&Oa(e,Ye,vn,!1)),Fn(e))}function Mm(e,t,l){if((Je&6)!==0)throw Error(o(327));var s=!l&&(t&127)===0&&(t&e.expiredLanes)===0||wn(e,t),c=s?Iy(e,t):ru(e,t,!0),d=s;do{if(c===0){Xl&&!s&&Oa(e,t,0,!1);break}else{if(l=e.current.alternate,d&&!Uy(l)){c=ru(e,t,!1),d=!1;continue}if(c===2){if(d=t,e.errorRecoveryDisabledLanes&d)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){t=b;e:{var C=e;c=Jr;var H=C.current.memoizedState.isDehydrated;if(H&&(er(C,b).flags|=256),b=ru(C,b,!1),b!==2){if(Zc&&!H){C.errorRecoveryDisabledLanes|=d,hl|=d,c=4;break e}d=un,un=c,d!==null&&(un===null?un=d:un.push.apply(un,d))}c=b}if(d=!1,c!==2)continue}}if(c===1){er(e,0),Oa(e,t,0,!0);break}e:{switch(s=e,d=c,d){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:Oa(s,t,vn,!Da);break e;case 2:un=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(c=Si+300-tt(),10<c)){if(Oa(s,t,vn,!Da),br(s,0,!0)!==0)break e;ha=t,s.timeoutHandle=oh(Dm.bind(null,s,l,un,wi,eu,t,vn,hl,Zl,Da,d,"Throttled",-0,0),c);break e}Dm(s,l,un,wi,eu,t,vn,hl,Zl,Da,d,null,-0,0)}}break}while(!0);Fn(e)}function Dm(e,t,l,s,c,d,b,C,H,K,ee,re,Q,J){if(e.timeoutHandle=-1,re=t.subtreeFlags,re&8192||(re&16785408)===16785408){re={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ea},wm(t,d,re);var Se=(d&62914560)===d?Si-tt():(d&4194048)===d?Tm-tt():0;if(Se=S1(re,Se),Se!==null){ha=d,e.cancelPendingCommit=Se(Im.bind(null,e,t,d,l,s,c,b,C,H,ee,re,null,Q,J)),Oa(e,d,b,!K);return}}Im(e,t,d,l,s,c,b,C,H)}function Uy(e){for(var t=e;;){var l=t.tag;if((l===0||l===11||l===15)&&t.flags&16384&&(l=t.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var s=0;s<l.length;s++){var c=l[s],d=c.getSnapshot;c=c.value;try{if(!fn(d(),c))return!1}catch{return!1}}if(l=t.child,t.subtreeFlags&16384&&l!==null)l.return=t,t=l;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Oa(e,t,l,s){t&=~Jc,t&=~hl,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var c=t;0<c;){var d=31-bt(c),b=1<<d;s[d]=-1,c&=~b}l!==0&&Vd(e,l,t)}function Ci(){return(Je&6)===0?(ts(0),!1):!0}function lu(){if(Pe!==null){if(at===0)var e=Pe.return;else e=Pe,la=sl=null,bc(e),Pl=null,Br=0,e=Pe;for(;e!==null;)cm(e.alternate,e),e=e.return;Pe=null}}function er(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,l1(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),ha=0,lu(),ut=e,Pe=l=na(e.current,null),Ye=t,at=0,xn=null,Da=!1,Xl=wn(e,t),Zc=!1,Zl=vn=Jc=hl=za=wt=0,un=Jr=null,eu=!1,(t&8)!==0&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var c=31-bt(s),d=1<<c;t|=e[c],s&=~d}return ma=t,Ys(),l}function zm(e,t){Oe=null,R.H=qr,t===Gl||t===ei?(t=Wf(),at=3):t===oc?(t=Wf(),at=4):at=t===Oc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,xn=t,Pe===null&&(wt=1,mi(e,Tn(t,e.current)))}function Lm(){var e=mn.current;return e===null?!0:(Ye&4194048)===Ye?Dn===null:(Ye&62914560)===Ye||(Ye&536870912)!==0?e===Dn:!1}function _m(){var e=R.H;return R.H=qr,e===null?qr:e}function Om(){var e=R.A;return R.A=Oy,e}function Ni(){wt=4,Da||(Ye&4194048)!==Ye&&mn.current!==null||(Xl=!0),(za&134217727)===0&&(hl&134217727)===0||ut===null||Oa(ut,Ye,vn,!1)}function ru(e,t,l){var s=Je;Je|=2;var c=_m(),d=Om();(ut!==e||Ye!==t)&&(wi=null,er(e,t)),t=!1;var b=wt;e:do try{if(at!==0&&Pe!==null){var C=Pe,H=xn;switch(at){case 8:lu(),b=6;break e;case 3:case 2:case 9:case 6:mn.current===null&&(t=!0);var K=at;if(at=0,xn=null,tr(e,C,H,K),l&&Xl){b=0;break e}break;default:K=at,at=0,xn=null,tr(e,C,H,K)}}Hy(),b=wt;break}catch(ee){zm(e,ee)}while(!0);return t&&e.shellSuspendCounter++,la=sl=null,Je=s,R.H=c,R.A=d,Pe===null&&(ut=null,Ye=0,Ys()),b}function Hy(){for(;Pe!==null;)Bm(Pe)}function Iy(e,t){var l=Je;Je|=2;var s=_m(),c=Om();ut!==e||Ye!==t?(wi=null,ki=tt()+500,er(e,t)):Xl=wn(e,t);e:do try{if(at!==0&&Pe!==null){t=Pe;var d=xn;t:switch(at){case 1:at=0,xn=null,tr(e,t,d,1);break;case 2:case 9:if(Ff(d)){at=0,xn=null,Um(t);break}t=function(){at!==2&&at!==9||ut!==e||(at=7),Fn(e)},d.then(t,t);break e;case 3:at=7;break e;case 4:at=5;break e;case 7:Ff(d)?(at=0,xn=null,Um(t)):(at=0,xn=null,tr(e,t,d,7));break;case 5:var b=null;switch(Pe.tag){case 26:b=Pe.memoizedState;case 5:case 27:var C=Pe;if(b?kh(b):C.stateNode.complete){at=0,xn=null;var H=C.sibling;if(H!==null)Pe=H;else{var K=C.return;K!==null?(Pe=K,Ei(K)):Pe=null}break t}}at=0,xn=null,tr(e,t,d,5);break;case 6:at=0,xn=null,tr(e,t,d,6);break;case 8:lu(),wt=6;break e;default:throw Error(o(462))}}Vy();break}catch(ee){zm(e,ee)}while(!0);return la=sl=null,R.H=s,R.A=c,Je=l,Pe!==null?0:(ut=null,Ye=0,Ys(),wt)}function Vy(){for(;Pe!==null&&!Vt();)Bm(Pe)}function Bm(e){var t=im(e.alternate,e,ma);e.memoizedProps=e.pendingProps,t===null?Ei(e):Pe=t}function Um(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=tm(l,t,t.pendingProps,t.type,void 0,Ye);break;case 11:t=tm(l,t,t.pendingProps,t.type.render,t.ref,Ye);break;case 5:bc(t);default:cm(l,t),t=Pe=Of(t,ma),t=im(l,t,ma)}e.memoizedProps=e.pendingProps,t===null?Ei(e):Pe=t}function tr(e,t,l,s){la=sl=null,bc(t),Pl=null,Br=0;var c=t.return;try{if(Ry(e,c,t,l,Ye)){wt=1,mi(e,Tn(l,e.current)),Pe=null;return}}catch(d){if(c!==null)throw Pe=c,d;wt=1,mi(e,Tn(l,e.current)),Pe=null;return}t.flags&32768?(Ke||s===1?e=!0:Xl||(Ye&536870912)!==0?e=!1:(Da=e=!0,(s===2||s===9||s===3||s===6)&&(s=mn.current,s!==null&&s.tag===13&&(s.flags|=16384))),Hm(t,e)):Ei(t)}function Ei(e){var t=e;do{if((t.flags&32768)!==0){Hm(t,Da);return}e=t.return;var l=Dy(t.alternate,t,ma);if(l!==null){Pe=l;return}if(t=t.sibling,t!==null){Pe=t;return}Pe=t=e}while(t!==null);wt===0&&(wt=5)}function Hm(e,t){do{var l=zy(e.alternate,e);if(l!==null){l.flags&=32767,Pe=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){Pe=e;return}Pe=e=l}while(e!==null);wt=6,Pe=null}function Im(e,t,l,s,c,d,b,C,H){e.cancelPendingCommit=null;do Ti();while(_t!==0);if((Je&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(d=t.lanes|t.childLanes,d|=Fo,bg(e,l,d,b,C,H),e===ut&&(Pe=ut=null,Ye=0),Jl=t,_a=e,ha=l,tu=d,nu=c,Rm=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,qy(De,function(){return qm(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=R.T,R.T=null,c=U.p,U.p=2,b=Je,Je|=4;try{Ly(e,t,l)}finally{Je=b,U.p=c,R.T=s}}_t=1,Vm(),$m(),Gm()}}function Vm(){if(_t===1){_t=0;var e=_a,t=Jl,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=R.T,R.T=null;var s=U.p;U.p=2;var c=Je;Je|=4;try{jm(t,e);var d=vu,b=Ef(e.containerInfo),C=d.focusedElem,H=d.selectionRange;if(b!==C&&C&&C.ownerDocument&&Nf(C.ownerDocument.documentElement,C)){if(H!==null&&$o(C)){var K=H.start,ee=H.end;if(ee===void 0&&(ee=K),"selectionStart"in C)C.selectionStart=K,C.selectionEnd=Math.min(ee,C.value.length);else{var re=C.ownerDocument||document,Q=re&&re.defaultView||window;if(Q.getSelection){var J=Q.getSelection(),Se=C.textContent.length,Te=Math.min(H.start,Se),it=H.end===void 0?Te:Math.min(H.end,Se);!J.extend&&Te>it&&(b=it,it=Te,Te=b);var P=Cf(C,Te),$=Cf(C,it);if(P&&$&&(J.rangeCount!==1||J.anchorNode!==P.node||J.anchorOffset!==P.offset||J.focusNode!==$.node||J.focusOffset!==$.offset)){var F=re.createRange();F.setStart(P.node,P.offset),J.removeAllRanges(),Te>it?(J.addRange(F),J.extend($.node,$.offset)):(F.setEnd($.node,$.offset),J.addRange(F))}}}}for(re=[],J=C;J=J.parentNode;)J.nodeType===1&&re.push({element:J,left:J.scrollLeft,top:J.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<re.length;C++){var le=re[C];le.element.scrollLeft=le.left,le.element.scrollTop=le.top}}Ii=!!xu,vu=xu=null}finally{Je=c,U.p=s,R.T=l}}e.current=t,_t=2}}function $m(){if(_t===2){_t=0;var e=_a,t=Jl,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=R.T,R.T=null;var s=U.p;U.p=2;var c=Je;Je|=4;try{xm(e,t.alternate,t)}finally{Je=c,U.p=s,R.T=l}}_t=3}}function Gm(){if(_t===4||_t===3){_t=0,$t();var e=_a,t=Jl,l=ha,s=Rm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?_t=5:(_t=0,Jl=_a=null,Pm(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(La=null),ko(l),t=t.stateNode,Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(Xn,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=R.T,c=U.p,U.p=2,R.T=null;try{for(var d=e.onRecoverableError,b=0;b<s.length;b++){var C=s[b];d(C.value,{componentStack:C.stack})}}finally{R.T=t,U.p=c}}(ha&3)!==0&&Ti(),Fn(e),c=e.pendingLanes,(l&261930)!==0&&(c&42)!==0?e===au?es++:(es=0,au=e):es=0,ts(0)}}function Pm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,_r(t)))}function Ti(){return Vm(),$m(),Gm(),qm()}function qm(){if(_t!==5)return!1;var e=_a,t=tu;tu=0;var l=ko(ha),s=R.T,c=U.p;try{U.p=32>l?32:l,R.T=null,l=nu,nu=null;var d=_a,b=ha;if(_t=0,Jl=_a=null,ha=0,(Je&6)!==0)throw Error(o(331));var C=Je;if(Je|=4,Nm(d.current),km(d,d.current,b,l),Je=C,ts(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(Xn,d)}catch{}return!0}finally{U.p=c,R.T=s,Pm(e,t)}}function Ym(e,t,l){t=Tn(l,t),t=_c(e.stateNode,t,2),e=Ta(e,t,2),e!==null&&(jr(e,2),Fn(e))}function lt(e,t,l){if(e.tag===3)Ym(e,e,l);else for(;t!==null;){if(t.tag===3){Ym(t,e,l);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(La===null||!La.has(s))){e=Tn(l,e),l=Fp(2),s=Ta(t,l,2),s!==null&&(Kp(l,s,t,e),jr(s,2),Fn(s));break}}t=t.return}}function su(e,t,l){var s=e.pingCache;if(s===null){s=e.pingCache=new By;var c=new Set;s.set(t,c)}else c=s.get(t),c===void 0&&(c=new Set,s.set(t,c));c.has(l)||(Zc=!0,c.add(l),e=$y.bind(null,e,t,l),t.then(e,e))}function $y(e,t,l){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,ut===e&&(Ye&l)===l&&(wt===4||wt===3&&(Ye&62914560)===Ye&&300>tt()-Si?(Je&2)===0&&er(e,0):Jc|=l,Zl===Ye&&(Zl=0)),Fn(e)}function Fm(e,t){t===0&&(t=Id()),e=al(e,t),e!==null&&(jr(e,t),Fn(e))}function Gy(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),Fm(e,l)}function Py(e,t){var l=0;switch(e.tag){case 31:case 13:var s=e.stateNode,c=e.memoizedState;c!==null&&(l=c.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(o(314))}s!==null&&s.delete(t),Fm(e,l)}function qy(e,t){return Zt(e,t)}var Ri=null,nr=null,iu=!1,Ai=!1,ou=!1,Ba=0;function Fn(e){e!==nr&&e.next===null&&(nr===null?Ri=nr=e:nr=nr.next=e),Ai=!0,iu||(iu=!0,Fy())}function ts(e,t){if(!ou&&Ai){ou=!0;do for(var l=!1,s=Ri;s!==null;){if(e!==0){var c=s.pendingLanes;if(c===0)var d=0;else{var b=s.suspendedLanes,C=s.pingedLanes;d=(1<<31-bt(42|e)+1)-1,d&=c&~(b&~C),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(l=!0,Xm(s,d))}else d=Ye,d=br(s,s===ut?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(d&3)===0||wn(s,d)||(l=!0,Xm(s,d));s=s.next}while(l);ou=!1}}function Yy(){Km()}function Km(){Ai=iu=!1;var e=0;Ba!==0&&a1()&&(e=Ba);for(var t=tt(),l=null,s=Ri;s!==null;){var c=s.next,d=Wm(s,t);d===0?(s.next=null,l===null?Ri=c:l.next=c,c===null&&(nr=l)):(l=s,(e!==0||(d&3)!==0)&&(Ai=!0)),s=c}_t!==0&&_t!==5||ts(e),Ba!==0&&(Ba=0)}function Wm(e,t){for(var l=e.suspendedLanes,s=e.pingedLanes,c=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var b=31-bt(d),C=1<<b,H=c[b];H===-1?((C&l)===0||(C&s)!==0)&&(c[b]=bo(C,t)):H<=t&&(e.expiredLanes|=C),d&=~C}if(t=ut,l=Ye,l=br(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,l===0||e===t&&(at===2||at===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&ct(s),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||wn(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(s!==null&&ct(s),ko(l)){case 2:case 8:l=Rt;break;case 32:l=De;break;case 268435456:l=Kt;break;default:l=De}return s=Qm.bind(null,e),l=Zt(l,s),e.callbackPriority=t,e.callbackNode=l,t}return s!==null&&s!==null&&ct(s),e.callbackPriority=2,e.callbackNode=null,2}function Qm(e,t){if(_t!==0&&_t!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(Ti()&&e.callbackNode!==l)return null;var s=Ye;return s=br(e,e===ut?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Mm(e,s,t),Wm(e,tt()),e.callbackNode!=null&&e.callbackNode===l?Qm.bind(null,e):null)}function Xm(e,t){if(Ti())return null;Mm(e,t,!0)}function Fy(){r1(function(){(Je&6)!==0?Zt(ye,Yy):Km()})}function cu(){if(Ba===0){var e=Vl;e===0&&(e=Ve,Ve<<=1,(Ve&261888)===0&&(Ve=256)),Ba=e}return Ba}function Zm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Us(""+e)}function Jm(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 Ky(e,t,l,s,c){if(t==="submit"&&l&&l.stateNode===c){var d=Zm((c[ln]||null).action),b=s.submitter;b&&(t=(t=b[ln]||null)?Zm(t.formAction):b.getAttribute("formAction"),t!==null&&(d=t,b=null));var C=new $s("action","action",null,s,c);e.push({event:C,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Ba!==0){var H=b?Jm(c,b):new FormData(c);Rc(l,{pending:!0,data:H,method:c.method,action:d},null,H)}}else typeof d=="function"&&(C.preventDefault(),H=b?Jm(c,b):new FormData(c),Rc(l,{pending:!0,data:H,method:c.method,action:d},d,H))},currentTarget:c}]})}}for(var uu=0;uu<Yo.length;uu++){var du=Yo[uu],Wy=du.toLowerCase(),Qy=du[0].toUpperCase()+du.slice(1);Hn(Wy,"on"+Qy)}Hn(Af,"onAnimationEnd"),Hn(Mf,"onAnimationIteration"),Hn(Df,"onAnimationStart"),Hn("dblclick","onDoubleClick"),Hn("focusin","onFocus"),Hn("focusout","onBlur"),Hn(fy,"onTransitionRun"),Hn(py,"onTransitionStart"),Hn(my,"onTransitionCancel"),Hn(zf,"onTransitionEnd"),El("onMouseEnter",["mouseout","mouseover"]),El("onMouseLeave",["mouseout","mouseover"]),El("onPointerEnter",["pointerout","pointerover"]),El("onPointerLeave",["pointerout","pointerover"]),Ja("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ja("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ja("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ja("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ja("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ja("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ns="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Xy=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ns));function eh(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var s=e[l],c=s.event;s=s.listeners;e:{var d=void 0;if(t)for(var b=s.length-1;0<=b;b--){var C=s[b],H=C.instance,K=C.currentTarget;if(C=C.listener,H!==d&&c.isPropagationStopped())break e;d=C,c.currentTarget=K;try{d(c)}catch(ee){qs(ee)}c.currentTarget=null,d=H}else for(b=0;b<s.length;b++){if(C=s[b],H=C.instance,K=C.currentTarget,C=C.listener,H!==d&&c.isPropagationStopped())break e;d=C,c.currentTarget=K;try{d(c)}catch(ee){qs(ee)}c.currentTarget=null,d=H}}}}function qe(e,t){var l=t[wo];l===void 0&&(l=t[wo]=new Set);var s=e+"__bubble";l.has(s)||(th(t,e,2,!1),l.add(s))}function fu(e,t,l){var s=0;t&&(s|=4),th(l,e,s,t)}var Mi="_reactListening"+Math.random().toString(36).slice(2);function pu(e){if(!e[Mi]){e[Mi]=!0,Fd.forEach(function(l){l!=="selectionchange"&&(Xy.has(l)||fu(l,!1,e),fu(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Mi]||(t[Mi]=!0,fu("selectionchange",!1,t))}}function th(e,t,l,s){switch(Ah(t)){case 2:var c=C1;break;case 8:c=N1;break;default:c=Tu}l=c.bind(null,t,l,e),c=void 0,!zo||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),s?c!==void 0?e.addEventListener(t,l,{capture:!0,passive:c}):e.addEventListener(t,l,!0):c!==void 0?e.addEventListener(t,l,{passive:c}):e.addEventListener(t,l,!1)}function mu(e,t,l,s,c){var d=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var b=s.tag;if(b===3||b===4){var C=s.stateNode.containerInfo;if(C===c)break;if(b===4)for(b=s.return;b!==null;){var H=b.tag;if((H===3||H===4)&&b.stateNode.containerInfo===c)return;b=b.return}for(;C!==null;){if(b=wl(C),b===null)return;if(H=b.tag,H===5||H===6||H===26||H===27){s=d=b;continue e}C=C.parentNode}}s=s.return}rf(function(){var K=d,ee=Mo(l),re=[];e:{var Q=Lf.get(e);if(Q!==void 0){var J=$s,Se=e;switch(e){case"keypress":if(Is(l)===0)break e;case"keydown":case"keyup":J=Pg;break;case"focusin":Se="focus",J=Bo;break;case"focusout":Se="blur",J=Bo;break;case"beforeblur":case"afterblur":J=Bo;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":J=cf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":J=Dg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":J=Fg;break;case Af:case Mf:case Df:J=_g;break;case zf:J=Wg;break;case"scroll":case"scrollend":J=Ag;break;case"wheel":J=Xg;break;case"copy":case"cut":case"paste":J=Bg;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":J=df;break;case"toggle":case"beforetoggle":J=Jg}var Te=(t&4)!==0,it=!Te&&(e==="scroll"||e==="scrollend"),P=Te?Q!==null?Q+"Capture":null:Q;Te=[];for(var $=K,F;$!==null;){var le=$;if(F=le.stateNode,le=le.tag,le!==5&&le!==26&&le!==27||F===null||P===null||(le=wr($,P),le!=null&&Te.push(as($,le,F))),it)break;$=$.return}0<Te.length&&(Q=new J(Q,Se,null,l,ee),re.push({event:Q,listeners:Te}))}}if((t&7)===0){e:{if(Q=e==="mouseover"||e==="pointerover",J=e==="mouseout"||e==="pointerout",Q&&l!==Ao&&(Se=l.relatedTarget||l.fromElement)&&(wl(Se)||Se[kl]))break e;if((J||Q)&&(Q=ee.window===ee?ee:(Q=ee.ownerDocument)?Q.defaultView||Q.parentWindow:window,J?(Se=l.relatedTarget||l.toElement,J=K,Se=Se?wl(Se):null,Se!==null&&(it=m(Se),Te=Se.tag,Se!==it||Te!==5&&Te!==27&&Te!==6)&&(Se=null)):(J=null,Se=K),J!==Se)){if(Te=cf,le="onMouseLeave",P="onMouseEnter",$="mouse",(e==="pointerout"||e==="pointerover")&&(Te=df,le="onPointerLeave",P="onPointerEnter",$="pointer"),it=J==null?Q:kr(J),F=Se==null?Q:kr(Se),Q=new Te(le,$+"leave",J,l,ee),Q.target=it,Q.relatedTarget=F,le=null,wl(ee)===K&&(Te=new Te(P,$+"enter",Se,l,ee),Te.target=F,Te.relatedTarget=it,le=Te),it=le,J&&Se)t:{for(Te=Zy,P=J,$=Se,F=0,le=P;le;le=Te(le))F++;le=0;for(var Ee=$;Ee;Ee=Te(Ee))le++;for(;0<F-le;)P=Te(P),F--;for(;0<le-F;)$=Te($),le--;for(;F--;){if(P===$||$!==null&&P===$.alternate){Te=P;break t}P=Te(P),$=Te($)}Te=null}else Te=null;J!==null&&nh(re,Q,J,Te,!1),Se!==null&&it!==null&&nh(re,it,Se,Te,!0)}}e:{if(Q=K?kr(K):window,J=Q.nodeName&&Q.nodeName.toLowerCase(),J==="select"||J==="input"&&Q.type==="file")var Qe=yf;else if(vf(Q))if(bf)Qe=cy;else{Qe=iy;var ke=sy}else J=Q.nodeName,!J||J.toLowerCase()!=="input"||Q.type!=="checkbox"&&Q.type!=="radio"?K&&Ro(K.elementType)&&(Qe=yf):Qe=oy;if(Qe&&(Qe=Qe(e,K))){gf(re,Qe,l,ee);break e}ke&&ke(e,Q,K),e==="focusout"&&K&&Q.type==="number"&&K.memoizedProps.value!=null&&To(Q,"number",Q.value)}switch(ke=K?kr(K):window,e){case"focusin":(vf(ke)||ke.contentEditable==="true")&&(zl=ke,Go=K,Dr=null);break;case"focusout":Dr=Go=zl=null;break;case"mousedown":Po=!0;break;case"contextmenu":case"mouseup":case"dragend":Po=!1,Tf(re,l,ee);break;case"selectionchange":if(dy)break;case"keydown":case"keyup":Tf(re,l,ee)}var Ue;if(Ho)e:{switch(e){case"compositionstart":var Fe="onCompositionStart";break e;case"compositionend":Fe="onCompositionEnd";break e;case"compositionupdate":Fe="onCompositionUpdate";break e}Fe=void 0}else Dl?hf(e,l)&&(Fe="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(Fe="onCompositionStart");Fe&&(ff&&l.locale!=="ko"&&(Dl||Fe!=="onCompositionStart"?Fe==="onCompositionEnd"&&Dl&&(Ue=sf()):(ja=ee,Lo="value"in ja?ja.value:ja.textContent,Dl=!0)),ke=Di(K,Fe),0<ke.length&&(Fe=new uf(Fe,e,null,l,ee),re.push({event:Fe,listeners:ke}),Ue?Fe.data=Ue:(Ue=xf(l),Ue!==null&&(Fe.data=Ue)))),(Ue=ty?ny(e,l):ay(e,l))&&(Fe=Di(K,"onBeforeInput"),0<Fe.length&&(ke=new uf("onBeforeInput","beforeinput",null,l,ee),re.push({event:ke,listeners:Fe}),ke.data=Ue)),Ky(re,e,K,l,ee)}eh(re,t)})}function as(e,t,l){return{instance:e,listener:t,currentTarget:l}}function Di(e,t){for(var l=t+"Capture",s=[];e!==null;){var c=e,d=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||d===null||(c=wr(e,l),c!=null&&s.unshift(as(e,c,d)),c=wr(e,t),c!=null&&s.push(as(e,c,d))),e.tag===3)return s;e=e.return}return[]}function Zy(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function nh(e,t,l,s,c){for(var d=t._reactName,b=[];l!==null&&l!==s;){var C=l,H=C.alternate,K=C.stateNode;if(C=C.tag,H!==null&&H===s)break;C!==5&&C!==26&&C!==27||K===null||(H=K,c?(K=wr(l,d),K!=null&&b.unshift(as(l,K,H))):c||(K=wr(l,d),K!=null&&b.push(as(l,K,H)))),l=l.return}b.length!==0&&e.push({event:t,listeners:b})}var Jy=/\r\n?/g,e1=/\u0000|\uFFFD/g;function ah(e){return(typeof e=="string"?e:""+e).replace(Jy,`
50
- `).replace(e1,"")}function lh(e,t){return t=ah(t),ah(e)===t}function st(e,t,l,s,c,d){switch(l){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||Rl(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&Rl(e,""+s);break;case"className":Os(e,"class",s);break;case"tabIndex":Os(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Os(e,l,s);break;case"style":af(e,s,d);break;case"data":if(t!=="object"){Os(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(l);break}s=Us(""+s),e.setAttribute(l,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof d=="function"&&(l==="formAction"?(t!=="input"&&st(e,t,"name",c.name,c,null),st(e,t,"formEncType",c.formEncType,c,null),st(e,t,"formMethod",c.formMethod,c,null),st(e,t,"formTarget",c.formTarget,c,null)):(st(e,t,"encType",c.encType,c,null),st(e,t,"method",c.method,c,null),st(e,t,"target",c.target,c,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(l);break}s=Us(""+s),e.setAttribute(l,s);break;case"onClick":s!=null&&(e.onclick=ea);break;case"onScroll":s!=null&&qe("scroll",e);break;case"onScrollEnd":s!=null&&qe("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(l=s.__html,l!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}l=Us(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,""+s):e.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":s===!0?e.setAttribute(l,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,s):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(l,s):e.removeAttribute(l);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(l):e.setAttribute(l,s);break;case"popover":qe("beforetoggle",e),qe("toggle",e),_s(e,"popover",s);break;case"xlinkActuate":Jn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Jn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Jn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Jn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Jn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Jn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Jn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Jn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Jn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":_s(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Tg.get(l)||l,_s(e,l,s))}}function hu(e,t,l,s,c,d){switch(l){case"style":af(e,s,d);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(l=s.__html,l!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"children":typeof s=="string"?Rl(e,s):(typeof s=="number"||typeof s=="bigint")&&Rl(e,""+s);break;case"onScroll":s!=null&&qe("scroll",e);break;case"onScrollEnd":s!=null&&qe("scrollend",e);break;case"onClick":s!=null&&(e.onclick=ea);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Kd.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(c=l.endsWith("Capture"),t=l.slice(2,c?l.length-7:void 0),d=e[ln]||null,d=d!=null?d[l]:null,typeof d=="function"&&e.removeEventListener(t,d,c),typeof s=="function")){typeof d!="function"&&d!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,s,c);break e}l in e?e[l]=s:s===!0?e.setAttribute(l,""):_s(e,l,s)}}}function Ft(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",e),qe("load",e);var s=!1,c=!1,d;for(d in l)if(l.hasOwnProperty(d)){var b=l[d];if(b!=null)switch(d){case"src":s=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:st(e,t,d,b,l,null)}}c&&st(e,t,"srcSet",l.srcSet,l,null),s&&st(e,t,"src",l.src,l,null);return;case"input":qe("invalid",e);var C=d=b=c=null,H=null,K=null;for(s in l)if(l.hasOwnProperty(s)){var ee=l[s];if(ee!=null)switch(s){case"name":c=ee;break;case"type":b=ee;break;case"checked":H=ee;break;case"defaultChecked":K=ee;break;case"value":d=ee;break;case"defaultValue":C=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(o(137,t));break;default:st(e,t,s,ee,l,null)}}Jd(e,d,C,H,K,b,c,!1);return;case"select":qe("invalid",e),s=b=d=null;for(c in l)if(l.hasOwnProperty(c)&&(C=l[c],C!=null))switch(c){case"value":d=C;break;case"defaultValue":b=C;break;case"multiple":s=C;default:st(e,t,c,C,l,null)}t=d,l=b,e.multiple=!!s,t!=null?Tl(e,!!s,t,!1):l!=null&&Tl(e,!!s,l,!0);return;case"textarea":qe("invalid",e),d=c=s=null;for(b in l)if(l.hasOwnProperty(b)&&(C=l[b],C!=null))switch(b){case"value":s=C;break;case"defaultValue":c=C;break;case"children":d=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(o(91));break;default:st(e,t,b,C,l,null)}tf(e,s,c,d);return;case"option":for(H in l)if(l.hasOwnProperty(H)&&(s=l[H],s!=null))switch(H){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:st(e,t,H,s,l,null)}return;case"dialog":qe("beforetoggle",e),qe("toggle",e),qe("cancel",e),qe("close",e);break;case"iframe":case"object":qe("load",e);break;case"video":case"audio":for(s=0;s<ns.length;s++)qe(ns[s],e);break;case"image":qe("error",e),qe("load",e);break;case"details":qe("toggle",e);break;case"embed":case"source":case"link":qe("error",e),qe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(K in l)if(l.hasOwnProperty(K)&&(s=l[K],s!=null))switch(K){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:st(e,t,K,s,l,null)}return;default:if(Ro(t)){for(ee in l)l.hasOwnProperty(ee)&&(s=l[ee],s!==void 0&&hu(e,t,ee,s,l,void 0));return}}for(C in l)l.hasOwnProperty(C)&&(s=l[C],s!=null&&st(e,t,C,s,l,null))}function t1(e,t,l,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,d=null,b=null,C=null,H=null,K=null,ee=null;for(J in l){var re=l[J];if(l.hasOwnProperty(J)&&re!=null)switch(J){case"checked":break;case"value":break;case"defaultValue":H=re;default:s.hasOwnProperty(J)||st(e,t,J,null,s,re)}}for(var Q in s){var J=s[Q];if(re=l[Q],s.hasOwnProperty(Q)&&(J!=null||re!=null))switch(Q){case"type":d=J;break;case"name":c=J;break;case"checked":K=J;break;case"defaultChecked":ee=J;break;case"value":b=J;break;case"defaultValue":C=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(o(137,t));break;default:J!==re&&st(e,t,Q,J,s,re)}}Eo(e,b,C,H,K,ee,d,c);return;case"select":J=b=C=Q=null;for(d in l)if(H=l[d],l.hasOwnProperty(d)&&H!=null)switch(d){case"value":break;case"multiple":J=H;default:s.hasOwnProperty(d)||st(e,t,d,null,s,H)}for(c in s)if(d=s[c],H=l[c],s.hasOwnProperty(c)&&(d!=null||H!=null))switch(c){case"value":Q=d;break;case"defaultValue":C=d;break;case"multiple":b=d;default:d!==H&&st(e,t,c,d,s,H)}t=C,l=b,s=J,Q!=null?Tl(e,!!l,Q,!1):!!s!=!!l&&(t!=null?Tl(e,!!l,t,!0):Tl(e,!!l,l?[]:"",!1));return;case"textarea":J=Q=null;for(C in l)if(c=l[C],l.hasOwnProperty(C)&&c!=null&&!s.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:st(e,t,C,null,s,c)}for(b in s)if(c=s[b],d=l[b],s.hasOwnProperty(b)&&(c!=null||d!=null))switch(b){case"value":Q=c;break;case"defaultValue":J=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(o(91));break;default:c!==d&&st(e,t,b,c,s,d)}ef(e,Q,J);return;case"option":for(var Se in l)if(Q=l[Se],l.hasOwnProperty(Se)&&Q!=null&&!s.hasOwnProperty(Se))switch(Se){case"selected":e.selected=!1;break;default:st(e,t,Se,null,s,Q)}for(H in s)if(Q=s[H],J=l[H],s.hasOwnProperty(H)&&Q!==J&&(Q!=null||J!=null))switch(H){case"selected":e.selected=Q&&typeof Q!="function"&&typeof Q!="symbol";break;default:st(e,t,H,Q,s,J)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Te in l)Q=l[Te],l.hasOwnProperty(Te)&&Q!=null&&!s.hasOwnProperty(Te)&&st(e,t,Te,null,s,Q);for(K in s)if(Q=s[K],J=l[K],s.hasOwnProperty(K)&&Q!==J&&(Q!=null||J!=null))switch(K){case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(o(137,t));break;default:st(e,t,K,Q,s,J)}return;default:if(Ro(t)){for(var it in l)Q=l[it],l.hasOwnProperty(it)&&Q!==void 0&&!s.hasOwnProperty(it)&&hu(e,t,it,void 0,s,Q);for(ee in s)Q=s[ee],J=l[ee],!s.hasOwnProperty(ee)||Q===J||Q===void 0&&J===void 0||hu(e,t,ee,Q,s,J);return}}for(var P in l)Q=l[P],l.hasOwnProperty(P)&&Q!=null&&!s.hasOwnProperty(P)&&st(e,t,P,null,s,Q);for(re in s)Q=s[re],J=l[re],!s.hasOwnProperty(re)||Q===J||Q==null&&J==null||st(e,t,re,Q,s,J)}function rh(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function n1(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),s=0;s<l.length;s++){var c=l[s],d=c.transferSize,b=c.initiatorType,C=c.duration;if(d&&C&&rh(b)){for(b=0,C=c.responseEnd,s+=1;s<l.length;s++){var H=l[s],K=H.startTime;if(K>C)break;var ee=H.transferSize,re=H.initiatorType;ee&&rh(re)&&(H=H.responseEnd,b+=ee*(H<C?1:(C-K)/(H-K)))}if(--s,t+=8*(d+b)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var xu=null,vu=null;function zi(e){return e.nodeType===9?e:e.ownerDocument}function sh(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 ih(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 yu=null;function a1(){var e=window.event;return e&&e.type==="popstate"?e===yu?!1:(yu=e,!0):(yu=null,!1)}var oh=typeof setTimeout=="function"?setTimeout:void 0,l1=typeof clearTimeout=="function"?clearTimeout:void 0,ch=typeof Promise=="function"?Promise:void 0,r1=typeof queueMicrotask=="function"?queueMicrotask:typeof ch<"u"?function(e){return ch.resolve(null).then(e).catch(s1)}:oh;function s1(e){setTimeout(function(){throw e})}function Ua(e){return e==="head"}function uh(e,t){var l=t,s=0;do{var c=l.nextSibling;if(e.removeChild(l),c&&c.nodeType===8)if(l=c.data,l==="/$"||l==="/&"){if(s===0){e.removeChild(c),sr(t);return}s--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")s++;else if(l==="html")ls(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,ls(l);for(var d=l.firstChild;d;){var b=d.nextSibling,C=d.nodeName;d[Sr]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&d.rel.toLowerCase()==="stylesheet"||l.removeChild(d),d=b}}else l==="body"&&ls(e.ownerDocument.body);l=c}while(l);sr(t)}function dh(e,t){var l=e;e=0;do{var s=l.nextSibling;if(l.nodeType===1?t?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(t?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),s&&s.nodeType===8)if(l=s.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=s}while(l)}function bu(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":bu(l),Co(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function i1(e,t,l,s){for(;e.nodeType===1;){var c=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[Sr])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(d=e.getAttribute("rel"),d==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(d!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(d=e.getAttribute("src"),(d!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var d=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=zn(e.nextSibling),e===null)break}return null}function o1(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=zn(e.nextSibling),e===null))return null;return e}function fh(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=zn(e.nextSibling),e===null))return null;return e}function ju(e){return e.data==="$?"||e.data==="$~"}function Su(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function c1(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var s=function(){t(),l.removeEventListener("DOMContentLoaded",s)};l.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function zn(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 ku=null;function ph(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return zn(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function mh(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 hh(e,t,l){switch(t=zi(l),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function ls(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Co(e)}var Ln=new Map,xh=new Set;function Li(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var xa=U.d;U.d={f:u1,r:d1,D:f1,C:p1,L:m1,m:h1,X:v1,S:x1,M:g1};function u1(){var e=xa.f(),t=Ci();return e||t}function d1(e){var t=Cl(e);t!==null&&t.tag===5&&t.type==="form"?zp(t):xa.r(e)}var ar=typeof document>"u"?null:document;function vh(e,t,l){var s=ar;if(s&&typeof t=="string"&&t){var c=Nn(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof l=="string"&&(c+='[crossorigin="'+l+'"]'),xh.has(c)||(xh.add(c),e={rel:e,crossOrigin:l,href:t},s.querySelector(c)===null&&(t=s.createElement("link"),Ft(t,"link",e),Ht(t),s.head.appendChild(t)))}}function f1(e){xa.D(e),vh("dns-prefetch",e,null)}function p1(e,t){xa.C(e,t),vh("preconnect",e,t)}function m1(e,t,l){xa.L(e,t,l);var s=ar;if(s&&e&&t){var c='link[rel="preload"][as="'+Nn(t)+'"]';t==="image"&&l&&l.imageSrcSet?(c+='[imagesrcset="'+Nn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(c+='[imagesizes="'+Nn(l.imageSizes)+'"]')):c+='[href="'+Nn(e)+'"]';var d=c;switch(t){case"style":d=lr(e);break;case"script":d=rr(e)}Ln.has(d)||(e=g({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),Ln.set(d,e),s.querySelector(c)!==null||t==="style"&&s.querySelector(rs(d))||t==="script"&&s.querySelector(ss(d))||(t=s.createElement("link"),Ft(t,"link",e),Ht(t),s.head.appendChild(t)))}}function h1(e,t){xa.m(e,t);var l=ar;if(l&&e){var s=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+Nn(s)+'"][href="'+Nn(e)+'"]',d=c;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=rr(e)}if(!Ln.has(d)&&(e=g({rel:"modulepreload",href:e},t),Ln.set(d,e),l.querySelector(c)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(ss(d)))return}s=l.createElement("link"),Ft(s,"link",e),Ht(s),l.head.appendChild(s)}}}function x1(e,t,l){xa.S(e,t,l);var s=ar;if(s&&e){var c=Nl(s).hoistableStyles,d=lr(e);t=t||"default";var b=c.get(d);if(!b){var C={loading:0,preload:null};if(b=s.querySelector(rs(d)))C.loading=5;else{e=g({rel:"stylesheet",href:e,"data-precedence":t},l),(l=Ln.get(d))&&wu(e,l);var H=b=s.createElement("link");Ht(H),Ft(H,"link",e),H._p=new Promise(function(K,ee){H.onload=K,H.onerror=ee}),H.addEventListener("load",function(){C.loading|=1}),H.addEventListener("error",function(){C.loading|=2}),C.loading|=4,_i(b,t,s)}b={type:"stylesheet",instance:b,count:1,state:C},c.set(d,b)}}}function v1(e,t){xa.X(e,t);var l=ar;if(l&&e){var s=Nl(l).hoistableScripts,c=rr(e),d=s.get(c);d||(d=l.querySelector(ss(c)),d||(e=g({src:e,async:!0},t),(t=Ln.get(c))&&Cu(e,t),d=l.createElement("script"),Ht(d),Ft(d,"link",e),l.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(c,d))}}function g1(e,t){xa.M(e,t);var l=ar;if(l&&e){var s=Nl(l).hoistableScripts,c=rr(e),d=s.get(c);d||(d=l.querySelector(ss(c)),d||(e=g({src:e,async:!0,type:"module"},t),(t=Ln.get(c))&&Cu(e,t),d=l.createElement("script"),Ht(d),Ft(d,"link",e),l.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(c,d))}}function gh(e,t,l,s){var c=(c=xe.current)?Li(c):null;if(!c)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=lr(l.href),l=Nl(c).hoistableStyles,s=l.get(t),s||(s={type:"style",instance:null,count:0,state:null},l.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=lr(l.href);var d=Nl(c).hoistableStyles,b=d.get(e);if(b||(c=c.ownerDocument||c,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,b),(d=c.querySelector(rs(e)))&&!d._p&&(b.instance=d,b.state.loading=5),Ln.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},Ln.set(e,l),d||y1(c,e,l,b.state))),t&&s===null)throw Error(o(528,""));return b}if(t&&s!==null)throw Error(o(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=rr(l),l=Nl(c).hoistableScripts,s=l.get(t),s||(s={type:"script",instance:null,count:0,state:null},l.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function lr(e){return'href="'+Nn(e)+'"'}function rs(e){return'link[rel="stylesheet"]['+e+"]"}function yh(e){return g({},e,{"data-precedence":e.precedence,precedence:null})}function y1(e,t,l,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),Ft(t,"link",l),Ht(t),e.head.appendChild(t))}function rr(e){return'[src="'+Nn(e)+'"]'}function ss(e){return"script[async]"+e}function bh(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Nn(l.href)+'"]');if(s)return t.instance=s,Ht(s),s;var c=g({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Ht(s),Ft(s,"style",c),_i(s,l.precedence,e),t.instance=s;case"stylesheet":c=lr(l.href);var d=e.querySelector(rs(c));if(d)return t.state.loading|=4,t.instance=d,Ht(d),d;s=yh(l),(c=Ln.get(c))&&wu(s,c),d=(e.ownerDocument||e).createElement("link"),Ht(d);var b=d;return b._p=new Promise(function(C,H){b.onload=C,b.onerror=H}),Ft(d,"link",s),t.state.loading|=4,_i(d,l.precedence,e),t.instance=d;case"script":return d=rr(l.src),(c=e.querySelector(ss(d)))?(t.instance=c,Ht(c),c):(s=l,(c=Ln.get(d))&&(s=g({},l),Cu(s,c)),e=e.ownerDocument||e,c=e.createElement("script"),Ht(c),Ft(c,"link",s),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,_i(s,l.precedence,e));return t.instance}function _i(e,t,l){for(var s=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=s.length?s[s.length-1]:null,d=c,b=0;b<s.length;b++){var C=s[b];if(C.dataset.precedence===t)d=C;else if(d!==c)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function wu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Cu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Oi=null;function jh(e,t,l){if(Oi===null){var s=new Map,c=Oi=new Map;c.set(l,s)}else c=Oi,s=c.get(l),s||(s=new Map,c.set(l,s));if(s.has(e))return s;for(s.set(e,null),l=l.getElementsByTagName(e),c=0;c<l.length;c++){var d=l[c];if(!(d[Sr]||d[Gt]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var b=d.getAttribute(t)||"";b=e+b;var C=s.get(b);C?C.push(d):s.set(b,[d])}}return s}function Sh(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function b1(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 kh(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function j1(e,t,l,s){if(l.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var c=lr(s.href),d=t.querySelector(rs(c));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Bi.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=d,Ht(d);return}d=t.ownerDocument||t,s=yh(s),(c=Ln.get(c))&&wu(s,c),d=d.createElement("link"),Ht(d);var b=d;b._p=new Promise(function(C,H){b.onload=C,b.onerror=H}),Ft(d,"link",s),l.instance=d}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=Bi.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var Nu=0;function S1(e,t){return e.stylesheets&&e.count===0&&Hi(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var s=setTimeout(function(){if(e.stylesheets&&Hi(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&Nu===0&&(Nu=62500*n1());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Hi(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>Nu?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(c)}}:null}function Bi(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Hi(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ui=null;function Hi(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ui=new Map,t.forEach(k1,e),Ui=null,Bi.call(e))}function k1(e,t){if(!(t.state.loading&4)){var l=Ui.get(e);if(l)var s=l.get(null);else{l=new Map,Ui.set(e,l);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<c.length;d++){var b=c[d];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(l.set(b.dataset.precedence,b),s=b)}s&&l.set(null,s)}c=t.instance,b=c.getAttribute("data-precedence"),d=l.get(b)||s,d===s&&l.set(null,c),l.set(b,c),this.count++,s=Bi.bind(this),c.addEventListener("load",s),c.addEventListener("error",s),d?d.parentNode.insertBefore(c,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var is={$$typeof:B,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function w1(e,t,l,s,c,d,b,C,H){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=jo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=jo(0),this.hiddenUpdates=jo(null),this.identifierPrefix=s,this.onUncaughtError=c,this.onCaughtError=d,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function wh(e,t,l,s,c,d,b,C,H,K,ee,re){return e=new w1(e,t,l,b,H,K,ee,re,C),t=1,d===!0&&(t|=24),d=pn(3,null,null,t),e.current=d,d.stateNode=e,t=rc(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:s,isDehydrated:l,cache:t},cc(d),e}function Ch(e){return e?(e=Ol,e):Ol}function Nh(e,t,l,s,c,d){c=Ch(c),s.context===null?s.context=c:s.pendingContext=c,s=Ea(t),s.payload={element:l},d=d===void 0?null:d,d!==null&&(s.callback=d),l=Ta(e,s,t),l!==null&&(dn(l,e,t),Hr(l,e,t))}function Eh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function Eu(e,t){Eh(e,t),(e=e.alternate)&&Eh(e,t)}function Th(e){if(e.tag===13||e.tag===31){var t=al(e,67108864);t!==null&&dn(t,e,67108864),Eu(e,67108864)}}function Rh(e){if(e.tag===13||e.tag===31){var t=gn();t=So(t);var l=al(e,t);l!==null&&dn(l,e,t),Eu(e,t)}}var Ii=!0;function C1(e,t,l,s){var c=R.T;R.T=null;var d=U.p;try{U.p=2,Tu(e,t,l,s)}finally{U.p=d,R.T=c}}function N1(e,t,l,s){var c=R.T;R.T=null;var d=U.p;try{U.p=8,Tu(e,t,l,s)}finally{U.p=d,R.T=c}}function Tu(e,t,l,s){if(Ii){var c=Ru(s);if(c===null)mu(e,t,s,Vi,l),Mh(e,s);else if(T1(c,e,t,l,s))s.stopPropagation();else if(Mh(e,s),t&4&&-1<E1.indexOf(e)){for(;c!==null;){var d=Cl(c);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var b=Nt(d.pendingLanes);if(b!==0){var C=d;for(C.pendingLanes|=2,C.entangledLanes|=2;b;){var H=1<<31-bt(b);C.entanglements[1]|=H,b&=~H}Fn(d),(Je&6)===0&&(ki=tt()+500,ts(0))}}break;case 31:case 13:C=al(d,2),C!==null&&dn(C,d,2),Ci(),Eu(d,2)}if(d=Ru(s),d===null&&mu(e,t,s,Vi,l),d===c)break;c=d}c!==null&&s.stopPropagation()}else mu(e,t,s,null,l)}}function Ru(e){return e=Mo(e),Au(e)}var Vi=null;function Au(e){if(Vi=null,e=wl(e),e!==null){var t=m(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=f(t),e!==null)return e;e=null}else if(l===31){if(e=h(t),e!==null)return e;e=null}else if(l===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Vi=e,null}function Ah(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(jt()){case ye:return 2;case Rt:return 8;case De:case xt:return 32;case Kt:return 268435456;default:return 32}default:return 32}}var Mu=!1,Ha=null,Ia=null,Va=null,os=new Map,cs=new Map,$a=[],E1="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 Mh(e,t){switch(e){case"focusin":case"focusout":Ha=null;break;case"dragenter":case"dragleave":Ia=null;break;case"mouseover":case"mouseout":Va=null;break;case"pointerover":case"pointerout":os.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":cs.delete(t.pointerId)}}function us(e,t,l,s,c,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:l,eventSystemFlags:s,nativeEvent:d,targetContainers:[c]},t!==null&&(t=Cl(t),t!==null&&Th(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function T1(e,t,l,s,c){switch(t){case"focusin":return Ha=us(Ha,e,t,l,s,c),!0;case"dragenter":return Ia=us(Ia,e,t,l,s,c),!0;case"mouseover":return Va=us(Va,e,t,l,s,c),!0;case"pointerover":var d=c.pointerId;return os.set(d,us(os.get(d)||null,e,t,l,s,c)),!0;case"gotpointercapture":return d=c.pointerId,cs.set(d,us(cs.get(d)||null,e,t,l,s,c)),!0}return!1}function Dh(e){var t=wl(e.target);if(t!==null){var l=m(t);if(l!==null){if(t=l.tag,t===13){if(t=f(l),t!==null){e.blockedOn=t,qd(e.priority,function(){Rh(l)});return}}else if(t===31){if(t=h(l),t!==null){e.blockedOn=t,qd(e.priority,function(){Rh(l)});return}}else if(t===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function $i(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=Ru(e.nativeEvent);if(l===null){l=e.nativeEvent;var s=new l.constructor(l.type,l);Ao=s,l.target.dispatchEvent(s),Ao=null}else return t=Cl(l),t!==null&&Th(t),e.blockedOn=l,!1;t.shift()}return!0}function zh(e,t,l){$i(e)&&l.delete(t)}function R1(){Mu=!1,Ha!==null&&$i(Ha)&&(Ha=null),Ia!==null&&$i(Ia)&&(Ia=null),Va!==null&&$i(Va)&&(Va=null),os.forEach(zh),cs.forEach(zh)}function Gi(e,t){e.blockedOn===t&&(e.blockedOn=null,Mu||(Mu=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,R1)))}var Pi=null;function Lh(e){Pi!==e&&(Pi=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Pi===e&&(Pi=null);for(var t=0;t<e.length;t+=3){var l=e[t],s=e[t+1],c=e[t+2];if(typeof s!="function"){if(Au(s||l)===null)continue;break}var d=Cl(l);d!==null&&(e.splice(t,3),t-=3,Rc(d,{pending:!0,data:c,method:l.method,action:s},s,c))}}))}function sr(e){function t(H){return Gi(H,e)}Ha!==null&&Gi(Ha,e),Ia!==null&&Gi(Ia,e),Va!==null&&Gi(Va,e),os.forEach(t),cs.forEach(t);for(var l=0;l<$a.length;l++){var s=$a[l];s.blockedOn===e&&(s.blockedOn=null)}for(;0<$a.length&&(l=$a[0],l.blockedOn===null);)Dh(l),l.blockedOn===null&&$a.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(s=0;s<l.length;s+=3){var c=l[s],d=l[s+1],b=c[ln]||null;if(typeof d=="function")b||Lh(l);else if(b){var C=null;if(d&&d.hasAttribute("formAction")){if(c=d,b=d[ln]||null)C=b.formAction;else if(Au(c)!==null)continue}else C=b.action;typeof C=="function"?l[s+1]=C:(l.splice(s,3),s-=3),Lh(l)}}}function _h(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(b){return c=b})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),s||setTimeout(l,20)}function l(){if(!s&&!navigation.transition){var d=navigation.currentEntry;d&&d.url!=null&&navigation.navigate(d.url,{state:d.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function Du(e){this._internalRoot=e}qi.prototype.render=Du.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var l=t.current,s=gn();Nh(l,s,e,t,null,null)},qi.prototype.unmount=Du.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Nh(e.current,2,null,e,null,null),Ci(),t[kl]=null}};function qi(e){this._internalRoot=e}qi.prototype.unstable_scheduleHydration=function(e){if(e){var t=Pd();e={blockedOn:null,target:e,priority:t};for(var l=0;l<$a.length&&t!==0&&t<$a[l].priority;l++);$a.splice(l,0,e),l===0&&Dh(e)}};var Oh=r.version;if(Oh!=="19.2.4")throw Error(o(527,Oh,"19.2.4"));U.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 A1={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:R,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yi=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yi.isDisabled&&Yi.supportsFiber)try{Xn=Yi.inject(A1),Ct=Yi}catch{}}return fs.createRoot=function(e,t){if(!u(e))throw Error(o(299));var l=!1,s="",c=Gp,d=Pp,b=qp;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(d=t.onCaughtError),t.onRecoverableError!==void 0&&(b=t.onRecoverableError)),t=wh(e,1,!1,null,null,l,s,null,c,d,b,_h),e[kl]=t.current,pu(e),new Du(t)},fs.hydrateRoot=function(e,t,l){if(!u(e))throw Error(o(299));var s=!1,c="",d=Gp,b=Pp,C=qp,H=null;return l!=null&&(l.unstable_strictMode===!0&&(s=!0),l.identifierPrefix!==void 0&&(c=l.identifierPrefix),l.onUncaughtError!==void 0&&(d=l.onUncaughtError),l.onCaughtError!==void 0&&(b=l.onCaughtError),l.onRecoverableError!==void 0&&(C=l.onRecoverableError),l.formState!==void 0&&(H=l.formState)),t=wh(e,1,!0,t,l??null,s,c,H,d,b,C,_h),t.context=Ch(null),l=t.current,s=gn(),s=So(s),c=Ea(s),c.callback=null,Ta(l,c,s),l=s,t.current.lanes=l,jr(t,l),Fn(t),e[kl]=t.current,pu(e),new qi(t)},fs.version="19.2.4",fs}var Yh;function H1(){if(Yh)return _u.exports;Yh=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(r){console.error(r)}}return a(),_u.exports=U1(),_u.exports}var I1=H1();const V1="modulepreload",$1=function(a){return"/"+a},Fh={},jd=function(r,i,o){let u=Promise.resolve();if(i&&i.length>0){let f=function(p){return Promise.all(p.map(y=>Promise.resolve(y).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),x=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));u=f(i.map(p=>{if(p=$1(p),p in Fh)return;Fh[p]=!0;const y=p.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const j=document.createElement("link");if(j.rel=y?"stylesheet":V1,y||(j.as="script"),j.crossOrigin="",j.href=p,x&&j.setAttribute("nonce",x),document.head.appendChild(j),y)return new Promise((S,N)=>{j.addEventListener("load",S),j.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${p}`)))})}))}function m(f){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=f,window.dispatchEvent(h),!h.defaultPrevented)throw f}return u.then(f=>{for(const h of f||[])h.status==="rejected"&&m(h.reason);return r().catch(m)})},Kh={own:"authoring-project",installed:"available-project",global:"available-personal"},sd=new Set(["available-project","available-personal","available-plugin","authoring-project","authoring-plugin"]);function G1(a){if(typeof a=="string"){if(sd.has(a))return a;if(Object.prototype.hasOwnProperty.call(Kh,a))return Kh[a]}return"authoring-project"}function P1(a){return a.startsWith("available-")?"available":"authoring"}function q1(a){const r=a.indexOf("-");return a.slice(r+1)}const Ya="";class gs extends Error{constructor(r,i){super(r),this.name="ApiError",this.status=i}}async function Ge(a,r){const i=await fetch(`${Ya}${a}`,r);if(!i.ok){const o=await i.json().catch(()=>({error:i.statusText}));throw new gs(o.error||`HTTP ${i.status}`,i.status)}return i.json()}function en(a){return typeof a=="string"&&a.length>0?a:null}function Y1(a){return typeof a=="number"&&Number.isFinite(a)?a:null}function Hu(a){if(!Array.isArray(a))return null;const r=a.filter(i=>typeof i=="string"&&i.length>0);return r.length>0?r:null}function F1(a){const r=a??{};let i;r.origin==="source"||r.origin==="installed"?i=r.origin:(i="source",console.warn(`[api.getSkills] skill ${String(r.plugin)}/${String(r.skill)} has invalid origin=${JSON.stringify(r.origin)}; defaulting to 'source'`));let o;r.scope==="own"||r.scope==="installed"||r.scope==="global"?o=r.scope:o=i==="installed"?"installed":"own";let u;r.installMethod==="authored"||r.installMethod==="copied"||r.installMethod==="symlinked"?u=r.installMethod:u=o==="own"?"authored":"copied";const m=typeof r.scopeV2=="string"&&sd.has(r.scopeV2)?r.scopeV2:G1(r.scope),f=P1(m),h=q1(m),x=typeof r.precedenceRank=="number"?r.precedenceRank:void 0;let p;r.shadowedBy===null?p=null:typeof r.shadowedBy=="string"&&sd.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:i,scope:o,isSymlink:typeof r.isSymlink=="boolean"?r.isSymlink:!1,symlinkTarget:en(r.symlinkTarget),installMethod:u,scopeV2:m,group:f,source:h,pluginName:en(r.pluginName),pluginNamespace:en(r.pluginNamespace),pluginMarketplace:en(r.pluginMarketplace),pluginManifestPath:en(r.pluginManifestPath),pluginVersion:en(r.pluginVersion),precedenceRank:x,shadowedBy:p,description:en(r.description),version:en(r.version),category:en(r.category),author:en(r.author),license:en(r.license),homepage:en(r.homepage),tags:Hu(r.tags),deps:Hu(r.deps),mcpDeps:Hu(r.mcpDeps),entryPoint:en(r.entryPoint),lastModified:en(r.lastModified),sizeBytes:Y1(r.sizeBytes),sourceAgent:en(r.sourceAgent)};if(r.provenance&&typeof r.provenance=="object"){const g=r.provenance;(g.promotedFrom==="installed"||g.promotedFrom==="global")&&typeof g.sourcePath=="string"&&typeof g.promotedAt=="number"?y.provenance={promotedFrom:g.promotedFrom,sourcePath:g.sourcePath,promotedAt:g.promotedAt,sourceSkillVersion:typeof g.sourceSkillVersion=="string"?g.sourceSkillVersion:void 0}:y.provenance=null}else r.provenance===null&&(y.provenance=null);return typeof r.updateAvailable=="boolean"&&(y.updateAvailable=r.updateAvailable),typeof r.currentVersion=="string"&&(y.currentVersion=r.currentVersion),typeof r.latestVersion=="string"&&(y.latestVersion=r.latestVersion),typeof r.pinnedVersion=="string"&&(y.pinnedVersion=r.pinnedVersion),y}const Ne={getConfig(){return Ge("/api/config")},setConfig(a,r){return Ge("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:a,model:r})})},async getSkills(a){const r=new URLSearchParams;a!=null&&a.scope&&r.set("scope",a.scope),a!=null&&a.agent&&r.set("agent",a.agent);const i=r.toString(),o=await Ge(`/api/skills${i?"?"+i:""}`);return Array.isArray(o)?o.map(F1):[]},getAgents(){return Ge("/api/agents")},getSkillDetail(a,r){return Ge(`/api/skills/${a}/${r}`)},getEvals(a,r){return Ge(`/api/skills/${a}/${r}/evals`)},saveEvals(a,r,i){return Ge(`/api/skills/${a}/${r}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})},generateEvals(a,r){return Ge(`/api/skills/${a}/${r}/generate-evals`,{method:"POST"})},async getLatestBenchmark(a,r){const i=await fetch(`${Ya}/api/skills/${a}/${r}/benchmark/latest`);if(i.status===404)return null;if(!i.ok){const o=await i.json().catch(()=>({error:i.statusText}));throw new gs(o.error||`HTTP ${i.status}`,i.status)}return i.json()},getHistory(a,r,i){const o=new URLSearchParams;i!=null&&i.model&&o.set("model",i.model),i!=null&&i.type&&o.set("type",i.type),i!=null&&i.from&&o.set("from",i.from),i!=null&&i.to&&o.set("to",i.to);const u=o.toString();return Ge(`/api/skills/${a}/${r}/history${u?"?"+u:""}`)},getHistoryEntry(a,r,i){return Ge(`/api/skills/${a}/${r}/history/${encodeURIComponent(i)}`)},compareRuns(a,r,i,o){return Ge(`/api/skills/${a}/${r}/history-compare?a=${encodeURIComponent(i)}&b=${encodeURIComponent(o)}`)},getCaseHistory(a,r,i,o){const u=new URLSearchParams;o&&u.set("model",o);const m=u.toString();return Ge(`/api/skills/${a}/${r}/history/case/${i}${m?"?"+m:""}`)},deleteHistoryEntry(a,r,i){return Ge(`/api/skills/${a}/${r}/history/${encodeURIComponent(i)}`,{method:"DELETE"})},deleteSkill(a,r){return Ge(`/api/skills/${a}/${r}`,{method:"DELETE"})},improveSkill(a,r,i){return Ge(`/api/skills/${a}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})},instructEdit(a,r,i){return Ge(`/api/skills/${a}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"instruct",...i})})},applyImprovement(a,r,i){return Ge(`/api/skills/${a}/${r}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i})})},getStats(a,r){return Ge(`/api/skills/${a}/${r}/stats`)},getDependencies(a,r){return Ge(`/api/skills/${a}/${r}/dependencies`)},getProjectLayout(){return Ge("/api/project-layout")},createSkill(a){return Ge("/api/skills/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},saveDraft(a){return Ge("/api/skills/save-draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},getSkillCreatorStatus(){return Ge("/api/skill-creator-status")},generateSkill(a){return Ge("/api/skills/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},getSkillFiles(a,r){return Ge(`/api/skills/${a}/${r}/files`)},getSkillFile(a,r,i){return Ge(`/api/skills/${a}/${r}/file?path=${encodeURIComponent(i)}`)},saveSkillFile(a,r,i,o){return Ge(`/api/skills/${a}/${r}/file`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:i,content:o})})},getLeaderboard(a,r){return Ge(`/api/skills/${a}/${r}/leaderboard`)},getLeaderboardEntry(a,r,i){return Ge(`/api/skills/${a}/${r}/leaderboard/${encodeURIComponent(i)}`)},startSweep(a,r,i){const o=`${Ya}/api/skills/${a}/${r}/sweep`,u=new EventSource(o);return fetch(o,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(i)}),u},getCredentials(a,r){return Ge(`/api/credentials/${a}/${r}`)},setCredential(a,r,i,o){return Ge(`/api/credentials/${a}/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,value:o})})},getParams(a,r){return Ge(`/api/credentials/${a}/${r}/params`)},getParamsRevealed(a,r,i){const o=i?`reveal=true&key=${encodeURIComponent(i)}`:"reveal=true";return Ge(`/api/credentials/${a}/${r}/params?${o}`)},searchModels(){return Ge("/api/openrouter/models")},getSkillVersions(a,r){return Ge(`/api/skills/${a}/${r}/versions`)},getVersionDiff(a,r,i,o){return Ge(`/api/skills/${a}/${r}/versions/diff?from=${i}&to=${o}`)},startBatchUpdate(a){const r=`${Ya}/api/skills/batch-update`,i=new EventSource(r);return fetch(r,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({skills:a})}),i},startSkillUpdate(a,r){const i=`${Ya}/api/skills/${a}/${r}/update`,o=new EventSource(i);return fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"}}),o},async getSkillUpdates(){try{const a=await fetch(`${Ya}/api/skills/updates`);return a.ok?await a.json():[]}catch{return[]}},promoteSkill(a,r,i){const o=i!=null&&i.overwrite?"?overwrite=true":"";return Iu(`/api/skills/${a}/${r}/promote${o}`,i==null?void 0:i.onEvent,i==null?void 0:i.signal)},testInstallSkill(a,r,i){const o=new URLSearchParams;(i==null?void 0:i.dest)==="global"&&o.set("dest","global"),i!=null&&i.overwrite&&o.set("overwrite","true");const u=o.toString();return Iu(`/api/skills/${a}/${r}/test-install${u?"?"+u:""}`,i==null?void 0:i.onEvent,i==null?void 0:i.signal)},revertSkill(a,r,i){return Iu(`/api/skills/${a}/${r}/revert`,i==null?void 0:i.onEvent,i==null?void 0:i.signal)},listStudioOps(a){const r=new URLSearchParams;(a==null?void 0:a.before)!=null&&r.set("before",String(a.before)),(a==null?void 0:a.limit)!=null&&r.set("limit",String(a.limit));const i=r.toString();return Ge(`/api/studio/ops${i?"?"+i:""}`)},deleteStudioOp(a){return Ge(`/api/studio/ops/${encodeURIComponent(a)}`,{method:"DELETE"})},studioOpsStream(){return new EventSource(`${Ya}/api/studio/ops/stream`)}};async function Iu(a,r,i){const o=await fetch(`${Ya}${a}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},signal:i});if(!o.ok||!o.body){let y=`HTTP ${o.status}`,g;try{const S=await o.json();S.error&&(y=S.error),typeof S.code=="string"&&(g=S.code)}catch{}const j=new gs(y,o.status);throw g&&(j.code=g),j}const u=o.body.getReader(),m=new TextDecoder;let f="",h="",x=null,p=null;for(;;){const{done:y,value:g}=await u.read();if(y)break;f+=m.decode(g,{stream:!0});const j=f.split(`
51
- `);f=j.pop()??"";for(const S of j)if(S.startsWith("event: "))h=S.slice(7).trim();else if(S.startsWith("data: ")){let N={};try{N=JSON.parse(S.slice(6))}catch{h="";continue}if(h==="started"||h==="copied"||h==="deleted"||h==="indexed"||h==="done"||h==="error"){const M={type:h,...N};r==null||r(M),M.type==="done"&&(x=M),M.type==="error"&&(p=M)}h=""}}if(p){const y=new gs(p.message,500);throw y.code=p.code,y}if(!x)throw new gs("Transfer stream ended without 'done' event",500);return x}function K1(a,r){if(!r.length)return a;const i=new Map;for(const o of r){const u=o.name.split("/").pop()||o.name;i.set(u,o)}return a.map(o=>{const u=i.get(o.skill);return u?{...o,updateAvailable:u.updateAvailable,currentVersion:u.installed,latestVersion:u.latest??void 0}:o})}function W1(a){const[r,i]=v.useState(()=>typeof window>"u"?!1:window.matchMedia(a).matches);return v.useEffect(()=>{const o=window.matchMedia(a);i(o.matches);const u=m=>i(m.matches);return o.addEventListener("change",u),()=>o.removeEventListener("change",u)},[a]),r}const Q1=3e5,X1=500,Z1=15e3,J1=6e4;function eb(a){const r=new Map;for(const i of a){const o=i.name.split("/").pop()||i.name;r.set(o,i)}return r}function tb(a){let r=0;for(const i of a)i.updateAvailable&&r++;return r}function nb(a){a()}function ab(a){const r=Q1,i=X1,o=Z1,u=J1,[m,f]=v.useState([]),[h,x]=v.useState(()=>new Map),[p,y]=v.useState(0),[g,j]=v.useState(!1),[S,N]=v.useState(null),[M,E]=v.useState(null),k=v.useRef(null),T=v.useRef(null),B=v.useRef(null),I=v.useRef(null),L=v.useRef(!0),V=v.useCallback(async()=>{j(!0);const O=new AbortController,G=setTimeout(()=>O.abort(),o);try{const q=await Promise.race([Ne.getSkillUpdates(),new Promise((te,X)=>{O.signal.addEventListener("abort",()=>{X(new Error("TIMEOUT"))})})]);if(q==="TIMEOUT")throw new Error("TIMEOUT");if(!L.current)return;f(q),x(eb(q)),y(tb(q)),T.current=Date.now(),N(T.current),E(null)}catch(q){if(!L.current)return;E(q instanceof Error?q:new Error(String(q)))}finally{clearTimeout(G),L.current&&j(!1)}},[o]),w=v.useCallback(()=>{if(k.current)return k.current;const O=V().finally(()=>{k.current=null});return k.current=O,O},[V]),D=v.useCallback(()=>{B.current==null&&(B.current=setInterval(()=>{w()},r))},[r,w]),A=v.useCallback(()=>{B.current!=null&&(clearInterval(B.current),B.current=null)},[]);return v.useEffect(()=>{L.current=!0,(T.current==null||Date.now()-T.current>u)&&nb(()=>void w()),(typeof document>"u"||document.visibilityState!=="hidden")&&D();const q=()=>{if(I.current&&(clearTimeout(I.current),I.current=null),document.visibilityState==="hidden"){A();return}I.current=setTimeout(()=>{I.current=null,(T.current==null||Date.now()-T.current>u)&&w(),D()},i)};return typeof document<"u"&&document.addEventListener("visibilitychange",q),()=>{L.current=!1,typeof document<"u"&&document.removeEventListener("visibilitychange",q),I.current&&clearTimeout(I.current),A()}},[]),{updates:m,updatesMap:h,updateCount:p,isRefreshing:g,lastFetchAt:S,error:M,refresh:w}}const lb={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list",updateNotificationDismissed:!1};function rb(a,r){switch(r.type){case"SELECT_SKILL":return{...a,selectedSkill:r.skill,mode:"browse",mobileView:a.isMobile?"detail":a.mobileView};case"CLEAR_SELECTION":return{...a,selectedSkill:null};case"SET_MODE":return{...a,mode:r.mode,selectedSkill:r.mode==="create"?null:a.selectedSkill};case"SET_SEARCH":return{...a,searchQuery:r.query};case"SET_SKILLS":return{...a,skills:r.skills,skillsLoading:!1,skillsError:null};case"SET_SKILLS_ERROR":return{...a,skillsError:r.error,skillsLoading:!1};case"SET_SKILLS_LOADING":return{...a,skillsLoading:r.loading};case"SET_MOBILE":return{...a,isMobile:r.isMobile};case"SET_MOBILE_VIEW":return{...a,mobileView:r.view};case"DISMISS_UPDATE_NOTIFICATION":return{...a,updateNotificationDismissed:!0};default:return a}}const lv=v.createContext(null);function ya(){const a=v.useContext(lv);if(!a)throw new Error("useStudio must be used within StudioProvider");return a}function sb({children:a}){const[r,i]=v.useReducer(rb,lb),o=W1("(max-width: 767px)");v.useEffect(()=>{i({type:"SET_MOBILE",isMobile:o})},[o]);const[u,m]=v.useState(()=>{try{const L=window.localStorage.getItem("vskill.studio.prefs");if(!L)return null;const V=JSON.parse(L);return typeof V.activeAgent=="string"?V.activeAgent:null}catch{return null}});v.useEffect(()=>{function L(V){if(!(V instanceof CustomEvent))return;const w=V.detail;w!=null&&w.agentId&&m(w.agentId)}return window.addEventListener("studio:agent-changed",L),()=>window.removeEventListener("studio:agent-changed",L)},[]);const f=v.useCallback(()=>{i({type:"SET_SKILLS_LOADING",loading:!0});const L=u?{agent:u}:void 0;Ne.getSkills(L).then(V=>{i({type:"SET_SKILLS",skills:V});const D=window.location.hash.match(/^#\/skills\/([^/]+)\/([^/?]+)/);if(D){const[,A,O]=D,G=V.find(q=>q.plugin===A&&q.skill===O);G&&i({type:"SELECT_SKILL",skill:{plugin:A,skill:O,origin:G.origin}})}}).catch(V=>i({type:"SET_SKILLS_ERROR",error:V.message}))},[u]);v.useEffect(()=>{f()},[f]);const h=v.useCallback(L=>{i({type:"SELECT_SKILL",skill:L}),window.location.hash=`/skills/${L.plugin}/${L.skill}`},[]),x=v.useCallback(()=>{i({type:"CLEAR_SELECTION"}),window.location.hash.startsWith("#/skills/")&&history.replaceState(null,"",window.location.pathname+window.location.search)},[]),p=v.useCallback(L=>{i({type:"SET_MODE",mode:L})},[]),y=v.useCallback(L=>{i({type:"SET_SEARCH",query:L})},[]),g=v.useCallback(L=>{i({type:"SET_MOBILE_VIEW",view:L})},[]),j=v.useCallback(()=>{i({type:"DISMISS_UPDATE_NOTIFICATION"})},[]),S=ab(),N=v.useMemo(()=>{const L=r.skills.map(V=>{if(!V.updateAvailable&&V.latestVersion===void 0)return V;const w={...V};return delete w.updateAvailable,delete w.currentVersion,delete w.latestVersion,w});return K1(L,S.updates)},[r.skills,S.updates]),M=v.useMemo(()=>{const L={source:0,installed:0};for(const V of N)V.updateAvailable&&(L[V.origin]+=1);return L},[N]),E=v.useMemo(()=>({...r,skills:N}),[r,N]),k=S.updateCount,T=S.refresh,B=S.isRefreshing,I=v.useMemo(()=>({state:E,selectSkill:h,clearSelection:x,setMode:p,setSearch:y,setMobileView:g,refreshSkills:f,updateCount:k,dismissUpdateNotification:j,updates:S.updates,outdatedByOrigin:M,isRefreshingUpdates:B,refreshUpdates:T}),[E,h,x,p,y,g,f,k,j,S.updates,M,B,T]);return n.jsx(lv.Provider,{value:I,children:a})}const ib={config:null,loading:!0};function ob(a,r){switch(r.type){case"SET_CONFIG":return{config:r.config,loading:!1};case"SET_LOADING":return{...a,loading:!0};default:return a}}const rv=v.createContext(null);function bl(){const a=v.useContext(rv);if(!a)throw new Error("useConfig must be used within ConfigProvider");return a}function cb({children:a}){const[r,i]=v.useReducer(ob,ib),o=v.useCallback(()=>{Ne.getConfig().then(f=>i({type:"SET_CONFIG",config:f})).catch(()=>{})},[]);v.useEffect(()=>{o()},[o]);const u=v.useCallback(async(f,h)=>{const x=await Ne.setConfig(f,h);return i({type:"SET_CONFIG",config:x}),x},[]),m=v.useMemo(()=>({config:r.config,loading:r.loading,updateConfig:u,refreshConfig:o}),[r,u,o]);return n.jsx(rv.Provider,{value:m,children:a})}function ub({topRail:a,sidebar:r,main:i,statusBar:o,resizeHandle:u,banner:m,liveMessage:f,sidebarWidth:h=320,sidebarHidden:x=!1}){const p={"--top-rail-height":"48px","--status-bar-height":"28px","--sidebar-width":`${h}px`,display:"grid",gridTemplateRows:"var(--top-rail-height) 1fr var(--status-bar-height)",height:"100vh",overflow:"hidden",background:"var(--bg-canvas)",color:"var(--text-primary)"},y={display:"grid",gridTemplateColumns:x?"1fr":"var(--sidebar-width) auto 1fr",minHeight:0,overflow:"hidden"};return n.jsxs("div",{className:"studio-shell",style:p,children:[m,n.jsx("header",{style:{borderBottom:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:a}),n.jsxs("div",{style:y,children:[!x&&n.jsx("aside",{"aria-label":"Skills sidebar",style:{minHeight:0,overflow:"hidden",borderRight:u?"none":"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",flexDirection:"column"},children:r}),!x&&u,n.jsx("main",{style:{minHeight:0,overflow:"auto",background:"var(--bg-canvas)"},children:i})]}),n.jsx("footer",{role:"contentinfo",style:{borderTop:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:o}),n.jsx("div",{"aria-live":"polite",role:"status",style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0},children:f??""})]})}var fo=av();const db=nv(fo),Wh=["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed","ollama","lm-studio"],fb={"claude-cli":".claude",cursor:".cursor","codex-cli":".codex","gemini-cli":".gemini",copilot:".github",zed:".zed"},pb={"claude-cli":"claude",cursor:"cursor","codex-cli":"codex","gemini-cli":"gemini"},mb={"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"},hb={"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 xb(a,r){var h,x;const i=fb[a.id]??null,o=pb[a.id]??null,u=i?!!((h=r==null?void 0:r.wrapperFolders)!=null&&h[i]):!1,m=o?!!((x=r==null?void 0:r.binaries)!=null&&x[o]):!0,f=a.models.map(p=>({id:p.id,displayName:p.label,billingMode:hb[a.id]??"per-token"}));return{id:a.id,displayName:vb(a.id,a.label),wrapperFolder:i,wrapperFolderPresent:u,binaryAvailable:m,endpointReachable:a.id==="ollama"||a.id==="lm-studio"?a.available:null,available:a.available,ctaType:a.available?null:mb[a.id]??null,models:f}}function vb(a,r){return{"claude-cli":"Claude Code",anthropic:"Anthropic API",openrouter:"OpenRouter",cursor:"Cursor","codex-cli":"Codex CLI","gemini-cli":"Gemini CLI",copilot:"GitHub Copilot",zed:"Zed",ollama:"Ollama","lm-studio":"LM Studio"}[a]??r}function gb(a){const r=new Map(a.map(o=>[o.id,o])),i=[];for(const o of Wh){const u=r.get(o);u&&i.push(u)}for(const o of a)Wh.includes(o.id)||i.push(o);return i}function yb(a){const[r,i]=v.useState(null),[o,u]=v.useState("loading"),[m,f]=v.useState(null),h=v.useRef(null),x=v.useRef(0),p=v.useCallback(async()=>{try{const N=await fetch("/api/config");if(!N.ok)throw new Error(`/api/config returned ${N.status}`);const M=await N.json(),E=gb((M.providers||[]).map(k=>xb(k,M.detection)));i({agents:E,activeAgent:M.provider??null,activeModel:M.model??null}),u("ready"),f(null)}catch(N){u("error"),f(N.message)}},[]);v.useEffect(()=>{p()},[p]);const y=v.useCallback(async()=>{const N=Date.now();if(!(N-x.current<5*6e4))try{const M=await fetch("/api/openrouter/models");if(!M.ok)return;const E=await M.json();x.current=N,i(k=>{if(!k)return k;const T=k.agents.map(B=>{if(B.id!=="openrouter")return B;const I=E.models.map(V=>({id:V.id,displayName:V.name,contextWindow:V.contextWindow,pricing:V.pricing,billingMode:"per-token"}));return{...B,models:I,catalogAgeMs:E.ageSec?E.ageSec*1e3:0,cacheStale:!!E.stale}});return{...k,agents:T}}),E.stale&&(a!=null&&a.onStaleCatalog)&&a.onStaleCatalog("openrouter",(E.ageSec??0)*1e3)}catch{}},[a]),g=v.useCallback(N=>{h.current=N,N==="openrouter"&&y()},[y]),j=v.useCallback(()=>{x.current=0,p()},[p]),S=v.useCallback(async(N,M)=>{(await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:N,model:M})})).ok&&i(k=>k&&{...k,activeAgent:N,activeModel:M})},[]);return{status:o,catalog:r,error:m,focusAgent:g,refresh:j,activeAgentId:(r==null?void 0:r.activeAgent)??null,activeModelId:(r==null?void 0:r.activeModel)??null,setActive:S}}function Vu({variant:a,label:r,onActivate:i,installUrl:o}){function u(f){if(f.stopPropagation(),a==="cli-install"&&o){window.open(o,"_blank","noopener,noreferrer");return}i()}function m(f){(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),u(f))}return n.jsx("button",{type:"button","data-testid":`locked-cta-${a}`,onClick:u,onKeyDown:m,className:"inline-flex items-center gap-1.5 px-0 py-0 text-[11px] font-medium",style:{color:"var(--accent, var(--text-primary))",background:"transparent",border:"none",cursor:"pointer"},"aria-label":r,children:r})}function id({unlocked:a=!1,size:r=10}){return a?n.jsxs("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[n.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),n.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 3.5"})]}):n.jsxs("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[n.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),n.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 4.5V7"})]})}const bb={sectionOwn:"Own",sectionInstalled:"Installed",searchPlaceholder:"Search skills",searchShortcutHint:"Press / to search",emptyOwnHeadline:"No skills yet.",emptyOwnBody:"Run vskill new <name> to create one.",emptyInstalledHeadline:"No installed skills.",emptyInstalledBody:"Run vskill install <plugin> to add one.",emptyFilteredHeadline:"No matches in this section.",emptyFilteredBody:"Clear the search or try another query.",loadErrorHeadline:"Couldn't load skills.",loadErrorRetry:"Retry",duplicateBadge:"synced from Own",updateAvailableBadge:"Update available",countBadgeFiltered:(a,r)=>`${a} of ${r}`},jb={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"},Sb={tabOverview:"Overview",tabVersions:"Versions",tabBenchmark:"Benchmark",emptyHeadline:"Select a skill to see details.",emptyBody:"Pick one from the sidebar.",loadErrorHeadline:a=>`Couldn't load SKILL.md for ${a}.`,loadErrorBody:"Check the file path and your workspace permissions.",openInEditor:"Open in editor",copyPath:"Copy path",copyConfigSnippet:"Copy config snippet",depNotInstalledTooltip:"Not installed",missingValue:"—",announceViewingOwn:a=>`Viewing ${a} (Own)`,announceViewingInstalled:a=>`Viewing ${a} (Installed)`,moreFields:"More fields",sourceAgent:"Source agent",noMcpDependencies:"No MCP dependencies.",filesystemGroup:"Filesystem",benchmarkGroup:"Benchmark",metadataGroup:"Frontmatter"},kb={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."},wb={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"},Cb={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"},Nb={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."},Eb={disconnected:"Disconnected — reconnecting…",reconnected:"Reconnected.",loading:"Loading skills…",loadingPlaceholderCount:"—"},Tb={fieldRequired:"This field is required.",nameInvalid:"Use letters, numbers, and hyphens.",descriptionRequired:"Description is required.",saveFailed:"Save failed. Check the form for errors."},Rb={boundaryHeadline:"Something broke in this view.",boundaryBody:"Reload the page to recover.",boundaryAction:"Reload"},Ab={triggerLabel:"Agent and model",popoverTitle:"Select agent and model",footerHint:"↑↓ navigate · Enter select · Esc close",settingsButton:"Settings",keyboardShortcut:"⌘K",noModelsYet:"No models yet.",searchPlaceholder:"Search 300+ models…",noMatches:a=>`No models match "${a}"`,clearSearch:"Clear",currentlyActive:"Currently active"},Mb={claudeCli:{name:"Claude Code",caption:"Delegates to the `claude` CLI — your existing Claude Code session handles quota.",missingBinary:"Claude Code not found. Install it: `npm install -g @anthropic-ai/claude-code`. Or choose a provider with an API key.",installCta:"Install Claude Code →",installUrl:"https://docs.claude.com/en/docs/claude-code"},anthropic:{name:"Anthropic API",caption:"Direct access via your Anthropic API key.",addKeyCta:"Add API key →",keyIssuanceUrl:"https://platform.claude.com/settings/keys",keyPrefix:"sk-ant-"},openrouter:{name:"OpenRouter",caption:"300+ models from every major vendor.",addKeyCta:"Add API key →",emptyCardBody:"Add your OpenRouter API key to browse 300+ models",keyIssuanceUrl:"https://openrouter.ai/settings/keys",keyPrefix:"sk-or-"},cursor:{name:"Cursor",caption:"Cursor IDE composer.",installCta:"Install Cursor →"},codexCli:{name:"Codex CLI",caption:"OpenAI Codex CLI.",installCta:"Install Codex CLI →"},geminiCli:{name:"Gemini CLI",caption:"Google Gemini CLI.",installCta:"Install Gemini CLI →"},copilot:{name:"GitHub Copilot",caption:"GitHub Copilot CLI.",installCta:"Install Copilot →"},zed:{name:"Zed",caption:"Zed editor.",installCta:"Install Zed →"},ollama:{name:"Ollama",caption:"Local models, free.",startServiceCta:"Start service →"},lmStudio:{name:"LM Studio",caption:"Local models, free.",startServiceCta:"Start service →"}},Db={subscriptionBilling:"· subscription",free:"· free"},zb={title:"Settings",sectionApiKeys:"API Keys",sectionStorage:"Storage",banner:"Keys are stored locally on this device only. Never synced, never committed to git, never transmitted off-device except to the provider's own API.",storageBrowser:"Browser storage (default)",storageKeychain:"macOS Keychain (recommended)",storageDarwinOnly:"macOS Keychain is only available on macOS",show:"Show",hide:"Hide",paste:"Paste",save:"Save",remove:"Remove",removeConfirm:a=>`Remove ${a} API key?`,keyStoredAt:a=>`Key stored locally — updated ${a}`,noKey:"No key stored",enterNonEmpty:"Enter a non-empty key",prefixWarn:a=>`This doesn't look like a typical ${a} key. Save anyway?`,keySaved:a=>`${a} API key saved (local only, never synced)`,keyRemoved:a=>`${a} API key removed`},Lb={providersLabel:"Providers",providerSummary:(a,r)=>`${a}/${r} providers`,locked:a=>`${a} — locked. Click to add a key.`,lockedCli:a=>`${a} — locked. Click for install instructions.`,unlocked:a=>`${a} — unlocked.`},_b={triggerAriaLabel:"Choose active agent for the sidebar",popoverTitle:"Choose active agent",statsInstalled:"Installed",statsGlobal:"Global",statsLastSync:"Last sync",statsHealthOk:"Fresh",statsHealthStale:"Updates available",statsHealthMissing:"Not detected",switchCta:"Switch for this studio session",notDetectedSubheading:"Not detected",setUpCta:a=>`Set up ${a}`,sharedFolderBanner:a=>`Shared folder — consumed by ${a}`},Ob={ownLabel:"Own",installedLabel:"Installed",globalLabel:"Global",emptyOwn:"No authored skills — run vskill new.",emptyInstalled:a=>`No skills installed for ${a} in this project — run vskill install.`,emptyGlobal:a=>`No global skills for ${a} — run vskill install --global.`},Bb={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"},Ub={title:a=>`Set up ${a}`,close:"Close",copy:"Copy",copied:"Copied",requiredEnv:"Required env vars",getKey:"Get a key",installRun:"Install & run",learnMore:"Learn more",fallbackTitle:"No setup guide available",fallbackBody:"We don't ship a setup guide for this provider yet."},Hb={groupAvailable:"Available",groupAuthoring:"Authoring",sourceProject:"Project",sourcePersonal:"Personal",sourcePlugin:"Plugins",authoringSkills:"Skills"},Ib={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"}},Z={sidebar:bb,shell:jb,detail:Sb,actions:kb,palette:wb,shortcuts:Cb,toasts:Nb,connection:Eb,forms:Tb,errors:Rb,picker:Ab,providers:Mb,models:Db,settings:zb,statusBar:Lb,scopePicker:_b,scopeSection:Ob,claudeCodeLabel:Bb,setupDrawer:Ub,setupProviders:Ib,scopeLabels:Hb},Qh=new Set(["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed"]);function Vb({agents:a,activeAgentId:r,focusedAgentId:i,onFocus:o,onSelect:u,onOpenSettings:m}){const f=a.filter(x=>Qh.has(x.id)),h=a.filter(x=>!Qh.has(x.id));return n.jsxs("div",{role:"listbox","aria-label":"Agent","data-testid":"agent-list",style:{width:240,borderRight:"1px solid var(--border-default, var(--border-subtle))",display:"flex",flexDirection:"column",overflowY:"auto"},children:[f.map(x=>n.jsx(Xh,{agent:x,isActive:x.id===r,isFocused:x.id===i,onFocus:o,onSelect:u,onOpenSettings:m},x.id)),h.length>0&&n.jsx("div",{style:{borderTop:"1px solid var(--border-default, var(--border-subtle))",margin:"4px 0"},"aria-hidden":"true"}),h.map(x=>n.jsx(Xh,{agent:x,isActive:x.id===r,isFocused:x.id===i,onFocus:o,onSelect:u,onOpenSettings:m},x.id))]})}function Xh({agent:a,isActive:r,isFocused:i,onFocus:o,onSelect:u,onOpenSettings:m}){const{providers:f}=Z,h={"claude-cli":f.claudeCli.caption,anthropic:f.anthropic.caption,openrouter:f.openrouter.caption},x={"claude-cli":{label:f.claudeCli.installCta,url:f.claudeCli.installUrl},cursor:{label:f.cursor.installCta},"codex-cli":{label:f.codexCli.installCta},"gemini-cli":{label:f.geminiCli.installCta},copilot:{label:f.copilot.installCta},zed:{label:f.zed.installCta}},p=a.id==="claude-cli"||a.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:i?"var(--surface-muted, var(--surface-3))":"transparent",borderLeft:r?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",fontSize:13,fontWeight:r?500:400,color:"var(--text-primary)"};return r&&(y.background="color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)"),n.jsxs("div",{role:"option","aria-selected":r,"data-testid":`agent-row-${a.id}`,"data-focused":i||void 0,tabIndex:i?0:-1,onMouseEnter:()=>o(a.id),onFocus:()=>o(a.id),onClick:()=>u(a.id),style:y,children:[a.wrapperFolder&&n.jsx("span",{"data-testid":`wrapper-dot-${a.id}`,"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",flexShrink:0,background:a.wrapperFolderPresent?"var(--accent, var(--color-accent))":"transparent",border:a.wrapperFolderPresent?"none":"1px solid var(--border-default, var(--border-subtle))"}}),!a.wrapperFolder&&n.jsx("span",{style:{width:6,height:6,flexShrink:0},"aria-hidden":"true"}),n.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[n.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.displayName}),(a.id==="claude-cli"||a.id==="claude-code")&&n.jsx("span",{"data-testid":"claude-code-billing-label",title:Z.claudeCodeLabel.tooltip,style:{fontSize:10,color:"var(--text-secondary, var(--text-tertiary))",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:1},children:Z.claudeCodeLabel.compactLabel})]}),n.jsx("span",{"aria-label":a.available?"available":"locked",style:{color:a.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0},children:a.available?n.jsx(id,{unlocked:!0,size:10}):n.jsx(id,{size:10})}),r&&n.jsx("span",{style:{fontSize:10,textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600,color:"var(--accent-ink, var(--accent))",flexShrink:0},"data-testid":`active-badge-${a.id}`,children:Z.picker.currentlyActive}),!a.available&&a.ctaType==="api-key"&&n.jsx(Vu,{variant:"api-key",label:a.id==="anthropic"?f.anthropic.addKeyCta:f.openrouter.addKeyCta,onActivate:()=>m(a.id)}),!a.available&&a.ctaType==="cli-install"&&x[a.id]&&n.jsx(Vu,{variant:"cli-install",label:x[a.id].label,installUrl:x[a.id].url,onActivate:()=>{}}),!a.available&&a.ctaType==="start-service"&&n.jsx(Vu,{variant:"start-service",label:a.id==="ollama"?f.ollama.startServiceCta:f.lmStudio.startServiceCta,onActivate:()=>m(a.id)}),h[a.id]&&n.jsx("span",{className:"sr-only","data-testid":`caption-${a.id}`,children:h[a.id]})]})}function $b(a,r,i,o){const f=a>=80,h=v.useRef(null),[x,p]=v.useState(0),y=v.useCallback(S=>{p(S.currentTarget.scrollTop)},[]),{visibleStart:g,visibleEnd:j}=v.useMemo(()=>{if(!f)return{visibleStart:0,visibleEnd:a};const S=Math.max(0,Math.floor(x/r)-4),N=Math.ceil(i/r)+8,M=Math.min(a,S+N);return{visibleStart:S,visibleEnd:M}},[f,x,r,i,a,4]);return{visibleStart:g,visibleEnd:j,totalHeight:a*r,offsetTop:g*r,virtualised:f,containerProps:{onScroll:y,ref:h,style:{overflowY:"auto",maxHeight:i,willChange:f?"transform":void 0}}}}const sv=44,Gb=352,Pb=60;function qb(a){var m,f;const r=a.contextWindow?a.contextWindow>=1e6?`${Math.round(a.contextWindow/1e6)}M`:a.contextWindow>=1e3?`${Math.round(a.contextWindow/1e3)}k`:String(a.contextWindow):null;if(a.billingMode==="subscription")return r?`${r} ctx ${Z.models.subscriptionBilling}`:Z.models.subscriptionBilling.trim();if(a.billingMode==="free")return r?`local · ${r} ctx · free`:"local · free";const i=((m=a.pricing)==null?void 0:m.prompt)??0,o=((f=a.pricing)==null?void 0:f.completion)??0,u=`$${i.toFixed(2)} / $${o.toFixed(2)} per 1M tokens`;return r?`${r} ctx · ${u}`:u}function Yb(a,r){if(!r)return a;const i=r.toLowerCase();return a.filter(u=>u.displayName.toLowerCase().includes(i)).sort((u,m)=>{const f=u.displayName.toLowerCase().indexOf(i),h=m.displayName.toLowerCase().indexOf(i);return f!==h?f-h:u.displayName.length-m.displayName.length})}function Fb({agent:a,activeModelId:r,onSelect:i,onOpenSettings:o}){const[u,m]=v.useState(""),[f,h]=v.useState(""),x=v.useRef(null);if(v.useEffect(()=>{const g=setTimeout(()=>h(u),Pb);return()=>clearTimeout(g)},[u]),v.useEffect(()=>{a.id==="openrouter"&&a.available&&x.current&&x.current.focus()},[a.id,a.available]),a.id==="openrouter"&&!a.available)return n.jsxs("div",{"data-testid":"openrouter-empty-card",style:{width:360,padding:20,display:"flex",flexDirection:"column",gap:12},children:[n.jsx("p",{style:{margin:0,color:"var(--text-primary)",fontSize:13,lineHeight:1.5},children:Z.providers.openrouter.emptyCardBody}),n.jsx("button",{type:"button",onClick:()=>o("openrouter"),style:{alignSelf:"flex-start",padding:"6px 10px",borderRadius:6,background:"var(--accent, var(--color-accent))",color:"var(--bg-surface, white)",border:"none",fontSize:12,fontWeight:500,cursor:"pointer"},children:Z.providers.openrouter.addKeyCta})]});const p=v.useMemo(()=>Yb(a.models,f),[a.models,f]),y=$b(p.length,sv,Gb);return n.jsxs("div",{role:"listbox","aria-label":"Model","data-testid":"model-list",style:{width:360,display:"flex",flexDirection:"column"},children:[a.id==="openrouter"&&n.jsx("div",{style:{padding:8,borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:n.jsx("input",{ref:x,type:"text",placeholder:Z.picker.searchPlaceholder,value:u,onChange:g=>m(g.target.value),"data-testid":"model-search-input","aria-label":Z.picker.searchPlaceholder,style:{width:"100%",padding:"6px 8px",background:"var(--surface-2, var(--bg-surface))",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif"}})}),p.length===0&&f?n.jsxs("div",{style:{padding:16},"data-testid":"no-matches",children:[n.jsx("div",{style:{color:"var(--text-muted, var(--text-tertiary))",fontSize:12,marginBottom:8},children:Z.picker.noMatches(f)}),n.jsx("button",{type:"button",onClick:()=>m(""),style:{padding:"4px 8px",background:"transparent",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:Z.picker.clearSearch})]}):p.length===0?n.jsx("div",{style:{padding:16,color:"var(--text-muted, var(--text-tertiary))",fontSize:12},children:Z.picker.noModelsYet}):n.jsx("div",{...y.containerProps,children:n.jsx("div",{style:{height:y.virtualised?y.totalHeight:"auto",position:"relative"},children:n.jsx("div",{style:{transform:y.virtualised?`translateY(${y.offsetTop}px)`:void 0},children:p.slice(y.visibleStart,y.visibleEnd).map(g=>n.jsx(Kb,{model:g,isActive:g.id===r,onSelect:()=>i(g.id)},g.id))})})})]})}function Kb({model:a,isActive:r,onSelect:i}){const o=qb(a);return n.jsxs("button",{type:"button",role:"option","aria-selected":r,"data-testid":`model-row-${a.id}`,onClick:i,title:a.id,style:{width:"100%",height:sv,padding:"4px 12px",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:2,background:r?"color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)":"transparent",borderLeft:r?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",cursor:"pointer",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",textAlign:"left"},children:[n.jsx("span",{style:{fontSize:14,fontWeight:500,color:"var(--text-primary)"},children:a.displayName}),n.jsx("span",{style:{fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace",fontVariantNumeric:"tabular-nums",color:"var(--text-muted, var(--text-tertiary))"},children:o})]})}const Zh={anthropic:{stored:!1,updatedAt:null,tier:"browser"},openrouter:{stored:!1,updatedAt:null,tier:"browser"}};function Wb(){const[a,r]=v.useState(null),[i,o]=v.useState(!0),[u,m]=v.useState(null),f=v.useCallback(async()=>{o(!0);try{const p=await fetch("/api/settings/keys");if(!p.ok)throw new Error(`GET /api/settings/keys returned ${p.status}`);const y=await p.json();r({...Zh,...y}),m(null)}catch(p){m(p.message),r(Zh)}finally{o(!1)}},[]);v.useEffect(()=>{f()},[f]);const h=v.useCallback(async(p,y,g="browser")=>{const j=await fetch("/api/settings/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:p,key:y,tier:g})});if(!j.ok){const N=await j.json().catch(()=>({error:j.statusText}));throw new Error(N.error||`POST /api/settings/keys returned ${j.status}`)}const S=await j.json();return await f(),S},[f]),x=v.useCallback(async 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:a,loading:i,error:u,save:h,remove:x,refresh:f}}const Qb=[{id:"anthropic",name:Z.providers.anthropic.name,keyIssuanceUrl:Z.providers.anthropic.keyIssuanceUrl,prefix:Z.providers.anthropic.keyPrefix},{id:"openrouter",name:Z.providers.openrouter.name,keyIssuanceUrl:Z.providers.openrouter.keyIssuanceUrl,prefix:Z.providers.openrouter.keyPrefix}];function Xb(){return typeof navigator>"u"?!1:/Mac|iPhone|iPad/.test(navigator.platform)}function Zb(a){const r=Date.now()-new Date(a).getTime();return r<6e4?"just now":r<36e5?`${Math.round(r/6e4)}m ago`:r<864e5?`${Math.round(r/36e5)}h ago`:new Date(a).toLocaleString()}function Jb({open:a,onClose:r,initialProvider:i,onToast:o}){const{state:u,save:m,remove:f}=Wb(),[h,x]=v.useState("browser"),p=v.useRef(null),y=v.useRef(null),[g,j]=v.useState(i??"anthropic");if(v.useEffect(()=>{if(!a)return;const N=document.activeElement,M=setTimeout(()=>{var T;const E=i?`input[data-provider="${i}"]`:"input[data-provider]",k=(T=p.current)==null?void 0:T.querySelector(E);k==null||k.focus()},0);return()=>{var E;clearTimeout(M),(E=N==null?void 0:N.focus)==null||E.call(N)}},[a,i]),v.useEffect(()=>{if(!a)return;const N=M=>{if(M.key==="Escape"){M.preventDefault(),r();return}if(M.key==="Tab"&&p.current){const E=p.current.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(E.length===0)return;const k=E[0],T=E[E.length-1];M.shiftKey&&document.activeElement===k?(M.preventDefault(),T.focus()):!M.shiftKey&&document.activeElement===T&&(M.preventDefault(),k.focus())}};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[a,r]),!a)return null;const S=Xb();return n.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"settings-modal-title","data-testid":"settings-modal",style:{position:"fixed",inset:0,background:"color-mix(in srgb, black 40%, transparent)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},onClick:N=>{N.target===N.currentTarget&&r()},children:n.jsxs("div",{ref:p,style:{background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,width:560,maxHeight:"80vh",overflowY:"auto",padding:20,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",color:"var(--text-primary)"},onClick:N=>N.stopPropagation(),children:[n.jsx("h2",{id:"settings-modal-title",style:{margin:"0 0 16px 0",fontSize:16,fontWeight:600},children:Z.settings.title}),n.jsx("div",{role:"note","data-testid":"settings-banner",style:{padding:"8px 12px",borderRadius:6,background:"color-mix(in srgb, var(--info, var(--accent-muted)) 20%, transparent)",color:"var(--text-primary)",fontSize:12,marginBottom:16},children:Z.settings.banner}),n.jsxs("section",{"aria-labelledby":"settings-api-keys-title",style:{marginBottom:20},children:[n.jsx("h3",{id:"settings-api-keys-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:Z.settings.sectionApiKeys}),Qb.map(N=>n.jsx(e0,{providerId:N.id,providerName:N.name,keyIssuanceUrl:N.keyIssuanceUrl,prefix:N.prefix,metadata:u==null?void 0:u[N.id],tier:h,onSave:async M=>{const E=await m(N.id,M,h);return o==null||o(Z.settings.keySaved(N.name)),E},onRemove:async()=>{await f(N.id),o==null||o(Z.settings.keyRemoved(N.name))},inputRef:N.id===(i??"anthropic")?y:void 0},N.id))]}),n.jsxs("section",{"aria-labelledby":"settings-storage-title",children:[n.jsx("h3",{id:"settings-storage-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:Z.settings.sectionStorage}),S?n.jsxs("fieldset",{style:{border:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:6},children:[n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[n.jsx("input",{type:"radio",name:"storage-tier",value:"browser",checked:h==="browser",onChange:()=>x("browser")}),Z.settings.storageBrowser]}),n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[n.jsx("input",{type:"radio",name:"storage-tier",value:"keychain",checked:h==="keychain",onChange:()=>x("keychain")}),Z.settings.storageKeychain]})]}):n.jsxs("div",{style:{fontSize:12,color:"var(--text-muted, var(--text-tertiary))"},children:[Z.settings.storageBrowser,n.jsxs("span",{title:Z.settings.storageDarwinOnly,style:{marginLeft:8},children:["(",Z.settings.storageDarwinOnly,")"]})]})]}),n.jsx("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end"},children:n.jsx("button",{type:"button",onClick:r,style:{padding:"6px 12px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:"Close"})})]})})}function e0({providerId:a,providerName:r,keyIssuanceUrl:i,prefix:o,metadata:u,onSave:m,onRemove:f,inputRef:h}){const[x,p]=v.useState(""),[y,g]=v.useState(!1),[j,S]=v.useState(!1),[N,M]=v.useState(!1),[E,k]=v.useState(null),T=x.trim(),B=T.length===0,I=T.length>0&&!T.startsWith(o),L=v.useCallback(async()=>{if(!B){S(!0);try{const D=await m(T);D.warning?k(D.warning):k(null),p("")}finally{S(!1)}}},[B,m,T]),V=v.useCallback(async()=>{var D;try{if(!((D=navigator.clipboard)!=null&&D.readText))return;const A=await navigator.clipboard.readText();p(A)}catch{}},[]),w=v.useCallback(async()=>{M(!1),await f()},[f]);return n.jsxs("div",{"data-testid":`provider-row-${a}`,style:{padding:12,border:"1px solid var(--border-subtle)",borderRadius:6,marginBottom:8,display:"flex",flexDirection:"column",gap:8},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[n.jsx("strong",{style:{fontSize:13},children:r}),n.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",style:{fontSize:12,color:"var(--accent, var(--color-accent))"},children:"Get a key →"})]}),n.jsxs("div",{style:{display:"flex",gap:6},children:[n.jsx("input",{ref:h,type:y?"text":"password",value:x,onChange:D=>{p(D.target.value),k(null)},"data-provider":a,placeholder:`Paste ${r} key`,style:{flex:1,padding:"6px 8px",border:"1px solid var(--border-subtle)",borderRadius:4,background:"var(--surface-2, var(--bg-surface))",color:"var(--text-primary)",fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"}}),n.jsx("button",{type:"button",onClick:()=>g(!y),style:ir,children:y?Z.settings.hide:Z.settings.show}),n.jsx("button",{type:"button",onClick:V,style:ir,children:Z.settings.paste})]}),B&&x.length>0&&n.jsx("div",{role:"status",style:t0,children:Z.settings.enterNonEmpty}),I&&n.jsx("div",{role:"status","data-testid":`prefix-warn-${a}`,style:Jh,children:Z.settings.prefixWarn(r)}),E&&n.jsx("div",{role:"status",style:Jh,children:E}),n.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[n.jsx("button",{type:"button",onClick:L,disabled:B||j,"data-testid":`save-${a}`,style:{...ir,background:B?"var(--surface-2)":"var(--accent, var(--color-accent))",color:B?"var(--text-muted)":"white",cursor:B?"not-allowed":"pointer"},children:Z.settings.save}),(u==null?void 0:u.stored)&&n.jsx(n.Fragment,{children:N?n.jsxs(n.Fragment,{children:[n.jsx("span",{style:{fontSize:12},children:Z.settings.removeConfirm(r)}),n.jsx("button",{type:"button",onClick:w,"data-testid":`remove-confirm-${a}`,style:{...ir,background:"var(--danger, #b33)",color:"white"},children:"Confirm"}),n.jsx("button",{type:"button",onClick:()=>M(!1),style:ir,children:"Cancel"})]}):n.jsx("button",{type:"button",onClick:()=>M(!0),"data-testid":`remove-${a}`,style:{...ir,color:"var(--text-muted)"},children:Z.settings.remove})}),n.jsx("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},"data-testid":`status-${a}`,children:u!=null&&u.stored&&u.updatedAt?Z.settings.keyStoredAt(Zb(u.updatedAt)):Z.settings.noKey})]})]})}const ir={padding:"4px 8px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},t0={fontSize:11,color:"var(--danger, #b33)"},Jh={fontSize:11,color:"var(--warning, var(--text-muted))"};function n0(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function a0({onToast:a}){const{status:r,catalog:i,focusAgent:o,setActive:u}=yb({onStaleCatalog:(D,A)=>{const O=Math.round(A/6e4);a==null||a(`Using cached ${D} catalog (${O} min old)`)}}),[m,f]=v.useState(!1),[h,x]=v.useState(!1),[p,y]=v.useState(),[g,j]=v.useState(null),[S,N]=v.useState("agents"),M=v.useRef(null);v.useRef(null),v.useEffect(()=>{var D;i&&!g&&j(i.activeAgent??((D=i.agents[0])==null?void 0:D.id)??null)},[i,g]);const E=(i==null?void 0:i.agents)??[],k=v.useMemo(()=>E.find(D=>D.id===g)??E[0],[E,g]),T=v.useCallback(()=>{var D;f(!0),N("agents"),j((i==null?void 0:i.activeAgent)??((D=E[0])==null?void 0:D.id)??null)},[i,E]),B=v.useCallback(()=>{var D;f(!1),(D=M.current)==null||D.focus()},[]);v.useEffect(()=>{const D=A=>{var G;if(!(A.metaKey||A.ctrlKey)||A.key.toLowerCase()!=="k")return;const O=(G=document.activeElement)==null?void 0:G.tagName;O==="INPUT"||O==="TEXTAREA"||(A.preventDefault(),f(q=>!q))};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[]),v.useEffect(()=>{if(!m)return;const D=O=>{if(O.key==="Escape"){O.preventDefault(),B();return}if(O.key==="ArrowDown"){O.preventDefault(),A(1);return}if(O.key==="ArrowUp"){O.preventDefault(),A(-1);return}if(O.key==="ArrowRight"&&S==="agents"){O.preventDefault(),N("models");return}if(O.key==="ArrowLeft"&&S==="models"){O.preventDefault(),N("agents");return}if(O.key==="Enter"){O.preventDefault(),S==="agents"&&k?N("models"):S==="models"&&k&&k.models[0]&&(u(k.id,k.models[0].id),B());return}};function A(O){if(S==="agents"){const G=E.findIndex(te=>te.id===g),q=E[Math.max(0,Math.min(E.length-1,G+O))];q&&(j(q.id),o(q.id))}}return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[m,S,E,g,k,B,o,u]);const I=v.useCallback(D=>{y(D==="anthropic"||D==="openrouter"?D:void 0),x(!0),f(!1)},[]),L=E.find(D=>D.id===(i==null?void 0:i.activeAgent)),V=L==null?void 0:L.models.find(D=>D.id===(i==null?void 0:i.activeModel)),w=v.useMemo(()=>{if(r!=="ready"||!i)return"Loading…";const D=(L==null?void 0:L.displayName)??"Agent",A=(V==null?void 0:V.displayName)??i.activeModel??"Model";return`${D} · ${A}`},[r,i,L,V]);return n.jsxs(n.Fragment,{children:[n.jsxs("button",{ref:M,type:"button","data-testid":"agent-model-picker-trigger",onClick:()=>m?B():T(),"aria-haspopup":"listbox","aria-expanded":m,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 10px",background:"var(--surface-2, var(--bg-surface))",border:"1px solid var(--border-subtle)",borderRadius:6,color:"var(--text-primary)",fontSize:12,cursor:"pointer",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:L!=null&&L.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0}}),n.jsx("span",{children:w})]}),m&&typeof document<"u"&&fo.createPortal(n.jsxs(l0,{reducedMotion:n0(),onClickOutside:B,children:[n.jsxs("div",{style:{display:"flex",height:440,maxHeight:"60vh"},children:[n.jsx(Vb,{agents:E,activeAgentId:(i==null?void 0:i.activeAgent)??null,focusedAgentId:g,onFocus:D=>{j(D),o(D)},onSelect:D=>{j(D),o(D),N("models")},onOpenSettings:I}),k&&n.jsx(Fb,{agent:k,activeModelId:(i==null?void 0:i.activeModel)??null,onSelect:D=>{u(k.id,D),B()},onOpenSettings:I})]}),n.jsxs("div",{style:{height:32,borderTop:"1px solid var(--border-default, var(--border-subtle))",padding:"0 12px",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},children:[n.jsx("button",{type:"button",onClick:()=>I(),"data-testid":"picker-footer-settings",style:{background:"transparent",border:"none",color:"var(--text-primary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:Z.picker.settingsButton}),n.jsx("span",{style:{fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"},children:Z.picker.footerHint})]})]}),document.body),n.jsx(Jb,{open:h,onClose:()=>x(!1),initialProvider:p,onToast:a})]})}function l0({children:a,reducedMotion:r,onClickOutside:i}){const o=v.useRef(null);return v.useEffect(()=>{const u=m=>{o.current&&!o.current.contains(m.target)&&i()};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[i]),n.jsxs("div",{ref:o,"data-testid":"agent-model-picker-popover",role:"dialog","aria-label":"Select agent and model",style:{position:"fixed",top:56,left:"50%",transform:"translateX(-50%)",width:600,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,overflow:"hidden",zIndex:90,animation:r?void 0:"agentPickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[a,n.jsx("style",{children:`@keyframes agentPickerFadeIn {
49
+ `+s.stack}}var dt=Object.prototype.hasOwnProperty,Zt=a.unstable_scheduleCallback,ct=a.unstable_cancelCallback,Vt=a.unstable_shouldYield,$t=a.unstable_requestPaint,tt=a.unstable_now,jt=a.unstable_getCurrentPriorityLevel,ye=a.unstable_ImmediatePriority,Rt=a.unstable_UserBlockingPriority,De=a.unstable_NormalPriority,xt=a.unstable_LowPriority,Wt=a.unstable_IdlePriority,nt=a.log,Xa=a.unstable_setDisableYieldValue,Xn=null,Ct=null;function St(e){if(typeof nt=="function"&&Xa(e),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(Xn,e)}catch{}}var bt=Math.clz32?Math.clz32:In,Bn=Math.log,Za=Math.LN2;function In(e){return e>>>=0,e===0?32:31-(Bn(e)/Za|0)|0}var Ve=256,It=262144,Zn=4194304;function Nt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function br(e,t,l){var s=e.pendingLanes;if(s===0)return 0;var c=0,d=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var w=s&134217727;return w!==0?(s=w&~d,s!==0?c=Nt(s):(b&=w,b!==0?c=Nt(b):l||(l=w&~e,l!==0&&(c=Nt(l))))):(w=s&~d,w!==0?c=Nt(w):b!==0?c=Nt(b):l||(l=s&~e,l!==0&&(c=Nt(l)))),c===0?0:t!==0&&t!==c&&(t&d)===0&&(d=c&-c,l=t&-t,d>=l||d===32&&(l&4194048)!==0)?t:c}function wn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function bo(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 Vd(){var e=Zn;return Zn<<=1,(Zn&62914560)===0&&(Zn=4194304),e}function jo(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function jr(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function jg(e,t,l,s,c,d){var b=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var w=e.entanglements,H=e.expirationTimes,K=e.hiddenUpdates;for(l=b&~l;0<l;){var ne=31-bt(l),se=1<<ne;w[ne]=0,H[ne]=-1;var Q=K[ne];if(Q!==null)for(K[ne]=null,ne=0;ne<Q.length;ne++){var J=Q[ne];J!==null&&(J.lane&=-536870913)}l&=~se}s!==0&&$d(e,s,0),d!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=d&~(b&~t))}function $d(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-bt(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|l&261930}function Gd(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var s=31-bt(l),c=1<<s;c&t|e[s]&t&&(e[s]|=t),l&=~c}}function Pd(e,t){var l=t&-t;return l=(l&42)!==0?1:So(l),(l&(e.suspendedLanes|t))!==0?0:l}function So(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 ko(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function qd(){var e=O.p;return e!==0?e:(e=window.event,e===void 0?32:Mh(e.type))}function Yd(e,t){var l=O.p;try{return O.p=e,t()}finally{O.p=l}}var ba=Math.random().toString(36).slice(2),Gt="__reactFiber$"+ba,ln="__reactProps$"+ba,kl="__reactContainer$"+ba,wo="__reactEvents$"+ba,Sg="__reactListeners$"+ba,kg="__reactHandles$"+ba,Fd="__reactResources$"+ba,Sr="__reactMarker$"+ba;function Co(e){delete e[Gt],delete e[ln],delete e[wo],delete e[Sg],delete e[kg]}function wl(e){var t=e[Gt];if(t)return t;for(var l=e.parentNode;l;){if(t=l[kl]||l[Gt]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=hh(e);e!==null;){if(l=e[Gt])return l;e=hh(e)}return t}e=l,l=e.parentNode}return null}function Cl(e){if(e=e[Gt]||e[kl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function kr(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function Nl(e){var t=e[Fd];return t||(t=e[Fd]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ht(e){e[Sr]=!0}var Wd=new Set,Kd={};function Ja(e,t){El(e,t),El(e+"Capture",t)}function El(e,t){for(Kd[e]=t,e=0;e<t.length;e++)Wd.add(t[e])}var wg=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]*$"),Qd={},Xd={};function Cg(e){return dt.call(Xd,e)?!0:dt.call(Qd,e)?!1:wg.test(e)?Xd[e]=!0:(Qd[e]=!0,!1)}function _s(e,t,l){if(Cg(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+l)}}function Os(e,t,l){if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+l)}}function Jn(e,t,l,s){if(s===null)e.removeAttribute(l);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+s)}}function Cn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Zd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ng(e,t,l){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var c=s.get,d=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(b){l=""+b,d.call(this,b)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return l},setValue:function(b){l=""+b},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function No(e){if(!e._valueTracker){var t=Zd(e)?"checked":"value";e._valueTracker=Ng(e,t,""+e[t])}}function Jd(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),s="";return e&&(s=Zd(e)?e.checked?"true":"false":e.value),e=s,e!==l?(t.setValue(e),!0):!1}function Bs(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Eg=/[\n"\\]/g;function Nn(e){return e.replace(Eg,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Eo(e,t,l,s,c,d,b,w){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),t!=null?b==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Cn(t)):e.value!==""+Cn(t)&&(e.value=""+Cn(t)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),t!=null?To(e,b,Cn(t)):l!=null?To(e,b,Cn(l)):s!=null&&e.removeAttribute("value"),c==null&&d!=null&&(e.defaultChecked=!!d),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.name=""+Cn(w):e.removeAttribute("name")}function ef(e,t,l,s,c,d,b,w){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),t!=null||l!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){No(e);return}l=l!=null?""+Cn(l):"",t=t!=null?""+Cn(t):l,w||t===e.value||(e.value=t),e.defaultValue=t}s=s??c,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=w?e.checked:!!s,e.defaultChecked=!!s,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),No(e)}function To(e,t,l){t==="number"&&Bs(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Tl(e,t,l,s){if(e=e.options,t){t={};for(var c=0;c<l.length;c++)t["$"+l[c]]=!0;for(l=0;l<e.length;l++)c=t.hasOwnProperty("$"+e[l].value),e[l].selected!==c&&(e[l].selected=c),c&&s&&(e[l].defaultSelected=!0)}else{for(l=""+Cn(l),t=null,c=0;c<e.length;c++){if(e[c].value===l){e[c].selected=!0,s&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function tf(e,t,l){if(t!=null&&(t=""+Cn(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+Cn(l):""}function nf(e,t,l,s){if(t==null){if(s!=null){if(l!=null)throw Error(o(92));if(_(s)){if(1<s.length)throw Error(o(93));s=s[0]}l=s}l==null&&(l=""),t=l}l=Cn(t),e.defaultValue=l,s=e.textContent,s===l&&s!==""&&s!==null&&(e.value=s),No(e)}function Rl(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var Tg=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 af(e,t,l){var s=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,l):typeof l!="number"||l===0||Tg.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function lf(e,t,l){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,l!=null){for(var s in l)!l.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var c in t)s=t[c],t.hasOwnProperty(c)&&l[c]!==s&&af(e,c,s)}else for(var d in t)t.hasOwnProperty(d)&&af(e,d,t[d])}function Ro(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 Rg=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"]]),Ag=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Is(e){return Ag.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ea(){}var Ao=null;function Mo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Al=null,Ml=null;function rf(e){var t=Cl(e);if(t&&(e=t.stateNode)){var l=e[ln]||null;e:switch(e=t.stateNode,t.type){case"input":if(Eo(e,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),t=l.name,l.type==="radio"&&t!=null){for(l=e;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Nn(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var s=l[t];if(s!==e&&s.form===e.form){var c=s[ln]||null;if(!c)throw Error(o(90));Eo(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<l.length;t++)s=l[t],s.form===e.form&&Jd(s)}break e;case"textarea":tf(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&Tl(e,!!l.multiple,t,!1)}}}var Do=!1;function sf(e,t,l){if(Do)return e(t,l);Do=!0;try{var s=e(t);return s}finally{if(Do=!1,(Al!==null||Ml!==null)&&(Ci(),Al&&(t=Al,e=Ml,Ml=Al=null,rf(t),e)))for(t=0;t<e.length;t++)rf(e[t])}}function wr(e,t){var l=e.stateNode;if(l===null)return null;var s=l[ln]||null;if(s===null)return null;l=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(o(231,t,typeof l));return l}var ta=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),zo=!1;if(ta)try{var Cr={};Object.defineProperty(Cr,"passive",{get:function(){zo=!0}}),window.addEventListener("test",Cr,Cr),window.removeEventListener("test",Cr,Cr)}catch{zo=!1}var ja=null,Lo=null,Hs=null;function of(){if(Hs)return Hs;var e,t=Lo,l=t.length,s,c="value"in ja?ja.value:ja.textContent,d=c.length;for(e=0;e<l&&t[e]===c[e];e++);var b=l-e;for(s=1;s<=b&&t[l-s]===c[d-s];s++);return Hs=c.slice(e,1<s?1-s:void 0)}function Us(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Vs(){return!0}function cf(){return!1}function rn(e){function t(l,s,c,d,b){this._reactName=l,this._targetInst=c,this.type=s,this.nativeEvent=d,this.target=b,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(l=e[w],this[w]=l?l(d):d[w]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?Vs:cf,this.isPropagationStopped=cf,this}return g(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Vs)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Vs)},persist:function(){},isPersistent:Vs}),t}var el={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$s=rn(el),Nr=g({},el,{view:0,detail:0}),Mg=rn(Nr),_o,Oo,Er,Gs=g({},Nr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Io,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Er&&(Er&&e.type==="mousemove"?(_o=e.screenX-Er.screenX,Oo=e.screenY-Er.screenY):Oo=_o=0,Er=e),_o)},movementY:function(e){return"movementY"in e?e.movementY:Oo}}),uf=rn(Gs),Dg=g({},Gs,{dataTransfer:0}),zg=rn(Dg),Lg=g({},Nr,{relatedTarget:0}),Bo=rn(Lg),_g=g({},el,{animationName:0,elapsedTime:0,pseudoElement:0}),Og=rn(_g),Bg=g({},el,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Ig=rn(Bg),Hg=g({},el,{data:0}),df=rn(Hg),Ug={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Vg={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"},$g={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Gg(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=$g[e])?!!t[e]:!1}function Io(){return Gg}var Pg=g({},Nr,{key:function(e){if(e.key){var t=Ug[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Us(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Vg[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Io,charCode:function(e){return e.type==="keypress"?Us(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Us(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),qg=rn(Pg),Yg=g({},Gs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ff=rn(Yg),Fg=g({},Nr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Io}),Wg=rn(Fg),Kg=g({},el,{propertyName:0,elapsedTime:0,pseudoElement:0}),Qg=rn(Kg),Xg=g({},Gs,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Zg=rn(Xg),Jg=g({},el,{newState:0,oldState:0}),ey=rn(Jg),ty=[9,13,27,32],Ho=ta&&"CompositionEvent"in window,Tr=null;ta&&"documentMode"in document&&(Tr=document.documentMode);var ny=ta&&"TextEvent"in window&&!Tr,pf=ta&&(!Ho||Tr&&8<Tr&&11>=Tr),mf=" ",hf=!1;function xf(e,t){switch(e){case"keyup":return ty.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function vf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Dl=!1;function ay(e,t){switch(e){case"compositionend":return vf(t);case"keypress":return t.which!==32?null:(hf=!0,mf);case"textInput":return e=t.data,e===mf&&hf?null:e;default:return null}}function ly(e,t){if(Dl)return e==="compositionend"||!Ho&&xf(e,t)?(e=of(),Hs=Lo=ja=null,Dl=!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 pf&&t.locale!=="ko"?null:t.data;default:return null}}var ry={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 gf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!ry[e.type]:t==="textarea"}function yf(e,t,l,s){Al?Ml?Ml.push(s):Ml=[s]:Al=s,t=Di(t,"onChange"),0<t.length&&(l=new $s("onChange","change",null,l,s),e.push({event:l,listeners:t}))}var Rr=null,Ar=null;function sy(e){th(e,0)}function Ps(e){var t=kr(e);if(Jd(t))return e}function bf(e,t){if(e==="change")return t}var jf=!1;if(ta){var Uo;if(ta){var Vo="oninput"in document;if(!Vo){var Sf=document.createElement("div");Sf.setAttribute("oninput","return;"),Vo=typeof Sf.oninput=="function"}Uo=Vo}else Uo=!1;jf=Uo&&(!document.documentMode||9<document.documentMode)}function kf(){Rr&&(Rr.detachEvent("onpropertychange",wf),Ar=Rr=null)}function wf(e){if(e.propertyName==="value"&&Ps(Ar)){var t=[];yf(t,Ar,e,Mo(e)),sf(sy,t)}}function iy(e,t,l){e==="focusin"?(kf(),Rr=t,Ar=l,Rr.attachEvent("onpropertychange",wf)):e==="focusout"&&kf()}function oy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ps(Ar)}function cy(e,t){if(e==="click")return Ps(t)}function uy(e,t){if(e==="input"||e==="change")return Ps(t)}function dy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var fn=typeof Object.is=="function"?Object.is:dy;function Mr(e,t){if(fn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),s=Object.keys(t);if(l.length!==s.length)return!1;for(s=0;s<l.length;s++){var c=l[s];if(!dt.call(t,c)||!fn(e[c],t[c]))return!1}return!0}function Cf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Nf(e,t){var l=Cf(e);e=0;for(var s;l;){if(l.nodeType===3){if(s=e+l.textContent.length,e<=t&&s>=t)return{node:l,offset:t-e};e=s}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Cf(l)}}function Ef(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ef(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Tf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Bs(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=Bs(e.document)}return t}function $o(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 fy=ta&&"documentMode"in document&&11>=document.documentMode,zl=null,Go=null,Dr=null,Po=!1;function Rf(e,t,l){var s=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Po||zl==null||zl!==Bs(s)||(s=zl,"selectionStart"in s&&$o(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Dr&&Mr(Dr,s)||(Dr=s,s=Di(Go,"onSelect"),0<s.length&&(t=new $s("onSelect","select",null,t,l),e.push({event:t,listeners:s}),t.target=zl)))}function tl(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var Ll={animationend:tl("Animation","AnimationEnd"),animationiteration:tl("Animation","AnimationIteration"),animationstart:tl("Animation","AnimationStart"),transitionrun:tl("Transition","TransitionRun"),transitionstart:tl("Transition","TransitionStart"),transitioncancel:tl("Transition","TransitionCancel"),transitionend:tl("Transition","TransitionEnd")},qo={},Af={};ta&&(Af=document.createElement("div").style,"AnimationEvent"in window||(delete Ll.animationend.animation,delete Ll.animationiteration.animation,delete Ll.animationstart.animation),"TransitionEvent"in window||delete Ll.transitionend.transition);function nl(e){if(qo[e])return qo[e];if(!Ll[e])return e;var t=Ll[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in Af)return qo[e]=t[l];return e}var Mf=nl("animationend"),Df=nl("animationiteration"),zf=nl("animationstart"),py=nl("transitionrun"),my=nl("transitionstart"),hy=nl("transitioncancel"),Lf=nl("transitionend"),_f=new Map,Yo="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(" ");Yo.push("scrollEnd");function Hn(e,t){_f.set(e,t),Ja(t,[e])}var qs=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},En=[],_l=0,Fo=0;function Ys(){for(var e=_l,t=Fo=_l=0;t<e;){var l=En[t];En[t++]=null;var s=En[t];En[t++]=null;var c=En[t];En[t++]=null;var d=En[t];if(En[t++]=null,s!==null&&c!==null){var b=s.pending;b===null?c.next=c:(c.next=b.next,b.next=c),s.pending=c}d!==0&&Of(l,c,d)}}function Fs(e,t,l,s){En[_l++]=e,En[_l++]=t,En[_l++]=l,En[_l++]=s,Fo|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Wo(e,t,l,s){return Fs(e,t,l,s),Ws(e)}function al(e,t){return Fs(e,null,null,t),Ws(e)}function Of(e,t,l){e.lanes|=l;var s=e.alternate;s!==null&&(s.lanes|=l);for(var c=!1,d=e.return;d!==null;)d.childLanes|=l,s=d.alternate,s!==null&&(s.childLanes|=l),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(c=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,c&&t!==null&&(c=31-bt(l),e=d.hiddenUpdates,s=e[c],s===null?e[c]=[t]:s.push(t),t.lane=l|536870912),d):null}function Ws(e){if(50<es)throw es=0,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 Ol={};function xy(e,t,l,s){this.tag=e,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function pn(e,t,l,s){return new xy(e,t,l,s)}function Ko(e){return e=e.prototype,!(!e||!e.isReactComponent)}function na(e,t){var l=e.alternate;return l===null?(l=pn(e.tag,t,e.key,e.mode),l.elementType=e.elementType,l.type=e.type,l.stateNode=e.stateNode,l.alternate=e,e.alternate=l):(l.pendingProps=t,l.type=e.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=e.flags&65011712,l.childLanes=e.childLanes,l.lanes=e.lanes,l.child=e.child,l.memoizedProps=e.memoizedProps,l.memoizedState=e.memoizedState,l.updateQueue=e.updateQueue,t=e.dependencies,l.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},l.sibling=e.sibling,l.index=e.index,l.ref=e.ref,l.refCleanup=e.refCleanup,l}function Bf(e,t){e.flags&=65011714;var l=e.alternate;return l===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=l.childLanes,e.lanes=l.lanes,e.child=l.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=l.memoizedProps,e.memoizedState=l.memoizedState,e.updateQueue=l.updateQueue,e.type=l.type,t=l.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ks(e,t,l,s,c,d){var b=0;if(s=e,typeof e=="function")Ko(e)&&(b=1);else if(typeof e=="string")b=j1(e,l,de.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case R:return e=pn(31,l,t,c),e.elementType=R,e.lanes=d,e;case D:return ll(l.children,c,d,t);case T:b=8,c|=24;break;case k:return e=pn(12,l,t,c|2),e.elementType=k,e.lanes=d,e;case A:return e=pn(13,l,t,c),e.elementType=A,e.lanes=d,e;case U:return e=pn(19,l,t,c),e.elementType=U,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case B:b=10;break e;case M:b=9;break e;case V:b=11;break e;case C:b=14;break e;case z:b=16,s=null;break e}b=29,l=Error(o(130,e===null?"null":typeof e,"")),s=null}return t=pn(b,l,t,c),t.elementType=e,t.type=s,t.lanes=d,t}function ll(e,t,l,s){return e=pn(7,e,s,t),e.lanes=l,e}function Qo(e,t,l){return e=pn(6,e,null,t),e.lanes=l,e}function If(e){var t=pn(18,null,null,0);return t.stateNode=e,t}function Xo(e,t,l){return t=pn(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Hf=new WeakMap;function Tn(e,t){if(typeof e=="object"&&e!==null){var l=Hf.get(e);return l!==void 0?l:(t={value:e,source:t,stack:Me(t)},Hf.set(e,t),t)}return{value:e,source:t,stack:Me(t)}}var Bl=[],Il=0,Qs=null,zr=0,Rn=[],An=0,Sa=null,Pn=1,qn="";function aa(e,t){Bl[Il++]=zr,Bl[Il++]=Qs,Qs=e,zr=t}function Uf(e,t,l){Rn[An++]=Pn,Rn[An++]=qn,Rn[An++]=Sa,Sa=e;var s=Pn;e=qn;var c=32-bt(s)-1;s&=~(1<<c),l+=1;var d=32-bt(t)+c;if(30<d){var b=c-c%5;d=(s&(1<<b)-1).toString(32),s>>=b,c-=b,Pn=1<<32-bt(t)+c|l<<c|s,qn=d+e}else Pn=1<<d|l<<c|s,qn=e}function Zo(e){e.return!==null&&(aa(e,1),Uf(e,1,0))}function Jo(e){for(;e===Qs;)Qs=Bl[--Il],Bl[Il]=null,zr=Bl[--Il],Bl[Il]=null;for(;e===Sa;)Sa=Rn[--An],Rn[An]=null,qn=Rn[--An],Rn[An]=null,Pn=Rn[--An],Rn[An]=null}function Vf(e,t){Rn[An++]=Pn,Rn[An++]=qn,Rn[An++]=Sa,Pn=t.id,qn=t.overflow,Sa=e}var Pt=null,ft=null,We=!1,ka=null,Mn=!1,ec=Error(o(519));function wa(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Lr(Tn(t,e)),ec}function $f(e){var t=e.stateNode,l=e.type,s=e.memoizedProps;switch(t[Gt]=e,t[ln]=s,l){case"dialog":qe("cancel",t),qe("close",t);break;case"iframe":case"object":case"embed":qe("load",t);break;case"video":case"audio":for(l=0;l<ns.length;l++)qe(ns[l],t);break;case"source":qe("error",t);break;case"img":case"image":case"link":qe("error",t),qe("load",t);break;case"details":qe("toggle",t);break;case"input":qe("invalid",t),ef(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":qe("invalid",t);break;case"textarea":qe("invalid",t),nf(t,s.value,s.defaultValue,s.children)}l=s.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||s.suppressHydrationWarning===!0||rh(t.textContent,l)?(s.popover!=null&&(qe("beforetoggle",t),qe("toggle",t)),s.onScroll!=null&&qe("scroll",t),s.onScrollEnd!=null&&qe("scrollend",t),s.onClick!=null&&(t.onclick=ea),t=!0):t=!1,t||wa(e,!0)}function Gf(e){for(Pt=e.return;Pt;)switch(Pt.tag){case 5:case 31:case 13:Mn=!1;return;case 27:case 3:Mn=!0;return;default:Pt=Pt.return}}function Hl(e){if(e!==Pt)return!1;if(!We)return Gf(e),We=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||gu(e.type,e.memoizedProps)),l=!l),l&&ft&&wa(e),Gf(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));ft=mh(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));ft=mh(e)}else t===27?(t=ft,Ia(e.type)?(e=ku,ku=null,ft=e):ft=t):ft=Pt?zn(e.stateNode.nextSibling):null;return!0}function rl(){ft=Pt=null,We=!1}function tc(){var e=ka;return e!==null&&(un===null?un=e:un.push.apply(un,e),ka=null),e}function Lr(e){ka===null?ka=[e]:ka.push(e)}var nc=L(null),sl=null,la=null;function Ca(e,t,l){ie(nc,t._currentValue),t._currentValue=l}function ra(e){e._currentValue=nc.current,F(nc)}function ac(e,t,l){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===l)break;e=e.return}}function lc(e,t,l,s){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var d=c.dependencies;if(d!==null){var b=c.child;d=d.firstContext;e:for(;d!==null;){var w=d;d=c;for(var H=0;H<t.length;H++)if(w.context===t[H]){d.lanes|=l,w=d.alternate,w!==null&&(w.lanes|=l),ac(d.return,l,e),s||(b=null);break e}d=w.next}}else if(c.tag===18){if(b=c.return,b===null)throw Error(o(341));b.lanes|=l,d=b.alternate,d!==null&&(d.lanes|=l),ac(b,l,e),b=null}else b=c.child;if(b!==null)b.return=c;else for(b=c;b!==null;){if(b===e){b=null;break}if(c=b.sibling,c!==null){c.return=b.return,b=c;break}b=b.return}c=b}}function Ul(e,t,l,s){e=null;for(var c=t,d=!1;c!==null;){if(!d){if((c.flags&524288)!==0)d=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var b=c.alternate;if(b===null)throw Error(o(387));if(b=b.memoizedProps,b!==null){var w=c.type;fn(c.pendingProps.value,b.value)||(e!==null?e.push(w):e=[w])}}else if(c===oe.current){if(b=c.alternate,b===null)throw Error(o(387));b.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(is):e=[is])}c=c.return}e!==null&&lc(t,e,l,s),t.flags|=262144}function Xs(e){for(e=e.firstContext;e!==null;){if(!fn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function il(e){sl=e,la=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function qt(e){return Pf(sl,e)}function Zs(e,t){return sl===null&&il(e),Pf(e,t)}function Pf(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},la===null){if(e===null)throw Error(o(308));la=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else la=la.next=t;return l}var vy=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},gy=a.unstable_scheduleCallback,yy=a.unstable_NormalPriority,At={$$typeof:B,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function rc(){return{controller:new vy,data:new Map,refCount:0}}function _r(e){e.refCount--,e.refCount===0&&gy(yy,function(){e.controller.abort()})}var Or=null,sc=0,Vl=0,$l=null;function by(e,t){if(Or===null){var l=Or=[];sc=0,Vl=cu(),$l={status:"pending",value:void 0,then:function(s){l.push(s)}}}return sc++,t.then(qf,qf),t}function qf(){if(--sc===0&&Or!==null){$l!==null&&($l.status="fulfilled");var e=Or;Or=null,Vl=0,$l=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function jy(e,t){var l=[],s={status:"pending",value:null,reason:null,then:function(c){l.push(c)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var c=0;c<l.length;c++)(0,l[c])(t)},function(c){for(s.status="rejected",s.reason=c,c=0;c<l.length;c++)(0,l[c])(void 0)}),s}var Yf=E.S;E.S=function(e,t){Rm=tt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&by(e,t),Yf!==null&&Yf(e,t)};var ol=L(null);function ic(){var e=ol.current;return e!==null?e:ut.pooledCache}function Js(e,t){t===null?ie(ol,ol.current):ie(ol,t.pool)}function Ff(){var e=ic();return e===null?null:{parent:At._currentValue,pool:e}}var Gl=Error(o(460)),oc=Error(o(474)),ei=Error(o(542)),ti={then:function(){}};function Wf(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Kf(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(ea,ea),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Xf(e),e;default:if(typeof t.status=="string")t.then(ea,ea);else{if(e=ut,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=s}},function(s){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Xf(e),e}throw ul=t,Gl}}function cl(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(ul=l,Gl):l}}var ul=null;function Qf(){if(ul===null)throw Error(o(459));var e=ul;return ul=null,e}function Xf(e){if(e===Gl||e===ei)throw Error(o(483))}var Pl=null,Br=0;function ni(e){var t=Br;return Br+=1,Pl===null&&(Pl=[]),Kf(Pl,e,t)}function Ir(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ai(e,t){throw t.$$typeof===j?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Zf(e){function t(G,$){if(e){var W=G.deletions;W===null?(G.deletions=[$],G.flags|=16):W.push($)}}function l(G,$){if(!e)return null;for(;$!==null;)t(G,$),$=$.sibling;return null}function s(G){for(var $=new Map;G!==null;)G.key!==null?$.set(G.key,G):$.set(G.index,G),G=G.sibling;return $}function c(G,$){return G=na(G,$),G.index=0,G.sibling=null,G}function d(G,$,W){return G.index=W,e?(W=G.alternate,W!==null?(W=W.index,W<$?(G.flags|=67108866,$):W):(G.flags|=67108866,$)):(G.flags|=1048576,$)}function b(G){return e&&G.alternate===null&&(G.flags|=67108866),G}function w(G,$,W,re){return $===null||$.tag!==6?($=Qo(W,G.mode,re),$.return=G,$):($=c($,W),$.return=G,$)}function H(G,$,W,re){var Ee=W.type;return Ee===D?ne(G,$,W.props.children,re,W.key):$!==null&&($.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===z&&cl(Ee)===$.type)?($=c($,W.props),Ir($,W),$.return=G,$):($=Ks(W.type,W.key,W.props,null,G.mode,re),Ir($,W),$.return=G,$)}function K(G,$,W,re){return $===null||$.tag!==4||$.stateNode.containerInfo!==W.containerInfo||$.stateNode.implementation!==W.implementation?($=Xo(W,G.mode,re),$.return=G,$):($=c($,W.children||[]),$.return=G,$)}function ne(G,$,W,re,Ee){return $===null||$.tag!==7?($=ll(W,G.mode,re,Ee),$.return=G,$):($=c($,W),$.return=G,$)}function se(G,$,W){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return $=Qo(""+$,G.mode,W),$.return=G,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case S:return W=Ks($.type,$.key,$.props,null,G.mode,W),Ir(W,$),W.return=G,W;case N:return $=Xo($,G.mode,W),$.return=G,$;case z:return $=cl($),se(G,$,W)}if(_($)||q($))return $=ll($,G.mode,W,null),$.return=G,$;if(typeof $.then=="function")return se(G,ni($),W);if($.$$typeof===B)return se(G,Zs(G,$),W);ai(G,$)}return null}function Q(G,$,W,re){var Ee=$!==null?$.key:null;if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return Ee!==null?null:w(G,$,""+W,re);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case S:return W.key===Ee?H(G,$,W,re):null;case N:return W.key===Ee?K(G,$,W,re):null;case z:return W=cl(W),Q(G,$,W,re)}if(_(W)||q(W))return Ee!==null?null:ne(G,$,W,re,null);if(typeof W.then=="function")return Q(G,$,ni(W),re);if(W.$$typeof===B)return Q(G,$,Zs(G,W),re);ai(G,W)}return null}function J(G,$,W,re,Ee){if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return G=G.get(W)||null,w($,G,""+re,Ee);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case S:return G=G.get(re.key===null?W:re.key)||null,H($,G,re,Ee);case N:return G=G.get(re.key===null?W:re.key)||null,K($,G,re,Ee);case z:return re=cl(re),J(G,$,W,re,Ee)}if(_(re)||q(re))return G=G.get(W)||null,ne($,G,re,Ee,null);if(typeof re.then=="function")return J(G,$,W,ni(re),Ee);if(re.$$typeof===B)return J(G,$,W,Zs($,re),Ee);ai($,re)}return null}function Se(G,$,W,re){for(var Ee=null,Qe=null,ke=$,Ie=$=0,Fe=null;ke!==null&&Ie<W.length;Ie++){ke.index>Ie?(Fe=ke,ke=null):Fe=ke.sibling;var Xe=Q(G,ke,W[Ie],re);if(Xe===null){ke===null&&(ke=Fe);break}e&&ke&&Xe.alternate===null&&t(G,ke),$=d(Xe,$,Ie),Qe===null?Ee=Xe:Qe.sibling=Xe,Qe=Xe,ke=Fe}if(Ie===W.length)return l(G,ke),We&&aa(G,Ie),Ee;if(ke===null){for(;Ie<W.length;Ie++)ke=se(G,W[Ie],re),ke!==null&&($=d(ke,$,Ie),Qe===null?Ee=ke:Qe.sibling=ke,Qe=ke);return We&&aa(G,Ie),Ee}for(ke=s(ke);Ie<W.length;Ie++)Fe=J(ke,G,Ie,W[Ie],re),Fe!==null&&(e&&Fe.alternate!==null&&ke.delete(Fe.key===null?Ie:Fe.key),$=d(Fe,$,Ie),Qe===null?Ee=Fe:Qe.sibling=Fe,Qe=Fe);return e&&ke.forEach(function(Ga){return t(G,Ga)}),We&&aa(G,Ie),Ee}function Te(G,$,W,re){if(W==null)throw Error(o(151));for(var Ee=null,Qe=null,ke=$,Ie=$=0,Fe=null,Xe=W.next();ke!==null&&!Xe.done;Ie++,Xe=W.next()){ke.index>Ie?(Fe=ke,ke=null):Fe=ke.sibling;var Ga=Q(G,ke,Xe.value,re);if(Ga===null){ke===null&&(ke=Fe);break}e&&ke&&Ga.alternate===null&&t(G,ke),$=d(Ga,$,Ie),Qe===null?Ee=Ga:Qe.sibling=Ga,Qe=Ga,ke=Fe}if(Xe.done)return l(G,ke),We&&aa(G,Ie),Ee;if(ke===null){for(;!Xe.done;Ie++,Xe=W.next())Xe=se(G,Xe.value,re),Xe!==null&&($=d(Xe,$,Ie),Qe===null?Ee=Xe:Qe.sibling=Xe,Qe=Xe);return We&&aa(G,Ie),Ee}for(ke=s(ke);!Xe.done;Ie++,Xe=W.next())Xe=J(ke,G,Ie,Xe.value,re),Xe!==null&&(e&&Xe.alternate!==null&&ke.delete(Xe.key===null?Ie:Xe.key),$=d(Xe,$,Ie),Qe===null?Ee=Xe:Qe.sibling=Xe,Qe=Xe);return e&&ke.forEach(function(D1){return t(G,D1)}),We&&aa(G,Ie),Ee}function it(G,$,W,re){if(typeof W=="object"&&W!==null&&W.type===D&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case S:e:{for(var Ee=W.key;$!==null;){if($.key===Ee){if(Ee=W.type,Ee===D){if($.tag===7){l(G,$.sibling),re=c($,W.props.children),re.return=G,G=re;break e}}else if($.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===z&&cl(Ee)===$.type){l(G,$.sibling),re=c($,W.props),Ir(re,W),re.return=G,G=re;break e}l(G,$);break}else t(G,$);$=$.sibling}W.type===D?(re=ll(W.props.children,G.mode,re,W.key),re.return=G,G=re):(re=Ks(W.type,W.key,W.props,null,G.mode,re),Ir(re,W),re.return=G,G=re)}return b(G);case N:e:{for(Ee=W.key;$!==null;){if($.key===Ee)if($.tag===4&&$.stateNode.containerInfo===W.containerInfo&&$.stateNode.implementation===W.implementation){l(G,$.sibling),re=c($,W.children||[]),re.return=G,G=re;break e}else{l(G,$);break}else t(G,$);$=$.sibling}re=Xo(W,G.mode,re),re.return=G,G=re}return b(G);case z:return W=cl(W),it(G,$,W,re)}if(_(W))return Se(G,$,W,re);if(q(W)){if(Ee=q(W),typeof Ee!="function")throw Error(o(150));return W=Ee.call(W),Te(G,$,W,re)}if(typeof W.then=="function")return it(G,$,ni(W),re);if(W.$$typeof===B)return it(G,$,Zs(G,W),re);ai(G,W)}return typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint"?(W=""+W,$!==null&&$.tag===6?(l(G,$.sibling),re=c($,W),re.return=G,G=re):(l(G,$),re=Qo(W,G.mode,re),re.return=G,G=re),b(G)):l(G,$)}return function(G,$,W,re){try{Br=0;var Ee=it(G,$,W,re);return Pl=null,Ee}catch(ke){if(ke===Gl||ke===ei)throw ke;var Qe=pn(29,ke,null,G.mode);return Qe.lanes=re,Qe.return=G,Qe}finally{}}}var dl=Zf(!0),Jf=Zf(!1),Na=!1;function cc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function uc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ea(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ta(e,t,l){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Je&2)!==0){var c=s.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),s.pending=t,t=Ws(e),Of(e,null,l),t}return Fs(e,s,t,l),Ws(e)}function Hr(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,l|=s,t.lanes=l,Gd(e,l)}}function dc(e,t){var l=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,l===s)){var c=null,d=null;if(l=l.firstBaseUpdate,l!==null){do{var b={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};d===null?c=d=b:d=d.next=b,l=l.next}while(l!==null);d===null?c=d=t:d=d.next=t}else c=d=t;l={baseState:s.baseState,firstBaseUpdate:c,lastBaseUpdate:d,shared:s.shared,callbacks:s.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var fc=!1;function Ur(){if(fc){var e=$l;if(e!==null)throw e}}function Vr(e,t,l,s){fc=!1;var c=e.updateQueue;Na=!1;var d=c.firstBaseUpdate,b=c.lastBaseUpdate,w=c.shared.pending;if(w!==null){c.shared.pending=null;var H=w,K=H.next;H.next=null,b===null?d=K:b.next=K,b=H;var ne=e.alternate;ne!==null&&(ne=ne.updateQueue,w=ne.lastBaseUpdate,w!==b&&(w===null?ne.firstBaseUpdate=K:w.next=K,ne.lastBaseUpdate=H))}if(d!==null){var se=c.baseState;b=0,ne=K=H=null,w=d;do{var Q=w.lane&-536870913,J=Q!==w.lane;if(J?(Ye&Q)===Q:(s&Q)===Q){Q!==0&&Q===Vl&&(fc=!0),ne!==null&&(ne=ne.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var Se=e,Te=w;Q=t;var it=l;switch(Te.tag){case 1:if(Se=Te.payload,typeof Se=="function"){se=Se.call(it,se,Q);break e}se=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Te.payload,Q=typeof Se=="function"?Se.call(it,se,Q):Se,Q==null)break e;se=g({},se,Q);break e;case 2:Na=!0}}Q=w.callback,Q!==null&&(e.flags|=64,J&&(e.flags|=8192),J=c.callbacks,J===null?c.callbacks=[Q]:J.push(Q))}else J={lane:Q,tag:w.tag,payload:w.payload,callback:w.callback,next:null},ne===null?(K=ne=J,H=se):ne=ne.next=J,b|=Q;if(w=w.next,w===null){if(w=c.shared.pending,w===null)break;J=w,w=J.next,J.next=null,c.lastBaseUpdate=J,c.shared.pending=null}}while(!0);ne===null&&(H=se),c.baseState=H,c.firstBaseUpdate=K,c.lastBaseUpdate=ne,d===null&&(c.shared.lanes=0),za|=b,e.lanes=b,e.memoizedState=se}}function ep(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function tp(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)ep(l[e],t)}var ql=L(null),li=L(0);function np(e,t){e=ma,ie(li,e),ie(ql,t),ma=e|t.baseLanes}function pc(){ie(li,ma),ie(ql,ql.current)}function mc(){ma=li.current,F(ql),F(li)}var mn=L(null),Dn=null;function Ra(e){var t=e.alternate;ie(Et,Et.current&1),ie(mn,e),Dn===null&&(t===null||ql.current!==null||t.memoizedState!==null)&&(Dn=e)}function hc(e){ie(Et,Et.current),ie(mn,e),Dn===null&&(Dn=e)}function ap(e){e.tag===22?(ie(Et,Et.current),ie(mn,e),Dn===null&&(Dn=e)):Aa()}function Aa(){ie(Et,Et.current),ie(mn,mn.current)}function hn(e){F(mn),Dn===e&&(Dn=null),F(Et)}var Et=L(0);function ri(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||ju(l)||Su(l)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var sa=0,Oe=null,rt=null,Mt=null,si=!1,Yl=!1,fl=!1,ii=0,$r=0,Fl=null,Sy=0;function kt(){throw Error(o(321))}function xc(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!fn(e[l],t[l]))return!1;return!0}function vc(e,t,l,s,c,d){return sa=d,Oe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,E.H=e===null||e.memoizedState===null?Up:Dc,fl=!1,d=l(s,c),fl=!1,Yl&&(d=rp(t,l,s,c)),lp(e),d}function lp(e){E.H=qr;var t=rt!==null&&rt.next!==null;if(sa=0,Mt=rt=Oe=null,si=!1,$r=0,Fl=null,t)throw Error(o(300));e===null||Dt||(e=e.dependencies,e!==null&&Xs(e)&&(Dt=!0))}function rp(e,t,l,s){Oe=e;var c=0;do{if(Yl&&(Fl=null),$r=0,Yl=!1,25<=c)throw Error(o(301));if(c+=1,Mt=rt=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}E.H=Vp,d=t(l,s)}while(Yl);return d}function ky(){var e=E.H,t=e.useState()[0];return t=typeof t.then=="function"?Gr(t):t,e=e.useState()[0],(rt!==null?rt.memoizedState:null)!==e&&(Oe.flags|=1024),t}function gc(){var e=ii!==0;return ii=0,e}function yc(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function bc(e){if(si){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}si=!1}sa=0,Mt=rt=Oe=null,Yl=!1,$r=ii=0,Fl=null}function Jt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mt===null?Oe.memoizedState=Mt=e:Mt=Mt.next=e,Mt}function Tt(){if(rt===null){var e=Oe.alternate;e=e!==null?e.memoizedState:null}else e=rt.next;var t=Mt===null?Oe.memoizedState:Mt.next;if(t!==null)Mt=t,rt=e;else{if(e===null)throw Oe.alternate===null?Error(o(467)):Error(o(310));rt=e,e={memoizedState:rt.memoizedState,baseState:rt.baseState,baseQueue:rt.baseQueue,queue:rt.queue,next:null},Mt===null?Oe.memoizedState=Mt=e:Mt=Mt.next=e}return Mt}function oi(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Gr(e){var t=$r;return $r+=1,Fl===null&&(Fl=[]),e=Kf(Fl,e,t),t=Oe,(Mt===null?t.memoizedState:Mt.next)===null&&(t=t.alternate,E.H=t===null||t.memoizedState===null?Up:Dc),e}function ci(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Gr(e);if(e.$$typeof===B)return qt(e)}throw Error(o(438,String(e)))}function jc(e){var t=null,l=Oe.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var s=Oe.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=oi(),Oe.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),s=0;s<e;s++)l[s]=I;return t.index++,l}function ia(e,t){return typeof t=="function"?t(e):t}function ui(e){var t=Tt();return Sc(t,rt,e)}function Sc(e,t,l){var s=e.queue;if(s===null)throw Error(o(311));s.lastRenderedReducer=l;var c=e.baseQueue,d=s.pending;if(d!==null){if(c!==null){var b=c.next;c.next=d.next,d.next=b}t.baseQueue=c=d,s.pending=null}if(d=e.baseState,c===null)e.memoizedState=d;else{t=c.next;var w=b=null,H=null,K=t,ne=!1;do{var se=K.lane&-536870913;if(se!==K.lane?(Ye&se)===se:(sa&se)===se){var Q=K.revertLane;if(Q===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),se===Vl&&(ne=!0);else if((sa&Q)===Q){K=K.next,Q===Vl&&(ne=!0);continue}else se={lane:0,revertLane:K.revertLane,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},H===null?(w=H=se,b=d):H=H.next=se,Oe.lanes|=Q,za|=Q;se=K.action,fl&&l(d,se),d=K.hasEagerState?K.eagerState:l(d,se)}else Q={lane:se,revertLane:K.revertLane,gesture:K.gesture,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},H===null?(w=H=Q,b=d):H=H.next=Q,Oe.lanes|=se,za|=se;K=K.next}while(K!==null&&K!==t);if(H===null?b=d:H.next=w,!fn(d,e.memoizedState)&&(Dt=!0,ne&&(l=$l,l!==null)))throw l;e.memoizedState=d,e.baseState=b,e.baseQueue=H,s.lastRenderedState=d}return c===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function kc(e){var t=Tt(),l=t.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=e;var s=l.dispatch,c=l.pending,d=t.memoizedState;if(c!==null){l.pending=null;var b=c=c.next;do d=e(d,b.action),b=b.next;while(b!==c);fn(d,t.memoizedState)||(Dt=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),l.lastRenderedState=d}return[d,s]}function sp(e,t,l){var s=Oe,c=Tt(),d=We;if(d){if(l===void 0)throw Error(o(407));l=l()}else l=t();var b=!fn((rt||c).memoizedState,l);if(b&&(c.memoizedState=l,Dt=!0),c=c.queue,Nc(cp.bind(null,s,c,e),[e]),c.getSnapshot!==t||b||Mt!==null&&Mt.memoizedState.tag&1){if(s.flags|=2048,Wl(9,{destroy:void 0},op.bind(null,s,c,l,t),null),ut===null)throw Error(o(349));d||(sa&127)!==0||ip(s,t,l)}return l}function ip(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=Oe.updateQueue,t===null?(t=oi(),Oe.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function op(e,t,l,s){t.value=l,t.getSnapshot=s,up(t)&&dp(e)}function cp(e,t,l){return l(function(){up(t)&&dp(e)})}function up(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!fn(e,l)}catch{return!0}}function dp(e){var t=al(e,2);t!==null&&dn(t,e,2)}function wc(e){var t=Jt();if(typeof e=="function"){var l=e;if(e=l(),fl){St(!0);try{l()}finally{St(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ia,lastRenderedState:e},t}function fp(e,t,l,s){return e.baseState=l,Sc(e,rt,typeof s=="function"?s:ia)}function wy(e,t,l,s,c){if(pi(e))throw Error(o(485));if(e=t.action,e!==null){var d={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){d.listeners.push(b)}};E.T!==null?l(!0):d.isTransition=!1,s(d),l=t.pending,l===null?(d.next=t.pending=d,pp(t,d)):(d.next=l.next,t.pending=l.next=d)}}function pp(e,t){var l=t.action,s=t.payload,c=e.state;if(t.isTransition){var d=E.T,b={};E.T=b;try{var w=l(c,s),H=E.S;H!==null&&H(b,w),mp(e,t,w)}catch(K){Cc(e,t,K)}finally{d!==null&&b.types!==null&&(d.types=b.types),E.T=d}}else try{d=l(c,s),mp(e,t,d)}catch(K){Cc(e,t,K)}}function mp(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(s){hp(e,t,s)},function(s){return Cc(e,t,s)}):hp(e,t,l)}function hp(e,t,l){t.status="fulfilled",t.value=l,xp(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,pp(e,l)))}function Cc(e,t,l){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=l,xp(t),t=t.next;while(t!==s)}e.action=null}function xp(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function vp(e,t){return t}function gp(e,t){if(We){var l=ut.formState;if(l!==null){e:{var s=Oe;if(We){if(ft){t:{for(var c=ft,d=Mn;c.nodeType!==8;){if(!d){c=null;break t}if(c=zn(c.nextSibling),c===null){c=null;break t}}d=c.data,c=d==="F!"||d==="F"?c:null}if(c){ft=zn(c.nextSibling),s=c.data==="F!";break e}}wa(s)}s=!1}s&&(t=l[0])}}return l=Jt(),l.memoizedState=l.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:vp,lastRenderedState:t},l.queue=s,l=Bp.bind(null,Oe,s),s.dispatch=l,s=wc(!1),d=Mc.bind(null,Oe,!1,s.queue),s=Jt(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,l=wy.bind(null,Oe,c,d,l),c.dispatch=l,s.memoizedState=e,[t,l,!1]}function yp(e){var t=Tt();return bp(t,rt,e)}function bp(e,t,l){if(t=Sc(e,t,vp)[0],e=ui(ia)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=Gr(t)}catch(b){throw b===Gl?ei:b}else s=t;t=Tt();var c=t.queue,d=c.dispatch;return l!==t.memoizedState&&(Oe.flags|=2048,Wl(9,{destroy:void 0},Cy.bind(null,c,l),null)),[s,d,e]}function Cy(e,t){e.action=t}function jp(e){var t=Tt(),l=rt;if(l!==null)return bp(t,l,e);Tt(),t=t.memoizedState,l=Tt();var s=l.queue.dispatch;return l.memoizedState=e,[t,s,!1]}function Wl(e,t,l,s){return e={tag:e,create:l,deps:s,inst:t,next:null},t=Oe.updateQueue,t===null&&(t=oi(),Oe.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(s=l.next,l.next=e,e.next=s,t.lastEffect=e),e}function Sp(){return Tt().memoizedState}function di(e,t,l,s){var c=Jt();Oe.flags|=e,c.memoizedState=Wl(1|t,{destroy:void 0},l,s===void 0?null:s)}function fi(e,t,l,s){var c=Tt();s=s===void 0?null:s;var d=c.memoizedState.inst;rt!==null&&s!==null&&xc(s,rt.memoizedState.deps)?c.memoizedState=Wl(t,d,l,s):(Oe.flags|=e,c.memoizedState=Wl(1|t,d,l,s))}function kp(e,t){di(8390656,8,e,t)}function Nc(e,t){fi(2048,8,e,t)}function Ny(e){Oe.flags|=4;var t=Oe.updateQueue;if(t===null)t=oi(),Oe.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function wp(e){var t=Tt().memoizedState;return Ny({ref:t,nextImpl:e}),function(){if((Je&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function Cp(e,t){return fi(4,2,e,t)}function Np(e,t){return fi(4,4,e,t)}function Ep(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 Tp(e,t,l){l=l!=null?l.concat([e]):null,fi(4,4,Ep.bind(null,t,e),l)}function Ec(){}function Rp(e,t){var l=Tt();t=t===void 0?null:t;var s=l.memoizedState;return t!==null&&xc(t,s[1])?s[0]:(l.memoizedState=[e,t],e)}function Ap(e,t){var l=Tt();t=t===void 0?null:t;var s=l.memoizedState;if(t!==null&&xc(t,s[1]))return s[0];if(s=e(),fl){St(!0);try{e()}finally{St(!1)}}return l.memoizedState=[s,t],s}function Tc(e,t,l){return l===void 0||(sa&1073741824)!==0&&(Ye&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=Mm(),Oe.lanes|=e,za|=e,l)}function Mp(e,t,l,s){return fn(l,t)?l:ql.current!==null?(e=Tc(e,l,s),fn(e,t)||(Dt=!0),e):(sa&42)===0||(sa&1073741824)!==0&&(Ye&261930)===0?(Dt=!0,e.memoizedState=l):(e=Mm(),Oe.lanes|=e,za|=e,t)}function Dp(e,t,l,s,c){var d=O.p;O.p=d!==0&&8>d?d:8;var b=E.T,w={};E.T=w,Mc(e,!1,t,l);try{var H=c(),K=E.S;if(K!==null&&K(w,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var ne=jy(H,s);Pr(e,t,ne,gn(e))}else Pr(e,t,s,gn(e))}catch(se){Pr(e,t,{then:function(){},status:"rejected",reason:se},gn())}finally{O.p=d,b!==null&&w.types!==null&&(b.types=w.types),E.T=b}}function Ey(){}function Rc(e,t,l,s){if(e.tag!==5)throw Error(o(476));var c=zp(e).queue;Dp(e,c,t,te,l===null?Ey:function(){return Lp(e),l(s)})}function zp(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:te,baseState:te,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ia,lastRenderedState:te},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ia,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Lp(e){var t=zp(e);t.next===null&&(t=e.alternate.memoizedState),Pr(e,t.next.queue,{},gn())}function Ac(){return qt(is)}function _p(){return Tt().memoizedState}function Op(){return Tt().memoizedState}function Ty(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=gn();e=Ea(l);var s=Ta(t,e,l);s!==null&&(dn(s,t,l),Hr(s,t,l)),t={cache:rc()},e.payload=t;return}t=t.return}}function Ry(e,t,l){var s=gn();l={lane:s,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},pi(e)?Ip(t,l):(l=Wo(e,t,l,s),l!==null&&(dn(l,e,s),Hp(l,t,s)))}function Bp(e,t,l){var s=gn();Pr(e,t,l,s)}function Pr(e,t,l,s){var c={lane:s,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(pi(e))Ip(t,c);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var b=t.lastRenderedState,w=d(b,l);if(c.hasEagerState=!0,c.eagerState=w,fn(w,b))return Fs(e,t,c,0),ut===null&&Ys(),!1}catch{}finally{}if(l=Wo(e,t,c,s),l!==null)return dn(l,e,s),Hp(l,t,s),!0}return!1}function Mc(e,t,l,s){if(s={lane:2,revertLane:cu(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},pi(e)){if(t)throw Error(o(479))}else t=Wo(e,l,s,2),t!==null&&dn(t,e,2)}function pi(e){var t=e.alternate;return e===Oe||t!==null&&t===Oe}function Ip(e,t){Yl=si=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function Hp(e,t,l){if((l&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,l|=s,t.lanes=l,Gd(e,l)}}var qr={readContext:qt,use:ci,useCallback:kt,useContext:kt,useEffect:kt,useImperativeHandle:kt,useLayoutEffect:kt,useInsertionEffect:kt,useMemo:kt,useReducer:kt,useRef:kt,useState:kt,useDebugValue:kt,useDeferredValue:kt,useTransition:kt,useSyncExternalStore:kt,useId:kt,useHostTransitionStatus:kt,useFormState:kt,useActionState:kt,useOptimistic:kt,useMemoCache:kt,useCacheRefresh:kt};qr.useEffectEvent=kt;var Up={readContext:qt,use:ci,useCallback:function(e,t){return Jt().memoizedState=[e,t===void 0?null:t],e},useContext:qt,useEffect:kp,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,di(4194308,4,Ep.bind(null,t,e),l)},useLayoutEffect:function(e,t){return di(4194308,4,e,t)},useInsertionEffect:function(e,t){di(4,2,e,t)},useMemo:function(e,t){var l=Jt();t=t===void 0?null:t;var s=e();if(fl){St(!0);try{e()}finally{St(!1)}}return l.memoizedState=[s,t],s},useReducer:function(e,t,l){var s=Jt();if(l!==void 0){var c=l(t);if(fl){St(!0);try{l(t)}finally{St(!1)}}}else c=t;return s.memoizedState=s.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},s.queue=e,e=e.dispatch=Ry.bind(null,Oe,e),[s.memoizedState,e]},useRef:function(e){var t=Jt();return e={current:e},t.memoizedState=e},useState:function(e){e=wc(e);var t=e.queue,l=Bp.bind(null,Oe,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:Ec,useDeferredValue:function(e,t){var l=Jt();return Tc(l,e,t)},useTransition:function(){var e=wc(!1);return e=Dp.bind(null,Oe,e.queue,!0,!1),Jt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var s=Oe,c=Jt();if(We){if(l===void 0)throw Error(o(407));l=l()}else{if(l=t(),ut===null)throw Error(o(349));(Ye&127)!==0||ip(s,t,l)}c.memoizedState=l;var d={value:l,getSnapshot:t};return c.queue=d,kp(cp.bind(null,s,d,e),[e]),s.flags|=2048,Wl(9,{destroy:void 0},op.bind(null,s,d,l,t),null),l},useId:function(){var e=Jt(),t=ut.identifierPrefix;if(We){var l=qn,s=Pn;l=(s&~(1<<32-bt(s)-1)).toString(32)+l,t="_"+t+"R_"+l,l=ii++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=Sy++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Ac,useFormState:gp,useActionState:gp,useOptimistic:function(e){var t=Jt();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=Mc.bind(null,Oe,!0,l),l.dispatch=t,[e,t]},useMemoCache:jc,useCacheRefresh:function(){return Jt().memoizedState=Ty.bind(null,Oe)},useEffectEvent:function(e){var t=Jt(),l={impl:e};return t.memoizedState=l,function(){if((Je&2)!==0)throw Error(o(440));return l.impl.apply(void 0,arguments)}}},Dc={readContext:qt,use:ci,useCallback:Rp,useContext:qt,useEffect:Nc,useImperativeHandle:Tp,useInsertionEffect:Cp,useLayoutEffect:Np,useMemo:Ap,useReducer:ui,useRef:Sp,useState:function(){return ui(ia)},useDebugValue:Ec,useDeferredValue:function(e,t){var l=Tt();return Mp(l,rt.memoizedState,e,t)},useTransition:function(){var e=ui(ia)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Gr(e),t]},useSyncExternalStore:sp,useId:_p,useHostTransitionStatus:Ac,useFormState:yp,useActionState:yp,useOptimistic:function(e,t){var l=Tt();return fp(l,rt,e,t)},useMemoCache:jc,useCacheRefresh:Op};Dc.useEffectEvent=wp;var Vp={readContext:qt,use:ci,useCallback:Rp,useContext:qt,useEffect:Nc,useImperativeHandle:Tp,useInsertionEffect:Cp,useLayoutEffect:Np,useMemo:Ap,useReducer:kc,useRef:Sp,useState:function(){return kc(ia)},useDebugValue:Ec,useDeferredValue:function(e,t){var l=Tt();return rt===null?Tc(l,e,t):Mp(l,rt.memoizedState,e,t)},useTransition:function(){var e=kc(ia)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Gr(e),t]},useSyncExternalStore:sp,useId:_p,useHostTransitionStatus:Ac,useFormState:jp,useActionState:jp,useOptimistic:function(e,t){var l=Tt();return rt!==null?fp(l,rt,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:jc,useCacheRefresh:Op};Vp.useEffectEvent=wp;function zc(e,t,l,s){t=e.memoizedState,l=l(s,t),l=l==null?t:g({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var Lc={enqueueSetState:function(e,t,l){e=e._reactInternals;var s=gn(),c=Ea(s);c.payload=t,l!=null&&(c.callback=l),t=Ta(e,c,s),t!==null&&(dn(t,e,s),Hr(t,e,s))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var s=gn(),c=Ea(s);c.tag=1,c.payload=t,l!=null&&(c.callback=l),t=Ta(e,c,s),t!==null&&(dn(t,e,s),Hr(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=gn(),s=Ea(l);s.tag=2,t!=null&&(s.callback=t),t=Ta(e,s,l),t!==null&&(dn(t,e,l),Hr(t,e,l))}};function $p(e,t,l,s,c,d,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,d,b):t.prototype&&t.prototype.isPureReactComponent?!Mr(l,s)||!Mr(c,d):!0}function Gp(e,t,l,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,s),t.state!==e&&Lc.enqueueReplaceState(t,t.state,null)}function pl(e,t){var l=t;if("ref"in t){l={};for(var s in t)s!=="ref"&&(l[s]=t[s])}if(e=e.defaultProps){l===t&&(l=g({},l));for(var c in e)l[c]===void 0&&(l[c]=e[c])}return l}function Pp(e){qs(e)}function qp(e){console.error(e)}function Yp(e){qs(e)}function mi(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Fp(e,t,l){try{var s=e.onCaughtError;s(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function _c(e,t,l){return l=Ea(l),l.tag=3,l.payload={element:null},l.callback=function(){mi(e,t)},l}function Wp(e){return e=Ea(e),e.tag=3,e}function Kp(e,t,l,s){var c=l.type.getDerivedStateFromError;if(typeof c=="function"){var d=s.value;e.payload=function(){return c(d)},e.callback=function(){Fp(t,l,s)}}var b=l.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){Fp(t,l,s),typeof c!="function"&&(La===null?La=new Set([this]):La.add(this));var w=s.stack;this.componentDidCatch(s.value,{componentStack:w!==null?w:""})})}function Ay(e,t,l,s,c){if(l.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=l.alternate,t!==null&&Ul(t,l,c,!0),l=mn.current,l!==null){switch(l.tag){case 31:case 13:return Dn===null?Ni():l.alternate===null&&wt===0&&(wt=3),l.flags&=-257,l.flags|=65536,l.lanes=c,s===ti?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([s]):t.add(s),su(e,s,c)),!1;case 22:return l.flags|=65536,s===ti?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([s]):l.add(s)),su(e,s,c)),!1}throw Error(o(435,l.tag))}return su(e,s,c),Ni(),!1}if(We)return t=mn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,s!==ec&&(e=Error(o(422),{cause:s}),Lr(Tn(e,l)))):(s!==ec&&(t=Error(o(423),{cause:s}),Lr(Tn(t,l))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,s=Tn(s,l),c=_c(e.stateNode,s,c),dc(e,c),wt!==4&&(wt=2)),!1;var d=Error(o(520),{cause:s});if(d=Tn(d,l),Jr===null?Jr=[d]:Jr.push(d),wt!==4&&(wt=2),t===null)return!0;s=Tn(s,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=c&-c,l.lanes|=e,e=_c(l.stateNode,s,e),dc(l,e),!1;case 1:if(t=l.type,d=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(La===null||!La.has(d))))return l.flags|=65536,c&=-c,l.lanes|=c,c=Wp(c),Kp(c,e,l,s),dc(l,c),!1}l=l.return}while(l!==null);return!1}var Oc=Error(o(461)),Dt=!1;function Yt(e,t,l,s){t.child=e===null?Jf(t,null,l,s):dl(t,e.child,l,s)}function Qp(e,t,l,s,c){l=l.render;var d=t.ref;if("ref"in s){var b={};for(var w in s)w!=="ref"&&(b[w]=s[w])}else b=s;return il(t),s=vc(e,t,l,b,d,c),w=gc(),e!==null&&!Dt?(yc(e,t,c),oa(e,t,c)):(We&&w&&Zo(t),t.flags|=1,Yt(e,t,s,c),t.child)}function Xp(e,t,l,s,c){if(e===null){var d=l.type;return typeof d=="function"&&!Ko(d)&&d.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=d,Zp(e,t,d,s,c)):(e=Ks(l.type,null,s,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!Pc(e,c)){var b=d.memoizedProps;if(l=l.compare,l=l!==null?l:Mr,l(b,s)&&e.ref===t.ref)return oa(e,t,c)}return t.flags|=1,e=na(d,s),e.ref=t.ref,e.return=t,t.child=e}function Zp(e,t,l,s,c){if(e!==null){var d=e.memoizedProps;if(Mr(d,s)&&e.ref===t.ref)if(Dt=!1,t.pendingProps=s=d,Pc(e,c))(e.flags&131072)!==0&&(Dt=!0);else return t.lanes=e.lanes,oa(e,t,c)}return Bc(e,t,l,s,c)}function Jp(e,t,l,s){var c=s.children,d=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((t.flags&128)!==0){if(d=d!==null?d.baseLanes|l:l,e!==null){for(s=t.child=e.child,c=0;s!==null;)c=c|s.lanes|s.childLanes,s=s.sibling;s=c&~d}else s=0,t.child=null;return em(e,t,d,l,s)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Js(t,d!==null?d.cachePool:null),d!==null?np(t,d):pc(),ap(t);else return s=t.lanes=536870912,em(e,t,d!==null?d.baseLanes|l:l,l,s)}else d!==null?(Js(t,d.cachePool),np(t,d),Aa(),t.memoizedState=null):(e!==null&&Js(t,null),pc(),Aa());return Yt(e,t,c,l),t.child}function Yr(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function em(e,t,l,s,c){var d=ic();return d=d===null?null:{parent:At._currentValue,pool:d},t.memoizedState={baseLanes:l,cachePool:d},e!==null&&Js(t,null),pc(),ap(t),e!==null&&Ul(e,t,s,!0),t.childLanes=c,null}function hi(e,t){return t=vi({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function tm(e,t,l){return dl(t,e.child,null,l),e=hi(t,t.pendingProps),e.flags|=2,hn(t),t.memoizedState=null,e}function My(e,t,l){var s=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(We){if(s.mode==="hidden")return e=hi(t,s),t.lanes=536870912,Yr(null,e);if(hc(t),(e=ft)?(e=ph(e,Mn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Sa!==null?{id:Pn,overflow:qn}:null,retryLane:536870912,hydrationErrors:null},l=If(e),l.return=t,t.child=l,Pt=t,ft=null)):e=null,e===null)throw wa(t);return t.lanes=536870912,null}return hi(t,s)}var d=e.memoizedState;if(d!==null){var b=d.dehydrated;if(hc(t),c)if(t.flags&256)t.flags&=-257,t=tm(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||Ul(e,t,l,!1),c=(l&e.childLanes)!==0,Dt||c){if(s=ut,s!==null&&(b=Pd(s,l),b!==0&&b!==d.retryLane))throw d.retryLane=b,al(e,b),dn(s,e,b),Oc;Ni(),t=tm(e,t,l)}else e=d.treeContext,ft=zn(b.nextSibling),Pt=t,We=!0,ka=null,Mn=!1,e!==null&&Vf(t,e),t=hi(t,s),t.flags|=4096;return t}return e=na(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function xi(e,t){var l=t.ref;if(l===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(o(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function Bc(e,t,l,s,c){return il(t),l=vc(e,t,l,s,void 0,c),s=gc(),e!==null&&!Dt?(yc(e,t,c),oa(e,t,c)):(We&&s&&Zo(t),t.flags|=1,Yt(e,t,l,c),t.child)}function nm(e,t,l,s,c,d){return il(t),t.updateQueue=null,l=rp(t,s,l,c),lp(e),s=gc(),e!==null&&!Dt?(yc(e,t,d),oa(e,t,d)):(We&&s&&Zo(t),t.flags|=1,Yt(e,t,l,d),t.child)}function am(e,t,l,s,c){if(il(t),t.stateNode===null){var d=Ol,b=l.contextType;typeof b=="object"&&b!==null&&(d=qt(b)),d=new l(s,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=Lc,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=s,d.state=t.memoizedState,d.refs={},cc(t),b=l.contextType,d.context=typeof b=="object"&&b!==null?qt(b):Ol,d.state=t.memoizedState,b=l.getDerivedStateFromProps,typeof b=="function"&&(zc(t,l,b,s),d.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(b=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),b!==d.state&&Lc.enqueueReplaceState(d,d.state,null),Vr(t,s,d,c),Ur(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){d=t.stateNode;var w=t.memoizedProps,H=pl(l,w);d.props=H;var K=d.context,ne=l.contextType;b=Ol,typeof ne=="object"&&ne!==null&&(b=qt(ne));var se=l.getDerivedStateFromProps;ne=typeof se=="function"||typeof d.getSnapshotBeforeUpdate=="function",w=t.pendingProps!==w,ne||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(w||K!==b)&&Gp(t,d,s,b),Na=!1;var Q=t.memoizedState;d.state=Q,Vr(t,s,d,c),Ur(),K=t.memoizedState,w||Q!==K||Na?(typeof se=="function"&&(zc(t,l,se,s),K=t.memoizedState),(H=Na||$p(t,l,H,s,Q,K,b))?(ne||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=K),d.props=s,d.state=K,d.context=b,s=H):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{d=t.stateNode,uc(e,t),b=t.memoizedProps,ne=pl(l,b),d.props=ne,se=t.pendingProps,Q=d.context,K=l.contextType,H=Ol,typeof K=="object"&&K!==null&&(H=qt(K)),w=l.getDerivedStateFromProps,(K=typeof w=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(b!==se||Q!==H)&&Gp(t,d,s,H),Na=!1,Q=t.memoizedState,d.state=Q,Vr(t,s,d,c),Ur();var J=t.memoizedState;b!==se||Q!==J||Na||e!==null&&e.dependencies!==null&&Xs(e.dependencies)?(typeof w=="function"&&(zc(t,l,w,s),J=t.memoizedState),(ne=Na||$p(t,l,ne,s,Q,J,H)||e!==null&&e.dependencies!==null&&Xs(e.dependencies))?(K||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(s,J,H),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(s,J,H)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||b===e.memoizedProps&&Q===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&Q===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=J),d.props=s,d.state=J,d.context=H,s=ne):(typeof d.componentDidUpdate!="function"||b===e.memoizedProps&&Q===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&Q===e.memoizedState||(t.flags|=1024),s=!1)}return d=s,xi(e,t),s=(t.flags&128)!==0,d||s?(d=t.stateNode,l=s&&typeof l.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&s?(t.child=dl(t,e.child,null,c),t.child=dl(t,null,l,c)):Yt(e,t,l,c),t.memoizedState=d.state,e=t.child):e=oa(e,t,c),e}function lm(e,t,l,s){return rl(),t.flags|=256,Yt(e,t,l,s),t.child}var Ic={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Hc(e){return{baseLanes:e,cachePool:Ff()}}function Uc(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=vn),e}function rm(e,t,l){var s=t.pendingProps,c=!1,d=(t.flags&128)!==0,b;if((b=d)||(b=e!==null&&e.memoizedState===null?!1:(Et.current&2)!==0),b&&(c=!0,t.flags&=-129),b=(t.flags&32)!==0,t.flags&=-33,e===null){if(We){if(c?Ra(t):Aa(),(e=ft)?(e=ph(e,Mn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Sa!==null?{id:Pn,overflow:qn}:null,retryLane:536870912,hydrationErrors:null},l=If(e),l.return=t,t.child=l,Pt=t,ft=null)):e=null,e===null)throw wa(t);return Su(e)?t.lanes=32:t.lanes=536870912,null}var w=s.children;return s=s.fallback,c?(Aa(),c=t.mode,w=vi({mode:"hidden",children:w},c),s=ll(s,c,l,null),w.return=t,s.return=t,w.sibling=s,t.child=w,s=t.child,s.memoizedState=Hc(l),s.childLanes=Uc(e,b,l),t.memoizedState=Ic,Yr(null,s)):(Ra(t),Vc(t,w))}var H=e.memoizedState;if(H!==null&&(w=H.dehydrated,w!==null)){if(d)t.flags&256?(Ra(t),t.flags&=-257,t=$c(e,t,l)):t.memoizedState!==null?(Aa(),t.child=e.child,t.flags|=128,t=null):(Aa(),w=s.fallback,c=t.mode,s=vi({mode:"visible",children:s.children},c),w=ll(w,c,l,null),w.flags|=2,s.return=t,w.return=t,s.sibling=w,t.child=s,dl(t,e.child,null,l),s=t.child,s.memoizedState=Hc(l),s.childLanes=Uc(e,b,l),t.memoizedState=Ic,t=Yr(null,s));else if(Ra(t),Su(w)){if(b=w.nextSibling&&w.nextSibling.dataset,b)var K=b.dgst;b=K,s=Error(o(419)),s.stack="",s.digest=b,Lr({value:s,source:null,stack:null}),t=$c(e,t,l)}else if(Dt||Ul(e,t,l,!1),b=(l&e.childLanes)!==0,Dt||b){if(b=ut,b!==null&&(s=Pd(b,l),s!==0&&s!==H.retryLane))throw H.retryLane=s,al(e,s),dn(b,e,s),Oc;ju(w)||Ni(),t=$c(e,t,l)}else ju(w)?(t.flags|=192,t.child=e.child,t=null):(e=H.treeContext,ft=zn(w.nextSibling),Pt=t,We=!0,ka=null,Mn=!1,e!==null&&Vf(t,e),t=Vc(t,s.children),t.flags|=4096);return t}return c?(Aa(),w=s.fallback,c=t.mode,H=e.child,K=H.sibling,s=na(H,{mode:"hidden",children:s.children}),s.subtreeFlags=H.subtreeFlags&65011712,K!==null?w=na(K,w):(w=ll(w,c,l,null),w.flags|=2),w.return=t,s.return=t,s.sibling=w,t.child=s,Yr(null,s),s=t.child,w=e.child.memoizedState,w===null?w=Hc(l):(c=w.cachePool,c!==null?(H=At._currentValue,c=c.parent!==H?{parent:H,pool:H}:c):c=Ff(),w={baseLanes:w.baseLanes|l,cachePool:c}),s.memoizedState=w,s.childLanes=Uc(e,b,l),t.memoizedState=Ic,Yr(e.child,s)):(Ra(t),l=e.child,e=l.sibling,l=na(l,{mode:"visible",children:s.children}),l.return=t,l.sibling=null,e!==null&&(b=t.deletions,b===null?(t.deletions=[e],t.flags|=16):b.push(e)),t.child=l,t.memoizedState=null,l)}function Vc(e,t){return t=vi({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function vi(e,t){return e=pn(22,e,null,t),e.lanes=0,e}function $c(e,t,l){return dl(t,e.child,null,l),e=Vc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function sm(e,t,l){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),ac(e.return,t,l)}function Gc(e,t,l,s,c,d){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:l,tailMode:c,treeForkCount:d}:(b.isBackwards=t,b.rendering=null,b.renderingStartTime=0,b.last=s,b.tail=l,b.tailMode=c,b.treeForkCount=d)}function im(e,t,l){var s=t.pendingProps,c=s.revealOrder,d=s.tail;s=s.children;var b=Et.current,w=(b&2)!==0;if(w?(b=b&1|2,t.flags|=128):b&=1,ie(Et,b),Yt(e,t,s,l),s=We?zr:0,!w&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&sm(e,l,t);else if(e.tag===19)sm(e,l,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(l=t.child,c=null;l!==null;)e=l.alternate,e!==null&&ri(e)===null&&(c=l),l=l.sibling;l=c,l===null?(c=t.child,t.child=null):(c=l.sibling,l.sibling=null),Gc(t,!1,c,l,d,s);break;case"backwards":case"unstable_legacy-backwards":for(l=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&ri(e)===null){t.child=c;break}e=c.sibling,c.sibling=l,l=c,c=e}Gc(t,!0,l,null,d,s);break;case"together":Gc(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function oa(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),za|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(Ul(e,t,l,!1),(l&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,l=na(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=na(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function Pc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Xs(e)))}function Dy(e,t,l){switch(t.tag){case 3:le(t,t.stateNode.containerInfo),Ca(t,At,e.memoizedState.cache),rl();break;case 27:case 5:Ue(t);break;case 4:le(t,t.stateNode.containerInfo);break;case 10:Ca(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,hc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(Ra(t),t.flags|=128,null):(l&t.child.childLanes)!==0?rm(e,t,l):(Ra(t),e=oa(e,t,l),e!==null?e.sibling:null);Ra(t);break;case 19:var c=(e.flags&128)!==0;if(s=(l&t.childLanes)!==0,s||(Ul(e,t,l,!1),s=(l&t.childLanes)!==0),c){if(s)return im(e,t,l);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),ie(Et,Et.current),s)break;return null;case 22:return t.lanes=0,Jp(e,t,l,t.pendingProps);case 24:Ca(t,At,e.memoizedState.cache)}return oa(e,t,l)}function om(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)Dt=!0;else{if(!Pc(e,l)&&(t.flags&128)===0)return Dt=!1,Dy(e,t,l);Dt=(e.flags&131072)!==0}else Dt=!1,We&&(t.flags&1048576)!==0&&Uf(t,zr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=cl(t.elementType),t.type=e,typeof e=="function")Ko(e)?(s=pl(e,s),t.tag=1,t=am(null,t,e,s,l)):(t.tag=0,t=Bc(null,t,e,s,l));else{if(e!=null){var c=e.$$typeof;if(c===V){t.tag=11,t=Qp(null,t,e,s,l);break e}else if(c===C){t.tag=14,t=Xp(null,t,e,s,l);break e}}throw t=X(e)||e,Error(o(306,t,""))}}return t;case 0:return Bc(e,t,t.type,t.pendingProps,l);case 1:return s=t.type,c=pl(s,t.pendingProps),am(e,t,s,c,l);case 3:e:{if(le(t,t.stateNode.containerInfo),e===null)throw Error(o(387));s=t.pendingProps;var d=t.memoizedState;c=d.element,uc(e,t),Vr(t,s,null,l);var b=t.memoizedState;if(s=b.cache,Ca(t,At,s),s!==d.cache&&lc(t,[At],l,!0),Ur(),s=b.element,d.isDehydrated)if(d={element:s,isDehydrated:!1,cache:b.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=lm(e,t,s,l);break e}else if(s!==c){c=Tn(Error(o(424)),t),Lr(c),t=lm(e,t,s,l);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(ft=zn(e.firstChild),Pt=t,We=!0,ka=null,Mn=!0,l=Jf(t,null,s,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(rl(),s===c){t=oa(e,t,l);break e}Yt(e,t,s,l)}t=t.child}return t;case 26:return xi(e,t),e===null?(l=yh(t.type,null,t.pendingProps,null))?t.memoizedState=l:We||(l=t.type,e=t.pendingProps,s=zi(xe.current).createElement(l),s[Gt]=t,s[ln]=e,Ft(s,l,e),Ht(s),t.stateNode=s):t.memoizedState=yh(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ue(t),e===null&&We&&(s=t.stateNode=xh(t.type,t.pendingProps,xe.current),Pt=t,Mn=!0,c=ft,Ia(t.type)?(ku=c,ft=zn(s.firstChild)):ft=c),Yt(e,t,t.pendingProps.children,l),xi(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&We&&((c=s=ft)&&(s=o1(s,t.type,t.pendingProps,Mn),s!==null?(t.stateNode=s,Pt=t,ft=zn(s.firstChild),Mn=!1,c=!0):c=!1),c||wa(t)),Ue(t),c=t.type,d=t.pendingProps,b=e!==null?e.memoizedProps:null,s=d.children,gu(c,d)?s=null:b!==null&&gu(c,b)&&(t.flags|=32),t.memoizedState!==null&&(c=vc(e,t,ky,null,null,l),is._currentValue=c),xi(e,t),Yt(e,t,s,l),t.child;case 6:return e===null&&We&&((e=l=ft)&&(l=c1(l,t.pendingProps,Mn),l!==null?(t.stateNode=l,Pt=t,ft=null,e=!0):e=!1),e||wa(t)),null;case 13:return rm(e,t,l);case 4:return le(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=dl(t,null,s,l):Yt(e,t,s,l),t.child;case 11:return Qp(e,t,t.type,t.pendingProps,l);case 7:return Yt(e,t,t.pendingProps,l),t.child;case 8:return Yt(e,t,t.pendingProps.children,l),t.child;case 12:return Yt(e,t,t.pendingProps.children,l),t.child;case 10:return s=t.pendingProps,Ca(t,t.type,s.value),Yt(e,t,s.children,l),t.child;case 9:return c=t.type._context,s=t.pendingProps.children,il(t),c=qt(c),s=s(c),t.flags|=1,Yt(e,t,s,l),t.child;case 14:return Xp(e,t,t.type,t.pendingProps,l);case 15:return Zp(e,t,t.type,t.pendingProps,l);case 19:return im(e,t,l);case 31:return My(e,t,l);case 22:return Jp(e,t,l,t.pendingProps);case 24:return il(t),s=qt(At),e===null?(c=ic(),c===null&&(c=ut,d=rc(),c.pooledCache=d,d.refCount++,d!==null&&(c.pooledCacheLanes|=l),c=d),t.memoizedState={parent:s,cache:c},cc(t),Ca(t,At,c)):((e.lanes&l)!==0&&(uc(e,t),Vr(t,null,null,l),Ur()),c=e.memoizedState,d=t.memoizedState,c.parent!==s?(c={parent:s,cache:s},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),Ca(t,At,s)):(s=d.cache,Ca(t,At,s),s!==c.cache&&lc(t,[At],l,!0))),Yt(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function ca(e){e.flags|=4}function qc(e,t,l,s,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(_m())e.flags|=8192;else throw ul=ti,oc}else e.flags&=-16777217}function cm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!wh(t))if(_m())e.flags|=8192;else throw ul=ti,oc}function gi(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Vd():536870912,e.lanes|=t,Zl|=t)}function Fr(e,t){if(!We)switch(e.tailMode){case"hidden":t=e.tail;for(var l=null;t!==null;)t.alternate!==null&&(l=t),t=t.sibling;l===null?e.tail=null:l.sibling=null;break;case"collapsed":l=e.tail;for(var s=null;l!==null;)l.alternate!==null&&(s=l),l=l.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function pt(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,s=0;if(t)for(var c=e.child;c!==null;)l|=c.lanes|c.childLanes,s|=c.subtreeFlags&65011712,s|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)l|=c.lanes|c.childLanes,s|=c.subtreeFlags,s|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=s,e.childLanes=l,t}function zy(e,t,l){var s=t.pendingProps;switch(Jo(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return pt(t),null;case 1:return pt(t),null;case 3:return l=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),ra(At),ve(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Hl(t)?ca(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,tc())),pt(t),null;case 26:var c=t.type,d=t.memoizedState;return e===null?(ca(t),d!==null?(pt(t),cm(t,d)):(pt(t),qc(t,c,null,s,l))):d?d!==e.memoizedState?(ca(t),pt(t),cm(t,d)):(pt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&ca(t),pt(t),qc(t,c,e,s,l)),null;case 27:if(Be(t),l=xe.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&ca(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return pt(t),null}e=de.current,Hl(t)?$f(t):(e=xh(c,s,l),t.stateNode=e,ca(t))}return pt(t),null;case 5:if(Be(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&ca(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return pt(t),null}if(d=de.current,Hl(t))$f(t);else{var b=zi(xe.current);switch(d){case 1:d=b.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:d=b.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":d=b.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":d=b.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":d=b.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof s.is=="string"?b.createElement("select",{is:s.is}):b.createElement("select"),s.multiple?d.multiple=!0:s.size&&(d.size=s.size);break;default:d=typeof s.is=="string"?b.createElement(c,{is:s.is}):b.createElement(c)}}d[Gt]=t,d[ln]=s;e:for(b=t.child;b!==null;){if(b.tag===5||b.tag===6)d.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===t)break e;for(;b.sibling===null;){if(b.return===null||b.return===t)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}t.stateNode=d;e:switch(Ft(d,c,s),c){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&ca(t)}}return pt(t),qc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&ca(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(o(166));if(e=xe.current,Hl(t)){if(e=t.stateNode,l=t.memoizedProps,s=null,c=Pt,c!==null)switch(c.tag){case 27:case 5:s=c.memoizedProps}e[Gt]=t,e=!!(e.nodeValue===l||s!==null&&s.suppressHydrationWarning===!0||rh(e.nodeValue,l)),e||wa(t,!0)}else e=zi(e).createTextNode(s),e[Gt]=t,t.stateNode=e}return pt(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(s=Hl(t),l!==null){if(e===null){if(!s)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[Gt]=t}else rl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pt(t),e=!1}else l=tc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(hn(t),t):(hn(t),null);if((t.flags&128)!==0)throw Error(o(558))}return pt(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Hl(t),s!==null&&s.dehydrated!==null){if(e===null){if(!c)throw Error(o(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(o(317));c[Gt]=t}else rl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pt(t),c=!1}else c=tc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(hn(t),t):(hn(t),null)}return hn(t),(t.flags&128)!==0?(t.lanes=l,t):(l=s!==null,e=e!==null&&e.memoizedState!==null,l&&(s=t.child,c=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(c=s.alternate.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==c&&(s.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),gi(t,t.updateQueue),pt(t),null);case 4:return ve(),e===null&&pu(t.stateNode.containerInfo),pt(t),null;case 10:return ra(t.type),pt(t),null;case 19:if(F(Et),s=t.memoizedState,s===null)return pt(t),null;if(c=(t.flags&128)!==0,d=s.rendering,d===null)if(c)Fr(s,!1);else{if(wt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=ri(e),d!==null){for(t.flags|=128,Fr(s,!1),e=d.updateQueue,t.updateQueue=e,gi(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)Bf(l,e),l=l.sibling;return ie(Et,Et.current&1|2),We&&aa(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&tt()>ki&&(t.flags|=128,c=!0,Fr(s,!1),t.lanes=4194304)}else{if(!c)if(e=ri(d),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,gi(t,e),Fr(s,!0),s.tail===null&&s.tailMode==="hidden"&&!d.alternate&&!We)return pt(t),null}else 2*tt()-s.renderingStartTime>ki&&l!==536870912&&(t.flags|=128,c=!0,Fr(s,!1),t.lanes=4194304);s.isBackwards?(d.sibling=t.child,t.child=d):(e=s.last,e!==null?e.sibling=d:t.child=d,s.last=d)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=tt(),e.sibling=null,l=Et.current,ie(Et,c?l&1|2:l&1),We&&aa(t,s.treeForkCount),e):(pt(t),null);case 22:case 23:return hn(t),mc(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(l&536870912)!==0&&(t.flags&128)===0&&(pt(t),t.subtreeFlags&6&&(t.flags|=8192)):pt(t),l=t.updateQueue,l!==null&&gi(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==l&&(t.flags|=2048),e!==null&&F(ol),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),ra(At),pt(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function Ly(e,t){switch(Jo(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ra(At),ve(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Be(t),null;case 31:if(t.memoizedState!==null){if(hn(t),t.alternate===null)throw Error(o(340));rl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(hn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));rl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return F(Et),null;case 4:return ve(),null;case 10:return ra(t.type),null;case 22:case 23:return hn(t),mc(),e!==null&&F(ol),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ra(At),null;case 25:return null;default:return null}}function um(e,t){switch(Jo(t),t.tag){case 3:ra(At),ve();break;case 26:case 27:case 5:Be(t);break;case 4:ve();break;case 31:t.memoizedState!==null&&hn(t);break;case 13:hn(t);break;case 19:F(Et);break;case 10:ra(t.type);break;case 22:case 23:hn(t),mc(),e!==null&&F(ol);break;case 24:ra(At)}}function Wr(e,t){try{var l=t.updateQueue,s=l!==null?l.lastEffect:null;if(s!==null){var c=s.next;l=c;do{if((l.tag&e)===e){s=void 0;var d=l.create,b=l.inst;s=d(),b.destroy=s}l=l.next}while(l!==c)}}catch(w){lt(t,t.return,w)}}function Ma(e,t,l){try{var s=t.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var d=c.next;s=d;do{if((s.tag&e)===e){var b=s.inst,w=b.destroy;if(w!==void 0){b.destroy=void 0,c=t;var H=l,K=w;try{K()}catch(ne){lt(c,H,ne)}}}s=s.next}while(s!==d)}}catch(ne){lt(t,t.return,ne)}}function dm(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{tp(t,l)}catch(s){lt(e,e.return,s)}}}function fm(e,t,l){l.props=pl(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(s){lt(e,t,s)}}function Kr(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof l=="function"?e.refCleanup=l(s):l.current=s}}catch(c){lt(e,t,c)}}function Yn(e,t){var l=e.ref,s=e.refCleanup;if(l!==null)if(typeof s=="function")try{s()}catch(c){lt(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(c){lt(e,t,c)}else l.current=null}function pm(e){var t=e.type,l=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&s.focus();break e;case"img":l.src?s.src=l.src:l.srcSet&&(s.srcset=l.srcSet)}}catch(c){lt(e,e.return,c)}}function Yc(e,t,l){try{var s=e.stateNode;n1(s,e.type,l,t),s[ln]=t}catch(c){lt(e,e.return,c)}}function mm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ia(e.type)||e.tag===4}function Fc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||mm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ia(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Wc(e,t,l){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,t):(t=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,t.appendChild(e),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=ea));else if(s!==4&&(s===27&&Ia(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(Wc(e,t,l),e=e.sibling;e!==null;)Wc(e,t,l),e=e.sibling}function yi(e,t,l){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(s!==4&&(s===27&&Ia(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(yi(e,t,l),e=e.sibling;e!==null;)yi(e,t,l),e=e.sibling}function hm(e){var t=e.stateNode,l=e.memoizedProps;try{for(var s=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);Ft(t,s,l),t[Gt]=e,t[ln]=l}catch(d){lt(e,e.return,d)}}var ua=!1,zt=!1,Kc=!1,xm=typeof WeakSet=="function"?WeakSet:Set,Ut=null;function _y(e,t){if(e=e.containerInfo,xu=Ui,e=Tf(e),$o(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var s=l.getSelection&&l.getSelection();if(s&&s.rangeCount!==0){l=s.anchorNode;var c=s.anchorOffset,d=s.focusNode;s=s.focusOffset;try{l.nodeType,d.nodeType}catch{l=null;break e}var b=0,w=-1,H=-1,K=0,ne=0,se=e,Q=null;t:for(;;){for(var J;se!==l||c!==0&&se.nodeType!==3||(w=b+c),se!==d||s!==0&&se.nodeType!==3||(H=b+s),se.nodeType===3&&(b+=se.nodeValue.length),(J=se.firstChild)!==null;)Q=se,se=J;for(;;){if(se===e)break t;if(Q===l&&++K===c&&(w=b),Q===d&&++ne===s&&(H=b),(J=se.nextSibling)!==null)break;se=Q,Q=se.parentNode}se=J}l=w===-1||H===-1?null:{start:w,end:H}}else l=null}l=l||{start:0,end:0}}else l=null;for(vu={focusedElem:e,selectionRange:l},Ui=!1,Ut=t;Ut!==null;)if(t=Ut,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ut=e;else for(;Ut!==null;){switch(t=Ut,d=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(l=0;l<e.length;l++)c=e[l],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&d!==null){e=void 0,l=t,c=d.memoizedProps,d=d.memoizedState,s=l.stateNode;try{var Se=pl(l.type,c);e=s.getSnapshotBeforeUpdate(Se,d),s.__reactInternalSnapshotBeforeUpdate=e}catch(Te){lt(l,l.return,Te)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)bu(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":bu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,Ut=e;break}Ut=t.return}}function vm(e,t,l){var s=l.flags;switch(l.tag){case 0:case 11:case 15:fa(e,l),s&4&&Wr(5,l);break;case 1:if(fa(e,l),s&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(b){lt(l,l.return,b)}else{var c=pl(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(b){lt(l,l.return,b)}}s&64&&dm(l),s&512&&Kr(l,l.return);break;case 3:if(fa(e,l),s&64&&(e=l.updateQueue,e!==null)){if(t=null,l.child!==null)switch(l.child.tag){case 27:case 5:t=l.child.stateNode;break;case 1:t=l.child.stateNode}try{tp(e,t)}catch(b){lt(l,l.return,b)}}break;case 27:t===null&&s&4&&hm(l);case 26:case 5:fa(e,l),t===null&&s&4&&pm(l),s&512&&Kr(l,l.return);break;case 12:fa(e,l);break;case 31:fa(e,l),s&4&&bm(e,l);break;case 13:fa(e,l),s&4&&jm(e,l),s&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=Py.bind(null,l),u1(e,l))));break;case 22:if(s=l.memoizedState!==null||ua,!s){t=t!==null&&t.memoizedState!==null||zt,c=ua;var d=zt;ua=s,(zt=t)&&!d?pa(e,l,(l.subtreeFlags&8772)!==0):fa(e,l),ua=c,zt=d}break;case 30:break;default:fa(e,l)}}function gm(e){var t=e.alternate;t!==null&&(e.alternate=null,gm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Co(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var vt=null,sn=!1;function da(e,t,l){for(l=l.child;l!==null;)ym(e,t,l),l=l.sibling}function ym(e,t,l){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(Xn,l)}catch{}switch(l.tag){case 26:zt||Yn(l,t),da(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:zt||Yn(l,t);var s=vt,c=sn;Ia(l.type)&&(vt=l.stateNode,sn=!1),da(e,t,l),ls(l.stateNode),vt=s,sn=c;break;case 5:zt||Yn(l,t);case 6:if(s=vt,c=sn,vt=null,da(e,t,l),vt=s,sn=c,vt!==null)if(sn)try{(vt.nodeType===9?vt.body:vt.nodeName==="HTML"?vt.ownerDocument.body:vt).removeChild(l.stateNode)}catch(d){lt(l,t,d)}else try{vt.removeChild(l.stateNode)}catch(d){lt(l,t,d)}break;case 18:vt!==null&&(sn?(e=vt,dh(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),sr(e)):dh(vt,l.stateNode));break;case 4:s=vt,c=sn,vt=l.stateNode.containerInfo,sn=!0,da(e,t,l),vt=s,sn=c;break;case 0:case 11:case 14:case 15:Ma(2,l,t),zt||Ma(4,l,t),da(e,t,l);break;case 1:zt||(Yn(l,t),s=l.stateNode,typeof s.componentWillUnmount=="function"&&fm(l,t,s)),da(e,t,l);break;case 21:da(e,t,l);break;case 22:zt=(s=zt)||l.memoizedState!==null,da(e,t,l),zt=s;break;default:da(e,t,l)}}function bm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{sr(e)}catch(l){lt(t,t.return,l)}}}function jm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{sr(e)}catch(l){lt(t,t.return,l)}}function Oy(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new xm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new xm),t;default:throw Error(o(435,e.tag))}}function bi(e,t){var l=Oy(e);t.forEach(function(s){if(!l.has(s)){l.add(s);var c=qy.bind(null,e,s);s.then(c,c)}})}function on(e,t){var l=t.deletions;if(l!==null)for(var s=0;s<l.length;s++){var c=l[s],d=e,b=t,w=b;e:for(;w!==null;){switch(w.tag){case 27:if(Ia(w.type)){vt=w.stateNode,sn=!1;break e}break;case 5:vt=w.stateNode,sn=!1;break e;case 3:case 4:vt=w.stateNode.containerInfo,sn=!0;break e}w=w.return}if(vt===null)throw Error(o(160));ym(d,b,c),vt=null,sn=!1,d=c.alternate,d!==null&&(d.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Sm(t,e),t=t.sibling}var Un=null;function Sm(e,t){var l=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:on(t,e),cn(e),s&4&&(Ma(3,e,e.return),Wr(3,e),Ma(5,e,e.return));break;case 1:on(t,e),cn(e),s&512&&(zt||l===null||Yn(l,l.return)),s&64&&ua&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?s:l.concat(s))));break;case 26:var c=Un;if(on(t,e),cn(e),s&512&&(zt||l===null||Yn(l,l.return)),s&4){var d=l!==null?l.memoizedState:null;if(s=e.memoizedState,l===null)if(s===null)if(e.stateNode===null){e:{s=e.type,l=e.memoizedProps,c=c.ownerDocument||c;t:switch(s){case"title":d=c.getElementsByTagName("title")[0],(!d||d[Sr]||d[Gt]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=c.createElement(s),c.head.insertBefore(d,c.querySelector("head > title"))),Ft(d,s,l),d[Gt]=e,Ht(d),s=d;break e;case"link":var b=Sh("link","href",c).get(s+(l.href||""));if(b){for(var w=0;w<b.length;w++)if(d=b[w],d.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&d.getAttribute("rel")===(l.rel==null?null:l.rel)&&d.getAttribute("title")===(l.title==null?null:l.title)&&d.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){b.splice(w,1);break t}}d=c.createElement(s),Ft(d,s,l),c.head.appendChild(d);break;case"meta":if(b=Sh("meta","content",c).get(s+(l.content||""))){for(w=0;w<b.length;w++)if(d=b[w],d.getAttribute("content")===(l.content==null?null:""+l.content)&&d.getAttribute("name")===(l.name==null?null:l.name)&&d.getAttribute("property")===(l.property==null?null:l.property)&&d.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&d.getAttribute("charset")===(l.charSet==null?null:l.charSet)){b.splice(w,1);break t}}d=c.createElement(s),Ft(d,s,l),c.head.appendChild(d);break;default:throw Error(o(468,s))}d[Gt]=e,Ht(d),s=d}e.stateNode=s}else kh(c,e.type,e.stateNode);else e.stateNode=jh(c,s,e.memoizedProps);else d!==s?(d===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):d.count--,s===null?kh(c,e.type,e.stateNode):jh(c,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Yc(e,e.memoizedProps,l.memoizedProps)}break;case 27:on(t,e),cn(e),s&512&&(zt||l===null||Yn(l,l.return)),l!==null&&s&4&&Yc(e,e.memoizedProps,l.memoizedProps);break;case 5:if(on(t,e),cn(e),s&512&&(zt||l===null||Yn(l,l.return)),e.flags&32){c=e.stateNode;try{Rl(c,"")}catch(Se){lt(e,e.return,Se)}}s&4&&e.stateNode!=null&&(c=e.memoizedProps,Yc(e,c,l!==null?l.memoizedProps:c)),s&1024&&(Kc=!0);break;case 6:if(on(t,e),cn(e),s&4){if(e.stateNode===null)throw Error(o(162));s=e.memoizedProps,l=e.stateNode;try{l.nodeValue=s}catch(Se){lt(e,e.return,Se)}}break;case 3:if(Oi=null,c=Un,Un=Li(t.containerInfo),on(t,e),Un=c,cn(e),s&4&&l!==null&&l.memoizedState.isDehydrated)try{sr(t.containerInfo)}catch(Se){lt(e,e.return,Se)}Kc&&(Kc=!1,km(e));break;case 4:s=Un,Un=Li(e.stateNode.containerInfo),on(t,e),cn(e),Un=s;break;case 12:on(t,e),cn(e);break;case 31:on(t,e),cn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,bi(e,s)));break;case 13:on(t,e),cn(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Si=tt()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,bi(e,s)));break;case 22:c=e.memoizedState!==null;var H=l!==null&&l.memoizedState!==null,K=ua,ne=zt;if(ua=K||c,zt=ne||H,on(t,e),zt=ne,ua=K,cn(e),s&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(l===null||H||ua||zt||ml(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){H=l=t;try{if(d=H.stateNode,c)b=d.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{w=H.stateNode;var se=H.memoizedProps.style,Q=se!=null&&se.hasOwnProperty("display")?se.display:null;w.style.display=Q==null||typeof Q=="boolean"?"":(""+Q).trim()}}catch(Se){lt(H,H.return,Se)}}}else if(t.tag===6){if(l===null){H=t;try{H.stateNode.nodeValue=c?"":H.memoizedProps}catch(Se){lt(H,H.return,Se)}}}else if(t.tag===18){if(l===null){H=t;try{var J=H.stateNode;c?fh(J,!0):fh(H.stateNode,!1)}catch(Se){lt(H,H.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}s&4&&(s=e.updateQueue,s!==null&&(l=s.retryQueue,l!==null&&(s.retryQueue=null,bi(e,l))));break;case 19:on(t,e),cn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,bi(e,s)));break;case 30:break;case 21:break;default:on(t,e),cn(e)}}function cn(e){var t=e.flags;if(t&2){try{for(var l,s=e.return;s!==null;){if(mm(s)){l=s;break}s=s.return}if(l==null)throw Error(o(160));switch(l.tag){case 27:var c=l.stateNode,d=Fc(e);yi(e,d,c);break;case 5:var b=l.stateNode;l.flags&32&&(Rl(b,""),l.flags&=-33);var w=Fc(e);yi(e,w,b);break;case 3:case 4:var H=l.stateNode.containerInfo,K=Fc(e);Wc(e,K,H);break;default:throw Error(o(161))}}catch(ne){lt(e,e.return,ne)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function km(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;km(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function fa(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)vm(e,t.alternate,t),t=t.sibling}function ml(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ma(4,t,t.return),ml(t);break;case 1:Yn(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&fm(t,t.return,l),ml(t);break;case 27:ls(t.stateNode);case 26:case 5:Yn(t,t.return),ml(t);break;case 22:t.memoizedState===null&&ml(t);break;case 30:ml(t);break;default:ml(t)}e=e.sibling}}function pa(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,c=e,d=t,b=d.flags;switch(d.tag){case 0:case 11:case 15:pa(c,d,l),Wr(4,d);break;case 1:if(pa(c,d,l),s=d,c=s.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(K){lt(s,s.return,K)}if(s=d,c=s.updateQueue,c!==null){var w=s.stateNode;try{var H=c.shared.hiddenCallbacks;if(H!==null)for(c.shared.hiddenCallbacks=null,c=0;c<H.length;c++)ep(H[c],w)}catch(K){lt(s,s.return,K)}}l&&b&64&&dm(d),Kr(d,d.return);break;case 27:hm(d);case 26:case 5:pa(c,d,l),l&&s===null&&b&4&&pm(d),Kr(d,d.return);break;case 12:pa(c,d,l);break;case 31:pa(c,d,l),l&&b&4&&bm(c,d);break;case 13:pa(c,d,l),l&&b&4&&jm(c,d);break;case 22:d.memoizedState===null&&pa(c,d,l),Kr(d,d.return);break;case 30:break;default:pa(c,d,l)}t=t.sibling}}function Qc(e,t){var l=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==l&&(e!=null&&e.refCount++,l!=null&&_r(l))}function Xc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&_r(e))}function Vn(e,t,l,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)wm(e,t,l,s),t=t.sibling}function wm(e,t,l,s){var c=t.flags;switch(t.tag){case 0:case 11:case 15:Vn(e,t,l,s),c&2048&&Wr(9,t);break;case 1:Vn(e,t,l,s);break;case 3:Vn(e,t,l,s),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&_r(e)));break;case 12:if(c&2048){Vn(e,t,l,s),e=t.stateNode;try{var d=t.memoizedProps,b=d.id,w=d.onPostCommit;typeof w=="function"&&w(b,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(H){lt(t,t.return,H)}}else Vn(e,t,l,s);break;case 31:Vn(e,t,l,s);break;case 13:Vn(e,t,l,s);break;case 23:break;case 22:d=t.stateNode,b=t.alternate,t.memoizedState!==null?d._visibility&2?Vn(e,t,l,s):Qr(e,t):d._visibility&2?Vn(e,t,l,s):(d._visibility|=2,Kl(e,t,l,s,(t.subtreeFlags&10256)!==0||!1)),c&2048&&Qc(b,t);break;case 24:Vn(e,t,l,s),c&2048&&Xc(t.alternate,t);break;default:Vn(e,t,l,s)}}function Kl(e,t,l,s,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,b=t,w=l,H=s,K=b.flags;switch(b.tag){case 0:case 11:case 15:Kl(d,b,w,H,c),Wr(8,b);break;case 23:break;case 22:var ne=b.stateNode;b.memoizedState!==null?ne._visibility&2?Kl(d,b,w,H,c):Qr(d,b):(ne._visibility|=2,Kl(d,b,w,H,c)),c&&K&2048&&Qc(b.alternate,b);break;case 24:Kl(d,b,w,H,c),c&&K&2048&&Xc(b.alternate,b);break;default:Kl(d,b,w,H,c)}t=t.sibling}}function Qr(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,s=t,c=s.flags;switch(s.tag){case 22:Qr(l,s),c&2048&&Qc(s.alternate,s);break;case 24:Qr(l,s),c&2048&&Xc(s.alternate,s);break;default:Qr(l,s)}t=t.sibling}}var Xr=8192;function Ql(e,t,l){if(e.subtreeFlags&Xr)for(e=e.child;e!==null;)Cm(e,t,l),e=e.sibling}function Cm(e,t,l){switch(e.tag){case 26:Ql(e,t,l),e.flags&Xr&&e.memoizedState!==null&&S1(l,Un,e.memoizedState,e.memoizedProps);break;case 5:Ql(e,t,l);break;case 3:case 4:var s=Un;Un=Li(e.stateNode.containerInfo),Ql(e,t,l),Un=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Xr,Xr=16777216,Ql(e,t,l),Xr=s):Ql(e,t,l));break;default:Ql(e,t,l)}}function Nm(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Zr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var s=t[l];Ut=s,Tm(s,e)}Nm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Em(e),e=e.sibling}function Em(e){switch(e.tag){case 0:case 11:case 15:Zr(e),e.flags&2048&&Ma(9,e,e.return);break;case 3:Zr(e);break;case 12:Zr(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,ji(e)):Zr(e);break;default:Zr(e)}}function ji(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var s=t[l];Ut=s,Tm(s,e)}Nm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ma(8,t,t.return),ji(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,ji(t));break;default:ji(t)}e=e.sibling}}function Tm(e,t){for(;Ut!==null;){var l=Ut;switch(l.tag){case 0:case 11:case 15:Ma(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var s=l.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:_r(l.memoizedState.cache)}if(s=l.child,s!==null)s.return=l,Ut=s;else e:for(l=e;Ut!==null;){s=Ut;var c=s.sibling,d=s.return;if(gm(s),s===l){Ut=null;break e}if(c!==null){c.return=d,Ut=c;break e}Ut=d}}}var By={getCacheForType:function(e){var t=qt(At),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return qt(At).controller.signal}},Iy=typeof WeakMap=="function"?WeakMap:Map,Je=0,ut=null,Pe=null,Ye=0,at=0,xn=null,Da=!1,Xl=!1,Zc=!1,ma=0,wt=0,za=0,hl=0,Jc=0,vn=0,Zl=0,Jr=null,un=null,eu=!1,Si=0,Rm=0,ki=1/0,wi=null,La=null,_t=0,_a=null,Jl=null,ha=0,tu=0,nu=null,Am=null,es=0,au=null;function gn(){return(Je&2)!==0&&Ye!==0?Ye&-Ye:E.T!==null?cu():qd()}function Mm(){if(vn===0)if((Ye&536870912)===0||We){var e=It;It<<=1,(It&3932160)===0&&(It=262144),vn=e}else vn=536870912;return e=mn.current,e!==null&&(e.flags|=32),vn}function dn(e,t,l){(e===ut&&(at===2||at===9)||e.cancelPendingCommit!==null)&&(er(e,0),Oa(e,Ye,vn,!1)),jr(e,l),((Je&2)===0||e!==ut)&&(e===ut&&((Je&2)===0&&(hl|=l),wt===4&&Oa(e,Ye,vn,!1)),Fn(e))}function Dm(e,t,l){if((Je&6)!==0)throw Error(o(327));var s=!l&&(t&127)===0&&(t&e.expiredLanes)===0||wn(e,t),c=s?Vy(e,t):ru(e,t,!0),d=s;do{if(c===0){Xl&&!s&&Oa(e,t,0,!1);break}else{if(l=e.current.alternate,d&&!Hy(l)){c=ru(e,t,!1),d=!1;continue}if(c===2){if(d=t,e.errorRecoveryDisabledLanes&d)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){t=b;e:{var w=e;c=Jr;var H=w.current.memoizedState.isDehydrated;if(H&&(er(w,b).flags|=256),b=ru(w,b,!1),b!==2){if(Zc&&!H){w.errorRecoveryDisabledLanes|=d,hl|=d,c=4;break e}d=un,un=c,d!==null&&(un===null?un=d:un.push.apply(un,d))}c=b}if(d=!1,c!==2)continue}}if(c===1){er(e,0),Oa(e,t,0,!0);break}e:{switch(s=e,d=c,d){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:Oa(s,t,vn,!Da);break e;case 2:un=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(c=Si+300-tt(),10<c)){if(Oa(s,t,vn,!Da),br(s,0,!0)!==0)break e;ha=t,s.timeoutHandle=ch(zm.bind(null,s,l,un,wi,eu,t,vn,hl,Zl,Da,d,"Throttled",-0,0),c);break e}zm(s,l,un,wi,eu,t,vn,hl,Zl,Da,d,null,-0,0)}}break}while(!0);Fn(e)}function zm(e,t,l,s,c,d,b,w,H,K,ne,se,Q,J){if(e.timeoutHandle=-1,se=t.subtreeFlags,se&8192||(se&16785408)===16785408){se={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ea},Cm(t,d,se);var Se=(d&62914560)===d?Si-tt():(d&4194048)===d?Rm-tt():0;if(Se=k1(se,Se),Se!==null){ha=d,e.cancelPendingCommit=Se(Vm.bind(null,e,t,d,l,s,c,b,w,H,ne,se,null,Q,J)),Oa(e,d,b,!K);return}}Vm(e,t,d,l,s,c,b,w,H)}function Hy(e){for(var t=e;;){var l=t.tag;if((l===0||l===11||l===15)&&t.flags&16384&&(l=t.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var s=0;s<l.length;s++){var c=l[s],d=c.getSnapshot;c=c.value;try{if(!fn(d(),c))return!1}catch{return!1}}if(l=t.child,t.subtreeFlags&16384&&l!==null)l.return=t,t=l;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Oa(e,t,l,s){t&=~Jc,t&=~hl,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var c=t;0<c;){var d=31-bt(c),b=1<<d;s[d]=-1,c&=~b}l!==0&&$d(e,l,t)}function Ci(){return(Je&6)===0?(ts(0),!1):!0}function lu(){if(Pe!==null){if(at===0)var e=Pe.return;else e=Pe,la=sl=null,bc(e),Pl=null,Br=0,e=Pe;for(;e!==null;)um(e.alternate,e),e=e.return;Pe=null}}function er(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,r1(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),ha=0,lu(),ut=e,Pe=l=na(e.current,null),Ye=t,at=0,xn=null,Da=!1,Xl=wn(e,t),Zc=!1,Zl=vn=Jc=hl=za=wt=0,un=Jr=null,eu=!1,(t&8)!==0&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var c=31-bt(s),d=1<<c;t|=e[c],s&=~d}return ma=t,Ys(),l}function Lm(e,t){Oe=null,E.H=qr,t===Gl||t===ei?(t=Qf(),at=3):t===oc?(t=Qf(),at=4):at=t===Oc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,xn=t,Pe===null&&(wt=1,mi(e,Tn(t,e.current)))}function _m(){var e=mn.current;return e===null?!0:(Ye&4194048)===Ye?Dn===null:(Ye&62914560)===Ye||(Ye&536870912)!==0?e===Dn:!1}function Om(){var e=E.H;return E.H=qr,e===null?qr:e}function Bm(){var e=E.A;return E.A=By,e}function Ni(){wt=4,Da||(Ye&4194048)!==Ye&&mn.current!==null||(Xl=!0),(za&134217727)===0&&(hl&134217727)===0||ut===null||Oa(ut,Ye,vn,!1)}function ru(e,t,l){var s=Je;Je|=2;var c=Om(),d=Bm();(ut!==e||Ye!==t)&&(wi=null,er(e,t)),t=!1;var b=wt;e:do try{if(at!==0&&Pe!==null){var w=Pe,H=xn;switch(at){case 8:lu(),b=6;break e;case 3:case 2:case 9:case 6:mn.current===null&&(t=!0);var K=at;if(at=0,xn=null,tr(e,w,H,K),l&&Xl){b=0;break e}break;default:K=at,at=0,xn=null,tr(e,w,H,K)}}Uy(),b=wt;break}catch(ne){Lm(e,ne)}while(!0);return t&&e.shellSuspendCounter++,la=sl=null,Je=s,E.H=c,E.A=d,Pe===null&&(ut=null,Ye=0,Ys()),b}function Uy(){for(;Pe!==null;)Im(Pe)}function Vy(e,t){var l=Je;Je|=2;var s=Om(),c=Bm();ut!==e||Ye!==t?(wi=null,ki=tt()+500,er(e,t)):Xl=wn(e,t);e:do try{if(at!==0&&Pe!==null){t=Pe;var d=xn;t:switch(at){case 1:at=0,xn=null,tr(e,t,d,1);break;case 2:case 9:if(Wf(d)){at=0,xn=null,Hm(t);break}t=function(){at!==2&&at!==9||ut!==e||(at=7),Fn(e)},d.then(t,t);break e;case 3:at=7;break e;case 4:at=5;break e;case 7:Wf(d)?(at=0,xn=null,Hm(t)):(at=0,xn=null,tr(e,t,d,7));break;case 5:var b=null;switch(Pe.tag){case 26:b=Pe.memoizedState;case 5:case 27:var w=Pe;if(b?wh(b):w.stateNode.complete){at=0,xn=null;var H=w.sibling;if(H!==null)Pe=H;else{var K=w.return;K!==null?(Pe=K,Ei(K)):Pe=null}break t}}at=0,xn=null,tr(e,t,d,5);break;case 6:at=0,xn=null,tr(e,t,d,6);break;case 8:lu(),wt=6;break e;default:throw Error(o(462))}}$y();break}catch(ne){Lm(e,ne)}while(!0);return la=sl=null,E.H=s,E.A=c,Je=l,Pe!==null?0:(ut=null,Ye=0,Ys(),wt)}function $y(){for(;Pe!==null&&!Vt();)Im(Pe)}function Im(e){var t=om(e.alternate,e,ma);e.memoizedProps=e.pendingProps,t===null?Ei(e):Pe=t}function Hm(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=nm(l,t,t.pendingProps,t.type,void 0,Ye);break;case 11:t=nm(l,t,t.pendingProps,t.type.render,t.ref,Ye);break;case 5:bc(t);default:um(l,t),t=Pe=Bf(t,ma),t=om(l,t,ma)}e.memoizedProps=e.pendingProps,t===null?Ei(e):Pe=t}function tr(e,t,l,s){la=sl=null,bc(t),Pl=null,Br=0;var c=t.return;try{if(Ay(e,c,t,l,Ye)){wt=1,mi(e,Tn(l,e.current)),Pe=null;return}}catch(d){if(c!==null)throw Pe=c,d;wt=1,mi(e,Tn(l,e.current)),Pe=null;return}t.flags&32768?(We||s===1?e=!0:Xl||(Ye&536870912)!==0?e=!1:(Da=e=!0,(s===2||s===9||s===3||s===6)&&(s=mn.current,s!==null&&s.tag===13&&(s.flags|=16384))),Um(t,e)):Ei(t)}function Ei(e){var t=e;do{if((t.flags&32768)!==0){Um(t,Da);return}e=t.return;var l=zy(t.alternate,t,ma);if(l!==null){Pe=l;return}if(t=t.sibling,t!==null){Pe=t;return}Pe=t=e}while(t!==null);wt===0&&(wt=5)}function Um(e,t){do{var l=Ly(e.alternate,e);if(l!==null){l.flags&=32767,Pe=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){Pe=e;return}Pe=e=l}while(e!==null);wt=6,Pe=null}function Vm(e,t,l,s,c,d,b,w,H){e.cancelPendingCommit=null;do Ti();while(_t!==0);if((Je&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(d=t.lanes|t.childLanes,d|=Fo,jg(e,l,d,b,w,H),e===ut&&(Pe=ut=null,Ye=0),Jl=t,_a=e,ha=l,tu=d,nu=c,Am=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Yy(De,function(){return Ym(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=E.T,E.T=null,c=O.p,O.p=2,b=Je,Je|=4;try{_y(e,t,l)}finally{Je=b,O.p=c,E.T=s}}_t=1,$m(),Gm(),Pm()}}function $m(){if(_t===1){_t=0;var e=_a,t=Jl,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=E.T,E.T=null;var s=O.p;O.p=2;var c=Je;Je|=4;try{Sm(t,e);var d=vu,b=Tf(e.containerInfo),w=d.focusedElem,H=d.selectionRange;if(b!==w&&w&&w.ownerDocument&&Ef(w.ownerDocument.documentElement,w)){if(H!==null&&$o(w)){var K=H.start,ne=H.end;if(ne===void 0&&(ne=K),"selectionStart"in w)w.selectionStart=K,w.selectionEnd=Math.min(ne,w.value.length);else{var se=w.ownerDocument||document,Q=se&&se.defaultView||window;if(Q.getSelection){var J=Q.getSelection(),Se=w.textContent.length,Te=Math.min(H.start,Se),it=H.end===void 0?Te:Math.min(H.end,Se);!J.extend&&Te>it&&(b=it,it=Te,Te=b);var G=Nf(w,Te),$=Nf(w,it);if(G&&$&&(J.rangeCount!==1||J.anchorNode!==G.node||J.anchorOffset!==G.offset||J.focusNode!==$.node||J.focusOffset!==$.offset)){var W=se.createRange();W.setStart(G.node,G.offset),J.removeAllRanges(),Te>it?(J.addRange(W),J.extend($.node,$.offset)):(W.setEnd($.node,$.offset),J.addRange(W))}}}}for(se=[],J=w;J=J.parentNode;)J.nodeType===1&&se.push({element:J,left:J.scrollLeft,top:J.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<se.length;w++){var re=se[w];re.element.scrollLeft=re.left,re.element.scrollTop=re.top}}Ui=!!xu,vu=xu=null}finally{Je=c,O.p=s,E.T=l}}e.current=t,_t=2}}function Gm(){if(_t===2){_t=0;var e=_a,t=Jl,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=E.T,E.T=null;var s=O.p;O.p=2;var c=Je;Je|=4;try{vm(e,t.alternate,t)}finally{Je=c,O.p=s,E.T=l}}_t=3}}function Pm(){if(_t===4||_t===3){_t=0,$t();var e=_a,t=Jl,l=ha,s=Am;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?_t=5:(_t=0,Jl=_a=null,qm(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(La=null),ko(l),t=t.stateNode,Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(Xn,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=E.T,c=O.p,O.p=2,E.T=null;try{for(var d=e.onRecoverableError,b=0;b<s.length;b++){var w=s[b];d(w.value,{componentStack:w.stack})}}finally{E.T=t,O.p=c}}(ha&3)!==0&&Ti(),Fn(e),c=e.pendingLanes,(l&261930)!==0&&(c&42)!==0?e===au?es++:(es=0,au=e):es=0,ts(0)}}function qm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,_r(t)))}function Ti(){return $m(),Gm(),Pm(),Ym()}function Ym(){if(_t!==5)return!1;var e=_a,t=tu;tu=0;var l=ko(ha),s=E.T,c=O.p;try{O.p=32>l?32:l,E.T=null,l=nu,nu=null;var d=_a,b=ha;if(_t=0,Jl=_a=null,ha=0,(Je&6)!==0)throw Error(o(331));var w=Je;if(Je|=4,Em(d.current),wm(d,d.current,b,l),Je=w,ts(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(Xn,d)}catch{}return!0}finally{O.p=c,E.T=s,qm(e,t)}}function Fm(e,t,l){t=Tn(l,t),t=_c(e.stateNode,t,2),e=Ta(e,t,2),e!==null&&(jr(e,2),Fn(e))}function lt(e,t,l){if(e.tag===3)Fm(e,e,l);else for(;t!==null;){if(t.tag===3){Fm(t,e,l);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(La===null||!La.has(s))){e=Tn(l,e),l=Wp(2),s=Ta(t,l,2),s!==null&&(Kp(l,s,t,e),jr(s,2),Fn(s));break}}t=t.return}}function su(e,t,l){var s=e.pingCache;if(s===null){s=e.pingCache=new Iy;var c=new Set;s.set(t,c)}else c=s.get(t),c===void 0&&(c=new Set,s.set(t,c));c.has(l)||(Zc=!0,c.add(l),e=Gy.bind(null,e,t,l),t.then(e,e))}function Gy(e,t,l){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,ut===e&&(Ye&l)===l&&(wt===4||wt===3&&(Ye&62914560)===Ye&&300>tt()-Si?(Je&2)===0&&er(e,0):Jc|=l,Zl===Ye&&(Zl=0)),Fn(e)}function Wm(e,t){t===0&&(t=Vd()),e=al(e,t),e!==null&&(jr(e,t),Fn(e))}function Py(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),Wm(e,l)}function qy(e,t){var l=0;switch(e.tag){case 31:case 13:var s=e.stateNode,c=e.memoizedState;c!==null&&(l=c.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(o(314))}s!==null&&s.delete(t),Wm(e,l)}function Yy(e,t){return Zt(e,t)}var Ri=null,nr=null,iu=!1,Ai=!1,ou=!1,Ba=0;function Fn(e){e!==nr&&e.next===null&&(nr===null?Ri=nr=e:nr=nr.next=e),Ai=!0,iu||(iu=!0,Wy())}function ts(e,t){if(!ou&&Ai){ou=!0;do for(var l=!1,s=Ri;s!==null;){if(e!==0){var c=s.pendingLanes;if(c===0)var d=0;else{var b=s.suspendedLanes,w=s.pingedLanes;d=(1<<31-bt(42|e)+1)-1,d&=c&~(b&~w),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(l=!0,Zm(s,d))}else d=Ye,d=br(s,s===ut?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(d&3)===0||wn(s,d)||(l=!0,Zm(s,d));s=s.next}while(l);ou=!1}}function Fy(){Km()}function Km(){Ai=iu=!1;var e=0;Ba!==0&&l1()&&(e=Ba);for(var t=tt(),l=null,s=Ri;s!==null;){var c=s.next,d=Qm(s,t);d===0?(s.next=null,l===null?Ri=c:l.next=c,c===null&&(nr=l)):(l=s,(e!==0||(d&3)!==0)&&(Ai=!0)),s=c}_t!==0&&_t!==5||ts(e),Ba!==0&&(Ba=0)}function Qm(e,t){for(var l=e.suspendedLanes,s=e.pingedLanes,c=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var b=31-bt(d),w=1<<b,H=c[b];H===-1?((w&l)===0||(w&s)!==0)&&(c[b]=bo(w,t)):H<=t&&(e.expiredLanes|=w),d&=~w}if(t=ut,l=Ye,l=br(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,l===0||e===t&&(at===2||at===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&ct(s),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||wn(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(s!==null&&ct(s),ko(l)){case 2:case 8:l=Rt;break;case 32:l=De;break;case 268435456:l=Wt;break;default:l=De}return s=Xm.bind(null,e),l=Zt(l,s),e.callbackPriority=t,e.callbackNode=l,t}return s!==null&&s!==null&&ct(s),e.callbackPriority=2,e.callbackNode=null,2}function Xm(e,t){if(_t!==0&&_t!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(Ti()&&e.callbackNode!==l)return null;var s=Ye;return s=br(e,e===ut?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Dm(e,s,t),Qm(e,tt()),e.callbackNode!=null&&e.callbackNode===l?Xm.bind(null,e):null)}function Zm(e,t){if(Ti())return null;Dm(e,t,!0)}function Wy(){s1(function(){(Je&6)!==0?Zt(ye,Fy):Km()})}function cu(){if(Ba===0){var e=Vl;e===0&&(e=Ve,Ve<<=1,(Ve&261888)===0&&(Ve=256)),Ba=e}return Ba}function Jm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Is(""+e)}function eh(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 Ky(e,t,l,s,c){if(t==="submit"&&l&&l.stateNode===c){var d=Jm((c[ln]||null).action),b=s.submitter;b&&(t=(t=b[ln]||null)?Jm(t.formAction):b.getAttribute("formAction"),t!==null&&(d=t,b=null));var w=new $s("action","action",null,s,c);e.push({event:w,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Ba!==0){var H=b?eh(c,b):new FormData(c);Rc(l,{pending:!0,data:H,method:c.method,action:d},null,H)}}else typeof d=="function"&&(w.preventDefault(),H=b?eh(c,b):new FormData(c),Rc(l,{pending:!0,data:H,method:c.method,action:d},d,H))},currentTarget:c}]})}}for(var uu=0;uu<Yo.length;uu++){var du=Yo[uu],Qy=du.toLowerCase(),Xy=du[0].toUpperCase()+du.slice(1);Hn(Qy,"on"+Xy)}Hn(Mf,"onAnimationEnd"),Hn(Df,"onAnimationIteration"),Hn(zf,"onAnimationStart"),Hn("dblclick","onDoubleClick"),Hn("focusin","onFocus"),Hn("focusout","onBlur"),Hn(py,"onTransitionRun"),Hn(my,"onTransitionStart"),Hn(hy,"onTransitionCancel"),Hn(Lf,"onTransitionEnd"),El("onMouseEnter",["mouseout","mouseover"]),El("onMouseLeave",["mouseout","mouseover"]),El("onPointerEnter",["pointerout","pointerover"]),El("onPointerLeave",["pointerout","pointerover"]),Ja("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ja("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ja("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ja("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ja("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ja("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ns="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Zy=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ns));function th(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var s=e[l],c=s.event;s=s.listeners;e:{var d=void 0;if(t)for(var b=s.length-1;0<=b;b--){var w=s[b],H=w.instance,K=w.currentTarget;if(w=w.listener,H!==d&&c.isPropagationStopped())break e;d=w,c.currentTarget=K;try{d(c)}catch(ne){qs(ne)}c.currentTarget=null,d=H}else for(b=0;b<s.length;b++){if(w=s[b],H=w.instance,K=w.currentTarget,w=w.listener,H!==d&&c.isPropagationStopped())break e;d=w,c.currentTarget=K;try{d(c)}catch(ne){qs(ne)}c.currentTarget=null,d=H}}}}function qe(e,t){var l=t[wo];l===void 0&&(l=t[wo]=new Set);var s=e+"__bubble";l.has(s)||(nh(t,e,2,!1),l.add(s))}function fu(e,t,l){var s=0;t&&(s|=4),nh(l,e,s,t)}var Mi="_reactListening"+Math.random().toString(36).slice(2);function pu(e){if(!e[Mi]){e[Mi]=!0,Wd.forEach(function(l){l!=="selectionchange"&&(Zy.has(l)||fu(l,!1,e),fu(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Mi]||(t[Mi]=!0,fu("selectionchange",!1,t))}}function nh(e,t,l,s){switch(Mh(t)){case 2:var c=N1;break;case 8:c=E1;break;default:c=Tu}l=c.bind(null,t,l,e),c=void 0,!zo||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),s?c!==void 0?e.addEventListener(t,l,{capture:!0,passive:c}):e.addEventListener(t,l,!0):c!==void 0?e.addEventListener(t,l,{passive:c}):e.addEventListener(t,l,!1)}function mu(e,t,l,s,c){var d=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var b=s.tag;if(b===3||b===4){var w=s.stateNode.containerInfo;if(w===c)break;if(b===4)for(b=s.return;b!==null;){var H=b.tag;if((H===3||H===4)&&b.stateNode.containerInfo===c)return;b=b.return}for(;w!==null;){if(b=wl(w),b===null)return;if(H=b.tag,H===5||H===6||H===26||H===27){s=d=b;continue e}w=w.parentNode}}s=s.return}sf(function(){var K=d,ne=Mo(l),se=[];e:{var Q=_f.get(e);if(Q!==void 0){var J=$s,Se=e;switch(e){case"keypress":if(Us(l)===0)break e;case"keydown":case"keyup":J=qg;break;case"focusin":Se="focus",J=Bo;break;case"focusout":Se="blur",J=Bo;break;case"beforeblur":case"afterblur":J=Bo;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":J=uf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":J=zg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":J=Wg;break;case Mf:case Df:case zf:J=Og;break;case Lf:J=Qg;break;case"scroll":case"scrollend":J=Mg;break;case"wheel":J=Zg;break;case"copy":case"cut":case"paste":J=Ig;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":J=ff;break;case"toggle":case"beforetoggle":J=ey}var Te=(t&4)!==0,it=!Te&&(e==="scroll"||e==="scrollend"),G=Te?Q!==null?Q+"Capture":null:Q;Te=[];for(var $=K,W;$!==null;){var re=$;if(W=re.stateNode,re=re.tag,re!==5&&re!==26&&re!==27||W===null||G===null||(re=wr($,G),re!=null&&Te.push(as($,re,W))),it)break;$=$.return}0<Te.length&&(Q=new J(Q,Se,null,l,ne),se.push({event:Q,listeners:Te}))}}if((t&7)===0){e:{if(Q=e==="mouseover"||e==="pointerover",J=e==="mouseout"||e==="pointerout",Q&&l!==Ao&&(Se=l.relatedTarget||l.fromElement)&&(wl(Se)||Se[kl]))break e;if((J||Q)&&(Q=ne.window===ne?ne:(Q=ne.ownerDocument)?Q.defaultView||Q.parentWindow:window,J?(Se=l.relatedTarget||l.toElement,J=K,Se=Se?wl(Se):null,Se!==null&&(it=m(Se),Te=Se.tag,Se!==it||Te!==5&&Te!==27&&Te!==6)&&(Se=null)):(J=null,Se=K),J!==Se)){if(Te=uf,re="onMouseLeave",G="onMouseEnter",$="mouse",(e==="pointerout"||e==="pointerover")&&(Te=ff,re="onPointerLeave",G="onPointerEnter",$="pointer"),it=J==null?Q:kr(J),W=Se==null?Q:kr(Se),Q=new Te(re,$+"leave",J,l,ne),Q.target=it,Q.relatedTarget=W,re=null,wl(ne)===K&&(Te=new Te(G,$+"enter",Se,l,ne),Te.target=W,Te.relatedTarget=it,re=Te),it=re,J&&Se)t:{for(Te=Jy,G=J,$=Se,W=0,re=G;re;re=Te(re))W++;re=0;for(var Ee=$;Ee;Ee=Te(Ee))re++;for(;0<W-re;)G=Te(G),W--;for(;0<re-W;)$=Te($),re--;for(;W--;){if(G===$||$!==null&&G===$.alternate){Te=G;break t}G=Te(G),$=Te($)}Te=null}else Te=null;J!==null&&ah(se,Q,J,Te,!1),Se!==null&&it!==null&&ah(se,it,Se,Te,!0)}}e:{if(Q=K?kr(K):window,J=Q.nodeName&&Q.nodeName.toLowerCase(),J==="select"||J==="input"&&Q.type==="file")var Qe=bf;else if(gf(Q))if(jf)Qe=uy;else{Qe=oy;var ke=iy}else J=Q.nodeName,!J||J.toLowerCase()!=="input"||Q.type!=="checkbox"&&Q.type!=="radio"?K&&Ro(K.elementType)&&(Qe=bf):Qe=cy;if(Qe&&(Qe=Qe(e,K))){yf(se,Qe,l,ne);break e}ke&&ke(e,Q,K),e==="focusout"&&K&&Q.type==="number"&&K.memoizedProps.value!=null&&To(Q,"number",Q.value)}switch(ke=K?kr(K):window,e){case"focusin":(gf(ke)||ke.contentEditable==="true")&&(zl=ke,Go=K,Dr=null);break;case"focusout":Dr=Go=zl=null;break;case"mousedown":Po=!0;break;case"contextmenu":case"mouseup":case"dragend":Po=!1,Rf(se,l,ne);break;case"selectionchange":if(fy)break;case"keydown":case"keyup":Rf(se,l,ne)}var Ie;if(Ho)e:{switch(e){case"compositionstart":var Fe="onCompositionStart";break e;case"compositionend":Fe="onCompositionEnd";break e;case"compositionupdate":Fe="onCompositionUpdate";break e}Fe=void 0}else Dl?xf(e,l)&&(Fe="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(Fe="onCompositionStart");Fe&&(pf&&l.locale!=="ko"&&(Dl||Fe!=="onCompositionStart"?Fe==="onCompositionEnd"&&Dl&&(Ie=of()):(ja=ne,Lo="value"in ja?ja.value:ja.textContent,Dl=!0)),ke=Di(K,Fe),0<ke.length&&(Fe=new df(Fe,e,null,l,ne),se.push({event:Fe,listeners:ke}),Ie?Fe.data=Ie:(Ie=vf(l),Ie!==null&&(Fe.data=Ie)))),(Ie=ny?ay(e,l):ly(e,l))&&(Fe=Di(K,"onBeforeInput"),0<Fe.length&&(ke=new df("onBeforeInput","beforeinput",null,l,ne),se.push({event:ke,listeners:Fe}),ke.data=Ie)),Ky(se,e,K,l,ne)}th(se,t)})}function as(e,t,l){return{instance:e,listener:t,currentTarget:l}}function Di(e,t){for(var l=t+"Capture",s=[];e!==null;){var c=e,d=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||d===null||(c=wr(e,l),c!=null&&s.unshift(as(e,c,d)),c=wr(e,t),c!=null&&s.push(as(e,c,d))),e.tag===3)return s;e=e.return}return[]}function Jy(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function ah(e,t,l,s,c){for(var d=t._reactName,b=[];l!==null&&l!==s;){var w=l,H=w.alternate,K=w.stateNode;if(w=w.tag,H!==null&&H===s)break;w!==5&&w!==26&&w!==27||K===null||(H=K,c?(K=wr(l,d),K!=null&&b.unshift(as(l,K,H))):c||(K=wr(l,d),K!=null&&b.push(as(l,K,H)))),l=l.return}b.length!==0&&e.push({event:t,listeners:b})}var e1=/\r\n?/g,t1=/\u0000|\uFFFD/g;function lh(e){return(typeof e=="string"?e:""+e).replace(e1,`
50
+ `).replace(t1,"")}function rh(e,t){return t=lh(t),lh(e)===t}function st(e,t,l,s,c,d){switch(l){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||Rl(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&Rl(e,""+s);break;case"className":Os(e,"class",s);break;case"tabIndex":Os(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Os(e,l,s);break;case"style":lf(e,s,d);break;case"data":if(t!=="object"){Os(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(l);break}s=Is(""+s),e.setAttribute(l,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof d=="function"&&(l==="formAction"?(t!=="input"&&st(e,t,"name",c.name,c,null),st(e,t,"formEncType",c.formEncType,c,null),st(e,t,"formMethod",c.formMethod,c,null),st(e,t,"formTarget",c.formTarget,c,null)):(st(e,t,"encType",c.encType,c,null),st(e,t,"method",c.method,c,null),st(e,t,"target",c.target,c,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(l);break}s=Is(""+s),e.setAttribute(l,s);break;case"onClick":s!=null&&(e.onclick=ea);break;case"onScroll":s!=null&&qe("scroll",e);break;case"onScrollEnd":s!=null&&qe("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(l=s.__html,l!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}l=Is(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,""+s):e.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":s===!0?e.setAttribute(l,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,s):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(l,s):e.removeAttribute(l);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(l):e.setAttribute(l,s);break;case"popover":qe("beforetoggle",e),qe("toggle",e),_s(e,"popover",s);break;case"xlinkActuate":Jn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Jn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Jn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Jn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Jn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Jn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Jn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Jn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Jn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":_s(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Rg.get(l)||l,_s(e,l,s))}}function hu(e,t,l,s,c,d){switch(l){case"style":lf(e,s,d);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(l=s.__html,l!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"children":typeof s=="string"?Rl(e,s):(typeof s=="number"||typeof s=="bigint")&&Rl(e,""+s);break;case"onScroll":s!=null&&qe("scroll",e);break;case"onScrollEnd":s!=null&&qe("scrollend",e);break;case"onClick":s!=null&&(e.onclick=ea);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Kd.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(c=l.endsWith("Capture"),t=l.slice(2,c?l.length-7:void 0),d=e[ln]||null,d=d!=null?d[l]:null,typeof d=="function"&&e.removeEventListener(t,d,c),typeof s=="function")){typeof d!="function"&&d!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,s,c);break e}l in e?e[l]=s:s===!0?e.setAttribute(l,""):_s(e,l,s)}}}function Ft(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",e),qe("load",e);var s=!1,c=!1,d;for(d in l)if(l.hasOwnProperty(d)){var b=l[d];if(b!=null)switch(d){case"src":s=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:st(e,t,d,b,l,null)}}c&&st(e,t,"srcSet",l.srcSet,l,null),s&&st(e,t,"src",l.src,l,null);return;case"input":qe("invalid",e);var w=d=b=c=null,H=null,K=null;for(s in l)if(l.hasOwnProperty(s)){var ne=l[s];if(ne!=null)switch(s){case"name":c=ne;break;case"type":b=ne;break;case"checked":H=ne;break;case"defaultChecked":K=ne;break;case"value":d=ne;break;case"defaultValue":w=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(o(137,t));break;default:st(e,t,s,ne,l,null)}}ef(e,d,w,H,K,b,c,!1);return;case"select":qe("invalid",e),s=b=d=null;for(c in l)if(l.hasOwnProperty(c)&&(w=l[c],w!=null))switch(c){case"value":d=w;break;case"defaultValue":b=w;break;case"multiple":s=w;default:st(e,t,c,w,l,null)}t=d,l=b,e.multiple=!!s,t!=null?Tl(e,!!s,t,!1):l!=null&&Tl(e,!!s,l,!0);return;case"textarea":qe("invalid",e),d=c=s=null;for(b in l)if(l.hasOwnProperty(b)&&(w=l[b],w!=null))switch(b){case"value":s=w;break;case"defaultValue":c=w;break;case"children":d=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(o(91));break;default:st(e,t,b,w,l,null)}nf(e,s,c,d);return;case"option":for(H in l)if(l.hasOwnProperty(H)&&(s=l[H],s!=null))switch(H){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:st(e,t,H,s,l,null)}return;case"dialog":qe("beforetoggle",e),qe("toggle",e),qe("cancel",e),qe("close",e);break;case"iframe":case"object":qe("load",e);break;case"video":case"audio":for(s=0;s<ns.length;s++)qe(ns[s],e);break;case"image":qe("error",e),qe("load",e);break;case"details":qe("toggle",e);break;case"embed":case"source":case"link":qe("error",e),qe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(K in l)if(l.hasOwnProperty(K)&&(s=l[K],s!=null))switch(K){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:st(e,t,K,s,l,null)}return;default:if(Ro(t)){for(ne in l)l.hasOwnProperty(ne)&&(s=l[ne],s!==void 0&&hu(e,t,ne,s,l,void 0));return}}for(w in l)l.hasOwnProperty(w)&&(s=l[w],s!=null&&st(e,t,w,s,l,null))}function n1(e,t,l,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,d=null,b=null,w=null,H=null,K=null,ne=null;for(J in l){var se=l[J];if(l.hasOwnProperty(J)&&se!=null)switch(J){case"checked":break;case"value":break;case"defaultValue":H=se;default:s.hasOwnProperty(J)||st(e,t,J,null,s,se)}}for(var Q in s){var J=s[Q];if(se=l[Q],s.hasOwnProperty(Q)&&(J!=null||se!=null))switch(Q){case"type":d=J;break;case"name":c=J;break;case"checked":K=J;break;case"defaultChecked":ne=J;break;case"value":b=J;break;case"defaultValue":w=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(o(137,t));break;default:J!==se&&st(e,t,Q,J,s,se)}}Eo(e,b,w,H,K,ne,d,c);return;case"select":J=b=w=Q=null;for(d in l)if(H=l[d],l.hasOwnProperty(d)&&H!=null)switch(d){case"value":break;case"multiple":J=H;default:s.hasOwnProperty(d)||st(e,t,d,null,s,H)}for(c in s)if(d=s[c],H=l[c],s.hasOwnProperty(c)&&(d!=null||H!=null))switch(c){case"value":Q=d;break;case"defaultValue":w=d;break;case"multiple":b=d;default:d!==H&&st(e,t,c,d,s,H)}t=w,l=b,s=J,Q!=null?Tl(e,!!l,Q,!1):!!s!=!!l&&(t!=null?Tl(e,!!l,t,!0):Tl(e,!!l,l?[]:"",!1));return;case"textarea":J=Q=null;for(w in l)if(c=l[w],l.hasOwnProperty(w)&&c!=null&&!s.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:st(e,t,w,null,s,c)}for(b in s)if(c=s[b],d=l[b],s.hasOwnProperty(b)&&(c!=null||d!=null))switch(b){case"value":Q=c;break;case"defaultValue":J=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(o(91));break;default:c!==d&&st(e,t,b,c,s,d)}tf(e,Q,J);return;case"option":for(var Se in l)if(Q=l[Se],l.hasOwnProperty(Se)&&Q!=null&&!s.hasOwnProperty(Se))switch(Se){case"selected":e.selected=!1;break;default:st(e,t,Se,null,s,Q)}for(H in s)if(Q=s[H],J=l[H],s.hasOwnProperty(H)&&Q!==J&&(Q!=null||J!=null))switch(H){case"selected":e.selected=Q&&typeof Q!="function"&&typeof Q!="symbol";break;default:st(e,t,H,Q,s,J)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Te in l)Q=l[Te],l.hasOwnProperty(Te)&&Q!=null&&!s.hasOwnProperty(Te)&&st(e,t,Te,null,s,Q);for(K in s)if(Q=s[K],J=l[K],s.hasOwnProperty(K)&&Q!==J&&(Q!=null||J!=null))switch(K){case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(o(137,t));break;default:st(e,t,K,Q,s,J)}return;default:if(Ro(t)){for(var it in l)Q=l[it],l.hasOwnProperty(it)&&Q!==void 0&&!s.hasOwnProperty(it)&&hu(e,t,it,void 0,s,Q);for(ne in s)Q=s[ne],J=l[ne],!s.hasOwnProperty(ne)||Q===J||Q===void 0&&J===void 0||hu(e,t,ne,Q,s,J);return}}for(var G in l)Q=l[G],l.hasOwnProperty(G)&&Q!=null&&!s.hasOwnProperty(G)&&st(e,t,G,null,s,Q);for(se in s)Q=s[se],J=l[se],!s.hasOwnProperty(se)||Q===J||Q==null&&J==null||st(e,t,se,Q,s,J)}function sh(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function a1(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),s=0;s<l.length;s++){var c=l[s],d=c.transferSize,b=c.initiatorType,w=c.duration;if(d&&w&&sh(b)){for(b=0,w=c.responseEnd,s+=1;s<l.length;s++){var H=l[s],K=H.startTime;if(K>w)break;var ne=H.transferSize,se=H.initiatorType;ne&&sh(se)&&(H=H.responseEnd,b+=ne*(H<w?1:(w-K)/(H-K)))}if(--s,t+=8*(d+b)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var xu=null,vu=null;function zi(e){return e.nodeType===9?e:e.ownerDocument}function ih(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 oh(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 yu=null;function l1(){var e=window.event;return e&&e.type==="popstate"?e===yu?!1:(yu=e,!0):(yu=null,!1)}var ch=typeof setTimeout=="function"?setTimeout:void 0,r1=typeof clearTimeout=="function"?clearTimeout:void 0,uh=typeof Promise=="function"?Promise:void 0,s1=typeof queueMicrotask=="function"?queueMicrotask:typeof uh<"u"?function(e){return uh.resolve(null).then(e).catch(i1)}:ch;function i1(e){setTimeout(function(){throw e})}function Ia(e){return e==="head"}function dh(e,t){var l=t,s=0;do{var c=l.nextSibling;if(e.removeChild(l),c&&c.nodeType===8)if(l=c.data,l==="/$"||l==="/&"){if(s===0){e.removeChild(c),sr(t);return}s--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")s++;else if(l==="html")ls(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,ls(l);for(var d=l.firstChild;d;){var b=d.nextSibling,w=d.nodeName;d[Sr]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&d.rel.toLowerCase()==="stylesheet"||l.removeChild(d),d=b}}else l==="body"&&ls(e.ownerDocument.body);l=c}while(l);sr(t)}function fh(e,t){var l=e;e=0;do{var s=l.nextSibling;if(l.nodeType===1?t?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(t?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),s&&s.nodeType===8)if(l=s.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=s}while(l)}function bu(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":bu(l),Co(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function o1(e,t,l,s){for(;e.nodeType===1;){var c=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[Sr])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(d=e.getAttribute("rel"),d==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(d!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(d=e.getAttribute("src"),(d!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var d=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=zn(e.nextSibling),e===null)break}return null}function c1(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=zn(e.nextSibling),e===null))return null;return e}function ph(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=zn(e.nextSibling),e===null))return null;return e}function ju(e){return e.data==="$?"||e.data==="$~"}function Su(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function u1(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var s=function(){t(),l.removeEventListener("DOMContentLoaded",s)};l.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function zn(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 ku=null;function mh(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return zn(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function hh(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 xh(e,t,l){switch(t=zi(l),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function ls(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Co(e)}var Ln=new Map,vh=new Set;function Li(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var xa=O.d;O.d={f:d1,r:f1,D:p1,C:m1,L:h1,m:x1,X:g1,S:v1,M:y1};function d1(){var e=xa.f(),t=Ci();return e||t}function f1(e){var t=Cl(e);t!==null&&t.tag===5&&t.type==="form"?Lp(t):xa.r(e)}var ar=typeof document>"u"?null:document;function gh(e,t,l){var s=ar;if(s&&typeof t=="string"&&t){var c=Nn(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof l=="string"&&(c+='[crossorigin="'+l+'"]'),vh.has(c)||(vh.add(c),e={rel:e,crossOrigin:l,href:t},s.querySelector(c)===null&&(t=s.createElement("link"),Ft(t,"link",e),Ht(t),s.head.appendChild(t)))}}function p1(e){xa.D(e),gh("dns-prefetch",e,null)}function m1(e,t){xa.C(e,t),gh("preconnect",e,t)}function h1(e,t,l){xa.L(e,t,l);var s=ar;if(s&&e&&t){var c='link[rel="preload"][as="'+Nn(t)+'"]';t==="image"&&l&&l.imageSrcSet?(c+='[imagesrcset="'+Nn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(c+='[imagesizes="'+Nn(l.imageSizes)+'"]')):c+='[href="'+Nn(e)+'"]';var d=c;switch(t){case"style":d=lr(e);break;case"script":d=rr(e)}Ln.has(d)||(e=g({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),Ln.set(d,e),s.querySelector(c)!==null||t==="style"&&s.querySelector(rs(d))||t==="script"&&s.querySelector(ss(d))||(t=s.createElement("link"),Ft(t,"link",e),Ht(t),s.head.appendChild(t)))}}function x1(e,t){xa.m(e,t);var l=ar;if(l&&e){var s=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+Nn(s)+'"][href="'+Nn(e)+'"]',d=c;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=rr(e)}if(!Ln.has(d)&&(e=g({rel:"modulepreload",href:e},t),Ln.set(d,e),l.querySelector(c)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(ss(d)))return}s=l.createElement("link"),Ft(s,"link",e),Ht(s),l.head.appendChild(s)}}}function v1(e,t,l){xa.S(e,t,l);var s=ar;if(s&&e){var c=Nl(s).hoistableStyles,d=lr(e);t=t||"default";var b=c.get(d);if(!b){var w={loading:0,preload:null};if(b=s.querySelector(rs(d)))w.loading=5;else{e=g({rel:"stylesheet",href:e,"data-precedence":t},l),(l=Ln.get(d))&&wu(e,l);var H=b=s.createElement("link");Ht(H),Ft(H,"link",e),H._p=new Promise(function(K,ne){H.onload=K,H.onerror=ne}),H.addEventListener("load",function(){w.loading|=1}),H.addEventListener("error",function(){w.loading|=2}),w.loading|=4,_i(b,t,s)}b={type:"stylesheet",instance:b,count:1,state:w},c.set(d,b)}}}function g1(e,t){xa.X(e,t);var l=ar;if(l&&e){var s=Nl(l).hoistableScripts,c=rr(e),d=s.get(c);d||(d=l.querySelector(ss(c)),d||(e=g({src:e,async:!0},t),(t=Ln.get(c))&&Cu(e,t),d=l.createElement("script"),Ht(d),Ft(d,"link",e),l.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(c,d))}}function y1(e,t){xa.M(e,t);var l=ar;if(l&&e){var s=Nl(l).hoistableScripts,c=rr(e),d=s.get(c);d||(d=l.querySelector(ss(c)),d||(e=g({src:e,async:!0,type:"module"},t),(t=Ln.get(c))&&Cu(e,t),d=l.createElement("script"),Ht(d),Ft(d,"link",e),l.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(c,d))}}function yh(e,t,l,s){var c=(c=xe.current)?Li(c):null;if(!c)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=lr(l.href),l=Nl(c).hoistableStyles,s=l.get(t),s||(s={type:"style",instance:null,count:0,state:null},l.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=lr(l.href);var d=Nl(c).hoistableStyles,b=d.get(e);if(b||(c=c.ownerDocument||c,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,b),(d=c.querySelector(rs(e)))&&!d._p&&(b.instance=d,b.state.loading=5),Ln.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},Ln.set(e,l),d||b1(c,e,l,b.state))),t&&s===null)throw Error(o(528,""));return b}if(t&&s!==null)throw Error(o(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=rr(l),l=Nl(c).hoistableScripts,s=l.get(t),s||(s={type:"script",instance:null,count:0,state:null},l.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function lr(e){return'href="'+Nn(e)+'"'}function rs(e){return'link[rel="stylesheet"]['+e+"]"}function bh(e){return g({},e,{"data-precedence":e.precedence,precedence:null})}function b1(e,t,l,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),Ft(t,"link",l),Ht(t),e.head.appendChild(t))}function rr(e){return'[src="'+Nn(e)+'"]'}function ss(e){return"script[async]"+e}function jh(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Nn(l.href)+'"]');if(s)return t.instance=s,Ht(s),s;var c=g({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Ht(s),Ft(s,"style",c),_i(s,l.precedence,e),t.instance=s;case"stylesheet":c=lr(l.href);var d=e.querySelector(rs(c));if(d)return t.state.loading|=4,t.instance=d,Ht(d),d;s=bh(l),(c=Ln.get(c))&&wu(s,c),d=(e.ownerDocument||e).createElement("link"),Ht(d);var b=d;return b._p=new Promise(function(w,H){b.onload=w,b.onerror=H}),Ft(d,"link",s),t.state.loading|=4,_i(d,l.precedence,e),t.instance=d;case"script":return d=rr(l.src),(c=e.querySelector(ss(d)))?(t.instance=c,Ht(c),c):(s=l,(c=Ln.get(d))&&(s=g({},l),Cu(s,c)),e=e.ownerDocument||e,c=e.createElement("script"),Ht(c),Ft(c,"link",s),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,_i(s,l.precedence,e));return t.instance}function _i(e,t,l){for(var s=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=s.length?s[s.length-1]:null,d=c,b=0;b<s.length;b++){var w=s[b];if(w.dataset.precedence===t)d=w;else if(d!==c)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function wu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Cu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Oi=null;function Sh(e,t,l){if(Oi===null){var s=new Map,c=Oi=new Map;c.set(l,s)}else c=Oi,s=c.get(l),s||(s=new Map,c.set(l,s));if(s.has(e))return s;for(s.set(e,null),l=l.getElementsByTagName(e),c=0;c<l.length;c++){var d=l[c];if(!(d[Sr]||d[Gt]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var b=d.getAttribute(t)||"";b=e+b;var w=s.get(b);w?w.push(d):s.set(b,[d])}}return s}function kh(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function j1(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 wh(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function S1(e,t,l,s){if(l.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var c=lr(s.href),d=t.querySelector(rs(c));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Bi.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=d,Ht(d);return}d=t.ownerDocument||t,s=bh(s),(c=Ln.get(c))&&wu(s,c),d=d.createElement("link"),Ht(d);var b=d;b._p=new Promise(function(w,H){b.onload=w,b.onerror=H}),Ft(d,"link",s),l.instance=d}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=Bi.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var Nu=0;function k1(e,t){return e.stylesheets&&e.count===0&&Hi(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var s=setTimeout(function(){if(e.stylesheets&&Hi(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&Nu===0&&(Nu=62500*a1());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Hi(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>Nu?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(c)}}:null}function Bi(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Hi(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ii=null;function Hi(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ii=new Map,t.forEach(w1,e),Ii=null,Bi.call(e))}function w1(e,t){if(!(t.state.loading&4)){var l=Ii.get(e);if(l)var s=l.get(null);else{l=new Map,Ii.set(e,l);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<c.length;d++){var b=c[d];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(l.set(b.dataset.precedence,b),s=b)}s&&l.set(null,s)}c=t.instance,b=c.getAttribute("data-precedence"),d=l.get(b)||s,d===s&&l.set(null,c),l.set(b,c),this.count++,s=Bi.bind(this),c.addEventListener("load",s),c.addEventListener("error",s),d?d.parentNode.insertBefore(c,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var is={$$typeof:B,Provider:null,Consumer:null,_currentValue:te,_currentValue2:te,_threadCount:0};function C1(e,t,l,s,c,d,b,w,H){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=jo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=jo(0),this.hiddenUpdates=jo(null),this.identifierPrefix=s,this.onUncaughtError=c,this.onCaughtError=d,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function Ch(e,t,l,s,c,d,b,w,H,K,ne,se){return e=new C1(e,t,l,b,H,K,ne,se,w),t=1,d===!0&&(t|=24),d=pn(3,null,null,t),e.current=d,d.stateNode=e,t=rc(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:s,isDehydrated:l,cache:t},cc(d),e}function Nh(e){return e?(e=Ol,e):Ol}function Eh(e,t,l,s,c,d){c=Nh(c),s.context===null?s.context=c:s.pendingContext=c,s=Ea(t),s.payload={element:l},d=d===void 0?null:d,d!==null&&(s.callback=d),l=Ta(e,s,t),l!==null&&(dn(l,e,t),Hr(l,e,t))}function Th(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function Eu(e,t){Th(e,t),(e=e.alternate)&&Th(e,t)}function Rh(e){if(e.tag===13||e.tag===31){var t=al(e,67108864);t!==null&&dn(t,e,67108864),Eu(e,67108864)}}function Ah(e){if(e.tag===13||e.tag===31){var t=gn();t=So(t);var l=al(e,t);l!==null&&dn(l,e,t),Eu(e,t)}}var Ui=!0;function N1(e,t,l,s){var c=E.T;E.T=null;var d=O.p;try{O.p=2,Tu(e,t,l,s)}finally{O.p=d,E.T=c}}function E1(e,t,l,s){var c=E.T;E.T=null;var d=O.p;try{O.p=8,Tu(e,t,l,s)}finally{O.p=d,E.T=c}}function Tu(e,t,l,s){if(Ui){var c=Ru(s);if(c===null)mu(e,t,s,Vi,l),Dh(e,s);else if(R1(c,e,t,l,s))s.stopPropagation();else if(Dh(e,s),t&4&&-1<T1.indexOf(e)){for(;c!==null;){var d=Cl(c);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var b=Nt(d.pendingLanes);if(b!==0){var w=d;for(w.pendingLanes|=2,w.entangledLanes|=2;b;){var H=1<<31-bt(b);w.entanglements[1]|=H,b&=~H}Fn(d),(Je&6)===0&&(ki=tt()+500,ts(0))}}break;case 31:case 13:w=al(d,2),w!==null&&dn(w,d,2),Ci(),Eu(d,2)}if(d=Ru(s),d===null&&mu(e,t,s,Vi,l),d===c)break;c=d}c!==null&&s.stopPropagation()}else mu(e,t,s,null,l)}}function Ru(e){return e=Mo(e),Au(e)}var Vi=null;function Au(e){if(Vi=null,e=wl(e),e!==null){var t=m(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=f(t),e!==null)return e;e=null}else if(l===31){if(e=h(t),e!==null)return e;e=null}else if(l===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Vi=e,null}function Mh(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(jt()){case ye:return 2;case Rt:return 8;case De:case xt:return 32;case Wt:return 268435456;default:return 32}default:return 32}}var Mu=!1,Ha=null,Ua=null,Va=null,os=new Map,cs=new Map,$a=[],T1="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 Dh(e,t){switch(e){case"focusin":case"focusout":Ha=null;break;case"dragenter":case"dragleave":Ua=null;break;case"mouseover":case"mouseout":Va=null;break;case"pointerover":case"pointerout":os.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":cs.delete(t.pointerId)}}function us(e,t,l,s,c,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:l,eventSystemFlags:s,nativeEvent:d,targetContainers:[c]},t!==null&&(t=Cl(t),t!==null&&Rh(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function R1(e,t,l,s,c){switch(t){case"focusin":return Ha=us(Ha,e,t,l,s,c),!0;case"dragenter":return Ua=us(Ua,e,t,l,s,c),!0;case"mouseover":return Va=us(Va,e,t,l,s,c),!0;case"pointerover":var d=c.pointerId;return os.set(d,us(os.get(d)||null,e,t,l,s,c)),!0;case"gotpointercapture":return d=c.pointerId,cs.set(d,us(cs.get(d)||null,e,t,l,s,c)),!0}return!1}function zh(e){var t=wl(e.target);if(t!==null){var l=m(t);if(l!==null){if(t=l.tag,t===13){if(t=f(l),t!==null){e.blockedOn=t,Yd(e.priority,function(){Ah(l)});return}}else if(t===31){if(t=h(l),t!==null){e.blockedOn=t,Yd(e.priority,function(){Ah(l)});return}}else if(t===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function $i(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=Ru(e.nativeEvent);if(l===null){l=e.nativeEvent;var s=new l.constructor(l.type,l);Ao=s,l.target.dispatchEvent(s),Ao=null}else return t=Cl(l),t!==null&&Rh(t),e.blockedOn=l,!1;t.shift()}return!0}function Lh(e,t,l){$i(e)&&l.delete(t)}function A1(){Mu=!1,Ha!==null&&$i(Ha)&&(Ha=null),Ua!==null&&$i(Ua)&&(Ua=null),Va!==null&&$i(Va)&&(Va=null),os.forEach(Lh),cs.forEach(Lh)}function Gi(e,t){e.blockedOn===t&&(e.blockedOn=null,Mu||(Mu=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,A1)))}var Pi=null;function _h(e){Pi!==e&&(Pi=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Pi===e&&(Pi=null);for(var t=0;t<e.length;t+=3){var l=e[t],s=e[t+1],c=e[t+2];if(typeof s!="function"){if(Au(s||l)===null)continue;break}var d=Cl(l);d!==null&&(e.splice(t,3),t-=3,Rc(d,{pending:!0,data:c,method:l.method,action:s},s,c))}}))}function sr(e){function t(H){return Gi(H,e)}Ha!==null&&Gi(Ha,e),Ua!==null&&Gi(Ua,e),Va!==null&&Gi(Va,e),os.forEach(t),cs.forEach(t);for(var l=0;l<$a.length;l++){var s=$a[l];s.blockedOn===e&&(s.blockedOn=null)}for(;0<$a.length&&(l=$a[0],l.blockedOn===null);)zh(l),l.blockedOn===null&&$a.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(s=0;s<l.length;s+=3){var c=l[s],d=l[s+1],b=c[ln]||null;if(typeof d=="function")b||_h(l);else if(b){var w=null;if(d&&d.hasAttribute("formAction")){if(c=d,b=d[ln]||null)w=b.formAction;else if(Au(c)!==null)continue}else w=b.action;typeof w=="function"?l[s+1]=w:(l.splice(s,3),s-=3),_h(l)}}}function Oh(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(b){return c=b})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),s||setTimeout(l,20)}function l(){if(!s&&!navigation.transition){var d=navigation.currentEntry;d&&d.url!=null&&navigation.navigate(d.url,{state:d.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function Du(e){this._internalRoot=e}qi.prototype.render=Du.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var l=t.current,s=gn();Eh(l,s,e,t,null,null)},qi.prototype.unmount=Du.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Eh(e.current,2,null,e,null,null),Ci(),t[kl]=null}};function qi(e){this._internalRoot=e}qi.prototype.unstable_scheduleHydration=function(e){if(e){var t=qd();e={blockedOn:null,target:e,priority:t};for(var l=0;l<$a.length&&t!==0&&t<$a[l].priority;l++);$a.splice(l,0,e),l===0&&zh(e)}};var Bh=r.version;if(Bh!=="19.2.4")throw Error(o(527,Bh,"19.2.4"));O.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 M1={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yi=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yi.isDisabled&&Yi.supportsFiber)try{Xn=Yi.inject(M1),Ct=Yi}catch{}}return fs.createRoot=function(e,t){if(!u(e))throw Error(o(299));var l=!1,s="",c=Pp,d=qp,b=Yp;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(d=t.onCaughtError),t.onRecoverableError!==void 0&&(b=t.onRecoverableError)),t=Ch(e,1,!1,null,null,l,s,null,c,d,b,Oh),e[kl]=t.current,pu(e),new Du(t)},fs.hydrateRoot=function(e,t,l){if(!u(e))throw Error(o(299));var s=!1,c="",d=Pp,b=qp,w=Yp,H=null;return l!=null&&(l.unstable_strictMode===!0&&(s=!0),l.identifierPrefix!==void 0&&(c=l.identifierPrefix),l.onUncaughtError!==void 0&&(d=l.onUncaughtError),l.onCaughtError!==void 0&&(b=l.onCaughtError),l.onRecoverableError!==void 0&&(w=l.onRecoverableError),l.formState!==void 0&&(H=l.formState)),t=Ch(e,1,!0,t,l??null,s,c,H,d,b,w,Oh),t.context=Nh(null),l=t.current,s=gn(),s=So(s),c=Ea(s),c.callback=null,Ta(l,c,s),l=s,t.current.lanes=l,jr(t,l),Fn(t),e[kl]=t.current,pu(e),new qi(t)},fs.version="19.2.4",fs}var Fh;function U1(){if(Fh)return _u.exports;Fh=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(r){console.error(r)}}return a(),_u.exports=H1(),_u.exports}var V1=U1();const $1="modulepreload",G1=function(a){return"/"+a},Wh={},Sd=function(r,i,o){let u=Promise.resolve();if(i&&i.length>0){let f=function(p){return Promise.all(p.map(y=>Promise.resolve(y).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),x=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));u=f(i.map(p=>{if(p=G1(p),p in Wh)return;Wh[p]=!0;const y=p.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const j=document.createElement("link");if(j.rel=y?"stylesheet":$1,y||(j.as="script"),j.crossOrigin="",j.href=p,x&&j.setAttribute("nonce",x),document.head.appendChild(j),y)return new Promise((S,N)=>{j.addEventListener("load",S),j.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${p}`)))})}))}function m(f){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=f,window.dispatchEvent(h),!h.defaultPrevented)throw f}return u.then(f=>{for(const h of f||[])h.status==="rejected"&&m(h.reason);return r().catch(m)})},Kh={own:"authoring-project",installed:"available-project",global:"available-personal"},sd=new Set(["available-project","available-personal","available-plugin","authoring-project","authoring-plugin"]);function P1(a){if(typeof a=="string"){if(sd.has(a))return a;if(Object.prototype.hasOwnProperty.call(Kh,a))return Kh[a]}return"authoring-project"}function q1(a){return a.startsWith("available-")?"available":"authoring"}function Y1(a){const r=a.indexOf("-");return a.slice(r+1)}const Ya="";class gs extends Error{constructor(r,i){super(r),this.name="ApiError",this.status=i}}async function Ge(a,r){const i=await fetch(`${Ya}${a}`,r);if(!i.ok){const o=await i.json().catch(()=>({error:i.statusText}));throw new gs(o.error||`HTTP ${i.status}`,i.status)}return i.json()}function en(a){return typeof a=="string"&&a.length>0?a:null}function F1(a){return typeof a=="number"&&Number.isFinite(a)?a:null}function Hu(a){if(!Array.isArray(a))return null;const r=a.filter(i=>typeof i=="string"&&i.length>0);return r.length>0?r:null}function W1(a){const r=a??{};let i;r.origin==="source"||r.origin==="installed"?i=r.origin:(i="source",console.warn(`[api.getSkills] skill ${String(r.plugin)}/${String(r.skill)} has invalid origin=${JSON.stringify(r.origin)}; defaulting to 'source'`));let o;r.scope==="own"||r.scope==="installed"||r.scope==="global"?o=r.scope:o=i==="installed"?"installed":"own";let u;r.installMethod==="authored"||r.installMethod==="copied"||r.installMethod==="symlinked"?u=r.installMethod:u=o==="own"?"authored":"copied";const m=typeof r.scopeV2=="string"&&sd.has(r.scopeV2)?r.scopeV2:P1(r.scope),f=q1(m),h=Y1(m),x=typeof r.precedenceRank=="number"?r.precedenceRank:void 0;let p;r.shadowedBy===null?p=null:typeof r.shadowedBy=="string"&&sd.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:i,scope:o,isSymlink:typeof r.isSymlink=="boolean"?r.isSymlink:!1,symlinkTarget:en(r.symlinkTarget),installMethod:u,scopeV2:m,group:f,source:h,pluginName:en(r.pluginName),pluginNamespace:en(r.pluginNamespace),pluginMarketplace:en(r.pluginMarketplace),pluginManifestPath:en(r.pluginManifestPath),pluginVersion:en(r.pluginVersion),precedenceRank:x,shadowedBy:p,description:en(r.description),version:en(r.version),category:en(r.category),author:en(r.author),license:en(r.license),homepage:en(r.homepage),tags:Hu(r.tags),deps:Hu(r.deps),mcpDeps:Hu(r.mcpDeps),entryPoint:en(r.entryPoint),lastModified:en(r.lastModified),sizeBytes:F1(r.sizeBytes),sourceAgent:en(r.sourceAgent)};if(r.provenance&&typeof r.provenance=="object"){const g=r.provenance;(g.promotedFrom==="installed"||g.promotedFrom==="global")&&typeof g.sourcePath=="string"&&typeof g.promotedAt=="number"?y.provenance={promotedFrom:g.promotedFrom,sourcePath:g.sourcePath,promotedAt:g.promotedAt,sourceSkillVersion:typeof g.sourceSkillVersion=="string"?g.sourceSkillVersion:void 0}:y.provenance=null}else r.provenance===null&&(y.provenance=null);return typeof r.updateAvailable=="boolean"&&(y.updateAvailable=r.updateAvailable),typeof r.currentVersion=="string"&&(y.currentVersion=r.currentVersion),typeof r.latestVersion=="string"&&(y.latestVersion=r.latestVersion),typeof r.pinnedVersion=="string"&&(y.pinnedVersion=r.pinnedVersion),y}const Ne={getConfig(){return Ge("/api/config")},setConfig(a,r){return Ge("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:a,model:r})})},async getSkills(a){const r=new URLSearchParams;a!=null&&a.scope&&r.set("scope",a.scope),a!=null&&a.agent&&r.set("agent",a.agent);const i=r.toString(),o=await Ge(`/api/skills${i?"?"+i:""}`);return Array.isArray(o)?o.map(W1):[]},getAgents(){return Ge("/api/agents")},getSkillDetail(a,r){return Ge(`/api/skills/${a}/${r}`)},getEvals(a,r){return Ge(`/api/skills/${a}/${r}/evals`)},saveEvals(a,r,i){return Ge(`/api/skills/${a}/${r}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})},generateEvals(a,r){return Ge(`/api/skills/${a}/${r}/generate-evals`,{method:"POST"})},async getLatestBenchmark(a,r){const i=await fetch(`${Ya}/api/skills/${a}/${r}/benchmark/latest`);if(i.status===404)return null;if(!i.ok){const o=await i.json().catch(()=>({error:i.statusText}));throw new gs(o.error||`HTTP ${i.status}`,i.status)}return i.json()},getHistory(a,r,i){const o=new URLSearchParams;i!=null&&i.model&&o.set("model",i.model),i!=null&&i.type&&o.set("type",i.type),i!=null&&i.from&&o.set("from",i.from),i!=null&&i.to&&o.set("to",i.to);const u=o.toString();return Ge(`/api/skills/${a}/${r}/history${u?"?"+u:""}`)},getHistoryEntry(a,r,i){return Ge(`/api/skills/${a}/${r}/history/${encodeURIComponent(i)}`)},compareRuns(a,r,i,o){return Ge(`/api/skills/${a}/${r}/history-compare?a=${encodeURIComponent(i)}&b=${encodeURIComponent(o)}`)},getCaseHistory(a,r,i,o){const u=new URLSearchParams;o&&u.set("model",o);const m=u.toString();return Ge(`/api/skills/${a}/${r}/history/case/${i}${m?"?"+m:""}`)},deleteHistoryEntry(a,r,i){return Ge(`/api/skills/${a}/${r}/history/${encodeURIComponent(i)}`,{method:"DELETE"})},deleteSkill(a,r){return Ge(`/api/skills/${a}/${r}`,{method:"DELETE"})},improveSkill(a,r,i){return Ge(`/api/skills/${a}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})},instructEdit(a,r,i){return Ge(`/api/skills/${a}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"instruct",...i})})},applyImprovement(a,r,i){return Ge(`/api/skills/${a}/${r}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i})})},getStats(a,r){return Ge(`/api/skills/${a}/${r}/stats`)},getDependencies(a,r){return Ge(`/api/skills/${a}/${r}/dependencies`)},getProjectLayout(){return Ge("/api/project-layout")},createSkill(a){return Ge("/api/skills/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},saveDraft(a){return Ge("/api/skills/save-draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},getSkillCreatorStatus(){return Ge("/api/skill-creator-status")},generateSkill(a){return Ge("/api/skills/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},getSkillFiles(a,r){return Ge(`/api/skills/${a}/${r}/files`)},getSkillFile(a,r,i){return Ge(`/api/skills/${a}/${r}/file?path=${encodeURIComponent(i)}`)},saveSkillFile(a,r,i,o){return Ge(`/api/skills/${a}/${r}/file`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:i,content:o})})},getLeaderboard(a,r){return Ge(`/api/skills/${a}/${r}/leaderboard`)},getLeaderboardEntry(a,r,i){return Ge(`/api/skills/${a}/${r}/leaderboard/${encodeURIComponent(i)}`)},startSweep(a,r,i){const o=`${Ya}/api/skills/${a}/${r}/sweep`,u=new EventSource(o);return fetch(o,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(i)}),u},getCredentials(a,r){return Ge(`/api/credentials/${a}/${r}`)},setCredential(a,r,i,o){return Ge(`/api/credentials/${a}/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,value:o})})},getParams(a,r){return Ge(`/api/credentials/${a}/${r}/params`)},getParamsRevealed(a,r,i){const o=i?`reveal=true&key=${encodeURIComponent(i)}`:"reveal=true";return Ge(`/api/credentials/${a}/${r}/params?${o}`)},searchModels(){return Ge("/api/openrouter/models")},getSkillVersions(a,r){return Ge(`/api/skills/${a}/${r}/versions`)},getVersionDiff(a,r,i,o){return Ge(`/api/skills/${a}/${r}/versions/diff?from=${i}&to=${o}`)},startBatchUpdate(a){const r=`${Ya}/api/skills/batch-update`,i=new EventSource(r);return fetch(r,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({skills:a})}),i},startSkillUpdate(a,r){const i=`${Ya}/api/skills/${a}/${r}/update`,o=new EventSource(i);return fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"}}),o},async getSkillUpdates(){try{const a=await fetch(`${Ya}/api/skills/updates`);return a.ok?await a.json():[]}catch{return[]}},promoteSkill(a,r,i){const o=i!=null&&i.overwrite?"?overwrite=true":"";return Uu(`/api/skills/${a}/${r}/promote${o}`,i==null?void 0:i.onEvent,i==null?void 0:i.signal)},testInstallSkill(a,r,i){const o=new URLSearchParams;(i==null?void 0:i.dest)==="global"&&o.set("dest","global"),i!=null&&i.overwrite&&o.set("overwrite","true");const u=o.toString();return Uu(`/api/skills/${a}/${r}/test-install${u?"?"+u:""}`,i==null?void 0:i.onEvent,i==null?void 0:i.signal)},revertSkill(a,r,i){return Uu(`/api/skills/${a}/${r}/revert`,i==null?void 0:i.onEvent,i==null?void 0:i.signal)},listStudioOps(a){const r=new URLSearchParams;(a==null?void 0:a.before)!=null&&r.set("before",String(a.before)),(a==null?void 0:a.limit)!=null&&r.set("limit",String(a.limit));const i=r.toString();return Ge(`/api/studio/ops${i?"?"+i:""}`)},deleteStudioOp(a){return Ge(`/api/studio/ops/${encodeURIComponent(a)}`,{method:"DELETE"})},studioOpsStream(){return new EventSource(`${Ya}/api/studio/ops/stream`)}};async function Uu(a,r,i){const o=await fetch(`${Ya}${a}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},signal:i});if(!o.ok||!o.body){let y=`HTTP ${o.status}`,g;try{const S=await o.json();S.error&&(y=S.error),typeof S.code=="string"&&(g=S.code)}catch{}const j=new gs(y,o.status);throw g&&(j.code=g),j}const u=o.body.getReader(),m=new TextDecoder;let f="",h="",x=null,p=null;for(;;){const{done:y,value:g}=await u.read();if(y)break;f+=m.decode(g,{stream:!0});const j=f.split(`
51
+ `);f=j.pop()??"";for(const S of j)if(S.startsWith("event: "))h=S.slice(7).trim();else if(S.startsWith("data: ")){let N={};try{N=JSON.parse(S.slice(6))}catch{h="";continue}if(h==="started"||h==="copied"||h==="deleted"||h==="indexed"||h==="done"||h==="error"){const D={type:h,...N};r==null||r(D),D.type==="done"&&(x=D),D.type==="error"&&(p=D)}h=""}}if(p){const y=new gs(p.message,500);throw y.code=p.code,y}if(!x)throw new gs("Transfer stream ended without 'done' event",500);return x}function K1(a,r){if(!r.length)return a;const i=new Map;for(const o of r){const u=o.name.split("/").pop()||o.name;i.set(u,o)}return a.map(o=>{const u=i.get(o.skill);return u?{...o,updateAvailable:u.updateAvailable,currentVersion:u.installed,latestVersion:u.latest??void 0}:o})}function Q1(a){const[r,i]=v.useState(()=>typeof window>"u"?!1:window.matchMedia(a).matches);return v.useEffect(()=>{const o=window.matchMedia(a);i(o.matches);const u=m=>i(m.matches);return o.addEventListener("change",u),()=>o.removeEventListener("change",u)},[a]),r}const X1=3e5,Z1=500,J1=15e3,eb=6e4;function tb(a){const r=new Map;for(const i of a){const o=i.name.split("/").pop()||i.name;r.set(o,i)}return r}function nb(a){let r=0;for(const i of a)i.updateAvailable&&r++;return r}function ab(a){a()}function lb(a){const r=X1,i=Z1,o=J1,u=eb,[m,f]=v.useState([]),[h,x]=v.useState(()=>new Map),[p,y]=v.useState(0),[g,j]=v.useState(!1),[S,N]=v.useState(null),[D,T]=v.useState(null),k=v.useRef(null),M=v.useRef(null),B=v.useRef(null),V=v.useRef(null),A=v.useRef(!0),U=v.useCallback(async()=>{j(!0);const I=new AbortController,P=setTimeout(()=>I.abort(),o);try{const q=await Promise.race([Ne.getSkillUpdates(),new Promise((ee,X)=>{I.signal.addEventListener("abort",()=>{X(new Error("TIMEOUT"))})})]);if(q==="TIMEOUT")throw new Error("TIMEOUT");if(!A.current)return;f(q),x(tb(q)),y(nb(q)),M.current=Date.now(),N(M.current),T(null)}catch(q){if(!A.current)return;T(q instanceof Error?q:new Error(String(q)))}finally{clearTimeout(P),A.current&&j(!1)}},[o]),C=v.useCallback(()=>{if(k.current)return k.current;const I=U().finally(()=>{k.current=null});return k.current=I,I},[U]),z=v.useCallback(()=>{B.current==null&&(B.current=setInterval(()=>{C()},r))},[r,C]),R=v.useCallback(()=>{B.current!=null&&(clearInterval(B.current),B.current=null)},[]);return v.useEffect(()=>{A.current=!0,(M.current==null||Date.now()-M.current>u)&&ab(()=>void C()),(typeof document>"u"||document.visibilityState!=="hidden")&&z();const q=()=>{if(V.current&&(clearTimeout(V.current),V.current=null),document.visibilityState==="hidden"){R();return}V.current=setTimeout(()=>{V.current=null,(M.current==null||Date.now()-M.current>u)&&C(),z()},i)};return typeof document<"u"&&document.addEventListener("visibilitychange",q),()=>{A.current=!1,typeof document<"u"&&document.removeEventListener("visibilitychange",q),V.current&&clearTimeout(V.current),R()}},[]),{updates:m,updatesMap:h,updateCount:p,isRefreshing:g,lastFetchAt:S,error:D,refresh:C}}const rb={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list",updateNotificationDismissed:!1};function sb(a,r){switch(r.type){case"SELECT_SKILL":return{...a,selectedSkill:r.skill,mode:"browse",mobileView:a.isMobile?"detail":a.mobileView};case"CLEAR_SELECTION":return{...a,selectedSkill:null};case"SET_MODE":return{...a,mode:r.mode,selectedSkill:r.mode==="create"?null:a.selectedSkill};case"SET_SEARCH":return{...a,searchQuery:r.query};case"SET_SKILLS":return{...a,skills:r.skills,skillsLoading:!1,skillsError:null};case"SET_SKILLS_ERROR":return{...a,skillsError:r.error,skillsLoading:!1};case"SET_SKILLS_LOADING":return{...a,skillsLoading:r.loading};case"SET_MOBILE":return{...a,isMobile:r.isMobile};case"SET_MOBILE_VIEW":return{...a,mobileView:r.view};case"DISMISS_UPDATE_NOTIFICATION":return{...a,updateNotificationDismissed:!0};default:return a}}const rv=v.createContext(null);function ya(){const a=v.useContext(rv);if(!a)throw new Error("useStudio must be used within StudioProvider");return a}function ib({children:a}){const[r,i]=v.useReducer(sb,rb),o=Q1("(max-width: 767px)");v.useEffect(()=>{i({type:"SET_MOBILE",isMobile:o})},[o]);const[u,m]=v.useState(()=>{try{const A=window.localStorage.getItem("vskill.studio.prefs");if(!A)return null;const U=JSON.parse(A);return typeof U.activeAgent=="string"?U.activeAgent:null}catch{return null}});v.useEffect(()=>{function A(U){if(!(U instanceof CustomEvent))return;const C=U.detail;C!=null&&C.agentId&&m(C.agentId)}return window.addEventListener("studio:agent-changed",A),()=>window.removeEventListener("studio:agent-changed",A)},[]);const f=v.useCallback(()=>{i({type:"SET_SKILLS_LOADING",loading:!0});const A=u?{agent:u}:void 0;Ne.getSkills(A).then(U=>{i({type:"SET_SKILLS",skills:U});const z=window.location.hash.match(/^#\/skills\/([^/]+)\/([^/?]+)/);if(z){const[,R,I]=z,P=U.find(q=>q.plugin===R&&q.skill===I);P&&i({type:"SELECT_SKILL",skill:{plugin:R,skill:I,origin:P.origin}})}}).catch(U=>i({type:"SET_SKILLS_ERROR",error:U.message}))},[u]);v.useEffect(()=>{f()},[f]);const h=v.useCallback(A=>{i({type:"SELECT_SKILL",skill:A}),window.location.hash=`/skills/${A.plugin}/${A.skill}`},[]),x=v.useCallback(()=>{i({type:"CLEAR_SELECTION"}),window.location.hash.startsWith("#/skills/")&&history.replaceState(null,"",window.location.pathname+window.location.search)},[]),p=v.useCallback(A=>{i({type:"SET_MODE",mode:A})},[]),y=v.useCallback(A=>{i({type:"SET_SEARCH",query:A})},[]),g=v.useCallback(A=>{i({type:"SET_MOBILE_VIEW",view:A})},[]),j=v.useCallback(()=>{i({type:"DISMISS_UPDATE_NOTIFICATION"})},[]),S=lb(),N=v.useMemo(()=>{const A=r.skills.map(U=>{if(!U.updateAvailable&&U.latestVersion===void 0)return U;const C={...U};return delete C.updateAvailable,delete C.currentVersion,delete C.latestVersion,C});return K1(A,S.updates)},[r.skills,S.updates]),D=v.useMemo(()=>{const A={source:0,installed:0};for(const U of N)U.updateAvailable&&(A[U.origin]+=1);return A},[N]),T=v.useMemo(()=>({...r,skills:N}),[r,N]),k=S.updateCount,M=S.refresh,B=S.isRefreshing,V=v.useMemo(()=>({state:T,selectSkill:h,clearSelection:x,setMode:p,setSearch:y,setMobileView:g,refreshSkills:f,updateCount:k,dismissUpdateNotification:j,updates:S.updates,outdatedByOrigin:D,isRefreshingUpdates:B,refreshUpdates:M}),[T,h,x,p,y,g,f,k,j,S.updates,D,B,M]);return n.jsx(rv.Provider,{value:V,children:a})}const ob={config:null,loading:!0};function cb(a,r){switch(r.type){case"SET_CONFIG":return{config:r.config,loading:!1};case"SET_LOADING":return{...a,loading:!0};default:return a}}const sv=v.createContext(null);function bl(){const a=v.useContext(sv);if(!a)throw new Error("useConfig must be used within ConfigProvider");return a}function ub({children:a}){const[r,i]=v.useReducer(cb,ob),o=v.useCallback(()=>{Ne.getConfig().then(f=>i({type:"SET_CONFIG",config:f})).catch(()=>{})},[]);v.useEffect(()=>{o()},[o]);const u=v.useCallback(async(f,h)=>{const x=await Ne.setConfig(f,h);return i({type:"SET_CONFIG",config:x}),x},[]),m=v.useMemo(()=>({config:r.config,loading:r.loading,updateConfig:u,refreshConfig:o}),[r,u,o]);return n.jsx(sv.Provider,{value:m,children:a})}function db({topRail:a,sidebar:r,main:i,statusBar:o,resizeHandle:u,banner:m,liveMessage:f,sidebarWidth:h=320,sidebarHidden:x=!1}){const p={"--top-rail-height":"48px","--status-bar-height":"28px","--sidebar-width":`${h}px`,display:"grid",gridTemplateRows:"var(--top-rail-height) 1fr var(--status-bar-height)",height:"100vh",overflow:"hidden",background:"var(--bg-canvas)",color:"var(--text-primary)"},y={display:"grid",gridTemplateColumns:x?"1fr":"var(--sidebar-width) auto 1fr",minHeight:0,overflow:"hidden"};return n.jsxs("div",{className:"studio-shell",style:p,children:[m,n.jsx("header",{style:{borderBottom:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:a}),n.jsxs("div",{style:y,children:[!x&&n.jsx("aside",{"aria-label":"Skills sidebar",style:{minHeight:0,overflow:"hidden",borderRight:u?"none":"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",flexDirection:"column"},children:r}),!x&&u,n.jsx("main",{style:{minHeight:0,overflow:"auto",background:"var(--bg-canvas)"},children:i})]}),n.jsx("footer",{role:"contentinfo",style:{borderTop:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:o}),n.jsx("div",{"aria-live":"polite",role:"status",style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0},children:f??""})]})}var fo=lv();const fb=av(fo),Qh=["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed","ollama","lm-studio"],pb={"claude-cli":".claude",cursor:".cursor","codex-cli":".codex","gemini-cli":".gemini",copilot:".github",zed:".zed"},mb={"claude-cli":"claude",cursor:"cursor","codex-cli":"codex","gemini-cli":"gemini"},hb={"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"},xb={"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 vb(a,r){var h,x;const i=pb[a.id]??null,o=mb[a.id]??null,u=i?!!((h=r==null?void 0:r.wrapperFolders)!=null&&h[i]):!1,m=o?!!((x=r==null?void 0:r.binaries)!=null&&x[o]):!0,f=a.models.map(p=>({id:p.id,displayName:p.label,billingMode:xb[a.id]??"per-token"}));return{id:a.id,displayName:gb(a.id,a.label),wrapperFolder:i,wrapperFolderPresent:u,binaryAvailable:m,endpointReachable:a.id==="ollama"||a.id==="lm-studio"?a.available:null,available:a.available,ctaType:a.available?null:hb[a.id]??null,models:f}}function gb(a,r){return{"claude-cli":"Claude Code",anthropic:"Anthropic API",openrouter:"OpenRouter",cursor:"Cursor","codex-cli":"Codex CLI","gemini-cli":"Gemini CLI",copilot:"GitHub Copilot",zed:"Zed",ollama:"Ollama","lm-studio":"LM Studio"}[a]??r}function yb(a){const r=new Map(a.map(o=>[o.id,o])),i=[];for(const o of Qh){const u=r.get(o);u&&i.push(u)}for(const o of a)Qh.includes(o.id)||i.push(o);return i}function bb(a){const[r,i]=v.useState(null),[o,u]=v.useState("loading"),[m,f]=v.useState(null),h=v.useRef(null),x=v.useRef(0),p=v.useCallback(async()=>{try{const N=await fetch("/api/config");if(!N.ok)throw new Error(`/api/config returned ${N.status}`);const D=await N.json(),T=yb((D.providers||[]).map(k=>vb(k,D.detection)));i({agents:T,activeAgent:D.provider??null,activeModel:D.model??null}),u("ready"),f(null)}catch(N){u("error"),f(N.message)}},[]);v.useEffect(()=>{p()},[p]);const y=v.useCallback(async()=>{const N=Date.now();if(!(N-x.current<5*6e4))try{const D=await fetch("/api/openrouter/models");if(!D.ok)return;const T=await D.json();x.current=N,i(k=>{if(!k)return k;const M=k.agents.map(B=>{if(B.id!=="openrouter")return B;const V=T.models.map(U=>({id:U.id,displayName:U.name,contextWindow:U.contextWindow,pricing:U.pricing,billingMode:"per-token"}));return{...B,models:V,catalogAgeMs:T.ageSec?T.ageSec*1e3:0,cacheStale:!!T.stale}});return{...k,agents:M}}),T.stale&&(a!=null&&a.onStaleCatalog)&&a.onStaleCatalog("openrouter",(T.ageSec??0)*1e3)}catch{}},[a]),g=v.useCallback(N=>{h.current=N,N==="openrouter"&&y()},[y]),j=v.useCallback(()=>{x.current=0,p()},[p]),S=v.useCallback(async(N,D)=>{(await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:N,model:D})})).ok&&i(k=>k&&{...k,activeAgent:N,activeModel:D})},[]);return{status:o,catalog:r,error:m,focusAgent:g,refresh:j,activeAgentId:(r==null?void 0:r.activeAgent)??null,activeModelId:(r==null?void 0:r.activeModel)??null,setActive:S}}function Vu({variant:a,label:r,onActivate:i,installUrl:o}){function u(f){if(f.stopPropagation(),a==="cli-install"&&o){window.open(o,"_blank","noopener,noreferrer");return}i()}function m(f){(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),u(f))}return n.jsx("button",{type:"button","data-testid":`locked-cta-${a}`,onClick:u,onKeyDown:m,className:"inline-flex items-center gap-1.5 px-0 py-0 text-[11px] font-medium",style:{color:"var(--accent, var(--text-primary))",background:"transparent",border:"none",cursor:"pointer"},"aria-label":r,children:r})}function id({unlocked:a=!1,size:r=10}){return a?n.jsxs("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[n.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),n.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 3.5"})]}):n.jsxs("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[n.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),n.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 4.5V7"})]})}const jb={sectionOwn:"Own",sectionInstalled:"Installed",searchPlaceholder:"Search skills",searchShortcutHint:"Press / to search",emptyOwnHeadline:"No skills yet.",emptyOwnBody:"Run vskill new <name> to create one.",emptyInstalledHeadline:"No installed skills.",emptyInstalledBody:"Run vskill install <plugin> to add one.",emptyFilteredHeadline:"No matches in this section.",emptyFilteredBody:"Clear the search or try another query.",loadErrorHeadline:"Couldn't load skills.",loadErrorRetry:"Retry",duplicateBadge:"synced from Own",updateAvailableBadge:"Update available",countBadgeFiltered:(a,r)=>`${a} of ${r}`},Sb={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"},kb={tabOverview:"Overview",tabVersions:"Versions",tabBenchmark:"Benchmark",emptyHeadline:"Select a skill to see details.",emptyBody:"Pick one from the sidebar.",loadErrorHeadline:a=>`Couldn't load SKILL.md for ${a}.`,loadErrorBody:"Check the file path and your workspace permissions.",openInEditor:"Open in editor",copyPath:"Copy path",copyConfigSnippet:"Copy config snippet",depNotInstalledTooltip:"Not installed",missingValue:"—",announceViewingOwn:a=>`Viewing ${a} (Own)`,announceViewingInstalled:a=>`Viewing ${a} (Installed)`,moreFields:"More fields",sourceAgent:"Source agent",noMcpDependencies:"No MCP dependencies.",filesystemGroup:"Filesystem",benchmarkGroup:"Benchmark",metadataGroup:"Frontmatter"},wb={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."},Cb={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"},Nb={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"},Eb={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."},Tb={disconnected:"Disconnected — reconnecting…",reconnected:"Reconnected.",loading:"Loading skills…",loadingPlaceholderCount:"—"},Rb={fieldRequired:"This field is required.",nameInvalid:"Use letters, numbers, and hyphens.",descriptionRequired:"Description is required.",saveFailed:"Save failed. Check the form for errors."},Ab={boundaryHeadline:"Something broke in this view.",boundaryBody:"Reload the page to recover.",boundaryAction:"Reload"},Mb={triggerLabel:"Agent and model",popoverTitle:"Select agent and model",footerHint:"↑↓ navigate · Enter select · Esc close",settingsButton:"Settings",keyboardShortcut:"⌘K",noModelsYet:"No models yet.",searchPlaceholder:"Search 300+ models…",noMatches:a=>`No models match "${a}"`,clearSearch:"Clear",currentlyActive:"Currently active"},Db={claudeCli:{name:"Claude Code",caption:"Delegates to the `claude` CLI — your existing Claude Code session handles quota.",missingBinary:"Claude Code not found. Install it: `npm install -g @anthropic-ai/claude-code`. Or choose a provider with an API key.",installCta:"Install Claude Code →",installUrl:"https://docs.claude.com/en/docs/claude-code"},anthropic:{name:"Anthropic API",caption:"Direct access via your Anthropic API key.",addKeyCta:"Add API key →",keyIssuanceUrl:"https://platform.claude.com/settings/keys",keyPrefix:"sk-ant-"},openrouter:{name:"OpenRouter",caption:"300+ models from every major vendor.",addKeyCta:"Add API key →",emptyCardBody:"Add your OpenRouter API key to browse 300+ models",keyIssuanceUrl:"https://openrouter.ai/settings/keys",keyPrefix:"sk-or-"},cursor:{name:"Cursor",caption:"Cursor IDE composer.",installCta:"Install Cursor →"},codexCli:{name:"Codex CLI",caption:"OpenAI Codex CLI.",installCta:"Install Codex CLI →"},geminiCli:{name:"Gemini CLI",caption:"Google Gemini CLI.",installCta:"Install Gemini CLI →"},copilot:{name:"GitHub Copilot",caption:"GitHub Copilot CLI.",installCta:"Install Copilot →"},zed:{name:"Zed",caption:"Zed editor.",installCta:"Install Zed →"},ollama:{name:"Ollama",caption:"Local models, free.",startServiceCta:"Start service →"},lmStudio:{name:"LM Studio",caption:"Local models, free.",startServiceCta:"Start service →"}},zb={subscriptionBilling:"· subscription",free:"· free"},Lb={title:"Settings",sectionApiKeys:"API Keys",sectionStorage:"Storage",banner:"Keys are stored locally on this device only. Never synced, never committed to git, never transmitted off-device except to the provider's own API.",storageBrowser:"Browser storage (default)",storageKeychain:"macOS Keychain (recommended)",storageDarwinOnly:"macOS Keychain is only available on macOS",show:"Show",hide:"Hide",paste:"Paste",save:"Save",remove:"Remove",removeConfirm:a=>`Remove ${a} API key?`,keyStoredAt:a=>`Key stored locally — updated ${a}`,noKey:"No key stored",enterNonEmpty:"Enter a non-empty key",prefixWarn:a=>`This doesn't look like a typical ${a} key. Save anyway?`,keySaved:a=>`${a} API key saved (local only, never synced)`,keyRemoved:a=>`${a} API key removed`},_b={providersLabel:"Providers",providerSummary:(a,r)=>`${a}/${r} providers`,locked:a=>`${a} — locked. Click to add a key.`,lockedCli:a=>`${a} — locked. Click for install instructions.`,unlocked:a=>`${a} — unlocked.`},Ob={triggerAriaLabel:"Choose active agent for the sidebar",popoverTitle:"Choose active agent",statsInstalled:"Installed",statsGlobal:"Global",statsLastSync:"Last sync",statsHealthOk:"Fresh",statsHealthStale:"Updates available",statsHealthMissing:"Not detected",switchCta:"Switch for this studio session",notDetectedSubheading:"Not detected",setUpCta:a=>`Set up ${a}`,sharedFolderBanner:a=>`Shared folder — consumed by ${a}`},Bb={ownLabel:"Own",installedLabel:"Installed",globalLabel:"Global",emptyOwn:"No authored skills — run vskill new.",emptyInstalled:a=>`No skills installed for ${a} in this project — run vskill install.`,emptyGlobal:a=>`No global skills for ${a} — run vskill install --global.`},Ib={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"},Hb={title:a=>`Set up ${a}`,close:"Close",copy:"Copy",copied:"Copied",requiredEnv:"Required env vars",getKey:"Get a key",installRun:"Install & run",learnMore:"Learn more",fallbackTitle:"No setup guide available",fallbackBody:"We don't ship a setup guide for this provider yet."},Ub={groupAvailable:"Available",groupAuthoring:"Authoring",sourceProject:"Project",sourcePersonal:"Personal",sourcePlugin:"Plugins",authoringSkills:"Skills"},Vb={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"}},Z={sidebar:jb,shell:Sb,detail:kb,actions:wb,palette:Cb,shortcuts:Nb,toasts:Eb,connection:Tb,forms:Rb,errors:Ab,picker:Mb,providers:Db,models:zb,settings:Lb,statusBar:_b,scopePicker:Ob,scopeSection:Bb,claudeCodeLabel:Ib,setupDrawer:Hb,setupProviders:Vb,scopeLabels:Ub},Xh=new Set(["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed"]);function $b({agents:a,activeAgentId:r,focusedAgentId:i,onFocus:o,onSelect:u,onOpenSettings:m}){const f=a.filter(x=>Xh.has(x.id)),h=a.filter(x=>!Xh.has(x.id));return n.jsxs("div",{role:"listbox","aria-label":"Agent","data-testid":"agent-list",style:{width:240,borderRight:"1px solid var(--border-default, var(--border-subtle))",display:"flex",flexDirection:"column",overflowY:"auto"},children:[f.map(x=>n.jsx(Zh,{agent:x,isActive:x.id===r,isFocused:x.id===i,onFocus:o,onSelect:u,onOpenSettings:m},x.id)),h.length>0&&n.jsx("div",{style:{borderTop:"1px solid var(--border-default, var(--border-subtle))",margin:"4px 0"},"aria-hidden":"true"}),h.map(x=>n.jsx(Zh,{agent:x,isActive:x.id===r,isFocused:x.id===i,onFocus:o,onSelect:u,onOpenSettings:m},x.id))]})}function Zh({agent:a,isActive:r,isFocused:i,onFocus:o,onSelect:u,onOpenSettings:m}){const{providers:f}=Z,h={"claude-cli":f.claudeCli.caption,anthropic:f.anthropic.caption,openrouter:f.openrouter.caption},x={"claude-cli":{label:f.claudeCli.installCta,url:f.claudeCli.installUrl},cursor:{label:f.cursor.installCta},"codex-cli":{label:f.codexCli.installCta},"gemini-cli":{label:f.geminiCli.installCta},copilot:{label:f.copilot.installCta},zed:{label:f.zed.installCta}},p=a.id==="claude-cli"||a.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:i?"var(--surface-muted, var(--surface-3))":"transparent",borderLeft:r?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",fontSize:13,fontWeight:r?500:400,color:"var(--text-primary)"};return r&&(y.background="color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)"),n.jsxs("div",{role:"option","aria-selected":r,"data-testid":`agent-row-${a.id}`,"data-focused":i||void 0,tabIndex:i?0:-1,onMouseEnter:()=>o(a.id),onFocus:()=>o(a.id),onClick:()=>u(a.id),style:y,children:[a.wrapperFolder&&n.jsx("span",{"data-testid":`wrapper-dot-${a.id}`,"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",flexShrink:0,background:a.wrapperFolderPresent?"var(--accent, var(--color-accent))":"transparent",border:a.wrapperFolderPresent?"none":"1px solid var(--border-default, var(--border-subtle))"}}),!a.wrapperFolder&&n.jsx("span",{style:{width:6,height:6,flexShrink:0},"aria-hidden":"true"}),n.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[n.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.displayName}),(a.id==="claude-cli"||a.id==="claude-code")&&n.jsx("span",{"data-testid":"claude-code-billing-label",title:Z.claudeCodeLabel.tooltip,style:{fontSize:10,color:"var(--text-secondary, var(--text-tertiary))",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:1},children:Z.claudeCodeLabel.compactLabel})]}),n.jsx("span",{"aria-label":a.available?"available":"locked",style:{color:a.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0},children:a.available?n.jsx(id,{unlocked:!0,size:10}):n.jsx(id,{size:10})}),r&&n.jsx("span",{style:{fontSize:10,textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600,color:"var(--accent-ink, var(--accent))",flexShrink:0},"data-testid":`active-badge-${a.id}`,children:Z.picker.currentlyActive}),!a.available&&a.ctaType==="api-key"&&n.jsx(Vu,{variant:"api-key",label:a.id==="anthropic"?f.anthropic.addKeyCta:f.openrouter.addKeyCta,onActivate:()=>m(a.id)}),!a.available&&a.ctaType==="cli-install"&&x[a.id]&&n.jsx(Vu,{variant:"cli-install",label:x[a.id].label,installUrl:x[a.id].url,onActivate:()=>{}}),!a.available&&a.ctaType==="start-service"&&n.jsx(Vu,{variant:"start-service",label:a.id==="ollama"?f.ollama.startServiceCta:f.lmStudio.startServiceCta,onActivate:()=>m(a.id)}),h[a.id]&&n.jsx("span",{className:"sr-only","data-testid":`caption-${a.id}`,children:h[a.id]})]})}function Gb(a,r,i,o){const f=a>=80,h=v.useRef(null),[x,p]=v.useState(0),y=v.useCallback(S=>{p(S.currentTarget.scrollTop)},[]),{visibleStart:g,visibleEnd:j}=v.useMemo(()=>{if(!f)return{visibleStart:0,visibleEnd:a};const S=Math.max(0,Math.floor(x/r)-4),N=Math.ceil(i/r)+8,D=Math.min(a,S+N);return{visibleStart:S,visibleEnd:D}},[f,x,r,i,a,4]);return{visibleStart:g,visibleEnd:j,totalHeight:a*r,offsetTop:g*r,virtualised:f,containerProps:{onScroll:y,ref:h,style:{overflowY:"auto",maxHeight:i,willChange:f?"transform":void 0}}}}const iv=44,Pb=352,qb=60;function Yb(a){var m,f;const r=a.contextWindow?a.contextWindow>=1e6?`${Math.round(a.contextWindow/1e6)}M`:a.contextWindow>=1e3?`${Math.round(a.contextWindow/1e3)}k`:String(a.contextWindow):null;if(a.billingMode==="subscription")return r?`${r} ctx ${Z.models.subscriptionBilling}`:Z.models.subscriptionBilling.trim();if(a.billingMode==="free")return r?`local · ${r} ctx · free`:"local · free";const i=((m=a.pricing)==null?void 0:m.prompt)??0,o=((f=a.pricing)==null?void 0:f.completion)??0,u=`$${i.toFixed(2)} / $${o.toFixed(2)} per 1M tokens`;return r?`${r} ctx · ${u}`:u}function Fb(a,r){if(!r)return a;const i=r.toLowerCase();return a.filter(u=>u.displayName.toLowerCase().includes(i)).sort((u,m)=>{const f=u.displayName.toLowerCase().indexOf(i),h=m.displayName.toLowerCase().indexOf(i);return f!==h?f-h:u.displayName.length-m.displayName.length})}function Wb({agent:a,activeModelId:r,onSelect:i,onOpenSettings:o}){const[u,m]=v.useState(""),[f,h]=v.useState(""),x=v.useRef(null);if(v.useEffect(()=>{const g=setTimeout(()=>h(u),qb);return()=>clearTimeout(g)},[u]),v.useEffect(()=>{a.id==="openrouter"&&a.available&&x.current&&x.current.focus()},[a.id,a.available]),a.id==="openrouter"&&!a.available)return n.jsxs("div",{"data-testid":"openrouter-empty-card",style:{width:360,padding:20,display:"flex",flexDirection:"column",gap:12},children:[n.jsx("p",{style:{margin:0,color:"var(--text-primary)",fontSize:13,lineHeight:1.5},children:Z.providers.openrouter.emptyCardBody}),n.jsx("button",{type:"button",onClick:()=>o("openrouter"),style:{alignSelf:"flex-start",padding:"6px 10px",borderRadius:6,background:"var(--accent, var(--color-accent))",color:"var(--bg-surface, white)",border:"none",fontSize:12,fontWeight:500,cursor:"pointer"},children:Z.providers.openrouter.addKeyCta})]});const p=v.useMemo(()=>Fb(a.models,f),[a.models,f]),y=Gb(p.length,iv,Pb);return n.jsxs("div",{role:"listbox","aria-label":"Model","data-testid":"model-list",style:{width:360,display:"flex",flexDirection:"column"},children:[a.id==="openrouter"&&n.jsx("div",{style:{padding:8,borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:n.jsx("input",{ref:x,type:"text",placeholder:Z.picker.searchPlaceholder,value:u,onChange:g=>m(g.target.value),"data-testid":"model-search-input","aria-label":Z.picker.searchPlaceholder,style:{width:"100%",padding:"6px 8px",background:"var(--surface-2, var(--bg-surface))",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif"}})}),p.length===0&&f?n.jsxs("div",{style:{padding:16},"data-testid":"no-matches",children:[n.jsx("div",{style:{color:"var(--text-muted, var(--text-tertiary))",fontSize:12,marginBottom:8},children:Z.picker.noMatches(f)}),n.jsx("button",{type:"button",onClick:()=>m(""),style:{padding:"4px 8px",background:"transparent",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:Z.picker.clearSearch})]}):p.length===0?n.jsx("div",{style:{padding:16,color:"var(--text-muted, var(--text-tertiary))",fontSize:12},children:Z.picker.noModelsYet}):n.jsx("div",{...y.containerProps,children:n.jsx("div",{style:{height:y.virtualised?y.totalHeight:"auto",position:"relative"},children:n.jsx("div",{style:{transform:y.virtualised?`translateY(${y.offsetTop}px)`:void 0},children:p.slice(y.visibleStart,y.visibleEnd).map(g=>n.jsx(Kb,{model:g,isActive:g.id===r,onSelect:()=>i(g.id)},g.id))})})})]})}function Kb({model:a,isActive:r,onSelect:i}){const o=Yb(a);return n.jsxs("button",{type:"button",role:"option","aria-selected":r,"data-testid":`model-row-${a.id}`,onClick:i,title:a.id,style:{width:"100%",height:iv,padding:"4px 12px",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:2,background:r?"color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)":"transparent",borderLeft:r?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",cursor:"pointer",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",textAlign:"left"},children:[n.jsx("span",{style:{fontSize:14,fontWeight:500,color:"var(--text-primary)"},children:a.displayName}),n.jsx("span",{style:{fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace",fontVariantNumeric:"tabular-nums",color:"var(--text-muted, var(--text-tertiary))"},children:o})]})}const Jh={anthropic:{stored:!1,updatedAt:null,tier:"browser"},openrouter:{stored:!1,updatedAt:null,tier:"browser"}};function Qb(){const[a,r]=v.useState(null),[i,o]=v.useState(!0),[u,m]=v.useState(null),f=v.useCallback(async()=>{o(!0);try{const p=await fetch("/api/settings/keys");if(!p.ok)throw new Error(`GET /api/settings/keys returned ${p.status}`);const y=await p.json();r({...Jh,...y}),m(null)}catch(p){m(p.message),r(Jh)}finally{o(!1)}},[]);v.useEffect(()=>{f()},[f]);const h=v.useCallback(async(p,y,g="browser")=>{const j=await fetch("/api/settings/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:p,key:y,tier:g})});if(!j.ok){const N=await j.json().catch(()=>({error:j.statusText}));throw new Error(N.error||`POST /api/settings/keys returned ${j.status}`)}const S=await j.json();return await f(),S},[f]),x=v.useCallback(async 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:a,loading:i,error:u,save:h,remove:x,refresh:f}}const Xb=[{id:"anthropic",name:Z.providers.anthropic.name,keyIssuanceUrl:Z.providers.anthropic.keyIssuanceUrl,prefix:Z.providers.anthropic.keyPrefix},{id:"openrouter",name:Z.providers.openrouter.name,keyIssuanceUrl:Z.providers.openrouter.keyIssuanceUrl,prefix:Z.providers.openrouter.keyPrefix}];function Zb(){return typeof navigator>"u"?!1:/Mac|iPhone|iPad/.test(navigator.platform)}function Jb(a){const r=Date.now()-new Date(a).getTime();return r<6e4?"just now":r<36e5?`${Math.round(r/6e4)}m ago`:r<864e5?`${Math.round(r/36e5)}h ago`:new Date(a).toLocaleString()}function e0({open:a,onClose:r,initialProvider:i,onToast:o}){const{state:u,save:m,remove:f}=Qb(),[h,x]=v.useState("browser"),p=v.useRef(null),y=v.useRef(null),[g,j]=v.useState(i??"anthropic");if(v.useEffect(()=>{if(!a)return;const N=document.activeElement,D=setTimeout(()=>{var M;const T=i?`input[data-provider="${i}"]`:"input[data-provider]",k=(M=p.current)==null?void 0:M.querySelector(T);k==null||k.focus()},0);return()=>{var T;clearTimeout(D),(T=N==null?void 0:N.focus)==null||T.call(N)}},[a,i]),v.useEffect(()=>{if(!a)return;const N=D=>{if(D.key==="Escape"){D.preventDefault(),r();return}if(D.key==="Tab"&&p.current){const T=p.current.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(T.length===0)return;const k=T[0],M=T[T.length-1];D.shiftKey&&document.activeElement===k?(D.preventDefault(),M.focus()):!D.shiftKey&&document.activeElement===M&&(D.preventDefault(),k.focus())}};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[a,r]),!a)return null;const S=Zb();return n.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"settings-modal-title","data-testid":"settings-modal",style:{position:"fixed",inset:0,background:"color-mix(in srgb, black 40%, transparent)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},onClick:N=>{N.target===N.currentTarget&&r()},children:n.jsxs("div",{ref:p,style:{background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,width:560,maxHeight:"80vh",overflowY:"auto",padding:20,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",color:"var(--text-primary)"},onClick:N=>N.stopPropagation(),children:[n.jsx("h2",{id:"settings-modal-title",style:{margin:"0 0 16px 0",fontSize:16,fontWeight:600},children:Z.settings.title}),n.jsx("div",{role:"note","data-testid":"settings-banner",style:{padding:"8px 12px",borderRadius:6,background:"color-mix(in srgb, var(--info, var(--accent-muted)) 20%, transparent)",color:"var(--text-primary)",fontSize:12,marginBottom:16},children:Z.settings.banner}),n.jsxs("section",{"aria-labelledby":"settings-api-keys-title",style:{marginBottom:20},children:[n.jsx("h3",{id:"settings-api-keys-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:Z.settings.sectionApiKeys}),Xb.map(N=>n.jsx(t0,{providerId:N.id,providerName:N.name,keyIssuanceUrl:N.keyIssuanceUrl,prefix:N.prefix,metadata:u==null?void 0:u[N.id],tier:h,onSave:async D=>{const T=await m(N.id,D,h);return o==null||o(Z.settings.keySaved(N.name)),T},onRemove:async()=>{await f(N.id),o==null||o(Z.settings.keyRemoved(N.name))},inputRef:N.id===(i??"anthropic")?y:void 0},N.id))]}),n.jsxs("section",{"aria-labelledby":"settings-storage-title",children:[n.jsx("h3",{id:"settings-storage-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:Z.settings.sectionStorage}),S?n.jsxs("fieldset",{style:{border:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:6},children:[n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[n.jsx("input",{type:"radio",name:"storage-tier",value:"browser",checked:h==="browser",onChange:()=>x("browser")}),Z.settings.storageBrowser]}),n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[n.jsx("input",{type:"radio",name:"storage-tier",value:"keychain",checked:h==="keychain",onChange:()=>x("keychain")}),Z.settings.storageKeychain]})]}):n.jsxs("div",{style:{fontSize:12,color:"var(--text-muted, var(--text-tertiary))"},children:[Z.settings.storageBrowser,n.jsxs("span",{title:Z.settings.storageDarwinOnly,style:{marginLeft:8},children:["(",Z.settings.storageDarwinOnly,")"]})]})]}),n.jsx("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end"},children:n.jsx("button",{type:"button",onClick:r,style:{padding:"6px 12px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:"Close"})})]})})}function t0({providerId:a,providerName:r,keyIssuanceUrl:i,prefix:o,metadata:u,onSave:m,onRemove:f,inputRef:h}){const[x,p]=v.useState(""),[y,g]=v.useState(!1),[j,S]=v.useState(!1),[N,D]=v.useState(!1),[T,k]=v.useState(null),M=x.trim(),B=M.length===0,V=M.length>0&&!M.startsWith(o),A=v.useCallback(async()=>{if(!B){S(!0);try{const z=await m(M);z.warning?k(z.warning):k(null),p("")}finally{S(!1)}}},[B,m,M]),U=v.useCallback(async()=>{var z;try{if(!((z=navigator.clipboard)!=null&&z.readText))return;const R=await navigator.clipboard.readText();p(R)}catch{}},[]),C=v.useCallback(async()=>{D(!1),await f()},[f]);return n.jsxs("div",{"data-testid":`provider-row-${a}`,style:{padding:12,border:"1px solid var(--border-subtle)",borderRadius:6,marginBottom:8,display:"flex",flexDirection:"column",gap:8},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[n.jsx("strong",{style:{fontSize:13},children:r}),n.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",style:{fontSize:12,color:"var(--accent, var(--color-accent))"},children:"Get a key →"})]}),n.jsxs("div",{style:{display:"flex",gap:6},children:[n.jsx("input",{ref:h,type:y?"text":"password",value:x,onChange:z=>{p(z.target.value),k(null)},"data-provider":a,placeholder:`Paste ${r} key`,style:{flex:1,padding:"6px 8px",border:"1px solid var(--border-subtle)",borderRadius:4,background:"var(--surface-2, var(--bg-surface))",color:"var(--text-primary)",fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"}}),n.jsx("button",{type:"button",onClick:()=>g(!y),style:ir,children:y?Z.settings.hide:Z.settings.show}),n.jsx("button",{type:"button",onClick:U,style:ir,children:Z.settings.paste})]}),B&&x.length>0&&n.jsx("div",{role:"status",style:n0,children:Z.settings.enterNonEmpty}),V&&n.jsx("div",{role:"status","data-testid":`prefix-warn-${a}`,style:ex,children:Z.settings.prefixWarn(r)}),T&&n.jsx("div",{role:"status",style:ex,children:T}),n.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[n.jsx("button",{type:"button",onClick:A,disabled:B||j,"data-testid":`save-${a}`,style:{...ir,background:B?"var(--surface-2)":"var(--accent, var(--color-accent))",color:B?"var(--text-muted)":"white",cursor:B?"not-allowed":"pointer"},children:Z.settings.save}),(u==null?void 0:u.stored)&&n.jsx(n.Fragment,{children:N?n.jsxs(n.Fragment,{children:[n.jsx("span",{style:{fontSize:12},children:Z.settings.removeConfirm(r)}),n.jsx("button",{type:"button",onClick:C,"data-testid":`remove-confirm-${a}`,style:{...ir,background:"var(--danger, #b33)",color:"white"},children:"Confirm"}),n.jsx("button",{type:"button",onClick:()=>D(!1),style:ir,children:"Cancel"})]}):n.jsx("button",{type:"button",onClick:()=>D(!0),"data-testid":`remove-${a}`,style:{...ir,color:"var(--text-muted)"},children:Z.settings.remove})}),n.jsx("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},"data-testid":`status-${a}`,children:u!=null&&u.stored&&u.updatedAt?Z.settings.keyStoredAt(Jb(u.updatedAt)):Z.settings.noKey})]})]})}const ir={padding:"4px 8px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},n0={fontSize:11,color:"var(--danger, #b33)"},ex={fontSize:11,color:"var(--warning, var(--text-muted))"};function a0(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function l0({onToast:a}){const{status:r,catalog:i,focusAgent:o,setActive:u}=bb({onStaleCatalog:(z,R)=>{const I=Math.round(R/6e4);a==null||a(`Using cached ${z} catalog (${I} min old)`)}}),[m,f]=v.useState(!1),[h,x]=v.useState(!1),[p,y]=v.useState(),[g,j]=v.useState(null),[S,N]=v.useState("agents"),D=v.useRef(null);v.useRef(null),v.useEffect(()=>{var z;i&&!g&&j(i.activeAgent??((z=i.agents[0])==null?void 0:z.id)??null)},[i,g]);const T=(i==null?void 0:i.agents)??[],k=v.useMemo(()=>T.find(z=>z.id===g)??T[0],[T,g]),M=v.useCallback(()=>{var z;f(!0),N("agents"),j((i==null?void 0:i.activeAgent)??((z=T[0])==null?void 0:z.id)??null)},[i,T]),B=v.useCallback(()=>{var z;f(!1),(z=D.current)==null||z.focus()},[]);v.useEffect(()=>{const z=R=>{var P;if(!(R.metaKey||R.ctrlKey)||R.key.toLowerCase()!=="k")return;const I=(P=document.activeElement)==null?void 0:P.tagName;I==="INPUT"||I==="TEXTAREA"||(R.preventDefault(),f(q=>!q))};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[]),v.useEffect(()=>{if(!m)return;const z=I=>{if(I.key==="Escape"){I.preventDefault(),B();return}if(I.key==="ArrowDown"){I.preventDefault(),R(1);return}if(I.key==="ArrowUp"){I.preventDefault(),R(-1);return}if(I.key==="ArrowRight"&&S==="agents"){I.preventDefault(),N("models");return}if(I.key==="ArrowLeft"&&S==="models"){I.preventDefault(),N("agents");return}if(I.key==="Enter"){I.preventDefault(),S==="agents"&&k?N("models"):S==="models"&&k&&k.models[0]&&(u(k.id,k.models[0].id),B());return}};function R(I){if(S==="agents"){const P=T.findIndex(ee=>ee.id===g),q=T[Math.max(0,Math.min(T.length-1,P+I))];q&&(j(q.id),o(q.id))}}return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[m,S,T,g,k,B,o,u]);const V=v.useCallback(z=>{y(z==="anthropic"||z==="openrouter"?z:void 0),x(!0),f(!1)},[]),A=T.find(z=>z.id===(i==null?void 0:i.activeAgent)),U=A==null?void 0:A.models.find(z=>z.id===(i==null?void 0:i.activeModel)),C=v.useMemo(()=>{if(r!=="ready"||!i)return"Loading…";const z=(A==null?void 0:A.displayName)??"Agent",R=(U==null?void 0:U.displayName)??i.activeModel??"Model";return`${z} · ${R}`},[r,i,A,U]);return n.jsxs(n.Fragment,{children:[n.jsxs("button",{ref:D,type:"button","data-testid":"agent-model-picker-trigger",onClick:()=>m?B():M(),"aria-haspopup":"listbox","aria-expanded":m,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 10px",background:"var(--surface-2, var(--bg-surface))",border:"1px solid var(--border-subtle)",borderRadius:6,color:"var(--text-primary)",fontSize:12,cursor:"pointer",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:A!=null&&A.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0}}),n.jsx("span",{children:C})]}),m&&typeof document<"u"&&fo.createPortal(n.jsxs(r0,{reducedMotion:a0(),onClickOutside:B,children:[n.jsxs("div",{style:{display:"flex",height:440,maxHeight:"60vh"},children:[n.jsx($b,{agents:T,activeAgentId:(i==null?void 0:i.activeAgent)??null,focusedAgentId:g,onFocus:z=>{j(z),o(z)},onSelect:z=>{j(z),o(z),N("models")},onOpenSettings:V}),k&&n.jsx(Wb,{agent:k,activeModelId:(i==null?void 0:i.activeModel)??null,onSelect:z=>{u(k.id,z),B()},onOpenSettings:V})]}),n.jsxs("div",{style:{height:32,borderTop:"1px solid var(--border-default, var(--border-subtle))",padding:"0 12px",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},children:[n.jsx("button",{type:"button",onClick:()=>V(),"data-testid":"picker-footer-settings",style:{background:"transparent",border:"none",color:"var(--text-primary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:Z.picker.settingsButton}),n.jsx("span",{style:{fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"},children:Z.picker.footerHint})]})]}),document.body),n.jsx(e0,{open:h,onClose:()=>x(!1),initialProvider:p,onToast:a})]})}function r0({children:a,reducedMotion:r,onClickOutside:i}){const o=v.useRef(null);return v.useEffect(()=>{const u=m=>{o.current&&!o.current.contains(m.target)&&i()};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[i]),n.jsxs("div",{ref:o,"data-testid":"agent-model-picker-popover",role:"dialog","aria-label":"Select agent and model",style:{position:"fixed",top:56,left:"50%",transform:"translateX(-50%)",width:600,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,overflow:"hidden",zIndex:90,animation:r?void 0:"agentPickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[a,n.jsx("style",{children:`@keyframes agentPickerFadeIn {
52
52
  from { opacity: 0; transform: translateX(-50%) translateY(2px); }
53
53
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
54
- }`})]})}function ex(){typeof window>"u"||(window.location.hash="#/")}function r0({onHome:a}){const[r,i]=v.useState(!1),[o,u]=v.useState(!1),m=h=>{h.metaKey||h.ctrlKey||h.shiftKey||h.button!==0||(h.preventDefault(),ex(),a==null||a())},f=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),ex(),a==null||a())};return n.jsxs("a",{href:"#/",role:"link","data-testid":"studio-logo","aria-label":"Skill Studio — home",onClick:m,onKeyDown:f,onFocus:()=>i(!0),onBlur:()=>i(!1),onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),style:{display:"inline-flex",alignItems:"center",gap:10,flexShrink:0,padding:"4px 6px",margin:"-4px -6px",borderRadius:6,textDecoration:"none",color:"inherit",cursor:"pointer",outline:r?"2px solid var(--border-focus)":"none",outlineOffset:2,background:o?"color-mix(in srgb, var(--text-primary) 4%, transparent)":"transparent",transition:"background-color var(--duration-fast, 120ms) var(--ease-standard, ease)"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:6,background:"color-mix(in srgb, var(--accent-surface) 20%, transparent)"},children:n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent-surface)",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}),n.jsx("span",{style:{fontSize:13,fontWeight:600,letterSpacing:"-0.01em",color:"var(--text-primary)"},children:"Skill Studio"})]})}const s0="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",i0=v.lazy(()=>jd(()=>import("./UpdateDropdown-D-KJPEWg.js"),__vite__mapDeps([0,1])));function o0(){const{updateCount:a,updates:r,isRefreshingUpdates:i,refreshUpdates:o,selectSkill:u}=ya(),[m,f]=v.useState(!1),h=v.useRef(null),x=v.useCallback(()=>f(!1),[]),p=a>0?"var(--text-primary)":"var(--text-secondary)",y=a>9?"9+":String(a),g=a===0?"No updates available":`${a} updates available, open summary`;return n.jsxs("span",{"data-testid":"update-bell-anchor",style:{position:"relative",display:"inline-flex"},children:[n.jsxs("button",{ref:h,type:"button","data-testid":"update-bell","aria-label":g,"aria-haspopup":"dialog","aria-expanded":m,onClick:()=>f(j=>!j),style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",height:26,width:26,padding:0,borderRadius:4,border:"1px solid transparent",background:"transparent",color:p,cursor:"pointer"},children:[n.jsx("img",{src:s0,alt:"",width:18,height:18,style:{display:"block",opacity:a>0?1:.75}}),a>0&&n.jsx("span",{"data-testid":"update-bell-badge","aria-hidden":"true",style:{position:"absolute",top:-2,right:-2,minWidth:14,height:14,padding:"0 3px",borderRadius:999,background:"var(--color-own)",color:"var(--color-paper)",fontSize:9,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:600,lineHeight:1},children:y})]}),m&&n.jsx(v.Suspense,{fallback:n.jsx("span",{"data-testid":"update-bell-fallback",children:"Loading…"}),children:n.jsx(i0,{updates:r,isRefreshing:i,onRefresh:()=>o(),onSelectSkill:j=>{const S=j.name.split("/"),N=S.length>=2?S[S.length-2]:S[0],M=S[S.length-1];u({plugin:N,skill:M,origin:"installed"}),x()},onViewAll:()=>{window.location.hash="#/updates",x()},onClose:x,anchorRef:h})})]})}function tx(a){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:navigate-scope",{detail:a}))}function c0({projectName:a,selected:r,onOpenPalette:i,onHome:o,projectPickerSlot:u}){const m=r?r.origin==="installed"?"Installed":"Own":null;return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,height:"100%",width:"100%",padding:"0 16px",fontFamily:"var(--font-sans)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexShrink:0},children:[n.jsx(r0,{onHome:o}),u?n.jsx("div",{style:{borderLeft:"1px solid var(--border-default)",paddingLeft:10,display:"flex",alignItems:"center"},children:u}):a&&n.jsx("span",{title:a,style:{fontSize:12,color:"var(--text-secondary)",borderLeft:"1px solid var(--border-default)",paddingLeft:10,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a})]}),n.jsx("nav",{"aria-label":"Breadcrumb",style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:6,fontSize:12,color:"var(--text-secondary)"},children:r&&m&&n.jsxs(n.Fragment,{children:[n.jsx(nx,{segment:"origin",onClick:()=>tx({scope:"origin",origin:r.origin}),style:{textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:r.origin==="installed"?"var(--status-installed)":"var(--status-own)"},children:m}),n.jsx(ax,{}),n.jsx(nx,{segment:"plugin",onClick:()=>tx({scope:"plugin",plugin:r.plugin}),style:{fontFamily:"var(--font-mono)",fontSize:11},children:r.plugin}),n.jsx(ax,{}),n.jsx("span",{"data-breadcrumb-segment":"skill","aria-current":"page",style:{color:"var(--text-primary)",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.skill})]})}),n.jsxs("div",{"data-toprail-right":"true",style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[n.jsx("span",{"data-slot":"agent-model-picker",style:{minWidth:200},children:n.jsx(a0,{})}),n.jsx("span",{"data-slot":"update-bell",style:{display:"inline-flex"},children:n.jsx(o0,{})}),n.jsx("button",{type:"button",onClick:i,"aria-label":"Open command palette",title:"Command palette (⌘K)",style:{display:"inline-flex",alignItems:"center",gap:6,height:26,padding:"0 10px",borderRadius:4,border:"1px solid var(--border-default)",background:"transparent",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono)",cursor:"pointer"},children:n.jsx("span",{children:"⌘K"})})]})]})}function nx({segment:a,onClick:r,style:i,children:o}){return n.jsx("button",{type:"button","data-breadcrumb-segment":a,onClick:r,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",color:"var(--text-secondary)",fontFamily:"inherit",...i},onMouseEnter:u=>{u.currentTarget.style.color="var(--color-accent-ink)"},onMouseLeave:u=>{const m=(i==null?void 0:i.color)??"var(--text-secondary)";u.currentTarget.style.color=m},children:o})}function ax(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)",fontSize:10},children:"›"})}const po="vskill-theme";function iv(a){return a==="light"||a==="dark"||a==="auto"?a:"auto"}function u0(a,r){return a==="light"||a==="dark"?a:r?"dark":"light"}function d0(a){try{const r=a.getItem(po);return iv(r)}catch{return"auto"}}function f0(a,r){try{a.setItem(po,r)}catch{}}function p0(a,r,i){a.dataset.theme=i,a.dataset.themeMode=r}function m0(a){if(!a)return!1;try{return a("(prefers-color-scheme: dark)").matches}catch{return!1}}const ov=v.createContext(null);function h0({storage:a,matchMedia:r,target:i,children:o}){const u=a??(typeof window<"u"?window.localStorage:void 0),m=r??(typeof window<"u"?window.matchMedia.bind(window):void 0),f=i??(typeof document<"u"?document.documentElement:void 0),[h,x]=v.useState(()=>u?d0(u):"auto"),[p,y]=v.useState(()=>m0(m)),g=v.useMemo(()=>u0(h,p),[h,p]);v.useEffect(()=>{f&&p0(f,h,g)},[f,h,g]),v.useEffect(()=>{if(!m)return;const N=m("(prefers-color-scheme: dark)"),M=k=>y(k.matches);if(typeof N.addEventListener=="function")return N.addEventListener("change",M),()=>N.removeEventListener("change",M);const E=N;return E.addListener(M),()=>E.removeListener(M)},[m]),v.useEffect(()=>{if(typeof window>"u")return;const N=M=>{M.key===po&&x(iv(M.newValue))};return window.addEventListener("storage",N),()=>window.removeEventListener("storage",N)},[]),v.useEffect(()=>{if(!m||!f)return;let N;try{N=m("(prefers-contrast: more)")}catch{return}const M=T=>{T?f.dataset.contrast="more":f.dataset.contrast==="more"&&delete f.dataset.contrast};M(N.matches);const E=T=>M(T.matches);if(typeof N.addEventListener=="function")return N.addEventListener("change",E),()=>N.removeEventListener("change",E);const k=N;return k.addListener(E),()=>k.removeListener(E)},[m,f]);const j=v.useCallback(N=>{x(N),u&&f0(u,N)},[u]),S=v.useMemo(()=>({mode:h,resolvedTheme:g,setTheme:j}),[h,g,j]);return n.jsx(ov.Provider,{value:S,children:o})}function cv(){const a=v.useContext(ov);if(!a)throw new Error("useTheme must be used inside <ThemeProvider>. Wrap the app root in main.tsx.");return a}const lx=["claude-cli","anthropic","openrouter","ollama","lm-studio"];function x0(a){const r=new Map(a.map(o=>[o.id,o])),i=[];for(const o of lx){const u=r.get(o);u&&i.push(u)}for(const o of a)lx.includes(o.id)||i.push(o);return i}function v0(a){const[r,i]=v.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(`(max-width: ${a}px)`).matches);return v.useEffect(()=>{var m;if(typeof window>"u"||!window.matchMedia)return;const o=window.matchMedia(`(max-width: ${a}px)`),u=()=>i(o.matches);return(m=o.addEventListener)==null||m.call(o,"change",u),()=>{var f;return(f=o.removeEventListener)==null?void 0:f.call(o,"change",u)}},[a]),r}function g0({providers:a,onOpenSettings:r,onOpenInstallHelp:i}){const o=x0(a),u=v0(640),[m,f]=v.useState(!1),h=v.useCallback(x=>{x.available||x.kind==="api-key"?r==null||r(x.id):i==null||i(x.id)},[r,i]);if(u){const x=o.filter(p=>p.available).length;return n.jsxs("div",{"data-testid":"providers-segment",style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[n.jsx("button",{type:"button","data-testid":"providers-summary",onClick:()=>f(!m),"aria-label":Z.statusBar.providerSummary(x,o.length),style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:Z.statusBar.providerSummary(x,o.length)}),m&&n.jsx("div",{role:"menu",style:{position:"absolute",bottom:"120%",right:0,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,padding:6,minWidth:180,display:"flex",flexDirection:"column",gap:2,zIndex:80},children:o.map(p=>n.jsx(rx,{p,onClick:h},p.id))})]})}return n.jsx("div",{"data-testid":"providers-segment",style:{display:"inline-flex",alignItems:"center",gap:4},children:o.map(x=>n.jsx(rx,{p:x,onClick:h,compact:!0},x.id))})}function rx({p:a,onClick:r,compact:i}){const o=a.available?Z.statusBar.unlocked(a.label):a.kind==="cli-install"?Z.statusBar.lockedCli(a.label):Z.statusBar.locked(a.label);return n.jsxs("button",{type:"button","data-testid":`provider-glyph-${a.id}`,"data-available":a.available,"aria-label":o,title:o,onClick:()=>r(a),style:{display:"inline-flex",alignItems:"center",gap:4,background:"transparent",border:"none",color:a.available?"var(--status-installed)":"var(--text-muted, var(--text-tertiary))",cursor:"pointer",padding:i?"2px":"4px 6px",fontSize:11},children:[n.jsx(id,{unlocked:a.available,size:10}),!i&&n.jsx("span",{children:a.label})]})}function y0(){try{return typeof localStorage>"u"?null:localStorage.getItem(po)}catch{return null}}function b0({projectPath:a,modelName:r,health:i="ok",onPathClick:o,providers:u,onOpenProviderSettings:m,onOpenProviderInstallHelp:f}){const{mode:h,resolvedTheme:x,setTheme:p}=cv(),g=y0()==="auto",j=j0(h,x,g),S=i==="down"||i==="degraded"?"var(--status-own)":"var(--status-installed)";return n.jsxs("div",{role:"contentinfo",style:{display:"flex",alignItems:"center",gap:12,height:"100%",width:"100%",padding:"0 12px",fontSize:11,fontFamily:"var(--font-sans)",color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[n.jsx("span",{title:r??"",style:{fontFamily:"var(--font-mono)"},children:r??"—"}),n.jsx(sx,{}),n.jsxs("span",{"aria-label":`Health: ${i}`,style:{display:"inline-flex",alignItems:"center",gap:6},children:[n.jsx(S0,{color:S}),n.jsx("span",{style:{textTransform:"capitalize"},children:i})]}),u&&u.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(sx,{}),n.jsx(g0,{providers:u,onOpenSettings:m,onOpenInstallHelp:f})]}),n.jsx("div",{style:{flex:1}}),n.jsxs("button",{type:"button","data-testid":"theme-toggle",onClick:()=>p(j),"aria-label":`Switch to ${j} theme`,title:`Theme: ${h} — click for ${j}`,style:{display:"inline-flex",alignItems:"center",gap:6,background:"transparent",border:"1px solid var(--border-default)",padding:"2px 8px",borderRadius:4,color:"var(--text-secondary)",cursor:"pointer",fontSize:11,height:20},children:[n.jsx(k0,{mode:h}),n.jsx("span",{style:{textTransform:"capitalize"},children:h})]})]})}function j0(a,r,i){return a==="light"?"dark":a==="dark"?"auto":i?"light":r==="light"?"dark":"light"}function S0({color:a}){return n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:a,display:"inline-block",flexShrink:0}})}function sx(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)"},children:"|"})}function k0({mode:a}){return a==="dark"?n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}):a==="light"?n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"4"}),n.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}):n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"9"}),n.jsx("path",{d:"M12 3a9 9 0 0 0 0 18z",fill:"currentColor"})]})}const mo=0,Ka=1,xr=2,uv=4;function ix(a){return()=>a}function w0(a){a()}function dv(a,r){return i=>a(r(i))}function ox(a,r){return()=>a(r)}function C0(a,r){return i=>a(r,i)}function Sd(a){return a!==void 0}function N0(...a){return()=>{a.map(w0)}}function vr(){}function ho(a,r){return r(a),a}function E0(a,r){return r(a)}function ht(...a){return a}function et(a,r){return a(Ka,r)}function He(a,r){a(mo,r)}function kd(a){a(xr)}function yt(a){return a(uv)}function Ce(a,r){return et(a,C0(r,mo))}function $n(a,r){const i=a(Ka,o=>{i(),r(o)});return i}function cx(a){let r,i;return o=>u=>{r=u,i&&clearTimeout(i),i=setTimeout(()=>{o(r)},a)}}function fv(a,r){return a===r}function mt(a=fv){let r;return i=>o=>{a(r,o)||(r=o,i(o))}}function Ae(a){return r=>i=>{a(i)&&r(i)}}function je(a){return r=>dv(r,a)}function Kn(a){return r=>()=>{r(a)}}function ce(a,...r){const i=T0(...r);return((o,u)=>{switch(o){case xr:kd(a);return;case Ka:return et(a,i(u))}})}function Wn(a,r){return i=>o=>{i(r=a(r,o))}}function yl(a){return r=>i=>{a>0?a--:r(i)}}function va(a){let r=null,i;return o=>u=>{r=u,!i&&(i=setTimeout(()=>{i=void 0,o(r)},a))}}function $e(...a){const r=new Array(a.length);let i=0,o=null;const u=2**a.length-1;return a.forEach((m,f)=>{const h=2**f;et(m,x=>{const p=i;i|=h,r[f]=x,p!==u&&i===u&&o&&(o(),o=null)})}),m=>f=>{const h=()=>{m([f].concat(r))};i===u?h():o=h}}function T0(...a){return r=>a.reduceRight(E0,r)}function R0(a){let r,i;const o=()=>r==null?void 0:r();return function(u,m){switch(u){case Ka:return m?i===m?void 0:(o(),i=m,r=et(a,m),r):(o(),vr);case xr:o(),i=null;return}}}function pe(a){let r=a;const i=We();return((o,u)=>{switch(o){case mo:r=u;break;case Ka:{u(r);break}case uv:return r}return i(o,u)})}function Xt(a,r){return ho(pe(r),i=>Ce(a,i))}function We(){const a=[];return((r,i)=>{switch(r){case mo:a.slice().forEach(o=>{o(i)});return;case xr:a.splice(0,a.length);return;case Ka:return a.push(i),()=>{const o=a.indexOf(i);o>-1&&a.splice(o,1)}}})}function jn(a){return ho(We(),r=>Ce(a,r))}function Ze(a,r=[],{singleton:i}={singleton:!0}){return{constructor:a,dependencies:r,id:A0(),singleton:i}}const A0=()=>Symbol();function M0(a){const r=new Map,i=({constructor:o,dependencies:u,id:m,singleton:f})=>{if(f&&r.has(m))return r.get(m);const h=o(u.map(x=>i(x)));return f&&r.set(m,h),h};return i(a)}function Lt(...a){const r=We(),i=new Array(a.length);let o=0;const u=2**a.length-1;return a.forEach((m,f)=>{const h=2**f;et(m,x=>{i[f]=x,o|=h,o===u&&He(r,i)})}),function(m,f){switch(m){case xr:{kd(r);return}case Ka:return o===u&&f(i),et(r,f)}}}function Re(a,r=fv){return ce(a,mt(r))}function od(...a){return function(r,i){switch(r){case xr:return;case Ka:return N0(...a.map(o=>et(o,i)))}}}const Bt={DEBUG:0,INFO:1,WARN:2,ERROR:3},D0={[Bt.DEBUG]:"debug",[Bt.ERROR]:"error",[Bt.INFO]:"log",[Bt.WARN]:"warn"},z0=()=>typeof globalThis>"u"?window:globalThis,Wa=Ze(()=>{const a=pe(Bt.ERROR);return{log:pe((r,i,o=Bt.INFO)=>{const u=z0().VIRTUOSO_LOG_LEVEL??yt(a);o>=u&&console[D0[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",r,i)}),logLevel:a}},[],{singleton:!0});function jl(a,r,i){return wd(a,r,i).callbackRef}function wd(a,r,i){const o=we.useRef(null);let u=f=>{};const m=we.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(f=>{const h=()=>{const x=f[0].target;x.offsetParent!==null&&a(x)};i?h():requestAnimationFrame(h)}):null,[a,i]);return u=f=>{f&&r?(m==null||m.observe(f),o.current=f):(o.current&&(m==null||m.unobserve(o.current)),o.current=null)},{callbackRef:u,ref:o}}function L0(a,r,i,o,u,m,f,h,x){const p=we.useCallback(y=>{const g=_0(y.children,r,h?"offsetWidth":"offsetHeight",u);let j=y.parentElement;for(;j.dataset.virtuosoScroller===void 0;)j=j.parentElement;const S=j.lastElementChild.dataset.viewportType==="window";let N;S&&(N=j.ownerDocument.defaultView);const M=f?h?f.scrollLeft:f.scrollTop:S?h?N.scrollX||N.document.documentElement.scrollLeft:N.scrollY||N.document.documentElement.scrollTop:h?j.scrollLeft:j.scrollTop,E=f?h?f.scrollWidth:f.scrollHeight:S?h?N.document.documentElement.scrollWidth:N.document.documentElement.scrollHeight:h?j.scrollWidth:j.scrollHeight,k=f?h?f.offsetWidth:f.offsetHeight:S?h?N.innerWidth:N.innerHeight:h?j.offsetWidth:j.offsetHeight;o({scrollHeight:E,scrollTop:Math.max(M,0),viewportHeight:k}),m==null||m(h?ux("column-gap",getComputedStyle(y).columnGap,u):ux("row-gap",getComputedStyle(y).rowGap,u)),g!==null&&a(g)},[a,r,u,m,f,o,h]);return wd(p,i,x)}function _0(a,r,i,o){const u=a.length;if(u===0)return null;const m=[];for(let f=0;f<u;f++){const h=a.item(f);if(h.dataset.index===void 0)continue;const x=parseInt(h.dataset.index),p=parseFloat(h.dataset.knownSize),y=r(h,i);if(y===0&&o("Zero-sized element, this should not happen",{child:h},Bt.ERROR),y===p)continue;const g=m[m.length-1];m.length===0||g.size!==y||g.endIndex!==x-1?m.push({endIndex:x,size:y,startIndex:x}):m[m.length-1].endIndex++}return m}function ux(a,r,i){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&i(`${a} was not resolved to pixel value correctly`,r,Bt.WARN),r==="normal"?0:parseInt(r??"0",10)}function pv(a,r,i){const o=we.useRef(null),u=we.useCallback(x=>{if(!(x!=null&&x.offsetParent))return;const p=x.getBoundingClientRect(),y=p.width;let g,j;if(r){const S=r.getBoundingClientRect(),N=p.top-S.top;j=S.height-Math.max(0,N),g=N+r.scrollTop}else{const S=f.current.ownerDocument.defaultView;j=S.innerHeight-Math.max(0,p.top),g=p.top+S.scrollY}o.current={listHeight:p.height,offsetTop:g,visibleHeight:j,visibleWidth:y},a(o.current)},[a,r]),{callbackRef:m,ref:f}=wd(u,!0,i),h=we.useCallback(()=>{u(f.current)},[u,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 x=(p=f.current)==null?void 0:p.ownerDocument.defaultView;return x==null||x.addEventListener("scroll",h),x==null||x.addEventListener("resize",h),()=>{x==null||x.removeEventListener("scroll",h),x==null||x.removeEventListener("resize",h)}},[h,r,f]),m}const an=Ze(()=>{const a=We(),r=We(),i=pe(0),o=We(),u=pe(0),m=We(),f=We(),h=pe(0),x=pe(0),p=pe(0),y=pe(0),g=We(),j=We(),S=pe(!1),N=pe(!1),M=pe(!1);return Ce(ce(a,je(({scrollTop:E})=>E)),r),Ce(ce(a,je(({scrollHeight:E})=>E)),f),Ce(r,u),{deviation:i,fixedFooterHeight:p,fixedHeaderHeight:x,footerHeight:y,headerHeight:h,horizontalDirection:N,scrollBy:j,scrollContainerState:a,scrollHeight:f,scrollingInProgress:S,scrollTo:g,scrollTop:r,skipAnimationFrameInResizeObserver:M,smoothScrollTargetReached:o,statefulScrollTop:u,viewportHeight:m}},[],{singleton:!0}),Ss={lvl:0};function mv(a,r){const i=a.length;if(i===0)return[];let{index:o,value:u}=r(a[0]);const m=[];for(let f=1;f<i;f++){const{index:h,value:x}=r(a[f]);m.push({end:h-1,start:o,value:u}),o=h,u=x}return m.push({end:1/0,start:o,value:u}),m}function ot(a){return a===Ss}function ks(a,r){if(!ot(a))return r===a.k?a.v:r<a.k?ks(a.l,r):ks(a.r,r)}function Gn(a,r,i="k"){if(ot(a))return[-1/0,void 0];if(Number(a[i])===r)return[a.k,a.v];if(Number(a[i])<r){const o=Gn(a.r,r,i);return o[0]===-1/0?[a.k,a.v]:o}return Gn(a.l,r,i)}function yn(a,r,i){return ot(a)?vv(r,i,1):r===a.k?Ot(a,{k:r,v:i}):r<a.k?dx(Ot(a,{l:yn(a.l,r,i)})):dx(Ot(a,{r:yn(a.r,r,i)}))}function ur(){return Ss}function dr(a,r,i){if(ot(a))return[];const o=Gn(a,r)[0];return O0(ud(a,o,i))}function cd(a,r){if(ot(a))return Ss;const{k:i,l:o,r:u}=a;if(r===i){if(ot(o))return u;if(ot(u))return o;const[m,f]=xv(o);return to(Ot(a,{k:m,l:hv(o),v:f}))}return r<i?to(Ot(a,{l:cd(o,r)})):to(Ot(a,{r:cd(u,r)}))}function gl(a){return ot(a)?[]:[...gl(a.l),{k:a.k,v:a.v},...gl(a.r)]}function ud(a,r,i){if(ot(a))return[];const{k:o,l:u,r:m,v:f}=a;let h=[];return o>r&&(h=h.concat(ud(u,r,i))),o>=r&&o<=i&&h.push({k:o,v:f}),o<=i&&(h=h.concat(ud(m,r,i))),h}function to(a){const{l:r,lvl:i,r:o}=a;if(o.lvl>=i-1&&r.lvl>=i-1)return a;if(i>o.lvl+1){if($u(r))return gv(Ot(a,{lvl:i-1}));if(!ot(r)&&!ot(r.r))return Ot(r.r,{l:Ot(r,{r:r.r.l}),lvl:i,r:Ot(a,{l:r.r.r,lvl:i-1})});throw new Error("Unexpected empty nodes")}if($u(a))return dd(Ot(a,{lvl:i-1}));if(!ot(o)&&!ot(o.l)){const u=o.l,m=$u(u)?o.lvl-1:o.lvl;return Ot(u,{l:Ot(a,{lvl:i-1,r:u.l}),lvl:u.lvl+1,r:dd(Ot(o,{l:u.r,lvl:m}))})}throw new Error("Unexpected empty nodes")}function Ot(a,r){return vv(r.k!==void 0?r.k:a.k,r.v!==void 0?r.v:a.v,r.lvl!==void 0?r.lvl:a.lvl,r.l!==void 0?r.l:a.l,r.r!==void 0?r.r:a.r)}function hv(a){return ot(a.r)?a.l:to(Ot(a,{r:hv(a.r)}))}function $u(a){return ot(a)||a.lvl>a.r.lvl}function xv(a){return ot(a.r)?[a.k,a.v]:xv(a.r)}function vv(a,r,i,o=Ss,u=Ss){return{k:a,l:o,lvl:i,r:u,v:r}}function dx(a){return dd(gv(a))}function gv(a){const{l:r}=a;return!ot(r)&&r.lvl===a.lvl?Ot(r,{r:Ot(a,{l:r.r})}):a}function dd(a){const{lvl:r,r:i}=a;return!ot(i)&&!ot(i.r)&&i.lvl===r&&i.r.lvl===r?Ot(i,{l:Ot(a,{r:i.l}),lvl:r+1}):a}function O0(a){return mv(a,({k:r,v:i})=>({index:r,value:i}))}function yv(a,r){return!!(a&&a.startIndex===r.startIndex&&a.endIndex===r.endIndex)}function ws(a,r){return!!(a&&a[0]===r[0]&&a[1]===r[1])}const Cd=Ze(()=>({recalcInProgress:pe(!1)}),[],{singleton:!0});function bv(a,r,i){return a[so(a,r,i)]}function so(a,r,i,o=0){let u=a.length-1;for(;o<=u;){const m=Math.floor((o+u)/2),f=a[m],h=i(f,r);if(h===0)return m;if(h===-1){if(u-o<2)return m-1;u=m-1}else{if(u===o)return m;o=m+1}}throw new Error(`Failed binary finding record in array - ${a.join(",")}, searched for ${r}`)}function B0(a,r,i,o){const u=so(a,r,o),m=so(a,i,o,u);return a.slice(u,m+1)}function Fa(a,r){return Math.round(a.getBoundingClientRect()[r])}function xo(a){return!ot(a.groupOffsetTree)}function Nd({index:a},r){return r===a?0:r<a?-1:1}function U0(){return{groupIndices:[],groupOffsetTree:ur(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:ur()}}function H0(a,r){let i=ot(a)?0:1/0;for(const o of r){const{endIndex:u,size:m,startIndex:f}=o;if(i=Math.min(i,f),ot(a)){a=yn(a,0,m);continue}const h=dr(a,f-1,u+1);if(h.some(Y0(o)))continue;let x=!1,p=!1;for(const{end:y,start:g,value:j}of h)x?(u>=g||m===j)&&(a=cd(a,g)):(p=j!==m,x=!0),y>u&&u>=g&&j!==m&&(a=yn(a,u+1,j));p&&(a=yn(a,f,m))}return[a,i]}function I0(a){return typeof a.groupIndex<"u"}function V0({offset:a},r){return r===a?0:r<a?-1:1}function Cs(a,r,i){if(r.length===0)return 0;const{index:o,offset:u,size:m}=bv(r,a,Nd),f=a-o,h=m*f+(f-1)*i+u;return h>0?h+i:h}function jv(a,r){if(!xo(r))return a;let i=0;for(;r.groupIndices[i]<=a+i;)i++;return a+i}function Sv(a,r,i){if(I0(a))return r.groupIndices[a.groupIndex]+1;const o=a.index==="LAST"?i:a.index;let u=jv(o,r);return u=Math.max(0,u,Math.min(i,u)),u}function $0(a,r,i,o=0){return o>0&&(r=Math.max(r,bv(a,o,Nd).offset)),mv(B0(a,r,i,V0),q0)}function G0(a,[r,i,o,u]){r.length>0&&o("received item sizes",r,Bt.DEBUG);const m=a.sizeTree;let f=m,h=0;if(i.length>0&&ot(m)&&r.length===2){const j=r[0].size,S=r[1].size;f=i.reduce((N,M)=>yn(yn(N,M,j),M+1,S),f)}else[f,h]=H0(f,r);if(f===m)return a;const{lastIndex:x,lastOffset:p,lastSize:y,offsetTree:g}=fd(a.offsetTree,h,f,u);return{groupIndices:i,groupOffsetTree:i.reduce((j,S)=>yn(j,S,Cs(S,g,u)),ur()),lastIndex:x,lastOffset:p,lastSize:y,offsetTree:g,sizeTree:f}}function P0(a){return gl(a).map(({k:r,v:i},o,u)=>{const m=u[o+1];return{endIndex:m!==void 0?m.k-1:1/0,size:i,startIndex:r}})}function fx(a,r){let i=0,o=0;for(;i<a;)i+=r[o+1]-r[o]-1,o++;return o-(i===a?0:1)}function fd(a,r,i,o){let u=a,m=0,f=0,h=0,x=0;if(r!==0){x=so(u,r-1,Nd),h=u[x].offset;const p=Gn(i,r-1);m=p[0],f=p[1],u.length&&u[x].size===Gn(i,r)[1]&&(x-=1),u=u.slice(0,x+1)}else u=[];for(const{start:p,value:y}of dr(i,r,1/0)){const g=p-m,j=g*f+h+g*o;u.push({index:p,offset:j,size:y}),m=p,h=j,f=y}return{lastIndex:m,lastOffset:h,lastSize:f,offsetTree:u}}function q0(a){return{index:a.index,value:a}}function Y0(a){const{endIndex:r,size:i,startIndex:o}=a;return u=>u.start===o&&(u.end===r||u.end===1/0)&&u.value===i}const F0={offsetHeight:"height",offsetWidth:"width"},Qn=Ze(([{log:a},{recalcInProgress:r}])=>{const i=We(),o=We(),u=Xt(o,0),m=We(),f=We(),h=pe(0),x=pe([]),p=pe(void 0),y=pe(void 0),g=pe(void 0),j=pe(void 0),S=pe((w,D)=>Fa(w,F0[D])),N=pe(void 0),M=pe(0),E=U0(),k=Xt(ce(i,$e(x,a,M),Wn(G0,E),mt()),E),T=Xt(ce(x,mt(),Wn((w,D)=>({current:D,prev:w.current}),{current:[],prev:[]}),je(({prev:w})=>w)),[]);Ce(ce(x,Ae(w=>w.length>0),$e(k,M),je(([w,D,A])=>{const O=w.reduce((G,q,te)=>yn(G,q,Cs(q,D.offsetTree,A)||te),ur());return{...D,groupIndices:w,groupOffsetTree:O}})),k),Ce(ce(o,$e(k),Ae(([w,{lastIndex:D}])=>w<D),je(([w,{lastIndex:D,lastSize:A}])=>[{endIndex:D,size:A,startIndex:w}])),i),Ce(p,y);const B=Xt(ce(p,je(w=>w===void 0)),!0);Ce(ce(y,Ae(w=>w!==void 0&&ot(yt(k).sizeTree)),je(w=>{const D=yt(g),A=yt(x).length>0;return D!==void 0&&D!==0?A?[{endIndex:0,size:D,startIndex:0},{endIndex:1,size:w,startIndex:1}]:[]:[{endIndex:0,size:w,startIndex:0}]})),i),Ce(ce(j,Ae(w=>w!==void 0&&w.length>0&&ot(yt(k).sizeTree)),je(w=>{const D=[];let A=w[0],O=0;for(let G=1;G<w.length;G++){const q=w[G];q!==A&&(D.push({endIndex:G-1,size:A,startIndex:O}),A=q,O=G)}return D.push({endIndex:w.length-1,size:A,startIndex:O}),D})),i),Ce(ce(x,$e(g,y),Ae(([,w,D])=>w!==void 0&&D!==void 0),je(([w,D,A])=>{const O=[];for(let G=0;G<w.length;G++){const q=w[G],te=w[G+1];O.push({startIndex:q,endIndex:q,size:D}),te!==void 0&&O.push({startIndex:q+1,endIndex:te-1,size:A})}return O})),i);const I=jn(ce(i,$e(k),Wn(({sizes:w},[D,A])=>({changed:A!==w,sizes:A}),{changed:!1,sizes:E}),je(w=>w.changed)));et(ce(h,Wn((w,D)=>({diff:w.prev-D,prev:D}),{diff:0,prev:0}),je(w=>w.diff)),w=>{const{groupIndices:D}=yt(k);if(w>0)He(r,!0),He(m,w+fx(w,D));else if(w<0){const A=yt(T);A.length>0&&(w-=fx(-w,A)),He(f,w)}}),et(ce(h,$e(a)),([w,D])=>{w<0&&D("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:h},Bt.ERROR)});const L=jn(m);Ce(ce(m,$e(k),je(([w,D])=>{const A=D.groupIndices.length>0,O=[],G=D.lastSize;if(A){const q=ks(D.sizeTree,0);let te=0,X=0;for(;te<w;){const R=D.groupIndices[X],U=D.groupIndices.length===X+1?1/0:D.groupIndices[X+1]-R-1;O.push({endIndex:R,size:q,startIndex:R}),O.push({endIndex:R+1+U-1,size:G,startIndex:R+1}),X++,te+=U+1}const _=gl(D.sizeTree);return te!==w&&_.shift(),_.reduce((R,{k:U,v:se})=>{let Y=R.ranges;return R.prevSize!==0&&(Y=[...R.ranges,{endIndex:U+w-1,size:R.prevSize,startIndex:R.prevIndex}]),{prevIndex:U+w,prevSize:se,ranges:Y}},{prevIndex:w,prevSize:0,ranges:O}).ranges}return gl(D.sizeTree).reduce((q,{k:te,v:X})=>({prevIndex:te+w,prevSize:X,ranges:[...q.ranges,{endIndex:te+w-1,size:q.prevSize,startIndex:q.prevIndex}]}),{prevIndex:0,prevSize:G,ranges:[]}).ranges})),i);const V=jn(ce(f,$e(k,M),je(([w,{offsetTree:D},A])=>{const O=-w;return Cs(O,D,A)})));return Ce(ce(f,$e(k,M),je(([w,D,A])=>{if(D.groupIndices.length>0){if(ot(D.sizeTree))return D;let G=ur();const q=yt(T);let te=0,X=0,_=0;for(;te<-w;){_=q[X];const R=q[X+1]-_-1;X++,te+=R+1}if(G=gl(D.sizeTree).reduce((R,{k:U,v:se})=>yn(R,Math.max(0,U+w),se),G),te!==-w){const R=ks(D.sizeTree,_);G=yn(G,0,R);const U=Gn(D.sizeTree,-w+1)[1];G=yn(G,1,U)}return{...D,sizeTree:G,...fd(D.offsetTree,0,G,A)}}const O=gl(D.sizeTree).reduce((G,{k:q,v:te})=>yn(G,Math.max(0,q+w),te),ur());return{...D,sizeTree:O,...fd(D.offsetTree,0,O,A)}})),k),{beforeUnshiftWith:L,data:N,defaultItemSize:y,firstItemIndex:h,fixedItemSize:p,fixedGroupSize:g,gap:M,groupIndices:x,heightEstimates:j,itemSize:S,listRefresh:I,shiftWith:f,shiftWithOffset:V,sizeRanges:i,sizes:k,statefulTotalCount:u,totalCount:o,trackItemSizes:B,unshiftWith:m}},ht(Wa,Cd),{singleton:!0});function K0(a){return a.reduce((r,i)=>(r.groupIndices.push(r.totalCount),r.totalCount+=i+1,r),{groupIndices:[],totalCount:0})}const kv=Ze(([{groupIndices:a,sizes:r,totalCount:i},{headerHeight:o,scrollTop:u}])=>{const m=We(),f=We(),h=jn(ce(m,je(K0)));return Ce(ce(h,je(x=>x.totalCount)),i),Ce(ce(h,je(x=>x.groupIndices)),a),Ce(ce(Lt(u,r,o),Ae(([x,p])=>xo(p)),je(([x,p,y])=>Gn(p.groupOffsetTree,Math.max(x-y,0),"v")[0]),mt(),je(x=>[x])),f),{groupCounts:m,topItemsIndexes:f}},ht(Qn,an)),Qa=Ze(([{log:a}])=>{const r=pe(!1),i=jn(ce(r,Ae(o=>o),mt()));return et(r,o=>{o&&yt(a)("props updated",{},Bt.DEBUG)}),{didMount:i,propsReady:r}},ht(Wa),{singleton:!0}),W0=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function wv(a){const r=typeof a=="number"?{index:a}:a;return r.align||(r.align="start"),(!r.behavior||!W0)&&(r.behavior="auto"),r.offset===void 0&&(r.offset=0),r}const Rs=Ze(([{gap:a,listRefresh:r,sizes:i,totalCount:o},{fixedFooterHeight:u,fixedHeaderHeight:m,footerHeight:f,headerHeight:h,scrollingInProgress:x,scrollTo:p,smoothScrollTargetReached:y,viewportHeight:g},{log:j}])=>{const S=We(),N=We(),M=pe(0);let E=null,k=null,T=null;function B(){E!==null&&(E(),E=null),T!==null&&(T(),T=null),k&&(clearTimeout(k),k=null),He(x,!1)}return Ce(ce(S,$e(i,g,o,M,h,f,j),$e(a,m,u),je(([[I,L,V,w,D,A,O,G],q,te,X])=>{const _=wv(I),{align:R,behavior:U,offset:se}=_,Y=w-1,me=Sv(_,L,Y);let z=Cs(me,L.offsetTree,q)+A;R==="end"?(z+=te+Gn(L.sizeTree,me)[1]-V+X,me===Y&&(z+=O)):R==="center"?z+=(te+Gn(L.sizeTree,me)[1]-V+X)/2:z-=D,se!==void 0&&se!==0&&(z+=se);const W=ie=>{B(),ie?(G("retrying to scroll to",{location:I},Bt.DEBUG),He(S,I)):(He(N,!0),G("list did not change, scroll successful",{},Bt.DEBUG))};if(B(),U==="smooth"){let ie=!1;T=et(r,de=>{ie=ie||de}),E=$n(y,()=>{W(ie)})}else E=$n(ce(r,Q0(150)),W);return k=setTimeout(()=>{B()},1200),He(x,!0),G("scrolling from index to",{behavior:U,index:me,top:z},Bt.DEBUG),{behavior:U,top:z}})),p),{scrollTargetReached:N,scrollToIndex:S,topListHeight:M}},ht(Qn,an,Wa),{singleton:!0});function Q0(a){return r=>{const i=setTimeout(()=>{r(!1)},a);return o=>{o&&(r(!0),clearTimeout(i))}}}function Ed(a,r){a===0?r():requestAnimationFrame(()=>{Ed(a-1,r)})}function Td(a,r){const i=r-1;return typeof a=="number"?a:a.index==="LAST"?i:a.index}const As=Ze(([{defaultItemSize:a,listRefresh:r,sizes:i},{scrollTop:o},{scrollTargetReached:u,scrollToIndex:m},{didMount:f}])=>{const h=pe(!0),x=pe(0),p=pe(!0);return Ce(ce(f,$e(x),Ae(([y,g])=>g!==0),Kn(!1)),h),Ce(ce(f,$e(x),Ae(([y,g])=>g!==0),Kn(!1)),p),et(ce(Lt(r,f),$e(h,i,a,p),Ae(([[,y],g,{sizeTree:j},S,N])=>y&&(!ot(j)||Sd(S))&&!g&&!N),$e(x)),([,y])=>{$n(u,()=>{He(p,!0)}),Ed(4,()=>{$n(o,()=>{He(h,!0)}),He(m,y)})}),{initialItemFinalLocationReached:p,initialTopMostItemIndex:x,scrolledToInitialItem:h}},ht(Qn,an,Rs,Qa),{singleton:!0});function Cv(a,r){return Math.abs(a-r)<1.01}const Ns="up",ys="down",X0="none",Z0={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},J0=0,Ms=Ze(([{footerHeight:a,headerHeight:r,scrollBy:i,scrollContainerState:o,scrollTop:u,viewportHeight:m}])=>{const f=pe(!1),h=pe(!0),x=We(),p=We(),y=pe(4),g=pe(J0),j=Xt(ce(od(ce(Re(u),yl(1),Kn(!0)),ce(Re(u),yl(1),Kn(!1),cx(100))),mt()),!1),S=Xt(ce(od(ce(i,Kn(!0)),ce(i,Kn(!1),cx(200))),mt()),!1);Ce(ce(Lt(Re(u),Re(g)),je(([T,B])=>T<=B),mt()),h),Ce(ce(h,va(50)),p);const N=jn(ce(Lt(o,Re(m),Re(r),Re(a),Re(y)),Wn((T,[{scrollHeight:B,scrollTop:I},L,V,w,D])=>{const A=I+L-B>-D,O={scrollHeight:B,scrollTop:I,viewportHeight:L};if(A){let q,te;return I>T.state.scrollTop?(q="SCROLLED_DOWN",te=T.state.scrollTop-I):(q="SIZE_DECREASED",te=T.state.scrollTop-I||T.scrollTopDelta),{atBottom:!0,atBottomBecause:q,scrollTopDelta:te,state:O}}let G;return O.scrollHeight>T.state.scrollHeight?G="SIZE_INCREASED":L<T.state.viewportHeight?G="VIEWPORT_HEIGHT_DECREASING":I<T.state.scrollTop?G="SCROLLING_UPWARDS":G="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:G,state:O}},Z0),mt((T,B)=>T!==void 0&&T.atBottom===B.atBottom))),M=Xt(ce(o,Wn((T,{scrollHeight:B,scrollTop:I,viewportHeight:L})=>{if(!Cv(T.scrollHeight,B)){const V=B-(I+L)<1;return T.scrollTop!==I&&V?{changed:!0,jump:T.scrollTop-I,scrollHeight:B,scrollTop:I}:{changed:!0,jump:0,scrollHeight:B,scrollTop:I}}return{changed:!1,jump:0,scrollHeight:B,scrollTop:I}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Ae(T=>T.changed),je(T=>T.jump)),0);Ce(ce(N,je(T=>T.atBottom)),f),Ce(ce(f,va(50)),x);const E=pe(ys);Ce(ce(o,je(({scrollTop:T})=>T),mt(),Wn((T,B)=>yt(S)?{direction:T.direction,prevScrollTop:B}:{direction:B<T.prevScrollTop?Ns:ys,prevScrollTop:B},{direction:ys,prevScrollTop:0}),je(T=>T.direction)),E),Ce(ce(o,va(50),Kn(X0)),E);const k=pe(0);return Ce(ce(j,Ae(T=>!T),Kn(0)),k),Ce(ce(u,va(100),$e(j),Ae(([T,B])=>B),Wn(([T,B],[I])=>[B,I],[0,0]),je(([T,B])=>B-T)),k),{atBottomState:N,atBottomStateChange:x,atBottomThreshold:y,atTopStateChange:p,atTopThreshold:g,isAtBottom:f,isAtTop:h,isScrolling:j,lastJumpDueToItemResize:M,scrollDirection:E,scrollVelocity:k}},ht(an)),Es="top",Ts="bottom",px="none";function mx(a,r,i){return typeof a=="number"?i===Ns&&r===Es||i===ys&&r===Ts?a:0:i===Ns?r===Es?a.main:a.reverse:r===Ts?a.main:a.reverse}function hx(a,r){return typeof a=="number"?a:a[r]??0}const Rd=Ze(([{deviation:a,fixedHeaderHeight:r,headerHeight:i,scrollTop:o,viewportHeight:u}])=>{const m=We(),f=pe(0),h=pe(0),x=pe(0),p=Xt(ce(Lt(Re(o),Re(u),Re(i),Re(m,ws),Re(x),Re(f),Re(r),Re(a),Re(h)),je(([y,g,j,[S,N],M,E,k,T,B])=>{const I=y-T,L=E+k,V=Math.max(j-I,0);let w=px;const D=hx(B,Es),A=hx(B,Ts);return S-=T,S+=j+k,N+=j+k,N-=T,S>y+L-D&&(w=Ns),N<y-V+g+A&&(w=ys),w!==px?[Math.max(I-j-mx(M,Es,w)-D,0),I-V-k+g+mx(M,Ts,w)+A]:null}),Ae(y=>y!==null),mt(ws)),[0,0]);return{increaseViewportBy:h,listBoundary:m,overscan:x,topListHeight:f,visibleRange:p}},ht(an),{singleton:!0});function ej(a,r,i){if(xo(r)){const o=jv(a,r);return[{index:Gn(r.groupOffsetTree,o)[0],offset:0,size:0},{data:i==null?void 0:i[0],index:o,offset:0,size:0}]}return[{data:i==null?void 0:i[0],index:a,offset:0,size:0}]}const Gu={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function no(a,r,i,o,u,m){const{lastIndex:f,lastOffset:h,lastSize:x}=u;let p=0,y=0;if(a.length>0){p=a[0].offset;const M=a[a.length-1];y=M.offset+M.size}const g=i-f,j=h+g*x+(g-1)*o,S=p,N=j-y;return{bottom:y,firstItemIndex:m,items:xx(a,u,m),offsetBottom:N,offsetTop:p,top:S,topItems:xx(r,u,m),topListHeight:r.reduce((M,E)=>E.size+M,0),totalCount:i}}function Nv(a,r,i,o,u,m){let f=0;if(i.groupIndices.length>0)for(const y of i.groupIndices){if(y-f>=a)break;f++}const h=a+f,x=Td(r,h),p=Array.from({length:h}).map((y,g)=>({data:m[g+x],index:g+x,offset:0,size:0}));return no(p,[],h,u,i,o)}function xx(a,r,i){if(a.length===0)return[];if(!xo(r))return a.map(p=>({...p,index:p.index+i,originalIndex:p.index}));const o=a[0].index,u=a[a.length-1].index,m=[],f=dr(r.groupOffsetTree,o,u);let h,x=0;for(const p of a){(!h||h.end<p.index)&&(h=f.shift(),x=r.groupIndices.indexOf(h.start));let y;p.index===h.start?y={index:x,type:"group"}:y={groupIndex:x,index:p.index-(x+1)+i},m.push({...y,data:p.data,offset:p.offset,originalIndex:p.index,size:p.size})}return m}function vx(a,r){return a===void 0?0:typeof a=="number"?a:a[r]??0}const Sl=Ze(([{data:a,firstItemIndex:r,gap:i,sizes:o,totalCount:u},m,{listBoundary:f,topListHeight:h,visibleRange:x},{initialTopMostItemIndex:p,scrolledToInitialItem:y},{topListHeight:g},j,{didMount:S},{recalcInProgress:N}])=>{const M=pe([]),E=pe(0),k=We(),T=pe(0);Ce(m.topItemsIndexes,M);const B=Xt(ce(Lt(S,N,Re(x,ws),Re(u),Re(o),Re(p),y,Re(M),Re(r),Re(i),Re(T),a),Ae(([w,D,,A,,,,,,,,O])=>{const G=O!==void 0&&O.length!==A;return w&&!D&&!G}),je(([,,[w,D],A,O,G,q,te,X,_,R,U])=>{var ve,Ie;const se=O,{offsetTree:Y,sizeTree:me}=se,z=yt(E);if(A===0)return{...Gu,totalCount:A};if(w===0&&D===0)return z===0?{...Gu,totalCount:A}:Nv(z,G,O,X,_,U||[]);if(ot(me))return z>0?null:no(ej(Td(G,A),se,U),[],A,_,se,X);const W=[];if(te.length>0){const Be=te[0],ne=te[te.length-1];let fe=0;for(const ue of dr(me,Be,ne)){const he=ue.value,be=Math.max(ue.start,Be),_e=Math.min(ue.end,ne);for(let Me=be;Me<=_e;Me++)W.push({data:U==null?void 0:U[Me],index:Me,offset:fe,size:he}),fe+=he}}if(!q)return no([],W,A,_,se,X);const ie=te.length>0?te[te.length-1]+1:0,de=$0(Y,w,D,ie);if(de.length===0)return null;const ge=A-1,xe=ho([],Be=>{for(const ne of de){const fe=ne.value;let ue=fe.offset,he=ne.start;const be=fe.size;if(fe.offset<w){he+=Math.floor((w-fe.offset+_)/(be+_));const Me=he-ne.start;ue+=Me*be+Me*_}he<ie&&(ue+=(ie-he)*be,he=ie);const _e=Math.min(ne.end,ge);for(let Me=he;Me<=_e&&!(ue>=D);Me++)Be.push({data:U==null?void 0:U[Me],index:Me,offset:ue,size:be}),ue+=be+_}}),oe=vx(R,Es),ae=vx(R,Ts);if(xe.length>0&&(oe>0||ae>0)){const Be=xe[0],ne=xe[xe.length-1];if(oe>0&&Be.index>ie){const fe=Math.min(oe,Be.index-ie),ue=[];let he=Be.offset;for(let be=Be.index-1;be>=Be.index-fe;be--){const _e=((ve=dr(me,be,be)[0])==null?void 0:ve.value)??Be.size;he-=_e+_,ue.unshift({data:U==null?void 0:U[be],index:be,offset:he,size:_e})}xe.unshift(...ue)}if(ae>0&&ne.index<ge){const fe=Math.min(ae,ge-ne.index);let ue=ne.offset+ne.size+_;for(let he=ne.index+1;he<=ne.index+fe;he++){const be=((Ie=dr(me,he,he)[0])==null?void 0:Ie.value)??ne.size;xe.push({data:U==null?void 0:U[he],index:he,offset:ue,size:be}),ue+=be+_}}}return no(xe,W,A,_,se,X)}),Ae(w=>w!==null),mt()),Gu);Ce(ce(a,Ae(Sd),je(w=>w==null?void 0:w.length)),u),Ce(ce(B,je(w=>w.topListHeight)),g),Ce(g,h),Ce(ce(B,je(w=>[w.top,w.bottom])),f),Ce(ce(B,je(w=>w.items)),k);const I=jn(ce(B,Ae(({items:w})=>w.length>0),$e(u,a),Ae(([{items:w},D])=>w[w.length-1].originalIndex===D-1),je(([,w,D])=>[w-1,D]),mt(ws),je(([w])=>w))),L=jn(ce(B,va(200),Ae(({items:w,topItems:D})=>w.length>0&&w[0].originalIndex===D.length),je(({items:w})=>w[0].index),mt())),V=jn(ce(B,Ae(({items:w})=>w.length>0),je(({items:w})=>{let D=0,A=w.length-1;for(;w[D].type==="group"&&D<A;)D++;for(;w[A].type==="group"&&A>D;)A--;return{endIndex:w[A].index,startIndex:w[D].index}}),mt(yv)));return{endReached:I,initialItemCount:E,itemsRendered:k,listState:B,minOverscanItemCount:T,rangeChanged:V,startReached:L,topItemsIndexes:M,...j}},ht(Qn,kv,Rd,As,Rs,Ms,Qa,Cd),{singleton:!0}),Ev=Ze(([{fixedFooterHeight:a,fixedHeaderHeight:r,footerHeight:i,headerHeight:o},{listState:u}])=>{const m=We(),f=Xt(ce(Lt(i,a,o,r,u),je(([h,x,p,y,g])=>h+x+p+y+g.offsetBottom+g.bottom)),0);return Ce(Re(f),m),{totalListHeight:f,totalListHeightChanged:m}},ht(an,Sl),{singleton:!0}),tj=Ze(([{viewportHeight:a},{totalListHeight:r}])=>{const i=pe(!1),o=Xt(ce(Lt(i,a,r),Ae(([u])=>u),je(([,u,m])=>Math.max(0,u-m)),va(0),mt()),0);return{alignToBottom:i,paddingTopAddition:o}},ht(an,Ev),{singleton:!0}),Tv=Ze(()=>({context:pe(null)})),nj=({itemBottom:a,itemTop:r,locationParams:{align:i,behavior:o,...u},viewportBottom:m,viewportTop:f})=>r<f?{...u,align:i??"start",...o!==void 0?{behavior:o}:{}}:a>m?{...u,align:i??"end",...o!==void 0?{behavior:o}:{}}:null,Rv=Ze(([{gap:a,sizes:r,totalCount:i},{fixedFooterHeight:o,fixedHeaderHeight:u,headerHeight:m,scrollingInProgress:f,scrollTop:h,viewportHeight:x},{scrollToIndex:p}])=>{const y=We();return Ce(ce(y,$e(r,x,i,m,u,o,h),$e(a),je(([[g,j,S,N,M,E,k,T],B])=>{const{calculateViewLocation:I=nj,done:L,...V}=g,w=Sv(g,j,N-1),D=Cs(w,j.offsetTree,B)+M+E,A=D+Gn(j.sizeTree,w)[1],O=T+E,G=T+S-k,q=I({itemBottom:A,itemTop:D,locationParams:V,viewportBottom:G,viewportTop:O});return q!==null?L&&$n(ce(f,Ae(te=>!te),yl(yt(f)?1:2)),L):L==null||L(),q}),Ae(g=>g!==null)),p),{scrollIntoView:y}},ht(Qn,an,Rs,Sl,Wa),{singleton:!0});function gx(a){return a===!1?!1:a==="smooth"?"smooth":"auto"}const aj=(a,r)=>typeof a=="function"?gx(a(r)):r&&gx(a),lj=Ze(([{listRefresh:a,totalCount:r,fixedItemSize:i,data:o},{atBottomState:u,isAtBottom:m},{scrollToIndex:f},{scrolledToInitialItem:h},{didMount:x,propsReady:p},{log:y},{scrollingInProgress:g},{context:j},{scrollIntoView:S}])=>{const N=pe(!1),M=We();let E=null;function k(L){He(f,{align:"end",behavior:L,index:"LAST"})}et(ce(Lt(ce(Re(r),yl(1)),x),$e(Re(N),m,h,g),je(([[L,V],w,D,A,O])=>{let G=V&&A,q="auto";return G&&(q=aj(w,D||O),G=G&&q!==!1),{followOutputBehavior:q,shouldFollow:G,totalCount:L}}),Ae(({shouldFollow:L})=>L)),({followOutputBehavior:L,totalCount:V})=>{E!==null&&(E(),E=null),yt(i)!==void 0?requestAnimationFrame(()=>{yt(y)("following output to ",{totalCount:V},Bt.DEBUG),k(L)}):E=$n(a,()=>{yt(y)("following output to ",{totalCount:V},Bt.DEBUG),k(L),E=null})});function T(L){const V=$n(u,w=>{L&&!w.atBottom&&w.notAtBottomBecause==="SIZE_INCREASED"&&E===null&&(yt(y)("scrolling to bottom due to increased size",{},Bt.DEBUG),k("auto"))});setTimeout(V,100)}et(ce(Lt(Re(N),r,p),Ae(([L,,V])=>L!==!1&&V),Wn(({value:L},[,V])=>({refreshed:L===V,value:V}),{refreshed:!1,value:0}),Ae(({refreshed:L})=>L),$e(N,r)),([,L])=>{yt(h)&&T(L!==!1)}),et(M,()=>{T(yt(N)!==!1)}),et(Lt(Re(N),u),([L,V])=>{L!==!1&&!V.atBottom&&V.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&k("auto")});const B=pe(null),I=We();return Ce(od(ce(Re(o),je(L=>(L==null?void 0:L.length)??0)),ce(Re(r))),I),et(ce(Lt(ce(I,yl(1)),x),$e(Re(B),h,g,j),je(([[L,V],w,D,A,O])=>V&&D&&(w==null?void 0:w({context:O,totalCount:L,scrollingInProgress:A}))),Ae(L=>!!L),va(0)),L=>{E!==null&&(E(),E=null),yt(i)!==void 0?requestAnimationFrame(()=>{yt(y)("scrolling into view",{}),He(S,L)}):E=$n(a,()=>{yt(y)("scrolling into view",{}),He(S,L),E=null})}),{autoscrollToBottom:M,followOutput:N,scrollIntoViewOnChange:B}},ht(Qn,Ms,Rs,As,Qa,Wa,an,Tv,Rv)),rj=Ze(([{data:a,firstItemIndex:r,gap:i,sizes:o},{initialTopMostItemIndex:u},{initialItemCount:m,listState:f},{didMount:h}])=>(Ce(ce(h,$e(m),Ae(([,x])=>x!==0),$e(u,o,r,i,a),je(([[,x],p,y,g,j,S=[]])=>Nv(x,p,y,g,j,S))),f),{}),ht(Qn,As,Sl,Qa),{singleton:!0}),sj=Ze(([{didMount:a},{scrollTo:r},{listState:i}])=>{const o=pe(0);return et(ce(a,$e(o),Ae(([,u])=>u!==0),je(([,u])=>({top:u}))),u=>{$n(ce(i,yl(1),Ae(m=>m.items.length>1)),()=>{requestAnimationFrame(()=>{He(r,u)})})}),{initialScrollTop:o}},ht(Qa,an,Sl),{singleton:!0}),Av=Ze(([{scrollVelocity:a}])=>{const r=pe(!1),i=We(),o=pe(!1);return Ce(ce(a,$e(o,r,i),Ae(([u,m])=>m!==!1&&m!==void 0),je(([u,m,f,h])=>{const{enter:x,exit:p}=m;if(f){if(p(u,h))return!1}else if(x(u,h))return!0;return f}),mt()),r),et(ce(Lt(r,a,i),$e(o)),([[u,m,f],h])=>{u&&h!==!1&&h!==void 0&&h.change&&h.change(m,f)}),{isSeeking:r,scrollSeekConfiguration:o,scrollSeekRangeChanged:i,scrollVelocity:a}},ht(Ms),{singleton:!0}),Ad=Ze(([{scrollContainerState:a,scrollTo:r}])=>{const i=We(),o=We(),u=We(),m=pe(!1),f=pe(void 0);return Ce(ce(Lt(i,o),je(([{scrollTop:h,viewportHeight:x},{offsetTop:p,listHeight:y}])=>({scrollHeight:y,scrollTop:Math.max(0,h-p),viewportHeight:x}))),a),Ce(ce(r,$e(o),je(([h,{offsetTop:x}])=>({...h,top:h.top+x}))),u),{customScrollParent:f,useWindowScroll:m,windowScrollContainerState:i,windowScrollTo:u,windowViewportRect:o}},ht(an)),ij=Ze(([{sizeRanges:a,sizes:r},{headerHeight:i,scrollTop:o},{initialTopMostItemIndex:u},{didMount:m},{useWindowScroll:f,windowScrollContainerState:h,windowViewportRect:x}])=>{const p=We(),y=pe(void 0),g=pe(null),j=pe(null);return Ce(h,g),Ce(x,j),et(ce(p,$e(r,o,f,g,j,i)),([S,N,M,E,k,T,B])=>{const I=P0(N.sizeTree);E&&k!==null&&T!==null&&(M=k.scrollTop-T.offsetTop),M-=B,S({ranges:I,scrollTop:M})}),Ce(ce(y,Ae(Sd),je(oj)),u),Ce(ce(m,$e(y),Ae(([,S])=>S!==void 0),mt(),je(([,S])=>S.ranges)),a),{getState:p,restoreStateFrom:y}},ht(Qn,an,As,Qa,Ad));function oj(a){return{align:"start",index:0,offset:a.scrollTop}}const cj=Ze(([{topItemsIndexes:a}])=>{const r=pe(0);return Ce(ce(r,Ae(i=>i>=0),je(i=>Array.from({length:i}).map((o,u)=>u))),a),{topItemCount:r}},ht(Sl));function Mv(a){let r=!1,i;return(()=>(r||(r=!0,i=a()),i))}const uj=Mv(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),dj=Ze(([{deviation:a,scrollBy:r,scrollingInProgress:i,scrollTop:o},{isAtBottom:u,isScrolling:m,lastJumpDueToItemResize:f,scrollDirection:h},{listState:x},{beforeUnshiftWith:p,gap:y,shiftWithOffset:g,sizes:j},{log:S},{recalcInProgress:N}])=>{const M=jn(ce(x,$e(f),Wn(([,k,T,B],[{bottom:I,items:L,offsetBottom:V,totalCount:w},D])=>{const A=I+V;let O=0;return T===w&&k.length>0&&L.length>0&&(L[0].originalIndex===0&&k[0].originalIndex===0||(O=A-B,O!==0&&(O+=D))),[O,L,w,A]},[0,[],0,0]),Ae(([k])=>k!==0),$e(o,h,i,u,S,N),Ae(([,k,T,B,,,I])=>!I&&!B&&k!==0&&T===Ns),je(([[k],,,,,T])=>(T("Upward scrolling compensation",{amount:k},Bt.DEBUG),k))));function E(k){k>0?(He(r,{behavior:"auto",top:-k}),He(a,0)):(He(a,0),He(r,{behavior:"auto",top:-k}))}return et(ce(M,$e(a,m)),([k,T,B])=>{B&&uj()?He(a,T-k):E(-k)}),et(ce(Lt(Xt(m,!1),a,N),Ae(([k,T,B])=>!k&&!B&&T!==0),je(([k,T])=>T),va(1)),E),Ce(ce(g,je(k=>({top:-k}))),r),et(ce(p,$e(j,y),je(([k,{groupIndices:T,lastSize:B,sizeTree:I},L])=>{function V(G){return G*(B+L)}if(T.length===0)return V(k);let w=0;const D=ks(I,0);let A=0,O=0;for(;A<k;){A++,w+=D;let G=T.length===O+1?1/0:T[O+1]-T[O]-1;A+G>k&&(w-=D,G=k-A+1),A+=G,w+=V(G),O++}return w})),k=>{He(a,k),requestAnimationFrame(()=>{He(r,{top:k}),requestAnimationFrame(()=>{He(a,0),He(N,!1)})})}),{deviation:a}},ht(an,Ms,Sl,Qn,Wa,Cd)),fj=Ze(([a,r,i,o,u,m,f,h,x,p,y])=>({...a,...r,...i,...o,...u,...m,...f,...h,...x,...p,...y}),ht(Rd,rj,Qa,Av,Ev,sj,tj,Ad,Rv,Wa,Tv)),Dv=Ze(([{data:a,defaultItemSize:r,firstItemIndex:i,fixedItemSize:o,fixedGroupSize:u,gap:m,groupIndices:f,heightEstimates:h,itemSize:x,sizeRanges:p,sizes:y,statefulTotalCount:g,totalCount:j,trackItemSizes:S},{initialItemFinalLocationReached:N,initialTopMostItemIndex:M,scrolledToInitialItem:E},k,T,B,I,{scrollToIndex:L},V,{topItemCount:w},{groupCounts:D},A])=>{const{listState:O,minOverscanItemCount:G,topItemsIndexes:q,rangeChanged:te,...X}=I;return Ce(te,A.scrollSeekRangeChanged),Ce(ce(A.windowViewportRect,je(_=>_.visibleHeight)),k.viewportHeight),{data:a,defaultItemHeight:r,firstItemIndex:i,fixedItemHeight:o,fixedGroupHeight:u,gap:m,groupCounts:D,heightEstimates:h,initialItemFinalLocationReached:N,initialTopMostItemIndex:M,scrolledToInitialItem:E,sizeRanges:p,topItemCount:w,topItemsIndexes:q,totalCount:j,...B,groupIndices:f,itemSize:x,listState:O,minOverscanItemCount:G,scrollToIndex:L,statefulTotalCount:g,trackItemSizes:S,rangeChanged:te,...X,...A,...k,sizes:y,...T}},ht(Qn,As,an,ij,lj,Sl,Rs,dj,cj,kv,fj));function pj(a,r){const i={},o={};let u=0;const m=a.length;for(;u<m;)o[a[u]]=1,u+=1;for(const f in r)Object.hasOwn(o,f)||(i[f]=r[f]);return i}const Fi=typeof document<"u"?we.useLayoutEffect:we.useEffect;function zv(a,r,i){const o=Object.keys(r.required||{}),u=Object.keys(r.optional||{}),m=Object.keys(r.methods||{}),f=Object.keys(r.events||{}),h=we.createContext({});function x(E,k){E.propsReady!==void 0&&He(E.propsReady,!1);for(const T of o){const B=E[r.required[T]];He(B,k[T])}for(const T of u)if(T in k){const B=E[r.optional[T]];He(B,k[T])}E.propsReady!==void 0&&He(E.propsReady,!0)}function p(E){return m.reduce((k,T)=>(k[T]=B=>{const I=E[r.methods[T]];He(I,B)},k),{})}function y(E){return f.reduce((k,T)=>(k[T]=R0(E[r.events[T]]),k),{})}const g=we.forwardRef(function(E,k){const{children:T,...B}=E,[I]=we.useState(()=>ho(M0(a),w=>{x(w,B)})),[L]=we.useState(ox(y,I));Fi(()=>{for(const w of f)w in B&&et(L[w],B[w]);return()=>{Object.values(L).map(kd)}},[B,L,I]),Fi(()=>{x(I,B)}),we.useImperativeHandle(k,ix(p(I)));const V=i;return n.jsx(h.Provider,{value:I,children:i!==void 0?n.jsx(V,{...pj([...o,...u,...f],B),children:T}):T})}),j=E=>{const k=we.useContext(h);return we.useCallback(T=>{He(k[E],T)},[k,E])},S=E=>{const k=we.useContext(h)[E],T=we.useCallback(B=>et(k,B),[k]);return we.useSyncExternalStore(T,()=>yt(k),()=>yt(k))},N=E=>{const k=we.useContext(h)[E],[T,B]=we.useState(ox(yt,k));return Fi(()=>et(k,I=>{I!==T&&B(ix(I))}),[k,T]),T},M=parseInt(we.version)>=18?S:N;return{Component:g,useEmitter:(E,k)=>{const T=we.useContext(h)[E];Fi(()=>et(T,k),[k,T])},useEmitterValue:M,usePublisher:j}}const Lv=we.createContext(void 0),_v=we.createContext(void 0),Pu="-webkit-sticky",yx="sticky",Md=Mv(()=>{if(typeof document>"u")return yx;const a=document.createElement("div");return a.style.position=Pu,a.style.position===Pu?Pu:yx}),Ov=typeof document<"u"?we.useLayoutEffect:we.useEffect;function qu(a){return"self"in a}function mj(a){return"body"in a}function Bv(a,r,i,o=vr,u,m){const f=we.useRef(null),h=we.useRef(null),x=we.useRef(null),p=we.useCallback(j=>{let S,N,M;const E=j.target;if(mj(E)||qu(E)){const T=qu(E)?E:E.defaultView;M=m===!0?T.scrollX:T.scrollY,S=m===!0?T.document.documentElement.scrollWidth:T.document.documentElement.scrollHeight,N=m===!0?T.innerWidth:T.innerHeight}else M=m===!0?E.scrollLeft:E.scrollTop,S=m===!0?E.scrollWidth:E.scrollHeight,N=m===!0?E.offsetWidth:E.offsetHeight;const k=()=>{a({scrollHeight:S,scrollTop:Math.max(M,0),viewportHeight:N})};j.suppressFlushSync===!0?k():db.flushSync(k),h.current!==null&&(M===h.current||M<=0||M===S-N)&&(h.current=null,r(!0),x.current&&(clearTimeout(x.current),x.current=null))},[a,r,m]);we.useEffect(()=>{const j=u||f.current;return o(u||f.current),p({suppressFlushSync:!0,target:j}),j.addEventListener("scroll",p,{passive:!0}),()=>{o(null),j.removeEventListener("scroll",p)}},[f,p,i,o,u]);function y(j){const S=f.current;if(!S||(m===!0?"offsetWidth"in S&&S.offsetWidth===0:"offsetHeight"in S&&S.offsetHeight===0))return;const N=j.behavior==="smooth";let M,E,k;qu(S)?(E=Math.max(Fa(S.document.documentElement,m===!0?"width":"height"),m===!0?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight),M=m===!0?S.innerWidth:S.innerHeight,k=m===!0?window.scrollX:window.scrollY):(E=S[m===!0?"scrollWidth":"scrollHeight"],M=Fa(S,m===!0?"width":"height"),k=S[m===!0?"scrollLeft":"scrollTop"]);const T=E-M;if(j.top=Math.ceil(Math.max(Math.min(T,j.top),0)),Cv(M,E)||j.top===k){a({scrollHeight:E,scrollTop:k,viewportHeight:M}),N&&r(!0);return}N?(h.current=j.top,x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{x.current=null,h.current=null,r(!0)},1e3)):h.current=null,m===!0&&(j={...j.behavior!==void 0?{behavior:j.behavior}:{},left:j.top}),S.scrollTo(j)}function g(j){m===!0&&(j={...j.behavior!==void 0?{behavior:j.behavior}:{},...j.top!==void 0?{left:j.top}:{}}),f.current.scrollBy(j)}return{scrollByCallback:g,scrollerRef:f,scrollToCallback:y}}function Dd(a){return a}const hj=Ze(()=>{const a=pe(h=>`Item ${h}`),r=pe(h=>`Group ${h}`),i=pe({}),o=pe(Dd),u=pe("div"),m=pe(vr),f=(h,x=null)=>Xt(ce(i,je(p=>p[h]),mt()),x);return{components:i,computeItemKey:o,EmptyPlaceholder:f("EmptyPlaceholder"),FooterComponent:f("Footer"),GroupComponent:f("Group","div"),groupContent:r,HeaderComponent:f("Header"),HeaderFooterTag:u,ItemComponent:f("Item","div"),itemContent:a,ListComponent:f("List","div"),ScrollerComponent:f("Scroller","div"),scrollerRef:m,ScrollSeekPlaceholder:f("ScrollSeekPlaceholder"),TopItemListComponent:f("TopItemList")}}),xj=Ze(([a,r])=>({...a,...r}),ht(Dv,hj)),vj=({height:a})=>n.jsx("div",{style:{height:a}}),gj={overflowAnchor:"none",position:Md(),zIndex:1},Uv={overflowAnchor:"none"},yj={...Uv,display:"inline-block",height:"100%"},bx=we.memo(function({showTopList:a=!1}){const r=Le("listState"),i=_n("sizeRanges"),o=Le("useWindowScroll"),u=Le("customScrollParent"),m=_n("windowScrollContainerState"),f=_n("scrollContainerState"),h=u||o?m:f,x=Le("itemContent"),p=Le("context"),y=Le("groupContent"),g=Le("trackItemSizes"),j=Le("itemSize"),S=Le("log"),N=_n("gap"),M=Le("horizontalDirection"),{callbackRef:E}=L0(i,j,g,a?vr:h,S,N,u,M,Le("skipAnimationFrameInResizeObserver")),[k,T]=we.useState(0);zd("deviation",X=>{k!==X&&T(X)});const B=Le("EmptyPlaceholder"),I=Le("ScrollSeekPlaceholder")??vj,L=Le("ListComponent"),V=Le("ItemComponent"),w=Le("GroupComponent"),D=Le("computeItemKey"),A=Le("isSeeking"),O=Le("groupIndices").length>0,G=Le("alignToBottom"),q=Le("initialItemFinalLocationReached"),te=a?{}:{boxSizing:"border-box",...M?{display:"inline-block",height:"100%",marginLeft:k!==0?k:G?"auto":0,paddingLeft:r.offsetTop,paddingRight:r.offsetBottom,whiteSpace:"nowrap"}:{marginTop:k!==0?k:G?"auto":0,paddingBottom:r.offsetBottom,paddingTop:r.offsetTop},...q?{}:{visibility:"hidden"}};return!a&&r.totalCount===0&&B!==null&&B!==void 0?n.jsx(B,{...Qt(B,p)}):n.jsx(L,{...Qt(L,p),"data-testid":a?"virtuoso-top-item-list":"virtuoso-item-list",ref:E,style:te,children:(a?r.topItems:r.items).map(X=>{const _=X.originalIndex,R=D(_+r.firstItemIndex,X.data,p);return A?v.createElement(I,{...Qt(I,p),height:X.size,index:X.index,key:R,type:X.type||"item",...X.type==="group"?{}:{groupIndex:X.groupIndex}}):X.type==="group"?v.createElement(w,{...Qt(w,p),"data-index":_,"data-item-index":X.index,"data-known-size":X.size,key:R,style:gj},y(X.index,p)):v.createElement(V,{...Qt(V,p),...kj(V,X.data),"data-index":_,"data-item-group-index":X.groupIndex,"data-item-index":X.index,"data-known-size":X.size,key:R,style:M?yj:Uv},O?x(X.index,X.groupIndex,X.data,p):x(X.index,X.data,p))})})}),bj={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},jj={outline:"none",overflowX:"auto",position:"relative"},vo=a=>({height:"100%",position:"absolute",top:0,width:"100%",...a?{display:"flex",flexDirection:"column"}:void 0}),Sj={position:Md(),top:0,width:"100%",zIndex:1};function Qt(a,r){if(typeof a!="string")return{context:r}}function kj(a,r){return{item:typeof a=="string"?void 0:r}}const wj=we.memo(function(){const a=Le("HeaderComponent"),r=_n("headerHeight"),i=Le("HeaderFooterTag"),o=jl(we.useMemo(()=>m=>{r(Fa(m,"height"))},[r]),!0,Le("skipAnimationFrameInResizeObserver")),u=Le("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,u)})}):null}),Cj=we.memo(function(){const a=Le("FooterComponent"),r=_n("footerHeight"),i=Le("HeaderFooterTag"),o=jl(we.useMemo(()=>m=>{r(Fa(m,"height"))},[r]),!0,Le("skipAnimationFrameInResizeObserver")),u=Le("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,u)})}):null});function Hv({useEmitter:a,useEmitterValue:r,usePublisher:i}){return we.memo(function({children:o,style:u,context:m,...f}){const h=i("scrollContainerState"),x=r("ScrollerComponent"),p=i("smoothScrollTargetReached"),y=r("scrollerRef"),g=r("horizontalDirection")||!1,{scrollByCallback:j,scrollerRef:S,scrollToCallback:N}=Bv(h,p,x,y,void 0,g);return a("scrollTo",N),a("scrollBy",j),n.jsx(x,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:S,style:{...g?jj:bj,...u},tabIndex:0,...f,...Qt(x,m),children:o})})}function Iv({useEmitter:a,useEmitterValue:r,usePublisher:i}){return we.memo(function({children:o,style:u,context:m,...f}){const h=i("windowScrollContainerState"),x=r("ScrollerComponent"),p=i("smoothScrollTargetReached"),y=r("totalListHeight"),g=r("deviation"),j=r("customScrollParent"),S=we.useRef(null),N=r("scrollerRef"),{scrollByCallback:M,scrollerRef:E,scrollToCallback:k}=Bv(h,p,x,N,j);return Ov(()=>{var T;return E.current=j||((T=S.current)==null?void 0:T.ownerDocument.defaultView),()=>{E.current=null}},[E,j]),a("windowScrollTo",k),a("scrollBy",M),n.jsx(x,{ref:S,"data-virtuoso-scroller":!0,style:{position:"relative",...u,...y!==0?{height:y+g}:void 0},...f,...Qt(x,m),children:o})})}const Nj=({children:a})=>{const r=we.useContext(Lv),i=_n("viewportHeight"),o=_n("fixedItemHeight"),u=Le("alignToBottom"),m=Le("horizontalDirection"),f=we.useMemo(()=>dv(i,x=>Fa(x,m?"width":"height")),[i,m]),h=jl(f,!0,Le("skipAnimationFrameInResizeObserver"));return we.useEffect(()=>{r&&(i(r.viewportHeight),o(r.itemHeight))},[r,i,o]),n.jsx("div",{"data-viewport-type":"element",ref:h,style:vo(u),children:a})},Ej=({children:a})=>{const r=we.useContext(Lv),i=_n("windowViewportRect"),o=_n("fixedItemHeight"),u=Le("customScrollParent"),m=pv(i,u,Le("skipAnimationFrameInResizeObserver")),f=Le("alignToBottom");return we.useEffect(()=>{r&&(o(r.itemHeight),i({listHeight:0,offsetTop:0,visibleHeight:r.viewportHeight,visibleWidth:100}))},[r,i,o]),n.jsx("div",{"data-viewport-type":"window",ref:m,style:vo(f),children:a})},Tj=({children:a})=>{const r=Le("TopItemListComponent")??"div",i=Le("headerHeight"),o={...Sj,marginTop:`${i}px`},u=Le("context");return n.jsx(r,{style:o,...Qt(r,u),children:a})},Rj=we.memo(function(a){const r=Le("useWindowScroll"),i=Le("topItemsIndexes").length>0,o=Le("customScrollParent"),u=Le("context");return n.jsxs(o||r?Dj:Mj,{...a,context:u,children:[i&&n.jsx(Tj,{children:n.jsx(bx,{showTopList:!0})}),n.jsxs(o||r?Ej:Nj,{children:[n.jsx(wj,{}),n.jsx(bx,{}),n.jsx(Cj,{})]})]})}),{Component:Aj,useEmitter:zd,useEmitterValue:Le,usePublisher:_n}=zv(xj,{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"}},Rj),Mj=Hv({useEmitter:zd,useEmitterValue:Le,usePublisher:_n}),Dj=Iv({useEmitter:zd,useEmitterValue:Le,usePublisher:_n}),zj=Aj,Lj=Ze(()=>{const a=pe(p=>n.jsxs("td",{children:["Item $",p]})),r=pe(null),i=pe(p=>n.jsxs("td",{colSpan:1e3,children:["Group ",p]})),o=pe(null),u=pe(null),m=pe({}),f=pe(Dd),h=pe(vr),x=(p,y=null)=>Xt(ce(m,je(g=>g[p]),mt()),y);return{components:m,computeItemKey:f,context:r,EmptyPlaceholder:x("EmptyPlaceholder"),FillerRow:x("FillerRow"),fixedFooterContent:u,fixedHeaderContent:o,itemContent:a,groupContent:i,ScrollerComponent:x("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:x("ScrollSeekPlaceholder"),TableBodyComponent:x("TableBody","tbody"),TableComponent:x("Table","table"),TableFooterComponent:x("TableFoot","tfoot"),TableHeadComponent:x("TableHead","thead"),TableRowComponent:x("TableRow","tr"),GroupComponent:x("Group","tr")}});ht(Dv,Lj);Md();const jx={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},_j={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Sx,floor:io,max:bs,min:Yu,round:kx}=Math;function wx(a,r,i){return Array.from({length:r-a+1}).map((o,u)=>({data:i===null?null:i[u+a],index:u+a}))}function Oj(a){return{..._j,items:a}}function Ki(a,r){return a!==void 0&&a.width===r.width&&a.height===r.height}function Bj(a,r){return a!==void 0&&a.column===r.column&&a.row===r.row}const Uj=Ze(([{increaseViewportBy:a,listBoundary:r,overscan:i,visibleRange:o},{footerHeight:u,headerHeight:m,scrollBy:f,scrollContainerState:h,scrollTo:x,scrollTop:p,smoothScrollTargetReached:y,viewportHeight:g},j,S,{didMount:N,propsReady:M},{customScrollParent:E,useWindowScroll:k,windowScrollContainerState:T,windowScrollTo:B,windowViewportRect:I},L])=>{const V=pe(0),w=pe(0),D=pe(jx),A=pe({height:0,width:0}),O=pe({height:0,width:0}),G=We(),q=We(),te=pe(0),X=pe(null),_=pe({column:0,row:0}),R=We(),U=We(),se=pe(!1),Y=pe(0),me=pe(!0),z=pe(!1),W=pe(!1);et(ce(N,$e(Y),Ae(([ae,ve])=>ve!==0)),()=>{He(me,!1)}),et(ce(Lt(N,me,O,A,Y,z),Ae(([ae,ve,Ie,Be,,ne])=>ae&&!ve&&Ie.height!==0&&Be.height!==0&&!ne)),([,,,,ae])=>{He(z,!0),Ed(1,()=>{He(G,ae)}),$n(ce(p),()=>{He(r,[0,0]),He(me,!0)})}),Ce(ce(U,Ae(ae=>ae!=null&&ae.scrollTop>0),Kn(0)),w),et(ce(N,$e(U),Ae(([,ae])=>ae!=null)),([,ae])=>{ae&&(He(A,ae.viewport),He(O,ae.item),He(_,ae.gap),ae.scrollTop>0&&(He(se,!0),$n(ce(p,yl(1)),ve=>{He(se,!1)}),He(x,{top:ae.scrollTop})))}),Ce(ce(A,je(({height:ae})=>ae)),g),Ce(ce(Lt(Re(A,Ki),Re(O,Ki),Re(_,(ae,ve)=>ae!==void 0&&ae.column===ve.column&&ae.row===ve.row),Re(p)),je(([ae,ve,Ie,Be])=>({gap:Ie,item:ve,scrollTop:Be,viewport:ae}))),R),Ce(ce(Lt(Re(V),o,Re(_,Bj),Re(O,Ki),Re(A,Ki),Re(X),Re(w),Re(se),Re(me),Re(Y)),Ae(([,,,,,,,ae])=>!ae),je(([ae,[ve,Ie],Be,ne,fe,ue,he,,be,_e])=>{const{column:Me,row:dt}=Be,{height:Zt,width:ct}=ne,{width:Vt}=fe;if(he===0&&(ae===0||Vt===0))return jx;if(ct===0){const nt=Td(_e,ae),Xa=nt+Math.max(he-1,0);return Oj(wx(nt,Xa,ue))}const $t=Vv(Vt,ct,Me);let tt,jt;be?ve===0&&Ie===0&&he>0?(tt=0,jt=he-1):(tt=$t*io((ve+dt)/(Zt+dt)),jt=$t*Sx((Ie+dt)/(Zt+dt))-1,jt=Yu(ae-1,bs(jt,$t-1)),tt=Yu(jt,bs(0,tt))):(tt=0,jt=-1);const ye=wx(tt,jt,ue),{bottom:Rt,top:De}=Cx(fe,Be,ne,ye),xt=Sx(ae/$t),Kt=xt*Zt+(xt-1)*dt-Rt;return{bottom:Rt,itemHeight:Zt,items:ye,itemWidth:ct,offsetBottom:Kt,offsetTop:De,top:De}})),D),Ce(ce(X,Ae(ae=>ae!==null),je(ae=>ae.length)),V),Ce(ce(Lt(A,O,D,_),Ae(([ae,ve,{items:Ie}])=>Ie.length>0&&ve.height!==0&&ae.height!==0),je(([ae,ve,{items:Ie},Be])=>{const{bottom:ne,top:fe}=Cx(ae,Be,ve,Ie);return[fe,ne]}),mt(ws)),r);const ie=pe(!1);Ce(ce(p,$e(ie),je(([ae,ve])=>ve||ae!==0)),ie);const de=jn(ce(Lt(D,V),Ae(([{items:ae}])=>ae.length>0),$e(ie),Ae(([[ae,ve],Ie])=>{const Be=ae.items[ae.items.length-1].index===ve-1;return(Ie||ae.bottom>0&&ae.itemHeight>0&&ae.offsetBottom===0&&ae.items.length===ve)&&Be}),je(([[,ae]])=>ae-1),mt())),ge=jn(ce(Re(D),Ae(({items:ae})=>ae.length>0&&ae[0].index===0),Kn(0),mt())),xe=jn(ce(Re(D),$e(se),Ae(([{items:ae},ve])=>ae.length>0&&!ve),je(([{items:ae}])=>({endIndex:ae[ae.length-1].index,startIndex:ae[0].index})),mt(yv),va(0)));Ce(xe,S.scrollSeekRangeChanged),Ce(ce(G,$e(A,O,V,_),je(([ae,ve,Ie,Be,ne])=>{const fe=wv(ae),{align:ue,behavior:he,offset:be}=fe;let _e=fe.index;_e==="LAST"&&(_e=Be-1),_e=bs(0,_e,Yu(Be-1,_e));let Me=pd(ve,ne,Ie,_e);return ue==="end"?Me=kx(Me-ve.height+Ie.height):ue==="center"&&(Me=kx(Me-ve.height/2+Ie.height/2)),be!==void 0&&be!==0&&(Me+=be),{behavior:he,top:Me}})),x);const oe=Xt(ce(D,je(ae=>ae.offsetBottom+ae.bottom)),0);return Ce(ce(I,je(ae=>({height:ae.visibleHeight,width:ae.visibleWidth}))),A),{customScrollParent:E,data:X,deviation:te,footerHeight:u,gap:_,headerHeight:m,increaseViewportBy:a,initialItemCount:w,itemDimensions:O,overscan:i,restoreStateFrom:U,scrollBy:f,scrollContainerState:h,scrollHeight:q,scrollTo:x,scrollToIndex:G,scrollTop:p,smoothScrollTargetReached:y,totalCount:V,useWindowScroll:k,viewportDimensions:A,windowScrollContainerState:T,windowScrollTo:B,windowViewportRect:I,...S,gridState:D,horizontalDirection:W,initialTopMostItemIndex:Y,totalListHeight:oe,...j,endReached:de,propsReady:M,rangeChanged:xe,startReached:ge,stateChanged:R,stateRestoreInProgress:se,...L}},ht(Rd,an,Ms,Av,Qa,Ad,Wa));function Vv(a,r,i){return bs(1,io((a+i)/(io(r)+i)))}function Cx(a,r,i,o){const{height:u}=i;if(u===void 0||o.length===0)return{bottom:0,top:0};const m=pd(a,r,i,o[0].index);return{bottom:pd(a,r,i,o[o.length-1].index)+u,top:m}}function pd(a,r,i,o){const u=Vv(a.width,i.width,r.column),m=io(o/u),f=m*i.height+bs(0,m-1)*r.row;return f>0?f+r.row:f}const Hj=Ze(()=>{const a=pe(g=>`Item ${g}`),r=pe({}),i=pe(null),o=pe("virtuoso-grid-item"),u=pe("virtuoso-grid-list"),m=pe(Dd),f=pe("div"),h=pe(vr),x=(g,j=null)=>Xt(ce(r,je(S=>S[g]),mt()),j),p=pe(!1),y=pe(!1);return Ce(Re(y),p),{components:r,computeItemKey:m,context:i,FooterComponent:x("Footer"),HeaderComponent:x("Header"),headerFooterTag:f,itemClassName:o,ItemComponent:x("Item","div"),itemContent:a,listClassName:u,ListComponent:x("List","div"),readyStateChanged:p,reportReadyState:y,ScrollerComponent:x("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:x("ScrollSeekPlaceholder","div")}}),Ij=Ze(([a,r])=>({...a,...r}),ht(Uj,Hj)),Vj=we.memo(function(){const a=gt("gridState"),r=gt("listClassName"),i=gt("itemClassName"),o=gt("itemContent"),u=gt("computeItemKey"),m=gt("isSeeking"),f=On("scrollHeight"),h=gt("ItemComponent"),x=gt("ListComponent"),p=gt("ScrollSeekPlaceholder"),y=gt("context"),g=On("itemDimensions"),j=On("gap"),S=gt("log"),N=gt("stateRestoreInProgress"),M=On("reportReadyState"),E=jl(we.useMemo(()=>k=>{const T=k.parentElement.parentElement.scrollHeight;f(T);const B=k.firstChild;if(B!==null){const{height:I,width:L}=B.getBoundingClientRect();g({height:I,width:L})}j({column:Nx("column-gap",getComputedStyle(k).columnGap,S),row:Nx("row-gap",getComputedStyle(k).rowGap,S)})},[f,g,j,S]),!0,!1);return Ov(()=>{a.itemHeight>0&&a.itemWidth>0&&M(!0)},[a]),N?null:n.jsx(x,{className:r,ref:E,...Qt(x,y),"data-testid":"virtuoso-item-list",style:{paddingBottom:a.offsetBottom,paddingTop:a.offsetTop},children:a.items.map(k=>{const T=u(k.index,k.data,y);return m?n.jsx(p,{...Qt(p,y),height:a.itemHeight,index:k.index,width:a.itemWidth},T):v.createElement(h,{...Qt(h,y),className:i,"data-index":k.index,key:T},o(k.index,k.data,y))})})}),$j=we.memo(function(){const a=gt("HeaderComponent"),r=On("headerHeight"),i=gt("headerFooterTag"),o=jl(we.useMemo(()=>m=>{r(Fa(m,"height"))},[r]),!0,!1),u=gt("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,u)})}):null}),Gj=we.memo(function(){const a=gt("FooterComponent"),r=On("footerHeight"),i=gt("headerFooterTag"),o=jl(we.useMemo(()=>m=>{r(Fa(m,"height"))},[r]),!0,!1),u=gt("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,u)})}):null}),Pj=({children:a})=>{const r=we.useContext(_v),i=On("itemDimensions"),o=On("viewportDimensions"),u=jl(we.useMemo(()=>m=>{o(m.getBoundingClientRect())},[o]),!0,!1);return we.useEffect(()=>{r&&(o({height:r.viewportHeight,width:r.viewportWidth}),i({height:r.itemHeight,width:r.itemWidth}))},[r,o,i]),n.jsx("div",{ref:u,style:vo(!1),children:a})},qj=({children:a})=>{const r=we.useContext(_v),i=On("windowViewportRect"),o=On("itemDimensions"),u=gt("customScrollParent"),m=pv(i,u,!1);return we.useEffect(()=>{r&&(o({height:r.itemHeight,width:r.itemWidth}),i({listHeight:0,offsetTop:0,visibleHeight:r.viewportHeight,visibleWidth:r.viewportWidth}))},[r,i,o]),n.jsx("div",{ref:m,style:vo(!1),children:a})},Yj=we.memo(function({...a}){const r=gt("useWindowScroll"),i=gt("customScrollParent"),o=i||r?Kj:Fj,u=i||r?qj:Pj,m=gt("context");return n.jsx(o,{...a,...Qt(o,m),children:n.jsxs(u,{children:[n.jsx($j,{}),n.jsx(Vj,{}),n.jsx(Gj,{})]})})}),{useEmitter:$v,useEmitterValue:gt,usePublisher:On}=zv(Ij,{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"}},Yj),Fj=Hv({useEmitter:$v,useEmitterValue:gt,usePublisher:On}),Kj=Iv({useEmitter:$v,useEmitterValue:gt,usePublisher:On});function Nx(a,r,i){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&i(`${a} was not resolved to pixel value correctly`,r,Bt.WARN),r==="normal"?0:parseInt(r??"0",10)}const Wj={source:"vskill-sidebar-own-collapsed",installed:"vskill-sidebar-installed-collapsed"},Gv={source:"Own",installed:"Installed"};function Qj(a){try{const r=localStorage.getItem(a);if(r!=null)return r==="true"}catch{}try{if(typeof sessionStorage<"u"){const r=sessionStorage.getItem(a);if(r!=null)return r==="true"}}catch{}return!1}function Xj(a,r){const i=r?"true":"false";try{localStorage.setItem(a,i)}catch{}try{typeof sessionStorage<"u"&&sessionStorage.setItem(a,i)}catch{}}function Ex({origin:a,count:r,filteredCount:i,updateCount:o,children:u}){const m=Wj[a],[f,h]=v.useState(()=>Qj(m)),x=v.useCallback(()=>{h(j=>{const S=!j;return Xj(m,S),S})},[m]),p=Gv[a],y=`sidebar-section-${a}-header`,g=`sidebar-section-${a}-group`;return n.jsxs("section",{"aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:[n.jsxs("button",{id:y,type:"button","data-testid":"sidebar-section-header","aria-expanded":!f,"aria-controls":g,onClick:x,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 12px 6px 14px",background:"transparent",border:"none",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",textAlign:"left"},children:[n.jsx(Jj,{collapsed:f}),n.jsx("h2",{"aria-level":2,style:{fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)",margin:0},children:p}),n.jsx("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:i!=null&&i!==r?`(${i} of ${r})`:`(${r})`}),o!=null&&o>0&&n.jsx(Zj,{origin:a,updateCount:o})]}),!f&&n.jsx("div",{id:g,role:"group","aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:u})]})}function Zj({origin:a,updateCount:r}){const[i,o]=v.useState(!1),u=Gv[a].toLowerCase(),m=`${r} updates available in ${u} section, view all`;return n.jsxs("span",{role:"link",tabIndex:0,"data-testid":"sidebar-section-update-chip","aria-label":m,onClick:f=>{f.stopPropagation(),window.location.hash="#/updates"},onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),f.stopPropagation(),window.location.hash="#/updates")},onFocus:()=>o(!0),onBlur:()=>o(!1),style:{display:"inline-flex",alignItems:"center",gap:2,fontSize:10,color:"var(--color-own)",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",cursor:"pointer",padding:"0 4px",borderRadius:3,outline:i?"2px solid var(--border-focus)":"none",outlineOffset:2},children:[r," updates",n.jsx("span",{"aria-hidden":"true",style:{fontSize:9,marginLeft:2},children:"▾"})]})}function Jj({collapsed:a}){return n.jsx("svg",{"aria-hidden":"true",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:a?"rotate(0deg)":"rotate(90deg)",transition:"transform var(--duration-fast, 120ms) var(--ease-standard, ease)",flexShrink:0},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Ld(a,r){const i=r.trim().toLowerCase();return i?a.skill.toLowerCase().includes(i)||a.plugin.toLowerCase().includes(i)||a.dir.toLowerCase().includes(i):!0}function e2({value:a,onChange:r,placeholder:i="Filter skills…",validationPattern:o,validationMessage:u="Invalid filter expression"}){const m=v.useRef(null),f=v.useId(),h=!!o&&a.trim()!==""&&!o.test(a);return v.useEffect(()=>{function x(p){var j;if(p.key!=="/")return;const y=p.target;if(!y)return;const g=y.tagName;g==="INPUT"||g==="TEXTAREA"||y.isContentEditable||(p.preventDefault(),(j=m.current)==null||j.focus())}return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[]),n.jsxs("div",{role:"search",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",borderBottom:"1px solid var(--border-default)"},children:[n.jsxs("svg",{"aria-hidden":"true",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[n.jsx("circle",{cx:"11",cy:"11",r:"8"}),n.jsx("path",{d:"M21 21l-4.35-4.35"})]}),n.jsx("input",{ref:m,type:"search","aria-label":"Filter skills","aria-invalid":h?!0:void 0,"aria-describedby":h?f:void 0,value:a,placeholder:i,onChange:x=>r(x.currentTarget.value),onKeyDown:x=>{x.key==="Escape"&&(r(""),x.currentTarget.blur())},style:{flex:1,minWidth:0,border:"none",outline:"none",background:"transparent",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:12,padding:"2px 0"}}),h&&n.jsx("span",{id:f,role:"alert","aria-live":"polite",style:{fontFamily:"var(--font-sans)",fontSize:10,color:"var(--text-error, #B42318)",marginLeft:4,whiteSpace:"nowrap"},children:u}),n.jsx("kbd",{"aria-hidden":"true",style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",border:"1px solid var(--border-default)",padding:"1px 5px",borderRadius:3,display:a?"none":"inline-block"},children:"/"})]})}function t2({target:a}){const r=typeof a=="string"&&a.length>0,i=r?`symlinked → ${a}`:"symlinked — cycle detected or target unresolved",o=r?`symlinked from ${a}`:"symlinked, target unresolved";return n.jsx("span",{"data-testid":"symlink-chip",role:"img","aria-label":o,title:i,tabIndex:0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:14,height:14,borderRadius:3,color:"var(--text-secondary)",flexShrink:0},children:n.jsxs("svg",{"data-testid":"symlink-glyph",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),n.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})})}function n2({skill:a}){if(!a.updateAvailable)return null;const r=a.currentVersion??"",i=a.latestVersion,o=i?`Update available: ${r} → ${i}`.trim():"Update available";return n.jsx("span",{"data-testid":"skill-row-update-glyph",title:o,"aria-label":"Update available",style:{color:"var(--color-own)",display:"inline-flex",flexShrink:0},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 19V5"}),n.jsx("path",{d:"M5 12l7-7 7 7"})]})})}function a2({skill:a,isSelected:r,onSelect:i,onContextMenu:o}){const u=a.origin==="installed"?"var(--status-installed)":"var(--status-own)";return n.jsxs("button",{type:"button",onClick:i,onContextMenu:o?m=>{m.preventDefault(),o(m,a)}:void 0,"aria-current":r?"true":void 0,"aria-selected":!!r,"data-testid":"skill-row","data-selected":r,"data-origin":a.origin,style:{display:"flex",alignItems:"center",gap:8,width:"100%",height:36,padding:"0 12px 0 14px",background:r?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",boxShadow:r?"inset 2px 0 0 var(--color-accent, var(--accent-surface))":"none",border:"none",borderRadius:0,color:"var(--text-primary)",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:13,textAlign:"left",transition:"background-color var(--duration-fast, 120ms) var(--ease-standard, ease), box-shadow var(--duration-base, 180ms) var(--ease-standard, ease)"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),n.jsx("span",{title:a.skill,style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.skill}),a.version&&n.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",flexShrink:0},children:a.version}),a.isSymlink&&n.jsx(t2,{target:a.symlinkTarget??null}),n.jsx(n2,{skill:a})]})}const oo=v.memo(a2);function l2({plugin:a,skills:r,selectedKey:i,onSelect:o,onContextMenu:u}){const m=[...r].sort((f,h)=>f.skill.localeCompare(h.skill));return n.jsxs("div",{role:"group","aria-label":`${a} (${r.length})`,children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:a,children:a}),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",r.length,")"]})]}),n.jsx("div",{role:"list",children:m.map(f=>{const h=!!i&&i.plugin===f.plugin&&i.skill===f.skill;return n.jsx("div",{role:"listitem",children:n.jsx(oo,{skill:f,isSelected:h,onSelect:()=>o(f),onContextMenu:u})},`${f.plugin}/${f.skill}`)})})]})}function r2(a,r){if(!a||typeof window>"u")return r;try{const i=window.localStorage.getItem(a);return i===null?r:i==="true"}catch{return r}}function Tx({skills:a,pluginName:r,initialCollapsed:i=!1,persistKey:o,renderSkill:u}){var y;const m=r??((y=a[0])==null?void 0:y.pluginName)??"unknown-plugin",[f,h]=v.useState(()=>r2(o,i)),x=v.useCallback(()=>{h(g=>{const j=!g;if(o&&typeof window<"u")try{window.localStorage.setItem(o,String(j))}catch{}return j})},[o]),p=f?"▸":"▾";return n.jsxs("div",{"data-vskill-plugin-tree":m,role:"group","aria-label":`${m} (${a.length})`,children:[n.jsxs("button",{type:"button",onClick:x,"aria-expanded":!f,className:"flex items-center gap-1 w-full px-2 py-1 text-xs text-muted-foreground hover:text-foreground",children:[n.jsx("span",{"aria-hidden":!0,className:"vskill-chevron tabular-nums w-3 text-center",children:p}),n.jsx("span",{className:"vskill-plugin-name font-mono",children:m}),n.jsxs("span",{className:"vskill-plugin-count tabular-nums ml-auto",children:["(",a.length,")"]})]}),!f&&n.jsx("div",{className:"vskill-plugin-tree-children pl-4",children:a.map(g=>n.jsx("div",{"data-vskill-plugin-skill":g.pluginNamespace??g.skill,children:u(g)},`${g.pluginNamespace??g.skill}`))})]})}function Rx({name:a,count:r,className:i}){const o=["flex items-center gap-1 px-2 py-1 text-xs uppercase tracking-wide font-medium text-muted-foreground select-none",i??""].join(" ").trim();return n.jsxs("div",{"data-vskill-group-header":a,className:o,role:"heading","aria-level":3,children:[n.jsx("span",{className:"vskill-group-header-name",children:a}),n.jsxs("span",{className:"vskill-group-header-count tabular-nums",children:["(",r,")"]})]})}function s2(){return n.jsxs("div",{"aria-hidden":"true",role:"presentation",style:{display:"flex",alignItems:"center",gap:8,height:36,padding:"0 12px 0 14px"},children:[n.jsx("span",{className:"placeholder",style:{width:6,height:6,borderRadius:"50%",flexShrink:0}}),n.jsx("span",{className:"placeholder",style:{height:10,flex:1,borderRadius:3,maxWidth:180}})]})}function i2(a){const r=a.key.split("+").map(h=>h.trim()).filter(Boolean);let i=!!a.meta,o=!!a.ctrl,u=!!a.shift,m=!!a.alt,f=a.key;if(r.length>1){for(const h of r.slice(0,-1)){const x=h.toLowerCase();x==="cmd"||x==="meta"||x==="⌘"?i=!0:x==="ctrl"||x==="control"?o=!0:x==="shift"?u=!0:(x==="alt"||x==="option")&&(m=!0)}f=r[r.length-1]}return{key:f.length===1?f.toLowerCase():f,meta:i,ctrl:o,shift:u,alt:m,allowInInputs:!!a.allowInInputs,handler:a.handler}}function o2(a){if(!a||!(a instanceof HTMLElement))return!1;const r=a.tagName;if(r==="INPUT"||r==="TEXTAREA"||a.isContentEditable)return!0;const i=a.getAttribute("contenteditable");return i!=null&&i!=="false"||a.getAttribute("role")==="textbox"}function c2(a,r){const i=!!a.metaKey,o=!!a.ctrlKey,u=!!a.shiftKey,m=!!a.altKey;return i!==r.meta||o!==r.ctrl||u!==r.shift||m!==r.alt?!1:(a.key.length===1?a.key.toLowerCase():a.key)===r.key}function md(a,r={}){const{enabled:i=!0,target:o}=r,u=v.useRef([]),m=Array.isArray(a)?a:[a];u.current=m.map(i2),v.useEffect(()=>{if(!i)return;const f=o??(typeof window<"u"?window:void 0);if(!f)return;function h(x){const p=x,y=o2(p.target);for(const g of u.current){if(!c2(p,g))continue;const j=g.meta||g.ctrl||g.alt;if(!(y&&!g.allowInInputs&&!j)){g.handler(p);return}}}return f.addEventListener("keydown",h),()=>{f.removeEventListener("keydown",h)}},[i,o])}const u2=200;function d2(a){return a.scope==="own"||a.scope==="installed"||a.scope==="global"?a.scope:a.origin==="installed"?"installed":"own"}function f2(a,r){const i={availableProject:[],availablePersonal:[],availablePlugin:[],authoringProject:[],authoringPlugin:[]};for(const u of a){const m=u.scopeV2??(u.scope==="installed"?"available-project":u.scope==="global"?"available-personal":"authoring-project");m==="available-project"?i.availableProject.push(u):m==="available-personal"?i.availablePersonal.push(u):m==="available-plugin"?i.availablePlugin.push(u):m==="authoring-plugin"?i.authoringPlugin.push(u):i.authoringProject.push(u)}function o(u){const m=u.filter(x=>Ld(x,r)),f={};for(const x of m){const p=x.pluginName??x.plugin;(f[p]||(f[p]=[])).push(x)}const h=Object.entries(f).sort((x,p)=>x[0].localeCompare(p[0]));return{total:u.length,filtered:m.length,byPlugin:h}}return{availableProject:o(i.availableProject),availablePersonal:o(i.availablePersonal),availablePlugin:o(i.availablePlugin),authoringProject:o(i.authoringProject),authoringPlugin:o(i.authoringPlugin)}}function p2(a,r){const i=[],o=[],u=[];for(const f of a){const h=d2(f);h==="global"?u.push(f):h==="installed"?o.push(f):i.push(f)}function m(f){var y;const h=f.filter(g=>Ld(g,r)),x={};for(const g of h)(x[y=g.plugin]||(x[y]=[])).push(g);const p=Object.entries(x).sort((g,j)=>g[0].localeCompare(j[0]));return{total:f.length,filtered:h.length,byPlugin:p}}return{own:m(i),installed:m(o),global:m(u)}}function m2(a,r){const i=[],o=[];for(const m of a)(m.origin==="installed"?o:i).push(m);function u(m){var p;const f=m.filter(y=>Ld(y,r)),h={};for(const y of f)(h[p=y.plugin]||(h[p]=[])).push(y);const x=Object.entries(h).sort((y,g)=>y[0].localeCompare(g[0]));return{total:m.length,filtered:f.length,byPlugin:x}}return{own:u(i),installed:u(o)}}function h2({skills:a,selectedKey:r,onSelect:i,isLoading:o,error:u,onRetry:m,onContextMenu:f,outdatedByOrigin:h,activeAgentId:x,outdatedByScope:p,topSlot:y}){const g=!!x||a.some(O=>O.scope!==void 0&&O.scope!==null),j=x??"claude-cli",[S,N]=v.useState(""),M=v.useDeferredValue(S),E=v.useMemo(()=>p2(a,M),[a,M]),k=v.useMemo(()=>f2(a,M),[a,M]),T=j==="claude-code",{own:B,installed:I}=v.useMemo(()=>m2(a,M),[a,M]),V=E.own.filtered+E.installed.filtered+E.global.filtered>=u2,w=v.useMemo(()=>{const O=G=>{const q=[];for(const[,te]of G){const X=[...te].sort((_,R)=>_.skill.localeCompare(R.skill));q.push(...X)}return q};return g?[...O(E.own.byPlugin),...O(E.installed.byPlugin),...O(E.global.byPlugin)]:[...O(B.byPlugin),...O(I.byPlugin)]},[g,E.own.byPlugin,E.installed.byPlugin,E.global.byPlugin,B.byPlugin,I.byPlugin]),D=v.useMemo(()=>r?w.findIndex(O=>O.plugin===r.plugin&&O.skill===r.skill):-1,[w,r]),A=v.useCallback(O=>{if(w.length===0)return;const G=D<0?O>0?0:w.length-1:Math.min(Math.max(D+O,0),w.length-1);i(w[G])},[w,D,i]);return md([{key:"j",handler:()=>A(1)},{key:"k",handler:()=>A(-1)},{key:"Enter",handler:()=>{D>=0&&i(w[D])}}],{enabled:!o&&!u}),n.jsxs("div",{"data-testid":"sidebar",style:{display:"flex",flexDirection:"column",minHeight:0,height:"100%",fontFamily:"var(--font-sans)"},children:[y,n.jsx(e2,{value:S,onChange:N}),o&&n.jsx(j2,{}),!o&&u&&n.jsx(S2,{error:u,onRetry:m}),!o&&!u&&g&&n.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[n.jsx(Rx,{name:Z.scopeLabels.groupAvailable.toUpperCase(),count:k.availableProject.total+k.availablePersonal.total+k.availablePlugin.total}),n.jsx(ps,{label:Z.scopeLabels.sourceProject,storageKey:`vskill-sidebar-${j}-available-project-collapsed`,count:k.availableProject.total,filteredCount:S?k.availableProject.filtered:null,updateCount:(p==null?void 0:p.installed)??(h==null?void 0:h.installed),children:k.availableProject.filtered===0?n.jsx(Mx,{queryActive:!!S,agentId:j}):n.jsx(ms,{items:k.availableProject.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:V})}),n.jsx(ps,{label:Z.scopeLabels.sourcePersonal,storageKey:`vskill-sidebar-${j}-available-personal-collapsed`,count:k.availablePersonal.total,filteredCount:S?k.availablePersonal.filtered:null,updateCount:p==null?void 0:p.global,children:k.availablePersonal.filtered===0?n.jsx(g2,{queryActive:!!S,agentId:j}):n.jsx(ms,{items:k.availablePersonal.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:V})}),T&&n.jsx(ps,{label:Z.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${j}-available-plugin-collapsed`,count:k.availablePlugin.total,filteredCount:S?k.availablePlugin.filtered:null,children:k.availablePlugin.filtered===0?n.jsxs("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:["No plugin skills installed — run ",n.jsx("code",{children:"/plugin install"})," in Claude Code."]}):k.availablePlugin.byPlugin.map(([O,G])=>n.jsx(Tx,{pluginName:O,skills:G,persistKey:`vskill-plugin-available-${O}-collapsed`,renderSkill:q=>n.jsx(oo,{skill:q,isSelected:(r==null?void 0:r.plugin)===q.plugin&&(r==null?void 0:r.skill)===q.skill,onSelect:()=>i(q),onContextMenu:f})},`available-${O}`))}),n.jsx(b2,{}),n.jsx(Rx,{name:Z.scopeLabels.groupAuthoring.toUpperCase(),count:k.authoringProject.total+k.authoringPlugin.total}),n.jsx(ps,{label:Z.scopeLabels.authoringSkills,storageKey:`vskill-sidebar-${j}-authoring-project-collapsed`,count:k.authoringProject.total,filteredCount:S?k.authoringProject.filtered:null,updateCount:(p==null?void 0:p.own)??(h==null?void 0:h.source),children:k.authoringProject.filtered===0?n.jsx(Ax,{queryActive:!!S}):n.jsx(ms,{items:k.authoringProject.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:V})}),T&&n.jsx(ps,{label:Z.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${j}-authoring-plugin-collapsed`,count:k.authoringPlugin.total,filteredCount:S?k.authoringPlugin.filtered:null,children:k.authoringPlugin.filtered===0?n.jsxs("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:["No plugin sources in this project. Add ",n.jsx("code",{children:"<plugin>/.claude-plugin/plugin.json"}),"."]}):k.authoringPlugin.byPlugin.map(([O,G])=>n.jsx(Tx,{pluginName:O,skills:G,persistKey:`vskill-plugin-authoring-${O}-collapsed`,renderSkill:q=>n.jsx(oo,{skill:q,isSelected:(r==null?void 0:r.plugin)===q.plugin&&(r==null?void 0:r.skill)===q.skill,onSelect:()=>i(q),onContextMenu:f})},`authoring-${O}`))})]}),!o&&!u&&!g&&n.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[n.jsx(Ex,{origin:"source",count:B.total,filteredCount:S?B.filtered:null,updateCount:h==null?void 0:h.source,children:B.filtered===0?n.jsx(Ax,{queryActive:!!S}):n.jsx(ms,{items:B.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:V})}),n.jsx(y2,{}),n.jsx(Ex,{origin:"installed",count:I.total,filteredCount:S?I.filtered:null,updateCount:h==null?void 0:h.installed,children:I.filtered===0?n.jsx(Mx,{queryActive:!!S}):n.jsx(ms,{items:I.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:V})})]})]})}function x2(a){if(typeof window>"u")return!1;try{return window.localStorage.getItem(a)==="true"}catch{return!1}}function ps({label:a,storageKey:r,count:i,filteredCount:o,updateCount:u,children:m}){const[f,h]=v.useState(()=>x2(r)),x=v.useCallback(()=>{h(y=>{const g=!y;if(typeof window<"u")try{window.localStorage.setItem(r,String(g))}catch{}return g})},[r]),p=o!=null&&o!==i?`${o} of ${i}`:String(i);return n.jsxs("section",{"data-vskill-named-scope":a,children:[n.jsxs("button",{type:"button",onClick:x,"aria-expanded":!f,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 12px",background:"transparent",border:"none",cursor:"pointer",fontFamily:"var(--font-sans)",textAlign:"left"},children:[n.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-secondary)",width:10,display:"inline-block"},children:f?"▸":"▾"}),n.jsx("span",{style:{fontSize:12,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)"},children:a}),n.jsxs("span",{style:{fontSize:11,color:"var(--text-tertiary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",p,")"]}),u!=null&&u>0&&n.jsxs("span",{style:{marginLeft:"auto",fontSize:10,color:"var(--color-own, #f59e0b)"},children:[u," update",u!==1?"s":""]})]}),!f&&n.jsx("div",{children:m})]})}function v2(a){const r=[];for(const[i,o]of a){const u=[...o].sort((m,f)=>m.skill.localeCompare(f.skill));r.push({kind:"header",plugin:i,count:u.length});for(const m of u)r.push({kind:"row",skill:m})}return r}function ms({items:a,selectedKey:r,onSelect:i,onContextMenu:o,useVirtual:u}){if(u){const m=v2(a);return n.jsx("div",{"data-virtualized":"true",style:{height:420,minHeight:200},children:n.jsx(zj,{overscan:4,totalCount:m.length,itemContent:f=>{const h=m[f];if(!h)return null;if(h.kind==="header")return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)"},children:h.plugin}),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",h.count,")"]})]});const x=h.skill,p=!!r&&r.plugin===x.plugin&&r.skill===x.skill;return n.jsx(oo,{skill:x,isSelected:p,onSelect:()=>i(x),onContextMenu:o})}})})}return n.jsx("div",{"data-virtualized":"false",children:a.map(([m,f])=>n.jsx(l2,{plugin:m,skills:f,selectedKey:r,onSelect:i,onContextMenu:o},m))})}function Ax({queryActive:a}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:"No skills yet.",body:n.jsxs(n.Fragment,{children:["Create one with ",n.jsx(_d,{children:"vskill new"})," or the"," ",n.jsx("strong",{style:{color:"var(--text-primary)"},children:"New skill"})," action in the top rail."]})})}function Mx({queryActive:a,agentId:r}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:r?`No skills installed for ${r} in this project.`:"No installed skills.",body:n.jsxs(n.Fragment,{children:["Run ",n.jsx(_d,{children:"vskill install <plugin>"})," to add one."]})})}function g2({queryActive:a,agentId:r}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:`No global skills for ${r}.`,body:n.jsxs(n.Fragment,{children:["Run ",n.jsx(_d,{children:"vskill install --global <plugin>"})," to add one."]})})}function pr({headline:a,body:r}){return n.jsxs("div",{style:{padding:"12px 14px 16px",fontSize:12,color:"var(--text-secondary)",lineHeight:1.5},children:[n.jsx("div",{style:{fontWeight:500,color:"var(--text-primary)",marginBottom:4},children:a}),n.jsx("div",{children:r})]})}function _d({children:a}){return n.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-primary)",background:"color-mix(in srgb, var(--border-default) 45%, transparent)",padding:"1px 4px",borderRadius:3},children:a})}function y2(){return n.jsx("div",{"aria-hidden":"true",style:{height:1,background:"var(--border-default)",margin:"4px 14px"}})}function b2(){return n.jsx("div",{"aria-hidden":"true","data-testid":"scope-bold-divider",style:{height:3,background:"var(--color-rule)",boxShadow:"inset 0 1px 0 color-mix(in srgb, var(--color-rule) 50%, transparent)",margin:"12px 0"}})}function j2(){return n.jsx("div",{style:{padding:"8px 0"},children:[0,1,2,3,4,5].map(a=>n.jsx(s2,{},a))})}function S2({error:a,onRetry:r}){return n.jsxs("div",{role:"alert",style:{margin:"12px 14px",padding:12,border:"1px solid var(--border-default)",borderRadius:6,background:"var(--bg-canvas)",color:"var(--text-primary)",fontSize:12},children:[n.jsx("div",{style:{fontWeight:600,marginBottom:4},children:"Couldn't load skills."}),n.jsxs("details",{children:[n.jsx("summary",{style:{cursor:"pointer",color:"var(--text-secondary)",fontSize:11,marginBottom:4},children:k2(a)}),n.jsx("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",margin:"6px 0 0"},children:a})]}),r&&n.jsx("button",{type:"button",onClick:r,style:{marginTop:8,background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"4px 10px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:"Retry"})]})}function k2(a){const r=a.split(`
55
- `)[0]??a;return r.length>80?r.slice(0,77)+"…":r}const Pv=240,qv=480,Yv="vskill-sidebar-width",js=320;function Od(a){return Number.isFinite(a)?Math.round(Math.max(Pv,Math.min(qv,a))):js}function w2(){try{const a=localStorage.getItem(Yv);if(!a)return js;const r=Number(a);return Number.isFinite(r)?Od(r):js}catch{return js}}function C2(a){try{localStorage.setItem(Yv,String(Od(a)))}catch{}}function N2({initialWidth:a,onChange:r}){const i=v.useRef({startX:0,startWidth:a,pointerId:null}),o=v.useRef(a);return v.useEffect(()=>{o.current=a},[a]),v.useEffect(()=>{function u(f){if(i.current.pointerId==null||f.pointerId!==i.current.pointerId)return;const h=f.clientX-i.current.startX,x=Od(i.current.startWidth+h);o.current=x,r(x)}function m(f){i.current.pointerId==null||f.pointerId!==i.current.pointerId||(i.current.pointerId=null,C2(o.current))}return window.addEventListener("pointermove",u),window.addEventListener("pointerup",m),window.addEventListener("pointercancel",m),()=>{window.removeEventListener("pointermove",u),window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",m)}},[r]),n.jsx("div",{role:"separator","aria-orientation":"vertical","aria-valuemin":Pv,"aria-valuemax":qv,"aria-valuenow":a,"aria-label":"Resize sidebar",title:"Drag to resize sidebar",onPointerDown:u=>{const m=u.currentTarget;i.current.startX=u.clientX,i.current.startWidth=o.current,i.current.pointerId=u.pointerId;try{m.setPointerCapture(u.pointerId)}catch{}},style:{width:4,alignSelf:"stretch",cursor:"col-resize",background:"var(--border-default)",userSelect:"none",touchAction:"none"}})}function E2({connected:a,hint:r,onRetry:i}){return a?null:n.jsxs("aside",{"aria-live":"assertive",role:"alert",style:{display:"flex",alignItems:"center",gap:10,padding:"6px 12px",background:"color-mix(in srgb, var(--status-own) 15%, transparent)",borderBottom:"1px solid var(--border-default)",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:12},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--status-own)",display:"inline-block",flexShrink:0}}),n.jsx("span",{style:{fontWeight:500},children:"Disconnected — reconnecting…"}),r&&n.jsx("span",{style:{color:"var(--text-secondary)",fontSize:11},children:r}),n.jsx("div",{style:{flex:1}}),i&&n.jsx("button",{type:"button",onClick:i,style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"2px 8px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:"Retry now"})]})}function Fv(a){if(a!==void 0)try{return JSON.stringify(a)}catch(r){console.error("Failed to serialize request body:",r);try{const i=new WeakSet;return JSON.stringify(a,(o,u)=>{if(typeof u=="object"&&u!==null){if(i.has(u))return"[Circular]";i.add(u)}return u})}catch{return JSON.stringify({error:"Request body could not be serialized"})}}}function Fu(){const[a,r]=v.useState([]),[i,o]=v.useState(!1),[u,m]=v.useState(!1),[f,h]=v.useState(null),x=v.useRef(null),p=v.useCallback(async(g,j)=>{r([]),o(!0),m(!1),h(null);const S=new AbortController;x.current=S;try{const N=Fv(j),M=await fetch(g,{method:"POST",headers:{"Content-Type":"application/json"},body:N,signal:S.signal});if(!M.ok||!M.body){let I=`HTTP ${M.status}`;try{const L=await M.json();L.error&&(I=L.error)}catch{}throw new Error(I)}const E=M.body.getReader(),k=new TextDecoder;let T="",B="";for(;;){const{done:I,value:L}=await E.read();if(I)break;T+=k.decode(L,{stream:!0});const V=T.split(`
56
- `);T=V.pop()||"";for(const w of V)if(w.startsWith("event: "))B=w.slice(7).trim();else if(w.startsWith("data: ")){try{const D=JSON.parse(w.slice(6)),A={event:B,data:D};B==="done"?(m(!0),r(O=>[...O,A])):r(O=>[...O,A])}catch{}B=""}}}catch(N){N.name!=="AbortError"&&h(N.message)}finally{o(!1),x.current=null}},[]),y=v.useCallback(()=>{var g;(g=x.current)==null||g.abort()},[]);return{events:a,running:i,done:u,error:f,start:p,stop:y}}function T2(a){const r=v.useRef(a);r.current=a;const[i,o]=v.useState(new Set),u=v.useRef(new Map),m=v.useCallback(async(p,y,g)=>{var S;(S=u.current.get(p))==null||S.abort();const j=new AbortController;u.current.set(p,j),o(N=>{const M=new Set(N);return M.add(p),M});try{const N=Fv(g),M=await fetch(y,{method:"POST",headers:{"Content-Type":"application/json"},body:N,signal:j.signal});if(!M.ok||!M.body){let I=`HTTP ${M.status}`;try{const L=await M.json();L.error&&(I=L.error)}catch{}throw new Error(I)}const E=M.body.getReader(),k=new TextDecoder;let T="",B="";for(;;){const{done:I,value:L}=await E.read();if(I)break;T+=k.decode(L,{stream:!0});const V=T.split(`
57
- `);T=V.pop()||"";for(const w of V)if(w.startsWith("event: "))B=w.slice(7).trim();else if(w.startsWith("data: ")){try{const D=JSON.parse(w.slice(6)),A={event:B,data:D};r.current.onEvent(p,A)}catch{}B=""}}r.current.onDone(p)}catch(N){N.name!=="AbortError"&&r.current.onError(p,N.message)}finally{o(N=>{const M=new Set(N);return M.delete(p),M}),u.current.delete(p)}},[]),f=v.useCallback(p=>{var y;(y=u.current.get(p))==null||y.abort()},[]),h=v.useCallback(()=>{for(const p of u.current.values())p.abort()},[]),x=i.size>0;return{runningSet:i,startCase:m,stopCase:f,stopAll:h,isAnyCaseRunning:x}}const R2={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 A2(a,r){var i,o;switch(r.type){case"SET_LOADING":return{...a,loading:r.loading};case"SET_ERROR":return{...a,error:r.error};case"INIT_DATA":{const u=new Map;if(r.benchmark)for(const f of r.benchmark.cases)u.set(f.eval_id,{status:f.status,passRate:f.pass_rate,errorMessage:f.error_message||void 0,durationMs:f.durationMs,tokens:f.tokens,output:f.output,assertions:f.assertions.map(h=>({assertion_id:h.id,text:h.text,pass:h.pass,reasoning:h.reasoning}))});const m=((o=(i=r.evals)==null?void 0:i.evals[0])==null?void 0:o.id)??null;return{...a,skillContent:r.skillContent,savedContent:r.skillContent,isDirty:!1,evals:r.evals,evalsError:r.evalsError??null,latestBenchmark:r.benchmark,inlineResults:u,selectedCaseId:m,loading:!1,error:null}}case"SET_PANEL":return{...a,activePanel:r.panel};case"SET_CONTENT":return{...a,skillContent:r.content,isDirty:r.content!==a.savedContent};case"CONTENT_SAVED":return{...a,savedContent:a.skillContent,isDirty:!1};case"SET_EVALS":return{...a,evals:r.evals};case"SELECT_CASE":return{...a,selectedCaseId:r.caseId};case"CASE_RUN_START":{const u=new Map(a.caseRunStates);return u.set(r.caseId,{status:"running",startedAt:Date.now(),mode:r.mode}),{...a,caseRunStates:u,runMode:r.mode,activePanel:"run"}}case"CASE_RUN_COMPLETE":{const u=new Map(a.caseRunStates),m=u.get(r.caseId);u.set(r.caseId,{status:"complete",mode:m==null?void 0:m.mode});const f=new Map(a.inlineResults);return f.set(r.caseId,r.result),{...a,caseRunStates:u,inlineResults:f}}case"CASE_RUN_ERROR":{const u=new Map(a.caseRunStates),m=u.get(r.caseId);u.set(r.caseId,{status:"error",mode:m==null?void 0:m.mode});const f=new Map(a.inlineResults);return f.set(r.caseId,{status:"error",errorMessage:r.error,assertions:[]}),{...a,caseRunStates:u,inlineResults:f}}case"CASE_RUN_CANCEL":{const u=new Map(a.caseRunStates),m=u.get(r.caseId);return u.set(r.caseId,{status:"cancelled",mode:m==null?void 0:m.mode}),{...a,caseRunStates:u}}case"BULK_RUN_START":{const u=new Map(a.caseRunStates);for(const m of r.caseIds)u.set(m,{status:"queued",mode:r.mode});return{...a,caseRunStates:u,bulkRunActive:!0,runMode:r.mode,activePanel:"run"}}case"BULK_RUN_COMPLETE":return{...a,bulkRunActive:!1,latestBenchmark:r.benchmark??a.latestBenchmark,iterationCount:a.iterationCount+1};case"CANCEL_ALL":{const u=new Map(a.caseRunStates);for(const[m,f]of u)(f.status==="running"||f.status==="queued")&&u.set(m,{status:"cancelled"});return{...a,caseRunStates:u,bulkRunActive:!1}}case"UPDATE_INLINE_RESULT":{const u=new Map(a.inlineResults);return u.set(r.evalId,r.result),{...a,inlineResults:u}}case"OPEN_IMPROVE":return{...a,improveTarget:r.evalId,activePanel:"editor"};case"CLOSE_IMPROVE":return{...a,improveTarget:null};case"OPEN_AI_EDIT":return{...a,aiEditOpen:!0,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"CLOSE_AI_EDIT":return{...a,aiEditOpen:!1,aiEditLoading:!1,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"AI_EDIT_LOADING":return{...a,aiEditLoading:!0,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[]};case"AI_EDIT_PROGRESS":return{...a,aiEditProgress:[...a.aiEditProgress,r.entry]};case"AI_EDIT_RESULT":{const u=r.evalChanges??[],m=new Map;for(let f=0;f<u.length;f++)m.set(f,!0);return{...a,aiEditLoading:!1,aiEditResult:{improved:r.improved,reasoning:r.reasoning,evalChanges:u},aiEditEvalChanges:u,aiEditEvalSelections:m}}case"AI_EDIT_ERROR":return{...a,aiEditLoading:!1,aiEditError:r.message,aiEditClassifiedError:r.classified??null};case"GENERATE_EVALS_START":return{...a,generateEvalsLoading:!0,generateEvalsProgress:[],generateEvalsError:null};case"GENERATE_EVALS_PROGRESS":return{...a,generateEvalsProgress:[...a.generateEvalsProgress,r.entry]};case"GENERATE_EVALS_DONE":return{...a,generateEvalsLoading:!1,evals:r.evals};case"GENERATE_EVALS_ERROR":return{...a,generateEvalsLoading:!1,generateEvalsError:r.classified};case"TOGGLE_EVAL_CHANGE":{const u=new Map(a.aiEditEvalSelections);return u.set(r.index,!u.get(r.index)),{...a,aiEditEvalSelections:u}}case"SELECT_ALL_EVAL_CHANGES":{const u=new Map(a.aiEditEvalSelections);for(const m of u.keys())u.set(m,!0);return{...a,aiEditEvalSelections:u}}case"DESELECT_ALL_EVAL_CHANGES":{const u=new Map(a.aiEditEvalSelections);for(const m of u.keys())u.set(m,!1);return{...a,aiEditEvalSelections:u}}case"SET_EVALS_RETRY":return{...a,aiEditEvalsRetry:r.evalsFile};case"SET_REGRESSIONS":return{...a,regressions:r.regressions};case"INCREMENT_ITERATION":return{...a,iterationCount:a.iterationCount+1};case"SET_ACTIVATION_PROMPTS":return{...a,activationPrompts:r.prompts};case"ACTIVATION_START":return{...a,activationRunning:!0,activationResults:[],activationSummary:null,activationError:null,activationClassifyingStatus:null,activationStartedAt:Date.now()};case"ACTIVATION_RESULT":return{...a,activationResults:[...a.activationResults,r.result]};case"ACTIVATION_DONE":return{...a,activationRunning:!1,activationSummary:r.summary,activationClassifyingStatus:null};case"ACTIVATION_CLASSIFYING":return{...a,activationClassifyingStatus:`Classifying prompt ${r.index}/${r.total}...`};case"ACTIVATION_ERROR":return{...a,activationRunning:!1,activationError:r.error,activationClassifyingStatus:null};case"ACTIVATION_RESET":return{...a,activationResults:[],activationSummary:null,activationError:null};case"ACTIVATION_TIMEOUT":return{...a,activationRunning:!1,activationError:"Activation test timed out after 120 seconds"};case"ACTIVATION_CANCEL":return{...a,activationRunning:!1};case"GENERATE_PROMPTS_START":return{...a,generatingPrompts:!0,generatingPromptsError:null};case"GENERATE_PROMPTS_DONE":return{...a,generatingPrompts:!1};case"GENERATE_PROMPTS_ERROR":return{...a,generatingPrompts:!1,generatingPromptsError:r.error};case"ACTIVATION_HISTORY_LOADED":return{...a,activationHistory:r.runs,activationHistoryLoading:!1};default:return a}}function M2(a){if(a==="unit"||a==="integration")return a}function D2(a,r){const i=r.data;if(r.event==="output_ready"&&(a.output=i.output,i.durationMs!=null&&(a.durationMs=i.durationMs),i.tokens!=null&&(a.tokens=i.tokens)),r.event==="outputs_ready"&&(a.output=i.skillOutput,i.skillDurationMs!=null&&(a.durationMs=i.skillDurationMs),i.skillTokens!=null&&(a.tokens=i.skillTokens)),r.event==="assertion_result"){const o={assertion_id:i.assertion_id,text:i.text,pass:i.pass,reasoning:i.reasoning};a.assertions.find(u=>u.assertion_id===o.assertion_id)||a.assertions.push(o)}r.event==="case_complete"&&(a.status=i.status,a.passRate=i.pass_rate,a.errorMessage=i.error_message||void 0,a.classifiedError=i.classified_error||void 0)}const Kv=v.createContext(null);function kn(){const a=v.useContext(Kv);if(!a)throw new Error("useWorkspace must be used within WorkspaceProvider");return a}function Dx({plugin:a,skill:r,origin:i,children:o}){const u=i==="installed",[m,f]=v.useReducer(A2,{...R2,plugin:a,skill:r}),h=v.useRef(new Set),x=v.useRef(new Set),p=v.useRef(new Map),y=v.useCallback((ne,fe)=>{let ue=p.current.get(ne);ue||(ue={assertions:[]},p.current.set(ne,ue)),D2(ue,fe),f({type:"UPDATE_INLINE_RESULT",evalId:ne,result:{...ue,assertions:[...ue.assertions]}})},[]),g=v.useCallback(ne=>{if(x.current.has(ne))return;x.current.add(ne);const fe=p.current.get(ne)??{assertions:[]};f({type:"CASE_RUN_COMPLETE",caseId:ne,result:{...fe,assertions:[...fe.assertions]}}),h.current.has(ne)&&(h.current.delete(ne),h.current.size===0&&Ne.getLatestBenchmark(a,r).then(ue=>f({type:"BULK_RUN_COMPLETE",benchmark:ue})).catch(()=>f({type:"BULK_RUN_COMPLETE",benchmark:null})))},[a,r]),j=v.useCallback((ne,fe)=>{x.current.has(ne)||(x.current.add(ne),f({type:"CASE_RUN_ERROR",caseId:ne,error:fe}),h.current.has(ne)&&(h.current.delete(ne),h.current.size===0&&Ne.getLatestBenchmark(a,r).then(ue=>f({type:"BULK_RUN_COMPLETE",benchmark:ue})).catch(()=>f({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[a,r]),{startCase:S,stopCase:N,stopAll:M}=T2({onEvent:y,onDone:g,onError:j});v.useEffect(()=>()=>{M()},[M]);const E=v.useCallback(async()=>{try{const ne=await fetch(`/api/skills/${a}/${r}/activation-history`);if(!ne.ok){if(ne.status===404){f({type:"ACTIVATION_HISTORY_LOADED",runs:[]});return}return}const fe=await ne.json();f({type:"ACTIVATION_HISTORY_LOADED",runs:fe.runs||[]})}catch{}},[a,r]);v.useEffect(()=>{let ne=!1;async function fe(){try{const[ue,he,be]=await Promise.allSettled([Ne.getSkillDetail(a,r),Ne.getEvals(a,r),Ne.getLatestBenchmark(a,r)]);if(ne)return;let _e=null,Me=null;if(he.status==="fulfilled")_e=he.value;else{const dt=he.reason;(dt==null?void 0:dt.status)!==404&&(Me=(dt==null?void 0:dt.message)??"Failed to load test cases")}f({type:"INIT_DATA",skillContent:ue.status==="fulfilled"?ue.value.skillContent:"",evals:_e,evalsError:Me,benchmark:be.status==="fulfilled"?be.value:null})}catch(ue){ne||f({type:"SET_ERROR",error:ue.message})}}return fe(),E(),()=>{ne=!0}},[a,r,E]);const k=v.useCallback(async()=>{if(!u)try{await Ne.applyImprovement(a,r,m.skillContent),f({type:"CONTENT_SAVED"})}catch(ne){f({type:"SET_ERROR",error:ne.message})}},[u,a,r,m.skillContent]),T=v.useCallback(async ne=>{if(!u)try{const fe=await Ne.saveEvals(a,r,ne);f({type:"SET_EVALS",evals:fe})}catch(fe){f({type:"SET_ERROR",error:fe.message})}},[u,a,r]),B=v.useCallback((ne,fe="benchmark")=>{if(u)return;const ue=m.caseRunStates.get(ne);if((ue==null?void 0:ue.status)!=="running")if(p.current.delete(ne),x.current.delete(ne),f({type:"CASE_RUN_START",caseId:ne,mode:fe}),fe==="comparison"){const he=`/api/skills/${a}/${r}/compare`;S(ne,he,{eval_ids:[ne]})}else{const he=`/api/skills/${a}/${r}/benchmark/case/${ne}`;S(ne,he,fe==="baseline"?{baseline_only:!0}:void 0)}},[u,a,r,m.caseRunStates,S]),I=v.useCallback((ne="benchmark")=>{var he;if(u)return;const fe=((he=m.evals)==null?void 0:he.evals)??[];if(fe.length===0)return;const ue=fe.map(be=>be.id);for(const be of ue)p.current.delete(be),x.current.delete(be);f({type:"BULK_RUN_START",caseIds:ue,mode:ne}),h.current=new Set(ue);for(const be of ue)if(ne==="comparison")S(be,`/api/skills/${a}/${r}/compare`,{eval_ids:[be]});else{const _e=`/api/skills/${a}/${r}/benchmark/case/${be}`;S(be,_e,ne==="baseline"?{baseline_only:!0}:void 0)}},[u,a,r,m.evals,S]),L=v.useCallback(ne=>{N(ne),f({type:"CASE_RUN_CANCEL",caseId:ne}),h.current.delete(ne),x.current.add(ne)},[N]),V=v.useCallback(()=>{M(),f({type:"CANCEL_ALL"}),h.current.clear()},[M]),w=v.useCallback(async(ne,fe)=>{f({type:"OPEN_IMPROVE",evalId:ne})},[]),D=v.useCallback(async(ne,fe)=>{try{await Ne.applyImprovement(a,r,fe),f({type:"SET_CONTENT",content:fe}),f({type:"CONTENT_SAVED"}),f({type:"CLOSE_IMPROVE"}),B(ne,"benchmark")}catch(ue){f({type:"SET_ERROR",error:ue.message})}},[a,r,B]),A=Fu(),O=v.useRef(null),G=v.useRef(0);v.useEffect(()=>{const ne=A.events;for(let fe=G.current;fe<ne.length;fe++){const ue=ne[fe],he=ue.data;if(ue.event==="progress"&&f({type:"AI_EDIT_PROGRESS",entry:{timestamp:Date.now(),phase:he.phase,message:he.message}}),ue.event==="done"){const be=he.improved,_e=he.reasoning,Me=he.evalChanges??[];f({type:"AI_EDIT_RESULT",improved:be,reasoning:_e,evalChanges:Me})}if(ue.event==="error"){const be=he;f({type:"AI_EDIT_ERROR",message:be.description||"Unknown error",classified:be})}}G.current=ne.length},[A.events]),v.useEffect(()=>{A.error&&f({type:"AI_EDIT_ERROR",message:A.error})},[A.error]),v.useEffect(()=>()=>{A.stop()},[A.stop]);const q=v.useCallback(async(ne,fe,ue)=>{u||(G.current=0,f({type:"AI_EDIT_LOADING"}),O.current=A.stop,A.start(`/api/skills/${a}/${r}/improve?sse`,{mode:"instruct",instruction:ne,content:m.skillContent,evals:m.evals??{skill_name:r,evals:[]},provider:fe,model:ue}))},[u,a,r,m.skillContent,m.evals,A]),te=v.useCallback(()=>{A.stop(),f({type:"AI_EDIT_ERROR",message:"Cancelled"})},[A]),X=v.useCallback(async()=>{const ne=m.aiEditResult;if(ne!=null&&ne.improved)try{if(await Ne.applyImprovement(a,r,ne.improved),f({type:"SET_CONTENT",content:ne.improved}),f({type:"CONTENT_SAVED"}),m.aiEditEvalChanges.length>0&&Array.from(m.aiEditEvalSelections.values()).some(Boolean)){const{mergeEvalChanges:ue}=await jd(async()=>{const{mergeEvalChanges:_e}=await import("./mergeEvalChanges-Dpbbs4d4.js");return{mergeEvalChanges:_e}},[]),he=m.evals??{skill_name:r,evals:[]},be=ue(he,m.aiEditEvalChanges,m.aiEditEvalSelections);try{const _e=await Ne.saveEvals(a,r,be);f({type:"SET_EVALS",evals:_e})}catch(_e){f({type:"SET_EVALS_RETRY",evalsFile:be}),f({type:"SET_ERROR",error:`SKILL.md saved, but test cases failed to save: ${_e.message}. You can retry from the AI Edit panel.`});return}}f({type:"CLOSE_AI_EDIT"})}catch(fe){f({type:"SET_ERROR",error:fe.message})}},[a,r,m.aiEditResult,m.evals,m.aiEditEvalChanges,m.aiEditEvalSelections]),_=v.useCallback(()=>{f({type:"CLOSE_AI_EDIT"})},[]),R=v.useCallback(ne=>{f({type:"TOGGLE_EVAL_CHANGE",index:ne})},[]),U=v.useCallback(()=>{f({type:"SELECT_ALL_EVAL_CHANGES"})},[]),se=v.useCallback(()=>{f({type:"DESELECT_ALL_EVAL_CHANGES"})},[]),Y=v.useCallback(async()=>{const ne=m.aiEditEvalsRetry;if(ne)try{const fe=await Ne.saveEvals(a,r,ne);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}`})}},[a,r,m.aiEditEvalsRetry]),me=v.useCallback(async()=>{try{const ne=await Ne.getSkillDetail(a,r);f({type:"SET_CONTENT",content:ne.skillContent}),f({type:"CONTENT_SAVED"})}catch{}},[a,r]),{config:z}=bl(),W=Fu(),ie=v.useRef(0);v.useEffect(()=>{const ne=W.events;for(let fe=ie.current;fe<ne.length;fe++){const ue=ne[fe],he=ue.data;if(ue.event==="progress"&&f({type:"GENERATE_EVALS_PROGRESS",entry:{timestamp:Date.now(),phase:he.phase,message:he.message}}),ue.event==="done"){const be=he;Ne.saveEvals(a,r,be).then(_e=>f({type:"GENERATE_EVALS_DONE",evals:_e})).catch(_e=>f({type:"SET_ERROR",error:_e.message}))}ue.event==="error"&&f({type:"GENERATE_EVALS_ERROR",classified:he})}ie.current=ne.length},[W.events,a,r]),v.useEffect(()=>{W.error&&f({type:"SET_ERROR",error:W.error})},[W.error]),v.useEffect(()=>()=>{W.stop()},[W.stop]);const de=v.useCallback(async ne=>{if(u)return;ie.current=0,f({type:"GENERATE_EVALS_START"});const fe={};z!=null&&z.provider&&(fe.provider=z.provider),z!=null&&z.model&&(fe.model=z.model);const ue=M2(ne==null?void 0:ne.testType);ue&&(fe.testType=ue),W.start(`/api/skills/${a}/${r}/generate-evals?sse`,Object.keys(fe).length>0?fe:void 0)},[u,a,r,W,z]),ge=Fu(),xe=v.useRef(0);v.useEffect(()=>()=>{ge.stop()},[ge.stop]),v.useEffect(()=>{const ne=ge.events;for(let fe=xe.current;fe<ne.length;fe++){const ue=ne[fe];if(ue.event==="classifying"){const he=ue.data;f({type:"ACTIVATION_CLASSIFYING",index:he.index,total:he.total})}if(ue.event==="prompt_result"&&f({type:"ACTIVATION_RESULT",result:ue.data}),ue.event==="done"){oe.current&&(clearTimeout(oe.current),oe.current=null);const he=ue.data;if(he.error)f({type:"ACTIVATION_ERROR",error:he.error});else{f({type:"ACTIVATION_DONE",summary:he});const be={id:`run-${Date.now()}`,timestamp:new Date().toISOString(),model:(z==null?void 0:z.model)||"unknown",provider:(z==null?void 0:z.provider)||"unknown",promptCount:he.total,summary:{precision:he.precision,recall:he.recall,reliability:he.reliability,tp:he.tp,tn:he.tn,fp:he.fp,fn:he.fn}};f({type:"ACTIVATION_HISTORY_LOADED",runs:[be,...m.activationHistory??[]]})}}}xe.current=ne.length},[ge.events,z,m.activationHistory]),v.useEffect(()=>{ge.error&&(oe.current&&(clearTimeout(oe.current),oe.current=null),f({type:"ACTIVATION_ERROR",error:ge.error}))},[ge.error]);const oe=v.useRef(null),ae=v.useCallback(()=>{oe.current&&(clearTimeout(oe.current),oe.current=null),ge.stop(),f({type:"ACTIVATION_CANCEL",totalPrompts:0})},[ge]),ve=v.useCallback(ne=>{const ue=ne.trim().split(`
58
- `).filter(Boolean).map(be=>be.startsWith("!")?{prompt:be.slice(1).trim(),expected:"should_not_activate"}:be.startsWith("+")?{prompt:be.slice(1).trim(),expected:"should_activate"}:{prompt:be.trim(),expected:"auto"});xe.current=0,f({type:"ACTIVATION_START"}),f({type:"SET_ACTIVATION_PROMPTS",prompts:ne});const he={prompts:ue};z!=null&&z.provider&&(he.provider=z.provider),z!=null&&z.model&&(he.model=z.model),ge.start(`/api/skills/${a}/${r}/activation-test`,he),oe.current&&clearTimeout(oe.current),oe.current=setTimeout(()=>{ge.stop(),f({type:"ACTIVATION_TIMEOUT"}),oe.current=null},12e4)},[a,r,ge,z]),Ie=v.useCallback(async(ne=8)=>{f({type:"GENERATE_PROMPTS_START"});try{const fe={count:ne};z!=null&&z.provider&&(fe.provider=z.provider),z!=null&&z.model&&(fe.model=z.model);const ue=await fetch(`/api/skills/${a}/${r}/activation-prompts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(fe)});if(!ue.ok){let ct=`HTTP ${ue.status}`;try{const Vt=await ue.json();Vt.error&&(ct=Vt.error)}catch{}throw new Error(ct)}const he=ue.body.getReader(),be=new TextDecoder;let _e="",Me="",dt=[];for(;;){const{done:ct,value:Vt}=await he.read();if(ct)break;_e+=be.decode(Vt,{stream:!0});const $t=_e.split(`
54
+ }`})]})}function tx(){typeof window>"u"||(window.location.hash="#/")}function s0({onHome:a}){const[r,i]=v.useState(!1),[o,u]=v.useState(!1),m=h=>{h.metaKey||h.ctrlKey||h.shiftKey||h.button!==0||(h.preventDefault(),tx(),a==null||a())},f=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),tx(),a==null||a())};return n.jsxs("a",{href:"#/",role:"link","data-testid":"studio-logo","aria-label":"Skill Studio — home",onClick:m,onKeyDown:f,onFocus:()=>i(!0),onBlur:()=>i(!1),onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),style:{display:"inline-flex",alignItems:"center",gap:10,flexShrink:0,padding:"4px 6px",margin:"-4px -6px",borderRadius:6,textDecoration:"none",color:"inherit",cursor:"pointer",outline:r?"2px solid var(--border-focus)":"none",outlineOffset:2,background:o?"color-mix(in srgb, var(--text-primary) 4%, transparent)":"transparent",transition:"background-color var(--duration-fast, 120ms) var(--ease-standard, ease)"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:6,background:"color-mix(in srgb, var(--accent-surface) 20%, transparent)"},children:n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent-surface)",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}),n.jsx("span",{style:{fontSize:13,fontWeight:600,letterSpacing:"-0.01em",color:"var(--text-primary)"},children:"Skill Studio"})]})}const i0="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",o0=v.lazy(()=>Sd(()=>import("./UpdateDropdown-J1iXSqe9.js"),__vite__mapDeps([0,1])));function c0(){const{updateCount:a,updates:r,isRefreshingUpdates:i,refreshUpdates:o,selectSkill:u}=ya(),[m,f]=v.useState(!1),h=v.useRef(null),x=v.useCallback(()=>f(!1),[]),p=a>0?"var(--text-primary)":"var(--text-secondary)",y=a>9?"9+":String(a),g=a===0?"No updates available":`${a} updates available, open summary`;return n.jsxs("span",{"data-testid":"update-bell-anchor",style:{position:"relative",display:"inline-flex"},children:[n.jsxs("button",{ref:h,type:"button","data-testid":"update-bell","aria-label":g,"aria-haspopup":"dialog","aria-expanded":m,onClick:()=>f(j=>!j),style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",height:26,width:26,padding:0,borderRadius:4,border:"1px solid transparent",background:"transparent",color:p,cursor:"pointer"},children:[n.jsx("img",{src:i0,alt:"",width:18,height:18,style:{display:"block",opacity:a>0?1:.75}}),a>0&&n.jsx("span",{"data-testid":"update-bell-badge","aria-hidden":"true",style:{position:"absolute",top:-2,right:-2,minWidth:14,height:14,padding:"0 3px",borderRadius:999,background:"var(--color-own)",color:"var(--color-paper)",fontSize:9,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:600,lineHeight:1},children:y})]}),m&&n.jsx(v.Suspense,{fallback:n.jsx("span",{"data-testid":"update-bell-fallback",children:"Loading…"}),children:n.jsx(o0,{updates:r,isRefreshing:i,onRefresh:()=>o(),onSelectSkill:j=>{const S=j.name.split("/"),N=S.length>=2?S[S.length-2]:S[0],D=S[S.length-1];u({plugin:N,skill:D,origin:"installed"}),x()},onViewAll:()=>{window.location.hash="#/updates",x()},onClose:x,anchorRef:h})})]})}function nx(a){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:navigate-scope",{detail:a}))}function u0({projectName:a,selected:r,onOpenPalette:i,onHome:o,projectPickerSlot:u}){const m=r?r.origin==="installed"?"Installed":"Own":null;return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,height:"100%",width:"100%",padding:"0 16px",fontFamily:"var(--font-sans)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexShrink:0},children:[n.jsx(s0,{onHome:o}),u?n.jsx("div",{style:{borderLeft:"1px solid var(--border-default)",paddingLeft:10,display:"flex",alignItems:"center"},children:u}):a&&n.jsx("span",{title:a,style:{fontSize:12,color:"var(--text-secondary)",borderLeft:"1px solid var(--border-default)",paddingLeft:10,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a})]}),n.jsx("nav",{"aria-label":"Breadcrumb",style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:6,fontSize:12,color:"var(--text-secondary)"},children:r&&m&&n.jsxs(n.Fragment,{children:[n.jsx(ax,{segment:"origin",onClick:()=>nx({scope:"origin",origin:r.origin}),style:{textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:r.origin==="installed"?"var(--status-installed)":"var(--status-own)"},children:m}),n.jsx(lx,{}),n.jsx(ax,{segment:"plugin",onClick:()=>nx({scope:"plugin",plugin:r.plugin}),style:{fontFamily:"var(--font-mono)",fontSize:11},children:r.plugin}),n.jsx(lx,{}),n.jsx("span",{"data-breadcrumb-segment":"skill","aria-current":"page",style:{color:"var(--text-primary)",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.skill})]})}),n.jsxs("div",{"data-toprail-right":"true",style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[n.jsx("span",{"data-slot":"agent-model-picker",style:{minWidth:200},children:n.jsx(l0,{})}),n.jsx("span",{"data-slot":"update-bell",style:{display:"inline-flex"},children:n.jsx(c0,{})}),n.jsx("button",{type:"button",onClick:i,"aria-label":"Open command palette",title:"Command palette (⌘K)",style:{display:"inline-flex",alignItems:"center",gap:6,height:26,padding:"0 10px",borderRadius:4,border:"1px solid var(--border-default)",background:"transparent",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono)",cursor:"pointer"},children:n.jsx("span",{children:"⌘K"})})]})]})}function ax({segment:a,onClick:r,style:i,children:o}){return n.jsx("button",{type:"button","data-breadcrumb-segment":a,onClick:r,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",color:"var(--text-secondary)",fontFamily:"inherit",...i},onMouseEnter:u=>{u.currentTarget.style.color="var(--color-accent-ink)"},onMouseLeave:u=>{const m=(i==null?void 0:i.color)??"var(--text-secondary)";u.currentTarget.style.color=m},children:o})}function lx(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)",fontSize:10},children:"›"})}const po="vskill-theme";function ov(a){return a==="light"||a==="dark"||a==="auto"?a:"auto"}function d0(a,r){return a==="light"||a==="dark"?a:r?"dark":"light"}function f0(a){try{const r=a.getItem(po);return ov(r)}catch{return"auto"}}function p0(a,r){try{a.setItem(po,r)}catch{}}function m0(a,r,i){a.dataset.theme=i,a.dataset.themeMode=r}function h0(a){if(!a)return!1;try{return a("(prefers-color-scheme: dark)").matches}catch{return!1}}const cv=v.createContext(null);function x0({storage:a,matchMedia:r,target:i,children:o}){const u=a??(typeof window<"u"?window.localStorage:void 0),m=r??(typeof window<"u"?window.matchMedia.bind(window):void 0),f=i??(typeof document<"u"?document.documentElement:void 0),[h,x]=v.useState(()=>u?f0(u):"auto"),[p,y]=v.useState(()=>h0(m)),g=v.useMemo(()=>d0(h,p),[h,p]);v.useEffect(()=>{f&&m0(f,h,g)},[f,h,g]),v.useEffect(()=>{if(!m)return;const N=m("(prefers-color-scheme: dark)"),D=k=>y(k.matches);if(typeof N.addEventListener=="function")return N.addEventListener("change",D),()=>N.removeEventListener("change",D);const T=N;return T.addListener(D),()=>T.removeListener(D)},[m]),v.useEffect(()=>{if(typeof window>"u")return;const N=D=>{D.key===po&&x(ov(D.newValue))};return window.addEventListener("storage",N),()=>window.removeEventListener("storage",N)},[]),v.useEffect(()=>{if(!m||!f)return;let N;try{N=m("(prefers-contrast: more)")}catch{return}const D=M=>{M?f.dataset.contrast="more":f.dataset.contrast==="more"&&delete f.dataset.contrast};D(N.matches);const T=M=>D(M.matches);if(typeof N.addEventListener=="function")return N.addEventListener("change",T),()=>N.removeEventListener("change",T);const k=N;return k.addListener(T),()=>k.removeListener(T)},[m,f]);const j=v.useCallback(N=>{x(N),u&&p0(u,N)},[u]),S=v.useMemo(()=>({mode:h,resolvedTheme:g,setTheme:j}),[h,g,j]);return n.jsx(cv.Provider,{value:S,children:o})}function uv(){const a=v.useContext(cv);if(!a)throw new Error("useTheme must be used inside <ThemeProvider>. Wrap the app root in main.tsx.");return a}const rx=["claude-cli","anthropic","openrouter","ollama","lm-studio"];function v0(a){const r=new Map(a.map(o=>[o.id,o])),i=[];for(const o of rx){const u=r.get(o);u&&i.push(u)}for(const o of a)rx.includes(o.id)||i.push(o);return i}function g0(a){const[r,i]=v.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(`(max-width: ${a}px)`).matches);return v.useEffect(()=>{var m;if(typeof window>"u"||!window.matchMedia)return;const o=window.matchMedia(`(max-width: ${a}px)`),u=()=>i(o.matches);return(m=o.addEventListener)==null||m.call(o,"change",u),()=>{var f;return(f=o.removeEventListener)==null?void 0:f.call(o,"change",u)}},[a]),r}function y0({providers:a,onOpenSettings:r,onOpenInstallHelp:i}){const o=v0(a),u=g0(640),[m,f]=v.useState(!1),h=v.useCallback(x=>{x.available||x.kind==="api-key"?r==null||r(x.id):i==null||i(x.id)},[r,i]);if(u){const x=o.filter(p=>p.available).length;return n.jsxs("div",{"data-testid":"providers-segment",style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[n.jsx("button",{type:"button","data-testid":"providers-summary",onClick:()=>f(!m),"aria-label":Z.statusBar.providerSummary(x,o.length),style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:Z.statusBar.providerSummary(x,o.length)}),m&&n.jsx("div",{role:"menu",style:{position:"absolute",bottom:"120%",right:0,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,padding:6,minWidth:180,display:"flex",flexDirection:"column",gap:2,zIndex:80},children:o.map(p=>n.jsx(sx,{p,onClick:h},p.id))})]})}return n.jsx("div",{"data-testid":"providers-segment",style:{display:"inline-flex",alignItems:"center",gap:4},children:o.map(x=>n.jsx(sx,{p:x,onClick:h,compact:!0},x.id))})}function sx({p:a,onClick:r,compact:i}){const o=a.available?Z.statusBar.unlocked(a.label):a.kind==="cli-install"?Z.statusBar.lockedCli(a.label):Z.statusBar.locked(a.label);return n.jsxs("button",{type:"button","data-testid":`provider-glyph-${a.id}`,"data-available":a.available,"aria-label":o,title:o,onClick:()=>r(a),style:{display:"inline-flex",alignItems:"center",gap:4,background:"transparent",border:"none",color:a.available?"var(--status-installed)":"var(--text-muted, var(--text-tertiary))",cursor:"pointer",padding:i?"2px":"4px 6px",fontSize:11},children:[n.jsx(id,{unlocked:a.available,size:10}),!i&&n.jsx("span",{children:a.label})]})}function b0(){try{return typeof localStorage>"u"?null:localStorage.getItem(po)}catch{return null}}function j0({projectPath:a,modelName:r,health:i="ok",onPathClick:o,providers:u,onOpenProviderSettings:m,onOpenProviderInstallHelp:f}){const{mode:h,resolvedTheme:x,setTheme:p}=uv(),g=b0()==="auto",j=S0(h,x,g),S=i==="down"||i==="degraded"?"var(--status-own)":"var(--status-installed)";return n.jsxs("div",{role:"contentinfo",style:{display:"flex",alignItems:"center",gap:12,height:"100%",width:"100%",padding:"0 12px",fontSize:11,fontFamily:"var(--font-sans)",color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[n.jsx("span",{title:r??"",style:{fontFamily:"var(--font-mono)"},children:r??"—"}),n.jsx(ix,{}),n.jsxs("span",{"aria-label":`Health: ${i}`,style:{display:"inline-flex",alignItems:"center",gap:6},children:[n.jsx(k0,{color:S}),n.jsx("span",{style:{textTransform:"capitalize"},children:i})]}),u&&u.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(ix,{}),n.jsx(y0,{providers:u,onOpenSettings:m,onOpenInstallHelp:f})]}),n.jsx("div",{style:{flex:1}}),n.jsxs("button",{type:"button","data-testid":"theme-toggle",onClick:()=>p(j),"aria-label":`Switch to ${j} theme`,title:`Theme: ${h} — click for ${j}`,style:{display:"inline-flex",alignItems:"center",gap:6,background:"transparent",border:"1px solid var(--border-default)",padding:"2px 8px",borderRadius:4,color:"var(--text-secondary)",cursor:"pointer",fontSize:11,height:20},children:[n.jsx(w0,{mode:h}),n.jsx("span",{style:{textTransform:"capitalize"},children:h})]})]})}function S0(a,r,i){return a==="light"?"dark":a==="dark"?"auto":i?"light":r==="light"?"dark":"light"}function k0({color:a}){return n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:a,display:"inline-block",flexShrink:0}})}function ix(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)"},children:"|"})}function w0({mode:a}){return a==="dark"?n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}):a==="light"?n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"4"}),n.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}):n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"9"}),n.jsx("path",{d:"M12 3a9 9 0 0 0 0 18z",fill:"currentColor"})]})}const mo=0,Wa=1,xr=2,dv=4;function ox(a){return()=>a}function C0(a){a()}function fv(a,r){return i=>a(r(i))}function cx(a,r){return()=>a(r)}function N0(a,r){return i=>a(r,i)}function kd(a){return a!==void 0}function E0(...a){return()=>{a.map(C0)}}function vr(){}function ho(a,r){return r(a),a}function T0(a,r){return r(a)}function ht(...a){return a}function et(a,r){return a(Wa,r)}function He(a,r){a(mo,r)}function wd(a){a(xr)}function yt(a){return a(dv)}function Ce(a,r){return et(a,N0(r,mo))}function $n(a,r){const i=a(Wa,o=>{i(),r(o)});return i}function ux(a){let r,i;return o=>u=>{r=u,i&&clearTimeout(i),i=setTimeout(()=>{o(r)},a)}}function pv(a,r){return a===r}function mt(a=pv){let r;return i=>o=>{a(r,o)||(r=o,i(o))}}function Ae(a){return r=>i=>{a(i)&&r(i)}}function je(a){return r=>fv(r,a)}function Wn(a){return r=>()=>{r(a)}}function ce(a,...r){const i=R0(...r);return((o,u)=>{switch(o){case xr:wd(a);return;case Wa:return et(a,i(u))}})}function Kn(a,r){return i=>o=>{i(r=a(r,o))}}function yl(a){return r=>i=>{a>0?a--:r(i)}}function va(a){let r=null,i;return o=>u=>{r=u,!i&&(i=setTimeout(()=>{i=void 0,o(r)},a))}}function $e(...a){const r=new Array(a.length);let i=0,o=null;const u=2**a.length-1;return a.forEach((m,f)=>{const h=2**f;et(m,x=>{const p=i;i|=h,r[f]=x,p!==u&&i===u&&o&&(o(),o=null)})}),m=>f=>{const h=()=>{m([f].concat(r))};i===u?h():o=h}}function R0(...a){return r=>a.reduceRight(T0,r)}function A0(a){let r,i;const o=()=>r==null?void 0:r();return function(u,m){switch(u){case Wa:return m?i===m?void 0:(o(),i=m,r=et(a,m),r):(o(),vr);case xr:o(),i=null;return}}}function pe(a){let r=a;const i=Ke();return((o,u)=>{switch(o){case mo:r=u;break;case Wa:{u(r);break}case dv:return r}return i(o,u)})}function Xt(a,r){return ho(pe(r),i=>Ce(a,i))}function Ke(){const a=[];return((r,i)=>{switch(r){case mo:a.slice().forEach(o=>{o(i)});return;case xr:a.splice(0,a.length);return;case Wa:return a.push(i),()=>{const o=a.indexOf(i);o>-1&&a.splice(o,1)}}})}function jn(a){return ho(Ke(),r=>Ce(a,r))}function Ze(a,r=[],{singleton:i}={singleton:!0}){return{constructor:a,dependencies:r,id:M0(),singleton:i}}const M0=()=>Symbol();function D0(a){const r=new Map,i=({constructor:o,dependencies:u,id:m,singleton:f})=>{if(f&&r.has(m))return r.get(m);const h=o(u.map(x=>i(x)));return f&&r.set(m,h),h};return i(a)}function Lt(...a){const r=Ke(),i=new Array(a.length);let o=0;const u=2**a.length-1;return a.forEach((m,f)=>{const h=2**f;et(m,x=>{i[f]=x,o|=h,o===u&&He(r,i)})}),function(m,f){switch(m){case xr:{wd(r);return}case Wa:return o===u&&f(i),et(r,f)}}}function Re(a,r=pv){return ce(a,mt(r))}function od(...a){return function(r,i){switch(r){case xr:return;case Wa:return E0(...a.map(o=>et(o,i)))}}}const Bt={DEBUG:0,INFO:1,WARN:2,ERROR:3},z0={[Bt.DEBUG]:"debug",[Bt.ERROR]:"error",[Bt.INFO]:"log",[Bt.WARN]:"warn"},L0=()=>typeof globalThis>"u"?window:globalThis,Ka=Ze(()=>{const a=pe(Bt.ERROR);return{log:pe((r,i,o=Bt.INFO)=>{const u=L0().VIRTUOSO_LOG_LEVEL??yt(a);o>=u&&console[z0[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",r,i)}),logLevel:a}},[],{singleton:!0});function jl(a,r,i){return Cd(a,r,i).callbackRef}function Cd(a,r,i){const o=we.useRef(null);let u=f=>{};const m=we.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(f=>{const h=()=>{const x=f[0].target;x.offsetParent!==null&&a(x)};i?h():requestAnimationFrame(h)}):null,[a,i]);return u=f=>{f&&r?(m==null||m.observe(f),o.current=f):(o.current&&(m==null||m.unobserve(o.current)),o.current=null)},{callbackRef:u,ref:o}}function _0(a,r,i,o,u,m,f,h,x){const p=we.useCallback(y=>{const g=O0(y.children,r,h?"offsetWidth":"offsetHeight",u);let j=y.parentElement;for(;j.dataset.virtuosoScroller===void 0;)j=j.parentElement;const S=j.lastElementChild.dataset.viewportType==="window";let N;S&&(N=j.ownerDocument.defaultView);const D=f?h?f.scrollLeft:f.scrollTop:S?h?N.scrollX||N.document.documentElement.scrollLeft:N.scrollY||N.document.documentElement.scrollTop:h?j.scrollLeft:j.scrollTop,T=f?h?f.scrollWidth:f.scrollHeight:S?h?N.document.documentElement.scrollWidth:N.document.documentElement.scrollHeight:h?j.scrollWidth:j.scrollHeight,k=f?h?f.offsetWidth:f.offsetHeight:S?h?N.innerWidth:N.innerHeight:h?j.offsetWidth:j.offsetHeight;o({scrollHeight:T,scrollTop:Math.max(D,0),viewportHeight:k}),m==null||m(h?dx("column-gap",getComputedStyle(y).columnGap,u):dx("row-gap",getComputedStyle(y).rowGap,u)),g!==null&&a(g)},[a,r,u,m,f,o,h]);return Cd(p,i,x)}function O0(a,r,i,o){const u=a.length;if(u===0)return null;const m=[];for(let f=0;f<u;f++){const h=a.item(f);if(h.dataset.index===void 0)continue;const x=parseInt(h.dataset.index),p=parseFloat(h.dataset.knownSize),y=r(h,i);if(y===0&&o("Zero-sized element, this should not happen",{child:h},Bt.ERROR),y===p)continue;const g=m[m.length-1];m.length===0||g.size!==y||g.endIndex!==x-1?m.push({endIndex:x,size:y,startIndex:x}):m[m.length-1].endIndex++}return m}function dx(a,r,i){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&i(`${a} was not resolved to pixel value correctly`,r,Bt.WARN),r==="normal"?0:parseInt(r??"0",10)}function mv(a,r,i){const o=we.useRef(null),u=we.useCallback(x=>{if(!(x!=null&&x.offsetParent))return;const p=x.getBoundingClientRect(),y=p.width;let g,j;if(r){const S=r.getBoundingClientRect(),N=p.top-S.top;j=S.height-Math.max(0,N),g=N+r.scrollTop}else{const S=f.current.ownerDocument.defaultView;j=S.innerHeight-Math.max(0,p.top),g=p.top+S.scrollY}o.current={listHeight:p.height,offsetTop:g,visibleHeight:j,visibleWidth:y},a(o.current)},[a,r]),{callbackRef:m,ref:f}=Cd(u,!0,i),h=we.useCallback(()=>{u(f.current)},[u,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 x=(p=f.current)==null?void 0:p.ownerDocument.defaultView;return x==null||x.addEventListener("scroll",h),x==null||x.addEventListener("resize",h),()=>{x==null||x.removeEventListener("scroll",h),x==null||x.removeEventListener("resize",h)}},[h,r,f]),m}const an=Ze(()=>{const a=Ke(),r=Ke(),i=pe(0),o=Ke(),u=pe(0),m=Ke(),f=Ke(),h=pe(0),x=pe(0),p=pe(0),y=pe(0),g=Ke(),j=Ke(),S=pe(!1),N=pe(!1),D=pe(!1);return Ce(ce(a,je(({scrollTop:T})=>T)),r),Ce(ce(a,je(({scrollHeight:T})=>T)),f),Ce(r,u),{deviation:i,fixedFooterHeight:p,fixedHeaderHeight:x,footerHeight:y,headerHeight:h,horizontalDirection:N,scrollBy:j,scrollContainerState:a,scrollHeight:f,scrollingInProgress:S,scrollTo:g,scrollTop:r,skipAnimationFrameInResizeObserver:D,smoothScrollTargetReached:o,statefulScrollTop:u,viewportHeight:m}},[],{singleton:!0}),Ss={lvl:0};function hv(a,r){const i=a.length;if(i===0)return[];let{index:o,value:u}=r(a[0]);const m=[];for(let f=1;f<i;f++){const{index:h,value:x}=r(a[f]);m.push({end:h-1,start:o,value:u}),o=h,u=x}return m.push({end:1/0,start:o,value:u}),m}function ot(a){return a===Ss}function ks(a,r){if(!ot(a))return r===a.k?a.v:r<a.k?ks(a.l,r):ks(a.r,r)}function Gn(a,r,i="k"){if(ot(a))return[-1/0,void 0];if(Number(a[i])===r)return[a.k,a.v];if(Number(a[i])<r){const o=Gn(a.r,r,i);return o[0]===-1/0?[a.k,a.v]:o}return Gn(a.l,r,i)}function yn(a,r,i){return ot(a)?gv(r,i,1):r===a.k?Ot(a,{k:r,v:i}):r<a.k?fx(Ot(a,{l:yn(a.l,r,i)})):fx(Ot(a,{r:yn(a.r,r,i)}))}function ur(){return Ss}function dr(a,r,i){if(ot(a))return[];const o=Gn(a,r)[0];return B0(ud(a,o,i))}function cd(a,r){if(ot(a))return Ss;const{k:i,l:o,r:u}=a;if(r===i){if(ot(o))return u;if(ot(u))return o;const[m,f]=vv(o);return to(Ot(a,{k:m,l:xv(o),v:f}))}return r<i?to(Ot(a,{l:cd(o,r)})):to(Ot(a,{r:cd(u,r)}))}function gl(a){return ot(a)?[]:[...gl(a.l),{k:a.k,v:a.v},...gl(a.r)]}function ud(a,r,i){if(ot(a))return[];const{k:o,l:u,r:m,v:f}=a;let h=[];return o>r&&(h=h.concat(ud(u,r,i))),o>=r&&o<=i&&h.push({k:o,v:f}),o<=i&&(h=h.concat(ud(m,r,i))),h}function to(a){const{l:r,lvl:i,r:o}=a;if(o.lvl>=i-1&&r.lvl>=i-1)return a;if(i>o.lvl+1){if($u(r))return yv(Ot(a,{lvl:i-1}));if(!ot(r)&&!ot(r.r))return Ot(r.r,{l:Ot(r,{r:r.r.l}),lvl:i,r:Ot(a,{l:r.r.r,lvl:i-1})});throw new Error("Unexpected empty nodes")}if($u(a))return dd(Ot(a,{lvl:i-1}));if(!ot(o)&&!ot(o.l)){const u=o.l,m=$u(u)?o.lvl-1:o.lvl;return Ot(u,{l:Ot(a,{lvl:i-1,r:u.l}),lvl:u.lvl+1,r:dd(Ot(o,{l:u.r,lvl:m}))})}throw new Error("Unexpected empty nodes")}function Ot(a,r){return gv(r.k!==void 0?r.k:a.k,r.v!==void 0?r.v:a.v,r.lvl!==void 0?r.lvl:a.lvl,r.l!==void 0?r.l:a.l,r.r!==void 0?r.r:a.r)}function xv(a){return ot(a.r)?a.l:to(Ot(a,{r:xv(a.r)}))}function $u(a){return ot(a)||a.lvl>a.r.lvl}function vv(a){return ot(a.r)?[a.k,a.v]:vv(a.r)}function gv(a,r,i,o=Ss,u=Ss){return{k:a,l:o,lvl:i,r:u,v:r}}function fx(a){return dd(yv(a))}function yv(a){const{l:r}=a;return!ot(r)&&r.lvl===a.lvl?Ot(r,{r:Ot(a,{l:r.r})}):a}function dd(a){const{lvl:r,r:i}=a;return!ot(i)&&!ot(i.r)&&i.lvl===r&&i.r.lvl===r?Ot(i,{l:Ot(a,{r:i.l}),lvl:r+1}):a}function B0(a){return hv(a,({k:r,v:i})=>({index:r,value:i}))}function bv(a,r){return!!(a&&a.startIndex===r.startIndex&&a.endIndex===r.endIndex)}function ws(a,r){return!!(a&&a[0]===r[0]&&a[1]===r[1])}const Nd=Ze(()=>({recalcInProgress:pe(!1)}),[],{singleton:!0});function jv(a,r,i){return a[so(a,r,i)]}function so(a,r,i,o=0){let u=a.length-1;for(;o<=u;){const m=Math.floor((o+u)/2),f=a[m],h=i(f,r);if(h===0)return m;if(h===-1){if(u-o<2)return m-1;u=m-1}else{if(u===o)return m;o=m+1}}throw new Error(`Failed binary finding record in array - ${a.join(",")}, searched for ${r}`)}function I0(a,r,i,o){const u=so(a,r,o),m=so(a,i,o,u);return a.slice(u,m+1)}function Fa(a,r){return Math.round(a.getBoundingClientRect()[r])}function xo(a){return!ot(a.groupOffsetTree)}function Ed({index:a},r){return r===a?0:r<a?-1:1}function H0(){return{groupIndices:[],groupOffsetTree:ur(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:ur()}}function U0(a,r){let i=ot(a)?0:1/0;for(const o of r){const{endIndex:u,size:m,startIndex:f}=o;if(i=Math.min(i,f),ot(a)){a=yn(a,0,m);continue}const h=dr(a,f-1,u+1);if(h.some(F0(o)))continue;let x=!1,p=!1;for(const{end:y,start:g,value:j}of h)x?(u>=g||m===j)&&(a=cd(a,g)):(p=j!==m,x=!0),y>u&&u>=g&&j!==m&&(a=yn(a,u+1,j));p&&(a=yn(a,f,m))}return[a,i]}function V0(a){return typeof a.groupIndex<"u"}function $0({offset:a},r){return r===a?0:r<a?-1:1}function Cs(a,r,i){if(r.length===0)return 0;const{index:o,offset:u,size:m}=jv(r,a,Ed),f=a-o,h=m*f+(f-1)*i+u;return h>0?h+i:h}function Sv(a,r){if(!xo(r))return a;let i=0;for(;r.groupIndices[i]<=a+i;)i++;return a+i}function kv(a,r,i){if(V0(a))return r.groupIndices[a.groupIndex]+1;const o=a.index==="LAST"?i:a.index;let u=Sv(o,r);return u=Math.max(0,u,Math.min(i,u)),u}function G0(a,r,i,o=0){return o>0&&(r=Math.max(r,jv(a,o,Ed).offset)),hv(I0(a,r,i,$0),Y0)}function P0(a,[r,i,o,u]){r.length>0&&o("received item sizes",r,Bt.DEBUG);const m=a.sizeTree;let f=m,h=0;if(i.length>0&&ot(m)&&r.length===2){const j=r[0].size,S=r[1].size;f=i.reduce((N,D)=>yn(yn(N,D,j),D+1,S),f)}else[f,h]=U0(f,r);if(f===m)return a;const{lastIndex:x,lastOffset:p,lastSize:y,offsetTree:g}=fd(a.offsetTree,h,f,u);return{groupIndices:i,groupOffsetTree:i.reduce((j,S)=>yn(j,S,Cs(S,g,u)),ur()),lastIndex:x,lastOffset:p,lastSize:y,offsetTree:g,sizeTree:f}}function q0(a){return gl(a).map(({k:r,v:i},o,u)=>{const m=u[o+1];return{endIndex:m!==void 0?m.k-1:1/0,size:i,startIndex:r}})}function px(a,r){let i=0,o=0;for(;i<a;)i+=r[o+1]-r[o]-1,o++;return o-(i===a?0:1)}function fd(a,r,i,o){let u=a,m=0,f=0,h=0,x=0;if(r!==0){x=so(u,r-1,Ed),h=u[x].offset;const p=Gn(i,r-1);m=p[0],f=p[1],u.length&&u[x].size===Gn(i,r)[1]&&(x-=1),u=u.slice(0,x+1)}else u=[];for(const{start:p,value:y}of dr(i,r,1/0)){const g=p-m,j=g*f+h+g*o;u.push({index:p,offset:j,size:y}),m=p,h=j,f=y}return{lastIndex:m,lastOffset:h,lastSize:f,offsetTree:u}}function Y0(a){return{index:a.index,value:a}}function F0(a){const{endIndex:r,size:i,startIndex:o}=a;return u=>u.start===o&&(u.end===r||u.end===1/0)&&u.value===i}const W0={offsetHeight:"height",offsetWidth:"width"},Qn=Ze(([{log:a},{recalcInProgress:r}])=>{const i=Ke(),o=Ke(),u=Xt(o,0),m=Ke(),f=Ke(),h=pe(0),x=pe([]),p=pe(void 0),y=pe(void 0),g=pe(void 0),j=pe(void 0),S=pe((C,z)=>Fa(C,W0[z])),N=pe(void 0),D=pe(0),T=H0(),k=Xt(ce(i,$e(x,a,D),Kn(P0,T),mt()),T),M=Xt(ce(x,mt(),Kn((C,z)=>({current:z,prev:C.current}),{current:[],prev:[]}),je(({prev:C})=>C)),[]);Ce(ce(x,Ae(C=>C.length>0),$e(k,D),je(([C,z,R])=>{const I=C.reduce((P,q,ee)=>yn(P,q,Cs(q,z.offsetTree,R)||ee),ur());return{...z,groupIndices:C,groupOffsetTree:I}})),k),Ce(ce(o,$e(k),Ae(([C,{lastIndex:z}])=>C<z),je(([C,{lastIndex:z,lastSize:R}])=>[{endIndex:z,size:R,startIndex:C}])),i),Ce(p,y);const B=Xt(ce(p,je(C=>C===void 0)),!0);Ce(ce(y,Ae(C=>C!==void 0&&ot(yt(k).sizeTree)),je(C=>{const z=yt(g),R=yt(x).length>0;return z!==void 0&&z!==0?R?[{endIndex:0,size:z,startIndex:0},{endIndex:1,size:C,startIndex:1}]:[]:[{endIndex:0,size:C,startIndex:0}]})),i),Ce(ce(j,Ae(C=>C!==void 0&&C.length>0&&ot(yt(k).sizeTree)),je(C=>{const z=[];let R=C[0],I=0;for(let P=1;P<C.length;P++){const q=C[P];q!==R&&(z.push({endIndex:P-1,size:R,startIndex:I}),R=q,I=P)}return z.push({endIndex:C.length-1,size:R,startIndex:I}),z})),i),Ce(ce(x,$e(g,y),Ae(([,C,z])=>C!==void 0&&z!==void 0),je(([C,z,R])=>{const I=[];for(let P=0;P<C.length;P++){const q=C[P],ee=C[P+1];I.push({startIndex:q,endIndex:q,size:z}),ee!==void 0&&I.push({startIndex:q+1,endIndex:ee-1,size:R})}return I})),i);const V=jn(ce(i,$e(k),Kn(({sizes:C},[z,R])=>({changed:R!==C,sizes:R}),{changed:!1,sizes:T}),je(C=>C.changed)));et(ce(h,Kn((C,z)=>({diff:C.prev-z,prev:z}),{diff:0,prev:0}),je(C=>C.diff)),C=>{const{groupIndices:z}=yt(k);if(C>0)He(r,!0),He(m,C+px(C,z));else if(C<0){const R=yt(M);R.length>0&&(C-=px(-C,R)),He(f,C)}}),et(ce(h,$e(a)),([C,z])=>{C<0&&z("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:h},Bt.ERROR)});const A=jn(m);Ce(ce(m,$e(k),je(([C,z])=>{const R=z.groupIndices.length>0,I=[],P=z.lastSize;if(R){const q=ks(z.sizeTree,0);let ee=0,X=0;for(;ee<C;){const E=z.groupIndices[X],O=z.groupIndices.length===X+1?1/0:z.groupIndices[X+1]-E-1;I.push({endIndex:E,size:q,startIndex:E}),I.push({endIndex:E+1+O-1,size:P,startIndex:E+1}),X++,ee+=O+1}const _=gl(z.sizeTree);return ee!==C&&_.shift(),_.reduce((E,{k:O,v:te})=>{let Y=E.ranges;return E.prevSize!==0&&(Y=[...E.ranges,{endIndex:O+C-1,size:E.prevSize,startIndex:E.prevIndex}]),{prevIndex:O+C,prevSize:te,ranges:Y}},{prevIndex:C,prevSize:0,ranges:I}).ranges}return gl(z.sizeTree).reduce((q,{k:ee,v:X})=>({prevIndex:ee+C,prevSize:X,ranges:[...q.ranges,{endIndex:ee+C-1,size:q.prevSize,startIndex:q.prevIndex}]}),{prevIndex:0,prevSize:P,ranges:[]}).ranges})),i);const U=jn(ce(f,$e(k,D),je(([C,{offsetTree:z},R])=>{const I=-C;return Cs(I,z,R)})));return Ce(ce(f,$e(k,D),je(([C,z,R])=>{if(z.groupIndices.length>0){if(ot(z.sizeTree))return z;let P=ur();const q=yt(M);let ee=0,X=0,_=0;for(;ee<-C;){_=q[X];const E=q[X+1]-_-1;X++,ee+=E+1}if(P=gl(z.sizeTree).reduce((E,{k:O,v:te})=>yn(E,Math.max(0,O+C),te),P),ee!==-C){const E=ks(z.sizeTree,_);P=yn(P,0,E);const O=Gn(z.sizeTree,-C+1)[1];P=yn(P,1,O)}return{...z,sizeTree:P,...fd(z.offsetTree,0,P,R)}}const I=gl(z.sizeTree).reduce((P,{k:q,v:ee})=>yn(P,Math.max(0,q+C),ee),ur());return{...z,sizeTree:I,...fd(z.offsetTree,0,I,R)}})),k),{beforeUnshiftWith:A,data:N,defaultItemSize:y,firstItemIndex:h,fixedItemSize:p,fixedGroupSize:g,gap:D,groupIndices:x,heightEstimates:j,itemSize:S,listRefresh:V,shiftWith:f,shiftWithOffset:U,sizeRanges:i,sizes:k,statefulTotalCount:u,totalCount:o,trackItemSizes:B,unshiftWith:m}},ht(Ka,Nd),{singleton:!0});function K0(a){return a.reduce((r,i)=>(r.groupIndices.push(r.totalCount),r.totalCount+=i+1,r),{groupIndices:[],totalCount:0})}const wv=Ze(([{groupIndices:a,sizes:r,totalCount:i},{headerHeight:o,scrollTop:u}])=>{const m=Ke(),f=Ke(),h=jn(ce(m,je(K0)));return Ce(ce(h,je(x=>x.totalCount)),i),Ce(ce(h,je(x=>x.groupIndices)),a),Ce(ce(Lt(u,r,o),Ae(([x,p])=>xo(p)),je(([x,p,y])=>Gn(p.groupOffsetTree,Math.max(x-y,0),"v")[0]),mt(),je(x=>[x])),f),{groupCounts:m,topItemsIndexes:f}},ht(Qn,an)),Qa=Ze(([{log:a}])=>{const r=pe(!1),i=jn(ce(r,Ae(o=>o),mt()));return et(r,o=>{o&&yt(a)("props updated",{},Bt.DEBUG)}),{didMount:i,propsReady:r}},ht(Ka),{singleton:!0}),Q0=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Cv(a){const r=typeof a=="number"?{index:a}:a;return r.align||(r.align="start"),(!r.behavior||!Q0)&&(r.behavior="auto"),r.offset===void 0&&(r.offset=0),r}const Rs=Ze(([{gap:a,listRefresh:r,sizes:i,totalCount:o},{fixedFooterHeight:u,fixedHeaderHeight:m,footerHeight:f,headerHeight:h,scrollingInProgress:x,scrollTo:p,smoothScrollTargetReached:y,viewportHeight:g},{log:j}])=>{const S=Ke(),N=Ke(),D=pe(0);let T=null,k=null,M=null;function B(){T!==null&&(T(),T=null),M!==null&&(M(),M=null),k&&(clearTimeout(k),k=null),He(x,!1)}return Ce(ce(S,$e(i,g,o,D,h,f,j),$e(a,m,u),je(([[V,A,U,C,z,R,I,P],q,ee,X])=>{const _=Cv(V),{align:E,behavior:O,offset:te}=_,Y=C-1,me=kv(_,A,Y);let L=Cs(me,A.offsetTree,q)+R;E==="end"?(L+=ee+Gn(A.sizeTree,me)[1]-U+X,me===Y&&(L+=I)):E==="center"?L+=(ee+Gn(A.sizeTree,me)[1]-U+X)/2:L-=z,te!==void 0&&te!==0&&(L+=te);const F=ie=>{B(),ie?(P("retrying to scroll to",{location:V},Bt.DEBUG),He(S,V)):(He(N,!0),P("list did not change, scroll successful",{},Bt.DEBUG))};if(B(),O==="smooth"){let ie=!1;M=et(r,de=>{ie=ie||de}),T=$n(y,()=>{F(ie)})}else T=$n(ce(r,X0(150)),F);return k=setTimeout(()=>{B()},1200),He(x,!0),P("scrolling from index to",{behavior:O,index:me,top:L},Bt.DEBUG),{behavior:O,top:L}})),p),{scrollTargetReached:N,scrollToIndex:S,topListHeight:D}},ht(Qn,an,Ka),{singleton:!0});function X0(a){return r=>{const i=setTimeout(()=>{r(!1)},a);return o=>{o&&(r(!0),clearTimeout(i))}}}function Td(a,r){a===0?r():requestAnimationFrame(()=>{Td(a-1,r)})}function Rd(a,r){const i=r-1;return typeof a=="number"?a:a.index==="LAST"?i:a.index}const As=Ze(([{defaultItemSize:a,listRefresh:r,sizes:i},{scrollTop:o},{scrollTargetReached:u,scrollToIndex:m},{didMount:f}])=>{const h=pe(!0),x=pe(0),p=pe(!0);return Ce(ce(f,$e(x),Ae(([y,g])=>g!==0),Wn(!1)),h),Ce(ce(f,$e(x),Ae(([y,g])=>g!==0),Wn(!1)),p),et(ce(Lt(r,f),$e(h,i,a,p),Ae(([[,y],g,{sizeTree:j},S,N])=>y&&(!ot(j)||kd(S))&&!g&&!N),$e(x)),([,y])=>{$n(u,()=>{He(p,!0)}),Td(4,()=>{$n(o,()=>{He(h,!0)}),He(m,y)})}),{initialItemFinalLocationReached:p,initialTopMostItemIndex:x,scrolledToInitialItem:h}},ht(Qn,an,Rs,Qa),{singleton:!0});function Nv(a,r){return Math.abs(a-r)<1.01}const Ns="up",ys="down",Z0="none",J0={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},ej=0,Ms=Ze(([{footerHeight:a,headerHeight:r,scrollBy:i,scrollContainerState:o,scrollTop:u,viewportHeight:m}])=>{const f=pe(!1),h=pe(!0),x=Ke(),p=Ke(),y=pe(4),g=pe(ej),j=Xt(ce(od(ce(Re(u),yl(1),Wn(!0)),ce(Re(u),yl(1),Wn(!1),ux(100))),mt()),!1),S=Xt(ce(od(ce(i,Wn(!0)),ce(i,Wn(!1),ux(200))),mt()),!1);Ce(ce(Lt(Re(u),Re(g)),je(([M,B])=>M<=B),mt()),h),Ce(ce(h,va(50)),p);const N=jn(ce(Lt(o,Re(m),Re(r),Re(a),Re(y)),Kn((M,[{scrollHeight:B,scrollTop:V},A,U,C,z])=>{const R=V+A-B>-z,I={scrollHeight:B,scrollTop:V,viewportHeight:A};if(R){let q,ee;return V>M.state.scrollTop?(q="SCROLLED_DOWN",ee=M.state.scrollTop-V):(q="SIZE_DECREASED",ee=M.state.scrollTop-V||M.scrollTopDelta),{atBottom:!0,atBottomBecause:q,scrollTopDelta:ee,state:I}}let P;return I.scrollHeight>M.state.scrollHeight?P="SIZE_INCREASED":A<M.state.viewportHeight?P="VIEWPORT_HEIGHT_DECREASING":V<M.state.scrollTop?P="SCROLLING_UPWARDS":P="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:P,state:I}},J0),mt((M,B)=>M!==void 0&&M.atBottom===B.atBottom))),D=Xt(ce(o,Kn((M,{scrollHeight:B,scrollTop:V,viewportHeight:A})=>{if(!Nv(M.scrollHeight,B)){const U=B-(V+A)<1;return M.scrollTop!==V&&U?{changed:!0,jump:M.scrollTop-V,scrollHeight:B,scrollTop:V}:{changed:!0,jump:0,scrollHeight:B,scrollTop:V}}return{changed:!1,jump:0,scrollHeight:B,scrollTop:V}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Ae(M=>M.changed),je(M=>M.jump)),0);Ce(ce(N,je(M=>M.atBottom)),f),Ce(ce(f,va(50)),x);const T=pe(ys);Ce(ce(o,je(({scrollTop:M})=>M),mt(),Kn((M,B)=>yt(S)?{direction:M.direction,prevScrollTop:B}:{direction:B<M.prevScrollTop?Ns:ys,prevScrollTop:B},{direction:ys,prevScrollTop:0}),je(M=>M.direction)),T),Ce(ce(o,va(50),Wn(Z0)),T);const k=pe(0);return Ce(ce(j,Ae(M=>!M),Wn(0)),k),Ce(ce(u,va(100),$e(j),Ae(([M,B])=>B),Kn(([M,B],[V])=>[B,V],[0,0]),je(([M,B])=>B-M)),k),{atBottomState:N,atBottomStateChange:x,atBottomThreshold:y,atTopStateChange:p,atTopThreshold:g,isAtBottom:f,isAtTop:h,isScrolling:j,lastJumpDueToItemResize:D,scrollDirection:T,scrollVelocity:k}},ht(an)),Es="top",Ts="bottom",mx="none";function hx(a,r,i){return typeof a=="number"?i===Ns&&r===Es||i===ys&&r===Ts?a:0:i===Ns?r===Es?a.main:a.reverse:r===Ts?a.main:a.reverse}function xx(a,r){return typeof a=="number"?a:a[r]??0}const Ad=Ze(([{deviation:a,fixedHeaderHeight:r,headerHeight:i,scrollTop:o,viewportHeight:u}])=>{const m=Ke(),f=pe(0),h=pe(0),x=pe(0),p=Xt(ce(Lt(Re(o),Re(u),Re(i),Re(m,ws),Re(x),Re(f),Re(r),Re(a),Re(h)),je(([y,g,j,[S,N],D,T,k,M,B])=>{const V=y-M,A=T+k,U=Math.max(j-V,0);let C=mx;const z=xx(B,Es),R=xx(B,Ts);return S-=M,S+=j+k,N+=j+k,N-=M,S>y+A-z&&(C=Ns),N<y-U+g+R&&(C=ys),C!==mx?[Math.max(V-j-hx(D,Es,C)-z,0),V-U-k+g+hx(D,Ts,C)+R]:null}),Ae(y=>y!==null),mt(ws)),[0,0]);return{increaseViewportBy:h,listBoundary:m,overscan:x,topListHeight:f,visibleRange:p}},ht(an),{singleton:!0});function tj(a,r,i){if(xo(r)){const o=Sv(a,r);return[{index:Gn(r.groupOffsetTree,o)[0],offset:0,size:0},{data:i==null?void 0:i[0],index:o,offset:0,size:0}]}return[{data:i==null?void 0:i[0],index:a,offset:0,size:0}]}const Gu={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function no(a,r,i,o,u,m){const{lastIndex:f,lastOffset:h,lastSize:x}=u;let p=0,y=0;if(a.length>0){p=a[0].offset;const D=a[a.length-1];y=D.offset+D.size}const g=i-f,j=h+g*x+(g-1)*o,S=p,N=j-y;return{bottom:y,firstItemIndex:m,items:vx(a,u,m),offsetBottom:N,offsetTop:p,top:S,topItems:vx(r,u,m),topListHeight:r.reduce((D,T)=>T.size+D,0),totalCount:i}}function Ev(a,r,i,o,u,m){let f=0;if(i.groupIndices.length>0)for(const y of i.groupIndices){if(y-f>=a)break;f++}const h=a+f,x=Rd(r,h),p=Array.from({length:h}).map((y,g)=>({data:m[g+x],index:g+x,offset:0,size:0}));return no(p,[],h,u,i,o)}function vx(a,r,i){if(a.length===0)return[];if(!xo(r))return a.map(p=>({...p,index:p.index+i,originalIndex:p.index}));const o=a[0].index,u=a[a.length-1].index,m=[],f=dr(r.groupOffsetTree,o,u);let h,x=0;for(const p of a){(!h||h.end<p.index)&&(h=f.shift(),x=r.groupIndices.indexOf(h.start));let y;p.index===h.start?y={index:x,type:"group"}:y={groupIndex:x,index:p.index-(x+1)+i},m.push({...y,data:p.data,offset:p.offset,originalIndex:p.index,size:p.size})}return m}function gx(a,r){return a===void 0?0:typeof a=="number"?a:a[r]??0}const Sl=Ze(([{data:a,firstItemIndex:r,gap:i,sizes:o,totalCount:u},m,{listBoundary:f,topListHeight:h,visibleRange:x},{initialTopMostItemIndex:p,scrolledToInitialItem:y},{topListHeight:g},j,{didMount:S},{recalcInProgress:N}])=>{const D=pe([]),T=pe(0),k=Ke(),M=pe(0);Ce(m.topItemsIndexes,D);const B=Xt(ce(Lt(S,N,Re(x,ws),Re(u),Re(o),Re(p),y,Re(D),Re(r),Re(i),Re(M),a),Ae(([C,z,,R,,,,,,,,I])=>{const P=I!==void 0&&I.length!==R;return C&&!z&&!P}),je(([,,[C,z],R,I,P,q,ee,X,_,E,O])=>{var ve,Ue;const te=I,{offsetTree:Y,sizeTree:me}=te,L=yt(T);if(R===0)return{...Gu,totalCount:R};if(C===0&&z===0)return L===0?{...Gu,totalCount:R}:Ev(L,P,I,X,_,O||[]);if(ot(me))return L>0?null:no(tj(Rd(P,R),te,O),[],R,_,te,X);const F=[];if(ee.length>0){const Be=ee[0],ae=ee[ee.length-1];let fe=0;for(const ue of dr(me,Be,ae)){const he=ue.value,be=Math.max(ue.start,Be),_e=Math.min(ue.end,ae);for(let Me=be;Me<=_e;Me++)F.push({data:O==null?void 0:O[Me],index:Me,offset:fe,size:he}),fe+=he}}if(!q)return no([],F,R,_,te,X);const ie=ee.length>0?ee[ee.length-1]+1:0,de=G0(Y,C,z,ie);if(de.length===0)return null;const ge=R-1,xe=ho([],Be=>{for(const ae of de){const fe=ae.value;let ue=fe.offset,he=ae.start;const be=fe.size;if(fe.offset<C){he+=Math.floor((C-fe.offset+_)/(be+_));const Me=he-ae.start;ue+=Me*be+Me*_}he<ie&&(ue+=(ie-he)*be,he=ie);const _e=Math.min(ae.end,ge);for(let Me=he;Me<=_e&&!(ue>=z);Me++)Be.push({data:O==null?void 0:O[Me],index:Me,offset:ue,size:be}),ue+=be+_}}),oe=gx(E,Es),le=gx(E,Ts);if(xe.length>0&&(oe>0||le>0)){const Be=xe[0],ae=xe[xe.length-1];if(oe>0&&Be.index>ie){const fe=Math.min(oe,Be.index-ie),ue=[];let he=Be.offset;for(let be=Be.index-1;be>=Be.index-fe;be--){const _e=((ve=dr(me,be,be)[0])==null?void 0:ve.value)??Be.size;he-=_e+_,ue.unshift({data:O==null?void 0:O[be],index:be,offset:he,size:_e})}xe.unshift(...ue)}if(le>0&&ae.index<ge){const fe=Math.min(le,ge-ae.index);let ue=ae.offset+ae.size+_;for(let he=ae.index+1;he<=ae.index+fe;he++){const be=((Ue=dr(me,he,he)[0])==null?void 0:Ue.value)??ae.size;xe.push({data:O==null?void 0:O[he],index:he,offset:ue,size:be}),ue+=be+_}}}return no(xe,F,R,_,te,X)}),Ae(C=>C!==null),mt()),Gu);Ce(ce(a,Ae(kd),je(C=>C==null?void 0:C.length)),u),Ce(ce(B,je(C=>C.topListHeight)),g),Ce(g,h),Ce(ce(B,je(C=>[C.top,C.bottom])),f),Ce(ce(B,je(C=>C.items)),k);const V=jn(ce(B,Ae(({items:C})=>C.length>0),$e(u,a),Ae(([{items:C},z])=>C[C.length-1].originalIndex===z-1),je(([,C,z])=>[C-1,z]),mt(ws),je(([C])=>C))),A=jn(ce(B,va(200),Ae(({items:C,topItems:z})=>C.length>0&&C[0].originalIndex===z.length),je(({items:C})=>C[0].index),mt())),U=jn(ce(B,Ae(({items:C})=>C.length>0),je(({items:C})=>{let z=0,R=C.length-1;for(;C[z].type==="group"&&z<R;)z++;for(;C[R].type==="group"&&R>z;)R--;return{endIndex:C[R].index,startIndex:C[z].index}}),mt(bv)));return{endReached:V,initialItemCount:T,itemsRendered:k,listState:B,minOverscanItemCount:M,rangeChanged:U,startReached:A,topItemsIndexes:D,...j}},ht(Qn,wv,Ad,As,Rs,Ms,Qa,Nd),{singleton:!0}),Tv=Ze(([{fixedFooterHeight:a,fixedHeaderHeight:r,footerHeight:i,headerHeight:o},{listState:u}])=>{const m=Ke(),f=Xt(ce(Lt(i,a,o,r,u),je(([h,x,p,y,g])=>h+x+p+y+g.offsetBottom+g.bottom)),0);return Ce(Re(f),m),{totalListHeight:f,totalListHeightChanged:m}},ht(an,Sl),{singleton:!0}),nj=Ze(([{viewportHeight:a},{totalListHeight:r}])=>{const i=pe(!1),o=Xt(ce(Lt(i,a,r),Ae(([u])=>u),je(([,u,m])=>Math.max(0,u-m)),va(0),mt()),0);return{alignToBottom:i,paddingTopAddition:o}},ht(an,Tv),{singleton:!0}),Rv=Ze(()=>({context:pe(null)})),aj=({itemBottom:a,itemTop:r,locationParams:{align:i,behavior:o,...u},viewportBottom:m,viewportTop:f})=>r<f?{...u,align:i??"start",...o!==void 0?{behavior:o}:{}}:a>m?{...u,align:i??"end",...o!==void 0?{behavior:o}:{}}:null,Av=Ze(([{gap:a,sizes:r,totalCount:i},{fixedFooterHeight:o,fixedHeaderHeight:u,headerHeight:m,scrollingInProgress:f,scrollTop:h,viewportHeight:x},{scrollToIndex:p}])=>{const y=Ke();return Ce(ce(y,$e(r,x,i,m,u,o,h),$e(a),je(([[g,j,S,N,D,T,k,M],B])=>{const{calculateViewLocation:V=aj,done:A,...U}=g,C=kv(g,j,N-1),z=Cs(C,j.offsetTree,B)+D+T,R=z+Gn(j.sizeTree,C)[1],I=M+T,P=M+S-k,q=V({itemBottom:R,itemTop:z,locationParams:U,viewportBottom:P,viewportTop:I});return q!==null?A&&$n(ce(f,Ae(ee=>!ee),yl(yt(f)?1:2)),A):A==null||A(),q}),Ae(g=>g!==null)),p),{scrollIntoView:y}},ht(Qn,an,Rs,Sl,Ka),{singleton:!0});function yx(a){return a===!1?!1:a==="smooth"?"smooth":"auto"}const lj=(a,r)=>typeof a=="function"?yx(a(r)):r&&yx(a),rj=Ze(([{listRefresh:a,totalCount:r,fixedItemSize:i,data:o},{atBottomState:u,isAtBottom:m},{scrollToIndex:f},{scrolledToInitialItem:h},{didMount:x,propsReady:p},{log:y},{scrollingInProgress:g},{context:j},{scrollIntoView:S}])=>{const N=pe(!1),D=Ke();let T=null;function k(A){He(f,{align:"end",behavior:A,index:"LAST"})}et(ce(Lt(ce(Re(r),yl(1)),x),$e(Re(N),m,h,g),je(([[A,U],C,z,R,I])=>{let P=U&&R,q="auto";return P&&(q=lj(C,z||I),P=P&&q!==!1),{followOutputBehavior:q,shouldFollow:P,totalCount:A}}),Ae(({shouldFollow:A})=>A)),({followOutputBehavior:A,totalCount:U})=>{T!==null&&(T(),T=null),yt(i)!==void 0?requestAnimationFrame(()=>{yt(y)("following output to ",{totalCount:U},Bt.DEBUG),k(A)}):T=$n(a,()=>{yt(y)("following output to ",{totalCount:U},Bt.DEBUG),k(A),T=null})});function M(A){const U=$n(u,C=>{A&&!C.atBottom&&C.notAtBottomBecause==="SIZE_INCREASED"&&T===null&&(yt(y)("scrolling to bottom due to increased size",{},Bt.DEBUG),k("auto"))});setTimeout(U,100)}et(ce(Lt(Re(N),r,p),Ae(([A,,U])=>A!==!1&&U),Kn(({value:A},[,U])=>({refreshed:A===U,value:U}),{refreshed:!1,value:0}),Ae(({refreshed:A})=>A),$e(N,r)),([,A])=>{yt(h)&&M(A!==!1)}),et(D,()=>{M(yt(N)!==!1)}),et(Lt(Re(N),u),([A,U])=>{A!==!1&&!U.atBottom&&U.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&k("auto")});const B=pe(null),V=Ke();return Ce(od(ce(Re(o),je(A=>(A==null?void 0:A.length)??0)),ce(Re(r))),V),et(ce(Lt(ce(V,yl(1)),x),$e(Re(B),h,g,j),je(([[A,U],C,z,R,I])=>U&&z&&(C==null?void 0:C({context:I,totalCount:A,scrollingInProgress:R}))),Ae(A=>!!A),va(0)),A=>{T!==null&&(T(),T=null),yt(i)!==void 0?requestAnimationFrame(()=>{yt(y)("scrolling into view",{}),He(S,A)}):T=$n(a,()=>{yt(y)("scrolling into view",{}),He(S,A),T=null})}),{autoscrollToBottom:D,followOutput:N,scrollIntoViewOnChange:B}},ht(Qn,Ms,Rs,As,Qa,Ka,an,Rv,Av)),sj=Ze(([{data:a,firstItemIndex:r,gap:i,sizes:o},{initialTopMostItemIndex:u},{initialItemCount:m,listState:f},{didMount:h}])=>(Ce(ce(h,$e(m),Ae(([,x])=>x!==0),$e(u,o,r,i,a),je(([[,x],p,y,g,j,S=[]])=>Ev(x,p,y,g,j,S))),f),{}),ht(Qn,As,Sl,Qa),{singleton:!0}),ij=Ze(([{didMount:a},{scrollTo:r},{listState:i}])=>{const o=pe(0);return et(ce(a,$e(o),Ae(([,u])=>u!==0),je(([,u])=>({top:u}))),u=>{$n(ce(i,yl(1),Ae(m=>m.items.length>1)),()=>{requestAnimationFrame(()=>{He(r,u)})})}),{initialScrollTop:o}},ht(Qa,an,Sl),{singleton:!0}),Mv=Ze(([{scrollVelocity:a}])=>{const r=pe(!1),i=Ke(),o=pe(!1);return Ce(ce(a,$e(o,r,i),Ae(([u,m])=>m!==!1&&m!==void 0),je(([u,m,f,h])=>{const{enter:x,exit:p}=m;if(f){if(p(u,h))return!1}else if(x(u,h))return!0;return f}),mt()),r),et(ce(Lt(r,a,i),$e(o)),([[u,m,f],h])=>{u&&h!==!1&&h!==void 0&&h.change&&h.change(m,f)}),{isSeeking:r,scrollSeekConfiguration:o,scrollSeekRangeChanged:i,scrollVelocity:a}},ht(Ms),{singleton:!0}),Md=Ze(([{scrollContainerState:a,scrollTo:r}])=>{const i=Ke(),o=Ke(),u=Ke(),m=pe(!1),f=pe(void 0);return Ce(ce(Lt(i,o),je(([{scrollTop:h,viewportHeight:x},{offsetTop:p,listHeight:y}])=>({scrollHeight:y,scrollTop:Math.max(0,h-p),viewportHeight:x}))),a),Ce(ce(r,$e(o),je(([h,{offsetTop:x}])=>({...h,top:h.top+x}))),u),{customScrollParent:f,useWindowScroll:m,windowScrollContainerState:i,windowScrollTo:u,windowViewportRect:o}},ht(an)),oj=Ze(([{sizeRanges:a,sizes:r},{headerHeight:i,scrollTop:o},{initialTopMostItemIndex:u},{didMount:m},{useWindowScroll:f,windowScrollContainerState:h,windowViewportRect:x}])=>{const p=Ke(),y=pe(void 0),g=pe(null),j=pe(null);return Ce(h,g),Ce(x,j),et(ce(p,$e(r,o,f,g,j,i)),([S,N,D,T,k,M,B])=>{const V=q0(N.sizeTree);T&&k!==null&&M!==null&&(D=k.scrollTop-M.offsetTop),D-=B,S({ranges:V,scrollTop:D})}),Ce(ce(y,Ae(kd),je(cj)),u),Ce(ce(m,$e(y),Ae(([,S])=>S!==void 0),mt(),je(([,S])=>S.ranges)),a),{getState:p,restoreStateFrom:y}},ht(Qn,an,As,Qa,Md));function cj(a){return{align:"start",index:0,offset:a.scrollTop}}const uj=Ze(([{topItemsIndexes:a}])=>{const r=pe(0);return Ce(ce(r,Ae(i=>i>=0),je(i=>Array.from({length:i}).map((o,u)=>u))),a),{topItemCount:r}},ht(Sl));function Dv(a){let r=!1,i;return(()=>(r||(r=!0,i=a()),i))}const dj=Dv(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),fj=Ze(([{deviation:a,scrollBy:r,scrollingInProgress:i,scrollTop:o},{isAtBottom:u,isScrolling:m,lastJumpDueToItemResize:f,scrollDirection:h},{listState:x},{beforeUnshiftWith:p,gap:y,shiftWithOffset:g,sizes:j},{log:S},{recalcInProgress:N}])=>{const D=jn(ce(x,$e(f),Kn(([,k,M,B],[{bottom:V,items:A,offsetBottom:U,totalCount:C},z])=>{const R=V+U;let I=0;return M===C&&k.length>0&&A.length>0&&(A[0].originalIndex===0&&k[0].originalIndex===0||(I=R-B,I!==0&&(I+=z))),[I,A,C,R]},[0,[],0,0]),Ae(([k])=>k!==0),$e(o,h,i,u,S,N),Ae(([,k,M,B,,,V])=>!V&&!B&&k!==0&&M===Ns),je(([[k],,,,,M])=>(M("Upward scrolling compensation",{amount:k},Bt.DEBUG),k))));function T(k){k>0?(He(r,{behavior:"auto",top:-k}),He(a,0)):(He(a,0),He(r,{behavior:"auto",top:-k}))}return et(ce(D,$e(a,m)),([k,M,B])=>{B&&dj()?He(a,M-k):T(-k)}),et(ce(Lt(Xt(m,!1),a,N),Ae(([k,M,B])=>!k&&!B&&M!==0),je(([k,M])=>M),va(1)),T),Ce(ce(g,je(k=>({top:-k}))),r),et(ce(p,$e(j,y),je(([k,{groupIndices:M,lastSize:B,sizeTree:V},A])=>{function U(P){return P*(B+A)}if(M.length===0)return U(k);let C=0;const z=ks(V,0);let R=0,I=0;for(;R<k;){R++,C+=z;let P=M.length===I+1?1/0:M[I+1]-M[I]-1;R+P>k&&(C-=z,P=k-R+1),R+=P,C+=U(P),I++}return C})),k=>{He(a,k),requestAnimationFrame(()=>{He(r,{top:k}),requestAnimationFrame(()=>{He(a,0),He(N,!1)})})}),{deviation:a}},ht(an,Ms,Sl,Qn,Ka,Nd)),pj=Ze(([a,r,i,o,u,m,f,h,x,p,y])=>({...a,...r,...i,...o,...u,...m,...f,...h,...x,...p,...y}),ht(Ad,sj,Qa,Mv,Tv,ij,nj,Md,Av,Ka,Rv)),zv=Ze(([{data:a,defaultItemSize:r,firstItemIndex:i,fixedItemSize:o,fixedGroupSize:u,gap:m,groupIndices:f,heightEstimates:h,itemSize:x,sizeRanges:p,sizes:y,statefulTotalCount:g,totalCount:j,trackItemSizes:S},{initialItemFinalLocationReached:N,initialTopMostItemIndex:D,scrolledToInitialItem:T},k,M,B,V,{scrollToIndex:A},U,{topItemCount:C},{groupCounts:z},R])=>{const{listState:I,minOverscanItemCount:P,topItemsIndexes:q,rangeChanged:ee,...X}=V;return Ce(ee,R.scrollSeekRangeChanged),Ce(ce(R.windowViewportRect,je(_=>_.visibleHeight)),k.viewportHeight),{data:a,defaultItemHeight:r,firstItemIndex:i,fixedItemHeight:o,fixedGroupHeight:u,gap:m,groupCounts:z,heightEstimates:h,initialItemFinalLocationReached:N,initialTopMostItemIndex:D,scrolledToInitialItem:T,sizeRanges:p,topItemCount:C,topItemsIndexes:q,totalCount:j,...B,groupIndices:f,itemSize:x,listState:I,minOverscanItemCount:P,scrollToIndex:A,statefulTotalCount:g,trackItemSizes:S,rangeChanged:ee,...X,...R,...k,sizes:y,...M}},ht(Qn,As,an,oj,rj,Sl,Rs,fj,uj,wv,pj));function mj(a,r){const i={},o={};let u=0;const m=a.length;for(;u<m;)o[a[u]]=1,u+=1;for(const f in r)Object.hasOwn(o,f)||(i[f]=r[f]);return i}const Fi=typeof document<"u"?we.useLayoutEffect:we.useEffect;function Lv(a,r,i){const o=Object.keys(r.required||{}),u=Object.keys(r.optional||{}),m=Object.keys(r.methods||{}),f=Object.keys(r.events||{}),h=we.createContext({});function x(T,k){T.propsReady!==void 0&&He(T.propsReady,!1);for(const M of o){const B=T[r.required[M]];He(B,k[M])}for(const M of u)if(M in k){const B=T[r.optional[M]];He(B,k[M])}T.propsReady!==void 0&&He(T.propsReady,!0)}function p(T){return m.reduce((k,M)=>(k[M]=B=>{const V=T[r.methods[M]];He(V,B)},k),{})}function y(T){return f.reduce((k,M)=>(k[M]=A0(T[r.events[M]]),k),{})}const g=we.forwardRef(function(T,k){const{children:M,...B}=T,[V]=we.useState(()=>ho(D0(a),C=>{x(C,B)})),[A]=we.useState(cx(y,V));Fi(()=>{for(const C of f)C in B&&et(A[C],B[C]);return()=>{Object.values(A).map(wd)}},[B,A,V]),Fi(()=>{x(V,B)}),we.useImperativeHandle(k,ox(p(V)));const U=i;return n.jsx(h.Provider,{value:V,children:i!==void 0?n.jsx(U,{...mj([...o,...u,...f],B),children:M}):M})}),j=T=>{const k=we.useContext(h);return we.useCallback(M=>{He(k[T],M)},[k,T])},S=T=>{const k=we.useContext(h)[T],M=we.useCallback(B=>et(k,B),[k]);return we.useSyncExternalStore(M,()=>yt(k),()=>yt(k))},N=T=>{const k=we.useContext(h)[T],[M,B]=we.useState(cx(yt,k));return Fi(()=>et(k,V=>{V!==M&&B(ox(V))}),[k,M]),M},D=parseInt(we.version)>=18?S:N;return{Component:g,useEmitter:(T,k)=>{const M=we.useContext(h)[T];Fi(()=>et(M,k),[k,M])},useEmitterValue:D,usePublisher:j}}const _v=we.createContext(void 0),Ov=we.createContext(void 0),Pu="-webkit-sticky",bx="sticky",Dd=Dv(()=>{if(typeof document>"u")return bx;const a=document.createElement("div");return a.style.position=Pu,a.style.position===Pu?Pu:bx}),Bv=typeof document<"u"?we.useLayoutEffect:we.useEffect;function qu(a){return"self"in a}function hj(a){return"body"in a}function Iv(a,r,i,o=vr,u,m){const f=we.useRef(null),h=we.useRef(null),x=we.useRef(null),p=we.useCallback(j=>{let S,N,D;const T=j.target;if(hj(T)||qu(T)){const M=qu(T)?T:T.defaultView;D=m===!0?M.scrollX:M.scrollY,S=m===!0?M.document.documentElement.scrollWidth:M.document.documentElement.scrollHeight,N=m===!0?M.innerWidth:M.innerHeight}else D=m===!0?T.scrollLeft:T.scrollTop,S=m===!0?T.scrollWidth:T.scrollHeight,N=m===!0?T.offsetWidth:T.offsetHeight;const k=()=>{a({scrollHeight:S,scrollTop:Math.max(D,0),viewportHeight:N})};j.suppressFlushSync===!0?k():fb.flushSync(k),h.current!==null&&(D===h.current||D<=0||D===S-N)&&(h.current=null,r(!0),x.current&&(clearTimeout(x.current),x.current=null))},[a,r,m]);we.useEffect(()=>{const j=u||f.current;return o(u||f.current),p({suppressFlushSync:!0,target:j}),j.addEventListener("scroll",p,{passive:!0}),()=>{o(null),j.removeEventListener("scroll",p)}},[f,p,i,o,u]);function y(j){const S=f.current;if(!S||(m===!0?"offsetWidth"in S&&S.offsetWidth===0:"offsetHeight"in S&&S.offsetHeight===0))return;const N=j.behavior==="smooth";let D,T,k;qu(S)?(T=Math.max(Fa(S.document.documentElement,m===!0?"width":"height"),m===!0?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight),D=m===!0?S.innerWidth:S.innerHeight,k=m===!0?window.scrollX:window.scrollY):(T=S[m===!0?"scrollWidth":"scrollHeight"],D=Fa(S,m===!0?"width":"height"),k=S[m===!0?"scrollLeft":"scrollTop"]);const M=T-D;if(j.top=Math.ceil(Math.max(Math.min(M,j.top),0)),Nv(D,T)||j.top===k){a({scrollHeight:T,scrollTop:k,viewportHeight:D}),N&&r(!0);return}N?(h.current=j.top,x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{x.current=null,h.current=null,r(!0)},1e3)):h.current=null,m===!0&&(j={...j.behavior!==void 0?{behavior:j.behavior}:{},left:j.top}),S.scrollTo(j)}function g(j){m===!0&&(j={...j.behavior!==void 0?{behavior:j.behavior}:{},...j.top!==void 0?{left:j.top}:{}}),f.current.scrollBy(j)}return{scrollByCallback:g,scrollerRef:f,scrollToCallback:y}}function zd(a){return a}const xj=Ze(()=>{const a=pe(h=>`Item ${h}`),r=pe(h=>`Group ${h}`),i=pe({}),o=pe(zd),u=pe("div"),m=pe(vr),f=(h,x=null)=>Xt(ce(i,je(p=>p[h]),mt()),x);return{components:i,computeItemKey:o,EmptyPlaceholder:f("EmptyPlaceholder"),FooterComponent:f("Footer"),GroupComponent:f("Group","div"),groupContent:r,HeaderComponent:f("Header"),HeaderFooterTag:u,ItemComponent:f("Item","div"),itemContent:a,ListComponent:f("List","div"),ScrollerComponent:f("Scroller","div"),scrollerRef:m,ScrollSeekPlaceholder:f("ScrollSeekPlaceholder"),TopItemListComponent:f("TopItemList")}}),vj=Ze(([a,r])=>({...a,...r}),ht(zv,xj)),gj=({height:a})=>n.jsx("div",{style:{height:a}}),yj={overflowAnchor:"none",position:Dd(),zIndex:1},Hv={overflowAnchor:"none"},bj={...Hv,display:"inline-block",height:"100%"},jx=we.memo(function({showTopList:a=!1}){const r=Le("listState"),i=_n("sizeRanges"),o=Le("useWindowScroll"),u=Le("customScrollParent"),m=_n("windowScrollContainerState"),f=_n("scrollContainerState"),h=u||o?m:f,x=Le("itemContent"),p=Le("context"),y=Le("groupContent"),g=Le("trackItemSizes"),j=Le("itemSize"),S=Le("log"),N=_n("gap"),D=Le("horizontalDirection"),{callbackRef:T}=_0(i,j,g,a?vr:h,S,N,u,D,Le("skipAnimationFrameInResizeObserver")),[k,M]=we.useState(0);Ld("deviation",X=>{k!==X&&M(X)});const B=Le("EmptyPlaceholder"),V=Le("ScrollSeekPlaceholder")??gj,A=Le("ListComponent"),U=Le("ItemComponent"),C=Le("GroupComponent"),z=Le("computeItemKey"),R=Le("isSeeking"),I=Le("groupIndices").length>0,P=Le("alignToBottom"),q=Le("initialItemFinalLocationReached"),ee=a?{}:{boxSizing:"border-box",...D?{display:"inline-block",height:"100%",marginLeft:k!==0?k:P?"auto":0,paddingLeft:r.offsetTop,paddingRight:r.offsetBottom,whiteSpace:"nowrap"}:{marginTop:k!==0?k:P?"auto":0,paddingBottom:r.offsetBottom,paddingTop:r.offsetTop},...q?{}:{visibility:"hidden"}};return!a&&r.totalCount===0&&B!==null&&B!==void 0?n.jsx(B,{...Qt(B,p)}):n.jsx(A,{...Qt(A,p),"data-testid":a?"virtuoso-top-item-list":"virtuoso-item-list",ref:T,style:ee,children:(a?r.topItems:r.items).map(X=>{const _=X.originalIndex,E=z(_+r.firstItemIndex,X.data,p);return R?v.createElement(V,{...Qt(V,p),height:X.size,index:X.index,key:E,type:X.type||"item",...X.type==="group"?{}:{groupIndex:X.groupIndex}}):X.type==="group"?v.createElement(C,{...Qt(C,p),"data-index":_,"data-item-index":X.index,"data-known-size":X.size,key:E,style:yj},y(X.index,p)):v.createElement(U,{...Qt(U,p),...wj(U,X.data),"data-index":_,"data-item-group-index":X.groupIndex,"data-item-index":X.index,"data-known-size":X.size,key:E,style:D?bj:Hv},I?x(X.index,X.groupIndex,X.data,p):x(X.index,X.data,p))})})}),jj={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Sj={outline:"none",overflowX:"auto",position:"relative"},vo=a=>({height:"100%",position:"absolute",top:0,width:"100%",...a?{display:"flex",flexDirection:"column"}:void 0}),kj={position:Dd(),top:0,width:"100%",zIndex:1};function Qt(a,r){if(typeof a!="string")return{context:r}}function wj(a,r){return{item:typeof a=="string"?void 0:r}}const Cj=we.memo(function(){const a=Le("HeaderComponent"),r=_n("headerHeight"),i=Le("HeaderFooterTag"),o=jl(we.useMemo(()=>m=>{r(Fa(m,"height"))},[r]),!0,Le("skipAnimationFrameInResizeObserver")),u=Le("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,u)})}):null}),Nj=we.memo(function(){const a=Le("FooterComponent"),r=_n("footerHeight"),i=Le("HeaderFooterTag"),o=jl(we.useMemo(()=>m=>{r(Fa(m,"height"))},[r]),!0,Le("skipAnimationFrameInResizeObserver")),u=Le("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,u)})}):null});function Uv({useEmitter:a,useEmitterValue:r,usePublisher:i}){return we.memo(function({children:o,style:u,context:m,...f}){const h=i("scrollContainerState"),x=r("ScrollerComponent"),p=i("smoothScrollTargetReached"),y=r("scrollerRef"),g=r("horizontalDirection")||!1,{scrollByCallback:j,scrollerRef:S,scrollToCallback:N}=Iv(h,p,x,y,void 0,g);return a("scrollTo",N),a("scrollBy",j),n.jsx(x,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:S,style:{...g?Sj:jj,...u},tabIndex:0,...f,...Qt(x,m),children:o})})}function Vv({useEmitter:a,useEmitterValue:r,usePublisher:i}){return we.memo(function({children:o,style:u,context:m,...f}){const h=i("windowScrollContainerState"),x=r("ScrollerComponent"),p=i("smoothScrollTargetReached"),y=r("totalListHeight"),g=r("deviation"),j=r("customScrollParent"),S=we.useRef(null),N=r("scrollerRef"),{scrollByCallback:D,scrollerRef:T,scrollToCallback:k}=Iv(h,p,x,N,j);return Bv(()=>{var M;return T.current=j||((M=S.current)==null?void 0:M.ownerDocument.defaultView),()=>{T.current=null}},[T,j]),a("windowScrollTo",k),a("scrollBy",D),n.jsx(x,{ref:S,"data-virtuoso-scroller":!0,style:{position:"relative",...u,...y!==0?{height:y+g}:void 0},...f,...Qt(x,m),children:o})})}const Ej=({children:a})=>{const r=we.useContext(_v),i=_n("viewportHeight"),o=_n("fixedItemHeight"),u=Le("alignToBottom"),m=Le("horizontalDirection"),f=we.useMemo(()=>fv(i,x=>Fa(x,m?"width":"height")),[i,m]),h=jl(f,!0,Le("skipAnimationFrameInResizeObserver"));return we.useEffect(()=>{r&&(i(r.viewportHeight),o(r.itemHeight))},[r,i,o]),n.jsx("div",{"data-viewport-type":"element",ref:h,style:vo(u),children:a})},Tj=({children:a})=>{const r=we.useContext(_v),i=_n("windowViewportRect"),o=_n("fixedItemHeight"),u=Le("customScrollParent"),m=mv(i,u,Le("skipAnimationFrameInResizeObserver")),f=Le("alignToBottom");return we.useEffect(()=>{r&&(o(r.itemHeight),i({listHeight:0,offsetTop:0,visibleHeight:r.viewportHeight,visibleWidth:100}))},[r,i,o]),n.jsx("div",{"data-viewport-type":"window",ref:m,style:vo(f),children:a})},Rj=({children:a})=>{const r=Le("TopItemListComponent")??"div",i=Le("headerHeight"),o={...kj,marginTop:`${i}px`},u=Le("context");return n.jsx(r,{style:o,...Qt(r,u),children:a})},Aj=we.memo(function(a){const r=Le("useWindowScroll"),i=Le("topItemsIndexes").length>0,o=Le("customScrollParent"),u=Le("context");return n.jsxs(o||r?zj:Dj,{...a,context:u,children:[i&&n.jsx(Rj,{children:n.jsx(jx,{showTopList:!0})}),n.jsxs(o||r?Tj:Ej,{children:[n.jsx(Cj,{}),n.jsx(jx,{}),n.jsx(Nj,{})]})]})}),{Component:Mj,useEmitter:Ld,useEmitterValue:Le,usePublisher:_n}=Lv(vj,{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"}},Aj),Dj=Uv({useEmitter:Ld,useEmitterValue:Le,usePublisher:_n}),zj=Vv({useEmitter:Ld,useEmitterValue:Le,usePublisher:_n}),Lj=Mj,_j=Ze(()=>{const a=pe(p=>n.jsxs("td",{children:["Item $",p]})),r=pe(null),i=pe(p=>n.jsxs("td",{colSpan:1e3,children:["Group ",p]})),o=pe(null),u=pe(null),m=pe({}),f=pe(zd),h=pe(vr),x=(p,y=null)=>Xt(ce(m,je(g=>g[p]),mt()),y);return{components:m,computeItemKey:f,context:r,EmptyPlaceholder:x("EmptyPlaceholder"),FillerRow:x("FillerRow"),fixedFooterContent:u,fixedHeaderContent:o,itemContent:a,groupContent:i,ScrollerComponent:x("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:x("ScrollSeekPlaceholder"),TableBodyComponent:x("TableBody","tbody"),TableComponent:x("Table","table"),TableFooterComponent:x("TableFoot","tfoot"),TableHeadComponent:x("TableHead","thead"),TableRowComponent:x("TableRow","tr"),GroupComponent:x("Group","tr")}});ht(zv,_j);Dd();const Sx={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},Oj={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:kx,floor:io,max:bs,min:Yu,round:wx}=Math;function Cx(a,r,i){return Array.from({length:r-a+1}).map((o,u)=>({data:i===null?null:i[u+a],index:u+a}))}function Bj(a){return{...Oj,items:a}}function Wi(a,r){return a!==void 0&&a.width===r.width&&a.height===r.height}function Ij(a,r){return a!==void 0&&a.column===r.column&&a.row===r.row}const Hj=Ze(([{increaseViewportBy:a,listBoundary:r,overscan:i,visibleRange:o},{footerHeight:u,headerHeight:m,scrollBy:f,scrollContainerState:h,scrollTo:x,scrollTop:p,smoothScrollTargetReached:y,viewportHeight:g},j,S,{didMount:N,propsReady:D},{customScrollParent:T,useWindowScroll:k,windowScrollContainerState:M,windowScrollTo:B,windowViewportRect:V},A])=>{const U=pe(0),C=pe(0),z=pe(Sx),R=pe({height:0,width:0}),I=pe({height:0,width:0}),P=Ke(),q=Ke(),ee=pe(0),X=pe(null),_=pe({column:0,row:0}),E=Ke(),O=Ke(),te=pe(!1),Y=pe(0),me=pe(!0),L=pe(!1),F=pe(!1);et(ce(N,$e(Y),Ae(([le,ve])=>ve!==0)),()=>{He(me,!1)}),et(ce(Lt(N,me,I,R,Y,L),Ae(([le,ve,Ue,Be,,ae])=>le&&!ve&&Ue.height!==0&&Be.height!==0&&!ae)),([,,,,le])=>{He(L,!0),Td(1,()=>{He(P,le)}),$n(ce(p),()=>{He(r,[0,0]),He(me,!0)})}),Ce(ce(O,Ae(le=>le!=null&&le.scrollTop>0),Wn(0)),C),et(ce(N,$e(O),Ae(([,le])=>le!=null)),([,le])=>{le&&(He(R,le.viewport),He(I,le.item),He(_,le.gap),le.scrollTop>0&&(He(te,!0),$n(ce(p,yl(1)),ve=>{He(te,!1)}),He(x,{top:le.scrollTop})))}),Ce(ce(R,je(({height:le})=>le)),g),Ce(ce(Lt(Re(R,Wi),Re(I,Wi),Re(_,(le,ve)=>le!==void 0&&le.column===ve.column&&le.row===ve.row),Re(p)),je(([le,ve,Ue,Be])=>({gap:Ue,item:ve,scrollTop:Be,viewport:le}))),E),Ce(ce(Lt(Re(U),o,Re(_,Ij),Re(I,Wi),Re(R,Wi),Re(X),Re(C),Re(te),Re(me),Re(Y)),Ae(([,,,,,,,le])=>!le),je(([le,[ve,Ue],Be,ae,fe,ue,he,,be,_e])=>{const{column:Me,row:dt}=Be,{height:Zt,width:ct}=ae,{width:Vt}=fe;if(he===0&&(le===0||Vt===0))return Sx;if(ct===0){const nt=Rd(_e,le),Xa=nt+Math.max(he-1,0);return Bj(Cx(nt,Xa,ue))}const $t=$v(Vt,ct,Me);let tt,jt;be?ve===0&&Ue===0&&he>0?(tt=0,jt=he-1):(tt=$t*io((ve+dt)/(Zt+dt)),jt=$t*kx((Ue+dt)/(Zt+dt))-1,jt=Yu(le-1,bs(jt,$t-1)),tt=Yu(jt,bs(0,tt))):(tt=0,jt=-1);const ye=Cx(tt,jt,ue),{bottom:Rt,top:De}=Nx(fe,Be,ae,ye),xt=kx(le/$t),Wt=xt*Zt+(xt-1)*dt-Rt;return{bottom:Rt,itemHeight:Zt,items:ye,itemWidth:ct,offsetBottom:Wt,offsetTop:De,top:De}})),z),Ce(ce(X,Ae(le=>le!==null),je(le=>le.length)),U),Ce(ce(Lt(R,I,z,_),Ae(([le,ve,{items:Ue}])=>Ue.length>0&&ve.height!==0&&le.height!==0),je(([le,ve,{items:Ue},Be])=>{const{bottom:ae,top:fe}=Nx(le,Be,ve,Ue);return[fe,ae]}),mt(ws)),r);const ie=pe(!1);Ce(ce(p,$e(ie),je(([le,ve])=>ve||le!==0)),ie);const de=jn(ce(Lt(z,U),Ae(([{items:le}])=>le.length>0),$e(ie),Ae(([[le,ve],Ue])=>{const Be=le.items[le.items.length-1].index===ve-1;return(Ue||le.bottom>0&&le.itemHeight>0&&le.offsetBottom===0&&le.items.length===ve)&&Be}),je(([[,le]])=>le-1),mt())),ge=jn(ce(Re(z),Ae(({items:le})=>le.length>0&&le[0].index===0),Wn(0),mt())),xe=jn(ce(Re(z),$e(te),Ae(([{items:le},ve])=>le.length>0&&!ve),je(([{items:le}])=>({endIndex:le[le.length-1].index,startIndex:le[0].index})),mt(bv),va(0)));Ce(xe,S.scrollSeekRangeChanged),Ce(ce(P,$e(R,I,U,_),je(([le,ve,Ue,Be,ae])=>{const fe=Cv(le),{align:ue,behavior:he,offset:be}=fe;let _e=fe.index;_e==="LAST"&&(_e=Be-1),_e=bs(0,_e,Yu(Be-1,_e));let Me=pd(ve,ae,Ue,_e);return ue==="end"?Me=wx(Me-ve.height+Ue.height):ue==="center"&&(Me=wx(Me-ve.height/2+Ue.height/2)),be!==void 0&&be!==0&&(Me+=be),{behavior:he,top:Me}})),x);const oe=Xt(ce(z,je(le=>le.offsetBottom+le.bottom)),0);return Ce(ce(V,je(le=>({height:le.visibleHeight,width:le.visibleWidth}))),R),{customScrollParent:T,data:X,deviation:ee,footerHeight:u,gap:_,headerHeight:m,increaseViewportBy:a,initialItemCount:C,itemDimensions:I,overscan:i,restoreStateFrom:O,scrollBy:f,scrollContainerState:h,scrollHeight:q,scrollTo:x,scrollToIndex:P,scrollTop:p,smoothScrollTargetReached:y,totalCount:U,useWindowScroll:k,viewportDimensions:R,windowScrollContainerState:M,windowScrollTo:B,windowViewportRect:V,...S,gridState:z,horizontalDirection:F,initialTopMostItemIndex:Y,totalListHeight:oe,...j,endReached:de,propsReady:D,rangeChanged:xe,startReached:ge,stateChanged:E,stateRestoreInProgress:te,...A}},ht(Ad,an,Ms,Mv,Qa,Md,Ka));function $v(a,r,i){return bs(1,io((a+i)/(io(r)+i)))}function Nx(a,r,i,o){const{height:u}=i;if(u===void 0||o.length===0)return{bottom:0,top:0};const m=pd(a,r,i,o[0].index);return{bottom:pd(a,r,i,o[o.length-1].index)+u,top:m}}function pd(a,r,i,o){const u=$v(a.width,i.width,r.column),m=io(o/u),f=m*i.height+bs(0,m-1)*r.row;return f>0?f+r.row:f}const Uj=Ze(()=>{const a=pe(g=>`Item ${g}`),r=pe({}),i=pe(null),o=pe("virtuoso-grid-item"),u=pe("virtuoso-grid-list"),m=pe(zd),f=pe("div"),h=pe(vr),x=(g,j=null)=>Xt(ce(r,je(S=>S[g]),mt()),j),p=pe(!1),y=pe(!1);return Ce(Re(y),p),{components:r,computeItemKey:m,context:i,FooterComponent:x("Footer"),HeaderComponent:x("Header"),headerFooterTag:f,itemClassName:o,ItemComponent:x("Item","div"),itemContent:a,listClassName:u,ListComponent:x("List","div"),readyStateChanged:p,reportReadyState:y,ScrollerComponent:x("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:x("ScrollSeekPlaceholder","div")}}),Vj=Ze(([a,r])=>({...a,...r}),ht(Hj,Uj)),$j=we.memo(function(){const a=gt("gridState"),r=gt("listClassName"),i=gt("itemClassName"),o=gt("itemContent"),u=gt("computeItemKey"),m=gt("isSeeking"),f=On("scrollHeight"),h=gt("ItemComponent"),x=gt("ListComponent"),p=gt("ScrollSeekPlaceholder"),y=gt("context"),g=On("itemDimensions"),j=On("gap"),S=gt("log"),N=gt("stateRestoreInProgress"),D=On("reportReadyState"),T=jl(we.useMemo(()=>k=>{const M=k.parentElement.parentElement.scrollHeight;f(M);const B=k.firstChild;if(B!==null){const{height:V,width:A}=B.getBoundingClientRect();g({height:V,width:A})}j({column:Ex("column-gap",getComputedStyle(k).columnGap,S),row:Ex("row-gap",getComputedStyle(k).rowGap,S)})},[f,g,j,S]),!0,!1);return Bv(()=>{a.itemHeight>0&&a.itemWidth>0&&D(!0)},[a]),N?null:n.jsx(x,{className:r,ref:T,...Qt(x,y),"data-testid":"virtuoso-item-list",style:{paddingBottom:a.offsetBottom,paddingTop:a.offsetTop},children:a.items.map(k=>{const M=u(k.index,k.data,y);return m?n.jsx(p,{...Qt(p,y),height:a.itemHeight,index:k.index,width:a.itemWidth},M):v.createElement(h,{...Qt(h,y),className:i,"data-index":k.index,key:M},o(k.index,k.data,y))})})}),Gj=we.memo(function(){const a=gt("HeaderComponent"),r=On("headerHeight"),i=gt("headerFooterTag"),o=jl(we.useMemo(()=>m=>{r(Fa(m,"height"))},[r]),!0,!1),u=gt("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,u)})}):null}),Pj=we.memo(function(){const a=gt("FooterComponent"),r=On("footerHeight"),i=gt("headerFooterTag"),o=jl(we.useMemo(()=>m=>{r(Fa(m,"height"))},[r]),!0,!1),u=gt("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,u)})}):null}),qj=({children:a})=>{const r=we.useContext(Ov),i=On("itemDimensions"),o=On("viewportDimensions"),u=jl(we.useMemo(()=>m=>{o(m.getBoundingClientRect())},[o]),!0,!1);return we.useEffect(()=>{r&&(o({height:r.viewportHeight,width:r.viewportWidth}),i({height:r.itemHeight,width:r.itemWidth}))},[r,o,i]),n.jsx("div",{ref:u,style:vo(!1),children:a})},Yj=({children:a})=>{const r=we.useContext(Ov),i=On("windowViewportRect"),o=On("itemDimensions"),u=gt("customScrollParent"),m=mv(i,u,!1);return we.useEffect(()=>{r&&(o({height:r.itemHeight,width:r.itemWidth}),i({listHeight:0,offsetTop:0,visibleHeight:r.viewportHeight,visibleWidth:r.viewportWidth}))},[r,i,o]),n.jsx("div",{ref:m,style:vo(!1),children:a})},Fj=we.memo(function({...a}){const r=gt("useWindowScroll"),i=gt("customScrollParent"),o=i||r?Kj:Wj,u=i||r?Yj:qj,m=gt("context");return n.jsx(o,{...a,...Qt(o,m),children:n.jsxs(u,{children:[n.jsx(Gj,{}),n.jsx($j,{}),n.jsx(Pj,{})]})})}),{useEmitter:Gv,useEmitterValue:gt,usePublisher:On}=Lv(Vj,{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"}},Fj),Wj=Uv({useEmitter:Gv,useEmitterValue:gt,usePublisher:On}),Kj=Vv({useEmitter:Gv,useEmitterValue:gt,usePublisher:On});function Ex(a,r,i){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&i(`${a} was not resolved to pixel value correctly`,r,Bt.WARN),r==="normal"?0:parseInt(r??"0",10)}const Qj={source:"vskill-sidebar-own-collapsed",installed:"vskill-sidebar-installed-collapsed"},Pv={source:"Own",installed:"Installed"};function Xj(a){try{const r=localStorage.getItem(a);if(r!=null)return r==="true"}catch{}try{if(typeof sessionStorage<"u"){const r=sessionStorage.getItem(a);if(r!=null)return r==="true"}}catch{}return!1}function Zj(a,r){const i=r?"true":"false";try{localStorage.setItem(a,i)}catch{}try{typeof sessionStorage<"u"&&sessionStorage.setItem(a,i)}catch{}}function Tx({origin:a,count:r,filteredCount:i,updateCount:o,children:u}){const m=Qj[a],[f,h]=v.useState(()=>Xj(m)),x=v.useCallback(()=>{h(j=>{const S=!j;return Zj(m,S),S})},[m]),p=Pv[a],y=`sidebar-section-${a}-header`,g=`sidebar-section-${a}-group`;return n.jsxs("section",{"aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:[n.jsxs("button",{id:y,type:"button","data-testid":"sidebar-section-header","aria-expanded":!f,"aria-controls":g,onClick:x,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 12px 6px 14px",background:"transparent",border:"none",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",textAlign:"left"},children:[n.jsx(e2,{collapsed:f}),n.jsx("h2",{"aria-level":2,style:{fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)",margin:0},children:p}),n.jsx("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:i!=null&&i!==r?`(${i} of ${r})`:`(${r})`}),o!=null&&o>0&&n.jsx(Jj,{origin:a,updateCount:o})]}),!f&&n.jsx("div",{id:g,role:"group","aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:u})]})}function Jj({origin:a,updateCount:r}){const[i,o]=v.useState(!1),u=Pv[a].toLowerCase(),m=`${r} updates available in ${u} section, view all`;return n.jsxs("span",{role:"link",tabIndex:0,"data-testid":"sidebar-section-update-chip","aria-label":m,onClick:f=>{f.stopPropagation(),window.location.hash="#/updates"},onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),f.stopPropagation(),window.location.hash="#/updates")},onFocus:()=>o(!0),onBlur:()=>o(!1),style:{display:"inline-flex",alignItems:"center",gap:2,fontSize:10,color:"var(--color-own)",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",cursor:"pointer",padding:"0 4px",borderRadius:3,outline:i?"2px solid var(--border-focus)":"none",outlineOffset:2},children:[r," updates",n.jsx("span",{"aria-hidden":"true",style:{fontSize:9,marginLeft:2},children:"▾"})]})}function e2({collapsed:a}){return n.jsx("svg",{"aria-hidden":"true",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:a?"rotate(0deg)":"rotate(90deg)",transition:"transform var(--duration-fast, 120ms) var(--ease-standard, ease)",flexShrink:0},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})}function _d(a,r){const i=r.trim().toLowerCase();return i?a.skill.toLowerCase().includes(i)||a.plugin.toLowerCase().includes(i)||a.dir.toLowerCase().includes(i):!0}function t2({value:a,onChange:r,placeholder:i="Filter skills…",validationPattern:o,validationMessage:u="Invalid filter expression"}){const m=v.useRef(null),f=v.useId(),h=!!o&&a.trim()!==""&&!o.test(a);return v.useEffect(()=>{function x(p){var j;if(p.key!=="/")return;const y=p.target;if(!y)return;const g=y.tagName;g==="INPUT"||g==="TEXTAREA"||y.isContentEditable||(p.preventDefault(),(j=m.current)==null||j.focus())}return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[]),n.jsxs("div",{role:"search",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",borderBottom:"1px solid var(--border-default)"},children:[n.jsxs("svg",{"aria-hidden":"true",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[n.jsx("circle",{cx:"11",cy:"11",r:"8"}),n.jsx("path",{d:"M21 21l-4.35-4.35"})]}),n.jsx("input",{ref:m,type:"search","aria-label":"Filter skills","aria-invalid":h?!0:void 0,"aria-describedby":h?f:void 0,value:a,placeholder:i,onChange:x=>r(x.currentTarget.value),onKeyDown:x=>{x.key==="Escape"&&(r(""),x.currentTarget.blur())},style:{flex:1,minWidth:0,border:"none",outline:"none",background:"transparent",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:12,padding:"2px 0"}}),h&&n.jsx("span",{id:f,role:"alert","aria-live":"polite",style:{fontFamily:"var(--font-sans)",fontSize:10,color:"var(--text-error, #B42318)",marginLeft:4,whiteSpace:"nowrap"},children:u}),n.jsx("kbd",{"aria-hidden":"true",style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",border:"1px solid var(--border-default)",padding:"1px 5px",borderRadius:3,display:a?"none":"inline-block"},children:"/"})]})}function n2({target:a}){const r=typeof a=="string"&&a.length>0,i=r?`symlinked → ${a}`:"symlinked — cycle detected or target unresolved",o=r?`symlinked from ${a}`:"symlinked, target unresolved";return n.jsx("span",{"data-testid":"symlink-chip",role:"img","aria-label":o,title:i,tabIndex:0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:14,height:14,borderRadius:3,color:"var(--text-secondary)",flexShrink:0},children:n.jsxs("svg",{"data-testid":"symlink-glyph",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),n.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})})}function a2({skill:a}){if(!a.updateAvailable)return null;const r=a.currentVersion??"",i=a.latestVersion,o=i?`Update available: ${r} → ${i}`.trim():"Update available";return n.jsx("span",{"data-testid":"skill-row-update-glyph",title:o,"aria-label":"Update available",style:{color:"var(--color-own)",display:"inline-flex",flexShrink:0},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 19V5"}),n.jsx("path",{d:"M5 12l7-7 7 7"})]})})}function l2({skill:a,isSelected:r,onSelect:i,onContextMenu:o}){const u=a.origin==="installed"?"var(--status-installed)":"var(--status-own)";return n.jsxs("button",{type:"button",onClick:i,onContextMenu:o?m=>{m.preventDefault(),o(m,a)}:void 0,"aria-current":r?"true":void 0,"aria-selected":!!r,"data-testid":"skill-row","data-selected":r,"data-origin":a.origin,style:{display:"flex",alignItems:"center",gap:8,width:"100%",height:36,padding:"0 12px 0 14px",background:r?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",boxShadow:r?"inset 2px 0 0 var(--color-accent, var(--accent-surface))":"none",border:"none",borderRadius:0,color:"var(--text-primary)",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:13,textAlign:"left",transition:"background-color var(--duration-fast, 120ms) var(--ease-standard, ease), box-shadow var(--duration-base, 180ms) var(--ease-standard, ease)"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),n.jsx("span",{title:a.skill,style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.skill}),a.version&&n.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",flexShrink:0},children:a.version}),a.isSymlink&&n.jsx(n2,{target:a.symlinkTarget??null}),n.jsx(a2,{skill:a})]})}const oo=v.memo(l2);function r2({plugin:a,skills:r,selectedKey:i,onSelect:o,onContextMenu:u}){const m=[...r].sort((f,h)=>f.skill.localeCompare(h.skill));return n.jsxs("div",{role:"group","aria-label":`${a} (${r.length})`,children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:a,children:a}),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",r.length,")"]})]}),n.jsx("div",{role:"list",children:m.map(f=>{const h=!!i&&i.plugin===f.plugin&&i.skill===f.skill;return n.jsx("div",{role:"listitem",children:n.jsx(oo,{skill:f,isSelected:h,onSelect:()=>o(f),onContextMenu:u})},`${f.plugin}/${f.skill}`)})})]})}function s2(a,r){if(!a||typeof window>"u")return r;try{const i=window.localStorage.getItem(a);return i===null?r:i==="true"}catch{return r}}function Rx({skills:a,pluginName:r,initialCollapsed:i=!1,persistKey:o,renderSkill:u}){var y;const m=r??((y=a[0])==null?void 0:y.pluginName)??"unknown-plugin",[f,h]=v.useState(()=>s2(o,i)),x=v.useCallback(()=>{h(g=>{const j=!g;if(o&&typeof window<"u")try{window.localStorage.setItem(o,String(j))}catch{}return j})},[o]),p=f?"▸":"▾";return n.jsxs("div",{"data-vskill-plugin-tree":m,role:"group","aria-label":`${m} (${a.length})`,children:[n.jsxs("button",{type:"button",onClick:x,"aria-expanded":!f,style:{display:"flex",alignItems:"center",gap:6,width:"100%",padding:"4px 10px 4px 18px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",color:"var(--text-primary)",fontSize:12,fontWeight:500},children:[n.jsx("span",{"aria-hidden":!0,className:"vskill-chevron tabular-nums",style:{width:12,display:"inline-block",textAlign:"center",fontSize:10,color:"var(--text-secondary)"},children:p}),n.jsx("span",{className:"vskill-plugin-name",style:{fontFamily:"var(--font-mono)"},children:m}),n.jsxs("span",{className:"vskill-plugin-count tabular-nums",style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:["(",a.length,")"]})]}),!f&&n.jsx("div",{className:"vskill-plugin-tree-children",style:{paddingLeft:36,borderLeft:"1px solid var(--border-subtle, rgba(128,128,128,0.2))",marginLeft:24},children:a.map(g=>n.jsx("div",{"data-vskill-plugin-skill":g.pluginNamespace??g.skill,children:u(g)},`${g.pluginNamespace??g.skill}`))})]})}function Ax({name:a,count:r,className:i,variant:o,collapsed:u,onToggle:m}){const f=o==="authoring"?"var(--color-own, #f59e0b)":"var(--color-accent, #2f6f8f)",h=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))",x=typeof m=="function",p={position:"sticky",top:0,zIndex:4,backdropFilter:"saturate(1.4) blur(10px)",WebkitBackdropFilter:"saturate(1.4) blur(10px)",background:h,borderLeft:`3px solid ${f}`,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:x?"pointer":"default",border:"none",textAlign:"left"},y=u?"▸":"▾",g=n.jsxs(n.Fragment,{children:[x&&n.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-secondary)",width:10,display:"inline-block",letterSpacing:0,textTransform:"none"},children:y}),n.jsx("span",{className:"vskill-group-header-name",children:a}),n.jsxs("span",{className:"vskill-group-header-count tabular-nums",style:{fontFamily:"var(--font-mono)",fontSize:11,fontWeight:500,color:"var(--text-secondary)",letterSpacing:0,textTransform:"none"},children:["(",r,")"]})]});return x?n.jsx("button",{type:"button","data-vskill-group-header":a,className:["vskill-group-header select-none",i??""].join(" ").trim(),style:p,onClick:()=>m(!u),"aria-expanded":!u,children:g}):n.jsx("div",{"data-vskill-group-header":a,role:"heading","aria-level":3,className:["vskill-group-header select-none",i??""].join(" ").trim(),style:p,children:g})}function i2(){return n.jsxs("div",{"aria-hidden":"true",role:"presentation",style:{display:"flex",alignItems:"center",gap:8,height:36,padding:"0 12px 0 14px"},children:[n.jsx("span",{className:"placeholder",style:{width:6,height:6,borderRadius:"50%",flexShrink:0}}),n.jsx("span",{className:"placeholder",style:{height:10,flex:1,borderRadius:3,maxWidth:180}})]})}function o2(a){const r=a.key.split("+").map(h=>h.trim()).filter(Boolean);let i=!!a.meta,o=!!a.ctrl,u=!!a.shift,m=!!a.alt,f=a.key;if(r.length>1){for(const h of r.slice(0,-1)){const x=h.toLowerCase();x==="cmd"||x==="meta"||x==="⌘"?i=!0:x==="ctrl"||x==="control"?o=!0:x==="shift"?u=!0:(x==="alt"||x==="option")&&(m=!0)}f=r[r.length-1]}return{key:f.length===1?f.toLowerCase():f,meta:i,ctrl:o,shift:u,alt:m,allowInInputs:!!a.allowInInputs,handler:a.handler}}function c2(a){if(!a||!(a instanceof HTMLElement))return!1;const r=a.tagName;if(r==="INPUT"||r==="TEXTAREA"||a.isContentEditable)return!0;const i=a.getAttribute("contenteditable");return i!=null&&i!=="false"||a.getAttribute("role")==="textbox"}function u2(a,r){const i=!!a.metaKey,o=!!a.ctrlKey,u=!!a.shiftKey,m=!!a.altKey;return i!==r.meta||o!==r.ctrl||u!==r.shift||m!==r.alt?!1:(a.key.length===1?a.key.toLowerCase():a.key)===r.key}function md(a,r={}){const{enabled:i=!0,target:o}=r,u=v.useRef([]),m=Array.isArray(a)?a:[a];u.current=m.map(o2),v.useEffect(()=>{if(!i)return;const f=o??(typeof window<"u"?window:void 0);if(!f)return;function h(x){const p=x,y=c2(p.target);for(const g of u.current){if(!u2(p,g))continue;const j=g.meta||g.ctrl||g.alt;if(!(y&&!g.allowInInputs&&!j)){g.handler(p);return}}}return f.addEventListener("keydown",h),()=>{f.removeEventListener("keydown",h)}},[i,o])}const d2=200;function f2(a){return a.scope==="own"||a.scope==="installed"||a.scope==="global"?a.scope:a.origin==="installed"?"installed":"own"}function p2(a,r){const i={availableProject:[],availablePersonal:[],availablePlugin:[],authoringProject:[],authoringPlugin:[]};for(const u of a){const m=u.scopeV2??(u.scope==="installed"?"available-project":u.scope==="global"?"available-personal":"authoring-project");m==="available-project"?i.availableProject.push(u):m==="available-personal"?i.availablePersonal.push(u):m==="available-plugin"?i.availablePlugin.push(u):m==="authoring-plugin"?i.authoringPlugin.push(u):i.authoringProject.push(u)}function o(u){const m=u.filter(x=>_d(x,r)),f={};for(const x of m){const p=x.pluginName??x.plugin;(f[p]||(f[p]=[])).push(x)}const h=Object.entries(f).sort((x,p)=>x[0].localeCompare(p[0]));return{total:u.length,filtered:m.length,byPlugin:h}}return{availableProject:o(i.availableProject),availablePersonal:o(i.availablePersonal),availablePlugin:o(i.availablePlugin),authoringProject:o(i.authoringProject),authoringPlugin:o(i.authoringPlugin)}}function m2(a,r){const i=[],o=[],u=[];for(const f of a){const h=f2(f);h==="global"?u.push(f):h==="installed"?o.push(f):i.push(f)}function m(f){var y;const h=f.filter(g=>_d(g,r)),x={};for(const g of h)(x[y=g.plugin]||(x[y]=[])).push(g);const p=Object.entries(x).sort((g,j)=>g[0].localeCompare(j[0]));return{total:f.length,filtered:h.length,byPlugin:p}}return{own:m(i),installed:m(o),global:m(u)}}function h2(a,r){const i=[],o=[];for(const m of a)(m.origin==="installed"?o:i).push(m);function u(m){var p;const f=m.filter(y=>_d(y,r)),h={};for(const y of f)(h[p=y.plugin]||(h[p]=[])).push(y);const x=Object.entries(h).sort((y,g)=>y[0].localeCompare(g[0]));return{total:m.length,filtered:f.length,byPlugin:x}}return{own:u(i),installed:u(o)}}function x2({skills:a,selectedKey:r,onSelect:i,isLoading:o,error:u,onRetry:m,onContextMenu:f,outdatedByOrigin:h,activeAgentId:x,outdatedByScope:p,topSlot:y}){const g=!!x||a.some(E=>E.scope!==void 0&&E.scope!==null),j=x??"claude-cli",[S,N]=v.useState(""),D=v.useDeferredValue(S),T=v.useMemo(()=>m2(a,D),[a,D]),k=v.useMemo(()=>p2(a,D),[a,D]),M=j==="claude-code",[B,V]=v.useState(()=>hd(`vskill-sidebar-${j}-group-available-collapsed`)),[A,U]=v.useState(()=>hd(`vskill-sidebar-${j}-group-authoring-collapsed`)),C=v.useCallback(E=>{V(E);try{window.localStorage.setItem(`vskill-sidebar-${j}-group-available-collapsed`,String(E))}catch{}},[j]),z=v.useCallback(E=>{U(E);try{window.localStorage.setItem(`vskill-sidebar-${j}-group-authoring-collapsed`,String(E))}catch{}},[j]),{own:R,installed:I}=v.useMemo(()=>h2(a,D),[a,D]),q=T.own.filtered+T.installed.filtered+T.global.filtered>=d2,ee=v.useMemo(()=>{const E=O=>{const te=[];for(const[,Y]of O){const me=[...Y].sort((L,F)=>L.skill.localeCompare(F.skill));te.push(...me)}return te};return g?[...E(T.own.byPlugin),...E(T.installed.byPlugin),...E(T.global.byPlugin)]:[...E(R.byPlugin),...E(I.byPlugin)]},[g,T.own.byPlugin,T.installed.byPlugin,T.global.byPlugin,R.byPlugin,I.byPlugin]),X=v.useMemo(()=>r?ee.findIndex(E=>E.plugin===r.plugin&&E.skill===r.skill):-1,[ee,r]),_=v.useCallback(E=>{if(ee.length===0)return;const O=X<0?E>0?0:ee.length-1:Math.min(Math.max(X+E,0),ee.length-1);i(ee[O])},[ee,X,i]);return md([{key:"j",handler:()=>_(1)},{key:"k",handler:()=>_(-1)},{key:"Enter",handler:()=>{X>=0&&i(ee[X])}}],{enabled:!o&&!u}),n.jsxs("div",{"data-testid":"sidebar",style:{display:"flex",flexDirection:"column",minHeight:0,height:"100%",fontFamily:"var(--font-sans)"},children:[y,n.jsx(t2,{value:S,onChange:N}),o&&n.jsx(j2,{}),!o&&u&&n.jsx(S2,{error:u,onRetry:m}),!o&&!u&&g&&n.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[n.jsx(Ax,{name:Z.scopeLabels.groupAvailable.toUpperCase(),variant:"available",collapsed:B,onToggle:C,count:k.availableProject.total+k.availablePersonal.total+k.availablePlugin.total}),!B&&n.jsxs(n.Fragment,{children:[n.jsx(ps,{label:Z.scopeLabels.sourceProject,storageKey:`vskill-sidebar-${j}-available-project-collapsed`,count:k.availableProject.total,filteredCount:S?k.availableProject.filtered:null,updateCount:(p==null?void 0:p.installed)??(h==null?void 0:h.installed),children:k.availableProject.filtered===0?n.jsx(Dx,{queryActive:!!S,agentId:j}):n.jsx(ms,{items:k.availableProject.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:q})}),n.jsx(ps,{label:Z.scopeLabels.sourcePersonal,storageKey:`vskill-sidebar-${j}-available-personal-collapsed`,count:k.availablePersonal.total,filteredCount:S?k.availablePersonal.filtered:null,updateCount:p==null?void 0:p.global,children:k.availablePersonal.filtered===0?n.jsx(g2,{queryActive:!!S,agentId:j}):n.jsx(ms,{items:k.availablePersonal.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:q})}),M&&n.jsx(ps,{label:Z.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${j}-available-plugin-collapsed`,count:k.availablePlugin.total,filteredCount:S?k.availablePlugin.filtered:null,children:k.availablePlugin.filtered===0?n.jsxs("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:["No plugin skills installed — run ",n.jsx("code",{children:"/plugin install"})," in Claude Code."]}):k.availablePlugin.byPlugin.map(([E,O])=>n.jsx(Rx,{pluginName:E,skills:O,persistKey:`vskill-plugin-available-${E}-collapsed`,renderSkill:te=>n.jsx(oo,{skill:te,isSelected:(r==null?void 0:r.plugin)===te.plugin&&(r==null?void 0:r.skill)===te.skill,onSelect:()=>i(te),onContextMenu:f})},`available-${E}`))})]}),n.jsx(b2,{}),n.jsx(Ax,{name:Z.scopeLabels.groupAuthoring.toUpperCase(),variant:"authoring",collapsed:A,onToggle:z,count:k.authoringProject.total+k.authoringPlugin.total}),!A&&n.jsxs(n.Fragment,{children:[n.jsx(ps,{label:Z.scopeLabels.authoringSkills,storageKey:`vskill-sidebar-${j}-authoring-project-collapsed`,count:k.authoringProject.total,filteredCount:S?k.authoringProject.filtered:null,updateCount:(p==null?void 0:p.own)??(h==null?void 0:h.source),children:k.authoringProject.filtered===0?n.jsx(Mx,{queryActive:!!S}):n.jsx(ms,{items:k.authoringProject.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:q})}),M&&n.jsx(ps,{label:Z.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${j}-authoring-plugin-collapsed`,count:k.authoringPlugin.total,filteredCount:S?k.authoringPlugin.filtered:null,children:k.authoringPlugin.filtered===0?n.jsxs("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:["No plugin sources in this project. Add ",n.jsx("code",{children:"<plugin>/.claude-plugin/plugin.json"}),"."]}):k.authoringPlugin.byPlugin.map(([E,O])=>n.jsx(Rx,{pluginName:E,skills:O,persistKey:`vskill-plugin-authoring-${E}-collapsed`,renderSkill:te=>n.jsx(oo,{skill:te,isSelected:(r==null?void 0:r.plugin)===te.plugin&&(r==null?void 0:r.skill)===te.skill,onSelect:()=>i(te),onContextMenu:f})},`authoring-${E}`))})]})]}),!o&&!u&&!g&&n.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[n.jsx(Tx,{origin:"source",count:R.total,filteredCount:S?R.filtered:null,updateCount:h==null?void 0:h.source,children:R.filtered===0?n.jsx(Mx,{queryActive:!!S}):n.jsx(ms,{items:R.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:q})}),n.jsx(y2,{}),n.jsx(Tx,{origin:"installed",count:I.total,filteredCount:S?I.filtered:null,updateCount:h==null?void 0:h.installed,children:I.filtered===0?n.jsx(Dx,{queryActive:!!S}):n.jsx(ms,{items:I.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:q})})]})]})}function hd(a){if(typeof window>"u")return!1;try{return window.localStorage.getItem(a)==="true"}catch{return!1}}function ps({label:a,storageKey:r,count:i,filteredCount:o,updateCount:u,children:m}){const[f,h]=v.useState(()=>hd(r)),x=v.useCallback(()=>{h(y=>{const g=!y;if(typeof window<"u")try{window.localStorage.setItem(r,String(g))}catch{}return g})},[r]),p=o!=null&&o!==i?`${o} of ${i}`:String(i);return n.jsxs("section",{"data-vskill-named-scope":a,children:[n.jsxs("button",{type:"button",onClick:x,"aria-expanded":!f,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 12px",background:"transparent",border:"none",cursor:"pointer",fontFamily:"var(--font-sans)",textAlign:"left"},children:[n.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-secondary)",width:10,display:"inline-block"},children:f?"▸":"▾"}),n.jsx("span",{style:{fontSize:12,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)"},children:a}),n.jsxs("span",{style:{fontSize:11,color:"var(--text-tertiary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",p,")"]}),u!=null&&u>0&&n.jsxs("span",{style:{marginLeft:"auto",fontSize:10,color:"var(--color-own, #f59e0b)"},children:[u," update",u!==1?"s":""]})]}),!f&&n.jsx("div",{children:m})]})}function v2(a){const r=[];for(const[i,o]of a){const u=[...o].sort((m,f)=>m.skill.localeCompare(f.skill));r.push({kind:"header",plugin:i,count:u.length});for(const m of u)r.push({kind:"row",skill:m})}return r}function ms({items:a,selectedKey:r,onSelect:i,onContextMenu:o,useVirtual:u}){if(u){const m=v2(a);return n.jsx("div",{"data-virtualized":"true",style:{height:420,minHeight:200},children:n.jsx(Lj,{overscan:4,totalCount:m.length,itemContent:f=>{const h=m[f];if(!h)return null;if(h.kind==="header")return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)"},children:h.plugin}),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",h.count,")"]})]});const x=h.skill,p=!!r&&r.plugin===x.plugin&&r.skill===x.skill;return n.jsx(oo,{skill:x,isSelected:p,onSelect:()=>i(x),onContextMenu:o})}})})}return n.jsx("div",{"data-virtualized":"false",children:a.map(([m,f])=>n.jsx(r2,{plugin:m,skills:f,selectedKey:r,onSelect:i,onContextMenu:o},m))})}function Mx({queryActive:a}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:"No skills yet.",body:n.jsxs(n.Fragment,{children:["Create one with ",n.jsx(Od,{children:"vskill new"})," or the"," ",n.jsx("strong",{style:{color:"var(--text-primary)"},children:"New skill"})," action in the top rail."]})})}function Dx({queryActive:a,agentId:r}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:r?`No skills installed for ${r} in this project.`:"No installed skills.",body:n.jsxs(n.Fragment,{children:["Run ",n.jsx(Od,{children:"vskill install <plugin>"})," to add one."]})})}function g2({queryActive:a,agentId:r}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:`No global skills for ${r}.`,body:n.jsxs(n.Fragment,{children:["Run ",n.jsx(Od,{children:"vskill install --global <plugin>"})," to add one."]})})}function pr({headline:a,body:r}){return n.jsxs("div",{style:{padding:"12px 14px 16px",fontSize:12,color:"var(--text-secondary)",lineHeight:1.5},children:[n.jsx("div",{style:{fontWeight:500,color:"var(--text-primary)",marginBottom:4},children:a}),n.jsx("div",{children:r})]})}function Od({children:a}){return n.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-primary)",background:"color-mix(in srgb, var(--border-default) 45%, transparent)",padding:"1px 4px",borderRadius:3},children:a})}function y2(){return n.jsx("div",{"aria-hidden":"true",style:{height:1,background:"var(--border-default)",margin:"4px 14px"}})}function b2(){return n.jsx("div",{"aria-hidden":"true","data-testid":"scope-bold-divider",style:{height:3,background:"var(--color-rule)",boxShadow:"inset 0 1px 0 color-mix(in srgb, var(--color-rule) 50%, transparent)",margin:"12px 0"}})}function j2(){return n.jsx("div",{style:{padding:"8px 0"},children:[0,1,2,3,4,5].map(a=>n.jsx(i2,{},a))})}function S2({error:a,onRetry:r}){return n.jsxs("div",{role:"alert",style:{margin:"12px 14px",padding:12,border:"1px solid var(--border-default)",borderRadius:6,background:"var(--bg-canvas)",color:"var(--text-primary)",fontSize:12},children:[n.jsx("div",{style:{fontWeight:600,marginBottom:4},children:"Couldn't load skills."}),n.jsxs("details",{children:[n.jsx("summary",{style:{cursor:"pointer",color:"var(--text-secondary)",fontSize:11,marginBottom:4},children:k2(a)}),n.jsx("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",margin:"6px 0 0"},children:a})]}),r&&n.jsx("button",{type:"button",onClick:r,style:{marginTop:8,background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"4px 10px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:"Retry"})]})}function k2(a){const r=a.split(`
55
+ `)[0]??a;return r.length>80?r.slice(0,77)+"…":r}const qv=240,Yv=480,Fv="vskill-sidebar-width",js=320;function Bd(a){return Number.isFinite(a)?Math.round(Math.max(qv,Math.min(Yv,a))):js}function w2(){try{const a=localStorage.getItem(Fv);if(!a)return js;const r=Number(a);return Number.isFinite(r)?Bd(r):js}catch{return js}}function C2(a){try{localStorage.setItem(Fv,String(Bd(a)))}catch{}}function N2({initialWidth:a,onChange:r}){const i=v.useRef({startX:0,startWidth:a,pointerId:null}),o=v.useRef(a);return v.useEffect(()=>{o.current=a},[a]),v.useEffect(()=>{function u(f){if(i.current.pointerId==null||f.pointerId!==i.current.pointerId)return;const h=f.clientX-i.current.startX,x=Bd(i.current.startWidth+h);o.current=x,r(x)}function m(f){i.current.pointerId==null||f.pointerId!==i.current.pointerId||(i.current.pointerId=null,C2(o.current))}return window.addEventListener("pointermove",u),window.addEventListener("pointerup",m),window.addEventListener("pointercancel",m),()=>{window.removeEventListener("pointermove",u),window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",m)}},[r]),n.jsx("div",{role:"separator","aria-orientation":"vertical","aria-valuemin":qv,"aria-valuemax":Yv,"aria-valuenow":a,"aria-label":"Resize sidebar",title:"Drag to resize sidebar",onPointerDown:u=>{const m=u.currentTarget;i.current.startX=u.clientX,i.current.startWidth=o.current,i.current.pointerId=u.pointerId;try{m.setPointerCapture(u.pointerId)}catch{}},style:{width:4,alignSelf:"stretch",cursor:"col-resize",background:"var(--border-default)",userSelect:"none",touchAction:"none"}})}function E2({connected:a,hint:r,onRetry:i}){return a?null:n.jsxs("aside",{"aria-live":"assertive",role:"alert",style:{display:"flex",alignItems:"center",gap:10,padding:"6px 12px",background:"color-mix(in srgb, var(--status-own) 15%, transparent)",borderBottom:"1px solid var(--border-default)",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:12},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--status-own)",display:"inline-block",flexShrink:0}}),n.jsx("span",{style:{fontWeight:500},children:"Disconnected — reconnecting…"}),r&&n.jsx("span",{style:{color:"var(--text-secondary)",fontSize:11},children:r}),n.jsx("div",{style:{flex:1}}),i&&n.jsx("button",{type:"button",onClick:i,style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"2px 8px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:"Retry now"})]})}function Wv(a){if(a!==void 0)try{return JSON.stringify(a)}catch(r){console.error("Failed to serialize request body:",r);try{const i=new WeakSet;return JSON.stringify(a,(o,u)=>{if(typeof u=="object"&&u!==null){if(i.has(u))return"[Circular]";i.add(u)}return u})}catch{return JSON.stringify({error:"Request body could not be serialized"})}}}function Fu(){const[a,r]=v.useState([]),[i,o]=v.useState(!1),[u,m]=v.useState(!1),[f,h]=v.useState(null),x=v.useRef(null),p=v.useCallback(async(g,j)=>{r([]),o(!0),m(!1),h(null);const S=new AbortController;x.current=S;try{const N=Wv(j),D=await fetch(g,{method:"POST",headers:{"Content-Type":"application/json"},body:N,signal:S.signal});if(!D.ok||!D.body){let V=`HTTP ${D.status}`;try{const A=await D.json();A.error&&(V=A.error)}catch{}throw new Error(V)}const T=D.body.getReader(),k=new TextDecoder;let M="",B="";for(;;){const{done:V,value:A}=await T.read();if(V)break;M+=k.decode(A,{stream:!0});const U=M.split(`
56
+ `);M=U.pop()||"";for(const C of U)if(C.startsWith("event: "))B=C.slice(7).trim();else if(C.startsWith("data: ")){try{const z=JSON.parse(C.slice(6)),R={event:B,data:z};B==="done"?(m(!0),r(I=>[...I,R])):r(I=>[...I,R])}catch{}B=""}}}catch(N){N.name!=="AbortError"&&h(N.message)}finally{o(!1),x.current=null}},[]),y=v.useCallback(()=>{var g;(g=x.current)==null||g.abort()},[]);return{events:a,running:i,done:u,error:f,start:p,stop:y}}function T2(a){const r=v.useRef(a);r.current=a;const[i,o]=v.useState(new Set),u=v.useRef(new Map),m=v.useCallback(async(p,y,g)=>{var S;(S=u.current.get(p))==null||S.abort();const j=new AbortController;u.current.set(p,j),o(N=>{const D=new Set(N);return D.add(p),D});try{const N=Wv(g),D=await fetch(y,{method:"POST",headers:{"Content-Type":"application/json"},body:N,signal:j.signal});if(!D.ok||!D.body){let V=`HTTP ${D.status}`;try{const A=await D.json();A.error&&(V=A.error)}catch{}throw new Error(V)}const T=D.body.getReader(),k=new TextDecoder;let M="",B="";for(;;){const{done:V,value:A}=await T.read();if(V)break;M+=k.decode(A,{stream:!0});const U=M.split(`
57
+ `);M=U.pop()||"";for(const C of U)if(C.startsWith("event: "))B=C.slice(7).trim();else if(C.startsWith("data: ")){try{const z=JSON.parse(C.slice(6)),R={event:B,data:z};r.current.onEvent(p,R)}catch{}B=""}}r.current.onDone(p)}catch(N){N.name!=="AbortError"&&r.current.onError(p,N.message)}finally{o(N=>{const D=new Set(N);return D.delete(p),D}),u.current.delete(p)}},[]),f=v.useCallback(p=>{var y;(y=u.current.get(p))==null||y.abort()},[]),h=v.useCallback(()=>{for(const p of u.current.values())p.abort()},[]),x=i.size>0;return{runningSet:i,startCase:m,stopCase:f,stopAll:h,isAnyCaseRunning:x}}const R2={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 A2(a,r){var i,o;switch(r.type){case"SET_LOADING":return{...a,loading:r.loading};case"SET_ERROR":return{...a,error:r.error};case"INIT_DATA":{const u=new Map;if(r.benchmark)for(const f of r.benchmark.cases)u.set(f.eval_id,{status:f.status,passRate:f.pass_rate,errorMessage:f.error_message||void 0,durationMs:f.durationMs,tokens:f.tokens,output:f.output,assertions:f.assertions.map(h=>({assertion_id:h.id,text:h.text,pass:h.pass,reasoning:h.reasoning}))});const m=((o=(i=r.evals)==null?void 0:i.evals[0])==null?void 0:o.id)??null;return{...a,skillContent:r.skillContent,savedContent:r.skillContent,isDirty:!1,evals:r.evals,evalsError:r.evalsError??null,latestBenchmark:r.benchmark,inlineResults:u,selectedCaseId:m,loading:!1,error:null}}case"SET_PANEL":return{...a,activePanel:r.panel};case"SET_CONTENT":return{...a,skillContent:r.content,isDirty:r.content!==a.savedContent};case"CONTENT_SAVED":return{...a,savedContent:a.skillContent,isDirty:!1};case"SET_EVALS":return{...a,evals:r.evals};case"SELECT_CASE":return{...a,selectedCaseId:r.caseId};case"CASE_RUN_START":{const u=new Map(a.caseRunStates);return u.set(r.caseId,{status:"running",startedAt:Date.now(),mode:r.mode}),{...a,caseRunStates:u,runMode:r.mode,activePanel:"run"}}case"CASE_RUN_COMPLETE":{const u=new Map(a.caseRunStates),m=u.get(r.caseId);u.set(r.caseId,{status:"complete",mode:m==null?void 0:m.mode});const f=new Map(a.inlineResults);return f.set(r.caseId,r.result),{...a,caseRunStates:u,inlineResults:f}}case"CASE_RUN_ERROR":{const u=new Map(a.caseRunStates),m=u.get(r.caseId);u.set(r.caseId,{status:"error",mode:m==null?void 0:m.mode});const f=new Map(a.inlineResults);return f.set(r.caseId,{status:"error",errorMessage:r.error,assertions:[]}),{...a,caseRunStates:u,inlineResults:f}}case"CASE_RUN_CANCEL":{const u=new Map(a.caseRunStates),m=u.get(r.caseId);return u.set(r.caseId,{status:"cancelled",mode:m==null?void 0:m.mode}),{...a,caseRunStates:u}}case"BULK_RUN_START":{const u=new Map(a.caseRunStates);for(const m of r.caseIds)u.set(m,{status:"queued",mode:r.mode});return{...a,caseRunStates:u,bulkRunActive:!0,runMode:r.mode,activePanel:"run"}}case"BULK_RUN_COMPLETE":return{...a,bulkRunActive:!1,latestBenchmark:r.benchmark??a.latestBenchmark,iterationCount:a.iterationCount+1};case"CANCEL_ALL":{const u=new Map(a.caseRunStates);for(const[m,f]of u)(f.status==="running"||f.status==="queued")&&u.set(m,{status:"cancelled"});return{...a,caseRunStates:u,bulkRunActive:!1}}case"UPDATE_INLINE_RESULT":{const u=new Map(a.inlineResults);return u.set(r.evalId,r.result),{...a,inlineResults:u}}case"OPEN_IMPROVE":return{...a,improveTarget:r.evalId,activePanel:"editor"};case"CLOSE_IMPROVE":return{...a,improveTarget:null};case"OPEN_AI_EDIT":return{...a,aiEditOpen:!0,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"CLOSE_AI_EDIT":return{...a,aiEditOpen:!1,aiEditLoading:!1,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"AI_EDIT_LOADING":return{...a,aiEditLoading:!0,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[]};case"AI_EDIT_PROGRESS":return{...a,aiEditProgress:[...a.aiEditProgress,r.entry]};case"AI_EDIT_RESULT":{const u=r.evalChanges??[],m=new Map;for(let f=0;f<u.length;f++)m.set(f,!0);return{...a,aiEditLoading:!1,aiEditResult:{improved:r.improved,reasoning:r.reasoning,evalChanges:u},aiEditEvalChanges:u,aiEditEvalSelections:m}}case"AI_EDIT_ERROR":return{...a,aiEditLoading:!1,aiEditError:r.message,aiEditClassifiedError:r.classified??null};case"GENERATE_EVALS_START":return{...a,generateEvalsLoading:!0,generateEvalsProgress:[],generateEvalsError:null};case"GENERATE_EVALS_PROGRESS":return{...a,generateEvalsProgress:[...a.generateEvalsProgress,r.entry]};case"GENERATE_EVALS_DONE":return{...a,generateEvalsLoading:!1,evals:r.evals};case"GENERATE_EVALS_ERROR":return{...a,generateEvalsLoading:!1,generateEvalsError:r.classified};case"TOGGLE_EVAL_CHANGE":{const u=new Map(a.aiEditEvalSelections);return u.set(r.index,!u.get(r.index)),{...a,aiEditEvalSelections:u}}case"SELECT_ALL_EVAL_CHANGES":{const u=new Map(a.aiEditEvalSelections);for(const m of u.keys())u.set(m,!0);return{...a,aiEditEvalSelections:u}}case"DESELECT_ALL_EVAL_CHANGES":{const u=new Map(a.aiEditEvalSelections);for(const m of u.keys())u.set(m,!1);return{...a,aiEditEvalSelections:u}}case"SET_EVALS_RETRY":return{...a,aiEditEvalsRetry:r.evalsFile};case"SET_REGRESSIONS":return{...a,regressions:r.regressions};case"INCREMENT_ITERATION":return{...a,iterationCount:a.iterationCount+1};case"SET_ACTIVATION_PROMPTS":return{...a,activationPrompts:r.prompts};case"ACTIVATION_START":return{...a,activationRunning:!0,activationResults:[],activationSummary:null,activationError:null,activationClassifyingStatus:null,activationStartedAt:Date.now()};case"ACTIVATION_RESULT":return{...a,activationResults:[...a.activationResults,r.result]};case"ACTIVATION_DONE":return{...a,activationRunning:!1,activationSummary:r.summary,activationClassifyingStatus:null};case"ACTIVATION_CLASSIFYING":return{...a,activationClassifyingStatus:`Classifying prompt ${r.index}/${r.total}...`};case"ACTIVATION_ERROR":return{...a,activationRunning:!1,activationError:r.error,activationClassifyingStatus:null};case"ACTIVATION_RESET":return{...a,activationResults:[],activationSummary:null,activationError:null};case"ACTIVATION_TIMEOUT":return{...a,activationRunning:!1,activationError:"Activation test timed out after 120 seconds"};case"ACTIVATION_CANCEL":return{...a,activationRunning:!1};case"GENERATE_PROMPTS_START":return{...a,generatingPrompts:!0,generatingPromptsError:null};case"GENERATE_PROMPTS_DONE":return{...a,generatingPrompts:!1};case"GENERATE_PROMPTS_ERROR":return{...a,generatingPrompts:!1,generatingPromptsError:r.error};case"ACTIVATION_HISTORY_LOADED":return{...a,activationHistory:r.runs,activationHistoryLoading:!1};default:return a}}function M2(a){if(a==="unit"||a==="integration")return a}function D2(a,r){const i=r.data;if(r.event==="output_ready"&&(a.output=i.output,i.durationMs!=null&&(a.durationMs=i.durationMs),i.tokens!=null&&(a.tokens=i.tokens)),r.event==="outputs_ready"&&(a.output=i.skillOutput,i.skillDurationMs!=null&&(a.durationMs=i.skillDurationMs),i.skillTokens!=null&&(a.tokens=i.skillTokens)),r.event==="assertion_result"){const o={assertion_id:i.assertion_id,text:i.text,pass:i.pass,reasoning:i.reasoning};a.assertions.find(u=>u.assertion_id===o.assertion_id)||a.assertions.push(o)}r.event==="case_complete"&&(a.status=i.status,a.passRate=i.pass_rate,a.errorMessage=i.error_message||void 0,a.classifiedError=i.classified_error||void 0)}const Kv=v.createContext(null);function kn(){const a=v.useContext(Kv);if(!a)throw new Error("useWorkspace must be used within WorkspaceProvider");return a}function zx({plugin:a,skill:r,origin:i,children:o}){const u=i==="installed",[m,f]=v.useReducer(A2,{...R2,plugin:a,skill:r}),h=v.useRef(new Set),x=v.useRef(new Set),p=v.useRef(new Map),y=v.useCallback((ae,fe)=>{let ue=p.current.get(ae);ue||(ue={assertions:[]},p.current.set(ae,ue)),D2(ue,fe),f({type:"UPDATE_INLINE_RESULT",evalId:ae,result:{...ue,assertions:[...ue.assertions]}})},[]),g=v.useCallback(ae=>{if(x.current.has(ae))return;x.current.add(ae);const fe=p.current.get(ae)??{assertions:[]};f({type:"CASE_RUN_COMPLETE",caseId:ae,result:{...fe,assertions:[...fe.assertions]}}),h.current.has(ae)&&(h.current.delete(ae),h.current.size===0&&Ne.getLatestBenchmark(a,r).then(ue=>f({type:"BULK_RUN_COMPLETE",benchmark:ue})).catch(()=>f({type:"BULK_RUN_COMPLETE",benchmark:null})))},[a,r]),j=v.useCallback((ae,fe)=>{x.current.has(ae)||(x.current.add(ae),f({type:"CASE_RUN_ERROR",caseId:ae,error:fe}),h.current.has(ae)&&(h.current.delete(ae),h.current.size===0&&Ne.getLatestBenchmark(a,r).then(ue=>f({type:"BULK_RUN_COMPLETE",benchmark:ue})).catch(()=>f({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[a,r]),{startCase:S,stopCase:N,stopAll:D}=T2({onEvent:y,onDone:g,onError:j});v.useEffect(()=>()=>{D()},[D]);const T=v.useCallback(async()=>{try{const ae=await fetch(`/api/skills/${a}/${r}/activation-history`);if(!ae.ok){if(ae.status===404){f({type:"ACTIVATION_HISTORY_LOADED",runs:[]});return}return}const fe=await ae.json();f({type:"ACTIVATION_HISTORY_LOADED",runs:fe.runs||[]})}catch{}},[a,r]);v.useEffect(()=>{let ae=!1;async function fe(){try{const[ue,he,be]=await Promise.allSettled([Ne.getSkillDetail(a,r),Ne.getEvals(a,r),Ne.getLatestBenchmark(a,r)]);if(ae)return;let _e=null,Me=null;if(he.status==="fulfilled")_e=he.value;else{const dt=he.reason;(dt==null?void 0:dt.status)!==404&&(Me=(dt==null?void 0:dt.message)??"Failed to load test cases")}f({type:"INIT_DATA",skillContent:ue.status==="fulfilled"?ue.value.skillContent:"",evals:_e,evalsError:Me,benchmark:be.status==="fulfilled"?be.value:null})}catch(ue){ae||f({type:"SET_ERROR",error:ue.message})}}return fe(),T(),()=>{ae=!0}},[a,r,T]);const k=v.useCallback(async()=>{if(!u)try{await Ne.applyImprovement(a,r,m.skillContent),f({type:"CONTENT_SAVED"})}catch(ae){f({type:"SET_ERROR",error:ae.message})}},[u,a,r,m.skillContent]),M=v.useCallback(async ae=>{if(!u)try{const fe=await Ne.saveEvals(a,r,ae);f({type:"SET_EVALS",evals:fe})}catch(fe){f({type:"SET_ERROR",error:fe.message})}},[u,a,r]),B=v.useCallback((ae,fe="benchmark")=>{if(u)return;const ue=m.caseRunStates.get(ae);if((ue==null?void 0:ue.status)!=="running")if(p.current.delete(ae),x.current.delete(ae),f({type:"CASE_RUN_START",caseId:ae,mode:fe}),fe==="comparison"){const he=`/api/skills/${a}/${r}/compare`;S(ae,he,{eval_ids:[ae]})}else{const he=`/api/skills/${a}/${r}/benchmark/case/${ae}`;S(ae,he,fe==="baseline"?{baseline_only:!0}:void 0)}},[u,a,r,m.caseRunStates,S]),V=v.useCallback((ae="benchmark")=>{var he;if(u)return;const fe=((he=m.evals)==null?void 0:he.evals)??[];if(fe.length===0)return;const ue=fe.map(be=>be.id);for(const be of ue)p.current.delete(be),x.current.delete(be);f({type:"BULK_RUN_START",caseIds:ue,mode:ae}),h.current=new Set(ue);for(const be of ue)if(ae==="comparison")S(be,`/api/skills/${a}/${r}/compare`,{eval_ids:[be]});else{const _e=`/api/skills/${a}/${r}/benchmark/case/${be}`;S(be,_e,ae==="baseline"?{baseline_only:!0}:void 0)}},[u,a,r,m.evals,S]),A=v.useCallback(ae=>{N(ae),f({type:"CASE_RUN_CANCEL",caseId:ae}),h.current.delete(ae),x.current.add(ae)},[N]),U=v.useCallback(()=>{D(),f({type:"CANCEL_ALL"}),h.current.clear()},[D]),C=v.useCallback(async(ae,fe)=>{f({type:"OPEN_IMPROVE",evalId:ae})},[]),z=v.useCallback(async(ae,fe)=>{try{await Ne.applyImprovement(a,r,fe),f({type:"SET_CONTENT",content:fe}),f({type:"CONTENT_SAVED"}),f({type:"CLOSE_IMPROVE"}),B(ae,"benchmark")}catch(ue){f({type:"SET_ERROR",error:ue.message})}},[a,r,B]),R=Fu(),I=v.useRef(null),P=v.useRef(0);v.useEffect(()=>{const ae=R.events;for(let fe=P.current;fe<ae.length;fe++){const ue=ae[fe],he=ue.data;if(ue.event==="progress"&&f({type:"AI_EDIT_PROGRESS",entry:{timestamp:Date.now(),phase:he.phase,message:he.message}}),ue.event==="done"){const be=he.improved,_e=he.reasoning,Me=he.evalChanges??[];f({type:"AI_EDIT_RESULT",improved:be,reasoning:_e,evalChanges:Me})}if(ue.event==="error"){const be=he;f({type:"AI_EDIT_ERROR",message:be.description||"Unknown error",classified:be})}}P.current=ae.length},[R.events]),v.useEffect(()=>{R.error&&f({type:"AI_EDIT_ERROR",message:R.error})},[R.error]),v.useEffect(()=>()=>{R.stop()},[R.stop]);const q=v.useCallback(async(ae,fe,ue)=>{u||(P.current=0,f({type:"AI_EDIT_LOADING"}),I.current=R.stop,R.start(`/api/skills/${a}/${r}/improve?sse`,{mode:"instruct",instruction:ae,content:m.skillContent,evals:m.evals??{skill_name:r,evals:[]},provider:fe,model:ue}))},[u,a,r,m.skillContent,m.evals,R]),ee=v.useCallback(()=>{R.stop(),f({type:"AI_EDIT_ERROR",message:"Cancelled"})},[R]),X=v.useCallback(async()=>{const ae=m.aiEditResult;if(ae!=null&&ae.improved)try{if(await Ne.applyImprovement(a,r,ae.improved),f({type:"SET_CONTENT",content:ae.improved}),f({type:"CONTENT_SAVED"}),m.aiEditEvalChanges.length>0&&Array.from(m.aiEditEvalSelections.values()).some(Boolean)){const{mergeEvalChanges:ue}=await Sd(async()=>{const{mergeEvalChanges:_e}=await import("./mergeEvalChanges-Dpbbs4d4.js");return{mergeEvalChanges:_e}},[]),he=m.evals??{skill_name:r,evals:[]},be=ue(he,m.aiEditEvalChanges,m.aiEditEvalSelections);try{const _e=await Ne.saveEvals(a,r,be);f({type:"SET_EVALS",evals:_e})}catch(_e){f({type:"SET_EVALS_RETRY",evalsFile:be}),f({type:"SET_ERROR",error:`SKILL.md saved, but test cases failed to save: ${_e.message}. You can retry from the AI Edit panel.`});return}}f({type:"CLOSE_AI_EDIT"})}catch(fe){f({type:"SET_ERROR",error:fe.message})}},[a,r,m.aiEditResult,m.evals,m.aiEditEvalChanges,m.aiEditEvalSelections]),_=v.useCallback(()=>{f({type:"CLOSE_AI_EDIT"})},[]),E=v.useCallback(ae=>{f({type:"TOGGLE_EVAL_CHANGE",index:ae})},[]),O=v.useCallback(()=>{f({type:"SELECT_ALL_EVAL_CHANGES"})},[]),te=v.useCallback(()=>{f({type:"DESELECT_ALL_EVAL_CHANGES"})},[]),Y=v.useCallback(async()=>{const ae=m.aiEditEvalsRetry;if(ae)try{const fe=await Ne.saveEvals(a,r,ae);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}`})}},[a,r,m.aiEditEvalsRetry]),me=v.useCallback(async()=>{try{const ae=await Ne.getSkillDetail(a,r);f({type:"SET_CONTENT",content:ae.skillContent}),f({type:"CONTENT_SAVED"})}catch{}},[a,r]),{config:L}=bl(),F=Fu(),ie=v.useRef(0);v.useEffect(()=>{const ae=F.events;for(let fe=ie.current;fe<ae.length;fe++){const ue=ae[fe],he=ue.data;if(ue.event==="progress"&&f({type:"GENERATE_EVALS_PROGRESS",entry:{timestamp:Date.now(),phase:he.phase,message:he.message}}),ue.event==="done"){const be=he;Ne.saveEvals(a,r,be).then(_e=>f({type:"GENERATE_EVALS_DONE",evals:_e})).catch(_e=>f({type:"SET_ERROR",error:_e.message}))}ue.event==="error"&&f({type:"GENERATE_EVALS_ERROR",classified:he})}ie.current=ae.length},[F.events,a,r]),v.useEffect(()=>{F.error&&f({type:"SET_ERROR",error:F.error})},[F.error]),v.useEffect(()=>()=>{F.stop()},[F.stop]);const de=v.useCallback(async ae=>{if(u)return;ie.current=0,f({type:"GENERATE_EVALS_START"});const fe={};L!=null&&L.provider&&(fe.provider=L.provider),L!=null&&L.model&&(fe.model=L.model);const ue=M2(ae==null?void 0:ae.testType);ue&&(fe.testType=ue),F.start(`/api/skills/${a}/${r}/generate-evals?sse`,Object.keys(fe).length>0?fe:void 0)},[u,a,r,F,L]),ge=Fu(),xe=v.useRef(0);v.useEffect(()=>()=>{ge.stop()},[ge.stop]),v.useEffect(()=>{const ae=ge.events;for(let fe=xe.current;fe<ae.length;fe++){const ue=ae[fe];if(ue.event==="classifying"){const he=ue.data;f({type:"ACTIVATION_CLASSIFYING",index:he.index,total:he.total})}if(ue.event==="prompt_result"&&f({type:"ACTIVATION_RESULT",result:ue.data}),ue.event==="done"){oe.current&&(clearTimeout(oe.current),oe.current=null);const he=ue.data;if(he.error)f({type:"ACTIVATION_ERROR",error:he.error});else{f({type:"ACTIVATION_DONE",summary:he});const be={id:`run-${Date.now()}`,timestamp:new Date().toISOString(),model:(L==null?void 0:L.model)||"unknown",provider:(L==null?void 0:L.provider)||"unknown",promptCount:he.total,summary:{precision:he.precision,recall:he.recall,reliability:he.reliability,tp:he.tp,tn:he.tn,fp:he.fp,fn:he.fn}};f({type:"ACTIVATION_HISTORY_LOADED",runs:[be,...m.activationHistory??[]]})}}}xe.current=ae.length},[ge.events,L,m.activationHistory]),v.useEffect(()=>{ge.error&&(oe.current&&(clearTimeout(oe.current),oe.current=null),f({type:"ACTIVATION_ERROR",error:ge.error}))},[ge.error]);const oe=v.useRef(null),le=v.useCallback(()=>{oe.current&&(clearTimeout(oe.current),oe.current=null),ge.stop(),f({type:"ACTIVATION_CANCEL",totalPrompts:0})},[ge]),ve=v.useCallback(ae=>{const ue=ae.trim().split(`
58
+ `).filter(Boolean).map(be=>be.startsWith("!")?{prompt:be.slice(1).trim(),expected:"should_not_activate"}:be.startsWith("+")?{prompt:be.slice(1).trim(),expected:"should_activate"}:{prompt:be.trim(),expected:"auto"});xe.current=0,f({type:"ACTIVATION_START"}),f({type:"SET_ACTIVATION_PROMPTS",prompts:ae});const he={prompts:ue};L!=null&&L.provider&&(he.provider=L.provider),L!=null&&L.model&&(he.model=L.model),ge.start(`/api/skills/${a}/${r}/activation-test`,he),oe.current&&clearTimeout(oe.current),oe.current=setTimeout(()=>{ge.stop(),f({type:"ACTIVATION_TIMEOUT"}),oe.current=null},12e4)},[a,r,ge,L]),Ue=v.useCallback(async(ae=8)=>{f({type:"GENERATE_PROMPTS_START"});try{const fe={count:ae};L!=null&&L.provider&&(fe.provider=L.provider),L!=null&&L.model&&(fe.model=L.model);const ue=await fetch(`/api/skills/${a}/${r}/activation-prompts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(fe)});if(!ue.ok){let ct=`HTTP ${ue.status}`;try{const Vt=await ue.json();Vt.error&&(ct=Vt.error)}catch{}throw new Error(ct)}const he=ue.body.getReader(),be=new TextDecoder;let _e="",Me="",dt=[];for(;;){const{done:ct,value:Vt}=await he.read();if(ct)break;_e+=be.decode(Vt,{stream:!0});const $t=_e.split(`
59
59
  `);_e=$t.pop()||"";for(const tt of $t)if(tt.startsWith("event: "))Me=tt.slice(7).trim();else if(tt.startsWith("data: ")){try{const jt=JSON.parse(tt.slice(6));if(Me==="done"){if(jt.error)throw new Error(jt.error);dt=jt.prompts||[]}if(Me==="error")throw new Error(jt.message||jt.description||"Generation failed")}catch(jt){if(!(jt instanceof SyntaxError))throw jt}Me=""}}const Zt=dt.map(ct=>`${ct.expected==="should_activate"?"+":"!"}${ct.prompt}`).join(`
60
- `);f({type:"SET_ACTIVATION_PROMPTS",prompts:Zt}),f({type:"GENERATE_PROMPTS_DONE"})}catch(fe){f({type:"GENERATE_PROMPTS_ERROR",error:fe.message})}},[a,r,z]),Be=v.useMemo(()=>({state:m,dispatch:f,isReadOnly:u,saveContent:k,saveEvals:T,runCase:B,runAll:I,cancelCase:L,cancelAll:V,improveForCase:w,applyImproveAndRerun:D,refreshSkillContent:me,generateEvals:de,runActivationTest:ve,cancelActivation:ae,generateActivationPrompts:Ie,fetchActivationHistory:E,submitAiEdit:q,cancelAiEdit:te,applyAiEdit:X,discardAiEdit:_,toggleEvalChange:R,selectAllEvalChanges:U,deselectAllEvalChanges:se,retryEvalsSave:Y}),[m,u,k,T,B,I,L,V,w,D,me,de,ve,ae,Ie,E,q,te,X,_,R,U,se,Y]);return n.jsx(Kv.Provider,{value:Be,children:o})}const ao=new Map,vl=new Map,hs=new Map;function ga(a){ao.delete(a),vl.delete(a);const r=hs.get(a);if(r)for(const i of r)i()}function Ds(a,r,i={}){const{ttl:o=3e4,enabled:u=!0}=i,[,m]=v.useState(0),f=v.useRef(!0),h=v.useRef(a);h.current=a;const x=()=>ga(a);v.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]),v.useEffect(()=>{if(!u)return;const j=()=>{f.current&&m(S=>S+1)};return hs.has(a)||hs.set(a,new Set),hs.get(a).add(j),()=>{var S;(S=hs.get(a))==null||S.delete(j)}},[a,u]),v.useEffect(()=>{if(!u)return;const j=ao.get(a);if(!(!j||Date.now()-j.fetchedAt>o))return;if(vl.has(a)){const E=vl.get(a),k=()=>{f.current&&h.current===a&&m(T=>T+1)};E.subscribers.push(k);return}const N={promise:Promise.resolve(),subscribers:[]},M=r().then(E=>{ao.set(a,{data:E,fetchedAt:Date.now()}),vl.delete(a),f.current&&h.current===a&&m(k=>k+1);for(const k of N.subscribers)k()},E=>{vl.delete(a),f.current&&h.current===a&&m(k=>k+1);for(const k of N.subscribers)k();throw E});N.promise=M,vl.set(a,N)},[a,r,o,u]);const p=ao.get(a),y=u&&!p&&vl.has(a);return{data:p==null?void 0:p.data,loading:y||u&&!p,error:void 0,revalidate:x}}function z2(a){if(!a)return[];const r=a.split(`
61
- `),i=[];for(const o of r)if(!(o.startsWith("--- ")||o.startsWith("+++ "))){if(o.startsWith("@@")){i.push({type:"header",content:o});continue}if(o.startsWith("+")){i.push({type:"add",content:o.slice(1)});continue}if(o.startsWith("-")){i.push({type:"remove",content:o.slice(1)});continue}(o.startsWith(" ")||o===""&&i.length>0)&&i.push({type:"context",content:o.startsWith(" ")?o.slice(1):""})}return i}function Bd({contentDiff:a,fromLabel:r,toLabel:i,diffSummary:o,maxHeight:u=480,collapsible:m=!1,renderContext:f="inline",onRetry:h}){const[x,p]=v.useState(m),[y,g]=v.useState("unified"),j=v.useRef(null),S=v.useRef(null),N=v.useMemo(()=>z2(a),[a]),M=v.useMemo(()=>{const L=N.filter(w=>w.type==="add").length,V=N.filter(w=>w.type==="remove").length;return{added:L,removed:V}},[N]),E=v.useMemo(()=>{let L=0,V=0;return N.filter(w=>w.type!=="header").map(w=>w.type==="remove"?(L++,{...w,origNum:L,newNum:null}):w.type==="add"?(V++,{...w,origNum:null,newNum:V}):(L++,V++,{...w,origNum:L,newNum:V}))},[N]),k=v.useMemo(()=>{const L=[],V=[];for(const w of E)if(w.type==="remove")L.push(w);else if(w.type==="add")V.push(w);else{for(;L.length<V.length;)L.push({type:"context",content:"",origNum:null,newNum:null});for(;V.length<L.length;)V.push({type:"context",content:"",origNum:null,newNum:null});L.push(w),V.push(w)}for(;L.length<V.length;)L.push({type:"context",content:"",origNum:null,newNum:null});for(;V.length<L.length;)V.push({type:"context",content:"",origNum:null,newNum:null});return{left:L,right:V}},[E]),T=v.useCallback(L=>{const V=L==="left"?j.current:S.current,w=L==="left"?S.current:j.current;V&&w&&(w.scrollTop=V.scrollTop)},[]);if(!a||N.length===0)return n.jsxs("div",{className:"rounded-lg p-6 text-center",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"Unable to load diff. Try again."}),h&&n.jsx("button",{onClick:h,className:"btn btn-secondary text-[12px]",children:"Retry"})]});const B=f==="modal"?"fixed inset-0 z-50 flex items-center justify-center bg-black/50":"",I=n.jsxs("div",{className:"rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:[r," → ",i]}),n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsxs("span",{style:{color:"var(--green)"},children:["+",M.added]}),n.jsxs("span",{style:{color:"var(--red)"},children:["-",M.removed]})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:()=>g(y==="unified"?"side-by-side":"unified"),className:"btn btn-ghost text-[11px]",children:y==="unified"?"Side-by-side":"Unified"}),m&&n.jsx("button",{onClick:()=>p(!x),className:"btn btn-ghost text-[11px]",children:x?"Expand":"Collapse"})]})]}),o&&n.jsx("div",{className:"mx-4 mt-3 px-4 py-2 rounded-lg text-[12px]",style:{background:"var(--accent-muted)",color:"var(--text-secondary)"},children:o}),!x&&(y==="unified"?n.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:u,overflowY:"auto"},children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:E.map((L,V)=>n.jsxs("tr",{style:{background:L.type==="add"?"rgba(34,197,94,0.08)":L.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:L.type==="remove"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:L.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:L.origNum??""}),n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:L.type==="add"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:L.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:L.newNum??""}),n.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:L.type==="add"?"var(--green)":L.type==="remove"?"var(--red)":"transparent",borderRight:L.type==="add"?"2px solid var(--green)":L.type==="remove"?"2px solid var(--red)":"2px solid transparent"},children:L.type==="add"?"+":L.type==="remove"?"-":" "}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:L.type==="add"?"var(--green)":L.type==="remove"?"var(--red)":"var(--text-secondary)"},children:L.content||"​"})]},V))})})}):n.jsxs("div",{className:"mx-4 my-4 grid grid-cols-2 gap-0 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:[n.jsx("div",{ref:j,style:{maxHeight:u,overflowY:"auto",borderRight:"1px solid var(--border-subtle)"},onScroll:()=>T("left"),children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:k.left.map((L,V)=>n.jsxs("tr",{style:{background:L.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:35,fontSize:10,color:"var(--text-tertiary)",opacity:.6,borderRight:"1px solid var(--border-subtle)"},children:L.origNum??""}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:L.type==="remove"?"var(--red)":"var(--text-secondary)"},children:L.content||"​"})]},V))})})}),n.jsx("div",{ref:S,style:{maxHeight:u,overflowY:"auto"},onScroll:()=>T("right"),children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:k.right.map((L,V)=>n.jsxs("tr",{style:{background:L.type==="add"?"rgba(34,197,94,0.08)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:35,fontSize:10,color:"var(--text-tertiary)",opacity:.6,borderRight:"1px solid var(--border-subtle)"},children:L.newNum??""}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:L.type==="add"?"var(--green)":"var(--text-secondary)"},children:L.content||"​"})]},V))})})})]}))]});return f==="modal"?n.jsx("div",{className:B,children:n.jsx("div",{style:{width:"80%",maxWidth:900},children:I})}):I}const zx={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 L2(a,r){return a?a.length>r?a.slice(0,r)+"…":a:""}function Wv(){const{state:a}=kn(),{plugin:r,skill:i}=a,{refreshSkills:o,updateCount:u}=ya(),m=`versions/${r}/${i}`,f=v.useCallback(()=>Ne.getSkillVersions(r,i),[r,i]),{data:h,loading:x}=Ds(m,f),[p,y]=v.useState(null),[g,j]=v.useState(null),[S,N]=v.useState(null),[M,E]=v.useState(!1),[k,T]=v.useState("idle"),[B,I]=v.useState(null),L=v.useRef(null),V=v.useRef(null),w=v.useMemo(()=>(h==null?void 0:h.find(X=>X.isInstalled))??null,[h]),D=v.useMemo(()=>(h==null?void 0:h[0])??null,[h]),A=w&&D&&w.version!==D.version,O=v.useCallback(X=>{p?!g&&X!==p?j(X):(y(X),j(null),N(null)):(y(X),N(null))},[p,g]),G=v.useCallback(async(X,_)=>{E(!0);try{const R=await Ne.getVersionDiff(r,i,X,_);N(R)}catch{N(null)}finally{E(!1)}},[r,i]);v.useEffect(()=>{if(p&&g){const X=h||[],_=X.findIndex(Y=>Y.version===p),R=X.findIndex(Y=>Y.version===g),[U,se]=_>R?[p,g]:[g,p];G(U,se)}},[p,g,h,G]);const q=v.useCallback(()=>{!w||!D||(y(w.version),j(D.version))},[w,D]),te=v.useCallback(()=>{T("updating"),I(null);const X=Ne.startSkillUpdate(r,i);L.current=X,X.addEventListener("progress",_=>{try{switch(JSON.parse(_.data).status){case"scanning":T("scanning");break;case"installing":T("installing");break;case"done":T("done");break}}catch{T("error"),I("Unexpected response from server")}}),X.addEventListener("done",()=>{X.close(),L.current=null,o(),ga(m),T("done")}),X.addEventListener("error",_=>{const R=_;let U="Connection lost";if(R.data)try{U=JSON.parse(R.data).error||"Update failed"}catch{}T("error"),I(U),X.close(),L.current=null})},[r,i,m,o]);return v.useEffect(()=>()=>{L.current&&(L.current.close(),L.current=null)},[]),x?n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"skeleton h-5 w-40 mb-4"}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"skeleton h-14 rounded-lg"}),n.jsx("div",{className:"skeleton h-14 rounded-lg"}),n.jsx("div",{className:"skeleton h-14 rounded-lg"})]})]}):!h||h.length===0?n.jsx("div",{className:"flex flex-col items-center justify-center h-full py-16",children:n.jsx("div",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No version history available"})}):n.jsxs("div",{className:"p-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Version History"}),n.jsxs("div",{className:"flex items-center gap-2",children:[A&&n.jsx("button",{onClick:q,className:"btn btn-secondary text-[11px]",children:"View changes since installed"}),A&&k!=="done"&&(k==="error"?n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--red)"},children:B||"Update failed"}),n.jsx("button",{onClick:te,className:"btn btn-secondary text-[11px]",children:"Retry"})]}):n.jsx("button",{onClick:te,disabled:k!=="idle",className:"btn btn-primary text-[11px]",children:k==="idle"?`Update to ${D==null?void 0:D.version}`:k==="updating"?"Starting update...":k==="scanning"?"Scanning...":"Installing..."})),u>1&&n.jsxs("button",{onClick:()=>{window.location.hash="#/updates"},className:"text-[11px] hover:underline",style:{color:"var(--text-tertiary)",background:"transparent",border:"none",cursor:"pointer"},children:["Manage all updates (",u,")"]})]})]}),p&&!g&&n.jsxs("div",{className:"text-[11px] mb-3 px-3 py-2 rounded-lg",style:{background:"var(--accent-muted)",color:"var(--accent)"},children:["Click another version to compare with ",p]}),n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute left-3 top-0 bottom-0",style:{width:2,background:"var(--border-subtle)"}}),n.jsx("div",{className:"space-y-1",children:h.map(X=>{const _=zx[X.certTier]||zx.COMMUNITY,R=X.version===p||X.version===g,U=X.isInstalled;return n.jsxs("button",{onClick:()=>O(X.version),className:"w-full text-left pl-8 pr-4 py-3 relative rounded-lg transition-all duration-150",style:{background:R?"var(--accent-muted)":"transparent",border:R?"1px solid var(--accent)":"1px solid transparent",cursor:"pointer"},onMouseEnter:se=>{R||(se.currentTarget.style.background="var(--surface-1)")},onMouseLeave:se=>{R||(se.currentTarget.style.background="transparent")},children:[n.jsx("span",{className:"absolute left-1.5 top-4 rounded-full",style:{width:U?10:8,height:U?10:8,background:U?"var(--accent)":"var(--surface-3)",border:U?"2px solid var(--accent)":"2px solid var(--border-default)"}}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:X.version}),n.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:_.bg,color:_.text},children:X.certTier}),U&&n.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:"var(--accent-muted)",color:"var(--accent)"},children:"installed"})]}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:new Date(X.createdAt).toLocaleDateString()})]}),X.diffSummary&&n.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:L2(X.diffSummary,80)})]},X.version)})}),n.jsx("div",{ref:V,style:{height:1}})]}),M&&n.jsx("div",{className:"mt-4",children:n.jsx("div",{className:"skeleton h-48 rounded-xl"})}),S&&!M&&n.jsx("div",{className:"mt-4",children:n.jsx(Bd,{contentDiff:S.contentDiff,fromLabel:S.from,toLabel:S.to,diffSummary:S.diffSummary,renderContext:"inline",onRetry:()=>p&&g&&G(S.from,S.to)})})]})}function _2(a){return a==null?"var(--text-tertiary)":a>=.7?"var(--green)":a>=.4?"var(--yellow)":"var(--red)"}function O2(a){return a==null?"var(--surface-3)":a>=.7?"var(--green-muted)":a>=.4?"var(--yellow-muted)":"var(--red-muted)"}function Lx(a,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:a,severity:r}}))}function Ud(a){return a.skill?U2({skill:a.skill}):I2({state:a.state,isReadOnly:a.isReadOnly,onDelete:a.onDelete})}function B2(a,r=48){if(a.length<=r)return a;const i=a.slice(0,12),o=a.slice(a.length-(r-12-1));return`${i}…${o}`}function U2({skill:a}){const[r,i]=v.useState(!1),o=v.useCallback(async()=>{var f;try{await((f=navigator.clipboard)==null?void 0:f.writeText(a.dir)),i(!0),setTimeout(()=>i(!1),1500),Lx(Z.toasts.pathCopied,"info")}catch{Lx(Z.toasts.permissionDenied,"error")}},[a.dir]),u=a.origin==="installed"?"Installed":"Own",m=a.origin==="installed"?"var(--status-installed)":"var(--status-own)";return n.jsxs("div",{"data-testid":"detail-header",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px",boxShadow:"none"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",marginBottom:4},children:[n.jsx("span",{"data-testid":"detail-header-plugin",children:a.plugin}),n.jsx("span",{"aria-hidden":"true",style:{color:"var(--text-secondary)"},children:"›"}),n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--text-secondary)",fontSize:11,letterSpacing:.3,textTransform:"uppercase"},children:[n.jsx("span",{"data-origin-dot":a.origin,"aria-label":`Origin: ${u}`,style:{display:"inline-block",width:7,height:7,borderRadius:999,background:m}}),u]})]}),n.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:12,marginBottom:8},children:[n.jsx("h2",{"data-testid":"detail-header-name",style:{fontFamily:"var(--font-serif)",fontSize:20,fontWeight:500,lineHeight:1.25,color:"var(--text-primary)",margin:0},children:a.skill}),n.jsx("span",{"data-testid":"detail-header-version",style:{fontFamily:"var(--font-sans)",fontVariantNumeric:"tabular-nums",fontSize:12,color:"var(--text-secondary)",whiteSpace:"nowrap"},children:a.version??"—"})]}),n.jsx(H2,{skill:a}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[n.jsx("button",{type:"button","data-testid":"detail-header-path-chip",title:a.dir,"aria-label":`Copy path ${a.dir} to clipboard`,onClick:o,style:{display:"inline-flex",alignItems:"center",padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"},children:B2(a.dir||"—")}),n.jsxs("button",{"data-testid":"detail-header-copy-path",type:"button",onClick:o,"aria-label":"Copy skill path to clipboard",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:11,cursor:"pointer"},children:[n.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),n.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),r?"Copied":"Copy"]})]})]})}function H2({skill:a}){const r=a.installMethod,i=a.symlinkTarget;if(!r)return null;let o="";switch(r){case"symlinked":o=i?`Symlinked from ${i}`:"Symlinked (target unresolved)";break;case"copied":o="Copied (independent)";break;case"authored":o="Authored";break;default:return null}return n.jsxs("div",{"data-testid":"detail-header-install-method",style:{display:"flex",alignItems:"center",gap:6,fontSize:11,color:"var(--text-secondary)",fontFamily:"var(--font-sans)",margin:"6px 0 8px"},children:[n.jsx("span",{style:{fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",fontSize:10,color:"var(--text-tertiary)"},children:"Install method"}),n.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:o})]})}function I2({state:a,isReadOnly:r,onDelete:i}){const{plugin:o,skill:u,evals:m,latestBenchmark:f,isDirty:h,caseRunStates:x,regressions:p,iterationCount:y}=a,g=Array.from(x.values()).some(k=>k.status==="running"||k.status==="queued"),j=f==null?void 0:f.overall_pass_rate,S=(m==null?void 0:m.evals.reduce((k,T)=>k+T.assertions.length,0))??0,N=(m==null?void 0:m.evals.length)??0,M=_2(j),E=O2(j);return n.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)",flexShrink:0},children:[n.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[n.jsx("span",{style:{color:"var(--text-tertiary)"},children:o}),n.jsx(V2,{}),n.jsx("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:u}),r&&n.jsxs("span",{className:"ml-2 flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:[n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"installed"]}),h&&n.jsx("span",{className:"ml-2 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded",style:{background:"var(--yellow-muted)",color:"var(--yellow)"},children:"unsaved"}),g&&n.jsxs("span",{className:"ml-2 flex items-center gap-1.5 text-[11px]",style:{color:"var(--accent)"},children:[n.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}}),"Running..."]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[!r&&i&&n.jsx("button",{disabled:g,onClick:()=>{window.confirm(`Delete skill "${u}"? This cannot be undone.`)&&i()},title:"Delete skill",className:"flex items-center justify-center transition-colors duration-150",style:{background:"none",border:"none",cursor:g?"not-allowed":"pointer",color:"var(--text-tertiary)",padding:4,opacity:g?.4:1,borderRadius:4},onMouseEnter:k=>{g||(k.currentTarget.style.color="var(--red)")},onMouseLeave:k=>{k.currentTarget.style.color="var(--text-tertiary)"},children:n.jsx($2,{})}),p.length>0&&n.jsxs("span",{className:"pill",style:{background:"var(--red-muted)",color:"var(--red)"},children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[n.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),n.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),n.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),p.length," regression",p.length>1?"s":""]}),y>0&&n.jsxs("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)"},children:["Iter ",y]}),n.jsx("span",{className:"pill",style:{background:E,color:M},children:j!=null?`${Math.round(j*100)}%`:"--"}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[N," case",N!==1?"s":""," / ",S," assert",S!==1?"s":""]})]})]})}function V2(){return n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})}function $2(){return n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"3 6 5 6 21 6"}),n.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),n.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),n.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}const G2=[{label:"Build",tabs:[{id:"editor",label:"Editor",shortcut:"1"},{id:"tests",label:"Tests",shortcut:"2"}]},{label:"Evaluate",tabs:[{id:"run",label:"Run",shortcut:"3"},{id:"activation",label:"Activation",shortcut:"4"}]},{label:"Insights",tabs:[{id:"history",label:"History",shortcut:"5"},{id:"leaderboard",label:"Leaderboard",shortcut:"6"},{id:"deps",label:"Deps",shortcut:"7"},{id:"versions",label:"Versions",shortcut:"8"}]}];function P2({id:a}){const r={width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"};switch(a){case"editor":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),n.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]});case"tests":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M9 11l3 3L22 4"}),n.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]});case"run":return n.jsx("svg",{...r,children:n.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})});case"activation":return n.jsxs("svg",{...r,children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("circle",{cx:"12",cy:"12",r:"6"}),n.jsx("circle",{cx:"12",cy:"12",r:"2"})]});case"history":return n.jsxs("svg",{...r,children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("polyline",{points:"12 6 12 12 16 14"})]});case"leaderboard":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M18 20V10"}),n.jsx("path",{d:"M12 20V4"}),n.jsx("path",{d:"M6 20v-6"})]});case"deps":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),n.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]});case"versions":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M12 8v4l3 3"}),n.jsx("path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"})]})}}function q2({activePanel:a,onPanelChange:r,isDirty:i,isRunning:o,hasRegressions:u,isActivationRunning:m,hasUpdate:f}){return n.jsx("div",{className:"flex items-center gap-0.5 px-3 overflow-x-auto",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)",flexShrink:0},children:G2.map((h,x)=>n.jsxs("div",{className:"flex items-center",children:[x>0&&n.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)",margin:"0 6px",flexShrink:0}}),h.tabs.map(p=>{const y=a===p.id,g=p.id==="editor"&&i||p.id==="run"&&o||p.id==="activation"&&m||p.id==="history"&&u||p.id==="versions"&&f,j=p.id==="run"||p.id==="activation"?"var(--accent)":p.id==="history"?"var(--red)":"var(--yellow)";return n.jsxs("button",{onClick:()=>r(p.id),title:`${p.label} (Ctrl+${p.shortcut})`,className:"relative flex items-center gap-1.5 px-3 py-2.5 text-[12px] font-medium transition-colors duration-150",style:{background:"transparent",color:y?"var(--text-primary)":"var(--text-tertiary)",borderBottom:y?"2px solid var(--accent)":"2px solid transparent",cursor:"pointer",border:"none",borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:y?"var(--accent)":"transparent",whiteSpace:"nowrap"},onMouseEnter:S=>{y||(S.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:S=>{y||(S.currentTarget.style.color="var(--text-tertiary)")},children:[n.jsx(P2,{id:p.id}),p.label,g&&n.jsx("span",{className:"absolute top-1.5 right-1 rounded-full",style:{width:5,height:5,background:j}})]},p.id)})]},h.label))})}const _x={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 zs({error:a,onRetry:r,onDismiss:i}){const[o,u]=v.useState(null),m=v.useRef(null);v.useEffect(()=>(a.category==="rate_limit"&&a.retryAfterMs?u(Math.ceil(a.retryAfterMs/1e3)):u(null),()=>{m.current&&clearInterval(m.current)}),[a]),v.useEffect(()=>{if(!(o==null||o<=0))return m.current=setInterval(()=>{u(x=>x==null||x<=1?(m.current&&clearInterval(m.current),0):x-1)},1e3),()=>{m.current&&clearInterval(m.current)}},[o!=null&&o>0]);const f=_x[a.category]||_x.unknown,h=o!=null&&o>0;return n.jsxs("div",{className:"rounded-lg overflow-hidden animate-fade-in",style:{border:`1px solid color-mix(in srgb, ${f.color} 30%, transparent)`,background:`color-mix(in srgb, ${f.color} 6%, var(--surface-1))`},children:[n.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{style:{fontSize:14},children:f.icon}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:f.color},children:a.title})]}),i&&n.jsx("button",{onClick:i,className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)"},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsxs("div",{className:"px-3.5 pb-3",children:[n.jsx("p",{className:"text-[11.5px] mb-1.5",style:{color:"var(--text-secondary)"},children:a.description}),n.jsx("p",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:a.hint}),(r||o!=null)&&n.jsx("div",{className:"flex items-center gap-2 mt-2.5",children:r&&n.jsx("button",{onClick:r,disabled:h,className:"btn btn-secondary text-[11px]",style:{padding:"4px 10px",opacity:h?.5:1},children:h?`Retry in ${o}s`:"Retry"})})]})]})}class Y2 extends v.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(r,i){console.error("ErrorBoundary caught:",r,i.componentStack)}render(){return this.state.hasError?n.jsxs("div",{style:{padding:24,textAlign:"center"},children:[n.jsx("p",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)"},children:"Something went wrong"}),n.jsx("p",{style:{fontSize:12,color:"var(--text-tertiary)",marginTop:8},children:"An unexpected error occurred in this panel."}),n.jsx("button",{onClick:()=>window.location.reload(),className:"btn btn-secondary",style:{marginTop:16,fontSize:12},children:"Reload"})]}):this.props.children}}function F2(a){const r=a.toLowerCase();return/rate.?limit|429|quota.?exceeded/.test(r)?{category:"rate_limit",title:"Rate Limit",description:a,hint:"Wait a moment and try again.",retryable:!0}:/401|unauthorized|invalid.?api.?key|authentication/.test(r)?{category:"auth",title:"Authentication Failed",description:a,hint:"Check your API key or credentials.",retryable:!1}:/timeout|timed?.?out|etimedout/.test(r)?{category:"timeout",title:"Request Timed Out",description:a,hint:"The request took too long. Try again.",retryable:!0}:/model\b.*not found/.test(r)?{category:"model_not_found",title:"Model Not Found",description:a,hint:"The selected model is not available. Try switching to a different model in the dropdown above.",retryable:!1}:/context.?(?:window|length)|token.?(?:limit|count|exceed)|too (?:long|large)|maximum.?context|input.?too.?long|prompt.?too.?(?:long|large)/.test(r)?{category:"context_window",title:"Content Too Large",description:a,hint:"Reduce SKILL.md size or move detailed content to references/ files.",retryable:!1}:/enoent|command not found|502|503|service.?unavailable|connection.?refused|econnrefused|server.?error/.test(r)?{category:"provider_unavailable",title:"Provider Unavailable",description:a,hint:"Check that the provider is installed and running.",retryable:!1}:/syntaxerror|json\.?parse|parse.?error|failed to parse|not valid json|unexpected token/.test(r)?{category:"parse_error",title:"Response Parse Error",description:a,hint:"Try again. If this persists, try a different model.",retryable:!0}:{category:"unknown",title:"Error",description:a,hint:"",retryable:!1}}function K2(a){const r=a.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!r)return{metadata:{},body:a};const i=r[1],o=r[2].trim(),u={},m=i.split(`
62
- `);let f="",h=!1;for(const x of m){const p=x.match(/^[ \t]+([\w-]+):\s*(.*)$/);if(p&&f&&h){const j=p[1],S=p[2].trim();let N=u[f];if((typeof N!="object"||Array.isArray(N))&&(N={},u[f]=N),!S)N[j]=[];else{const M=S.match(/^\[(.+)\]$/);M?N[j]=M[1].split(",").map(E=>E.trim().replace(/^["']|["']$/g,"")).filter(Boolean):N[j]=S.replace(/^["']|["']$/g,"")}continue}const y=x.match(/^\s+-\s+(.+)$/);if(y&&f){h=!1;const j=u[f];Array.isArray(j)?j.push(y[1].trim().replace(/^["']|["']$/g,"")):u[f]=[y[1].trim().replace(/^["']|["']$/g,"")];continue}const g=x.match(/^([\w-]+):\s*(.*)$/);if(g){f=g[1];const j=g[2].trim();if(h=!1,!j){u[f]={},h=!0;continue}const S=j.match(/^\[(.+)\]$/);if(S){u[f]=S[1].split(",").map(N=>N.trim().replace(/^["']|["']$/g,"")).filter(Boolean);continue}u[f]=j.replace(/^["']|["']$/g,"")}}return{metadata:u,body:o}}function go(a){if(!a)return"";try{let r=a.replace(/^---\n[\s\S]*?\n---\n?/,""),i=W2(r);return i=i.replace(/```(\w*)\n([\s\S]*?)```/g,'<pre style="background:var(--surface-2);padding:0.75rem;border-radius:6px;overflow-x:auto;font-size:12px;line-height:1.5;margin:0.5rem 0;border:1px solid var(--border-subtle)"><code>$2</code></pre>'),i=i.replace(/^### (.+)$/gm,'<div style="font-weight:600;font-size:14px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),i=i.replace(/^## (.+)$/gm,'<div style="font-weight:700;font-size:15px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),i=i.replace(/^# (.+)$/gm,'<div style="font-weight:700;font-size:1rem;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),i=i.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer" style="color:var(--accent);text-decoration:underline">$1</a>'),i=i.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),i=i.replace(/\*([^*]+)\*/g,"<em>$1</em>"),i=i.replace(/`([^`]+)`/g,'<code style="background:var(--surface-3);padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em">$1</code>'),i=i.replace(/^- (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">• $1</div>'),i=i.replace(/^(\d+)\. (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">$1. $2</div>'),i=i.replace(/\n\n/g,'<div style="height:0.5rem"></div>'),i=i.replace(/\n/g,"<br/>"),i}catch{return`<pre style="white-space:pre-wrap;font-size:12px;line-height:1.5">${a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}</pre>`}}function W2(a){const r=a.split(`
63
- `),i=[];let o=0;for(;o<r.length;)if(r[o].trim().startsWith("|")&&o+1<r.length&&r[o+1].trim().startsWith("|")&&/\|[\s-:]+\|/.test(r[o+1])){const u=Ox(r[o]);o+=2;const m=[];for(;o<r.length&&r[o].trim().startsWith("|");)m.push(Ox(r[o])),o++;const f='style="text-align:left;padding:0.4rem 0.6rem;font-weight:600;font-size:12px;color:var(--text-primary);border-bottom:1px solid var(--border-default)"',h='style="padding:0.4rem 0.6rem;font-size:12px;color:var(--text-secondary);border-bottom:1px solid var(--border-subtle)"';let x='<table style="width:100%;border-collapse:collapse;margin:0.5rem 0;border:1px solid var(--border-subtle);border-radius:6px;overflow:hidden">';x+="<thead><tr>";for(const p of u)x+=`<th ${f}>${p}</th>`;x+="</tr></thead><tbody>";for(const p of m){x+="<tr>";for(const y of p)x+=`<td ${h}>${y}</td>`;x+="</tr>"}x+="</tbody></table>",i.push(x)}else i.push(r[o]),o++;return i.join(`
64
- `)}function Ox(a){return a.split("|").map(r=>r.trim()).filter(r=>r.length>0)}function yo(a,r){const i=a.split(`
60
+ `);f({type:"SET_ACTIVATION_PROMPTS",prompts:Zt}),f({type:"GENERATE_PROMPTS_DONE"})}catch(fe){f({type:"GENERATE_PROMPTS_ERROR",error:fe.message})}},[a,r,L]),Be=v.useMemo(()=>({state:m,dispatch:f,isReadOnly:u,saveContent:k,saveEvals:M,runCase:B,runAll:V,cancelCase:A,cancelAll:U,improveForCase:C,applyImproveAndRerun:z,refreshSkillContent:me,generateEvals:de,runActivationTest:ve,cancelActivation:le,generateActivationPrompts:Ue,fetchActivationHistory:T,submitAiEdit:q,cancelAiEdit:ee,applyAiEdit:X,discardAiEdit:_,toggleEvalChange:E,selectAllEvalChanges:O,deselectAllEvalChanges:te,retryEvalsSave:Y}),[m,u,k,M,B,V,A,U,C,z,me,de,ve,le,Ue,T,q,ee,X,_,E,O,te,Y]);return n.jsx(Kv.Provider,{value:Be,children:o})}const ao=new Map,vl=new Map,hs=new Map;function ga(a){ao.delete(a),vl.delete(a);const r=hs.get(a);if(r)for(const i of r)i()}function Ds(a,r,i={}){const{ttl:o=3e4,enabled:u=!0}=i,[,m]=v.useState(0),f=v.useRef(!0),h=v.useRef(a);h.current=a;const x=()=>ga(a);v.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]),v.useEffect(()=>{if(!u)return;const j=()=>{f.current&&m(S=>S+1)};return hs.has(a)||hs.set(a,new Set),hs.get(a).add(j),()=>{var S;(S=hs.get(a))==null||S.delete(j)}},[a,u]),v.useEffect(()=>{if(!u)return;const j=ao.get(a);if(!(!j||Date.now()-j.fetchedAt>o))return;if(vl.has(a)){const T=vl.get(a),k=()=>{f.current&&h.current===a&&m(M=>M+1)};T.subscribers.push(k);return}const N={promise:Promise.resolve(),subscribers:[]},D=r().then(T=>{ao.set(a,{data:T,fetchedAt:Date.now()}),vl.delete(a),f.current&&h.current===a&&m(k=>k+1);for(const k of N.subscribers)k()},T=>{vl.delete(a),f.current&&h.current===a&&m(k=>k+1);for(const k of N.subscribers)k();throw T});N.promise=D,vl.set(a,N)},[a,r,o,u]);const p=ao.get(a),y=u&&!p&&vl.has(a);return{data:p==null?void 0:p.data,loading:y||u&&!p,error:void 0,revalidate:x}}function z2(a){if(!a)return[];const r=a.split(`
61
+ `),i=[];for(const o of r)if(!(o.startsWith("--- ")||o.startsWith("+++ "))){if(o.startsWith("@@")){i.push({type:"header",content:o});continue}if(o.startsWith("+")){i.push({type:"add",content:o.slice(1)});continue}if(o.startsWith("-")){i.push({type:"remove",content:o.slice(1)});continue}(o.startsWith(" ")||o===""&&i.length>0)&&i.push({type:"context",content:o.startsWith(" ")?o.slice(1):""})}return i}function Id({contentDiff:a,fromLabel:r,toLabel:i,diffSummary:o,maxHeight:u=480,collapsible:m=!1,renderContext:f="inline",onRetry:h}){const[x,p]=v.useState(m),[y,g]=v.useState("unified"),j=v.useRef(null),S=v.useRef(null),N=v.useMemo(()=>z2(a),[a]),D=v.useMemo(()=>{const A=N.filter(C=>C.type==="add").length,U=N.filter(C=>C.type==="remove").length;return{added:A,removed:U}},[N]),T=v.useMemo(()=>{let A=0,U=0;return N.filter(C=>C.type!=="header").map(C=>C.type==="remove"?(A++,{...C,origNum:A,newNum:null}):C.type==="add"?(U++,{...C,origNum:null,newNum:U}):(A++,U++,{...C,origNum:A,newNum:U}))},[N]),k=v.useMemo(()=>{const A=[],U=[];for(const C of T)if(C.type==="remove")A.push(C);else if(C.type==="add")U.push(C);else{for(;A.length<U.length;)A.push({type:"context",content:"",origNum:null,newNum:null});for(;U.length<A.length;)U.push({type:"context",content:"",origNum:null,newNum:null});A.push(C),U.push(C)}for(;A.length<U.length;)A.push({type:"context",content:"",origNum:null,newNum:null});for(;U.length<A.length;)U.push({type:"context",content:"",origNum:null,newNum:null});return{left:A,right:U}},[T]),M=v.useCallback(A=>{const U=A==="left"?j.current:S.current,C=A==="left"?S.current:j.current;U&&C&&(C.scrollTop=U.scrollTop)},[]);if(!a||N.length===0)return n.jsxs("div",{className:"rounded-lg p-6 text-center",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"Unable to load diff. Try again."}),h&&n.jsx("button",{onClick:h,className:"btn btn-secondary text-[12px]",children:"Retry"})]});const B=f==="modal"?"fixed inset-0 z-50 flex items-center justify-center bg-black/50":"",V=n.jsxs("div",{className:"rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:[r," → ",i]}),n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsxs("span",{style:{color:"var(--green)"},children:["+",D.added]}),n.jsxs("span",{style:{color:"var(--red)"},children:["-",D.removed]})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:()=>g(y==="unified"?"side-by-side":"unified"),className:"btn btn-ghost text-[11px]",children:y==="unified"?"Side-by-side":"Unified"}),m&&n.jsx("button",{onClick:()=>p(!x),className:"btn btn-ghost text-[11px]",children:x?"Expand":"Collapse"})]})]}),o&&n.jsx("div",{className:"mx-4 mt-3 px-4 py-2 rounded-lg text-[12px]",style:{background:"var(--accent-muted)",color:"var(--text-secondary)"},children:o}),!x&&(y==="unified"?n.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:u,overflowY:"auto"},children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:T.map((A,U)=>n.jsxs("tr",{style:{background:A.type==="add"?"rgba(34,197,94,0.08)":A.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:A.type==="remove"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:A.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:A.origNum??""}),n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:A.type==="add"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:A.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:A.newNum??""}),n.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:A.type==="add"?"var(--green)":A.type==="remove"?"var(--red)":"transparent",borderRight:A.type==="add"?"2px solid var(--green)":A.type==="remove"?"2px solid var(--red)":"2px solid transparent"},children:A.type==="add"?"+":A.type==="remove"?"-":" "}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:A.type==="add"?"var(--green)":A.type==="remove"?"var(--red)":"var(--text-secondary)"},children:A.content||"​"})]},U))})})}):n.jsxs("div",{className:"mx-4 my-4 grid grid-cols-2 gap-0 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:[n.jsx("div",{ref:j,style:{maxHeight:u,overflowY:"auto",borderRight:"1px solid var(--border-subtle)"},onScroll:()=>M("left"),children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:k.left.map((A,U)=>n.jsxs("tr",{style:{background:A.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:35,fontSize:10,color:"var(--text-tertiary)",opacity:.6,borderRight:"1px solid var(--border-subtle)"},children:A.origNum??""}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:A.type==="remove"?"var(--red)":"var(--text-secondary)"},children:A.content||"​"})]},U))})})}),n.jsx("div",{ref:S,style:{maxHeight:u,overflowY:"auto"},onScroll:()=>M("right"),children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:k.right.map((A,U)=>n.jsxs("tr",{style:{background:A.type==="add"?"rgba(34,197,94,0.08)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:35,fontSize:10,color:"var(--text-tertiary)",opacity:.6,borderRight:"1px solid var(--border-subtle)"},children:A.newNum??""}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:A.type==="add"?"var(--green)":"var(--text-secondary)"},children:A.content||"​"})]},U))})})})]}))]});return f==="modal"?n.jsx("div",{className:B,children:n.jsx("div",{style:{width:"80%",maxWidth:900},children:V})}):V}const Lx={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 L2(a,r){return a?a.length>r?a.slice(0,r)+"…":a:""}function Qv(){const{state:a}=kn(),{plugin:r,skill:i}=a,{refreshSkills:o,updateCount:u}=ya(),m=`versions/${r}/${i}`,f=v.useCallback(()=>Ne.getSkillVersions(r,i),[r,i]),{data:h,loading:x}=Ds(m,f),[p,y]=v.useState(null),[g,j]=v.useState(null),[S,N]=v.useState(null),[D,T]=v.useState(!1),[k,M]=v.useState("idle"),[B,V]=v.useState(null),A=v.useRef(null),U=v.useRef(null),C=v.useMemo(()=>(h==null?void 0:h.find(X=>X.isInstalled))??null,[h]),z=v.useMemo(()=>(h==null?void 0:h[0])??null,[h]),R=C&&z&&C.version!==z.version,I=v.useCallback(X=>{p?!g&&X!==p?j(X):(y(X),j(null),N(null)):(y(X),N(null))},[p,g]),P=v.useCallback(async(X,_)=>{T(!0);try{const E=await Ne.getVersionDiff(r,i,X,_);N(E)}catch{N(null)}finally{T(!1)}},[r,i]);v.useEffect(()=>{if(p&&g){const X=h||[],_=X.findIndex(Y=>Y.version===p),E=X.findIndex(Y=>Y.version===g),[O,te]=_>E?[p,g]:[g,p];P(O,te)}},[p,g,h,P]);const q=v.useCallback(()=>{!C||!z||(y(C.version),j(z.version))},[C,z]),ee=v.useCallback(()=>{M("updating"),V(null);const X=Ne.startSkillUpdate(r,i);A.current=X,X.addEventListener("progress",_=>{try{switch(JSON.parse(_.data).status){case"scanning":M("scanning");break;case"installing":M("installing");break;case"done":M("done");break}}catch{M("error"),V("Unexpected response from server")}}),X.addEventListener("done",()=>{X.close(),A.current=null,o(),ga(m),M("done")}),X.addEventListener("error",_=>{const E=_;let O="Connection lost";if(E.data)try{O=JSON.parse(E.data).error||"Update failed"}catch{}M("error"),V(O),X.close(),A.current=null})},[r,i,m,o]);return v.useEffect(()=>()=>{A.current&&(A.current.close(),A.current=null)},[]),x?n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"skeleton h-5 w-40 mb-4"}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"skeleton h-14 rounded-lg"}),n.jsx("div",{className:"skeleton h-14 rounded-lg"}),n.jsx("div",{className:"skeleton h-14 rounded-lg"})]})]}):!h||h.length===0?n.jsx("div",{className:"flex flex-col items-center justify-center h-full py-16",children:n.jsx("div",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No version history available"})}):n.jsxs("div",{className:"p-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Version History"}),n.jsxs("div",{className:"flex items-center gap-2",children:[R&&n.jsx("button",{onClick:q,className:"btn btn-secondary text-[11px]",children:"View changes since installed"}),R&&k!=="done"&&(k==="error"?n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--red)"},children:B||"Update failed"}),n.jsx("button",{onClick:ee,className:"btn btn-secondary text-[11px]",children:"Retry"})]}):n.jsx("button",{onClick:ee,disabled:k!=="idle",className:"btn btn-primary text-[11px]",children:k==="idle"?`Update to ${z==null?void 0:z.version}`:k==="updating"?"Starting update...":k==="scanning"?"Scanning...":"Installing..."})),u>1&&n.jsxs("button",{onClick:()=>{window.location.hash="#/updates"},className:"text-[11px] hover:underline",style:{color:"var(--text-tertiary)",background:"transparent",border:"none",cursor:"pointer"},children:["Manage all updates (",u,")"]})]})]}),p&&!g&&n.jsxs("div",{className:"text-[11px] mb-3 px-3 py-2 rounded-lg",style:{background:"var(--accent-muted)",color:"var(--accent)"},children:["Click another version to compare with ",p]}),n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute left-3 top-0 bottom-0",style:{width:2,background:"var(--border-subtle)"}}),n.jsx("div",{className:"space-y-1",children:h.map(X=>{const _=Lx[X.certTier]||Lx.COMMUNITY,E=X.version===p||X.version===g,O=X.isInstalled;return n.jsxs("button",{onClick:()=>I(X.version),className:"w-full text-left pl-8 pr-4 py-3 relative rounded-lg transition-all duration-150",style:{background:E?"var(--accent-muted)":"transparent",border:E?"1px solid var(--accent)":"1px solid transparent",cursor:"pointer"},onMouseEnter:te=>{E||(te.currentTarget.style.background="var(--surface-1)")},onMouseLeave:te=>{E||(te.currentTarget.style.background="transparent")},children:[n.jsx("span",{className:"absolute left-1.5 top-4 rounded-full",style:{width:O?10:8,height:O?10:8,background:O?"var(--accent)":"var(--surface-3)",border:O?"2px solid var(--accent)":"2px solid var(--border-default)"}}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:X.version}),n.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:_.bg,color:_.text},children:X.certTier}),O&&n.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:"var(--accent-muted)",color:"var(--accent)"},children:"installed"})]}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:new Date(X.createdAt).toLocaleDateString()})]}),X.diffSummary&&n.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:L2(X.diffSummary,80)})]},X.version)})}),n.jsx("div",{ref:U,style:{height:1}})]}),D&&n.jsx("div",{className:"mt-4",children:n.jsx("div",{className:"skeleton h-48 rounded-xl"})}),S&&!D&&n.jsx("div",{className:"mt-4",children:n.jsx(Id,{contentDiff:S.contentDiff,fromLabel:S.from,toLabel:S.to,diffSummary:S.diffSummary,renderContext:"inline",onRetry:()=>p&&g&&P(S.from,S.to)})})]})}function _2(a){return a==null?"var(--text-tertiary)":a>=.7?"var(--green)":a>=.4?"var(--yellow)":"var(--red)"}function O2(a){return a==null?"var(--surface-3)":a>=.7?"var(--green-muted)":a>=.4?"var(--yellow-muted)":"var(--red-muted)"}function _x(a,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:a,severity:r}}))}function Hd(a){return a.skill?I2({skill:a.skill}):U2({state:a.state,isReadOnly:a.isReadOnly,onDelete:a.onDelete})}function B2(a,r=48){if(a.length<=r)return a;const i=a.slice(0,12),o=a.slice(a.length-(r-12-1));return`${i}…${o}`}function I2({skill:a}){const[r,i]=v.useState(!1),o=v.useCallback(async()=>{var f;try{await((f=navigator.clipboard)==null?void 0:f.writeText(a.dir)),i(!0),setTimeout(()=>i(!1),1500),_x(Z.toasts.pathCopied,"info")}catch{_x(Z.toasts.permissionDenied,"error")}},[a.dir]),u=a.origin==="installed"?"Installed":"Own",m=a.origin==="installed"?"var(--status-installed)":"var(--status-own)";return n.jsxs("div",{"data-testid":"detail-header",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px",boxShadow:"none"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",marginBottom:4},children:[n.jsx("span",{"data-testid":"detail-header-plugin",children:a.plugin}),n.jsx("span",{"aria-hidden":"true",style:{color:"var(--text-secondary)"},children:"›"}),n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--text-secondary)",fontSize:11,letterSpacing:.3,textTransform:"uppercase"},children:[n.jsx("span",{"data-origin-dot":a.origin,"aria-label":`Origin: ${u}`,style:{display:"inline-block",width:7,height:7,borderRadius:999,background:m}}),u]})]}),n.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:12,marginBottom:8},children:[n.jsx("h2",{"data-testid":"detail-header-name",style:{fontFamily:"var(--font-serif)",fontSize:20,fontWeight:500,lineHeight:1.25,color:"var(--text-primary)",margin:0},children:a.skill}),n.jsx("span",{"data-testid":"detail-header-version",style:{fontFamily:"var(--font-sans)",fontVariantNumeric:"tabular-nums",fontSize:12,color:"var(--text-secondary)",whiteSpace:"nowrap"},children:a.version??"—"})]}),n.jsx(H2,{skill:a}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[n.jsx("button",{type:"button","data-testid":"detail-header-path-chip",title:a.dir,"aria-label":`Copy path ${a.dir} to clipboard`,onClick:o,style:{display:"inline-flex",alignItems:"center",padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"},children:B2(a.dir||"—")}),n.jsxs("button",{"data-testid":"detail-header-copy-path",type:"button",onClick:o,"aria-label":"Copy skill path to clipboard",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:11,cursor:"pointer"},children:[n.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),n.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),r?"Copied":"Copy"]})]})]})}function H2({skill:a}){const r=a.installMethod,i=a.symlinkTarget;if(!r)return null;let o="";switch(r){case"symlinked":o=i?`Symlinked from ${i}`:"Symlinked (target unresolved)";break;case"copied":o="Copied (independent)";break;case"authored":o="Authored";break;default:return null}return n.jsxs("div",{"data-testid":"detail-header-install-method",style:{display:"flex",alignItems:"center",gap:6,fontSize:11,color:"var(--text-secondary)",fontFamily:"var(--font-sans)",margin:"6px 0 8px"},children:[n.jsx("span",{style:{fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",fontSize:10,color:"var(--text-tertiary)"},children:"Install method"}),n.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:o})]})}function U2({state:a,isReadOnly:r,onDelete:i}){const{plugin:o,skill:u,evals:m,latestBenchmark:f,isDirty:h,caseRunStates:x,regressions:p,iterationCount:y}=a,g=Array.from(x.values()).some(k=>k.status==="running"||k.status==="queued"),j=f==null?void 0:f.overall_pass_rate,S=(m==null?void 0:m.evals.reduce((k,M)=>k+M.assertions.length,0))??0,N=(m==null?void 0:m.evals.length)??0,D=_2(j),T=O2(j);return n.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)",flexShrink:0},children:[n.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[n.jsx("span",{style:{color:"var(--text-tertiary)"},children:o}),n.jsx(V2,{}),n.jsx("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:u}),r&&n.jsxs("span",{className:"ml-2 flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:[n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"installed"]}),h&&n.jsx("span",{className:"ml-2 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded",style:{background:"var(--yellow-muted)",color:"var(--yellow)"},children:"unsaved"}),g&&n.jsxs("span",{className:"ml-2 flex items-center gap-1.5 text-[11px]",style:{color:"var(--accent)"},children:[n.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}}),"Running..."]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[!r&&i&&n.jsx("button",{disabled:g,onClick:()=>{window.confirm(`Delete skill "${u}"? This cannot be undone.`)&&i()},title:"Delete skill",className:"flex items-center justify-center transition-colors duration-150",style:{background:"none",border:"none",cursor:g?"not-allowed":"pointer",color:"var(--text-tertiary)",padding:4,opacity:g?.4:1,borderRadius:4},onMouseEnter:k=>{g||(k.currentTarget.style.color="var(--red)")},onMouseLeave:k=>{k.currentTarget.style.color="var(--text-tertiary)"},children:n.jsx($2,{})}),p.length>0&&n.jsxs("span",{className:"pill",style:{background:"var(--red-muted)",color:"var(--red)"},children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[n.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),n.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),n.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),p.length," regression",p.length>1?"s":""]}),y>0&&n.jsxs("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)"},children:["Iter ",y]}),n.jsx("span",{className:"pill",style:{background:T,color:D},children:j!=null?`${Math.round(j*100)}%`:"--"}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[N," case",N!==1?"s":""," / ",S," assert",S!==1?"s":""]})]})]})}function V2(){return n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})}function $2(){return n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"3 6 5 6 21 6"}),n.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),n.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),n.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}const G2=[{label:"Build",tabs:[{id:"editor",label:"Editor",shortcut:"1"},{id:"tests",label:"Tests",shortcut:"2"}]},{label:"Evaluate",tabs:[{id:"run",label:"Run",shortcut:"3"},{id:"activation",label:"Activation",shortcut:"4"}]},{label:"Insights",tabs:[{id:"history",label:"History",shortcut:"5"},{id:"leaderboard",label:"Leaderboard",shortcut:"6"},{id:"deps",label:"Deps",shortcut:"7"},{id:"versions",label:"Versions",shortcut:"8"}]}];function P2({id:a}){const r={width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"};switch(a){case"editor":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),n.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]});case"tests":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M9 11l3 3L22 4"}),n.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]});case"run":return n.jsx("svg",{...r,children:n.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})});case"activation":return n.jsxs("svg",{...r,children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("circle",{cx:"12",cy:"12",r:"6"}),n.jsx("circle",{cx:"12",cy:"12",r:"2"})]});case"history":return n.jsxs("svg",{...r,children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("polyline",{points:"12 6 12 12 16 14"})]});case"leaderboard":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M18 20V10"}),n.jsx("path",{d:"M12 20V4"}),n.jsx("path",{d:"M6 20v-6"})]});case"deps":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),n.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]});case"versions":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M12 8v4l3 3"}),n.jsx("path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"})]})}}function q2({activePanel:a,onPanelChange:r,isDirty:i,isRunning:o,hasRegressions:u,isActivationRunning:m,hasUpdate:f}){return n.jsx("div",{className:"flex items-center gap-0.5 px-3 overflow-x-auto",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)",flexShrink:0},children:G2.map((h,x)=>n.jsxs("div",{className:"flex items-center",children:[x>0&&n.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)",margin:"0 6px",flexShrink:0}}),h.tabs.map(p=>{const y=a===p.id,g=p.id==="editor"&&i||p.id==="run"&&o||p.id==="activation"&&m||p.id==="history"&&u||p.id==="versions"&&f,j=p.id==="run"||p.id==="activation"?"var(--accent)":p.id==="history"?"var(--red)":"var(--yellow)";return n.jsxs("button",{onClick:()=>r(p.id),title:`${p.label} (Ctrl+${p.shortcut})`,className:"relative flex items-center gap-1.5 px-3 py-2.5 text-[12px] font-medium transition-colors duration-150",style:{background:"transparent",color:y?"var(--text-primary)":"var(--text-tertiary)",borderBottom:y?"2px solid var(--accent)":"2px solid transparent",cursor:"pointer",border:"none",borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:y?"var(--accent)":"transparent",whiteSpace:"nowrap"},onMouseEnter:S=>{y||(S.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:S=>{y||(S.currentTarget.style.color="var(--text-tertiary)")},children:[n.jsx(P2,{id:p.id}),p.label,g&&n.jsx("span",{className:"absolute top-1.5 right-1 rounded-full",style:{width:5,height:5,background:j}})]},p.id)})]},h.label))})}const Ox={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 zs({error:a,onRetry:r,onDismiss:i}){const[o,u]=v.useState(null),m=v.useRef(null);v.useEffect(()=>(a.category==="rate_limit"&&a.retryAfterMs?u(Math.ceil(a.retryAfterMs/1e3)):u(null),()=>{m.current&&clearInterval(m.current)}),[a]),v.useEffect(()=>{if(!(o==null||o<=0))return m.current=setInterval(()=>{u(x=>x==null||x<=1?(m.current&&clearInterval(m.current),0):x-1)},1e3),()=>{m.current&&clearInterval(m.current)}},[o!=null&&o>0]);const f=Ox[a.category]||Ox.unknown,h=o!=null&&o>0;return n.jsxs("div",{className:"rounded-lg overflow-hidden animate-fade-in",style:{border:`1px solid color-mix(in srgb, ${f.color} 30%, transparent)`,background:`color-mix(in srgb, ${f.color} 6%, var(--surface-1))`},children:[n.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{style:{fontSize:14},children:f.icon}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:f.color},children:a.title})]}),i&&n.jsx("button",{onClick:i,className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)"},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsxs("div",{className:"px-3.5 pb-3",children:[n.jsx("p",{className:"text-[11.5px] mb-1.5",style:{color:"var(--text-secondary)"},children:a.description}),n.jsx("p",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:a.hint}),(r||o!=null)&&n.jsx("div",{className:"flex items-center gap-2 mt-2.5",children:r&&n.jsx("button",{onClick:r,disabled:h,className:"btn btn-secondary text-[11px]",style:{padding:"4px 10px",opacity:h?.5:1},children:h?`Retry in ${o}s`:"Retry"})})]})]})}class Y2 extends v.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(r,i){console.error("ErrorBoundary caught:",r,i.componentStack)}render(){return this.state.hasError?n.jsxs("div",{style:{padding:24,textAlign:"center"},children:[n.jsx("p",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)"},children:"Something went wrong"}),n.jsx("p",{style:{fontSize:12,color:"var(--text-tertiary)",marginTop:8},children:"An unexpected error occurred in this panel."}),n.jsx("button",{onClick:()=>window.location.reload(),className:"btn btn-secondary",style:{marginTop:16,fontSize:12},children:"Reload"})]}):this.props.children}}function F2(a){const r=a.toLowerCase();return/rate.?limit|429|quota.?exceeded/.test(r)?{category:"rate_limit",title:"Rate Limit",description:a,hint:"Wait a moment and try again.",retryable:!0}:/401|unauthorized|invalid.?api.?key|authentication/.test(r)?{category:"auth",title:"Authentication Failed",description:a,hint:"Check your API key or credentials.",retryable:!1}:/timeout|timed?.?out|etimedout/.test(r)?{category:"timeout",title:"Request Timed Out",description:a,hint:"The request took too long. Try again.",retryable:!0}:/model\b.*not found/.test(r)?{category:"model_not_found",title:"Model Not Found",description:a,hint:"The selected model is not available. Try switching to a different model in the dropdown above.",retryable:!1}:/context.?(?:window|length)|token.?(?:limit|count|exceed)|too (?:long|large)|maximum.?context|input.?too.?long|prompt.?too.?(?:long|large)/.test(r)?{category:"context_window",title:"Content Too Large",description:a,hint:"Reduce SKILL.md size or move detailed content to references/ files.",retryable:!1}:/enoent|command not found|502|503|service.?unavailable|connection.?refused|econnrefused|server.?error/.test(r)?{category:"provider_unavailable",title:"Provider Unavailable",description:a,hint:"Check that the provider is installed and running.",retryable:!1}:/syntaxerror|json\.?parse|parse.?error|failed to parse|not valid json|unexpected token/.test(r)?{category:"parse_error",title:"Response Parse Error",description:a,hint:"Try again. If this persists, try a different model.",retryable:!0}:{category:"unknown",title:"Error",description:a,hint:"",retryable:!1}}function W2(a){const r=a.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!r)return{metadata:{},body:a};const i=r[1],o=r[2].trim(),u={},m=i.split(`
62
+ `);let f="",h=!1;for(const x of m){const p=x.match(/^[ \t]+([\w-]+):\s*(.*)$/);if(p&&f&&h){const j=p[1],S=p[2].trim();let N=u[f];if((typeof N!="object"||Array.isArray(N))&&(N={},u[f]=N),!S)N[j]=[];else{const D=S.match(/^\[(.+)\]$/);D?N[j]=D[1].split(",").map(T=>T.trim().replace(/^["']|["']$/g,"")).filter(Boolean):N[j]=S.replace(/^["']|["']$/g,"")}continue}const y=x.match(/^\s+-\s+(.+)$/);if(y&&f){h=!1;const j=u[f];Array.isArray(j)?j.push(y[1].trim().replace(/^["']|["']$/g,"")):u[f]=[y[1].trim().replace(/^["']|["']$/g,"")];continue}const g=x.match(/^([\w-]+):\s*(.*)$/);if(g){f=g[1];const j=g[2].trim();if(h=!1,!j){u[f]={},h=!0;continue}const S=j.match(/^\[(.+)\]$/);if(S){u[f]=S[1].split(",").map(N=>N.trim().replace(/^["']|["']$/g,"")).filter(Boolean);continue}u[f]=j.replace(/^["']|["']$/g,"")}}return{metadata:u,body:o}}function go(a){if(!a)return"";try{let r=a.replace(/^---\n[\s\S]*?\n---\n?/,""),i=K2(r);return i=i.replace(/```(\w*)\n([\s\S]*?)```/g,'<pre style="background:var(--surface-2);padding:0.75rem;border-radius:6px;overflow-x:auto;font-size:12px;line-height:1.5;margin:0.5rem 0;border:1px solid var(--border-subtle)"><code>$2</code></pre>'),i=i.replace(/^### (.+)$/gm,'<div style="font-weight:600;font-size:14px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),i=i.replace(/^## (.+)$/gm,'<div style="font-weight:700;font-size:15px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),i=i.replace(/^# (.+)$/gm,'<div style="font-weight:700;font-size:1rem;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),i=i.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer" style="color:var(--accent);text-decoration:underline">$1</a>'),i=i.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),i=i.replace(/\*([^*]+)\*/g,"<em>$1</em>"),i=i.replace(/`([^`]+)`/g,'<code style="background:var(--surface-3);padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em">$1</code>'),i=i.replace(/^- (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">• $1</div>'),i=i.replace(/^(\d+)\. (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">$1. $2</div>'),i=i.replace(/\n\n/g,'<div style="height:0.5rem"></div>'),i=i.replace(/\n/g,"<br/>"),i}catch{return`<pre style="white-space:pre-wrap;font-size:12px;line-height:1.5">${a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}</pre>`}}function K2(a){const r=a.split(`
63
+ `),i=[];let o=0;for(;o<r.length;)if(r[o].trim().startsWith("|")&&o+1<r.length&&r[o+1].trim().startsWith("|")&&/\|[\s-:]+\|/.test(r[o+1])){const u=Bx(r[o]);o+=2;const m=[];for(;o<r.length&&r[o].trim().startsWith("|");)m.push(Bx(r[o])),o++;const f='style="text-align:left;padding:0.4rem 0.6rem;font-weight:600;font-size:12px;color:var(--text-primary);border-bottom:1px solid var(--border-default)"',h='style="padding:0.4rem 0.6rem;font-size:12px;color:var(--text-secondary);border-bottom:1px solid var(--border-subtle)"';let x='<table style="width:100%;border-collapse:collapse;margin:0.5rem 0;border:1px solid var(--border-subtle);border-radius:6px;overflow:hidden">';x+="<thead><tr>";for(const p of u)x+=`<th ${f}>${p}</th>`;x+="</tr></thead><tbody>";for(const p of m){x+="<tr>";for(const y of p)x+=`<td ${h}>${y}</td>`;x+="</tr>"}x+="</tbody></table>",i.push(x)}else i.push(r[o]),o++;return i.join(`
64
+ `)}function Bx(a){return a.split("|").map(r=>r.trim()).filter(r=>r.length>0)}function yo(a,r){const i=a.split(`
65
65
  `),o=r.split(`
66
- `);if(i.length>1e3||o.length>1e3)return[...i.map(y=>({type:"unchanged",content:y}))];const u=i.length,m=o.length,f=Array.from({length:u+1},()=>new Array(m+1).fill(0));for(let y=1;y<=u;y++)for(let g=1;g<=m;g++)i[y-1]===o[g-1]?f[y][g]=f[y-1][g-1]+1:f[y][g]=Math.max(f[y-1][g],f[y][g-1]);const h=[];let x=u,p=m;for(;x>0||p>0;)x>0&&p>0&&i[x-1]===o[p-1]?(h.push({type:"unchanged",content:i[x-1]}),x--,p--):p>0&&(x===0||f[x][p-1]>=f[x-1][p])?(h.push({type:"added",content:o[p-1]}),p--):(h.push({type:"removed",content:i[x-1]}),x--);return h.reverse()}function Q2(a,r){if(r&&new Set(["generating","comparing","judging","judging_assertion","preparing","parsing","generating_skill","generating_baseline","scoring","action_items"]).has(a))return n.jsx("div",{className:"spinner",style:{width:10,height:10,flexShrink:0}});const o=new Set(["generating","comparing","preparing","generating_skill","generating_baseline","scoring","action_items"]);return n.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{background:o.has(a)?"var(--accent)":"var(--green)"}})}function Ls({entries:a,isRunning:r}){const[i,o]=v.useState(!1),u=v.useRef(null);return v.useEffect(()=>{u.current&&!i&&(u.current.scrollTop=u.current.scrollHeight)},[a,i]),a.length===0&&!r?null:n.jsxs("div",{className:"mt-2 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsxs("button",{onClick:()=>o(!i),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:m=>{m.currentTarget.style.color="var(--text-primary)"},onMouseLeave:m=>{m.currentTarget.style.color="var(--text-tertiary)"},children:[n.jsxs("span",{className:"flex items-center gap-2",children:[r&&n.jsx("div",{className:"spinner",style:{width:10,height:10}}),"Progress Log (",a.length,")"]}),n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{transform:i?"rotate(0)":"rotate(180deg)",transition:"transform 0.2s ease"},children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),!i&&n.jsx("div",{ref:u,className:"px-3 pb-3 space-y-1 max-h-48 overflow-y-auto",children:a.map((m,f)=>{const h=f===a.length-1&&r,x=f===0?"0s":`+${((m.timestamp-a[0].timestamp)/1e3).toFixed(1)}s`;return n.jsxs("div",{className:"flex items-center gap-2 text-[11px] animate-fade-in",style:{opacity:h?1:.7},children:[Q2(m.phase,h),n.jsx("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)",width:40},children:x}),n.jsx("span",{style:{color:h?"var(--text-primary)":"var(--text-secondary)"},children:m.message}),m.current!=null&&m.total!=null&&n.jsxs("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)"},children:["[",m.current,"/",m.total,"]"]})]},f)})})]})}function X2({plugin:a,skill:r,skillContent:i,onApplied:o}){const[u,m]=v.useState("closed"),{config:f}=bl(),[h,x]=v.useState("claude-cli"),[p,y]=v.useState("opus"),[g,j]=v.useState([]),[S,N]=v.useState(""),[M,E]=v.useState(""),[k,T]=v.useState(null),[B,I]=v.useState(null),[L,V]=v.useState([]),[w,D]=v.useState(!1),A=v.useRef(null);v.useEffect(()=>{if(!f)return;f.providers.find(U=>U.id==="claude-cli"&&U.available)&&(x("claude-cli"),y("opus"))},[f]),v.useEffect(()=>()=>{var R;(R=A.current)==null||R.abort()},[]);function O(){return f==null?void 0:f.providers.find(R=>R.id===h&&R.available)}const G=v.useCallback(()=>{var R;(R=A.current)==null||R.abort(),m("open")},[]);async function q(){m("loading"),T(null),I(null),V([]);const R=new AbortController;A.current=R;try{const U=await fetch(`/api/skills/${encodeURIComponent(a)}/${encodeURIComponent(r)}/improve?sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:h,model:p}),signal:R.signal});if(!U.ok||!U.body){let W=`HTTP ${U.status}`;try{const ie=await U.json();ie.error&&(W=ie.error)}catch{}throw new Error(W)}const se=U.body.getReader(),Y=new TextDecoder;let me="",z="";for(;;){const{done:W,value:ie}=await se.read();if(W)break;me+=Y.decode(ie,{stream:!0});const de=me.split(`
67
- `);me=de.pop()||"";for(const ge of de)if(ge.startsWith("event: "))z=ge.slice(7).trim();else if(ge.startsWith("data: ")){try{const xe=JSON.parse(ge.slice(6));z==="progress"?V(oe=>[...oe,{phase:xe.phase,message:xe.message,timestamp:Date.now()}]):z==="done"||z==="complete"?(N(xe.improved),E(xe.reasoning||""),j(yo(xe.original||i,xe.improved)),m("diff_shown")):z==="error"&&(T(xe.message||xe.description||"Unknown error"),xe.category&&I(xe),m("open"))}catch{}z=""}}}catch(U){U.name!=="AbortError"&&(T(U.message),m("open"))}finally{A.current=null}}async function te(){D(!0);try{await Ne.applyImprovement(a,r,S),o(S),m("closed")}catch(R){T(R.message)}finally{D(!1)}}function X(){m("closed"),j([]),N(""),E(""),T(null)}if(u==="closed")return n.jsxs("button",{onClick:()=>m("open"),className:"btn btn-secondary mb-5",disabled:!i,children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),n.jsx("path",{d:"M2 17l10 5 10-5"}),n.jsx("path",{d:"M2 12l10 5 10-5"})]}),"Improve Skill"]});const _=O();return n.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden animate-fade-in",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),n.jsx("path",{d:"M2 17l10 5 10-5"}),n.jsx("path",{d:"M2 12l10 5 10-5"})]})}),n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Skill Improvement"})]}),n.jsx("button",{onClick:X,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:R=>{R.currentTarget.style.background="var(--surface-3)"},onMouseLeave:R=>{R.currentTarget.style.background="transparent"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsxs("div",{className:"px-5 py-4",children:[(u==="open"||u==="loading")&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-end gap-3 mb-4",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),n.jsx("select",{className:"input-field text-[12px] py-1.5",value:h,onChange:R=>{x(R.target.value);const U=f==null?void 0:f.providers.find(se=>se.id===R.target.value);U!=null&&U.models[0]&&y(U.models[0].id)},disabled:u==="loading",children:f==null?void 0:f.providers.filter(R=>R.available).map(R=>n.jsx("option",{value:R.id,children:R.label},R.id))})]}),n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),n.jsx("select",{className:"input-field text-[12px] py-1.5",value:p,onChange:R=>y(R.target.value),disabled:u==="loading",children:_==null?void 0:_.models.map(R=>n.jsx("option",{value:R.id,children:R.label},R.id))})]}),u==="loading"?n.jsx("button",{onClick:G,className:"btn btn-secondary flex-shrink-0",children:"Cancel"}):n.jsx("button",{onClick:q,className:"btn btn-primary flex-shrink-0",children:"Improve"})]}),u==="loading"&&L.length>0&&n.jsx("div",{className:"mt-3",children:n.jsx(Ls,{entries:L,isRunning:!0})})]}),k&&n.jsx("div",{className:"mb-4",children:B?n.jsx(zs,{error:B,onRetry:q,onDismiss:()=>{T(null),I(null)}}):n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:k})}),u==="diff_shown"&&n.jsxs(n.Fragment,{children:[M&&n.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"rgba(168,85,247,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(168,85,247,0.2)"},children:[n.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),M]}),n.jsx("div",{className:"rounded-lg overflow-hidden mb-4",style:{border:"1px solid var(--border-subtle)",maxHeight:"400px",overflowY:"auto"},children:g.map((R,U)=>n.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:R.type==="added"?"rgba(34,197,94,0.1)":R.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:R.type==="added"?"var(--green)":R.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:R.type==="added"?"3px solid var(--green)":R.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:R.type==="added"?"+":R.type==="removed"?"-":" "}),R.content]},U))}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:te,disabled:w,className:"btn btn-primary",children:w?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"spinner",style:{width:12,height:12}})," Applying..."]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})," Apply"]})}),n.jsx("button",{onClick:X,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}const Bx={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"}},Z2={remove:"var(--red)",modify:"#fbbf24",add:"var(--green)"};function J2({change:a,index:r,selected:i,onToggle:o,originalEval:u}){var g;const[m,f]=v.useState(!1),h=Bx[a.action]??Bx.add,x=Z2[a.action]??"var(--border-subtle)",p=a.action==="remove"?(u==null?void 0:u.name)??`Eval #${a.evalId}`:((g=a.eval)==null?void 0:g.name)??"Unnamed",y=v.useCallback(()=>o(r),[o,r]);return n.jsxs("div",{className:"rounded-lg transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderLeft:`3px solid ${x}`,opacity:i?1:.5},children:[n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[n.jsx("input",{type:"checkbox",checked:i,onChange:y,className:"flex-shrink-0",style:{accentColor:"var(--accent)"}}),n.jsx("span",{className:"pill text-[9px] font-bold flex-shrink-0",style:{background:h.bg,color:h.color,padding:"1px 6px"},children:h.label}),n.jsx("span",{className:"text-[12px] font-medium truncate",style:{color:"var(--text-primary)"},children:p}),n.jsx("span",{className:"text-[11px] truncate flex-1",style:{color:"var(--text-tertiary)"},children:a.reason}),n.jsx("button",{onClick:()=>f(!m),className:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:j=>{j.currentTarget.style.background="var(--surface-3)"},onMouseLeave:j=>{j.currentTarget.style.background="transparent"},children:n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:m?"rotate(90deg)":"rotate(0)",transition:"transform 0.15s ease"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),m&&n.jsxs("div",{className:"px-4 pb-3 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.action==="add"&&a.eval&&n.jsx(eS,{evalCase:a.eval}),a.action==="modify"&&a.eval&&u&&n.jsx(tS,{original:u,proposed:a.eval}),a.action==="remove"&&u&&n.jsx(nS,{evalCase:u})]})]})}function eS({evalCase:a}){var r;return n.jsxs("div",{className:"pt-2.5 space-y-2",children:[n.jsx(hd,{label:"Prompt",value:a.prompt}),n.jsx(hd,{label:"Expected",value:a.expected_output}),n.jsxs("div",{children:[n.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((r=a.assertions)==null?void 0:r.length)??0,")"]}),n.jsx("div",{className:"mt-1 space-y-1",children:(a.assertions??[]).map(i=>n.jsxs("div",{className:"text-[11px] flex items-start gap-1.5",style:{color:"var(--text-secondary)"},children:[n.jsx("span",{style:{color:"var(--green)"},children:"+"})," ",i.text]},i.id))})]})]})}function tS({original:a,proposed:r}){const i=[];a.name!==r.name&&i.push({label:"Name",old:a.name,new:r.name}),a.prompt!==r.prompt&&i.push({label:"Prompt",old:a.prompt,new:r.prompt}),a.expected_output!==r.expected_output&&i.push({label:"Expected",old:a.expected_output,new:r.expected_output});const o=a.assertions??[],u=r.assertions??[],m=new Set(o.map(p=>p.text)),f=new Set(u.map(p=>p.text)),h=u.filter(p=>!m.has(p.text)),x=o.filter(p=>!f.has(p.text));return n.jsxs("div",{className:"pt-2.5 space-y-2",children:[i.map(p=>n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:p.label}),n.jsxs("div",{className:"mt-1 text-[11px] font-mono rounded p-2",style:{background:"var(--surface-1)"},children:[n.jsxs("div",{style:{color:"var(--red)",textDecoration:"line-through"},children:["- ",xd(p.old,120)]}),n.jsxs("div",{style:{color:"var(--green)"},children:["+ ",xd(p.new,120)]})]})]},p.label)),(h.length>0||x.length>0)&&n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Assertions"}),n.jsxs("div",{className:"mt-1 space-y-0.5",children:[x.map(p=>n.jsxs("div",{className:"text-[11px]",style:{color:"var(--red)"},children:["- ",p.text]},p.id)),h.map(p=>n.jsxs("div",{className:"text-[11px]",style:{color:"var(--green)"},children:["+ ",p.text]},p.id))]})]}),i.length===0&&h.length===0&&x.length===0&&n.jsx("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"No visible field changes"})]})}function nS({evalCase:a}){var r;return n.jsxs("div",{className:"pt-2.5 space-y-2",style:{opacity:.7},children:[n.jsx(hd,{label:"Prompt",value:a.prompt}),n.jsxs("div",{children:[n.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((r=a.assertions)==null?void 0:r.length)??0,")"]}),n.jsx("div",{className:"mt-1 space-y-0.5",children:(a.assertions??[]).map(i=>n.jsx("div",{className:"text-[11px]",style:{color:"var(--red)",textDecoration:"line-through"},children:i.text},i.id))})]})]})}function hd({label:a,value:r}){return n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:a}),n.jsx("div",{className:"mt-0.5 text-[11px] p-2 rounded font-mono",style:{background:"var(--surface-1)",color:"var(--text-secondary)",whiteSpace:"pre-wrap"},children:xd(r,300)})]})}function xd(a,r){return a.length>r?a.slice(0,r)+"...":a}const Ux={remove:0,modify:1,add:2};function aS({changes:a,selections:r,currentEvals:i,onToggle:o,onSelectAll:u,onDeselectAll:m}){if(a.length===0)return null;const f=a.map((x,p)=>({change:x,originalIndex:p}));f.sort((x,p)=>(Ux[x.change.action]??2)-(Ux[p.change.action]??2));const h=Array.from(r.values()).filter(Boolean).length;return n.jsxs("div",{className:"mt-3 animate-fade-in",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"Test Case Changes"}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",h,"/",a.length," selected)"]})]}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("button",{onClick:u,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--accent)",background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--accent-muted)"},onMouseLeave:x=>{x.currentTarget.style.background="transparent"},children:"Select All"}),n.jsx("button",{onClick:m,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--surface-3)"},onMouseLeave:x=>{x.currentTarget.style.background="transparent"},children:"Deselect All"})]})]}),n.jsx("div",{className:"space-y-1.5 overflow-auto",style:{maxHeight:240},children:f.map(({change:x,originalIndex:p})=>n.jsx(J2,{change:x,index:p,selected:r.get(p)??!1,onToggle:o,originalEval:x.evalId!=null?i.find(y=>y.id===x.evalId):void 0},p))})]})}function lS(){var R;const{state:a,dispatch:r,submitAiEdit:i,applyAiEdit:o,discardAiEdit:u,cancelAiEdit:m,toggleEvalChange:f,selectAllEvalChanges:h,deselectAllEvalChanges:x,retryEvalsSave:p}=kn(),{aiEditLoading:y,aiEditResult:g,aiEditError:j,aiEditClassifiedError:S,aiEditProgress:N,aiEditEvalChanges:M,aiEditEvalSelections:E,aiEditEvalsRetry:k}=a,[T,B]=v.useState(""),{config:I}=bl(),[L,V]=v.useState("claude-cli"),[w,D]=v.useState("opus"),A=v.useRef(null);v.useEffect(()=>{var U;(U=A.current)==null||U.focus()},[]),v.useEffect(()=>{if(!I)return;I.providers.find(se=>se.id==="claude-cli"&&se.available)&&(V("claude-cli"),D("opus"))},[I]);const O=I==null?void 0:I.providers.find(U=>U.id===L&&U.available),G=v.useCallback(()=>{const U=T.trim();!U||y||i(U,L,w)},[T,y,i,L,w]),q=v.useCallback(U=>{U.key==="Enter"&&!U.shiftKey&&(U.preventDefault(),G()),U.key==="Escape"&&(U.preventDefault(),y?m():u())},[G,y,m,u]),te=v.useCallback(()=>{r({type:"CLOSE_AI_EDIT"}),r({type:"OPEN_AI_EDIT"})},[r]),X=g?yo(a.skillContent,g.improved):[],_=((R=a.evals)==null?void 0:R.evals)??[];return n.jsxs("div",{className:"animate-fade-in",style:{background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-2)"},children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M15 4V2"}),n.jsx("path",{d:"M15 16v-2"}),n.jsx("path",{d:"M8 9h2"}),n.jsx("path",{d:"M20 9h2"}),n.jsx("path",{d:"M17.8 11.8L19 13"}),n.jsx("path",{d:"M15 9h.01"}),n.jsx("path",{d:"M17.8 6.2L19 5"}),n.jsx("path",{d:"M11 6.2L9.7 5"}),n.jsx("path",{d:"M3 21l9-9"})]})}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Edit"}),n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:"Describe what to change — Enter to submit, Esc to dismiss"})]}),n.jsx("button",{onClick:u,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:U=>{U.currentTarget.style.background="var(--surface-3)"},onMouseLeave:U=>{U.currentTarget.style.background="transparent"},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsxs("div",{className:"px-4 py-3",children:[!g&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-end gap-2.5",children:[n.jsx("div",{className:"flex-1",children:n.jsx("textarea",{ref:A,value:T,onChange:U=>B(U.target.value),onKeyDown:q,placeholder:"e.g., Add an error handling section...",disabled:y,rows:1,className:"w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",borderRadius:6,padding:"8px 12px",fontSize:12.5,lineHeight:1.5,fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",minHeight:36,maxHeight:96},onInput:U=>{const se=U.currentTarget;se.style.height="auto",se.style.height=Math.min(se.scrollHeight,96)+"px"}})}),n.jsxs("div",{style:{minWidth:100},children:[n.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),n.jsx("select",{className:"input-field text-[11px] py-1",value:L,onChange:U=>{V(U.target.value);const se=I==null?void 0:I.providers.find(Y=>Y.id===U.target.value);se!=null&&se.models[0]&&D(se.models[0].id)},disabled:y,style:{width:"100%"},children:I==null?void 0:I.providers.filter(U=>U.available).map(U=>n.jsx("option",{value:U.id,children:U.label},U.id))})]}),n.jsxs("div",{style:{minWidth:80},children:[n.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Model"}),n.jsx("select",{className:"input-field text-[11px] py-1",value:w,onChange:U=>D(U.target.value),disabled:y,style:{width:"100%"},children:O==null?void 0:O.models.map(U=>n.jsx("option",{value:U.id,children:U.label},U.id))})]}),y?n.jsx("button",{onClick:m,className:"btn btn-secondary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Cancel"}):n.jsx("button",{onClick:G,disabled:!T.trim(),className:"btn btn-primary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Submit"})]}),y&&N.length>0&&n.jsx("div",{className:"mt-2.5",children:n.jsx(Ls,{entries:N,isRunning:!0})})]}),j&&n.jsx("div",{className:"mt-3",children:S?n.jsx(zs,{error:S,onRetry:te,onDismiss:u}):n.jsx("div",{className:"px-3 py-2.5 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:j})}),g&&n.jsxs("div",{className:"animate-fade-in",children:[g.reasoning&&n.jsxs("div",{className:"mb-3 px-3 py-2.5 rounded-lg text-[11.5px]",style:{background:"rgba(168,85,247,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(168,85,247,0.2)"},children:[n.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),g.reasoning]}),n.jsx("div",{className:"mb-1",children:n.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"})}),n.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:300,overflowY:"auto"},children:X.map((U,se)=>n.jsxs("div",{className:"px-3 py-0.5 text-[10.5px] font-mono",style:{background:U.type==="added"?"rgba(34,197,94,0.1)":U.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:U.type==="added"?"var(--green)":U.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:U.type==="added"?"3px solid var(--green)":U.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:U.type==="added"?"+":U.type==="removed"?"-":" "}),U.content]},se))}),n.jsx(aS,{changes:M,selections:E,currentEvals:_,onToggle:f,onSelectAll:h,onDeselectAll:x}),k&&n.jsxs("div",{className:"mt-3 px-3 py-2.5 rounded-lg text-[12px] flex items-center justify-between",style:{background:"rgba(251,191,36,0.12)",border:"1px solid rgba(251,191,36,0.3)",color:"#fbbf24"},children:[n.jsx("span",{children:"Test case save failed. SKILL.md was saved successfully."}),n.jsx("button",{onClick:p,className:"btn text-[11px]",style:{background:"rgba(251,191,36,0.2)",color:"#fbbf24",padding:"3px 10px"},children:"Retry Save"})]}),n.jsxs("div",{className:"flex gap-2 mt-3",children:[n.jsxs("button",{onClick:o,className:"btn btn-primary text-[11px]",style:{padding:"5px 12px"},children:[n.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),n.jsx("button",{onClick:u,className:"btn btn-secondary text-[11px]",style:{padding:"5px 12px"},children:"Discard"}),n.jsx("button",{onClick:te,className:"btn btn-ghost text-[11px]",style:{padding:"5px 12px"},children:"Try Again"})]})]})]})]})}function rS(a,r){const[i,o]=v.useState([]),[u,m]=v.useState("SKILL.md"),[f,h]=v.useState(null),[x,p]=v.useState(!1),[y,g]=v.useState(null),j=v.useCallback(async()=>{try{const M=await Ne.getSkillFiles(a,r);o(M.files)}catch{o([])}},[a,r]);v.useEffect(()=>{m("SKILL.md"),h(null),g(null),j()},[a,r,j]);const S=v.useCallback(async M=>{if(m(M),M==="SKILL.md"){h(null),g(null);return}p(!0),g(null);try{const E=await Ne.getSkillFile(a,r,M);h(E)}catch(E){g(`Unable to open file: ${E.message}`),h(null)}finally{p(!1)}},[a,r]),N=v.useCallback(()=>{j()},[j]);return{files:i,activeFile:u,secondaryContent:f,loading:x,error:y,selectFile:S,refresh:N,isSkillMd:u==="SKILL.md"}}function sS(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function iS(a){const r=[],i=new Map;for(const o of a){const u=o.path.split("/"),f={name:u[u.length-1],path:o.path,type:o.type,size:o.size,children:[]};i.set(o.path,f)}for(const o of a){const u=o.path.split("/");if(u.length===1){const m=i.get(o.path);m&&r.push(m)}else{const m=u.slice(0,-1).join("/"),f=i.get(m),h=i.get(o.path);f&&h&&f.children.push(h)}}return r}function Qv({expanded:a}){return n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:a?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Xv(){return n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function oS(){return n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function cS(){return n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"23 4 23 10 17 10"}),n.jsx("polyline",{points:"1 20 1 14 7 14"}),n.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]})}function Zv({node:a,depth:r,activeFile:i,onSelect:o}){const[u,m]=v.useState(!0),f=a.path===i;return a.type==="dir"?n.jsxs("div",{children:[n.jsxs("button",{onClick:()=>m(!u),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+r*14}px`,paddingTop:2,paddingBottom:2,background:"none",border:"none",cursor:"pointer",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left"},children:[n.jsx(Qv,{expanded:u}),n.jsx(Xv,{}),n.jsxs("span",{children:[a.name,"/"]})]}),u&&a.children.map(h=>n.jsx(Zv,{node:h,depth:r+1,activeFile:i,onSelect:o},h.path))]}):n.jsxs("button",{onClick:()=>o(a.path),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+r*14}px`,paddingTop:2,paddingBottom:2,background:f?"var(--accent-muted)":"none",border:"none",cursor:"pointer",color:f?"var(--accent)":"var(--text-tertiary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left",borderRadius:3},children:[n.jsx("span",{style:{width:10}}),n.jsx(oS,{}),n.jsx("span",{style:{flex:1},children:a.name}),n.jsx("span",{style:{fontSize:9,color:"var(--text-tertiary)",marginRight:4,whiteSpace:"nowrap"},children:sS(a.size)})]})}function uS({files:a,activeFile:r,onSelect:i,onRefresh:o}){const[u,m]=v.useState(!1),f=v.useMemo(()=>iS(a),[a]);return n.jsxs("div",{style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 8px",cursor:"pointer",userSelect:"none"},onClick:()=>m(!u),children:[n.jsx(Qv,{expanded:u}),n.jsx(Xv,{}),n.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r}),n.jsx("button",{onClick:h=>{h.stopPropagation(),o()},style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",padding:"2px 4px",display:"flex",alignItems:"center",borderRadius:3},title:"Refresh file list",children:n.jsx(cS,{})})]}),u&&n.jsx("div",{style:{maxHeight:240,overflowY:"auto",padding:"2px 4px 4px"},children:f.length===0?n.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 8px"},children:"No files found"}):f.map(h=>n.jsx(Zv,{node:h,depth:0,activeFile:r,onSelect:i},h.path))})]})}function Wi(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function dS(a){try{return JSON.stringify(JSON.parse(a),null,2)}catch{return a}}function fS(a){const r=a.toLowerCase();return r.endsWith(".json")?"json":r.endsWith(".md")?"md":"other"}function Hx({content:a}){return n.jsx("textarea",{readOnly:!0,value:a,style:{flex:1,width:"100%",resize:"none",background:"var(--surface-1)",color:"var(--text-primary)",border:"none",outline:"none",padding:"12px 16px",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6}})}function Ix({content:a,fileType:r}){if(r==="json"){const i=dS(a);return n.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:i})}return r==="md"?n.jsx("div",{style:{flex:1,overflow:"auto",padding:"16px 20px",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:13,lineHeight:1.6},dangerouslySetInnerHTML:{__html:go(a)}}):n.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:a})}function Vx(a){try{return JSON.stringify(JSON.parse(a),null,2).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"([^"\\]|\\.)*"\s*:/g,i=>`<span style="color:#6383ff">${i}</span>`).replace(/:\s*"([^"\\]|\\.)*"/g,i=>`<span style="color:#22c55e">${i.slice(0,2)}<span style="color:#22c55e">${i.slice(2)}</span></span>`).replace(/:\s*(-?\d+\.?\d*)/g,(i,o)=>`: <span style="color:#fb923c">${o}</span>`).replace(/:\s*(true|false|null)/g,(i,o)=>`: <span style="color:#a855f7">${o}</span>`)}catch{return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}}function pS({file:a,loading:r,error:i,viewMode:o,plugin:u,skill:m,onSaved:f,onDirtyChange:h}){const[x,p]=v.useState(o),[y,g]=v.useState(!1),[j,S]=v.useState(""),[N,M]=v.useState(!1),[E,k]=v.useState(null),T=o!==x?o:x;v.useEffect(()=>{h==null||h(y)},[y,h]);const B=v.useCallback(()=>{(a==null?void 0:a.content)!=null&&(S(a.content),g(!0))},[a]),I=v.useCallback(()=>{g(!1)},[]),L=v.useCallback(async()=>{if(!(!u||!m||!a)){M(!0);try{await Ne.saveSkillFile(u,m,a.path,j),k("Saved"),g(!1),f==null||f(),setTimeout(()=>k(null),2e3)}catch(D){k(`Save failed: ${D.message}`),setTimeout(()=>k(null),3e3)}finally{M(!1)}}},[u,m,a,j,f]);if(v.useEffect(()=>{if(!y)return;const D=A=>{(A.ctrlKey||A.metaKey)&&A.key==="s"&&(A.preventDefault(),L())};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[y,L]),r)return n.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:"Loading…"});if(i)return n.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:n.jsxs("div",{style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"16px 20px",maxWidth:400,textAlign:"center"},children:[n.jsx("div",{style:{fontSize:13,color:"var(--text-primary)",fontWeight:600,marginBottom:6},children:"Unable to open file"}),n.jsx("div",{style:{fontSize:12,color:"var(--text-tertiary)"},children:i})]})});if(!a)return null;if(a.binary)return n.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:["Binary file (",Wi(a.size),") — cannot be displayed"]});const V=a.content??"",w=fS(a.path);return n.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[a.truncated&&n.jsxs("div",{style:{padding:"4px 12px",background:"var(--warning-muted, #fef3c7)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:"var(--warning-text, #92400e)"},children:["File truncated at ",Wi(512*1024)," — ",Wi(a.size)," total"]}),n.jsxs("div",{style:{display:"flex",gap:4,padding:"4px 8px",borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[(w==="md"||w==="json")&&["raw","split","preview"].map(D=>n.jsx("button",{onClick:()=>p(D),style:{padding:"2px 8px",fontSize:11,background:T===D?"var(--accent-muted)":"none",color:T===D?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer",textTransform:"capitalize"},children:D},D)),n.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",display:"flex",alignItems:"center",gap:6},children:[Wi(a.size),u&&m&&!a.binary&&!y&&n.jsx("button",{onClick:B,style:{padding:"1px 6px",fontSize:10,background:"var(--accent-muted)",color:"var(--accent)",border:"none",borderRadius:3,cursor:"pointer"},children:"Edit"}),y&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:L,disabled:N,style:{padding:"1px 6px",fontSize:10,background:"var(--accent)",color:"#fff",border:"none",borderRadius:3,cursor:"pointer",opacity:N?.6:1},children:N?"Saving...":"Save"}),n.jsx("button",{onClick:I,style:{padding:"1px 6px",fontSize:10,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer"},children:"Cancel"})]})]})]}),E&&n.jsx("div",{style:{padding:"4px 12px",background:E.startsWith("Save failed")?"var(--red-muted)":"var(--green-muted)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:E.startsWith("Save failed")?"var(--red)":"var(--green)"},children:E}),n.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:y?n.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:[n.jsx("textarea",{value:j,onChange:D=>S(D.target.value),style:{flex:1,width:"100%",resize:"none",background:"var(--surface-0)",color:"var(--text-primary)",border:"none",outline:"none",padding:"12px 16px",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6}}),n.jsxs("div",{style:{position:"sticky",bottom:0,display:"flex",alignItems:"center",gap:8,padding:"6px 12px",background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[n.jsx("span",{style:{flex:1,fontSize:11,color:"var(--text-tertiary)"},children:"Unsaved changes"}),n.jsx("button",{onClick:L,disabled:N,style:{padding:"3px 12px",fontSize:11,background:"var(--accent)",color:"#fff",border:"none",borderRadius:4,cursor:"pointer",opacity:N?.6:1},children:N?"Saving...":"Save"}),n.jsx("button",{onClick:I,style:{padding:"3px 12px",fontSize:11,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer"},children:"Cancel"})]})]}):T==="split"&&w!=="other"?n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",borderRight:"1px solid var(--border-subtle)"},children:n.jsx(Hx,{content:V})}),n.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:w==="json"?n.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Vx(V)}}):n.jsx(Ix,{content:V,fileType:w})})]}):T==="preview"&&w!=="other"?w==="json"?n.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Vx(V)}}):n.jsx(Ix,{content:V,fileType:w}):n.jsx(Hx,{content:V})})]})}function mS({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"16 18 22 12 16 6"}),n.jsx("polyline",{points:"8 6 2 12 8 18"})]})}function hS({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),n.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})}function xS({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function vS({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M15 4V2"}),n.jsx("path",{d:"M15 16v-2"}),n.jsx("path",{d:"M8 9h2"}),n.jsx("path",{d:"M20 9h2"}),n.jsx("path",{d:"M17.8 11.8L19 13"}),n.jsx("path",{d:"M15 9h.01"}),n.jsx("path",{d:"M17.8 6.2L19 5"}),n.jsx("path",{d:"M11 6.2L9.7 5"}),n.jsx("path",{d:"M3 21l9-9"})]})}function Ku({size:a=15}){return n.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M12 3l1.5 5.5L19 10l-5.5 1.5L12 17l-1.5-5.5L5 10l5.5-1.5L12 3z"})})}function gS(){const{state:a,dispatch:r,saveContent:i,isReadOnly:o}=kn(),{plugin:u,skill:m,skillContent:f,isDirty:h,improveTarget:x,aiEditOpen:p}=a,[y,g]=v.useState("split"),[j,S]=v.useState(!1),N=v.useRef(null),[M,E]=v.useState(!1),[k,T]=v.useState(""),[B,I]=v.useState(!1),[L,V]=v.useState(null),[w,D]=v.useState([]),[A,O]=v.useState([]),[G,q]=v.useState(null),te=v.useRef(null),{config:X}=bl(),{files:_,activeFile:R,secondaryContent:U,loading:se,error:Y,selectFile:me,refresh:z,isSkillMd:W}=rS(u??"",m??""),[ie,de]=v.useState(!1),ge=v.useCallback(ye=>{ie&&!window.confirm("You have unsaved changes. Discard?")||me(ye)},[ie,me]);v.useEffect(()=>()=>{var ye;(ye=te.current)==null||ye.abort()},[]);const{metadata:xe,body:oe}=K2(f),ae=xe["allowed-tools"],ve=Array.isArray(ae)?ae:typeof ae=="string"?[ae]:[],Ie=xe.name,Be=xe.description,ne=xe.metadata,fe=typeof ne=="object"&&!Array.isArray(ne)?ne:null,ue=xe.version||(fe==null?void 0:fe.version),he=xe.tags||(fe==null?void 0:fe.tags),be=Array.isArray(he)?he:typeof he=="string"?he.split(",").map(ye=>ye.trim()).filter(Boolean):[],_e=new Set(["name","description","metadata","allowed-tools","version","tags"]),Me=Object.entries(xe).filter(([ye])=>!_e.has(ye)),dt=v.useCallback(async()=>{S(!0),await i(),S(!1)},[i]),Zt=v.useCallback(ye=>{(ye.ctrlKey||ye.metaKey)&&ye.key==="s"&&(ye.preventDefault(),ye.stopPropagation(),h&&dt()),(ye.ctrlKey||ye.metaKey)&&ye.key==="k"&&(ye.preventDefault(),ye.stopPropagation(),r({type:p?"CLOSE_AI_EDIT":"OPEN_AI_EDIT"}))},[h,dt,p,r]),ct=v.useCallback(async()=>{var Rt,De;if(!k.trim())return;(Rt=te.current)==null||Rt.abort();const ye=new AbortController;te.current=ye,I(!0),q(null),O([]),V(null),D([]);try{const xt=(X==null?void 0:X.provider)||"claude-cli",Kt=(X==null?void 0:X.model)||"sonnet",nt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:k,provider:xt,model:Kt}),signal:ye.signal});if(!nt.ok||!nt.body){let bt=`HTTP ${nt.status}`;try{const Bn=await nt.json();Bn.error&&(bt=Bn.error)}catch{}throw new Error(bt)}const Xa=nt.body.getReader(),Xn=new TextDecoder;let Ct="",St="";for(;;){const{done:bt,value:Bn}=await Xa.read();if(bt)break;Ct+=Xn.decode(Bn,{stream:!0});const Za=Ct.split(`
68
- `);Ct=Za.pop()||"";for(const Un of Za)if(Un.startsWith("event: "))St=Un.slice(7).trim();else if(Un.startsWith("data: ")){try{const Ve=JSON.parse(Un.slice(6));if(St==="progress")O(Ut=>[...Ut,{phase:Ve.phase,message:Ve.message,timestamp:Date.now()}]);else if(St==="done"||St==="complete"){const Ut=["---"];Ve.name&&Ut.push(`name: ${Ve.name}`),Ve.description&&Ut.push(`description: "${Ve.description.replace(/"/g,'\\"')}"`),Ve.model&&Ut.push(`model: ${Ve.model}`),(De=Ve.allowedTools)!=null&&De.trim()&&Ut.push(`allowed-tools: ${Ve.allowedTools.trim()}`),Ut.push("---","",Ve.body||"");const Zn=Ut.join(`
69
- `);V(Zn),D(yo(f,Zn)),I(!1)}else St==="error"&&(q(Ve.message||Ve.description||"Generation failed"),I(!1))}catch{}St=""}}}catch(xt){xt.name!=="AbortError"&&q(xt.message)}finally{I(!1),te.current=null}},[k,X,f]),Vt=v.useCallback(()=>{L&&r({type:"SET_CONTENT",content:L}),E(!1),V(null),D([]),T(""),O([])},[L,r]),$t=v.useCallback(()=>{E(!1),V(null),D([]),T(""),O([]),q(null)},[]),tt=v.useCallback(()=>{var ye;M?((ye=te.current)==null||ye.abort(),$t()):(p&&r({type:"CLOSE_AI_EDIT"}),E(!0))},[M,p,r,$t]),jt=[{mode:"raw",icon:n.jsx(mS,{}),label:"Editor"},{mode:"split",icon:n.jsx(hS,{}),label:"Split"},{mode:"preview",icon:n.jsx(xS,{}),label:"Preview"}];return n.jsxs("div",{className:"flex flex-col h-full",onKeyDown:Zt,tabIndex:-1,children:[n.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:jt.map(({mode:ye,icon:Rt,label:De})=>n.jsxs("button",{onClick:()=>g(ye),title:De,className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"5px 10px",background:y===ye?"var(--surface-4)":"transparent",color:y===ye?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:y===ye?600:400,border:"none",cursor:"pointer"},children:[Rt,n.jsx("span",{style:{letterSpacing:"0.01em"},children:De})]},ye))}),W?o?n.jsx("div",{className:"flex items-center gap-2",children:n.jsxs("span",{className:"flex items-center gap-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Read-only"]})}):n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{onClick:()=>{p?r({type:"CLOSE_AI_EDIT"}):(M&&$t(),r({type:"OPEN_AI_EDIT"}))},title:"Edit with AI (Ctrl+K)",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:p?600:400,border:"none",cursor:"pointer",color:p?"var(--purple)":"var(--text-tertiary)",background:p?"var(--purple-muted)":"transparent"},children:[n.jsx(vS,{size:13}),n.jsx("span",{children:"AI Edit"})]}),n.jsxs("button",{onClick:tt,title:"Regenerate skill from prompt",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:M?600:400,border:"none",cursor:"pointer",color:M?"var(--purple)":"var(--text-tertiary)",background:M?"var(--purple-muted)":"transparent"},children:[n.jsx(Ku,{size:13}),n.jsx("span",{children:"Regenerate"})]}),n.jsx("div",{style:{width:1,height:16,background:"var(--border-subtle)"}}),h&&n.jsx("button",{onClick:()=>r({type:"SET_CONTENT",content:a.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),n.jsx("button",{onClick:dt,disabled:!h||j,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:j?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Saving..."]}):"Save"})]}):null]}),u&&m&&n.jsx(uS,{files:_,activeFile:R,onSelect:ge,onRefresh:z}),!W&&n.jsx(pS,{file:U,loading:se,error:Y,viewMode:y,plugin:u??void 0,skill:m??void 0,onSaved:()=>{me(R),z()},onDirtyChange:de}),W&&n.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:y==="raw"||y==="preview"?"1fr":"1fr 1fr"},children:[y!=="preview"&&n.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:y==="split"?"1px solid var(--border-subtle)":"none"},children:n.jsx("textarea",{ref:N,value:f,onChange:ye=>{o||r({type:"SET_CONTENT",content:ye.target.value})},onKeyDown:Zt,spellCheck:!1,readOnly:o,className:"flex-1 w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",fontSize:12.5,lineHeight:1.7,tabSize:2,border:"none",padding:"16px 20px",opacity:o?.7:1}})}),y!=="raw"&&n.jsx("div",{className:"overflow-auto",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"animate-fade-in",style:{padding:"20px 24px",maxWidth:720},children:[(Ie||ue||Be)&&n.jsxs("div",{style:{marginBottom:20},children:[n.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[Ie&&n.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:Ie}),ue&&n.jsxs("span",{style:{fontSize:10,fontWeight:600,color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4,letterSpacing:"0.03em",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:["v",ue]})]}),Be&&n.jsx("p",{style:{fontSize:12.5,lineHeight:1.65,color:"var(--text-secondary)",margin:0,paddingLeft:12,borderLeft:"2px solid var(--accent)",maxWidth:600},children:Be})]}),be.length>0&&n.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:be.map(ye=>n.jsx("span",{style:{fontSize:10,fontWeight:500,color:"var(--text-tertiary)",background:"var(--surface-2)",padding:"3px 8px",borderRadius:4,letterSpacing:"0.02em"},children:ye},ye))}),ve.length>0&&n.jsx("div",{style:{marginBottom:16},children:n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",marginRight:4},children:"Tools"}),ve.map(ye=>n.jsx("span",{style:{fontSize:10.5,fontFamily:"var(--font-mono, ui-monospace, monospace)",color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4},children:ye},ye))]})}),Me.length>0&&n.jsx("div",{style:{marginBottom:16,padding:"8px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:Me.map(([ye,Rt],De)=>{const xt=Array.isArray(Rt)?Rt.join(", "):typeof Rt=="object"?Object.entries(Rt).map(([Kt,nt])=>`${Kt}: ${Array.isArray(nt)?nt.join(", "):nt}`).join(" | "):Rt;return n.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:De>0?"1px solid var(--border-subtle)":"none"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",minWidth:80,flexShrink:0},children:ye}),n.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:xt})]},ye)})}),(Ie||Be||be.length>0||ve.length>0||Me.length>0)&&oe&&n.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),oe&&n.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:go(oe)}})]})})]}),W&&p&&n.jsx(lS,{}),W&&M&&n.jsx("div",{className:"animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:n.jsxs("div",{className:"px-4 py-3",children:[!L&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(Ku,{size:14}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerate Skill"})]}),n.jsx("div",{className:"flex gap-2 mb-2",children:n.jsx("textarea",{value:k,onChange:ye=>T(ye.target.value),placeholder:"Describe what this skill should do...",rows:2,disabled:B,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:B?.5:1},onKeyDown:ye=>{ye.key==="Enter"&&(ye.ctrlKey||ye.metaKey)&&k.trim()&&!B&&(ye.preventDefault(),ct())}})}),n.jsxs("div",{className:"flex items-center gap-2",children:[B?n.jsx("button",{onClick:()=>{var ye;(ye=te.current)==null||ye.abort(),I(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):n.jsx("button",{onClick:ct,disabled:!k.trim(),className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:"Generate"}),n.jsx("button",{onClick:$t,className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Close"})]}),B&&A.length>0&&n.jsx("div",{className:"mt-2",children:n.jsx(Ls,{entries:A,isRunning:!0})}),G&&n.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:[G,n.jsx("button",{onClick:ct,className:"ml-2 underline",style:{color:"var(--red)"},children:"Retry"})]})]}),L&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(Ku,{size:14}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerated — Review Changes"})]}),n.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:"300px",overflowY:"auto"},children:w.map((ye,Rt)=>n.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:ye.type==="added"?"var(--green-muted)":ye.type==="removed"?"var(--red-muted)":"transparent",color:ye.type==="added"?"var(--green)":ye.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:ye.type==="added"?"3px solid var(--green)":ye.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:ye.type==="added"?"+":ye.type==="removed"?"-":" "}),ye.content]},Rt))}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs("button",{onClick:Vt,className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),n.jsx("button",{onClick:$t,className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Discard"})]})]})]})}),W&&x!==null&&u&&m&&n.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:n.jsx(X2,{plugin:u,skill:m,skillContent:f,onApplied:ye=>{r({type:"SET_CONTENT",content:ye}),r({type:"CONTENT_SAVED"}),r({type:"CLOSE_IMPROVE"})}})})]})}function or(a){return a.testType==="integration"?"integration":"unit"}function mr(a){return a>=.8?"var(--green)":a>=.5?"var(--yellow)":"var(--red)"}function Jv(a){const r=new Date(a);return r.toLocaleDateString(void 0,{month:"short",day:"numeric"})+", "+r.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function eg(a){return a==null?"--":a>=1e3?`${(a/1e3).toFixed(1)}s`:`${a}ms`}const yS=new Set(["benchmark","comparison","baseline"]);function $x(a,r,i,o){return a.map(({rate:u,idx:m,total:f})=>{const h=o+m/(f-1)*(r-o*2),x=o+(i-o*2)-u*(i-o*2);return`${h},${x}`})}function tg({entries:a}){const r=a.filter(g=>yS.has(g.type)).slice().reverse(),i=r.map((g,j,S)=>({rate:g.pass_rate,idx:j,total:S.length})).filter((g,j)=>{const S=r[j].type;return S==="benchmark"||S==="comparison"}),o=r.flatMap((g,j)=>g.type==="baseline"?[{rate:g.pass_rate,idx:j,total:r.length}]:g.type==="comparison"&&g.baselinePassRate!=null?[{rate:g.baselinePassRate,idx:j,total:r.length}]:[]);if(i.length<2&&o.length<2)return null;const u=80,m=24,f=2,h=i.length>=2?$x(i,u,m,f):[],x=o.length>=2?$x(o,u,m,f):[],p=h[h.length-1],y=x[x.length-1];return n.jsxs("svg",{width:u,height:m,style:{display:"block",flexShrink:0},children:[x.length>0&&n.jsx("polyline",{points:x.join(" "),fill:"none",stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:"3 2"}),h.length>0&&n.jsx("polyline",{points:h.join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),y&&n.jsx("circle",{cx:parseFloat(y.split(",")[0]),cy:parseFloat(y.split(",")[1]),r:2.5,fill:"var(--text-tertiary)"}),p&&n.jsx("circle",{cx:parseFloat(p.split(",")[0]),cy:parseFloat(p.split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function ng(a,r,i){const o=isNaN(r)?0:r,u=[],m=[],f=[];if((a==="PASS"||a==="EFFECTIVE")&&o>=.7){const p=u.length>0?` Met criteria: ${u.map(y=>y.criterion).join(", ")}.`:"";return{explanation:`${a} (score ${o.toFixed(2)}): evaluation met expectations.${p}`}}if(a==="FAIL"||a==="DEGRADING"){const p=m.length>0?` Failed criteria: ${m.map(g=>g.criterion).join(", ")}.`:"",y=[...m.map(g=>`Improve "${g.criterion}" (score: ${g.score.toFixed(2)})`),...f.map(g=>`Strengthen "${g.criterion}" (score: ${g.score.toFixed(2)})`)];return y.length===0&&y.push("Review prompt instructions and add more specific guidance"),{explanation:`${a} (score ${o.toFixed(2)}): evaluation did not meet expectations.${p}`,recommendations:y}}if(a==="INEFFECTIVE"){if(o<.2){const y=[...m.map(g=>`Rework "${g.criterion}" — currently at ${g.score.toFixed(2)}`),"Consider adding examples to your system prompt","Review the rubric criteria for achievability"];return{explanation:`${a} (score ${o.toFixed(2)}): evaluation is significantly below expectations.`,recommendations:y}}const p=[...m.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:`${a} (score ${o.toFixed(2)}): below expectations but showing some capability.`,recommendations:p}}if(a==="MARGINAL"){const p=[...f.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`),...m.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return p.length===0&&p.push(u.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Review prompt instructions for areas of improvement"),{explanation:`${a} (score ${o.toFixed(2)}): moderate improvement detected.`,recommendations:p}}if(a==="EMERGING"){const p=[...m.map(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(u.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Add more specific guidance to your prompt instructions"),{explanation:`${a} (score ${o.toFixed(2)}): early promise — focus on weak areas to improve.`,recommendations:p}}const h=u.length>0?` Passing: ${u.map(p=>p.criterion).join(", ")}.`:"",x=f.length>0?` Needs improvement: ${f.map(p=>p.criterion).join(", ")}.`:"";return{explanation:`${a} (score ${o.toFixed(2)}): mixed results.${h}${x}`}}const ag={EFFECTIVE:"Strong Improvement",MARGINAL:"Moderate Improvement",EMERGING:"Early Promise",INEFFECTIVE:"Needs Work",DEGRADING:"Regression"};function bS(a){return Object.hasOwn(ag,a)}function jS(a){return bS(a)?ag[a]:a}function SS(){const{state:a}=kn(),{plugin:r,skill:i}=a,[o,u]=v.useState([]),[m,f]=v.useState([]),[h,x]=v.useState(!0),[p,y]=v.useState(null),[g,j]=v.useState(new Set),[S,N]=v.useState({}),[M,E]=v.useState(null),[k,T]=v.useState(""),[B,I]=v.useState(!1),[L,V]=v.useState(""),[w,D]=v.useState(""),A=v.useCallback(async()=>{x(!0),y(null);try{const[_,R]=await Promise.all([Ne.getCredentials(r,i),Ne.getParams(r,i)]);u(_.credentials),f(R.params)}catch(_){y(_ instanceof Error?_.message:"Failed to load parameters"),u([]),f([])}finally{x(!1)}},[r,i]);v.useEffect(()=>{A()},[A]);const O=v.useCallback(async(_,R)=>{I(!0),y(null);try{await Ne.setCredential(r,i,_,R),E(null),T(""),await A()}catch(U){y(U instanceof Error?U.message:`Failed to save ${_}`)}finally{I(!1)}},[r,i,A]),G=v.useCallback(async()=>{const _=L.trim().toUpperCase(),R=w.trim();if(!(!_||!R)){I(!0),y(null);try{await Ne.setCredential(r,i,_,R),V(""),D(""),await A()}catch(U){y(U instanceof Error?U.message:`Failed to add ${_}`)}finally{I(!1)}}},[r,i,L,w,A]),q=v.useCallback(async _=>{if(g.has(_)){j(R=>{const U=new Set(R);return U.delete(_),U}),N(R=>{const U={...R};return delete U[_],U});return}try{const U=(await Ne.getParamsRevealed(r,i,_)).params.find(se=>se.name===_);U!=null&&U.value&&(N(se=>({...se,[_]:U.value})),j(se=>new Set(se).add(_)))}catch{}},[r,i,g]),te=new Set(o.map(_=>_.name)),X=[...o.map(_=>{const R=m.find(U=>U.name===_.name);return{name:_.name,status:_.status,maskedValue:(R==null?void 0:R.maskedValue)??""}}),...m.filter(_=>!te.has(_.name)).map(_=>({name:_.name,status:_.status,maskedValue:_.maskedValue}))];return n.jsxs("div",{className:"py-2 px-3",children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters"}),p&&n.jsx("div",{className:"text-[10px] px-2 py-1.5 rounded mb-2",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},role:"alert",children:p}),h&&X.length===0&&n.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!h&&X.length===0&&!p&&n.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),X.map(_=>n.jsxs("div",{className:"flex items-center gap-2 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("span",{className:"text-[10px] font-mono flex-1 truncate",style:{color:"var(--text-primary)"},children:_.name}),n.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:_.status==="ready"?"var(--green-muted)":"var(--red-muted)",color:_.status==="ready"?"var(--green)":"var(--red)"},children:_.status}),(_.maskedValue||_.status==="ready")&&n.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[g.has(_.name)?S[_.name]??_.maskedValue:_.maskedValue||"***",n.jsx("button",{onClick:()=>q(_.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${g.has(_.name)?"Hide":"Reveal"} value for ${_.name}`,children:g.has(_.name)?"hide":"show"})]}),M===_.name?n.jsxs("div",{className:"flex gap-1",children:[n.jsx("input",{value:k,onChange:R=>T(R.target.value),onKeyDown:R=>{R.key==="Enter"&&k.trim()&&O(_.name,k)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${_.name}`,autoFocus:!0}),n.jsx("button",{onClick:()=>O(_.name,k),disabled:B||!k.trim(),className:"text-[10px] font-medium",style:{color:"var(--green)",background:"none",border:"none",cursor:"pointer"},children:"Save"}),n.jsx("button",{onClick:()=>{E(null),T("")},className:"text-[10px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]}):n.jsx("button",{onClick:()=>{E(_.name),T("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},_.name)),n.jsxs("div",{className:"mt-3 pt-2",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[10px] font-medium mb-1.5",style:{color:"var(--text-secondary)"},children:"Add New Parameter"}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("input",{value:L,onChange:_=>V(_.target.value),className:"input-field text-[10px] font-mono flex-1",placeholder:"KEY_NAME","aria-label":"Parameter key name"}),n.jsx("input",{value:w,onChange:_=>D(_.target.value),onKeyDown:_=>{_.key==="Enter"&&L.trim()&&w.trim()&&G()},className:"input-field text-[10px] font-mono flex-1",placeholder:"value",type:"password","aria-label":"Parameter value"}),n.jsx("button",{onClick:G,disabled:B||!L.trim()||!w.trim(),className:"text-[10px] font-medium px-2 py-1 rounded",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"none",cursor:B?"not-allowed":"pointer"},children:"Add"})]})]})]})}function kS(a,r,i){const[o,u]=v.useState(null),[m,f]=v.useState(!1),h=v.useRef("");v.useEffect(()=>{const p=`${a}/${r}/${i}`;h.current!==p&&(h.current=p,f(!0),Ne.getCaseHistory(a,r,i).then(y=>u(y)).catch(()=>u([])).finally(()=>f(!1)))},[a,r,i]);const x=v.useCallback(()=>{f(!0),h.current="",Ne.getCaseHistory(a,r,i).then(p=>u(p)).catch(()=>u([])).finally(()=>f(!1))},[a,r,i]);return{entries:o,loading:m,refetch:x}}function wS(a,r,i){const o={flaky:!1,nonDiscriminating:!1,regression:!1};if(!i||i.length===0)return o;const m=i.slice(0,10).map(x=>x.assertions.find(p=>p.id===a)).filter(Boolean);if(m.length>=2){const p=m.filter(y=>y.pass).length/m.length;p>=.3&&p<=.7&&(o.flaky=!0)}const f=i.find(x=>x.type==="benchmark"),h=i.find(x=>x.type==="baseline");if(f&&h){const x=f.assertions.find(y=>y.id===a),p=h.assertions.find(y=>y.id===a);x!=null&&x.pass&&(p!=null&&p.pass)&&(o.nonDiscriminating=!0)}if(r&&!r.pass&&i.length>=1){const p=i[0].assertions.find(y=>y.id===a);p!=null&&p.pass&&(o.regression=!0)}return o}function CS(){var se;const{state:a,dispatch:r,saveEvals:i,runCase:o,runAll:u,cancelCase:m,cancelAll:f,generateEvals:h,isReadOnly:x}=kn(),{evals:p,evalsError:y,selectedCaseId:g,inlineResults:j,caseRunStates:S,generateEvalsLoading:N,generateEvalsProgress:M,generateEvalsError:E}=a,k=v.useMemo(()=>{for(const Y of S.values())if(Y.status==="running"||Y.status==="queued")return!0;return!1},[S]),[T,B]=v.useState(!1),[I,L]=v.useState("all"),V={skill_name:a.skill,evals:[]},w=p??V,D=w.evals,A=v.useMemo(()=>I==="all"?D:D.filter(Y=>or(Y)===I),[I,D]),O=A.find(Y=>Y.id===g)??null;v.useEffect(()=>{g!==null&&!A.find(Y=>Y.id===g)&&r({type:"SELECT_CASE",caseId:A.length>0?A[0].id:null})},[A,g,r]);const[G,q]=v.useState([]),te=v.useMemo(()=>D.some(Y=>or(Y)==="integration"),[D]);v.useEffect(()=>{te&&Ne.getCredentials(a.plugin,a.skill).then(Y=>q(Y.credentials)).catch(()=>q([]))},[a.plugin,a.skill,te]);const X=v.useMemo(()=>new Set(G.filter(Y=>Y.status==="missing").map(Y=>Y.name)),[G]),[_,R]=v.useState(!1),U=v.useCallback(Y=>{R(!1),h(Y?{testType:Y}:void 0)},[h]);return!p||D.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:y?"var(--red-muted)":"var(--accent-muted)"},children:y?n.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),n.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}):n.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M9 11l3 3L22 4"}),n.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),n.jsx("div",{className:"text-center",children:y?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--red)"},children:"Invalid evals.json"}),n.jsx("div",{className:"text-[11px] font-mono px-3 py-2 rounded mt-1 max-w-sm text-left break-words",style:{color:"var(--text-secondary)",background:"var(--surface-2)"},children:y}),n.jsx("div",{className:"text-[12px] mt-2",style:{color:"var(--text-tertiary)"},children:"Fix the evals.json file and reload, or regenerate test cases with AI"})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No test cases yet"}),n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Create test cases to start evaluating your skill"})]})}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:()=>B(!0),disabled:x,className:"btn btn-primary text-[12px]",children:"Create Test Case"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsxs("div",{className:"flex",children:[n.jsx("button",{onClick:()=>U("unit"),disabled:N||x,className:"btn btn-secondary text-[12px]",style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:N?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}})," Generating..."]}):"Generate Unit Tests"}),n.jsx("button",{onClick:()=>R(!_),disabled:N||x,className:"btn btn-secondary text-[12px]",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid var(--border-default)",padding:"4px 6px"},children:n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),_&&n.jsx("div",{className:"absolute right-0 mt-1 rounded-lg py-1 z-50",style:{background:"var(--surface-1)",border:"1px solid var(--border-default)",minWidth:180,boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:n.jsx("button",{onClick:()=>U("integration"),className:"w-full text-left px-3 py-2 text-[12px] transition-colors duration-100",style:{color:"var(--text-secondary)",background:"transparent"},onMouseEnter:Y=>{Y.currentTarget.style.background="var(--surface-2)"},onMouseLeave:Y=>{Y.currentTarget.style.background="transparent"},children:"Generate Integration Tests"})})]})]}),N&&M.length>0&&n.jsx("div",{className:"w-full max-w-md mt-3",children:n.jsx(Ls,{entries:M,isRunning:!0})}),E&&n.jsx("div",{className:"w-full max-w-md mt-3",children:n.jsx(zs,{error:E,onRetry:()=>U()})}),T&&n.jsx(Gx,{evals:w,onSave:Y=>{i(Y),B(!1)},onCancel:()=>B(!1)})]}):n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"280px 1fr",height:"100%",overflow:"hidden"},children:[n.jsxs("div",{className:"overflow-auto",style:{borderRight:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Test Cases (",A.length,")"]}),n.jsx("div",{className:"flex items-center gap-1.5",children:k?n.jsx("button",{onClick:f,className:"btn text-[10px] px-2 py-0.5",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:"Cancel All"}):n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>u("benchmark"),disabled:A.length===0||x,className:"btn btn-primary text-[10px] px-2 py-0.5",children:"Run All"}),n.jsx("button",{onClick:()=>u("comparison"),disabled:A.length===0||x,className:"btn btn-purple text-[10px] px-2 py-0.5",children:"Compare All"})]})})]}),n.jsx("div",{className:"flex px-3 py-1.5 gap-1",style:{borderBottom:"1px solid var(--border-subtle)"},children:["all","unit","integration"].map(Y=>n.jsx("button",{onClick:()=>L(Y),style:{padding:"2px 8px",fontSize:10,fontWeight:I===Y?600:400,background:I===Y?"var(--accent-muted)":"transparent",color:I===Y?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:Y==="all"?`All (${D.length})`:Y==="unit"?`Unit (${D.filter(me=>or(me)==="unit").length})`:`Integration (${D.filter(me=>or(me)==="integration").length})`},Y))}),n.jsxs("div",{className:"py-1",children:[A.length===0&&D.length>0&&n.jsxs("div",{className:"flex items-center justify-center py-8 px-3 text-[12px]",style:{color:"var(--text-tertiary)"},children:["No ",I==="all"?"":I+" ","tests yet"]}),A.map(Y=>{var ie;const me=j.get(Y.id),z=g===Y.id,W=or(Y);return n.jsxs("button",{onClick:()=>r({type:"SELECT_CASE",caseId:Y.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:z?"var(--accent-muted)":"transparent",borderLeft:z?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:de=>{z||(de.currentTarget.style.background="var(--surface-2)")},onMouseLeave:de=>{z||(de.currentTarget.style.background="transparent")},children:[n.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[n.jsxs("span",{className:"text-[12px] font-medium truncate flex items-center gap-1.5",style:{color:z?"var(--text-primary)":"var(--text-secondary)"},children:["#",Y.id," ",Y.name,n.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:9999,background:W==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:W==="unit"?"var(--accent)":"var(--orange)",whiteSpace:"nowrap"},children:W==="unit"?"U":"I"}),W==="integration"&&((ie=Y.requiredCredentials)==null?void 0:ie.some(de=>X.has(de)))&&n.jsx("span",{title:"Configure credentials to run",children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})})]}),n.jsx(lg,{result:me})]}),n.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[Y.assertions.length," assertion",Y.assertions.length!==1?"s":"",(me==null?void 0:me.passRate)!=null&&n.jsx(TS,{passRate:me.passRate})]})]},Y.id)})]}),n.jsx("div",{className:"px-3 py-2",children:!x&&n.jsx("button",{onClick:()=>B(!0),className:"w-full py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{border:"1px dashed var(--border-default)",color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:Y=>{Y.currentTarget.style.borderColor="var(--accent)",Y.currentTarget.style.color="var(--accent)"},onMouseLeave:Y=>{Y.currentTarget.style.borderColor="var(--border-default)",Y.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})}),n.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:n.jsx(SS,{})})]}),n.jsx("div",{className:"overflow-auto",children:O?n.jsx(NS,{evalCase:O,result:j.get(O.id),evals:p,caseStatus:((se=S.get(O.id))==null?void 0:se.status)??"idle",onSaveEvals:i,onRun:Y=>o(Y,"benchmark"),onCompare:Y=>o(Y,"comparison"),onCancel:Y=>m(Y),onImprove:Y=>r({type:"OPEN_IMPROVE",evalId:Y})}):n.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"Select a test case"})}),T&&n.jsx(Gx,{evals:w,onSave:Y=>{i(Y),B(!1)},onCancel:()=>B(!1)})]})}function NS({evalCase:a,result:r,evals:i,caseStatus:o,onSaveEvals:u,onRun:m,onCompare:f,onCancel:h,onImprove:x}){const{state:p,isReadOnly:y}=kn(),{plugin:g,skill:j}=p,{entries:S,loading:N}=kS(g,j,a.id),[M,E]=v.useState(!1),[k,T]=v.useState(a.prompt),[B,I]=v.useState(!1),[L,V]=v.useState(a.expected_output);v.useState(()=>{T(a.prompt),V(a.expected_output)});const w=v.useCallback(Y=>{u({...i,evals:i.evals.map(me=>me.id===Y.id?Y:me)})},[i,u]),D=v.useCallback(()=>{w({...a,prompt:k}),E(!1)},[a,k,w]),A=v.useCallback(()=>{w({...a,expected_output:L}),I(!1)},[a,L,w]),O=v.useCallback(()=>{w({...a,assertions:[...a.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[a,w]),G=v.useCallback((Y,me)=>{w({...a,assertions:a.assertions.map(z=>z.id===Y?{...z,text:me}:z)})},[a,w]),q=v.useCallback(Y=>{w({...a,assertions:a.assertions.filter(me=>me.id!==Y)})},[a,w]),te=v.useCallback(()=>{confirm("Delete this test case?")&&u({...i,evals:i.evals.filter(Y=>Y.id!==a.id)})},[i,a.id,u]),X=r&&r.assertions.length>0&&r.assertions.every(Y=>Y.pass),_=r&&r.assertions.some(Y=>!Y.pass),R=or(a),U=a.requiredCredentials??[],se=R==="integration"&&U.length>0;return n.jsxs("div",{className:"p-5 animate-fade-in",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("span",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["#",a.id," ",a.name]}),y?n.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:R==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:R==="unit"?"var(--accent)":"var(--orange)"},children:R==="unit"?"Unit":"Integration"}):n.jsx("button",{onClick:()=>{if((R==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:me,requirements:z,cleanup:W,...ie}=a;w({...ie,testType:"unit"})}else w({...a,testType:"integration"})},title:`Click to switch to ${R==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:R==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:R==="unit"?"var(--accent)":"var(--orange)",border:"none",cursor:"pointer"},children:R==="unit"?"Unit":"Integration"}),n.jsx(lg,{result:r})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[o==="running"||o==="queued"?n.jsxs("button",{onClick:()=>h(a.id),className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:n.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel"]}):n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>m(a.id),disabled:y,className:"btn btn-primary text-[12px]",children:"Run"}),n.jsx("button",{onClick:()=>f(a.id),disabled:y,className:"btn btn-purple text-[12px]",children:"A/B Compare"})]}),_&&!y&&o!=="running"&&o!=="queued"&&n.jsx("button",{onClick:()=>x(a.id),className:"btn btn-secondary text-[12px]",children:"Fix with AI"}),!y&&o!=="running"&&o!=="queued"&&n.jsx("button",{onClick:te,className:"btn btn-ghost text-[12px]",style:{color:"var(--red)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("polyline",{points:"3 6 5 6 21 6"}),n.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})]}),y&&R==="integration"&&n.jsxs("div",{"data-testid":"platform-integration-note",className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--accent-muted)",border:"1px solid var(--accent-muted)"},children:[n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),n.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),n.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--accent)"},children:"Run locally in vSkill Studio"})]}),X&&n.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--green-muted)",border:"1px solid var(--green-muted)"},children:[n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",children:[n.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),n.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--green)"},children:"All assertions passing"})]}),se&&n.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--orange)"},children:"Required Credentials"})]}),n.jsx("div",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:"This integration test requires the following environment variables:"}),n.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:U.map(Y=>n.jsx("span",{style:{fontSize:10,fontFamily:"var(--font-mono, monospace)",padding:"2px 6px",borderRadius:4,background:"var(--orange-muted)",color:"var(--orange)"},children:Y},Y))})]}),!y&&R==="integration"&&n.jsx(MS,{evalCase:a,onUpdate:w}),n.jsx(Qi,{title:"Prompt",children:M?n.jsxs("div",{children:[n.jsx("textarea",{value:k,onChange:Y=>T(Y.target.value),className:"input-field w-full",rows:4,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),n.jsxs("div",{className:"flex gap-2 mt-2",children:[n.jsx("button",{onClick:D,className:"btn btn-primary text-[12px]",children:"Save"}),n.jsx("button",{onClick:()=>{T(a.prompt),E(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):n.jsx("div",{className:"p-3 rounded-lg text-[12px] transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-secondary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)",maxHeight:200,overflowY:"auto",cursor:y?"default":"pointer"},onClick:()=>{y||E(!0)},onMouseEnter:Y=>{y||(Y.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:Y=>{Y.currentTarget.style.borderColor="var(--border-subtle)"},children:a.prompt||n.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:y?"No prompt":"Click to edit prompt..."})})}),n.jsx(Qi,{title:"Expected Output",children:B?n.jsxs("div",{children:[n.jsx("textarea",{value:L,onChange:Y=>V(Y.target.value),className:"input-field w-full",rows:3,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),n.jsxs("div",{className:"flex gap-2 mt-2",children:[n.jsx("button",{onClick:A,className:"btn btn-primary text-[12px]",children:"Save"}),n.jsx("button",{onClick:()=>{V(a.expected_output),I(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):n.jsx("div",{className:"p-3 rounded-lg text-[12px] transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)",maxHeight:200,overflowY:"auto",cursor:y?"default":"pointer"},onClick:()=>{y||I(!0)},onMouseEnter:Y=>{y||(Y.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:Y=>{Y.currentTarget.style.borderColor="var(--border-subtle)"},children:a.expected_output||n.jsx("span",{style:{fontStyle:"italic"},children:y?"No expected output":"Click to edit expected output..."})})}),n.jsx(Qi,{title:`Assertions (${a.assertions.length})`,action:y?void 0:n.jsx("button",{onClick:O,className:"btn btn-ghost text-[11px]",children:"+ Add"}),children:a.assertions.length===0?n.jsx("div",{className:"text-[12px] text-center py-4",style:{color:"var(--text-tertiary)"},children:'No assertions. Click "+ Add" to create one.'}):n.jsx("div",{className:"space-y-2",children:a.assertions.map(Y=>{const me=r==null?void 0:r.assertions.find(W=>W.assertion_id===Y.id),z=wS(Y.id,me,S);return n.jsx(ES,{assertion:Y,result:me,badges:z,isReadOnly:y,onUpdate:W=>G(Y.id,W),onDelete:()=>q(Y.id)},Y.id)})})}),(r==null?void 0:r.output)&&n.jsx(RS,{output:r.output,durationMs:r.durationMs,tokens:r.tokens}),r&&r.passRate!=null&&r.passRate<.2&&(()=>{const Y=ng("INEFFECTIVE",r.passRate);return Y.recommendations&&Y.recommendations.length>0?n.jsx(Qi,{title:"Recommendations",children:n.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),n.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--orange)"},children:"This eval is significantly below expectations"})]}),n.jsx("ul",{className:"space-y-1.5 ml-1",children:Y.recommendations.map((me,z)=>n.jsxs("li",{className:"flex items-start gap-2 text-[12px]",style:{color:"var(--text-secondary)"},children:[n.jsx("span",{style:{color:"var(--orange)",fontWeight:600,flexShrink:0},children:"•"}),me]},z))})]})}):null})(),n.jsx(AS,{evalId:a.id,sharedEntries:S,sharedLoading:N})]},a.id)}function ES({assertion:a,result:r,badges:i,isReadOnly:o,onUpdate:u,onDelete:m}){const[f,h]=v.useState(!1),[x,p]=v.useState(a.text),[y,g]=v.useState(!1),j=()=>{u(x),h(!1)};return n.jsx("div",{className:"rounded-lg px-3 py-2.5 transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:n.jsxs("div",{className:"flex items-start gap-2",children:[r?n.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",background:r.pass?"var(--green-muted)":"var(--red-muted)"},children:r.pass?n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):n.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,border:"1.5px dashed var(--text-tertiary)",background:"transparent"},title:"Not run yet"}),(i==null?void 0:i.regression)&&n.jsx("span",{className:"mt-0.5 flex-shrink-0",title:"Regression: was passing, now failing",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:16,height:18,color:"var(--red)",fontSize:14,fontWeight:700,lineHeight:1},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("polyline",{points:"19 12 12 19 5 12"})]})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[n.jsx("span",{className:"text-[10px] font-mono font-semibold",style:{color:"var(--text-tertiary)"},children:a.id}),(i==null?void 0:i.flaky)&&n.jsx("span",{title:"Flaky: 30-70% pass rate across recent runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"var(--yellow-muted)",color:"var(--yellow)",whiteSpace:"nowrap"},children:"Flaky"}),(i==null?void 0:i.nonDiscriminating)&&n.jsx("span",{title:"Non-discriminating: passes on both skill and baseline runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"var(--surface-3)",color:"var(--text-tertiary)",whiteSpace:"nowrap"},children:"Non-Discrim."})]}),f?n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{value:x,onChange:S=>p(S.target.value),onKeyDown:S=>{S.key==="Enter"&&j(),S.key==="Escape"&&h(!1)},className:"input-field flex-1 text-[12px]",autoFocus:!0}),n.jsx("button",{onClick:j,className:"btn btn-primary text-[11px]",children:"Save"})]}):n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-secondary)",cursor:o?"default":"pointer"},onClick:()=>{o||(p(a.text),h(!0))},children:a.text}),(r==null?void 0:r.reasoning)&&n.jsx("button",{onClick:()=>g(!y),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:y?"Hide reasoning":"Show reasoning"}),y&&(r==null?void 0:r.reasoning)&&n.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:r.reasoning})]}),!o&&n.jsx("button",{onClick:m,className:"btn btn-ghost p-1 opacity-0 group-hover:opacity-100",style:{color:"var(--text-tertiary)"},onMouseEnter:S=>{S.currentTarget.style.color="var(--red)",S.currentTarget.style.opacity="1"},onMouseLeave:S=>{S.currentTarget.style.color="var(--text-tertiary)",S.currentTarget.style.opacity=""},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})}function Qi({title:a,action:r,children:i}){return n.jsxs("div",{className:"mb-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:a}),r]}),i]})}function lg({result:a}){const[r,i]=v.useState(!1);if(!a||a.status==null)return n.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"--"});const o=a.status==="pass",u=a.passRate??0,f=ng(o?"PASS":"FAIL",u);return n.jsxs("span",{className:"pill text-[10px]",style:{background:o?"var(--green-muted)":"var(--red-muted)",color:o?"var(--green)":"var(--red)",position:"relative",cursor:"default"},onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),"aria-describedby":r?"verdict-tooltip":void 0,children:[a.passRate!=null?`${Math.round(a.passRate*100)}%`:a.status,r&&n.jsx("div",{id:"verdict-tooltip",role:"tooltip",style:{position:"absolute",bottom:"calc(100% + 6px)",right:0,padding:"6px 10px",background:"var(--surface-4)",border:"1px solid var(--border-subtle)",borderRadius:6,fontSize:11,color:"var(--text-secondary)",whiteSpace:"nowrap",zIndex:50,maxWidth:300,width:"max-content",boxShadow:"0 4px 12px rgba(0,0,0,0.15)"},children:f.explanation})]})}function TS({passRate:a}){const r=Math.round(a*100);return n.jsx("div",{className:"flex items-center gap-1",children:n.jsx("div",{className:"rounded-full overflow-hidden",style:{width:32,height:4,background:"var(--surface-4)"},children:n.jsx("div",{className:"h-full rounded-full",style:{width:`${r}%`,background:r>=80?"var(--green)":r>=50?"var(--yellow)":"var(--red)"}})})})}function RS({output:a,durationMs:r,tokens:i}){const[o,u]=v.useState(!1);return n.jsxs("div",{className:"mb-5",children:[n.jsxs("button",{onClick:()=>u(!o),className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:o?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),"LLM Output",r!=null&&n.jsxs("span",{style:{fontWeight:400},children:["(",(r/1e3).toFixed(1),"s)"]}),i!=null&&n.jsxs("span",{style:{fontWeight:400},children:["(",i," tokens)"]})]}),o&&n.jsx("pre",{className:"text-[12px] p-4 rounded-lg overflow-auto animate-fade-in",style:{background:"var(--surface-1)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:400,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:a})]})}function Wu(a){return a==="baseline"?"right":a==="comparison"?"full":"left"}function Qu({entry:a}){return n.jsxs("div",{className:"rounded-lg px-3 py-2.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:Jv(a.timestamp)}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:a.model}),n.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:a.type==="benchmark"?"var(--accent-muted)":a.type==="comparison"?"var(--purple-muted)":"var(--orange-muted)",color:a.type==="benchmark"?"var(--accent)":a.type==="comparison"?"var(--purple)":"var(--orange)"},children:a.type}),n.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:mr(a.pass_rate)},children:[Math.round(a.pass_rate*100),"%"]})]}),n.jsxs("div",{className:"flex items-center gap-4 mb-1.5 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[a.durationMs!=null&&n.jsx("span",{children:eg(a.durationMs)}),a.tokens!=null&&n.jsxs("span",{children:[a.tokens>=1e3?`${(a.tokens/1e3).toFixed(1)}k`:a.tokens," tok"]})]}),a.type==="comparison"&&a.baselinePassRate!=null&&(()=>{const r=a.pass_rate-a.baselinePassRate,i=r>.001?"skill":r<-.001?"baseline":"tie",o=r>0?"+":"",u=i==="skill"?"var(--green)":i==="baseline"?"var(--red)":"var(--text-tertiary)";return n.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"vs baseline:"}),n.jsxs("span",{className:"text-[11px] font-semibold",style:{color:r>=0?"var(--green)":"var(--red)"},children:[o,(r*100).toFixed(1),"%"]}),n.jsx("span",{className:"pill text-[9px]",style:{padding:"1px 5px",background:"var(--surface-3)",color:u},children:i})]})})(),n.jsx("div",{className:"space-y-0.5",children:a.assertions.map(r=>n.jsxs("div",{className:"flex items-start gap-1.5",children:[n.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:14,height:14,display:"flex",alignItems:"center",justifyContent:"center",background:r.pass?"var(--green-muted)":"var(--red-muted)"},children:r.pass?n.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:r.text})]},r.id))})]})}function AS({evalId:a,sharedEntries:r,sharedLoading:i}){const{state:o,dispatch:u}=kn(),{plugin:m,skill:f}=o,[h,x]=v.useState(!0),p=r??null,y=i??!1,g=v.useCallback(()=>{x(M=>!M)},[]),j=p?p.slice(0,10):[],S=j.some(M=>{const E=Wu(M.type);return E==="left"||E==="full"}),N=j.some(M=>{const E=Wu(M.type);return E==="right"||E==="full"});return n.jsxs("div",{className:"mb-5",children:[n.jsxs("button",{onClick:g,className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:h?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Execution History",p&&p.length>0&&n.jsxs("span",{style:{fontWeight:400},children:["(",p.length," run",p.length!==1?"s":"",")"]})]}),h&&n.jsx("div",{className:"animate-fade-in",children:y?n.jsxs("div",{className:"flex items-center gap-2 py-3",children:[n.jsx("div",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),n.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):!p||p.length===0?n.jsx("div",{className:"text-[12px] py-3",style:{color:"var(--text-tertiary)"},children:"No history for this case"}):n.jsxs("div",{children:[j.length>=2&&n.jsx("div",{className:"mb-2",children:n.jsx(tg,{entries:j})}),n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"1"},children:"Skill"}),n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"2"},children:"Baseline"}),!S&&n.jsx("div",{style:{gridColumn:"1",fontSize:12,color:"var(--text-tertiary)"},children:"No skill runs"}),!N&&n.jsx("div",{style:{gridColumn:"2",fontSize:12,color:"var(--text-tertiary)"},children:"No baseline runs"}),j.map((M,E)=>{const k=Wu(M.type);return k==="full"?n.jsx("div",{style:{gridColumn:"1 / -1"},children:n.jsx(Qu,{entry:M})},E):k==="left"?n.jsxs(v.Fragment,{children:[n.jsx("div",{style:{gridColumn:"1"},children:n.jsx(Qu,{entry:M})}),n.jsx("div",{style:{gridColumn:"2"}})]},E):n.jsxs(v.Fragment,{children:[n.jsx("div",{style:{gridColumn:"1"}}),n.jsx("div",{style:{gridColumn:"2"},children:n.jsx(Qu,{entry:M})})]},E)})]}),n.jsx("button",{onClick:()=>u({type:"SET_PANEL",panel:"history"}),className:"mt-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--accent)"},onMouseEnter:M=>{M.currentTarget.style.textDecoration="underline"},onMouseLeave:M=>{M.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function Gx({evals:a,onSave:r,onCancel:i}){const[o,u]=v.useState(""),[m,f]=v.useState(""),[h,x]=v.useState(""),[p,y]=v.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[g,j]=v.useState("unit"),[S,N]=v.useState(""),[M,E]=v.useState([]),[k,T]=v.useState(""),[B,I]=v.useState(""),L=Math.max(0,...a.evals.map(A=>A.id))+1,V=A=>{j(A),A==="unit"&&(E([]),N(""),T(""),I(""))},w=()=>{const A=S.trim().toUpperCase();A&&!M.includes(A)&&E([...M,A]),N("")},D=()=>{if(!o.trim()||!m.trim())return;const A={id:L,name:o.trim(),prompt:m.trim(),expected_output:h.trim(),files:[],assertions:p.filter(O=>O.text.trim()),...g==="integration"?{testType:"integration",...M.length>0?{requiredCredentials:M}:{},...k||B?{requirements:{...k?{platform:k}:{},...B?{chromeProfile:B}:{}}}:{}}:{}};r({...a,evals:[...a.evals,A]})};return n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center animate-overlay-in",style:{background:"rgba(0,0,0,0.6)"},children:n.jsxs("div",{className:"w-full max-w-lg rounded-xl p-6 animate-modal-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",maxHeight:"85vh",overflowY:"auto"},children:[n.jsx("div",{className:"text-[15px] font-semibold mb-4",style:{color:"var(--text-primary)"},children:"New Test Case"}),n.jsxs("div",{className:"mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1.5 block",style:{color:"var(--text-tertiary)"},children:"Type"}),n.jsx("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)",display:"inline-flex"},children:["unit","integration"].map(A=>n.jsx("button",{onClick:()=>V(A),className:"px-3 py-1 rounded-md text-[12px] font-medium transition-all duration-150",style:{background:g===A?A==="unit"?"var(--accent-muted)":"var(--orange-muted)":"transparent",color:g===A?A==="unit"?"var(--accent)":"var(--orange)":"var(--text-tertiary)",border:"none",cursor:"pointer",textTransform:"capitalize"},children:A},A))})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Name"}),n.jsx("input",{value:o,onChange:A=>u(A.target.value),className:"input-field",placeholder:"e.g., auth-check",autoFocus:!0})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Prompt"}),n.jsx("textarea",{value:m,onChange:A=>f(A.target.value),className:"input-field",rows:3,placeholder:"User prompt to test..."})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Expected Output"}),n.jsx("textarea",{value:h,onChange:A=>x(A.target.value),className:"input-field",rows:2,placeholder:"Description of expected behavior..."})]}),n.jsxs("div",{className:"mb-4",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Assertions"}),p.map((A,O)=>n.jsxs("div",{className:"flex gap-2 mb-2",children:[n.jsx("input",{value:A.text,onChange:G=>y(p.map((q,te)=>te===O?{...q,text:G.target.value}:q)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),p.length>1&&n.jsx("button",{onClick:()=>y(p.filter((G,q)=>q!==O)),className:"btn btn-ghost p-1",style:{color:"var(--text-tertiary)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},A.id)),n.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"})]}),g==="integration"&&n.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},children:"Integration Settings"}),n.jsxs("div",{className:"mb-3",children:[n.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),n.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:M.map(A=>n.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"var(--orange-muted)",color:"var(--orange)"},children:[A,n.jsx("button",{onClick:()=>E(M.filter(O=>O!==A)),style:{color:"var(--orange)",lineHeight:1},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},A))}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("input",{value:S,onChange:A=>N(A.target.value),onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),w())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., SLACK_BOT_TOKEN"}),n.jsx("button",{onClick:w,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),n.jsx("input",{value:k,onChange:A=>T(A.target.value),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),n.jsxs("label",{className:"block",children:[n.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),n.jsx("input",{value:B,onChange:A=>I(A.target.value),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{onClick:i,className:"btn btn-secondary text-[12px]",children:"Cancel"}),n.jsx("button",{onClick:D,disabled:!o.trim()||!m.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function MS({evalCase:a,onUpdate:r}){var f,h;const[i,o]=v.useState(""),u=()=>{const x=i.trim().toUpperCase();x&&!(a.requiredCredentials??[]).includes(x)&&r({...a,requiredCredentials:[...a.requiredCredentials??[],x]}),o("")},m=x=>{const p=(a.requiredCredentials??[]).filter(y=>y!==x);r({...a,requiredCredentials:p.length>0?p:void 0})};return n.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},children:"Integration Settings"}),n.jsxs("div",{className:"mb-2.5",children:[n.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),n.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:(a.requiredCredentials??[]).map(x=>n.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"var(--orange-muted)",color:"var(--orange)"},children:[x,n.jsx("button",{onClick:()=>m(x),style:{color:"var(--orange)",lineHeight:1},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},x))}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("input",{value:i,onChange:x=>o(x.target.value),onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),u())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., GITHUB_TOKEN"}),n.jsx("button",{onClick:u,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),n.jsxs("div",{className:"mb-2.5",children:[n.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),n.jsx("input",{value:((f=a.requirements)==null?void 0:f.platform)??"",onChange:x=>r({...a,requirements:{...a.requirements,platform:x.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),n.jsx("input",{value:((h=a.requirements)==null?void 0:h.chromeProfile)??"",onChange:x=>r({...a,requirements:{...a.requirements,chromeProfile:x.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]})}function Sn(a,r){return r==="free"?"Free":r==="subscription"&&a==null?"Subscription":a==null?"N/A":a>=1?`$${a.toFixed(2)}`:a===0?"$0.00":a>=.001?`$${a.toFixed(4)}`:`$${a.toPrecision(3).replace(/0+$/,"").replace(/\.$/,"")}`}function rg(a,r){return a==null||r==null?"N/A":`${a.toLocaleString("en-US")} in / ${r.toLocaleString("en-US")} out`}function DS(a){return a==="baseline"?"Baseline Pass Rate":"Skill Pass Rate"}function zS(a,r){let i="";if(r){const u=new Date(r);isNaN(u.getTime())||(i=u.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}))}return[a,i].filter(Boolean).join(" · ")}function LS(a,r,i){const o=i===1?"test case":"test cases";if(a===0)return`Your skill performs the same as the baseline across ${i} ${o}`;const u=Math.round(Math.abs(a)*r);if(u===0)return`Your skill performs the same as the baseline across ${i} ${o}`;const m=a>0?"more":"fewer";return`Your skill passes ${u} ${m} assertions across ${i} ${o}`}function Px(a,r){const i=o=>{const u=o/5*100;return isFinite(u)?Math.round(Math.min(100,Math.max(0,u))):0};return{skill:i(a),baseline:i(r)}}function _S(a){return a==="skill"?{text:"Skill wins",isSkill:!0}:a==="baseline"?{text:"Baseline wins",isSkill:!1}:{text:"Tie",isSkill:!1}}function OS(a,r){const i=a+r,o=i*10,u=i*25,m=f=>f>=60?`${Math.round(f/60)}m`:`${f}s`;return`${m(o)}–${m(u)}`}const BS={anthropic:.01,openrouter:.01,ollama:0,"lm-studio":0,"claude-cli":0,"codex-cli":0,"gemini-cli":0};function US(a,r){if(!a)return null;const i=BS[a];if(i==null||i===0)return null;const o=i*r*.5,u=i*r*2;return`${Sn(o)}–${Sn(u)}`}function HS(){const{state:a,runCase:r,runAll:i,cancelCase:o,cancelAll:u,isReadOnly:m}=kn(),{evals:f,caseRunStates:h,bulkRunActive:x,latestBenchmark:p,inlineResults:y}=a,{config:g}=bl(),j=(f==null?void 0:f.evals)??[],S=v.useMemo(()=>{for(const w of h.values())if(w.status==="running"||w.status==="queued")return!0;return!1},[h]),N=j.filter(w=>{const D=h.get(w.id);return D&&(D.status==="complete"||D.status==="error"||D.status==="cancelled")}).length,M=j.filter(w=>{const D=h.get(w.id);return D&&(D.status==="running"||D.status==="queued")}).length,E=v.useRef(null),[k,T]=v.useState(0);v.useEffect(()=>{if(S&&!E.current&&(E.current=Date.now()),!S){E.current=null,T(0);return}const w=setInterval(()=>{E.current&&T(Math.round((Date.now()-E.current)/1e3))},1e3);return()=>clearInterval(w)},[S]);const B=j.reduce((w,D)=>w+D.assertions.length,0),I=j.length+B,L=v.useMemo(()=>OS(j.length,B),[j.length,B]),V=v.useMemo(()=>US((g==null?void 0:g.provider)??null,I),[g==null?void 0:g.provider,I]);return n.jsxs("div",{className:"p-5",children:[m&&n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-4 text-[11px]",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Installed skill — benchmarking is disabled. Edit the source skill to run benchmarks."]}),n.jsxs("div",{className:"rounded-xl p-4 mb-5",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Benchmark"}),S&&n.jsxs("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:[M," running"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[S&&n.jsxs("button",{onClick:u,className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:n.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel All"]}),n.jsx("button",{onClick:()=>i("comparison"),disabled:j.length===0||S||m,className:"btn btn-primary text-[12px]",title:"Runs both your skill and the baseline, then compares results side by side",children:"Run A/B Test"}),n.jsx("button",{onClick:()=>i("benchmark"),disabled:j.length===0||S||m,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using your skill only",children:"Test Skill"}),n.jsx("button",{onClick:()=>i("baseline"),disabled:j.length===0||S||m,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using the baseline (no skill) for reference",children:"Test Baseline"})]}),!S&&j.length>0&&n.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[10px]",style:{color:"var(--text-tertiary)"},children:[n.jsxs("span",{children:["Est. duration: ",L]}),V&&n.jsxs("span",{children:["Est. cost: ",V]}),!V&&(g==null?void 0:g.provider)&&(g.provider==="claude-cli"||g.provider==="codex-cli")&&n.jsx("span",{children:"Cost: Subscription"}),!V&&(g==null?void 0:g.provider)&&(g.provider==="ollama"||g.provider==="lm-studio"||g.provider==="gemini-cli")&&n.jsx("span",{children:"Cost: Free"})]})]}),S&&j.length>0&&n.jsxs("div",{className:"mb-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("span",{className:"text-[12px] font-medium",style:{color:"var(--text-secondary)"},children:["Progress: ",N,"/",j.length," cases"]}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(N/j.length*100),"%"]})]}),n.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:n.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${N/j.length*100}%`,background:"var(--accent)"}})}),n.jsxs("div",{className:"flex items-center justify-between mt-1.5",children:[n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Elapsed: ",k>=60?`${Math.floor(k/60)}m ${k%60}s`:`${k}s`]}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Est. total: ",L]})]})]}),n.jsx("div",{className:"space-y-3 stagger-children",children:j.map(w=>{const D=y.get(w.id),A=h.get(w.id),O=(A==null?void 0:A.status)??"idle",G=p==null?void 0:p.cases.find(q=>q.eval_id===w.id);return n.jsx(VS,{name:w.name,evalId:w.id,result:D,caseCost:G==null?void 0:G.cost,caseBillingMode:G==null?void 0:G.billingMode,caseInputTokens:G==null?void 0:G.inputTokens,caseOutputTokens:G==null?void 0:G.outputTokens,caseStatus:O,runMode:(A==null?void 0:A.mode)??null,comparisonDetail:G==null?void 0:G.comparisonDetail,isReadOnly:m,onRun:q=>r(q,"benchmark"),onBaseline:q=>r(q,"baseline"),onCompare:q=>r(q,"comparison"),onCancel:q=>o(q)},w.id)})}),!S&&p&&p.cases.length>0&&n.jsxs("div",{className:"mt-5",children:[n.jsxs("div",{className:"rounded-xl p-4 mb-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:DS(p.type)}),n.jsx("span",{className:"text-[20px] font-bold",style:{color:(p.overall_pass_rate??0)>=.8?"var(--green)":(p.overall_pass_rate??0)>=.5?"var(--yellow)":"var(--red)"},children:p.overall_pass_rate!=null?`${Math.round(p.overall_pass_rate*100)}%`:"--"})]}),p.totalDurationMs!=null&&n.jsxs("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:["Total: ",(p.totalDurationMs/1e3).toFixed(1),"s",p.model&&` | Model: ${p.model}`,p.totalInputTokens!=null&&p.totalOutputTokens!=null&&` | Tokens: ${rg(p.totalInputTokens,p.totalOutputTokens)}`,p.totalCost!=null&&` | Cost: ${Sn(p.totalCost)}`]}),p.overall_pass_rate>=.9999&&!p.comparison&&n.jsx("button",{onClick:()=>i("comparison"),disabled:j.length===0||m,className:"text-[13px] font-semibold mt-3 w-full rounded-lg transition-opacity duration-150",style:{padding:"10px 0",background:"var(--green)",color:"var(--color-paper)",border:"none",cursor:"pointer",opacity:j.length===0?.5:1},children:"Run Final A/B Comparison"})]}),p.comparison&&n.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Skill vs Baseline"}),(()=>{const w=zS(p.model,p.timestamp);return w?n.jsx("div",{className:"text-[10px] mt-0.5 mb-3",style:{color:"var(--text-tertiary)"},children:w}):n.jsx("div",{className:"mb-3"})})(),n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsx(qx,{label:"Skill",value:p.comparison.skillPassRate,color:"var(--accent)"}),n.jsx(qx,{label:"Baseline",value:p.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),n.jsxs("div",{className:"mt-3 text-[12px] font-medium",style:{color:p.comparison.delta>0?"var(--green)":p.comparison.delta<0?"var(--red)":"var(--text-tertiary)"},children:["Delta: ",p.comparison.delta>0?"+":"",(p.comparison.delta*100).toFixed(1),"%",p.verdict&&` | ${jS(p.verdict)}`]}),(()=>{const w=p.cases.reduce((A,O)=>A+O.assertions.length,0),D=LS(p.comparison.delta,w,p.cases.length);return n.jsx("div",{className:"mt-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:D})})()]})]})]})}const IS={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 VS({name:a,evalId:r,result:i,caseCost:o,caseBillingMode:u,caseInputTokens:m,caseOutputTokens:f,caseStatus:h,runMode:x,comparisonDetail:p,isReadOnly:y,onRun:g,onBaseline:j,onCompare:S,onCancel:N}){const[M,E]=v.useState(!1),k=h==="running"||h==="queued",T=h==="complete"||h==="error";return n.jsxs("div",{className:"rounded-xl overflow-hidden transition-all duration-200",style:{background:"var(--surface-1)",border:k?"1px solid var(--accent)":"1px solid var(--border-subtle)",boxShadow:k?"0 0 12px rgba(99, 131, 255, 0.15)":"none"},children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[h==="running"&&n.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),h==="queued"&&n.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--text-tertiary)"},children:"queued"}),n.jsxs("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:["#",r," ",a]}),x&&(k||T)&&(()=>{const B=IS[x];return B?n.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:B.bg,color:B.color,padding:"1px 6px"},children:B.label}):null})()]}),n.jsxs("div",{className:"flex items-center gap-2",children:[k?n.jsx("button",{onClick:()=>N(r),className:"btn text-[10px] px-2 py-1",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:"Cancel"}):n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>S(r),disabled:y,className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),n.jsx("button",{onClick:()=>g(r),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),n.jsx("button",{onClick:()=>j(r),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Base"})]}),i&&i.status!=null&&n.jsx("span",{className:"pill text-[10px]",style:{background:i.status==="pass"?"var(--green-muted)":"var(--red-muted)",color:i.status==="pass"?"var(--green)":"var(--red)"},children:i.passRate!=null?`${Math.round(i.passRate*100)}%`:i.status}),m!=null&&f!=null&&n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:rg(m,f)}),o!=null&&n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:Sn(o,u)}),h==="cancelled"&&n.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"cancelled"})]})]}),i&&i.assertions.length>0&&n.jsxs("div",{className:"px-4 pb-3",children:[n.jsx("div",{className:"space-y-1",children:i.assertions.map(B=>n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsx("span",{style:{color:B.pass?"var(--green)":"var(--red)"},children:B.pass?"PASS":"FAIL"}),n.jsx("span",{style:{color:"var(--text-secondary)"},children:B.text})]},B.assertion_id))}),i.output&&n.jsx("button",{onClick:()=>E(!M),className:"text-[11px] mt-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:M?"Hide output":"Show output"}),M&&i.output&&n.jsx("pre",{className:"text-[11px] mt-2 p-3 rounded-lg overflow-auto",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:200,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap"},children:i.output})]}),p&&n.jsx("div",{className:"px-4 pb-3",children:n.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:n.jsx("div",{className:"flex items-center gap-4 text-[11px] flex-wrap",children:(()=>{const B=Px(p.skillContentScore,p.baselineContentScore),I=Px(p.skillStructureScore,p.baselineStructureScore),L=_S(p.winner);return n.jsxs(n.Fragment,{children:[n.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Content: Skill ",B.skill,"% / Baseline ",B.baseline,"%"]}),n.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),n.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Structure: Skill ",I.skill,"% / Baseline ",I.baseline,"%"]}),n.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),n.jsx("span",{style:{color:L.isSkill?"var(--accent)":"var(--text-tertiary)",fontWeight:500},children:L.text})]})})()})})}),i&&i.errorMessage&&n.jsx($S,{errorMessage:i.errorMessage,classifiedError:i.classifiedError})]})}const Xu={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function $S({errorMessage:a,classifiedError:r}){const[i,o]=v.useState(!1),u=(r==null?void 0:r.title)??"Error",m=r==null?void 0:r.hint,f=r?Xu[r.category]??Xu.unknown:Xu.unknown;return n.jsx("div",{className:"px-4 pb-3",children:n.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:"var(--red-muted)",border:"1px solid var(--red-muted)"},children:[n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[n.jsx("span",{style:{fontSize:12},children:f}),n.jsx("span",{className:"text-[11.5px] font-semibold flex-1",style:{color:"var(--red)"},children:u}),n.jsx("button",{onClick:()=>o(!i),className:"text-[10px] px-1.5 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},children:i?"Hide details":"Details"})]}),m&&n.jsx("div",{className:"px-3 pb-2 text-[10.5px]",style:{color:"var(--text-secondary)"},children:m}),i&&n.jsx("pre",{className:"text-[10px] px-3 pb-2.5 overflow-auto",style:{color:"var(--text-tertiary)",maxHeight:120,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0},children:a})]})})}function qx({label:a,value:r,color:i}){return n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-1",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:a}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:i},children:[Math.round(r*100),"%"]})]}),n.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:n.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${r*100}%`,background:i}})})]})}const Yx={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 GS(){const{state:a,dispatch:r,runActivationTest:i,cancelActivation:o,generateActivationPrompts:u}=kn(),{plugin:m,skill:f,activationPrompts:h,activationResults:x,activationSummary:p,activationRunning:y,activationError:g,activationStartedAt:j,activationClassifyingStatus:S,generatingPrompts:N,generatingPromptsError:M,activationHistory:E}=a,[k,T]=v.useState(h),[B,I]=v.useState(null),[L,V]=v.useState(!1);v.useEffect(()=>{h&&h!==k&&T(h)},[h]),v.useEffect(()=>{r({type:"SET_ACTIVATION_PROMPTS",prompts:k})},[k,r]),v.useEffect(()=>{fetch(`/api/skills/${m}/${f}/description`).then(_=>_.json()).then(_=>I(_.rawContent||_.description||null)).catch(()=>I(null))},[m,f]);function w(){i(k)}function D(){u(8)}const A=k.trim().split(`
70
- `).filter(Boolean).length,O=x.filter(_=>_.classification==="TP"||_.classification==="TN"),G=x.filter(_=>_.classification==="FP"||_.classification==="FN"),q=(B==null?void 0:B.replace(/^---[\s\S]*?---\s*/,"").trim())??null,te=k.trim().length>0,X=q?go(q):"";return n.jsxs("div",{className:"p-5 space-y-5",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Activation Test"}),n.jsx("div",{className:"text-[12px] mt-0.5",style:{color:"var(--text-tertiary)"},children:"Test whether this skill's description activates for relevant prompts and stays silent for irrelevant ones."})]}),n.jsxs("div",{className:"grid grid-cols-[3fr_2fr] gap-4 items-stretch",children:[n.jsxs("div",{className:"glass-card p-4 flex flex-col gap-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Test Prompts"}),n.jsx("div",{className:"flex gap-1.5",children:n.jsx("button",{onClick:D,disabled:N||!q||y,className:"text-[10px] px-2.5 py-1 rounded-md transition-colors duration-150 flex items-center gap-1.5",style:{background:N?"var(--surface-3)":"var(--surface-2)",color:q?"var(--accent)":"var(--text-tertiary)",border:"1px solid var(--border-subtle)",opacity:q?1:.5,cursor:q?"pointer":"not-allowed"},title:q?void 0:"No skill description available",onMouseEnter:_=>{q&&!N&&(_.currentTarget.style.background="var(--surface-3)")},onMouseLeave:_=>{N||(_.currentTarget.style.background="var(--surface-2)")},children:N?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"spinner",style:{borderTopColor:"var(--accent)",borderColor:"var(--border-subtle)",width:10,height:10}}),"Generating..."]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M12 3v3m6.36.64l-2.12 2.12M21 12h-3m-.64 6.36l-2.12-2.12M12 21v-3m-4.24.64l2.12-2.12M3 12h3m.64-6.36l2.12 2.12"})}),te?"Regenerate":"Generate"," Test Prompts"]})})})]}),!q&&!y&&n.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},"aria-live":"polite",children:"Add a description to your skill's frontmatter to enable prompt generation."}),M&&n.jsx("div",{className:"text-[11px] px-2 py-1 rounded",style:{color:"var(--red)",background:"var(--red-muted)"},children:M}),n.jsx("textarea",{className:"input-field resize-y font-mono text-[12px]",style:{minHeight:140,height:140},value:k,onChange:_=>T(_.target.value),placeholder:`How do I write a unit test?
66
+ `);if(i.length>1e3||o.length>1e3)return[...i.map(y=>({type:"unchanged",content:y}))];const u=i.length,m=o.length,f=Array.from({length:u+1},()=>new Array(m+1).fill(0));for(let y=1;y<=u;y++)for(let g=1;g<=m;g++)i[y-1]===o[g-1]?f[y][g]=f[y-1][g-1]+1:f[y][g]=Math.max(f[y-1][g],f[y][g-1]);const h=[];let x=u,p=m;for(;x>0||p>0;)x>0&&p>0&&i[x-1]===o[p-1]?(h.push({type:"unchanged",content:i[x-1]}),x--,p--):p>0&&(x===0||f[x][p-1]>=f[x-1][p])?(h.push({type:"added",content:o[p-1]}),p--):(h.push({type:"removed",content:i[x-1]}),x--);return h.reverse()}function Q2(a,r){if(r&&new Set(["generating","comparing","judging","judging_assertion","preparing","parsing","generating_skill","generating_baseline","scoring","action_items"]).has(a))return n.jsx("div",{className:"spinner",style:{width:10,height:10,flexShrink:0}});const o=new Set(["generating","comparing","preparing","generating_skill","generating_baseline","scoring","action_items"]);return n.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{background:o.has(a)?"var(--accent)":"var(--green)"}})}function Ls({entries:a,isRunning:r}){const[i,o]=v.useState(!1),u=v.useRef(null);return v.useEffect(()=>{u.current&&!i&&(u.current.scrollTop=u.current.scrollHeight)},[a,i]),a.length===0&&!r?null:n.jsxs("div",{className:"mt-2 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsxs("button",{onClick:()=>o(!i),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:m=>{m.currentTarget.style.color="var(--text-primary)"},onMouseLeave:m=>{m.currentTarget.style.color="var(--text-tertiary)"},children:[n.jsxs("span",{className:"flex items-center gap-2",children:[r&&n.jsx("div",{className:"spinner",style:{width:10,height:10}}),"Progress Log (",a.length,")"]}),n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{transform:i?"rotate(0)":"rotate(180deg)",transition:"transform 0.2s ease"},children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),!i&&n.jsx("div",{ref:u,className:"px-3 pb-3 space-y-1 max-h-48 overflow-y-auto",children:a.map((m,f)=>{const h=f===a.length-1&&r,x=f===0?"0s":`+${((m.timestamp-a[0].timestamp)/1e3).toFixed(1)}s`;return n.jsxs("div",{className:"flex items-center gap-2 text-[11px] animate-fade-in",style:{opacity:h?1:.7},children:[Q2(m.phase,h),n.jsx("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)",width:40},children:x}),n.jsx("span",{style:{color:h?"var(--text-primary)":"var(--text-secondary)"},children:m.message}),m.current!=null&&m.total!=null&&n.jsxs("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)"},children:["[",m.current,"/",m.total,"]"]})]},f)})})]})}function X2({plugin:a,skill:r,skillContent:i,onApplied:o}){const[u,m]=v.useState("closed"),{config:f}=bl(),[h,x]=v.useState("claude-cli"),[p,y]=v.useState("opus"),[g,j]=v.useState([]),[S,N]=v.useState(""),[D,T]=v.useState(""),[k,M]=v.useState(null),[B,V]=v.useState(null),[A,U]=v.useState([]),[C,z]=v.useState(!1),R=v.useRef(null);v.useEffect(()=>{if(!f)return;f.providers.find(O=>O.id==="claude-cli"&&O.available)&&(x("claude-cli"),y("opus"))},[f]),v.useEffect(()=>()=>{var E;(E=R.current)==null||E.abort()},[]);function I(){return f==null?void 0:f.providers.find(E=>E.id===h&&E.available)}const P=v.useCallback(()=>{var E;(E=R.current)==null||E.abort(),m("open")},[]);async function q(){m("loading"),M(null),V(null),U([]);const E=new AbortController;R.current=E;try{const O=await fetch(`/api/skills/${encodeURIComponent(a)}/${encodeURIComponent(r)}/improve?sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:h,model:p}),signal:E.signal});if(!O.ok||!O.body){let F=`HTTP ${O.status}`;try{const ie=await O.json();ie.error&&(F=ie.error)}catch{}throw new Error(F)}const te=O.body.getReader(),Y=new TextDecoder;let me="",L="";for(;;){const{done:F,value:ie}=await te.read();if(F)break;me+=Y.decode(ie,{stream:!0});const de=me.split(`
67
+ `);me=de.pop()||"";for(const ge of de)if(ge.startsWith("event: "))L=ge.slice(7).trim();else if(ge.startsWith("data: ")){try{const xe=JSON.parse(ge.slice(6));L==="progress"?U(oe=>[...oe,{phase:xe.phase,message:xe.message,timestamp:Date.now()}]):L==="done"||L==="complete"?(N(xe.improved),T(xe.reasoning||""),j(yo(xe.original||i,xe.improved)),m("diff_shown")):L==="error"&&(M(xe.message||xe.description||"Unknown error"),xe.category&&V(xe),m("open"))}catch{}L=""}}}catch(O){O.name!=="AbortError"&&(M(O.message),m("open"))}finally{R.current=null}}async function ee(){z(!0);try{await Ne.applyImprovement(a,r,S),o(S),m("closed")}catch(E){M(E.message)}finally{z(!1)}}function X(){m("closed"),j([]),N(""),T(""),M(null)}if(u==="closed")return n.jsxs("button",{onClick:()=>m("open"),className:"btn btn-secondary mb-5",disabled:!i,children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),n.jsx("path",{d:"M2 17l10 5 10-5"}),n.jsx("path",{d:"M2 12l10 5 10-5"})]}),"Improve Skill"]});const _=I();return n.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden animate-fade-in",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),n.jsx("path",{d:"M2 17l10 5 10-5"}),n.jsx("path",{d:"M2 12l10 5 10-5"})]})}),n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Skill Improvement"})]}),n.jsx("button",{onClick:X,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:E=>{E.currentTarget.style.background="var(--surface-3)"},onMouseLeave:E=>{E.currentTarget.style.background="transparent"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsxs("div",{className:"px-5 py-4",children:[(u==="open"||u==="loading")&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-end gap-3 mb-4",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),n.jsx("select",{className:"input-field text-[12px] py-1.5",value:h,onChange:E=>{x(E.target.value);const O=f==null?void 0:f.providers.find(te=>te.id===E.target.value);O!=null&&O.models[0]&&y(O.models[0].id)},disabled:u==="loading",children:f==null?void 0:f.providers.filter(E=>E.available).map(E=>n.jsx("option",{value:E.id,children:E.label},E.id))})]}),n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),n.jsx("select",{className:"input-field text-[12px] py-1.5",value:p,onChange:E=>y(E.target.value),disabled:u==="loading",children:_==null?void 0:_.models.map(E=>n.jsx("option",{value:E.id,children:E.label},E.id))})]}),u==="loading"?n.jsx("button",{onClick:P,className:"btn btn-secondary flex-shrink-0",children:"Cancel"}):n.jsx("button",{onClick:q,className:"btn btn-primary flex-shrink-0",children:"Improve"})]}),u==="loading"&&A.length>0&&n.jsx("div",{className:"mt-3",children:n.jsx(Ls,{entries:A,isRunning:!0})})]}),k&&n.jsx("div",{className:"mb-4",children:B?n.jsx(zs,{error:B,onRetry:q,onDismiss:()=>{M(null),V(null)}}):n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:k})}),u==="diff_shown"&&n.jsxs(n.Fragment,{children:[D&&n.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"rgba(168,85,247,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(168,85,247,0.2)"},children:[n.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),D]}),n.jsx("div",{className:"rounded-lg overflow-hidden mb-4",style:{border:"1px solid var(--border-subtle)",maxHeight:"400px",overflowY:"auto"},children:g.map((E,O)=>n.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:E.type==="added"?"rgba(34,197,94,0.1)":E.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:E.type==="added"?"var(--green)":E.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:E.type==="added"?"3px solid var(--green)":E.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:E.type==="added"?"+":E.type==="removed"?"-":" "}),E.content]},O))}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:ee,disabled:C,className:"btn btn-primary",children:C?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"spinner",style:{width:12,height:12}})," Applying..."]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})," Apply"]})}),n.jsx("button",{onClick:X,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}const Ix={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"}},Z2={remove:"var(--red)",modify:"#fbbf24",add:"var(--green)"};function J2({change:a,index:r,selected:i,onToggle:o,originalEval:u}){var g;const[m,f]=v.useState(!1),h=Ix[a.action]??Ix.add,x=Z2[a.action]??"var(--border-subtle)",p=a.action==="remove"?(u==null?void 0:u.name)??`Eval #${a.evalId}`:((g=a.eval)==null?void 0:g.name)??"Unnamed",y=v.useCallback(()=>o(r),[o,r]);return n.jsxs("div",{className:"rounded-lg transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderLeft:`3px solid ${x}`,opacity:i?1:.5},children:[n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[n.jsx("input",{type:"checkbox",checked:i,onChange:y,className:"flex-shrink-0",style:{accentColor:"var(--accent)"}}),n.jsx("span",{className:"pill text-[9px] font-bold flex-shrink-0",style:{background:h.bg,color:h.color,padding:"1px 6px"},children:h.label}),n.jsx("span",{className:"text-[12px] font-medium truncate",style:{color:"var(--text-primary)"},children:p}),n.jsx("span",{className:"text-[11px] truncate flex-1",style:{color:"var(--text-tertiary)"},children:a.reason}),n.jsx("button",{onClick:()=>f(!m),className:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:j=>{j.currentTarget.style.background="var(--surface-3)"},onMouseLeave:j=>{j.currentTarget.style.background="transparent"},children:n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:m?"rotate(90deg)":"rotate(0)",transition:"transform 0.15s ease"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),m&&n.jsxs("div",{className:"px-4 pb-3 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.action==="add"&&a.eval&&n.jsx(eS,{evalCase:a.eval}),a.action==="modify"&&a.eval&&u&&n.jsx(tS,{original:u,proposed:a.eval}),a.action==="remove"&&u&&n.jsx(nS,{evalCase:u})]})]})}function eS({evalCase:a}){var r;return n.jsxs("div",{className:"pt-2.5 space-y-2",children:[n.jsx(xd,{label:"Prompt",value:a.prompt}),n.jsx(xd,{label:"Expected",value:a.expected_output}),n.jsxs("div",{children:[n.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((r=a.assertions)==null?void 0:r.length)??0,")"]}),n.jsx("div",{className:"mt-1 space-y-1",children:(a.assertions??[]).map(i=>n.jsxs("div",{className:"text-[11px] flex items-start gap-1.5",style:{color:"var(--text-secondary)"},children:[n.jsx("span",{style:{color:"var(--green)"},children:"+"})," ",i.text]},i.id))})]})]})}function tS({original:a,proposed:r}){const i=[];a.name!==r.name&&i.push({label:"Name",old:a.name,new:r.name}),a.prompt!==r.prompt&&i.push({label:"Prompt",old:a.prompt,new:r.prompt}),a.expected_output!==r.expected_output&&i.push({label:"Expected",old:a.expected_output,new:r.expected_output});const o=a.assertions??[],u=r.assertions??[],m=new Set(o.map(p=>p.text)),f=new Set(u.map(p=>p.text)),h=u.filter(p=>!m.has(p.text)),x=o.filter(p=>!f.has(p.text));return n.jsxs("div",{className:"pt-2.5 space-y-2",children:[i.map(p=>n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:p.label}),n.jsxs("div",{className:"mt-1 text-[11px] font-mono rounded p-2",style:{background:"var(--surface-1)"},children:[n.jsxs("div",{style:{color:"var(--red)",textDecoration:"line-through"},children:["- ",vd(p.old,120)]}),n.jsxs("div",{style:{color:"var(--green)"},children:["+ ",vd(p.new,120)]})]})]},p.label)),(h.length>0||x.length>0)&&n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Assertions"}),n.jsxs("div",{className:"mt-1 space-y-0.5",children:[x.map(p=>n.jsxs("div",{className:"text-[11px]",style:{color:"var(--red)"},children:["- ",p.text]},p.id)),h.map(p=>n.jsxs("div",{className:"text-[11px]",style:{color:"var(--green)"},children:["+ ",p.text]},p.id))]})]}),i.length===0&&h.length===0&&x.length===0&&n.jsx("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"No visible field changes"})]})}function nS({evalCase:a}){var r;return n.jsxs("div",{className:"pt-2.5 space-y-2",style:{opacity:.7},children:[n.jsx(xd,{label:"Prompt",value:a.prompt}),n.jsxs("div",{children:[n.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((r=a.assertions)==null?void 0:r.length)??0,")"]}),n.jsx("div",{className:"mt-1 space-y-0.5",children:(a.assertions??[]).map(i=>n.jsx("div",{className:"text-[11px]",style:{color:"var(--red)",textDecoration:"line-through"},children:i.text},i.id))})]})]})}function xd({label:a,value:r}){return n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:a}),n.jsx("div",{className:"mt-0.5 text-[11px] p-2 rounded font-mono",style:{background:"var(--surface-1)",color:"var(--text-secondary)",whiteSpace:"pre-wrap"},children:vd(r,300)})]})}function vd(a,r){return a.length>r?a.slice(0,r)+"...":a}const Hx={remove:0,modify:1,add:2};function aS({changes:a,selections:r,currentEvals:i,onToggle:o,onSelectAll:u,onDeselectAll:m}){if(a.length===0)return null;const f=a.map((x,p)=>({change:x,originalIndex:p}));f.sort((x,p)=>(Hx[x.change.action]??2)-(Hx[p.change.action]??2));const h=Array.from(r.values()).filter(Boolean).length;return n.jsxs("div",{className:"mt-3 animate-fade-in",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"Test Case Changes"}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",h,"/",a.length," selected)"]})]}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("button",{onClick:u,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--accent)",background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--accent-muted)"},onMouseLeave:x=>{x.currentTarget.style.background="transparent"},children:"Select All"}),n.jsx("button",{onClick:m,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--surface-3)"},onMouseLeave:x=>{x.currentTarget.style.background="transparent"},children:"Deselect All"})]})]}),n.jsx("div",{className:"space-y-1.5 overflow-auto",style:{maxHeight:240},children:f.map(({change:x,originalIndex:p})=>n.jsx(J2,{change:x,index:p,selected:r.get(p)??!1,onToggle:o,originalEval:x.evalId!=null?i.find(y=>y.id===x.evalId):void 0},p))})]})}function lS(){var E;const{state:a,dispatch:r,submitAiEdit:i,applyAiEdit:o,discardAiEdit:u,cancelAiEdit:m,toggleEvalChange:f,selectAllEvalChanges:h,deselectAllEvalChanges:x,retryEvalsSave:p}=kn(),{aiEditLoading:y,aiEditResult:g,aiEditError:j,aiEditClassifiedError:S,aiEditProgress:N,aiEditEvalChanges:D,aiEditEvalSelections:T,aiEditEvalsRetry:k}=a,[M,B]=v.useState(""),{config:V}=bl(),[A,U]=v.useState("claude-cli"),[C,z]=v.useState("opus"),R=v.useRef(null);v.useEffect(()=>{var O;(O=R.current)==null||O.focus()},[]),v.useEffect(()=>{if(!V)return;V.providers.find(te=>te.id==="claude-cli"&&te.available)&&(U("claude-cli"),z("opus"))},[V]);const I=V==null?void 0:V.providers.find(O=>O.id===A&&O.available),P=v.useCallback(()=>{const O=M.trim();!O||y||i(O,A,C)},[M,y,i,A,C]),q=v.useCallback(O=>{O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),P()),O.key==="Escape"&&(O.preventDefault(),y?m():u())},[P,y,m,u]),ee=v.useCallback(()=>{r({type:"CLOSE_AI_EDIT"}),r({type:"OPEN_AI_EDIT"})},[r]),X=g?yo(a.skillContent,g.improved):[],_=((E=a.evals)==null?void 0:E.evals)??[];return n.jsxs("div",{className:"animate-fade-in",style:{background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-2)"},children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M15 4V2"}),n.jsx("path",{d:"M15 16v-2"}),n.jsx("path",{d:"M8 9h2"}),n.jsx("path",{d:"M20 9h2"}),n.jsx("path",{d:"M17.8 11.8L19 13"}),n.jsx("path",{d:"M15 9h.01"}),n.jsx("path",{d:"M17.8 6.2L19 5"}),n.jsx("path",{d:"M11 6.2L9.7 5"}),n.jsx("path",{d:"M3 21l9-9"})]})}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Edit"}),n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:"Describe what to change — Enter to submit, Esc to dismiss"})]}),n.jsx("button",{onClick:u,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:O=>{O.currentTarget.style.background="var(--surface-3)"},onMouseLeave:O=>{O.currentTarget.style.background="transparent"},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsxs("div",{className:"px-4 py-3",children:[!g&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-end gap-2.5",children:[n.jsx("div",{className:"flex-1",children:n.jsx("textarea",{ref:R,value:M,onChange:O=>B(O.target.value),onKeyDown:q,placeholder:"e.g., Add an error handling section...",disabled:y,rows:1,className:"w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",borderRadius:6,padding:"8px 12px",fontSize:12.5,lineHeight:1.5,fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",minHeight:36,maxHeight:96},onInput:O=>{const te=O.currentTarget;te.style.height="auto",te.style.height=Math.min(te.scrollHeight,96)+"px"}})}),n.jsxs("div",{style:{minWidth:100},children:[n.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),n.jsx("select",{className:"input-field text-[11px] py-1",value:A,onChange:O=>{U(O.target.value);const te=V==null?void 0:V.providers.find(Y=>Y.id===O.target.value);te!=null&&te.models[0]&&z(te.models[0].id)},disabled:y,style:{width:"100%"},children:V==null?void 0:V.providers.filter(O=>O.available).map(O=>n.jsx("option",{value:O.id,children:O.label},O.id))})]}),n.jsxs("div",{style:{minWidth:80},children:[n.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Model"}),n.jsx("select",{className:"input-field text-[11px] py-1",value:C,onChange:O=>z(O.target.value),disabled:y,style:{width:"100%"},children:I==null?void 0:I.models.map(O=>n.jsx("option",{value:O.id,children:O.label},O.id))})]}),y?n.jsx("button",{onClick:m,className:"btn btn-secondary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Cancel"}):n.jsx("button",{onClick:P,disabled:!M.trim(),className:"btn btn-primary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Submit"})]}),y&&N.length>0&&n.jsx("div",{className:"mt-2.5",children:n.jsx(Ls,{entries:N,isRunning:!0})})]}),j&&n.jsx("div",{className:"mt-3",children:S?n.jsx(zs,{error:S,onRetry:ee,onDismiss:u}):n.jsx("div",{className:"px-3 py-2.5 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:j})}),g&&n.jsxs("div",{className:"animate-fade-in",children:[g.reasoning&&n.jsxs("div",{className:"mb-3 px-3 py-2.5 rounded-lg text-[11.5px]",style:{background:"rgba(168,85,247,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(168,85,247,0.2)"},children:[n.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),g.reasoning]}),n.jsx("div",{className:"mb-1",children:n.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"})}),n.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:300,overflowY:"auto"},children:X.map((O,te)=>n.jsxs("div",{className:"px-3 py-0.5 text-[10.5px] font-mono",style:{background:O.type==="added"?"rgba(34,197,94,0.1)":O.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:O.type==="added"?"var(--green)":O.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:O.type==="added"?"3px solid var(--green)":O.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:O.type==="added"?"+":O.type==="removed"?"-":" "}),O.content]},te))}),n.jsx(aS,{changes:D,selections:T,currentEvals:_,onToggle:f,onSelectAll:h,onDeselectAll:x}),k&&n.jsxs("div",{className:"mt-3 px-3 py-2.5 rounded-lg text-[12px] flex items-center justify-between",style:{background:"rgba(251,191,36,0.12)",border:"1px solid rgba(251,191,36,0.3)",color:"#fbbf24"},children:[n.jsx("span",{children:"Test case save failed. SKILL.md was saved successfully."}),n.jsx("button",{onClick:p,className:"btn text-[11px]",style:{background:"rgba(251,191,36,0.2)",color:"#fbbf24",padding:"3px 10px"},children:"Retry Save"})]}),n.jsxs("div",{className:"flex gap-2 mt-3",children:[n.jsxs("button",{onClick:o,className:"btn btn-primary text-[11px]",style:{padding:"5px 12px"},children:[n.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),n.jsx("button",{onClick:u,className:"btn btn-secondary text-[11px]",style:{padding:"5px 12px"},children:"Discard"}),n.jsx("button",{onClick:ee,className:"btn btn-ghost text-[11px]",style:{padding:"5px 12px"},children:"Try Again"})]})]})]})]})}function rS(a,r){const[i,o]=v.useState([]),[u,m]=v.useState("SKILL.md"),[f,h]=v.useState(null),[x,p]=v.useState(!1),[y,g]=v.useState(null),j=v.useCallback(async()=>{try{const D=await Ne.getSkillFiles(a,r);o(D.files)}catch{o([])}},[a,r]);v.useEffect(()=>{m("SKILL.md"),h(null),g(null),j()},[a,r,j]);const S=v.useCallback(async D=>{if(m(D),D==="SKILL.md"){h(null),g(null);return}p(!0),g(null);try{const T=await Ne.getSkillFile(a,r,D);h(T)}catch(T){g(`Unable to open file: ${T.message}`),h(null)}finally{p(!1)}},[a,r]),N=v.useCallback(()=>{j()},[j]);return{files:i,activeFile:u,secondaryContent:f,loading:x,error:y,selectFile:S,refresh:N,isSkillMd:u==="SKILL.md"}}function sS(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function iS(a){const r=[],i=new Map;for(const o of a){const u=o.path.split("/"),f={name:u[u.length-1],path:o.path,type:o.type,size:o.size,children:[]};i.set(o.path,f)}for(const o of a){const u=o.path.split("/");if(u.length===1){const m=i.get(o.path);m&&r.push(m)}else{const m=u.slice(0,-1).join("/"),f=i.get(m),h=i.get(o.path);f&&h&&f.children.push(h)}}return r}function Xv({expanded:a}){return n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:a?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Zv(){return n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function oS(){return n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function cS(){return n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"23 4 23 10 17 10"}),n.jsx("polyline",{points:"1 20 1 14 7 14"}),n.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]})}function Jv({node:a,depth:r,activeFile:i,onSelect:o}){const[u,m]=v.useState(!0),f=a.path===i;return a.type==="dir"?n.jsxs("div",{children:[n.jsxs("button",{onClick:()=>m(!u),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+r*14}px`,paddingTop:2,paddingBottom:2,background:"none",border:"none",cursor:"pointer",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left"},children:[n.jsx(Xv,{expanded:u}),n.jsx(Zv,{}),n.jsxs("span",{children:[a.name,"/"]})]}),u&&a.children.map(h=>n.jsx(Jv,{node:h,depth:r+1,activeFile:i,onSelect:o},h.path))]}):n.jsxs("button",{onClick:()=>o(a.path),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+r*14}px`,paddingTop:2,paddingBottom:2,background:f?"var(--accent-muted)":"none",border:"none",cursor:"pointer",color:f?"var(--accent)":"var(--text-tertiary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left",borderRadius:3},children:[n.jsx("span",{style:{width:10}}),n.jsx(oS,{}),n.jsx("span",{style:{flex:1},children:a.name}),n.jsx("span",{style:{fontSize:9,color:"var(--text-tertiary)",marginRight:4,whiteSpace:"nowrap"},children:sS(a.size)})]})}function uS({files:a,activeFile:r,onSelect:i,onRefresh:o}){const[u,m]=v.useState(!1),f=v.useMemo(()=>iS(a),[a]);return n.jsxs("div",{style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 8px",cursor:"pointer",userSelect:"none"},onClick:()=>m(!u),children:[n.jsx(Xv,{expanded:u}),n.jsx(Zv,{}),n.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r}),n.jsx("button",{onClick:h=>{h.stopPropagation(),o()},style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",padding:"2px 4px",display:"flex",alignItems:"center",borderRadius:3},title:"Refresh file list",children:n.jsx(cS,{})})]}),u&&n.jsx("div",{style:{maxHeight:240,overflowY:"auto",padding:"2px 4px 4px"},children:f.length===0?n.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 8px"},children:"No files found"}):f.map(h=>n.jsx(Jv,{node:h,depth:0,activeFile:r,onSelect:i},h.path))})]})}function Ki(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function dS(a){try{return JSON.stringify(JSON.parse(a),null,2)}catch{return a}}function fS(a){const r=a.toLowerCase();return r.endsWith(".json")?"json":r.endsWith(".md")?"md":"other"}function Ux({content:a}){return n.jsx("textarea",{readOnly:!0,value:a,style:{flex:1,width:"100%",resize:"none",background:"var(--surface-1)",color:"var(--text-primary)",border:"none",outline:"none",padding:"12px 16px",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6}})}function Vx({content:a,fileType:r}){if(r==="json"){const i=dS(a);return n.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:i})}return r==="md"?n.jsx("div",{style:{flex:1,overflow:"auto",padding:"16px 20px",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:13,lineHeight:1.6},dangerouslySetInnerHTML:{__html:go(a)}}):n.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:a})}function $x(a){try{return JSON.stringify(JSON.parse(a),null,2).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"([^"\\]|\\.)*"\s*:/g,i=>`<span style="color:#6383ff">${i}</span>`).replace(/:\s*"([^"\\]|\\.)*"/g,i=>`<span style="color:#22c55e">${i.slice(0,2)}<span style="color:#22c55e">${i.slice(2)}</span></span>`).replace(/:\s*(-?\d+\.?\d*)/g,(i,o)=>`: <span style="color:#fb923c">${o}</span>`).replace(/:\s*(true|false|null)/g,(i,o)=>`: <span style="color:#a855f7">${o}</span>`)}catch{return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}}function pS({file:a,loading:r,error:i,viewMode:o,plugin:u,skill:m,onSaved:f,onDirtyChange:h}){const[x,p]=v.useState(o),[y,g]=v.useState(!1),[j,S]=v.useState(""),[N,D]=v.useState(!1),[T,k]=v.useState(null),M=o!==x?o:x;v.useEffect(()=>{h==null||h(y)},[y,h]);const B=v.useCallback(()=>{(a==null?void 0:a.content)!=null&&(S(a.content),g(!0))},[a]),V=v.useCallback(()=>{g(!1)},[]),A=v.useCallback(async()=>{if(!(!u||!m||!a)){D(!0);try{await Ne.saveSkillFile(u,m,a.path,j),k("Saved"),g(!1),f==null||f(),setTimeout(()=>k(null),2e3)}catch(z){k(`Save failed: ${z.message}`),setTimeout(()=>k(null),3e3)}finally{D(!1)}}},[u,m,a,j,f]);if(v.useEffect(()=>{if(!y)return;const z=R=>{(R.ctrlKey||R.metaKey)&&R.key==="s"&&(R.preventDefault(),A())};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[y,A]),r)return n.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:"Loading…"});if(i)return n.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:n.jsxs("div",{style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"16px 20px",maxWidth:400,textAlign:"center"},children:[n.jsx("div",{style:{fontSize:13,color:"var(--text-primary)",fontWeight:600,marginBottom:6},children:"Unable to open file"}),n.jsx("div",{style:{fontSize:12,color:"var(--text-tertiary)"},children:i})]})});if(!a)return null;if(a.binary)return n.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:["Binary file (",Ki(a.size),") — cannot be displayed"]});const U=a.content??"",C=fS(a.path);return n.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[a.truncated&&n.jsxs("div",{style:{padding:"4px 12px",background:"var(--warning-muted, #fef3c7)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:"var(--warning-text, #92400e)"},children:["File truncated at ",Ki(512*1024)," — ",Ki(a.size)," total"]}),n.jsxs("div",{style:{display:"flex",gap:4,padding:"4px 8px",borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[(C==="md"||C==="json")&&["raw","split","preview"].map(z=>n.jsx("button",{onClick:()=>p(z),style:{padding:"2px 8px",fontSize:11,background:M===z?"var(--accent-muted)":"none",color:M===z?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer",textTransform:"capitalize"},children:z},z)),n.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",display:"flex",alignItems:"center",gap:6},children:[Ki(a.size),u&&m&&!a.binary&&!y&&n.jsx("button",{onClick:B,style:{padding:"1px 6px",fontSize:10,background:"var(--accent-muted)",color:"var(--accent)",border:"none",borderRadius:3,cursor:"pointer"},children:"Edit"}),y&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:A,disabled:N,style:{padding:"1px 6px",fontSize:10,background:"var(--accent)",color:"#fff",border:"none",borderRadius:3,cursor:"pointer",opacity:N?.6:1},children:N?"Saving...":"Save"}),n.jsx("button",{onClick:V,style:{padding:"1px 6px",fontSize:10,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer"},children:"Cancel"})]})]})]}),T&&n.jsx("div",{style:{padding:"4px 12px",background:T.startsWith("Save failed")?"var(--red-muted)":"var(--green-muted)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:T.startsWith("Save failed")?"var(--red)":"var(--green)"},children:T}),n.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:y?n.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:[n.jsx("textarea",{value:j,onChange:z=>S(z.target.value),style:{flex:1,width:"100%",resize:"none",background:"var(--surface-0)",color:"var(--text-primary)",border:"none",outline:"none",padding:"12px 16px",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6}}),n.jsxs("div",{style:{position:"sticky",bottom:0,display:"flex",alignItems:"center",gap:8,padding:"6px 12px",background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[n.jsx("span",{style:{flex:1,fontSize:11,color:"var(--text-tertiary)"},children:"Unsaved changes"}),n.jsx("button",{onClick:A,disabled:N,style:{padding:"3px 12px",fontSize:11,background:"var(--accent)",color:"#fff",border:"none",borderRadius:4,cursor:"pointer",opacity:N?.6:1},children:N?"Saving...":"Save"}),n.jsx("button",{onClick:V,style:{padding:"3px 12px",fontSize:11,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer"},children:"Cancel"})]})]}):M==="split"&&C!=="other"?n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",borderRight:"1px solid var(--border-subtle)"},children:n.jsx(Ux,{content:U})}),n.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:C==="json"?n.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:$x(U)}}):n.jsx(Vx,{content:U,fileType:C})})]}):M==="preview"&&C!=="other"?C==="json"?n.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:$x(U)}}):n.jsx(Vx,{content:U,fileType:C}):n.jsx(Ux,{content:U})})]})}function mS({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"16 18 22 12 16 6"}),n.jsx("polyline",{points:"8 6 2 12 8 18"})]})}function hS({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),n.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})}function xS({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function vS({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M15 4V2"}),n.jsx("path",{d:"M15 16v-2"}),n.jsx("path",{d:"M8 9h2"}),n.jsx("path",{d:"M20 9h2"}),n.jsx("path",{d:"M17.8 11.8L19 13"}),n.jsx("path",{d:"M15 9h.01"}),n.jsx("path",{d:"M17.8 6.2L19 5"}),n.jsx("path",{d:"M11 6.2L9.7 5"}),n.jsx("path",{d:"M3 21l9-9"})]})}function Wu({size:a=15}){return n.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M12 3l1.5 5.5L19 10l-5.5 1.5L12 17l-1.5-5.5L5 10l5.5-1.5L12 3z"})})}function gS(){const{state:a,dispatch:r,saveContent:i,isReadOnly:o}=kn(),{plugin:u,skill:m,skillContent:f,isDirty:h,improveTarget:x,aiEditOpen:p}=a,[y,g]=v.useState("split"),[j,S]=v.useState(!1),N=v.useRef(null),[D,T]=v.useState(!1),[k,M]=v.useState(""),[B,V]=v.useState(!1),[A,U]=v.useState(null),[C,z]=v.useState([]),[R,I]=v.useState([]),[P,q]=v.useState(null),ee=v.useRef(null),{config:X}=bl(),{files:_,activeFile:E,secondaryContent:O,loading:te,error:Y,selectFile:me,refresh:L,isSkillMd:F}=rS(u??"",m??""),[ie,de]=v.useState(!1),ge=v.useCallback(ye=>{ie&&!window.confirm("You have unsaved changes. Discard?")||me(ye)},[ie,me]);v.useEffect(()=>()=>{var ye;(ye=ee.current)==null||ye.abort()},[]);const{metadata:xe,body:oe}=W2(f),le=xe["allowed-tools"],ve=Array.isArray(le)?le:typeof le=="string"?[le]:[],Ue=xe.name,Be=xe.description,ae=xe.metadata,fe=typeof ae=="object"&&!Array.isArray(ae)?ae:null,ue=xe.version||(fe==null?void 0:fe.version),he=xe.tags||(fe==null?void 0:fe.tags),be=Array.isArray(he)?he:typeof he=="string"?he.split(",").map(ye=>ye.trim()).filter(Boolean):[],_e=new Set(["name","description","metadata","allowed-tools","version","tags"]),Me=Object.entries(xe).filter(([ye])=>!_e.has(ye)),dt=v.useCallback(async()=>{S(!0),await i(),S(!1)},[i]),Zt=v.useCallback(ye=>{(ye.ctrlKey||ye.metaKey)&&ye.key==="s"&&(ye.preventDefault(),ye.stopPropagation(),h&&dt()),(ye.ctrlKey||ye.metaKey)&&ye.key==="k"&&(ye.preventDefault(),ye.stopPropagation(),r({type:p?"CLOSE_AI_EDIT":"OPEN_AI_EDIT"}))},[h,dt,p,r]),ct=v.useCallback(async()=>{var Rt,De;if(!k.trim())return;(Rt=ee.current)==null||Rt.abort();const ye=new AbortController;ee.current=ye,V(!0),q(null),I([]),U(null),z([]);try{const xt=(X==null?void 0:X.provider)||"claude-cli",Wt=(X==null?void 0:X.model)||"sonnet",nt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:k,provider:xt,model:Wt}),signal:ye.signal});if(!nt.ok||!nt.body){let bt=`HTTP ${nt.status}`;try{const Bn=await nt.json();Bn.error&&(bt=Bn.error)}catch{}throw new Error(bt)}const Xa=nt.body.getReader(),Xn=new TextDecoder;let Ct="",St="";for(;;){const{done:bt,value:Bn}=await Xa.read();if(bt)break;Ct+=Xn.decode(Bn,{stream:!0});const Za=Ct.split(`
68
+ `);Ct=Za.pop()||"";for(const In of Za)if(In.startsWith("event: "))St=In.slice(7).trim();else if(In.startsWith("data: ")){try{const Ve=JSON.parse(In.slice(6));if(St==="progress")I(It=>[...It,{phase:Ve.phase,message:Ve.message,timestamp:Date.now()}]);else if(St==="done"||St==="complete"){const It=["---"];Ve.name&&It.push(`name: ${Ve.name}`),Ve.description&&It.push(`description: "${Ve.description.replace(/"/g,'\\"')}"`),Ve.model&&It.push(`model: ${Ve.model}`),(De=Ve.allowedTools)!=null&&De.trim()&&It.push(`allowed-tools: ${Ve.allowedTools.trim()}`),It.push("---","",Ve.body||"");const Zn=It.join(`
69
+ `);U(Zn),z(yo(f,Zn)),V(!1)}else St==="error"&&(q(Ve.message||Ve.description||"Generation failed"),V(!1))}catch{}St=""}}}catch(xt){xt.name!=="AbortError"&&q(xt.message)}finally{V(!1),ee.current=null}},[k,X,f]),Vt=v.useCallback(()=>{A&&r({type:"SET_CONTENT",content:A}),T(!1),U(null),z([]),M(""),I([])},[A,r]),$t=v.useCallback(()=>{T(!1),U(null),z([]),M(""),I([]),q(null)},[]),tt=v.useCallback(()=>{var ye;D?((ye=ee.current)==null||ye.abort(),$t()):(p&&r({type:"CLOSE_AI_EDIT"}),T(!0))},[D,p,r,$t]),jt=[{mode:"raw",icon:n.jsx(mS,{}),label:"Editor"},{mode:"split",icon:n.jsx(hS,{}),label:"Split"},{mode:"preview",icon:n.jsx(xS,{}),label:"Preview"}];return n.jsxs("div",{className:"flex flex-col h-full",onKeyDown:Zt,tabIndex:-1,children:[n.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:jt.map(({mode:ye,icon:Rt,label:De})=>n.jsxs("button",{onClick:()=>g(ye),title:De,className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"5px 10px",background:y===ye?"var(--surface-4)":"transparent",color:y===ye?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:y===ye?600:400,border:"none",cursor:"pointer"},children:[Rt,n.jsx("span",{style:{letterSpacing:"0.01em"},children:De})]},ye))}),F?o?n.jsx("div",{className:"flex items-center gap-2",children:n.jsxs("span",{className:"flex items-center gap-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Read-only"]})}):n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{onClick:()=>{p?r({type:"CLOSE_AI_EDIT"}):(D&&$t(),r({type:"OPEN_AI_EDIT"}))},title:"Edit with AI (Ctrl+K)",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:p?600:400,border:"none",cursor:"pointer",color:p?"var(--purple)":"var(--text-tertiary)",background:p?"var(--purple-muted)":"transparent"},children:[n.jsx(vS,{size:13}),n.jsx("span",{children:"AI Edit"})]}),n.jsxs("button",{onClick:tt,title:"Regenerate skill from prompt",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:D?600:400,border:"none",cursor:"pointer",color:D?"var(--purple)":"var(--text-tertiary)",background:D?"var(--purple-muted)":"transparent"},children:[n.jsx(Wu,{size:13}),n.jsx("span",{children:"Regenerate"})]}),n.jsx("div",{style:{width:1,height:16,background:"var(--border-subtle)"}}),h&&n.jsx("button",{onClick:()=>r({type:"SET_CONTENT",content:a.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),n.jsx("button",{onClick:dt,disabled:!h||j,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:j?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Saving..."]}):"Save"})]}):null]}),u&&m&&n.jsx(uS,{files:_,activeFile:E,onSelect:ge,onRefresh:L}),!F&&n.jsx(pS,{file:O,loading:te,error:Y,viewMode:y,plugin:u??void 0,skill:m??void 0,onSaved:()=>{me(E),L()},onDirtyChange:de}),F&&n.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:y==="raw"||y==="preview"?"1fr":"1fr 1fr"},children:[y!=="preview"&&n.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:y==="split"?"1px solid var(--border-subtle)":"none"},children:n.jsx("textarea",{ref:N,value:f,onChange:ye=>{o||r({type:"SET_CONTENT",content:ye.target.value})},onKeyDown:Zt,spellCheck:!1,readOnly:o,className:"flex-1 w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",fontSize:12.5,lineHeight:1.7,tabSize:2,border:"none",padding:"16px 20px",opacity:o?.7:1}})}),y!=="raw"&&n.jsx("div",{className:"overflow-auto",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"animate-fade-in",style:{padding:"20px 24px",maxWidth:720},children:[(Ue||ue||Be)&&n.jsxs("div",{style:{marginBottom:20},children:[n.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[Ue&&n.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:Ue}),ue&&n.jsxs("span",{style:{fontSize:10,fontWeight:600,color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4,letterSpacing:"0.03em",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:["v",ue]})]}),Be&&n.jsx("p",{style:{fontSize:12.5,lineHeight:1.65,color:"var(--text-secondary)",margin:0,paddingLeft:12,borderLeft:"2px solid var(--accent)",maxWidth:600},children:Be})]}),be.length>0&&n.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:be.map(ye=>n.jsx("span",{style:{fontSize:10,fontWeight:500,color:"var(--text-tertiary)",background:"var(--surface-2)",padding:"3px 8px",borderRadius:4,letterSpacing:"0.02em"},children:ye},ye))}),ve.length>0&&n.jsx("div",{style:{marginBottom:16},children:n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",marginRight:4},children:"Tools"}),ve.map(ye=>n.jsx("span",{style:{fontSize:10.5,fontFamily:"var(--font-mono, ui-monospace, monospace)",color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4},children:ye},ye))]})}),Me.length>0&&n.jsx("div",{style:{marginBottom:16,padding:"8px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:Me.map(([ye,Rt],De)=>{const xt=Array.isArray(Rt)?Rt.join(", "):typeof Rt=="object"?Object.entries(Rt).map(([Wt,nt])=>`${Wt}: ${Array.isArray(nt)?nt.join(", "):nt}`).join(" | "):Rt;return n.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:De>0?"1px solid var(--border-subtle)":"none"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",minWidth:80,flexShrink:0},children:ye}),n.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:xt})]},ye)})}),(Ue||Be||be.length>0||ve.length>0||Me.length>0)&&oe&&n.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),oe&&n.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:go(oe)}})]})})]}),F&&p&&n.jsx(lS,{}),F&&D&&n.jsx("div",{className:"animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:n.jsxs("div",{className:"px-4 py-3",children:[!A&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(Wu,{size:14}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerate Skill"})]}),n.jsx("div",{className:"flex gap-2 mb-2",children:n.jsx("textarea",{value:k,onChange:ye=>M(ye.target.value),placeholder:"Describe what this skill should do...",rows:2,disabled:B,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:B?.5:1},onKeyDown:ye=>{ye.key==="Enter"&&(ye.ctrlKey||ye.metaKey)&&k.trim()&&!B&&(ye.preventDefault(),ct())}})}),n.jsxs("div",{className:"flex items-center gap-2",children:[B?n.jsx("button",{onClick:()=>{var ye;(ye=ee.current)==null||ye.abort(),V(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):n.jsx("button",{onClick:ct,disabled:!k.trim(),className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:"Generate"}),n.jsx("button",{onClick:$t,className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Close"})]}),B&&R.length>0&&n.jsx("div",{className:"mt-2",children:n.jsx(Ls,{entries:R,isRunning:!0})}),P&&n.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:[P,n.jsx("button",{onClick:ct,className:"ml-2 underline",style:{color:"var(--red)"},children:"Retry"})]})]}),A&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(Wu,{size:14}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerated — Review Changes"})]}),n.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:"300px",overflowY:"auto"},children:C.map((ye,Rt)=>n.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:ye.type==="added"?"var(--green-muted)":ye.type==="removed"?"var(--red-muted)":"transparent",color:ye.type==="added"?"var(--green)":ye.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:ye.type==="added"?"3px solid var(--green)":ye.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:ye.type==="added"?"+":ye.type==="removed"?"-":" "}),ye.content]},Rt))}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs("button",{onClick:Vt,className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),n.jsx("button",{onClick:$t,className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Discard"})]})]})]})}),F&&x!==null&&u&&m&&n.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:n.jsx(X2,{plugin:u,skill:m,skillContent:f,onApplied:ye=>{r({type:"SET_CONTENT",content:ye}),r({type:"CONTENT_SAVED"}),r({type:"CLOSE_IMPROVE"})}})})]})}function or(a){return a.testType==="integration"?"integration":"unit"}function mr(a){return a>=.8?"var(--green)":a>=.5?"var(--yellow)":"var(--red)"}function eg(a){const r=new Date(a);return r.toLocaleDateString(void 0,{month:"short",day:"numeric"})+", "+r.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function tg(a){return a==null?"--":a>=1e3?`${(a/1e3).toFixed(1)}s`:`${a}ms`}const yS=new Set(["benchmark","comparison","baseline"]);function Gx(a,r,i,o){return a.map(({rate:u,idx:m,total:f})=>{const h=o+m/(f-1)*(r-o*2),x=o+(i-o*2)-u*(i-o*2);return`${h},${x}`})}function ng({entries:a}){const r=a.filter(g=>yS.has(g.type)).slice().reverse(),i=r.map((g,j,S)=>({rate:g.pass_rate,idx:j,total:S.length})).filter((g,j)=>{const S=r[j].type;return S==="benchmark"||S==="comparison"}),o=r.flatMap((g,j)=>g.type==="baseline"?[{rate:g.pass_rate,idx:j,total:r.length}]:g.type==="comparison"&&g.baselinePassRate!=null?[{rate:g.baselinePassRate,idx:j,total:r.length}]:[]);if(i.length<2&&o.length<2)return null;const u=80,m=24,f=2,h=i.length>=2?Gx(i,u,m,f):[],x=o.length>=2?Gx(o,u,m,f):[],p=h[h.length-1],y=x[x.length-1];return n.jsxs("svg",{width:u,height:m,style:{display:"block",flexShrink:0},children:[x.length>0&&n.jsx("polyline",{points:x.join(" "),fill:"none",stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:"3 2"}),h.length>0&&n.jsx("polyline",{points:h.join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),y&&n.jsx("circle",{cx:parseFloat(y.split(",")[0]),cy:parseFloat(y.split(",")[1]),r:2.5,fill:"var(--text-tertiary)"}),p&&n.jsx("circle",{cx:parseFloat(p.split(",")[0]),cy:parseFloat(p.split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function ag(a,r,i){const o=isNaN(r)?0:r,u=[],m=[],f=[];if((a==="PASS"||a==="EFFECTIVE")&&o>=.7){const p=u.length>0?` Met criteria: ${u.map(y=>y.criterion).join(", ")}.`:"";return{explanation:`${a} (score ${o.toFixed(2)}): evaluation met expectations.${p}`}}if(a==="FAIL"||a==="DEGRADING"){const p=m.length>0?` Failed criteria: ${m.map(g=>g.criterion).join(", ")}.`:"",y=[...m.map(g=>`Improve "${g.criterion}" (score: ${g.score.toFixed(2)})`),...f.map(g=>`Strengthen "${g.criterion}" (score: ${g.score.toFixed(2)})`)];return y.length===0&&y.push("Review prompt instructions and add more specific guidance"),{explanation:`${a} (score ${o.toFixed(2)}): evaluation did not meet expectations.${p}`,recommendations:y}}if(a==="INEFFECTIVE"){if(o<.2){const y=[...m.map(g=>`Rework "${g.criterion}" — currently at ${g.score.toFixed(2)}`),"Consider adding examples to your system prompt","Review the rubric criteria for achievability"];return{explanation:`${a} (score ${o.toFixed(2)}): evaluation is significantly below expectations.`,recommendations:y}}const p=[...m.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:`${a} (score ${o.toFixed(2)}): below expectations but showing some capability.`,recommendations:p}}if(a==="MARGINAL"){const p=[...f.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`),...m.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return p.length===0&&p.push(u.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Review prompt instructions for areas of improvement"),{explanation:`${a} (score ${o.toFixed(2)}): moderate improvement detected.`,recommendations:p}}if(a==="EMERGING"){const p=[...m.map(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(u.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Add more specific guidance to your prompt instructions"),{explanation:`${a} (score ${o.toFixed(2)}): early promise — focus on weak areas to improve.`,recommendations:p}}const h=u.length>0?` Passing: ${u.map(p=>p.criterion).join(", ")}.`:"",x=f.length>0?` Needs improvement: ${f.map(p=>p.criterion).join(", ")}.`:"";return{explanation:`${a} (score ${o.toFixed(2)}): mixed results.${h}${x}`}}const lg={EFFECTIVE:"Strong Improvement",MARGINAL:"Moderate Improvement",EMERGING:"Early Promise",INEFFECTIVE:"Needs Work",DEGRADING:"Regression"};function bS(a){return Object.hasOwn(lg,a)}function jS(a){return bS(a)?lg[a]:a}function SS(){const{state:a}=kn(),{plugin:r,skill:i}=a,[o,u]=v.useState([]),[m,f]=v.useState([]),[h,x]=v.useState(!0),[p,y]=v.useState(null),[g,j]=v.useState(new Set),[S,N]=v.useState({}),[D,T]=v.useState(null),[k,M]=v.useState(""),[B,V]=v.useState(!1),[A,U]=v.useState(""),[C,z]=v.useState(""),R=v.useCallback(async()=>{x(!0),y(null);try{const[_,E]=await Promise.all([Ne.getCredentials(r,i),Ne.getParams(r,i)]);u(_.credentials),f(E.params)}catch(_){y(_ instanceof Error?_.message:"Failed to load parameters"),u([]),f([])}finally{x(!1)}},[r,i]);v.useEffect(()=>{R()},[R]);const I=v.useCallback(async(_,E)=>{V(!0),y(null);try{await Ne.setCredential(r,i,_,E),T(null),M(""),await R()}catch(O){y(O instanceof Error?O.message:`Failed to save ${_}`)}finally{V(!1)}},[r,i,R]),P=v.useCallback(async()=>{const _=A.trim().toUpperCase(),E=C.trim();if(!(!_||!E)){V(!0),y(null);try{await Ne.setCredential(r,i,_,E),U(""),z(""),await R()}catch(O){y(O instanceof Error?O.message:`Failed to add ${_}`)}finally{V(!1)}}},[r,i,A,C,R]),q=v.useCallback(async _=>{if(g.has(_)){j(E=>{const O=new Set(E);return O.delete(_),O}),N(E=>{const O={...E};return delete O[_],O});return}try{const O=(await Ne.getParamsRevealed(r,i,_)).params.find(te=>te.name===_);O!=null&&O.value&&(N(te=>({...te,[_]:O.value})),j(te=>new Set(te).add(_)))}catch{}},[r,i,g]),ee=new Set(o.map(_=>_.name)),X=[...o.map(_=>{const E=m.find(O=>O.name===_.name);return{name:_.name,status:_.status,maskedValue:(E==null?void 0:E.maskedValue)??""}}),...m.filter(_=>!ee.has(_.name)).map(_=>({name:_.name,status:_.status,maskedValue:_.maskedValue}))];return n.jsxs("div",{className:"py-2 px-3",children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters"}),p&&n.jsx("div",{className:"text-[10px] px-2 py-1.5 rounded mb-2",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},role:"alert",children:p}),h&&X.length===0&&n.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!h&&X.length===0&&!p&&n.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),X.map(_=>n.jsxs("div",{className:"flex items-center gap-2 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("span",{className:"text-[10px] font-mono flex-1 truncate",style:{color:"var(--text-primary)"},children:_.name}),n.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:_.status==="ready"?"var(--green-muted)":"var(--red-muted)",color:_.status==="ready"?"var(--green)":"var(--red)"},children:_.status}),(_.maskedValue||_.status==="ready")&&n.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[g.has(_.name)?S[_.name]??_.maskedValue:_.maskedValue||"***",n.jsx("button",{onClick:()=>q(_.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${g.has(_.name)?"Hide":"Reveal"} value for ${_.name}`,children:g.has(_.name)?"hide":"show"})]}),D===_.name?n.jsxs("div",{className:"flex gap-1",children:[n.jsx("input",{value:k,onChange:E=>M(E.target.value),onKeyDown:E=>{E.key==="Enter"&&k.trim()&&I(_.name,k)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${_.name}`,autoFocus:!0}),n.jsx("button",{onClick:()=>I(_.name,k),disabled:B||!k.trim(),className:"text-[10px] font-medium",style:{color:"var(--green)",background:"none",border:"none",cursor:"pointer"},children:"Save"}),n.jsx("button",{onClick:()=>{T(null),M("")},className:"text-[10px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]}):n.jsx("button",{onClick:()=>{T(_.name),M("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},_.name)),n.jsxs("div",{className:"mt-3 pt-2",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[10px] font-medium mb-1.5",style:{color:"var(--text-secondary)"},children:"Add New Parameter"}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("input",{value:A,onChange:_=>U(_.target.value),className:"input-field text-[10px] font-mono flex-1",placeholder:"KEY_NAME","aria-label":"Parameter key name"}),n.jsx("input",{value:C,onChange:_=>z(_.target.value),onKeyDown:_=>{_.key==="Enter"&&A.trim()&&C.trim()&&P()},className:"input-field text-[10px] font-mono flex-1",placeholder:"value",type:"password","aria-label":"Parameter value"}),n.jsx("button",{onClick:P,disabled:B||!A.trim()||!C.trim(),className:"text-[10px] font-medium px-2 py-1 rounded",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"none",cursor:B?"not-allowed":"pointer"},children:"Add"})]})]})]})}function kS(a,r,i){const[o,u]=v.useState(null),[m,f]=v.useState(!1),h=v.useRef("");v.useEffect(()=>{const p=`${a}/${r}/${i}`;h.current!==p&&(h.current=p,f(!0),Ne.getCaseHistory(a,r,i).then(y=>u(y)).catch(()=>u([])).finally(()=>f(!1)))},[a,r,i]);const x=v.useCallback(()=>{f(!0),h.current="",Ne.getCaseHistory(a,r,i).then(p=>u(p)).catch(()=>u([])).finally(()=>f(!1))},[a,r,i]);return{entries:o,loading:m,refetch:x}}function wS(a,r,i){const o={flaky:!1,nonDiscriminating:!1,regression:!1};if(!i||i.length===0)return o;const m=i.slice(0,10).map(x=>x.assertions.find(p=>p.id===a)).filter(Boolean);if(m.length>=2){const p=m.filter(y=>y.pass).length/m.length;p>=.3&&p<=.7&&(o.flaky=!0)}const f=i.find(x=>x.type==="benchmark"),h=i.find(x=>x.type==="baseline");if(f&&h){const x=f.assertions.find(y=>y.id===a),p=h.assertions.find(y=>y.id===a);x!=null&&x.pass&&(p!=null&&p.pass)&&(o.nonDiscriminating=!0)}if(r&&!r.pass&&i.length>=1){const p=i[0].assertions.find(y=>y.id===a);p!=null&&p.pass&&(o.regression=!0)}return o}function CS(){var te;const{state:a,dispatch:r,saveEvals:i,runCase:o,runAll:u,cancelCase:m,cancelAll:f,generateEvals:h,isReadOnly:x}=kn(),{evals:p,evalsError:y,selectedCaseId:g,inlineResults:j,caseRunStates:S,generateEvalsLoading:N,generateEvalsProgress:D,generateEvalsError:T}=a,k=v.useMemo(()=>{for(const Y of S.values())if(Y.status==="running"||Y.status==="queued")return!0;return!1},[S]),[M,B]=v.useState(!1),[V,A]=v.useState("all"),U={skill_name:a.skill,evals:[]},C=p??U,z=C.evals,R=v.useMemo(()=>V==="all"?z:z.filter(Y=>or(Y)===V),[V,z]),I=R.find(Y=>Y.id===g)??null;v.useEffect(()=>{g!==null&&!R.find(Y=>Y.id===g)&&r({type:"SELECT_CASE",caseId:R.length>0?R[0].id:null})},[R,g,r]);const[P,q]=v.useState([]),ee=v.useMemo(()=>z.some(Y=>or(Y)==="integration"),[z]);v.useEffect(()=>{ee&&Ne.getCredentials(a.plugin,a.skill).then(Y=>q(Y.credentials)).catch(()=>q([]))},[a.plugin,a.skill,ee]);const X=v.useMemo(()=>new Set(P.filter(Y=>Y.status==="missing").map(Y=>Y.name)),[P]),[_,E]=v.useState(!1),O=v.useCallback(Y=>{E(!1),h(Y?{testType:Y}:void 0)},[h]);return!p||z.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:y?"var(--red-muted)":"var(--accent-muted)"},children:y?n.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),n.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}):n.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M9 11l3 3L22 4"}),n.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),n.jsx("div",{className:"text-center",children:y?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--red)"},children:"Invalid evals.json"}),n.jsx("div",{className:"text-[11px] font-mono px-3 py-2 rounded mt-1 max-w-sm text-left break-words",style:{color:"var(--text-secondary)",background:"var(--surface-2)"},children:y}),n.jsx("div",{className:"text-[12px] mt-2",style:{color:"var(--text-tertiary)"},children:"Fix the evals.json file and reload, or regenerate test cases with AI"})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No test cases yet"}),n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Create test cases to start evaluating your skill"})]})}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:()=>B(!0),disabled:x,className:"btn btn-primary text-[12px]",children:"Create Test Case"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsxs("div",{className:"flex",children:[n.jsx("button",{onClick:()=>O("unit"),disabled:N||x,className:"btn btn-secondary text-[12px]",style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:N?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}})," Generating..."]}):"Generate Unit Tests"}),n.jsx("button",{onClick:()=>E(!_),disabled:N||x,className:"btn btn-secondary text-[12px]",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid var(--border-default)",padding:"4px 6px"},children:n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),_&&n.jsx("div",{className:"absolute right-0 mt-1 rounded-lg py-1 z-50",style:{background:"var(--surface-1)",border:"1px solid var(--border-default)",minWidth:180,boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:n.jsx("button",{onClick:()=>O("integration"),className:"w-full text-left px-3 py-2 text-[12px] transition-colors duration-100",style:{color:"var(--text-secondary)",background:"transparent"},onMouseEnter:Y=>{Y.currentTarget.style.background="var(--surface-2)"},onMouseLeave:Y=>{Y.currentTarget.style.background="transparent"},children:"Generate Integration Tests"})})]})]}),N&&D.length>0&&n.jsx("div",{className:"w-full max-w-md mt-3",children:n.jsx(Ls,{entries:D,isRunning:!0})}),T&&n.jsx("div",{className:"w-full max-w-md mt-3",children:n.jsx(zs,{error:T,onRetry:()=>O()})}),M&&n.jsx(Px,{evals:C,onSave:Y=>{i(Y),B(!1)},onCancel:()=>B(!1)})]}):n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"280px 1fr",height:"100%",overflow:"hidden"},children:[n.jsxs("div",{className:"overflow-auto",style:{borderRight:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Test Cases (",R.length,")"]}),n.jsx("div",{className:"flex items-center gap-1.5",children:k?n.jsx("button",{onClick:f,className:"btn text-[10px] px-2 py-0.5",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:"Cancel All"}):n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>u("benchmark"),disabled:R.length===0||x,className:"btn btn-primary text-[10px] px-2 py-0.5",children:"Run All"}),n.jsx("button",{onClick:()=>u("comparison"),disabled:R.length===0||x,className:"btn btn-purple text-[10px] px-2 py-0.5",children:"Compare All"})]})})]}),n.jsx("div",{className:"flex px-3 py-1.5 gap-1",style:{borderBottom:"1px solid var(--border-subtle)"},children:["all","unit","integration"].map(Y=>n.jsx("button",{onClick:()=>A(Y),style:{padding:"2px 8px",fontSize:10,fontWeight:V===Y?600:400,background:V===Y?"var(--accent-muted)":"transparent",color:V===Y?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:Y==="all"?`All (${z.length})`:Y==="unit"?`Unit (${z.filter(me=>or(me)==="unit").length})`:`Integration (${z.filter(me=>or(me)==="integration").length})`},Y))}),n.jsxs("div",{className:"py-1",children:[R.length===0&&z.length>0&&n.jsxs("div",{className:"flex items-center justify-center py-8 px-3 text-[12px]",style:{color:"var(--text-tertiary)"},children:["No ",V==="all"?"":V+" ","tests yet"]}),R.map(Y=>{var ie;const me=j.get(Y.id),L=g===Y.id,F=or(Y);return n.jsxs("button",{onClick:()=>r({type:"SELECT_CASE",caseId:Y.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:L?"var(--accent-muted)":"transparent",borderLeft:L?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:de=>{L||(de.currentTarget.style.background="var(--surface-2)")},onMouseLeave:de=>{L||(de.currentTarget.style.background="transparent")},children:[n.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[n.jsxs("span",{className:"text-[12px] font-medium truncate flex items-center gap-1.5",style:{color:L?"var(--text-primary)":"var(--text-secondary)"},children:["#",Y.id," ",Y.name,n.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:9999,background:F==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:F==="unit"?"var(--accent)":"var(--orange)",whiteSpace:"nowrap"},children:F==="unit"?"U":"I"}),F==="integration"&&((ie=Y.requiredCredentials)==null?void 0:ie.some(de=>X.has(de)))&&n.jsx("span",{title:"Configure credentials to run",children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})})]}),n.jsx(rg,{result:me})]}),n.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[Y.assertions.length," assertion",Y.assertions.length!==1?"s":"",(me==null?void 0:me.passRate)!=null&&n.jsx(TS,{passRate:me.passRate})]})]},Y.id)})]}),n.jsx("div",{className:"px-3 py-2",children:!x&&n.jsx("button",{onClick:()=>B(!0),className:"w-full py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{border:"1px dashed var(--border-default)",color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:Y=>{Y.currentTarget.style.borderColor="var(--accent)",Y.currentTarget.style.color="var(--accent)"},onMouseLeave:Y=>{Y.currentTarget.style.borderColor="var(--border-default)",Y.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})}),n.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:n.jsx(SS,{})})]}),n.jsx("div",{className:"overflow-auto",children:I?n.jsx(NS,{evalCase:I,result:j.get(I.id),evals:p,caseStatus:((te=S.get(I.id))==null?void 0:te.status)??"idle",onSaveEvals:i,onRun:Y=>o(Y,"benchmark"),onCompare:Y=>o(Y,"comparison"),onCancel:Y=>m(Y),onImprove:Y=>r({type:"OPEN_IMPROVE",evalId:Y})}):n.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"Select a test case"})}),M&&n.jsx(Px,{evals:C,onSave:Y=>{i(Y),B(!1)},onCancel:()=>B(!1)})]})}function NS({evalCase:a,result:r,evals:i,caseStatus:o,onSaveEvals:u,onRun:m,onCompare:f,onCancel:h,onImprove:x}){const{state:p,isReadOnly:y}=kn(),{plugin:g,skill:j}=p,{entries:S,loading:N}=kS(g,j,a.id),[D,T]=v.useState(!1),[k,M]=v.useState(a.prompt),[B,V]=v.useState(!1),[A,U]=v.useState(a.expected_output);v.useState(()=>{M(a.prompt),U(a.expected_output)});const C=v.useCallback(Y=>{u({...i,evals:i.evals.map(me=>me.id===Y.id?Y:me)})},[i,u]),z=v.useCallback(()=>{C({...a,prompt:k}),T(!1)},[a,k,C]),R=v.useCallback(()=>{C({...a,expected_output:A}),V(!1)},[a,A,C]),I=v.useCallback(()=>{C({...a,assertions:[...a.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[a,C]),P=v.useCallback((Y,me)=>{C({...a,assertions:a.assertions.map(L=>L.id===Y?{...L,text:me}:L)})},[a,C]),q=v.useCallback(Y=>{C({...a,assertions:a.assertions.filter(me=>me.id!==Y)})},[a,C]),ee=v.useCallback(()=>{confirm("Delete this test case?")&&u({...i,evals:i.evals.filter(Y=>Y.id!==a.id)})},[i,a.id,u]),X=r&&r.assertions.length>0&&r.assertions.every(Y=>Y.pass),_=r&&r.assertions.some(Y=>!Y.pass),E=or(a),O=a.requiredCredentials??[],te=E==="integration"&&O.length>0;return n.jsxs("div",{className:"p-5 animate-fade-in",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("span",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["#",a.id," ",a.name]}),y?n.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:E==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:E==="unit"?"var(--accent)":"var(--orange)"},children:E==="unit"?"Unit":"Integration"}):n.jsx("button",{onClick:()=>{if((E==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:me,requirements:L,cleanup:F,...ie}=a;C({...ie,testType:"unit"})}else C({...a,testType:"integration"})},title:`Click to switch to ${E==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:E==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:E==="unit"?"var(--accent)":"var(--orange)",border:"none",cursor:"pointer"},children:E==="unit"?"Unit":"Integration"}),n.jsx(rg,{result:r})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[o==="running"||o==="queued"?n.jsxs("button",{onClick:()=>h(a.id),className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:n.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel"]}):n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>m(a.id),disabled:y,className:"btn btn-primary text-[12px]",children:"Run"}),n.jsx("button",{onClick:()=>f(a.id),disabled:y,className:"btn btn-purple text-[12px]",children:"A/B Compare"})]}),_&&!y&&o!=="running"&&o!=="queued"&&n.jsx("button",{onClick:()=>x(a.id),className:"btn btn-secondary text-[12px]",children:"Fix with AI"}),!y&&o!=="running"&&o!=="queued"&&n.jsx("button",{onClick:ee,className:"btn btn-ghost text-[12px]",style:{color:"var(--red)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("polyline",{points:"3 6 5 6 21 6"}),n.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})]}),y&&E==="integration"&&n.jsxs("div",{"data-testid":"platform-integration-note",className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--accent-muted)",border:"1px solid var(--accent-muted)"},children:[n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),n.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),n.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--accent)"},children:"Run locally in vSkill Studio"})]}),X&&n.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--green-muted)",border:"1px solid var(--green-muted)"},children:[n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",children:[n.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),n.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--green)"},children:"All assertions passing"})]}),te&&n.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--orange)"},children:"Required Credentials"})]}),n.jsx("div",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:"This integration test requires the following environment variables:"}),n.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:O.map(Y=>n.jsx("span",{style:{fontSize:10,fontFamily:"var(--font-mono, monospace)",padding:"2px 6px",borderRadius:4,background:"var(--orange-muted)",color:"var(--orange)"},children:Y},Y))})]}),!y&&E==="integration"&&n.jsx(MS,{evalCase:a,onUpdate:C}),n.jsx(Qi,{title:"Prompt",children:D?n.jsxs("div",{children:[n.jsx("textarea",{value:k,onChange:Y=>M(Y.target.value),className:"input-field w-full",rows:4,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),n.jsxs("div",{className:"flex gap-2 mt-2",children:[n.jsx("button",{onClick:z,className:"btn btn-primary text-[12px]",children:"Save"}),n.jsx("button",{onClick:()=>{M(a.prompt),T(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):n.jsx("div",{className:"p-3 rounded-lg text-[12px] transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-secondary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)",maxHeight:200,overflowY:"auto",cursor:y?"default":"pointer"},onClick:()=>{y||T(!0)},onMouseEnter:Y=>{y||(Y.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:Y=>{Y.currentTarget.style.borderColor="var(--border-subtle)"},children:a.prompt||n.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:y?"No prompt":"Click to edit prompt..."})})}),n.jsx(Qi,{title:"Expected Output",children:B?n.jsxs("div",{children:[n.jsx("textarea",{value:A,onChange:Y=>U(Y.target.value),className:"input-field w-full",rows:3,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),n.jsxs("div",{className:"flex gap-2 mt-2",children:[n.jsx("button",{onClick:R,className:"btn btn-primary text-[12px]",children:"Save"}),n.jsx("button",{onClick:()=>{U(a.expected_output),V(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):n.jsx("div",{className:"p-3 rounded-lg text-[12px] transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)",maxHeight:200,overflowY:"auto",cursor:y?"default":"pointer"},onClick:()=>{y||V(!0)},onMouseEnter:Y=>{y||(Y.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:Y=>{Y.currentTarget.style.borderColor="var(--border-subtle)"},children:a.expected_output||n.jsx("span",{style:{fontStyle:"italic"},children:y?"No expected output":"Click to edit expected output..."})})}),n.jsx(Qi,{title:`Assertions (${a.assertions.length})`,action:y?void 0:n.jsx("button",{onClick:I,className:"btn btn-ghost text-[11px]",children:"+ Add"}),children:a.assertions.length===0?n.jsx("div",{className:"text-[12px] text-center py-4",style:{color:"var(--text-tertiary)"},children:'No assertions. Click "+ Add" to create one.'}):n.jsx("div",{className:"space-y-2",children:a.assertions.map(Y=>{const me=r==null?void 0:r.assertions.find(F=>F.assertion_id===Y.id),L=wS(Y.id,me,S);return n.jsx(ES,{assertion:Y,result:me,badges:L,isReadOnly:y,onUpdate:F=>P(Y.id,F),onDelete:()=>q(Y.id)},Y.id)})})}),(r==null?void 0:r.output)&&n.jsx(RS,{output:r.output,durationMs:r.durationMs,tokens:r.tokens}),r&&r.passRate!=null&&r.passRate<.2&&(()=>{const Y=ag("INEFFECTIVE",r.passRate);return Y.recommendations&&Y.recommendations.length>0?n.jsx(Qi,{title:"Recommendations",children:n.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),n.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--orange)"},children:"This eval is significantly below expectations"})]}),n.jsx("ul",{className:"space-y-1.5 ml-1",children:Y.recommendations.map((me,L)=>n.jsxs("li",{className:"flex items-start gap-2 text-[12px]",style:{color:"var(--text-secondary)"},children:[n.jsx("span",{style:{color:"var(--orange)",fontWeight:600,flexShrink:0},children:"•"}),me]},L))})]})}):null})(),n.jsx(AS,{evalId:a.id,sharedEntries:S,sharedLoading:N})]},a.id)}function ES({assertion:a,result:r,badges:i,isReadOnly:o,onUpdate:u,onDelete:m}){const[f,h]=v.useState(!1),[x,p]=v.useState(a.text),[y,g]=v.useState(!1),j=()=>{u(x),h(!1)};return n.jsx("div",{className:"rounded-lg px-3 py-2.5 transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:n.jsxs("div",{className:"flex items-start gap-2",children:[r?n.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",background:r.pass?"var(--green-muted)":"var(--red-muted)"},children:r.pass?n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):n.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,border:"1.5px dashed var(--text-tertiary)",background:"transparent"},title:"Not run yet"}),(i==null?void 0:i.regression)&&n.jsx("span",{className:"mt-0.5 flex-shrink-0",title:"Regression: was passing, now failing",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:16,height:18,color:"var(--red)",fontSize:14,fontWeight:700,lineHeight:1},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("polyline",{points:"19 12 12 19 5 12"})]})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[n.jsx("span",{className:"text-[10px] font-mono font-semibold",style:{color:"var(--text-tertiary)"},children:a.id}),(i==null?void 0:i.flaky)&&n.jsx("span",{title:"Flaky: 30-70% pass rate across recent runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"var(--yellow-muted)",color:"var(--yellow)",whiteSpace:"nowrap"},children:"Flaky"}),(i==null?void 0:i.nonDiscriminating)&&n.jsx("span",{title:"Non-discriminating: passes on both skill and baseline runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"var(--surface-3)",color:"var(--text-tertiary)",whiteSpace:"nowrap"},children:"Non-Discrim."})]}),f?n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{value:x,onChange:S=>p(S.target.value),onKeyDown:S=>{S.key==="Enter"&&j(),S.key==="Escape"&&h(!1)},className:"input-field flex-1 text-[12px]",autoFocus:!0}),n.jsx("button",{onClick:j,className:"btn btn-primary text-[11px]",children:"Save"})]}):n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-secondary)",cursor:o?"default":"pointer"},onClick:()=>{o||(p(a.text),h(!0))},children:a.text}),(r==null?void 0:r.reasoning)&&n.jsx("button",{onClick:()=>g(!y),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:y?"Hide reasoning":"Show reasoning"}),y&&(r==null?void 0:r.reasoning)&&n.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:r.reasoning})]}),!o&&n.jsx("button",{onClick:m,className:"btn btn-ghost p-1 opacity-0 group-hover:opacity-100",style:{color:"var(--text-tertiary)"},onMouseEnter:S=>{S.currentTarget.style.color="var(--red)",S.currentTarget.style.opacity="1"},onMouseLeave:S=>{S.currentTarget.style.color="var(--text-tertiary)",S.currentTarget.style.opacity=""},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})}function Qi({title:a,action:r,children:i}){return n.jsxs("div",{className:"mb-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:a}),r]}),i]})}function rg({result:a}){const[r,i]=v.useState(!1);if(!a||a.status==null)return n.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"--"});const o=a.status==="pass",u=a.passRate??0,f=ag(o?"PASS":"FAIL",u);return n.jsxs("span",{className:"pill text-[10px]",style:{background:o?"var(--green-muted)":"var(--red-muted)",color:o?"var(--green)":"var(--red)",position:"relative",cursor:"default"},onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),"aria-describedby":r?"verdict-tooltip":void 0,children:[a.passRate!=null?`${Math.round(a.passRate*100)}%`:a.status,r&&n.jsx("div",{id:"verdict-tooltip",role:"tooltip",style:{position:"absolute",bottom:"calc(100% + 6px)",right:0,padding:"6px 10px",background:"var(--surface-4)",border:"1px solid var(--border-subtle)",borderRadius:6,fontSize:11,color:"var(--text-secondary)",whiteSpace:"nowrap",zIndex:50,maxWidth:300,width:"max-content",boxShadow:"0 4px 12px rgba(0,0,0,0.15)"},children:f.explanation})]})}function TS({passRate:a}){const r=Math.round(a*100);return n.jsx("div",{className:"flex items-center gap-1",children:n.jsx("div",{className:"rounded-full overflow-hidden",style:{width:32,height:4,background:"var(--surface-4)"},children:n.jsx("div",{className:"h-full rounded-full",style:{width:`${r}%`,background:r>=80?"var(--green)":r>=50?"var(--yellow)":"var(--red)"}})})})}function RS({output:a,durationMs:r,tokens:i}){const[o,u]=v.useState(!1);return n.jsxs("div",{className:"mb-5",children:[n.jsxs("button",{onClick:()=>u(!o),className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:o?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),"LLM Output",r!=null&&n.jsxs("span",{style:{fontWeight:400},children:["(",(r/1e3).toFixed(1),"s)"]}),i!=null&&n.jsxs("span",{style:{fontWeight:400},children:["(",i," tokens)"]})]}),o&&n.jsx("pre",{className:"text-[12px] p-4 rounded-lg overflow-auto animate-fade-in",style:{background:"var(--surface-1)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:400,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:a})]})}function Ku(a){return a==="baseline"?"right":a==="comparison"?"full":"left"}function Qu({entry:a}){return n.jsxs("div",{className:"rounded-lg px-3 py-2.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:eg(a.timestamp)}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:a.model}),n.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:a.type==="benchmark"?"var(--accent-muted)":a.type==="comparison"?"var(--purple-muted)":"var(--orange-muted)",color:a.type==="benchmark"?"var(--accent)":a.type==="comparison"?"var(--purple)":"var(--orange)"},children:a.type}),n.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:mr(a.pass_rate)},children:[Math.round(a.pass_rate*100),"%"]})]}),n.jsxs("div",{className:"flex items-center gap-4 mb-1.5 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[a.durationMs!=null&&n.jsx("span",{children:tg(a.durationMs)}),a.tokens!=null&&n.jsxs("span",{children:[a.tokens>=1e3?`${(a.tokens/1e3).toFixed(1)}k`:a.tokens," tok"]})]}),a.type==="comparison"&&a.baselinePassRate!=null&&(()=>{const r=a.pass_rate-a.baselinePassRate,i=r>.001?"skill":r<-.001?"baseline":"tie",o=r>0?"+":"",u=i==="skill"?"var(--green)":i==="baseline"?"var(--red)":"var(--text-tertiary)";return n.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"vs baseline:"}),n.jsxs("span",{className:"text-[11px] font-semibold",style:{color:r>=0?"var(--green)":"var(--red)"},children:[o,(r*100).toFixed(1),"%"]}),n.jsx("span",{className:"pill text-[9px]",style:{padding:"1px 5px",background:"var(--surface-3)",color:u},children:i})]})})(),n.jsx("div",{className:"space-y-0.5",children:a.assertions.map(r=>n.jsxs("div",{className:"flex items-start gap-1.5",children:[n.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:14,height:14,display:"flex",alignItems:"center",justifyContent:"center",background:r.pass?"var(--green-muted)":"var(--red-muted)"},children:r.pass?n.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:r.text})]},r.id))})]})}function AS({evalId:a,sharedEntries:r,sharedLoading:i}){const{state:o,dispatch:u}=kn(),{plugin:m,skill:f}=o,[h,x]=v.useState(!0),p=r??null,y=i??!1,g=v.useCallback(()=>{x(D=>!D)},[]),j=p?p.slice(0,10):[],S=j.some(D=>{const T=Ku(D.type);return T==="left"||T==="full"}),N=j.some(D=>{const T=Ku(D.type);return T==="right"||T==="full"});return n.jsxs("div",{className:"mb-5",children:[n.jsxs("button",{onClick:g,className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:h?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Execution History",p&&p.length>0&&n.jsxs("span",{style:{fontWeight:400},children:["(",p.length," run",p.length!==1?"s":"",")"]})]}),h&&n.jsx("div",{className:"animate-fade-in",children:y?n.jsxs("div",{className:"flex items-center gap-2 py-3",children:[n.jsx("div",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),n.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):!p||p.length===0?n.jsx("div",{className:"text-[12px] py-3",style:{color:"var(--text-tertiary)"},children:"No history for this case"}):n.jsxs("div",{children:[j.length>=2&&n.jsx("div",{className:"mb-2",children:n.jsx(ng,{entries:j})}),n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"1"},children:"Skill"}),n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"2"},children:"Baseline"}),!S&&n.jsx("div",{style:{gridColumn:"1",fontSize:12,color:"var(--text-tertiary)"},children:"No skill runs"}),!N&&n.jsx("div",{style:{gridColumn:"2",fontSize:12,color:"var(--text-tertiary)"},children:"No baseline runs"}),j.map((D,T)=>{const k=Ku(D.type);return k==="full"?n.jsx("div",{style:{gridColumn:"1 / -1"},children:n.jsx(Qu,{entry:D})},T):k==="left"?n.jsxs(v.Fragment,{children:[n.jsx("div",{style:{gridColumn:"1"},children:n.jsx(Qu,{entry:D})}),n.jsx("div",{style:{gridColumn:"2"}})]},T):n.jsxs(v.Fragment,{children:[n.jsx("div",{style:{gridColumn:"1"}}),n.jsx("div",{style:{gridColumn:"2"},children:n.jsx(Qu,{entry:D})})]},T)})]}),n.jsx("button",{onClick:()=>u({type:"SET_PANEL",panel:"history"}),className:"mt-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--accent)"},onMouseEnter:D=>{D.currentTarget.style.textDecoration="underline"},onMouseLeave:D=>{D.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function Px({evals:a,onSave:r,onCancel:i}){const[o,u]=v.useState(""),[m,f]=v.useState(""),[h,x]=v.useState(""),[p,y]=v.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[g,j]=v.useState("unit"),[S,N]=v.useState(""),[D,T]=v.useState([]),[k,M]=v.useState(""),[B,V]=v.useState(""),A=Math.max(0,...a.evals.map(R=>R.id))+1,U=R=>{j(R),R==="unit"&&(T([]),N(""),M(""),V(""))},C=()=>{const R=S.trim().toUpperCase();R&&!D.includes(R)&&T([...D,R]),N("")},z=()=>{if(!o.trim()||!m.trim())return;const R={id:A,name:o.trim(),prompt:m.trim(),expected_output:h.trim(),files:[],assertions:p.filter(I=>I.text.trim()),...g==="integration"?{testType:"integration",...D.length>0?{requiredCredentials:D}:{},...k||B?{requirements:{...k?{platform:k}:{},...B?{chromeProfile:B}:{}}}:{}}:{}};r({...a,evals:[...a.evals,R]})};return n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center animate-overlay-in",style:{background:"rgba(0,0,0,0.6)"},children:n.jsxs("div",{className:"w-full max-w-lg rounded-xl p-6 animate-modal-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",maxHeight:"85vh",overflowY:"auto"},children:[n.jsx("div",{className:"text-[15px] font-semibold mb-4",style:{color:"var(--text-primary)"},children:"New Test Case"}),n.jsxs("div",{className:"mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1.5 block",style:{color:"var(--text-tertiary)"},children:"Type"}),n.jsx("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)",display:"inline-flex"},children:["unit","integration"].map(R=>n.jsx("button",{onClick:()=>U(R),className:"px-3 py-1 rounded-md text-[12px] font-medium transition-all duration-150",style:{background:g===R?R==="unit"?"var(--accent-muted)":"var(--orange-muted)":"transparent",color:g===R?R==="unit"?"var(--accent)":"var(--orange)":"var(--text-tertiary)",border:"none",cursor:"pointer",textTransform:"capitalize"},children:R},R))})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Name"}),n.jsx("input",{value:o,onChange:R=>u(R.target.value),className:"input-field",placeholder:"e.g., auth-check",autoFocus:!0})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Prompt"}),n.jsx("textarea",{value:m,onChange:R=>f(R.target.value),className:"input-field",rows:3,placeholder:"User prompt to test..."})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Expected Output"}),n.jsx("textarea",{value:h,onChange:R=>x(R.target.value),className:"input-field",rows:2,placeholder:"Description of expected behavior..."})]}),n.jsxs("div",{className:"mb-4",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Assertions"}),p.map((R,I)=>n.jsxs("div",{className:"flex gap-2 mb-2",children:[n.jsx("input",{value:R.text,onChange:P=>y(p.map((q,ee)=>ee===I?{...q,text:P.target.value}:q)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),p.length>1&&n.jsx("button",{onClick:()=>y(p.filter((P,q)=>q!==I)),className:"btn btn-ghost p-1",style:{color:"var(--text-tertiary)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},R.id)),n.jsx("button",{onClick:()=>y([...p,{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--accent)"},children:"+ Add Assertion"})]}),g==="integration"&&n.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},children:"Integration Settings"}),n.jsxs("div",{className:"mb-3",children:[n.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),n.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:D.map(R=>n.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"var(--orange-muted)",color:"var(--orange)"},children:[R,n.jsx("button",{onClick:()=>T(D.filter(I=>I!==R)),style:{color:"var(--orange)",lineHeight:1},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},R))}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("input",{value:S,onChange:R=>N(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),C())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., SLACK_BOT_TOKEN"}),n.jsx("button",{onClick:C,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),n.jsx("input",{value:k,onChange:R=>M(R.target.value),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),n.jsxs("label",{className:"block",children:[n.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),n.jsx("input",{value:B,onChange:R=>V(R.target.value),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{onClick:i,className:"btn btn-secondary text-[12px]",children:"Cancel"}),n.jsx("button",{onClick:z,disabled:!o.trim()||!m.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function MS({evalCase:a,onUpdate:r}){var f,h;const[i,o]=v.useState(""),u=()=>{const x=i.trim().toUpperCase();x&&!(a.requiredCredentials??[]).includes(x)&&r({...a,requiredCredentials:[...a.requiredCredentials??[],x]}),o("")},m=x=>{const p=(a.requiredCredentials??[]).filter(y=>y!==x);r({...a,requiredCredentials:p.length>0?p:void 0})};return n.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},children:"Integration Settings"}),n.jsxs("div",{className:"mb-2.5",children:[n.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),n.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:(a.requiredCredentials??[]).map(x=>n.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"var(--orange-muted)",color:"var(--orange)"},children:[x,n.jsx("button",{onClick:()=>m(x),style:{color:"var(--orange)",lineHeight:1},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},x))}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("input",{value:i,onChange:x=>o(x.target.value),onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),u())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., GITHUB_TOKEN"}),n.jsx("button",{onClick:u,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),n.jsxs("div",{className:"mb-2.5",children:[n.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),n.jsx("input",{value:((f=a.requirements)==null?void 0:f.platform)??"",onChange:x=>r({...a,requirements:{...a.requirements,platform:x.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),n.jsx("input",{value:((h=a.requirements)==null?void 0:h.chromeProfile)??"",onChange:x=>r({...a,requirements:{...a.requirements,chromeProfile:x.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]})}function Sn(a,r){return r==="free"?"Free":r==="subscription"&&a==null?"Subscription":a==null?"N/A":a>=1?`$${a.toFixed(2)}`:a===0?"$0.00":a>=.001?`$${a.toFixed(4)}`:`$${a.toPrecision(3).replace(/0+$/,"").replace(/\.$/,"")}`}function sg(a,r){return a==null||r==null?"N/A":`${a.toLocaleString("en-US")} in / ${r.toLocaleString("en-US")} out`}function DS(a){return a==="baseline"?"Baseline Pass Rate":"Skill Pass Rate"}function zS(a,r){let i="";if(r){const u=new Date(r);isNaN(u.getTime())||(i=u.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}))}return[a,i].filter(Boolean).join(" · ")}function LS(a,r,i){const o=i===1?"test case":"test cases";if(a===0)return`Your skill performs the same as the baseline across ${i} ${o}`;const u=Math.round(Math.abs(a)*r);if(u===0)return`Your skill performs the same as the baseline across ${i} ${o}`;const m=a>0?"more":"fewer";return`Your skill passes ${u} ${m} assertions across ${i} ${o}`}function qx(a,r){const i=o=>{const u=o/5*100;return isFinite(u)?Math.round(Math.min(100,Math.max(0,u))):0};return{skill:i(a),baseline:i(r)}}function _S(a){return a==="skill"?{text:"Skill wins",isSkill:!0}:a==="baseline"?{text:"Baseline wins",isSkill:!1}:{text:"Tie",isSkill:!1}}function OS(a,r){const i=a+r,o=i*10,u=i*25,m=f=>f>=60?`${Math.round(f/60)}m`:`${f}s`;return`${m(o)}–${m(u)}`}const BS={anthropic:.01,openrouter:.01,ollama:0,"lm-studio":0,"claude-cli":0,"codex-cli":0,"gemini-cli":0};function IS(a,r){if(!a)return null;const i=BS[a];if(i==null||i===0)return null;const o=i*r*.5,u=i*r*2;return`${Sn(o)}–${Sn(u)}`}function HS(){const{state:a,runCase:r,runAll:i,cancelCase:o,cancelAll:u,isReadOnly:m}=kn(),{evals:f,caseRunStates:h,bulkRunActive:x,latestBenchmark:p,inlineResults:y}=a,{config:g}=bl(),j=(f==null?void 0:f.evals)??[],S=v.useMemo(()=>{for(const C of h.values())if(C.status==="running"||C.status==="queued")return!0;return!1},[h]),N=j.filter(C=>{const z=h.get(C.id);return z&&(z.status==="complete"||z.status==="error"||z.status==="cancelled")}).length,D=j.filter(C=>{const z=h.get(C.id);return z&&(z.status==="running"||z.status==="queued")}).length,T=v.useRef(null),[k,M]=v.useState(0);v.useEffect(()=>{if(S&&!T.current&&(T.current=Date.now()),!S){T.current=null,M(0);return}const C=setInterval(()=>{T.current&&M(Math.round((Date.now()-T.current)/1e3))},1e3);return()=>clearInterval(C)},[S]);const B=j.reduce((C,z)=>C+z.assertions.length,0),V=j.length+B,A=v.useMemo(()=>OS(j.length,B),[j.length,B]),U=v.useMemo(()=>IS((g==null?void 0:g.provider)??null,V),[g==null?void 0:g.provider,V]);return n.jsxs("div",{className:"p-5",children:[m&&n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-4 text-[11px]",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Installed skill — benchmarking is disabled. Edit the source skill to run benchmarks."]}),n.jsxs("div",{className:"rounded-xl p-4 mb-5",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Benchmark"}),S&&n.jsxs("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:[D," running"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[S&&n.jsxs("button",{onClick:u,className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:n.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel All"]}),n.jsx("button",{onClick:()=>i("comparison"),disabled:j.length===0||S||m,className:"btn btn-primary text-[12px]",title:"Runs both your skill and the baseline, then compares results side by side",children:"Run A/B Test"}),n.jsx("button",{onClick:()=>i("benchmark"),disabled:j.length===0||S||m,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using your skill only",children:"Test Skill"}),n.jsx("button",{onClick:()=>i("baseline"),disabled:j.length===0||S||m,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using the baseline (no skill) for reference",children:"Test Baseline"})]}),!S&&j.length>0&&n.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[10px]",style:{color:"var(--text-tertiary)"},children:[n.jsxs("span",{children:["Est. duration: ",A]}),U&&n.jsxs("span",{children:["Est. cost: ",U]}),!U&&(g==null?void 0:g.provider)&&(g.provider==="claude-cli"||g.provider==="codex-cli")&&n.jsx("span",{children:"Cost: Subscription"}),!U&&(g==null?void 0:g.provider)&&(g.provider==="ollama"||g.provider==="lm-studio"||g.provider==="gemini-cli")&&n.jsx("span",{children:"Cost: Free"})]})]}),S&&j.length>0&&n.jsxs("div",{className:"mb-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("span",{className:"text-[12px] font-medium",style:{color:"var(--text-secondary)"},children:["Progress: ",N,"/",j.length," cases"]}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(N/j.length*100),"%"]})]}),n.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:n.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${N/j.length*100}%`,background:"var(--accent)"}})}),n.jsxs("div",{className:"flex items-center justify-between mt-1.5",children:[n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Elapsed: ",k>=60?`${Math.floor(k/60)}m ${k%60}s`:`${k}s`]}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Est. total: ",A]})]})]}),n.jsx("div",{className:"space-y-3 stagger-children",children:j.map(C=>{const z=y.get(C.id),R=h.get(C.id),I=(R==null?void 0:R.status)??"idle",P=p==null?void 0:p.cases.find(q=>q.eval_id===C.id);return n.jsx(VS,{name:C.name,evalId:C.id,result:z,caseCost:P==null?void 0:P.cost,caseBillingMode:P==null?void 0:P.billingMode,caseInputTokens:P==null?void 0:P.inputTokens,caseOutputTokens:P==null?void 0:P.outputTokens,caseStatus:I,runMode:(R==null?void 0:R.mode)??null,comparisonDetail:P==null?void 0:P.comparisonDetail,isReadOnly:m,onRun:q=>r(q,"benchmark"),onBaseline:q=>r(q,"baseline"),onCompare:q=>r(q,"comparison"),onCancel:q=>o(q)},C.id)})}),!S&&p&&p.cases.length>0&&n.jsxs("div",{className:"mt-5",children:[n.jsxs("div",{className:"rounded-xl p-4 mb-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:DS(p.type)}),n.jsx("span",{className:"text-[20px] font-bold",style:{color:(p.overall_pass_rate??0)>=.8?"var(--green)":(p.overall_pass_rate??0)>=.5?"var(--yellow)":"var(--red)"},children:p.overall_pass_rate!=null?`${Math.round(p.overall_pass_rate*100)}%`:"--"})]}),p.totalDurationMs!=null&&n.jsxs("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:["Total: ",(p.totalDurationMs/1e3).toFixed(1),"s",p.model&&` | Model: ${p.model}`,p.totalInputTokens!=null&&p.totalOutputTokens!=null&&` | Tokens: ${sg(p.totalInputTokens,p.totalOutputTokens)}`,p.totalCost!=null&&` | Cost: ${Sn(p.totalCost)}`]}),p.overall_pass_rate>=.9999&&!p.comparison&&n.jsx("button",{onClick:()=>i("comparison"),disabled:j.length===0||m,className:"text-[13px] font-semibold mt-3 w-full rounded-lg transition-opacity duration-150",style:{padding:"10px 0",background:"var(--green)",color:"var(--color-paper)",border:"none",cursor:"pointer",opacity:j.length===0?.5:1},children:"Run Final A/B Comparison"})]}),p.comparison&&n.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Skill vs Baseline"}),(()=>{const C=zS(p.model,p.timestamp);return C?n.jsx("div",{className:"text-[10px] mt-0.5 mb-3",style:{color:"var(--text-tertiary)"},children:C}):n.jsx("div",{className:"mb-3"})})(),n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsx(Yx,{label:"Skill",value:p.comparison.skillPassRate,color:"var(--accent)"}),n.jsx(Yx,{label:"Baseline",value:p.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),n.jsxs("div",{className:"mt-3 text-[12px] font-medium",style:{color:p.comparison.delta>0?"var(--green)":p.comparison.delta<0?"var(--red)":"var(--text-tertiary)"},children:["Delta: ",p.comparison.delta>0?"+":"",(p.comparison.delta*100).toFixed(1),"%",p.verdict&&` | ${jS(p.verdict)}`]}),(()=>{const C=p.cases.reduce((R,I)=>R+I.assertions.length,0),z=LS(p.comparison.delta,C,p.cases.length);return n.jsx("div",{className:"mt-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:z})})()]})]})]})}const US={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 VS({name:a,evalId:r,result:i,caseCost:o,caseBillingMode:u,caseInputTokens:m,caseOutputTokens:f,caseStatus:h,runMode:x,comparisonDetail:p,isReadOnly:y,onRun:g,onBaseline:j,onCompare:S,onCancel:N}){const[D,T]=v.useState(!1),k=h==="running"||h==="queued",M=h==="complete"||h==="error";return n.jsxs("div",{className:"rounded-xl overflow-hidden transition-all duration-200",style:{background:"var(--surface-1)",border:k?"1px solid var(--accent)":"1px solid var(--border-subtle)",boxShadow:k?"0 0 12px rgba(99, 131, 255, 0.15)":"none"},children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[h==="running"&&n.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),h==="queued"&&n.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--text-tertiary)"},children:"queued"}),n.jsxs("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:["#",r," ",a]}),x&&(k||M)&&(()=>{const B=US[x];return B?n.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:B.bg,color:B.color,padding:"1px 6px"},children:B.label}):null})()]}),n.jsxs("div",{className:"flex items-center gap-2",children:[k?n.jsx("button",{onClick:()=>N(r),className:"btn text-[10px] px-2 py-1",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:"Cancel"}):n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>S(r),disabled:y,className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),n.jsx("button",{onClick:()=>g(r),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),n.jsx("button",{onClick:()=>j(r),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Base"})]}),i&&i.status!=null&&n.jsx("span",{className:"pill text-[10px]",style:{background:i.status==="pass"?"var(--green-muted)":"var(--red-muted)",color:i.status==="pass"?"var(--green)":"var(--red)"},children:i.passRate!=null?`${Math.round(i.passRate*100)}%`:i.status}),m!=null&&f!=null&&n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:sg(m,f)}),o!=null&&n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:Sn(o,u)}),h==="cancelled"&&n.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"cancelled"})]})]}),i&&i.assertions.length>0&&n.jsxs("div",{className:"px-4 pb-3",children:[n.jsx("div",{className:"space-y-1",children:i.assertions.map(B=>n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsx("span",{style:{color:B.pass?"var(--green)":"var(--red)"},children:B.pass?"PASS":"FAIL"}),n.jsx("span",{style:{color:"var(--text-secondary)"},children:B.text})]},B.assertion_id))}),i.output&&n.jsx("button",{onClick:()=>T(!D),className:"text-[11px] mt-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:D?"Hide output":"Show output"}),D&&i.output&&n.jsx("pre",{className:"text-[11px] mt-2 p-3 rounded-lg overflow-auto",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:200,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap"},children:i.output})]}),p&&n.jsx("div",{className:"px-4 pb-3",children:n.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:n.jsx("div",{className:"flex items-center gap-4 text-[11px] flex-wrap",children:(()=>{const B=qx(p.skillContentScore,p.baselineContentScore),V=qx(p.skillStructureScore,p.baselineStructureScore),A=_S(p.winner);return n.jsxs(n.Fragment,{children:[n.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Content: Skill ",B.skill,"% / Baseline ",B.baseline,"%"]}),n.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),n.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Structure: Skill ",V.skill,"% / Baseline ",V.baseline,"%"]}),n.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),n.jsx("span",{style:{color:A.isSkill?"var(--accent)":"var(--text-tertiary)",fontWeight:500},children:A.text})]})})()})})}),i&&i.errorMessage&&n.jsx($S,{errorMessage:i.errorMessage,classifiedError:i.classifiedError})]})}const Xu={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function $S({errorMessage:a,classifiedError:r}){const[i,o]=v.useState(!1),u=(r==null?void 0:r.title)??"Error",m=r==null?void 0:r.hint,f=r?Xu[r.category]??Xu.unknown:Xu.unknown;return n.jsx("div",{className:"px-4 pb-3",children:n.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:"var(--red-muted)",border:"1px solid var(--red-muted)"},children:[n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[n.jsx("span",{style:{fontSize:12},children:f}),n.jsx("span",{className:"text-[11.5px] font-semibold flex-1",style:{color:"var(--red)"},children:u}),n.jsx("button",{onClick:()=>o(!i),className:"text-[10px] px-1.5 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},children:i?"Hide details":"Details"})]}),m&&n.jsx("div",{className:"px-3 pb-2 text-[10.5px]",style:{color:"var(--text-secondary)"},children:m}),i&&n.jsx("pre",{className:"text-[10px] px-3 pb-2.5 overflow-auto",style:{color:"var(--text-tertiary)",maxHeight:120,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0},children:a})]})})}function Yx({label:a,value:r,color:i}){return n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-1",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:a}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:i},children:[Math.round(r*100),"%"]})]}),n.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:n.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${r*100}%`,background:i}})})]})}const Fx={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 GS(){const{state:a,dispatch:r,runActivationTest:i,cancelActivation:o,generateActivationPrompts:u}=kn(),{plugin:m,skill:f,activationPrompts:h,activationResults:x,activationSummary:p,activationRunning:y,activationError:g,activationStartedAt:j,activationClassifyingStatus:S,generatingPrompts:N,generatingPromptsError:D,activationHistory:T}=a,[k,M]=v.useState(h),[B,V]=v.useState(null),[A,U]=v.useState(!1);v.useEffect(()=>{h&&h!==k&&M(h)},[h]),v.useEffect(()=>{r({type:"SET_ACTIVATION_PROMPTS",prompts:k})},[k,r]),v.useEffect(()=>{fetch(`/api/skills/${m}/${f}/description`).then(_=>_.json()).then(_=>V(_.rawContent||_.description||null)).catch(()=>V(null))},[m,f]);function C(){i(k)}function z(){u(8)}const R=k.trim().split(`
70
+ `).filter(Boolean).length,I=x.filter(_=>_.classification==="TP"||_.classification==="TN"),P=x.filter(_=>_.classification==="FP"||_.classification==="FN"),q=(B==null?void 0:B.replace(/^---[\s\S]*?---\s*/,"").trim())??null,ee=k.trim().length>0,X=q?go(q):"";return n.jsxs("div",{className:"p-5 space-y-5",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Activation Test"}),n.jsx("div",{className:"text-[12px] mt-0.5",style:{color:"var(--text-tertiary)"},children:"Test whether this skill's description activates for relevant prompts and stays silent for irrelevant ones."})]}),n.jsxs("div",{className:"grid grid-cols-[3fr_2fr] gap-4 items-stretch",children:[n.jsxs("div",{className:"glass-card p-4 flex flex-col gap-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Test Prompts"}),n.jsx("div",{className:"flex gap-1.5",children:n.jsx("button",{onClick:z,disabled:N||!q||y,className:"text-[10px] px-2.5 py-1 rounded-md transition-colors duration-150 flex items-center gap-1.5",style:{background:N?"var(--surface-3)":"var(--surface-2)",color:q?"var(--accent)":"var(--text-tertiary)",border:"1px solid var(--border-subtle)",opacity:q?1:.5,cursor:q?"pointer":"not-allowed"},title:q?void 0:"No skill description available",onMouseEnter:_=>{q&&!N&&(_.currentTarget.style.background="var(--surface-3)")},onMouseLeave:_=>{N||(_.currentTarget.style.background="var(--surface-2)")},children:N?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"spinner",style:{borderTopColor:"var(--accent)",borderColor:"var(--border-subtle)",width:10,height:10}}),"Generating..."]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M12 3v3m6.36.64l-2.12 2.12M21 12h-3m-.64 6.36l-2.12-2.12M12 21v-3m-4.24.64l2.12-2.12M3 12h3m.64-6.36l2.12 2.12"})}),ee?"Regenerate":"Generate"," Test Prompts"]})})})]}),!q&&!y&&n.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},"aria-live":"polite",children:"Add a description to your skill's frontmatter to enable prompt generation."}),D&&n.jsx("div",{className:"text-[11px] px-2 py-1 rounded",style:{color:"var(--red)",background:"var(--red-muted)"},children:D}),n.jsx("textarea",{className:"input-field resize-y font-mono text-[12px]",style:{minHeight:140,height:140},value:k,onChange:_=>M(_.target.value),placeholder:`How do I write a unit test?
71
71
  What edge cases should I test?
72
72
  +Deploy this to production
73
73
  !What's the weather like today?
74
- !Write me a poem about flowers`}),n.jsxs("div",{className:"flex items-center flex-wrap gap-x-3 gap-y-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:[n.jsx("span",{children:"One prompt per line"}),n.jsx(Xi,{}),n.jsx("span",{children:"No prefix = auto-classify"}),n.jsx(Xi,{}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"+"}),"= must activate"]}),n.jsx(Xi,{}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"!"}),"= must NOT activate"]}),n.jsx(Xi,{}),n.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[A," prompt",A!==1?"s":""]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:w,disabled:y||!k.trim(),className:"btn btn-primary",children:y?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"spinner",style:{borderTopColor:"var(--color-paper)",borderColor:"var(--border-default)",width:14,height:14}}),"Testing..."]}):n.jsxs(n.Fragment,{children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("circle",{cx:"12",cy:"12",r:"6"}),n.jsx("circle",{cx:"12",cy:"12",r:"2"})]}),"Run Activation Test"]})}),y&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:o,className:"btn btn-secondary text-[12px]",children:"Cancel"}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[S||`${x.length} / ${A} prompts tested`,j&&n.jsx(FS,{startedAt:j})]})]})]})]}),n.jsxs("div",{className:"glass-card flex flex-col overflow-hidden",children:[n.jsx("div",{className:"px-4 pt-3.5 pb-2.5 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Skill Description"})}),n.jsx("div",{className:"flex-1 overflow-auto px-4 py-3",style:{minHeight:0},children:q?n.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:X}}):n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No description available"})})]})]}),g&&n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:g}),y&&x.length===0&&n.jsxs("div",{className:"text-center py-12 animate-fade-in",children:[n.jsx("div",{className:"spinner-lg mx-auto mb-4"}),n.jsx("p",{className:"text-[14px]",style:{color:"var(--text-secondary)"},children:"Testing activation against skill description..."})]}),x.length>0&&n.jsxs("div",{className:"space-y-5",children:[G.length>0&&n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),n.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--red)"},children:["Incorrect (",G.length,")"]}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"— These need attention"})]}),n.jsx("div",{className:"space-y-1.5 stagger-children",children:G.map((_,R)=>n.jsx(Fx,{result:_},`incorrect-${R}`))})]}),O.length>0&&n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("polyline",{points:"16 10 11 15 8 12"})]}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--green)"},children:["Correct (",O.length,")"]})]}),n.jsx("div",{className:"space-y-1.5 stagger-children",children:O.map((_,R)=>n.jsx(Fx,{result:_},`correct-${R}`))})]})]}),p&&n.jsxs("div",{className:"glass-card p-6 animate-fade-in-scale",style:{borderColor:"var(--border-active)",borderWidth:2},children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-2",style:{color:"var(--text-tertiary)"},children:"Summary"}),p.autoClassifiedCount!=null&&p.autoClassifiedCount>0&&n.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:[p.autoClassifiedCount," of ",p.total," prompts auto-classified from skill name and tags"]}),n.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[n.jsx(Zu,{label:"Precision",value:p.precision,description:"Of all activations, how many were correct?",detail:`${p.tp} true / ${p.tp+p.fp} total activations`}),n.jsx(Zu,{label:"Recall",value:p.recall,description:"Of expected activations, how many fired?",detail:`${p.tp} activated / ${p.tp+p.fn} expected`}),n.jsx(Zu,{label:"Reliability",value:p.reliability,description:"Overall correct classification rate",detail:`${p.tp+p.tn} correct / ${p.total} total`})]}),n.jsxs("div",{className:"pt-4",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-3 text-center",style:{color:"var(--text-tertiary)"},children:"Confusion Matrix"}),n.jsxs("div",{className:"grid grid-cols-2 gap-2 max-w-xs mx-auto",children:[n.jsx(Zi,{label:"True Positive",abbr:"TP",count:p.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),n.jsx(Zi,{label:"False Positive",abbr:"FP",count:p.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),n.jsx(Zi,{label:"False Negative",abbr:"FN",count:p.fn,bg:"var(--red-muted)",color:"var(--red)",description:"Missed activation"}),n.jsx(Zi,{label:"True Negative",abbr:"TN",count:p.tn,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly silent"})]})]})]}),n.jsx(PS,{history:E,expanded:L,onToggle:()=>V(!L)})]})}function PS({history:a,expanded:r,onToggle:i}){return a===null?null:n.jsxs("div",{className:"glass-card overflow-hidden",children:[n.jsxs("button",{className:"w-full px-4 py-3 flex items-center justify-between text-left",style:{borderBottom:r?"1px solid var(--border-subtle)":"none"},onClick:i,children:[n.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:["Test History",a.length>0&&n.jsxs("span",{className:"ml-2 font-normal",style:{color:"var(--text-tertiary)"},children:["(",a.length," run",a.length!==1?"s":"",")"]})]}),n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:r?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),r&&n.jsx("div",{className:"px-4 py-3",children:a.length===0?n.jsx("div",{className:"text-[12px] py-4 text-center",style:{color:"var(--text-tertiary)"},children:"No test runs yet"}):n.jsx("div",{className:"space-y-2",children:a.map(o=>n.jsx(qS,{run:o},o.id))})})]})}function qS({run:a}){const r=Math.round(a.summary.reliability*100),i=r>=80?"var(--green)":r>=60?"var(--yellow)":"var(--red)",o=r>=80?"Good":r>=60?"Needs Work":"Poor",u=i;return n.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{background:"var(--surface-1)"},children:[n.jsx("div",{className:"flex-1 min-w-0",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:YS(a.timestamp)}),n.jsx("span",{className:"pill text-[9px] px-1.5",style:{background:"var(--surface-2)",color:"var(--text-tertiary)"},children:a.model||a.provider}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[a.promptCount," prompts"]})]})}),n.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:i,fontVariantNumeric:"tabular-nums"},children:[r,"%"]}),n.jsx("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded",style:{color:u,background:`color-mix(in srgb, ${u} 10%, transparent)`},children:o})]})]})}function YS(a){const r=Date.now(),i=new Date(a).getTime(),o=Math.floor((r-i)/1e3);if(o<60)return"just now";const u=Math.floor(o/60);if(u<60)return`${u}m ago`;const m=Math.floor(u/60);if(m<24)return`${m}h ago`;const f=Math.floor(m/24);return f<7?`${f}d ago`:new Date(a).toLocaleDateString()}function Xi(){return n.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function Fx({result:a}){const r=Yx[a.classification]||Yx.FN,i=a.classification==="TP"||a.classification==="TN";return n.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl transition-all duration-200",style:{background:r.bg,border:"1px solid transparent"},children:[n.jsx("div",{className:"flex-shrink-0 mt-0.5",children:n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:`color-mix(in srgb, ${r.text} 20%, transparent)`},children:i?n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:r.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:r.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"flex items-center gap-2 mb-1",children:n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:a.prompt})}),n.jsxs("div",{className:"flex items-center gap-3 text-[12px]",children:[n.jsx("span",{className:"pill",style:{background:"var(--surface-3)",color:r.text,fontWeight:700,fontSize:"10px",padding:"1px 6px"},children:a.classification}),n.jsx("span",{style:{color:a.activate?"var(--green)":"var(--text-tertiary)"},children:a.activate?"Activated":"Silent"}),n.jsxs("span",{style:{color:"var(--text-tertiary)"},children:["Expected: ",a.expected==="should_activate"?"activate":"stay silent"]}),n.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[a.confidence," confidence"]}),a.autoClassified&&n.jsx("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)",fontSize:"9px",padding:"1px 5px"},children:"auto"})]}),a.reasoning&&n.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--text-tertiary)"},children:a.reasoning})]})]})}function Zu({label:a,value:r,description:i,detail:o}){const u=Math.round(r*100),m=u>=80?"var(--green)":u>=60?"var(--yellow)":"var(--red)";return n.jsxs("div",{className:"text-center",children:[n.jsxs("div",{className:"text-[28px] font-bold tracking-tight",style:{color:m},children:[u,"%"]}),n.jsx("div",{className:"text-[12px] font-medium mt-0.5",style:{color:"var(--text-secondary)"},children:a}),n.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--text-tertiary)"},children:i}),n.jsx("div",{className:"text-[10px] mt-0.5 font-mono",style:{color:"var(--text-tertiary)"},children:o})]})}function Zi({abbr:a,count:r,bg:i,color:o,description:u}){return n.jsxs("div",{className:"text-center p-3 rounded-lg",style:{background:i},children:[n.jsx("div",{className:"text-[20px] font-bold",style:{color:o},children:r}),n.jsx("div",{className:"text-[11px] font-semibold",style:{color:o},children:a}),n.jsx("div",{className:"text-[9px] mt-0.5",style:{color:"var(--text-tertiary)"},children:u})]})}function FS({startedAt:a}){const[r,i]=v.useState(0);return v.useEffect(()=>{const o=setInterval(()=>i(Math.floor((Date.now()-a)/1e3)),1e3);return()=>clearInterval(o)},[a]),n.jsxs("span",{className:"ml-2",children:["(",r,"s)"]})}const Ju={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},Kx={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},vd=600,gd=180,tn=40,ed=vd-tn*2,Pa=gd-tn*2,KS=[25,50,75,100];function Wx(a){return new Date(a).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function WS(a){return a==null?"--":`${(a/1e3).toFixed(1)}s`}function QS({entries:a,onPointClick:r}){const[i,o]=v.useState(null),u=v.useMemo(()=>[...a].reverse(),[a]);if(u.length<2)return null;const m=u.length,f=u.map((p,y)=>{const g=tn+y/(m-1)*ed,j=p.passRate*100,S=tn+Pa-j/100*Pa;return{x:g,y:S,pct:j,entry:p}}),h=f.map(p=>`${p.x},${p.y}`).join(" "),x=Array.from(new Set(u.map(p=>p.type)));return n.jsxs("div",{className:"glass-card p-5 animate-fade-in",style:{position:"relative",overflowX:m>=20?"auto":void 0},children:[n.jsx("div",{className:"text-[13px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"Pass Rate Trend"}),n.jsx("div",{className:"flex items-center gap-5 mb-3",children:x.map(p=>n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:Ju[p]??"var(--text-tertiary)"}}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:Kx[p]??p})]},p))}),n.jsxs("svg",{width:vd,height:gd,viewBox:`0 0 ${vd} ${gd}`,style:{display:"block",overflow:"visible"},children:[KS.map(p=>{const y=tn+Pa-p/100*Pa;return n.jsxs("g",{children:[n.jsx("line",{x1:tn,y1:y,x2:tn+ed,y2:y,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),n.jsxs("text",{x:tn-8,y:y+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[p,"%"]})]},p)}),n.jsx("line",{x1:tn,y1:tn+Pa,x2:tn+ed,y2:tn+Pa,stroke:"var(--border-subtle)",strokeWidth:1}),n.jsx("text",{x:tn-8,y:tn+Pa+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:"0%"}),n.jsx("polyline",{points:h,fill:"none",stroke:"var(--border-subtle)",strokeWidth:1.5,strokeLinejoin:"round"}),f.map((p,y)=>n.jsx("circle",{cx:p.x,cy:p.y,r:5,fill:Ju[p.entry.type]??"var(--text-tertiary)",stroke:"var(--surface-2)",strokeWidth:2,style:{cursor:"pointer",transition:"r 0.15s ease"},onMouseEnter:g=>{g.currentTarget.setAttribute("r","7"),o({x:p.x,y:p.y,entry:p.entry})},onMouseLeave:g=>{g.currentTarget.setAttribute("r","5"),o(null)},onClick:()=>r==null?void 0:r(p.entry)},y)),XS(m).map(p=>n.jsx("text",{x:f[p].x,y:tn+Pa+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:Wx(u[p].timestamp)},p))]}),i&&n.jsxs("div",{style:{position:"absolute",left:i.x,top:i.y-12,transform:"translate(-50%, -100%)",background:"var(--surface-3)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"8px 12px",pointerEvents:"none",zIndex:10,whiteSpace:"nowrap"},children:[n.jsx("div",{className:"text-[11px] font-medium",style:{color:"var(--text-primary)"},children:Wx(i.entry.timestamp)}),n.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-tertiary)"},children:i.entry.model}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:Ju[i.entry.type]??"var(--text-tertiary)",color:"#fff"},children:Kx[i.entry.type]??i.entry.type}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:[Math.round(i.entry.passRate*100),"%"]})]}),n.jsxs("div",{className:"text-[10px] mt-1.5 flex items-center gap-3",style:{color:"var(--text-tertiary)"},children:[n.jsx("span",{children:WS(i.entry.totalDurationMs)}),n.jsx("span",{children:i.entry.totalTokens!=null?`${i.entry.totalTokens} tokens`:"--"})]})]})]})}function XS(a){if(a<=3)return Array.from({length:a},(o,u)=>u);if(a<=6)return[0,Math.floor(a/2),a-1];if(a<20)return[0,Math.floor(a/3),Math.floor(2*a/3),a-1];const r=Math.ceil(a/10),i=[0];for(let o=r;o<a-1;o+=r)i.push(o);return i.push(a-1),i}const xs=new Map;let nn=null,lo=null,Ji=1e3,vs=0;function sg(){if(nn)return;nn=new EventSource("/api/events");const a=r=>i=>{let o={};try{o=i.data?JSON.parse(i.data):{}}catch{}const u=xs.get(r);if(u)for(const m of u)m(o)};nn.addEventListener("benchmark:complete",a("benchmark:complete")),nn.addEventListener("history:written",a("history:written")),nn.addEventListener("leaderboard:updated",a("leaderboard:updated")),nn.onerror=()=>{nn==null||nn.close(),nn=null,vs>0&&(lo=setTimeout(()=>{Ji=Math.min(Ji*2,3e4),sg()},Ji))},nn.onopen=()=>{Ji=1e3}}function ZS(){lo!=null&&(clearTimeout(lo),lo=null),nn==null||nn.close(),nn=null}function JS(a,r){return xs.has(a)||xs.set(a,new Set),xs.get(a).add(r),vs++,sg(),()=>{var i;(i=xs.get(a))==null||i.delete(r),vs--,vs<=0&&(vs=0,ZS())}}function co(a,r){const i=v.useRef(r);i.current=r,v.useEffect(()=>JS(a,u=>i.current(u)),[a])}function uo(a){return a>=.8?"var(--green)":a>=.5?"var(--yellow)":"var(--red)"}function ek(a){return a>=1e3?`${(a/1e3).toFixed(1)}s`:`${Math.round(a)}ms`}function tk({rate:a,label:r}){const i=Math.round(a*100);return n.jsx("div",{className:"flex items-center gap-3",children:n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"flex items-center justify-between mb-1",children:[n.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-primary)",maxWidth:"70%"},children:r}),n.jsxs("span",{className:"text-[11px] font-semibold",style:{color:uo(a)},children:[i,"%"]})]}),n.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{background:"var(--surface-3)"},children:n.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${i}%`,background:uo(a)}})})]})})}function nk({points:a}){if(a.length<2)return null;const r=200,i=48,o=4,u=a.length,m=a.map((x,p)=>{const y=o+p/(u-1)*(r-o*2),g=o+(i-o*2)-x.passRate*(i-o*2);return{x:y,y:g}}),f=`M ${m[0].x},${i-o} `+m.map(x=>`L ${x.x},${x.y}`).join(" ")+` L ${m[m.length-1].x},${i-o} Z`,h=m.map((x,p)=>`${p===0?"M":"L"} ${x.x},${x.y}`).join(" ");return n.jsxs("svg",{width:r,height:i,style:{display:"block"},children:[n.jsx("path",{d:f,fill:"var(--accent-muted)"}),n.jsx("path",{d:h,fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),n.jsx("circle",{cx:m[m.length-1].x,cy:m[m.length-1].y,r:3,fill:"var(--accent)"})]})}function ak({plugin:a,skill:r}){const i=`stats/${a}/${r}`,o=v.useCallback(()=>Ne.getStats(a,r),[a,r]),{data:u,loading:m}=Ds(i,o),f=v.useCallback(()=>ga(i),[i]);if(co("benchmark:complete",f),co("history:written",f),m)return n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"skeleton h-24 rounded-xl"}),n.jsx("div",{className:"skeleton h-48 rounded-xl"}),n.jsx("div",{className:"skeleton h-36 rounded-xl"})]});if(!u||u.totalRuns===0)return n.jsxs("div",{className:"text-center py-12",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center mx-auto mb-3",style:{background:"var(--surface-2)"},children:n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",children:[n.jsx("path",{d:"M18 20V10"}),n.jsx("path",{d:"M12 20V4"}),n.jsx("path",{d:"M6 20v-6"})]})}),n.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark data yet"}),n.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"Run some benchmarks to see statistics"})]});const h=u.trendPoints.length>0?u.trendPoints[u.trendPoints.length-1].passRate:0,x=u.trendPoints.length>0?u.trendPoints[0].passRate:0,p=h-x,y=u.assertionStats.slice(0,10);return n.jsxs("div",{className:"space-y-4 stagger-children",children:[n.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Runs"}),n.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:u.totalRuns})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Latest Pass Rate"}),n.jsxs("div",{className:"text-[24px] font-bold",style:{color:uo(h)},children:[Math.round(h*100),"%"]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Trend"}),n.jsxs("div",{className:"text-[24px] font-bold",style:{color:p>=0?"var(--green)":"var(--red)"},children:[p>=0?"+":"",Math.round(p*100),"%"]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Models Tested"}),n.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:u.modelStats.length})]}),u.totalCost!=null&&n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Cost"}),n.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:Sn(u.totalCost)})]}),u.costPerRun!=null&&n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Avg Cost/Run"}),n.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:Sn(u.costPerRun)})]})]}),u.trendPoints.length>=2&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Pass Rate Over Time"}),n.jsx(nk,{points:u.trendPoints})]}),u.modelStats.length>0&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Model Performance"}),n.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[n.jsx("thead",{children:n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("th",{style:{textAlign:"left",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Model"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Runs"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Pass Rate"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Duration"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Cost"})]})}),n.jsx("tbody",{children:u.modelStats.map(g=>n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("td",{style:{padding:"8px",color:"var(--text-primary)",fontWeight:500},children:g.model}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:g.runs}),n.jsx("td",{style:{padding:"8px",textAlign:"center"},children:n.jsxs("span",{className:"font-semibold",style:{color:uo(g.avgPassRate)},children:[Math.round(g.avgPassRate*100),"%"]})}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:ek(g.avgDurationMs)}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:g.avgCost!=null?Sn(g.avgCost):"N/A"})]},g.model))})]})]}),y.length>0&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Weakest Assertions"}),n.jsx("div",{className:"space-y-3",children:y.map(g=>n.jsxs("button",{className:"block w-full text-left rounded-lg p-2 -mx-2 transition-colors duration-150",style:{background:"transparent"},onMouseEnter:j=>{j.currentTarget.style.background="var(--surface-2)"},onMouseLeave:j=>{j.currentTarget.style.background="transparent"},onClick:()=>{},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[n.jsxs("span",{className:"text-[10px] font-mono px-1 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",g.evalId]}),n.jsx("span",{className:"text-[10px] truncate",style:{color:"var(--text-tertiary)"},children:g.evalName}),n.jsxs("span",{className:"text-[10px] ml-auto flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[g.totalRuns," runs"]})]}),n.jsx(tk,{rate:g.passRate,label:g.text})]},`${g.evalId}:${g.id}`))})]})]})}function lk({plugin:a,skill:r}){const[i,o]=v.useState(null),[u,m]=v.useState(null),[f,h]=v.useState({}),[x,p]=v.useState({});v.useEffect(()=>{Ne.getEvals(a,r).then(o).catch(()=>o(null))},[a,r]);async function y(g){if(u===g){m(null);return}if(m(g),!f[g]){p(j=>({...j,[g]:!0}));try{const j=await Ne.getCaseHistory(a,r,g);h(S=>({...S,[g]:j}))}catch{h(j=>({...j,[g]:[]}))}finally{p(j=>({...j,[g]:!1}))}}}return i?n.jsx("div",{className:"space-y-2 stagger-children",children:i.evals.map(g=>{const j=f[g.id]||[],S=u===g.id,N=x[g.id],M=j.length>0?j[0].pass_rate:null;return n.jsxs("div",{className:"glass-card overflow-hidden",children:[n.jsxs("button",{onClick:()=>y(g.id),className:"w-full text-left p-4 flex items-center gap-3 transition-colors duration-150",style:{background:S?"var(--surface-2)":"transparent"},onMouseEnter:E=>{S||(E.currentTarget.style.background="var(--surface-2)")},onMouseLeave:E=>{S||(E.currentTarget.style.background="transparent")},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",style:{transform:S?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease",flexShrink:0},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),n.jsxs("span",{className:"text-[11px] font-mono px-1.5 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",g.id]}),n.jsx("span",{className:"text-[13px] font-medium flex-1 truncate",style:{color:"var(--text-primary)"},children:g.name}),j.length>=2&&n.jsx(tg,{entries:j}),M!=null&&n.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:mr(M)},children:[Math.round(M*100),"%"]}),j.length>0&&n.jsxs("span",{className:"text-[10px] flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[j.length," runs"]})]}),S&&n.jsx("div",{className:"border-t animate-fade-in",style:{borderColor:"var(--border-subtle)"},children:N?n.jsxs("div",{className:"p-4 flex items-center gap-2",children:[n.jsx("div",{className:"spinner",style:{width:14,height:14}}),n.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):j.length===0?n.jsx("div",{className:"p-4",children:n.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No history for this eval case"})}):n.jsx("div",{className:"divide-y",style:{borderColor:"var(--border-subtle)"},children:j.map((E,k)=>n.jsxs("div",{className:"p-4",style:{background:k===0?"var(--surface-2)":"transparent"},children:[n.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:Jv(E.timestamp)}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:E.model}),n.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:E.type==="benchmark"?"rgba(99,131,255,0.15)":E.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:E.type==="benchmark"?"#6383ff":E.type==="comparison"?"var(--purple)":"#fb923c"},children:E.type}),n.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:mr(E.pass_rate)},children:[Math.round(E.pass_rate*100),"%"]})]}),n.jsxs("div",{className:"flex items-center gap-4 mb-2 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[E.durationMs!=null&&n.jsx("span",{children:eg(E.durationMs)}),E.tokens!=null&&n.jsxs("span",{children:[E.tokens>=1e3?`${(E.tokens/1e3).toFixed(1)}k`:E.tokens," tok"]})]}),n.jsx("div",{className:"space-y-1",children:E.assertions.map(T=>n.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[n.jsx("div",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:T.pass?"var(--green)":"var(--red)"},children:n.jsx("svg",{width:"7",height:"7",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",children:T.pass?n.jsx("polyline",{points:"20 6 9 17 4 12"}):n.jsxs(n.Fragment,{children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"text-[11px]",style:{color:"var(--text-primary)"},children:T.text}),T.reasoning&&n.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:T.reasoning})]})]},T.id))})]},k))})})]},g.id)})}):n.jsx("div",{className:"text-center py-12",children:n.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No eval cases found"})})}function rk(){const{state:a,dispatch:r}=kn(),{plugin:i,skill:o}=a,[u,m]=v.useState("timeline"),[f,h]=v.useState(""),[x,p]=v.useState(""),[y,g]=v.useState(!1),[j,S]=v.useState([]),[N,M]=v.useState(null),[E,k]=v.useState(!1),[T,B]=v.useState(null),[I,L]=v.useState(!1),V=`history/${i}/${o}?model=${f}&type=${x}`,w=v.useCallback(()=>Ne.getHistory(i,o,{model:f||void 0,type:x||void 0}),[i,o,f,x]),{data:D,loading:A}=Ds(V,w),O=D??[];v.useEffect(()=>{!D||D.length<2||Ne.compareRuns(i,o,D[0].timestamp,D[1].timestamp).then(_=>{const R=_.regressions.filter(U=>U.change==="regression");r({type:"SET_REGRESSIONS",regressions:R})}).catch(()=>{})},[D,i,o,r]);const G=v.useCallback(()=>ga(V),[V]);co("history:written",G);const q=v.useCallback(async _=>{if(y){S(R=>R.includes(_)?R.filter(U=>U!==_):R.length>=2?[R[1],_]:[...R,_]);return}L(!0);try{const R=await Ne.getHistoryEntry(i,o,_);B(R)}catch{}finally{L(!1)}},[i,o,y]),te=v.useCallback(async()=>{if(j.length===2){k(!0);try{const _=await Ne.compareRuns(i,o,j[0],j[1]);M(_)}catch{}finally{k(!1)}}},[i,o,j]),X=[...new Set(O.map(_=>_.model))];return A?n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),n.jsx("div",{className:"skeleton h-48 rounded-xl mb-4"}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"skeleton h-12 rounded-lg"}),n.jsx("div",{className:"skeleton h-12 rounded-lg"})]})]}):n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"flex items-center gap-1 mb-4",children:["timeline","per-eval","statistics"].map(_=>n.jsx("button",{onClick:()=>m(_),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:u===_?"var(--accent-muted)":"transparent",color:u===_?"var(--accent)":"var(--text-tertiary)"},children:_==="timeline"?"Timeline":_==="per-eval"?"Per Eval":"Statistics"},_))}),u==="timeline"&&n.jsxs("div",{children:[O.length>0&&n.jsx("div",{className:"mb-5 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:n.jsx(QS,{entries:O,onPointClick:_=>q(_.timestamp)})}),n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("select",{value:f,onChange:_=>h(_.target.value),className:"input-field text-[12px]",style:{width:150},children:[n.jsx("option",{value:"",children:"All Models"}),X.map(_=>n.jsx("option",{value:_,children:_},_))]}),n.jsxs("select",{value:x,onChange:_=>p(_.target.value),className:"input-field text-[12px]",style:{width:150},children:[n.jsx("option",{value:"",children:"All Types"}),n.jsx("option",{value:"benchmark",children:"Benchmark"}),n.jsx("option",{value:"comparison",children:"Comparison"}),n.jsx("option",{value:"baseline",children:"Baseline"}),n.jsx("option",{value:"model-compare",children:"Model Compare"}),n.jsx("option",{value:"improve",children:"AI Improve"}),n.jsx("option",{value:"instruct",children:"AI Edit"}),n.jsx("option",{value:"ai-generate",children:"AI Generate"}),n.jsx("option",{value:"eval-generate",children:"Eval Generate"})]}),n.jsx("div",{className:"flex-1"}),n.jsx("button",{onClick:()=>{g(!y),S([]),M(null)},className:`btn text-[12px] ${y?"btn-primary":"btn-secondary"}`,children:y?"Exit Compare":"Compare Runs"}),y&&j.length===2&&n.jsx("button",{onClick:te,disabled:E,className:"btn btn-primary text-[12px]",children:E?"Comparing...":"Compare"})]}),n.jsx("div",{className:"space-y-2",children:O.length===0?n.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):O.map(_=>{const R=j.includes(_.timestamp);return n.jsx("button",{onClick:()=>q(_.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:R?"var(--accent-muted)":"var(--surface-1)",border:R?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:U=>{R||(U.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:U=>{R||(U.currentTarget.style.borderColor="var(--border-subtle)")},children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[y&&n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:R?"var(--accent)":"var(--border-default)",background:R?"var(--accent)":"transparent"},children:R&&n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})}),n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:new Date(_.timestamp).toLocaleString()}),n.jsx("span",{className:"pill text-[9px]",style:{background:_.type==="comparison"?"var(--purple-muted)":_.type==="baseline"?"var(--surface-3)":_.type==="model-compare"?"var(--accent-muted)":_.type==="improve"||_.type==="instruct"?"var(--purple-muted)":_.type==="ai-generate"?"var(--green-muted)":_.type==="eval-generate"?"var(--orange-muted)":"var(--accent-muted)",color:_.type==="comparison"?"var(--purple)":_.type==="baseline"?"var(--text-tertiary)":_.type==="model-compare"?"var(--accent)":_.type==="improve"||_.type==="instruct"?"var(--purple)":_.type==="ai-generate"?"var(--green)":_.type==="eval-generate"?"var(--orange)":"var(--accent)"},children:_.type==="model-compare"?"model compare":_.type==="improve"?"ai improve":_.type==="instruct"?"ai edit":_.type==="ai-generate"?"ai generate":_.type==="eval-generate"?"eval generate":_.type})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:_.model}),_.totalCost!=null&&_.totalCost>0&&n.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--text-tertiary)"},children:Sn(_.totalCost)}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:_.passRate>=.8?"var(--green)":_.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(_.passRate*100),"%"]})]})]})},_.timestamp)})}),N&&n.jsx(sk,{result:N}),T&&!y&&n.jsx(ik,{run:T,onClose:()=>B(null)})]}),u==="per-eval"&&n.jsx(lk,{plugin:i,skill:o}),u==="statistics"&&n.jsx(ak,{plugin:i,skill:o})]})}function sk({result:a}){const r=a.regressions.filter(o=>o.change==="regression"),i=a.regressions.filter(o=>o.change==="improvement");return n.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Comparison: ",new Date(a.runA.timestamp).toLocaleDateString()," vs ",new Date(a.runB.timestamp).toLocaleDateString()]}),(a.runA.totalCost!=null||a.runB.totalCost!=null)&&n.jsxs("div",{className:"flex items-center gap-4 mb-3 text-[11px]",style:{color:"var(--text-secondary)"},children:[n.jsxs("span",{children:["Run A cost: ",Sn(a.runA.totalCost??null)]}),n.jsxs("span",{children:["Run B cost: ",Sn(a.runB.totalCost??null)]}),a.runA.totalCost!=null&&a.runB.totalCost!=null&&n.jsxs("span",{style:{color:a.runB.totalCost<=a.runA.totalCost?"var(--green)":"var(--red)"},children:["Delta: ",Sn(a.runB.totalCost-a.runA.totalCost)]})]}),r.length>0&&n.jsxs("div",{className:"mb-3",children:[n.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--red)"},children:["Regressions (",r.length,")"]}),r.map(o=>n.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",n.jsx("span",{style:{color:"var(--red)"},children:o.assertionId})," (was passing, now failing)"]},`${o.evalId}-${o.assertionId}`))]}),i.length>0&&n.jsxs("div",{className:"mb-3",children:[n.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--green)"},children:["Improvements (",i.length,")"]}),i.map(o=>n.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",n.jsx("span",{style:{color:"var(--green)"},children:o.assertionId})," (was failing, now passing)"]},`${o.evalId}-${o.assertionId}`))]}),n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 mt-3",style:{color:"var(--text-tertiary)"},children:"Case Diffs"}),n.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:n.jsxs("table",{className:"w-full text-[12px]",children:[n.jsx("thead",{children:n.jsxs("tr",{style:{background:"var(--surface-2)"},children:[n.jsx("th",{className:"text-left px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Case"}),n.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run A"}),n.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run B"})]})}),n.jsx("tbody",{children:a.caseDiffs.map(o=>n.jsxs("tr",{style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsxs("td",{className:"px-3 py-2",style:{color:"var(--text-secondary)"},children:["#",o.eval_id," ",o.eval_name]}),n.jsx("td",{className:"text-right px-3 py-2",style:{color:o.passRateA!=null?o.passRateA>=.8?"var(--green)":o.passRateA>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:o.passRateA!=null?`${Math.round(o.passRateA*100)}%`:o.statusA}),n.jsx("td",{className:"text-right px-3 py-2",style:{color:o.passRateB!=null?o.passRateB>=.8?"var(--green)":o.passRateB>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:o.passRateB!=null?`${Math.round(o.passRateB*100)}%`:o.statusB})]},o.eval_id))})]})})]})}function ik({run:a,onClose:r}){return(a.type==="improve"||a.type==="instruct")&&a.improve?n.jsx(ok,{run:a,onClose:r}):n.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:["Run: ",new Date(a.timestamp).toLocaleString()]}),n.jsx("button",{onClick:r,className:"btn btn-ghost text-[11px]",children:"Close"})]}),n.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:["Model: ",a.model," | Cases: ",a.cases.length," | Pass Rate: ",a.overall_pass_rate!=null?`${Math.round(a.overall_pass_rate*100)}%`:"--",a.totalCost!=null&&a.totalCost>0&&` | Cost: ${Sn(a.totalCost)}`]}),n.jsx("div",{className:"space-y-2",children:a.cases.map(i=>n.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)"},children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("span",{className:"text-[12px]",style:{color:"var(--text-secondary)"},children:["#",i.eval_id," ",i.eval_name]}),n.jsxs("div",{className:"flex items-center gap-2",children:[i.cost!=null&&i.cost>0&&n.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--text-tertiary)"},children:Sn(i.cost)}),n.jsx("span",{className:"text-[11px] font-semibold",style:{color:i.status==="pass"?"var(--green)":"var(--red)"},children:i.pass_rate!=null?`${Math.round(i.pass_rate*100)}%`:i.status})]})]})},i.eval_id))})]})}function ok({run:a,onClose:r}){var m;const i=v.useMemo(()=>a.improve?yo(a.improve.original,a.improve.improved):[],[a.improve]),o=v.useMemo(()=>{const f=i.filter(x=>x.type==="added").length,h=i.filter(x=>x.type==="removed").length;return{added:f,removed:h}},[i]),u=v.useMemo(()=>{let f=0,h=0;return i.map(x=>x.type==="removed"?(f++,{...x,origNum:f,newNum:null}):x.type==="added"?(h++,{...x,origNum:null,newNum:h}):(f++,h++,{...x,origNum:f,newNum:h}))},[i]);return n.jsxs("div",{className:"mt-4 rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{background:"var(--purple-muted)"},children:n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--purple)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),n.jsx("path",{d:"M2 17l10 5 10-5"}),n.jsx("path",{d:"M2 12l10 5 10-5"})]})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"}),n.jsxs("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[new Date(a.timestamp).toLocaleString()," · ",a.model]})]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsxs("span",{style:{color:"var(--green)"},children:["+",o.added]}),n.jsxs("span",{style:{color:"var(--red)"},children:["-",o.removed]})]}),n.jsx("button",{onClick:r,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:f=>{f.currentTarget.style.background="var(--surface-3)"},onMouseLeave:f=>{f.currentTarget.style.background="transparent"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),((m=a.improve)==null?void 0:m.reasoning)&&n.jsxs("div",{className:"mx-4 mt-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"var(--purple-muted)",border:"1px solid var(--purple-muted)",color:"var(--text-secondary)"},children:[n.jsx("span",{className:"font-semibold",style:{color:"var(--purple)"},children:"AI Reasoning: "}),a.improve.reasoning]}),n.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:480,overflowY:"auto"},children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:u.map((f,h)=>n.jsxs("tr",{style:{background:f.type==="added"?"var(--green-muted)":f.type==="removed"?"var(--red-muted)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:f.type==="removed"?"var(--red)":"var(--text-tertiary)",opacity:f.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:f.origNum??""}),n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:f.type==="added"?"var(--green)":"var(--text-tertiary)",opacity:f.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:f.newNum??""}),n.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:f.type==="added"?"var(--green)":f.type==="removed"?"var(--red)":"transparent",borderRight:f.type==="added"?"2px solid var(--green)":f.type==="removed"?"2px solid var(--red)":"2px solid transparent"},children:f.type==="added"?"+":f.type==="removed"?"-":" "}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:f.type==="added"?"var(--green)":f.type==="removed"?"var(--red)":"var(--text-secondary)"},children:f.content||"​"})]},h))})})})]})}function ck({plugin:a,skill:r}){const[i,o]=v.useState([]),[u,m]=v.useState([]),[f,h]=v.useState(!0),[x,p]=v.useState(null);v.useEffect(()=>{Ne.getDependencies(a,r).then(g=>{o(g.mcpDependencies),m(g.skillDependencies)}).catch(()=>{}).finally(()=>h(!1))},[a,r]);async function y(g,j){try{await navigator.clipboard.writeText(j),p(g),setTimeout(()=>p(null),2e3)}catch{}}return f?null:i.length===0&&u.length===0?n.jsx("div",{className:"mb-5 px-4 py-3 rounded-lg text-[12px]",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:"No dependencies detected"}):n.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsxs("div",{className:"flex items-center gap-2.5 px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(234,179,8,0.15)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#eab308",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),n.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Dependencies"}),n.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:i.length+u.length})]}),n.jsxs("div",{className:"px-5 py-4",children:[i.length>0&&n.jsxs("div",{className:"space-y-3 mb-4",children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"MCP Servers"}),i.map(g=>n.jsxs("div",{className:"p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:g.server}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:g.transport})]}),n.jsx("button",{onClick:()=>y(g.server,g.configSnippet),className:"btn btn-ghost text-[11px] py-1 px-2",style:{color:x===g.server?"var(--green)":"var(--accent)"},children:x===g.server?n.jsxs(n.Fragment,{children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})," Copied!"]}):n.jsxs(n.Fragment,{children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),n.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})," Copy Config"]})})]}),n.jsx("div",{className:"text-[11px] mb-2 font-mono",style:{color:"var(--text-tertiary)"},children:g.url}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:g.matchedTools.map(j=>n.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:j},j))})]},g.server))]}),u.length>0&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Skill Dependencies"}),n.jsx("div",{className:"space-y-1.5",children:u.map(g=>n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})}),n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:g.name}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:g.source==="frontmatter"?"frontmatter":"referenced"})]},g.name))})]})]})]})}function Qx({plugin:a,skill:r}){const[i,o]=v.useState([]),[u,m]=v.useState(!0),[f,h]=v.useState(null),[x,p]=v.useState(""),[y,g]=v.useState(!1),[j,S]=v.useState(null),[N,M]=v.useState(""),[E,k]=v.useState(""),[T,B]=v.useState(!1),[I,L]=v.useState(new Set),V=v.useCallback(async()=>{m(!0);try{const[O,G]=await Promise.all([Ne.getCredentials(a,r).catch(()=>({credentials:[]})),Ne.getParams(a,r).catch(()=>({params:[]}))]),q=new Map(G.params.map(_=>[_.name,_])),te=new Set,X=[];for(const _ of O.credentials){te.add(_.name);const R=q.get(_.name);X.push({name:_.name,status:_.status==="ready"||_.status==="resolved"?"ready":"missing",source:_.source,maskedValue:R==null?void 0:R.maskedValue})}for(const _ of G.params)te.has(_.name)||X.push({name:_.name,status:_.status,maskedValue:_.maskedValue});o(X)}finally{m(!1)}},[a,r]);v.useEffect(()=>{V()},[V]);const w=v.useCallback(async O=>{if(I.has(O)){L(G=>{const q=new Set(G);return q.delete(O),q}),o(G=>G.map(q=>q.name===O?{...q,revealedValue:void 0}:q));return}try{const q=(await Ne.getParamsRevealed(a,r,O)).params.find(te=>te.name===O);q&&(o(te=>te.map(X=>X.name===O?{...X,revealedValue:q.value}:X)),L(te=>new Set(te).add(O)))}catch{}},[a,r,I]),D=async(O,G)=>{if(!(!O.trim()||!G.trim())){g(!0),S(null);try{await Ne.setCredential(a,r,O,G),h(null),p(""),L(new Set),V()}catch(q){S(q.message)}finally{g(!1)}}},A=async()=>{if(!(!N.trim()||!E.trim())){g(!0),S(null);try{await Ne.setCredential(a,r,N.trim().toUpperCase(),E),M(""),k(""),B(!1),V()}catch(O){S(O.message)}finally{g(!1)}}};return u?n.jsxs("div",{className:"mt-6",children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),n.jsx("div",{className:"skeleton h-20 rounded-xl"})]}):n.jsxs("div",{className:"mt-6",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),n.jsx("button",{onClick:()=>B(!T),className:"text-[11px] transition-colors duration-150",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"+ Add Parameter"})]}),j&&n.jsx("div",{className:"mb-2 px-3 py-2 rounded-lg text-[11px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:j}),i.length===0&&!T?n.jsx("div",{className:"text-[12px] text-center py-6 rounded-xl",style:{color:"var(--text-tertiary)",background:"var(--surface-2)"},children:"No credentials configured for this skill"}):n.jsx("div",{className:"rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:i.map(O=>n.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsx("span",{className:"text-[11px] font-mono font-medium truncate",style:{color:"var(--text-primary)",minWidth:80},children:O.name}),O.maskedValue&&n.jsx("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)",maxWidth:120},children:I.has(O.name)&&O.revealedValue!=null?O.revealedValue:O.maskedValue}),O.maskedValue&&n.jsx("button",{onClick:()=>w(O.name),className:"btn btn-ghost px-1",title:I.has(O.name)?"Hide value":"Reveal value",style:{color:"var(--text-tertiary)",lineHeight:1},children:I.has(O.name)?n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94"}),n.jsx("path",{d:"M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19"}),n.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),n.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:O.status==="ready"?"var(--green-muted)":"var(--orange-muted)",color:O.status==="ready"?"var(--green)":"var(--orange)"},children:O.status==="ready"?"ready":"missing"}),O.source&&n.jsx("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:O.source}),f===O.name?n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("input",{value:x,onChange:G=>p(G.target.value),onKeyDown:G=>{G.key==="Enter"&&D(O.name,x)},className:"input-field text-[11px] font-mono",style:{width:160},placeholder:"Value...",autoFocus:!0}),n.jsx("button",{onClick:()=>D(O.name,x),disabled:y||!x.trim(),className:"btn btn-primary text-[10px] px-2 py-0.5",children:y?"...":"Save"}),n.jsx("button",{onClick:()=>{h(null),p("")},className:"btn btn-ghost text-[10px] px-1",children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}):n.jsx("button",{onClick:()=>{h(O.name),p("")},className:"btn btn-ghost text-[10px] px-2 py-0.5",style:{color:"var(--accent)"},children:"Edit"})]},O.name))}),T&&n.jsxs("div",{className:"mt-2 p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex gap-2 mb-2",children:[n.jsx("input",{value:N,onChange:O=>M(O.target.value),className:"input-field flex-1 text-[11px] font-mono",placeholder:"KEY_NAME",autoFocus:!0}),n.jsx("input",{value:E,onChange:O=>k(O.target.value),onKeyDown:O=>{O.key==="Enter"&&A()},className:"input-field flex-1 text-[11px] font-mono",placeholder:"Value",type:"password"})]}),n.jsxs("div",{className:"flex justify-end gap-1.5",children:[n.jsx("button",{onClick:()=>{B(!1),M(""),k("")},className:"btn btn-ghost text-[10px]",children:"Cancel"}),n.jsx("button",{onClick:A,disabled:y||!N.trim()||!E.trim(),className:"btn btn-primary text-[10px]",children:y?"Saving...":"Save"})]})]})]})}function uk(){const{state:a}=kn(),{plugin:r,skill:i}=a,[o,u]=v.useState(null),[m,f]=v.useState(!0);return v.useEffect(()=>{Ne.getDependencies(r,i).then(u).catch(()=>{}).finally(()=>f(!1))},[r,i]),m?n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),n.jsx("div",{className:"skeleton h-32 rounded-xl"})]}):o?n.jsxs("div",{className:"p-5 max-w-3xl",children:[n.jsx(ck,{plugin:r,skill:i}),n.jsx(Qx,{plugin:r,skill:i})]}):n.jsxs("div",{className:"p-5 max-w-3xl",children:[n.jsx("div",{className:"text-[13px] mb-4",style:{color:"var(--text-tertiary)"},children:"No MCP dependency information available"}),n.jsx(Qx,{plugin:r,skill:i})]})}function ig({data:a}){if(a.length<2)return n.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:"--"});const r=a.slice(-10),i=80,o=24,u=2,m=i-u*2,f=o-u*2,h=r.length,x=Math.min(...r),y=Math.max(...r)-x||1,g=r.map((N,M)=>{const E=u+M/(h-1)*m,k=u+f-(N-x)/y*f;return`${E.toFixed(1)},${k.toFixed(1)}`}),j=r[r.length-1],S=mr(j);return n.jsxs("svg",{width:i,height:o,viewBox:`0 0 ${i} ${o}`,style:{display:"block"},children:[n.jsx("polyline",{points:g.join(" "),fill:"none",stroke:S,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),(()=>{const[N,M]=g[g.length-1].split(",");return n.jsx("circle",{cx:N,cy:M,r:2.5,fill:S})})()]})}function dk(){return n.jsxs("span",{className:"pill",style:{background:"var(--yellow-muted)",color:"var(--yellow)",fontSize:9,fontWeight:700,gap:3},children:[n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"var(--yellow)",stroke:"none",children:n.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),"Best Model"]})}function fk({pct:a}){const r=a>=10?"var(--green)":a>=0?"var(--yellow)":"var(--red)",i=a>=10?"var(--green-muted)":a>=0?"var(--yellow-muted)":"var(--red-muted)",o=a>=0?"+":"";return n.jsxs("span",{className:"pill",style:{background:i,color:r,fontSize:10,fontWeight:600},children:[o,a.toFixed(1),"%"]})}function pk({score:a,rating:r}){const i={excellent:{bg:"var(--green-muted)",fg:"var(--green)"},good:{bg:"var(--green-muted)",fg:"var(--green)"},marginal:{bg:"var(--yellow-muted)",fg:"var(--yellow)"},minimal:{bg:"var(--yellow-muted)",fg:"var(--yellow)"},harmful:{bg:"var(--red-muted)",fg:"var(--red)"}},o=i[r]??i.minimal,u=a>=0?"+":"";return n.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"Skill Quality:"}),n.jsxs("span",{className:"pill",style:{background:o.bg,color:o.fg,fontSize:11,fontWeight:600},children:[u,a.toFixed(1),"% (",r.toUpperCase(),")"]})]})}function mk({warning:a}){return n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-3",style:{background:"var(--yellow-muted)",border:"1px solid var(--yellow-muted)"},children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--yellow)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),n.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),n.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--yellow)"},children:a})]})}function hk({active:a,onChange:r,hasBaseline:i}){return n.jsxs("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)"},children:[n.jsx("button",{onClick:()=>r("rankings"),className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:a==="rankings"?"var(--surface-3)":"transparent",color:a==="rankings"?"var(--text-primary)":"var(--text-tertiary)"},children:"Rankings"}),n.jsx("button",{onClick:()=>r("amplification"),disabled:!i,className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:a==="amplification"?"var(--surface-3)":"transparent",color:i&&a==="amplification"?"var(--text-primary)":"var(--text-tertiary)",opacity:i?1:.5,cursor:i?"pointer":"not-allowed"},title:i?"View skill amplification data":"Run sweep with --baseline to see amplification data",children:"Skill Amplification"})]})}function xk(a){var o,u,m;if(a.length===0)return[];const r=new Map;for(const f of a)for(const h of f.models){if(h.status==="error")continue;const x=`${h.provider}/${h.model}`;r.has(x)||r.set(x,{provider:h.provider,passRates:[],lastRubric:null,lastDuration:0,lastCost:null,lastBaselinePassRate:void 0,lastSkillDelta:void 0,lastAmplificationPct:void 0,lastCompositeScore:void 0,hasBaseline:!1});const p=r.get(x);p.passRates.push(h.passRate.mean),p.lastRubric=((o=h.rubricScore)==null?void 0:o.mean)??null,p.lastDuration=h.duration.mean,p.lastCost=((u=h.cost)==null?void 0:u.total)??null,p.lastCompositeScore=h.compositeScore,h.baselinePassRate!=null&&(p.lastBaselinePassRate=h.baselinePassRate.mean,p.lastSkillDelta=(m=h.skillDelta)==null?void 0:m.mean,p.lastAmplificationPct=h.amplificationPct,p.hasBaseline=!0)}const i=[];for(const[f,h]of r){const[x,...p]=f.split("/");i.push({rank:0,model:p.join("/"),provider:x,passRate:h.passRates[h.passRates.length-1],rubricScore:h.lastRubric,duration:h.lastDuration,cost:h.lastCost,sparklineData:h.passRates,isBest:!1,baselinePassRate:h.lastBaselinePassRate,skillDelta:h.lastSkillDelta,amplificationPct:h.lastAmplificationPct,compositeScore:h.lastCompositeScore,hasBaseline:h.hasBaseline})}return i.sort((f,h)=>{const x=f.compositeScore??f.passRate;return(h.compositeScore??h.passRate)-x}),i.forEach((f,h)=>{f.rank=h+1}),i.length>0&&(i[0].isBest=!0),i}const og=(a="left")=>({padding:"10px 12px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary)",textAlign:a,whiteSpace:"nowrap"});function vk({entries:a}){return n.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:n.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[n.jsx("thead",{children:n.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","Pass Rate","Rubric","Duration","Cost","Trend"].map(r=>n.jsx("th",{style:og(r==="#"?"center":"left"),children:r},r))})}),n.jsx("tbody",{children:a.map(r=>n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:i=>{i.currentTarget.style.background="var(--surface-2)"},onMouseLeave:i=>{i.currentTarget.style.background="transparent"},children:[n.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:r.rank}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:r.model}),n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:r.provider}),r.isBest&&n.jsx(dk,{})]})}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("span",{className:"pill",style:{background:r.passRate>=.7?"var(--green-muted)":r.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:mr(r.passRate),fontSize:11,fontWeight:600},children:[Math.round(r.passRate*100),"%"]})}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.rubricScore!=null?r.rubricScore.toFixed(1):"--"}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.duration<1e3?`${Math.round(r.duration)}ms`:`${(r.duration/1e3).toFixed(1)}s`}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.cost!=null?`$${r.cost.toFixed(4)}`:"N/A"}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsx(ig,{data:r.sparklineData})})]},`${r.provider}/${r.model}`))})]})})}function gk({entries:a}){const r=[...a].filter(i=>i.hasBaseline).sort((i,o)=>(o.amplificationPct??0)-(i.amplificationPct??0));return r.length===0?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx("div",{className:"text-center",children:n.jsxs("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:["No baseline data available. Run sweep with ",n.jsx("code",{children:"--baseline"})," flag."]})})}):n.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:n.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[n.jsx("thead",{children:n.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","With Skill","Without Skill","Delta","Amplification","Trend"].map(i=>n.jsx("th",{style:og(i==="#"?"center":"left"),children:i},i))})}),n.jsx("tbody",{children:r.map((i,o)=>n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:u=>{u.currentTarget.style.background="var(--surface-2)"},onMouseLeave:u=>{u.currentTarget.style.background="transparent"},children:[n.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:o+1}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:i.model}),n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:i.provider})]})}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("span",{className:"pill",style:{background:i.passRate>=.7?"var(--green-muted)":i.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:mr(i.passRate),fontSize:11,fontWeight:600},children:[Math.round(i.passRate*100),"%"]})}),n.jsx("td",{style:{padding:"10px 12px"},children:i.baselinePassRate!=null?n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:[Math.round(i.baselinePassRate*100),"%"]}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:i.skillDelta!=null?n.jsxs("span",{className:"text-[11px] font-medium",style:{color:i.skillDelta>=0?"var(--green)":"var(--red)"},children:[i.skillDelta>=0?"+":"",(i.skillDelta*100).toFixed(1),"pp"]}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:i.amplificationPct!=null&&isFinite(i.amplificationPct)?n.jsx(fk,{pct:i.amplificationPct}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsx(ig,{data:i.sparklineData})})]},`${i.provider}/${i.model}`))})]})})}function yk(){const{state:a}=kn(),{plugin:r,skill:i}=a,[o,u]=v.useState("rankings"),m=`leaderboard/${r}/${i}`,f=v.useCallback(()=>Ne.getLeaderboard(r,i),[r,i]),{data:h,loading:x}=Ds(m,f),p=(h==null?void 0:h.entries)??[];v.useEffect(()=>{u("rankings")},[r,i]);const y=v.useCallback(()=>ga(m),[m]);co("leaderboard:updated",y);const g=v.useMemo(()=>xk(p),[p]),j=g.some(M=>M.hasBaseline),S=p[0],N=S==null?void 0:S.judgeBiasWarning;return x?n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsx("div",{className:"spinner spinner-lg"})}):g.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:"var(--accent-muted)"},children:n.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M18 20V10"}),n.jsx("path",{d:"M12 20V4"}),n.jsx("path",{d:"M6 20v-6"})]})}),n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No sweep results yet"}),n.jsx("div",{className:"text-[12px] mb-3",style:{color:"var(--text-tertiary)"},children:"Run your first model sweep to compare performance across models:"}),n.jsx("div",{className:"text-[11px] font-mono px-4 py-3 rounded-lg text-left",style:{background:"var(--surface-2)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)"},children:'vskill eval sweep --models "anthropic/claude-sonnet-4,openrouter/meta-llama/llama-3.1-70b" --judge "anthropic/claude-sonnet-4"'}),n.jsxs("div",{className:"text-[11px] mt-2",style:{color:"var(--text-tertiary)"},children:["Add ",n.jsx("code",{children:"--baseline"})," to measure skill amplification per model."]})]})]}):n.jsxs("div",{className:"p-5 animate-fade-in",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"text-[15px] font-semibold",style:{color:"var(--text-primary)"},children:"Model Leaderboard"}),n.jsx(hk,{active:o,onChange:u,hasBaseline:j})]}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[p.length," sweep",p.length!==1?"s":""," · ",g.length," model",g.length!==1?"s":""]})]}),N&&n.jsx(mk,{warning:N}),o==="rankings"?n.jsx(vk,{entries:g}):n.jsx(gk,{entries:g}),o==="amplification"&&(S==null?void 0:S.skillQualityScore)!=null&&(S==null?void 0:S.skillQualityRating)&&n.jsx(pk,{score:S.skillQualityScore,rating:S.skillQualityRating})]})}const bk=["editor","tests","run","activation","history","leaderboard","deps","versions"];function jk(a){return a!=null&&bk.includes(a)}function Sk({hideHeader:a=!1}={}){var j;const{state:r,dispatch:i,saveContent:o,isReadOnly:u}=kn(),{state:m,refreshSkills:f,clearSelection:h}=ya(),x=v.useCallback(async()=>{try{await Ne.deleteSkill(r.plugin,r.skill),f(),h()}catch(S){const N=S instanceof Error?S.message:String(S);i({type:"SET_ERROR",error:`Failed to delete skill: ${N}`})}},[r.plugin,r.skill,f,h,i]);v.useEffect(()=>{const N=new URLSearchParams(window.location.search).get("panel");jk(N)&&N!==r.activePanel&&i({type:"SET_PANEL",panel:N})},[]),v.useEffect(()=>{const S=new URLSearchParams(window.location.search);S.set("panel",r.activePanel);const N=`${window.location.pathname}?${S.toString()}${window.location.hash}`;history.replaceState(null,"",N)},[r.activePanel]);const p=v.useCallback(S=>{const N=S.ctrlKey||S.metaKey;if(N&&S.key>="1"&&S.key<="8"){S.preventDefault(),i({type:"SET_PANEL",panel:["editor","tests","run","activation","history","leaderboard","deps","versions"][parseInt(S.key)-1]});return}if(N&&S.key==="s"&&!S.shiftKey){S.preventDefault(),r.isDirty&&o();return}},[r.isDirty,o,i]);if(v.useEffect(()=>(window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)),[p]),r.loading)return n.jsx("div",{className:"flex items-center justify-center h-full",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"flex flex-col items-center gap-3",children:[n.jsx("div",{className:"spinner spinner-lg"}),n.jsx("span",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"Loading workspace..."})]})});const y=Array.from(r.caseRunStates.values()).some(S=>S.status==="running"||S.status==="queued"),g=((j=m.skills.find(S=>S.skill===r.skill&&S.plugin===r.plugin))==null?void 0:j.updateAvailable)??!1;return n.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[!a&&n.jsx(Ud,{state:r,isReadOnly:u,onDelete:u?void 0:x}),r.error&&n.jsx("div",{className:"px-4 py-2",style:{borderBottom:"1px solid var(--border-subtle)"},children:n.jsx(zs,{error:F2(r.error),onDismiss:()=>i({type:"SET_ERROR",error:null})})}),n.jsx(q2,{activePanel:r.activePanel,onPanelChange:S=>i({type:"SET_PANEL",panel:S}),isDirty:r.isDirty,isRunning:y,hasRegressions:r.regressions.length>0,isActivationRunning:r.activationRunning,hasUpdate:g}),n.jsx(Y2,{children:n.jsx("div",{className:"flex-1 overflow-hidden",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"animate-fade-in",style:{height:"100%",overflow:"auto"},children:[r.activePanel==="editor"&&n.jsx(gS,{}),r.activePanel==="tests"&&n.jsx(CS,{}),r.activePanel==="run"&&n.jsx(HS,{}),r.activePanel==="activation"&&n.jsx(GS,{}),r.activePanel==="history"&&n.jsx(rk,{}),r.activePanel==="leaderboard"&&n.jsx(yk,{}),r.activePanel==="deps"&&n.jsx(uk,{}),r.activePanel==="versions"&&n.jsx(Wv,{})]},r.activePanel)})},`${r.plugin}/${r.skill}`)]})}function kk(a){const r={prompt:a.prompt,provider:a.provider,model:a.model};return a.targetAgents&&a.targetAgents.length>0&&(r.targetAgents=a.targetAgents),r}function yd(a,r=!0){let i=a.toLowerCase().replace(/[^a-z0-9]+/g,"-");return r&&(i=i.replace(/^-+|-+$/g,"")),i}function wk(a,r,i,o){const m=`.../${a.split("/").slice(-2).join("/")}`;switch(r){case 1:return`${m}/${i}/skills/${o}/SKILL.md`;case 2:return`${m}/plugins/${i}/skills/${o}/SKILL.md`;case 3:return`${m}/skills/${o}/SKILL.md`}}function Ck({onCreated:a,resolveAiConfigOverride:r}){const[i,o]=v.useState("ai"),[u,m]=v.useState(null),[f,h]=v.useState(!0),{config:x}=bl(),[p,y]=v.useState(""),[g,j]=v.useState(3),[S,N]=v.useState(""),[M,E]=v.useState(""),[k,T]=v.useState(""),[B,I]=v.useState(""),[L,V]=v.useState(""),[w,D]=v.useState(""),[A,O]=v.useState("write"),[G,q]=v.useState([]),[te,X]=v.useState(!1),[_,R]=v.useState(null),[U,se]=v.useState(""),[Y,me]=v.useState(!1),[z,W]=v.useState(!1),[ie,de]=v.useState(null),[ge,xe]=v.useState(null),[oe,ae]=v.useState([]),ve=v.useRef(null),Ie=v.useRef(null),Be=v.useRef(null),ne=v.useRef(null),[fe,ue]=v.useState(!1),[he,be]=v.useState(!1);v.useEffect(()=>{Ne.getProjectLayout().then(De=>{m(De),j(De.suggestedLayout);const xt=De.detectedLayouts.find(Kt=>Kt.layout===De.suggestedLayout);xt!=null&&xt.existingPlugins.length&&N(xt.existingPlugins[0])}).catch(()=>{}).finally(()=>h(!1))},[]),v.useEffect(()=>{var De;i==="ai"&&((De=ve.current)==null||De.focus())},[i]),v.useEffect(()=>()=>{var De;(De=Ie.current)==null||De.abort()},[]);const _e=v.useMemo(()=>{var De;return u?((De=u.detectedLayouts.find(xt=>xt.layout===g))==null?void 0:De.existingPlugins)||[]:[]},[u,g]),Me=S==="__new__"?M:S,dt=u?wk(u.root,g,Me||"{plugin}",p||"{skill}"):"",Zt=v.useMemo(()=>u?u.detectedLayouts.filter(De=>De.layout!==4):[],[u]),ct=v.useMemo(()=>{if(!u)return null;const De=u.detectedLayouts.find(nt=>nt.layout===2&&nt.existingPlugins.length>0),xt=u.detectedLayouts.find(nt=>nt.layout===1&&nt.existingPlugins.length>0),Kt=De||xt;return Kt?{layout:Kt.layout,plugins:Kt.existingPlugins}:null},[u]),Vt=v.useCallback(()=>{if(r)return r();if(!x)return{provider:"claude-cli",model:"sonnet"};const De=x.provider||"claude-cli",xt=x.model||"sonnet";return{provider:De,model:xt}},[x,r]),$t=v.useCallback(()=>{var De;(De=Ie.current)==null||De.abort(),me(!1)},[]),tt=v.useCallback(()=>{de(null),xe(null)},[]),jt=v.useCallback(async()=>{if(de(null),xe(null),ae([]),Be.current=null,!U.trim()){de("Describe what your skill should do");return}me(!0);const De=new AbortController;Ie.current=De;const{provider:xt,model:Kt}=Vt();try{const nt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(kk({prompt:U.trim(),provider:xt,model:Kt,targetAgents:G})),signal:De.signal});if(!nt.ok||!nt.body){let bt=`HTTP ${nt.status}`;try{const Bn=await nt.json();Bn.error&&(bt=Bn.error)}catch{}throw new Error(bt)}const Xa=nt.body.getReader(),Xn=new TextDecoder;let Ct="",St="";for(;;){const{done:bt,value:Bn}=await Xa.read();if(bt)break;Ct+=Xn.decode(Bn,{stream:!0});const Za=Ct.split(`
75
- `);Ct=Za.pop()||"";for(const Un of Za)if(Un.startsWith("event: "))St=Un.slice(7).trim();else if(Un.startsWith("data: ")){try{const Ve=JSON.parse(Un.slice(6));if(St==="progress")ae(Ut=>[...Ut,{phase:Ve.phase,message:Ve.message,timestamp:Date.now()}]);else if(St==="done"||St==="complete"){const Ut={prompt:U.trim(),provider:Vt().provider,model:Vt().model,reasoning:Ve.reasoning||""};if(y(Ve.name),T(Ve.description),I(Ve.model||""),V(Ve.allowedTools||""),D(Ve.body),W(!0),Be.current=Ut,o("manual"),Ve.suggestedPlugin&&typeof Ve.suggestedPlugin=="object"&&Ve.suggestedPlugin.plugin){const Nt=Ve.suggestedPlugin;if(((u==null?void 0:u.detectedLayouts.flatMap(wn=>wn.existingPlugins))??[]).includes(Nt.plugin))if(N(Nt.plugin),Nt.layout&&(Nt.layout===1||Nt.layout===2))j(Nt.layout);else{const wn=u==null?void 0:u.detectedLayouts.find(bo=>bo.existingPlugins.includes(Nt.plugin));wn&&(wn.layout===1||wn.layout===2)&&j(wn.layout)}else N("__new__"),E(Nt.plugin)}else g===3&&ct&&be(!0);const Zn={name:Ve.name,plugin:Me||"",layout:g,description:Ve.description,model:Ve.model||void 0,allowedTools:Ve.allowedTools||void 0,body:Ve.body,aiMeta:Ut};Ne.saveDraft(Zn).then(Nt=>{ue(!0),Nt!=null&&Nt.dir&&(ne.current=Nt.dir)}).catch(()=>{})}else St==="error"&&(de(Ve.message||Ve.description||"Unknown error"),Ve.category&&xe(Ve))}catch{}St=""}}}catch(nt){nt.name!=="AbortError"&&de(nt.message)}finally{me(!1),Ie.current=null}},[U,Vt,g,ct,Me,u,G]),ye=v.useCallback(async()=>{if(R(null),!p.trim()){R("Skill name is required");return}if(!k.trim()){R("Description is required");return}if(g!==3&&!Me.trim()){R("Plugin name is required");return}X(!0);try{const De=await Ne.createSkill({name:yd(p),plugin:Me||"",layout:g,description:k,model:B||void 0,allowedTools:L||void 0,body:w,aiMeta:Be.current||void 0,draftDir:ne.current||void 0});ne.current=null,a(De.plugin,De.skill)}catch(De){R(De.message)}finally{X(!1)}},[p,k,g,Me,B,L,w,a]),Rt=v.useCallback(()=>{ct&&(j(ct.layout),N(ct.plugins[0]),be(!1))},[ct]);return{mode:i,setMode:o,layout:u,layoutLoading:f,selectedLayout:g,setSelectedLayout:j,creatableLayouts:Zt,availablePlugins:_e,pathPreview:dt,plugin:S,setPlugin:N,newPlugin:M,setNewPlugin:E,effectivePlugin:Me,name:p,setName:y,description:k,setDescription:T,model:B,setModel:I,allowedTools:L,setAllowedTools:V,body:w,setBody:D,bodyViewMode:A,setBodyViewMode:O,aiPrompt:U,setAiPrompt:se,generating:Y,aiGenerated:z,aiError:ie,aiClassifiedError:ge,aiProgress:oe,promptRef:ve,handleGenerate:jt,handleCancelGenerate:$t,clearAiError:tt,targetAgents:G,setTargetAgents:q,draftSaved:fe,showPluginRecommendation:he,setShowPluginRecommendation:be,pluginLayoutInfo:ct,applyPluginRecommendation:Rt,creating:te,error:_,handleCreate:ye}}function cg(){return n.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function Nk(){return n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function ug({node:a,depth:r=0}){var i;return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",style:{paddingLeft:`${r*16}px`,color:a.type==="dir"?"var(--text-secondary)":"var(--text-tertiary)",fontSize:12,fontFamily:"var(--font-mono, monospace)"},children:[a.type==="dir"?n.jsx(cg,{}):n.jsx(Nk,{}),n.jsxs("span",{children:[a.name,a.type==="dir"?"/":""]})]}),(i=a.children)==null?void 0:i.map(o=>n.jsx(ug,{node:o,depth:r+1},o.name))]})}function Ek(a,r,i){const o=[];r&&o.push({name:"evals.json",type:"file"}),o.push({name:"history",type:"dir"});const u=[{name:"SKILL.md",type:"file"},{name:"evals",type:"dir",children:o}];return i&&u.push({name:"draft.json",type:"file"}),{name:a||"{skill}",type:"dir",children:u}}function Tk({skillName:a,hasEvals:r,isDraft:i}){const o=Ek(a,r,i);return n.jsxs("div",{className:"glass-card p-4",children:[n.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[n.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"var(--accent-muted)"},children:n.jsx(cg,{})}),"Skill Structure"]}),n.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-0)",border:"1px solid var(--border-subtle)"},children:n.jsx(ug,{node:o})})]})}const qa={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function td({size:a=14,color:r="currentColor"}){return n.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M12 3l1.912 5.813a2 2 0 001.275 1.275L21 12l-5.813 1.912a2 2 0 00-1.275 1.275L12 21l-1.912-5.813a2 2 0 00-1.275-1.275L3 12l5.813-1.912a2 2 0 001.275-1.275L12 3z"})})}function Rk({onCreated:a,onCancel:r}){const i=Ck({onCreated:a});return n.jsxs("div",{className:"px-8 py-6 max-w-4xl animate-fade-in overflow-auto h-full",children:[n.jsxs("div",{className:"mb-5",children:[n.jsx("h2",{className:"text-[20px] font-semibold tracking-tight",style:{color:"var(--text-primary)"},children:"Create a New Skill"}),n.jsx("div",{className:"flex items-center justify-between mt-2",children:n.jsxs("div",{className:"inline-flex rounded-lg p-0.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsx("button",{onClick:()=>i.setMode("ai"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:i.mode==="ai"?"rgba(168,85,247,0.15)":"transparent",color:i.mode==="ai"?"#a855f7":"var(--text-tertiary)",boxShadow:i.mode==="ai"?"0 1px 3px rgba(168,85,247,0.15)":"none",cursor:"pointer",border:"none"},children:n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx(td,{size:12}),"AI-Assisted"]})}),n.jsx("button",{onClick:()=>i.setMode("manual"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:i.mode==="manual"?"var(--surface-4, var(--surface-3))":"transparent",color:i.mode==="manual"?"var(--text-primary)":"var(--text-tertiary)",boxShadow:i.mode==="manual"?"0 1px 3px rgba(0,0,0,0.1)":"none",cursor:"pointer",border:"none"},children:"Manual"})]})})]}),i.layoutLoading&&n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"skeleton h-10 w-full rounded-lg"}),n.jsx("div",{className:"skeleton h-10 w-full rounded-lg"})]}),!i.layoutLoading&&i.layout&&i.mode==="ai"&&n.jsxs("div",{className:"space-y-4 animate-fade-in",children:[n.jsxs("div",{className:"glass-card p-4",children:[n.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[n.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:n.jsx(td,{size:11,color:"#a855f7"})}),"Describe Your Skill"]}),n.jsx("textarea",{ref:i.promptRef,value:i.aiPrompt,onChange:o=>i.setAiPrompt(o.target.value),placeholder:`e.g., A skill that helps format SQL queries, optimize them for performance, and explain query execution plans.
74
+ !Write me a poem about flowers`}),n.jsxs("div",{className:"flex items-center flex-wrap gap-x-3 gap-y-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:[n.jsx("span",{children:"One prompt per line"}),n.jsx(Xi,{}),n.jsx("span",{children:"No prefix = auto-classify"}),n.jsx(Xi,{}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"+"}),"= must activate"]}),n.jsx(Xi,{}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"!"}),"= must NOT activate"]}),n.jsx(Xi,{}),n.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[R," prompt",R!==1?"s":""]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:C,disabled:y||!k.trim(),className:"btn btn-primary",children:y?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"spinner",style:{borderTopColor:"var(--color-paper)",borderColor:"var(--border-default)",width:14,height:14}}),"Testing..."]}):n.jsxs(n.Fragment,{children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("circle",{cx:"12",cy:"12",r:"6"}),n.jsx("circle",{cx:"12",cy:"12",r:"2"})]}),"Run Activation Test"]})}),y&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:o,className:"btn btn-secondary text-[12px]",children:"Cancel"}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[S||`${x.length} / ${R} prompts tested`,j&&n.jsx(FS,{startedAt:j})]})]})]})]}),n.jsxs("div",{className:"glass-card flex flex-col overflow-hidden",children:[n.jsx("div",{className:"px-4 pt-3.5 pb-2.5 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Skill Description"})}),n.jsx("div",{className:"flex-1 overflow-auto px-4 py-3",style:{minHeight:0},children:q?n.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:X}}):n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No description available"})})]})]}),g&&n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:g}),y&&x.length===0&&n.jsxs("div",{className:"text-center py-12 animate-fade-in",children:[n.jsx("div",{className:"spinner-lg mx-auto mb-4"}),n.jsx("p",{className:"text-[14px]",style:{color:"var(--text-secondary)"},children:"Testing activation against skill description..."})]}),x.length>0&&n.jsxs("div",{className:"space-y-5",children:[P.length>0&&n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),n.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--red)"},children:["Incorrect (",P.length,")"]}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"— These need attention"})]}),n.jsx("div",{className:"space-y-1.5 stagger-children",children:P.map((_,E)=>n.jsx(Wx,{result:_},`incorrect-${E}`))})]}),I.length>0&&n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("polyline",{points:"16 10 11 15 8 12"})]}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--green)"},children:["Correct (",I.length,")"]})]}),n.jsx("div",{className:"space-y-1.5 stagger-children",children:I.map((_,E)=>n.jsx(Wx,{result:_},`correct-${E}`))})]})]}),p&&n.jsxs("div",{className:"glass-card p-6 animate-fade-in-scale",style:{borderColor:"var(--border-active)",borderWidth:2},children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-2",style:{color:"var(--text-tertiary)"},children:"Summary"}),p.autoClassifiedCount!=null&&p.autoClassifiedCount>0&&n.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:[p.autoClassifiedCount," of ",p.total," prompts auto-classified from skill name and tags"]}),n.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[n.jsx(Zu,{label:"Precision",value:p.precision,description:"Of all activations, how many were correct?",detail:`${p.tp} true / ${p.tp+p.fp} total activations`}),n.jsx(Zu,{label:"Recall",value:p.recall,description:"Of expected activations, how many fired?",detail:`${p.tp} activated / ${p.tp+p.fn} expected`}),n.jsx(Zu,{label:"Reliability",value:p.reliability,description:"Overall correct classification rate",detail:`${p.tp+p.tn} correct / ${p.total} total`})]}),n.jsxs("div",{className:"pt-4",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-3 text-center",style:{color:"var(--text-tertiary)"},children:"Confusion Matrix"}),n.jsxs("div",{className:"grid grid-cols-2 gap-2 max-w-xs mx-auto",children:[n.jsx(Zi,{label:"True Positive",abbr:"TP",count:p.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),n.jsx(Zi,{label:"False Positive",abbr:"FP",count:p.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),n.jsx(Zi,{label:"False Negative",abbr:"FN",count:p.fn,bg:"var(--red-muted)",color:"var(--red)",description:"Missed activation"}),n.jsx(Zi,{label:"True Negative",abbr:"TN",count:p.tn,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly silent"})]})]})]}),n.jsx(PS,{history:T,expanded:A,onToggle:()=>U(!A)})]})}function PS({history:a,expanded:r,onToggle:i}){return a===null?null:n.jsxs("div",{className:"glass-card overflow-hidden",children:[n.jsxs("button",{className:"w-full px-4 py-3 flex items-center justify-between text-left",style:{borderBottom:r?"1px solid var(--border-subtle)":"none"},onClick:i,children:[n.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:["Test History",a.length>0&&n.jsxs("span",{className:"ml-2 font-normal",style:{color:"var(--text-tertiary)"},children:["(",a.length," run",a.length!==1?"s":"",")"]})]}),n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:r?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),r&&n.jsx("div",{className:"px-4 py-3",children:a.length===0?n.jsx("div",{className:"text-[12px] py-4 text-center",style:{color:"var(--text-tertiary)"},children:"No test runs yet"}):n.jsx("div",{className:"space-y-2",children:a.map(o=>n.jsx(qS,{run:o},o.id))})})]})}function qS({run:a}){const r=Math.round(a.summary.reliability*100),i=r>=80?"var(--green)":r>=60?"var(--yellow)":"var(--red)",o=r>=80?"Good":r>=60?"Needs Work":"Poor",u=i;return n.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{background:"var(--surface-1)"},children:[n.jsx("div",{className:"flex-1 min-w-0",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:YS(a.timestamp)}),n.jsx("span",{className:"pill text-[9px] px-1.5",style:{background:"var(--surface-2)",color:"var(--text-tertiary)"},children:a.model||a.provider}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[a.promptCount," prompts"]})]})}),n.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:i,fontVariantNumeric:"tabular-nums"},children:[r,"%"]}),n.jsx("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded",style:{color:u,background:`color-mix(in srgb, ${u} 10%, transparent)`},children:o})]})]})}function YS(a){const r=Date.now(),i=new Date(a).getTime(),o=Math.floor((r-i)/1e3);if(o<60)return"just now";const u=Math.floor(o/60);if(u<60)return`${u}m ago`;const m=Math.floor(u/60);if(m<24)return`${m}h ago`;const f=Math.floor(m/24);return f<7?`${f}d ago`:new Date(a).toLocaleDateString()}function Xi(){return n.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function Wx({result:a}){const r=Fx[a.classification]||Fx.FN,i=a.classification==="TP"||a.classification==="TN";return n.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl transition-all duration-200",style:{background:r.bg,border:"1px solid transparent"},children:[n.jsx("div",{className:"flex-shrink-0 mt-0.5",children:n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:`color-mix(in srgb, ${r.text} 20%, transparent)`},children:i?n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:r.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:r.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"flex items-center gap-2 mb-1",children:n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:a.prompt})}),n.jsxs("div",{className:"flex items-center gap-3 text-[12px]",children:[n.jsx("span",{className:"pill",style:{background:"var(--surface-3)",color:r.text,fontWeight:700,fontSize:"10px",padding:"1px 6px"},children:a.classification}),n.jsx("span",{style:{color:a.activate?"var(--green)":"var(--text-tertiary)"},children:a.activate?"Activated":"Silent"}),n.jsxs("span",{style:{color:"var(--text-tertiary)"},children:["Expected: ",a.expected==="should_activate"?"activate":"stay silent"]}),n.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[a.confidence," confidence"]}),a.autoClassified&&n.jsx("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)",fontSize:"9px",padding:"1px 5px"},children:"auto"})]}),a.reasoning&&n.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--text-tertiary)"},children:a.reasoning})]})]})}function Zu({label:a,value:r,description:i,detail:o}){const u=Math.round(r*100),m=u>=80?"var(--green)":u>=60?"var(--yellow)":"var(--red)";return n.jsxs("div",{className:"text-center",children:[n.jsxs("div",{className:"text-[28px] font-bold tracking-tight",style:{color:m},children:[u,"%"]}),n.jsx("div",{className:"text-[12px] font-medium mt-0.5",style:{color:"var(--text-secondary)"},children:a}),n.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--text-tertiary)"},children:i}),n.jsx("div",{className:"text-[10px] mt-0.5 font-mono",style:{color:"var(--text-tertiary)"},children:o})]})}function Zi({abbr:a,count:r,bg:i,color:o,description:u}){return n.jsxs("div",{className:"text-center p-3 rounded-lg",style:{background:i},children:[n.jsx("div",{className:"text-[20px] font-bold",style:{color:o},children:r}),n.jsx("div",{className:"text-[11px] font-semibold",style:{color:o},children:a}),n.jsx("div",{className:"text-[9px] mt-0.5",style:{color:"var(--text-tertiary)"},children:u})]})}function FS({startedAt:a}){const[r,i]=v.useState(0);return v.useEffect(()=>{const o=setInterval(()=>i(Math.floor((Date.now()-a)/1e3)),1e3);return()=>clearInterval(o)},[a]),n.jsxs("span",{className:"ml-2",children:["(",r,"s)"]})}const Ju={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},Kx={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},gd=600,yd=180,tn=40,ed=gd-tn*2,Pa=yd-tn*2,WS=[25,50,75,100];function Qx(a){return new Date(a).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function KS(a){return a==null?"--":`${(a/1e3).toFixed(1)}s`}function QS({entries:a,onPointClick:r}){const[i,o]=v.useState(null),u=v.useMemo(()=>[...a].reverse(),[a]);if(u.length<2)return null;const m=u.length,f=u.map((p,y)=>{const g=tn+y/(m-1)*ed,j=p.passRate*100,S=tn+Pa-j/100*Pa;return{x:g,y:S,pct:j,entry:p}}),h=f.map(p=>`${p.x},${p.y}`).join(" "),x=Array.from(new Set(u.map(p=>p.type)));return n.jsxs("div",{className:"glass-card p-5 animate-fade-in",style:{position:"relative",overflowX:m>=20?"auto":void 0},children:[n.jsx("div",{className:"text-[13px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"Pass Rate Trend"}),n.jsx("div",{className:"flex items-center gap-5 mb-3",children:x.map(p=>n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:Ju[p]??"var(--text-tertiary)"}}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:Kx[p]??p})]},p))}),n.jsxs("svg",{width:gd,height:yd,viewBox:`0 0 ${gd} ${yd}`,style:{display:"block",overflow:"visible"},children:[WS.map(p=>{const y=tn+Pa-p/100*Pa;return n.jsxs("g",{children:[n.jsx("line",{x1:tn,y1:y,x2:tn+ed,y2:y,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),n.jsxs("text",{x:tn-8,y:y+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[p,"%"]})]},p)}),n.jsx("line",{x1:tn,y1:tn+Pa,x2:tn+ed,y2:tn+Pa,stroke:"var(--border-subtle)",strokeWidth:1}),n.jsx("text",{x:tn-8,y:tn+Pa+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:"0%"}),n.jsx("polyline",{points:h,fill:"none",stroke:"var(--border-subtle)",strokeWidth:1.5,strokeLinejoin:"round"}),f.map((p,y)=>n.jsx("circle",{cx:p.x,cy:p.y,r:5,fill:Ju[p.entry.type]??"var(--text-tertiary)",stroke:"var(--surface-2)",strokeWidth:2,style:{cursor:"pointer",transition:"r 0.15s ease"},onMouseEnter:g=>{g.currentTarget.setAttribute("r","7"),o({x:p.x,y:p.y,entry:p.entry})},onMouseLeave:g=>{g.currentTarget.setAttribute("r","5"),o(null)},onClick:()=>r==null?void 0:r(p.entry)},y)),XS(m).map(p=>n.jsx("text",{x:f[p].x,y:tn+Pa+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:Qx(u[p].timestamp)},p))]}),i&&n.jsxs("div",{style:{position:"absolute",left:i.x,top:i.y-12,transform:"translate(-50%, -100%)",background:"var(--surface-3)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"8px 12px",pointerEvents:"none",zIndex:10,whiteSpace:"nowrap"},children:[n.jsx("div",{className:"text-[11px] font-medium",style:{color:"var(--text-primary)"},children:Qx(i.entry.timestamp)}),n.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-tertiary)"},children:i.entry.model}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:Ju[i.entry.type]??"var(--text-tertiary)",color:"#fff"},children:Kx[i.entry.type]??i.entry.type}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:[Math.round(i.entry.passRate*100),"%"]})]}),n.jsxs("div",{className:"text-[10px] mt-1.5 flex items-center gap-3",style:{color:"var(--text-tertiary)"},children:[n.jsx("span",{children:KS(i.entry.totalDurationMs)}),n.jsx("span",{children:i.entry.totalTokens!=null?`${i.entry.totalTokens} tokens`:"--"})]})]})]})}function XS(a){if(a<=3)return Array.from({length:a},(o,u)=>u);if(a<=6)return[0,Math.floor(a/2),a-1];if(a<20)return[0,Math.floor(a/3),Math.floor(2*a/3),a-1];const r=Math.ceil(a/10),i=[0];for(let o=r;o<a-1;o+=r)i.push(o);return i.push(a-1),i}const xs=new Map;let nn=null,lo=null,Ji=1e3,vs=0;function ig(){if(nn)return;nn=new EventSource("/api/events");const a=r=>i=>{let o={};try{o=i.data?JSON.parse(i.data):{}}catch{}const u=xs.get(r);if(u)for(const m of u)m(o)};nn.addEventListener("benchmark:complete",a("benchmark:complete")),nn.addEventListener("history:written",a("history:written")),nn.addEventListener("leaderboard:updated",a("leaderboard:updated")),nn.onerror=()=>{nn==null||nn.close(),nn=null,vs>0&&(lo=setTimeout(()=>{Ji=Math.min(Ji*2,3e4),ig()},Ji))},nn.onopen=()=>{Ji=1e3}}function ZS(){lo!=null&&(clearTimeout(lo),lo=null),nn==null||nn.close(),nn=null}function JS(a,r){return xs.has(a)||xs.set(a,new Set),xs.get(a).add(r),vs++,ig(),()=>{var i;(i=xs.get(a))==null||i.delete(r),vs--,vs<=0&&(vs=0,ZS())}}function co(a,r){const i=v.useRef(r);i.current=r,v.useEffect(()=>JS(a,u=>i.current(u)),[a])}function uo(a){return a>=.8?"var(--green)":a>=.5?"var(--yellow)":"var(--red)"}function ek(a){return a>=1e3?`${(a/1e3).toFixed(1)}s`:`${Math.round(a)}ms`}function tk({rate:a,label:r}){const i=Math.round(a*100);return n.jsx("div",{className:"flex items-center gap-3",children:n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"flex items-center justify-between mb-1",children:[n.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-primary)",maxWidth:"70%"},children:r}),n.jsxs("span",{className:"text-[11px] font-semibold",style:{color:uo(a)},children:[i,"%"]})]}),n.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{background:"var(--surface-3)"},children:n.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${i}%`,background:uo(a)}})})]})})}function nk({points:a}){if(a.length<2)return null;const r=200,i=48,o=4,u=a.length,m=a.map((x,p)=>{const y=o+p/(u-1)*(r-o*2),g=o+(i-o*2)-x.passRate*(i-o*2);return{x:y,y:g}}),f=`M ${m[0].x},${i-o} `+m.map(x=>`L ${x.x},${x.y}`).join(" ")+` L ${m[m.length-1].x},${i-o} Z`,h=m.map((x,p)=>`${p===0?"M":"L"} ${x.x},${x.y}`).join(" ");return n.jsxs("svg",{width:r,height:i,style:{display:"block"},children:[n.jsx("path",{d:f,fill:"var(--accent-muted)"}),n.jsx("path",{d:h,fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),n.jsx("circle",{cx:m[m.length-1].x,cy:m[m.length-1].y,r:3,fill:"var(--accent)"})]})}function ak({plugin:a,skill:r}){const i=`stats/${a}/${r}`,o=v.useCallback(()=>Ne.getStats(a,r),[a,r]),{data:u,loading:m}=Ds(i,o),f=v.useCallback(()=>ga(i),[i]);if(co("benchmark:complete",f),co("history:written",f),m)return n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"skeleton h-24 rounded-xl"}),n.jsx("div",{className:"skeleton h-48 rounded-xl"}),n.jsx("div",{className:"skeleton h-36 rounded-xl"})]});if(!u||u.totalRuns===0)return n.jsxs("div",{className:"text-center py-12",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center mx-auto mb-3",style:{background:"var(--surface-2)"},children:n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",children:[n.jsx("path",{d:"M18 20V10"}),n.jsx("path",{d:"M12 20V4"}),n.jsx("path",{d:"M6 20v-6"})]})}),n.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark data yet"}),n.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"Run some benchmarks to see statistics"})]});const h=u.trendPoints.length>0?u.trendPoints[u.trendPoints.length-1].passRate:0,x=u.trendPoints.length>0?u.trendPoints[0].passRate:0,p=h-x,y=u.assertionStats.slice(0,10);return n.jsxs("div",{className:"space-y-4 stagger-children",children:[n.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Runs"}),n.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:u.totalRuns})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Latest Pass Rate"}),n.jsxs("div",{className:"text-[24px] font-bold",style:{color:uo(h)},children:[Math.round(h*100),"%"]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Trend"}),n.jsxs("div",{className:"text-[24px] font-bold",style:{color:p>=0?"var(--green)":"var(--red)"},children:[p>=0?"+":"",Math.round(p*100),"%"]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Models Tested"}),n.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:u.modelStats.length})]}),u.totalCost!=null&&n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Cost"}),n.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:Sn(u.totalCost)})]}),u.costPerRun!=null&&n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Avg Cost/Run"}),n.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:Sn(u.costPerRun)})]})]}),u.trendPoints.length>=2&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Pass Rate Over Time"}),n.jsx(nk,{points:u.trendPoints})]}),u.modelStats.length>0&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Model Performance"}),n.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[n.jsx("thead",{children:n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("th",{style:{textAlign:"left",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Model"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Runs"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Pass Rate"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Duration"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Cost"})]})}),n.jsx("tbody",{children:u.modelStats.map(g=>n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("td",{style:{padding:"8px",color:"var(--text-primary)",fontWeight:500},children:g.model}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:g.runs}),n.jsx("td",{style:{padding:"8px",textAlign:"center"},children:n.jsxs("span",{className:"font-semibold",style:{color:uo(g.avgPassRate)},children:[Math.round(g.avgPassRate*100),"%"]})}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:ek(g.avgDurationMs)}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:g.avgCost!=null?Sn(g.avgCost):"N/A"})]},g.model))})]})]}),y.length>0&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Weakest Assertions"}),n.jsx("div",{className:"space-y-3",children:y.map(g=>n.jsxs("button",{className:"block w-full text-left rounded-lg p-2 -mx-2 transition-colors duration-150",style:{background:"transparent"},onMouseEnter:j=>{j.currentTarget.style.background="var(--surface-2)"},onMouseLeave:j=>{j.currentTarget.style.background="transparent"},onClick:()=>{},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[n.jsxs("span",{className:"text-[10px] font-mono px-1 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",g.evalId]}),n.jsx("span",{className:"text-[10px] truncate",style:{color:"var(--text-tertiary)"},children:g.evalName}),n.jsxs("span",{className:"text-[10px] ml-auto flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[g.totalRuns," runs"]})]}),n.jsx(tk,{rate:g.passRate,label:g.text})]},`${g.evalId}:${g.id}`))})]})]})}function lk({plugin:a,skill:r}){const[i,o]=v.useState(null),[u,m]=v.useState(null),[f,h]=v.useState({}),[x,p]=v.useState({});v.useEffect(()=>{Ne.getEvals(a,r).then(o).catch(()=>o(null))},[a,r]);async function y(g){if(u===g){m(null);return}if(m(g),!f[g]){p(j=>({...j,[g]:!0}));try{const j=await Ne.getCaseHistory(a,r,g);h(S=>({...S,[g]:j}))}catch{h(j=>({...j,[g]:[]}))}finally{p(j=>({...j,[g]:!1}))}}}return i?n.jsx("div",{className:"space-y-2 stagger-children",children:i.evals.map(g=>{const j=f[g.id]||[],S=u===g.id,N=x[g.id],D=j.length>0?j[0].pass_rate:null;return n.jsxs("div",{className:"glass-card overflow-hidden",children:[n.jsxs("button",{onClick:()=>y(g.id),className:"w-full text-left p-4 flex items-center gap-3 transition-colors duration-150",style:{background:S?"var(--surface-2)":"transparent"},onMouseEnter:T=>{S||(T.currentTarget.style.background="var(--surface-2)")},onMouseLeave:T=>{S||(T.currentTarget.style.background="transparent")},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",style:{transform:S?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease",flexShrink:0},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),n.jsxs("span",{className:"text-[11px] font-mono px-1.5 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",g.id]}),n.jsx("span",{className:"text-[13px] font-medium flex-1 truncate",style:{color:"var(--text-primary)"},children:g.name}),j.length>=2&&n.jsx(ng,{entries:j}),D!=null&&n.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:mr(D)},children:[Math.round(D*100),"%"]}),j.length>0&&n.jsxs("span",{className:"text-[10px] flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[j.length," runs"]})]}),S&&n.jsx("div",{className:"border-t animate-fade-in",style:{borderColor:"var(--border-subtle)"},children:N?n.jsxs("div",{className:"p-4 flex items-center gap-2",children:[n.jsx("div",{className:"spinner",style:{width:14,height:14}}),n.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):j.length===0?n.jsx("div",{className:"p-4",children:n.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No history for this eval case"})}):n.jsx("div",{className:"divide-y",style:{borderColor:"var(--border-subtle)"},children:j.map((T,k)=>n.jsxs("div",{className:"p-4",style:{background:k===0?"var(--surface-2)":"transparent"},children:[n.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:eg(T.timestamp)}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:T.model}),n.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:T.type==="benchmark"?"rgba(99,131,255,0.15)":T.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:T.type==="benchmark"?"#6383ff":T.type==="comparison"?"var(--purple)":"#fb923c"},children:T.type}),n.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:mr(T.pass_rate)},children:[Math.round(T.pass_rate*100),"%"]})]}),n.jsxs("div",{className:"flex items-center gap-4 mb-2 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[T.durationMs!=null&&n.jsx("span",{children:tg(T.durationMs)}),T.tokens!=null&&n.jsxs("span",{children:[T.tokens>=1e3?`${(T.tokens/1e3).toFixed(1)}k`:T.tokens," tok"]})]}),n.jsx("div",{className:"space-y-1",children:T.assertions.map(M=>n.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[n.jsx("div",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:M.pass?"var(--green)":"var(--red)"},children:n.jsx("svg",{width:"7",height:"7",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",children:M.pass?n.jsx("polyline",{points:"20 6 9 17 4 12"}):n.jsxs(n.Fragment,{children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"text-[11px]",style:{color:"var(--text-primary)"},children:M.text}),M.reasoning&&n.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:M.reasoning})]})]},M.id))})]},k))})})]},g.id)})}):n.jsx("div",{className:"text-center py-12",children:n.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No eval cases found"})})}function rk(){const{state:a,dispatch:r}=kn(),{plugin:i,skill:o}=a,[u,m]=v.useState("timeline"),[f,h]=v.useState(""),[x,p]=v.useState(""),[y,g]=v.useState(!1),[j,S]=v.useState([]),[N,D]=v.useState(null),[T,k]=v.useState(!1),[M,B]=v.useState(null),[V,A]=v.useState(!1),U=`history/${i}/${o}?model=${f}&type=${x}`,C=v.useCallback(()=>Ne.getHistory(i,o,{model:f||void 0,type:x||void 0}),[i,o,f,x]),{data:z,loading:R}=Ds(U,C),I=z??[];v.useEffect(()=>{!z||z.length<2||Ne.compareRuns(i,o,z[0].timestamp,z[1].timestamp).then(_=>{const E=_.regressions.filter(O=>O.change==="regression");r({type:"SET_REGRESSIONS",regressions:E})}).catch(()=>{})},[z,i,o,r]);const P=v.useCallback(()=>ga(U),[U]);co("history:written",P);const q=v.useCallback(async _=>{if(y){S(E=>E.includes(_)?E.filter(O=>O!==_):E.length>=2?[E[1],_]:[...E,_]);return}A(!0);try{const E=await Ne.getHistoryEntry(i,o,_);B(E)}catch{}finally{A(!1)}},[i,o,y]),ee=v.useCallback(async()=>{if(j.length===2){k(!0);try{const _=await Ne.compareRuns(i,o,j[0],j[1]);D(_)}catch{}finally{k(!1)}}},[i,o,j]),X=[...new Set(I.map(_=>_.model))];return R?n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),n.jsx("div",{className:"skeleton h-48 rounded-xl mb-4"}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"skeleton h-12 rounded-lg"}),n.jsx("div",{className:"skeleton h-12 rounded-lg"})]})]}):n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"flex items-center gap-1 mb-4",children:["timeline","per-eval","statistics"].map(_=>n.jsx("button",{onClick:()=>m(_),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:u===_?"var(--accent-muted)":"transparent",color:u===_?"var(--accent)":"var(--text-tertiary)"},children:_==="timeline"?"Timeline":_==="per-eval"?"Per Eval":"Statistics"},_))}),u==="timeline"&&n.jsxs("div",{children:[I.length>0&&n.jsx("div",{className:"mb-5 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:n.jsx(QS,{entries:I,onPointClick:_=>q(_.timestamp)})}),n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("select",{value:f,onChange:_=>h(_.target.value),className:"input-field text-[12px]",style:{width:150},children:[n.jsx("option",{value:"",children:"All Models"}),X.map(_=>n.jsx("option",{value:_,children:_},_))]}),n.jsxs("select",{value:x,onChange:_=>p(_.target.value),className:"input-field text-[12px]",style:{width:150},children:[n.jsx("option",{value:"",children:"All Types"}),n.jsx("option",{value:"benchmark",children:"Benchmark"}),n.jsx("option",{value:"comparison",children:"Comparison"}),n.jsx("option",{value:"baseline",children:"Baseline"}),n.jsx("option",{value:"model-compare",children:"Model Compare"}),n.jsx("option",{value:"improve",children:"AI Improve"}),n.jsx("option",{value:"instruct",children:"AI Edit"}),n.jsx("option",{value:"ai-generate",children:"AI Generate"}),n.jsx("option",{value:"eval-generate",children:"Eval Generate"})]}),n.jsx("div",{className:"flex-1"}),n.jsx("button",{onClick:()=>{g(!y),S([]),D(null)},className:`btn text-[12px] ${y?"btn-primary":"btn-secondary"}`,children:y?"Exit Compare":"Compare Runs"}),y&&j.length===2&&n.jsx("button",{onClick:ee,disabled:T,className:"btn btn-primary text-[12px]",children:T?"Comparing...":"Compare"})]}),n.jsx("div",{className:"space-y-2",children:I.length===0?n.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):I.map(_=>{const E=j.includes(_.timestamp);return n.jsx("button",{onClick:()=>q(_.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:E?"var(--accent-muted)":"var(--surface-1)",border:E?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:O=>{E||(O.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:O=>{E||(O.currentTarget.style.borderColor="var(--border-subtle)")},children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[y&&n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:E?"var(--accent)":"var(--border-default)",background:E?"var(--accent)":"transparent"},children:E&&n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})}),n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:new Date(_.timestamp).toLocaleString()}),n.jsx("span",{className:"pill text-[9px]",style:{background:_.type==="comparison"?"var(--purple-muted)":_.type==="baseline"?"var(--surface-3)":_.type==="model-compare"?"var(--accent-muted)":_.type==="improve"||_.type==="instruct"?"var(--purple-muted)":_.type==="ai-generate"?"var(--green-muted)":_.type==="eval-generate"?"var(--orange-muted)":"var(--accent-muted)",color:_.type==="comparison"?"var(--purple)":_.type==="baseline"?"var(--text-tertiary)":_.type==="model-compare"?"var(--accent)":_.type==="improve"||_.type==="instruct"?"var(--purple)":_.type==="ai-generate"?"var(--green)":_.type==="eval-generate"?"var(--orange)":"var(--accent)"},children:_.type==="model-compare"?"model compare":_.type==="improve"?"ai improve":_.type==="instruct"?"ai edit":_.type==="ai-generate"?"ai generate":_.type==="eval-generate"?"eval generate":_.type})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:_.model}),_.totalCost!=null&&_.totalCost>0&&n.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--text-tertiary)"},children:Sn(_.totalCost)}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:_.passRate>=.8?"var(--green)":_.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(_.passRate*100),"%"]})]})]})},_.timestamp)})}),N&&n.jsx(sk,{result:N}),M&&!y&&n.jsx(ik,{run:M,onClose:()=>B(null)})]}),u==="per-eval"&&n.jsx(lk,{plugin:i,skill:o}),u==="statistics"&&n.jsx(ak,{plugin:i,skill:o})]})}function sk({result:a}){const r=a.regressions.filter(o=>o.change==="regression"),i=a.regressions.filter(o=>o.change==="improvement");return n.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Comparison: ",new Date(a.runA.timestamp).toLocaleDateString()," vs ",new Date(a.runB.timestamp).toLocaleDateString()]}),(a.runA.totalCost!=null||a.runB.totalCost!=null)&&n.jsxs("div",{className:"flex items-center gap-4 mb-3 text-[11px]",style:{color:"var(--text-secondary)"},children:[n.jsxs("span",{children:["Run A cost: ",Sn(a.runA.totalCost??null)]}),n.jsxs("span",{children:["Run B cost: ",Sn(a.runB.totalCost??null)]}),a.runA.totalCost!=null&&a.runB.totalCost!=null&&n.jsxs("span",{style:{color:a.runB.totalCost<=a.runA.totalCost?"var(--green)":"var(--red)"},children:["Delta: ",Sn(a.runB.totalCost-a.runA.totalCost)]})]}),r.length>0&&n.jsxs("div",{className:"mb-3",children:[n.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--red)"},children:["Regressions (",r.length,")"]}),r.map(o=>n.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",n.jsx("span",{style:{color:"var(--red)"},children:o.assertionId})," (was passing, now failing)"]},`${o.evalId}-${o.assertionId}`))]}),i.length>0&&n.jsxs("div",{className:"mb-3",children:[n.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--green)"},children:["Improvements (",i.length,")"]}),i.map(o=>n.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",n.jsx("span",{style:{color:"var(--green)"},children:o.assertionId})," (was failing, now passing)"]},`${o.evalId}-${o.assertionId}`))]}),n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 mt-3",style:{color:"var(--text-tertiary)"},children:"Case Diffs"}),n.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:n.jsxs("table",{className:"w-full text-[12px]",children:[n.jsx("thead",{children:n.jsxs("tr",{style:{background:"var(--surface-2)"},children:[n.jsx("th",{className:"text-left px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Case"}),n.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run A"}),n.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run B"})]})}),n.jsx("tbody",{children:a.caseDiffs.map(o=>n.jsxs("tr",{style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsxs("td",{className:"px-3 py-2",style:{color:"var(--text-secondary)"},children:["#",o.eval_id," ",o.eval_name]}),n.jsx("td",{className:"text-right px-3 py-2",style:{color:o.passRateA!=null?o.passRateA>=.8?"var(--green)":o.passRateA>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:o.passRateA!=null?`${Math.round(o.passRateA*100)}%`:o.statusA}),n.jsx("td",{className:"text-right px-3 py-2",style:{color:o.passRateB!=null?o.passRateB>=.8?"var(--green)":o.passRateB>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:o.passRateB!=null?`${Math.round(o.passRateB*100)}%`:o.statusB})]},o.eval_id))})]})})]})}function ik({run:a,onClose:r}){return(a.type==="improve"||a.type==="instruct")&&a.improve?n.jsx(ok,{run:a,onClose:r}):n.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:["Run: ",new Date(a.timestamp).toLocaleString()]}),n.jsx("button",{onClick:r,className:"btn btn-ghost text-[11px]",children:"Close"})]}),n.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:["Model: ",a.model," | Cases: ",a.cases.length," | Pass Rate: ",a.overall_pass_rate!=null?`${Math.round(a.overall_pass_rate*100)}%`:"--",a.totalCost!=null&&a.totalCost>0&&` | Cost: ${Sn(a.totalCost)}`]}),n.jsx("div",{className:"space-y-2",children:a.cases.map(i=>n.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)"},children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("span",{className:"text-[12px]",style:{color:"var(--text-secondary)"},children:["#",i.eval_id," ",i.eval_name]}),n.jsxs("div",{className:"flex items-center gap-2",children:[i.cost!=null&&i.cost>0&&n.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--text-tertiary)"},children:Sn(i.cost)}),n.jsx("span",{className:"text-[11px] font-semibold",style:{color:i.status==="pass"?"var(--green)":"var(--red)"},children:i.pass_rate!=null?`${Math.round(i.pass_rate*100)}%`:i.status})]})]})},i.eval_id))})]})}function ok({run:a,onClose:r}){var m;const i=v.useMemo(()=>a.improve?yo(a.improve.original,a.improve.improved):[],[a.improve]),o=v.useMemo(()=>{const f=i.filter(x=>x.type==="added").length,h=i.filter(x=>x.type==="removed").length;return{added:f,removed:h}},[i]),u=v.useMemo(()=>{let f=0,h=0;return i.map(x=>x.type==="removed"?(f++,{...x,origNum:f,newNum:null}):x.type==="added"?(h++,{...x,origNum:null,newNum:h}):(f++,h++,{...x,origNum:f,newNum:h}))},[i]);return n.jsxs("div",{className:"mt-4 rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{background:"var(--purple-muted)"},children:n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--purple)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),n.jsx("path",{d:"M2 17l10 5 10-5"}),n.jsx("path",{d:"M2 12l10 5 10-5"})]})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"}),n.jsxs("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[new Date(a.timestamp).toLocaleString()," · ",a.model]})]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsxs("span",{style:{color:"var(--green)"},children:["+",o.added]}),n.jsxs("span",{style:{color:"var(--red)"},children:["-",o.removed]})]}),n.jsx("button",{onClick:r,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:f=>{f.currentTarget.style.background="var(--surface-3)"},onMouseLeave:f=>{f.currentTarget.style.background="transparent"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),((m=a.improve)==null?void 0:m.reasoning)&&n.jsxs("div",{className:"mx-4 mt-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"var(--purple-muted)",border:"1px solid var(--purple-muted)",color:"var(--text-secondary)"},children:[n.jsx("span",{className:"font-semibold",style:{color:"var(--purple)"},children:"AI Reasoning: "}),a.improve.reasoning]}),n.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:480,overflowY:"auto"},children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:u.map((f,h)=>n.jsxs("tr",{style:{background:f.type==="added"?"var(--green-muted)":f.type==="removed"?"var(--red-muted)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:f.type==="removed"?"var(--red)":"var(--text-tertiary)",opacity:f.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:f.origNum??""}),n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:f.type==="added"?"var(--green)":"var(--text-tertiary)",opacity:f.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:f.newNum??""}),n.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:f.type==="added"?"var(--green)":f.type==="removed"?"var(--red)":"transparent",borderRight:f.type==="added"?"2px solid var(--green)":f.type==="removed"?"2px solid var(--red)":"2px solid transparent"},children:f.type==="added"?"+":f.type==="removed"?"-":" "}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:f.type==="added"?"var(--green)":f.type==="removed"?"var(--red)":"var(--text-secondary)"},children:f.content||"​"})]},h))})})})]})}function ck({plugin:a,skill:r}){const[i,o]=v.useState([]),[u,m]=v.useState([]),[f,h]=v.useState(!0),[x,p]=v.useState(null);v.useEffect(()=>{Ne.getDependencies(a,r).then(g=>{o(g.mcpDependencies),m(g.skillDependencies)}).catch(()=>{}).finally(()=>h(!1))},[a,r]);async function y(g,j){try{await navigator.clipboard.writeText(j),p(g),setTimeout(()=>p(null),2e3)}catch{}}return f?null:i.length===0&&u.length===0?n.jsx("div",{className:"mb-5 px-4 py-3 rounded-lg text-[12px]",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:"No dependencies detected"}):n.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsxs("div",{className:"flex items-center gap-2.5 px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(234,179,8,0.15)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#eab308",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),n.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Dependencies"}),n.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:i.length+u.length})]}),n.jsxs("div",{className:"px-5 py-4",children:[i.length>0&&n.jsxs("div",{className:"space-y-3 mb-4",children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"MCP Servers"}),i.map(g=>n.jsxs("div",{className:"p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:g.server}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:g.transport})]}),n.jsx("button",{onClick:()=>y(g.server,g.configSnippet),className:"btn btn-ghost text-[11px] py-1 px-2",style:{color:x===g.server?"var(--green)":"var(--accent)"},children:x===g.server?n.jsxs(n.Fragment,{children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})," Copied!"]}):n.jsxs(n.Fragment,{children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),n.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})," Copy Config"]})})]}),n.jsx("div",{className:"text-[11px] mb-2 font-mono",style:{color:"var(--text-tertiary)"},children:g.url}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:g.matchedTools.map(j=>n.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:j},j))})]},g.server))]}),u.length>0&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Skill Dependencies"}),n.jsx("div",{className:"space-y-1.5",children:u.map(g=>n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})}),n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:g.name}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:g.source==="frontmatter"?"frontmatter":"referenced"})]},g.name))})]})]})]})}function Xx({plugin:a,skill:r}){const[i,o]=v.useState([]),[u,m]=v.useState(!0),[f,h]=v.useState(null),[x,p]=v.useState(""),[y,g]=v.useState(!1),[j,S]=v.useState(null),[N,D]=v.useState(""),[T,k]=v.useState(""),[M,B]=v.useState(!1),[V,A]=v.useState(new Set),U=v.useCallback(async()=>{m(!0);try{const[I,P]=await Promise.all([Ne.getCredentials(a,r).catch(()=>({credentials:[]})),Ne.getParams(a,r).catch(()=>({params:[]}))]),q=new Map(P.params.map(_=>[_.name,_])),ee=new Set,X=[];for(const _ of I.credentials){ee.add(_.name);const E=q.get(_.name);X.push({name:_.name,status:_.status==="ready"||_.status==="resolved"?"ready":"missing",source:_.source,maskedValue:E==null?void 0:E.maskedValue})}for(const _ of P.params)ee.has(_.name)||X.push({name:_.name,status:_.status,maskedValue:_.maskedValue});o(X)}finally{m(!1)}},[a,r]);v.useEffect(()=>{U()},[U]);const C=v.useCallback(async I=>{if(V.has(I)){A(P=>{const q=new Set(P);return q.delete(I),q}),o(P=>P.map(q=>q.name===I?{...q,revealedValue:void 0}:q));return}try{const q=(await Ne.getParamsRevealed(a,r,I)).params.find(ee=>ee.name===I);q&&(o(ee=>ee.map(X=>X.name===I?{...X,revealedValue:q.value}:X)),A(ee=>new Set(ee).add(I)))}catch{}},[a,r,V]),z=async(I,P)=>{if(!(!I.trim()||!P.trim())){g(!0),S(null);try{await Ne.setCredential(a,r,I,P),h(null),p(""),A(new Set),U()}catch(q){S(q.message)}finally{g(!1)}}},R=async()=>{if(!(!N.trim()||!T.trim())){g(!0),S(null);try{await Ne.setCredential(a,r,N.trim().toUpperCase(),T),D(""),k(""),B(!1),U()}catch(I){S(I.message)}finally{g(!1)}}};return u?n.jsxs("div",{className:"mt-6",children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),n.jsx("div",{className:"skeleton h-20 rounded-xl"})]}):n.jsxs("div",{className:"mt-6",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),n.jsx("button",{onClick:()=>B(!M),className:"text-[11px] transition-colors duration-150",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"+ Add Parameter"})]}),j&&n.jsx("div",{className:"mb-2 px-3 py-2 rounded-lg text-[11px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:j}),i.length===0&&!M?n.jsx("div",{className:"text-[12px] text-center py-6 rounded-xl",style:{color:"var(--text-tertiary)",background:"var(--surface-2)"},children:"No credentials configured for this skill"}):n.jsx("div",{className:"rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:i.map(I=>n.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsx("span",{className:"text-[11px] font-mono font-medium truncate",style:{color:"var(--text-primary)",minWidth:80},children:I.name}),I.maskedValue&&n.jsx("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)",maxWidth:120},children:V.has(I.name)&&I.revealedValue!=null?I.revealedValue:I.maskedValue}),I.maskedValue&&n.jsx("button",{onClick:()=>C(I.name),className:"btn btn-ghost px-1",title:V.has(I.name)?"Hide value":"Reveal value",style:{color:"var(--text-tertiary)",lineHeight:1},children:V.has(I.name)?n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94"}),n.jsx("path",{d:"M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19"}),n.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),n.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:I.status==="ready"?"var(--green-muted)":"var(--orange-muted)",color:I.status==="ready"?"var(--green)":"var(--orange)"},children:I.status==="ready"?"ready":"missing"}),I.source&&n.jsx("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:I.source}),f===I.name?n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("input",{value:x,onChange:P=>p(P.target.value),onKeyDown:P=>{P.key==="Enter"&&z(I.name,x)},className:"input-field text-[11px] font-mono",style:{width:160},placeholder:"Value...",autoFocus:!0}),n.jsx("button",{onClick:()=>z(I.name,x),disabled:y||!x.trim(),className:"btn btn-primary text-[10px] px-2 py-0.5",children:y?"...":"Save"}),n.jsx("button",{onClick:()=>{h(null),p("")},className:"btn btn-ghost text-[10px] px-1",children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}):n.jsx("button",{onClick:()=>{h(I.name),p("")},className:"btn btn-ghost text-[10px] px-2 py-0.5",style:{color:"var(--accent)"},children:"Edit"})]},I.name))}),M&&n.jsxs("div",{className:"mt-2 p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex gap-2 mb-2",children:[n.jsx("input",{value:N,onChange:I=>D(I.target.value),className:"input-field flex-1 text-[11px] font-mono",placeholder:"KEY_NAME",autoFocus:!0}),n.jsx("input",{value:T,onChange:I=>k(I.target.value),onKeyDown:I=>{I.key==="Enter"&&R()},className:"input-field flex-1 text-[11px] font-mono",placeholder:"Value",type:"password"})]}),n.jsxs("div",{className:"flex justify-end gap-1.5",children:[n.jsx("button",{onClick:()=>{B(!1),D(""),k("")},className:"btn btn-ghost text-[10px]",children:"Cancel"}),n.jsx("button",{onClick:R,disabled:y||!N.trim()||!T.trim(),className:"btn btn-primary text-[10px]",children:y?"Saving...":"Save"})]})]})]})}function uk(){const{state:a}=kn(),{plugin:r,skill:i}=a,[o,u]=v.useState(null),[m,f]=v.useState(!0);return v.useEffect(()=>{Ne.getDependencies(r,i).then(u).catch(()=>{}).finally(()=>f(!1))},[r,i]),m?n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),n.jsx("div",{className:"skeleton h-32 rounded-xl"})]}):o?n.jsxs("div",{className:"p-5 max-w-3xl",children:[n.jsx(ck,{plugin:r,skill:i}),n.jsx(Xx,{plugin:r,skill:i})]}):n.jsxs("div",{className:"p-5 max-w-3xl",children:[n.jsx("div",{className:"text-[13px] mb-4",style:{color:"var(--text-tertiary)"},children:"No MCP dependency information available"}),n.jsx(Xx,{plugin:r,skill:i})]})}function og({data:a}){if(a.length<2)return n.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:"--"});const r=a.slice(-10),i=80,o=24,u=2,m=i-u*2,f=o-u*2,h=r.length,x=Math.min(...r),y=Math.max(...r)-x||1,g=r.map((N,D)=>{const T=u+D/(h-1)*m,k=u+f-(N-x)/y*f;return`${T.toFixed(1)},${k.toFixed(1)}`}),j=r[r.length-1],S=mr(j);return n.jsxs("svg",{width:i,height:o,viewBox:`0 0 ${i} ${o}`,style:{display:"block"},children:[n.jsx("polyline",{points:g.join(" "),fill:"none",stroke:S,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),(()=>{const[N,D]=g[g.length-1].split(",");return n.jsx("circle",{cx:N,cy:D,r:2.5,fill:S})})()]})}function dk(){return n.jsxs("span",{className:"pill",style:{background:"var(--yellow-muted)",color:"var(--yellow)",fontSize:9,fontWeight:700,gap:3},children:[n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"var(--yellow)",stroke:"none",children:n.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),"Best Model"]})}function fk({pct:a}){const r=a>=10?"var(--green)":a>=0?"var(--yellow)":"var(--red)",i=a>=10?"var(--green-muted)":a>=0?"var(--yellow-muted)":"var(--red-muted)",o=a>=0?"+":"";return n.jsxs("span",{className:"pill",style:{background:i,color:r,fontSize:10,fontWeight:600},children:[o,a.toFixed(1),"%"]})}function pk({score:a,rating:r}){const i={excellent:{bg:"var(--green-muted)",fg:"var(--green)"},good:{bg:"var(--green-muted)",fg:"var(--green)"},marginal:{bg:"var(--yellow-muted)",fg:"var(--yellow)"},minimal:{bg:"var(--yellow-muted)",fg:"var(--yellow)"},harmful:{bg:"var(--red-muted)",fg:"var(--red)"}},o=i[r]??i.minimal,u=a>=0?"+":"";return n.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"Skill Quality:"}),n.jsxs("span",{className:"pill",style:{background:o.bg,color:o.fg,fontSize:11,fontWeight:600},children:[u,a.toFixed(1),"% (",r.toUpperCase(),")"]})]})}function mk({warning:a}){return n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-3",style:{background:"var(--yellow-muted)",border:"1px solid var(--yellow-muted)"},children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--yellow)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),n.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),n.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--yellow)"},children:a})]})}function hk({active:a,onChange:r,hasBaseline:i}){return n.jsxs("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)"},children:[n.jsx("button",{onClick:()=>r("rankings"),className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:a==="rankings"?"var(--surface-3)":"transparent",color:a==="rankings"?"var(--text-primary)":"var(--text-tertiary)"},children:"Rankings"}),n.jsx("button",{onClick:()=>r("amplification"),disabled:!i,className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:a==="amplification"?"var(--surface-3)":"transparent",color:i&&a==="amplification"?"var(--text-primary)":"var(--text-tertiary)",opacity:i?1:.5,cursor:i?"pointer":"not-allowed"},title:i?"View skill amplification data":"Run sweep with --baseline to see amplification data",children:"Skill Amplification"})]})}function xk(a){var o,u,m;if(a.length===0)return[];const r=new Map;for(const f of a)for(const h of f.models){if(h.status==="error")continue;const x=`${h.provider}/${h.model}`;r.has(x)||r.set(x,{provider:h.provider,passRates:[],lastRubric:null,lastDuration:0,lastCost:null,lastBaselinePassRate:void 0,lastSkillDelta:void 0,lastAmplificationPct:void 0,lastCompositeScore:void 0,hasBaseline:!1});const p=r.get(x);p.passRates.push(h.passRate.mean),p.lastRubric=((o=h.rubricScore)==null?void 0:o.mean)??null,p.lastDuration=h.duration.mean,p.lastCost=((u=h.cost)==null?void 0:u.total)??null,p.lastCompositeScore=h.compositeScore,h.baselinePassRate!=null&&(p.lastBaselinePassRate=h.baselinePassRate.mean,p.lastSkillDelta=(m=h.skillDelta)==null?void 0:m.mean,p.lastAmplificationPct=h.amplificationPct,p.hasBaseline=!0)}const i=[];for(const[f,h]of r){const[x,...p]=f.split("/");i.push({rank:0,model:p.join("/"),provider:x,passRate:h.passRates[h.passRates.length-1],rubricScore:h.lastRubric,duration:h.lastDuration,cost:h.lastCost,sparklineData:h.passRates,isBest:!1,baselinePassRate:h.lastBaselinePassRate,skillDelta:h.lastSkillDelta,amplificationPct:h.lastAmplificationPct,compositeScore:h.lastCompositeScore,hasBaseline:h.hasBaseline})}return i.sort((f,h)=>{const x=f.compositeScore??f.passRate;return(h.compositeScore??h.passRate)-x}),i.forEach((f,h)=>{f.rank=h+1}),i.length>0&&(i[0].isBest=!0),i}const cg=(a="left")=>({padding:"10px 12px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary)",textAlign:a,whiteSpace:"nowrap"});function vk({entries:a}){return n.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:n.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[n.jsx("thead",{children:n.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","Pass Rate","Rubric","Duration","Cost","Trend"].map(r=>n.jsx("th",{style:cg(r==="#"?"center":"left"),children:r},r))})}),n.jsx("tbody",{children:a.map(r=>n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:i=>{i.currentTarget.style.background="var(--surface-2)"},onMouseLeave:i=>{i.currentTarget.style.background="transparent"},children:[n.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:r.rank}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:r.model}),n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:r.provider}),r.isBest&&n.jsx(dk,{})]})}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("span",{className:"pill",style:{background:r.passRate>=.7?"var(--green-muted)":r.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:mr(r.passRate),fontSize:11,fontWeight:600},children:[Math.round(r.passRate*100),"%"]})}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.rubricScore!=null?r.rubricScore.toFixed(1):"--"}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.duration<1e3?`${Math.round(r.duration)}ms`:`${(r.duration/1e3).toFixed(1)}s`}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.cost!=null?`$${r.cost.toFixed(4)}`:"N/A"}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsx(og,{data:r.sparklineData})})]},`${r.provider}/${r.model}`))})]})})}function gk({entries:a}){const r=[...a].filter(i=>i.hasBaseline).sort((i,o)=>(o.amplificationPct??0)-(i.amplificationPct??0));return r.length===0?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx("div",{className:"text-center",children:n.jsxs("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:["No baseline data available. Run sweep with ",n.jsx("code",{children:"--baseline"})," flag."]})})}):n.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:n.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[n.jsx("thead",{children:n.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","With Skill","Without Skill","Delta","Amplification","Trend"].map(i=>n.jsx("th",{style:cg(i==="#"?"center":"left"),children:i},i))})}),n.jsx("tbody",{children:r.map((i,o)=>n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:u=>{u.currentTarget.style.background="var(--surface-2)"},onMouseLeave:u=>{u.currentTarget.style.background="transparent"},children:[n.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:o+1}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:i.model}),n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:i.provider})]})}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("span",{className:"pill",style:{background:i.passRate>=.7?"var(--green-muted)":i.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:mr(i.passRate),fontSize:11,fontWeight:600},children:[Math.round(i.passRate*100),"%"]})}),n.jsx("td",{style:{padding:"10px 12px"},children:i.baselinePassRate!=null?n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:[Math.round(i.baselinePassRate*100),"%"]}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:i.skillDelta!=null?n.jsxs("span",{className:"text-[11px] font-medium",style:{color:i.skillDelta>=0?"var(--green)":"var(--red)"},children:[i.skillDelta>=0?"+":"",(i.skillDelta*100).toFixed(1),"pp"]}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:i.amplificationPct!=null&&isFinite(i.amplificationPct)?n.jsx(fk,{pct:i.amplificationPct}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsx(og,{data:i.sparklineData})})]},`${i.provider}/${i.model}`))})]})})}function yk(){const{state:a}=kn(),{plugin:r,skill:i}=a,[o,u]=v.useState("rankings"),m=`leaderboard/${r}/${i}`,f=v.useCallback(()=>Ne.getLeaderboard(r,i),[r,i]),{data:h,loading:x}=Ds(m,f),p=(h==null?void 0:h.entries)??[];v.useEffect(()=>{u("rankings")},[r,i]);const y=v.useCallback(()=>ga(m),[m]);co("leaderboard:updated",y);const g=v.useMemo(()=>xk(p),[p]),j=g.some(D=>D.hasBaseline),S=p[0],N=S==null?void 0:S.judgeBiasWarning;return x?n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsx("div",{className:"spinner spinner-lg"})}):g.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:"var(--accent-muted)"},children:n.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M18 20V10"}),n.jsx("path",{d:"M12 20V4"}),n.jsx("path",{d:"M6 20v-6"})]})}),n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No sweep results yet"}),n.jsx("div",{className:"text-[12px] mb-3",style:{color:"var(--text-tertiary)"},children:"Run your first model sweep to compare performance across models:"}),n.jsx("div",{className:"text-[11px] font-mono px-4 py-3 rounded-lg text-left",style:{background:"var(--surface-2)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)"},children:'vskill eval sweep --models "anthropic/claude-sonnet-4,openrouter/meta-llama/llama-3.1-70b" --judge "anthropic/claude-sonnet-4"'}),n.jsxs("div",{className:"text-[11px] mt-2",style:{color:"var(--text-tertiary)"},children:["Add ",n.jsx("code",{children:"--baseline"})," to measure skill amplification per model."]})]})]}):n.jsxs("div",{className:"p-5 animate-fade-in",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"text-[15px] font-semibold",style:{color:"var(--text-primary)"},children:"Model Leaderboard"}),n.jsx(hk,{active:o,onChange:u,hasBaseline:j})]}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[p.length," sweep",p.length!==1?"s":""," · ",g.length," model",g.length!==1?"s":""]})]}),N&&n.jsx(mk,{warning:N}),o==="rankings"?n.jsx(vk,{entries:g}):n.jsx(gk,{entries:g}),o==="amplification"&&(S==null?void 0:S.skillQualityScore)!=null&&(S==null?void 0:S.skillQualityRating)&&n.jsx(pk,{score:S.skillQualityScore,rating:S.skillQualityRating})]})}const bk=["editor","tests","run","activation","history","leaderboard","deps","versions"];function jk(a){return a!=null&&bk.includes(a)}function Sk({hideHeader:a=!1}={}){var j;const{state:r,dispatch:i,saveContent:o,isReadOnly:u}=kn(),{state:m,refreshSkills:f,clearSelection:h}=ya(),x=v.useCallback(async()=>{try{await Ne.deleteSkill(r.plugin,r.skill),f(),h()}catch(S){const N=S instanceof Error?S.message:String(S);i({type:"SET_ERROR",error:`Failed to delete skill: ${N}`})}},[r.plugin,r.skill,f,h,i]);v.useEffect(()=>{const N=new URLSearchParams(window.location.search).get("panel");jk(N)&&N!==r.activePanel&&i({type:"SET_PANEL",panel:N})},[]),v.useEffect(()=>{const S=new URLSearchParams(window.location.search);S.set("panel",r.activePanel);const N=`${window.location.pathname}?${S.toString()}${window.location.hash}`;history.replaceState(null,"",N)},[r.activePanel]);const p=v.useCallback(S=>{const N=S.ctrlKey||S.metaKey;if(N&&S.key>="1"&&S.key<="8"){S.preventDefault(),i({type:"SET_PANEL",panel:["editor","tests","run","activation","history","leaderboard","deps","versions"][parseInt(S.key)-1]});return}if(N&&S.key==="s"&&!S.shiftKey){S.preventDefault(),r.isDirty&&o();return}},[r.isDirty,o,i]);if(v.useEffect(()=>(window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)),[p]),r.loading)return n.jsx("div",{className:"flex items-center justify-center h-full",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"flex flex-col items-center gap-3",children:[n.jsx("div",{className:"spinner spinner-lg"}),n.jsx("span",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"Loading workspace..."})]})});const y=Array.from(r.caseRunStates.values()).some(S=>S.status==="running"||S.status==="queued"),g=((j=m.skills.find(S=>S.skill===r.skill&&S.plugin===r.plugin))==null?void 0:j.updateAvailable)??!1;return n.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[!a&&n.jsx(Hd,{state:r,isReadOnly:u,onDelete:u?void 0:x}),r.error&&n.jsx("div",{className:"px-4 py-2",style:{borderBottom:"1px solid var(--border-subtle)"},children:n.jsx(zs,{error:F2(r.error),onDismiss:()=>i({type:"SET_ERROR",error:null})})}),n.jsx(q2,{activePanel:r.activePanel,onPanelChange:S=>i({type:"SET_PANEL",panel:S}),isDirty:r.isDirty,isRunning:y,hasRegressions:r.regressions.length>0,isActivationRunning:r.activationRunning,hasUpdate:g}),n.jsx(Y2,{children:n.jsx("div",{className:"flex-1 overflow-hidden",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"animate-fade-in",style:{height:"100%",overflow:"auto"},children:[r.activePanel==="editor"&&n.jsx(gS,{}),r.activePanel==="tests"&&n.jsx(CS,{}),r.activePanel==="run"&&n.jsx(HS,{}),r.activePanel==="activation"&&n.jsx(GS,{}),r.activePanel==="history"&&n.jsx(rk,{}),r.activePanel==="leaderboard"&&n.jsx(yk,{}),r.activePanel==="deps"&&n.jsx(uk,{}),r.activePanel==="versions"&&n.jsx(Qv,{})]},r.activePanel)})},`${r.plugin}/${r.skill}`)]})}function kk(a){const r={prompt:a.prompt,provider:a.provider,model:a.model};return a.targetAgents&&a.targetAgents.length>0&&(r.targetAgents=a.targetAgents),r}function bd(a,r=!0){let i=a.toLowerCase().replace(/[^a-z0-9]+/g,"-");return r&&(i=i.replace(/^-+|-+$/g,"")),i}function wk(a,r,i,o){const m=`.../${a.split("/").slice(-2).join("/")}`;switch(r){case 1:return`${m}/${i}/skills/${o}/SKILL.md`;case 2:return`${m}/plugins/${i}/skills/${o}/SKILL.md`;case 3:return`${m}/skills/${o}/SKILL.md`}}function Ck({onCreated:a,resolveAiConfigOverride:r}){const[i,o]=v.useState("ai"),[u,m]=v.useState(null),[f,h]=v.useState(!0),{config:x}=bl(),[p,y]=v.useState(""),[g,j]=v.useState(3),[S,N]=v.useState(""),[D,T]=v.useState(""),[k,M]=v.useState(""),[B,V]=v.useState(""),[A,U]=v.useState(""),[C,z]=v.useState(""),[R,I]=v.useState("write"),[P,q]=v.useState([]),[ee,X]=v.useState(!1),[_,E]=v.useState(null),[O,te]=v.useState(""),[Y,me]=v.useState(!1),[L,F]=v.useState(!1),[ie,de]=v.useState(null),[ge,xe]=v.useState(null),[oe,le]=v.useState([]),ve=v.useRef(null),Ue=v.useRef(null),Be=v.useRef(null),ae=v.useRef(null),[fe,ue]=v.useState(!1),[he,be]=v.useState(!1);v.useEffect(()=>{Ne.getProjectLayout().then(De=>{m(De),j(De.suggestedLayout);const xt=De.detectedLayouts.find(Wt=>Wt.layout===De.suggestedLayout);xt!=null&&xt.existingPlugins.length&&N(xt.existingPlugins[0])}).catch(()=>{}).finally(()=>h(!1))},[]),v.useEffect(()=>{var De;i==="ai"&&((De=ve.current)==null||De.focus())},[i]),v.useEffect(()=>()=>{var De;(De=Ue.current)==null||De.abort()},[]);const _e=v.useMemo(()=>{var De;return u?((De=u.detectedLayouts.find(xt=>xt.layout===g))==null?void 0:De.existingPlugins)||[]:[]},[u,g]),Me=S==="__new__"?D:S,dt=u?wk(u.root,g,Me||"{plugin}",p||"{skill}"):"",Zt=v.useMemo(()=>u?u.detectedLayouts.filter(De=>De.layout!==4):[],[u]),ct=v.useMemo(()=>{if(!u)return null;const De=u.detectedLayouts.find(nt=>nt.layout===2&&nt.existingPlugins.length>0),xt=u.detectedLayouts.find(nt=>nt.layout===1&&nt.existingPlugins.length>0),Wt=De||xt;return Wt?{layout:Wt.layout,plugins:Wt.existingPlugins}:null},[u]),Vt=v.useCallback(()=>{if(r)return r();if(!x)return{provider:"claude-cli",model:"sonnet"};const De=x.provider||"claude-cli",xt=x.model||"sonnet";return{provider:De,model:xt}},[x,r]),$t=v.useCallback(()=>{var De;(De=Ue.current)==null||De.abort(),me(!1)},[]),tt=v.useCallback(()=>{de(null),xe(null)},[]),jt=v.useCallback(async()=>{if(de(null),xe(null),le([]),Be.current=null,!O.trim()){de("Describe what your skill should do");return}me(!0);const De=new AbortController;Ue.current=De;const{provider:xt,model:Wt}=Vt();try{const nt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(kk({prompt:O.trim(),provider:xt,model:Wt,targetAgents:P})),signal:De.signal});if(!nt.ok||!nt.body){let bt=`HTTP ${nt.status}`;try{const Bn=await nt.json();Bn.error&&(bt=Bn.error)}catch{}throw new Error(bt)}const Xa=nt.body.getReader(),Xn=new TextDecoder;let Ct="",St="";for(;;){const{done:bt,value:Bn}=await Xa.read();if(bt)break;Ct+=Xn.decode(Bn,{stream:!0});const Za=Ct.split(`
75
+ `);Ct=Za.pop()||"";for(const In of Za)if(In.startsWith("event: "))St=In.slice(7).trim();else if(In.startsWith("data: ")){try{const Ve=JSON.parse(In.slice(6));if(St==="progress")le(It=>[...It,{phase:Ve.phase,message:Ve.message,timestamp:Date.now()}]);else if(St==="done"||St==="complete"){const It={prompt:O.trim(),provider:Vt().provider,model:Vt().model,reasoning:Ve.reasoning||""};if(y(Ve.name),M(Ve.description),V(Ve.model||""),U(Ve.allowedTools||""),z(Ve.body),F(!0),Be.current=It,o("manual"),Ve.suggestedPlugin&&typeof Ve.suggestedPlugin=="object"&&Ve.suggestedPlugin.plugin){const Nt=Ve.suggestedPlugin;if(((u==null?void 0:u.detectedLayouts.flatMap(wn=>wn.existingPlugins))??[]).includes(Nt.plugin))if(N(Nt.plugin),Nt.layout&&(Nt.layout===1||Nt.layout===2))j(Nt.layout);else{const wn=u==null?void 0:u.detectedLayouts.find(bo=>bo.existingPlugins.includes(Nt.plugin));wn&&(wn.layout===1||wn.layout===2)&&j(wn.layout)}else N("__new__"),T(Nt.plugin)}else g===3&&ct&&be(!0);const Zn={name:Ve.name,plugin:Me||"",layout:g,description:Ve.description,model:Ve.model||void 0,allowedTools:Ve.allowedTools||void 0,body:Ve.body,aiMeta:It};Ne.saveDraft(Zn).then(Nt=>{ue(!0),Nt!=null&&Nt.dir&&(ae.current=Nt.dir)}).catch(()=>{})}else St==="error"&&(de(Ve.message||Ve.description||"Unknown error"),Ve.category&&xe(Ve))}catch{}St=""}}}catch(nt){nt.name!=="AbortError"&&de(nt.message)}finally{me(!1),Ue.current=null}},[O,Vt,g,ct,Me,u,P]),ye=v.useCallback(async()=>{if(E(null),!p.trim()){E("Skill name is required");return}if(!k.trim()){E("Description is required");return}if(g!==3&&!Me.trim()){E("Plugin name is required");return}X(!0);try{const De=await Ne.createSkill({name:bd(p),plugin:Me||"",layout:g,description:k,model:B||void 0,allowedTools:A||void 0,body:C,aiMeta:Be.current||void 0,draftDir:ae.current||void 0});ae.current=null,a(De.plugin,De.skill)}catch(De){E(De.message)}finally{X(!1)}},[p,k,g,Me,B,A,C,a]),Rt=v.useCallback(()=>{ct&&(j(ct.layout),N(ct.plugins[0]),be(!1))},[ct]);return{mode:i,setMode:o,layout:u,layoutLoading:f,selectedLayout:g,setSelectedLayout:j,creatableLayouts:Zt,availablePlugins:_e,pathPreview:dt,plugin:S,setPlugin:N,newPlugin:D,setNewPlugin:T,effectivePlugin:Me,name:p,setName:y,description:k,setDescription:M,model:B,setModel:V,allowedTools:A,setAllowedTools:U,body:C,setBody:z,bodyViewMode:R,setBodyViewMode:I,aiPrompt:O,setAiPrompt:te,generating:Y,aiGenerated:L,aiError:ie,aiClassifiedError:ge,aiProgress:oe,promptRef:ve,handleGenerate:jt,handleCancelGenerate:$t,clearAiError:tt,targetAgents:P,setTargetAgents:q,draftSaved:fe,showPluginRecommendation:he,setShowPluginRecommendation:be,pluginLayoutInfo:ct,applyPluginRecommendation:Rt,creating:ee,error:_,handleCreate:ye}}function ug(){return n.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function Nk(){return n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function dg({node:a,depth:r=0}){var i;return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",style:{paddingLeft:`${r*16}px`,color:a.type==="dir"?"var(--text-secondary)":"var(--text-tertiary)",fontSize:12,fontFamily:"var(--font-mono, monospace)"},children:[a.type==="dir"?n.jsx(ug,{}):n.jsx(Nk,{}),n.jsxs("span",{children:[a.name,a.type==="dir"?"/":""]})]}),(i=a.children)==null?void 0:i.map(o=>n.jsx(dg,{node:o,depth:r+1},o.name))]})}function Ek(a,r,i){const o=[];r&&o.push({name:"evals.json",type:"file"}),o.push({name:"history",type:"dir"});const u=[{name:"SKILL.md",type:"file"},{name:"evals",type:"dir",children:o}];return i&&u.push({name:"draft.json",type:"file"}),{name:a||"{skill}",type:"dir",children:u}}function Tk({skillName:a,hasEvals:r,isDraft:i}){const o=Ek(a,r,i);return n.jsxs("div",{className:"glass-card p-4",children:[n.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[n.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"var(--accent-muted)"},children:n.jsx(ug,{})}),"Skill Structure"]}),n.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-0)",border:"1px solid var(--border-subtle)"},children:n.jsx(dg,{node:o})})]})}const qa={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function td({size:a=14,color:r="currentColor"}){return n.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M12 3l1.912 5.813a2 2 0 001.275 1.275L21 12l-5.813 1.912a2 2 0 00-1.275 1.275L12 21l-1.912-5.813a2 2 0 00-1.275-1.275L3 12l5.813-1.912a2 2 0 001.275-1.275L12 3z"})})}function Rk({onCreated:a,onCancel:r}){const i=Ck({onCreated:a});return n.jsxs("div",{className:"px-8 py-6 max-w-4xl animate-fade-in overflow-auto h-full",children:[n.jsxs("div",{className:"mb-5",children:[n.jsx("h2",{className:"text-[20px] font-semibold tracking-tight",style:{color:"var(--text-primary)"},children:"Create a New Skill"}),n.jsx("div",{className:"flex items-center justify-between mt-2",children:n.jsxs("div",{className:"inline-flex rounded-lg p-0.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsx("button",{onClick:()=>i.setMode("ai"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:i.mode==="ai"?"rgba(168,85,247,0.15)":"transparent",color:i.mode==="ai"?"#a855f7":"var(--text-tertiary)",boxShadow:i.mode==="ai"?"0 1px 3px rgba(168,85,247,0.15)":"none",cursor:"pointer",border:"none"},children:n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx(td,{size:12}),"AI-Assisted"]})}),n.jsx("button",{onClick:()=>i.setMode("manual"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:i.mode==="manual"?"var(--surface-4, var(--surface-3))":"transparent",color:i.mode==="manual"?"var(--text-primary)":"var(--text-tertiary)",boxShadow:i.mode==="manual"?"0 1px 3px rgba(0,0,0,0.1)":"none",cursor:"pointer",border:"none"},children:"Manual"})]})})]}),i.layoutLoading&&n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"skeleton h-10 w-full rounded-lg"}),n.jsx("div",{className:"skeleton h-10 w-full rounded-lg"})]}),!i.layoutLoading&&i.layout&&i.mode==="ai"&&n.jsxs("div",{className:"space-y-4 animate-fade-in",children:[n.jsxs("div",{className:"glass-card p-4",children:[n.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[n.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:n.jsx(td,{size:11,color:"#a855f7"})}),"Describe Your Skill"]}),n.jsx("textarea",{ref:i.promptRef,value:i.aiPrompt,onChange:o=>i.setAiPrompt(o.target.value),placeholder:`e.g., A skill that helps format SQL queries, optimize them for performance, and explain query execution plans.
76
76
 
77
- Include any specific behaviors, constraints, or output formats you want.`,rows:5,disabled:i.generating,className:"w-full px-3 py-2.5 rounded-lg text-[13px] resize-y",style:{...qa,minHeight:"120px"},onKeyDown:o=>{o.key==="Enter"&&(o.metaKey||o.ctrlKey)&&(o.preventDefault(),i.handleGenerate())}}),n.jsx("p",{className:"text-[11px] mt-2",style:{color:"var(--text-quaternary, var(--text-tertiary))"},children:"Cmd+Enter to generate"})]}),i.generating&&i.aiProgress.length>0&&n.jsx(Ls,{entries:i.aiProgress,isRunning:!0}),i.aiError&&n.jsx("div",{children:i.aiClassifiedError?n.jsx(zs,{error:i.aiClassifiedError,onRetry:i.handleGenerate,onDismiss:i.clearAiError}):n.jsxs("div",{children:[n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:i.aiError}),n.jsx("button",{onClick:i.handleGenerate,className:"mt-2 text-[12px] font-medium",style:{color:"#a855f7",background:"none",border:"none",cursor:"pointer"},children:"Retry"})]})}),n.jsxs("div",{className:"flex items-center gap-3",children:[i.generating?n.jsx("button",{onClick:i.handleCancelGenerate,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:"var(--surface-3)",color:"var(--text-secondary)",border:"none",cursor:"pointer"},children:"Cancel Generation"}):n.jsxs("button",{onClick:i.handleGenerate,disabled:!i.aiPrompt.trim(),className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:i.aiPrompt.trim()?"#a855f7":"var(--surface-3)",color:i.aiPrompt.trim()?"#fff":"var(--text-tertiary)",cursor:i.aiPrompt.trim()?"pointer":"not-allowed",border:"none"},children:[n.jsx(td,{size:14}),"Generate"]}),n.jsx("button",{onClick:r,className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"}),!i.generating&&n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:["or fill in the form manually",n.jsx("button",{onClick:()=>i.setMode("manual"),className:"ml-1 font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"below"})]})]})]}),!i.layoutLoading&&i.layout&&i.mode==="manual"&&n.jsxs("div",{className:"space-y-4 animate-fade-in",children:[n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Location"}),i.creatableLayouts.length>1&&n.jsxs("div",{className:"mb-3",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Layout"}),n.jsx("div",{className:"flex gap-2",children:i.creatableLayouts.map(o=>n.jsx("button",{onClick:()=>{i.setSelectedLayout(o.layout),i.setPlugin(o.existingPlugins[0]||""),i.setNewPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:i.selectedLayout===o.layout?"var(--accent)":"var(--surface-3)",color:i.selectedLayout===o.layout?"#fff":"var(--text-secondary)",border:`1px solid ${i.selectedLayout===o.layout?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},children:o.label},o.layout))})]}),i.selectedLayout!==3&&n.jsxs("div",{className:"mb-3",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Plugin"}),n.jsxs("select",{value:i.plugin,onChange:o=>{i.setPlugin(o.target.value),i.setNewPlugin("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa,children:[i.availablePlugins.map(o=>n.jsx("option",{value:o,children:o},o)),n.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),i.plugin==="__new__"&&n.jsx("input",{type:"text",value:i.newPlugin,onChange:o=>i.setNewPlugin(yd(o.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:qa})]}),n.jsx("div",{className:"px-3 py-2 rounded-lg text-[11px] font-mono",style:{background:"var(--surface-0)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:i.pathPreview})]}),i.showPluginRecommendation&&i.pluginLayoutInfo&&i.selectedLayout===3&&n.jsxs("div",{className:"px-4 py-3 rounded-lg text-[12px] animate-fade-in flex items-center justify-between gap-3",style:{background:"rgba(59,130,246,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(59,130,246,0.2)"},children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#3b82f6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),n.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),n.jsxs("span",{children:["Plugins detected (",n.jsx("strong",{children:i.pluginLayoutInfo.plugins.slice(0,3).join(", ")}),"). Add this skill to a plugin for better organization."]})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsx("button",{onClick:i.applyPluginRecommendation,className:"px-3 py-1 rounded-md text-[11px] font-medium",style:{background:"#3b82f6",color:"#fff",border:"none",cursor:"pointer"},children:"Use plugin"}),n.jsx("button",{onClick:()=>i.setShowPluginRecommendation(!1),className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Skill Details"}),n.jsxs("div",{className:"mb-3",children:[n.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Name ",n.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),n.jsx("input",{type:"text",value:i.name,onChange:o=>i.setName(yd(o.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa})]}),n.jsxs("div",{className:"mb-3",children:[n.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Description ",n.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),n.jsx("textarea",{value:i.description,onChange:o=>i.setDescription(o.target.value),placeholder:"Brief description",rows:3,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-y",style:{...qa,minHeight:"72px"}})]}),n.jsxs("div",{className:"flex gap-3",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),n.jsxs("select",{value:i.model,onChange:o=>i.setModel(o.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa,children:[n.jsx("option",{value:"",children:"Any"}),n.jsx("option",{value:"opus",children:"Opus"}),n.jsx("option",{value:"sonnet",children:"Sonnet"}),n.jsx("option",{value:"haiku",children:"Haiku"})]})]}),n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Allowed Tools"}),n.jsx("input",{type:"text",value:i.allowedTools,onChange:o=>i.setAllowedTools(o.target.value),placeholder:"Read, Write, Edit...",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa})]})]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--accent-muted)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"}),n.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),n.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),n.jsxs("div",{children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md"}),n.jsx("span",{className:"text-[11px] ml-2",style:{color:"var(--text-tertiary)"},children:"Skill Definition"})]})]}),n.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:["write","preview"].map(o=>n.jsxs("button",{onClick:()=>i.setBodyViewMode(o),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:i.bodyViewMode===o?"var(--surface-4)":"transparent",color:i.bodyViewMode===o?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:i.bodyViewMode===o?600:400,border:"none",cursor:"pointer"},children:[o==="write"?n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"16 18 22 12 16 6"}),n.jsx("polyline",{points:"8 6 2 12 8 18"})]}):n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),n.jsx("span",{children:o==="write"?"Write":"Preview"})]},o))})]}),i.bodyViewMode==="write"?n.jsx("textarea",{value:i.body,onChange:o=>i.setBody(o.target.value),placeholder:`# /my-skill
77
+ Include any specific behaviors, constraints, or output formats you want.`,rows:5,disabled:i.generating,className:"w-full px-3 py-2.5 rounded-lg text-[13px] resize-y",style:{...qa,minHeight:"120px"},onKeyDown:o=>{o.key==="Enter"&&(o.metaKey||o.ctrlKey)&&(o.preventDefault(),i.handleGenerate())}}),n.jsx("p",{className:"text-[11px] mt-2",style:{color:"var(--text-quaternary, var(--text-tertiary))"},children:"Cmd+Enter to generate"})]}),i.generating&&i.aiProgress.length>0&&n.jsx(Ls,{entries:i.aiProgress,isRunning:!0}),i.aiError&&n.jsx("div",{children:i.aiClassifiedError?n.jsx(zs,{error:i.aiClassifiedError,onRetry:i.handleGenerate,onDismiss:i.clearAiError}):n.jsxs("div",{children:[n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:i.aiError}),n.jsx("button",{onClick:i.handleGenerate,className:"mt-2 text-[12px] font-medium",style:{color:"#a855f7",background:"none",border:"none",cursor:"pointer"},children:"Retry"})]})}),n.jsxs("div",{className:"flex items-center gap-3",children:[i.generating?n.jsx("button",{onClick:i.handleCancelGenerate,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:"var(--surface-3)",color:"var(--text-secondary)",border:"none",cursor:"pointer"},children:"Cancel Generation"}):n.jsxs("button",{onClick:i.handleGenerate,disabled:!i.aiPrompt.trim(),className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:i.aiPrompt.trim()?"#a855f7":"var(--surface-3)",color:i.aiPrompt.trim()?"#fff":"var(--text-tertiary)",cursor:i.aiPrompt.trim()?"pointer":"not-allowed",border:"none"},children:[n.jsx(td,{size:14}),"Generate"]}),n.jsx("button",{onClick:r,className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"}),!i.generating&&n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:["or fill in the form manually",n.jsx("button",{onClick:()=>i.setMode("manual"),className:"ml-1 font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"below"})]})]})]}),!i.layoutLoading&&i.layout&&i.mode==="manual"&&n.jsxs("div",{className:"space-y-4 animate-fade-in",children:[n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Location"}),i.creatableLayouts.length>1&&n.jsxs("div",{className:"mb-3",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Layout"}),n.jsx("div",{className:"flex gap-2",children:i.creatableLayouts.map(o=>n.jsx("button",{onClick:()=>{i.setSelectedLayout(o.layout),i.setPlugin(o.existingPlugins[0]||""),i.setNewPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:i.selectedLayout===o.layout?"var(--accent)":"var(--surface-3)",color:i.selectedLayout===o.layout?"#fff":"var(--text-secondary)",border:`1px solid ${i.selectedLayout===o.layout?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},children:o.label},o.layout))})]}),i.selectedLayout!==3&&n.jsxs("div",{className:"mb-3",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Plugin"}),n.jsxs("select",{value:i.plugin,onChange:o=>{i.setPlugin(o.target.value),i.setNewPlugin("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa,children:[i.availablePlugins.map(o=>n.jsx("option",{value:o,children:o},o)),n.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),i.plugin==="__new__"&&n.jsx("input",{type:"text",value:i.newPlugin,onChange:o=>i.setNewPlugin(bd(o.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:qa})]}),n.jsx("div",{className:"px-3 py-2 rounded-lg text-[11px] font-mono",style:{background:"var(--surface-0)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:i.pathPreview})]}),i.showPluginRecommendation&&i.pluginLayoutInfo&&i.selectedLayout===3&&n.jsxs("div",{className:"px-4 py-3 rounded-lg text-[12px] animate-fade-in flex items-center justify-between gap-3",style:{background:"rgba(59,130,246,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(59,130,246,0.2)"},children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#3b82f6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),n.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),n.jsxs("span",{children:["Plugins detected (",n.jsx("strong",{children:i.pluginLayoutInfo.plugins.slice(0,3).join(", ")}),"). Add this skill to a plugin for better organization."]})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsx("button",{onClick:i.applyPluginRecommendation,className:"px-3 py-1 rounded-md text-[11px] font-medium",style:{background:"#3b82f6",color:"#fff",border:"none",cursor:"pointer"},children:"Use plugin"}),n.jsx("button",{onClick:()=>i.setShowPluginRecommendation(!1),className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Skill Details"}),n.jsxs("div",{className:"mb-3",children:[n.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Name ",n.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),n.jsx("input",{type:"text",value:i.name,onChange:o=>i.setName(bd(o.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa})]}),n.jsxs("div",{className:"mb-3",children:[n.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Description ",n.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),n.jsx("textarea",{value:i.description,onChange:o=>i.setDescription(o.target.value),placeholder:"Brief description",rows:3,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-y",style:{...qa,minHeight:"72px"}})]}),n.jsxs("div",{className:"flex gap-3",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),n.jsxs("select",{value:i.model,onChange:o=>i.setModel(o.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa,children:[n.jsx("option",{value:"",children:"Any"}),n.jsx("option",{value:"opus",children:"Opus"}),n.jsx("option",{value:"sonnet",children:"Sonnet"}),n.jsx("option",{value:"haiku",children:"Haiku"})]})]}),n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Allowed Tools"}),n.jsx("input",{type:"text",value:i.allowedTools,onChange:o=>i.setAllowedTools(o.target.value),placeholder:"Read, Write, Edit...",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa})]})]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--accent-muted)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"}),n.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),n.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),n.jsxs("div",{children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md"}),n.jsx("span",{className:"text-[11px] ml-2",style:{color:"var(--text-tertiary)"},children:"Skill Definition"})]})]}),n.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:["write","preview"].map(o=>n.jsxs("button",{onClick:()=>i.setBodyViewMode(o),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:i.bodyViewMode===o?"var(--surface-4)":"transparent",color:i.bodyViewMode===o?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:i.bodyViewMode===o?600:400,border:"none",cursor:"pointer"},children:[o==="write"?n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"16 18 22 12 16 6"}),n.jsx("polyline",{points:"8 6 2 12 8 18"})]}):n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),n.jsx("span",{children:o==="write"?"Write":"Preview"})]},o))})]}),i.bodyViewMode==="write"?n.jsx("textarea",{value:i.body,onChange:o=>i.setBody(o.target.value),placeholder:`# /my-skill
78
78
 
79
79
  You are an expert at...
80
- `,rows:8,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{...qa,minHeight:"150px"}}):i.body.trim()?n.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"150px",maxHeight:"400px",overflowY:"auto"},dangerouslySetInnerHTML:{__html:go(i.body)}}):n.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"150px",maxHeight:"400px",overflowY:"auto"},children:n.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Start writing to see preview"})})]}),n.jsx(Tk,{skillName:i.name||"{skill}",hasEvals:!1,isDraft:i.draftSaved}),i.error&&n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:i.error}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:i.handleCreate,disabled:i.creating||!i.name||!i.description,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:i.creating||!i.name||!i.description?"var(--surface-3)":"var(--accent)",color:i.creating||!i.name||!i.description?"var(--text-tertiary)":"#fff",cursor:i.creating||!i.name||!i.description?"not-allowed":"pointer",border:"none"},children:i.creating?"Creating...":"Create Skill"}),n.jsx("button",{onClick:r,className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]})]})]})}function Ak(){return n.jsx("div",{className:"w-16 h-16 rounded-2xl flex items-center justify-center",style:{background:"var(--surface-2)"},children:n.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),n.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),n.jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]})})}function ro({variant:a,message:r,onRetry:i}){const{setMode:o,setSearch:u}=ya(),[m,f]=v.useState(!1);return a==="no-selection"?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:[n.jsx("div",{className:"mb-5",children:m?n.jsx(Ak,{}):n.jsx("img",{src:"/images/empty-studio.webp",width:128,height:128,alt:"",onError:()=>f(!0),style:{objectFit:"contain"}})}),n.jsx("p",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Select a skill to view details"}),n.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Choose a skill from the list to edit, test, and evaluate"})]}):a==="no-skills"?n.jsxs("div",{className:"text-center py-12 px-4 animate-fade-in-scale",children:[n.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mx-auto mb-4",style:{background:"var(--surface-2)"},children:n.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})})}),n.jsx("p",{className:"text-[14px] font-medium",style:{color:"var(--text-secondary)"},children:"No skills found"}),n.jsxs("p",{className:"text-[12px] mt-1 mb-4",style:{color:"var(--text-tertiary)"},children:["Check your ",n.jsx("code",{className:"px-1.5 py-0.5 rounded text-[11px]",style:{background:"var(--surface-2)"},children:"--root"})," directory, or create your first skill"]}),n.jsxs("button",{onClick:()=>o("create"),className:"inline-flex items-center gap-2 px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:"var(--accent)",color:"#fff",border:"none",cursor:"pointer"},onMouseEnter:h=>{h.currentTarget.style.opacity="0.9"},onMouseLeave:h=>{h.currentTarget.style.opacity="1"},children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Create Your First Skill"]})]}):a==="error"?n.jsx("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:n.jsxs("div",{className:"px-5 py-4 rounded-lg text-center max-w-sm",style:{background:"var(--red-muted)",border:"1px solid rgba(248,113,113,0.2)"},children:[n.jsx("p",{className:"text-[13px] mb-3",style:{color:"var(--red)"},children:r||"Failed to load skill data"}),i&&n.jsx("button",{onClick:i,className:"px-4 py-2 rounded-lg text-[12px] font-medium",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"none",cursor:"pointer"},children:"Retry"})]})}):n.jsxs("div",{className:"px-4 py-8 text-center animate-fade-in",children:[n.jsx("p",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"No skills match your search"}),n.jsx("button",{onClick:()=>u(""),className:"text-[12px] font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer",textDecoration:"underline"},children:"Clear search"})]})}function Mk(a,r){const[i,o]=a.split(".").map(Number),[u,m]=r.split(".").map(Number);return u>i?"major":m>o?"minor":"patch"}const Dk={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 zk(){const[a,r]=v.useState([]),[i,o]=v.useState(!0),[u,m]=v.useState(new Set),[f,h]=v.useState(new Map),[x,p]=v.useState(!1),[y,g]=v.useState(new Set),[j,S]=v.useState(null),[N,M]=v.useState(null),[E,k]=v.useState(!1),T=v.useCallback(async()=>{o(!0);try{const A=await Ne.getSkillUpdates();r(A.filter(O=>O.updateAvailable))}catch{r([])}finally{o(!1)}},[]);v.useEffect(()=>{T()},[T]);const B=v.useMemo(()=>a.filter(A=>!A.pinned),[a]),I=v.useCallback(A=>{m(O=>{const G=new Set(O);return G.has(A)?G.delete(A):G.add(A),G})},[]),L=v.useCallback(()=>{u.size===B.length?m(new Set):m(new Set(B.map(A=>A.name)))},[u,B]),V=v.useCallback(()=>{const A=[...u];if(!A.length)return;p(!0),h(new Map(A.map(G=>[G,{skill:G,status:"pending"}])));const O=Ne.startBatchUpdate(A);O.addEventListener("progress",G=>{try{const q=JSON.parse(G.data);h(te=>new Map(te).set(q.skill,q))}catch{}}),O.addEventListener("done",G=>{O.close(),p(!1);try{const q=JSON.parse(G.data);S(`Updated ${q.updated??0} skills, ${q.failed??0} failed`),setTimeout(()=>S(null),5e3)}catch{}T()}),O.addEventListener("error",()=>{O.close(),p(!1),S("Batch update failed"),setTimeout(()=>S(null),5e3)})},[u,T]),w=v.useCallback(A=>{A.name.split("/").pop()||A.name;const O=A.name.split("/"),G=O.length>=3?O[O.length-2]:O[0],q=O[O.length-1];g(X=>new Set(X).add(A.name));const te=Ne.startSkillUpdate(G,q);te.addEventListener("done",()=>{te.close(),g(X=>{const _=new Set(X);return _.delete(A.name),_}),T()}),te.addEventListener("error",()=>{te.close(),g(X=>{const _=new Set(X);return _.delete(A.name),_})})},[T]),D=v.useCallback(async A=>{if(!A.latest)return;const O=A.name.split("/"),G=O.length>=3?O[O.length-2]:O[0],q=O[O.length-1];k(!0);try{const te=await Ne.getVersionDiff(G,q,A.installed,A.latest);M({skill:A,diff:te})}catch{M(null)}finally{k(!1)}},[]);return i?n.jsxs("div",{className:"p-6",children:[n.jsx("div",{className:"skeleton h-6 w-48 mb-4"}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"skeleton h-16 rounded-lg"}),n.jsx("div",{className:"skeleton h-16 rounded-lg"})]})]}):a.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-16",children:[n.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"mb-4",children:[n.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),n.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),n.jsx("div",{className:"text-[15px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"All skills are up to date"}),n.jsx("div",{className:"text-[12px] mb-4",style:{color:"var(--text-tertiary)"},children:"No updates available for installed skills."}),n.jsx("button",{onClick:T,className:"btn btn-secondary text-[12px]",children:"Refresh"})]}):n.jsxs("div",{className:"p-6",children:[j&&n.jsx("div",{className:"fixed top-4 right-4 z-50 px-4 py-3 rounded-lg text-[13px] font-medium animate-fade-in",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"},children:j}),n.jsxs("div",{className:"flex items-center justify-between mb-5",children:[n.jsxs("div",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["Available Updates (",B.length,")"]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:T,className:"btn btn-ghost text-[12px]",disabled:x,children:"Refresh"}),n.jsx("button",{onClick:V,disabled:u.size===0||x,className:"btn btn-primary text-[12px]",children:x?"Updating...":`Update Selected (${u.size})`})]})]}),n.jsx("div",{className:"flex items-center gap-2 mb-3",children:n.jsxs("button",{onClick:L,className:"flex items-center gap-2 text-[12px] font-medium",style:{color:"var(--text-secondary)",background:"transparent",border:"none",cursor:"pointer"},children:[n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:u.size===B.length&&B.length>0?"var(--accent)":"var(--border-default)",background:u.size===B.length&&B.length>0?"var(--accent)":"transparent"},children:u.size===B.length&&B.length>0&&n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})}),"Select All"]})}),n.jsx("div",{className:"space-y-2",children:a.map(A=>{const O=A.name.split("/").pop()||A.name,G=A.latest?Mk(A.installed,A.latest):"patch",q=Dk[G],te=!!A.pinned,X=y.has(A.name),_=f.get(A.name),R=u.has(A.name);return n.jsx("div",{className:"rounded-lg px-4 py-3 transition-all duration-150",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",opacity:te?.7:1},children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:()=>!te&&I(A.name),disabled:te,className:"flex-shrink-0",style:{background:"transparent",border:"none",cursor:te?"not-allowed":"pointer"},children:n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:R?"var(--accent)":"var(--border-default)",background:R?"var(--accent)":"transparent",opacity:te?.4:1},children:R&&n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:O}),te&&n.jsx("span",{className:"text-[10px]",title:"Pinned — unpin from CLI to update",children:"📌"}),n.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:q.bg,color:q.text},children:G})]}),n.jsxs("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[A.installed," → ",A.latest||"?",te&&` (pinned at ${A.pinnedVersion||A.installed})`]})]}),_&&n.jsxs("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:_.status==="done"?"var(--green-muted)":_.status==="error"?"var(--red-muted)":"var(--yellow-muted)",color:_.status==="done"?"var(--green)":_.status==="error"?"var(--red)":"var(--yellow)"},children:[_.status,_.error&&`: ${_.error}`]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsx("button",{onClick:()=>D(A),className:"btn btn-ghost text-[11px]",disabled:E,children:"View Changes"}),n.jsx("button",{onClick:()=>w(A),disabled:te||X||x,title:te?"Pinned — unpin from CLI to update":"",className:`btn ${te?"btn-ghost":"btn-primary"} text-[11px]`,children:X?n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"spinner spinner-sm"})," Updating"]}):(_==null?void 0:_.status)==="done"?n.jsx("span",{style:{color:"var(--green)"},children:"✓"}):"Update"})]})]})},A.name)})}),N&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>M(null),children:n.jsxs("div",{style:{width:"80%",maxWidth:900},onClick:A=>A.stopPropagation(),children:[n.jsx("div",{className:"mb-2 flex justify-end",children:n.jsx("button",{onClick:()=>M(null),className:"btn btn-ghost text-[12px]",children:"Close"})}),n.jsx(Bd,{contentDiff:N.diff.contentDiff,fromLabel:N.diff.from,toLabel:N.diff.to,diffSummary:N.diff.diffSummary,renderContext:"inline"})]})})]})}const Lk=[{id:"amp",displayName:"Amp",localSkillsDir:".amp/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!0,detectInstalled:"which amp",parentCompany:"Sourcegraph",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"cline",displayName:"Cline",localSkillsDir:".cline/skills",globalSkillsDir:"~/.cline/skills",isUniversal:!0,detectInstalled:"which cline",parentCompany:"Cline",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"codex",displayName:"Codex CLI",localSkillsDir:".codex/skills",globalSkillsDir:"~/.codex/skills",isUniversal:!0,detectInstalled:"which codex",parentCompany:"OpenAI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"cursor",displayName:"Cursor",localSkillsDir:".cursor/skills",globalSkillsDir:"~/.cursor/skills",isUniversal:!0,detectInstalled:"which cursor",parentCompany:"Anysphere",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"gemini-cli",displayName:"Gemini CLI",localSkillsDir:".gemini/skills",globalSkillsDir:"~/.gemini/skills",isUniversal:!0,detectInstalled:"which gemini",parentCompany:"Google",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"github-copilot-ext",displayName:"GitHub Copilot (VS Code)",localSkillsDir:".github/copilot/skills",globalSkillsDir:"~/.config/github-copilot/skills",isUniversal:!0,detectInstalled:"which code && ls ~/.vscode/extensions/github.copilot-* 2>/dev/null",parentCompany:"GitHub (Microsoft)",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"kimi-cli",displayName:"Kimi CLI",localSkillsDir:".kimi/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!0,detectInstalled:"which kimi",parentCompany:"Moonshot AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"opencode",displayName:"OpenCode",localSkillsDir:".opencode/skills",globalSkillsDir:"~/.config/opencode/skills",isUniversal:!0,detectInstalled:"which opencode",parentCompany:"Community",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"antigravity",displayName:"Antigravity",localSkillsDir:".agent/skills",globalSkillsDir:"~/.gemini/antigravity/skills",isUniversal:!1,detectInstalled:"which antigravity",parentCompany:"Google",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"augment",displayName:"Augment Code",localSkillsDir:".augment/skills",globalSkillsDir:"~/.augment/skills",isUniversal:!1,detectInstalled:"which augment",parentCompany:"Augment",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"claude-code",displayName:"Claude Code",localSkillsDir:".claude/skills",globalSkillsDir:"~/.claude/skills",isUniversal:!1,detectInstalled:"which claude",parentCompany:"Anthropic",featureSupport:{slashCommands:!0,hooks:!0,mcp:!0,customSystemPrompt:!0},pluginCacheDir:"~/.claude/plugins/cache",pluginMarketplaceDir:"~/.claude/plugins/marketplaces"},{id:"openclaw",displayName:"OpenClaw",localSkillsDir:".openclaw/skills",globalSkillsDir:"~/.openclaw/skills",isUniversal:!1,detectInstalled:"which openclaw",parentCompany:"Community",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"replit",displayName:"Replit Agent",localSkillsDir:".replit/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!1,detectInstalled:"which replit",parentCompany:"Replit",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"codebuddy",displayName:"CodeBuddy",localSkillsDir:".codebuddy/skills",globalSkillsDir:"~/.codebuddy/skills",isUniversal:!1,detectInstalled:"which codebuddy",parentCompany:"CodeBuddy",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"command-code",displayName:"Command Code",localSkillsDir:".commandcode/skills",globalSkillsDir:"~/.commandcode/skills",isUniversal:!1,detectInstalled:"which command-code",parentCompany:"Command",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"continue",displayName:"Continue",localSkillsDir:".continue/skills",globalSkillsDir:"~/.continue/skills",isUniversal:!1,detectInstalled:"which continue",parentCompany:"Continue",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"crush",displayName:"Crush",localSkillsDir:".crush/skills",globalSkillsDir:"~/.config/crush/skills",isUniversal:!1,detectInstalled:"which crush",parentCompany:"Crush",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"droid",displayName:"Droid (Factory)",localSkillsDir:".factory/skills",globalSkillsDir:"~/.factory/skills",isUniversal:!1,detectInstalled:"which droid",parentCompany:"Factory",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"goose",displayName:"Goose",localSkillsDir:".goose/skills",globalSkillsDir:"~/.config/goose/skills",isUniversal:!1,detectInstalled:"which goose",parentCompany:"Block",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"junie",displayName:"Junie",localSkillsDir:".junie/skills",globalSkillsDir:"~/.junie/skills",isUniversal:!1,detectInstalled:"which junie",parentCompany:"JetBrains",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"iflow-cli",displayName:"iFlow CLI",localSkillsDir:".iflow/skills",globalSkillsDir:"~/.iflow/skills",isUniversal:!1,detectInstalled:"which iflow",parentCompany:"iFlow",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kilo",displayName:"Kilo Code",localSkillsDir:".kilocode/skills",globalSkillsDir:"~/.kilocode/skills",isUniversal:!1,detectInstalled:"which kilocode",parentCompany:"Kilo Code",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kiro-cli",displayName:"Kiro CLI",localSkillsDir:".kiro/skills",globalSkillsDir:"~/.kiro/skills",isUniversal:!1,detectInstalled:"which kiro",parentCompany:"AWS",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kode",displayName:"Kode",localSkillsDir:".kode/skills",globalSkillsDir:"~/.kode/skills",isUniversal:!1,detectInstalled:"which kode",parentCompany:"Kode",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mcpjam",displayName:"MCPJam",localSkillsDir:".mcpjam/skills",globalSkillsDir:"~/.mcpjam/skills",isUniversal:!1,detectInstalled:"which mcpjam",parentCompany:"MCPJam",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!1}},{id:"mistral-vibe",displayName:"Mistral Vibe",localSkillsDir:".vibe/skills",globalSkillsDir:"~/.vibe/skills",isUniversal:!1,detectInstalled:"which vibe",parentCompany:"Mistral AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mux",displayName:"Mux",localSkillsDir:".mux/skills",globalSkillsDir:"~/.mux/skills",isUniversal:!1,detectInstalled:"which mux",parentCompany:"Mux",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"openhands",displayName:"OpenHands",localSkillsDir:".openhands/skills",globalSkillsDir:"~/.openhands/skills",isUniversal:!1,detectInstalled:"which openhands",parentCompany:"All Hands AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"pi",displayName:"Pi",localSkillsDir:".pi/skills",globalSkillsDir:"~/.pi/agent/skills",isUniversal:!1,detectInstalled:"which pi",parentCompany:"Pi",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"qoder",displayName:"Qoder",localSkillsDir:".qoder/skills",globalSkillsDir:"~/.qoder/skills",isUniversal:!1,detectInstalled:"which qoder",parentCompany:"Qoder",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"qwen-code",displayName:"Qwen Code",localSkillsDir:".qwen/skills",globalSkillsDir:"~/.qwen/skills",isUniversal:!1,detectInstalled:"which qwen-code",parentCompany:"Alibaba",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"roo",displayName:"Roo Code",localSkillsDir:".roo/skills",globalSkillsDir:"~/.roo/skills",isUniversal:!1,detectInstalled:"which roo",parentCompany:"Roo",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"trae",displayName:"Trae",localSkillsDir:".trae/skills",globalSkillsDir:"~/.trae/skills",isUniversal:!1,detectInstalled:"which trae",parentCompany:"ByteDance",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"trae-cn",displayName:"Trae CN",localSkillsDir:".trae-cn/skills",globalSkillsDir:"~/.trae-cn/skills",isUniversal:!1,detectInstalled:"which trae-cn",parentCompany:"ByteDance",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"windsurf",displayName:"Windsurf",localSkillsDir:".windsurf/skills",globalSkillsDir:"~/.codeium/windsurf/skills",isUniversal:!1,detectInstalled:"which windsurf",parentCompany:"Codeium",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"zencoder",displayName:"ZenCoder",localSkillsDir:".zencoder/skills",globalSkillsDir:"~/.zencoder/skills",isUniversal:!1,detectInstalled:"which zencoder",parentCompany:"ZenCoder",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"neovate",displayName:"Neovate",localSkillsDir:".neovate/skills",globalSkillsDir:"~/.neovate/skills",isUniversal:!1,detectInstalled:"which neovate",parentCompany:"Neovate",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"pochi",displayName:"Pochi",localSkillsDir:".pochi/skills",globalSkillsDir:"~/.pochi/skills",isUniversal:!1,detectInstalled:"which pochi",parentCompany:"Pochi",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"adal",displayName:"Adal",localSkillsDir:".adal/skills",globalSkillsDir:"~/.adal/skills",isUniversal:!1,detectInstalled:"which adal",parentCompany:"Adal",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"cortex",displayName:"Cortex",localSkillsDir:".cortex/skills",globalSkillsDir:"~/.snowflake/cortex/skills",isUniversal:!1,detectInstalled:"which cortex",parentCompany:"Cortex",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"aider",displayName:"Aider",localSkillsDir:".aider/skills",globalSkillsDir:"~/.aider/skills",isUniversal:!1,detectInstalled:"which aider",parentCompany:"Aider",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"tabnine",displayName:"Tabnine Chat",localSkillsDir:".tabnine/skills",globalSkillsDir:"~/.tabnine/skills",isUniversal:!1,detectInstalled:"which tabnine",parentCompany:"Tabnine",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"devin",displayName:"Devin",localSkillsDir:".devin/skills",globalSkillsDir:"~/.devin/skills",isUniversal:!1,detectInstalled:"which devin",parentCompany:"Cognition",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"bolt-new",displayName:"bolt.new",localSkillsDir:".bolt/skills",globalSkillsDir:"~/.bolt/skills",isUniversal:!1,detectInstalled:"which bolt",parentCompany:"StackBlitz",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"v0",displayName:"v0",localSkillsDir:".v0/skills",globalSkillsDir:"~/.v0/skills",isUniversal:!1,detectInstalled:"which v0",parentCompany:"Vercel",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"gpt-pilot",displayName:"GPT Pilot",localSkillsDir:".gpt-pilot/skills",globalSkillsDir:"~/.gpt-pilot/skills",isUniversal:!1,detectInstalled:"which gpt-pilot",parentCompany:"Pythagora",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"plandex",displayName:"Plandex",localSkillsDir:".plandex/skills",globalSkillsDir:"~/.plandex/skills",isUniversal:!1,detectInstalled:"which plandex",parentCompany:"Plandex",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"sweep",displayName:"Sweep",localSkillsDir:".sweep/skills",globalSkillsDir:"~/.sweep/skills",isUniversal:!1,detectInstalled:"which sweep",parentCompany:"Sweep AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mentat",displayName:"Mentat",localSkillsDir:".mentat/skills",globalSkillsDir:"~/.mentat/skills",isUniversal:!1,detectInstalled:"which mentat",parentCompany:"AbanteAI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"copilot-cli",displayName:"GitHub Copilot CLI",localSkillsDir:".copilot/skills",globalSkillsDir:"~/.copilot/skills",isUniversal:!1,detectInstalled:"which copilot",parentCompany:"GitHub (Microsoft)",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"warp",displayName:"Warp",localSkillsDir:".warp/skills",globalSkillsDir:"~/.warp/skills",isUniversal:!1,detectInstalled:"which warp",parentCompany:"Warp",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"amazon-q-cli",displayName:"Amazon Q CLI",localSkillsDir:".amazonq/skills",globalSkillsDir:"~/.aws/amazonq/skills",isUniversal:!1,detectInstalled:"which q",parentCompany:"AWS",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"zed",displayName:"Zed",localSkillsDir:".zed/skills",globalSkillsDir:"~/.config/zed/skills",isUniversal:!1,detectInstalled:"which zed",parentCompany:"Zed Industries",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}}],gr={fontFamily:"var(--font-serif)",fontSize:15,fontWeight:500,color:"var(--text-primary)",margin:"0 0 8px",letterSpacing:.1},yr={background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px",boxShadow:"none"},_k={fontFamily:"var(--font-sans)",fontSize:11,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:.4},dg={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},fg={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",wordBreak:"break-all"},fr={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)",fontVariantNumeric:"tabular-nums"},Ok={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-secondary)"},Bk={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",overflowWrap:"anywhere",wordBreak:"break-word"},Uk={Description:"Add `description:` to the SKILL.md frontmatter to display a value here.",Version:"Add `version:` to the SKILL.md frontmatter to display a value here.",Category:"Add `category:` to the SKILL.md frontmatter to display a value here.",Author:"Add `author:` to the SKILL.md frontmatter to display a value here.",License:"Add `license:` to the SKILL.md frontmatter to display a value here.",Homepage:"Add `homepage:` to the SKILL.md frontmatter to display a value here.",Tags:"Add `tags:` to the SKILL.md frontmatter to display a value here.",Directory:"Filesystem location of this skill — not configurable via SKILL.md.","Entry point":"Add `entry-point:` to the SKILL.md frontmatter to customize; defaults to SKILL.md.","Last modified":"Filesystem mtime — updates automatically on save.","Last benchmark":"Shown after the first benchmark run completes."};function Hk(a){if(a==null||!Number.isFinite(a))return"—";if(a<1024)return`${a} B`;const r=a/1024;if(r<1024)return r>=10?`${Math.round(r)} KB`:`${r.toFixed(1).replace(/\.0$/,"")} KB`;const i=r/1024;return i>=10?`${Math.round(i)} MB`:`${i.toFixed(1).replace(/\.0$/,"")} MB`}function pg(a){if(!a)return"—";const r=new Date(a);if(Number.isNaN(r.getTime()))return a;const i=Date.now()-r.getTime(),o=Math.floor(i/1e3);if(o<60)return"just now";const u=Math.floor(o/60);if(u<60)return`${u} min ago`;const m=Math.floor(u/60);if(m<24)return`${m} hr ago`;const f=Math.floor(m/24);if(f<30)return`${f} day${f===1?"":"s"} ago`;const h=Math.floor(f/30);if(h<12)return`${h} month${h===1?"":"s"} ago`;const x=Math.floor(h/12);return`${x} year${x===1?"":"s"} ago`}function Ik(a){const r=Lk.find(i=>i.id===a);return(r==null?void 0:r.displayName)??a}function hr(a){const r=a?Uk[a]:void 0;return n.jsx("span",{style:Ok,title:r,children:"—"})}function bn(a,r,i){return n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"130px 1fr",alignItems:"baseline",gap:12,padding:"6px 0"},children:[n.jsx("span",{style:_k,children:a}),n.jsx("span",{style:{minWidth:0},children:r})]},a)}function cr(a,r,i={}){if(r==null||r==="")return bn(a,hr(a));if(i.path)return bn(a,n.jsx("span",{"data-path-value":"true",style:Bk,children:r}));const o=i.tabular?fr:i.mono?fg:dg;return bn(a,n.jsx("span",{style:o,children:r}))}function Vk({skill:a,allSkills:r=[],onSelectSkill:i}){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:16},children:[$k(a),a.origin==="installed"?Gk(a):null,Pk(a),Yk(a),Fk(a),Wk(a,r,i)]})}function $k(a){const r=a.homepage?n.jsxs("a",{href:a.homepage,target:"_blank",rel:"noopener noreferrer","data-external-link":"homepage",style:{...fg,color:"var(--text-accent)",textDecoration:"none",display:"inline-flex",alignItems:"center",gap:4},onMouseEnter:o=>{o.currentTarget.style.textDecoration="underline"},onMouseLeave:o=>{o.currentTarget.style.textDecoration="none"},children:[n.jsx("span",{children:a.homepage}),n.jsx("span",{"aria-hidden":"true",style:{fontSize:11,color:"var(--text-accent)"},children:"↗"})]}):hr("Homepage"),i=a.tags&&a.tags.length>0?n.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:a.tags.map(o=>n.jsx("span",{"data-chip":"tag",style:{fontFamily:"var(--font-sans)",fontSize:11,padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:999,color:"var(--text-secondary)",background:"transparent"},children:o},o))}):hr("Tags");return n.jsxs("section",{style:yr,"aria-labelledby":"md-frontmatter",children:[n.jsx("h3",{id:"md-frontmatter",style:gr,children:"Frontmatter"}),cr("Description",a.description??null),cr("Version",a.version??null,{tabular:!0}),cr("Category",a.category??null),cr("Author",a.author??null),cr("License",a.license??null),bn("Homepage",r),bn("Tags",i)]},"frontmatter")}function Gk(a){const r=a.sourceAgent,i=r?n.jsx("span",{style:dg,"data-agent-id":r,children:Ik(r)}):hr("Agent");return n.jsxs("section",{style:yr,"aria-labelledby":"md-source-agent",children:[n.jsx("h3",{id:"md-source-agent",style:gr,children:"Source agent"}),bn("Agent",i)]},"source-agent")}function Pk(a){const r=a.lastModified?n.jsx("span",{style:fr,title:a.lastModified,children:pg(a.lastModified)}):hr("Last modified"),i=a.entryPoint??"SKILL.md",o=a.dir?`${a.dir.replace(/\/$/,"")}/${i}`:i,u=n.jsx("button",{type:"button","data-entry-chip":"true",title:`Copy ${o}`,"aria-label":`Copy entry-point path ${o} to clipboard`,onClick:()=>qk(o),style:{display:"inline-flex",alignItems:"center",padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",cursor:"pointer",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i});return n.jsxs("section",{style:yr,"aria-labelledby":"md-fs",children:[n.jsx("h3",{id:"md-fs",style:gr,children:"Filesystem"}),cr("Directory",a.dir||null,{path:!0}),bn("Entry point",u),bn("Size",n.jsx("span",{style:fr,children:Hk(a.sizeBytes)})),bn("Last modified",r)]},"filesystem")}function qk(a){var r;try{(r=navigator.clipboard)==null||r.writeText(a)}catch{}typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:`Copied ${a}`,severity:"info"}}))}function Yk(a){const r=a.benchmarkStatus==="pass"?"var(--status-installed)":a.benchmarkStatus==="fail"?"var(--red, #b54444)":"var(--status-own)",i=n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},children:[n.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:7,height:7,borderRadius:999,background:r}}),a.benchmarkStatus]}),o=a.lastBenchmark?n.jsx("span",{style:fr,title:a.lastBenchmark,children:pg(a.lastBenchmark)}):hr("Last benchmark");return n.jsxs("section",{style:yr,"aria-labelledby":"md-bench",children:[n.jsx("h3",{id:"md-bench",style:gr,children:"Benchmark"}),bn("Eval count",n.jsx("span",{style:fr,children:a.evalCount})),bn("Assertions",n.jsx("span",{style:fr,children:a.assertionCount})),bn("Status",i),bn("Last benchmark",o)]},"benchmark")}function Fk(a){const r=a.mcpDeps??[];return n.jsxs("section",{style:yr,"aria-labelledby":"md-mcp",children:[n.jsx("h3",{id:"md-mcp",style:gr,children:"MCP dependencies"}),r.length===0?n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:0},children:"No MCP dependencies"}):n.jsx("ul",{style:{listStyle:"none",padding:0,margin:0},children:r.map(i=>n.jsxs("li",{"data-mcp-dep":i,style:{display:"flex",alignItems:"center",gap:8,padding:"6px 0",borderBottom:"1px solid var(--border-default)"},children:[n.jsx(Kk,{}),n.jsx("span",{style:{fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},children:i})]},i))})]},"mcp-deps")}function Kk(){return n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--text-secondary)",flexShrink:0},"aria-hidden":"true",children:[n.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),n.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"})]})}function Wk(a,r,i){const o=a.deps??[];return n.jsxs("section",{style:yr,"aria-labelledby":"md-skill-deps",children:[n.jsx("h3",{id:"md-skill-deps",style:gr,children:"Skill dependencies"}),o.length===0?n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:0},children:"No skill dependencies"}):n.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:o.map(u=>{const m=Qk(u,r),f=m!=null,h={fontFamily:"var(--font-sans)",fontSize:12,padding:"3px 10px",border:"1px solid var(--border-default)",borderRadius:999,color:f?"var(--text-primary)":"var(--text-secondary)",background:"transparent",cursor:f?"pointer":"help"},x=f&&i?()=>i({plugin:m.plugin,skill:m.skill,origin:m.origin}):void 0,p=f&&i?y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),i({plugin:m.plugin,skill:m.skill,origin:m.origin}))}:void 0;return n.jsx("button",{type:"button","data-chip":"skill-dep","data-present":f?"true":"false",title:f?`Open ${u}`:"Not installed",onClick:x,onKeyDown:p,style:h,children:u},u)})})]},"skill-deps")}function Qk(a,r){const[i,o]=a.includes("/")?a.split("/"):["",a];for(const u of r)if(i&&u.plugin===i&&u.skill===o||!i&&u.skill===o)return u;return null}const Xx=v.memo(function({message:r,politeness:i="polite",role:o}){const u=o??(i==="assertive"?"alert":"status");return n.jsx("div",{"aria-live":i,"aria-atomic":"true",role:u,"data-testid":"aria-live","data-politeness":i,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0,padding:0,margin:-1},children:r})});function Xk({toast:a,onDismiss:r}){const[i,o]=v.useState(!0),u=v.useRef(null);v.useEffect(()=>(u.current=requestAnimationFrame(()=>{u.current=requestAnimationFrame(()=>o(!1))}),()=>{u.current!=null&&cancelAnimationFrame(u.current)}),[]);const m={success:"var(--status-installed)",info:"var(--text-secondary)",error:"var(--color-accent, var(--accent-surface))"};return n.jsxs("div",{role:a.severity==="error"?"alert":"status","data-testid":"toast-item","data-severity":a.severity,style:{display:"flex",alignItems:"center",gap:12,padding:"10px 12px",minWidth:240,maxWidth:360,background:"var(--bg-canvas)",color:"var(--text-primary)",border:"1px solid var(--border-default)",borderLeft:`3px solid ${m[a.severity]}`,borderRadius:6,boxShadow:"0 8px 24px rgba(0,0,0,0.12)",fontFamily:"var(--font-sans)",fontSize:12,transform:i?"translateY(8px)":"translateY(0)",opacity:i?0:1,transition:"transform var(--duration-base, 180ms) var(--ease-standard, ease), opacity var(--duration-base, 180ms) var(--ease-standard, ease)"},children:[n.jsx("span",{style:{flex:1,minWidth:0},children:a.message}),a.action&&n.jsx("button",{type:"button",onClick:()=>{a.action.onInvoke(),r(a.id)},style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"3px 8px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:a.action.label}),n.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>r(a.id),style:{background:"transparent",border:"none",padding:2,color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1},children:"×"})]})}function Zk({toasts:a,onDismiss:r,liveMessage:i,liveAssertiveMessage:o}){return n.jsxs(n.Fragment,{children:[n.jsx(Xx,{politeness:"polite",message:i}),n.jsx(Xx,{politeness:"assertive",message:o}),a.length>0&&n.jsx("div",{"data-testid":"toast-stack",style:{position:"fixed",right:16,bottom:16,display:"flex",flexDirection:"column-reverse",gap:8,zIndex:50,pointerEvents:"none"},children:a.map(u=>n.jsx("div",{style:{pointerEvents:"auto"},children:n.jsx(Xk,{toast:u,onDismiss:r})},u.id))})]})}const mg=v.createContext(null);function Hd(){const a=v.useContext(mg);if(!a)throw new Error("useToast must be used inside <ToastProvider>.");return a}function Jk({children:a,maxVisible:r=4,defaultDurationMs:i=4e3}){const[o,u]=v.useState([]),[m,f]=v.useState(""),[h,x]=v.useState(""),p=v.useRef(new Map),y=v.useCallback(E=>{const k=p.current.get(E);k&&(clearTimeout(k),p.current.delete(E)),u(T=>T.filter(B=>B.id!==E))},[]),g=v.useCallback((E,k)=>{if(k<=0)return;const T=setTimeout(()=>{y(E)},k);p.current.set(E,T)},[y]),j=v.useCallback(E=>{const k=E.id??`toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,T={id:k,message:E.message,severity:E.severity??"info",durationMs:E.durationMs??i,action:E.action};return u(B=>[...B,T]),T.severity==="error"?x(T.message):f(T.message),g(k,T.durationMs),k},[i,g]),S=v.useCallback(()=>{for(const E of p.current.values())clearTimeout(E);p.current.clear(),u([])},[]);v.useEffect(()=>{function E(k){k.key==="Escape"&&u(T=>{if(T.length===0)return T;const B=T.slice(0,r),I=B[B.length-1],L=p.current.get(I.id);return L&&(clearTimeout(L),p.current.delete(I.id)),T.filter(V=>V.id!==I.id)})}return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[r]),v.useEffect(()=>()=>{for(const E of p.current.values())clearTimeout(E);p.current.clear()},[]);const N=o.slice(0,r),M=v.useMemo(()=>({toast:j,dismiss:y,clear:S}),[j,y,S]);return n.jsxs(mg.Provider,{value:M,children:[a,n.jsx(Zk,{toasts:N,onDismiss:y,liveMessage:m,liveAssertiveMessage:h})]})}function ew(a){const{toast:r}=Hd(),i=v.useRef(a);i.current=a;const o=v.useCallback(async(...u)=>{const m=i.current,f=m.snapshot();m.apply(...u),m.confirmGraceMs;const h=m.timeoutMs??5e3;let x=!1,p,y=!1;const g=m.commit(...u).then(()=>{x=!0,y=!0},N=>{x=!0,p=N??new Error("Commit failed")}),j=new Promise(N=>{setTimeout(N,h)});if(await Promise.race([g,j]),!x)p=new Error("TIMEOUT");else if(y)return;m.rollback(f);const S=typeof m.failureMessage=="function"?m.failureMessage(p):m.failureMessage??"Couldn't complete that action.";r({message:S,severity:"error",durationMs:0,action:{label:"Retry",onInvoke:()=>{o(...u)}}})},[r]);return{run:o}}const Zx=6e4;function tw({skill:a}){const{refreshUpdates:r}=ya(),{toast:i}=Hd(),[o,u]=v.useState("idle"),[m,f]=v.useState(null),[h,x]=v.useState(!1),[p,y]=v.useState(null),[g,j]=v.useState(!1),S=v.useRef(null),N=v.useRef(null),M=v.useCallback(()=>new Promise((I,L)=>{if(!a){L(new Error("No skill selected"));return}const V=Ne.startSkillUpdate(a.plugin,a.skill);S.current=V;const w=()=>{N.current&&(clearTimeout(N.current),N.current=null);try{V.close()}catch{}S.current=null};N.current=setTimeout(()=>{w(),L(new Error("TIMEOUT"))},Zx),V.addEventListener("progress",D=>{try{const A=JSON.parse(D.data);typeof(A==null?void 0:A.status)=="string"&&f(A.status)}catch{}}),V.addEventListener("done",()=>{w(),u("done"),f(null),r(),i({message:`Updated ${a.skill}.`,severity:"success",durationMs:4e3}),I()}),V.addEventListener("error",D=>{w();let A="Stream error";try{const O=typeof D.data=="string"?JSON.parse(D.data):null;O!=null&&O.error&&(A=String(O.error))}catch{}L(new Error(A))})}),[a,r,i]),E=ew({snapshot:()=>({status:o}),apply:()=>{u("updating"),f("updating")},commit:()=>M(),rollback:I=>{u(I.status==="updating"?"idle":I.status),f(null)},failureMessage:I=>`Couldn't update ${(a==null?void 0:a.skill)??"skill"} — ${I.message}`,timeoutMs:Zx+1e3});if(v.useEffect(()=>{if(!h||p!=null||!a||!a.latestVersion)return;let I=!1;return j(!0),Ne.getVersionDiff(a.plugin,a.skill,a.currentVersion??"",a.latestVersion).then(L=>{I||y(L)}).catch(()=>{I||y(null)}).finally(()=>{I||j(!1)}),()=>{I=!0}},[h,p,a==null?void 0:a.plugin,a==null?void 0:a.skill,a==null?void 0:a.latestVersion,a==null?void 0:a.currentVersion,a]),v.useEffect(()=>()=>{if(N.current&&clearTimeout(N.current),S.current)try{S.current.close()}catch{}},[]),!a||a.updateAvailable!==!0)return null;const k=a.latestVersion,T=o==="updating"?"Updating…":k?`Update to ${k}`:"Update",B=o==="updating";return n.jsxs("div",{"data-testid":"update-action",style:{display:"flex",flexDirection:"column",gap:6,padding:"12px 16px",borderTop:"1px solid var(--border-default)",borderBottom:"1px solid var(--border-default)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[n.jsx("button",{type:"button","data-testid":"update-action-button",onClick:()=>{E.run()},disabled:B,style:{height:36,padding:"0 14px",background:"var(--color-ink)",color:"var(--color-paper)",border:"none",borderRadius:4,cursor:B?"not-allowed":"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500},children:T}),n.jsx("button",{type:"button","data-testid":"update-action-toggle-changelog",onClick:()=>x(I=>!I),disabled:B||!k,style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:12,fontFamily:"var(--font-sans)",cursor:"pointer",textDecoration:"underline"},children:h?"Hide changelog":"Preview changelog"})]}),m&&n.jsx("div",{"data-testid":"update-action-progress",role:"status",style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-muted, var(--text-secondary))"},children:m}),h&&k&&n.jsxs("div",{"data-testid":"update-action-changelog",style:{paddingTop:8},children:[g&&n.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Loading changelog…"}),!g&&p&&n.jsx(Bd,{contentDiff:p.contentDiff,fromLabel:p.from,toLabel:p.to,diffSummary:p.diffSummary??void 0,renderContext:"inline"}),!g&&!p&&n.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Couldn't load changelog."})]})]})}function nd(){const{state:a,setMobileView:r}=ya();return a.isMobile?n.jsxs("button",{onClick:()=>r("list"),className:"flex items-center gap-1.5 px-3 py-2 text-[12px] font-medium",style:{background:"var(--surface-1)",color:"var(--text-secondary)",border:"none",borderBottom:"1px solid var(--border-subtle)",cursor:"pointer",width:"100%"},children:[n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back to skills"]}):null}function nw(a={}){if(a.selectedSkillInfo!==void 0||a.loadError!==void 0)return aw(a);const{state:r,selectSkill:i,setMode:o,refreshSkills:u}=ya(),[m,f]=v.useState(typeof window<"u"?window.location.hash:"");if(v.useEffect(()=>{const p=()=>f(window.location.hash);return window.addEventListener("hashchange",p),()=>window.removeEventListener("hashchange",p)},[]),m==="#/updates")return n.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[n.jsx(nd,{}),n.jsx(zk,{})]});if(r.mode==="create")return n.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[n.jsx(nd,{}),n.jsx(Rk,{onCreated:(p,y)=>{o("browse"),u(),i({plugin:p,skill:y,origin:"source"})},onCancel:()=>o("browse")})]});if(!r.selectedSkill)return r.skillsError?n.jsx(ro,{variant:"error",message:r.skillsError,onRetry:u}):!r.skillsLoading&&r.skills.length===0?n.jsx(ro,{variant:"no-skills"}):n.jsx(ro,{variant:"no-selection"});const h=r.selectedSkill,x=r.skills.find(p=>p.plugin===h.plugin&&p.skill===h.skill)??null;return n.jsxs("div",{className:"flex flex-col h-full",children:[n.jsx(nd,{}),n.jsx(lw,{skillInfo:x,allSkills:r.skills,onSelectSkill:p=>i(p)})]})}function aw(a){const r=a.selectedSkillInfo??null,i=a.activeDetailTab??"overview";if(r==null)return iw();if(a.loadError)return ow(r,a.loadError);const o=a.allSkills&&a.onSelectSkill?{allSkills:a.allSkills,onSelectSkill:a.onSelectSkill}:void 0;return hg(r,i,a.onDetailTabChange,o)}function lw({skillInfo:a,allSkills:r,onSelectSkill:i}){const[o,u]=v.useState("overview"),m=v.useMemo(()=>a?hg(a,o,u,{allSkills:r,onSelectSkill:i}):n.jsx(ro,{variant:"no-selection"}),[a,o,r,i]);return n.jsx("div",{className:"flex flex-col h-full",style:{background:"var(--bg-canvas)"},children:m})}const rw=[{id:"overview",label:"Overview"},{id:"versions",label:"Versions"}];function sw(a,r){return n.jsx("div",{role:"tablist","aria-label":"Detail sections",style:{display:"flex",alignItems:"stretch",gap:4,borderBottom:"1px solid var(--border-default)",padding:"0 16px",background:"var(--bg-canvas)"},children:rw.map(i=>{const o=i.id===a;return n.jsx("button",{type:"button",role:"tab","aria-selected":o,tabIndex:o?0:-1,id:`detail-tab-${i.id}`,"aria-controls":`detail-panel-${i.id}`,onClick:()=>r==null?void 0:r(i.id),style:{background:"transparent",border:"none",borderBottom:o?"2px solid var(--text-primary)":"2px solid transparent",padding:"10px 4px",marginBottom:-1,fontFamily:"var(--font-sans)",fontSize:13,fontWeight:o?500:400,color:o?"var(--text-primary)":"var(--text-secondary)",cursor:"pointer"},children:i.label},i.id)})})}function iw(){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:32,background:"var(--bg-canvas)"},children:[n.jsx("h2",{style:{fontFamily:"var(--font-serif)",fontSize:20,fontWeight:500,color:"var(--text-primary)",margin:0,marginBottom:8},children:"Select a skill to view details"}),n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-secondary)",margin:0,maxWidth:420,textAlign:"center"},children:"Choose a skill from the sidebar — its frontmatter, filesystem info, and benchmark status will appear here."})]})}function ow(a,r){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:24,background:"var(--bg-canvas)",height:"100%"},children:[Ud({skill:a}),n.jsxs("section",{role:"alert",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px"},children:[n.jsxs("h3",{style:{fontFamily:"var(--font-serif)",fontSize:15,fontWeight:500,color:"var(--text-primary)",margin:"0 0 8px"},children:["Couldn't load SKILL.md for ",a.skill]}),n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:"0 0 12px",wordBreak:"break-word"},children:r}),n.jsxs("div",{style:{display:"flex",gap:8},children:[n.jsx("button",{type:"button",style:{fontFamily:"var(--font-sans)",fontSize:12,padding:"4px 10px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Open in editor"}),n.jsx("button",{type:"button",onClick:()=>{var i;return(i=navigator.clipboard)==null?void 0:i.writeText(a.dir)},style:{fontFamily:"var(--font-sans)",fontSize:12,padding:"4px 10px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Copy path"})]})]})]})}function hg(a,r,i,o){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--bg-canvas)"},children:[n.jsx("div",{style:{padding:16,paddingBottom:12},children:Ud({skill:a})}),n.jsx(tw,{skill:a}),sw(r,i),n.jsxs("div",{role:"tabpanel",id:`detail-panel-${r}`,"aria-labelledby":`detail-tab-${r}`,style:{flex:1,minHeight:0,overflow:"auto"},children:[r==="overview"&&n.jsxs(n.Fragment,{children:[Vk({skill:a,allSkills:(o==null?void 0:o.allSkills)??[],onSelectSkill:o==null?void 0:o.onSelectSkill}),o!=null&&n.jsx(Dx,{plugin:a.plugin,skill:a.skill,origin:a.origin,children:n.jsx("div",{style:{minHeight:520,display:"flex",flexDirection:"column"},children:n.jsx(Sk,{hideHeader:!0})})},`${a.plugin}/${a.skill}-workspace`)]}),r==="versions"&&o!=null&&n.jsx(Dx,{plugin:a.plugin,skill:a.skill,origin:a.origin,children:n.jsx("div",{style:{padding:16},children:n.jsx(Wv,{})})},`${a.plugin}/${a.skill}-versions`),r==="versions"&&o==null&&n.jsx("div",{style:{padding:16,fontFamily:"var(--font-sans)",color:"var(--text-secondary)",fontSize:13},children:"Select a skill from the sidebar to load its version history."})]})]})}function cw(){const{updateCount:a,state:r,dismissUpdateNotification:i}=ya(),o=a>0&&!r.updateNotificationDismissed;return v.useEffect(()=>{if(!o)return;const u=setTimeout(()=>i(),1e4);return()=>clearTimeout(u)},[o,i]),o?n.jsxs("div",{className:"fixed bottom-4 right-4 z-50 flex items-center gap-3 px-4 py-3 rounded-lg text-[13px] font-medium animate-fade-in",style:{background:"var(--yellow-muted)",border:"1px solid var(--yellow)",color:"var(--text-primary)"},children:[n.jsxs("span",{children:[a," update",a===1?"":"s"," available"]}),n.jsx("button",{onClick:()=>{window.location.hash="#/updates"},className:"px-2 py-0.5 rounded text-[12px] font-semibold",style:{background:"var(--yellow)",color:"var(--surface-0)",border:"none",cursor:"pointer"},children:"View Updates"}),n.jsx("button",{onClick:i,className:"text-[14px] leading-none",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",padding:"0 2px"},"aria-label":"Dismiss",children:"✕"})]}):null}const uw=[{name:Z.shortcuts.groupNavigation,items:[{keys:"/",label:Z.shortcuts.search},{keys:"j",label:Z.shortcuts.moveDown},{keys:"k",label:Z.shortcuts.moveUp},{keys:"Enter",label:Z.shortcuts.openSelected},{keys:"Esc",label:"Close / clear"}]},{name:Z.shortcuts.groupActions,items:[{keys:"⌘K",label:Z.shortcuts.openPalette},{keys:"?",label:Z.shortcuts.openShortcuts},{keys:"⌘B",label:Z.shortcuts.toggleSidebar},{keys:"E",label:Z.actions.edit}]},{name:Z.shortcuts.groupTheme,items:[{keys:"⌘⇧D",label:Z.shortcuts.toggleTheme}]}];function dw({open:a,onClose:r,groups:i=uw,title:o=Z.shortcuts.title}){const u=v.useRef(null),m=v.useRef(null);return v.useEffect(()=>{var f;if(a)return u.current=document.activeElement??null,(f=m.current)==null||f.focus(),()=>{var h,x;(x=(h=u.current)==null?void 0:h.focus)==null||x.call(h),u.current=null}},[a]),v.useEffect(()=>{if(!a)return;function f(h){var x;if(h.key==="Escape"){h.preventDefault(),r();return}h.key==="Tab"&&(h.preventDefault(),(x=m.current)==null||x.focus())}return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)},[a,r]),a?n.jsx("div",{role:"presentation","data-testid":"shortcut-modal",style:{position:"fixed",inset:0,background:"color-mix(in srgb, var(--bg-canvas) 70%, transparent)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:60},onClick:f=>{f.target===f.currentTarget&&r()},children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"shortcut-modal-title",style:{width:"min(480px, 92vw)",maxHeight:"80vh",overflow:"auto",background:"var(--bg-canvas)",border:"1px solid var(--border-default)",borderRadius:8,boxShadow:"0 16px 48px rgba(0,0,0,0.18)",padding:"16px 20px",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[n.jsx("h2",{id:"shortcut-modal-title",style:{margin:0,fontFamily:"var(--font-serif)",fontWeight:500,fontSize:18},children:o}),n.jsx("button",{ref:m,type:"button","aria-label":"Close",onClick:r,style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"2px 8px",color:"var(--text-secondary)",cursor:"pointer",fontSize:13},children:"Esc"})]}),i.map(f=>n.jsxs("section",{style:{marginBottom:12},children:[n.jsx("h3",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--text-secondary)",margin:"0 0 6px"},children:f.name}),n.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:f.items.map(h=>n.jsxs("li",{style:{display:"flex",justifyContent:"space-between",padding:"4px 0",borderTop:"1px solid var(--border-default)",fontSize:13},children:[n.jsx("span",{children:h.label}),n.jsx("kbd",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-secondary)",border:"1px solid var(--border-default)",borderRadius:3,padding:"1px 6px"},children:h.keys})]},`${f.name}:${h.keys}`))})]},f.name))]})}):null}function fw(a){const r=Z.actions,i=[{action:"open",label:r.open},{action:"copy-path",label:r.copyPath},{action:"reveal",label:r.revealInEditor},{action:"run-benchmark",label:r.runBenchmark}];if(a.origin==="source")return[...i,{action:"edit",label:r.edit},{action:"duplicate",label:r.duplicate}];const o=[...i];return a.updateAvailable&&o.push({action:"update",label:r.update}),o.push({action:"uninstall",label:r.uninstall}),o}function pw({state:a,onClose:r,onAction:i,itemsOverride:o}){const u=v.useRef(null),m=v.useRef(null),[f,h]=v.useState(0),x=v.useMemo(()=>a.skill?o??fw(a.skill):[],[a.skill,o]),p=v.useMemo(()=>{if(typeof window>"u")return{left:a.x,top:a.y};const g=8,j=220,S=44+x.length*28;let N=a.x,M=a.y;return N+j+g>window.innerWidth&&(N=Math.max(g,a.x-j)),M+S+g>window.innerHeight&&(M=Math.max(g,a.y-S)),{left:N,top:M}},[a.x,a.y,x.length]);v.useEffect(()=>{if(a.open)return m.current=document.activeElement??null,h(0),requestAnimationFrame(()=>{var g;(g=u.current)==null||g.focus()}),()=>{var g,j;(j=(g=m.current)==null?void 0:g.focus)==null||j.call(g),m.current=null}},[a.open]);const y=v.useCallback(()=>{if(!a.skill)return;const g=x[f];!g||g.disabled||(i(g.action,a.skill),r())},[x,f,a.skill,i,r]);return v.useEffect(()=>{if(!a.open)return;function g(S){if(S.key==="Escape"){S.preventDefault(),r();return}if(S.key==="ArrowDown"){S.preventDefault(),h(N=>Math.min(N+1,Math.max(x.length-1,0)));return}if(S.key==="ArrowUp"){S.preventDefault(),h(N=>Math.max(N-1,0));return}if(S.key==="Enter"||S.key===" "){S.preventDefault(),y();return}}function j(S){u.current&&S.target instanceof Node&&(u.current.contains(S.target)||r())}return window.addEventListener("keydown",g,!0),window.addEventListener("mousedown",j,!0),()=>{window.removeEventListener("keydown",g,!0),window.removeEventListener("mousedown",j,!0)}},[a.open,r,x.length,y]),!a.open||!a.skill?null:n.jsx("div",{ref:u,role:"menu",tabIndex:-1,"data-testid":"context-menu",style:{position:"fixed",left:p.left,top:p.top,zIndex:70,minWidth:200,padding:4,background:"var(--bg-canvas)",border:"1px solid var(--border-default)",borderRadius:6,boxShadow:"0 12px 32px rgba(0,0,0,0.16)",fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)",outline:"none"},children:x.map((g,j)=>n.jsx("div",{role:"menuitem","aria-disabled":g.disabled||void 0,"data-action":g.action,"data-selected":j===f||void 0,onMouseEnter:()=>h(j),onClick:()=>{g.disabled||(i(g.action,a.skill),r())},style:{padding:"5px 10px",borderRadius:4,cursor:g.disabled?"default":"pointer",opacity:g.disabled?.5:1,background:j===f?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent"},children:g.label},g.action))})}const mw={"anthropic-api":{name:Z.setupProviders.anthropic.name,description:Z.setupProviders.anthropic.description,envVars:Z.setupProviders.anthropic.envVars,keyUrl:Z.setupProviders.anthropic.keyUrl,learnMoreUrl:Z.setupProviders.anthropic.learnMoreUrl},openai:{name:Z.setupProviders.openai.name,description:Z.setupProviders.openai.description,envVars:Z.setupProviders.openai.envVars,keyUrl:Z.setupProviders.openai.keyUrl,learnMoreUrl:Z.setupProviders.openai.learnMoreUrl},openrouter:{name:Z.setupProviders.openrouter.name,description:Z.setupProviders.openrouter.description,envVars:Z.setupProviders.openrouter.envVars,keyUrl:Z.setupProviders.openrouter.keyUrl,learnMoreUrl:Z.setupProviders.openrouter.learnMoreUrl},gemini:{name:Z.setupProviders.gemini.name,description:Z.setupProviders.gemini.description,envVars:Z.setupProviders.gemini.envVars,keyUrl:Z.setupProviders.gemini.keyUrl,learnMoreUrl:Z.setupProviders.gemini.learnMoreUrl},ollama:{name:Z.setupProviders.ollama.name,description:Z.setupProviders.ollama.description,envVars:Z.setupProviders.ollama.envVars,install:[Z.setupProviders.ollama.installCmd],start:[Z.setupProviders.ollama.startCmd],pullExample:Z.setupProviders.ollama.pullExample,learnMoreUrl:Z.setupProviders.ollama.learnMoreUrl},"lm-studio":{name:Z.setupProviders.lmStudio.name,description:Z.setupProviders.lmStudio.description,envVars:Z.setupProviders.lmStudio.envVars,install:[Z.setupProviders.lmStudio.installCmd],start:[Z.setupProviders.lmStudio.startCmd],pullExample:Z.setupProviders.lmStudio.pullExample,learnMoreUrl:Z.setupProviders.lmStudio.learnMoreUrl},"claude-code":{name:Z.setupProviders.claudeCode.name,description:Z.setupProviders.claudeCode.description,envVars:[],notes:[Z.setupProviders.claudeCode.loginHint,Z.claudeCodeLabel.compactLabel],learnMoreUrl:Z.setupProviders.claudeCode.learnMoreUrl}};function hw(a){return a?mw[a]??null:null}function xw({open:a,providerKey:r,onClose:i}){const o=v.useRef(null);if(v.useEffect(()=>{if(!a)return;const f=h=>{h.key==="Escape"&&(h.preventDefault(),i())};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[a,i]),v.useEffect(()=>{if(!a)return;const f=o.current;if(!f)return;const h=f.querySelector("button, a[href], [tabindex]:not([tabindex='-1']), input, textarea, select");h==null||h.focus()},[a]),!a||typeof document>"u")return null;const u=hw(r),m=(u==null?void 0:u.name)??Z.setupDrawer.fallbackTitle;return fo.createPortal(n.jsxs(n.Fragment,{children:[n.jsx("div",{"data-testid":"setup-drawer-backdrop","aria-hidden":"true",onClick:i,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:99,animation:"vskillDrawerBackdropIn 120ms ease"}}),n.jsxs("div",{"data-testid":"setup-drawer",ref:o,role:"dialog","aria-modal":"true","aria-label":Z.setupDrawer.title(m),style:{position:"fixed",top:0,right:0,bottom:0,width:"480px",maxWidth:"100vw",background:"var(--bg-surface, var(--surface-1))",borderLeft:"1px solid var(--border-default, var(--border-subtle))",boxShadow:"-8px 0 32px rgba(0,0,0,0.18)",display:"flex",flexDirection:"column",zIndex:100,fontFamily:"var(--font-sans)",animation:"vskillDrawerIn 200ms cubic-bezier(0.2, 0, 0, 1)"},children:[n.jsx(vw,{title:m,onClose:i}),n.jsx("div",{"data-testid":"setup-drawer-body",style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:u?n.jsx(gw,{content:u}):n.jsx(yw,{})}),n.jsx("style",{children:`@keyframes vskillDrawerIn {
80
+ `,rows:8,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{...qa,minHeight:"150px"}}):i.body.trim()?n.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"150px",maxHeight:"400px",overflowY:"auto"},dangerouslySetInnerHTML:{__html:go(i.body)}}):n.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"150px",maxHeight:"400px",overflowY:"auto"},children:n.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Start writing to see preview"})})]}),n.jsx(Tk,{skillName:i.name||"{skill}",hasEvals:!1,isDraft:i.draftSaved}),i.error&&n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:i.error}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:i.handleCreate,disabled:i.creating||!i.name||!i.description,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:i.creating||!i.name||!i.description?"var(--surface-3)":"var(--accent)",color:i.creating||!i.name||!i.description?"var(--text-tertiary)":"#fff",cursor:i.creating||!i.name||!i.description?"not-allowed":"pointer",border:"none"},children:i.creating?"Creating...":"Create Skill"}),n.jsx("button",{onClick:r,className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]})]})]})}function Ak(){return n.jsx("div",{className:"w-16 h-16 rounded-2xl flex items-center justify-center",style:{background:"var(--surface-2)"},children:n.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),n.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),n.jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]})})}function ro({variant:a,message:r,onRetry:i}){const{setMode:o,setSearch:u}=ya(),[m,f]=v.useState(!1);return a==="no-selection"?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:[n.jsx("div",{className:"mb-5",children:m?n.jsx(Ak,{}):n.jsx("img",{src:"/images/empty-studio.webp",width:128,height:128,alt:"",onError:()=>f(!0),style:{objectFit:"contain"}})}),n.jsx("p",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Select a skill to view details"}),n.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Choose a skill from the list to edit, test, and evaluate"})]}):a==="no-skills"?n.jsxs("div",{className:"text-center py-12 px-4 animate-fade-in-scale",children:[n.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mx-auto mb-4",style:{background:"var(--surface-2)"},children:n.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})})}),n.jsx("p",{className:"text-[14px] font-medium",style:{color:"var(--text-secondary)"},children:"No skills found"}),n.jsxs("p",{className:"text-[12px] mt-1 mb-4",style:{color:"var(--text-tertiary)"},children:["Check your ",n.jsx("code",{className:"px-1.5 py-0.5 rounded text-[11px]",style:{background:"var(--surface-2)"},children:"--root"})," directory, or create your first skill"]}),n.jsxs("button",{onClick:()=>o("create"),className:"inline-flex items-center gap-2 px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:"var(--accent)",color:"#fff",border:"none",cursor:"pointer"},onMouseEnter:h=>{h.currentTarget.style.opacity="0.9"},onMouseLeave:h=>{h.currentTarget.style.opacity="1"},children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Create Your First Skill"]})]}):a==="error"?n.jsx("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:n.jsxs("div",{className:"px-5 py-4 rounded-lg text-center max-w-sm",style:{background:"var(--red-muted)",border:"1px solid rgba(248,113,113,0.2)"},children:[n.jsx("p",{className:"text-[13px] mb-3",style:{color:"var(--red)"},children:r||"Failed to load skill data"}),i&&n.jsx("button",{onClick:i,className:"px-4 py-2 rounded-lg text-[12px] font-medium",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"none",cursor:"pointer"},children:"Retry"})]})}):n.jsxs("div",{className:"px-4 py-8 text-center animate-fade-in",children:[n.jsx("p",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"No skills match your search"}),n.jsx("button",{onClick:()=>u(""),className:"text-[12px] font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer",textDecoration:"underline"},children:"Clear search"})]})}function Mk(a,r){const[i,o]=a.split(".").map(Number),[u,m]=r.split(".").map(Number);return u>i?"major":m>o?"minor":"patch"}const Dk={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 zk(){const[a,r]=v.useState([]),[i,o]=v.useState(!0),[u,m]=v.useState(new Set),[f,h]=v.useState(new Map),[x,p]=v.useState(!1),[y,g]=v.useState(new Set),[j,S]=v.useState(null),[N,D]=v.useState(null),[T,k]=v.useState(!1),M=v.useCallback(async()=>{o(!0);try{const R=await Ne.getSkillUpdates();r(R.filter(I=>I.updateAvailable))}catch{r([])}finally{o(!1)}},[]);v.useEffect(()=>{M()},[M]);const B=v.useMemo(()=>a.filter(R=>!R.pinned),[a]),V=v.useCallback(R=>{m(I=>{const P=new Set(I);return P.has(R)?P.delete(R):P.add(R),P})},[]),A=v.useCallback(()=>{u.size===B.length?m(new Set):m(new Set(B.map(R=>R.name)))},[u,B]),U=v.useCallback(()=>{const R=[...u];if(!R.length)return;p(!0),h(new Map(R.map(P=>[P,{skill:P,status:"pending"}])));const I=Ne.startBatchUpdate(R);I.addEventListener("progress",P=>{try{const q=JSON.parse(P.data);h(ee=>new Map(ee).set(q.skill,q))}catch{}}),I.addEventListener("done",P=>{I.close(),p(!1);try{const q=JSON.parse(P.data);S(`Updated ${q.updated??0} skills, ${q.failed??0} failed`),setTimeout(()=>S(null),5e3)}catch{}M()}),I.addEventListener("error",()=>{I.close(),p(!1),S("Batch update failed"),setTimeout(()=>S(null),5e3)})},[u,M]),C=v.useCallback(R=>{R.name.split("/").pop()||R.name;const I=R.name.split("/"),P=I.length>=3?I[I.length-2]:I[0],q=I[I.length-1];g(X=>new Set(X).add(R.name));const ee=Ne.startSkillUpdate(P,q);ee.addEventListener("done",()=>{ee.close(),g(X=>{const _=new Set(X);return _.delete(R.name),_}),M()}),ee.addEventListener("error",()=>{ee.close(),g(X=>{const _=new Set(X);return _.delete(R.name),_})})},[M]),z=v.useCallback(async R=>{if(!R.latest)return;const I=R.name.split("/"),P=I.length>=3?I[I.length-2]:I[0],q=I[I.length-1];k(!0);try{const ee=await Ne.getVersionDiff(P,q,R.installed,R.latest);D({skill:R,diff:ee})}catch{D(null)}finally{k(!1)}},[]);return i?n.jsxs("div",{className:"p-6",children:[n.jsx("div",{className:"skeleton h-6 w-48 mb-4"}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"skeleton h-16 rounded-lg"}),n.jsx("div",{className:"skeleton h-16 rounded-lg"})]})]}):a.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-16",children:[n.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"mb-4",children:[n.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),n.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),n.jsx("div",{className:"text-[15px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"All skills are up to date"}),n.jsx("div",{className:"text-[12px] mb-4",style:{color:"var(--text-tertiary)"},children:"No updates available for installed skills."}),n.jsx("button",{onClick:M,className:"btn btn-secondary text-[12px]",children:"Refresh"})]}):n.jsxs("div",{className:"p-6",children:[j&&n.jsx("div",{className:"fixed top-4 right-4 z-50 px-4 py-3 rounded-lg text-[13px] font-medium animate-fade-in",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"},children:j}),n.jsxs("div",{className:"flex items-center justify-between mb-5",children:[n.jsxs("div",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["Available Updates (",B.length,")"]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:M,className:"btn btn-ghost text-[12px]",disabled:x,children:"Refresh"}),n.jsx("button",{onClick:U,disabled:u.size===0||x,className:"btn btn-primary text-[12px]",children:x?"Updating...":`Update Selected (${u.size})`})]})]}),n.jsx("div",{className:"flex items-center gap-2 mb-3",children:n.jsxs("button",{onClick:A,className:"flex items-center gap-2 text-[12px] font-medium",style:{color:"var(--text-secondary)",background:"transparent",border:"none",cursor:"pointer"},children:[n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:u.size===B.length&&B.length>0?"var(--accent)":"var(--border-default)",background:u.size===B.length&&B.length>0?"var(--accent)":"transparent"},children:u.size===B.length&&B.length>0&&n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})}),"Select All"]})}),n.jsx("div",{className:"space-y-2",children:a.map(R=>{const I=R.name.split("/").pop()||R.name,P=R.latest?Mk(R.installed,R.latest):"patch",q=Dk[P],ee=!!R.pinned,X=y.has(R.name),_=f.get(R.name),E=u.has(R.name);return n.jsx("div",{className:"rounded-lg px-4 py-3 transition-all duration-150",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",opacity:ee?.7:1},children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:()=>!ee&&V(R.name),disabled:ee,className:"flex-shrink-0",style:{background:"transparent",border:"none",cursor:ee?"not-allowed":"pointer"},children:n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:E?"var(--accent)":"var(--border-default)",background:E?"var(--accent)":"transparent",opacity:ee?.4:1},children:E&&n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:I}),ee&&n.jsx("span",{className:"text-[10px]",title:"Pinned — unpin from CLI to update",children:"📌"}),n.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:q.bg,color:q.text},children:P})]}),n.jsxs("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[R.installed," → ",R.latest||"?",ee&&` (pinned at ${R.pinnedVersion||R.installed})`]})]}),_&&n.jsxs("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:_.status==="done"?"var(--green-muted)":_.status==="error"?"var(--red-muted)":"var(--yellow-muted)",color:_.status==="done"?"var(--green)":_.status==="error"?"var(--red)":"var(--yellow)"},children:[_.status,_.error&&`: ${_.error}`]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsx("button",{onClick:()=>z(R),className:"btn btn-ghost text-[11px]",disabled:T,children:"View Changes"}),n.jsx("button",{onClick:()=>C(R),disabled:ee||X||x,title:ee?"Pinned — unpin from CLI to update":"",className:`btn ${ee?"btn-ghost":"btn-primary"} text-[11px]`,children:X?n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"spinner spinner-sm"})," Updating"]}):(_==null?void 0:_.status)==="done"?n.jsx("span",{style:{color:"var(--green)"},children:"✓"}):"Update"})]})]})},R.name)})}),N&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>D(null),children:n.jsxs("div",{style:{width:"80%",maxWidth:900},onClick:R=>R.stopPropagation(),children:[n.jsx("div",{className:"mb-2 flex justify-end",children:n.jsx("button",{onClick:()=>D(null),className:"btn btn-ghost text-[12px]",children:"Close"})}),n.jsx(Id,{contentDiff:N.diff.contentDiff,fromLabel:N.diff.from,toLabel:N.diff.to,diffSummary:N.diff.diffSummary,renderContext:"inline"})]})})]})}const Lk=[{id:"amp",displayName:"Amp",localSkillsDir:".amp/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!0,detectInstalled:"which amp",parentCompany:"Sourcegraph",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"cline",displayName:"Cline",localSkillsDir:".cline/skills",globalSkillsDir:"~/.cline/skills",isUniversal:!0,detectInstalled:"which cline",parentCompany:"Cline",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"codex",displayName:"Codex CLI",localSkillsDir:".codex/skills",globalSkillsDir:"~/.codex/skills",isUniversal:!0,detectInstalled:"which codex",parentCompany:"OpenAI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"cursor",displayName:"Cursor",localSkillsDir:".cursor/skills",globalSkillsDir:"~/.cursor/skills",isUniversal:!0,detectInstalled:"which cursor",parentCompany:"Anysphere",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"gemini-cli",displayName:"Gemini CLI",localSkillsDir:".gemini/skills",globalSkillsDir:"~/.gemini/skills",isUniversal:!0,detectInstalled:"which gemini",parentCompany:"Google",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"github-copilot-ext",displayName:"GitHub Copilot (VS Code)",localSkillsDir:".github/copilot/skills",globalSkillsDir:"~/.config/github-copilot/skills",isUniversal:!0,detectInstalled:"which code && ls ~/.vscode/extensions/github.copilot-* 2>/dev/null",parentCompany:"GitHub (Microsoft)",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"kimi-cli",displayName:"Kimi CLI",localSkillsDir:".kimi/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!0,detectInstalled:"which kimi",parentCompany:"Moonshot AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"opencode",displayName:"OpenCode",localSkillsDir:".opencode/skills",globalSkillsDir:"~/.config/opencode/skills",isUniversal:!0,detectInstalled:"which opencode",parentCompany:"Community",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"antigravity",displayName:"Antigravity",localSkillsDir:".agent/skills",globalSkillsDir:"~/.gemini/antigravity/skills",isUniversal:!1,detectInstalled:"which antigravity",parentCompany:"Google",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"augment",displayName:"Augment Code",localSkillsDir:".augment/skills",globalSkillsDir:"~/.augment/skills",isUniversal:!1,detectInstalled:"which augment",parentCompany:"Augment",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"claude-code",displayName:"Claude Code",localSkillsDir:".claude/skills",globalSkillsDir:"~/.claude/skills",isUniversal:!1,detectInstalled:"which claude",parentCompany:"Anthropic",featureSupport:{slashCommands:!0,hooks:!0,mcp:!0,customSystemPrompt:!0},pluginCacheDir:"~/.claude/plugins/cache",pluginMarketplaceDir:"~/.claude/plugins/marketplaces"},{id:"openclaw",displayName:"OpenClaw",localSkillsDir:".openclaw/skills",globalSkillsDir:"~/.openclaw/skills",isUniversal:!1,detectInstalled:"which openclaw",parentCompany:"Community",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"replit",displayName:"Replit Agent",localSkillsDir:".replit/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!1,detectInstalled:"which replit",parentCompany:"Replit",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"codebuddy",displayName:"CodeBuddy",localSkillsDir:".codebuddy/skills",globalSkillsDir:"~/.codebuddy/skills",isUniversal:!1,detectInstalled:"which codebuddy",parentCompany:"CodeBuddy",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"command-code",displayName:"Command Code",localSkillsDir:".commandcode/skills",globalSkillsDir:"~/.commandcode/skills",isUniversal:!1,detectInstalled:"which command-code",parentCompany:"Command",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"continue",displayName:"Continue",localSkillsDir:".continue/skills",globalSkillsDir:"~/.continue/skills",isUniversal:!1,detectInstalled:"which continue",parentCompany:"Continue",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"crush",displayName:"Crush",localSkillsDir:".crush/skills",globalSkillsDir:"~/.config/crush/skills",isUniversal:!1,detectInstalled:"which crush",parentCompany:"Crush",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"droid",displayName:"Droid (Factory)",localSkillsDir:".factory/skills",globalSkillsDir:"~/.factory/skills",isUniversal:!1,detectInstalled:"which droid",parentCompany:"Factory",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"goose",displayName:"Goose",localSkillsDir:".goose/skills",globalSkillsDir:"~/.config/goose/skills",isUniversal:!1,detectInstalled:"which goose",parentCompany:"Block",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"junie",displayName:"Junie",localSkillsDir:".junie/skills",globalSkillsDir:"~/.junie/skills",isUniversal:!1,detectInstalled:"which junie",parentCompany:"JetBrains",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"iflow-cli",displayName:"iFlow CLI",localSkillsDir:".iflow/skills",globalSkillsDir:"~/.iflow/skills",isUniversal:!1,detectInstalled:"which iflow",parentCompany:"iFlow",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kilo",displayName:"Kilo Code",localSkillsDir:".kilocode/skills",globalSkillsDir:"~/.kilocode/skills",isUniversal:!1,detectInstalled:"which kilocode",parentCompany:"Kilo Code",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kiro-cli",displayName:"Kiro CLI",localSkillsDir:".kiro/skills",globalSkillsDir:"~/.kiro/skills",isUniversal:!1,detectInstalled:"which kiro",parentCompany:"AWS",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kode",displayName:"Kode",localSkillsDir:".kode/skills",globalSkillsDir:"~/.kode/skills",isUniversal:!1,detectInstalled:"which kode",parentCompany:"Kode",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mcpjam",displayName:"MCPJam",localSkillsDir:".mcpjam/skills",globalSkillsDir:"~/.mcpjam/skills",isUniversal:!1,detectInstalled:"which mcpjam",parentCompany:"MCPJam",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!1}},{id:"mistral-vibe",displayName:"Mistral Vibe",localSkillsDir:".vibe/skills",globalSkillsDir:"~/.vibe/skills",isUniversal:!1,detectInstalled:"which vibe",parentCompany:"Mistral AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mux",displayName:"Mux",localSkillsDir:".mux/skills",globalSkillsDir:"~/.mux/skills",isUniversal:!1,detectInstalled:"which mux",parentCompany:"Mux",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"openhands",displayName:"OpenHands",localSkillsDir:".openhands/skills",globalSkillsDir:"~/.openhands/skills",isUniversal:!1,detectInstalled:"which openhands",parentCompany:"All Hands AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"pi",displayName:"Pi",localSkillsDir:".pi/skills",globalSkillsDir:"~/.pi/agent/skills",isUniversal:!1,detectInstalled:"which pi",parentCompany:"Pi",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"qoder",displayName:"Qoder",localSkillsDir:".qoder/skills",globalSkillsDir:"~/.qoder/skills",isUniversal:!1,detectInstalled:"which qoder",parentCompany:"Qoder",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"qwen-code",displayName:"Qwen Code",localSkillsDir:".qwen/skills",globalSkillsDir:"~/.qwen/skills",isUniversal:!1,detectInstalled:"which qwen-code",parentCompany:"Alibaba",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"roo",displayName:"Roo Code",localSkillsDir:".roo/skills",globalSkillsDir:"~/.roo/skills",isUniversal:!1,detectInstalled:"which roo",parentCompany:"Roo",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"trae",displayName:"Trae",localSkillsDir:".trae/skills",globalSkillsDir:"~/.trae/skills",isUniversal:!1,detectInstalled:"which trae",parentCompany:"ByteDance",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"trae-cn",displayName:"Trae CN",localSkillsDir:".trae-cn/skills",globalSkillsDir:"~/.trae-cn/skills",isUniversal:!1,detectInstalled:"which trae-cn",parentCompany:"ByteDance",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"windsurf",displayName:"Windsurf",localSkillsDir:".windsurf/skills",globalSkillsDir:"~/.codeium/windsurf/skills",isUniversal:!1,detectInstalled:"which windsurf",parentCompany:"Codeium",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"zencoder",displayName:"ZenCoder",localSkillsDir:".zencoder/skills",globalSkillsDir:"~/.zencoder/skills",isUniversal:!1,detectInstalled:"which zencoder",parentCompany:"ZenCoder",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"neovate",displayName:"Neovate",localSkillsDir:".neovate/skills",globalSkillsDir:"~/.neovate/skills",isUniversal:!1,detectInstalled:"which neovate",parentCompany:"Neovate",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"pochi",displayName:"Pochi",localSkillsDir:".pochi/skills",globalSkillsDir:"~/.pochi/skills",isUniversal:!1,detectInstalled:"which pochi",parentCompany:"Pochi",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"adal",displayName:"Adal",localSkillsDir:".adal/skills",globalSkillsDir:"~/.adal/skills",isUniversal:!1,detectInstalled:"which adal",parentCompany:"Adal",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"cortex",displayName:"Cortex",localSkillsDir:".cortex/skills",globalSkillsDir:"~/.snowflake/cortex/skills",isUniversal:!1,detectInstalled:"which cortex",parentCompany:"Cortex",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"aider",displayName:"Aider",localSkillsDir:".aider/skills",globalSkillsDir:"~/.aider/skills",isUniversal:!1,detectInstalled:"which aider",parentCompany:"Aider",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"tabnine",displayName:"Tabnine Chat",localSkillsDir:".tabnine/skills",globalSkillsDir:"~/.tabnine/skills",isUniversal:!1,detectInstalled:"which tabnine",parentCompany:"Tabnine",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"devin",displayName:"Devin",localSkillsDir:".devin/skills",globalSkillsDir:"~/.devin/skills",isUniversal:!1,detectInstalled:"which devin",parentCompany:"Cognition",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"bolt-new",displayName:"bolt.new",localSkillsDir:".bolt/skills",globalSkillsDir:"~/.bolt/skills",isUniversal:!1,detectInstalled:"which bolt",parentCompany:"StackBlitz",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"v0",displayName:"v0",localSkillsDir:".v0/skills",globalSkillsDir:"~/.v0/skills",isUniversal:!1,detectInstalled:"which v0",parentCompany:"Vercel",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"gpt-pilot",displayName:"GPT Pilot",localSkillsDir:".gpt-pilot/skills",globalSkillsDir:"~/.gpt-pilot/skills",isUniversal:!1,detectInstalled:"which gpt-pilot",parentCompany:"Pythagora",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"plandex",displayName:"Plandex",localSkillsDir:".plandex/skills",globalSkillsDir:"~/.plandex/skills",isUniversal:!1,detectInstalled:"which plandex",parentCompany:"Plandex",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"sweep",displayName:"Sweep",localSkillsDir:".sweep/skills",globalSkillsDir:"~/.sweep/skills",isUniversal:!1,detectInstalled:"which sweep",parentCompany:"Sweep AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mentat",displayName:"Mentat",localSkillsDir:".mentat/skills",globalSkillsDir:"~/.mentat/skills",isUniversal:!1,detectInstalled:"which mentat",parentCompany:"AbanteAI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"copilot-cli",displayName:"GitHub Copilot CLI",localSkillsDir:".copilot/skills",globalSkillsDir:"~/.copilot/skills",isUniversal:!1,detectInstalled:"which copilot",parentCompany:"GitHub (Microsoft)",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"warp",displayName:"Warp",localSkillsDir:".warp/skills",globalSkillsDir:"~/.warp/skills",isUniversal:!1,detectInstalled:"which warp",parentCompany:"Warp",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"amazon-q-cli",displayName:"Amazon Q CLI",localSkillsDir:".amazonq/skills",globalSkillsDir:"~/.aws/amazonq/skills",isUniversal:!1,detectInstalled:"which q",parentCompany:"AWS",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"zed",displayName:"Zed",localSkillsDir:".zed/skills",globalSkillsDir:"~/.config/zed/skills",isUniversal:!1,detectInstalled:"which zed",parentCompany:"Zed Industries",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}}],gr={fontFamily:"var(--font-serif)",fontSize:15,fontWeight:500,color:"var(--text-primary)",margin:"0 0 8px",letterSpacing:.1},yr={background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px",boxShadow:"none"},_k={fontFamily:"var(--font-sans)",fontSize:11,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:.4},fg={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},pg={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",wordBreak:"break-all"},fr={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)",fontVariantNumeric:"tabular-nums"},Ok={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-secondary)"},Bk={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",overflowWrap:"anywhere",wordBreak:"break-word"},Ik={Description:"Add `description:` to the SKILL.md frontmatter to display a value here.",Version:"Add `version:` to the SKILL.md frontmatter to display a value here.",Category:"Add `category:` to the SKILL.md frontmatter to display a value here.",Author:"Add `author:` to the SKILL.md frontmatter to display a value here.",License:"Add `license:` to the SKILL.md frontmatter to display a value here.",Homepage:"Add `homepage:` to the SKILL.md frontmatter to display a value here.",Tags:"Add `tags:` to the SKILL.md frontmatter to display a value here.",Directory:"Filesystem location of this skill — not configurable via SKILL.md.","Entry point":"Add `entry-point:` to the SKILL.md frontmatter to customize; defaults to SKILL.md.","Last modified":"Filesystem mtime — updates automatically on save.","Last benchmark":"Shown after the first benchmark run completes."};function Hk(a){if(a==null||!Number.isFinite(a))return"—";if(a<1024)return`${a} B`;const r=a/1024;if(r<1024)return r>=10?`${Math.round(r)} KB`:`${r.toFixed(1).replace(/\.0$/,"")} KB`;const i=r/1024;return i>=10?`${Math.round(i)} MB`:`${i.toFixed(1).replace(/\.0$/,"")} MB`}function mg(a){if(!a)return"—";const r=new Date(a);if(Number.isNaN(r.getTime()))return a;const i=Date.now()-r.getTime(),o=Math.floor(i/1e3);if(o<60)return"just now";const u=Math.floor(o/60);if(u<60)return`${u} min ago`;const m=Math.floor(u/60);if(m<24)return`${m} hr ago`;const f=Math.floor(m/24);if(f<30)return`${f} day${f===1?"":"s"} ago`;const h=Math.floor(f/30);if(h<12)return`${h} month${h===1?"":"s"} ago`;const x=Math.floor(h/12);return`${x} year${x===1?"":"s"} ago`}function Uk(a){const r=Lk.find(i=>i.id===a);return(r==null?void 0:r.displayName)??a}function hr(a){const r=a?Ik[a]:void 0;return n.jsx("span",{style:Ok,title:r,children:"—"})}function bn(a,r,i){return n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"130px 1fr",alignItems:"baseline",gap:12,padding:"6px 0"},children:[n.jsx("span",{style:_k,children:a}),n.jsx("span",{style:{minWidth:0},children:r})]},a)}function cr(a,r,i={}){if(r==null||r==="")return bn(a,hr(a));if(i.path)return bn(a,n.jsx("span",{"data-path-value":"true",style:Bk,children:r}));const o=i.tabular?fr:i.mono?pg:fg;return bn(a,n.jsx("span",{style:o,children:r}))}function Vk({skill:a,allSkills:r=[],onSelectSkill:i}){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:16},children:[$k(a),a.origin==="installed"?Gk(a):null,Pk(a),Yk(a),Fk(a),Kk(a,r,i)]})}function $k(a){const r=a.homepage?n.jsxs("a",{href:a.homepage,target:"_blank",rel:"noopener noreferrer","data-external-link":"homepage",style:{...pg,color:"var(--text-accent)",textDecoration:"none",display:"inline-flex",alignItems:"center",gap:4},onMouseEnter:o=>{o.currentTarget.style.textDecoration="underline"},onMouseLeave:o=>{o.currentTarget.style.textDecoration="none"},children:[n.jsx("span",{children:a.homepage}),n.jsx("span",{"aria-hidden":"true",style:{fontSize:11,color:"var(--text-accent)"},children:"↗"})]}):hr("Homepage"),i=a.tags&&a.tags.length>0?n.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:a.tags.map(o=>n.jsx("span",{"data-chip":"tag",style:{fontFamily:"var(--font-sans)",fontSize:11,padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:999,color:"var(--text-secondary)",background:"transparent"},children:o},o))}):hr("Tags");return n.jsxs("section",{style:yr,"aria-labelledby":"md-frontmatter",children:[n.jsx("h3",{id:"md-frontmatter",style:gr,children:"Frontmatter"}),cr("Description",a.description??null),cr("Version",a.version??null,{tabular:!0}),cr("Category",a.category??null),cr("Author",a.author??null),cr("License",a.license??null),bn("Homepage",r),bn("Tags",i)]},"frontmatter")}function Gk(a){const r=a.sourceAgent,i=r?n.jsx("span",{style:fg,"data-agent-id":r,children:Uk(r)}):hr("Agent");return n.jsxs("section",{style:yr,"aria-labelledby":"md-source-agent",children:[n.jsx("h3",{id:"md-source-agent",style:gr,children:"Source agent"}),bn("Agent",i)]},"source-agent")}function Pk(a){const r=a.lastModified?n.jsx("span",{style:fr,title:a.lastModified,children:mg(a.lastModified)}):hr("Last modified"),i=a.entryPoint??"SKILL.md",o=a.dir?`${a.dir.replace(/\/$/,"")}/${i}`:i,u=n.jsx("button",{type:"button","data-entry-chip":"true",title:`Copy ${o}`,"aria-label":`Copy entry-point path ${o} to clipboard`,onClick:()=>qk(o),style:{display:"inline-flex",alignItems:"center",padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",cursor:"pointer",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i});return n.jsxs("section",{style:yr,"aria-labelledby":"md-fs",children:[n.jsx("h3",{id:"md-fs",style:gr,children:"Filesystem"}),cr("Directory",a.dir||null,{path:!0}),bn("Entry point",u),bn("Size",n.jsx("span",{style:fr,children:Hk(a.sizeBytes)})),bn("Last modified",r)]},"filesystem")}function qk(a){var r;try{(r=navigator.clipboard)==null||r.writeText(a)}catch{}typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:`Copied ${a}`,severity:"info"}}))}function Yk(a){const r=a.benchmarkStatus==="pass"?"var(--status-installed)":a.benchmarkStatus==="fail"?"var(--red, #b54444)":"var(--status-own)",i=n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},children:[n.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:7,height:7,borderRadius:999,background:r}}),a.benchmarkStatus]}),o=a.lastBenchmark?n.jsx("span",{style:fr,title:a.lastBenchmark,children:mg(a.lastBenchmark)}):hr("Last benchmark");return n.jsxs("section",{style:yr,"aria-labelledby":"md-bench",children:[n.jsx("h3",{id:"md-bench",style:gr,children:"Benchmark"}),bn("Eval count",n.jsx("span",{style:fr,children:a.evalCount})),bn("Assertions",n.jsx("span",{style:fr,children:a.assertionCount})),bn("Status",i),bn("Last benchmark",o)]},"benchmark")}function Fk(a){const r=a.mcpDeps??[];return n.jsxs("section",{style:yr,"aria-labelledby":"md-mcp",children:[n.jsx("h3",{id:"md-mcp",style:gr,children:"MCP dependencies"}),r.length===0?n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:0},children:"No MCP dependencies"}):n.jsx("ul",{style:{listStyle:"none",padding:0,margin:0},children:r.map(i=>n.jsxs("li",{"data-mcp-dep":i,style:{display:"flex",alignItems:"center",gap:8,padding:"6px 0",borderBottom:"1px solid var(--border-default)"},children:[n.jsx(Wk,{}),n.jsx("span",{style:{fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},children:i})]},i))})]},"mcp-deps")}function Wk(){return n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--text-secondary)",flexShrink:0},"aria-hidden":"true",children:[n.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),n.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"})]})}function Kk(a,r,i){const o=a.deps??[];return n.jsxs("section",{style:yr,"aria-labelledby":"md-skill-deps",children:[n.jsx("h3",{id:"md-skill-deps",style:gr,children:"Skill dependencies"}),o.length===0?n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:0},children:"No skill dependencies"}):n.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:o.map(u=>{const m=Qk(u,r),f=m!=null,h={fontFamily:"var(--font-sans)",fontSize:12,padding:"3px 10px",border:"1px solid var(--border-default)",borderRadius:999,color:f?"var(--text-primary)":"var(--text-secondary)",background:"transparent",cursor:f?"pointer":"help"},x=f&&i?()=>i({plugin:m.plugin,skill:m.skill,origin:m.origin}):void 0,p=f&&i?y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),i({plugin:m.plugin,skill:m.skill,origin:m.origin}))}:void 0;return n.jsx("button",{type:"button","data-chip":"skill-dep","data-present":f?"true":"false",title:f?`Open ${u}`:"Not installed",onClick:x,onKeyDown:p,style:h,children:u},u)})})]},"skill-deps")}function Qk(a,r){const[i,o]=a.includes("/")?a.split("/"):["",a];for(const u of r)if(i&&u.plugin===i&&u.skill===o||!i&&u.skill===o)return u;return null}const Zx=v.memo(function({message:r,politeness:i="polite",role:o}){const u=o??(i==="assertive"?"alert":"status");return n.jsx("div",{"aria-live":i,"aria-atomic":"true",role:u,"data-testid":"aria-live","data-politeness":i,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0,padding:0,margin:-1},children:r})});function Xk({toast:a,onDismiss:r}){const[i,o]=v.useState(!0),u=v.useRef(null);v.useEffect(()=>(u.current=requestAnimationFrame(()=>{u.current=requestAnimationFrame(()=>o(!1))}),()=>{u.current!=null&&cancelAnimationFrame(u.current)}),[]);const m={success:"var(--status-installed)",info:"var(--text-secondary)",error:"var(--color-accent, var(--accent-surface))"};return n.jsxs("div",{role:a.severity==="error"?"alert":"status","data-testid":"toast-item","data-severity":a.severity,style:{display:"flex",alignItems:"center",gap:12,padding:"10px 12px",minWidth:240,maxWidth:360,background:"var(--bg-canvas)",color:"var(--text-primary)",border:"1px solid var(--border-default)",borderLeft:`3px solid ${m[a.severity]}`,borderRadius:6,boxShadow:"0 8px 24px rgba(0,0,0,0.12)",fontFamily:"var(--font-sans)",fontSize:12,transform:i?"translateY(8px)":"translateY(0)",opacity:i?0:1,transition:"transform var(--duration-base, 180ms) var(--ease-standard, ease), opacity var(--duration-base, 180ms) var(--ease-standard, ease)"},children:[n.jsx("span",{style:{flex:1,minWidth:0},children:a.message}),a.action&&n.jsx("button",{type:"button",onClick:()=>{a.action.onInvoke(),r(a.id)},style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"3px 8px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:a.action.label}),n.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>r(a.id),style:{background:"transparent",border:"none",padding:2,color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1},children:"×"})]})}function Zk({toasts:a,onDismiss:r,liveMessage:i,liveAssertiveMessage:o}){return n.jsxs(n.Fragment,{children:[n.jsx(Zx,{politeness:"polite",message:i}),n.jsx(Zx,{politeness:"assertive",message:o}),a.length>0&&n.jsx("div",{"data-testid":"toast-stack",style:{position:"fixed",right:16,bottom:16,display:"flex",flexDirection:"column-reverse",gap:8,zIndex:50,pointerEvents:"none"},children:a.map(u=>n.jsx("div",{style:{pointerEvents:"auto"},children:n.jsx(Xk,{toast:u,onDismiss:r})},u.id))})]})}const hg=v.createContext(null);function Ud(){const a=v.useContext(hg);if(!a)throw new Error("useToast must be used inside <ToastProvider>.");return a}function Jk({children:a,maxVisible:r=4,defaultDurationMs:i=4e3}){const[o,u]=v.useState([]),[m,f]=v.useState(""),[h,x]=v.useState(""),p=v.useRef(new Map),y=v.useCallback(T=>{const k=p.current.get(T);k&&(clearTimeout(k),p.current.delete(T)),u(M=>M.filter(B=>B.id!==T))},[]),g=v.useCallback((T,k)=>{if(k<=0)return;const M=setTimeout(()=>{y(T)},k);p.current.set(T,M)},[y]),j=v.useCallback(T=>{const k=T.id??`toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,M={id:k,message:T.message,severity:T.severity??"info",durationMs:T.durationMs??i,action:T.action};return u(B=>[...B,M]),M.severity==="error"?x(M.message):f(M.message),g(k,M.durationMs),k},[i,g]),S=v.useCallback(()=>{for(const T of p.current.values())clearTimeout(T);p.current.clear(),u([])},[]);v.useEffect(()=>{function T(k){k.key==="Escape"&&u(M=>{if(M.length===0)return M;const B=M.slice(0,r),V=B[B.length-1],A=p.current.get(V.id);return A&&(clearTimeout(A),p.current.delete(V.id)),M.filter(U=>U.id!==V.id)})}return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[r]),v.useEffect(()=>()=>{for(const T of p.current.values())clearTimeout(T);p.current.clear()},[]);const N=o.slice(0,r),D=v.useMemo(()=>({toast:j,dismiss:y,clear:S}),[j,y,S]);return n.jsxs(hg.Provider,{value:D,children:[a,n.jsx(Zk,{toasts:N,onDismiss:y,liveMessage:m,liveAssertiveMessage:h})]})}function ew(a){const{toast:r}=Ud(),i=v.useRef(a);i.current=a;const o=v.useCallback(async(...u)=>{const m=i.current,f=m.snapshot();m.apply(...u),m.confirmGraceMs;const h=m.timeoutMs??5e3;let x=!1,p,y=!1;const g=m.commit(...u).then(()=>{x=!0,y=!0},N=>{x=!0,p=N??new Error("Commit failed")}),j=new Promise(N=>{setTimeout(N,h)});if(await Promise.race([g,j]),!x)p=new Error("TIMEOUT");else if(y)return;m.rollback(f);const S=typeof m.failureMessage=="function"?m.failureMessage(p):m.failureMessage??"Couldn't complete that action.";r({message:S,severity:"error",durationMs:0,action:{label:"Retry",onInvoke:()=>{o(...u)}}})},[r]);return{run:o}}const Jx=6e4;function tw({skill:a}){const{refreshUpdates:r}=ya(),{toast:i}=Ud(),[o,u]=v.useState("idle"),[m,f]=v.useState(null),[h,x]=v.useState(!1),[p,y]=v.useState(null),[g,j]=v.useState(!1),S=v.useRef(null),N=v.useRef(null),D=v.useCallback(()=>new Promise((V,A)=>{if(!a){A(new Error("No skill selected"));return}const U=Ne.startSkillUpdate(a.plugin,a.skill);S.current=U;const C=()=>{N.current&&(clearTimeout(N.current),N.current=null);try{U.close()}catch{}S.current=null};N.current=setTimeout(()=>{C(),A(new Error("TIMEOUT"))},Jx),U.addEventListener("progress",z=>{try{const R=JSON.parse(z.data);typeof(R==null?void 0:R.status)=="string"&&f(R.status)}catch{}}),U.addEventListener("done",()=>{C(),u("done"),f(null),r(),i({message:`Updated ${a.skill}.`,severity:"success",durationMs:4e3}),V()}),U.addEventListener("error",z=>{C();let R="Stream error";try{const I=typeof z.data=="string"?JSON.parse(z.data):null;I!=null&&I.error&&(R=String(I.error))}catch{}A(new Error(R))})}),[a,r,i]),T=ew({snapshot:()=>({status:o}),apply:()=>{u("updating"),f("updating")},commit:()=>D(),rollback:V=>{u(V.status==="updating"?"idle":V.status),f(null)},failureMessage:V=>`Couldn't update ${(a==null?void 0:a.skill)??"skill"} — ${V.message}`,timeoutMs:Jx+1e3});if(v.useEffect(()=>{if(!h||p!=null||!a||!a.latestVersion)return;let V=!1;return j(!0),Ne.getVersionDiff(a.plugin,a.skill,a.currentVersion??"",a.latestVersion).then(A=>{V||y(A)}).catch(()=>{V||y(null)}).finally(()=>{V||j(!1)}),()=>{V=!0}},[h,p,a==null?void 0:a.plugin,a==null?void 0:a.skill,a==null?void 0:a.latestVersion,a==null?void 0:a.currentVersion,a]),v.useEffect(()=>()=>{if(N.current&&clearTimeout(N.current),S.current)try{S.current.close()}catch{}},[]),!a||a.updateAvailable!==!0)return null;const k=a.latestVersion,M=o==="updating"?"Updating…":k?`Update to ${k}`:"Update",B=o==="updating";return n.jsxs("div",{"data-testid":"update-action",style:{display:"flex",flexDirection:"column",gap:6,padding:"12px 16px",borderTop:"1px solid var(--border-default)",borderBottom:"1px solid var(--border-default)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[n.jsx("button",{type:"button","data-testid":"update-action-button",onClick:()=>{T.run()},disabled:B,style:{height:36,padding:"0 14px",background:"var(--color-ink)",color:"var(--color-paper)",border:"none",borderRadius:4,cursor:B?"not-allowed":"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500},children:M}),n.jsx("button",{type:"button","data-testid":"update-action-toggle-changelog",onClick:()=>x(V=>!V),disabled:B||!k,style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:12,fontFamily:"var(--font-sans)",cursor:"pointer",textDecoration:"underline"},children:h?"Hide changelog":"Preview changelog"})]}),m&&n.jsx("div",{"data-testid":"update-action-progress",role:"status",style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-muted, var(--text-secondary))"},children:m}),h&&k&&n.jsxs("div",{"data-testid":"update-action-changelog",style:{paddingTop:8},children:[g&&n.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Loading changelog…"}),!g&&p&&n.jsx(Id,{contentDiff:p.contentDiff,fromLabel:p.from,toLabel:p.to,diffSummary:p.diffSummary??void 0,renderContext:"inline"}),!g&&!p&&n.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Couldn't load changelog."})]})]})}function nd(){const{state:a,setMobileView:r}=ya();return a.isMobile?n.jsxs("button",{onClick:()=>r("list"),className:"flex items-center gap-1.5 px-3 py-2 text-[12px] font-medium",style:{background:"var(--surface-1)",color:"var(--text-secondary)",border:"none",borderBottom:"1px solid var(--border-subtle)",cursor:"pointer",width:"100%"},children:[n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back to skills"]}):null}function nw(a={}){if(a.selectedSkillInfo!==void 0||a.loadError!==void 0)return aw(a);const{state:r,selectSkill:i,setMode:o,refreshSkills:u}=ya(),[m,f]=v.useState(typeof window<"u"?window.location.hash:"");if(v.useEffect(()=>{const p=()=>f(window.location.hash);return window.addEventListener("hashchange",p),()=>window.removeEventListener("hashchange",p)},[]),m==="#/updates")return n.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[n.jsx(nd,{}),n.jsx(zk,{})]});if(r.mode==="create")return n.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[n.jsx(nd,{}),n.jsx(Rk,{onCreated:(p,y)=>{o("browse"),u(),i({plugin:p,skill:y,origin:"source"})},onCancel:()=>o("browse")})]});if(!r.selectedSkill)return r.skillsError?n.jsx(ro,{variant:"error",message:r.skillsError,onRetry:u}):!r.skillsLoading&&r.skills.length===0?n.jsx(ro,{variant:"no-skills"}):n.jsx(ro,{variant:"no-selection"});const h=r.selectedSkill,x=r.skills.find(p=>p.plugin===h.plugin&&p.skill===h.skill)??null;return n.jsxs("div",{className:"flex flex-col h-full",children:[n.jsx(nd,{}),n.jsx(lw,{skillInfo:x,allSkills:r.skills,onSelectSkill:p=>i(p)})]})}function aw(a){const r=a.selectedSkillInfo??null,i=a.activeDetailTab??"overview";if(r==null)return iw();if(a.loadError)return ow(r,a.loadError);const o=a.allSkills&&a.onSelectSkill?{allSkills:a.allSkills,onSelectSkill:a.onSelectSkill}:void 0;return xg(r,i,a.onDetailTabChange,o)}function lw({skillInfo:a,allSkills:r,onSelectSkill:i}){const[o,u]=v.useState("overview"),m=v.useMemo(()=>a?xg(a,o,u,{allSkills:r,onSelectSkill:i}):n.jsx(ro,{variant:"no-selection"}),[a,o,r,i]);return n.jsx("div",{className:"flex flex-col h-full",style:{background:"var(--bg-canvas)"},children:m})}const rw=[{id:"overview",label:"Overview"},{id:"versions",label:"Versions"}];function sw(a,r){return n.jsx("div",{role:"tablist","aria-label":"Detail sections",style:{display:"flex",alignItems:"stretch",gap:4,borderBottom:"1px solid var(--border-default)",padding:"0 16px",background:"var(--bg-canvas)"},children:rw.map(i=>{const o=i.id===a;return n.jsx("button",{type:"button",role:"tab","aria-selected":o,tabIndex:o?0:-1,id:`detail-tab-${i.id}`,"aria-controls":`detail-panel-${i.id}`,onClick:()=>r==null?void 0:r(i.id),style:{background:"transparent",border:"none",borderBottom:o?"2px solid var(--text-primary)":"2px solid transparent",padding:"10px 4px",marginBottom:-1,fontFamily:"var(--font-sans)",fontSize:13,fontWeight:o?500:400,color:o?"var(--text-primary)":"var(--text-secondary)",cursor:"pointer"},children:i.label},i.id)})})}function iw(){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:32,background:"var(--bg-canvas)"},children:[n.jsx("h2",{style:{fontFamily:"var(--font-serif)",fontSize:20,fontWeight:500,color:"var(--text-primary)",margin:0,marginBottom:8},children:"Select a skill to view details"}),n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-secondary)",margin:0,maxWidth:420,textAlign:"center"},children:"Choose a skill from the sidebar — its frontmatter, filesystem info, and benchmark status will appear here."})]})}function ow(a,r){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:24,background:"var(--bg-canvas)",height:"100%"},children:[Hd({skill:a}),n.jsxs("section",{role:"alert",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px"},children:[n.jsxs("h3",{style:{fontFamily:"var(--font-serif)",fontSize:15,fontWeight:500,color:"var(--text-primary)",margin:"0 0 8px"},children:["Couldn't load SKILL.md for ",a.skill]}),n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:"0 0 12px",wordBreak:"break-word"},children:r}),n.jsxs("div",{style:{display:"flex",gap:8},children:[n.jsx("button",{type:"button",style:{fontFamily:"var(--font-sans)",fontSize:12,padding:"4px 10px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Open in editor"}),n.jsx("button",{type:"button",onClick:()=>{var i;return(i=navigator.clipboard)==null?void 0:i.writeText(a.dir)},style:{fontFamily:"var(--font-sans)",fontSize:12,padding:"4px 10px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Copy path"})]})]})]})}function xg(a,r,i,o){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--bg-canvas)"},children:[n.jsx("div",{style:{padding:16,paddingBottom:12},children:Hd({skill:a})}),n.jsx(tw,{skill:a}),sw(r,i),n.jsxs("div",{role:"tabpanel",id:`detail-panel-${r}`,"aria-labelledby":`detail-tab-${r}`,style:{flex:1,minHeight:0,overflow:"auto"},children:[r==="overview"&&n.jsxs(n.Fragment,{children:[Vk({skill:a,allSkills:(o==null?void 0:o.allSkills)??[],onSelectSkill:o==null?void 0:o.onSelectSkill}),o!=null&&n.jsx(zx,{plugin:a.plugin,skill:a.skill,origin:a.origin,children:n.jsx("div",{style:{minHeight:520,display:"flex",flexDirection:"column"},children:n.jsx(Sk,{hideHeader:!0})})},`${a.plugin}/${a.skill}-workspace`)]}),r==="versions"&&o!=null&&n.jsx(zx,{plugin:a.plugin,skill:a.skill,origin:a.origin,children:n.jsx("div",{style:{padding:16},children:n.jsx(Qv,{})})},`${a.plugin}/${a.skill}-versions`),r==="versions"&&o==null&&n.jsx("div",{style:{padding:16,fontFamily:"var(--font-sans)",color:"var(--text-secondary)",fontSize:13},children:"Select a skill from the sidebar to load its version history."})]})]})}function cw(){const{updateCount:a,state:r,dismissUpdateNotification:i}=ya(),o=a>0&&!r.updateNotificationDismissed;return v.useEffect(()=>{if(!o)return;const u=setTimeout(()=>i(),1e4);return()=>clearTimeout(u)},[o,i]),o?n.jsxs("div",{className:"fixed bottom-4 right-4 z-50 flex items-center gap-3 px-4 py-3 rounded-lg text-[13px] font-medium animate-fade-in",style:{background:"var(--yellow-muted)",border:"1px solid var(--yellow)",color:"var(--text-primary)"},children:[n.jsxs("span",{children:[a," update",a===1?"":"s"," available"]}),n.jsx("button",{onClick:()=>{window.location.hash="#/updates"},className:"px-2 py-0.5 rounded text-[12px] font-semibold",style:{background:"var(--yellow)",color:"var(--surface-0)",border:"none",cursor:"pointer"},children:"View Updates"}),n.jsx("button",{onClick:i,className:"text-[14px] leading-none",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",padding:"0 2px"},"aria-label":"Dismiss",children:"✕"})]}):null}const uw=[{name:Z.shortcuts.groupNavigation,items:[{keys:"/",label:Z.shortcuts.search},{keys:"j",label:Z.shortcuts.moveDown},{keys:"k",label:Z.shortcuts.moveUp},{keys:"Enter",label:Z.shortcuts.openSelected},{keys:"Esc",label:"Close / clear"}]},{name:Z.shortcuts.groupActions,items:[{keys:"⌘K",label:Z.shortcuts.openPalette},{keys:"?",label:Z.shortcuts.openShortcuts},{keys:"⌘B",label:Z.shortcuts.toggleSidebar},{keys:"E",label:Z.actions.edit}]},{name:Z.shortcuts.groupTheme,items:[{keys:"⌘⇧D",label:Z.shortcuts.toggleTheme}]}];function dw({open:a,onClose:r,groups:i=uw,title:o=Z.shortcuts.title}){const u=v.useRef(null),m=v.useRef(null);return v.useEffect(()=>{var f;if(a)return u.current=document.activeElement??null,(f=m.current)==null||f.focus(),()=>{var h,x;(x=(h=u.current)==null?void 0:h.focus)==null||x.call(h),u.current=null}},[a]),v.useEffect(()=>{if(!a)return;function f(h){var x;if(h.key==="Escape"){h.preventDefault(),r();return}h.key==="Tab"&&(h.preventDefault(),(x=m.current)==null||x.focus())}return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)},[a,r]),a?n.jsx("div",{role:"presentation","data-testid":"shortcut-modal",style:{position:"fixed",inset:0,background:"color-mix(in srgb, var(--bg-canvas) 70%, transparent)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:60},onClick:f=>{f.target===f.currentTarget&&r()},children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"shortcut-modal-title",style:{width:"min(480px, 92vw)",maxHeight:"80vh",overflow:"auto",background:"var(--bg-canvas)",border:"1px solid var(--border-default)",borderRadius:8,boxShadow:"0 16px 48px rgba(0,0,0,0.18)",padding:"16px 20px",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[n.jsx("h2",{id:"shortcut-modal-title",style:{margin:0,fontFamily:"var(--font-serif)",fontWeight:500,fontSize:18},children:o}),n.jsx("button",{ref:m,type:"button","aria-label":"Close",onClick:r,style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"2px 8px",color:"var(--text-secondary)",cursor:"pointer",fontSize:13},children:"Esc"})]}),i.map(f=>n.jsxs("section",{style:{marginBottom:12},children:[n.jsx("h3",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--text-secondary)",margin:"0 0 6px"},children:f.name}),n.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:f.items.map(h=>n.jsxs("li",{style:{display:"flex",justifyContent:"space-between",padding:"4px 0",borderTop:"1px solid var(--border-default)",fontSize:13},children:[n.jsx("span",{children:h.label}),n.jsx("kbd",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-secondary)",border:"1px solid var(--border-default)",borderRadius:3,padding:"1px 6px"},children:h.keys})]},`${f.name}:${h.keys}`))})]},f.name))]})}):null}function fw(a){const r=Z.actions,i=[{action:"open",label:r.open},{action:"copy-path",label:r.copyPath},{action:"reveal",label:r.revealInEditor},{action:"run-benchmark",label:r.runBenchmark}];if(a.origin==="source")return[...i,{action:"edit",label:r.edit},{action:"duplicate",label:r.duplicate}];const o=[...i];return a.updateAvailable&&o.push({action:"update",label:r.update}),o.push({action:"uninstall",label:r.uninstall}),o}function pw({state:a,onClose:r,onAction:i,itemsOverride:o}){const u=v.useRef(null),m=v.useRef(null),[f,h]=v.useState(0),x=v.useMemo(()=>a.skill?o??fw(a.skill):[],[a.skill,o]),p=v.useMemo(()=>{if(typeof window>"u")return{left:a.x,top:a.y};const g=8,j=220,S=44+x.length*28;let N=a.x,D=a.y;return N+j+g>window.innerWidth&&(N=Math.max(g,a.x-j)),D+S+g>window.innerHeight&&(D=Math.max(g,a.y-S)),{left:N,top:D}},[a.x,a.y,x.length]);v.useEffect(()=>{if(a.open)return m.current=document.activeElement??null,h(0),requestAnimationFrame(()=>{var g;(g=u.current)==null||g.focus()}),()=>{var g,j;(j=(g=m.current)==null?void 0:g.focus)==null||j.call(g),m.current=null}},[a.open]);const y=v.useCallback(()=>{if(!a.skill)return;const g=x[f];!g||g.disabled||(i(g.action,a.skill),r())},[x,f,a.skill,i,r]);return v.useEffect(()=>{if(!a.open)return;function g(S){if(S.key==="Escape"){S.preventDefault(),r();return}if(S.key==="ArrowDown"){S.preventDefault(),h(N=>Math.min(N+1,Math.max(x.length-1,0)));return}if(S.key==="ArrowUp"){S.preventDefault(),h(N=>Math.max(N-1,0));return}if(S.key==="Enter"||S.key===" "){S.preventDefault(),y();return}}function j(S){u.current&&S.target instanceof Node&&(u.current.contains(S.target)||r())}return window.addEventListener("keydown",g,!0),window.addEventListener("mousedown",j,!0),()=>{window.removeEventListener("keydown",g,!0),window.removeEventListener("mousedown",j,!0)}},[a.open,r,x.length,y]),!a.open||!a.skill?null:n.jsx("div",{ref:u,role:"menu",tabIndex:-1,"data-testid":"context-menu",style:{position:"fixed",left:p.left,top:p.top,zIndex:70,minWidth:200,padding:4,background:"var(--bg-canvas)",border:"1px solid var(--border-default)",borderRadius:6,boxShadow:"0 12px 32px rgba(0,0,0,0.16)",fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)",outline:"none"},children:x.map((g,j)=>n.jsx("div",{role:"menuitem","aria-disabled":g.disabled||void 0,"data-action":g.action,"data-selected":j===f||void 0,onMouseEnter:()=>h(j),onClick:()=>{g.disabled||(i(g.action,a.skill),r())},style:{padding:"5px 10px",borderRadius:4,cursor:g.disabled?"default":"pointer",opacity:g.disabled?.5:1,background:j===f?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent"},children:g.label},g.action))})}const mw={"anthropic-api":{name:Z.setupProviders.anthropic.name,description:Z.setupProviders.anthropic.description,envVars:Z.setupProviders.anthropic.envVars,keyUrl:Z.setupProviders.anthropic.keyUrl,learnMoreUrl:Z.setupProviders.anthropic.learnMoreUrl},openai:{name:Z.setupProviders.openai.name,description:Z.setupProviders.openai.description,envVars:Z.setupProviders.openai.envVars,keyUrl:Z.setupProviders.openai.keyUrl,learnMoreUrl:Z.setupProviders.openai.learnMoreUrl},openrouter:{name:Z.setupProviders.openrouter.name,description:Z.setupProviders.openrouter.description,envVars:Z.setupProviders.openrouter.envVars,keyUrl:Z.setupProviders.openrouter.keyUrl,learnMoreUrl:Z.setupProviders.openrouter.learnMoreUrl},gemini:{name:Z.setupProviders.gemini.name,description:Z.setupProviders.gemini.description,envVars:Z.setupProviders.gemini.envVars,keyUrl:Z.setupProviders.gemini.keyUrl,learnMoreUrl:Z.setupProviders.gemini.learnMoreUrl},ollama:{name:Z.setupProviders.ollama.name,description:Z.setupProviders.ollama.description,envVars:Z.setupProviders.ollama.envVars,install:[Z.setupProviders.ollama.installCmd],start:[Z.setupProviders.ollama.startCmd],pullExample:Z.setupProviders.ollama.pullExample,learnMoreUrl:Z.setupProviders.ollama.learnMoreUrl},"lm-studio":{name:Z.setupProviders.lmStudio.name,description:Z.setupProviders.lmStudio.description,envVars:Z.setupProviders.lmStudio.envVars,install:[Z.setupProviders.lmStudio.installCmd],start:[Z.setupProviders.lmStudio.startCmd],pullExample:Z.setupProviders.lmStudio.pullExample,learnMoreUrl:Z.setupProviders.lmStudio.learnMoreUrl},"claude-code":{name:Z.setupProviders.claudeCode.name,description:Z.setupProviders.claudeCode.description,envVars:[],notes:[Z.setupProviders.claudeCode.loginHint,Z.claudeCodeLabel.compactLabel],learnMoreUrl:Z.setupProviders.claudeCode.learnMoreUrl}};function hw(a){return a?mw[a]??null:null}function xw({open:a,providerKey:r,onClose:i}){const o=v.useRef(null);if(v.useEffect(()=>{if(!a)return;const f=h=>{h.key==="Escape"&&(h.preventDefault(),i())};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[a,i]),v.useEffect(()=>{if(!a)return;const f=o.current;if(!f)return;const h=f.querySelector("button, a[href], [tabindex]:not([tabindex='-1']), input, textarea, select");h==null||h.focus()},[a]),!a||typeof document>"u")return null;const u=hw(r),m=(u==null?void 0:u.name)??Z.setupDrawer.fallbackTitle;return fo.createPortal(n.jsxs(n.Fragment,{children:[n.jsx("div",{"data-testid":"setup-drawer-backdrop","aria-hidden":"true",onClick:i,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:99,animation:"vskillDrawerBackdropIn 120ms ease"}}),n.jsxs("div",{"data-testid":"setup-drawer",ref:o,role:"dialog","aria-modal":"true","aria-label":Z.setupDrawer.title(m),style:{position:"fixed",top:0,right:0,bottom:0,width:"480px",maxWidth:"100vw",background:"var(--bg-surface, var(--surface-1))",borderLeft:"1px solid var(--border-default, var(--border-subtle))",boxShadow:"-8px 0 32px rgba(0,0,0,0.18)",display:"flex",flexDirection:"column",zIndex:100,fontFamily:"var(--font-sans)",animation:"vskillDrawerIn 200ms cubic-bezier(0.2, 0, 0, 1)"},children:[n.jsx(vw,{title:m,onClose:i}),n.jsx("div",{"data-testid":"setup-drawer-body",style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:u?n.jsx(gw,{content:u}):n.jsx(yw,{})}),n.jsx("style",{children:`@keyframes vskillDrawerIn {
81
81
  from { transform: translateX(100%); }
82
82
  to { transform: translateX(0); }
83
83
  }
84
84
  @keyframes vskillDrawerBackdropIn {
85
85
  from { opacity: 0; }
86
86
  to { opacity: 1; }
87
- }`})]})]}),document.body)}function vw({title:a,onClose:r}){return n.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 20px",borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:[n.jsx("h2",{style:{fontFamily:"var(--font-serif)",fontSize:18,fontWeight:500,margin:0,color:"var(--text-primary)"},children:Z.setupDrawer.title(a)}),n.jsx("button",{type:"button","data-testid":"setup-drawer-close",onClick:r,"aria-label":Z.setupDrawer.close,style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:18,padding:4,lineHeight:1},children:"×"})]})}function gw({content:a}){var r,i;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[n.jsx("p",{style:{fontSize:14,lineHeight:1.5,color:"var(--text-primary)",margin:0},children:a.description}),a.notes&&a.notes.length>0&&n.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:6},children:a.notes.map(o=>n.jsx("li",{style:{fontSize:13,color:"var(--text-secondary)",padding:"8px 10px",background:"color-mix(in srgb, var(--accent-surface) 8%, transparent)",borderRadius:4},children:o},o))}),a.envVars.length>0&&n.jsxs("section",{children:[n.jsx("h3",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",margin:"0 0 8px"},children:Z.setupDrawer.requiredEnv}),n.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:6},children:a.envVars.map(o=>n.jsx("li",{children:n.jsx(bw,{name:o})},o))})]}),a.keyUrl&&n.jsx(jw,{href:a.keyUrl,label:Z.setupDrawer.getKey,testId:"setup-drawer-get-key"}),(a.install||a.start||a.pullExample)&&n.jsxs("section",{children:[n.jsx("h3",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",margin:"0 0 8px"},children:Z.setupDrawer.installRun}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(r=a.install)==null?void 0:r.map((o,u)=>n.jsx(ad,{code:o},`install-${u}`)),(i=a.start)==null?void 0:i.map((o,u)=>n.jsx(ad,{code:o},`start-${u}`)),a.pullExample&&n.jsx(ad,{code:a.pullExample})]})]}),n.jsx("footer",{style:{marginTop:8},children:n.jsxs("a",{href:a.learnMoreUrl,target:"_blank",rel:"noopener noreferrer","data-testid":"setup-drawer-learn-more",style:{fontSize:12,color:"var(--color-accent, var(--accent-surface))",textDecoration:"none"},children:[Z.setupDrawer.learnMore," →"]})})]})}function yw(){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[n.jsx("h3",{style:{margin:0,fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:Z.setupDrawer.fallbackTitle}),n.jsx("p",{style:{margin:0,fontSize:13,color:"var(--text-secondary)",lineHeight:1.5},children:Z.setupDrawer.fallbackBody})]})}function bw({name:a}){const r=async()=>{var i;try{await((i=navigator.clipboard)==null?void 0:i.writeText(a))}catch{}};return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",background:"color-mix(in srgb, var(--border-default) 30%, transparent)",borderRadius:4},children:[n.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",flex:1},children:a}),n.jsx("button",{type:"button",onClick:r,"aria-label":`Copy ${a} to clipboard`,style:{background:"transparent",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:3,padding:"2px 8px",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-sans)",cursor:"pointer"},children:Z.setupDrawer.copy})]})}function ad({code:a}){return n.jsx("pre",{style:{margin:0,padding:"8px 10px",background:"var(--bg-canvas, #111)",color:"var(--text-primary)",fontFamily:"var(--font-mono)",fontSize:11.5,lineHeight:1.5,borderRadius:4,border:"1px solid var(--border-default, var(--border-subtle))",overflowX:"auto",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:a})}function jw({href:a,label:r,testId:i}){return n.jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer","data-testid":i,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6,padding:"8px 14px",borderRadius:6,border:"1px solid var(--border-default, var(--border-subtle))",background:"color-mix(in srgb, var(--accent-surface) 12%, transparent)",color:"var(--text-primary)",textDecoration:"none",fontSize:13,fontWeight:500,fontFamily:"var(--font-sans)",width:"fit-content"},children:[r," →"]})}function Sw(){const[a,r]=v.useState(!1),[i,o]=v.useState(null),u=v.useRef(null),m=v.useCallback((h,x)=>{var p;u.current=typeof document<"u"?document.activeElement:null,(p=x==null?void 0:x.beforeOpen)==null||p.call(x),o(h),r(!0)},[]),f=v.useCallback(()=>{r(!1);const h=u.current;h&&"focus"in h&&typeof h.focus=="function"&&queueMicrotask(()=>h.focus())},[]);return{open:m,close:f,isOpen:a,providerKey:i}}function kw(a){const r=[],i=[],o=new Set;for(const u of a){if(u.presence==="absent"||u.health==="missing"){i.push({kind:"individual",key:u.id,agent:u});continue}if(u.sharedFolderGroup&&u.sharedFolderGroup.length>1){const m=[...u.sharedFolderGroup].sort().join("+");if(o.has(m))continue;o.add(m);const f=a.filter(h=>u.sharedFolderGroup.includes(h.id));r.push({kind:"aggregate",key:`shared:${m}`,consumers:f,sharedFolderPath:u.sharedFolderPath??"~/.config/agents/skills",combinedCount:f.reduce((h,x)=>h+x.globalCount,0)});continue}r.push({kind:"individual",key:u.id,agent:u})}return{detected:r,notDetected:i}}function ww({agents:a,activeAgentId:r,focusedAgentId:i,onFocusAgent:o,onSwitch:u,onOpenSetup:m,onClose:f}){const h=v.useRef(null);v.useEffect(()=>{const y=g=>{g.key==="Escape"&&(g.preventDefault(),f())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[f]),v.useEffect(()=>{const y=j=>{h.current&&!h.current.contains(j.target)&&f()},g=setTimeout(()=>{document.addEventListener("mousedown",y)},0);return()=>{clearTimeout(g),document.removeEventListener("mousedown",y)}},[f]);const x=v.useMemo(()=>kw(a),[a]),p=a.find(y=>y.id===i)??a.find(y=>y.id===r)??a[0];return typeof document>"u"?null:fo.createPortal(n.jsxs("div",{ref:h,"data-testid":"agent-scope-picker-popover",role:"dialog","aria-label":Z.scopePicker.popoverTitle,style:{position:"fixed",top:96,left:"50%",transform:"translateX(-50%)",width:600,maxWidth:"calc(100vw - 32px)",background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,boxShadow:"0 18px 40px rgba(0,0,0,0.25)",overflow:"hidden",zIndex:90,animation:"scopePickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[n.jsxs("div",{style:{display:"flex",height:360,maxHeight:"60vh"},children:[n.jsxs("section",{"data-testid":"agent-scope-picker-agents",style:{width:260,borderRight:"1px solid var(--border-default, var(--border-subtle))",overflowY:"auto",padding:"6px 0"},children:[x.detected.length===0&&x.notDetected.length===0&&n.jsx(Jx,{}),x.detected.map(y=>y.kind==="aggregate"?n.jsx(Nw,{row:y,onFocus:()=>{var g;return o(((g=y.consumers[0])==null?void 0:g.id)??r??"")}},y.key):n.jsx(Cw,{agent:y.agent,focused:y.agent.id===i,active:y.agent.id===r,onClick:()=>o(y.agent.id)},y.key)),x.notDetected.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("div",{"data-testid":"agent-scope-not-detected-subheading",style:{padding:"10px 14px 4px",fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-tertiary)"},children:Z.scopePicker.notDetectedSubheading}),x.notDetected.map(y=>n.jsx(Ew,{agent:y.agent,onSetUp:()=>m(y.agent.id)},y.key))]})]}),n.jsx("section",{"data-testid":"agent-scope-picker-stats",style:{flex:1,overflowY:"auto",padding:"14px 16px"},children:p?n.jsx(Tw,{agent:p,activeAgentId:r,onSwitch:()=>u(p.id)}):n.jsx(Jx,{})})]}),n.jsx("style",{children:`@keyframes scopePickerFadeIn {
87
+ }`})]})]}),document.body)}function vw({title:a,onClose:r}){return n.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 20px",borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:[n.jsx("h2",{style:{fontFamily:"var(--font-serif)",fontSize:18,fontWeight:500,margin:0,color:"var(--text-primary)"},children:Z.setupDrawer.title(a)}),n.jsx("button",{type:"button","data-testid":"setup-drawer-close",onClick:r,"aria-label":Z.setupDrawer.close,style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:18,padding:4,lineHeight:1},children:"×"})]})}function gw({content:a}){var r,i;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[n.jsx("p",{style:{fontSize:14,lineHeight:1.5,color:"var(--text-primary)",margin:0},children:a.description}),a.notes&&a.notes.length>0&&n.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:6},children:a.notes.map(o=>n.jsx("li",{style:{fontSize:13,color:"var(--text-secondary)",padding:"8px 10px",background:"color-mix(in srgb, var(--accent-surface) 8%, transparent)",borderRadius:4},children:o},o))}),a.envVars.length>0&&n.jsxs("section",{children:[n.jsx("h3",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",margin:"0 0 8px"},children:Z.setupDrawer.requiredEnv}),n.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:6},children:a.envVars.map(o=>n.jsx("li",{children:n.jsx(bw,{name:o})},o))})]}),a.keyUrl&&n.jsx(jw,{href:a.keyUrl,label:Z.setupDrawer.getKey,testId:"setup-drawer-get-key"}),(a.install||a.start||a.pullExample)&&n.jsxs("section",{children:[n.jsx("h3",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",margin:"0 0 8px"},children:Z.setupDrawer.installRun}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(r=a.install)==null?void 0:r.map((o,u)=>n.jsx(ad,{code:o},`install-${u}`)),(i=a.start)==null?void 0:i.map((o,u)=>n.jsx(ad,{code:o},`start-${u}`)),a.pullExample&&n.jsx(ad,{code:a.pullExample})]})]}),n.jsx("footer",{style:{marginTop:8},children:n.jsxs("a",{href:a.learnMoreUrl,target:"_blank",rel:"noopener noreferrer","data-testid":"setup-drawer-learn-more",style:{fontSize:12,color:"var(--color-accent, var(--accent-surface))",textDecoration:"none"},children:[Z.setupDrawer.learnMore," →"]})})]})}function yw(){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[n.jsx("h3",{style:{margin:0,fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:Z.setupDrawer.fallbackTitle}),n.jsx("p",{style:{margin:0,fontSize:13,color:"var(--text-secondary)",lineHeight:1.5},children:Z.setupDrawer.fallbackBody})]})}function bw({name:a}){const r=async()=>{var i;try{await((i=navigator.clipboard)==null?void 0:i.writeText(a))}catch{}};return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",background:"color-mix(in srgb, var(--border-default) 30%, transparent)",borderRadius:4},children:[n.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",flex:1},children:a}),n.jsx("button",{type:"button",onClick:r,"aria-label":`Copy ${a} to clipboard`,style:{background:"transparent",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:3,padding:"2px 8px",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-sans)",cursor:"pointer"},children:Z.setupDrawer.copy})]})}function ad({code:a}){return n.jsx("pre",{style:{margin:0,padding:"8px 10px",background:"var(--bg-canvas, #111)",color:"var(--text-primary)",fontFamily:"var(--font-mono)",fontSize:11.5,lineHeight:1.5,borderRadius:4,border:"1px solid var(--border-default, var(--border-subtle))",overflowX:"auto",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:a})}function jw({href:a,label:r,testId:i}){return n.jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer","data-testid":i,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6,padding:"8px 14px",borderRadius:6,border:"1px solid var(--border-default, var(--border-subtle))",background:"color-mix(in srgb, var(--accent-surface) 12%, transparent)",color:"var(--text-primary)",textDecoration:"none",fontSize:13,fontWeight:500,fontFamily:"var(--font-sans)",width:"fit-content"},children:[r," →"]})}function Sw(){const[a,r]=v.useState(!1),[i,o]=v.useState(null),u=v.useRef(null),m=v.useCallback((h,x)=>{var p;u.current=typeof document<"u"?document.activeElement:null,(p=x==null?void 0:x.beforeOpen)==null||p.call(x),o(h),r(!0)},[]),f=v.useCallback(()=>{r(!1);const h=u.current;h&&"focus"in h&&typeof h.focus=="function"&&queueMicrotask(()=>h.focus())},[]);return{open:m,close:f,isOpen:a,providerKey:i}}function kw(a){const r=[],i=[],o=new Set;for(const u of a){if(u.presence==="absent"||u.health==="missing"){i.push({kind:"individual",key:u.id,agent:u});continue}if(u.sharedFolderGroup&&u.sharedFolderGroup.length>1){const m=[...u.sharedFolderGroup].sort().join("+");if(o.has(m))continue;o.add(m);const f=a.filter(h=>u.sharedFolderGroup.includes(h.id));r.push({kind:"aggregate",key:`shared:${m}`,consumers:f,sharedFolderPath:u.sharedFolderPath??"~/.config/agents/skills",combinedCount:f.reduce((h,x)=>h+x.globalCount,0)});continue}r.push({kind:"individual",key:u.id,agent:u})}return{detected:r,notDetected:i}}function ww({agents:a,activeAgentId:r,focusedAgentId:i,onFocusAgent:o,onSwitch:u,onOpenSetup:m,onClose:f}){const h=v.useRef(null);v.useEffect(()=>{const y=g=>{g.key==="Escape"&&(g.preventDefault(),f())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[f]),v.useEffect(()=>{const y=j=>{h.current&&!h.current.contains(j.target)&&f()},g=setTimeout(()=>{document.addEventListener("mousedown",y)},0);return()=>{clearTimeout(g),document.removeEventListener("mousedown",y)}},[f]);const x=v.useMemo(()=>kw(a),[a]),p=a.find(y=>y.id===i)??a.find(y=>y.id===r)??a[0];return typeof document>"u"?null:fo.createPortal(n.jsxs("div",{ref:h,"data-testid":"agent-scope-picker-popover",role:"dialog","aria-label":Z.scopePicker.popoverTitle,style:{position:"fixed",top:96,left:"50%",transform:"translateX(-50%)",width:600,maxWidth:"calc(100vw - 32px)",background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,boxShadow:"0 18px 40px rgba(0,0,0,0.25)",overflow:"hidden",zIndex:90,animation:"scopePickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[n.jsxs("div",{style:{display:"flex",height:360,maxHeight:"60vh"},children:[n.jsxs("section",{"data-testid":"agent-scope-picker-agents",style:{width:260,borderRight:"1px solid var(--border-default, var(--border-subtle))",overflowY:"auto",padding:"6px 0"},children:[x.detected.length===0&&x.notDetected.length===0&&n.jsx(ev,{}),x.detected.map(y=>y.kind==="aggregate"?n.jsx(Nw,{row:y,onFocus:()=>{var g;return o(((g=y.consumers[0])==null?void 0:g.id)??r??"")}},y.key):n.jsx(Cw,{agent:y.agent,focused:y.agent.id===i,active:y.agent.id===r,onClick:()=>o(y.agent.id)},y.key)),x.notDetected.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("div",{"data-testid":"agent-scope-not-detected-subheading",style:{padding:"10px 14px 4px",fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-tertiary)"},children:Z.scopePicker.notDetectedSubheading}),x.notDetected.map(y=>n.jsx(Ew,{agent:y.agent,onSetUp:()=>m(y.agent.id)},y.key))]})]}),n.jsx("section",{"data-testid":"agent-scope-picker-stats",style:{flex:1,overflowY:"auto",padding:"14px 16px"},children:p?n.jsx(Tw,{agent:p,activeAgentId:r,onSwitch:()=>u(p.id)}):n.jsx(ev,{})})]}),n.jsx("style",{children:`@keyframes scopePickerFadeIn {
88
88
  from { opacity: 0; transform: translateX(-50%) translateY(2px); }
89
89
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
90
- }`})]}),document.body)}function Cw({agent:a,focused:r,active:i,onClick:o}){const u=a.health==="ok"?"var(--color-ok, #22c55e)":a.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)";return n.jsxs("button",{type:"button","data-testid":"agent-scope-row","data-agent-id":a.id,"data-active":i?"true":"false",onClick:o,style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 14px",background:r?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",border:"none",cursor:"pointer",textAlign:"left",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:u,flexShrink:0}}),n.jsx("span",{style:{flex:1,fontSize:13},children:a.displayName}),n.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[a.installedCount,"·",a.globalCount]})]})}function Nw({row:a,onFocus:r}){return n.jsxs("button",{type:"button","data-testid":"agent-scope-shared-folder-row",onClick:r,style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4,width:"100%",padding:"8px 14px",background:"transparent",border:"none",borderTop:"1px dashed var(--border-subtle)",borderBottom:"1px dashed var(--border-subtle)",cursor:"pointer",textAlign:"left",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)"},children:a.sharedFolderPath}),n.jsxs("span",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[a.consumers.map(i=>n.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:10,background:"color-mix(in srgb, var(--color-global) 20%, transparent)",color:"var(--text-primary)"},children:i.id},i.id)),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontFamily:"var(--font-mono)"},children:["· ",a.combinedCount," skills"]})]})]})}function Ew({agent:a,onSetUp:r}){return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"6px 14px",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:12},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--text-tertiary)",flexShrink:0}}),n.jsx("span",{style:{flex:1},children:a.displayName}),a.isRemoteOnly?n.jsx("span",{"data-testid":`agent-scope-remote-badge-${a.id}`,"aria-label":"Remote-only agent",style:{background:"color-mix(in srgb, var(--text-tertiary) 18%, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:10,padding:"1px 8px",color:"var(--text-secondary)",fontSize:10,letterSpacing:"0.04em",textTransform:"uppercase"},children:"Remote"}):n.jsx("button",{type:"button","data-testid":`agent-scope-set-up-${a.id}`,onClick:r,style:{background:"transparent",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:4,padding:"2px 8px",color:"var(--text-primary)",fontSize:11,cursor:"pointer"},children:Z.scopePicker.setUpCta(a.displayName)})]})}function Tw({agent:a,activeAgentId:r,onSwitch:i}){const o=a.id===r,u=a.isRemoteOnly===!0,m=o||u,f=o?"Active":u?"Remote-only":Z.scopePicker.switchCta;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[n.jsxs("div",{children:[n.jsx("div",{style:{fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:a.displayName}),n.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:2},children:u?"Remote service — no local install":Aw(a.health)})]}),n.jsxs("dl",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"4px 12px",margin:0,fontSize:12},children:[n.jsx(ld,{label:Z.scopePicker.statsInstalled,value:String(a.installedCount)}),n.jsx(ld,{label:Z.scopePicker.statsGlobal,value:String(a.globalCount)}),n.jsx(ld,{label:Z.scopePicker.statsLastSync,value:a.lastSync?Rw(a.lastSync):"—"})]}),n.jsx("button",{type:"button","data-testid":"agent-scope-switch",onClick:i,disabled:m,title:u?"This agent has no local CLI to switch to":void 0,style:{alignSelf:"flex-start",padding:"8px 14px",borderRadius:6,border:"1px solid var(--border-default, var(--border-subtle))",background:m?"transparent":"color-mix(in srgb, var(--accent-surface) 20%, transparent)",color:"var(--text-primary)",fontSize:12,fontWeight:500,fontFamily:"var(--font-sans)",cursor:m?"default":"pointer",opacity:m?.5:1},children:f})]})}function ld({label:a,value:r}){return n.jsxs(n.Fragment,{children:[n.jsx("dt",{style:{color:"var(--text-secondary)",margin:0},children:a}),n.jsx("dd",{style:{color:"var(--text-primary)",margin:0,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums"},children:r})]})}function Jx(){return n.jsx("div",{style:{padding:"16px 18px",fontSize:12,color:"var(--text-secondary)"},children:"No agents detected yet."})}function Rw(a){try{const r=new Date(a).getTime(),i=Date.now()-r;if(Number.isNaN(r))return"—";const o=Math.round(i/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const u=Math.round(o/60);return u<24?`${u}h ago`:`${Math.round(u/24)}d ago`}catch{return"—"}}function Aw(a){switch(a){case"ok":return Z.scopePicker.statsHealthOk;case"stale":return Z.scopePicker.statsHealthStale;case"missing":return Z.scopePicker.statsHealthMissing}}function Mw(a){const r=new Map;for(const i of a.sharedFolders??[])for(const o of i.consumers)r.set(o,i);return a.agents.map(i=>{const o=r.get(i.id);return{id:i.id,displayName:i.displayName,presence:i.detected?"detected":"absent",installedCount:i.localSkillCount,globalCount:i.globalSkillCount,lastSync:i.lastSync,health:i.health,sharedFolderGroup:o?o.consumers:void 0,sharedFolderPath:o?o.path:void 0,isRemoteOnly:i.isRemoteOnly}})}function Dw({agents:a,activeAgentId:r,onActiveAgentChange:i,onOpenSetup:o}){const[u,m]=v.useState(!1),[f,h]=v.useState(null),x=v.useRef(null),p=v.useMemo(()=>a.find(S=>S.id===r)??a[0]??null,[a,r]),y=v.useMemo(()=>p?p.health==="ok"?"var(--color-ok, #22c55e)":p.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)":"var(--text-tertiary)",[p]),g=v.useCallback(()=>{var S;m(!1),(S=x.current)==null||S.focus()},[]),j=v.useCallback(S=>{i(S),m(!1)},[i]);return n.jsxs(n.Fragment,{children:[n.jsxs("button",{ref:x,type:"button","data-testid":"agent-scope-picker-trigger","aria-haspopup":"dialog","aria-expanded":u,onClick:()=>m(S=>!S),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),m(!0))},style:{display:"flex",alignItems:"center",gap:10,height:"40px",width:"100%",padding:"0 14px",background:"var(--bg-surface, var(--surface-1))",border:"none",borderBottom:"1px solid var(--border-default, var(--border-subtle))",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500,textAlign:"left",position:"sticky",top:0,zIndex:2},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:y,flexShrink:0}}),n.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(p==null?void 0:p.displayName)??"Select agent"}),n.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:["(",(p==null?void 0:p.installedCount)??0," · ",(p==null?void 0:p.globalCount)??0,")"]}),n.jsx("span",{"aria-hidden":"true",style:{fontSize:10,color:"var(--text-secondary)"},children:"▾"})]}),u&&n.jsx(ww,{agents:a,activeAgentId:r,focusedAgentId:f??r,onFocusAgent:h,onSwitch:j,onOpenSetup:S=>{o(S),g()},onClose:g})]})}const xg="vskill-ccode-banner-dismissed",zw=new Set(["claude-cli","claude-code"]);function Lw(){try{return sessionStorage.getItem(xg)==="true"}catch{return!1}}function _w(){try{sessionStorage.setItem(xg,"true")}catch{}}function Ow({activeAgentId:a}){const[r,i]=v.useState(()=>Lw()),o=v.useCallback(()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:open-setup-drawer",{detail:{provider:"claude-code"}}))},[]),u=v.useCallback(()=>{_w(),i(!0)},[]);return!a||!zw.has(a)||r?null:n.jsxs("div",{"data-testid":"claude-code-first-use-banner",role:"note","aria-label":"Claude Code subscription info",style:{display:"flex",alignItems:"flex-start",gap:10,padding:"8px 12px",borderBottom:"1px solid var(--border-default, var(--border-subtle))",background:"color-mix(in srgb, var(--accent-surface) 8%, transparent)",fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-primary)",lineHeight:1.45},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--color-ok, #22c55e)",marginTop:6,flexShrink:0}}),n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsxs("span",{children:[Z.claudeCodeLabel.firstUseBanner," "]}),n.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-learn-more",onClick:o,style:{background:"transparent",border:"none",padding:0,color:"var(--color-accent, var(--accent-surface))",cursor:"pointer",textDecoration:"underline",fontFamily:"inherit",fontSize:"inherit"},children:Z.claudeCodeLabel.learnMore})]}),n.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-dismiss",onClick:u,"aria-label":"Dismiss Claude Code info banner",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1,padding:2,flexShrink:0},children:"×"})]})}function Bw(){const[a,r]=v.useState(null),[i,o]=v.useState("loading"),[u,m]=v.useState(null),f=v.useCallback(async()=>{try{const h=await Ne.getAgents();r(h),o("ready"),m(null)}catch(h){o("error"),m(h.message)}},[]);return v.useEffect(()=>{f()},[f]),v.useEffect(()=>{const h=()=>void f();return window.addEventListener("studio:agent-changed",h),()=>window.removeEventListener("studio:agent-changed",h)},[f]),{status:i,response:a,error:u,refresh:()=>void f()}}const eo="workspace",Uw=["skills","agents"];async function Hw(){const a=await fetch("/api/workspace");if(!a.ok)throw new Error(`GET /api/workspace failed: ${a.status}`);return await a.json()}async function Iw(a){const r=await fetch("/api/workspace/active",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a})});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`POST /api/workspace/active failed: ${r.status}`)}return await r.json()}async function Vw(a){const r=await fetch("/api/workspace/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`POST /api/workspace/projects failed: ${r.status}`)}return await r.json()}async function $w(a){const r=await fetch(`/api/workspace/projects/${encodeURIComponent(a)}`,{method:"DELETE"});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`DELETE /api/workspace/projects/${a} failed: ${r.status}`)}return await r.json()}function rd(){for(const a of Uw)ga(a)}function Gw(){const{data:a,loading:r,error:i,revalidate:o}=Ds(eo,Hw),u=a,m=u==null?void 0:u.projects.find(p=>p.id===u.activeProjectId),f=v.useCallback(async p=>{await Iw(p),ga(eo),rd()},[]),h=v.useCallback(async p=>{await Vw(p),ga(eo),rd()},[]),x=v.useCallback(async p=>{await $w(p),ga(eo),rd()},[]);return{workspace:u,activeProject:m,loading:r,error:i,switchProject:f,addProject:h,removeProject:x,revalidate:o}}function Pw({workspace:a,onSwitch:r,onAdd:i,onRemove:o,isPathStale:u}){const[m,f]=v.useState(!1),[h,x]=v.useState(!1),[p,y]=v.useState(""),[g,j]=v.useState(null),S=(a==null?void 0:a.projects)??[],N=S.find(k=>k.id===(a==null?void 0:a.activeProjectId));async function M(){j(null);const k=p.trim();if(!k){j("Enter an absolute project path");return}try{await i({path:k}),y(""),x(!1)}catch(T){j(T instanceof Error?T.message:String(T))}}async function E(){if(j(null),typeof window<"u"&&"showDirectoryPicker"in window)try{const k=await window.showDirectoryPicker();y(k.name)}catch{}else x(!0)}return n.jsxs("div",{"data-vskill-project-picker":!0,className:"relative inline-block",children:[n.jsxs("button",{type:"button",onClick:()=>f(k=>!k),"aria-expanded":m,"aria-haspopup":"menu",className:"vskill-project-pill flex items-center gap-2 px-2 py-1 text-sm font-mono",children:[n.jsx("span",{"data-testid":"project-color-dot","aria-hidden":!0,className:"vskill-project-dot inline-block w-2 h-2 rounded-full",style:{backgroundColor:(N==null?void 0:N.colorDot)??"var(--muted-foreground)"}}),n.jsx("span",{className:"vskill-project-name",children:N?N.name:"No project selected"})]}),m&&n.jsxs("div",{role:"menu",className:"vskill-project-popover absolute top-full left-0 mt-1 min-w-64 border rounded shadow-md bg-background z-10",children:[S.length===0&&n.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No projects — add one to begin."}),S.map(k=>{const T=u?u(k.path):!1;return n.jsxs("div",{role:"menuitem","data-stale":T?"true":"false",className:["flex items-center gap-2 px-3 py-2",T?"opacity-50 pointer-events-none-selection":"cursor-pointer hover:bg-muted"].join(" "),children:[n.jsx("span",{"aria-hidden":!0,className:"inline-block w-2 h-2 rounded-full",style:{backgroundColor:k.colorDot}}),n.jsxs("button",{type:"button",disabled:T,onClick:()=>{T||(r(k.id),f(!1))},className:"flex-1 text-left text-sm",children:[n.jsx("div",{className:"vskill-project-row-name",children:k.name}),n.jsx("div",{className:"vskill-project-row-path text-xs font-mono text-muted-foreground",children:k.path}),T&&n.jsx("div",{className:"text-xs text-amber-600",children:"Stale — path no longer exists."})]}),n.jsx("button",{type:"button","aria-label":`Remove ${k.name}`,onClick:B=>{B.stopPropagation(),o(k.id)},className:"px-2 text-xs text-muted-foreground hover:text-destructive",children:"Remove"})]},k.id)}),n.jsxs("div",{className:"border-t px-3 py-2 text-xs",children:[!h&&n.jsx("button",{type:"button",onClick:()=>void E(),className:"vskill-project-add text-xs text-primary hover:underline",children:"+ Add project"}),h&&n.jsxs("div",{className:"flex gap-1",children:[n.jsx("input",{type:"text",value:p,onChange:k=>y(k.target.value),placeholder:"/absolute/path/to/project",className:"flex-1 px-2 py-1 text-xs border rounded",autoFocus:!0}),n.jsx("button",{type:"button",onClick:()=>void M(),className:"text-xs",children:"Add"})]}),g&&n.jsx("div",{className:"mt-1 text-xs text-destructive",children:g})]})]})]})}function qw(a,r){const i=r.trim().toLowerCase().split(/\s+/).filter(Boolean);return i.length===0?a:a.filter(o=>{const u=`${o.name} ${o.path}`.toLowerCase();return i.every(m=>u.includes(m))})}function Yw({open:a,projects:r,onSwitch:i,onClose:o}){const[u,m]=v.useState(""),[f,h]=v.useState(0),x=v.useMemo(()=>qw(r,u),[r,u]);v.useEffect(()=>{a||(m(""),h(0))},[a]),v.useEffect(()=>{f>=x.length&&h(0)},[x.length,f]);const p=y=>{if(y.key==="Escape"){y.preventDefault(),o();return}if(y.key==="ArrowDown"){y.preventDefault(),h(g=>Math.min(g+1,Math.max(x.length-1,0)));return}if(y.key==="ArrowUp"){y.preventDefault(),h(g=>Math.max(g-1,0));return}if(y.key==="Enter"){y.preventDefault();const g=x[f];g&&(i(g.id),o())}};return a?n.jsxs("div",{role:"dialog","aria-modal":"true","data-vskill-project-palette":!0,className:"vskill-project-palette fixed inset-0 z-50 flex items-start justify-center pt-24",children:[n.jsx("div",{className:"absolute inset-0 bg-black/30",onClick:o}),n.jsxs("div",{className:"relative w-[520px] max-w-[92vw] bg-background border rounded shadow-lg",children:[n.jsx("input",{type:"text",autoFocus:!0,value:u,onChange:y=>m(y.target.value),onKeyDown:p,placeholder:"Switch project…",className:"w-full px-3 py-2 text-sm border-b outline-none"}),n.jsxs("ul",{role:"listbox",className:"max-h-80 overflow-auto",children:[x.length===0&&n.jsx("li",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No matches."}),x.map((y,g)=>n.jsxs("li",{role:"option","aria-selected":g===f,"data-highlighted":g===f,className:["flex items-center gap-2 px-3 py-2 text-sm cursor-pointer",g===f?"bg-muted":""].join(" "),onMouseEnter:()=>h(g),onClick:()=>{i(y.id),o()},children:[n.jsx("span",{"aria-hidden":!0,className:"inline-block w-2 h-2 rounded-full",style:{backgroundColor:y.colorDot}}),n.jsxs("span",{className:"flex-1",children:[n.jsx("span",{className:"vskill-palette-name",children:y.name}),n.jsx("span",{className:"ml-2 vskill-palette-path text-xs font-mono text-muted-foreground",children:y.path})]})]},y.id))]})]})]}):null}const vg="vskill.studio.prefs";function gg(){try{return typeof window>"u"?null:window.localStorage??null}catch{return null}}function yg(){const a=gg();if(!a)return{};try{const r=a.getItem(vg);if(!r)return{};const i=JSON.parse(r);return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}catch{return{}}}function Fw(a,r){const i=gg();if(i)try{const u={...yg(),[a]:r};i.setItem(vg,JSON.stringify(u))}catch{}}function Kw(a,r){const o=yg()[a];return o===void 0?r:o}const ev={open:!1,x:0,y:0,skill:null};function Ww(a,r){return{open:!0,x:a.clientX,y:a.clientY,skill:r}}function xl(a,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:a,severity:r}}))}function Qw(a,r){var i;switch(a){case"copy-path":try{(i=navigator.clipboard)==null||i.writeText(r.dir)}catch{xl(Z.toasts.permissionDenied,"error");return}xl(Z.toasts.pathCopied,"info");return;case"open":case"reveal":case"edit":xl(Z.actions.editPlaceholder,"info");return;case"run-benchmark":xl(Z.toasts.benchmarkQueued,"info");return;case"duplicate":xl(Z.toasts.skillDuplicated,"info");return;case"update":xl(Z.toasts.skillUpdated,"info");return;case"uninstall":xl(Z.actions.editPlaceholder,"info");return;default:return}}const Xw=v.lazy(()=>jd(()=>import("./CommandPalette-9-Hnt3XO.js"),__vite__mapDeps([2,1])));function Zw(){return n.jsx(cb,{children:n.jsx(sb,{children:n.jsxs(Jk,{children:[n.jsx(Jw,{}),n.jsx(cw,{})]})})})}function Jw(){var ge,xe;const{state:a,selectSkill:r,clearSelection:i,refreshSkills:o,outdatedByOrigin:u}=ya(),{config:m}=bl(),{mode:f,resolvedTheme:h,setTheme:x}=cv(),{toast:p}=Hd(),[y,g]=v.useState(()=>w2()),[j]=v.useState(!0),[S,N]=v.useState(!1),[M,E]=v.useState(!1),[k,T]=v.useState(!1),[B,I]=v.useState("overview"),[L,V]=v.useState(ev),w=v.useCallback((oe,ae)=>{V(Ww(oe,ae))},[]),D=Bw(),[A,O]=v.useState(()=>Kw("activeAgent",null));v.useEffect(()=>{var oe;!A&&((oe=D.response)!=null&&oe.suggested)&&O(D.response.suggested)},[A,(ge=D.response)==null?void 0:ge.suggested]);const G=v.useCallback(oe=>{O(oe),Fw("activeAgent",oe),typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:agent-changed",{detail:{agentId:oe}}))},[]),q=v.useMemo(()=>D.response?Mw(D.response):[],[D.response]),{workspace:te,switchProject:X,addProject:_,removeProject:R}=Gw(),[U,se]=v.useState(!1);md([{key:"p",meta:!0,handler:oe=>{var ve;const ae=typeof document<"u"?document.activeElement:null;ae&&ae.tagName==="INPUT"||((ve=oe==null?void 0:oe.preventDefault)==null||ve.call(oe),se(Ie=>!Ie))}}],{enabled:!0});const Y=Sw();v.useEffect(()=>{function oe(ae){if(!(ae instanceof CustomEvent))return;const ve=ae.detail;ve!=null&&ve.provider&&Y.open(ve.provider)}return window.addEventListener("studio:open-setup-drawer",oe),()=>window.removeEventListener("studio:open-setup-drawer",oe)},[Y]);const me=v.useCallback(()=>{V(ev)},[]);v.useEffect(()=>{function oe(ae){if(!(ae instanceof CustomEvent))return;const ve=ae.detail;ve!=null&&ve.message&&p({message:ve.message,severity:ve.severity??"info"})}return window.addEventListener("studio:toast",oe),()=>window.removeEventListener("studio:toast",oe)},[p]),v.useEffect(()=>{document.documentElement.style.setProperty("--sidebar-width",`${y}px`)},[y]);const z=v.useMemo(()=>a.selectedSkill?a.skills.find(oe=>oe.plugin===a.selectedSkill.plugin&&oe.skill===a.selectedSkill.skill)??null:null,[a.skills,a.selectedSkill]),W=v.useCallback(oe=>{r({plugin:oe.plugin,skill:oe.skill,origin:oe.origin})},[r]),ie=v.useMemo(()=>{if(!a.selectedSkill)return"";const oe=a.selectedSkill.origin==="installed"?"Installed":"Own";return`Viewing ${a.selectedSkill.skill} (${oe})`},[a.selectedSkill]),de=v.useMemo(()=>[{id:"switch-theme",label:Z.palette.actionSwitchTheme,description:"Cycle light / dark / auto",keywords:["theme","dark","light","mode"],onInvoke:()=>x(f==="light"?"dark":f==="dark"?"auto":"light")},{id:"toggle-sidebar",label:"Toggle sidebar",description:"Show or hide the skills sidebar",keywords:["sidebar","panel","hide","show","cmd+b"],onInvoke:()=>T(oe=>!oe)},{id:"show-shortcuts",label:"Show keyboard shortcuts",description:"Open the cheatsheet",keywords:["help","keys"],onInvoke:()=>E(!0)},{id:"refresh-skills",label:"Refresh skills",description:"Re-scan local + installed",keywords:["reload","scan"],onInvoke:()=>o()}],[f,x,o]);return md([{key:"cmd+k",handler:()=>N(oe=>!oe)},{key:"ctrl+k",handler:()=>N(oe=>!oe)},{key:"?",handler:()=>E(oe=>!oe)},{key:"cmd+shift+d",handler:()=>x(h==="light"?"dark":"light")},{key:"ctrl+shift+d",handler:()=>x(h==="light"?"dark":"light")},{key:"cmd+b",handler:()=>T(oe=>!oe)},{key:"ctrl+b",handler:()=>T(oe=>!oe)},{key:"e",handler:()=>p({message:Z.actions.editPlaceholder,severity:"info"})}]),n.jsxs(n.Fragment,{children:[n.jsx(ub,{sidebarWidth:y,sidebarHidden:k||a.isMobile&&a.mobileView==="detail",banner:n.jsx(E2,{connected:j}),liveMessage:ie,topRail:n.jsx(c0,{projectName:(m==null?void 0:m.projectName)??null,selected:a.selectedSkill,onOpenPalette:()=>N(!0),onHome:i,projectPickerSlot:te&&te.projects.length>0?n.jsx(Pw,{workspace:te,onSwitch:X,onAdd:_,onRemove:R}):void 0}),sidebar:n.jsx(h2,{skills:a.skills,selectedKey:a.selectedSkill?{plugin:a.selectedSkill.plugin,skill:a.selectedSkill.skill}:null,onSelect:W,isLoading:a.skillsLoading,error:a.skillsError??null,onRetry:o,onContextMenu:w,outdatedByOrigin:u,activeAgentId:A,topSlot:D.status==="ready"&&q.length>0?n.jsxs(n.Fragment,{children:[n.jsx(Dw,{agents:q,activeAgentId:A,onActiveAgentChange:G,onOpenSetup:oe=>Y.open(oe)}),n.jsx(Ow,{activeAgentId:A})]}):null}),resizeHandle:n.jsx(N2,{initialWidth:y??js,onChange:g}),main:n.jsx(nw,{selectedSkillInfo:z,activeDetailTab:B,onDetailTabChange:I,allSkills:a.skills,onSelectSkill:W}),statusBar:n.jsx(b0,{projectPath:(m==null?void 0:m.root)??null,modelName:(m==null?void 0:m.model)??null,health:m!=null&&m.error?"degraded":"ok",providers:(xe=m==null?void 0:m.providers)==null?void 0:xe.map(oe=>{const ae=oe.id;return{id:ae,label:oe.label,available:oe.available,kind:ae==="ollama"||ae==="lm-studio"?"start-service":ae==="anthropic"||ae==="openrouter"?"api-key":"cli-install"}})})}),n.jsx(dw,{open:M,onClose:()=>E(!1)}),n.jsx(xw,{open:Y.isOpen,providerKey:Y.providerKey,onClose:Y.close}),n.jsx(pw,{state:L,onClose:me,onAction:(oe,ae)=>Qw(oe,ae)}),S&&n.jsx(v.Suspense,{fallback:null,children:n.jsx(Xw,{open:S,onClose:()=>N(!1),commands:de})}),n.jsx(Yw,{open:U,projects:(te==null?void 0:te.projects)??[],onSwitch:oe=>{X(oe)},onClose:()=>se(!1)})]})}const tv="vskill.migrations.scope-rename.v1",eC={own:"authoring-project",installed:"available-project",global:"available-personal"},tC=/^vskill-sidebar-(.+)-(own|installed|global)-collapsed$/;function nC(a){if(a.getItem(tv)==="done")return;const r=[];for(let i=0;i<a.length;i++){const o=a.key(i);if(!o)continue;const u=o.match(tC);if(!u)continue;const[,m,f]=u,h=eC[f];if(!h)continue;const x=a.getItem(o);x!==null&&r.push({oldKey:o,newKey:`vskill-sidebar-${m}-${h}-collapsed`,value:x})}for(const{oldKey:i,newKey:o,value:u}of r)a.getItem(o)===null&&a.setItem(o,u),a.removeItem(i);a.setItem(tv,"done")}if(typeof PerformanceObserver<"u")try{const a=new PerformanceObserver(r=>{for(const i of r.getEntries())if(i.name==="first-contentful-paint"){window.__vskillPaint=i.startTime,a.disconnect();return}});a.observe({type:"paint",buffered:!0})}catch{}if(typeof window<"u"&&window.localStorage)try{nC(window.localStorage)}catch{}I1.createRoot(document.getElementById("root")).render(n.jsx(v.StrictMode,{children:n.jsx(h0,{children:n.jsx(Zw,{})})}));export{n as j,v as r,Z as s};
90
+ }`})]}),document.body)}function Cw({agent:a,focused:r,active:i,onClick:o}){const u=a.health==="ok"?"var(--color-ok, #22c55e)":a.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)";return n.jsxs("button",{type:"button","data-testid":"agent-scope-row","data-agent-id":a.id,"data-active":i?"true":"false",onClick:o,style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 14px",background:r?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",border:"none",cursor:"pointer",textAlign:"left",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:u,flexShrink:0}}),n.jsx("span",{style:{flex:1,fontSize:13},children:a.displayName}),n.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[a.installedCount,"·",a.globalCount]})]})}function Nw({row:a,onFocus:r}){return n.jsxs("button",{type:"button","data-testid":"agent-scope-shared-folder-row",onClick:r,style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4,width:"100%",padding:"8px 14px",background:"transparent",border:"none",borderTop:"1px dashed var(--border-subtle)",borderBottom:"1px dashed var(--border-subtle)",cursor:"pointer",textAlign:"left",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)"},children:a.sharedFolderPath}),n.jsxs("span",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[a.consumers.map(i=>n.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:10,background:"color-mix(in srgb, var(--color-global) 20%, transparent)",color:"var(--text-primary)"},children:i.id},i.id)),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontFamily:"var(--font-mono)"},children:["· ",a.combinedCount," skills"]})]})]})}function Ew({agent:a,onSetUp:r}){return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"6px 14px",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:12},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--text-tertiary)",flexShrink:0}}),n.jsx("span",{style:{flex:1},children:a.displayName}),a.isRemoteOnly?n.jsx("span",{"data-testid":`agent-scope-remote-badge-${a.id}`,"aria-label":"Remote-only agent",style:{background:"color-mix(in srgb, var(--text-tertiary) 18%, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:10,padding:"1px 8px",color:"var(--text-secondary)",fontSize:10,letterSpacing:"0.04em",textTransform:"uppercase"},children:"Remote"}):n.jsx("button",{type:"button","data-testid":`agent-scope-set-up-${a.id}`,onClick:r,style:{background:"transparent",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:4,padding:"2px 8px",color:"var(--text-primary)",fontSize:11,cursor:"pointer"},children:Z.scopePicker.setUpCta(a.displayName)})]})}function Tw({agent:a,activeAgentId:r,onSwitch:i}){const o=a.id===r,u=a.isRemoteOnly===!0,m=o||u,f=o?"Active":u?"Remote-only":Z.scopePicker.switchCta;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[n.jsxs("div",{children:[n.jsx("div",{style:{fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:a.displayName}),n.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:2},children:u?"Remote service — no local install":Aw(a.health)})]}),n.jsxs("dl",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"4px 12px",margin:0,fontSize:12},children:[n.jsx(ld,{label:Z.scopePicker.statsInstalled,value:String(a.installedCount)}),n.jsx(ld,{label:Z.scopePicker.statsGlobal,value:String(a.globalCount)}),n.jsx(ld,{label:Z.scopePicker.statsLastSync,value:a.lastSync?Rw(a.lastSync):"—"})]}),n.jsx("button",{type:"button","data-testid":"agent-scope-switch",onClick:i,disabled:m,title:u?"This agent has no local CLI to switch to":void 0,style:{alignSelf:"flex-start",padding:"8px 14px",borderRadius:6,border:"1px solid var(--border-default, var(--border-subtle))",background:m?"transparent":"color-mix(in srgb, var(--accent-surface) 20%, transparent)",color:"var(--text-primary)",fontSize:12,fontWeight:500,fontFamily:"var(--font-sans)",cursor:m?"default":"pointer",opacity:m?.5:1},children:f})]})}function ld({label:a,value:r}){return n.jsxs(n.Fragment,{children:[n.jsx("dt",{style:{color:"var(--text-secondary)",margin:0},children:a}),n.jsx("dd",{style:{color:"var(--text-primary)",margin:0,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums"},children:r})]})}function ev(){return n.jsx("div",{style:{padding:"16px 18px",fontSize:12,color:"var(--text-secondary)"},children:"No agents detected yet."})}function Rw(a){try{const r=new Date(a).getTime(),i=Date.now()-r;if(Number.isNaN(r))return"—";const o=Math.round(i/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const u=Math.round(o/60);return u<24?`${u}h ago`:`${Math.round(u/24)}d ago`}catch{return"—"}}function Aw(a){switch(a){case"ok":return Z.scopePicker.statsHealthOk;case"stale":return Z.scopePicker.statsHealthStale;case"missing":return Z.scopePicker.statsHealthMissing}}function Mw(a){const r=new Map;for(const i of a.sharedFolders??[])for(const o of i.consumers)r.set(o,i);return a.agents.map(i=>{const o=r.get(i.id);return{id:i.id,displayName:i.displayName,presence:i.detected?"detected":"absent",installedCount:i.localSkillCount,globalCount:i.globalSkillCount,lastSync:i.lastSync,health:i.health,sharedFolderGroup:o?o.consumers:void 0,sharedFolderPath:o?o.path:void 0,isRemoteOnly:i.isRemoteOnly}})}function Dw({agents:a,activeAgentId:r,onActiveAgentChange:i,onOpenSetup:o}){const[u,m]=v.useState(!1),[f,h]=v.useState(null),x=v.useRef(null),p=v.useMemo(()=>a.find(S=>S.id===r)??a[0]??null,[a,r]),y=v.useMemo(()=>p?p.health==="ok"?"var(--color-ok, #22c55e)":p.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)":"var(--text-tertiary)",[p]),g=v.useCallback(()=>{var S;m(!1),(S=x.current)==null||S.focus()},[]),j=v.useCallback(S=>{i(S),m(!1)},[i]);return n.jsxs(n.Fragment,{children:[n.jsxs("button",{ref:x,type:"button","data-testid":"agent-scope-picker-trigger","aria-haspopup":"dialog","aria-expanded":u,onClick:()=>m(S=>!S),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),m(!0))},style:{display:"flex",alignItems:"center",gap:10,height:"40px",width:"100%",padding:"0 14px",background:"var(--bg-surface, var(--surface-1))",border:"none",borderBottom:"1px solid var(--border-default, var(--border-subtle))",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500,textAlign:"left",position:"sticky",top:0,zIndex:2},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:y,flexShrink:0}}),n.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(p==null?void 0:p.displayName)??"Select agent"}),n.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:["(",(p==null?void 0:p.installedCount)??0," · ",(p==null?void 0:p.globalCount)??0,")"]}),n.jsx("span",{"aria-hidden":"true",style:{fontSize:10,color:"var(--text-secondary)"},children:"▾"})]}),u&&n.jsx(ww,{agents:a,activeAgentId:r,focusedAgentId:f??r,onFocusAgent:h,onSwitch:j,onOpenSetup:S=>{o(S),g()},onClose:g})]})}const vg="vskill-ccode-banner-dismissed",zw=new Set(["claude-cli","claude-code"]);function Lw(){try{return sessionStorage.getItem(vg)==="true"}catch{return!1}}function _w(){try{sessionStorage.setItem(vg,"true")}catch{}}function Ow({activeAgentId:a}){const[r,i]=v.useState(()=>Lw()),o=v.useCallback(()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:open-setup-drawer",{detail:{provider:"claude-code"}}))},[]),u=v.useCallback(()=>{_w(),i(!0)},[]);return!a||!zw.has(a)||r?null:n.jsxs("div",{"data-testid":"claude-code-first-use-banner",role:"note","aria-label":"Claude Code subscription info",style:{display:"flex",alignItems:"flex-start",gap:10,padding:"8px 12px",borderBottom:"1px solid var(--border-default, var(--border-subtle))",background:"color-mix(in srgb, var(--accent-surface) 8%, transparent)",fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-primary)",lineHeight:1.45},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--color-ok, #22c55e)",marginTop:6,flexShrink:0}}),n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsxs("span",{children:[Z.claudeCodeLabel.firstUseBanner," "]}),n.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-learn-more",onClick:o,style:{background:"transparent",border:"none",padding:0,color:"var(--color-accent, var(--accent-surface))",cursor:"pointer",textDecoration:"underline",fontFamily:"inherit",fontSize:"inherit"},children:Z.claudeCodeLabel.learnMore})]}),n.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-dismiss",onClick:u,"aria-label":"Dismiss Claude Code info banner",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1,padding:2,flexShrink:0},children:"×"})]})}function Bw(){const[a,r]=v.useState(null),[i,o]=v.useState("loading"),[u,m]=v.useState(null),f=v.useCallback(async()=>{try{const h=await Ne.getAgents();r(h),o("ready"),m(null)}catch(h){o("error"),m(h.message)}},[]);return v.useEffect(()=>{f()},[f]),v.useEffect(()=>{const h=()=>void f();return window.addEventListener("studio:agent-changed",h),()=>window.removeEventListener("studio:agent-changed",h)},[f]),{status:i,response:a,error:u,refresh:()=>void f()}}const eo="workspace",Iw=["skills","agents"];async function Hw(){const a=await fetch("/api/workspace");if(!a.ok)throw new Error(`GET /api/workspace failed: ${a.status}`);return await a.json()}async function Uw(a){const r=await fetch("/api/workspace/active",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a})});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`POST /api/workspace/active failed: ${r.status}`)}return await r.json()}async function Vw(a){const r=await fetch("/api/workspace/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`POST /api/workspace/projects failed: ${r.status}`)}return await r.json()}async function $w(a){const r=await fetch(`/api/workspace/projects/${encodeURIComponent(a)}`,{method:"DELETE"});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`DELETE /api/workspace/projects/${a} failed: ${r.status}`)}return await r.json()}function rd(){for(const a of Iw)ga(a)}function Gw(){const{data:a,loading:r,error:i,revalidate:o}=Ds(eo,Hw),u=a,m=u==null?void 0:u.projects.find(p=>p.id===u.activeProjectId),f=v.useCallback(async p=>{await Uw(p),ga(eo),rd()},[]),h=v.useCallback(async p=>{await Vw(p),ga(eo),rd()},[]),x=v.useCallback(async p=>{await $w(p),ga(eo),rd()},[]);return{workspace:u,activeProject:m,loading:r,error:i,switchProject:f,addProject:h,removeProject:x,revalidate:o}}function Pw({workspace:a,onSwitch:r,onAdd:i,onRemove:o,isPathStale:u}){const[m,f]=v.useState(!1),[h,x]=v.useState(!1),[p,y]=v.useState(""),[g,j]=v.useState(null),[S,N]=v.useState(null),D=v.useRef(null),T=(a==null?void 0:a.projects)??[],k=T.find(A=>A.id===(a==null?void 0:a.activeProjectId));v.useEffect(()=>{if(!m)return;function A(U){D.current&&!D.current.contains(U.target)&&(f(!1),x(!1),j(null))}return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[m]);async function M(){j(null);const A=p.trim();if(!A){j("Enter an absolute project path");return}try{await i({path:A}),y(""),x(!1)}catch(U){j(U instanceof Error?U.message:String(U))}}async function B(){if(j(null),typeof window<"u"&&"showDirectoryPicker"in window)try{const A=await window.showDirectoryPicker();y(A.name),x(!0)}catch{}else x(!0)}function V(A){if(A.length<=50)return A;const U=A.split("/");return U.length<=4?A:`${U.slice(0,3).join("/")}/…/${U.slice(-2).join("/")}`}return n.jsxs("div",{ref:D,"data-vskill-project-picker":!0,style:{position:"relative",display:"inline-block"},children:[n.jsxs("button",{type:"button",onClick:()=>f(A=>!A),"aria-expanded":m,"aria-haspopup":"menu",title:(k==null?void 0:k.path)??"No project selected",style:{display:"flex",alignItems:"center",gap:8,padding:"4px 10px",border:"1px solid transparent",borderRadius:6,background:m?"var(--surface-2, rgba(0,0,0,0.05))":"transparent",cursor:"pointer",fontFamily:"var(--font-mono)",fontSize:13,color:"var(--text-primary)",transition:"background-color 120ms ease"},children:[n.jsx("span",{"aria-hidden":!0,style:{width:8,height:8,borderRadius:"50%",flexShrink:0,backgroundColor:(k==null?void 0:k.colorDot)??"var(--text-tertiary, #999)"}}),n.jsx("span",{style:{maxWidth:180,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k?k.name:"No project"}),n.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-tertiary, #999)",marginLeft:2},children:m?"▴":"▾"})]}),m&&n.jsxs("div",{role:"menu","aria-label":"Switch project",style:{position:"absolute",top:"calc(100% + 4px)",left:0,minWidth:280,maxWidth:420,width:"max-content",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:8,boxShadow:"0 4px 6px -1px rgba(0,0,0,0.08), 0 10px 20px -5px rgba(0,0,0,0.12)",overflow:"hidden",zIndex:50,fontFamily:"var(--font-sans)"},children:[T.length===0&&n.jsx("div",{style:{padding:"16px 16px 12px",fontSize:12,color:"var(--text-tertiary)",lineHeight:1.5},children:"No projects registered. Add one to get started."}),T.length>0&&n.jsx("ul",{role:"none",style:{listStyle:"none",margin:0,padding:4,maxHeight:320,overflowY:"auto"},children:T.map(A=>{const U=u?u(A.path):!1,C=A.id===(a==null?void 0:a.activeProjectId),z=S===A.id;return n.jsxs("li",{role:"menuitem","data-stale":U?"true":"false",onMouseEnter:()=>N(A.id),onMouseLeave:()=>N(R=>R===A.id?null:R),onClick:()=>{U||(r(A.id),f(!1))},style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:6,cursor:U?"not-allowed":"pointer",background:z&&!U?"var(--surface-2, rgba(0,0,0,0.04))":C?"var(--surface-1, rgba(0,0,0,0.02))":"transparent",opacity:U?.5:1,transition:"background-color 120ms ease"},children:[n.jsx("span",{"aria-hidden":!0,style:{width:10,height:10,borderRadius:"50%",flexShrink:0,backgroundColor:A.colorDot,boxShadow:C?"0 0 0 2px color-mix(in oklch, currentColor 20%, transparent)":"none"}}),n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13,fontWeight:C?600:500,color:"var(--text-primary)",lineHeight:1.3},children:[n.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.name}),C&&n.jsx("span",{"aria-label":"Active",style:{fontSize:10,color:"var(--color-accent, #2f6f8f)",letterSpacing:"0.05em",textTransform:"uppercase",fontWeight:600},children:"Active"})]}),n.jsx("div",{title:A.path,style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-tertiary)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:V(A.path)}),U&&n.jsx("div",{style:{fontSize:10,color:"var(--color-own, #b45309)",marginTop:2},children:"Path no longer exists"})]}),n.jsx("button",{type:"button","aria-label":`Remove ${A.name}`,onClick:R=>{R.stopPropagation(),o(A.id)},style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",borderRadius:4,cursor:"pointer",color:"var(--text-tertiary)",opacity:z?1:0,transition:"opacity 120ms ease, color 120ms ease, background-color 120ms ease",flexShrink:0},onMouseEnter:R=>{R.currentTarget.style.color="var(--color-error, #b91c1c)",R.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-error, #b91c1c) 10%, transparent)"},onMouseLeave:R=>{R.currentTarget.style.color="var(--text-tertiary)",R.currentTarget.style.backgroundColor="transparent"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[n.jsx("polyline",{points:"3 6 5 6 21 6"}),n.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),n.jsx("path",{d:"M10 11v6"}),n.jsx("path",{d:"M14 11v6"}),n.jsx("path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]})})]},A.id)})}),n.jsxs("div",{style:{borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",padding:h?8:6},children:[!h&&n.jsxs("button",{type:"button",onClick:()=>void B(),className:"vskill-project-add",style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 10px",border:"none",borderRadius:6,background:"transparent",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500,color:"var(--color-accent, #2f6f8f)",transition:"background-color 120ms ease"},onMouseEnter:A=>{A.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-accent, #2f6f8f) 10%, transparent)"},onMouseLeave:A=>{A.currentTarget.style.backgroundColor="transparent"},children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add project"]}),h&&n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[n.jsx("input",{type:"text",value:p,onChange:A=>y(A.target.value),onKeyDown:A=>{A.key==="Enter"&&M(),A.key==="Escape"&&(x(!1),j(null))},placeholder:"/absolute/path/to/project",autoFocus:!0,style:{width:"100%",padding:"6px 8px",fontFamily:"var(--font-mono)",fontSize:12,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none"}}),n.jsxs("div",{style:{display:"flex",gap:6,justifyContent:"flex-end"},children:[n.jsx("button",{type:"button",onClick:()=>{x(!1),j(null),y("")},style:{padding:"4px 10px",fontSize:12,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Cancel"}),n.jsx("button",{type:"button",onClick:()=>void M(),style:{padding:"4px 10px",fontSize:12,border:"none",borderRadius:4,background:"var(--color-accent, #2f6f8f)",color:"var(--color-paper, #fff)",cursor:"pointer",fontWeight:500},children:"Add"})]}),g&&n.jsx("div",{style:{fontSize:11,color:"var(--color-error, #b91c1c)"},children:g})]})]})]})]})}function qw(a,r){const i=r.trim().toLowerCase().split(/\s+/).filter(Boolean);return i.length===0?a:a.filter(o=>{const u=`${o.name} ${o.path}`.toLowerCase();return i.every(m=>u.includes(m))})}function Yw({open:a,projects:r,onSwitch:i,onClose:o}){const[u,m]=v.useState(""),[f,h]=v.useState(0),x=v.useMemo(()=>qw(r,u),[r,u]);v.useEffect(()=>{a||(m(""),h(0))},[a]),v.useEffect(()=>{f>=x.length&&h(0)},[x.length,f]);const p=y=>{if(y.key==="Escape"){y.preventDefault(),o();return}if(y.key==="ArrowDown"){y.preventDefault(),h(g=>Math.min(g+1,Math.max(x.length-1,0)));return}if(y.key==="ArrowUp"){y.preventDefault(),h(g=>Math.max(g-1,0));return}if(y.key==="Enter"){y.preventDefault();const g=x[f];g&&(i(g.id),o())}};return a?n.jsxs("div",{role:"dialog","aria-modal":"true","data-vskill-project-palette":!0,className:"vskill-project-palette fixed inset-0 z-50 flex items-start justify-center pt-24",children:[n.jsx("div",{className:"absolute inset-0 bg-black/30",onClick:o}),n.jsxs("div",{className:"relative w-[520px] max-w-[92vw] bg-background border rounded shadow-lg",children:[n.jsx("input",{type:"text",autoFocus:!0,value:u,onChange:y=>m(y.target.value),onKeyDown:p,placeholder:"Switch project…",className:"w-full px-3 py-2 text-sm border-b outline-none"}),n.jsxs("ul",{role:"listbox",className:"max-h-80 overflow-auto",children:[x.length===0&&n.jsx("li",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No matches."}),x.map((y,g)=>n.jsxs("li",{role:"option","aria-selected":g===f,"data-highlighted":g===f,className:["flex items-center gap-2 px-3 py-2 text-sm cursor-pointer",g===f?"bg-muted":""].join(" "),onMouseEnter:()=>h(g),onClick:()=>{i(y.id),o()},children:[n.jsx("span",{"aria-hidden":!0,className:"inline-block w-2 h-2 rounded-full",style:{backgroundColor:y.colorDot}}),n.jsxs("span",{className:"flex-1",children:[n.jsx("span",{className:"vskill-palette-name",children:y.name}),n.jsx("span",{className:"ml-2 vskill-palette-path text-xs font-mono text-muted-foreground",children:y.path})]})]},y.id))]})]})]}):null}const gg="vskill.studio.prefs";function yg(){try{return typeof window>"u"?null:window.localStorage??null}catch{return null}}function bg(){const a=yg();if(!a)return{};try{const r=a.getItem(gg);if(!r)return{};const i=JSON.parse(r);return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}catch{return{}}}function Fw(a,r){const i=yg();if(i)try{const u={...bg(),[a]:r};i.setItem(gg,JSON.stringify(u))}catch{}}function Ww(a,r){const o=bg()[a];return o===void 0?r:o}const tv={open:!1,x:0,y:0,skill:null};function Kw(a,r){return{open:!0,x:a.clientX,y:a.clientY,skill:r}}function xl(a,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:a,severity:r}}))}function Qw(a,r){var i;switch(a){case"copy-path":try{(i=navigator.clipboard)==null||i.writeText(r.dir)}catch{xl(Z.toasts.permissionDenied,"error");return}xl(Z.toasts.pathCopied,"info");return;case"open":case"reveal":case"edit":xl(Z.actions.editPlaceholder,"info");return;case"run-benchmark":xl(Z.toasts.benchmarkQueued,"info");return;case"duplicate":xl(Z.toasts.skillDuplicated,"info");return;case"update":xl(Z.toasts.skillUpdated,"info");return;case"uninstall":xl(Z.actions.editPlaceholder,"info");return;default:return}}const Xw=v.lazy(()=>Sd(()=>import("./CommandPalette-BmFHPac6.js"),__vite__mapDeps([2,1])));function Zw(){return n.jsx(ub,{children:n.jsx(ib,{children:n.jsxs(Jk,{children:[n.jsx(Jw,{}),n.jsx(cw,{})]})})})}function Jw(){var ge,xe;const{state:a,selectSkill:r,clearSelection:i,refreshSkills:o,outdatedByOrigin:u}=ya(),{config:m}=bl(),{mode:f,resolvedTheme:h,setTheme:x}=uv(),{toast:p}=Ud(),[y,g]=v.useState(()=>w2()),[j]=v.useState(!0),[S,N]=v.useState(!1),[D,T]=v.useState(!1),[k,M]=v.useState(!1),[B,V]=v.useState("overview"),[A,U]=v.useState(tv),C=v.useCallback((oe,le)=>{U(Kw(oe,le))},[]),z=Bw(),[R,I]=v.useState(()=>Ww("activeAgent",null));v.useEffect(()=>{var oe;!R&&((oe=z.response)!=null&&oe.suggested)&&I(z.response.suggested)},[R,(ge=z.response)==null?void 0:ge.suggested]);const P=v.useCallback(oe=>{I(oe),Fw("activeAgent",oe),typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:agent-changed",{detail:{agentId:oe}}))},[]),q=v.useMemo(()=>z.response?Mw(z.response):[],[z.response]),{workspace:ee,switchProject:X,addProject:_,removeProject:E}=Gw(),[O,te]=v.useState(!1);md([{key:"p",meta:!0,handler:oe=>{var ve;const le=typeof document<"u"?document.activeElement:null;le&&le.tagName==="INPUT"||((ve=oe==null?void 0:oe.preventDefault)==null||ve.call(oe),te(Ue=>!Ue))}}],{enabled:!0});const Y=Sw();v.useEffect(()=>{function oe(le){if(!(le instanceof CustomEvent))return;const ve=le.detail;ve!=null&&ve.provider&&Y.open(ve.provider)}return window.addEventListener("studio:open-setup-drawer",oe),()=>window.removeEventListener("studio:open-setup-drawer",oe)},[Y]);const me=v.useCallback(()=>{U(tv)},[]);v.useEffect(()=>{function oe(le){if(!(le instanceof CustomEvent))return;const ve=le.detail;ve!=null&&ve.message&&p({message:ve.message,severity:ve.severity??"info"})}return window.addEventListener("studio:toast",oe),()=>window.removeEventListener("studio:toast",oe)},[p]),v.useEffect(()=>{document.documentElement.style.setProperty("--sidebar-width",`${y}px`)},[y]);const L=v.useMemo(()=>a.selectedSkill?a.skills.find(oe=>oe.plugin===a.selectedSkill.plugin&&oe.skill===a.selectedSkill.skill)??null:null,[a.skills,a.selectedSkill]),F=v.useCallback(oe=>{r({plugin:oe.plugin,skill:oe.skill,origin:oe.origin})},[r]),ie=v.useMemo(()=>{if(!a.selectedSkill)return"";const oe=a.selectedSkill.origin==="installed"?"Installed":"Own";return`Viewing ${a.selectedSkill.skill} (${oe})`},[a.selectedSkill]),de=v.useMemo(()=>[{id:"switch-theme",label:Z.palette.actionSwitchTheme,description:"Cycle light / dark / auto",keywords:["theme","dark","light","mode"],onInvoke:()=>x(f==="light"?"dark":f==="dark"?"auto":"light")},{id:"toggle-sidebar",label:"Toggle sidebar",description:"Show or hide the skills sidebar",keywords:["sidebar","panel","hide","show","cmd+b"],onInvoke:()=>M(oe=>!oe)},{id:"show-shortcuts",label:"Show keyboard shortcuts",description:"Open the cheatsheet",keywords:["help","keys"],onInvoke:()=>T(!0)},{id:"refresh-skills",label:"Refresh skills",description:"Re-scan local + installed",keywords:["reload","scan"],onInvoke:()=>o()}],[f,x,o]);return md([{key:"cmd+k",handler:()=>N(oe=>!oe)},{key:"ctrl+k",handler:()=>N(oe=>!oe)},{key:"?",handler:()=>T(oe=>!oe)},{key:"cmd+shift+d",handler:()=>x(h==="light"?"dark":"light")},{key:"ctrl+shift+d",handler:()=>x(h==="light"?"dark":"light")},{key:"cmd+b",handler:()=>M(oe=>!oe)},{key:"ctrl+b",handler:()=>M(oe=>!oe)},{key:"e",handler:()=>p({message:Z.actions.editPlaceholder,severity:"info"})}]),n.jsxs(n.Fragment,{children:[n.jsx(db,{sidebarWidth:y,sidebarHidden:k||a.isMobile&&a.mobileView==="detail",banner:n.jsx(E2,{connected:j}),liveMessage:ie,topRail:n.jsx(u0,{projectName:(m==null?void 0:m.projectName)??null,selected:a.selectedSkill,onOpenPalette:()=>N(!0),onHome:i,projectPickerSlot:ee&&ee.projects.length>0?n.jsx(Pw,{workspace:ee,onSwitch:X,onAdd:_,onRemove:E}):void 0}),sidebar:n.jsx(x2,{skills:a.skills,selectedKey:a.selectedSkill?{plugin:a.selectedSkill.plugin,skill:a.selectedSkill.skill}:null,onSelect:F,isLoading:a.skillsLoading,error:a.skillsError??null,onRetry:o,onContextMenu:C,outdatedByOrigin:u,activeAgentId:R,topSlot:z.status==="ready"&&q.length>0?n.jsxs(n.Fragment,{children:[n.jsx(Dw,{agents:q,activeAgentId:R,onActiveAgentChange:P,onOpenSetup:oe=>Y.open(oe)}),n.jsx(Ow,{activeAgentId:R})]}):null}),resizeHandle:n.jsx(N2,{initialWidth:y??js,onChange:g}),main:n.jsx(nw,{selectedSkillInfo:L,activeDetailTab:B,onDetailTabChange:V,allSkills:a.skills,onSelectSkill:F}),statusBar:n.jsx(j0,{projectPath:(m==null?void 0:m.root)??null,modelName:(m==null?void 0:m.model)??null,health:m!=null&&m.error?"degraded":"ok",providers:(xe=m==null?void 0:m.providers)==null?void 0:xe.map(oe=>{const le=oe.id;return{id:le,label:oe.label,available:oe.available,kind:le==="ollama"||le==="lm-studio"?"start-service":le==="anthropic"||le==="openrouter"?"api-key":"cli-install"}})})}),n.jsx(dw,{open:D,onClose:()=>T(!1)}),n.jsx(xw,{open:Y.isOpen,providerKey:Y.providerKey,onClose:Y.close}),n.jsx(pw,{state:A,onClose:me,onAction:(oe,le)=>Qw(oe,le)}),S&&n.jsx(v.Suspense,{fallback:null,children:n.jsx(Xw,{open:S,onClose:()=>N(!1),commands:de})}),n.jsx(Yw,{open:O,projects:(ee==null?void 0:ee.projects)??[],onSwitch:oe=>{X(oe)},onClose:()=>te(!1)})]})}const nv="vskill.migrations.scope-rename.v1",eC={own:"authoring-project",installed:"available-project",global:"available-personal"},tC=/^vskill-sidebar-(.+)-(own|installed|global)-collapsed$/;function nC(a){if(a.getItem(nv)==="done")return;const r=[];for(let i=0;i<a.length;i++){const o=a.key(i);if(!o)continue;const u=o.match(tC);if(!u)continue;const[,m,f]=u,h=eC[f];if(!h)continue;const x=a.getItem(o);x!==null&&r.push({oldKey:o,newKey:`vskill-sidebar-${m}-${h}-collapsed`,value:x})}for(const{oldKey:i,newKey:o,value:u}of r)a.getItem(o)===null&&a.setItem(o,u),a.removeItem(i);a.setItem(nv,"done")}if(typeof PerformanceObserver<"u")try{const a=new PerformanceObserver(r=>{for(const i of r.getEntries())if(i.name==="first-contentful-paint"){window.__vskillPaint=i.startTime,a.disconnect();return}});a.observe({type:"paint",buffered:!0})}catch{}if(typeof window<"u"&&window.localStorage)try{nC(window.localStorage)}catch{}V1.createRoot(document.getElementById("root")).render(n.jsx(v.StrictMode,{children:n.jsx(x0,{children:n.jsx(Zw,{})})}));export{n as j,v as r,Z as s};