vskill 0.5.136 → 0.5.137
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agents.json +1 -1
- package/dist/eval-ui/assets/{CommandPalette-C0OajJac.js → CommandPalette-B1lpjr8F.js} +1 -1
- package/dist/eval-ui/assets/{CreateSkillPage-BHTsGTx2.js → CreateSkillPage-Dv1SXZYl.js} +1 -1
- package/dist/eval-ui/assets/{FindSkillsPalette-Fd_xvWRc.js → FindSkillsPalette-BaZE9bu1.js} +2 -2
- package/dist/eval-ui/assets/{SearchPaletteCore-CYaU33vf.js → SearchPaletteCore-C1y3Gn3F.js} +1 -1
- package/dist/eval-ui/assets/{SkillDetailPanel-cxwua4jw.js → SkillDetailPanel-DncmK2MR.js} +1 -1
- package/dist/eval-ui/assets/{UpdateDropdown-C6b6HzFl.js → UpdateDropdown-1PXKezB7.js} +1 -1
- package/dist/eval-ui/assets/{index-CWWW1rkS.js → index-DDu1cXQ7.js} +31 -31
- package/dist/eval-ui/index.html +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-
|
|
2
|
-
/* empty css */(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&o(d)}).observe(document,{childList:!0,subtree:!0});function s(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function o(c){if(c.ep)return;c.ep=!0;const u=s(c);fetch(c.href,u)}})();function
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-1PXKezB7.js","assets/fonts-i7Lkz2zN.css","assets/CommandPalette-B1lpjr8F.js","assets/FindSkillsPalette-BaZE9bu1.js","assets/SkillDetailPanel-DncmK2MR.js","assets/skill-url-C4ekwoGs.js","assets/CreateSkillPage-Dv1SXZYl.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
/* empty css */(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&o(d)}).observe(document,{childList:!0,subtree:!0});function s(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function o(c){if(c.ep)return;c.ep=!0;const u=s(c);fetch(c.href,u)}})();function fv(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ud={exports:{}},As={};/**
|
|
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
|
|
10
|
+
*/var Tx;function h0(){if(Tx)return As;Tx=1;var t=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function s(o,c,u){var d=null;if(u!==void 0&&(d=""+u),c.key!==void 0&&(d=""+c.key),"key"in c){u={};for(var h in c)h!=="key"&&(u[h]=c[h])}else u=c;return c=u.ref,{$$typeof:t,type:o,key:d,ref:c!==void 0?c:null,props:u}}return As.Fragment=a,As.jsx=s,As.jsxs=s,As}var Rx;function x0(){return Rx||(Rx=1,ud.exports=h0()),ud.exports}var r=x0(),dd={exports:{}},He={};/**
|
|
11
11
|
* @license React
|
|
12
12
|
* react.production.js
|
|
13
13
|
*
|
|
@@ -15,7 +15,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-
|
|
|
15
15
|
*
|
|
16
16
|
* This source code is licensed under the MIT license found in the
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var
|
|
18
|
+
*/var Ax;function g0(){if(Ax)return He;Ax=1;var t=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),d=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),b=Symbol.iterator;function S(M){return M===null||typeof M!="object"?null:(M=b&&M[b]||M["@@iterator"],typeof M=="function"?M:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,C={};function T(M,Y,W){this.props=M,this.context=Y,this.refs=C,this.updater=W||k}T.prototype.isReactComponent={},T.prototype.setState=function(M,Y){if(typeof M!="object"&&typeof M!="function"&&M!=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,M,Y,"setState")},T.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function N(){}N.prototype=T.prototype;function A(M,Y,W){this.props=M,this.context=Y,this.refs=C,this.updater=W||k}var _=A.prototype=new N;_.constructor=A,w(_,T.prototype),_.isPureReactComponent=!0;var D=Array.isArray;function F(){}var E={H:null,A:null,T:null,S:null},B=Object.prototype.hasOwnProperty;function L(M,Y,W){var Q=W.ref;return{$$typeof:t,type:M,key:Y,ref:Q!==void 0?Q:null,props:W}}function U(M,Y){return L(M.type,Y,M.props)}function $(M){return typeof M=="object"&&M!==null&&M.$$typeof===t}function q(M){var Y={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(W){return Y[W]})}var X=/\/+/g;function ee(M,Y){return typeof M=="object"&&M!==null&&M.key!=null?q(""+M.key):Y.toString(36)}function I(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(F,F):(M.status="pending",M.then(function(Y){M.status==="pending"&&(M.status="fulfilled",M.value=Y)},function(Y){M.status==="pending"&&(M.status="rejected",M.reason=Y)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function z(M,Y,W,Q,oe){var de=typeof M;(de==="undefined"||de==="boolean")&&(M=null);var ve=!1;if(M===null)ve=!0;else switch(de){case"bigint":case"string":case"number":ve=!0;break;case"object":switch(M.$$typeof){case t:case a:ve=!0;break;case y:return ve=M._init,z(ve(M._payload),Y,W,Q,oe)}}if(ve)return oe=oe(M),ve=Q===""?"."+ee(M,0):Q,D(oe)?(W="",ve!=null&&(W=ve.replace(X,"$&/")+"/"),z(oe,Y,W,"",function(Re){return Re})):oe!=null&&($(oe)&&(oe=U(oe,W+(oe.key==null||M&&M.key===oe.key?"":(""+oe.key).replace(X,"$&/")+"/")+ve)),Y.push(oe)),1;ve=0;var ce=Q===""?".":Q+":";if(D(M))for(var je=0;je<M.length;je++)Q=M[je],de=ce+ee(Q,je),ve+=z(Q,Y,W,de,oe);else if(je=S(M),typeof je=="function")for(M=je.call(M),je=0;!(Q=M.next()).done;)Q=Q.value,de=ce+ee(Q,je++),ve+=z(Q,Y,W,de,oe);else if(de==="object"){if(typeof M.then=="function")return z(I(M),Y,W,Q,oe);throw Y=String(M),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return ve}function O(M,Y,W){if(M==null)return M;var Q=[],oe=0;return z(M,Q,"","",function(de){return Y.call(W,de,oe++)}),Q}function P(M){if(M._status===-1){var Y=M._result;Y=Y(),Y.then(function(W){(M._status===0||M._status===-1)&&(M._status=1,M._result=W)},function(W){(M._status===0||M._status===-1)&&(M._status=2,M._result=W)}),M._status===-1&&(M._status=0,M._result=Y)}if(M._status===1)return M._result.default;throw M._result}var H=typeof reportError=="function"?reportError:function(M){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof M=="object"&&M!==null&&typeof M.message=="string"?String(M.message):String(M),error:M});if(!window.dispatchEvent(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",M);return}console.error(M)},ae={map:O,forEach:function(M,Y,W){O(M,function(){Y.apply(this,arguments)},W)},count:function(M){var Y=0;return O(M,function(){Y++}),Y},toArray:function(M){return O(M,function(Y){return Y})||[]},only:function(M){if(!$(M))throw Error("React.Children.only expected to receive a single React element child.");return M}};return He.Activity=v,He.Children=ae,He.Component=T,He.Fragment=s,He.Profiler=c,He.PureComponent=A,He.StrictMode=o,He.Suspense=g,He.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=E,He.__COMPILER_RUNTIME={__proto__:null,c:function(M){return E.H.useMemoCache(M)}},He.cache=function(M){return function(){return M.apply(null,arguments)}},He.cacheSignal=function(){return null},He.cloneElement=function(M,Y,W){if(M==null)throw Error("The argument must be a React element, but you passed "+M+".");var Q=w({},M.props),oe=M.key;if(Y!=null)for(de in Y.key!==void 0&&(oe=""+Y.key),Y)!B.call(Y,de)||de==="key"||de==="__self"||de==="__source"||de==="ref"&&Y.ref===void 0||(Q[de]=Y[de]);var de=arguments.length-2;if(de===1)Q.children=W;else if(1<de){for(var ve=Array(de),ce=0;ce<de;ce++)ve[ce]=arguments[ce+2];Q.children=ve}return L(M.type,oe,Q)},He.createContext=function(M){return M={$$typeof:d,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null},M.Provider=M,M.Consumer={$$typeof:u,_context:M},M},He.createElement=function(M,Y,W){var Q,oe={},de=null;if(Y!=null)for(Q in Y.key!==void 0&&(de=""+Y.key),Y)B.call(Y,Q)&&Q!=="key"&&Q!=="__self"&&Q!=="__source"&&(oe[Q]=Y[Q]);var ve=arguments.length-2;if(ve===1)oe.children=W;else if(1<ve){for(var ce=Array(ve),je=0;je<ve;je++)ce[je]=arguments[je+2];oe.children=ce}if(M&&M.defaultProps)for(Q in ve=M.defaultProps,ve)oe[Q]===void 0&&(oe[Q]=ve[Q]);return L(M,de,oe)},He.createRef=function(){return{current:null}},He.forwardRef=function(M){return{$$typeof:h,render:M}},He.isValidElement=$,He.lazy=function(M){return{$$typeof:y,_payload:{_status:-1,_result:M},_init:P}},He.memo=function(M,Y){return{$$typeof:m,type:M,compare:Y===void 0?null:Y}},He.startTransition=function(M){var Y=E.T,W={};E.T=W;try{var Q=M(),oe=E.S;oe!==null&&oe(W,Q),typeof Q=="object"&&Q!==null&&typeof Q.then=="function"&&Q.then(F,H)}catch(de){H(de)}finally{Y!==null&&W.types!==null&&(Y.types=W.types),E.T=Y}},He.unstable_useCacheRefresh=function(){return E.H.useCacheRefresh()},He.use=function(M){return E.H.use(M)},He.useActionState=function(M,Y,W){return E.H.useActionState(M,Y,W)},He.useCallback=function(M,Y){return E.H.useCallback(M,Y)},He.useContext=function(M){return E.H.useContext(M)},He.useDebugValue=function(){},He.useDeferredValue=function(M,Y){return E.H.useDeferredValue(M,Y)},He.useEffect=function(M,Y){return E.H.useEffect(M,Y)},He.useEffectEvent=function(M){return E.H.useEffectEvent(M)},He.useId=function(){return E.H.useId()},He.useImperativeHandle=function(M,Y,W){return E.H.useImperativeHandle(M,Y,W)},He.useInsertionEffect=function(M,Y){return E.H.useInsertionEffect(M,Y)},He.useLayoutEffect=function(M,Y){return E.H.useLayoutEffect(M,Y)},He.useMemo=function(M,Y){return E.H.useMemo(M,Y)},He.useOptimistic=function(M,Y){return E.H.useOptimistic(M,Y)},He.useReducer=function(M,Y,W){return E.H.useReducer(M,Y,W)},He.useRef=function(M){return E.H.useRef(M)},He.useState=function(M){return E.H.useState(M)},He.useSyncExternalStore=function(M,Y,W){return E.H.useSyncExternalStore(M,Y,W)},He.useTransition=function(){return E.H.useTransition()},He.version="19.2.4",He}var Mx;function hf(){return Mx||(Mx=1,dd.exports=g0()),dd.exports}var p=hf();const Ne=fv(p);var fd={exports:{}},Ms={},pd={exports:{}},md={};/**
|
|
19
19
|
* @license React
|
|
20
20
|
* scheduler.production.js
|
|
21
21
|
*
|
|
@@ -23,7 +23,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-
|
|
|
23
23
|
*
|
|
24
24
|
* This source code is licensed under the MIT license found in the
|
|
25
25
|
* LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/var
|
|
26
|
+
*/var Lx;function v0(){return Lx||(Lx=1,(function(t){function a(z,O){var P=z.length;z.push(O);e:for(;0<P;){var H=P-1>>>1,ae=z[H];if(0<c(ae,O))z[H]=O,z[P]=ae,P=H;else break e}}function s(z){return z.length===0?null:z[0]}function o(z){if(z.length===0)return null;var O=z[0],P=z.pop();if(P!==O){z[0]=P;e:for(var H=0,ae=z.length,M=ae>>>1;H<M;){var Y=2*(H+1)-1,W=z[Y],Q=Y+1,oe=z[Q];if(0>c(W,P))Q<ae&&0>c(oe,W)?(z[H]=oe,z[Q]=P,H=Q):(z[H]=W,z[Y]=P,H=Y);else if(Q<ae&&0>c(oe,P))z[H]=oe,z[Q]=P,H=Q;else break e}}return O}function c(z,O){var P=z.sortIndex-O.sortIndex;return P!==0?P:z.id-O.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;t.unstable_now=function(){return u.now()}}else{var d=Date,h=d.now();t.unstable_now=function(){return d.now()-h}}var g=[],m=[],y=1,v=null,b=3,S=!1,k=!1,w=!1,C=!1,T=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function _(z){for(var O=s(m);O!==null;){if(O.callback===null)o(m);else if(O.startTime<=z)o(m),O.sortIndex=O.expirationTime,a(g,O);else break;O=s(m)}}function D(z){if(w=!1,_(z),!k)if(s(g)!==null)k=!0,F||(F=!0,q());else{var O=s(m);O!==null&&I(D,O.startTime-z)}}var F=!1,E=-1,B=5,L=-1;function U(){return C?!0:!(t.unstable_now()-L<B)}function $(){if(C=!1,F){var z=t.unstable_now();L=z;var O=!0;try{e:{k=!1,w&&(w=!1,N(E),E=-1),S=!0;var P=b;try{t:{for(_(z),v=s(g);v!==null&&!(v.expirationTime>z&&U());){var H=v.callback;if(typeof H=="function"){v.callback=null,b=v.priorityLevel;var ae=H(v.expirationTime<=z);if(z=t.unstable_now(),typeof ae=="function"){v.callback=ae,_(z),O=!0;break t}v===s(g)&&o(g),_(z)}else o(g);v=s(g)}if(v!==null)O=!0;else{var M=s(m);M!==null&&I(D,M.startTime-z),O=!1}}break e}finally{v=null,b=P,S=!1}O=void 0}}finally{O?q():F=!1}}}var q;if(typeof A=="function")q=function(){A($)};else if(typeof MessageChannel<"u"){var X=new MessageChannel,ee=X.port2;X.port1.onmessage=$,q=function(){ee.postMessage(null)}}else q=function(){T($,0)};function I(z,O){E=T(function(){z(t.unstable_now())},O)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(z){z.callback=null},t.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<z?Math.floor(1e3/z):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_next=function(z){switch(b){case 1:case 2:case 3:var O=3;break;default:O=b}var P=b;b=O;try{return z()}finally{b=P}},t.unstable_requestPaint=function(){C=!0},t.unstable_runWithPriority=function(z,O){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var P=b;b=z;try{return O()}finally{b=P}},t.unstable_scheduleCallback=function(z,O,P){var H=t.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?H+P:H):P=H,z){case 1:var ae=-1;break;case 2:ae=250;break;case 5:ae=1073741823;break;case 4:ae=1e4;break;default:ae=5e3}return ae=P+ae,z={id:y++,callback:O,priorityLevel:z,startTime:P,expirationTime:ae,sortIndex:-1},P>H?(z.sortIndex=P,a(m,z),s(g)===null&&z===s(m)&&(w?(N(E),E=-1):w=!0,I(D,P-H))):(z.sortIndex=ae,a(g,z),k||S||(k=!0,F||(F=!0,q()))),z},t.unstable_shouldYield=U,t.unstable_wrapCallback=function(z){var O=b;return function(){var P=b;b=O;try{return z.apply(this,arguments)}finally{b=P}}}})(md)),md}var zx;function y0(){return zx||(zx=1,pd.exports=v0()),pd.exports}var hd={exports:{}},tn={};/**
|
|
27
27
|
* @license React
|
|
28
28
|
* react-dom.production.js
|
|
29
29
|
*
|
|
@@ -31,7 +31,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-
|
|
|
31
31
|
*
|
|
32
32
|
* This source code is licensed under the MIT license found in the
|
|
33
33
|
* LICENSE file in the root directory of this source tree.
|
|
34
|
-
*/var
|
|
34
|
+
*/var Dx;function b0(){if(Dx)return tn;Dx=1;var t=hf();function a(g){var m="https://react.dev/errors/"+g;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)m+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+g+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var o={d:{f:s,r:function(){throw Error(a(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},c=Symbol.for("react.portal");function u(g,m,y){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:v==null?null:""+v,children:g,containerInfo:m,implementation:y}}var d=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(g,m){if(g==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return tn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,tn.createPortal=function(g,m){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(a(299));return u(g,m,null,y)},tn.flushSync=function(g){var m=d.T,y=o.p;try{if(d.T=null,o.p=2,g)return g()}finally{d.T=m,o.p=y,o.d.f()}},tn.preconnect=function(g,m){typeof g=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,o.d.C(g,m))},tn.prefetchDNS=function(g){typeof g=="string"&&o.d.D(g)},tn.preinit=function(g,m){if(typeof g=="string"&&m&&typeof m.as=="string"){var y=m.as,v=h(y,m.crossOrigin),b=typeof m.integrity=="string"?m.integrity:void 0,S=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;y==="style"?o.d.S(g,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:v,integrity:b,fetchPriority:S}):y==="script"&&o.d.X(g,{crossOrigin:v,integrity:b,fetchPriority:S,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},tn.preinitModule=function(g,m){if(typeof g=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var y=h(m.as,m.crossOrigin);o.d.M(g,{crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&o.d.M(g)},tn.preload=function(g,m){if(typeof g=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var y=m.as,v=h(y,m.crossOrigin);o.d.L(g,y,{crossOrigin:v,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},tn.preloadModule=function(g,m){if(typeof g=="string")if(m){var y=h(m.as,m.crossOrigin);o.d.m(g,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else o.d.m(g)},tn.requestFormReset=function(g){o.d.r(g)},tn.unstable_batchedUpdates=function(g,m){return g(m)},tn.useFormState=function(g,m,y){return d.H.useFormState(g,m,y)},tn.useFormStatus=function(){return d.H.useHostTransitionStatus()},tn.version="19.2.4",tn}var _x;function pv(){if(_x)return hd.exports;_x=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(a){console.error(a)}}return t(),hd.exports=b0(),hd.exports}/**
|
|
35
35
|
* @license React
|
|
36
36
|
* react-dom-client.production.js
|
|
37
37
|
*
|
|
@@ -39,15 +39,15 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-
|
|
|
39
39
|
*
|
|
40
40
|
* This source code is licensed under the MIT license found in the
|
|
41
41
|
* LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/var
|
|
42
|
+
*/var Ox;function j0(){if(Ox)return Ms;Ox=1;var t=y0(),a=hf(),s=pv();function o(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)n+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var n=e,l=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(l=n.return),e=n.return;while(e)}return n.tag===3?l:null}function d(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function h(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function g(e){if(u(e)!==e)throw Error(o(188))}function m(e){var n=e.alternate;if(!n){if(n=u(e),n===null)throw Error(o(188));return n!==e?null:e}for(var l=e,i=n;;){var f=l.return;if(f===null)break;var x=f.alternate;if(x===null){if(i=f.return,i!==null){l=i;continue}break}if(f.child===x.child){for(x=f.child;x;){if(x===l)return g(f),e;if(x===i)return g(f),n;x=x.sibling}throw Error(o(188))}if(l.return!==i.return)l=f,i=x;else{for(var j=!1,R=f.child;R;){if(R===l){j=!0,l=f,i=x;break}if(R===i){j=!0,i=f,l=x;break}R=R.sibling}if(!j){for(R=x.child;R;){if(R===l){j=!0,l=x,i=f;break}if(R===i){j=!0,i=x,l=f;break}R=R.sibling}if(!j)throw Error(o(189))}}if(l.alternate!==i)throw Error(o(190))}if(l.tag!==3)throw Error(o(188));return l.stateNode.current===l?e:n}function y(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=y(e),n!==null)return n;e=e.sibling}return null}var v=Object.assign,b=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),A=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),F=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),U=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function q(e){return e===null||typeof e!="object"?null:(e=$&&e[$]||e["@@iterator"],typeof e=="function"?e:null)}var X=Symbol.for("react.client.reference");function ee(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===X?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case w:return"Fragment";case T:return"Profiler";case C:return"StrictMode";case D:return"Suspense";case F:return"SuspenseList";case L:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case A:return e.displayName||"Context";case N:return(e._context.displayName||"Context")+".Consumer";case _:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case E:return n=e.displayName||null,n!==null?n:ee(e.type)||"Memo";case B:n=e._payload,e=e._init;try{return ee(e(n))}catch{}}return null}var I=Array.isArray,z=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P={pending:!1,data:null,method:null,action:null},H=[],ae=-1;function M(e){return{current:e}}function Y(e){0>ae||(e.current=H[ae],H[ae]=null,ae--)}function W(e,n){ae++,H[ae]=e.current,e.current=n}var Q=M(null),oe=M(null),de=M(null),ve=M(null);function ce(e,n){switch(W(de,n),W(oe,e),W(Q,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?Qh(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=Qh(n),e=Zh(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Y(Q),W(Q,e)}function je(){Y(Q),Y(oe),Y(de)}function Re(e){e.memoizedState!==null&&W(ve,e);var n=Q.current,l=Zh(n,e.type);n!==l&&(W(oe,e),W(Q,l))}function Oe(e){oe.current===e&&(Y(Q),Y(oe)),ve.current===e&&(Y(ve),Es._currentValue=P)}var le,he;function pe(e){if(le===void 0)try{throw Error()}catch(l){var n=l.stack.trim().match(/\n( *(at )?)/);le=n&&n[1]||"",he=-1<l.stack.indexOf(`
|
|
43
43
|
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
44
|
`+le+e+he}var xe=!1;function be(e,n){if(!e||xe)return"";xe=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(n){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(re){var te=re}Reflect.construct(e,[],fe)}else{try{fe.call()}catch(re){te=re}e.call(fe.prototype)}}else{try{throw Error()}catch(re){te=re}(fe=e())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(re){if(re&&te&&typeof re.stack=="string")return[re.stack,te.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=i.DetermineComponentFrameRoot(),j=x[0],R=x[1];if(j&&R){var V=j.split(`
|
|
45
45
|
`),J=R.split(`
|
|
46
46
|
`);for(f=i=0;i<V.length&&!V[i].includes("DetermineComponentFrameRoot");)i++;for(;f<J.length&&!J[f].includes("DetermineComponentFrameRoot");)f++;if(i===V.length||f===J.length)for(i=V.length-1,f=J.length-1;1<=i&&0<=f&&V[i]!==J[f];)f--;for(;1<=i&&0<=f;i--,f--)if(V[i]!==J[f]){if(i!==1||f!==1)do if(i--,f--,0>f||V[i]!==J[f]){var ie=`
|
|
47
47
|
`+V[i].replace(" at new "," at ");return e.displayName&&ie.includes("<anonymous>")&&(ie=ie.replace("<anonymous>",e.displayName)),ie}while(1<=i&&0<=f);break}}}finally{xe=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?pe(l):""}function Be(e,n){switch(e.tag){case 26:case 27:case 5:return pe(e.type);case 16:return pe("Lazy");case 13:return e.child!==n&&n!==null?pe("Suspense Fallback"):pe("Suspense");case 19:return pe("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 pe("Activity");default:return""}}function Ue(e){try{var n="",l=null;do n+=Be(e,l),l=e,e=e.return;while(e);return n}catch(i){return`
|
|
48
48
|
Error generating stack: `+i.message+`
|
|
49
|
-
`+i.stack}}var lt=Object.prototype.hasOwnProperty,Ct=t.unstable_scheduleCallback,gt=t.unstable_cancelCallback,Tt=t.unstable_shouldYield,Gt=t.unstable_requestPaint,We=t.unstable_now,nt=t.unstable_getCurrentPriorityLevel,xn=t.unstable_ImmediatePriority,ye=t.unstable_UserBlockingPriority,ot=t.unstable_NormalPriority,Wt=t.unstable_LowPriority,Kt=t.unstable_IdlePriority,An=t.log,Et=t.unstable_setDisableYieldValue,Mn=null,Ut=null;function Rt(e){if(typeof An=="function"&&Et(e),Ut&&typeof Ut.setStrictMode=="function")try{Ut.setStrictMode(Mn,e)}catch{}}var ct=Math.clz32?Math.clz32:da,Wn=Math.log,tr=Math.LN2;function da(e){return e>>>=0,e===0?32:31-(Wn(e)/tr|0)|0}var gn=256,Nt=262144,Le=4194304;function se(e){var n=e&42;if(n!==0)return n;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 Se(e,n,l){var i=e.pendingLanes;if(i===0)return 0;var f=0,x=e.suspendedLanes,j=e.pingedLanes;e=e.warmLanes;var R=i&134217727;return R!==0?(i=R&~x,i!==0?f=se(i):(j&=R,j!==0?f=se(j):l||(l=R&~e,l!==0&&(f=se(l))))):(R=i&~x,R!==0?f=se(R):j!==0?f=se(j):l||(l=i&~e,l!==0&&(f=se(l)))),f===0?0:n!==0&&n!==f&&(n&x)===0&&(x=f&-f,l=n&-n,x>=l||x===32&&(l&4194048)!==0)?n:f}function Me(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function Fa(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 qn(){var e=Le;return Le<<=1,(Le&62914560)===0&&(Le=4194304),e}function Ul(e){for(var n=[],l=0;31>l;l++)n.push(e);return n}function fa(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Hl(e,n,l,i,f,x){var j=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var R=e.entanglements,V=e.expirationTimes,J=e.hiddenUpdates;for(l=j&~l;0<l;){var ie=31-ct(l),fe=1<<ie;R[ie]=0,V[ie]=-1;var te=J[ie];if(te!==null)for(J[ie]=null,ie=0;ie<te.length;ie++){var re=te[ie];re!==null&&(re.lane&=-536870913)}l&=~fe}i!==0&&nr(e,i,0),x!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=x&~(j&~n))}function nr(e,n,l){e.pendingLanes|=n,e.suspendedLanes&=~n;var i=31-ct(n);e.entangledLanes|=n,e.entanglements[i]=e.entanglements[i]|1073741824|l&261930}function pa(e,n){var l=e.entangledLanes|=n;for(e=e.entanglements;l;){var i=31-ct(l),f=1<<i;f&n|e[i]&n&&(e[i]|=n),l&=~f}}function ma(e,n){var l=n&-n;return l=(l&42)!==0?1:Ga(l),(l&(e.suspendedLanes|n))!==0?0:l}function Ga(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 zr(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ut(){var e=O.p;return e!==0?e:(e=window.event,e===void 0?32:bx(e.type))}function ha(e,n){var l=O.p;try{return O.p=e,n()}finally{O.p=l}}var an=Math.random().toString(36).slice(2),Ht="__reactFiber$"+an,dt="__reactProps$"+an,xa="__reactContainer$"+an,rr="__reactEvents$"+an,tc="__reactListeners$"+an,rb="__reactHandles$"+an,Bf="__reactResources$"+an,$l="__reactMarker$"+an;function nc(e){delete e[Ht],delete e[dt],delete e[rr],delete e[tc],delete e[rb]}function Wa(e){var n=e[Ht];if(n)return n;for(var l=e.parentNode;l;){if(n=l[xa]||l[Ht]){if(l=n.alternate,n.child!==null||l!==null&&l.child!==null)for(e=ax(e);e!==null;){if(l=e[Ht])return l;e=ax(e)}return n}e=l,l=e.parentNode}return null}function qa(e){if(e=e[Ht]||e[xa]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Vl(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(o(33))}function Ya(e){var n=e[Bf];return n||(n=e[Bf]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function qt(e){e[$l]=!0}var If=new Set,Uf={};function ga(e,n){Ka(e,n),Ka(e+"Capture",n)}function Ka(e,n){for(Uf[e]=n,e=0;e<n.length;e++)If.add(n[e])}var ab=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]*$"),Hf={},$f={};function lb(e){return lt.call($f,e)?!0:lt.call(Hf,e)?!1:ab.test(e)?$f[e]=!0:(Hf[e]=!0,!1)}function li(e,n,l){if(lb(n))if(l===null)e.removeAttribute(n);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var i=n.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+l)}}function si(e,n,l){if(l===null)e.removeAttribute(n);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+l)}}function fr(e,n,l,i){if(i===null)e.removeAttribute(l);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(n,l,""+i)}}function Ln(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Vf(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function sb(e,n,l){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var f=i.get,x=i.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(j){l=""+j,x.call(this,j)}}),Object.defineProperty(e,n,{enumerable:i.enumerable}),{getValue:function(){return l},setValue:function(j){l=""+j},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function rc(e){if(!e._valueTracker){var n=Vf(e)?"checked":"value";e._valueTracker=sb(e,n,""+e[n])}}function Pf(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var l=n.getValue(),i="";return e&&(i=Vf(e)?e.checked?"true":"false":e.value),e=i,e!==l?(n.setValue(e),!0):!1}function ii(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 ib=/[\n"\\]/g;function zn(e){return e.replace(ib,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function ac(e,n,l,i,f,x,j,R){e.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?e.type=j:e.removeAttribute("type"),n!=null?j==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Ln(n)):e.value!==""+Ln(n)&&(e.value=""+Ln(n)):j!=="submit"&&j!=="reset"||e.removeAttribute("value"),n!=null?lc(e,j,Ln(n)):l!=null?lc(e,j,Ln(l)):i!=null&&e.removeAttribute("value"),f==null&&x!=null&&(e.defaultChecked=!!x),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?e.name=""+Ln(R):e.removeAttribute("name")}function Ff(e,n,l,i,f,x,j,R){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.type=x),n!=null||l!=null){if(!(x!=="submit"&&x!=="reset"||n!=null)){rc(e);return}l=l!=null?""+Ln(l):"",n=n!=null?""+Ln(n):l,R||n===e.value||(e.value=n),e.defaultValue=n}i=i??f,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=R?e.checked:!!i,e.defaultChecked=!!i,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(e.name=j),rc(e)}function lc(e,n,l){n==="number"&&ii(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Xa(e,n,l,i){if(e=e.options,n){n={};for(var f=0;f<l.length;f++)n["$"+l[f]]=!0;for(l=0;l<e.length;l++)f=n.hasOwnProperty("$"+e[l].value),e[l].selected!==f&&(e[l].selected=f),f&&i&&(e[l].defaultSelected=!0)}else{for(l=""+Ln(l),n=null,f=0;f<e.length;f++){if(e[f].value===l){e[f].selected=!0,i&&(e[f].defaultSelected=!0);return}n!==null||e[f].disabled||(n=e[f])}n!==null&&(n.selected=!0)}}function Gf(e,n,l){if(n!=null&&(n=""+Ln(n),n!==e.value&&(e.value=n),l==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=l!=null?""+Ln(l):""}function Wf(e,n,l,i){if(n==null){if(i!=null){if(l!=null)throw Error(o(92));if(I(i)){if(1<i.length)throw Error(o(93));i=i[0]}l=i}l==null&&(l=""),n=l}l=Ln(n),e.defaultValue=l,i=e.textContent,i===l&&i!==""&&i!==null&&(e.value=i),rc(e)}function Qa(e,n){if(n){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=n;return}}e.textContent=n}var ob=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 qf(e,n,l){var i=n.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?i?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":i?e.setProperty(n,l):typeof l!="number"||l===0||ob.has(n)?n==="float"?e.cssFloat=l:e[n]=(""+l).trim():e[n]=l+"px"}function Yf(e,n,l){if(n!=null&&typeof n!="object")throw Error(o(62));if(e=e.style,l!=null){for(var i in l)!l.hasOwnProperty(i)||n!=null&&n.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="");for(var f in n)i=n[f],n.hasOwnProperty(f)&&l[f]!==i&&qf(e,f,i)}else for(var x in n)n.hasOwnProperty(x)&&qf(e,x,n[x])}function sc(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 cb=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"]]),ub=/^[\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 oi(e){return ub.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function pr(){}var ic=null;function oc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Za=null,Ja=null;function Kf(e){var n=qa(e);if(n&&(e=n.stateNode)){var l=e[dt]||null;e:switch(e=n.stateNode,n.type){case"input":if(ac(e,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),n=l.name,l.type==="radio"&&n!=null){for(l=e;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+zn(""+n)+'"][type="radio"]'),n=0;n<l.length;n++){var i=l[n];if(i!==e&&i.form===e.form){var f=i[dt]||null;if(!f)throw Error(o(90));ac(i,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(n=0;n<l.length;n++)i=l[n],i.form===e.form&&Pf(i)}break e;case"textarea":Gf(e,l.value,l.defaultValue);break e;case"select":n=l.value,n!=null&&Xa(e,!!l.multiple,n,!1)}}}var cc=!1;function Xf(e,n,l){if(cc)return e(n,l);cc=!0;try{var i=e(n);return i}finally{if(cc=!1,(Za!==null||Ja!==null)&&(Ki(),Za&&(n=Za,e=Ja,Ja=Za=null,Kf(n),e)))for(n=0;n<e.length;n++)Kf(e[n])}}function Pl(e,n){var l=e.stateNode;if(l===null)return null;var i=l[dt]||null;if(i===null)return null;l=i[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(o(231,n,typeof l));return l}var mr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),uc=!1;if(mr)try{var Fl={};Object.defineProperty(Fl,"passive",{get:function(){uc=!0}}),window.addEventListener("test",Fl,Fl),window.removeEventListener("test",Fl,Fl)}catch{uc=!1}var Dr=null,dc=null,ci=null;function Qf(){if(ci)return ci;var e,n=dc,l=n.length,i,f="value"in Dr?Dr.value:Dr.textContent,x=f.length;for(e=0;e<l&&n[e]===f[e];e++);var j=l-e;for(i=1;i<=j&&n[l-i]===f[x-i];i++);return ci=f.slice(e,1<i?1-i:void 0)}function ui(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function di(){return!0}function Zf(){return!1}function un(e){function n(l,i,f,x,j){this._reactName=l,this._targetInst=f,this.type=i,this.nativeEvent=x,this.target=j,this.currentTarget=null;for(var R in e)e.hasOwnProperty(R)&&(l=e[R],this[R]=l?l(x):x[R]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?di:Zf,this.isPropagationStopped=Zf,this}return v(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=di)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=di)},persist:function(){},isPersistent:di}),n}var va={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fi=un(va),Gl=v({},va,{view:0,detail:0}),db=un(Gl),fc,pc,Wl,pi=v({},Gl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:hc,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!==Wl&&(Wl&&e.type==="mousemove"?(fc=e.screenX-Wl.screenX,pc=e.screenY-Wl.screenY):pc=fc=0,Wl=e),fc)},movementY:function(e){return"movementY"in e?e.movementY:pc}}),Jf=un(pi),fb=v({},pi,{dataTransfer:0}),pb=un(fb),mb=v({},Gl,{relatedTarget:0}),mc=un(mb),hb=v({},va,{animationName:0,elapsedTime:0,pseudoElement:0}),xb=un(hb),gb=v({},va,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),vb=un(gb),yb=v({},va,{data:0}),ep=un(yb),bb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},jb={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"},Sb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function kb(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Sb[e])?!!n[e]:!1}function hc(){return kb}var wb=v({},Gl,{key:function(e){if(e.key){var n=bb[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=ui(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?jb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:hc,charCode:function(e){return e.type==="keypress"?ui(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ui(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Cb=un(wb),Eb=v({},pi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),tp=un(Eb),Nb=v({},Gl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:hc}),Tb=un(Nb),Rb=v({},va,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ab=un(Rb),Mb=v({},pi,{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}),Lb=un(Mb),zb=v({},va,{newState:0,oldState:0}),Db=un(zb),_b=[9,13,27,32],xc=mr&&"CompositionEvent"in window,ql=null;mr&&"documentMode"in document&&(ql=document.documentMode);var Ob=mr&&"TextEvent"in window&&!ql,np=mr&&(!xc||ql&&8<ql&&11>=ql),rp=" ",ap=!1;function lp(e,n){switch(e){case"keyup":return _b.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function sp(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var el=!1;function Bb(e,n){switch(e){case"compositionend":return sp(n);case"keypress":return n.which!==32?null:(ap=!0,rp);case"textInput":return e=n.data,e===rp&&ap?null:e;default:return null}}function Ib(e,n){if(el)return e==="compositionend"||!xc&&lp(e,n)?(e=Qf(),ci=dc=Dr=null,el=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return np&&n.locale!=="ko"?null:n.data;default:return null}}var Ub={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 ip(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Ub[e.type]:n==="textarea"}function op(e,n,l,i){Za?Ja?Ja.push(i):Ja=[i]:Za=i,n=no(n,"onChange"),0<n.length&&(l=new fi("onChange","change",null,l,i),e.push({event:l,listeners:n}))}var Yl=null,Kl=null;function Hb(e){Fh(e,0)}function mi(e){var n=Vl(e);if(Pf(n))return e}function cp(e,n){if(e==="change")return n}var up=!1;if(mr){var gc;if(mr){var vc="oninput"in document;if(!vc){var dp=document.createElement("div");dp.setAttribute("oninput","return;"),vc=typeof dp.oninput=="function"}gc=vc}else gc=!1;up=gc&&(!document.documentMode||9<document.documentMode)}function fp(){Yl&&(Yl.detachEvent("onpropertychange",pp),Kl=Yl=null)}function pp(e){if(e.propertyName==="value"&&mi(Kl)){var n=[];op(n,Kl,e,oc(e)),Xf(Hb,n)}}function $b(e,n,l){e==="focusin"?(fp(),Yl=n,Kl=l,Yl.attachEvent("onpropertychange",pp)):e==="focusout"&&fp()}function Vb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return mi(Kl)}function Pb(e,n){if(e==="click")return mi(n)}function Fb(e,n){if(e==="input"||e==="change")return mi(n)}function Gb(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var vn=typeof Object.is=="function"?Object.is:Gb;function Xl(e,n){if(vn(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var l=Object.keys(e),i=Object.keys(n);if(l.length!==i.length)return!1;for(i=0;i<l.length;i++){var f=l[i];if(!lt.call(n,f)||!vn(e[f],n[f]))return!1}return!0}function mp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function hp(e,n){var l=mp(e);e=0;for(var i;l;){if(l.nodeType===3){if(i=e+l.textContent.length,e<=n&&i>=n)return{node:l,offset:n-e};e=i}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=mp(l)}}function xp(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?xp(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function gp(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=ii(e.document);n instanceof e.HTMLIFrameElement;){try{var l=typeof n.contentWindow.location.href=="string"}catch{l=!1}if(l)e=n.contentWindow;else break;n=ii(e.document)}return n}function yc(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var Wb=mr&&"documentMode"in document&&11>=document.documentMode,tl=null,bc=null,Ql=null,jc=!1;function vp(e,n,l){var i=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;jc||tl==null||tl!==ii(i)||(i=tl,"selectionStart"in i&&yc(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Ql&&Xl(Ql,i)||(Ql=i,i=no(bc,"onSelect"),0<i.length&&(n=new fi("onSelect","select",null,n,l),e.push({event:n,listeners:i}),n.target=tl)))}function ya(e,n){var l={};return l[e.toLowerCase()]=n.toLowerCase(),l["Webkit"+e]="webkit"+n,l["Moz"+e]="moz"+n,l}var nl={animationend:ya("Animation","AnimationEnd"),animationiteration:ya("Animation","AnimationIteration"),animationstart:ya("Animation","AnimationStart"),transitionrun:ya("Transition","TransitionRun"),transitionstart:ya("Transition","TransitionStart"),transitioncancel:ya("Transition","TransitionCancel"),transitionend:ya("Transition","TransitionEnd")},Sc={},yp={};mr&&(yp=document.createElement("div").style,"AnimationEvent"in window||(delete nl.animationend.animation,delete nl.animationiteration.animation,delete nl.animationstart.animation),"TransitionEvent"in window||delete nl.transitionend.transition);function ba(e){if(Sc[e])return Sc[e];if(!nl[e])return e;var n=nl[e],l;for(l in n)if(n.hasOwnProperty(l)&&l in yp)return Sc[e]=n[l];return e}var bp=ba("animationend"),jp=ba("animationiteration"),Sp=ba("animationstart"),qb=ba("transitionrun"),Yb=ba("transitionstart"),Kb=ba("transitioncancel"),kp=ba("transitionend"),wp=new Map,kc="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(" ");kc.push("scrollEnd");function Yn(e,n){wp.set(e,n),ga(n,[e])}var hi=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=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(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Dn=[],rl=0,wc=0;function xi(){for(var e=rl,n=wc=rl=0;n<e;){var l=Dn[n];Dn[n++]=null;var i=Dn[n];Dn[n++]=null;var f=Dn[n];Dn[n++]=null;var x=Dn[n];if(Dn[n++]=null,i!==null&&f!==null){var j=i.pending;j===null?f.next=f:(f.next=j.next,j.next=f),i.pending=f}x!==0&&Cp(l,f,x)}}function gi(e,n,l,i){Dn[rl++]=e,Dn[rl++]=n,Dn[rl++]=l,Dn[rl++]=i,wc|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function Cc(e,n,l,i){return gi(e,n,l,i),vi(e)}function ja(e,n){return gi(e,null,null,n),vi(e)}function Cp(e,n,l){e.lanes|=l;var i=e.alternate;i!==null&&(i.lanes|=l);for(var f=!1,x=e.return;x!==null;)x.childLanes|=l,i=x.alternate,i!==null&&(i.childLanes|=l),x.tag===22&&(e=x.stateNode,e===null||e._visibility&1||(f=!0)),e=x,x=x.return;return e.tag===3?(x=e.stateNode,f&&n!==null&&(f=31-ct(l),e=x.hiddenUpdates,i=e[f],i===null?e[f]=[n]:i.push(n),n.lane=l|536870912),x):null}function vi(e){if(50<ys)throw ys=0,Du=null,Error(o(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var al={};function Xb(e,n,l,i){this.tag=e,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yn(e,n,l,i){return new Xb(e,n,l,i)}function Ec(e){return e=e.prototype,!(!e||!e.isReactComponent)}function hr(e,n){var l=e.alternate;return l===null?(l=yn(e.tag,n,e.key,e.mode),l.elementType=e.elementType,l.type=e.type,l.stateNode=e.stateNode,l.alternate=e,e.alternate=l):(l.pendingProps=n,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,n=e.dependencies,l.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},l.sibling=e.sibling,l.index=e.index,l.ref=e.ref,l.refCleanup=e.refCleanup,l}function Ep(e,n){e.flags&=65011714;var l=e.alternate;return l===null?(e.childLanes=0,e.lanes=n,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,n=l.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function yi(e,n,l,i,f,x){var j=0;if(i=e,typeof e=="function")Ec(e)&&(j=1);else if(typeof e=="string")j=t0(e,l,Q.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case L:return e=yn(31,l,n,f),e.elementType=L,e.lanes=x,e;case w:return Sa(l.children,f,x,n);case E:j=8,f|=24;break;case T:return e=yn(12,l,n,f|2),e.elementType=T,e.lanes=x,e;case D:return e=yn(13,l,n,f),e.elementType=D,e.lanes=x,e;case F:return e=yn(19,l,n,f),e.elementType=F,e.lanes=x,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case A:j=10;break e;case N:j=9;break e;case _:j=11;break e;case C:j=14;break e;case B:j=16,i=null;break e}j=29,l=Error(o(130,e===null?"null":typeof e,"")),i=null}return n=yn(j,l,n,f),n.elementType=e,n.type=i,n.lanes=x,n}function Sa(e,n,l,i){return e=yn(7,e,i,n),e.lanes=l,e}function Nc(e,n,l){return e=yn(6,e,null,n),e.lanes=l,e}function Np(e){var n=yn(18,null,null,0);return n.stateNode=e,n}function Tc(e,n,l){return n=yn(4,e.children!==null?e.children:[],e.key,n),n.lanes=l,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Tp=new WeakMap;function _n(e,n){if(typeof e=="object"&&e!==null){var l=Tp.get(e);return l!==void 0?l:(n={value:e,source:n,stack:Ue(n)},Tp.set(e,n),n)}return{value:e,source:n,stack:Ue(n)}}var ll=[],sl=0,bi=null,Zl=0,On=[],Bn=0,_r=null,ar=1,lr="";function xr(e,n){ll[sl++]=Zl,ll[sl++]=bi,bi=e,Zl=n}function Rp(e,n,l){On[Bn++]=ar,On[Bn++]=lr,On[Bn++]=_r,_r=e;var i=ar;e=lr;var f=32-ct(i)-1;i&=~(1<<f),l+=1;var x=32-ct(n)+f;if(30<x){var j=f-f%5;x=(i&(1<<j)-1).toString(32),i>>=j,f-=j,ar=1<<32-ct(n)+f|l<<f|i,lr=x+e}else ar=1<<x|l<<f|i,lr=e}function Rc(e){e.return!==null&&(xr(e,1),Rp(e,1,0))}function Ac(e){for(;e===bi;)bi=ll[--sl],ll[sl]=null,Zl=ll[--sl],ll[sl]=null;for(;e===_r;)_r=On[--Bn],On[Bn]=null,lr=On[--Bn],On[Bn]=null,ar=On[--Bn],On[Bn]=null}function Ap(e,n){On[Bn++]=ar,On[Bn++]=lr,On[Bn++]=_r,ar=n.id,lr=n.overflow,_r=e}var Xt=null,vt=null,Qe=!1,Or=null,In=!1,Mc=Error(o(519));function Br(e){var n=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Jl(_n(n,e)),Mc}function Mp(e){var n=e.stateNode,l=e.type,i=e.memoizedProps;switch(n[Ht]=e,n[dt]=i,l){case"dialog":Ye("cancel",n),Ye("close",n);break;case"iframe":case"object":case"embed":Ye("load",n);break;case"video":case"audio":for(l=0;l<js.length;l++)Ye(js[l],n);break;case"source":Ye("error",n);break;case"img":case"image":case"link":Ye("error",n),Ye("load",n);break;case"details":Ye("toggle",n);break;case"input":Ye("invalid",n),Ff(n,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":Ye("invalid",n);break;case"textarea":Ye("invalid",n),Wf(n,i.value,i.defaultValue,i.children)}l=i.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||n.textContent===""+l||i.suppressHydrationWarning===!0||Yh(n.textContent,l)?(i.popover!=null&&(Ye("beforetoggle",n),Ye("toggle",n)),i.onScroll!=null&&Ye("scroll",n),i.onScrollEnd!=null&&Ye("scrollend",n),i.onClick!=null&&(n.onclick=pr),n=!0):n=!1,n||Br(e,!0)}function Lp(e){for(Xt=e.return;Xt;)switch(Xt.tag){case 5:case 31:case 13:In=!1;return;case 27:case 3:In=!0;return;default:Xt=Xt.return}}function il(e){if(e!==Xt)return!1;if(!Qe)return Lp(e),Qe=!0,!1;var n=e.tag,l;if((l=n!==3&&n!==27)&&((l=n===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||Ku(e.type,e.memoizedProps)),l=!l),l&&vt&&Br(e),Lp(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));vt=rx(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));vt=rx(e)}else n===27?(n=vt,Qr(e.type)?(e=ed,ed=null,vt=e):vt=n):vt=Xt?Hn(e.stateNode.nextSibling):null;return!0}function ka(){vt=Xt=null,Qe=!1}function Lc(){var e=Or;return e!==null&&(mn===null?mn=e:mn.push.apply(mn,e),Or=null),e}function Jl(e){Or===null?Or=[e]:Or.push(e)}var zc=M(null),wa=null,gr=null;function Ir(e,n,l){W(zc,n._currentValue),n._currentValue=l}function vr(e){e._currentValue=zc.current,Y(zc)}function Dc(e,n,l){for(;e!==null;){var i=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,i!==null&&(i.childLanes|=n)):i!==null&&(i.childLanes&n)!==n&&(i.childLanes|=n),e===l)break;e=e.return}}function _c(e,n,l,i){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var x=f.dependencies;if(x!==null){var j=f.child;x=x.firstContext;e:for(;x!==null;){var R=x;x=f;for(var V=0;V<n.length;V++)if(R.context===n[V]){x.lanes|=l,R=x.alternate,R!==null&&(R.lanes|=l),Dc(x.return,l,e),i||(j=null);break e}x=R.next}}else if(f.tag===18){if(j=f.return,j===null)throw Error(o(341));j.lanes|=l,x=j.alternate,x!==null&&(x.lanes|=l),Dc(j,l,e),j=null}else j=f.child;if(j!==null)j.return=f;else for(j=f;j!==null;){if(j===e){j=null;break}if(f=j.sibling,f!==null){f.return=j.return,j=f;break}j=j.return}f=j}}function ol(e,n,l,i){e=null;for(var f=n,x=!1;f!==null;){if(!x){if((f.flags&524288)!==0)x=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var j=f.alternate;if(j===null)throw Error(o(387));if(j=j.memoizedProps,j!==null){var R=f.type;vn(f.pendingProps.value,j.value)||(e!==null?e.push(R):e=[R])}}else if(f===ve.current){if(j=f.alternate,j===null)throw Error(o(387));j.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(Es):e=[Es])}f=f.return}e!==null&&_c(n,e,l,i),n.flags|=262144}function ji(e){for(e=e.firstContext;e!==null;){if(!vn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ca(e){wa=e,gr=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Qt(e){return zp(wa,e)}function Si(e,n){return wa===null&&Ca(e),zp(e,n)}function zp(e,n){var l=n._currentValue;if(n={context:n,memoizedValue:l,next:null},gr===null){if(e===null)throw Error(o(308));gr=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else gr=gr.next=n;return l}var Qb=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(l,i){e.push(i)}};this.abort=function(){n.aborted=!0,e.forEach(function(l){return l()})}},Zb=t.unstable_scheduleCallback,Jb=t.unstable_NormalPriority,Dt={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Oc(){return{controller:new Qb,data:new Map,refCount:0}}function es(e){e.refCount--,e.refCount===0&&Zb(Jb,function(){e.controller.abort()})}var ts=null,Bc=0,cl=0,ul=null;function e1(e,n){if(ts===null){var l=ts=[];Bc=0,cl=Hu(),ul={status:"pending",value:void 0,then:function(i){l.push(i)}}}return Bc++,n.then(Dp,Dp),n}function Dp(){if(--Bc===0&&ts!==null){ul!==null&&(ul.status="fulfilled");var e=ts;ts=null,cl=0,ul=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function t1(e,n){var l=[],i={status:"pending",value:null,reason:null,then:function(f){l.push(f)}};return e.then(function(){i.status="fulfilled",i.value=n;for(var f=0;f<l.length;f++)(0,l[f])(n)},function(f){for(i.status="rejected",i.reason=f,f=0;f<l.length;f++)(0,l[f])(void 0)}),i}var _p=z.S;z.S=function(e,n){vh=We(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&e1(e,n),_p!==null&&_p(e,n)};var Ea=M(null);function Ic(){var e=Ea.current;return e!==null?e:xt.pooledCache}function ki(e,n){n===null?W(Ea,Ea.current):W(Ea,n.pool)}function Op(){var e=Ic();return e===null?null:{parent:Dt._currentValue,pool:e}}var dl=Error(o(460)),Uc=Error(o(474)),wi=Error(o(542)),Ci={then:function(){}};function Bp(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Ip(e,n,l){switch(l=e[l],l===void 0?e.push(n):l!==n&&(n.then(pr,pr),n=l),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Hp(e),e;default:if(typeof n.status=="string")n.then(pr,pr);else{if(e=xt,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=n,e.status="pending",e.then(function(i){if(n.status==="pending"){var f=n;f.status="fulfilled",f.value=i}},function(i){if(n.status==="pending"){var f=n;f.status="rejected",f.reason=i}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Hp(e),e}throw Ta=n,dl}}function Na(e){try{var n=e._init;return n(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Ta=l,dl):l}}var Ta=null;function Up(){if(Ta===null)throw Error(o(459));var e=Ta;return Ta=null,e}function Hp(e){if(e===dl||e===wi)throw Error(o(483))}var fl=null,ns=0;function Ei(e){var n=ns;return ns+=1,fl===null&&(fl=[]),Ip(fl,e,n)}function rs(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Ni(e,n){throw n.$$typeof===b?Error(o(525)):(e=Object.prototype.toString.call(n),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function $p(e){function n(K,G){if(e){var Z=K.deletions;Z===null?(K.deletions=[G],K.flags|=16):Z.push(G)}}function l(K,G){if(!e)return null;for(;G!==null;)n(K,G),G=G.sibling;return null}function i(K){for(var G=new Map;K!==null;)K.key!==null?G.set(K.key,K):G.set(K.index,K),K=K.sibling;return G}function f(K,G){return K=hr(K,G),K.index=0,K.sibling=null,K}function x(K,G,Z){return K.index=Z,e?(Z=K.alternate,Z!==null?(Z=Z.index,Z<G?(K.flags|=67108866,G):Z):(K.flags|=67108866,G)):(K.flags|=1048576,G)}function j(K){return e&&K.alternate===null&&(K.flags|=67108866),K}function R(K,G,Z,ue){return G===null||G.tag!==6?(G=Nc(Z,K.mode,ue),G.return=K,G):(G=f(G,Z),G.return=K,G)}function V(K,G,Z,ue){var Ae=Z.type;return Ae===w?ie(K,G,Z.props.children,ue,Z.key):G!==null&&(G.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===B&&Na(Ae)===G.type)?(G=f(G,Z.props),rs(G,Z),G.return=K,G):(G=yi(Z.type,Z.key,Z.props,null,K.mode,ue),rs(G,Z),G.return=K,G)}function J(K,G,Z,ue){return G===null||G.tag!==4||G.stateNode.containerInfo!==Z.containerInfo||G.stateNode.implementation!==Z.implementation?(G=Tc(Z,K.mode,ue),G.return=K,G):(G=f(G,Z.children||[]),G.return=K,G)}function ie(K,G,Z,ue,Ae){return G===null||G.tag!==7?(G=Sa(Z,K.mode,ue,Ae),G.return=K,G):(G=f(G,Z),G.return=K,G)}function fe(K,G,Z){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=Nc(""+G,K.mode,Z),G.return=K,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case S:return Z=yi(G.type,G.key,G.props,null,K.mode,Z),rs(Z,G),Z.return=K,Z;case k:return G=Tc(G,K.mode,Z),G.return=K,G;case B:return G=Na(G),fe(K,G,Z)}if(I(G)||q(G))return G=Sa(G,K.mode,Z,null),G.return=K,G;if(typeof G.then=="function")return fe(K,Ei(G),Z);if(G.$$typeof===A)return fe(K,Si(K,G),Z);Ni(K,G)}return null}function te(K,G,Z,ue){var Ae=G!==null?G.key:null;if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return Ae!==null?null:R(K,G,""+Z,ue);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case S:return Z.key===Ae?V(K,G,Z,ue):null;case k:return Z.key===Ae?J(K,G,Z,ue):null;case B:return Z=Na(Z),te(K,G,Z,ue)}if(I(Z)||q(Z))return Ae!==null?null:ie(K,G,Z,ue,null);if(typeof Z.then=="function")return te(K,G,Ei(Z),ue);if(Z.$$typeof===A)return te(K,G,Si(K,Z),ue);Ni(K,Z)}return null}function re(K,G,Z,ue,Ae){if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return K=K.get(Z)||null,R(G,K,""+ue,Ae);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case S:return K=K.get(ue.key===null?Z:ue.key)||null,V(G,K,ue,Ae);case k:return K=K.get(ue.key===null?Z:ue.key)||null,J(G,K,ue,Ae);case B:return ue=Na(ue),re(K,G,Z,ue,Ae)}if(I(ue)||q(ue))return K=K.get(Z)||null,ie(G,K,ue,Ae,null);if(typeof ue.then=="function")return re(K,G,Z,Ei(ue),Ae);if(ue.$$typeof===A)return re(K,G,Z,Si(G,ue),Ae);Ni(G,ue)}return null}function Ce(K,G,Z,ue){for(var Ae=null,Je=null,Ee=G,Pe=G=0,Xe=null;Ee!==null&&Pe<Z.length;Pe++){Ee.index>Pe?(Xe=Ee,Ee=null):Xe=Ee.sibling;var et=te(K,Ee,Z[Pe],ue);if(et===null){Ee===null&&(Ee=Xe);break}e&&Ee&&et.alternate===null&&n(K,Ee),G=x(et,G,Pe),Je===null?Ae=et:Je.sibling=et,Je=et,Ee=Xe}if(Pe===Z.length)return l(K,Ee),Qe&&xr(K,Pe),Ae;if(Ee===null){for(;Pe<Z.length;Pe++)Ee=fe(K,Z[Pe],ue),Ee!==null&&(G=x(Ee,G,Pe),Je===null?Ae=Ee:Je.sibling=Ee,Je=Ee);return Qe&&xr(K,Pe),Ae}for(Ee=i(Ee);Pe<Z.length;Pe++)Xe=re(Ee,K,Pe,Z[Pe],ue),Xe!==null&&(e&&Xe.alternate!==null&&Ee.delete(Xe.key===null?Pe:Xe.key),G=x(Xe,G,Pe),Je===null?Ae=Xe:Je.sibling=Xe,Je=Xe);return e&&Ee.forEach(function(na){return n(K,na)}),Qe&&xr(K,Pe),Ae}function ze(K,G,Z,ue){if(Z==null)throw Error(o(151));for(var Ae=null,Je=null,Ee=G,Pe=G=0,Xe=null,et=Z.next();Ee!==null&&!et.done;Pe++,et=Z.next()){Ee.index>Pe?(Xe=Ee,Ee=null):Xe=Ee.sibling;var na=te(K,Ee,et.value,ue);if(na===null){Ee===null&&(Ee=Xe);break}e&&Ee&&na.alternate===null&&n(K,Ee),G=x(na,G,Pe),Je===null?Ae=na:Je.sibling=na,Je=na,Ee=Xe}if(et.done)return l(K,Ee),Qe&&xr(K,Pe),Ae;if(Ee===null){for(;!et.done;Pe++,et=Z.next())et=fe(K,et.value,ue),et!==null&&(G=x(et,G,Pe),Je===null?Ae=et:Je.sibling=et,Je=et);return Qe&&xr(K,Pe),Ae}for(Ee=i(Ee);!et.done;Pe++,et=Z.next())et=re(Ee,K,Pe,et.value,ue),et!==null&&(e&&et.alternate!==null&&Ee.delete(et.key===null?Pe:et.key),G=x(et,G,Pe),Je===null?Ae=et:Je.sibling=et,Je=et);return e&&Ee.forEach(function(f0){return n(K,f0)}),Qe&&xr(K,Pe),Ae}function mt(K,G,Z,ue){if(typeof Z=="object"&&Z!==null&&Z.type===w&&Z.key===null&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case S:e:{for(var Ae=Z.key;G!==null;){if(G.key===Ae){if(Ae=Z.type,Ae===w){if(G.tag===7){l(K,G.sibling),ue=f(G,Z.props.children),ue.return=K,K=ue;break e}}else if(G.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===B&&Na(Ae)===G.type){l(K,G.sibling),ue=f(G,Z.props),rs(ue,Z),ue.return=K,K=ue;break e}l(K,G);break}else n(K,G);G=G.sibling}Z.type===w?(ue=Sa(Z.props.children,K.mode,ue,Z.key),ue.return=K,K=ue):(ue=yi(Z.type,Z.key,Z.props,null,K.mode,ue),rs(ue,Z),ue.return=K,K=ue)}return j(K);case k:e:{for(Ae=Z.key;G!==null;){if(G.key===Ae)if(G.tag===4&&G.stateNode.containerInfo===Z.containerInfo&&G.stateNode.implementation===Z.implementation){l(K,G.sibling),ue=f(G,Z.children||[]),ue.return=K,K=ue;break e}else{l(K,G);break}else n(K,G);G=G.sibling}ue=Tc(Z,K.mode,ue),ue.return=K,K=ue}return j(K);case B:return Z=Na(Z),mt(K,G,Z,ue)}if(I(Z))return Ce(K,G,Z,ue);if(q(Z)){if(Ae=q(Z),typeof Ae!="function")throw Error(o(150));return Z=Ae.call(Z),ze(K,G,Z,ue)}if(typeof Z.then=="function")return mt(K,G,Ei(Z),ue);if(Z.$$typeof===A)return mt(K,G,Si(K,Z),ue);Ni(K,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint"?(Z=""+Z,G!==null&&G.tag===6?(l(K,G.sibling),ue=f(G,Z),ue.return=K,K=ue):(l(K,G),ue=Nc(Z,K.mode,ue),ue.return=K,K=ue),j(K)):l(K,G)}return function(K,G,Z,ue){try{ns=0;var Ae=mt(K,G,Z,ue);return fl=null,Ae}catch(Ee){if(Ee===dl||Ee===wi)throw Ee;var Je=yn(29,Ee,null,K.mode);return Je.lanes=ue,Je.return=K,Je}finally{}}}var Ra=$p(!0),Vp=$p(!1),Ur=!1;function Hc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function $c(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Hr(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function $r(e,n,l){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(rt&2)!==0){var f=i.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),i.pending=n,n=vi(e),Cp(e,null,l),n}return gi(e,i,n,l),vi(e)}function as(e,n,l){if(n=n.updateQueue,n!==null&&(n=n.shared,(l&4194048)!==0)){var i=n.lanes;i&=e.pendingLanes,l|=i,n.lanes=l,pa(e,l)}}function Vc(e,n){var l=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,l===i)){var f=null,x=null;if(l=l.firstBaseUpdate,l!==null){do{var j={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};x===null?f=x=j:x=x.next=j,l=l.next}while(l!==null);x===null?f=x=n:x=x.next=n}else f=x=n;l={baseState:i.baseState,firstBaseUpdate:f,lastBaseUpdate:x,shared:i.shared,callbacks:i.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=n:e.next=n,l.lastBaseUpdate=n}var Pc=!1;function ls(){if(Pc){var e=ul;if(e!==null)throw e}}function ss(e,n,l,i){Pc=!1;var f=e.updateQueue;Ur=!1;var x=f.firstBaseUpdate,j=f.lastBaseUpdate,R=f.shared.pending;if(R!==null){f.shared.pending=null;var V=R,J=V.next;V.next=null,j===null?x=J:j.next=J,j=V;var ie=e.alternate;ie!==null&&(ie=ie.updateQueue,R=ie.lastBaseUpdate,R!==j&&(R===null?ie.firstBaseUpdate=J:R.next=J,ie.lastBaseUpdate=V))}if(x!==null){var fe=f.baseState;j=0,ie=J=V=null,R=x;do{var te=R.lane&-536870913,re=te!==R.lane;if(re?(Ke&te)===te:(i&te)===te){te!==0&&te===cl&&(Pc=!0),ie!==null&&(ie=ie.next={lane:0,tag:R.tag,payload:R.payload,callback:null,next:null});e:{var Ce=e,ze=R;te=n;var mt=l;switch(ze.tag){case 1:if(Ce=ze.payload,typeof Ce=="function"){fe=Ce.call(mt,fe,te);break e}fe=Ce;break e;case 3:Ce.flags=Ce.flags&-65537|128;case 0:if(Ce=ze.payload,te=typeof Ce=="function"?Ce.call(mt,fe,te):Ce,te==null)break e;fe=v({},fe,te);break e;case 2:Ur=!0}}te=R.callback,te!==null&&(e.flags|=64,re&&(e.flags|=8192),re=f.callbacks,re===null?f.callbacks=[te]:re.push(te))}else re={lane:te,tag:R.tag,payload:R.payload,callback:R.callback,next:null},ie===null?(J=ie=re,V=fe):ie=ie.next=re,j|=te;if(R=R.next,R===null){if(R=f.shared.pending,R===null)break;re=R,R=re.next,re.next=null,f.lastBaseUpdate=re,f.shared.pending=null}}while(!0);ie===null&&(V=fe),f.baseState=V,f.firstBaseUpdate=J,f.lastBaseUpdate=ie,x===null&&(f.shared.lanes=0),Wr|=j,e.lanes=j,e.memoizedState=fe}}function Pp(e,n){if(typeof e!="function")throw Error(o(191,e));e.call(n)}function Fp(e,n){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)Pp(l[e],n)}var pl=M(null),Ti=M(0);function Gp(e,n){e=Nr,W(Ti,e),W(pl,n),Nr=e|n.baseLanes}function Fc(){W(Ti,Nr),W(pl,pl.current)}function Gc(){Nr=Ti.current,Y(pl),Y(Ti)}var bn=M(null),Un=null;function Vr(e){var n=e.alternate;W(Lt,Lt.current&1),W(bn,e),Un===null&&(n===null||pl.current!==null||n.memoizedState!==null)&&(Un=e)}function Wc(e){W(Lt,Lt.current),W(bn,e),Un===null&&(Un=e)}function Wp(e){e.tag===22?(W(Lt,Lt.current),W(bn,e),Un===null&&(Un=e)):Pr()}function Pr(){W(Lt,Lt.current),W(bn,bn.current)}function jn(e){Y(bn),Un===e&&(Un=null),Y(Lt)}var Lt=M(0);function Ri(e){for(var n=e;n!==null;){if(n.tag===13){var l=n.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Zu(l)||Ju(l)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var yr=0,Ve=null,ft=null,_t=null,Ai=!1,ml=!1,Aa=!1,Mi=0,is=0,hl=null,n1=0;function At(){throw Error(o(321))}function qc(e,n){if(n===null)return!1;for(var l=0;l<n.length&&l<e.length;l++)if(!vn(e[l],n[l]))return!1;return!0}function Yc(e,n,l,i,f,x){return yr=x,Ve=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,z.H=e===null||e.memoizedState===null?Rm:cu,Aa=!1,x=l(i,f),Aa=!1,ml&&(x=Yp(n,l,i,f)),qp(e),x}function qp(e){z.H=us;var n=ft!==null&&ft.next!==null;if(yr=0,_t=ft=Ve=null,Ai=!1,is=0,hl=null,n)throw Error(o(300));e===null||Ot||(e=e.dependencies,e!==null&&ji(e)&&(Ot=!0))}function Yp(e,n,l,i){Ve=e;var f=0;do{if(ml&&(hl=null),is=0,ml=!1,25<=f)throw Error(o(301));if(f+=1,_t=ft=null,e.updateQueue!=null){var x=e.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}z.H=Am,x=n(l,i)}while(ml);return x}function r1(){var e=z.H,n=e.useState()[0];return n=typeof n.then=="function"?os(n):n,e=e.useState()[0],(ft!==null?ft.memoizedState:null)!==e&&(Ve.flags|=1024),n}function Kc(){var e=Mi!==0;return Mi=0,e}function Xc(e,n,l){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~l}function Qc(e){if(Ai){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Ai=!1}yr=0,_t=ft=Ve=null,ml=!1,is=Mi=0,hl=null}function ln(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _t===null?Ve.memoizedState=_t=e:_t=_t.next=e,_t}function zt(){if(ft===null){var e=Ve.alternate;e=e!==null?e.memoizedState:null}else e=ft.next;var n=_t===null?Ve.memoizedState:_t.next;if(n!==null)_t=n,ft=e;else{if(e===null)throw Ve.alternate===null?Error(o(467)):Error(o(310));ft=e,e={memoizedState:ft.memoizedState,baseState:ft.baseState,baseQueue:ft.baseQueue,queue:ft.queue,next:null},_t===null?Ve.memoizedState=_t=e:_t=_t.next=e}return _t}function Li(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function os(e){var n=is;return is+=1,hl===null&&(hl=[]),e=Ip(hl,e,n),n=Ve,(_t===null?n.memoizedState:_t.next)===null&&(n=n.alternate,z.H=n===null||n.memoizedState===null?Rm:cu),e}function zi(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return os(e);if(e.$$typeof===A)return Qt(e)}throw Error(o(438,String(e)))}function Zc(e){var n=null,l=Ve.updateQueue;if(l!==null&&(n=l.memoCache),n==null){var i=Ve.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(n={data:i.data.map(function(f){return f.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),l===null&&(l=Li(),Ve.updateQueue=l),l.memoCache=n,l=n.data[n.index],l===void 0)for(l=n.data[n.index]=Array(e),i=0;i<e;i++)l[i]=U;return n.index++,l}function br(e,n){return typeof n=="function"?n(e):n}function Di(e){var n=zt();return Jc(n,ft,e)}function Jc(e,n,l){var i=e.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=l;var f=e.baseQueue,x=i.pending;if(x!==null){if(f!==null){var j=f.next;f.next=x.next,x.next=j}n.baseQueue=f=x,i.pending=null}if(x=e.baseState,f===null)e.memoizedState=x;else{n=f.next;var R=j=null,V=null,J=n,ie=!1;do{var fe=J.lane&-536870913;if(fe!==J.lane?(Ke&fe)===fe:(yr&fe)===fe){var te=J.revertLane;if(te===0)V!==null&&(V=V.next={lane:0,revertLane:0,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null}),fe===cl&&(ie=!0);else if((yr&te)===te){J=J.next,te===cl&&(ie=!0);continue}else fe={lane:0,revertLane:J.revertLane,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},V===null?(R=V=fe,j=x):V=V.next=fe,Ve.lanes|=te,Wr|=te;fe=J.action,Aa&&l(x,fe),x=J.hasEagerState?J.eagerState:l(x,fe)}else te={lane:fe,revertLane:J.revertLane,gesture:J.gesture,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},V===null?(R=V=te,j=x):V=V.next=te,Ve.lanes|=fe,Wr|=fe;J=J.next}while(J!==null&&J!==n);if(V===null?j=x:V.next=R,!vn(x,e.memoizedState)&&(Ot=!0,ie&&(l=ul,l!==null)))throw l;e.memoizedState=x,e.baseState=j,e.baseQueue=V,i.lastRenderedState=x}return f===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function eu(e){var n=zt(),l=n.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=e;var i=l.dispatch,f=l.pending,x=n.memoizedState;if(f!==null){l.pending=null;var j=f=f.next;do x=e(x,j.action),j=j.next;while(j!==f);vn(x,n.memoizedState)||(Ot=!0),n.memoizedState=x,n.baseQueue===null&&(n.baseState=x),l.lastRenderedState=x}return[x,i]}function Kp(e,n,l){var i=Ve,f=zt(),x=Qe;if(x){if(l===void 0)throw Error(o(407));l=l()}else l=n();var j=!vn((ft||f).memoizedState,l);if(j&&(f.memoizedState=l,Ot=!0),f=f.queue,ru(Zp.bind(null,i,f,e),[e]),f.getSnapshot!==n||j||_t!==null&&_t.memoizedState.tag&1){if(i.flags|=2048,xl(9,{destroy:void 0},Qp.bind(null,i,f,l,n),null),xt===null)throw Error(o(349));x||(yr&127)!==0||Xp(i,n,l)}return l}function Xp(e,n,l){e.flags|=16384,e={getSnapshot:n,value:l},n=Ve.updateQueue,n===null?(n=Li(),Ve.updateQueue=n,n.stores=[e]):(l=n.stores,l===null?n.stores=[e]:l.push(e))}function Qp(e,n,l,i){n.value=l,n.getSnapshot=i,Jp(n)&&em(e)}function Zp(e,n,l){return l(function(){Jp(n)&&em(e)})}function Jp(e){var n=e.getSnapshot;e=e.value;try{var l=n();return!vn(e,l)}catch{return!0}}function em(e){var n=ja(e,2);n!==null&&hn(n,e,2)}function tu(e){var n=ln();if(typeof e=="function"){var l=e;if(e=l(),Aa){Rt(!0);try{l()}finally{Rt(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:br,lastRenderedState:e},n}function tm(e,n,l,i){return e.baseState=l,Jc(e,ft,typeof i=="function"?i:br)}function a1(e,n,l,i,f){if(Bi(e))throw Error(o(485));if(e=n.action,e!==null){var x={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(j){x.listeners.push(j)}};z.T!==null?l(!0):x.isTransition=!1,i(x),l=n.pending,l===null?(x.next=n.pending=x,nm(n,x)):(x.next=l.next,n.pending=l.next=x)}}function nm(e,n){var l=n.action,i=n.payload,f=e.state;if(n.isTransition){var x=z.T,j={};z.T=j;try{var R=l(f,i),V=z.S;V!==null&&V(j,R),rm(e,n,R)}catch(J){nu(e,n,J)}finally{x!==null&&j.types!==null&&(x.types=j.types),z.T=x}}else try{x=l(f,i),rm(e,n,x)}catch(J){nu(e,n,J)}}function rm(e,n,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(i){am(e,n,i)},function(i){return nu(e,n,i)}):am(e,n,l)}function am(e,n,l){n.status="fulfilled",n.value=l,lm(n),e.state=l,n=e.pending,n!==null&&(l=n.next,l===n?e.pending=null:(l=l.next,n.next=l,nm(e,l)))}function nu(e,n,l){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do n.status="rejected",n.reason=l,lm(n),n=n.next;while(n!==i)}e.action=null}function lm(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function sm(e,n){return n}function im(e,n){if(Qe){var l=xt.formState;if(l!==null){e:{var i=Ve;if(Qe){if(vt){t:{for(var f=vt,x=In;f.nodeType!==8;){if(!x){f=null;break t}if(f=Hn(f.nextSibling),f===null){f=null;break t}}x=f.data,f=x==="F!"||x==="F"?f:null}if(f){vt=Hn(f.nextSibling),i=f.data==="F!";break e}}Br(i)}i=!1}i&&(n=l[0])}}return l=ln(),l.memoizedState=l.baseState=n,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sm,lastRenderedState:n},l.queue=i,l=Em.bind(null,Ve,i),i.dispatch=l,i=tu(!1),x=ou.bind(null,Ve,!1,i.queue),i=ln(),f={state:n,dispatch:null,action:e,pending:null},i.queue=f,l=a1.bind(null,Ve,f,x,l),f.dispatch=l,i.memoizedState=e,[n,l,!1]}function om(e){var n=zt();return cm(n,ft,e)}function cm(e,n,l){if(n=Jc(e,n,sm)[0],e=Di(br)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var i=os(n)}catch(j){throw j===dl?wi:j}else i=n;n=zt();var f=n.queue,x=f.dispatch;return l!==n.memoizedState&&(Ve.flags|=2048,xl(9,{destroy:void 0},l1.bind(null,f,l),null)),[i,x,e]}function l1(e,n){e.action=n}function um(e){var n=zt(),l=ft;if(l!==null)return cm(n,l,e);zt(),n=n.memoizedState,l=zt();var i=l.queue.dispatch;return l.memoizedState=e,[n,i,!1]}function xl(e,n,l,i){return e={tag:e,create:l,deps:i,inst:n,next:null},n=Ve.updateQueue,n===null&&(n=Li(),Ve.updateQueue=n),l=n.lastEffect,l===null?n.lastEffect=e.next=e:(i=l.next,l.next=e,e.next=i,n.lastEffect=e),e}function dm(){return zt().memoizedState}function _i(e,n,l,i){var f=ln();Ve.flags|=e,f.memoizedState=xl(1|n,{destroy:void 0},l,i===void 0?null:i)}function Oi(e,n,l,i){var f=zt();i=i===void 0?null:i;var x=f.memoizedState.inst;ft!==null&&i!==null&&qc(i,ft.memoizedState.deps)?f.memoizedState=xl(n,x,l,i):(Ve.flags|=e,f.memoizedState=xl(1|n,x,l,i))}function fm(e,n){_i(8390656,8,e,n)}function ru(e,n){Oi(2048,8,e,n)}function s1(e){Ve.flags|=4;var n=Ve.updateQueue;if(n===null)n=Li(),Ve.updateQueue=n,n.events=[e];else{var l=n.events;l===null?n.events=[e]:l.push(e)}}function pm(e){var n=zt().memoizedState;return s1({ref:n,nextImpl:e}),function(){if((rt&2)!==0)throw Error(o(440));return n.impl.apply(void 0,arguments)}}function mm(e,n){return Oi(4,2,e,n)}function hm(e,n){return Oi(4,4,e,n)}function xm(e,n){if(typeof n=="function"){e=e();var l=n(e);return function(){typeof l=="function"?l():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function gm(e,n,l){l=l!=null?l.concat([e]):null,Oi(4,4,xm.bind(null,n,e),l)}function au(){}function vm(e,n){var l=zt();n=n===void 0?null:n;var i=l.memoizedState;return n!==null&&qc(n,i[1])?i[0]:(l.memoizedState=[e,n],e)}function ym(e,n){var l=zt();n=n===void 0?null:n;var i=l.memoizedState;if(n!==null&&qc(n,i[1]))return i[0];if(i=e(),Aa){Rt(!0);try{e()}finally{Rt(!1)}}return l.memoizedState=[i,n],i}function lu(e,n,l){return l===void 0||(yr&1073741824)!==0&&(Ke&261930)===0?e.memoizedState=n:(e.memoizedState=l,e=bh(),Ve.lanes|=e,Wr|=e,l)}function bm(e,n,l,i){return vn(l,n)?l:pl.current!==null?(e=lu(e,l,i),vn(e,n)||(Ot=!0),e):(yr&42)===0||(yr&1073741824)!==0&&(Ke&261930)===0?(Ot=!0,e.memoizedState=l):(e=bh(),Ve.lanes|=e,Wr|=e,n)}function jm(e,n,l,i,f){var x=O.p;O.p=x!==0&&8>x?x:8;var j=z.T,R={};z.T=R,ou(e,!1,n,l);try{var V=f(),J=z.S;if(J!==null&&J(R,V),V!==null&&typeof V=="object"&&typeof V.then=="function"){var ie=t1(V,i);cs(e,n,ie,wn(e))}else cs(e,n,i,wn(e))}catch(fe){cs(e,n,{then:function(){},status:"rejected",reason:fe},wn())}finally{O.p=x,j!==null&&R.types!==null&&(j.types=R.types),z.T=j}}function i1(){}function su(e,n,l,i){if(e.tag!==5)throw Error(o(476));var f=Sm(e).queue;jm(e,f,n,P,l===null?i1:function(){return km(e),l(i)})}function Sm(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:P,baseState:P,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:br,lastRenderedState:P},next:null};var l={};return n.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:br,lastRenderedState:l},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function km(e){var n=Sm(e);n.next===null&&(n=e.alternate.memoizedState),cs(e,n.next.queue,{},wn())}function iu(){return Qt(Es)}function wm(){return zt().memoizedState}function Cm(){return zt().memoizedState}function o1(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var l=wn();e=Hr(l);var i=$r(n,e,l);i!==null&&(hn(i,n,l),as(i,n,l)),n={cache:Oc()},e.payload=n;return}n=n.return}}function c1(e,n,l){var i=wn();l={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Bi(e)?Nm(n,l):(l=Cc(e,n,l,i),l!==null&&(hn(l,e,i),Tm(l,n,i)))}function Em(e,n,l){var i=wn();cs(e,n,l,i)}function cs(e,n,l,i){var f={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Bi(e))Nm(n,f);else{var x=e.alternate;if(e.lanes===0&&(x===null||x.lanes===0)&&(x=n.lastRenderedReducer,x!==null))try{var j=n.lastRenderedState,R=x(j,l);if(f.hasEagerState=!0,f.eagerState=R,vn(R,j))return gi(e,n,f,0),xt===null&&xi(),!1}catch{}finally{}if(l=Cc(e,n,f,i),l!==null)return hn(l,e,i),Tm(l,n,i),!0}return!1}function ou(e,n,l,i){if(i={lane:2,revertLane:Hu(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Bi(e)){if(n)throw Error(o(479))}else n=Cc(e,l,i,2),n!==null&&hn(n,e,2)}function Bi(e){var n=e.alternate;return e===Ve||n!==null&&n===Ve}function Nm(e,n){ml=Ai=!0;var l=e.pending;l===null?n.next=n:(n.next=l.next,l.next=n),e.pending=n}function Tm(e,n,l){if((l&4194048)!==0){var i=n.lanes;i&=e.pendingLanes,l|=i,n.lanes=l,pa(e,l)}}var us={readContext:Qt,use:zi,useCallback:At,useContext:At,useEffect:At,useImperativeHandle:At,useLayoutEffect:At,useInsertionEffect:At,useMemo:At,useReducer:At,useRef:At,useState:At,useDebugValue:At,useDeferredValue:At,useTransition:At,useSyncExternalStore:At,useId:At,useHostTransitionStatus:At,useFormState:At,useActionState:At,useOptimistic:At,useMemoCache:At,useCacheRefresh:At};us.useEffectEvent=At;var Rm={readContext:Qt,use:zi,useCallback:function(e,n){return ln().memoizedState=[e,n===void 0?null:n],e},useContext:Qt,useEffect:fm,useImperativeHandle:function(e,n,l){l=l!=null?l.concat([e]):null,_i(4194308,4,xm.bind(null,n,e),l)},useLayoutEffect:function(e,n){return _i(4194308,4,e,n)},useInsertionEffect:function(e,n){_i(4,2,e,n)},useMemo:function(e,n){var l=ln();n=n===void 0?null:n;var i=e();if(Aa){Rt(!0);try{e()}finally{Rt(!1)}}return l.memoizedState=[i,n],i},useReducer:function(e,n,l){var i=ln();if(l!==void 0){var f=l(n);if(Aa){Rt(!0);try{l(n)}finally{Rt(!1)}}}else f=n;return i.memoizedState=i.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},i.queue=e,e=e.dispatch=c1.bind(null,Ve,e),[i.memoizedState,e]},useRef:function(e){var n=ln();return e={current:e},n.memoizedState=e},useState:function(e){e=tu(e);var n=e.queue,l=Em.bind(null,Ve,n);return n.dispatch=l,[e.memoizedState,l]},useDebugValue:au,useDeferredValue:function(e,n){var l=ln();return lu(l,e,n)},useTransition:function(){var e=tu(!1);return e=jm.bind(null,Ve,e.queue,!0,!1),ln().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,l){var i=Ve,f=ln();if(Qe){if(l===void 0)throw Error(o(407));l=l()}else{if(l=n(),xt===null)throw Error(o(349));(Ke&127)!==0||Xp(i,n,l)}f.memoizedState=l;var x={value:l,getSnapshot:n};return f.queue=x,fm(Zp.bind(null,i,x,e),[e]),i.flags|=2048,xl(9,{destroy:void 0},Qp.bind(null,i,x,l,n),null),l},useId:function(){var e=ln(),n=xt.identifierPrefix;if(Qe){var l=lr,i=ar;l=(i&~(1<<32-ct(i)-1)).toString(32)+l,n="_"+n+"R_"+l,l=Mi++,0<l&&(n+="H"+l.toString(32)),n+="_"}else l=n1++,n="_"+n+"r_"+l.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:iu,useFormState:im,useActionState:im,useOptimistic:function(e){var n=ln();n.memoizedState=n.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=l,n=ou.bind(null,Ve,!0,l),l.dispatch=n,[e,n]},useMemoCache:Zc,useCacheRefresh:function(){return ln().memoizedState=o1.bind(null,Ve)},useEffectEvent:function(e){var n=ln(),l={impl:e};return n.memoizedState=l,function(){if((rt&2)!==0)throw Error(o(440));return l.impl.apply(void 0,arguments)}}},cu={readContext:Qt,use:zi,useCallback:vm,useContext:Qt,useEffect:ru,useImperativeHandle:gm,useInsertionEffect:mm,useLayoutEffect:hm,useMemo:ym,useReducer:Di,useRef:dm,useState:function(){return Di(br)},useDebugValue:au,useDeferredValue:function(e,n){var l=zt();return bm(l,ft.memoizedState,e,n)},useTransition:function(){var e=Di(br)[0],n=zt().memoizedState;return[typeof e=="boolean"?e:os(e),n]},useSyncExternalStore:Kp,useId:wm,useHostTransitionStatus:iu,useFormState:om,useActionState:om,useOptimistic:function(e,n){var l=zt();return tm(l,ft,e,n)},useMemoCache:Zc,useCacheRefresh:Cm};cu.useEffectEvent=pm;var Am={readContext:Qt,use:zi,useCallback:vm,useContext:Qt,useEffect:ru,useImperativeHandle:gm,useInsertionEffect:mm,useLayoutEffect:hm,useMemo:ym,useReducer:eu,useRef:dm,useState:function(){return eu(br)},useDebugValue:au,useDeferredValue:function(e,n){var l=zt();return ft===null?lu(l,e,n):bm(l,ft.memoizedState,e,n)},useTransition:function(){var e=eu(br)[0],n=zt().memoizedState;return[typeof e=="boolean"?e:os(e),n]},useSyncExternalStore:Kp,useId:wm,useHostTransitionStatus:iu,useFormState:um,useActionState:um,useOptimistic:function(e,n){var l=zt();return ft!==null?tm(l,ft,e,n):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:Zc,useCacheRefresh:Cm};Am.useEffectEvent=pm;function uu(e,n,l,i){n=e.memoizedState,l=l(i,n),l=l==null?n:v({},n,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var du={enqueueSetState:function(e,n,l){e=e._reactInternals;var i=wn(),f=Hr(i);f.payload=n,l!=null&&(f.callback=l),n=$r(e,f,i),n!==null&&(hn(n,e,i),as(n,e,i))},enqueueReplaceState:function(e,n,l){e=e._reactInternals;var i=wn(),f=Hr(i);f.tag=1,f.payload=n,l!=null&&(f.callback=l),n=$r(e,f,i),n!==null&&(hn(n,e,i),as(n,e,i))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var l=wn(),i=Hr(l);i.tag=2,n!=null&&(i.callback=n),n=$r(e,i,l),n!==null&&(hn(n,e,l),as(n,e,l))}};function Mm(e,n,l,i,f,x,j){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,x,j):n.prototype&&n.prototype.isPureReactComponent?!Xl(l,i)||!Xl(f,x):!0}function Lm(e,n,l,i){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(l,i),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(l,i),n.state!==e&&du.enqueueReplaceState(n,n.state,null)}function Ma(e,n){var l=n;if("ref"in n){l={};for(var i in n)i!=="ref"&&(l[i]=n[i])}if(e=e.defaultProps){l===n&&(l=v({},l));for(var f in e)l[f]===void 0&&(l[f]=e[f])}return l}function zm(e){hi(e)}function Dm(e){console.error(e)}function _m(e){hi(e)}function Ii(e,n){try{var l=e.onUncaughtError;l(n.value,{componentStack:n.stack})}catch(i){setTimeout(function(){throw i})}}function Om(e,n,l){try{var i=e.onCaughtError;i(l.value,{componentStack:l.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function fu(e,n,l){return l=Hr(l),l.tag=3,l.payload={element:null},l.callback=function(){Ii(e,n)},l}function Bm(e){return e=Hr(e),e.tag=3,e}function Im(e,n,l,i){var f=l.type.getDerivedStateFromError;if(typeof f=="function"){var x=i.value;e.payload=function(){return f(x)},e.callback=function(){Om(n,l,i)}}var j=l.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(e.callback=function(){Om(n,l,i),typeof f!="function"&&(qr===null?qr=new Set([this]):qr.add(this));var R=i.stack;this.componentDidCatch(i.value,{componentStack:R!==null?R:""})})}function u1(e,n,l,i,f){if(l.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(n=l.alternate,n!==null&&ol(n,l,f,!0),l=bn.current,l!==null){switch(l.tag){case 31:case 13:return Un===null?Xi():l.alternate===null&&Mt===0&&(Mt=3),l.flags&=-257,l.flags|=65536,l.lanes=f,i===Ci?l.flags|=16384:(n=l.updateQueue,n===null?l.updateQueue=new Set([i]):n.add(i),Bu(e,i,f)),!1;case 22:return l.flags|=65536,i===Ci?l.flags|=16384:(n=l.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([i])},l.updateQueue=n):(l=n.retryQueue,l===null?n.retryQueue=new Set([i]):l.add(i)),Bu(e,i,f)),!1}throw Error(o(435,l.tag))}return Bu(e,i,f),Xi(),!1}if(Qe)return n=bn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,i!==Mc&&(e=Error(o(422),{cause:i}),Jl(_n(e,l)))):(i!==Mc&&(n=Error(o(423),{cause:i}),Jl(_n(n,l))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,i=_n(i,l),f=fu(e.stateNode,i,f),Vc(e,f),Mt!==4&&(Mt=2)),!1;var x=Error(o(520),{cause:i});if(x=_n(x,l),vs===null?vs=[x]:vs.push(x),Mt!==4&&(Mt=2),n===null)return!0;i=_n(i,l),l=n;do{switch(l.tag){case 3:return l.flags|=65536,e=f&-f,l.lanes|=e,e=fu(l.stateNode,i,e),Vc(l,e),!1;case 1:if(n=l.type,x=l.stateNode,(l.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(qr===null||!qr.has(x))))return l.flags|=65536,f&=-f,l.lanes|=f,f=Bm(f),Im(f,e,l,i),Vc(l,f),!1}l=l.return}while(l!==null);return!1}var pu=Error(o(461)),Ot=!1;function Zt(e,n,l,i){n.child=e===null?Vp(n,null,l,i):Ra(n,e.child,l,i)}function Um(e,n,l,i,f){l=l.render;var x=n.ref;if("ref"in i){var j={};for(var R in i)R!=="ref"&&(j[R]=i[R])}else j=i;return Ca(n),i=Yc(e,n,l,j,x,f),R=Kc(),e!==null&&!Ot?(Xc(e,n,f),jr(e,n,f)):(Qe&&R&&Rc(n),n.flags|=1,Zt(e,n,i,f),n.child)}function Hm(e,n,l,i,f){if(e===null){var x=l.type;return typeof x=="function"&&!Ec(x)&&x.defaultProps===void 0&&l.compare===null?(n.tag=15,n.type=x,$m(e,n,x,i,f)):(e=yi(l.type,null,i,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(x=e.child,!ju(e,f)){var j=x.memoizedProps;if(l=l.compare,l=l!==null?l:Xl,l(j,i)&&e.ref===n.ref)return jr(e,n,f)}return n.flags|=1,e=hr(x,i),e.ref=n.ref,e.return=n,n.child=e}function $m(e,n,l,i,f){if(e!==null){var x=e.memoizedProps;if(Xl(x,i)&&e.ref===n.ref)if(Ot=!1,n.pendingProps=i=x,ju(e,f))(e.flags&131072)!==0&&(Ot=!0);else return n.lanes=e.lanes,jr(e,n,f)}return mu(e,n,l,i,f)}function Vm(e,n,l,i){var f=i.children,x=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((n.flags&128)!==0){if(x=x!==null?x.baseLanes|l:l,e!==null){for(i=n.child=e.child,f=0;i!==null;)f=f|i.lanes|i.childLanes,i=i.sibling;i=f&~x}else i=0,n.child=null;return Pm(e,n,x,l,i)}if((l&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&ki(n,x!==null?x.cachePool:null),x!==null?Gp(n,x):Fc(),Wp(n);else return i=n.lanes=536870912,Pm(e,n,x!==null?x.baseLanes|l:l,l,i)}else x!==null?(ki(n,x.cachePool),Gp(n,x),Pr(),n.memoizedState=null):(e!==null&&ki(n,null),Fc(),Pr());return Zt(e,n,f,l),n.child}function ds(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Pm(e,n,l,i,f){var x=Ic();return x=x===null?null:{parent:Dt._currentValue,pool:x},n.memoizedState={baseLanes:l,cachePool:x},e!==null&&ki(n,null),Fc(),Wp(n),e!==null&&ol(e,n,i,!0),n.childLanes=f,null}function Ui(e,n){return n=$i({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function Fm(e,n,l){return Ra(n,e.child,null,l),e=Ui(n,n.pendingProps),e.flags|=2,jn(n),n.memoizedState=null,e}function d1(e,n,l){var i=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Qe){if(i.mode==="hidden")return e=Ui(n,i),n.lanes=536870912,ds(null,e);if(Wc(n),(e=vt)?(e=nx(e,In),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:_r!==null?{id:ar,overflow:lr}:null,retryLane:536870912,hydrationErrors:null},l=Np(e),l.return=n,n.child=l,Xt=n,vt=null)):e=null,e===null)throw Br(n);return n.lanes=536870912,null}return Ui(n,i)}var x=e.memoizedState;if(x!==null){var j=x.dehydrated;if(Wc(n),f)if(n.flags&256)n.flags&=-257,n=Fm(e,n,l);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(o(558));else if(Ot||ol(e,n,l,!1),f=(l&e.childLanes)!==0,Ot||f){if(i=xt,i!==null&&(j=ma(i,l),j!==0&&j!==x.retryLane))throw x.retryLane=j,ja(e,j),hn(i,e,j),pu;Xi(),n=Fm(e,n,l)}else e=x.treeContext,vt=Hn(j.nextSibling),Xt=n,Qe=!0,Or=null,In=!1,e!==null&&Ap(n,e),n=Ui(n,i),n.flags|=4096;return n}return e=hr(e.child,{mode:i.mode,children:i.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Hi(e,n){var l=n.ref;if(l===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(o(284));(e===null||e.ref!==l)&&(n.flags|=4194816)}}function mu(e,n,l,i,f){return Ca(n),l=Yc(e,n,l,i,void 0,f),i=Kc(),e!==null&&!Ot?(Xc(e,n,f),jr(e,n,f)):(Qe&&i&&Rc(n),n.flags|=1,Zt(e,n,l,f),n.child)}function Gm(e,n,l,i,f,x){return Ca(n),n.updateQueue=null,l=Yp(n,i,l,f),qp(e),i=Kc(),e!==null&&!Ot?(Xc(e,n,x),jr(e,n,x)):(Qe&&i&&Rc(n),n.flags|=1,Zt(e,n,l,x),n.child)}function Wm(e,n,l,i,f){if(Ca(n),n.stateNode===null){var x=al,j=l.contextType;typeof j=="object"&&j!==null&&(x=Qt(j)),x=new l(i,x),n.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=du,n.stateNode=x,x._reactInternals=n,x=n.stateNode,x.props=i,x.state=n.memoizedState,x.refs={},Hc(n),j=l.contextType,x.context=typeof j=="object"&&j!==null?Qt(j):al,x.state=n.memoizedState,j=l.getDerivedStateFromProps,typeof j=="function"&&(uu(n,l,j,i),x.state=n.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(j=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),j!==x.state&&du.enqueueReplaceState(x,x.state,null),ss(n,i,x,f),ls(),x.state=n.memoizedState),typeof x.componentDidMount=="function"&&(n.flags|=4194308),i=!0}else if(e===null){x=n.stateNode;var R=n.memoizedProps,V=Ma(l,R);x.props=V;var J=x.context,ie=l.contextType;j=al,typeof ie=="object"&&ie!==null&&(j=Qt(ie));var fe=l.getDerivedStateFromProps;ie=typeof fe=="function"||typeof x.getSnapshotBeforeUpdate=="function",R=n.pendingProps!==R,ie||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(R||J!==j)&&Lm(n,x,i,j),Ur=!1;var te=n.memoizedState;x.state=te,ss(n,i,x,f),ls(),J=n.memoizedState,R||te!==J||Ur?(typeof fe=="function"&&(uu(n,l,fe,i),J=n.memoizedState),(V=Ur||Mm(n,l,V,i,te,J,j))?(ie||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(n.flags|=4194308)):(typeof x.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=i,n.memoizedState=J),x.props=i,x.state=J,x.context=j,i=V):(typeof x.componentDidMount=="function"&&(n.flags|=4194308),i=!1)}else{x=n.stateNode,$c(e,n),j=n.memoizedProps,ie=Ma(l,j),x.props=ie,fe=n.pendingProps,te=x.context,J=l.contextType,V=al,typeof J=="object"&&J!==null&&(V=Qt(J)),R=l.getDerivedStateFromProps,(J=typeof R=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(j!==fe||te!==V)&&Lm(n,x,i,V),Ur=!1,te=n.memoizedState,x.state=te,ss(n,i,x,f),ls();var re=n.memoizedState;j!==fe||te!==re||Ur||e!==null&&e.dependencies!==null&&ji(e.dependencies)?(typeof R=="function"&&(uu(n,l,R,i),re=n.memoizedState),(ie=Ur||Mm(n,l,ie,i,te,re,V)||e!==null&&e.dependencies!==null&&ji(e.dependencies))?(J||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(i,re,V),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(i,re,V)),typeof x.componentDidUpdate=="function"&&(n.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof x.componentDidUpdate!="function"||j===e.memoizedProps&&te===e.memoizedState||(n.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||j===e.memoizedProps&&te===e.memoizedState||(n.flags|=1024),n.memoizedProps=i,n.memoizedState=re),x.props=i,x.state=re,x.context=V,i=ie):(typeof x.componentDidUpdate!="function"||j===e.memoizedProps&&te===e.memoizedState||(n.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||j===e.memoizedProps&&te===e.memoizedState||(n.flags|=1024),i=!1)}return x=i,Hi(e,n),i=(n.flags&128)!==0,x||i?(x=n.stateNode,l=i&&typeof l.getDerivedStateFromError!="function"?null:x.render(),n.flags|=1,e!==null&&i?(n.child=Ra(n,e.child,null,f),n.child=Ra(n,null,l,f)):Zt(e,n,l,f),n.memoizedState=x.state,e=n.child):e=jr(e,n,f),e}function qm(e,n,l,i){return ka(),n.flags|=256,Zt(e,n,l,i),n.child}var hu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function xu(e){return{baseLanes:e,cachePool:Op()}}function gu(e,n,l){return e=e!==null?e.childLanes&~l:0,n&&(e|=kn),e}function Ym(e,n,l){var i=n.pendingProps,f=!1,x=(n.flags&128)!==0,j;if((j=x)||(j=e!==null&&e.memoizedState===null?!1:(Lt.current&2)!==0),j&&(f=!0,n.flags&=-129),j=(n.flags&32)!==0,n.flags&=-33,e===null){if(Qe){if(f?Vr(n):Pr(),(e=vt)?(e=nx(e,In),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:_r!==null?{id:ar,overflow:lr}:null,retryLane:536870912,hydrationErrors:null},l=Np(e),l.return=n,n.child=l,Xt=n,vt=null)):e=null,e===null)throw Br(n);return Ju(e)?n.lanes=32:n.lanes=536870912,null}var R=i.children;return i=i.fallback,f?(Pr(),f=n.mode,R=$i({mode:"hidden",children:R},f),i=Sa(i,f,l,null),R.return=n,i.return=n,R.sibling=i,n.child=R,i=n.child,i.memoizedState=xu(l),i.childLanes=gu(e,j,l),n.memoizedState=hu,ds(null,i)):(Vr(n),vu(n,R))}var V=e.memoizedState;if(V!==null&&(R=V.dehydrated,R!==null)){if(x)n.flags&256?(Vr(n),n.flags&=-257,n=yu(e,n,l)):n.memoizedState!==null?(Pr(),n.child=e.child,n.flags|=128,n=null):(Pr(),R=i.fallback,f=n.mode,i=$i({mode:"visible",children:i.children},f),R=Sa(R,f,l,null),R.flags|=2,i.return=n,R.return=n,i.sibling=R,n.child=i,Ra(n,e.child,null,l),i=n.child,i.memoizedState=xu(l),i.childLanes=gu(e,j,l),n.memoizedState=hu,n=ds(null,i));else if(Vr(n),Ju(R)){if(j=R.nextSibling&&R.nextSibling.dataset,j)var J=j.dgst;j=J,i=Error(o(419)),i.stack="",i.digest=j,Jl({value:i,source:null,stack:null}),n=yu(e,n,l)}else if(Ot||ol(e,n,l,!1),j=(l&e.childLanes)!==0,Ot||j){if(j=xt,j!==null&&(i=ma(j,l),i!==0&&i!==V.retryLane))throw V.retryLane=i,ja(e,i),hn(j,e,i),pu;Zu(R)||Xi(),n=yu(e,n,l)}else Zu(R)?(n.flags|=192,n.child=e.child,n=null):(e=V.treeContext,vt=Hn(R.nextSibling),Xt=n,Qe=!0,Or=null,In=!1,e!==null&&Ap(n,e),n=vu(n,i.children),n.flags|=4096);return n}return f?(Pr(),R=i.fallback,f=n.mode,V=e.child,J=V.sibling,i=hr(V,{mode:"hidden",children:i.children}),i.subtreeFlags=V.subtreeFlags&65011712,J!==null?R=hr(J,R):(R=Sa(R,f,l,null),R.flags|=2),R.return=n,i.return=n,i.sibling=R,n.child=i,ds(null,i),i=n.child,R=e.child.memoizedState,R===null?R=xu(l):(f=R.cachePool,f!==null?(V=Dt._currentValue,f=f.parent!==V?{parent:V,pool:V}:f):f=Op(),R={baseLanes:R.baseLanes|l,cachePool:f}),i.memoizedState=R,i.childLanes=gu(e,j,l),n.memoizedState=hu,ds(e.child,i)):(Vr(n),l=e.child,e=l.sibling,l=hr(l,{mode:"visible",children:i.children}),l.return=n,l.sibling=null,e!==null&&(j=n.deletions,j===null?(n.deletions=[e],n.flags|=16):j.push(e)),n.child=l,n.memoizedState=null,l)}function vu(e,n){return n=$i({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function $i(e,n){return e=yn(22,e,null,n),e.lanes=0,e}function yu(e,n,l){return Ra(n,e.child,null,l),e=vu(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Km(e,n,l){e.lanes|=n;var i=e.alternate;i!==null&&(i.lanes|=n),Dc(e.return,n,l)}function bu(e,n,l,i,f,x){var j=e.memoizedState;j===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:i,tail:l,tailMode:f,treeForkCount:x}:(j.isBackwards=n,j.rendering=null,j.renderingStartTime=0,j.last=i,j.tail=l,j.tailMode=f,j.treeForkCount=x)}function Xm(e,n,l){var i=n.pendingProps,f=i.revealOrder,x=i.tail;i=i.children;var j=Lt.current,R=(j&2)!==0;if(R?(j=j&1|2,n.flags|=128):j&=1,W(Lt,j),Zt(e,n,i,l),i=Qe?Zl:0,!R&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Km(e,l,n);else if(e.tag===19)Km(e,l,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(f){case"forwards":for(l=n.child,f=null;l!==null;)e=l.alternate,e!==null&&Ri(e)===null&&(f=l),l=l.sibling;l=f,l===null?(f=n.child,n.child=null):(f=l.sibling,l.sibling=null),bu(n,!1,f,l,x,i);break;case"backwards":case"unstable_legacy-backwards":for(l=null,f=n.child,n.child=null;f!==null;){if(e=f.alternate,e!==null&&Ri(e)===null){n.child=f;break}e=f.sibling,f.sibling=l,l=f,f=e}bu(n,!0,l,null,x,i);break;case"together":bu(n,!1,null,null,void 0,i);break;default:n.memoizedState=null}return n.child}function jr(e,n,l){if(e!==null&&(n.dependencies=e.dependencies),Wr|=n.lanes,(l&n.childLanes)===0)if(e!==null){if(ol(e,n,l,!1),(l&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(o(153));if(n.child!==null){for(e=n.child,l=hr(e,e.pendingProps),n.child=l,l.return=n;e.sibling!==null;)e=e.sibling,l=l.sibling=hr(e,e.pendingProps),l.return=n;l.sibling=null}return n.child}function ju(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&ji(e)))}function f1(e,n,l){switch(n.tag){case 3:ce(n,n.stateNode.containerInfo),Ir(n,Dt,e.memoizedState.cache),ka();break;case 27:case 5:Re(n);break;case 4:ce(n,n.stateNode.containerInfo);break;case 10:Ir(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Wc(n),null;break;case 13:var i=n.memoizedState;if(i!==null)return i.dehydrated!==null?(Vr(n),n.flags|=128,null):(l&n.child.childLanes)!==0?Ym(e,n,l):(Vr(n),e=jr(e,n,l),e!==null?e.sibling:null);Vr(n);break;case 19:var f=(e.flags&128)!==0;if(i=(l&n.childLanes)!==0,i||(ol(e,n,l,!1),i=(l&n.childLanes)!==0),f){if(i)return Xm(e,n,l);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),W(Lt,Lt.current),i)break;return null;case 22:return n.lanes=0,Vm(e,n,l,n.pendingProps);case 24:Ir(n,Dt,e.memoizedState.cache)}return jr(e,n,l)}function Qm(e,n,l){if(e!==null)if(e.memoizedProps!==n.pendingProps)Ot=!0;else{if(!ju(e,l)&&(n.flags&128)===0)return Ot=!1,f1(e,n,l);Ot=(e.flags&131072)!==0}else Ot=!1,Qe&&(n.flags&1048576)!==0&&Rp(n,Zl,n.index);switch(n.lanes=0,n.tag){case 16:e:{var i=n.pendingProps;if(e=Na(n.elementType),n.type=e,typeof e=="function")Ec(e)?(i=Ma(e,i),n.tag=1,n=Wm(null,n,e,i,l)):(n.tag=0,n=mu(null,n,e,i,l));else{if(e!=null){var f=e.$$typeof;if(f===_){n.tag=11,n=Um(null,n,e,i,l);break e}else if(f===C){n.tag=14,n=Hm(null,n,e,i,l);break e}}throw n=ee(e)||e,Error(o(306,n,""))}}return n;case 0:return mu(e,n,n.type,n.pendingProps,l);case 1:return i=n.type,f=Ma(i,n.pendingProps),Wm(e,n,i,f,l);case 3:e:{if(ce(n,n.stateNode.containerInfo),e===null)throw Error(o(387));i=n.pendingProps;var x=n.memoizedState;f=x.element,$c(e,n),ss(n,i,null,l);var j=n.memoizedState;if(i=j.cache,Ir(n,Dt,i),i!==x.cache&&_c(n,[Dt],l,!0),ls(),i=j.element,x.isDehydrated)if(x={element:i,isDehydrated:!1,cache:j.cache},n.updateQueue.baseState=x,n.memoizedState=x,n.flags&256){n=qm(e,n,i,l);break e}else if(i!==f){f=_n(Error(o(424)),n),Jl(f),n=qm(e,n,i,l);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(vt=Hn(e.firstChild),Xt=n,Qe=!0,Or=null,In=!0,l=Vp(n,null,i,l),n.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(ka(),i===f){n=jr(e,n,l);break e}Zt(e,n,i,l)}n=n.child}return n;case 26:return Hi(e,n),e===null?(l=ox(n.type,null,n.pendingProps,null))?n.memoizedState=l:Qe||(l=n.type,e=n.pendingProps,i=ro(de.current).createElement(l),i[Ht]=n,i[dt]=e,Jt(i,l,e),qt(i),n.stateNode=i):n.memoizedState=ox(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return Re(n),e===null&&Qe&&(i=n.stateNode=lx(n.type,n.pendingProps,de.current),Xt=n,In=!0,f=vt,Qr(n.type)?(ed=f,vt=Hn(i.firstChild)):vt=f),Zt(e,n,n.pendingProps.children,l),Hi(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Qe&&((f=i=vt)&&(i=V1(i,n.type,n.pendingProps,In),i!==null?(n.stateNode=i,Xt=n,vt=Hn(i.firstChild),In=!1,f=!0):f=!1),f||Br(n)),Re(n),f=n.type,x=n.pendingProps,j=e!==null?e.memoizedProps:null,i=x.children,Ku(f,x)?i=null:j!==null&&Ku(f,j)&&(n.flags|=32),n.memoizedState!==null&&(f=Yc(e,n,r1,null,null,l),Es._currentValue=f),Hi(e,n),Zt(e,n,i,l),n.child;case 6:return e===null&&Qe&&((e=l=vt)&&(l=P1(l,n.pendingProps,In),l!==null?(n.stateNode=l,Xt=n,vt=null,e=!0):e=!1),e||Br(n)),null;case 13:return Ym(e,n,l);case 4:return ce(n,n.stateNode.containerInfo),i=n.pendingProps,e===null?n.child=Ra(n,null,i,l):Zt(e,n,i,l),n.child;case 11:return Um(e,n,n.type,n.pendingProps,l);case 7:return Zt(e,n,n.pendingProps,l),n.child;case 8:return Zt(e,n,n.pendingProps.children,l),n.child;case 12:return Zt(e,n,n.pendingProps.children,l),n.child;case 10:return i=n.pendingProps,Ir(n,n.type,i.value),Zt(e,n,i.children,l),n.child;case 9:return f=n.type._context,i=n.pendingProps.children,Ca(n),f=Qt(f),i=i(f),n.flags|=1,Zt(e,n,i,l),n.child;case 14:return Hm(e,n,n.type,n.pendingProps,l);case 15:return $m(e,n,n.type,n.pendingProps,l);case 19:return Xm(e,n,l);case 31:return d1(e,n,l);case 22:return Vm(e,n,l,n.pendingProps);case 24:return Ca(n),i=Qt(Dt),e===null?(f=Ic(),f===null&&(f=xt,x=Oc(),f.pooledCache=x,x.refCount++,x!==null&&(f.pooledCacheLanes|=l),f=x),n.memoizedState={parent:i,cache:f},Hc(n),Ir(n,Dt,f)):((e.lanes&l)!==0&&($c(e,n),ss(n,null,null,l),ls()),f=e.memoizedState,x=n.memoizedState,f.parent!==i?(f={parent:i,cache:i},n.memoizedState=f,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=f),Ir(n,Dt,i)):(i=x.cache,Ir(n,Dt,i),i!==f.cache&&_c(n,[Dt],l,!0))),Zt(e,n,n.pendingProps.children,l),n.child;case 29:throw n.pendingProps}throw Error(o(156,n.tag))}function Sr(e){e.flags|=4}function Su(e,n,l,i,f){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(f&335544128)===f)if(e.stateNode.complete)e.flags|=8192;else if(wh())e.flags|=8192;else throw Ta=Ci,Uc}else e.flags&=-16777217}function Zm(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!px(n))if(wh())e.flags|=8192;else throw Ta=Ci,Uc}function Vi(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?qn():536870912,e.lanes|=n,bl|=n)}function fs(e,n){if(!Qe)switch(e.tailMode){case"hidden":n=e.tail;for(var l=null;n!==null;)n.alternate!==null&&(l=n),n=n.sibling;l===null?e.tail=null:l.sibling=null;break;case"collapsed":l=e.tail;for(var i=null;l!==null;)l.alternate!==null&&(i=l),l=l.sibling;i===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function yt(e){var n=e.alternate!==null&&e.alternate.child===e.child,l=0,i=0;if(n)for(var f=e.child;f!==null;)l|=f.lanes|f.childLanes,i|=f.subtreeFlags&65011712,i|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)l|=f.lanes|f.childLanes,i|=f.subtreeFlags,i|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=i,e.childLanes=l,n}function p1(e,n,l){var i=n.pendingProps;switch(Ac(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return yt(n),null;case 1:return yt(n),null;case 3:return l=n.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),n.memoizedState.cache!==i&&(n.flags|=2048),vr(Dt),je(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(il(n)?Sr(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Lc())),yt(n),null;case 26:var f=n.type,x=n.memoizedState;return e===null?(Sr(n),x!==null?(yt(n),Zm(n,x)):(yt(n),Su(n,f,null,i,l))):x?x!==e.memoizedState?(Sr(n),yt(n),Zm(n,x)):(yt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==i&&Sr(n),yt(n),Su(n,f,e,i,l)),null;case 27:if(Oe(n),l=de.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==i&&Sr(n);else{if(!i){if(n.stateNode===null)throw Error(o(166));return yt(n),null}e=Q.current,il(n)?Mp(n):(e=lx(f,i,l),n.stateNode=e,Sr(n))}return yt(n),null;case 5:if(Oe(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==i&&Sr(n);else{if(!i){if(n.stateNode===null)throw Error(o(166));return yt(n),null}if(x=Q.current,il(n))Mp(n);else{var j=ro(de.current);switch(x){case 1:x=j.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:x=j.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":x=j.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":x=j.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":x=j.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof i.is=="string"?j.createElement("select",{is:i.is}):j.createElement("select"),i.multiple?x.multiple=!0:i.size&&(x.size=i.size);break;default:x=typeof i.is=="string"?j.createElement(f,{is:i.is}):j.createElement(f)}}x[Ht]=n,x[dt]=i;e:for(j=n.child;j!==null;){if(j.tag===5||j.tag===6)x.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===n)break e;for(;j.sibling===null;){if(j.return===null||j.return===n)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}n.stateNode=x;e:switch(Jt(x,f,i),f){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&Sr(n)}}return yt(n),Su(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,l),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==i&&Sr(n);else{if(typeof i!="string"&&n.stateNode===null)throw Error(o(166));if(e=de.current,il(n)){if(e=n.stateNode,l=n.memoizedProps,i=null,f=Xt,f!==null)switch(f.tag){case 27:case 5:i=f.memoizedProps}e[Ht]=n,e=!!(e.nodeValue===l||i!==null&&i.suppressHydrationWarning===!0||Yh(e.nodeValue,l)),e||Br(n,!0)}else e=ro(e).createTextNode(i),e[Ht]=n,n.stateNode=e}return yt(n),null;case 31:if(l=n.memoizedState,e===null||e.memoizedState!==null){if(i=il(n),l!==null){if(e===null){if(!i)throw Error(o(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[Ht]=n}else ka(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;yt(n),e=!1}else l=Lc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return n.flags&256?(jn(n),n):(jn(n),null);if((n.flags&128)!==0)throw Error(o(558))}return yt(n),null;case 13:if(i=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=il(n),i!==null&&i.dehydrated!==null){if(e===null){if(!f)throw Error(o(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(o(317));f[Ht]=n}else ka(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;yt(n),f=!1}else f=Lc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(jn(n),n):(jn(n),null)}return jn(n),(n.flags&128)!==0?(n.lanes=l,n):(l=i!==null,e=e!==null&&e.memoizedState!==null,l&&(i=n.child,f=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(f=i.alternate.memoizedState.cachePool.pool),x=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(x=i.memoizedState.cachePool.pool),x!==f&&(i.flags|=2048)),l!==e&&l&&(n.child.flags|=8192),Vi(n,n.updateQueue),yt(n),null);case 4:return je(),e===null&&Fu(n.stateNode.containerInfo),yt(n),null;case 10:return vr(n.type),yt(n),null;case 19:if(Y(Lt),i=n.memoizedState,i===null)return yt(n),null;if(f=(n.flags&128)!==0,x=i.rendering,x===null)if(f)fs(i,!1);else{if(Mt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(x=Ri(e),x!==null){for(n.flags|=128,fs(i,!1),e=x.updateQueue,n.updateQueue=e,Vi(n,e),n.subtreeFlags=0,e=l,l=n.child;l!==null;)Ep(l,e),l=l.sibling;return W(Lt,Lt.current&1|2),Qe&&xr(n,i.treeForkCount),n.child}e=e.sibling}i.tail!==null&&We()>qi&&(n.flags|=128,f=!0,fs(i,!1),n.lanes=4194304)}else{if(!f)if(e=Ri(x),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,Vi(n,e),fs(i,!0),i.tail===null&&i.tailMode==="hidden"&&!x.alternate&&!Qe)return yt(n),null}else 2*We()-i.renderingStartTime>qi&&l!==536870912&&(n.flags|=128,f=!0,fs(i,!1),n.lanes=4194304);i.isBackwards?(x.sibling=n.child,n.child=x):(e=i.last,e!==null?e.sibling=x:n.child=x,i.last=x)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=We(),e.sibling=null,l=Lt.current,W(Lt,f?l&1|2:l&1),Qe&&xr(n,i.treeForkCount),e):(yt(n),null);case 22:case 23:return jn(n),Gc(),i=n.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(n.flags|=8192):i&&(n.flags|=8192),i?(l&536870912)!==0&&(n.flags&128)===0&&(yt(n),n.subtreeFlags&6&&(n.flags|=8192)):yt(n),l=n.updateQueue,l!==null&&Vi(n,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),i=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),i!==l&&(n.flags|=2048),e!==null&&Y(Ea),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),vr(Dt),yt(n),null;case 25:return null;case 30:return null}throw Error(o(156,n.tag))}function m1(e,n){switch(Ac(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return vr(Dt),je(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return Oe(n),null;case 31:if(n.memoizedState!==null){if(jn(n),n.alternate===null)throw Error(o(340));ka()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(jn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(o(340));ka()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return Y(Lt),null;case 4:return je(),null;case 10:return vr(n.type),null;case 22:case 23:return jn(n),Gc(),e!==null&&Y(Ea),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return vr(Dt),null;case 25:return null;default:return null}}function Jm(e,n){switch(Ac(n),n.tag){case 3:vr(Dt),je();break;case 26:case 27:case 5:Oe(n);break;case 4:je();break;case 31:n.memoizedState!==null&&jn(n);break;case 13:jn(n);break;case 19:Y(Lt);break;case 10:vr(n.type);break;case 22:case 23:jn(n),Gc(),e!==null&&Y(Ea);break;case 24:vr(Dt)}}function ps(e,n){try{var l=n.updateQueue,i=l!==null?l.lastEffect:null;if(i!==null){var f=i.next;l=f;do{if((l.tag&e)===e){i=void 0;var x=l.create,j=l.inst;i=x(),j.destroy=i}l=l.next}while(l!==f)}}catch(R){it(n,n.return,R)}}function Fr(e,n,l){try{var i=n.updateQueue,f=i!==null?i.lastEffect:null;if(f!==null){var x=f.next;i=x;do{if((i.tag&e)===e){var j=i.inst,R=j.destroy;if(R!==void 0){j.destroy=void 0,f=n;var V=l,J=R;try{J()}catch(ie){it(f,V,ie)}}}i=i.next}while(i!==x)}}catch(ie){it(n,n.return,ie)}}function eh(e){var n=e.updateQueue;if(n!==null){var l=e.stateNode;try{Fp(n,l)}catch(i){it(e,e.return,i)}}}function th(e,n,l){l.props=Ma(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(i){it(e,n,i)}}function ms(e,n){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof l=="function"?e.refCleanup=l(i):l.current=i}}catch(f){it(e,n,f)}}function sr(e,n){var l=e.ref,i=e.refCleanup;if(l!==null)if(typeof i=="function")try{i()}catch(f){it(e,n,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(f){it(e,n,f)}else l.current=null}function nh(e){var n=e.type,l=e.memoizedProps,i=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":l.autoFocus&&i.focus();break e;case"img":l.src?i.src=l.src:l.srcSet&&(i.srcset=l.srcSet)}}catch(f){it(e,e.return,f)}}function ku(e,n,l){try{var i=e.stateNode;O1(i,e.type,l,n),i[dt]=n}catch(f){it(e,e.return,f)}}function rh(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Qr(e.type)||e.tag===4}function wu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||rh(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&&Qr(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 Cu(e,n,l){var i=e.tag;if(i===5||i===6)e=e.stateNode,n?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,n):(n=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,n.appendChild(e),l=l._reactRootContainer,l!=null||n.onclick!==null||(n.onclick=pr));else if(i!==4&&(i===27&&Qr(e.type)&&(l=e.stateNode,n=null),e=e.child,e!==null))for(Cu(e,n,l),e=e.sibling;e!==null;)Cu(e,n,l),e=e.sibling}function Pi(e,n,l){var i=e.tag;if(i===5||i===6)e=e.stateNode,n?l.insertBefore(e,n):l.appendChild(e);else if(i!==4&&(i===27&&Qr(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(Pi(e,n,l),e=e.sibling;e!==null;)Pi(e,n,l),e=e.sibling}function ah(e){var n=e.stateNode,l=e.memoizedProps;try{for(var i=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);Jt(n,i,l),n[Ht]=e,n[dt]=l}catch(x){it(e,e.return,x)}}var kr=!1,Bt=!1,Eu=!1,lh=typeof WeakSet=="function"?WeakSet:Set,Yt=null;function h1(e,n){if(e=e.containerInfo,qu=uo,e=gp(e),yc(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var i=l.getSelection&&l.getSelection();if(i&&i.rangeCount!==0){l=i.anchorNode;var f=i.anchorOffset,x=i.focusNode;i=i.focusOffset;try{l.nodeType,x.nodeType}catch{l=null;break e}var j=0,R=-1,V=-1,J=0,ie=0,fe=e,te=null;t:for(;;){for(var re;fe!==l||f!==0&&fe.nodeType!==3||(R=j+f),fe!==x||i!==0&&fe.nodeType!==3||(V=j+i),fe.nodeType===3&&(j+=fe.nodeValue.length),(re=fe.firstChild)!==null;)te=fe,fe=re;for(;;){if(fe===e)break t;if(te===l&&++J===f&&(R=j),te===x&&++ie===i&&(V=j),(re=fe.nextSibling)!==null)break;fe=te,te=fe.parentNode}fe=re}l=R===-1||V===-1?null:{start:R,end:V}}else l=null}l=l||{start:0,end:0}}else l=null;for(Yu={focusedElem:e,selectionRange:l},uo=!1,Yt=n;Yt!==null;)if(n=Yt,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Yt=e;else for(;Yt!==null;){switch(n=Yt,x=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(l=0;l<e.length;l++)f=e[l],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&x!==null){e=void 0,l=n,f=x.memoizedProps,x=x.memoizedState,i=l.stateNode;try{var Ce=Ma(l.type,f);e=i.getSnapshotBeforeUpdate(Ce,x),i.__reactInternalSnapshotBeforeUpdate=e}catch(ze){it(l,l.return,ze)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,l=e.nodeType,l===9)Qu(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Qu(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=n.sibling,e!==null){e.return=n.return,Yt=e;break}Yt=n.return}}function sh(e,n,l){var i=l.flags;switch(l.tag){case 0:case 11:case 15:Cr(e,l),i&4&&ps(5,l);break;case 1:if(Cr(e,l),i&4)if(e=l.stateNode,n===null)try{e.componentDidMount()}catch(j){it(l,l.return,j)}else{var f=Ma(l.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(j){it(l,l.return,j)}}i&64&&eh(l),i&512&&ms(l,l.return);break;case 3:if(Cr(e,l),i&64&&(e=l.updateQueue,e!==null)){if(n=null,l.child!==null)switch(l.child.tag){case 27:case 5:n=l.child.stateNode;break;case 1:n=l.child.stateNode}try{Fp(e,n)}catch(j){it(l,l.return,j)}}break;case 27:n===null&&i&4&&ah(l);case 26:case 5:Cr(e,l),n===null&&i&4&&nh(l),i&512&&ms(l,l.return);break;case 12:Cr(e,l);break;case 31:Cr(e,l),i&4&&ch(e,l);break;case 13:Cr(e,l),i&4&&uh(e,l),i&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=w1.bind(null,l),F1(e,l))));break;case 22:if(i=l.memoizedState!==null||kr,!i){n=n!==null&&n.memoizedState!==null||Bt,f=kr;var x=Bt;kr=i,(Bt=n)&&!x?Er(e,l,(l.subtreeFlags&8772)!==0):Cr(e,l),kr=f,Bt=x}break;case 30:break;default:Cr(e,l)}}function ih(e){var n=e.alternate;n!==null&&(e.alternate=null,ih(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&nc(n)),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 St=null,dn=!1;function wr(e,n,l){for(l=l.child;l!==null;)oh(e,n,l),l=l.sibling}function oh(e,n,l){if(Ut&&typeof Ut.onCommitFiberUnmount=="function")try{Ut.onCommitFiberUnmount(Mn,l)}catch{}switch(l.tag){case 26:Bt||sr(l,n),wr(e,n,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Bt||sr(l,n);var i=St,f=dn;Qr(l.type)&&(St=l.stateNode,dn=!1),wr(e,n,l),ks(l.stateNode),St=i,dn=f;break;case 5:Bt||sr(l,n);case 6:if(i=St,f=dn,St=null,wr(e,n,l),St=i,dn=f,St!==null)if(dn)try{(St.nodeType===9?St.body:St.nodeName==="HTML"?St.ownerDocument.body:St).removeChild(l.stateNode)}catch(x){it(l,n,x)}else try{St.removeChild(l.stateNode)}catch(x){it(l,n,x)}break;case 18:St!==null&&(dn?(e=St,ex(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),Tl(e)):ex(St,l.stateNode));break;case 4:i=St,f=dn,St=l.stateNode.containerInfo,dn=!0,wr(e,n,l),St=i,dn=f;break;case 0:case 11:case 14:case 15:Fr(2,l,n),Bt||Fr(4,l,n),wr(e,n,l);break;case 1:Bt||(sr(l,n),i=l.stateNode,typeof i.componentWillUnmount=="function"&&th(l,n,i)),wr(e,n,l);break;case 21:wr(e,n,l);break;case 22:Bt=(i=Bt)||l.memoizedState!==null,wr(e,n,l),Bt=i;break;default:wr(e,n,l)}}function ch(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Tl(e)}catch(l){it(n,n.return,l)}}}function uh(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Tl(e)}catch(l){it(n,n.return,l)}}function x1(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new lh),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new lh),n;default:throw Error(o(435,e.tag))}}function Fi(e,n){var l=x1(e);n.forEach(function(i){if(!l.has(i)){l.add(i);var f=C1.bind(null,e,i);i.then(f,f)}})}function fn(e,n){var l=n.deletions;if(l!==null)for(var i=0;i<l.length;i++){var f=l[i],x=e,j=n,R=j;e:for(;R!==null;){switch(R.tag){case 27:if(Qr(R.type)){St=R.stateNode,dn=!1;break e}break;case 5:St=R.stateNode,dn=!1;break e;case 3:case 4:St=R.stateNode.containerInfo,dn=!0;break e}R=R.return}if(St===null)throw Error(o(160));oh(x,j,f),St=null,dn=!1,x=f.alternate,x!==null&&(x.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)dh(n,e),n=n.sibling}var Kn=null;function dh(e,n){var l=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:fn(n,e),pn(e),i&4&&(Fr(3,e,e.return),ps(3,e),Fr(5,e,e.return));break;case 1:fn(n,e),pn(e),i&512&&(Bt||l===null||sr(l,l.return)),i&64&&kr&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?i:l.concat(i))));break;case 26:var f=Kn;if(fn(n,e),pn(e),i&512&&(Bt||l===null||sr(l,l.return)),i&4){var x=l!==null?l.memoizedState:null;if(i=e.memoizedState,l===null)if(i===null)if(e.stateNode===null){e:{i=e.type,l=e.memoizedProps,f=f.ownerDocument||f;t:switch(i){case"title":x=f.getElementsByTagName("title")[0],(!x||x[$l]||x[Ht]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=f.createElement(i),f.head.insertBefore(x,f.querySelector("head > title"))),Jt(x,i,l),x[Ht]=e,qt(x),i=x;break e;case"link":var j=dx("link","href",f).get(i+(l.href||""));if(j){for(var R=0;R<j.length;R++)if(x=j[R],x.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&x.getAttribute("rel")===(l.rel==null?null:l.rel)&&x.getAttribute("title")===(l.title==null?null:l.title)&&x.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){j.splice(R,1);break t}}x=f.createElement(i),Jt(x,i,l),f.head.appendChild(x);break;case"meta":if(j=dx("meta","content",f).get(i+(l.content||""))){for(R=0;R<j.length;R++)if(x=j[R],x.getAttribute("content")===(l.content==null?null:""+l.content)&&x.getAttribute("name")===(l.name==null?null:l.name)&&x.getAttribute("property")===(l.property==null?null:l.property)&&x.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&x.getAttribute("charset")===(l.charSet==null?null:l.charSet)){j.splice(R,1);break t}}x=f.createElement(i),Jt(x,i,l),f.head.appendChild(x);break;default:throw Error(o(468,i))}x[Ht]=e,qt(x),i=x}e.stateNode=i}else fx(f,e.type,e.stateNode);else e.stateNode=ux(f,i,e.memoizedProps);else x!==i?(x===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):x.count--,i===null?fx(f,e.type,e.stateNode):ux(f,i,e.memoizedProps)):i===null&&e.stateNode!==null&&ku(e,e.memoizedProps,l.memoizedProps)}break;case 27:fn(n,e),pn(e),i&512&&(Bt||l===null||sr(l,l.return)),l!==null&&i&4&&ku(e,e.memoizedProps,l.memoizedProps);break;case 5:if(fn(n,e),pn(e),i&512&&(Bt||l===null||sr(l,l.return)),e.flags&32){f=e.stateNode;try{Qa(f,"")}catch(Ce){it(e,e.return,Ce)}}i&4&&e.stateNode!=null&&(f=e.memoizedProps,ku(e,f,l!==null?l.memoizedProps:f)),i&1024&&(Eu=!0);break;case 6:if(fn(n,e),pn(e),i&4){if(e.stateNode===null)throw Error(o(162));i=e.memoizedProps,l=e.stateNode;try{l.nodeValue=i}catch(Ce){it(e,e.return,Ce)}}break;case 3:if(so=null,f=Kn,Kn=ao(n.containerInfo),fn(n,e),Kn=f,pn(e),i&4&&l!==null&&l.memoizedState.isDehydrated)try{Tl(n.containerInfo)}catch(Ce){it(e,e.return,Ce)}Eu&&(Eu=!1,fh(e));break;case 4:i=Kn,Kn=ao(e.stateNode.containerInfo),fn(n,e),pn(e),Kn=i;break;case 12:fn(n,e),pn(e);break;case 31:fn(n,e),pn(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Fi(e,i)));break;case 13:fn(n,e),pn(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Wi=We()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Fi(e,i)));break;case 22:f=e.memoizedState!==null;var V=l!==null&&l.memoizedState!==null,J=kr,ie=Bt;if(kr=J||f,Bt=ie||V,fn(n,e),Bt=ie,kr=J,pn(e),i&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(l===null||V||kr||Bt||La(e)),l=null,n=e;;){if(n.tag===5||n.tag===26){if(l===null){V=l=n;try{if(x=V.stateNode,f)j=x.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{R=V.stateNode;var fe=V.memoizedProps.style,te=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;R.style.display=te==null||typeof te=="boolean"?"":(""+te).trim()}}catch(Ce){it(V,V.return,Ce)}}}else if(n.tag===6){if(l===null){V=n;try{V.stateNode.nodeValue=f?"":V.memoizedProps}catch(Ce){it(V,V.return,Ce)}}}else if(n.tag===18){if(l===null){V=n;try{var re=V.stateNode;f?tx(re,!0):tx(V.stateNode,!1)}catch(Ce){it(V,V.return,Ce)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;l===n&&(l=null),n=n.return}l===n&&(l=null),n.sibling.return=n.return,n=n.sibling}i&4&&(i=e.updateQueue,i!==null&&(l=i.retryQueue,l!==null&&(i.retryQueue=null,Fi(e,l))));break;case 19:fn(n,e),pn(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Fi(e,i)));break;case 30:break;case 21:break;default:fn(n,e),pn(e)}}function pn(e){var n=e.flags;if(n&2){try{for(var l,i=e.return;i!==null;){if(rh(i)){l=i;break}i=i.return}if(l==null)throw Error(o(160));switch(l.tag){case 27:var f=l.stateNode,x=wu(e);Pi(e,x,f);break;case 5:var j=l.stateNode;l.flags&32&&(Qa(j,""),l.flags&=-33);var R=wu(e);Pi(e,R,j);break;case 3:case 4:var V=l.stateNode.containerInfo,J=wu(e);Cu(e,J,V);break;default:throw Error(o(161))}}catch(ie){it(e,e.return,ie)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function fh(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;fh(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Cr(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)sh(e,n.alternate,n),n=n.sibling}function La(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Fr(4,n,n.return),La(n);break;case 1:sr(n,n.return);var l=n.stateNode;typeof l.componentWillUnmount=="function"&&th(n,n.return,l),La(n);break;case 27:ks(n.stateNode);case 26:case 5:sr(n,n.return),La(n);break;case 22:n.memoizedState===null&&La(n);break;case 30:La(n);break;default:La(n)}e=e.sibling}}function Er(e,n,l){for(l=l&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var i=n.alternate,f=e,x=n,j=x.flags;switch(x.tag){case 0:case 11:case 15:Er(f,x,l),ps(4,x);break;case 1:if(Er(f,x,l),i=x,f=i.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(J){it(i,i.return,J)}if(i=x,f=i.updateQueue,f!==null){var R=i.stateNode;try{var V=f.shared.hiddenCallbacks;if(V!==null)for(f.shared.hiddenCallbacks=null,f=0;f<V.length;f++)Pp(V[f],R)}catch(J){it(i,i.return,J)}}l&&j&64&&eh(x),ms(x,x.return);break;case 27:ah(x);case 26:case 5:Er(f,x,l),l&&i===null&&j&4&&nh(x),ms(x,x.return);break;case 12:Er(f,x,l);break;case 31:Er(f,x,l),l&&j&4&&ch(f,x);break;case 13:Er(f,x,l),l&&j&4&&uh(f,x);break;case 22:x.memoizedState===null&&Er(f,x,l),ms(x,x.return);break;case 30:break;default:Er(f,x,l)}n=n.sibling}}function Nu(e,n){var l=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==l&&(e!=null&&e.refCount++,l!=null&&es(l))}function Tu(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&es(e))}function Xn(e,n,l,i){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)ph(e,n,l,i),n=n.sibling}function ph(e,n,l,i){var f=n.flags;switch(n.tag){case 0:case 11:case 15:Xn(e,n,l,i),f&2048&&ps(9,n);break;case 1:Xn(e,n,l,i);break;case 3:Xn(e,n,l,i),f&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&es(e)));break;case 12:if(f&2048){Xn(e,n,l,i),e=n.stateNode;try{var x=n.memoizedProps,j=x.id,R=x.onPostCommit;typeof R=="function"&&R(j,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(V){it(n,n.return,V)}}else Xn(e,n,l,i);break;case 31:Xn(e,n,l,i);break;case 13:Xn(e,n,l,i);break;case 23:break;case 22:x=n.stateNode,j=n.alternate,n.memoizedState!==null?x._visibility&2?Xn(e,n,l,i):hs(e,n):x._visibility&2?Xn(e,n,l,i):(x._visibility|=2,gl(e,n,l,i,(n.subtreeFlags&10256)!==0||!1)),f&2048&&Nu(j,n);break;case 24:Xn(e,n,l,i),f&2048&&Tu(n.alternate,n);break;default:Xn(e,n,l,i)}}function gl(e,n,l,i,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var x=e,j=n,R=l,V=i,J=j.flags;switch(j.tag){case 0:case 11:case 15:gl(x,j,R,V,f),ps(8,j);break;case 23:break;case 22:var ie=j.stateNode;j.memoizedState!==null?ie._visibility&2?gl(x,j,R,V,f):hs(x,j):(ie._visibility|=2,gl(x,j,R,V,f)),f&&J&2048&&Nu(j.alternate,j);break;case 24:gl(x,j,R,V,f),f&&J&2048&&Tu(j.alternate,j);break;default:gl(x,j,R,V,f)}n=n.sibling}}function hs(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var l=e,i=n,f=i.flags;switch(i.tag){case 22:hs(l,i),f&2048&&Nu(i.alternate,i);break;case 24:hs(l,i),f&2048&&Tu(i.alternate,i);break;default:hs(l,i)}n=n.sibling}}var xs=8192;function vl(e,n,l){if(e.subtreeFlags&xs)for(e=e.child;e!==null;)mh(e,n,l),e=e.sibling}function mh(e,n,l){switch(e.tag){case 26:vl(e,n,l),e.flags&xs&&e.memoizedState!==null&&n0(l,Kn,e.memoizedState,e.memoizedProps);break;case 5:vl(e,n,l);break;case 3:case 4:var i=Kn;Kn=ao(e.stateNode.containerInfo),vl(e,n,l),Kn=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=xs,xs=16777216,vl(e,n,l),xs=i):vl(e,n,l));break;default:vl(e,n,l)}}function hh(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function gs(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var l=0;l<n.length;l++){var i=n[l];Yt=i,gh(i,e)}hh(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)xh(e),e=e.sibling}function xh(e){switch(e.tag){case 0:case 11:case 15:gs(e),e.flags&2048&&Fr(9,e,e.return);break;case 3:gs(e);break;case 12:gs(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Gi(e)):gs(e);break;default:gs(e)}}function Gi(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var l=0;l<n.length;l++){var i=n[l];Yt=i,gh(i,e)}hh(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Fr(8,n,n.return),Gi(n);break;case 22:l=n.stateNode,l._visibility&2&&(l._visibility&=-3,Gi(n));break;default:Gi(n)}e=e.sibling}}function gh(e,n){for(;Yt!==null;){var l=Yt;switch(l.tag){case 0:case 11:case 15:Fr(8,l,n);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var i=l.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:es(l.memoizedState.cache)}if(i=l.child,i!==null)i.return=l,Yt=i;else e:for(l=e;Yt!==null;){i=Yt;var f=i.sibling,x=i.return;if(ih(i),i===l){Yt=null;break e}if(f!==null){f.return=x,Yt=f;break e}Yt=x}}}var g1={getCacheForType:function(e){var n=Qt(Dt),l=n.data.get(e);return l===void 0&&(l=e(),n.data.set(e,l)),l},cacheSignal:function(){return Qt(Dt).controller.signal}},v1=typeof WeakMap=="function"?WeakMap:Map,rt=0,xt=null,qe=null,Ke=0,st=0,Sn=null,Gr=!1,yl=!1,Ru=!1,Nr=0,Mt=0,Wr=0,za=0,Au=0,kn=0,bl=0,vs=null,mn=null,Mu=!1,Wi=0,vh=0,qi=1/0,Yi=null,qr=null,$t=0,Yr=null,jl=null,Tr=0,Lu=0,zu=null,yh=null,ys=0,Du=null;function wn(){return(rt&2)!==0&&Ke!==0?Ke&-Ke:z.T!==null?Hu():ut()}function bh(){if(kn===0)if((Ke&536870912)===0||Qe){var e=Nt;Nt<<=1,(Nt&3932160)===0&&(Nt=262144),kn=e}else kn=536870912;return e=bn.current,e!==null&&(e.flags|=32),kn}function hn(e,n,l){(e===xt&&(st===2||st===9)||e.cancelPendingCommit!==null)&&(Sl(e,0),Kr(e,Ke,kn,!1)),fa(e,l),((rt&2)===0||e!==xt)&&(e===xt&&((rt&2)===0&&(za|=l),Mt===4&&Kr(e,Ke,kn,!1)),ir(e))}function jh(e,n,l){if((rt&6)!==0)throw Error(o(327));var i=!l&&(n&127)===0&&(n&e.expiredLanes)===0||Me(e,n),f=i?j1(e,n):Ou(e,n,!0),x=i;do{if(f===0){yl&&!i&&Kr(e,n,0,!1);break}else{if(l=e.current.alternate,x&&!y1(l)){f=Ou(e,n,!1),x=!1;continue}if(f===2){if(x=n,e.errorRecoveryDisabledLanes&x)var j=0;else j=e.pendingLanes&-536870913,j=j!==0?j:j&536870912?536870912:0;if(j!==0){n=j;e:{var R=e;f=vs;var V=R.current.memoizedState.isDehydrated;if(V&&(Sl(R,j).flags|=256),j=Ou(R,j,!1),j!==2){if(Ru&&!V){R.errorRecoveryDisabledLanes|=x,za|=x,f=4;break e}x=mn,mn=f,x!==null&&(mn===null?mn=x:mn.push.apply(mn,x))}f=j}if(x=!1,f!==2)continue}}if(f===1){Sl(e,0),Kr(e,n,0,!0);break}e:{switch(i=e,x=f,x){case 0:case 1:throw Error(o(345));case 4:if((n&4194048)!==n)break;case 6:Kr(i,n,kn,!Gr);break e;case 2:mn=null;break;case 3:case 5:break;default:throw Error(o(329))}if((n&62914560)===n&&(f=Wi+300-We(),10<f)){if(Kr(i,n,kn,!Gr),Se(i,0,!0)!==0)break e;Tr=n,i.timeoutHandle=Zh(Sh.bind(null,i,l,mn,Yi,Mu,n,kn,za,bl,Gr,x,"Throttled",-0,0),f);break e}Sh(i,l,mn,Yi,Mu,n,kn,za,bl,Gr,x,null,-0,0)}}break}while(!0);ir(e)}function Sh(e,n,l,i,f,x,j,R,V,J,ie,fe,te,re){if(e.timeoutHandle=-1,fe=n.subtreeFlags,fe&8192||(fe&16785408)===16785408){fe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:pr},mh(n,x,fe);var Ce=(x&62914560)===x?Wi-We():(x&4194048)===x?vh-We():0;if(Ce=r0(fe,Ce),Ce!==null){Tr=x,e.cancelPendingCommit=Ce(Ah.bind(null,e,n,x,l,i,f,j,R,V,ie,fe,null,te,re)),Kr(e,x,j,!J);return}}Ah(e,n,x,l,i,f,j,R,V)}function y1(e){for(var n=e;;){var l=n.tag;if((l===0||l===11||l===15)&&n.flags&16384&&(l=n.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var i=0;i<l.length;i++){var f=l[i],x=f.getSnapshot;f=f.value;try{if(!vn(x(),f))return!1}catch{return!1}}if(l=n.child,n.subtreeFlags&16384&&l!==null)l.return=n,n=l;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Kr(e,n,l,i){n&=~Au,n&=~za,e.suspendedLanes|=n,e.pingedLanes&=~n,i&&(e.warmLanes|=n),i=e.expirationTimes;for(var f=n;0<f;){var x=31-ct(f),j=1<<x;i[x]=-1,f&=~j}l!==0&&nr(e,l,n)}function Ki(){return(rt&6)===0?(bs(0),!1):!0}function _u(){if(qe!==null){if(st===0)var e=qe.return;else e=qe,gr=wa=null,Qc(e),fl=null,ns=0,e=qe;for(;e!==null;)Jm(e.alternate,e),e=e.return;qe=null}}function Sl(e,n){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,U1(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),Tr=0,_u(),xt=e,qe=l=hr(e.current,null),Ke=n,st=0,Sn=null,Gr=!1,yl=Me(e,n),Ru=!1,bl=kn=Au=za=Wr=Mt=0,mn=vs=null,Mu=!1,(n&8)!==0&&(n|=n&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=n;0<i;){var f=31-ct(i),x=1<<f;n|=e[f],i&=~x}return Nr=n,xi(),l}function kh(e,n){Ve=null,z.H=us,n===dl||n===wi?(n=Up(),st=3):n===Uc?(n=Up(),st=4):st=n===pu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Sn=n,qe===null&&(Mt=1,Ii(e,_n(n,e.current)))}function wh(){var e=bn.current;return e===null?!0:(Ke&4194048)===Ke?Un===null:(Ke&62914560)===Ke||(Ke&536870912)!==0?e===Un:!1}function Ch(){var e=z.H;return z.H=us,e===null?us:e}function Eh(){var e=z.A;return z.A=g1,e}function Xi(){Mt=4,Gr||(Ke&4194048)!==Ke&&bn.current!==null||(yl=!0),(Wr&134217727)===0&&(za&134217727)===0||xt===null||Kr(xt,Ke,kn,!1)}function Ou(e,n,l){var i=rt;rt|=2;var f=Ch(),x=Eh();(xt!==e||Ke!==n)&&(Yi=null,Sl(e,n)),n=!1;var j=Mt;e:do try{if(st!==0&&qe!==null){var R=qe,V=Sn;switch(st){case 8:_u(),j=6;break e;case 3:case 2:case 9:case 6:bn.current===null&&(n=!0);var J=st;if(st=0,Sn=null,kl(e,R,V,J),l&&yl){j=0;break e}break;default:J=st,st=0,Sn=null,kl(e,R,V,J)}}b1(),j=Mt;break}catch(ie){kh(e,ie)}while(!0);return n&&e.shellSuspendCounter++,gr=wa=null,rt=i,z.H=f,z.A=x,qe===null&&(xt=null,Ke=0,xi()),j}function b1(){for(;qe!==null;)Nh(qe)}function j1(e,n){var l=rt;rt|=2;var i=Ch(),f=Eh();xt!==e||Ke!==n?(Yi=null,qi=We()+500,Sl(e,n)):yl=Me(e,n);e:do try{if(st!==0&&qe!==null){n=qe;var x=Sn;t:switch(st){case 1:st=0,Sn=null,kl(e,n,x,1);break;case 2:case 9:if(Bp(x)){st=0,Sn=null,Th(n);break}n=function(){st!==2&&st!==9||xt!==e||(st=7),ir(e)},x.then(n,n);break e;case 3:st=7;break e;case 4:st=5;break e;case 7:Bp(x)?(st=0,Sn=null,Th(n)):(st=0,Sn=null,kl(e,n,x,7));break;case 5:var j=null;switch(qe.tag){case 26:j=qe.memoizedState;case 5:case 27:var R=qe;if(j?px(j):R.stateNode.complete){st=0,Sn=null;var V=R.sibling;if(V!==null)qe=V;else{var J=R.return;J!==null?(qe=J,Qi(J)):qe=null}break t}}st=0,Sn=null,kl(e,n,x,5);break;case 6:st=0,Sn=null,kl(e,n,x,6);break;case 8:_u(),Mt=6;break e;default:throw Error(o(462))}}S1();break}catch(ie){kh(e,ie)}while(!0);return gr=wa=null,z.H=i,z.A=f,rt=l,qe!==null?0:(xt=null,Ke=0,xi(),Mt)}function S1(){for(;qe!==null&&!Tt();)Nh(qe)}function Nh(e){var n=Qm(e.alternate,e,Nr);e.memoizedProps=e.pendingProps,n===null?Qi(e):qe=n}function Th(e){var n=e,l=n.alternate;switch(n.tag){case 15:case 0:n=Gm(l,n,n.pendingProps,n.type,void 0,Ke);break;case 11:n=Gm(l,n,n.pendingProps,n.type.render,n.ref,Ke);break;case 5:Qc(n);default:Jm(l,n),n=qe=Ep(n,Nr),n=Qm(l,n,Nr)}e.memoizedProps=e.pendingProps,n===null?Qi(e):qe=n}function kl(e,n,l,i){gr=wa=null,Qc(n),fl=null,ns=0;var f=n.return;try{if(u1(e,f,n,l,Ke)){Mt=1,Ii(e,_n(l,e.current)),qe=null;return}}catch(x){if(f!==null)throw qe=f,x;Mt=1,Ii(e,_n(l,e.current)),qe=null;return}n.flags&32768?(Qe||i===1?e=!0:yl||(Ke&536870912)!==0?e=!1:(Gr=e=!0,(i===2||i===9||i===3||i===6)&&(i=bn.current,i!==null&&i.tag===13&&(i.flags|=16384))),Rh(n,e)):Qi(n)}function Qi(e){var n=e;do{if((n.flags&32768)!==0){Rh(n,Gr);return}e=n.return;var l=p1(n.alternate,n,Nr);if(l!==null){qe=l;return}if(n=n.sibling,n!==null){qe=n;return}qe=n=e}while(n!==null);Mt===0&&(Mt=5)}function Rh(e,n){do{var l=m1(e.alternate,e);if(l!==null){l.flags&=32767,qe=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!n&&(e=e.sibling,e!==null)){qe=e;return}qe=e=l}while(e!==null);Mt=6,qe=null}function Ah(e,n,l,i,f,x,j,R,V){e.cancelPendingCommit=null;do Zi();while($t!==0);if((rt&6)!==0)throw Error(o(327));if(n!==null){if(n===e.current)throw Error(o(177));if(x=n.lanes|n.childLanes,x|=wc,Hl(e,l,x,j,R,V),e===xt&&(qe=xt=null,Ke=0),jl=n,Yr=e,Tr=l,Lu=x,zu=f,yh=i,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,E1(ot,function(){return _h(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||i){i=z.T,z.T=null,f=O.p,O.p=2,j=rt,rt|=4;try{h1(e,n,l)}finally{rt=j,O.p=f,z.T=i}}$t=1,Mh(),Lh(),zh()}}function Mh(){if($t===1){$t=0;var e=Yr,n=jl,l=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||l){l=z.T,z.T=null;var i=O.p;O.p=2;var f=rt;rt|=4;try{dh(n,e);var x=Yu,j=gp(e.containerInfo),R=x.focusedElem,V=x.selectionRange;if(j!==R&&R&&R.ownerDocument&&xp(R.ownerDocument.documentElement,R)){if(V!==null&&yc(R)){var J=V.start,ie=V.end;if(ie===void 0&&(ie=J),"selectionStart"in R)R.selectionStart=J,R.selectionEnd=Math.min(ie,R.value.length);else{var fe=R.ownerDocument||document,te=fe&&fe.defaultView||window;if(te.getSelection){var re=te.getSelection(),Ce=R.textContent.length,ze=Math.min(V.start,Ce),mt=V.end===void 0?ze:Math.min(V.end,Ce);!re.extend&&ze>mt&&(j=mt,mt=ze,ze=j);var K=hp(R,ze),G=hp(R,mt);if(K&&G&&(re.rangeCount!==1||re.anchorNode!==K.node||re.anchorOffset!==K.offset||re.focusNode!==G.node||re.focusOffset!==G.offset)){var Z=fe.createRange();Z.setStart(K.node,K.offset),re.removeAllRanges(),ze>mt?(re.addRange(Z),re.extend(G.node,G.offset)):(Z.setEnd(G.node,G.offset),re.addRange(Z))}}}}for(fe=[],re=R;re=re.parentNode;)re.nodeType===1&&fe.push({element:re,left:re.scrollLeft,top:re.scrollTop});for(typeof R.focus=="function"&&R.focus(),R=0;R<fe.length;R++){var ue=fe[R];ue.element.scrollLeft=ue.left,ue.element.scrollTop=ue.top}}uo=!!qu,Yu=qu=null}finally{rt=f,O.p=i,z.T=l}}e.current=n,$t=2}}function Lh(){if($t===2){$t=0;var e=Yr,n=jl,l=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||l){l=z.T,z.T=null;var i=O.p;O.p=2;var f=rt;rt|=4;try{sh(e,n.alternate,n)}finally{rt=f,O.p=i,z.T=l}}$t=3}}function zh(){if($t===4||$t===3){$t=0,Gt();var e=Yr,n=jl,l=Tr,i=yh;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?$t=5:($t=0,jl=Yr=null,Dh(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(qr=null),zr(l),n=n.stateNode,Ut&&typeof Ut.onCommitFiberRoot=="function")try{Ut.onCommitFiberRoot(Mn,n,void 0,(n.current.flags&128)===128)}catch{}if(i!==null){n=z.T,f=O.p,O.p=2,z.T=null;try{for(var x=e.onRecoverableError,j=0;j<i.length;j++){var R=i[j];x(R.value,{componentStack:R.stack})}}finally{z.T=n,O.p=f}}(Tr&3)!==0&&Zi(),ir(e),f=e.pendingLanes,(l&261930)!==0&&(f&42)!==0?e===Du?ys++:(ys=0,Du=e):ys=0,bs(0)}}function Dh(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,es(n)))}function Zi(){return Mh(),Lh(),zh(),_h()}function _h(){if($t!==5)return!1;var e=Yr,n=Lu;Lu=0;var l=zr(Tr),i=z.T,f=O.p;try{O.p=32>l?32:l,z.T=null,l=zu,zu=null;var x=Yr,j=Tr;if($t=0,jl=Yr=null,Tr=0,(rt&6)!==0)throw Error(o(331));var R=rt;if(rt|=4,xh(x.current),ph(x,x.current,j,l),rt=R,bs(0,!1),Ut&&typeof Ut.onPostCommitFiberRoot=="function")try{Ut.onPostCommitFiberRoot(Mn,x)}catch{}return!0}finally{O.p=f,z.T=i,Dh(e,n)}}function Oh(e,n,l){n=_n(l,n),n=fu(e.stateNode,n,2),e=$r(e,n,2),e!==null&&(fa(e,2),ir(e))}function it(e,n,l){if(e.tag===3)Oh(e,e,l);else for(;n!==null;){if(n.tag===3){Oh(n,e,l);break}else if(n.tag===1){var i=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(qr===null||!qr.has(i))){e=_n(l,e),l=Bm(2),i=$r(n,l,2),i!==null&&(Im(l,i,n,e),fa(i,2),ir(i));break}}n=n.return}}function Bu(e,n,l){var i=e.pingCache;if(i===null){i=e.pingCache=new v1;var f=new Set;i.set(n,f)}else f=i.get(n),f===void 0&&(f=new Set,i.set(n,f));f.has(l)||(Ru=!0,f.add(l),e=k1.bind(null,e,n,l),n.then(e,e))}function k1(e,n,l){var i=e.pingCache;i!==null&&i.delete(n),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,xt===e&&(Ke&l)===l&&(Mt===4||Mt===3&&(Ke&62914560)===Ke&&300>We()-Wi?(rt&2)===0&&Sl(e,0):Au|=l,bl===Ke&&(bl=0)),ir(e)}function Bh(e,n){n===0&&(n=qn()),e=ja(e,n),e!==null&&(fa(e,n),ir(e))}function w1(e){var n=e.memoizedState,l=0;n!==null&&(l=n.retryLane),Bh(e,l)}function C1(e,n){var l=0;switch(e.tag){case 31:case 13:var i=e.stateNode,f=e.memoizedState;f!==null&&(l=f.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(o(314))}i!==null&&i.delete(n),Bh(e,l)}function E1(e,n){return Ct(e,n)}var Ji=null,wl=null,Iu=!1,eo=!1,Uu=!1,Xr=0;function ir(e){e!==wl&&e.next===null&&(wl===null?Ji=wl=e:wl=wl.next=e),eo=!0,Iu||(Iu=!0,T1())}function bs(e,n){if(!Uu&&eo){Uu=!0;do for(var l=!1,i=Ji;i!==null;){if(e!==0){var f=i.pendingLanes;if(f===0)var x=0;else{var j=i.suspendedLanes,R=i.pingedLanes;x=(1<<31-ct(42|e)+1)-1,x&=f&~(j&~R),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(l=!0,$h(i,x))}else x=Ke,x=Se(i,i===xt?x:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(x&3)===0||Me(i,x)||(l=!0,$h(i,x));i=i.next}while(l);Uu=!1}}function N1(){Ih()}function Ih(){eo=Iu=!1;var e=0;Xr!==0&&I1()&&(e=Xr);for(var n=We(),l=null,i=Ji;i!==null;){var f=i.next,x=Uh(i,n);x===0?(i.next=null,l===null?Ji=f:l.next=f,f===null&&(wl=l)):(l=i,(e!==0||(x&3)!==0)&&(eo=!0)),i=f}$t!==0&&$t!==5||bs(e),Xr!==0&&(Xr=0)}function Uh(e,n){for(var l=e.suspendedLanes,i=e.pingedLanes,f=e.expirationTimes,x=e.pendingLanes&-62914561;0<x;){var j=31-ct(x),R=1<<j,V=f[j];V===-1?((R&l)===0||(R&i)!==0)&&(f[j]=Fa(R,n)):V<=n&&(e.expiredLanes|=R),x&=~R}if(n=xt,l=Ke,l=Se(e,e===n?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,l===0||e===n&&(st===2||st===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&>(i),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||Me(e,l)){if(n=l&-l,n===e.callbackPriority)return n;switch(i!==null&>(i),zr(l)){case 2:case 8:l=ye;break;case 32:l=ot;break;case 268435456:l=Kt;break;default:l=ot}return i=Hh.bind(null,e),l=Ct(l,i),e.callbackPriority=n,e.callbackNode=l,n}return i!==null&&i!==null&>(i),e.callbackPriority=2,e.callbackNode=null,2}function Hh(e,n){if($t!==0&&$t!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(Zi()&&e.callbackNode!==l)return null;var i=Ke;return i=Se(e,e===xt?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(jh(e,i,n),Uh(e,We()),e.callbackNode!=null&&e.callbackNode===l?Hh.bind(null,e):null)}function $h(e,n){if(Zi())return null;jh(e,n,!0)}function T1(){H1(function(){(rt&6)!==0?Ct(xn,N1):Ih()})}function Hu(){if(Xr===0){var e=cl;e===0&&(e=gn,gn<<=1,(gn&261888)===0&&(gn=256)),Xr=e}return Xr}function Vh(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:oi(""+e)}function Ph(e,n){var l=n.ownerDocument.createElement("input");return l.name=n.name,l.value=n.value,e.id&&l.setAttribute("form",e.id),n.parentNode.insertBefore(l,n),e=new FormData(e),l.parentNode.removeChild(l),e}function R1(e,n,l,i,f){if(n==="submit"&&l&&l.stateNode===f){var x=Vh((f[dt]||null).action),j=i.submitter;j&&(n=(n=j[dt]||null)?Vh(n.formAction):j.getAttribute("formAction"),n!==null&&(x=n,j=null));var R=new fi("action","action",null,i,f);e.push({event:R,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Xr!==0){var V=j?Ph(f,j):new FormData(f);su(l,{pending:!0,data:V,method:f.method,action:x},null,V)}}else typeof x=="function"&&(R.preventDefault(),V=j?Ph(f,j):new FormData(f),su(l,{pending:!0,data:V,method:f.method,action:x},x,V))},currentTarget:f}]})}}for(var $u=0;$u<kc.length;$u++){var Vu=kc[$u],A1=Vu.toLowerCase(),M1=Vu[0].toUpperCase()+Vu.slice(1);Yn(A1,"on"+M1)}Yn(bp,"onAnimationEnd"),Yn(jp,"onAnimationIteration"),Yn(Sp,"onAnimationStart"),Yn("dblclick","onDoubleClick"),Yn("focusin","onFocus"),Yn("focusout","onBlur"),Yn(qb,"onTransitionRun"),Yn(Yb,"onTransitionStart"),Yn(Kb,"onTransitionCancel"),Yn(kp,"onTransitionEnd"),Ka("onMouseEnter",["mouseout","mouseover"]),Ka("onMouseLeave",["mouseout","mouseover"]),Ka("onPointerEnter",["pointerout","pointerover"]),Ka("onPointerLeave",["pointerout","pointerover"]),ga("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ga("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ga("onBeforeInput",["compositionend","keypress","textInput","paste"]),ga("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ga("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ga("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var js="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),L1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(js));function Fh(e,n){n=(n&4)!==0;for(var l=0;l<e.length;l++){var i=e[l],f=i.event;i=i.listeners;e:{var x=void 0;if(n)for(var j=i.length-1;0<=j;j--){var R=i[j],V=R.instance,J=R.currentTarget;if(R=R.listener,V!==x&&f.isPropagationStopped())break e;x=R,f.currentTarget=J;try{x(f)}catch(ie){hi(ie)}f.currentTarget=null,x=V}else for(j=0;j<i.length;j++){if(R=i[j],V=R.instance,J=R.currentTarget,R=R.listener,V!==x&&f.isPropagationStopped())break e;x=R,f.currentTarget=J;try{x(f)}catch(ie){hi(ie)}f.currentTarget=null,x=V}}}}function Ye(e,n){var l=n[rr];l===void 0&&(l=n[rr]=new Set);var i=e+"__bubble";l.has(i)||(Gh(n,e,2,!1),l.add(i))}function Pu(e,n,l){var i=0;n&&(i|=4),Gh(l,e,i,n)}var to="_reactListening"+Math.random().toString(36).slice(2);function Fu(e){if(!e[to]){e[to]=!0,If.forEach(function(l){l!=="selectionchange"&&(L1.has(l)||Pu(l,!1,e),Pu(l,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[to]||(n[to]=!0,Pu("selectionchange",!1,n))}}function Gh(e,n,l,i){switch(bx(n)){case 2:var f=s0;break;case 8:f=i0;break;default:f=ld}l=f.bind(null,n,l,e),f=void 0,!uc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),i?f!==void 0?e.addEventListener(n,l,{capture:!0,passive:f}):e.addEventListener(n,l,!0):f!==void 0?e.addEventListener(n,l,{passive:f}):e.addEventListener(n,l,!1)}function Gu(e,n,l,i,f){var x=i;if((n&1)===0&&(n&2)===0&&i!==null)e:for(;;){if(i===null)return;var j=i.tag;if(j===3||j===4){var R=i.stateNode.containerInfo;if(R===f)break;if(j===4)for(j=i.return;j!==null;){var V=j.tag;if((V===3||V===4)&&j.stateNode.containerInfo===f)return;j=j.return}for(;R!==null;){if(j=Wa(R),j===null)return;if(V=j.tag,V===5||V===6||V===26||V===27){i=x=j;continue e}R=R.parentNode}}i=i.return}Xf(function(){var J=x,ie=oc(l),fe=[];e:{var te=wp.get(e);if(te!==void 0){var re=fi,Ce=e;switch(e){case"keypress":if(ui(l)===0)break e;case"keydown":case"keyup":re=Cb;break;case"focusin":Ce="focus",re=mc;break;case"focusout":Ce="blur",re=mc;break;case"beforeblur":case"afterblur":re=mc;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":re=Jf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":re=pb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":re=Tb;break;case bp:case jp:case Sp:re=xb;break;case kp:re=Ab;break;case"scroll":case"scrollend":re=db;break;case"wheel":re=Lb;break;case"copy":case"cut":case"paste":re=vb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":re=tp;break;case"toggle":case"beforetoggle":re=Db}var ze=(n&4)!==0,mt=!ze&&(e==="scroll"||e==="scrollend"),K=ze?te!==null?te+"Capture":null:te;ze=[];for(var G=J,Z;G!==null;){var ue=G;if(Z=ue.stateNode,ue=ue.tag,ue!==5&&ue!==26&&ue!==27||Z===null||K===null||(ue=Pl(G,K),ue!=null&&ze.push(Ss(G,ue,Z))),mt)break;G=G.return}0<ze.length&&(te=new re(te,Ce,null,l,ie),fe.push({event:te,listeners:ze}))}}if((n&7)===0){e:{if(te=e==="mouseover"||e==="pointerover",re=e==="mouseout"||e==="pointerout",te&&l!==ic&&(Ce=l.relatedTarget||l.fromElement)&&(Wa(Ce)||Ce[xa]))break e;if((re||te)&&(te=ie.window===ie?ie:(te=ie.ownerDocument)?te.defaultView||te.parentWindow:window,re?(Ce=l.relatedTarget||l.toElement,re=J,Ce=Ce?Wa(Ce):null,Ce!==null&&(mt=u(Ce),ze=Ce.tag,Ce!==mt||ze!==5&&ze!==27&&ze!==6)&&(Ce=null)):(re=null,Ce=J),re!==Ce)){if(ze=Jf,ue="onMouseLeave",K="onMouseEnter",G="mouse",(e==="pointerout"||e==="pointerover")&&(ze=tp,ue="onPointerLeave",K="onPointerEnter",G="pointer"),mt=re==null?te:Vl(re),Z=Ce==null?te:Vl(Ce),te=new ze(ue,G+"leave",re,l,ie),te.target=mt,te.relatedTarget=Z,ue=null,Wa(ie)===J&&(ze=new ze(K,G+"enter",Ce,l,ie),ze.target=Z,ze.relatedTarget=mt,ue=ze),mt=ue,re&&Ce)t:{for(ze=z1,K=re,G=Ce,Z=0,ue=K;ue;ue=ze(ue))Z++;ue=0;for(var Ae=G;Ae;Ae=ze(Ae))ue++;for(;0<Z-ue;)K=ze(K),Z--;for(;0<ue-Z;)G=ze(G),ue--;for(;Z--;){if(K===G||G!==null&&K===G.alternate){ze=K;break t}K=ze(K),G=ze(G)}ze=null}else ze=null;re!==null&&Wh(fe,te,re,ze,!1),Ce!==null&&mt!==null&&Wh(fe,mt,Ce,ze,!0)}}e:{if(te=J?Vl(J):window,re=te.nodeName&&te.nodeName.toLowerCase(),re==="select"||re==="input"&&te.type==="file")var Je=cp;else if(ip(te))if(up)Je=Fb;else{Je=Vb;var Ee=$b}else re=te.nodeName,!re||re.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?J&&sc(J.elementType)&&(Je=cp):Je=Pb;if(Je&&(Je=Je(e,J))){op(fe,Je,l,ie);break e}Ee&&Ee(e,te,J),e==="focusout"&&J&&te.type==="number"&&J.memoizedProps.value!=null&&lc(te,"number",te.value)}switch(Ee=J?Vl(J):window,e){case"focusin":(ip(Ee)||Ee.contentEditable==="true")&&(tl=Ee,bc=J,Ql=null);break;case"focusout":Ql=bc=tl=null;break;case"mousedown":jc=!0;break;case"contextmenu":case"mouseup":case"dragend":jc=!1,vp(fe,l,ie);break;case"selectionchange":if(Wb)break;case"keydown":case"keyup":vp(fe,l,ie)}var Pe;if(xc)e:{switch(e){case"compositionstart":var Xe="onCompositionStart";break e;case"compositionend":Xe="onCompositionEnd";break e;case"compositionupdate":Xe="onCompositionUpdate";break e}Xe=void 0}else el?lp(e,l)&&(Xe="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(Xe="onCompositionStart");Xe&&(np&&l.locale!=="ko"&&(el||Xe!=="onCompositionStart"?Xe==="onCompositionEnd"&&el&&(Pe=Qf()):(Dr=ie,dc="value"in Dr?Dr.value:Dr.textContent,el=!0)),Ee=no(J,Xe),0<Ee.length&&(Xe=new ep(Xe,e,null,l,ie),fe.push({event:Xe,listeners:Ee}),Pe?Xe.data=Pe:(Pe=sp(l),Pe!==null&&(Xe.data=Pe)))),(Pe=Ob?Bb(e,l):Ib(e,l))&&(Xe=no(J,"onBeforeInput"),0<Xe.length&&(Ee=new ep("onBeforeInput","beforeinput",null,l,ie),fe.push({event:Ee,listeners:Xe}),Ee.data=Pe)),R1(fe,e,J,l,ie)}Fh(fe,n)})}function Ss(e,n,l){return{instance:e,listener:n,currentTarget:l}}function no(e,n){for(var l=n+"Capture",i=[];e!==null;){var f=e,x=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||x===null||(f=Pl(e,l),f!=null&&i.unshift(Ss(e,f,x)),f=Pl(e,n),f!=null&&i.push(Ss(e,f,x))),e.tag===3)return i;e=e.return}return[]}function z1(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Wh(e,n,l,i,f){for(var x=n._reactName,j=[];l!==null&&l!==i;){var R=l,V=R.alternate,J=R.stateNode;if(R=R.tag,V!==null&&V===i)break;R!==5&&R!==26&&R!==27||J===null||(V=J,f?(J=Pl(l,x),J!=null&&j.unshift(Ss(l,J,V))):f||(J=Pl(l,x),J!=null&&j.push(Ss(l,J,V)))),l=l.return}j.length!==0&&e.push({event:n,listeners:j})}var D1=/\r\n?/g,_1=/\u0000|\uFFFD/g;function qh(e){return(typeof e=="string"?e:""+e).replace(D1,`
|
|
50
|
-
`).replace(_1,"")}function Yh(e,n){return n=qh(n),qh(e)===n}function pt(e,n,l,i,f,x){switch(l){case"children":typeof i=="string"?n==="body"||n==="textarea"&&i===""||Qa(e,i):(typeof i=="number"||typeof i=="bigint")&&n!=="body"&&Qa(e,""+i);break;case"className":si(e,"class",i);break;case"tabIndex":si(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":si(e,l,i);break;case"style":Yf(e,i,x);break;case"data":if(n!=="object"){si(e,"data",i);break}case"src":case"href":if(i===""&&(n!=="a"||l!=="href")){e.removeAttribute(l);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(l);break}i=oi(""+i),e.setAttribute(l,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(l==="formAction"?(n!=="input"&&pt(e,n,"name",f.name,f,null),pt(e,n,"formEncType",f.formEncType,f,null),pt(e,n,"formMethod",f.formMethod,f,null),pt(e,n,"formTarget",f.formTarget,f,null)):(pt(e,n,"encType",f.encType,f,null),pt(e,n,"method",f.method,f,null),pt(e,n,"target",f.target,f,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(l);break}i=oi(""+i),e.setAttribute(l,i);break;case"onClick":i!=null&&(e.onclick=pr);break;case"onScroll":i!=null&&Ye("scroll",e);break;case"onScrollEnd":i!=null&&Ye("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(o(61));if(l=i.__html,l!=null){if(f.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}l=oi(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,""+i):e.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":i===!0?e.setAttribute(l,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,i):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(l,i):e.removeAttribute(l);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(l):e.setAttribute(l,i);break;case"popover":Ye("beforetoggle",e),Ye("toggle",e),li(e,"popover",i);break;case"xlinkActuate":fr(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":fr(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":fr(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":fr(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":fr(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":fr(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":fr(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":fr(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":fr(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":li(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=cb.get(l)||l,li(e,l,i))}}function Wu(e,n,l,i,f,x){switch(l){case"style":Yf(e,i,x);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(o(61));if(l=i.__html,l!=null){if(f.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"children":typeof i=="string"?Qa(e,i):(typeof i=="number"||typeof i=="bigint")&&Qa(e,""+i);break;case"onScroll":i!=null&&Ye("scroll",e);break;case"onScrollEnd":i!=null&&Ye("scrollend",e);break;case"onClick":i!=null&&(e.onclick=pr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Uf.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(f=l.endsWith("Capture"),n=l.slice(2,f?l.length-7:void 0),x=e[dt]||null,x=x!=null?x[l]:null,typeof x=="function"&&e.removeEventListener(n,x,f),typeof i=="function")){typeof x!="function"&&x!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(n,i,f);break e}l in e?e[l]=i:i===!0?e.setAttribute(l,""):li(e,l,i)}}}function Jt(e,n,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ye("error",e),Ye("load",e);var i=!1,f=!1,x;for(x in l)if(l.hasOwnProperty(x)){var j=l[x];if(j!=null)switch(x){case"src":i=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,n));default:pt(e,n,x,j,l,null)}}f&&pt(e,n,"srcSet",l.srcSet,l,null),i&&pt(e,n,"src",l.src,l,null);return;case"input":Ye("invalid",e);var R=x=j=f=null,V=null,J=null;for(i in l)if(l.hasOwnProperty(i)){var ie=l[i];if(ie!=null)switch(i){case"name":f=ie;break;case"type":j=ie;break;case"checked":V=ie;break;case"defaultChecked":J=ie;break;case"value":x=ie;break;case"defaultValue":R=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(o(137,n));break;default:pt(e,n,i,ie,l,null)}}Ff(e,x,R,V,J,j,f,!1);return;case"select":Ye("invalid",e),i=j=x=null;for(f in l)if(l.hasOwnProperty(f)&&(R=l[f],R!=null))switch(f){case"value":x=R;break;case"defaultValue":j=R;break;case"multiple":i=R;default:pt(e,n,f,R,l,null)}n=x,l=j,e.multiple=!!i,n!=null?Xa(e,!!i,n,!1):l!=null&&Xa(e,!!i,l,!0);return;case"textarea":Ye("invalid",e),x=f=i=null;for(j in l)if(l.hasOwnProperty(j)&&(R=l[j],R!=null))switch(j){case"value":i=R;break;case"defaultValue":f=R;break;case"children":x=R;break;case"dangerouslySetInnerHTML":if(R!=null)throw Error(o(91));break;default:pt(e,n,j,R,l,null)}Wf(e,i,f,x);return;case"option":for(V in l)if(l.hasOwnProperty(V)&&(i=l[V],i!=null))switch(V){case"selected":e.selected=i&&typeof i!="function"&&typeof i!="symbol";break;default:pt(e,n,V,i,l,null)}return;case"dialog":Ye("beforetoggle",e),Ye("toggle",e),Ye("cancel",e),Ye("close",e);break;case"iframe":case"object":Ye("load",e);break;case"video":case"audio":for(i=0;i<js.length;i++)Ye(js[i],e);break;case"image":Ye("error",e),Ye("load",e);break;case"details":Ye("toggle",e);break;case"embed":case"source":case"link":Ye("error",e),Ye("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(J in l)if(l.hasOwnProperty(J)&&(i=l[J],i!=null))switch(J){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,n));default:pt(e,n,J,i,l,null)}return;default:if(sc(n)){for(ie in l)l.hasOwnProperty(ie)&&(i=l[ie],i!==void 0&&Wu(e,n,ie,i,l,void 0));return}}for(R in l)l.hasOwnProperty(R)&&(i=l[R],i!=null&&pt(e,n,R,i,l,null))}function O1(e,n,l,i){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,x=null,j=null,R=null,V=null,J=null,ie=null;for(re in l){var fe=l[re];if(l.hasOwnProperty(re)&&fe!=null)switch(re){case"checked":break;case"value":break;case"defaultValue":V=fe;default:i.hasOwnProperty(re)||pt(e,n,re,null,i,fe)}}for(var te in i){var re=i[te];if(fe=l[te],i.hasOwnProperty(te)&&(re!=null||fe!=null))switch(te){case"type":x=re;break;case"name":f=re;break;case"checked":J=re;break;case"defaultChecked":ie=re;break;case"value":j=re;break;case"defaultValue":R=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(o(137,n));break;default:re!==fe&&pt(e,n,te,re,i,fe)}}ac(e,j,R,V,J,ie,x,f);return;case"select":re=j=R=te=null;for(x in l)if(V=l[x],l.hasOwnProperty(x)&&V!=null)switch(x){case"value":break;case"multiple":re=V;default:i.hasOwnProperty(x)||pt(e,n,x,null,i,V)}for(f in i)if(x=i[f],V=l[f],i.hasOwnProperty(f)&&(x!=null||V!=null))switch(f){case"value":te=x;break;case"defaultValue":R=x;break;case"multiple":j=x;default:x!==V&&pt(e,n,f,x,i,V)}n=R,l=j,i=re,te!=null?Xa(e,!!l,te,!1):!!i!=!!l&&(n!=null?Xa(e,!!l,n,!0):Xa(e,!!l,l?[]:"",!1));return;case"textarea":re=te=null;for(R in l)if(f=l[R],l.hasOwnProperty(R)&&f!=null&&!i.hasOwnProperty(R))switch(R){case"value":break;case"children":break;default:pt(e,n,R,null,i,f)}for(j in i)if(f=i[j],x=l[j],i.hasOwnProperty(j)&&(f!=null||x!=null))switch(j){case"value":te=f;break;case"defaultValue":re=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(o(91));break;default:f!==x&&pt(e,n,j,f,i,x)}Gf(e,te,re);return;case"option":for(var Ce in l)if(te=l[Ce],l.hasOwnProperty(Ce)&&te!=null&&!i.hasOwnProperty(Ce))switch(Ce){case"selected":e.selected=!1;break;default:pt(e,n,Ce,null,i,te)}for(V in i)if(te=i[V],re=l[V],i.hasOwnProperty(V)&&te!==re&&(te!=null||re!=null))switch(V){case"selected":e.selected=te&&typeof te!="function"&&typeof te!="symbol";break;default:pt(e,n,V,te,i,re)}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 ze in l)te=l[ze],l.hasOwnProperty(ze)&&te!=null&&!i.hasOwnProperty(ze)&&pt(e,n,ze,null,i,te);for(J in i)if(te=i[J],re=l[J],i.hasOwnProperty(J)&&te!==re&&(te!=null||re!=null))switch(J){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(o(137,n));break;default:pt(e,n,J,te,i,re)}return;default:if(sc(n)){for(var mt in l)te=l[mt],l.hasOwnProperty(mt)&&te!==void 0&&!i.hasOwnProperty(mt)&&Wu(e,n,mt,void 0,i,te);for(ie in i)te=i[ie],re=l[ie],!i.hasOwnProperty(ie)||te===re||te===void 0&&re===void 0||Wu(e,n,ie,te,i,re);return}}for(var K in l)te=l[K],l.hasOwnProperty(K)&&te!=null&&!i.hasOwnProperty(K)&&pt(e,n,K,null,i,te);for(fe in i)te=i[fe],re=l[fe],!i.hasOwnProperty(fe)||te===re||te==null&&re==null||pt(e,n,fe,te,i,re)}function Kh(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function B1(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,l=performance.getEntriesByType("resource"),i=0;i<l.length;i++){var f=l[i],x=f.transferSize,j=f.initiatorType,R=f.duration;if(x&&R&&Kh(j)){for(j=0,R=f.responseEnd,i+=1;i<l.length;i++){var V=l[i],J=V.startTime;if(J>R)break;var ie=V.transferSize,fe=V.initiatorType;ie&&Kh(fe)&&(V=V.responseEnd,j+=ie*(V<R?1:(R-J)/(V-J)))}if(--i,n+=8*(x+j)/(f.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var qu=null,Yu=null;function ro(e){return e.nodeType===9?e:e.ownerDocument}function Xh(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 Qh(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function Ku(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Xu=null;function I1(){var e=window.event;return e&&e.type==="popstate"?e===Xu?!1:(Xu=e,!0):(Xu=null,!1)}var Zh=typeof setTimeout=="function"?setTimeout:void 0,U1=typeof clearTimeout=="function"?clearTimeout:void 0,Jh=typeof Promise=="function"?Promise:void 0,H1=typeof queueMicrotask=="function"?queueMicrotask:typeof Jh<"u"?function(e){return Jh.resolve(null).then(e).catch($1)}:Zh;function $1(e){setTimeout(function(){throw e})}function Qr(e){return e==="head"}function ex(e,n){var l=n,i=0;do{var f=l.nextSibling;if(e.removeChild(l),f&&f.nodeType===8)if(l=f.data,l==="/$"||l==="/&"){if(i===0){e.removeChild(f),Tl(n);return}i--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")i++;else if(l==="html")ks(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,ks(l);for(var x=l.firstChild;x;){var j=x.nextSibling,R=x.nodeName;x[$l]||R==="SCRIPT"||R==="STYLE"||R==="LINK"&&x.rel.toLowerCase()==="stylesheet"||l.removeChild(x),x=j}}else l==="body"&&ks(e.ownerDocument.body);l=f}while(l);Tl(n)}function tx(e,n){var l=e;e=0;do{var i=l.nextSibling;if(l.nodeType===1?n?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(n?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),i&&i.nodeType===8)if(l=i.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=i}while(l)}function Qu(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var l=n;switch(n=n.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Qu(l),nc(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function V1(e,n,l,i){for(;e.nodeType===1;){var f=l;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[$l])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(x=e.getAttribute("rel"),x==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(x!==f.rel||e.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||e.getAttribute("title")!==(f.title==null?null:f.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(x=e.getAttribute("src"),(x!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&x&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var x=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===x)return e}else return e;if(e=Hn(e.nextSibling),e===null)break}return null}function P1(e,n,l){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=Hn(e.nextSibling),e===null))return null;return e}function nx(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Hn(e.nextSibling),e===null))return null;return e}function Zu(e){return e.data==="$?"||e.data==="$~"}function Ju(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function F1(e,n){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||l.readyState!=="loading")n();else{var i=function(){n(),l.removeEventListener("DOMContentLoaded",i)};l.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function Hn(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var ed=null;function rx(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(n===0)return Hn(e.nextSibling);n--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||n++}e=e.nextSibling}return null}function ax(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var l=e.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(n===0)return e;n--}else l!=="/$"&&l!=="/&"||n++}e=e.previousSibling}return null}function lx(e,n,l){switch(n=ro(l),e){case"html":if(e=n.documentElement,!e)throw Error(o(452));return e;case"head":if(e=n.head,!e)throw Error(o(453));return e;case"body":if(e=n.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function ks(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);nc(e)}var $n=new Map,sx=new Set;function ao(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Rr=O.d;O.d={f:G1,r:W1,D:q1,C:Y1,L:K1,m:X1,X:Z1,S:Q1,M:J1};function G1(){var e=Rr.f(),n=Ki();return e||n}function W1(e){var n=qa(e);n!==null&&n.tag===5&&n.type==="form"?km(n):Rr.r(e)}var Cl=typeof document>"u"?null:document;function ix(e,n,l){var i=Cl;if(i&&typeof n=="string"&&n){var f=zn(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof l=="string"&&(f+='[crossorigin="'+l+'"]'),sx.has(f)||(sx.add(f),e={rel:e,crossOrigin:l,href:n},i.querySelector(f)===null&&(n=i.createElement("link"),Jt(n,"link",e),qt(n),i.head.appendChild(n)))}}function q1(e){Rr.D(e),ix("dns-prefetch",e,null)}function Y1(e,n){Rr.C(e,n),ix("preconnect",e,n)}function K1(e,n,l){Rr.L(e,n,l);var i=Cl;if(i&&e&&n){var f='link[rel="preload"][as="'+zn(n)+'"]';n==="image"&&l&&l.imageSrcSet?(f+='[imagesrcset="'+zn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(f+='[imagesizes="'+zn(l.imageSizes)+'"]')):f+='[href="'+zn(e)+'"]';var x=f;switch(n){case"style":x=El(e);break;case"script":x=Nl(e)}$n.has(x)||(e=v({rel:"preload",href:n==="image"&&l&&l.imageSrcSet?void 0:e,as:n},l),$n.set(x,e),i.querySelector(f)!==null||n==="style"&&i.querySelector(ws(x))||n==="script"&&i.querySelector(Cs(x))||(n=i.createElement("link"),Jt(n,"link",e),qt(n),i.head.appendChild(n)))}}function X1(e,n){Rr.m(e,n);var l=Cl;if(l&&e){var i=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+zn(i)+'"][href="'+zn(e)+'"]',x=f;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Nl(e)}if(!$n.has(x)&&(e=v({rel:"modulepreload",href:e},n),$n.set(x,e),l.querySelector(f)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Cs(x)))return}i=l.createElement("link"),Jt(i,"link",e),qt(i),l.head.appendChild(i)}}}function Q1(e,n,l){Rr.S(e,n,l);var i=Cl;if(i&&e){var f=Ya(i).hoistableStyles,x=El(e);n=n||"default";var j=f.get(x);if(!j){var R={loading:0,preload:null};if(j=i.querySelector(ws(x)))R.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":n},l),(l=$n.get(x))&&td(e,l);var V=j=i.createElement("link");qt(V),Jt(V,"link",e),V._p=new Promise(function(J,ie){V.onload=J,V.onerror=ie}),V.addEventListener("load",function(){R.loading|=1}),V.addEventListener("error",function(){R.loading|=2}),R.loading|=4,lo(j,n,i)}j={type:"stylesheet",instance:j,count:1,state:R},f.set(x,j)}}}function Z1(e,n){Rr.X(e,n);var l=Cl;if(l&&e){var i=Ya(l).hoistableScripts,f=Nl(e),x=i.get(f);x||(x=l.querySelector(Cs(f)),x||(e=v({src:e,async:!0},n),(n=$n.get(f))&&nd(e,n),x=l.createElement("script"),qt(x),Jt(x,"link",e),l.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},i.set(f,x))}}function J1(e,n){Rr.M(e,n);var l=Cl;if(l&&e){var i=Ya(l).hoistableScripts,f=Nl(e),x=i.get(f);x||(x=l.querySelector(Cs(f)),x||(e=v({src:e,async:!0,type:"module"},n),(n=$n.get(f))&&nd(e,n),x=l.createElement("script"),qt(x),Jt(x,"link",e),l.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},i.set(f,x))}}function ox(e,n,l,i){var f=(f=de.current)?ao(f):null;if(!f)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(n=El(l.href),l=Ya(f).hoistableStyles,i=l.get(n),i||(i={type:"style",instance:null,count:0,state:null},l.set(n,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=El(l.href);var x=Ya(f).hoistableStyles,j=x.get(e);if(j||(f=f.ownerDocument||f,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(e,j),(x=f.querySelector(ws(e)))&&!x._p&&(j.instance=x,j.state.loading=5),$n.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},$n.set(e,l),x||e0(f,e,l,j.state))),n&&i===null)throw Error(o(528,""));return j}if(n&&i!==null)throw Error(o(529,""));return null;case"script":return n=l.async,l=l.src,typeof l=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Nl(l),l=Ya(f).hoistableScripts,i=l.get(n),i||(i={type:"script",instance:null,count:0,state:null},l.set(n,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function El(e){return'href="'+zn(e)+'"'}function ws(e){return'link[rel="stylesheet"]['+e+"]"}function cx(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function e0(e,n,l,i){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?i.loading=1:(n=e.createElement("link"),i.preload=n,n.addEventListener("load",function(){return i.loading|=1}),n.addEventListener("error",function(){return i.loading|=2}),Jt(n,"link",l),qt(n),e.head.appendChild(n))}function Nl(e){return'[src="'+zn(e)+'"]'}function Cs(e){return"script[async]"+e}function ux(e,n,l){if(n.count++,n.instance===null)switch(n.type){case"style":var i=e.querySelector('style[data-href~="'+zn(l.href)+'"]');if(i)return n.instance=i,qt(i),i;var f=v({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),qt(i),Jt(i,"style",f),lo(i,l.precedence,e),n.instance=i;case"stylesheet":f=El(l.href);var x=e.querySelector(ws(f));if(x)return n.state.loading|=4,n.instance=x,qt(x),x;i=cx(l),(f=$n.get(f))&&td(i,f),x=(e.ownerDocument||e).createElement("link"),qt(x);var j=x;return j._p=new Promise(function(R,V){j.onload=R,j.onerror=V}),Jt(x,"link",i),n.state.loading|=4,lo(x,l.precedence,e),n.instance=x;case"script":return x=Nl(l.src),(f=e.querySelector(Cs(x)))?(n.instance=f,qt(f),f):(i=l,(f=$n.get(x))&&(i=v({},l),nd(i,f)),e=e.ownerDocument||e,f=e.createElement("script"),qt(f),Jt(f,"link",i),e.head.appendChild(f),n.instance=f);case"void":return null;default:throw Error(o(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(i=n.instance,n.state.loading|=4,lo(i,l.precedence,e));return n.instance}function lo(e,n,l){for(var i=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=i.length?i[i.length-1]:null,x=f,j=0;j<i.length;j++){var R=i[j];if(R.dataset.precedence===n)x=R;else if(x!==f)break}x?x.parentNode.insertBefore(e,x.nextSibling):(n=l.nodeType===9?l.head:l,n.insertBefore(e,n.firstChild))}function td(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function nd(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var so=null;function dx(e,n,l){if(so===null){var i=new Map,f=so=new Map;f.set(l,i)}else f=so,i=f.get(l),i||(i=new Map,f.set(l,i));if(i.has(e))return i;for(i.set(e,null),l=l.getElementsByTagName(e),f=0;f<l.length;f++){var x=l[f];if(!(x[$l]||x[Ht]||e==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var j=x.getAttribute(n)||"";j=e+j;var R=i.get(j);R?R.push(x):i.set(j,[x])}}return i}function fx(e,n,l){e=e.ownerDocument||e,e.head.insertBefore(l,n==="title"?e.querySelector("head > title"):null)}function t0(e,n,l){if(l===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function px(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function n0(e,n,l,i){if(l.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var f=El(i.href),x=n.querySelector(ws(f));if(x){n=x._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=io.bind(e),n.then(e,e)),l.state.loading|=4,l.instance=x,qt(x);return}x=n.ownerDocument||n,i=cx(i),(f=$n.get(f))&&td(i,f),x=x.createElement("link"),qt(x);var j=x;j._p=new Promise(function(R,V){j.onload=R,j.onerror=V}),Jt(x,"link",i),l.instance=x}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,n),(n=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=io.bind(e),n.addEventListener("load",l),n.addEventListener("error",l))}}var rd=0;function r0(e,n){return e.stylesheets&&e.count===0&&co(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var i=setTimeout(function(){if(e.stylesheets&&co(e,e.stylesheets),e.unsuspend){var x=e.unsuspend;e.unsuspend=null,x()}},6e4+n);0<e.imgBytes&&rd===0&&(rd=62500*B1());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&co(e,e.stylesheets),e.unsuspend)){var x=e.unsuspend;e.unsuspend=null,x()}},(e.imgBytes>rd?50:800)+n);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(f)}}:null}function io(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)co(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var oo=null;function co(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,oo=new Map,n.forEach(a0,e),oo=null,io.call(e))}function a0(e,n){if(!(n.state.loading&4)){var l=oo.get(e);if(l)var i=l.get(null);else{l=new Map,oo.set(e,l);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<f.length;x++){var j=f[x];(j.nodeName==="LINK"||j.getAttribute("media")!=="not all")&&(l.set(j.dataset.precedence,j),i=j)}i&&l.set(null,i)}f=n.instance,j=f.getAttribute("data-precedence"),x=l.get(j)||i,x===i&&l.set(null,f),l.set(j,f),this.count++,i=io.bind(this),f.addEventListener("load",i),f.addEventListener("error",i),x?x.parentNode.insertBefore(f,x.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),n.state.loading|=4}}var Es={$$typeof:A,Provider:null,Consumer:null,_currentValue:P,_currentValue2:P,_threadCount:0};function l0(e,n,l,i,f,x,j,R,V){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=Ul(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ul(0),this.hiddenUpdates=Ul(null),this.identifierPrefix=i,this.onUncaughtError=f,this.onCaughtError=x,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=V,this.incompleteTransitions=new Map}function mx(e,n,l,i,f,x,j,R,V,J,ie,fe){return e=new l0(e,n,l,j,V,J,ie,fe,R),n=1,x===!0&&(n|=24),x=yn(3,null,null,n),e.current=x,x.stateNode=e,n=Oc(),n.refCount++,e.pooledCache=n,n.refCount++,x.memoizedState={element:i,isDehydrated:l,cache:n},Hc(x),e}function hx(e){return e?(e=al,e):al}function xx(e,n,l,i,f,x){f=hx(f),i.context===null?i.context=f:i.pendingContext=f,i=Hr(n),i.payload={element:l},x=x===void 0?null:x,x!==null&&(i.callback=x),l=$r(e,i,n),l!==null&&(hn(l,e,n),as(l,e,n))}function gx(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<n?l:n}}function ad(e,n){gx(e,n),(e=e.alternate)&&gx(e,n)}function vx(e){if(e.tag===13||e.tag===31){var n=ja(e,67108864);n!==null&&hn(n,e,67108864),ad(e,67108864)}}function yx(e){if(e.tag===13||e.tag===31){var n=wn();n=Ga(n);var l=ja(e,n);l!==null&&hn(l,e,n),ad(e,n)}}var uo=!0;function s0(e,n,l,i){var f=z.T;z.T=null;var x=O.p;try{O.p=2,ld(e,n,l,i)}finally{O.p=x,z.T=f}}function i0(e,n,l,i){var f=z.T;z.T=null;var x=O.p;try{O.p=8,ld(e,n,l,i)}finally{O.p=x,z.T=f}}function ld(e,n,l,i){if(uo){var f=sd(i);if(f===null)Gu(e,n,i,fo,l),jx(e,i);else if(c0(f,e,n,l,i))i.stopPropagation();else if(jx(e,i),n&4&&-1<o0.indexOf(e)){for(;f!==null;){var x=qa(f);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var j=se(x.pendingLanes);if(j!==0){var R=x;for(R.pendingLanes|=2,R.entangledLanes|=2;j;){var V=1<<31-ct(j);R.entanglements[1]|=V,j&=~V}ir(x),(rt&6)===0&&(qi=We()+500,bs(0))}}break;case 31:case 13:R=ja(x,2),R!==null&&hn(R,x,2),Ki(),ad(x,2)}if(x=sd(i),x===null&&Gu(e,n,i,fo,l),x===f)break;f=x}f!==null&&i.stopPropagation()}else Gu(e,n,i,null,l)}}function sd(e){return e=oc(e),id(e)}var fo=null;function id(e){if(fo=null,e=Wa(e),e!==null){var n=u(e);if(n===null)e=null;else{var l=n.tag;if(l===13){if(e=d(n),e!==null)return e;e=null}else if(l===31){if(e=h(n),e!==null)return e;e=null}else if(l===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return fo=e,null}function bx(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(nt()){case xn:return 2;case ye:return 8;case ot:case Wt:return 32;case Kt:return 268435456;default:return 32}default:return 32}}var od=!1,Zr=null,Jr=null,ea=null,Ns=new Map,Ts=new Map,ta=[],o0="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 jx(e,n){switch(e){case"focusin":case"focusout":Zr=null;break;case"dragenter":case"dragleave":Jr=null;break;case"mouseover":case"mouseout":ea=null;break;case"pointerover":case"pointerout":Ns.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ts.delete(n.pointerId)}}function Rs(e,n,l,i,f,x){return e===null||e.nativeEvent!==x?(e={blockedOn:n,domEventName:l,eventSystemFlags:i,nativeEvent:x,targetContainers:[f]},n!==null&&(n=qa(n),n!==null&&vx(n)),e):(e.eventSystemFlags|=i,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function c0(e,n,l,i,f){switch(n){case"focusin":return Zr=Rs(Zr,e,n,l,i,f),!0;case"dragenter":return Jr=Rs(Jr,e,n,l,i,f),!0;case"mouseover":return ea=Rs(ea,e,n,l,i,f),!0;case"pointerover":var x=f.pointerId;return Ns.set(x,Rs(Ns.get(x)||null,e,n,l,i,f)),!0;case"gotpointercapture":return x=f.pointerId,Ts.set(x,Rs(Ts.get(x)||null,e,n,l,i,f)),!0}return!1}function Sx(e){var n=Wa(e.target);if(n!==null){var l=u(n);if(l!==null){if(n=l.tag,n===13){if(n=d(l),n!==null){e.blockedOn=n,ha(e.priority,function(){yx(l)});return}}else if(n===31){if(n=h(l),n!==null){e.blockedOn=n,ha(e.priority,function(){yx(l)});return}}else if(n===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function po(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var l=sd(e.nativeEvent);if(l===null){l=e.nativeEvent;var i=new l.constructor(l.type,l);ic=i,l.target.dispatchEvent(i),ic=null}else return n=qa(l),n!==null&&vx(n),e.blockedOn=l,!1;n.shift()}return!0}function kx(e,n,l){po(e)&&l.delete(n)}function u0(){od=!1,Zr!==null&&po(Zr)&&(Zr=null),Jr!==null&&po(Jr)&&(Jr=null),ea!==null&&po(ea)&&(ea=null),Ns.forEach(kx),Ts.forEach(kx)}function mo(e,n){e.blockedOn===n&&(e.blockedOn=null,od||(od=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,u0)))}var ho=null;function wx(e){ho!==e&&(ho=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){ho===e&&(ho=null);for(var n=0;n<e.length;n+=3){var l=e[n],i=e[n+1],f=e[n+2];if(typeof i!="function"){if(id(i||l)===null)continue;break}var x=qa(l);x!==null&&(e.splice(n,3),n-=3,su(x,{pending:!0,data:f,method:l.method,action:i},i,f))}}))}function Tl(e){function n(V){return mo(V,e)}Zr!==null&&mo(Zr,e),Jr!==null&&mo(Jr,e),ea!==null&&mo(ea,e),Ns.forEach(n),Ts.forEach(n);for(var l=0;l<ta.length;l++){var i=ta[l];i.blockedOn===e&&(i.blockedOn=null)}for(;0<ta.length&&(l=ta[0],l.blockedOn===null);)Sx(l),l.blockedOn===null&&ta.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(i=0;i<l.length;i+=3){var f=l[i],x=l[i+1],j=f[dt]||null;if(typeof x=="function")j||wx(l);else if(j){var R=null;if(x&&x.hasAttribute("formAction")){if(f=x,j=x[dt]||null)R=j.formAction;else if(id(f)!==null)continue}else R=j.action;typeof R=="function"?l[i+1]=R:(l.splice(i,3),i-=3),wx(l)}}}function Cx(){function e(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(j){return f=j})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),i||setTimeout(l,20)}function l(){if(!i&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(l,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function cd(e){this._internalRoot=e}xo.prototype.render=cd.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(o(409));var l=n.current,i=wn();xx(l,i,e,n,null,null)},xo.prototype.unmount=cd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;xx(e.current,2,null,e,null,null),Ki(),n[xa]=null}};function xo(e){this._internalRoot=e}xo.prototype.unstable_scheduleHydration=function(e){if(e){var n=ut();e={blockedOn:null,target:e,priority:n};for(var l=0;l<ta.length&&n!==0&&n<ta[l].priority;l++);ta.splice(l,0,e),l===0&&Sx(e)}};var Ex=a.version;if(Ex!=="19.2.4")throw Error(o(527,Ex,"19.2.4"));O.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=m(n),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var d0={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var go=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!go.isDisabled&&go.supportsFiber)try{Mn=go.inject(d0),Ut=go}catch{}}return Ms.createRoot=function(e,n){if(!c(e))throw Error(o(299));var l=!1,i="",f=zm,x=Dm,j=_m;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(x=n.onCaughtError),n.onRecoverableError!==void 0&&(j=n.onRecoverableError)),n=mx(e,1,!1,null,null,l,i,null,f,x,j,Cx),e[xa]=n.current,Fu(e),new cd(n)},Ms.hydrateRoot=function(e,n,l){if(!c(e))throw Error(o(299));var i=!1,f="",x=zm,j=Dm,R=_m,V=null;return l!=null&&(l.unstable_strictMode===!0&&(i=!0),l.identifierPrefix!==void 0&&(f=l.identifierPrefix),l.onUncaughtError!==void 0&&(x=l.onUncaughtError),l.onCaughtError!==void 0&&(j=l.onCaughtError),l.onRecoverableError!==void 0&&(R=l.onRecoverableError),l.formState!==void 0&&(V=l.formState)),n=mx(e,1,!0,n,l??null,i,f,V,x,j,R,Cx),n.context=hx(null),l=n.current,i=wn(),i=Ga(i),f=Hr(i),f.callback=null,$r(l,f,i),l=i,n.current.lanes=l,fa(n,l),ir(n),e[xa]=n.current,Fu(e),new xo(n)},Ms.version="19.2.4",Ms}var Ox;function b0(){if(Ox)return fd.exports;Ox=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(a){console.error(a)}}return t(),fd.exports=y0(),fd.exports}var j0=b0();/**
|
|
49
|
+
`+i.stack}}var lt=Object.prototype.hasOwnProperty,Ct=t.unstable_scheduleCallback,gt=t.unstable_cancelCallback,Tt=t.unstable_shouldYield,Gt=t.unstable_requestPaint,We=t.unstable_now,nt=t.unstable_getCurrentPriorityLevel,xn=t.unstable_ImmediatePriority,ye=t.unstable_UserBlockingPriority,ot=t.unstable_NormalPriority,Wt=t.unstable_LowPriority,Kt=t.unstable_IdlePriority,An=t.log,Et=t.unstable_setDisableYieldValue,Mn=null,Ut=null;function Rt(e){if(typeof An=="function"&&Et(e),Ut&&typeof Ut.setStrictMode=="function")try{Ut.setStrictMode(Mn,e)}catch{}}var ct=Math.clz32?Math.clz32:da,Wn=Math.log,tr=Math.LN2;function da(e){return e>>>=0,e===0?32:31-(Wn(e)/tr|0)|0}var gn=256,Nt=262144,Le=4194304;function se(e){var n=e&42;if(n!==0)return n;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 Se(e,n,l){var i=e.pendingLanes;if(i===0)return 0;var f=0,x=e.suspendedLanes,j=e.pingedLanes;e=e.warmLanes;var R=i&134217727;return R!==0?(i=R&~x,i!==0?f=se(i):(j&=R,j!==0?f=se(j):l||(l=R&~e,l!==0&&(f=se(l))))):(R=i&~x,R!==0?f=se(R):j!==0?f=se(j):l||(l=i&~e,l!==0&&(f=se(l)))),f===0?0:n!==0&&n!==f&&(n&x)===0&&(x=f&-f,l=n&-n,x>=l||x===32&&(l&4194048)!==0)?n:f}function Me(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function Fa(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 qn(){var e=Le;return Le<<=1,(Le&62914560)===0&&(Le=4194304),e}function Ul(e){for(var n=[],l=0;31>l;l++)n.push(e);return n}function fa(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Hl(e,n,l,i,f,x){var j=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var R=e.entanglements,V=e.expirationTimes,J=e.hiddenUpdates;for(l=j&~l;0<l;){var ie=31-ct(l),fe=1<<ie;R[ie]=0,V[ie]=-1;var te=J[ie];if(te!==null)for(J[ie]=null,ie=0;ie<te.length;ie++){var re=te[ie];re!==null&&(re.lane&=-536870913)}l&=~fe}i!==0&&nr(e,i,0),x!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=x&~(j&~n))}function nr(e,n,l){e.pendingLanes|=n,e.suspendedLanes&=~n;var i=31-ct(n);e.entangledLanes|=n,e.entanglements[i]=e.entanglements[i]|1073741824|l&261930}function pa(e,n){var l=e.entangledLanes|=n;for(e=e.entanglements;l;){var i=31-ct(l),f=1<<i;f&n|e[i]&n&&(e[i]|=n),l&=~f}}function ma(e,n){var l=n&-n;return l=(l&42)!==0?1:Ga(l),(l&(e.suspendedLanes|n))!==0?0:l}function Ga(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 zr(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ut(){var e=O.p;return e!==0?e:(e=window.event,e===void 0?32:jx(e.type))}function ha(e,n){var l=O.p;try{return O.p=e,n()}finally{O.p=l}}var an=Math.random().toString(36).slice(2),Ht="__reactFiber$"+an,dt="__reactProps$"+an,xa="__reactContainer$"+an,rr="__reactEvents$"+an,tc="__reactListeners$"+an,lb="__reactHandles$"+an,If="__reactResources$"+an,$l="__reactMarker$"+an;function nc(e){delete e[Ht],delete e[dt],delete e[rr],delete e[tc],delete e[lb]}function Wa(e){var n=e[Ht];if(n)return n;for(var l=e.parentNode;l;){if(n=l[xa]||l[Ht]){if(l=n.alternate,n.child!==null||l!==null&&l.child!==null)for(e=lx(e);e!==null;){if(l=e[Ht])return l;e=lx(e)}return n}e=l,l=e.parentNode}return null}function qa(e){if(e=e[Ht]||e[xa]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Vl(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(o(33))}function Ya(e){var n=e[If];return n||(n=e[If]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function qt(e){e[$l]=!0}var Uf=new Set,Hf={};function ga(e,n){Ka(e,n),Ka(e+"Capture",n)}function Ka(e,n){for(Hf[e]=n,e=0;e<n.length;e++)Uf.add(n[e])}var sb=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),$f={},Vf={};function ib(e){return lt.call(Vf,e)?!0:lt.call($f,e)?!1:sb.test(e)?Vf[e]=!0:($f[e]=!0,!1)}function li(e,n,l){if(ib(n))if(l===null)e.removeAttribute(n);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var i=n.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+l)}}function si(e,n,l){if(l===null)e.removeAttribute(n);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+l)}}function fr(e,n,l,i){if(i===null)e.removeAttribute(l);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(n,l,""+i)}}function Ln(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Pf(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function ob(e,n,l){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var f=i.get,x=i.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(j){l=""+j,x.call(this,j)}}),Object.defineProperty(e,n,{enumerable:i.enumerable}),{getValue:function(){return l},setValue:function(j){l=""+j},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function rc(e){if(!e._valueTracker){var n=Pf(e)?"checked":"value";e._valueTracker=ob(e,n,""+e[n])}}function Ff(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var l=n.getValue(),i="";return e&&(i=Pf(e)?e.checked?"true":"false":e.value),e=i,e!==l?(n.setValue(e),!0):!1}function ii(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 cb=/[\n"\\]/g;function zn(e){return e.replace(cb,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function ac(e,n,l,i,f,x,j,R){e.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?e.type=j:e.removeAttribute("type"),n!=null?j==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Ln(n)):e.value!==""+Ln(n)&&(e.value=""+Ln(n)):j!=="submit"&&j!=="reset"||e.removeAttribute("value"),n!=null?lc(e,j,Ln(n)):l!=null?lc(e,j,Ln(l)):i!=null&&e.removeAttribute("value"),f==null&&x!=null&&(e.defaultChecked=!!x),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?e.name=""+Ln(R):e.removeAttribute("name")}function Gf(e,n,l,i,f,x,j,R){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.type=x),n!=null||l!=null){if(!(x!=="submit"&&x!=="reset"||n!=null)){rc(e);return}l=l!=null?""+Ln(l):"",n=n!=null?""+Ln(n):l,R||n===e.value||(e.value=n),e.defaultValue=n}i=i??f,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=R?e.checked:!!i,e.defaultChecked=!!i,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(e.name=j),rc(e)}function lc(e,n,l){n==="number"&&ii(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Xa(e,n,l,i){if(e=e.options,n){n={};for(var f=0;f<l.length;f++)n["$"+l[f]]=!0;for(l=0;l<e.length;l++)f=n.hasOwnProperty("$"+e[l].value),e[l].selected!==f&&(e[l].selected=f),f&&i&&(e[l].defaultSelected=!0)}else{for(l=""+Ln(l),n=null,f=0;f<e.length;f++){if(e[f].value===l){e[f].selected=!0,i&&(e[f].defaultSelected=!0);return}n!==null||e[f].disabled||(n=e[f])}n!==null&&(n.selected=!0)}}function Wf(e,n,l){if(n!=null&&(n=""+Ln(n),n!==e.value&&(e.value=n),l==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=l!=null?""+Ln(l):""}function qf(e,n,l,i){if(n==null){if(i!=null){if(l!=null)throw Error(o(92));if(I(i)){if(1<i.length)throw Error(o(93));i=i[0]}l=i}l==null&&(l=""),n=l}l=Ln(n),e.defaultValue=l,i=e.textContent,i===l&&i!==""&&i!==null&&(e.value=i),rc(e)}function Qa(e,n){if(n){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=n;return}}e.textContent=n}var ub=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 Yf(e,n,l){var i=n.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?i?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":i?e.setProperty(n,l):typeof l!="number"||l===0||ub.has(n)?n==="float"?e.cssFloat=l:e[n]=(""+l).trim():e[n]=l+"px"}function Kf(e,n,l){if(n!=null&&typeof n!="object")throw Error(o(62));if(e=e.style,l!=null){for(var i in l)!l.hasOwnProperty(i)||n!=null&&n.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="");for(var f in n)i=n[f],n.hasOwnProperty(f)&&l[f]!==i&&Yf(e,f,i)}else for(var x in n)n.hasOwnProperty(x)&&Yf(e,x,n[x])}function sc(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 db=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"]]),fb=/^[\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 oi(e){return fb.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function pr(){}var ic=null;function oc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Za=null,Ja=null;function Xf(e){var n=qa(e);if(n&&(e=n.stateNode)){var l=e[dt]||null;e:switch(e=n.stateNode,n.type){case"input":if(ac(e,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),n=l.name,l.type==="radio"&&n!=null){for(l=e;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+zn(""+n)+'"][type="radio"]'),n=0;n<l.length;n++){var i=l[n];if(i!==e&&i.form===e.form){var f=i[dt]||null;if(!f)throw Error(o(90));ac(i,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(n=0;n<l.length;n++)i=l[n],i.form===e.form&&Ff(i)}break e;case"textarea":Wf(e,l.value,l.defaultValue);break e;case"select":n=l.value,n!=null&&Xa(e,!!l.multiple,n,!1)}}}var cc=!1;function Qf(e,n,l){if(cc)return e(n,l);cc=!0;try{var i=e(n);return i}finally{if(cc=!1,(Za!==null||Ja!==null)&&(Ki(),Za&&(n=Za,e=Ja,Ja=Za=null,Xf(n),e)))for(n=0;n<e.length;n++)Xf(e[n])}}function Pl(e,n){var l=e.stateNode;if(l===null)return null;var i=l[dt]||null;if(i===null)return null;l=i[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(o(231,n,typeof l));return l}var mr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),uc=!1;if(mr)try{var Fl={};Object.defineProperty(Fl,"passive",{get:function(){uc=!0}}),window.addEventListener("test",Fl,Fl),window.removeEventListener("test",Fl,Fl)}catch{uc=!1}var Dr=null,dc=null,ci=null;function Zf(){if(ci)return ci;var e,n=dc,l=n.length,i,f="value"in Dr?Dr.value:Dr.textContent,x=f.length;for(e=0;e<l&&n[e]===f[e];e++);var j=l-e;for(i=1;i<=j&&n[l-i]===f[x-i];i++);return ci=f.slice(e,1<i?1-i:void 0)}function ui(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function di(){return!0}function Jf(){return!1}function un(e){function n(l,i,f,x,j){this._reactName=l,this._targetInst=f,this.type=i,this.nativeEvent=x,this.target=j,this.currentTarget=null;for(var R in e)e.hasOwnProperty(R)&&(l=e[R],this[R]=l?l(x):x[R]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?di:Jf,this.isPropagationStopped=Jf,this}return v(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=di)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=di)},persist:function(){},isPersistent:di}),n}var va={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fi=un(va),Gl=v({},va,{view:0,detail:0}),pb=un(Gl),fc,pc,Wl,pi=v({},Gl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:hc,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!==Wl&&(Wl&&e.type==="mousemove"?(fc=e.screenX-Wl.screenX,pc=e.screenY-Wl.screenY):pc=fc=0,Wl=e),fc)},movementY:function(e){return"movementY"in e?e.movementY:pc}}),ep=un(pi),mb=v({},pi,{dataTransfer:0}),hb=un(mb),xb=v({},Gl,{relatedTarget:0}),mc=un(xb),gb=v({},va,{animationName:0,elapsedTime:0,pseudoElement:0}),vb=un(gb),yb=v({},va,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),bb=un(yb),jb=v({},va,{data:0}),tp=un(jb),Sb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},kb={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"},wb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Cb(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=wb[e])?!!n[e]:!1}function hc(){return Cb}var Eb=v({},Gl,{key:function(e){if(e.key){var n=Sb[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=ui(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?kb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:hc,charCode:function(e){return e.type==="keypress"?ui(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ui(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Nb=un(Eb),Tb=v({},pi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),np=un(Tb),Rb=v({},Gl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:hc}),Ab=un(Rb),Mb=v({},va,{propertyName:0,elapsedTime:0,pseudoElement:0}),Lb=un(Mb),zb=v({},pi,{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}),Db=un(zb),_b=v({},va,{newState:0,oldState:0}),Ob=un(_b),Bb=[9,13,27,32],xc=mr&&"CompositionEvent"in window,ql=null;mr&&"documentMode"in document&&(ql=document.documentMode);var Ib=mr&&"TextEvent"in window&&!ql,rp=mr&&(!xc||ql&&8<ql&&11>=ql),ap=" ",lp=!1;function sp(e,n){switch(e){case"keyup":return Bb.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ip(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var el=!1;function Ub(e,n){switch(e){case"compositionend":return ip(n);case"keypress":return n.which!==32?null:(lp=!0,ap);case"textInput":return e=n.data,e===ap&&lp?null:e;default:return null}}function Hb(e,n){if(el)return e==="compositionend"||!xc&&sp(e,n)?(e=Zf(),ci=dc=Dr=null,el=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return rp&&n.locale!=="ko"?null:n.data;default:return null}}var $b={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 op(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!$b[e.type]:n==="textarea"}function cp(e,n,l,i){Za?Ja?Ja.push(i):Ja=[i]:Za=i,n=no(n,"onChange"),0<n.length&&(l=new fi("onChange","change",null,l,i),e.push({event:l,listeners:n}))}var Yl=null,Kl=null;function Vb(e){Gh(e,0)}function mi(e){var n=Vl(e);if(Ff(n))return e}function up(e,n){if(e==="change")return n}var dp=!1;if(mr){var gc;if(mr){var vc="oninput"in document;if(!vc){var fp=document.createElement("div");fp.setAttribute("oninput","return;"),vc=typeof fp.oninput=="function"}gc=vc}else gc=!1;dp=gc&&(!document.documentMode||9<document.documentMode)}function pp(){Yl&&(Yl.detachEvent("onpropertychange",mp),Kl=Yl=null)}function mp(e){if(e.propertyName==="value"&&mi(Kl)){var n=[];cp(n,Kl,e,oc(e)),Qf(Vb,n)}}function Pb(e,n,l){e==="focusin"?(pp(),Yl=n,Kl=l,Yl.attachEvent("onpropertychange",mp)):e==="focusout"&&pp()}function Fb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return mi(Kl)}function Gb(e,n){if(e==="click")return mi(n)}function Wb(e,n){if(e==="input"||e==="change")return mi(n)}function qb(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var vn=typeof Object.is=="function"?Object.is:qb;function Xl(e,n){if(vn(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var l=Object.keys(e),i=Object.keys(n);if(l.length!==i.length)return!1;for(i=0;i<l.length;i++){var f=l[i];if(!lt.call(n,f)||!vn(e[f],n[f]))return!1}return!0}function hp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function xp(e,n){var l=hp(e);e=0;for(var i;l;){if(l.nodeType===3){if(i=e+l.textContent.length,e<=n&&i>=n)return{node:l,offset:n-e};e=i}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=hp(l)}}function gp(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?gp(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function vp(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=ii(e.document);n instanceof e.HTMLIFrameElement;){try{var l=typeof n.contentWindow.location.href=="string"}catch{l=!1}if(l)e=n.contentWindow;else break;n=ii(e.document)}return n}function yc(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var Yb=mr&&"documentMode"in document&&11>=document.documentMode,tl=null,bc=null,Ql=null,jc=!1;function yp(e,n,l){var i=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;jc||tl==null||tl!==ii(i)||(i=tl,"selectionStart"in i&&yc(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Ql&&Xl(Ql,i)||(Ql=i,i=no(bc,"onSelect"),0<i.length&&(n=new fi("onSelect","select",null,n,l),e.push({event:n,listeners:i}),n.target=tl)))}function ya(e,n){var l={};return l[e.toLowerCase()]=n.toLowerCase(),l["Webkit"+e]="webkit"+n,l["Moz"+e]="moz"+n,l}var nl={animationend:ya("Animation","AnimationEnd"),animationiteration:ya("Animation","AnimationIteration"),animationstart:ya("Animation","AnimationStart"),transitionrun:ya("Transition","TransitionRun"),transitionstart:ya("Transition","TransitionStart"),transitioncancel:ya("Transition","TransitionCancel"),transitionend:ya("Transition","TransitionEnd")},Sc={},bp={};mr&&(bp=document.createElement("div").style,"AnimationEvent"in window||(delete nl.animationend.animation,delete nl.animationiteration.animation,delete nl.animationstart.animation),"TransitionEvent"in window||delete nl.transitionend.transition);function ba(e){if(Sc[e])return Sc[e];if(!nl[e])return e;var n=nl[e],l;for(l in n)if(n.hasOwnProperty(l)&&l in bp)return Sc[e]=n[l];return e}var jp=ba("animationend"),Sp=ba("animationiteration"),kp=ba("animationstart"),Kb=ba("transitionrun"),Xb=ba("transitionstart"),Qb=ba("transitioncancel"),wp=ba("transitionend"),Cp=new Map,kc="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(" ");kc.push("scrollEnd");function Yn(e,n){Cp.set(e,n),ga(n,[e])}var hi=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=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(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Dn=[],rl=0,wc=0;function xi(){for(var e=rl,n=wc=rl=0;n<e;){var l=Dn[n];Dn[n++]=null;var i=Dn[n];Dn[n++]=null;var f=Dn[n];Dn[n++]=null;var x=Dn[n];if(Dn[n++]=null,i!==null&&f!==null){var j=i.pending;j===null?f.next=f:(f.next=j.next,j.next=f),i.pending=f}x!==0&&Ep(l,f,x)}}function gi(e,n,l,i){Dn[rl++]=e,Dn[rl++]=n,Dn[rl++]=l,Dn[rl++]=i,wc|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function Cc(e,n,l,i){return gi(e,n,l,i),vi(e)}function ja(e,n){return gi(e,null,null,n),vi(e)}function Ep(e,n,l){e.lanes|=l;var i=e.alternate;i!==null&&(i.lanes|=l);for(var f=!1,x=e.return;x!==null;)x.childLanes|=l,i=x.alternate,i!==null&&(i.childLanes|=l),x.tag===22&&(e=x.stateNode,e===null||e._visibility&1||(f=!0)),e=x,x=x.return;return e.tag===3?(x=e.stateNode,f&&n!==null&&(f=31-ct(l),e=x.hiddenUpdates,i=e[f],i===null?e[f]=[n]:i.push(n),n.lane=l|536870912),x):null}function vi(e){if(50<ys)throw ys=0,Du=null,Error(o(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var al={};function Zb(e,n,l,i){this.tag=e,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yn(e,n,l,i){return new Zb(e,n,l,i)}function Ec(e){return e=e.prototype,!(!e||!e.isReactComponent)}function hr(e,n){var l=e.alternate;return l===null?(l=yn(e.tag,n,e.key,e.mode),l.elementType=e.elementType,l.type=e.type,l.stateNode=e.stateNode,l.alternate=e,e.alternate=l):(l.pendingProps=n,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,n=e.dependencies,l.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},l.sibling=e.sibling,l.index=e.index,l.ref=e.ref,l.refCleanup=e.refCleanup,l}function Np(e,n){e.flags&=65011714;var l=e.alternate;return l===null?(e.childLanes=0,e.lanes=n,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,n=l.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function yi(e,n,l,i,f,x){var j=0;if(i=e,typeof e=="function")Ec(e)&&(j=1);else if(typeof e=="string")j=r0(e,l,Q.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case L:return e=yn(31,l,n,f),e.elementType=L,e.lanes=x,e;case w:return Sa(l.children,f,x,n);case C:j=8,f|=24;break;case T:return e=yn(12,l,n,f|2),e.elementType=T,e.lanes=x,e;case D:return e=yn(13,l,n,f),e.elementType=D,e.lanes=x,e;case F:return e=yn(19,l,n,f),e.elementType=F,e.lanes=x,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case A:j=10;break e;case N:j=9;break e;case _:j=11;break e;case E:j=14;break e;case B:j=16,i=null;break e}j=29,l=Error(o(130,e===null?"null":typeof e,"")),i=null}return n=yn(j,l,n,f),n.elementType=e,n.type=i,n.lanes=x,n}function Sa(e,n,l,i){return e=yn(7,e,i,n),e.lanes=l,e}function Nc(e,n,l){return e=yn(6,e,null,n),e.lanes=l,e}function Tp(e){var n=yn(18,null,null,0);return n.stateNode=e,n}function Tc(e,n,l){return n=yn(4,e.children!==null?e.children:[],e.key,n),n.lanes=l,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Rp=new WeakMap;function _n(e,n){if(typeof e=="object"&&e!==null){var l=Rp.get(e);return l!==void 0?l:(n={value:e,source:n,stack:Ue(n)},Rp.set(e,n),n)}return{value:e,source:n,stack:Ue(n)}}var ll=[],sl=0,bi=null,Zl=0,On=[],Bn=0,_r=null,ar=1,lr="";function xr(e,n){ll[sl++]=Zl,ll[sl++]=bi,bi=e,Zl=n}function Ap(e,n,l){On[Bn++]=ar,On[Bn++]=lr,On[Bn++]=_r,_r=e;var i=ar;e=lr;var f=32-ct(i)-1;i&=~(1<<f),l+=1;var x=32-ct(n)+f;if(30<x){var j=f-f%5;x=(i&(1<<j)-1).toString(32),i>>=j,f-=j,ar=1<<32-ct(n)+f|l<<f|i,lr=x+e}else ar=1<<x|l<<f|i,lr=e}function Rc(e){e.return!==null&&(xr(e,1),Ap(e,1,0))}function Ac(e){for(;e===bi;)bi=ll[--sl],ll[sl]=null,Zl=ll[--sl],ll[sl]=null;for(;e===_r;)_r=On[--Bn],On[Bn]=null,lr=On[--Bn],On[Bn]=null,ar=On[--Bn],On[Bn]=null}function Mp(e,n){On[Bn++]=ar,On[Bn++]=lr,On[Bn++]=_r,ar=n.id,lr=n.overflow,_r=e}var Xt=null,vt=null,Qe=!1,Or=null,In=!1,Mc=Error(o(519));function Br(e){var n=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Jl(_n(n,e)),Mc}function Lp(e){var n=e.stateNode,l=e.type,i=e.memoizedProps;switch(n[Ht]=e,n[dt]=i,l){case"dialog":Ye("cancel",n),Ye("close",n);break;case"iframe":case"object":case"embed":Ye("load",n);break;case"video":case"audio":for(l=0;l<js.length;l++)Ye(js[l],n);break;case"source":Ye("error",n);break;case"img":case"image":case"link":Ye("error",n),Ye("load",n);break;case"details":Ye("toggle",n);break;case"input":Ye("invalid",n),Gf(n,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":Ye("invalid",n);break;case"textarea":Ye("invalid",n),qf(n,i.value,i.defaultValue,i.children)}l=i.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||n.textContent===""+l||i.suppressHydrationWarning===!0||Kh(n.textContent,l)?(i.popover!=null&&(Ye("beforetoggle",n),Ye("toggle",n)),i.onScroll!=null&&Ye("scroll",n),i.onScrollEnd!=null&&Ye("scrollend",n),i.onClick!=null&&(n.onclick=pr),n=!0):n=!1,n||Br(e,!0)}function zp(e){for(Xt=e.return;Xt;)switch(Xt.tag){case 5:case 31:case 13:In=!1;return;case 27:case 3:In=!0;return;default:Xt=Xt.return}}function il(e){if(e!==Xt)return!1;if(!Qe)return zp(e),Qe=!0,!1;var n=e.tag,l;if((l=n!==3&&n!==27)&&((l=n===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||Ku(e.type,e.memoizedProps)),l=!l),l&&vt&&Br(e),zp(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));vt=ax(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));vt=ax(e)}else n===27?(n=vt,Qr(e.type)?(e=ed,ed=null,vt=e):vt=n):vt=Xt?Hn(e.stateNode.nextSibling):null;return!0}function ka(){vt=Xt=null,Qe=!1}function Lc(){var e=Or;return e!==null&&(mn===null?mn=e:mn.push.apply(mn,e),Or=null),e}function Jl(e){Or===null?Or=[e]:Or.push(e)}var zc=M(null),wa=null,gr=null;function Ir(e,n,l){W(zc,n._currentValue),n._currentValue=l}function vr(e){e._currentValue=zc.current,Y(zc)}function Dc(e,n,l){for(;e!==null;){var i=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,i!==null&&(i.childLanes|=n)):i!==null&&(i.childLanes&n)!==n&&(i.childLanes|=n),e===l)break;e=e.return}}function _c(e,n,l,i){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var x=f.dependencies;if(x!==null){var j=f.child;x=x.firstContext;e:for(;x!==null;){var R=x;x=f;for(var V=0;V<n.length;V++)if(R.context===n[V]){x.lanes|=l,R=x.alternate,R!==null&&(R.lanes|=l),Dc(x.return,l,e),i||(j=null);break e}x=R.next}}else if(f.tag===18){if(j=f.return,j===null)throw Error(o(341));j.lanes|=l,x=j.alternate,x!==null&&(x.lanes|=l),Dc(j,l,e),j=null}else j=f.child;if(j!==null)j.return=f;else for(j=f;j!==null;){if(j===e){j=null;break}if(f=j.sibling,f!==null){f.return=j.return,j=f;break}j=j.return}f=j}}function ol(e,n,l,i){e=null;for(var f=n,x=!1;f!==null;){if(!x){if((f.flags&524288)!==0)x=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var j=f.alternate;if(j===null)throw Error(o(387));if(j=j.memoizedProps,j!==null){var R=f.type;vn(f.pendingProps.value,j.value)||(e!==null?e.push(R):e=[R])}}else if(f===ve.current){if(j=f.alternate,j===null)throw Error(o(387));j.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(Es):e=[Es])}f=f.return}e!==null&&_c(n,e,l,i),n.flags|=262144}function ji(e){for(e=e.firstContext;e!==null;){if(!vn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ca(e){wa=e,gr=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Qt(e){return Dp(wa,e)}function Si(e,n){return wa===null&&Ca(e),Dp(e,n)}function Dp(e,n){var l=n._currentValue;if(n={context:n,memoizedValue:l,next:null},gr===null){if(e===null)throw Error(o(308));gr=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else gr=gr.next=n;return l}var Jb=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(l,i){e.push(i)}};this.abort=function(){n.aborted=!0,e.forEach(function(l){return l()})}},e1=t.unstable_scheduleCallback,t1=t.unstable_NormalPriority,Dt={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Oc(){return{controller:new Jb,data:new Map,refCount:0}}function es(e){e.refCount--,e.refCount===0&&e1(t1,function(){e.controller.abort()})}var ts=null,Bc=0,cl=0,ul=null;function n1(e,n){if(ts===null){var l=ts=[];Bc=0,cl=Hu(),ul={status:"pending",value:void 0,then:function(i){l.push(i)}}}return Bc++,n.then(_p,_p),n}function _p(){if(--Bc===0&&ts!==null){ul!==null&&(ul.status="fulfilled");var e=ts;ts=null,cl=0,ul=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function r1(e,n){var l=[],i={status:"pending",value:null,reason:null,then:function(f){l.push(f)}};return e.then(function(){i.status="fulfilled",i.value=n;for(var f=0;f<l.length;f++)(0,l[f])(n)},function(f){for(i.status="rejected",i.reason=f,f=0;f<l.length;f++)(0,l[f])(void 0)}),i}var Op=z.S;z.S=function(e,n){yh=We(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&n1(e,n),Op!==null&&Op(e,n)};var Ea=M(null);function Ic(){var e=Ea.current;return e!==null?e:xt.pooledCache}function ki(e,n){n===null?W(Ea,Ea.current):W(Ea,n.pool)}function Bp(){var e=Ic();return e===null?null:{parent:Dt._currentValue,pool:e}}var dl=Error(o(460)),Uc=Error(o(474)),wi=Error(o(542)),Ci={then:function(){}};function Ip(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Up(e,n,l){switch(l=e[l],l===void 0?e.push(n):l!==n&&(n.then(pr,pr),n=l),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,$p(e),e;default:if(typeof n.status=="string")n.then(pr,pr);else{if(e=xt,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=n,e.status="pending",e.then(function(i){if(n.status==="pending"){var f=n;f.status="fulfilled",f.value=i}},function(i){if(n.status==="pending"){var f=n;f.status="rejected",f.reason=i}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,$p(e),e}throw Ta=n,dl}}function Na(e){try{var n=e._init;return n(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Ta=l,dl):l}}var Ta=null;function Hp(){if(Ta===null)throw Error(o(459));var e=Ta;return Ta=null,e}function $p(e){if(e===dl||e===wi)throw Error(o(483))}var fl=null,ns=0;function Ei(e){var n=ns;return ns+=1,fl===null&&(fl=[]),Up(fl,e,n)}function rs(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Ni(e,n){throw n.$$typeof===b?Error(o(525)):(e=Object.prototype.toString.call(n),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function Vp(e){function n(K,G){if(e){var Z=K.deletions;Z===null?(K.deletions=[G],K.flags|=16):Z.push(G)}}function l(K,G){if(!e)return null;for(;G!==null;)n(K,G),G=G.sibling;return null}function i(K){for(var G=new Map;K!==null;)K.key!==null?G.set(K.key,K):G.set(K.index,K),K=K.sibling;return G}function f(K,G){return K=hr(K,G),K.index=0,K.sibling=null,K}function x(K,G,Z){return K.index=Z,e?(Z=K.alternate,Z!==null?(Z=Z.index,Z<G?(K.flags|=67108866,G):Z):(K.flags|=67108866,G)):(K.flags|=1048576,G)}function j(K){return e&&K.alternate===null&&(K.flags|=67108866),K}function R(K,G,Z,ue){return G===null||G.tag!==6?(G=Nc(Z,K.mode,ue),G.return=K,G):(G=f(G,Z),G.return=K,G)}function V(K,G,Z,ue){var Ae=Z.type;return Ae===w?ie(K,G,Z.props.children,ue,Z.key):G!==null&&(G.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===B&&Na(Ae)===G.type)?(G=f(G,Z.props),rs(G,Z),G.return=K,G):(G=yi(Z.type,Z.key,Z.props,null,K.mode,ue),rs(G,Z),G.return=K,G)}function J(K,G,Z,ue){return G===null||G.tag!==4||G.stateNode.containerInfo!==Z.containerInfo||G.stateNode.implementation!==Z.implementation?(G=Tc(Z,K.mode,ue),G.return=K,G):(G=f(G,Z.children||[]),G.return=K,G)}function ie(K,G,Z,ue,Ae){return G===null||G.tag!==7?(G=Sa(Z,K.mode,ue,Ae),G.return=K,G):(G=f(G,Z),G.return=K,G)}function fe(K,G,Z){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=Nc(""+G,K.mode,Z),G.return=K,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case S:return Z=yi(G.type,G.key,G.props,null,K.mode,Z),rs(Z,G),Z.return=K,Z;case k:return G=Tc(G,K.mode,Z),G.return=K,G;case B:return G=Na(G),fe(K,G,Z)}if(I(G)||q(G))return G=Sa(G,K.mode,Z,null),G.return=K,G;if(typeof G.then=="function")return fe(K,Ei(G),Z);if(G.$$typeof===A)return fe(K,Si(K,G),Z);Ni(K,G)}return null}function te(K,G,Z,ue){var Ae=G!==null?G.key:null;if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return Ae!==null?null:R(K,G,""+Z,ue);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case S:return Z.key===Ae?V(K,G,Z,ue):null;case k:return Z.key===Ae?J(K,G,Z,ue):null;case B:return Z=Na(Z),te(K,G,Z,ue)}if(I(Z)||q(Z))return Ae!==null?null:ie(K,G,Z,ue,null);if(typeof Z.then=="function")return te(K,G,Ei(Z),ue);if(Z.$$typeof===A)return te(K,G,Si(K,Z),ue);Ni(K,Z)}return null}function re(K,G,Z,ue,Ae){if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return K=K.get(Z)||null,R(G,K,""+ue,Ae);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case S:return K=K.get(ue.key===null?Z:ue.key)||null,V(G,K,ue,Ae);case k:return K=K.get(ue.key===null?Z:ue.key)||null,J(G,K,ue,Ae);case B:return ue=Na(ue),re(K,G,Z,ue,Ae)}if(I(ue)||q(ue))return K=K.get(Z)||null,ie(G,K,ue,Ae,null);if(typeof ue.then=="function")return re(K,G,Z,Ei(ue),Ae);if(ue.$$typeof===A)return re(K,G,Z,Si(G,ue),Ae);Ni(G,ue)}return null}function Ce(K,G,Z,ue){for(var Ae=null,Je=null,Ee=G,Pe=G=0,Xe=null;Ee!==null&&Pe<Z.length;Pe++){Ee.index>Pe?(Xe=Ee,Ee=null):Xe=Ee.sibling;var et=te(K,Ee,Z[Pe],ue);if(et===null){Ee===null&&(Ee=Xe);break}e&&Ee&&et.alternate===null&&n(K,Ee),G=x(et,G,Pe),Je===null?Ae=et:Je.sibling=et,Je=et,Ee=Xe}if(Pe===Z.length)return l(K,Ee),Qe&&xr(K,Pe),Ae;if(Ee===null){for(;Pe<Z.length;Pe++)Ee=fe(K,Z[Pe],ue),Ee!==null&&(G=x(Ee,G,Pe),Je===null?Ae=Ee:Je.sibling=Ee,Je=Ee);return Qe&&xr(K,Pe),Ae}for(Ee=i(Ee);Pe<Z.length;Pe++)Xe=re(Ee,K,Pe,Z[Pe],ue),Xe!==null&&(e&&Xe.alternate!==null&&Ee.delete(Xe.key===null?Pe:Xe.key),G=x(Xe,G,Pe),Je===null?Ae=Xe:Je.sibling=Xe,Je=Xe);return e&&Ee.forEach(function(na){return n(K,na)}),Qe&&xr(K,Pe),Ae}function ze(K,G,Z,ue){if(Z==null)throw Error(o(151));for(var Ae=null,Je=null,Ee=G,Pe=G=0,Xe=null,et=Z.next();Ee!==null&&!et.done;Pe++,et=Z.next()){Ee.index>Pe?(Xe=Ee,Ee=null):Xe=Ee.sibling;var na=te(K,Ee,et.value,ue);if(na===null){Ee===null&&(Ee=Xe);break}e&&Ee&&na.alternate===null&&n(K,Ee),G=x(na,G,Pe),Je===null?Ae=na:Je.sibling=na,Je=na,Ee=Xe}if(et.done)return l(K,Ee),Qe&&xr(K,Pe),Ae;if(Ee===null){for(;!et.done;Pe++,et=Z.next())et=fe(K,et.value,ue),et!==null&&(G=x(et,G,Pe),Je===null?Ae=et:Je.sibling=et,Je=et);return Qe&&xr(K,Pe),Ae}for(Ee=i(Ee);!et.done;Pe++,et=Z.next())et=re(Ee,K,Pe,et.value,ue),et!==null&&(e&&et.alternate!==null&&Ee.delete(et.key===null?Pe:et.key),G=x(et,G,Pe),Je===null?Ae=et:Je.sibling=et,Je=et);return e&&Ee.forEach(function(m0){return n(K,m0)}),Qe&&xr(K,Pe),Ae}function mt(K,G,Z,ue){if(typeof Z=="object"&&Z!==null&&Z.type===w&&Z.key===null&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case S:e:{for(var Ae=Z.key;G!==null;){if(G.key===Ae){if(Ae=Z.type,Ae===w){if(G.tag===7){l(K,G.sibling),ue=f(G,Z.props.children),ue.return=K,K=ue;break e}}else if(G.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===B&&Na(Ae)===G.type){l(K,G.sibling),ue=f(G,Z.props),rs(ue,Z),ue.return=K,K=ue;break e}l(K,G);break}else n(K,G);G=G.sibling}Z.type===w?(ue=Sa(Z.props.children,K.mode,ue,Z.key),ue.return=K,K=ue):(ue=yi(Z.type,Z.key,Z.props,null,K.mode,ue),rs(ue,Z),ue.return=K,K=ue)}return j(K);case k:e:{for(Ae=Z.key;G!==null;){if(G.key===Ae)if(G.tag===4&&G.stateNode.containerInfo===Z.containerInfo&&G.stateNode.implementation===Z.implementation){l(K,G.sibling),ue=f(G,Z.children||[]),ue.return=K,K=ue;break e}else{l(K,G);break}else n(K,G);G=G.sibling}ue=Tc(Z,K.mode,ue),ue.return=K,K=ue}return j(K);case B:return Z=Na(Z),mt(K,G,Z,ue)}if(I(Z))return Ce(K,G,Z,ue);if(q(Z)){if(Ae=q(Z),typeof Ae!="function")throw Error(o(150));return Z=Ae.call(Z),ze(K,G,Z,ue)}if(typeof Z.then=="function")return mt(K,G,Ei(Z),ue);if(Z.$$typeof===A)return mt(K,G,Si(K,Z),ue);Ni(K,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint"?(Z=""+Z,G!==null&&G.tag===6?(l(K,G.sibling),ue=f(G,Z),ue.return=K,K=ue):(l(K,G),ue=Nc(Z,K.mode,ue),ue.return=K,K=ue),j(K)):l(K,G)}return function(K,G,Z,ue){try{ns=0;var Ae=mt(K,G,Z,ue);return fl=null,Ae}catch(Ee){if(Ee===dl||Ee===wi)throw Ee;var Je=yn(29,Ee,null,K.mode);return Je.lanes=ue,Je.return=K,Je}finally{}}}var Ra=Vp(!0),Pp=Vp(!1),Ur=!1;function Hc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function $c(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Hr(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function $r(e,n,l){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(rt&2)!==0){var f=i.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),i.pending=n,n=vi(e),Ep(e,null,l),n}return gi(e,i,n,l),vi(e)}function as(e,n,l){if(n=n.updateQueue,n!==null&&(n=n.shared,(l&4194048)!==0)){var i=n.lanes;i&=e.pendingLanes,l|=i,n.lanes=l,pa(e,l)}}function Vc(e,n){var l=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,l===i)){var f=null,x=null;if(l=l.firstBaseUpdate,l!==null){do{var j={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};x===null?f=x=j:x=x.next=j,l=l.next}while(l!==null);x===null?f=x=n:x=x.next=n}else f=x=n;l={baseState:i.baseState,firstBaseUpdate:f,lastBaseUpdate:x,shared:i.shared,callbacks:i.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=n:e.next=n,l.lastBaseUpdate=n}var Pc=!1;function ls(){if(Pc){var e=ul;if(e!==null)throw e}}function ss(e,n,l,i){Pc=!1;var f=e.updateQueue;Ur=!1;var x=f.firstBaseUpdate,j=f.lastBaseUpdate,R=f.shared.pending;if(R!==null){f.shared.pending=null;var V=R,J=V.next;V.next=null,j===null?x=J:j.next=J,j=V;var ie=e.alternate;ie!==null&&(ie=ie.updateQueue,R=ie.lastBaseUpdate,R!==j&&(R===null?ie.firstBaseUpdate=J:R.next=J,ie.lastBaseUpdate=V))}if(x!==null){var fe=f.baseState;j=0,ie=J=V=null,R=x;do{var te=R.lane&-536870913,re=te!==R.lane;if(re?(Ke&te)===te:(i&te)===te){te!==0&&te===cl&&(Pc=!0),ie!==null&&(ie=ie.next={lane:0,tag:R.tag,payload:R.payload,callback:null,next:null});e:{var Ce=e,ze=R;te=n;var mt=l;switch(ze.tag){case 1:if(Ce=ze.payload,typeof Ce=="function"){fe=Ce.call(mt,fe,te);break e}fe=Ce;break e;case 3:Ce.flags=Ce.flags&-65537|128;case 0:if(Ce=ze.payload,te=typeof Ce=="function"?Ce.call(mt,fe,te):Ce,te==null)break e;fe=v({},fe,te);break e;case 2:Ur=!0}}te=R.callback,te!==null&&(e.flags|=64,re&&(e.flags|=8192),re=f.callbacks,re===null?f.callbacks=[te]:re.push(te))}else re={lane:te,tag:R.tag,payload:R.payload,callback:R.callback,next:null},ie===null?(J=ie=re,V=fe):ie=ie.next=re,j|=te;if(R=R.next,R===null){if(R=f.shared.pending,R===null)break;re=R,R=re.next,re.next=null,f.lastBaseUpdate=re,f.shared.pending=null}}while(!0);ie===null&&(V=fe),f.baseState=V,f.firstBaseUpdate=J,f.lastBaseUpdate=ie,x===null&&(f.shared.lanes=0),Wr|=j,e.lanes=j,e.memoizedState=fe}}function Fp(e,n){if(typeof e!="function")throw Error(o(191,e));e.call(n)}function Gp(e,n){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)Fp(l[e],n)}var pl=M(null),Ti=M(0);function Wp(e,n){e=Nr,W(Ti,e),W(pl,n),Nr=e|n.baseLanes}function Fc(){W(Ti,Nr),W(pl,pl.current)}function Gc(){Nr=Ti.current,Y(pl),Y(Ti)}var bn=M(null),Un=null;function Vr(e){var n=e.alternate;W(Lt,Lt.current&1),W(bn,e),Un===null&&(n===null||pl.current!==null||n.memoizedState!==null)&&(Un=e)}function Wc(e){W(Lt,Lt.current),W(bn,e),Un===null&&(Un=e)}function qp(e){e.tag===22?(W(Lt,Lt.current),W(bn,e),Un===null&&(Un=e)):Pr()}function Pr(){W(Lt,Lt.current),W(bn,bn.current)}function jn(e){Y(bn),Un===e&&(Un=null),Y(Lt)}var Lt=M(0);function Ri(e){for(var n=e;n!==null;){if(n.tag===13){var l=n.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Zu(l)||Ju(l)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var yr=0,Ve=null,ft=null,_t=null,Ai=!1,ml=!1,Aa=!1,Mi=0,is=0,hl=null,a1=0;function At(){throw Error(o(321))}function qc(e,n){if(n===null)return!1;for(var l=0;l<n.length&&l<e.length;l++)if(!vn(e[l],n[l]))return!1;return!0}function Yc(e,n,l,i,f,x){return yr=x,Ve=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,z.H=e===null||e.memoizedState===null?Am:cu,Aa=!1,x=l(i,f),Aa=!1,ml&&(x=Kp(n,l,i,f)),Yp(e),x}function Yp(e){z.H=us;var n=ft!==null&&ft.next!==null;if(yr=0,_t=ft=Ve=null,Ai=!1,is=0,hl=null,n)throw Error(o(300));e===null||Ot||(e=e.dependencies,e!==null&&ji(e)&&(Ot=!0))}function Kp(e,n,l,i){Ve=e;var f=0;do{if(ml&&(hl=null),is=0,ml=!1,25<=f)throw Error(o(301));if(f+=1,_t=ft=null,e.updateQueue!=null){var x=e.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}z.H=Mm,x=n(l,i)}while(ml);return x}function l1(){var e=z.H,n=e.useState()[0];return n=typeof n.then=="function"?os(n):n,e=e.useState()[0],(ft!==null?ft.memoizedState:null)!==e&&(Ve.flags|=1024),n}function Kc(){var e=Mi!==0;return Mi=0,e}function Xc(e,n,l){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~l}function Qc(e){if(Ai){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Ai=!1}yr=0,_t=ft=Ve=null,ml=!1,is=Mi=0,hl=null}function ln(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _t===null?Ve.memoizedState=_t=e:_t=_t.next=e,_t}function zt(){if(ft===null){var e=Ve.alternate;e=e!==null?e.memoizedState:null}else e=ft.next;var n=_t===null?Ve.memoizedState:_t.next;if(n!==null)_t=n,ft=e;else{if(e===null)throw Ve.alternate===null?Error(o(467)):Error(o(310));ft=e,e={memoizedState:ft.memoizedState,baseState:ft.baseState,baseQueue:ft.baseQueue,queue:ft.queue,next:null},_t===null?Ve.memoizedState=_t=e:_t=_t.next=e}return _t}function Li(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function os(e){var n=is;return is+=1,hl===null&&(hl=[]),e=Up(hl,e,n),n=Ve,(_t===null?n.memoizedState:_t.next)===null&&(n=n.alternate,z.H=n===null||n.memoizedState===null?Am:cu),e}function zi(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return os(e);if(e.$$typeof===A)return Qt(e)}throw Error(o(438,String(e)))}function Zc(e){var n=null,l=Ve.updateQueue;if(l!==null&&(n=l.memoCache),n==null){var i=Ve.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(n={data:i.data.map(function(f){return f.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),l===null&&(l=Li(),Ve.updateQueue=l),l.memoCache=n,l=n.data[n.index],l===void 0)for(l=n.data[n.index]=Array(e),i=0;i<e;i++)l[i]=U;return n.index++,l}function br(e,n){return typeof n=="function"?n(e):n}function Di(e){var n=zt();return Jc(n,ft,e)}function Jc(e,n,l){var i=e.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=l;var f=e.baseQueue,x=i.pending;if(x!==null){if(f!==null){var j=f.next;f.next=x.next,x.next=j}n.baseQueue=f=x,i.pending=null}if(x=e.baseState,f===null)e.memoizedState=x;else{n=f.next;var R=j=null,V=null,J=n,ie=!1;do{var fe=J.lane&-536870913;if(fe!==J.lane?(Ke&fe)===fe:(yr&fe)===fe){var te=J.revertLane;if(te===0)V!==null&&(V=V.next={lane:0,revertLane:0,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null}),fe===cl&&(ie=!0);else if((yr&te)===te){J=J.next,te===cl&&(ie=!0);continue}else fe={lane:0,revertLane:J.revertLane,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},V===null?(R=V=fe,j=x):V=V.next=fe,Ve.lanes|=te,Wr|=te;fe=J.action,Aa&&l(x,fe),x=J.hasEagerState?J.eagerState:l(x,fe)}else te={lane:fe,revertLane:J.revertLane,gesture:J.gesture,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},V===null?(R=V=te,j=x):V=V.next=te,Ve.lanes|=fe,Wr|=fe;J=J.next}while(J!==null&&J!==n);if(V===null?j=x:V.next=R,!vn(x,e.memoizedState)&&(Ot=!0,ie&&(l=ul,l!==null)))throw l;e.memoizedState=x,e.baseState=j,e.baseQueue=V,i.lastRenderedState=x}return f===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function eu(e){var n=zt(),l=n.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=e;var i=l.dispatch,f=l.pending,x=n.memoizedState;if(f!==null){l.pending=null;var j=f=f.next;do x=e(x,j.action),j=j.next;while(j!==f);vn(x,n.memoizedState)||(Ot=!0),n.memoizedState=x,n.baseQueue===null&&(n.baseState=x),l.lastRenderedState=x}return[x,i]}function Xp(e,n,l){var i=Ve,f=zt(),x=Qe;if(x){if(l===void 0)throw Error(o(407));l=l()}else l=n();var j=!vn((ft||f).memoizedState,l);if(j&&(f.memoizedState=l,Ot=!0),f=f.queue,ru(Jp.bind(null,i,f,e),[e]),f.getSnapshot!==n||j||_t!==null&&_t.memoizedState.tag&1){if(i.flags|=2048,xl(9,{destroy:void 0},Zp.bind(null,i,f,l,n),null),xt===null)throw Error(o(349));x||(yr&127)!==0||Qp(i,n,l)}return l}function Qp(e,n,l){e.flags|=16384,e={getSnapshot:n,value:l},n=Ve.updateQueue,n===null?(n=Li(),Ve.updateQueue=n,n.stores=[e]):(l=n.stores,l===null?n.stores=[e]:l.push(e))}function Zp(e,n,l,i){n.value=l,n.getSnapshot=i,em(n)&&tm(e)}function Jp(e,n,l){return l(function(){em(n)&&tm(e)})}function em(e){var n=e.getSnapshot;e=e.value;try{var l=n();return!vn(e,l)}catch{return!0}}function tm(e){var n=ja(e,2);n!==null&&hn(n,e,2)}function tu(e){var n=ln();if(typeof e=="function"){var l=e;if(e=l(),Aa){Rt(!0);try{l()}finally{Rt(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:br,lastRenderedState:e},n}function nm(e,n,l,i){return e.baseState=l,Jc(e,ft,typeof i=="function"?i:br)}function s1(e,n,l,i,f){if(Bi(e))throw Error(o(485));if(e=n.action,e!==null){var x={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(j){x.listeners.push(j)}};z.T!==null?l(!0):x.isTransition=!1,i(x),l=n.pending,l===null?(x.next=n.pending=x,rm(n,x)):(x.next=l.next,n.pending=l.next=x)}}function rm(e,n){var l=n.action,i=n.payload,f=e.state;if(n.isTransition){var x=z.T,j={};z.T=j;try{var R=l(f,i),V=z.S;V!==null&&V(j,R),am(e,n,R)}catch(J){nu(e,n,J)}finally{x!==null&&j.types!==null&&(x.types=j.types),z.T=x}}else try{x=l(f,i),am(e,n,x)}catch(J){nu(e,n,J)}}function am(e,n,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(i){lm(e,n,i)},function(i){return nu(e,n,i)}):lm(e,n,l)}function lm(e,n,l){n.status="fulfilled",n.value=l,sm(n),e.state=l,n=e.pending,n!==null&&(l=n.next,l===n?e.pending=null:(l=l.next,n.next=l,rm(e,l)))}function nu(e,n,l){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do n.status="rejected",n.reason=l,sm(n),n=n.next;while(n!==i)}e.action=null}function sm(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function im(e,n){return n}function om(e,n){if(Qe){var l=xt.formState;if(l!==null){e:{var i=Ve;if(Qe){if(vt){t:{for(var f=vt,x=In;f.nodeType!==8;){if(!x){f=null;break t}if(f=Hn(f.nextSibling),f===null){f=null;break t}}x=f.data,f=x==="F!"||x==="F"?f:null}if(f){vt=Hn(f.nextSibling),i=f.data==="F!";break e}}Br(i)}i=!1}i&&(n=l[0])}}return l=ln(),l.memoizedState=l.baseState=n,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:im,lastRenderedState:n},l.queue=i,l=Nm.bind(null,Ve,i),i.dispatch=l,i=tu(!1),x=ou.bind(null,Ve,!1,i.queue),i=ln(),f={state:n,dispatch:null,action:e,pending:null},i.queue=f,l=s1.bind(null,Ve,f,x,l),f.dispatch=l,i.memoizedState=e,[n,l,!1]}function cm(e){var n=zt();return um(n,ft,e)}function um(e,n,l){if(n=Jc(e,n,im)[0],e=Di(br)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var i=os(n)}catch(j){throw j===dl?wi:j}else i=n;n=zt();var f=n.queue,x=f.dispatch;return l!==n.memoizedState&&(Ve.flags|=2048,xl(9,{destroy:void 0},i1.bind(null,f,l),null)),[i,x,e]}function i1(e,n){e.action=n}function dm(e){var n=zt(),l=ft;if(l!==null)return um(n,l,e);zt(),n=n.memoizedState,l=zt();var i=l.queue.dispatch;return l.memoizedState=e,[n,i,!1]}function xl(e,n,l,i){return e={tag:e,create:l,deps:i,inst:n,next:null},n=Ve.updateQueue,n===null&&(n=Li(),Ve.updateQueue=n),l=n.lastEffect,l===null?n.lastEffect=e.next=e:(i=l.next,l.next=e,e.next=i,n.lastEffect=e),e}function fm(){return zt().memoizedState}function _i(e,n,l,i){var f=ln();Ve.flags|=e,f.memoizedState=xl(1|n,{destroy:void 0},l,i===void 0?null:i)}function Oi(e,n,l,i){var f=zt();i=i===void 0?null:i;var x=f.memoizedState.inst;ft!==null&&i!==null&&qc(i,ft.memoizedState.deps)?f.memoizedState=xl(n,x,l,i):(Ve.flags|=e,f.memoizedState=xl(1|n,x,l,i))}function pm(e,n){_i(8390656,8,e,n)}function ru(e,n){Oi(2048,8,e,n)}function o1(e){Ve.flags|=4;var n=Ve.updateQueue;if(n===null)n=Li(),Ve.updateQueue=n,n.events=[e];else{var l=n.events;l===null?n.events=[e]:l.push(e)}}function mm(e){var n=zt().memoizedState;return o1({ref:n,nextImpl:e}),function(){if((rt&2)!==0)throw Error(o(440));return n.impl.apply(void 0,arguments)}}function hm(e,n){return Oi(4,2,e,n)}function xm(e,n){return Oi(4,4,e,n)}function gm(e,n){if(typeof n=="function"){e=e();var l=n(e);return function(){typeof l=="function"?l():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function vm(e,n,l){l=l!=null?l.concat([e]):null,Oi(4,4,gm.bind(null,n,e),l)}function au(){}function ym(e,n){var l=zt();n=n===void 0?null:n;var i=l.memoizedState;return n!==null&&qc(n,i[1])?i[0]:(l.memoizedState=[e,n],e)}function bm(e,n){var l=zt();n=n===void 0?null:n;var i=l.memoizedState;if(n!==null&&qc(n,i[1]))return i[0];if(i=e(),Aa){Rt(!0);try{e()}finally{Rt(!1)}}return l.memoizedState=[i,n],i}function lu(e,n,l){return l===void 0||(yr&1073741824)!==0&&(Ke&261930)===0?e.memoizedState=n:(e.memoizedState=l,e=jh(),Ve.lanes|=e,Wr|=e,l)}function jm(e,n,l,i){return vn(l,n)?l:pl.current!==null?(e=lu(e,l,i),vn(e,n)||(Ot=!0),e):(yr&42)===0||(yr&1073741824)!==0&&(Ke&261930)===0?(Ot=!0,e.memoizedState=l):(e=jh(),Ve.lanes|=e,Wr|=e,n)}function Sm(e,n,l,i,f){var x=O.p;O.p=x!==0&&8>x?x:8;var j=z.T,R={};z.T=R,ou(e,!1,n,l);try{var V=f(),J=z.S;if(J!==null&&J(R,V),V!==null&&typeof V=="object"&&typeof V.then=="function"){var ie=r1(V,i);cs(e,n,ie,wn(e))}else cs(e,n,i,wn(e))}catch(fe){cs(e,n,{then:function(){},status:"rejected",reason:fe},wn())}finally{O.p=x,j!==null&&R.types!==null&&(j.types=R.types),z.T=j}}function c1(){}function su(e,n,l,i){if(e.tag!==5)throw Error(o(476));var f=km(e).queue;Sm(e,f,n,P,l===null?c1:function(){return wm(e),l(i)})}function km(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:P,baseState:P,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:br,lastRenderedState:P},next:null};var l={};return n.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:br,lastRenderedState:l},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function wm(e){var n=km(e);n.next===null&&(n=e.alternate.memoizedState),cs(e,n.next.queue,{},wn())}function iu(){return Qt(Es)}function Cm(){return zt().memoizedState}function Em(){return zt().memoizedState}function u1(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var l=wn();e=Hr(l);var i=$r(n,e,l);i!==null&&(hn(i,n,l),as(i,n,l)),n={cache:Oc()},e.payload=n;return}n=n.return}}function d1(e,n,l){var i=wn();l={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Bi(e)?Tm(n,l):(l=Cc(e,n,l,i),l!==null&&(hn(l,e,i),Rm(l,n,i)))}function Nm(e,n,l){var i=wn();cs(e,n,l,i)}function cs(e,n,l,i){var f={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Bi(e))Tm(n,f);else{var x=e.alternate;if(e.lanes===0&&(x===null||x.lanes===0)&&(x=n.lastRenderedReducer,x!==null))try{var j=n.lastRenderedState,R=x(j,l);if(f.hasEagerState=!0,f.eagerState=R,vn(R,j))return gi(e,n,f,0),xt===null&&xi(),!1}catch{}finally{}if(l=Cc(e,n,f,i),l!==null)return hn(l,e,i),Rm(l,n,i),!0}return!1}function ou(e,n,l,i){if(i={lane:2,revertLane:Hu(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Bi(e)){if(n)throw Error(o(479))}else n=Cc(e,l,i,2),n!==null&&hn(n,e,2)}function Bi(e){var n=e.alternate;return e===Ve||n!==null&&n===Ve}function Tm(e,n){ml=Ai=!0;var l=e.pending;l===null?n.next=n:(n.next=l.next,l.next=n),e.pending=n}function Rm(e,n,l){if((l&4194048)!==0){var i=n.lanes;i&=e.pendingLanes,l|=i,n.lanes=l,pa(e,l)}}var us={readContext:Qt,use:zi,useCallback:At,useContext:At,useEffect:At,useImperativeHandle:At,useLayoutEffect:At,useInsertionEffect:At,useMemo:At,useReducer:At,useRef:At,useState:At,useDebugValue:At,useDeferredValue:At,useTransition:At,useSyncExternalStore:At,useId:At,useHostTransitionStatus:At,useFormState:At,useActionState:At,useOptimistic:At,useMemoCache:At,useCacheRefresh:At};us.useEffectEvent=At;var Am={readContext:Qt,use:zi,useCallback:function(e,n){return ln().memoizedState=[e,n===void 0?null:n],e},useContext:Qt,useEffect:pm,useImperativeHandle:function(e,n,l){l=l!=null?l.concat([e]):null,_i(4194308,4,gm.bind(null,n,e),l)},useLayoutEffect:function(e,n){return _i(4194308,4,e,n)},useInsertionEffect:function(e,n){_i(4,2,e,n)},useMemo:function(e,n){var l=ln();n=n===void 0?null:n;var i=e();if(Aa){Rt(!0);try{e()}finally{Rt(!1)}}return l.memoizedState=[i,n],i},useReducer:function(e,n,l){var i=ln();if(l!==void 0){var f=l(n);if(Aa){Rt(!0);try{l(n)}finally{Rt(!1)}}}else f=n;return i.memoizedState=i.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},i.queue=e,e=e.dispatch=d1.bind(null,Ve,e),[i.memoizedState,e]},useRef:function(e){var n=ln();return e={current:e},n.memoizedState=e},useState:function(e){e=tu(e);var n=e.queue,l=Nm.bind(null,Ve,n);return n.dispatch=l,[e.memoizedState,l]},useDebugValue:au,useDeferredValue:function(e,n){var l=ln();return lu(l,e,n)},useTransition:function(){var e=tu(!1);return e=Sm.bind(null,Ve,e.queue,!0,!1),ln().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,l){var i=Ve,f=ln();if(Qe){if(l===void 0)throw Error(o(407));l=l()}else{if(l=n(),xt===null)throw Error(o(349));(Ke&127)!==0||Qp(i,n,l)}f.memoizedState=l;var x={value:l,getSnapshot:n};return f.queue=x,pm(Jp.bind(null,i,x,e),[e]),i.flags|=2048,xl(9,{destroy:void 0},Zp.bind(null,i,x,l,n),null),l},useId:function(){var e=ln(),n=xt.identifierPrefix;if(Qe){var l=lr,i=ar;l=(i&~(1<<32-ct(i)-1)).toString(32)+l,n="_"+n+"R_"+l,l=Mi++,0<l&&(n+="H"+l.toString(32)),n+="_"}else l=a1++,n="_"+n+"r_"+l.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:iu,useFormState:om,useActionState:om,useOptimistic:function(e){var n=ln();n.memoizedState=n.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=l,n=ou.bind(null,Ve,!0,l),l.dispatch=n,[e,n]},useMemoCache:Zc,useCacheRefresh:function(){return ln().memoizedState=u1.bind(null,Ve)},useEffectEvent:function(e){var n=ln(),l={impl:e};return n.memoizedState=l,function(){if((rt&2)!==0)throw Error(o(440));return l.impl.apply(void 0,arguments)}}},cu={readContext:Qt,use:zi,useCallback:ym,useContext:Qt,useEffect:ru,useImperativeHandle:vm,useInsertionEffect:hm,useLayoutEffect:xm,useMemo:bm,useReducer:Di,useRef:fm,useState:function(){return Di(br)},useDebugValue:au,useDeferredValue:function(e,n){var l=zt();return jm(l,ft.memoizedState,e,n)},useTransition:function(){var e=Di(br)[0],n=zt().memoizedState;return[typeof e=="boolean"?e:os(e),n]},useSyncExternalStore:Xp,useId:Cm,useHostTransitionStatus:iu,useFormState:cm,useActionState:cm,useOptimistic:function(e,n){var l=zt();return nm(l,ft,e,n)},useMemoCache:Zc,useCacheRefresh:Em};cu.useEffectEvent=mm;var Mm={readContext:Qt,use:zi,useCallback:ym,useContext:Qt,useEffect:ru,useImperativeHandle:vm,useInsertionEffect:hm,useLayoutEffect:xm,useMemo:bm,useReducer:eu,useRef:fm,useState:function(){return eu(br)},useDebugValue:au,useDeferredValue:function(e,n){var l=zt();return ft===null?lu(l,e,n):jm(l,ft.memoizedState,e,n)},useTransition:function(){var e=eu(br)[0],n=zt().memoizedState;return[typeof e=="boolean"?e:os(e),n]},useSyncExternalStore:Xp,useId:Cm,useHostTransitionStatus:iu,useFormState:dm,useActionState:dm,useOptimistic:function(e,n){var l=zt();return ft!==null?nm(l,ft,e,n):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:Zc,useCacheRefresh:Em};Mm.useEffectEvent=mm;function uu(e,n,l,i){n=e.memoizedState,l=l(i,n),l=l==null?n:v({},n,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var du={enqueueSetState:function(e,n,l){e=e._reactInternals;var i=wn(),f=Hr(i);f.payload=n,l!=null&&(f.callback=l),n=$r(e,f,i),n!==null&&(hn(n,e,i),as(n,e,i))},enqueueReplaceState:function(e,n,l){e=e._reactInternals;var i=wn(),f=Hr(i);f.tag=1,f.payload=n,l!=null&&(f.callback=l),n=$r(e,f,i),n!==null&&(hn(n,e,i),as(n,e,i))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var l=wn(),i=Hr(l);i.tag=2,n!=null&&(i.callback=n),n=$r(e,i,l),n!==null&&(hn(n,e,l),as(n,e,l))}};function Lm(e,n,l,i,f,x,j){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,x,j):n.prototype&&n.prototype.isPureReactComponent?!Xl(l,i)||!Xl(f,x):!0}function zm(e,n,l,i){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(l,i),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(l,i),n.state!==e&&du.enqueueReplaceState(n,n.state,null)}function Ma(e,n){var l=n;if("ref"in n){l={};for(var i in n)i!=="ref"&&(l[i]=n[i])}if(e=e.defaultProps){l===n&&(l=v({},l));for(var f in e)l[f]===void 0&&(l[f]=e[f])}return l}function Dm(e){hi(e)}function _m(e){console.error(e)}function Om(e){hi(e)}function Ii(e,n){try{var l=e.onUncaughtError;l(n.value,{componentStack:n.stack})}catch(i){setTimeout(function(){throw i})}}function Bm(e,n,l){try{var i=e.onCaughtError;i(l.value,{componentStack:l.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function fu(e,n,l){return l=Hr(l),l.tag=3,l.payload={element:null},l.callback=function(){Ii(e,n)},l}function Im(e){return e=Hr(e),e.tag=3,e}function Um(e,n,l,i){var f=l.type.getDerivedStateFromError;if(typeof f=="function"){var x=i.value;e.payload=function(){return f(x)},e.callback=function(){Bm(n,l,i)}}var j=l.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(e.callback=function(){Bm(n,l,i),typeof f!="function"&&(qr===null?qr=new Set([this]):qr.add(this));var R=i.stack;this.componentDidCatch(i.value,{componentStack:R!==null?R:""})})}function f1(e,n,l,i,f){if(l.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(n=l.alternate,n!==null&&ol(n,l,f,!0),l=bn.current,l!==null){switch(l.tag){case 31:case 13:return Un===null?Xi():l.alternate===null&&Mt===0&&(Mt=3),l.flags&=-257,l.flags|=65536,l.lanes=f,i===Ci?l.flags|=16384:(n=l.updateQueue,n===null?l.updateQueue=new Set([i]):n.add(i),Bu(e,i,f)),!1;case 22:return l.flags|=65536,i===Ci?l.flags|=16384:(n=l.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([i])},l.updateQueue=n):(l=n.retryQueue,l===null?n.retryQueue=new Set([i]):l.add(i)),Bu(e,i,f)),!1}throw Error(o(435,l.tag))}return Bu(e,i,f),Xi(),!1}if(Qe)return n=bn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,i!==Mc&&(e=Error(o(422),{cause:i}),Jl(_n(e,l)))):(i!==Mc&&(n=Error(o(423),{cause:i}),Jl(_n(n,l))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,i=_n(i,l),f=fu(e.stateNode,i,f),Vc(e,f),Mt!==4&&(Mt=2)),!1;var x=Error(o(520),{cause:i});if(x=_n(x,l),vs===null?vs=[x]:vs.push(x),Mt!==4&&(Mt=2),n===null)return!0;i=_n(i,l),l=n;do{switch(l.tag){case 3:return l.flags|=65536,e=f&-f,l.lanes|=e,e=fu(l.stateNode,i,e),Vc(l,e),!1;case 1:if(n=l.type,x=l.stateNode,(l.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(qr===null||!qr.has(x))))return l.flags|=65536,f&=-f,l.lanes|=f,f=Im(f),Um(f,e,l,i),Vc(l,f),!1}l=l.return}while(l!==null);return!1}var pu=Error(o(461)),Ot=!1;function Zt(e,n,l,i){n.child=e===null?Pp(n,null,l,i):Ra(n,e.child,l,i)}function Hm(e,n,l,i,f){l=l.render;var x=n.ref;if("ref"in i){var j={};for(var R in i)R!=="ref"&&(j[R]=i[R])}else j=i;return Ca(n),i=Yc(e,n,l,j,x,f),R=Kc(),e!==null&&!Ot?(Xc(e,n,f),jr(e,n,f)):(Qe&&R&&Rc(n),n.flags|=1,Zt(e,n,i,f),n.child)}function $m(e,n,l,i,f){if(e===null){var x=l.type;return typeof x=="function"&&!Ec(x)&&x.defaultProps===void 0&&l.compare===null?(n.tag=15,n.type=x,Vm(e,n,x,i,f)):(e=yi(l.type,null,i,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(x=e.child,!ju(e,f)){var j=x.memoizedProps;if(l=l.compare,l=l!==null?l:Xl,l(j,i)&&e.ref===n.ref)return jr(e,n,f)}return n.flags|=1,e=hr(x,i),e.ref=n.ref,e.return=n,n.child=e}function Vm(e,n,l,i,f){if(e!==null){var x=e.memoizedProps;if(Xl(x,i)&&e.ref===n.ref)if(Ot=!1,n.pendingProps=i=x,ju(e,f))(e.flags&131072)!==0&&(Ot=!0);else return n.lanes=e.lanes,jr(e,n,f)}return mu(e,n,l,i,f)}function Pm(e,n,l,i){var f=i.children,x=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((n.flags&128)!==0){if(x=x!==null?x.baseLanes|l:l,e!==null){for(i=n.child=e.child,f=0;i!==null;)f=f|i.lanes|i.childLanes,i=i.sibling;i=f&~x}else i=0,n.child=null;return Fm(e,n,x,l,i)}if((l&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&ki(n,x!==null?x.cachePool:null),x!==null?Wp(n,x):Fc(),qp(n);else return i=n.lanes=536870912,Fm(e,n,x!==null?x.baseLanes|l:l,l,i)}else x!==null?(ki(n,x.cachePool),Wp(n,x),Pr(),n.memoizedState=null):(e!==null&&ki(n,null),Fc(),Pr());return Zt(e,n,f,l),n.child}function ds(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Fm(e,n,l,i,f){var x=Ic();return x=x===null?null:{parent:Dt._currentValue,pool:x},n.memoizedState={baseLanes:l,cachePool:x},e!==null&&ki(n,null),Fc(),qp(n),e!==null&&ol(e,n,i,!0),n.childLanes=f,null}function Ui(e,n){return n=$i({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function Gm(e,n,l){return Ra(n,e.child,null,l),e=Ui(n,n.pendingProps),e.flags|=2,jn(n),n.memoizedState=null,e}function p1(e,n,l){var i=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Qe){if(i.mode==="hidden")return e=Ui(n,i),n.lanes=536870912,ds(null,e);if(Wc(n),(e=vt)?(e=rx(e,In),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:_r!==null?{id:ar,overflow:lr}:null,retryLane:536870912,hydrationErrors:null},l=Tp(e),l.return=n,n.child=l,Xt=n,vt=null)):e=null,e===null)throw Br(n);return n.lanes=536870912,null}return Ui(n,i)}var x=e.memoizedState;if(x!==null){var j=x.dehydrated;if(Wc(n),f)if(n.flags&256)n.flags&=-257,n=Gm(e,n,l);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(o(558));else if(Ot||ol(e,n,l,!1),f=(l&e.childLanes)!==0,Ot||f){if(i=xt,i!==null&&(j=ma(i,l),j!==0&&j!==x.retryLane))throw x.retryLane=j,ja(e,j),hn(i,e,j),pu;Xi(),n=Gm(e,n,l)}else e=x.treeContext,vt=Hn(j.nextSibling),Xt=n,Qe=!0,Or=null,In=!1,e!==null&&Mp(n,e),n=Ui(n,i),n.flags|=4096;return n}return e=hr(e.child,{mode:i.mode,children:i.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Hi(e,n){var l=n.ref;if(l===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(o(284));(e===null||e.ref!==l)&&(n.flags|=4194816)}}function mu(e,n,l,i,f){return Ca(n),l=Yc(e,n,l,i,void 0,f),i=Kc(),e!==null&&!Ot?(Xc(e,n,f),jr(e,n,f)):(Qe&&i&&Rc(n),n.flags|=1,Zt(e,n,l,f),n.child)}function Wm(e,n,l,i,f,x){return Ca(n),n.updateQueue=null,l=Kp(n,i,l,f),Yp(e),i=Kc(),e!==null&&!Ot?(Xc(e,n,x),jr(e,n,x)):(Qe&&i&&Rc(n),n.flags|=1,Zt(e,n,l,x),n.child)}function qm(e,n,l,i,f){if(Ca(n),n.stateNode===null){var x=al,j=l.contextType;typeof j=="object"&&j!==null&&(x=Qt(j)),x=new l(i,x),n.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=du,n.stateNode=x,x._reactInternals=n,x=n.stateNode,x.props=i,x.state=n.memoizedState,x.refs={},Hc(n),j=l.contextType,x.context=typeof j=="object"&&j!==null?Qt(j):al,x.state=n.memoizedState,j=l.getDerivedStateFromProps,typeof j=="function"&&(uu(n,l,j,i),x.state=n.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(j=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),j!==x.state&&du.enqueueReplaceState(x,x.state,null),ss(n,i,x,f),ls(),x.state=n.memoizedState),typeof x.componentDidMount=="function"&&(n.flags|=4194308),i=!0}else if(e===null){x=n.stateNode;var R=n.memoizedProps,V=Ma(l,R);x.props=V;var J=x.context,ie=l.contextType;j=al,typeof ie=="object"&&ie!==null&&(j=Qt(ie));var fe=l.getDerivedStateFromProps;ie=typeof fe=="function"||typeof x.getSnapshotBeforeUpdate=="function",R=n.pendingProps!==R,ie||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(R||J!==j)&&zm(n,x,i,j),Ur=!1;var te=n.memoizedState;x.state=te,ss(n,i,x,f),ls(),J=n.memoizedState,R||te!==J||Ur?(typeof fe=="function"&&(uu(n,l,fe,i),J=n.memoizedState),(V=Ur||Lm(n,l,V,i,te,J,j))?(ie||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(n.flags|=4194308)):(typeof x.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=i,n.memoizedState=J),x.props=i,x.state=J,x.context=j,i=V):(typeof x.componentDidMount=="function"&&(n.flags|=4194308),i=!1)}else{x=n.stateNode,$c(e,n),j=n.memoizedProps,ie=Ma(l,j),x.props=ie,fe=n.pendingProps,te=x.context,J=l.contextType,V=al,typeof J=="object"&&J!==null&&(V=Qt(J)),R=l.getDerivedStateFromProps,(J=typeof R=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(j!==fe||te!==V)&&zm(n,x,i,V),Ur=!1,te=n.memoizedState,x.state=te,ss(n,i,x,f),ls();var re=n.memoizedState;j!==fe||te!==re||Ur||e!==null&&e.dependencies!==null&&ji(e.dependencies)?(typeof R=="function"&&(uu(n,l,R,i),re=n.memoizedState),(ie=Ur||Lm(n,l,ie,i,te,re,V)||e!==null&&e.dependencies!==null&&ji(e.dependencies))?(J||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(i,re,V),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(i,re,V)),typeof x.componentDidUpdate=="function"&&(n.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof x.componentDidUpdate!="function"||j===e.memoizedProps&&te===e.memoizedState||(n.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||j===e.memoizedProps&&te===e.memoizedState||(n.flags|=1024),n.memoizedProps=i,n.memoizedState=re),x.props=i,x.state=re,x.context=V,i=ie):(typeof x.componentDidUpdate!="function"||j===e.memoizedProps&&te===e.memoizedState||(n.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||j===e.memoizedProps&&te===e.memoizedState||(n.flags|=1024),i=!1)}return x=i,Hi(e,n),i=(n.flags&128)!==0,x||i?(x=n.stateNode,l=i&&typeof l.getDerivedStateFromError!="function"?null:x.render(),n.flags|=1,e!==null&&i?(n.child=Ra(n,e.child,null,f),n.child=Ra(n,null,l,f)):Zt(e,n,l,f),n.memoizedState=x.state,e=n.child):e=jr(e,n,f),e}function Ym(e,n,l,i){return ka(),n.flags|=256,Zt(e,n,l,i),n.child}var hu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function xu(e){return{baseLanes:e,cachePool:Bp()}}function gu(e,n,l){return e=e!==null?e.childLanes&~l:0,n&&(e|=kn),e}function Km(e,n,l){var i=n.pendingProps,f=!1,x=(n.flags&128)!==0,j;if((j=x)||(j=e!==null&&e.memoizedState===null?!1:(Lt.current&2)!==0),j&&(f=!0,n.flags&=-129),j=(n.flags&32)!==0,n.flags&=-33,e===null){if(Qe){if(f?Vr(n):Pr(),(e=vt)?(e=rx(e,In),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:_r!==null?{id:ar,overflow:lr}:null,retryLane:536870912,hydrationErrors:null},l=Tp(e),l.return=n,n.child=l,Xt=n,vt=null)):e=null,e===null)throw Br(n);return Ju(e)?n.lanes=32:n.lanes=536870912,null}var R=i.children;return i=i.fallback,f?(Pr(),f=n.mode,R=$i({mode:"hidden",children:R},f),i=Sa(i,f,l,null),R.return=n,i.return=n,R.sibling=i,n.child=R,i=n.child,i.memoizedState=xu(l),i.childLanes=gu(e,j,l),n.memoizedState=hu,ds(null,i)):(Vr(n),vu(n,R))}var V=e.memoizedState;if(V!==null&&(R=V.dehydrated,R!==null)){if(x)n.flags&256?(Vr(n),n.flags&=-257,n=yu(e,n,l)):n.memoizedState!==null?(Pr(),n.child=e.child,n.flags|=128,n=null):(Pr(),R=i.fallback,f=n.mode,i=$i({mode:"visible",children:i.children},f),R=Sa(R,f,l,null),R.flags|=2,i.return=n,R.return=n,i.sibling=R,n.child=i,Ra(n,e.child,null,l),i=n.child,i.memoizedState=xu(l),i.childLanes=gu(e,j,l),n.memoizedState=hu,n=ds(null,i));else if(Vr(n),Ju(R)){if(j=R.nextSibling&&R.nextSibling.dataset,j)var J=j.dgst;j=J,i=Error(o(419)),i.stack="",i.digest=j,Jl({value:i,source:null,stack:null}),n=yu(e,n,l)}else if(Ot||ol(e,n,l,!1),j=(l&e.childLanes)!==0,Ot||j){if(j=xt,j!==null&&(i=ma(j,l),i!==0&&i!==V.retryLane))throw V.retryLane=i,ja(e,i),hn(j,e,i),pu;Zu(R)||Xi(),n=yu(e,n,l)}else Zu(R)?(n.flags|=192,n.child=e.child,n=null):(e=V.treeContext,vt=Hn(R.nextSibling),Xt=n,Qe=!0,Or=null,In=!1,e!==null&&Mp(n,e),n=vu(n,i.children),n.flags|=4096);return n}return f?(Pr(),R=i.fallback,f=n.mode,V=e.child,J=V.sibling,i=hr(V,{mode:"hidden",children:i.children}),i.subtreeFlags=V.subtreeFlags&65011712,J!==null?R=hr(J,R):(R=Sa(R,f,l,null),R.flags|=2),R.return=n,i.return=n,i.sibling=R,n.child=i,ds(null,i),i=n.child,R=e.child.memoizedState,R===null?R=xu(l):(f=R.cachePool,f!==null?(V=Dt._currentValue,f=f.parent!==V?{parent:V,pool:V}:f):f=Bp(),R={baseLanes:R.baseLanes|l,cachePool:f}),i.memoizedState=R,i.childLanes=gu(e,j,l),n.memoizedState=hu,ds(e.child,i)):(Vr(n),l=e.child,e=l.sibling,l=hr(l,{mode:"visible",children:i.children}),l.return=n,l.sibling=null,e!==null&&(j=n.deletions,j===null?(n.deletions=[e],n.flags|=16):j.push(e)),n.child=l,n.memoizedState=null,l)}function vu(e,n){return n=$i({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function $i(e,n){return e=yn(22,e,null,n),e.lanes=0,e}function yu(e,n,l){return Ra(n,e.child,null,l),e=vu(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Xm(e,n,l){e.lanes|=n;var i=e.alternate;i!==null&&(i.lanes|=n),Dc(e.return,n,l)}function bu(e,n,l,i,f,x){var j=e.memoizedState;j===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:i,tail:l,tailMode:f,treeForkCount:x}:(j.isBackwards=n,j.rendering=null,j.renderingStartTime=0,j.last=i,j.tail=l,j.tailMode=f,j.treeForkCount=x)}function Qm(e,n,l){var i=n.pendingProps,f=i.revealOrder,x=i.tail;i=i.children;var j=Lt.current,R=(j&2)!==0;if(R?(j=j&1|2,n.flags|=128):j&=1,W(Lt,j),Zt(e,n,i,l),i=Qe?Zl:0,!R&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Xm(e,l,n);else if(e.tag===19)Xm(e,l,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(f){case"forwards":for(l=n.child,f=null;l!==null;)e=l.alternate,e!==null&&Ri(e)===null&&(f=l),l=l.sibling;l=f,l===null?(f=n.child,n.child=null):(f=l.sibling,l.sibling=null),bu(n,!1,f,l,x,i);break;case"backwards":case"unstable_legacy-backwards":for(l=null,f=n.child,n.child=null;f!==null;){if(e=f.alternate,e!==null&&Ri(e)===null){n.child=f;break}e=f.sibling,f.sibling=l,l=f,f=e}bu(n,!0,l,null,x,i);break;case"together":bu(n,!1,null,null,void 0,i);break;default:n.memoizedState=null}return n.child}function jr(e,n,l){if(e!==null&&(n.dependencies=e.dependencies),Wr|=n.lanes,(l&n.childLanes)===0)if(e!==null){if(ol(e,n,l,!1),(l&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(o(153));if(n.child!==null){for(e=n.child,l=hr(e,e.pendingProps),n.child=l,l.return=n;e.sibling!==null;)e=e.sibling,l=l.sibling=hr(e,e.pendingProps),l.return=n;l.sibling=null}return n.child}function ju(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&ji(e)))}function m1(e,n,l){switch(n.tag){case 3:ce(n,n.stateNode.containerInfo),Ir(n,Dt,e.memoizedState.cache),ka();break;case 27:case 5:Re(n);break;case 4:ce(n,n.stateNode.containerInfo);break;case 10:Ir(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Wc(n),null;break;case 13:var i=n.memoizedState;if(i!==null)return i.dehydrated!==null?(Vr(n),n.flags|=128,null):(l&n.child.childLanes)!==0?Km(e,n,l):(Vr(n),e=jr(e,n,l),e!==null?e.sibling:null);Vr(n);break;case 19:var f=(e.flags&128)!==0;if(i=(l&n.childLanes)!==0,i||(ol(e,n,l,!1),i=(l&n.childLanes)!==0),f){if(i)return Qm(e,n,l);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),W(Lt,Lt.current),i)break;return null;case 22:return n.lanes=0,Pm(e,n,l,n.pendingProps);case 24:Ir(n,Dt,e.memoizedState.cache)}return jr(e,n,l)}function Zm(e,n,l){if(e!==null)if(e.memoizedProps!==n.pendingProps)Ot=!0;else{if(!ju(e,l)&&(n.flags&128)===0)return Ot=!1,m1(e,n,l);Ot=(e.flags&131072)!==0}else Ot=!1,Qe&&(n.flags&1048576)!==0&&Ap(n,Zl,n.index);switch(n.lanes=0,n.tag){case 16:e:{var i=n.pendingProps;if(e=Na(n.elementType),n.type=e,typeof e=="function")Ec(e)?(i=Ma(e,i),n.tag=1,n=qm(null,n,e,i,l)):(n.tag=0,n=mu(null,n,e,i,l));else{if(e!=null){var f=e.$$typeof;if(f===_){n.tag=11,n=Hm(null,n,e,i,l);break e}else if(f===E){n.tag=14,n=$m(null,n,e,i,l);break e}}throw n=ee(e)||e,Error(o(306,n,""))}}return n;case 0:return mu(e,n,n.type,n.pendingProps,l);case 1:return i=n.type,f=Ma(i,n.pendingProps),qm(e,n,i,f,l);case 3:e:{if(ce(n,n.stateNode.containerInfo),e===null)throw Error(o(387));i=n.pendingProps;var x=n.memoizedState;f=x.element,$c(e,n),ss(n,i,null,l);var j=n.memoizedState;if(i=j.cache,Ir(n,Dt,i),i!==x.cache&&_c(n,[Dt],l,!0),ls(),i=j.element,x.isDehydrated)if(x={element:i,isDehydrated:!1,cache:j.cache},n.updateQueue.baseState=x,n.memoizedState=x,n.flags&256){n=Ym(e,n,i,l);break e}else if(i!==f){f=_n(Error(o(424)),n),Jl(f),n=Ym(e,n,i,l);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(vt=Hn(e.firstChild),Xt=n,Qe=!0,Or=null,In=!0,l=Pp(n,null,i,l),n.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(ka(),i===f){n=jr(e,n,l);break e}Zt(e,n,i,l)}n=n.child}return n;case 26:return Hi(e,n),e===null?(l=cx(n.type,null,n.pendingProps,null))?n.memoizedState=l:Qe||(l=n.type,e=n.pendingProps,i=ro(de.current).createElement(l),i[Ht]=n,i[dt]=e,Jt(i,l,e),qt(i),n.stateNode=i):n.memoizedState=cx(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return Re(n),e===null&&Qe&&(i=n.stateNode=sx(n.type,n.pendingProps,de.current),Xt=n,In=!0,f=vt,Qr(n.type)?(ed=f,vt=Hn(i.firstChild)):vt=f),Zt(e,n,n.pendingProps.children,l),Hi(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Qe&&((f=i=vt)&&(i=F1(i,n.type,n.pendingProps,In),i!==null?(n.stateNode=i,Xt=n,vt=Hn(i.firstChild),In=!1,f=!0):f=!1),f||Br(n)),Re(n),f=n.type,x=n.pendingProps,j=e!==null?e.memoizedProps:null,i=x.children,Ku(f,x)?i=null:j!==null&&Ku(f,j)&&(n.flags|=32),n.memoizedState!==null&&(f=Yc(e,n,l1,null,null,l),Es._currentValue=f),Hi(e,n),Zt(e,n,i,l),n.child;case 6:return e===null&&Qe&&((e=l=vt)&&(l=G1(l,n.pendingProps,In),l!==null?(n.stateNode=l,Xt=n,vt=null,e=!0):e=!1),e||Br(n)),null;case 13:return Km(e,n,l);case 4:return ce(n,n.stateNode.containerInfo),i=n.pendingProps,e===null?n.child=Ra(n,null,i,l):Zt(e,n,i,l),n.child;case 11:return Hm(e,n,n.type,n.pendingProps,l);case 7:return Zt(e,n,n.pendingProps,l),n.child;case 8:return Zt(e,n,n.pendingProps.children,l),n.child;case 12:return Zt(e,n,n.pendingProps.children,l),n.child;case 10:return i=n.pendingProps,Ir(n,n.type,i.value),Zt(e,n,i.children,l),n.child;case 9:return f=n.type._context,i=n.pendingProps.children,Ca(n),f=Qt(f),i=i(f),n.flags|=1,Zt(e,n,i,l),n.child;case 14:return $m(e,n,n.type,n.pendingProps,l);case 15:return Vm(e,n,n.type,n.pendingProps,l);case 19:return Qm(e,n,l);case 31:return p1(e,n,l);case 22:return Pm(e,n,l,n.pendingProps);case 24:return Ca(n),i=Qt(Dt),e===null?(f=Ic(),f===null&&(f=xt,x=Oc(),f.pooledCache=x,x.refCount++,x!==null&&(f.pooledCacheLanes|=l),f=x),n.memoizedState={parent:i,cache:f},Hc(n),Ir(n,Dt,f)):((e.lanes&l)!==0&&($c(e,n),ss(n,null,null,l),ls()),f=e.memoizedState,x=n.memoizedState,f.parent!==i?(f={parent:i,cache:i},n.memoizedState=f,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=f),Ir(n,Dt,i)):(i=x.cache,Ir(n,Dt,i),i!==f.cache&&_c(n,[Dt],l,!0))),Zt(e,n,n.pendingProps.children,l),n.child;case 29:throw n.pendingProps}throw Error(o(156,n.tag))}function Sr(e){e.flags|=4}function Su(e,n,l,i,f){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(f&335544128)===f)if(e.stateNode.complete)e.flags|=8192;else if(Ch())e.flags|=8192;else throw Ta=Ci,Uc}else e.flags&=-16777217}function Jm(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!mx(n))if(Ch())e.flags|=8192;else throw Ta=Ci,Uc}function Vi(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?qn():536870912,e.lanes|=n,bl|=n)}function fs(e,n){if(!Qe)switch(e.tailMode){case"hidden":n=e.tail;for(var l=null;n!==null;)n.alternate!==null&&(l=n),n=n.sibling;l===null?e.tail=null:l.sibling=null;break;case"collapsed":l=e.tail;for(var i=null;l!==null;)l.alternate!==null&&(i=l),l=l.sibling;i===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function yt(e){var n=e.alternate!==null&&e.alternate.child===e.child,l=0,i=0;if(n)for(var f=e.child;f!==null;)l|=f.lanes|f.childLanes,i|=f.subtreeFlags&65011712,i|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)l|=f.lanes|f.childLanes,i|=f.subtreeFlags,i|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=i,e.childLanes=l,n}function h1(e,n,l){var i=n.pendingProps;switch(Ac(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return yt(n),null;case 1:return yt(n),null;case 3:return l=n.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),n.memoizedState.cache!==i&&(n.flags|=2048),vr(Dt),je(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(il(n)?Sr(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Lc())),yt(n),null;case 26:var f=n.type,x=n.memoizedState;return e===null?(Sr(n),x!==null?(yt(n),Jm(n,x)):(yt(n),Su(n,f,null,i,l))):x?x!==e.memoizedState?(Sr(n),yt(n),Jm(n,x)):(yt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==i&&Sr(n),yt(n),Su(n,f,e,i,l)),null;case 27:if(Oe(n),l=de.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==i&&Sr(n);else{if(!i){if(n.stateNode===null)throw Error(o(166));return yt(n),null}e=Q.current,il(n)?Lp(n):(e=sx(f,i,l),n.stateNode=e,Sr(n))}return yt(n),null;case 5:if(Oe(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==i&&Sr(n);else{if(!i){if(n.stateNode===null)throw Error(o(166));return yt(n),null}if(x=Q.current,il(n))Lp(n);else{var j=ro(de.current);switch(x){case 1:x=j.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:x=j.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":x=j.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":x=j.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":x=j.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof i.is=="string"?j.createElement("select",{is:i.is}):j.createElement("select"),i.multiple?x.multiple=!0:i.size&&(x.size=i.size);break;default:x=typeof i.is=="string"?j.createElement(f,{is:i.is}):j.createElement(f)}}x[Ht]=n,x[dt]=i;e:for(j=n.child;j!==null;){if(j.tag===5||j.tag===6)x.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===n)break e;for(;j.sibling===null;){if(j.return===null||j.return===n)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}n.stateNode=x;e:switch(Jt(x,f,i),f){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&Sr(n)}}return yt(n),Su(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,l),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==i&&Sr(n);else{if(typeof i!="string"&&n.stateNode===null)throw Error(o(166));if(e=de.current,il(n)){if(e=n.stateNode,l=n.memoizedProps,i=null,f=Xt,f!==null)switch(f.tag){case 27:case 5:i=f.memoizedProps}e[Ht]=n,e=!!(e.nodeValue===l||i!==null&&i.suppressHydrationWarning===!0||Kh(e.nodeValue,l)),e||Br(n,!0)}else e=ro(e).createTextNode(i),e[Ht]=n,n.stateNode=e}return yt(n),null;case 31:if(l=n.memoizedState,e===null||e.memoizedState!==null){if(i=il(n),l!==null){if(e===null){if(!i)throw Error(o(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[Ht]=n}else ka(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;yt(n),e=!1}else l=Lc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return n.flags&256?(jn(n),n):(jn(n),null);if((n.flags&128)!==0)throw Error(o(558))}return yt(n),null;case 13:if(i=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=il(n),i!==null&&i.dehydrated!==null){if(e===null){if(!f)throw Error(o(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(o(317));f[Ht]=n}else ka(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;yt(n),f=!1}else f=Lc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(jn(n),n):(jn(n),null)}return jn(n),(n.flags&128)!==0?(n.lanes=l,n):(l=i!==null,e=e!==null&&e.memoizedState!==null,l&&(i=n.child,f=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(f=i.alternate.memoizedState.cachePool.pool),x=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(x=i.memoizedState.cachePool.pool),x!==f&&(i.flags|=2048)),l!==e&&l&&(n.child.flags|=8192),Vi(n,n.updateQueue),yt(n),null);case 4:return je(),e===null&&Fu(n.stateNode.containerInfo),yt(n),null;case 10:return vr(n.type),yt(n),null;case 19:if(Y(Lt),i=n.memoizedState,i===null)return yt(n),null;if(f=(n.flags&128)!==0,x=i.rendering,x===null)if(f)fs(i,!1);else{if(Mt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(x=Ri(e),x!==null){for(n.flags|=128,fs(i,!1),e=x.updateQueue,n.updateQueue=e,Vi(n,e),n.subtreeFlags=0,e=l,l=n.child;l!==null;)Np(l,e),l=l.sibling;return W(Lt,Lt.current&1|2),Qe&&xr(n,i.treeForkCount),n.child}e=e.sibling}i.tail!==null&&We()>qi&&(n.flags|=128,f=!0,fs(i,!1),n.lanes=4194304)}else{if(!f)if(e=Ri(x),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,Vi(n,e),fs(i,!0),i.tail===null&&i.tailMode==="hidden"&&!x.alternate&&!Qe)return yt(n),null}else 2*We()-i.renderingStartTime>qi&&l!==536870912&&(n.flags|=128,f=!0,fs(i,!1),n.lanes=4194304);i.isBackwards?(x.sibling=n.child,n.child=x):(e=i.last,e!==null?e.sibling=x:n.child=x,i.last=x)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=We(),e.sibling=null,l=Lt.current,W(Lt,f?l&1|2:l&1),Qe&&xr(n,i.treeForkCount),e):(yt(n),null);case 22:case 23:return jn(n),Gc(),i=n.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(n.flags|=8192):i&&(n.flags|=8192),i?(l&536870912)!==0&&(n.flags&128)===0&&(yt(n),n.subtreeFlags&6&&(n.flags|=8192)):yt(n),l=n.updateQueue,l!==null&&Vi(n,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),i=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),i!==l&&(n.flags|=2048),e!==null&&Y(Ea),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),vr(Dt),yt(n),null;case 25:return null;case 30:return null}throw Error(o(156,n.tag))}function x1(e,n){switch(Ac(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return vr(Dt),je(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return Oe(n),null;case 31:if(n.memoizedState!==null){if(jn(n),n.alternate===null)throw Error(o(340));ka()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(jn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(o(340));ka()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return Y(Lt),null;case 4:return je(),null;case 10:return vr(n.type),null;case 22:case 23:return jn(n),Gc(),e!==null&&Y(Ea),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return vr(Dt),null;case 25:return null;default:return null}}function eh(e,n){switch(Ac(n),n.tag){case 3:vr(Dt),je();break;case 26:case 27:case 5:Oe(n);break;case 4:je();break;case 31:n.memoizedState!==null&&jn(n);break;case 13:jn(n);break;case 19:Y(Lt);break;case 10:vr(n.type);break;case 22:case 23:jn(n),Gc(),e!==null&&Y(Ea);break;case 24:vr(Dt)}}function ps(e,n){try{var l=n.updateQueue,i=l!==null?l.lastEffect:null;if(i!==null){var f=i.next;l=f;do{if((l.tag&e)===e){i=void 0;var x=l.create,j=l.inst;i=x(),j.destroy=i}l=l.next}while(l!==f)}}catch(R){it(n,n.return,R)}}function Fr(e,n,l){try{var i=n.updateQueue,f=i!==null?i.lastEffect:null;if(f!==null){var x=f.next;i=x;do{if((i.tag&e)===e){var j=i.inst,R=j.destroy;if(R!==void 0){j.destroy=void 0,f=n;var V=l,J=R;try{J()}catch(ie){it(f,V,ie)}}}i=i.next}while(i!==x)}}catch(ie){it(n,n.return,ie)}}function th(e){var n=e.updateQueue;if(n!==null){var l=e.stateNode;try{Gp(n,l)}catch(i){it(e,e.return,i)}}}function nh(e,n,l){l.props=Ma(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(i){it(e,n,i)}}function ms(e,n){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof l=="function"?e.refCleanup=l(i):l.current=i}}catch(f){it(e,n,f)}}function sr(e,n){var l=e.ref,i=e.refCleanup;if(l!==null)if(typeof i=="function")try{i()}catch(f){it(e,n,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(f){it(e,n,f)}else l.current=null}function rh(e){var n=e.type,l=e.memoizedProps,i=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":l.autoFocus&&i.focus();break e;case"img":l.src?i.src=l.src:l.srcSet&&(i.srcset=l.srcSet)}}catch(f){it(e,e.return,f)}}function ku(e,n,l){try{var i=e.stateNode;I1(i,e.type,l,n),i[dt]=n}catch(f){it(e,e.return,f)}}function ah(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Qr(e.type)||e.tag===4}function wu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ah(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&&Qr(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 Cu(e,n,l){var i=e.tag;if(i===5||i===6)e=e.stateNode,n?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,n):(n=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,n.appendChild(e),l=l._reactRootContainer,l!=null||n.onclick!==null||(n.onclick=pr));else if(i!==4&&(i===27&&Qr(e.type)&&(l=e.stateNode,n=null),e=e.child,e!==null))for(Cu(e,n,l),e=e.sibling;e!==null;)Cu(e,n,l),e=e.sibling}function Pi(e,n,l){var i=e.tag;if(i===5||i===6)e=e.stateNode,n?l.insertBefore(e,n):l.appendChild(e);else if(i!==4&&(i===27&&Qr(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(Pi(e,n,l),e=e.sibling;e!==null;)Pi(e,n,l),e=e.sibling}function lh(e){var n=e.stateNode,l=e.memoizedProps;try{for(var i=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);Jt(n,i,l),n[Ht]=e,n[dt]=l}catch(x){it(e,e.return,x)}}var kr=!1,Bt=!1,Eu=!1,sh=typeof WeakSet=="function"?WeakSet:Set,Yt=null;function g1(e,n){if(e=e.containerInfo,qu=uo,e=vp(e),yc(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var i=l.getSelection&&l.getSelection();if(i&&i.rangeCount!==0){l=i.anchorNode;var f=i.anchorOffset,x=i.focusNode;i=i.focusOffset;try{l.nodeType,x.nodeType}catch{l=null;break e}var j=0,R=-1,V=-1,J=0,ie=0,fe=e,te=null;t:for(;;){for(var re;fe!==l||f!==0&&fe.nodeType!==3||(R=j+f),fe!==x||i!==0&&fe.nodeType!==3||(V=j+i),fe.nodeType===3&&(j+=fe.nodeValue.length),(re=fe.firstChild)!==null;)te=fe,fe=re;for(;;){if(fe===e)break t;if(te===l&&++J===f&&(R=j),te===x&&++ie===i&&(V=j),(re=fe.nextSibling)!==null)break;fe=te,te=fe.parentNode}fe=re}l=R===-1||V===-1?null:{start:R,end:V}}else l=null}l=l||{start:0,end:0}}else l=null;for(Yu={focusedElem:e,selectionRange:l},uo=!1,Yt=n;Yt!==null;)if(n=Yt,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Yt=e;else for(;Yt!==null;){switch(n=Yt,x=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(l=0;l<e.length;l++)f=e[l],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&x!==null){e=void 0,l=n,f=x.memoizedProps,x=x.memoizedState,i=l.stateNode;try{var Ce=Ma(l.type,f);e=i.getSnapshotBeforeUpdate(Ce,x),i.__reactInternalSnapshotBeforeUpdate=e}catch(ze){it(l,l.return,ze)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,l=e.nodeType,l===9)Qu(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Qu(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=n.sibling,e!==null){e.return=n.return,Yt=e;break}Yt=n.return}}function ih(e,n,l){var i=l.flags;switch(l.tag){case 0:case 11:case 15:Cr(e,l),i&4&&ps(5,l);break;case 1:if(Cr(e,l),i&4)if(e=l.stateNode,n===null)try{e.componentDidMount()}catch(j){it(l,l.return,j)}else{var f=Ma(l.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(j){it(l,l.return,j)}}i&64&&th(l),i&512&&ms(l,l.return);break;case 3:if(Cr(e,l),i&64&&(e=l.updateQueue,e!==null)){if(n=null,l.child!==null)switch(l.child.tag){case 27:case 5:n=l.child.stateNode;break;case 1:n=l.child.stateNode}try{Gp(e,n)}catch(j){it(l,l.return,j)}}break;case 27:n===null&&i&4&&lh(l);case 26:case 5:Cr(e,l),n===null&&i&4&&rh(l),i&512&&ms(l,l.return);break;case 12:Cr(e,l);break;case 31:Cr(e,l),i&4&&uh(e,l);break;case 13:Cr(e,l),i&4&&dh(e,l),i&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=E1.bind(null,l),W1(e,l))));break;case 22:if(i=l.memoizedState!==null||kr,!i){n=n!==null&&n.memoizedState!==null||Bt,f=kr;var x=Bt;kr=i,(Bt=n)&&!x?Er(e,l,(l.subtreeFlags&8772)!==0):Cr(e,l),kr=f,Bt=x}break;case 30:break;default:Cr(e,l)}}function oh(e){var n=e.alternate;n!==null&&(e.alternate=null,oh(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&nc(n)),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 St=null,dn=!1;function wr(e,n,l){for(l=l.child;l!==null;)ch(e,n,l),l=l.sibling}function ch(e,n,l){if(Ut&&typeof Ut.onCommitFiberUnmount=="function")try{Ut.onCommitFiberUnmount(Mn,l)}catch{}switch(l.tag){case 26:Bt||sr(l,n),wr(e,n,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Bt||sr(l,n);var i=St,f=dn;Qr(l.type)&&(St=l.stateNode,dn=!1),wr(e,n,l),ks(l.stateNode),St=i,dn=f;break;case 5:Bt||sr(l,n);case 6:if(i=St,f=dn,St=null,wr(e,n,l),St=i,dn=f,St!==null)if(dn)try{(St.nodeType===9?St.body:St.nodeName==="HTML"?St.ownerDocument.body:St).removeChild(l.stateNode)}catch(x){it(l,n,x)}else try{St.removeChild(l.stateNode)}catch(x){it(l,n,x)}break;case 18:St!==null&&(dn?(e=St,tx(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),Tl(e)):tx(St,l.stateNode));break;case 4:i=St,f=dn,St=l.stateNode.containerInfo,dn=!0,wr(e,n,l),St=i,dn=f;break;case 0:case 11:case 14:case 15:Fr(2,l,n),Bt||Fr(4,l,n),wr(e,n,l);break;case 1:Bt||(sr(l,n),i=l.stateNode,typeof i.componentWillUnmount=="function"&&nh(l,n,i)),wr(e,n,l);break;case 21:wr(e,n,l);break;case 22:Bt=(i=Bt)||l.memoizedState!==null,wr(e,n,l),Bt=i;break;default:wr(e,n,l)}}function uh(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Tl(e)}catch(l){it(n,n.return,l)}}}function dh(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Tl(e)}catch(l){it(n,n.return,l)}}function v1(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new sh),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new sh),n;default:throw Error(o(435,e.tag))}}function Fi(e,n){var l=v1(e);n.forEach(function(i){if(!l.has(i)){l.add(i);var f=N1.bind(null,e,i);i.then(f,f)}})}function fn(e,n){var l=n.deletions;if(l!==null)for(var i=0;i<l.length;i++){var f=l[i],x=e,j=n,R=j;e:for(;R!==null;){switch(R.tag){case 27:if(Qr(R.type)){St=R.stateNode,dn=!1;break e}break;case 5:St=R.stateNode,dn=!1;break e;case 3:case 4:St=R.stateNode.containerInfo,dn=!0;break e}R=R.return}if(St===null)throw Error(o(160));ch(x,j,f),St=null,dn=!1,x=f.alternate,x!==null&&(x.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)fh(n,e),n=n.sibling}var Kn=null;function fh(e,n){var l=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:fn(n,e),pn(e),i&4&&(Fr(3,e,e.return),ps(3,e),Fr(5,e,e.return));break;case 1:fn(n,e),pn(e),i&512&&(Bt||l===null||sr(l,l.return)),i&64&&kr&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?i:l.concat(i))));break;case 26:var f=Kn;if(fn(n,e),pn(e),i&512&&(Bt||l===null||sr(l,l.return)),i&4){var x=l!==null?l.memoizedState:null;if(i=e.memoizedState,l===null)if(i===null)if(e.stateNode===null){e:{i=e.type,l=e.memoizedProps,f=f.ownerDocument||f;t:switch(i){case"title":x=f.getElementsByTagName("title")[0],(!x||x[$l]||x[Ht]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=f.createElement(i),f.head.insertBefore(x,f.querySelector("head > title"))),Jt(x,i,l),x[Ht]=e,qt(x),i=x;break e;case"link":var j=fx("link","href",f).get(i+(l.href||""));if(j){for(var R=0;R<j.length;R++)if(x=j[R],x.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&x.getAttribute("rel")===(l.rel==null?null:l.rel)&&x.getAttribute("title")===(l.title==null?null:l.title)&&x.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){j.splice(R,1);break t}}x=f.createElement(i),Jt(x,i,l),f.head.appendChild(x);break;case"meta":if(j=fx("meta","content",f).get(i+(l.content||""))){for(R=0;R<j.length;R++)if(x=j[R],x.getAttribute("content")===(l.content==null?null:""+l.content)&&x.getAttribute("name")===(l.name==null?null:l.name)&&x.getAttribute("property")===(l.property==null?null:l.property)&&x.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&x.getAttribute("charset")===(l.charSet==null?null:l.charSet)){j.splice(R,1);break t}}x=f.createElement(i),Jt(x,i,l),f.head.appendChild(x);break;default:throw Error(o(468,i))}x[Ht]=e,qt(x),i=x}e.stateNode=i}else px(f,e.type,e.stateNode);else e.stateNode=dx(f,i,e.memoizedProps);else x!==i?(x===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):x.count--,i===null?px(f,e.type,e.stateNode):dx(f,i,e.memoizedProps)):i===null&&e.stateNode!==null&&ku(e,e.memoizedProps,l.memoizedProps)}break;case 27:fn(n,e),pn(e),i&512&&(Bt||l===null||sr(l,l.return)),l!==null&&i&4&&ku(e,e.memoizedProps,l.memoizedProps);break;case 5:if(fn(n,e),pn(e),i&512&&(Bt||l===null||sr(l,l.return)),e.flags&32){f=e.stateNode;try{Qa(f,"")}catch(Ce){it(e,e.return,Ce)}}i&4&&e.stateNode!=null&&(f=e.memoizedProps,ku(e,f,l!==null?l.memoizedProps:f)),i&1024&&(Eu=!0);break;case 6:if(fn(n,e),pn(e),i&4){if(e.stateNode===null)throw Error(o(162));i=e.memoizedProps,l=e.stateNode;try{l.nodeValue=i}catch(Ce){it(e,e.return,Ce)}}break;case 3:if(so=null,f=Kn,Kn=ao(n.containerInfo),fn(n,e),Kn=f,pn(e),i&4&&l!==null&&l.memoizedState.isDehydrated)try{Tl(n.containerInfo)}catch(Ce){it(e,e.return,Ce)}Eu&&(Eu=!1,ph(e));break;case 4:i=Kn,Kn=ao(e.stateNode.containerInfo),fn(n,e),pn(e),Kn=i;break;case 12:fn(n,e),pn(e);break;case 31:fn(n,e),pn(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Fi(e,i)));break;case 13:fn(n,e),pn(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Wi=We()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Fi(e,i)));break;case 22:f=e.memoizedState!==null;var V=l!==null&&l.memoizedState!==null,J=kr,ie=Bt;if(kr=J||f,Bt=ie||V,fn(n,e),Bt=ie,kr=J,pn(e),i&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(l===null||V||kr||Bt||La(e)),l=null,n=e;;){if(n.tag===5||n.tag===26){if(l===null){V=l=n;try{if(x=V.stateNode,f)j=x.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{R=V.stateNode;var fe=V.memoizedProps.style,te=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;R.style.display=te==null||typeof te=="boolean"?"":(""+te).trim()}}catch(Ce){it(V,V.return,Ce)}}}else if(n.tag===6){if(l===null){V=n;try{V.stateNode.nodeValue=f?"":V.memoizedProps}catch(Ce){it(V,V.return,Ce)}}}else if(n.tag===18){if(l===null){V=n;try{var re=V.stateNode;f?nx(re,!0):nx(V.stateNode,!1)}catch(Ce){it(V,V.return,Ce)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;l===n&&(l=null),n=n.return}l===n&&(l=null),n.sibling.return=n.return,n=n.sibling}i&4&&(i=e.updateQueue,i!==null&&(l=i.retryQueue,l!==null&&(i.retryQueue=null,Fi(e,l))));break;case 19:fn(n,e),pn(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Fi(e,i)));break;case 30:break;case 21:break;default:fn(n,e),pn(e)}}function pn(e){var n=e.flags;if(n&2){try{for(var l,i=e.return;i!==null;){if(ah(i)){l=i;break}i=i.return}if(l==null)throw Error(o(160));switch(l.tag){case 27:var f=l.stateNode,x=wu(e);Pi(e,x,f);break;case 5:var j=l.stateNode;l.flags&32&&(Qa(j,""),l.flags&=-33);var R=wu(e);Pi(e,R,j);break;case 3:case 4:var V=l.stateNode.containerInfo,J=wu(e);Cu(e,J,V);break;default:throw Error(o(161))}}catch(ie){it(e,e.return,ie)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function ph(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;ph(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Cr(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)ih(e,n.alternate,n),n=n.sibling}function La(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Fr(4,n,n.return),La(n);break;case 1:sr(n,n.return);var l=n.stateNode;typeof l.componentWillUnmount=="function"&&nh(n,n.return,l),La(n);break;case 27:ks(n.stateNode);case 26:case 5:sr(n,n.return),La(n);break;case 22:n.memoizedState===null&&La(n);break;case 30:La(n);break;default:La(n)}e=e.sibling}}function Er(e,n,l){for(l=l&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var i=n.alternate,f=e,x=n,j=x.flags;switch(x.tag){case 0:case 11:case 15:Er(f,x,l),ps(4,x);break;case 1:if(Er(f,x,l),i=x,f=i.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(J){it(i,i.return,J)}if(i=x,f=i.updateQueue,f!==null){var R=i.stateNode;try{var V=f.shared.hiddenCallbacks;if(V!==null)for(f.shared.hiddenCallbacks=null,f=0;f<V.length;f++)Fp(V[f],R)}catch(J){it(i,i.return,J)}}l&&j&64&&th(x),ms(x,x.return);break;case 27:lh(x);case 26:case 5:Er(f,x,l),l&&i===null&&j&4&&rh(x),ms(x,x.return);break;case 12:Er(f,x,l);break;case 31:Er(f,x,l),l&&j&4&&uh(f,x);break;case 13:Er(f,x,l),l&&j&4&&dh(f,x);break;case 22:x.memoizedState===null&&Er(f,x,l),ms(x,x.return);break;case 30:break;default:Er(f,x,l)}n=n.sibling}}function Nu(e,n){var l=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==l&&(e!=null&&e.refCount++,l!=null&&es(l))}function Tu(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&es(e))}function Xn(e,n,l,i){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)mh(e,n,l,i),n=n.sibling}function mh(e,n,l,i){var f=n.flags;switch(n.tag){case 0:case 11:case 15:Xn(e,n,l,i),f&2048&&ps(9,n);break;case 1:Xn(e,n,l,i);break;case 3:Xn(e,n,l,i),f&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&es(e)));break;case 12:if(f&2048){Xn(e,n,l,i),e=n.stateNode;try{var x=n.memoizedProps,j=x.id,R=x.onPostCommit;typeof R=="function"&&R(j,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(V){it(n,n.return,V)}}else Xn(e,n,l,i);break;case 31:Xn(e,n,l,i);break;case 13:Xn(e,n,l,i);break;case 23:break;case 22:x=n.stateNode,j=n.alternate,n.memoizedState!==null?x._visibility&2?Xn(e,n,l,i):hs(e,n):x._visibility&2?Xn(e,n,l,i):(x._visibility|=2,gl(e,n,l,i,(n.subtreeFlags&10256)!==0||!1)),f&2048&&Nu(j,n);break;case 24:Xn(e,n,l,i),f&2048&&Tu(n.alternate,n);break;default:Xn(e,n,l,i)}}function gl(e,n,l,i,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var x=e,j=n,R=l,V=i,J=j.flags;switch(j.tag){case 0:case 11:case 15:gl(x,j,R,V,f),ps(8,j);break;case 23:break;case 22:var ie=j.stateNode;j.memoizedState!==null?ie._visibility&2?gl(x,j,R,V,f):hs(x,j):(ie._visibility|=2,gl(x,j,R,V,f)),f&&J&2048&&Nu(j.alternate,j);break;case 24:gl(x,j,R,V,f),f&&J&2048&&Tu(j.alternate,j);break;default:gl(x,j,R,V,f)}n=n.sibling}}function hs(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var l=e,i=n,f=i.flags;switch(i.tag){case 22:hs(l,i),f&2048&&Nu(i.alternate,i);break;case 24:hs(l,i),f&2048&&Tu(i.alternate,i);break;default:hs(l,i)}n=n.sibling}}var xs=8192;function vl(e,n,l){if(e.subtreeFlags&xs)for(e=e.child;e!==null;)hh(e,n,l),e=e.sibling}function hh(e,n,l){switch(e.tag){case 26:vl(e,n,l),e.flags&xs&&e.memoizedState!==null&&a0(l,Kn,e.memoizedState,e.memoizedProps);break;case 5:vl(e,n,l);break;case 3:case 4:var i=Kn;Kn=ao(e.stateNode.containerInfo),vl(e,n,l),Kn=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=xs,xs=16777216,vl(e,n,l),xs=i):vl(e,n,l));break;default:vl(e,n,l)}}function xh(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function gs(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var l=0;l<n.length;l++){var i=n[l];Yt=i,vh(i,e)}xh(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)gh(e),e=e.sibling}function gh(e){switch(e.tag){case 0:case 11:case 15:gs(e),e.flags&2048&&Fr(9,e,e.return);break;case 3:gs(e);break;case 12:gs(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Gi(e)):gs(e);break;default:gs(e)}}function Gi(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var l=0;l<n.length;l++){var i=n[l];Yt=i,vh(i,e)}xh(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Fr(8,n,n.return),Gi(n);break;case 22:l=n.stateNode,l._visibility&2&&(l._visibility&=-3,Gi(n));break;default:Gi(n)}e=e.sibling}}function vh(e,n){for(;Yt!==null;){var l=Yt;switch(l.tag){case 0:case 11:case 15:Fr(8,l,n);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var i=l.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:es(l.memoizedState.cache)}if(i=l.child,i!==null)i.return=l,Yt=i;else e:for(l=e;Yt!==null;){i=Yt;var f=i.sibling,x=i.return;if(oh(i),i===l){Yt=null;break e}if(f!==null){f.return=x,Yt=f;break e}Yt=x}}}var y1={getCacheForType:function(e){var n=Qt(Dt),l=n.data.get(e);return l===void 0&&(l=e(),n.data.set(e,l)),l},cacheSignal:function(){return Qt(Dt).controller.signal}},b1=typeof WeakMap=="function"?WeakMap:Map,rt=0,xt=null,qe=null,Ke=0,st=0,Sn=null,Gr=!1,yl=!1,Ru=!1,Nr=0,Mt=0,Wr=0,za=0,Au=0,kn=0,bl=0,vs=null,mn=null,Mu=!1,Wi=0,yh=0,qi=1/0,Yi=null,qr=null,$t=0,Yr=null,jl=null,Tr=0,Lu=0,zu=null,bh=null,ys=0,Du=null;function wn(){return(rt&2)!==0&&Ke!==0?Ke&-Ke:z.T!==null?Hu():ut()}function jh(){if(kn===0)if((Ke&536870912)===0||Qe){var e=Nt;Nt<<=1,(Nt&3932160)===0&&(Nt=262144),kn=e}else kn=536870912;return e=bn.current,e!==null&&(e.flags|=32),kn}function hn(e,n,l){(e===xt&&(st===2||st===9)||e.cancelPendingCommit!==null)&&(Sl(e,0),Kr(e,Ke,kn,!1)),fa(e,l),((rt&2)===0||e!==xt)&&(e===xt&&((rt&2)===0&&(za|=l),Mt===4&&Kr(e,Ke,kn,!1)),ir(e))}function Sh(e,n,l){if((rt&6)!==0)throw Error(o(327));var i=!l&&(n&127)===0&&(n&e.expiredLanes)===0||Me(e,n),f=i?k1(e,n):Ou(e,n,!0),x=i;do{if(f===0){yl&&!i&&Kr(e,n,0,!1);break}else{if(l=e.current.alternate,x&&!j1(l)){f=Ou(e,n,!1),x=!1;continue}if(f===2){if(x=n,e.errorRecoveryDisabledLanes&x)var j=0;else j=e.pendingLanes&-536870913,j=j!==0?j:j&536870912?536870912:0;if(j!==0){n=j;e:{var R=e;f=vs;var V=R.current.memoizedState.isDehydrated;if(V&&(Sl(R,j).flags|=256),j=Ou(R,j,!1),j!==2){if(Ru&&!V){R.errorRecoveryDisabledLanes|=x,za|=x,f=4;break e}x=mn,mn=f,x!==null&&(mn===null?mn=x:mn.push.apply(mn,x))}f=j}if(x=!1,f!==2)continue}}if(f===1){Sl(e,0),Kr(e,n,0,!0);break}e:{switch(i=e,x=f,x){case 0:case 1:throw Error(o(345));case 4:if((n&4194048)!==n)break;case 6:Kr(i,n,kn,!Gr);break e;case 2:mn=null;break;case 3:case 5:break;default:throw Error(o(329))}if((n&62914560)===n&&(f=Wi+300-We(),10<f)){if(Kr(i,n,kn,!Gr),Se(i,0,!0)!==0)break e;Tr=n,i.timeoutHandle=Jh(kh.bind(null,i,l,mn,Yi,Mu,n,kn,za,bl,Gr,x,"Throttled",-0,0),f);break e}kh(i,l,mn,Yi,Mu,n,kn,za,bl,Gr,x,null,-0,0)}}break}while(!0);ir(e)}function kh(e,n,l,i,f,x,j,R,V,J,ie,fe,te,re){if(e.timeoutHandle=-1,fe=n.subtreeFlags,fe&8192||(fe&16785408)===16785408){fe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:pr},hh(n,x,fe);var Ce=(x&62914560)===x?Wi-We():(x&4194048)===x?yh-We():0;if(Ce=l0(fe,Ce),Ce!==null){Tr=x,e.cancelPendingCommit=Ce(Mh.bind(null,e,n,x,l,i,f,j,R,V,ie,fe,null,te,re)),Kr(e,x,j,!J);return}}Mh(e,n,x,l,i,f,j,R,V)}function j1(e){for(var n=e;;){var l=n.tag;if((l===0||l===11||l===15)&&n.flags&16384&&(l=n.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var i=0;i<l.length;i++){var f=l[i],x=f.getSnapshot;f=f.value;try{if(!vn(x(),f))return!1}catch{return!1}}if(l=n.child,n.subtreeFlags&16384&&l!==null)l.return=n,n=l;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Kr(e,n,l,i){n&=~Au,n&=~za,e.suspendedLanes|=n,e.pingedLanes&=~n,i&&(e.warmLanes|=n),i=e.expirationTimes;for(var f=n;0<f;){var x=31-ct(f),j=1<<x;i[x]=-1,f&=~j}l!==0&&nr(e,l,n)}function Ki(){return(rt&6)===0?(bs(0),!1):!0}function _u(){if(qe!==null){if(st===0)var e=qe.return;else e=qe,gr=wa=null,Qc(e),fl=null,ns=0,e=qe;for(;e!==null;)eh(e.alternate,e),e=e.return;qe=null}}function Sl(e,n){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,$1(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),Tr=0,_u(),xt=e,qe=l=hr(e.current,null),Ke=n,st=0,Sn=null,Gr=!1,yl=Me(e,n),Ru=!1,bl=kn=Au=za=Wr=Mt=0,mn=vs=null,Mu=!1,(n&8)!==0&&(n|=n&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=n;0<i;){var f=31-ct(i),x=1<<f;n|=e[f],i&=~x}return Nr=n,xi(),l}function wh(e,n){Ve=null,z.H=us,n===dl||n===wi?(n=Hp(),st=3):n===Uc?(n=Hp(),st=4):st=n===pu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Sn=n,qe===null&&(Mt=1,Ii(e,_n(n,e.current)))}function Ch(){var e=bn.current;return e===null?!0:(Ke&4194048)===Ke?Un===null:(Ke&62914560)===Ke||(Ke&536870912)!==0?e===Un:!1}function Eh(){var e=z.H;return z.H=us,e===null?us:e}function Nh(){var e=z.A;return z.A=y1,e}function Xi(){Mt=4,Gr||(Ke&4194048)!==Ke&&bn.current!==null||(yl=!0),(Wr&134217727)===0&&(za&134217727)===0||xt===null||Kr(xt,Ke,kn,!1)}function Ou(e,n,l){var i=rt;rt|=2;var f=Eh(),x=Nh();(xt!==e||Ke!==n)&&(Yi=null,Sl(e,n)),n=!1;var j=Mt;e:do try{if(st!==0&&qe!==null){var R=qe,V=Sn;switch(st){case 8:_u(),j=6;break e;case 3:case 2:case 9:case 6:bn.current===null&&(n=!0);var J=st;if(st=0,Sn=null,kl(e,R,V,J),l&&yl){j=0;break e}break;default:J=st,st=0,Sn=null,kl(e,R,V,J)}}S1(),j=Mt;break}catch(ie){wh(e,ie)}while(!0);return n&&e.shellSuspendCounter++,gr=wa=null,rt=i,z.H=f,z.A=x,qe===null&&(xt=null,Ke=0,xi()),j}function S1(){for(;qe!==null;)Th(qe)}function k1(e,n){var l=rt;rt|=2;var i=Eh(),f=Nh();xt!==e||Ke!==n?(Yi=null,qi=We()+500,Sl(e,n)):yl=Me(e,n);e:do try{if(st!==0&&qe!==null){n=qe;var x=Sn;t:switch(st){case 1:st=0,Sn=null,kl(e,n,x,1);break;case 2:case 9:if(Ip(x)){st=0,Sn=null,Rh(n);break}n=function(){st!==2&&st!==9||xt!==e||(st=7),ir(e)},x.then(n,n);break e;case 3:st=7;break e;case 4:st=5;break e;case 7:Ip(x)?(st=0,Sn=null,Rh(n)):(st=0,Sn=null,kl(e,n,x,7));break;case 5:var j=null;switch(qe.tag){case 26:j=qe.memoizedState;case 5:case 27:var R=qe;if(j?mx(j):R.stateNode.complete){st=0,Sn=null;var V=R.sibling;if(V!==null)qe=V;else{var J=R.return;J!==null?(qe=J,Qi(J)):qe=null}break t}}st=0,Sn=null,kl(e,n,x,5);break;case 6:st=0,Sn=null,kl(e,n,x,6);break;case 8:_u(),Mt=6;break e;default:throw Error(o(462))}}w1();break}catch(ie){wh(e,ie)}while(!0);return gr=wa=null,z.H=i,z.A=f,rt=l,qe!==null?0:(xt=null,Ke=0,xi(),Mt)}function w1(){for(;qe!==null&&!Tt();)Th(qe)}function Th(e){var n=Zm(e.alternate,e,Nr);e.memoizedProps=e.pendingProps,n===null?Qi(e):qe=n}function Rh(e){var n=e,l=n.alternate;switch(n.tag){case 15:case 0:n=Wm(l,n,n.pendingProps,n.type,void 0,Ke);break;case 11:n=Wm(l,n,n.pendingProps,n.type.render,n.ref,Ke);break;case 5:Qc(n);default:eh(l,n),n=qe=Np(n,Nr),n=Zm(l,n,Nr)}e.memoizedProps=e.pendingProps,n===null?Qi(e):qe=n}function kl(e,n,l,i){gr=wa=null,Qc(n),fl=null,ns=0;var f=n.return;try{if(f1(e,f,n,l,Ke)){Mt=1,Ii(e,_n(l,e.current)),qe=null;return}}catch(x){if(f!==null)throw qe=f,x;Mt=1,Ii(e,_n(l,e.current)),qe=null;return}n.flags&32768?(Qe||i===1?e=!0:yl||(Ke&536870912)!==0?e=!1:(Gr=e=!0,(i===2||i===9||i===3||i===6)&&(i=bn.current,i!==null&&i.tag===13&&(i.flags|=16384))),Ah(n,e)):Qi(n)}function Qi(e){var n=e;do{if((n.flags&32768)!==0){Ah(n,Gr);return}e=n.return;var l=h1(n.alternate,n,Nr);if(l!==null){qe=l;return}if(n=n.sibling,n!==null){qe=n;return}qe=n=e}while(n!==null);Mt===0&&(Mt=5)}function Ah(e,n){do{var l=x1(e.alternate,e);if(l!==null){l.flags&=32767,qe=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!n&&(e=e.sibling,e!==null)){qe=e;return}qe=e=l}while(e!==null);Mt=6,qe=null}function Mh(e,n,l,i,f,x,j,R,V){e.cancelPendingCommit=null;do Zi();while($t!==0);if((rt&6)!==0)throw Error(o(327));if(n!==null){if(n===e.current)throw Error(o(177));if(x=n.lanes|n.childLanes,x|=wc,Hl(e,l,x,j,R,V),e===xt&&(qe=xt=null,Ke=0),jl=n,Yr=e,Tr=l,Lu=x,zu=f,bh=i,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,T1(ot,function(){return Oh(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||i){i=z.T,z.T=null,f=O.p,O.p=2,j=rt,rt|=4;try{g1(e,n,l)}finally{rt=j,O.p=f,z.T=i}}$t=1,Lh(),zh(),Dh()}}function Lh(){if($t===1){$t=0;var e=Yr,n=jl,l=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||l){l=z.T,z.T=null;var i=O.p;O.p=2;var f=rt;rt|=4;try{fh(n,e);var x=Yu,j=vp(e.containerInfo),R=x.focusedElem,V=x.selectionRange;if(j!==R&&R&&R.ownerDocument&&gp(R.ownerDocument.documentElement,R)){if(V!==null&&yc(R)){var J=V.start,ie=V.end;if(ie===void 0&&(ie=J),"selectionStart"in R)R.selectionStart=J,R.selectionEnd=Math.min(ie,R.value.length);else{var fe=R.ownerDocument||document,te=fe&&fe.defaultView||window;if(te.getSelection){var re=te.getSelection(),Ce=R.textContent.length,ze=Math.min(V.start,Ce),mt=V.end===void 0?ze:Math.min(V.end,Ce);!re.extend&&ze>mt&&(j=mt,mt=ze,ze=j);var K=xp(R,ze),G=xp(R,mt);if(K&&G&&(re.rangeCount!==1||re.anchorNode!==K.node||re.anchorOffset!==K.offset||re.focusNode!==G.node||re.focusOffset!==G.offset)){var Z=fe.createRange();Z.setStart(K.node,K.offset),re.removeAllRanges(),ze>mt?(re.addRange(Z),re.extend(G.node,G.offset)):(Z.setEnd(G.node,G.offset),re.addRange(Z))}}}}for(fe=[],re=R;re=re.parentNode;)re.nodeType===1&&fe.push({element:re,left:re.scrollLeft,top:re.scrollTop});for(typeof R.focus=="function"&&R.focus(),R=0;R<fe.length;R++){var ue=fe[R];ue.element.scrollLeft=ue.left,ue.element.scrollTop=ue.top}}uo=!!qu,Yu=qu=null}finally{rt=f,O.p=i,z.T=l}}e.current=n,$t=2}}function zh(){if($t===2){$t=0;var e=Yr,n=jl,l=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||l){l=z.T,z.T=null;var i=O.p;O.p=2;var f=rt;rt|=4;try{ih(e,n.alternate,n)}finally{rt=f,O.p=i,z.T=l}}$t=3}}function Dh(){if($t===4||$t===3){$t=0,Gt();var e=Yr,n=jl,l=Tr,i=bh;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?$t=5:($t=0,jl=Yr=null,_h(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(qr=null),zr(l),n=n.stateNode,Ut&&typeof Ut.onCommitFiberRoot=="function")try{Ut.onCommitFiberRoot(Mn,n,void 0,(n.current.flags&128)===128)}catch{}if(i!==null){n=z.T,f=O.p,O.p=2,z.T=null;try{for(var x=e.onRecoverableError,j=0;j<i.length;j++){var R=i[j];x(R.value,{componentStack:R.stack})}}finally{z.T=n,O.p=f}}(Tr&3)!==0&&Zi(),ir(e),f=e.pendingLanes,(l&261930)!==0&&(f&42)!==0?e===Du?ys++:(ys=0,Du=e):ys=0,bs(0)}}function _h(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,es(n)))}function Zi(){return Lh(),zh(),Dh(),Oh()}function Oh(){if($t!==5)return!1;var e=Yr,n=Lu;Lu=0;var l=zr(Tr),i=z.T,f=O.p;try{O.p=32>l?32:l,z.T=null,l=zu,zu=null;var x=Yr,j=Tr;if($t=0,jl=Yr=null,Tr=0,(rt&6)!==0)throw Error(o(331));var R=rt;if(rt|=4,gh(x.current),mh(x,x.current,j,l),rt=R,bs(0,!1),Ut&&typeof Ut.onPostCommitFiberRoot=="function")try{Ut.onPostCommitFiberRoot(Mn,x)}catch{}return!0}finally{O.p=f,z.T=i,_h(e,n)}}function Bh(e,n,l){n=_n(l,n),n=fu(e.stateNode,n,2),e=$r(e,n,2),e!==null&&(fa(e,2),ir(e))}function it(e,n,l){if(e.tag===3)Bh(e,e,l);else for(;n!==null;){if(n.tag===3){Bh(n,e,l);break}else if(n.tag===1){var i=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(qr===null||!qr.has(i))){e=_n(l,e),l=Im(2),i=$r(n,l,2),i!==null&&(Um(l,i,n,e),fa(i,2),ir(i));break}}n=n.return}}function Bu(e,n,l){var i=e.pingCache;if(i===null){i=e.pingCache=new b1;var f=new Set;i.set(n,f)}else f=i.get(n),f===void 0&&(f=new Set,i.set(n,f));f.has(l)||(Ru=!0,f.add(l),e=C1.bind(null,e,n,l),n.then(e,e))}function C1(e,n,l){var i=e.pingCache;i!==null&&i.delete(n),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,xt===e&&(Ke&l)===l&&(Mt===4||Mt===3&&(Ke&62914560)===Ke&&300>We()-Wi?(rt&2)===0&&Sl(e,0):Au|=l,bl===Ke&&(bl=0)),ir(e)}function Ih(e,n){n===0&&(n=qn()),e=ja(e,n),e!==null&&(fa(e,n),ir(e))}function E1(e){var n=e.memoizedState,l=0;n!==null&&(l=n.retryLane),Ih(e,l)}function N1(e,n){var l=0;switch(e.tag){case 31:case 13:var i=e.stateNode,f=e.memoizedState;f!==null&&(l=f.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(o(314))}i!==null&&i.delete(n),Ih(e,l)}function T1(e,n){return Ct(e,n)}var Ji=null,wl=null,Iu=!1,eo=!1,Uu=!1,Xr=0;function ir(e){e!==wl&&e.next===null&&(wl===null?Ji=wl=e:wl=wl.next=e),eo=!0,Iu||(Iu=!0,A1())}function bs(e,n){if(!Uu&&eo){Uu=!0;do for(var l=!1,i=Ji;i!==null;){if(e!==0){var f=i.pendingLanes;if(f===0)var x=0;else{var j=i.suspendedLanes,R=i.pingedLanes;x=(1<<31-ct(42|e)+1)-1,x&=f&~(j&~R),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(l=!0,Vh(i,x))}else x=Ke,x=Se(i,i===xt?x:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(x&3)===0||Me(i,x)||(l=!0,Vh(i,x));i=i.next}while(l);Uu=!1}}function R1(){Uh()}function Uh(){eo=Iu=!1;var e=0;Xr!==0&&H1()&&(e=Xr);for(var n=We(),l=null,i=Ji;i!==null;){var f=i.next,x=Hh(i,n);x===0?(i.next=null,l===null?Ji=f:l.next=f,f===null&&(wl=l)):(l=i,(e!==0||(x&3)!==0)&&(eo=!0)),i=f}$t!==0&&$t!==5||bs(e),Xr!==0&&(Xr=0)}function Hh(e,n){for(var l=e.suspendedLanes,i=e.pingedLanes,f=e.expirationTimes,x=e.pendingLanes&-62914561;0<x;){var j=31-ct(x),R=1<<j,V=f[j];V===-1?((R&l)===0||(R&i)!==0)&&(f[j]=Fa(R,n)):V<=n&&(e.expiredLanes|=R),x&=~R}if(n=xt,l=Ke,l=Se(e,e===n?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,l===0||e===n&&(st===2||st===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&>(i),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||Me(e,l)){if(n=l&-l,n===e.callbackPriority)return n;switch(i!==null&>(i),zr(l)){case 2:case 8:l=ye;break;case 32:l=ot;break;case 268435456:l=Kt;break;default:l=ot}return i=$h.bind(null,e),l=Ct(l,i),e.callbackPriority=n,e.callbackNode=l,n}return i!==null&&i!==null&>(i),e.callbackPriority=2,e.callbackNode=null,2}function $h(e,n){if($t!==0&&$t!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(Zi()&&e.callbackNode!==l)return null;var i=Ke;return i=Se(e,e===xt?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(Sh(e,i,n),Hh(e,We()),e.callbackNode!=null&&e.callbackNode===l?$h.bind(null,e):null)}function Vh(e,n){if(Zi())return null;Sh(e,n,!0)}function A1(){V1(function(){(rt&6)!==0?Ct(xn,R1):Uh()})}function Hu(){if(Xr===0){var e=cl;e===0&&(e=gn,gn<<=1,(gn&261888)===0&&(gn=256)),Xr=e}return Xr}function Ph(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:oi(""+e)}function Fh(e,n){var l=n.ownerDocument.createElement("input");return l.name=n.name,l.value=n.value,e.id&&l.setAttribute("form",e.id),n.parentNode.insertBefore(l,n),e=new FormData(e),l.parentNode.removeChild(l),e}function M1(e,n,l,i,f){if(n==="submit"&&l&&l.stateNode===f){var x=Ph((f[dt]||null).action),j=i.submitter;j&&(n=(n=j[dt]||null)?Ph(n.formAction):j.getAttribute("formAction"),n!==null&&(x=n,j=null));var R=new fi("action","action",null,i,f);e.push({event:R,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Xr!==0){var V=j?Fh(f,j):new FormData(f);su(l,{pending:!0,data:V,method:f.method,action:x},null,V)}}else typeof x=="function"&&(R.preventDefault(),V=j?Fh(f,j):new FormData(f),su(l,{pending:!0,data:V,method:f.method,action:x},x,V))},currentTarget:f}]})}}for(var $u=0;$u<kc.length;$u++){var Vu=kc[$u],L1=Vu.toLowerCase(),z1=Vu[0].toUpperCase()+Vu.slice(1);Yn(L1,"on"+z1)}Yn(jp,"onAnimationEnd"),Yn(Sp,"onAnimationIteration"),Yn(kp,"onAnimationStart"),Yn("dblclick","onDoubleClick"),Yn("focusin","onFocus"),Yn("focusout","onBlur"),Yn(Kb,"onTransitionRun"),Yn(Xb,"onTransitionStart"),Yn(Qb,"onTransitionCancel"),Yn(wp,"onTransitionEnd"),Ka("onMouseEnter",["mouseout","mouseover"]),Ka("onMouseLeave",["mouseout","mouseover"]),Ka("onPointerEnter",["pointerout","pointerover"]),Ka("onPointerLeave",["pointerout","pointerover"]),ga("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ga("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ga("onBeforeInput",["compositionend","keypress","textInput","paste"]),ga("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ga("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ga("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var js="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(" "),D1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(js));function Gh(e,n){n=(n&4)!==0;for(var l=0;l<e.length;l++){var i=e[l],f=i.event;i=i.listeners;e:{var x=void 0;if(n)for(var j=i.length-1;0<=j;j--){var R=i[j],V=R.instance,J=R.currentTarget;if(R=R.listener,V!==x&&f.isPropagationStopped())break e;x=R,f.currentTarget=J;try{x(f)}catch(ie){hi(ie)}f.currentTarget=null,x=V}else for(j=0;j<i.length;j++){if(R=i[j],V=R.instance,J=R.currentTarget,R=R.listener,V!==x&&f.isPropagationStopped())break e;x=R,f.currentTarget=J;try{x(f)}catch(ie){hi(ie)}f.currentTarget=null,x=V}}}}function Ye(e,n){var l=n[rr];l===void 0&&(l=n[rr]=new Set);var i=e+"__bubble";l.has(i)||(Wh(n,e,2,!1),l.add(i))}function Pu(e,n,l){var i=0;n&&(i|=4),Wh(l,e,i,n)}var to="_reactListening"+Math.random().toString(36).slice(2);function Fu(e){if(!e[to]){e[to]=!0,Uf.forEach(function(l){l!=="selectionchange"&&(D1.has(l)||Pu(l,!1,e),Pu(l,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[to]||(n[to]=!0,Pu("selectionchange",!1,n))}}function Wh(e,n,l,i){switch(jx(n)){case 2:var f=o0;break;case 8:f=c0;break;default:f=ld}l=f.bind(null,n,l,e),f=void 0,!uc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),i?f!==void 0?e.addEventListener(n,l,{capture:!0,passive:f}):e.addEventListener(n,l,!0):f!==void 0?e.addEventListener(n,l,{passive:f}):e.addEventListener(n,l,!1)}function Gu(e,n,l,i,f){var x=i;if((n&1)===0&&(n&2)===0&&i!==null)e:for(;;){if(i===null)return;var j=i.tag;if(j===3||j===4){var R=i.stateNode.containerInfo;if(R===f)break;if(j===4)for(j=i.return;j!==null;){var V=j.tag;if((V===3||V===4)&&j.stateNode.containerInfo===f)return;j=j.return}for(;R!==null;){if(j=Wa(R),j===null)return;if(V=j.tag,V===5||V===6||V===26||V===27){i=x=j;continue e}R=R.parentNode}}i=i.return}Qf(function(){var J=x,ie=oc(l),fe=[];e:{var te=Cp.get(e);if(te!==void 0){var re=fi,Ce=e;switch(e){case"keypress":if(ui(l)===0)break e;case"keydown":case"keyup":re=Nb;break;case"focusin":Ce="focus",re=mc;break;case"focusout":Ce="blur",re=mc;break;case"beforeblur":case"afterblur":re=mc;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":re=ep;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":re=hb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":re=Ab;break;case jp:case Sp:case kp:re=vb;break;case wp:re=Lb;break;case"scroll":case"scrollend":re=pb;break;case"wheel":re=Db;break;case"copy":case"cut":case"paste":re=bb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":re=np;break;case"toggle":case"beforetoggle":re=Ob}var ze=(n&4)!==0,mt=!ze&&(e==="scroll"||e==="scrollend"),K=ze?te!==null?te+"Capture":null:te;ze=[];for(var G=J,Z;G!==null;){var ue=G;if(Z=ue.stateNode,ue=ue.tag,ue!==5&&ue!==26&&ue!==27||Z===null||K===null||(ue=Pl(G,K),ue!=null&&ze.push(Ss(G,ue,Z))),mt)break;G=G.return}0<ze.length&&(te=new re(te,Ce,null,l,ie),fe.push({event:te,listeners:ze}))}}if((n&7)===0){e:{if(te=e==="mouseover"||e==="pointerover",re=e==="mouseout"||e==="pointerout",te&&l!==ic&&(Ce=l.relatedTarget||l.fromElement)&&(Wa(Ce)||Ce[xa]))break e;if((re||te)&&(te=ie.window===ie?ie:(te=ie.ownerDocument)?te.defaultView||te.parentWindow:window,re?(Ce=l.relatedTarget||l.toElement,re=J,Ce=Ce?Wa(Ce):null,Ce!==null&&(mt=u(Ce),ze=Ce.tag,Ce!==mt||ze!==5&&ze!==27&&ze!==6)&&(Ce=null)):(re=null,Ce=J),re!==Ce)){if(ze=ep,ue="onMouseLeave",K="onMouseEnter",G="mouse",(e==="pointerout"||e==="pointerover")&&(ze=np,ue="onPointerLeave",K="onPointerEnter",G="pointer"),mt=re==null?te:Vl(re),Z=Ce==null?te:Vl(Ce),te=new ze(ue,G+"leave",re,l,ie),te.target=mt,te.relatedTarget=Z,ue=null,Wa(ie)===J&&(ze=new ze(K,G+"enter",Ce,l,ie),ze.target=Z,ze.relatedTarget=mt,ue=ze),mt=ue,re&&Ce)t:{for(ze=_1,K=re,G=Ce,Z=0,ue=K;ue;ue=ze(ue))Z++;ue=0;for(var Ae=G;Ae;Ae=ze(Ae))ue++;for(;0<Z-ue;)K=ze(K),Z--;for(;0<ue-Z;)G=ze(G),ue--;for(;Z--;){if(K===G||G!==null&&K===G.alternate){ze=K;break t}K=ze(K),G=ze(G)}ze=null}else ze=null;re!==null&&qh(fe,te,re,ze,!1),Ce!==null&&mt!==null&&qh(fe,mt,Ce,ze,!0)}}e:{if(te=J?Vl(J):window,re=te.nodeName&&te.nodeName.toLowerCase(),re==="select"||re==="input"&&te.type==="file")var Je=up;else if(op(te))if(dp)Je=Wb;else{Je=Fb;var Ee=Pb}else re=te.nodeName,!re||re.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?J&&sc(J.elementType)&&(Je=up):Je=Gb;if(Je&&(Je=Je(e,J))){cp(fe,Je,l,ie);break e}Ee&&Ee(e,te,J),e==="focusout"&&J&&te.type==="number"&&J.memoizedProps.value!=null&&lc(te,"number",te.value)}switch(Ee=J?Vl(J):window,e){case"focusin":(op(Ee)||Ee.contentEditable==="true")&&(tl=Ee,bc=J,Ql=null);break;case"focusout":Ql=bc=tl=null;break;case"mousedown":jc=!0;break;case"contextmenu":case"mouseup":case"dragend":jc=!1,yp(fe,l,ie);break;case"selectionchange":if(Yb)break;case"keydown":case"keyup":yp(fe,l,ie)}var Pe;if(xc)e:{switch(e){case"compositionstart":var Xe="onCompositionStart";break e;case"compositionend":Xe="onCompositionEnd";break e;case"compositionupdate":Xe="onCompositionUpdate";break e}Xe=void 0}else el?sp(e,l)&&(Xe="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(Xe="onCompositionStart");Xe&&(rp&&l.locale!=="ko"&&(el||Xe!=="onCompositionStart"?Xe==="onCompositionEnd"&&el&&(Pe=Zf()):(Dr=ie,dc="value"in Dr?Dr.value:Dr.textContent,el=!0)),Ee=no(J,Xe),0<Ee.length&&(Xe=new tp(Xe,e,null,l,ie),fe.push({event:Xe,listeners:Ee}),Pe?Xe.data=Pe:(Pe=ip(l),Pe!==null&&(Xe.data=Pe)))),(Pe=Ib?Ub(e,l):Hb(e,l))&&(Xe=no(J,"onBeforeInput"),0<Xe.length&&(Ee=new tp("onBeforeInput","beforeinput",null,l,ie),fe.push({event:Ee,listeners:Xe}),Ee.data=Pe)),M1(fe,e,J,l,ie)}Gh(fe,n)})}function Ss(e,n,l){return{instance:e,listener:n,currentTarget:l}}function no(e,n){for(var l=n+"Capture",i=[];e!==null;){var f=e,x=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||x===null||(f=Pl(e,l),f!=null&&i.unshift(Ss(e,f,x)),f=Pl(e,n),f!=null&&i.push(Ss(e,f,x))),e.tag===3)return i;e=e.return}return[]}function _1(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function qh(e,n,l,i,f){for(var x=n._reactName,j=[];l!==null&&l!==i;){var R=l,V=R.alternate,J=R.stateNode;if(R=R.tag,V!==null&&V===i)break;R!==5&&R!==26&&R!==27||J===null||(V=J,f?(J=Pl(l,x),J!=null&&j.unshift(Ss(l,J,V))):f||(J=Pl(l,x),J!=null&&j.push(Ss(l,J,V)))),l=l.return}j.length!==0&&e.push({event:n,listeners:j})}var O1=/\r\n?/g,B1=/\u0000|\uFFFD/g;function Yh(e){return(typeof e=="string"?e:""+e).replace(O1,`
|
|
50
|
+
`).replace(B1,"")}function Kh(e,n){return n=Yh(n),Yh(e)===n}function pt(e,n,l,i,f,x){switch(l){case"children":typeof i=="string"?n==="body"||n==="textarea"&&i===""||Qa(e,i):(typeof i=="number"||typeof i=="bigint")&&n!=="body"&&Qa(e,""+i);break;case"className":si(e,"class",i);break;case"tabIndex":si(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":si(e,l,i);break;case"style":Kf(e,i,x);break;case"data":if(n!=="object"){si(e,"data",i);break}case"src":case"href":if(i===""&&(n!=="a"||l!=="href")){e.removeAttribute(l);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(l);break}i=oi(""+i),e.setAttribute(l,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(l==="formAction"?(n!=="input"&&pt(e,n,"name",f.name,f,null),pt(e,n,"formEncType",f.formEncType,f,null),pt(e,n,"formMethod",f.formMethod,f,null),pt(e,n,"formTarget",f.formTarget,f,null)):(pt(e,n,"encType",f.encType,f,null),pt(e,n,"method",f.method,f,null),pt(e,n,"target",f.target,f,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(l);break}i=oi(""+i),e.setAttribute(l,i);break;case"onClick":i!=null&&(e.onclick=pr);break;case"onScroll":i!=null&&Ye("scroll",e);break;case"onScrollEnd":i!=null&&Ye("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(o(61));if(l=i.__html,l!=null){if(f.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}l=oi(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,""+i):e.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":i===!0?e.setAttribute(l,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,i):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(l,i):e.removeAttribute(l);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(l):e.setAttribute(l,i);break;case"popover":Ye("beforetoggle",e),Ye("toggle",e),li(e,"popover",i);break;case"xlinkActuate":fr(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":fr(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":fr(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":fr(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":fr(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":fr(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":fr(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":fr(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":fr(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":li(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=db.get(l)||l,li(e,l,i))}}function Wu(e,n,l,i,f,x){switch(l){case"style":Kf(e,i,x);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(o(61));if(l=i.__html,l!=null){if(f.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"children":typeof i=="string"?Qa(e,i):(typeof i=="number"||typeof i=="bigint")&&Qa(e,""+i);break;case"onScroll":i!=null&&Ye("scroll",e);break;case"onScrollEnd":i!=null&&Ye("scrollend",e);break;case"onClick":i!=null&&(e.onclick=pr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Hf.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(f=l.endsWith("Capture"),n=l.slice(2,f?l.length-7:void 0),x=e[dt]||null,x=x!=null?x[l]:null,typeof x=="function"&&e.removeEventListener(n,x,f),typeof i=="function")){typeof x!="function"&&x!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(n,i,f);break e}l in e?e[l]=i:i===!0?e.setAttribute(l,""):li(e,l,i)}}}function Jt(e,n,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ye("error",e),Ye("load",e);var i=!1,f=!1,x;for(x in l)if(l.hasOwnProperty(x)){var j=l[x];if(j!=null)switch(x){case"src":i=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,n));default:pt(e,n,x,j,l,null)}}f&&pt(e,n,"srcSet",l.srcSet,l,null),i&&pt(e,n,"src",l.src,l,null);return;case"input":Ye("invalid",e);var R=x=j=f=null,V=null,J=null;for(i in l)if(l.hasOwnProperty(i)){var ie=l[i];if(ie!=null)switch(i){case"name":f=ie;break;case"type":j=ie;break;case"checked":V=ie;break;case"defaultChecked":J=ie;break;case"value":x=ie;break;case"defaultValue":R=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(o(137,n));break;default:pt(e,n,i,ie,l,null)}}Gf(e,x,R,V,J,j,f,!1);return;case"select":Ye("invalid",e),i=j=x=null;for(f in l)if(l.hasOwnProperty(f)&&(R=l[f],R!=null))switch(f){case"value":x=R;break;case"defaultValue":j=R;break;case"multiple":i=R;default:pt(e,n,f,R,l,null)}n=x,l=j,e.multiple=!!i,n!=null?Xa(e,!!i,n,!1):l!=null&&Xa(e,!!i,l,!0);return;case"textarea":Ye("invalid",e),x=f=i=null;for(j in l)if(l.hasOwnProperty(j)&&(R=l[j],R!=null))switch(j){case"value":i=R;break;case"defaultValue":f=R;break;case"children":x=R;break;case"dangerouslySetInnerHTML":if(R!=null)throw Error(o(91));break;default:pt(e,n,j,R,l,null)}qf(e,i,f,x);return;case"option":for(V in l)if(l.hasOwnProperty(V)&&(i=l[V],i!=null))switch(V){case"selected":e.selected=i&&typeof i!="function"&&typeof i!="symbol";break;default:pt(e,n,V,i,l,null)}return;case"dialog":Ye("beforetoggle",e),Ye("toggle",e),Ye("cancel",e),Ye("close",e);break;case"iframe":case"object":Ye("load",e);break;case"video":case"audio":for(i=0;i<js.length;i++)Ye(js[i],e);break;case"image":Ye("error",e),Ye("load",e);break;case"details":Ye("toggle",e);break;case"embed":case"source":case"link":Ye("error",e),Ye("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(J in l)if(l.hasOwnProperty(J)&&(i=l[J],i!=null))switch(J){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,n));default:pt(e,n,J,i,l,null)}return;default:if(sc(n)){for(ie in l)l.hasOwnProperty(ie)&&(i=l[ie],i!==void 0&&Wu(e,n,ie,i,l,void 0));return}}for(R in l)l.hasOwnProperty(R)&&(i=l[R],i!=null&&pt(e,n,R,i,l,null))}function I1(e,n,l,i){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,x=null,j=null,R=null,V=null,J=null,ie=null;for(re in l){var fe=l[re];if(l.hasOwnProperty(re)&&fe!=null)switch(re){case"checked":break;case"value":break;case"defaultValue":V=fe;default:i.hasOwnProperty(re)||pt(e,n,re,null,i,fe)}}for(var te in i){var re=i[te];if(fe=l[te],i.hasOwnProperty(te)&&(re!=null||fe!=null))switch(te){case"type":x=re;break;case"name":f=re;break;case"checked":J=re;break;case"defaultChecked":ie=re;break;case"value":j=re;break;case"defaultValue":R=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(o(137,n));break;default:re!==fe&&pt(e,n,te,re,i,fe)}}ac(e,j,R,V,J,ie,x,f);return;case"select":re=j=R=te=null;for(x in l)if(V=l[x],l.hasOwnProperty(x)&&V!=null)switch(x){case"value":break;case"multiple":re=V;default:i.hasOwnProperty(x)||pt(e,n,x,null,i,V)}for(f in i)if(x=i[f],V=l[f],i.hasOwnProperty(f)&&(x!=null||V!=null))switch(f){case"value":te=x;break;case"defaultValue":R=x;break;case"multiple":j=x;default:x!==V&&pt(e,n,f,x,i,V)}n=R,l=j,i=re,te!=null?Xa(e,!!l,te,!1):!!i!=!!l&&(n!=null?Xa(e,!!l,n,!0):Xa(e,!!l,l?[]:"",!1));return;case"textarea":re=te=null;for(R in l)if(f=l[R],l.hasOwnProperty(R)&&f!=null&&!i.hasOwnProperty(R))switch(R){case"value":break;case"children":break;default:pt(e,n,R,null,i,f)}for(j in i)if(f=i[j],x=l[j],i.hasOwnProperty(j)&&(f!=null||x!=null))switch(j){case"value":te=f;break;case"defaultValue":re=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(o(91));break;default:f!==x&&pt(e,n,j,f,i,x)}Wf(e,te,re);return;case"option":for(var Ce in l)if(te=l[Ce],l.hasOwnProperty(Ce)&&te!=null&&!i.hasOwnProperty(Ce))switch(Ce){case"selected":e.selected=!1;break;default:pt(e,n,Ce,null,i,te)}for(V in i)if(te=i[V],re=l[V],i.hasOwnProperty(V)&&te!==re&&(te!=null||re!=null))switch(V){case"selected":e.selected=te&&typeof te!="function"&&typeof te!="symbol";break;default:pt(e,n,V,te,i,re)}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 ze in l)te=l[ze],l.hasOwnProperty(ze)&&te!=null&&!i.hasOwnProperty(ze)&&pt(e,n,ze,null,i,te);for(J in i)if(te=i[J],re=l[J],i.hasOwnProperty(J)&&te!==re&&(te!=null||re!=null))switch(J){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(o(137,n));break;default:pt(e,n,J,te,i,re)}return;default:if(sc(n)){for(var mt in l)te=l[mt],l.hasOwnProperty(mt)&&te!==void 0&&!i.hasOwnProperty(mt)&&Wu(e,n,mt,void 0,i,te);for(ie in i)te=i[ie],re=l[ie],!i.hasOwnProperty(ie)||te===re||te===void 0&&re===void 0||Wu(e,n,ie,te,i,re);return}}for(var K in l)te=l[K],l.hasOwnProperty(K)&&te!=null&&!i.hasOwnProperty(K)&&pt(e,n,K,null,i,te);for(fe in i)te=i[fe],re=l[fe],!i.hasOwnProperty(fe)||te===re||te==null&&re==null||pt(e,n,fe,te,i,re)}function Xh(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function U1(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,l=performance.getEntriesByType("resource"),i=0;i<l.length;i++){var f=l[i],x=f.transferSize,j=f.initiatorType,R=f.duration;if(x&&R&&Xh(j)){for(j=0,R=f.responseEnd,i+=1;i<l.length;i++){var V=l[i],J=V.startTime;if(J>R)break;var ie=V.transferSize,fe=V.initiatorType;ie&&Xh(fe)&&(V=V.responseEnd,j+=ie*(V<R?1:(R-J)/(V-J)))}if(--i,n+=8*(x+j)/(f.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var qu=null,Yu=null;function ro(e){return e.nodeType===9?e:e.ownerDocument}function Qh(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 Zh(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function Ku(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Xu=null;function H1(){var e=window.event;return e&&e.type==="popstate"?e===Xu?!1:(Xu=e,!0):(Xu=null,!1)}var Jh=typeof setTimeout=="function"?setTimeout:void 0,$1=typeof clearTimeout=="function"?clearTimeout:void 0,ex=typeof Promise=="function"?Promise:void 0,V1=typeof queueMicrotask=="function"?queueMicrotask:typeof ex<"u"?function(e){return ex.resolve(null).then(e).catch(P1)}:Jh;function P1(e){setTimeout(function(){throw e})}function Qr(e){return e==="head"}function tx(e,n){var l=n,i=0;do{var f=l.nextSibling;if(e.removeChild(l),f&&f.nodeType===8)if(l=f.data,l==="/$"||l==="/&"){if(i===0){e.removeChild(f),Tl(n);return}i--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")i++;else if(l==="html")ks(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,ks(l);for(var x=l.firstChild;x;){var j=x.nextSibling,R=x.nodeName;x[$l]||R==="SCRIPT"||R==="STYLE"||R==="LINK"&&x.rel.toLowerCase()==="stylesheet"||l.removeChild(x),x=j}}else l==="body"&&ks(e.ownerDocument.body);l=f}while(l);Tl(n)}function nx(e,n){var l=e;e=0;do{var i=l.nextSibling;if(l.nodeType===1?n?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(n?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),i&&i.nodeType===8)if(l=i.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=i}while(l)}function Qu(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var l=n;switch(n=n.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Qu(l),nc(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function F1(e,n,l,i){for(;e.nodeType===1;){var f=l;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[$l])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(x=e.getAttribute("rel"),x==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(x!==f.rel||e.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||e.getAttribute("title")!==(f.title==null?null:f.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(x=e.getAttribute("src"),(x!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&x&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var x=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===x)return e}else return e;if(e=Hn(e.nextSibling),e===null)break}return null}function G1(e,n,l){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=Hn(e.nextSibling),e===null))return null;return e}function rx(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Hn(e.nextSibling),e===null))return null;return e}function Zu(e){return e.data==="$?"||e.data==="$~"}function Ju(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function W1(e,n){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||l.readyState!=="loading")n();else{var i=function(){n(),l.removeEventListener("DOMContentLoaded",i)};l.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function Hn(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var ed=null;function ax(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(n===0)return Hn(e.nextSibling);n--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||n++}e=e.nextSibling}return null}function lx(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var l=e.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(n===0)return e;n--}else l!=="/$"&&l!=="/&"||n++}e=e.previousSibling}return null}function sx(e,n,l){switch(n=ro(l),e){case"html":if(e=n.documentElement,!e)throw Error(o(452));return e;case"head":if(e=n.head,!e)throw Error(o(453));return e;case"body":if(e=n.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function ks(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);nc(e)}var $n=new Map,ix=new Set;function ao(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Rr=O.d;O.d={f:q1,r:Y1,D:K1,C:X1,L:Q1,m:Z1,X:e0,S:J1,M:t0};function q1(){var e=Rr.f(),n=Ki();return e||n}function Y1(e){var n=qa(e);n!==null&&n.tag===5&&n.type==="form"?wm(n):Rr.r(e)}var Cl=typeof document>"u"?null:document;function ox(e,n,l){var i=Cl;if(i&&typeof n=="string"&&n){var f=zn(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof l=="string"&&(f+='[crossorigin="'+l+'"]'),ix.has(f)||(ix.add(f),e={rel:e,crossOrigin:l,href:n},i.querySelector(f)===null&&(n=i.createElement("link"),Jt(n,"link",e),qt(n),i.head.appendChild(n)))}}function K1(e){Rr.D(e),ox("dns-prefetch",e,null)}function X1(e,n){Rr.C(e,n),ox("preconnect",e,n)}function Q1(e,n,l){Rr.L(e,n,l);var i=Cl;if(i&&e&&n){var f='link[rel="preload"][as="'+zn(n)+'"]';n==="image"&&l&&l.imageSrcSet?(f+='[imagesrcset="'+zn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(f+='[imagesizes="'+zn(l.imageSizes)+'"]')):f+='[href="'+zn(e)+'"]';var x=f;switch(n){case"style":x=El(e);break;case"script":x=Nl(e)}$n.has(x)||(e=v({rel:"preload",href:n==="image"&&l&&l.imageSrcSet?void 0:e,as:n},l),$n.set(x,e),i.querySelector(f)!==null||n==="style"&&i.querySelector(ws(x))||n==="script"&&i.querySelector(Cs(x))||(n=i.createElement("link"),Jt(n,"link",e),qt(n),i.head.appendChild(n)))}}function Z1(e,n){Rr.m(e,n);var l=Cl;if(l&&e){var i=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+zn(i)+'"][href="'+zn(e)+'"]',x=f;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Nl(e)}if(!$n.has(x)&&(e=v({rel:"modulepreload",href:e},n),$n.set(x,e),l.querySelector(f)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Cs(x)))return}i=l.createElement("link"),Jt(i,"link",e),qt(i),l.head.appendChild(i)}}}function J1(e,n,l){Rr.S(e,n,l);var i=Cl;if(i&&e){var f=Ya(i).hoistableStyles,x=El(e);n=n||"default";var j=f.get(x);if(!j){var R={loading:0,preload:null};if(j=i.querySelector(ws(x)))R.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":n},l),(l=$n.get(x))&&td(e,l);var V=j=i.createElement("link");qt(V),Jt(V,"link",e),V._p=new Promise(function(J,ie){V.onload=J,V.onerror=ie}),V.addEventListener("load",function(){R.loading|=1}),V.addEventListener("error",function(){R.loading|=2}),R.loading|=4,lo(j,n,i)}j={type:"stylesheet",instance:j,count:1,state:R},f.set(x,j)}}}function e0(e,n){Rr.X(e,n);var l=Cl;if(l&&e){var i=Ya(l).hoistableScripts,f=Nl(e),x=i.get(f);x||(x=l.querySelector(Cs(f)),x||(e=v({src:e,async:!0},n),(n=$n.get(f))&&nd(e,n),x=l.createElement("script"),qt(x),Jt(x,"link",e),l.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},i.set(f,x))}}function t0(e,n){Rr.M(e,n);var l=Cl;if(l&&e){var i=Ya(l).hoistableScripts,f=Nl(e),x=i.get(f);x||(x=l.querySelector(Cs(f)),x||(e=v({src:e,async:!0,type:"module"},n),(n=$n.get(f))&&nd(e,n),x=l.createElement("script"),qt(x),Jt(x,"link",e),l.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},i.set(f,x))}}function cx(e,n,l,i){var f=(f=de.current)?ao(f):null;if(!f)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(n=El(l.href),l=Ya(f).hoistableStyles,i=l.get(n),i||(i={type:"style",instance:null,count:0,state:null},l.set(n,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=El(l.href);var x=Ya(f).hoistableStyles,j=x.get(e);if(j||(f=f.ownerDocument||f,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(e,j),(x=f.querySelector(ws(e)))&&!x._p&&(j.instance=x,j.state.loading=5),$n.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},$n.set(e,l),x||n0(f,e,l,j.state))),n&&i===null)throw Error(o(528,""));return j}if(n&&i!==null)throw Error(o(529,""));return null;case"script":return n=l.async,l=l.src,typeof l=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Nl(l),l=Ya(f).hoistableScripts,i=l.get(n),i||(i={type:"script",instance:null,count:0,state:null},l.set(n,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function El(e){return'href="'+zn(e)+'"'}function ws(e){return'link[rel="stylesheet"]['+e+"]"}function ux(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function n0(e,n,l,i){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?i.loading=1:(n=e.createElement("link"),i.preload=n,n.addEventListener("load",function(){return i.loading|=1}),n.addEventListener("error",function(){return i.loading|=2}),Jt(n,"link",l),qt(n),e.head.appendChild(n))}function Nl(e){return'[src="'+zn(e)+'"]'}function Cs(e){return"script[async]"+e}function dx(e,n,l){if(n.count++,n.instance===null)switch(n.type){case"style":var i=e.querySelector('style[data-href~="'+zn(l.href)+'"]');if(i)return n.instance=i,qt(i),i;var f=v({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),qt(i),Jt(i,"style",f),lo(i,l.precedence,e),n.instance=i;case"stylesheet":f=El(l.href);var x=e.querySelector(ws(f));if(x)return n.state.loading|=4,n.instance=x,qt(x),x;i=ux(l),(f=$n.get(f))&&td(i,f),x=(e.ownerDocument||e).createElement("link"),qt(x);var j=x;return j._p=new Promise(function(R,V){j.onload=R,j.onerror=V}),Jt(x,"link",i),n.state.loading|=4,lo(x,l.precedence,e),n.instance=x;case"script":return x=Nl(l.src),(f=e.querySelector(Cs(x)))?(n.instance=f,qt(f),f):(i=l,(f=$n.get(x))&&(i=v({},l),nd(i,f)),e=e.ownerDocument||e,f=e.createElement("script"),qt(f),Jt(f,"link",i),e.head.appendChild(f),n.instance=f);case"void":return null;default:throw Error(o(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(i=n.instance,n.state.loading|=4,lo(i,l.precedence,e));return n.instance}function lo(e,n,l){for(var i=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=i.length?i[i.length-1]:null,x=f,j=0;j<i.length;j++){var R=i[j];if(R.dataset.precedence===n)x=R;else if(x!==f)break}x?x.parentNode.insertBefore(e,x.nextSibling):(n=l.nodeType===9?l.head:l,n.insertBefore(e,n.firstChild))}function td(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function nd(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var so=null;function fx(e,n,l){if(so===null){var i=new Map,f=so=new Map;f.set(l,i)}else f=so,i=f.get(l),i||(i=new Map,f.set(l,i));if(i.has(e))return i;for(i.set(e,null),l=l.getElementsByTagName(e),f=0;f<l.length;f++){var x=l[f];if(!(x[$l]||x[Ht]||e==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var j=x.getAttribute(n)||"";j=e+j;var R=i.get(j);R?R.push(x):i.set(j,[x])}}return i}function px(e,n,l){e=e.ownerDocument||e,e.head.insertBefore(l,n==="title"?e.querySelector("head > title"):null)}function r0(e,n,l){if(l===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function mx(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function a0(e,n,l,i){if(l.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var f=El(i.href),x=n.querySelector(ws(f));if(x){n=x._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=io.bind(e),n.then(e,e)),l.state.loading|=4,l.instance=x,qt(x);return}x=n.ownerDocument||n,i=ux(i),(f=$n.get(f))&&td(i,f),x=x.createElement("link"),qt(x);var j=x;j._p=new Promise(function(R,V){j.onload=R,j.onerror=V}),Jt(x,"link",i),l.instance=x}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,n),(n=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=io.bind(e),n.addEventListener("load",l),n.addEventListener("error",l))}}var rd=0;function l0(e,n){return e.stylesheets&&e.count===0&&co(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var i=setTimeout(function(){if(e.stylesheets&&co(e,e.stylesheets),e.unsuspend){var x=e.unsuspend;e.unsuspend=null,x()}},6e4+n);0<e.imgBytes&&rd===0&&(rd=62500*U1());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&co(e,e.stylesheets),e.unsuspend)){var x=e.unsuspend;e.unsuspend=null,x()}},(e.imgBytes>rd?50:800)+n);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(f)}}:null}function io(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)co(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var oo=null;function co(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,oo=new Map,n.forEach(s0,e),oo=null,io.call(e))}function s0(e,n){if(!(n.state.loading&4)){var l=oo.get(e);if(l)var i=l.get(null);else{l=new Map,oo.set(e,l);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<f.length;x++){var j=f[x];(j.nodeName==="LINK"||j.getAttribute("media")!=="not all")&&(l.set(j.dataset.precedence,j),i=j)}i&&l.set(null,i)}f=n.instance,j=f.getAttribute("data-precedence"),x=l.get(j)||i,x===i&&l.set(null,f),l.set(j,f),this.count++,i=io.bind(this),f.addEventListener("load",i),f.addEventListener("error",i),x?x.parentNode.insertBefore(f,x.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),n.state.loading|=4}}var Es={$$typeof:A,Provider:null,Consumer:null,_currentValue:P,_currentValue2:P,_threadCount:0};function i0(e,n,l,i,f,x,j,R,V){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=Ul(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ul(0),this.hiddenUpdates=Ul(null),this.identifierPrefix=i,this.onUncaughtError=f,this.onCaughtError=x,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=V,this.incompleteTransitions=new Map}function hx(e,n,l,i,f,x,j,R,V,J,ie,fe){return e=new i0(e,n,l,j,V,J,ie,fe,R),n=1,x===!0&&(n|=24),x=yn(3,null,null,n),e.current=x,x.stateNode=e,n=Oc(),n.refCount++,e.pooledCache=n,n.refCount++,x.memoizedState={element:i,isDehydrated:l,cache:n},Hc(x),e}function xx(e){return e?(e=al,e):al}function gx(e,n,l,i,f,x){f=xx(f),i.context===null?i.context=f:i.pendingContext=f,i=Hr(n),i.payload={element:l},x=x===void 0?null:x,x!==null&&(i.callback=x),l=$r(e,i,n),l!==null&&(hn(l,e,n),as(l,e,n))}function vx(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<n?l:n}}function ad(e,n){vx(e,n),(e=e.alternate)&&vx(e,n)}function yx(e){if(e.tag===13||e.tag===31){var n=ja(e,67108864);n!==null&&hn(n,e,67108864),ad(e,67108864)}}function bx(e){if(e.tag===13||e.tag===31){var n=wn();n=Ga(n);var l=ja(e,n);l!==null&&hn(l,e,n),ad(e,n)}}var uo=!0;function o0(e,n,l,i){var f=z.T;z.T=null;var x=O.p;try{O.p=2,ld(e,n,l,i)}finally{O.p=x,z.T=f}}function c0(e,n,l,i){var f=z.T;z.T=null;var x=O.p;try{O.p=8,ld(e,n,l,i)}finally{O.p=x,z.T=f}}function ld(e,n,l,i){if(uo){var f=sd(i);if(f===null)Gu(e,n,i,fo,l),Sx(e,i);else if(d0(f,e,n,l,i))i.stopPropagation();else if(Sx(e,i),n&4&&-1<u0.indexOf(e)){for(;f!==null;){var x=qa(f);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var j=se(x.pendingLanes);if(j!==0){var R=x;for(R.pendingLanes|=2,R.entangledLanes|=2;j;){var V=1<<31-ct(j);R.entanglements[1]|=V,j&=~V}ir(x),(rt&6)===0&&(qi=We()+500,bs(0))}}break;case 31:case 13:R=ja(x,2),R!==null&&hn(R,x,2),Ki(),ad(x,2)}if(x=sd(i),x===null&&Gu(e,n,i,fo,l),x===f)break;f=x}f!==null&&i.stopPropagation()}else Gu(e,n,i,null,l)}}function sd(e){return e=oc(e),id(e)}var fo=null;function id(e){if(fo=null,e=Wa(e),e!==null){var n=u(e);if(n===null)e=null;else{var l=n.tag;if(l===13){if(e=d(n),e!==null)return e;e=null}else if(l===31){if(e=h(n),e!==null)return e;e=null}else if(l===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return fo=e,null}function jx(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(nt()){case xn:return 2;case ye:return 8;case ot:case Wt:return 32;case Kt:return 268435456;default:return 32}default:return 32}}var od=!1,Zr=null,Jr=null,ea=null,Ns=new Map,Ts=new Map,ta=[],u0="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 Sx(e,n){switch(e){case"focusin":case"focusout":Zr=null;break;case"dragenter":case"dragleave":Jr=null;break;case"mouseover":case"mouseout":ea=null;break;case"pointerover":case"pointerout":Ns.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ts.delete(n.pointerId)}}function Rs(e,n,l,i,f,x){return e===null||e.nativeEvent!==x?(e={blockedOn:n,domEventName:l,eventSystemFlags:i,nativeEvent:x,targetContainers:[f]},n!==null&&(n=qa(n),n!==null&&yx(n)),e):(e.eventSystemFlags|=i,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function d0(e,n,l,i,f){switch(n){case"focusin":return Zr=Rs(Zr,e,n,l,i,f),!0;case"dragenter":return Jr=Rs(Jr,e,n,l,i,f),!0;case"mouseover":return ea=Rs(ea,e,n,l,i,f),!0;case"pointerover":var x=f.pointerId;return Ns.set(x,Rs(Ns.get(x)||null,e,n,l,i,f)),!0;case"gotpointercapture":return x=f.pointerId,Ts.set(x,Rs(Ts.get(x)||null,e,n,l,i,f)),!0}return!1}function kx(e){var n=Wa(e.target);if(n!==null){var l=u(n);if(l!==null){if(n=l.tag,n===13){if(n=d(l),n!==null){e.blockedOn=n,ha(e.priority,function(){bx(l)});return}}else if(n===31){if(n=h(l),n!==null){e.blockedOn=n,ha(e.priority,function(){bx(l)});return}}else if(n===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function po(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var l=sd(e.nativeEvent);if(l===null){l=e.nativeEvent;var i=new l.constructor(l.type,l);ic=i,l.target.dispatchEvent(i),ic=null}else return n=qa(l),n!==null&&yx(n),e.blockedOn=l,!1;n.shift()}return!0}function wx(e,n,l){po(e)&&l.delete(n)}function f0(){od=!1,Zr!==null&&po(Zr)&&(Zr=null),Jr!==null&&po(Jr)&&(Jr=null),ea!==null&&po(ea)&&(ea=null),Ns.forEach(wx),Ts.forEach(wx)}function mo(e,n){e.blockedOn===n&&(e.blockedOn=null,od||(od=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,f0)))}var ho=null;function Cx(e){ho!==e&&(ho=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){ho===e&&(ho=null);for(var n=0;n<e.length;n+=3){var l=e[n],i=e[n+1],f=e[n+2];if(typeof i!="function"){if(id(i||l)===null)continue;break}var x=qa(l);x!==null&&(e.splice(n,3),n-=3,su(x,{pending:!0,data:f,method:l.method,action:i},i,f))}}))}function Tl(e){function n(V){return mo(V,e)}Zr!==null&&mo(Zr,e),Jr!==null&&mo(Jr,e),ea!==null&&mo(ea,e),Ns.forEach(n),Ts.forEach(n);for(var l=0;l<ta.length;l++){var i=ta[l];i.blockedOn===e&&(i.blockedOn=null)}for(;0<ta.length&&(l=ta[0],l.blockedOn===null);)kx(l),l.blockedOn===null&&ta.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(i=0;i<l.length;i+=3){var f=l[i],x=l[i+1],j=f[dt]||null;if(typeof x=="function")j||Cx(l);else if(j){var R=null;if(x&&x.hasAttribute("formAction")){if(f=x,j=x[dt]||null)R=j.formAction;else if(id(f)!==null)continue}else R=j.action;typeof R=="function"?l[i+1]=R:(l.splice(i,3),i-=3),Cx(l)}}}function Ex(){function e(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(j){return f=j})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),i||setTimeout(l,20)}function l(){if(!i&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(l,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function cd(e){this._internalRoot=e}xo.prototype.render=cd.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(o(409));var l=n.current,i=wn();gx(l,i,e,n,null,null)},xo.prototype.unmount=cd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;gx(e.current,2,null,e,null,null),Ki(),n[xa]=null}};function xo(e){this._internalRoot=e}xo.prototype.unstable_scheduleHydration=function(e){if(e){var n=ut();e={blockedOn:null,target:e,priority:n};for(var l=0;l<ta.length&&n!==0&&n<ta[l].priority;l++);ta.splice(l,0,e),l===0&&kx(e)}};var Nx=a.version;if(Nx!=="19.2.4")throw Error(o(527,Nx,"19.2.4"));O.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=m(n),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var p0={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var go=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!go.isDisabled&&go.supportsFiber)try{Mn=go.inject(p0),Ut=go}catch{}}return Ms.createRoot=function(e,n){if(!c(e))throw Error(o(299));var l=!1,i="",f=Dm,x=_m,j=Om;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(x=n.onCaughtError),n.onRecoverableError!==void 0&&(j=n.onRecoverableError)),n=hx(e,1,!1,null,null,l,i,null,f,x,j,Ex),e[xa]=n.current,Fu(e),new cd(n)},Ms.hydrateRoot=function(e,n,l){if(!c(e))throw Error(o(299));var i=!1,f="",x=Dm,j=_m,R=Om,V=null;return l!=null&&(l.unstable_strictMode===!0&&(i=!0),l.identifierPrefix!==void 0&&(f=l.identifierPrefix),l.onUncaughtError!==void 0&&(x=l.onUncaughtError),l.onCaughtError!==void 0&&(j=l.onCaughtError),l.onRecoverableError!==void 0&&(R=l.onRecoverableError),l.formState!==void 0&&(V=l.formState)),n=hx(e,1,!0,n,l??null,i,f,V,x,j,R,Ex),n.context=xx(null),l=n.current,i=wn(),i=Ga(i),f=Hr(i),f.callback=null,$r(l,f,i),l=i,n.current.lanes=l,fa(n,l),ir(n),e[xa]=n.current,Fu(e),new xo(n)},Ms.version="19.2.4",Ms}var Bx;function S0(){if(Bx)return fd.exports;Bx=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(a){console.error(a)}}return t(),fd.exports=j0(),fd.exports}var k0=S0();/**
|
|
51
51
|
* react-router v7.13.1
|
|
52
52
|
*
|
|
53
53
|
* Copyright (c) Remix Software Inc.
|
|
@@ -56,47 +56,47 @@ Error generating stack: `+i.message+`
|
|
|
56
56
|
* LICENSE.md file in the root directory of this source tree.
|
|
57
57
|
*
|
|
58
58
|
* @license MIT
|
|
59
|
-
*/var Bx="popstate";function Ix(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function S0(t={}){function a(c,u){let{pathname:d="/",search:h="",hash:g=""}=_l(c.location.hash.substring(1));return!d.startsWith("/")&&!d.startsWith(".")&&(d="/"+d),Kd("",{pathname:d,search:h,hash:g},u.state&&u.state.usr||null,u.state&&u.state.key||"default")}function s(c,u){let d=c.document.querySelector("base"),h="";if(d&&d.getAttribute("href")){let g=c.location.href,m=g.indexOf("#");h=m===-1?g:g.slice(0,m)}return h+"#"+(typeof u=="string"?u:Ps(u))}function o(c,u){Zn(c.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(u)})`)}return w0(a,s,o,t)}function Ft(t,a){if(t===!1||t===null||typeof t>"u")throw new Error(a)}function Zn(t,a){if(!t){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function k0(){return Math.random().toString(36).substring(2,10)}function Ux(t,a){return{usr:t.state,key:t.key,idx:a,masked:t.unstable_mask?{pathname:t.pathname,search:t.search,hash:t.hash}:void 0}}function Kd(t,a,s=null,o,c){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof a=="string"?_l(a):a,state:s,key:a&&a.key||o||k0(),unstable_mask:c}}function Ps({pathname:t="/",search:a="",hash:s=""}){return a&&a!=="?"&&(t+=a.charAt(0)==="?"?a:"?"+a),s&&s!=="#"&&(t+=s.charAt(0)==="#"?s:"#"+s),t}function _l(t){let a={};if(t){let s=t.indexOf("#");s>=0&&(a.hash=t.substring(s),t=t.substring(0,s));let o=t.indexOf("?");o>=0&&(a.search=t.substring(o),t=t.substring(0,o)),t&&(a.pathname=t)}return a}function w0(t,a,s,o={}){let{window:c=document.defaultView,v5Compat:u=!1}=o,d=c.history,h="POP",g=null,m=y();m==null&&(m=0,d.replaceState({...d.state,idx:m},""));function y(){return(d.state||{idx:null}).idx}function v(){h="POP";let E=y(),T=E==null?null:E-m;m=E,g&&g({action:h,location:w.location,delta:T})}function b(E,T){h="PUSH";let N=Ix(E)?E:Kd(w.location,E,T);s&&s(N,E),m=y()+1;let A=Ux(N,m),_=w.createHref(N.unstable_mask||N);try{d.pushState(A,"",_)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;c.location.assign(_)}u&&g&&g({action:h,location:w.location,delta:1})}function S(E,T){h="REPLACE";let N=Ix(E)?E:Kd(w.location,E,T);s&&s(N,E),m=y();let A=Ux(N,m),_=w.createHref(N.unstable_mask||N);d.replaceState(A,"",_),u&&g&&g({action:h,location:w.location,delta:0})}function k(E){return C0(E)}let w={get action(){return h},get location(){return t(c,d)},listen(E){if(g)throw new Error("A history only accepts one active listener");return c.addEventListener(Bx,v),g=E,()=>{c.removeEventListener(Bx,v),g=null}},createHref(E){return a(c,E)},createURL:k,encodeLocation(E){let T=k(E);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:b,replace:S,go(E){return d.go(E)}};return w}function C0(t,a=!1){let s="http://localhost";typeof window<"u"&&(s=window.location.origin!=="null"?window.location.origin:window.location.href),Ft(s,"No window.location.(origin|href) available to create URL");let o=typeof t=="string"?t:Ps(t);return o=o.replace(/ $/,"%20"),!a&&o.startsWith("//")&&(o=s+o),new URL(o,s)}function pv(t,a,s="/"){return E0(t,a,s,!1)}function E0(t,a,s,o){let c=typeof a=="string"?_l(a):a,u=Mr(c.pathname||"/",s);if(u==null)return null;let d=mv(t);N0(d);let h=null;for(let g=0;h==null&&g<d.length;++g){let m=I0(u);h=O0(d[g],m,o)}return h}function mv(t,a=[],s=[],o="",c=!1){let u=(d,h,g=c,m)=>{let y={relativePath:m===void 0?d.path||"":m,caseSensitive:d.caseSensitive===!0,childrenIndex:h,route:d};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(o)&&g)return;Ft(y.relativePath.startsWith(o),`Absolute route path "${y.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(o.length)}let v=ur([o,y.relativePath]),b=s.concat(y);d.children&&d.children.length>0&&(Ft(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),mv(d.children,a,b,v,g)),!(d.path==null&&!d.index)&&a.push({path:v,score:D0(v,d.index),routesMeta:b})};return t.forEach((d,h)=>{var g;if(d.path===""||!((g=d.path)!=null&&g.includes("?")))u(d,h);else for(let m of hv(d.path))u(d,h,!0,m)}),a}function hv(t){let a=t.split("/");if(a.length===0)return[];let[s,...o]=a,c=s.endsWith("?"),u=s.replace(/\?$/,"");if(o.length===0)return c?[u,""]:[u];let d=hv(o.join("/")),h=[];return h.push(...d.map(g=>g===""?u:[u,g].join("/"))),c&&h.push(...d),h.map(g=>t.startsWith("/")&&g===""?"/":g)}function N0(t){t.sort((a,s)=>a.score!==s.score?s.score-a.score:_0(a.routesMeta.map(o=>o.childrenIndex),s.routesMeta.map(o=>o.childrenIndex)))}var T0=/^:[\w-]+$/,R0=3,A0=2,M0=1,L0=10,z0=-2,Hx=t=>t==="*";function D0(t,a){let s=t.split("/"),o=s.length;return s.some(Hx)&&(o+=z0),a&&(o+=A0),s.filter(c=>!Hx(c)).reduce((c,u)=>c+(T0.test(u)?R0:u===""?M0:L0),o)}function _0(t,a){return t.length===a.length&&t.slice(0,-1).every((o,c)=>o===a[c])?t[t.length-1]-a[a.length-1]:0}function O0(t,a,s=!1){let{routesMeta:o}=t,c={},u="/",d=[];for(let h=0;h<o.length;++h){let g=o[h],m=h===o.length-1,y=u==="/"?a:a.slice(u.length)||"/",v=Oo({path:g.relativePath,caseSensitive:g.caseSensitive,end:m},y),b=g.route;if(!v&&m&&s&&!o[o.length-1].route.index&&(v=Oo({path:g.relativePath,caseSensitive:g.caseSensitive,end:!1},y)),!v)return null;Object.assign(c,v.params),d.push({params:c,pathname:ur([u,v.pathname]),pathnameBase:V0(ur([u,v.pathnameBase])),route:b}),v.pathnameBase!=="/"&&(u=ur([u,v.pathnameBase]))}return d}function Oo(t,a){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[s,o]=B0(t.path,t.caseSensitive,t.end),c=a.match(s);if(!c)return null;let u=c[0],d=u.replace(/(.)\/+$/,"$1"),h=c.slice(1);return{params:o.reduce((m,{paramName:y,isOptional:v},b)=>{if(y==="*"){let k=h[b]||"";d=u.slice(0,u.length-k.length).replace(/(.)\/+$/,"$1")}const S=h[b];return v&&!S?m[y]=void 0:m[y]=(S||"").replace(/%2F/g,"/"),m},{}),pathname:u,pathnameBase:d,pattern:t}}function B0(t,a=!1,s=!0){Zn(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let o=[],c="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,h,g,m,y)=>{if(o.push({paramName:h,isOptional:g!=null}),g){let v=y.charAt(m+d.length);return v&&v!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(o.push({paramName:"*"}),c+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?c+="\\/*$":t!==""&&t!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,a?void 0:"i"),o]}function I0(t){try{return t.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return Zn(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${a}).`),t}}function Mr(t,a){if(a==="/")return t;if(!t.toLowerCase().startsWith(a.toLowerCase()))return null;let s=a.endsWith("/")?a.length-1:a.length,o=t.charAt(s);return o&&o!=="/"?null:t.slice(s)||"/"}var U0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function H0(t,a="/"){let{pathname:s,search:o="",hash:c=""}=typeof t=="string"?_l(t):t,u;return s?(s=s.replace(/\/\/+/g,"/"),s.startsWith("/")?u=$x(s.substring(1),"/"):u=$x(s,a)):u=a,{pathname:u,search:P0(o),hash:F0(c)}}function $x(t,a){let s=a.replace(/\/+$/,"").split("/");return t.split("/").forEach(c=>{c===".."?s.length>1&&s.pop():c!=="."&&s.push(c)}),s.length>1?s.join("/"):"/"}function xd(t,a,s,o){return`Cannot include a '${t}' character in a manually specified \`to.${a}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${s}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function $0(t){return t.filter((a,s)=>s===0||a.route.path&&a.route.path.length>0)}function xv(t){let a=$0(t);return a.map((s,o)=>o===a.length-1?s.pathname:s.pathnameBase)}function hf(t,a,s,o=!1){let c;typeof t=="string"?c=_l(t):(c={...t},Ft(!c.pathname||!c.pathname.includes("?"),xd("?","pathname","search",c)),Ft(!c.pathname||!c.pathname.includes("#"),xd("#","pathname","hash",c)),Ft(!c.search||!c.search.includes("#"),xd("#","search","hash",c)));let u=t===""||c.pathname==="",d=u?"/":c.pathname,h;if(d==null)h=s;else{let v=a.length-1;if(!o&&d.startsWith("..")){let b=d.split("/");for(;b[0]==="..";)b.shift(),v-=1;c.pathname=b.join("/")}h=v>=0?a[v]:"/"}let g=H0(c,h),m=d&&d!=="/"&&d.endsWith("/"),y=(u||d===".")&&s.endsWith("/");return!g.pathname.endsWith("/")&&(m||y)&&(g.pathname+="/"),g}var ur=t=>t.join("/").replace(/\/\/+/g,"/"),V0=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),P0=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,F0=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,G0=class{constructor(t,a,s,o=!1){this.status=t,this.statusText=a||"",this.internal=o,s instanceof Error?(this.data=s.toString(),this.error=s):this.data=s}};function W0(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function q0(t){return t.map(a=>a.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var gv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function vv(t,a){let s=t;if(typeof s!="string"||!U0.test(s))return{absoluteURL:void 0,isExternal:!1,to:s};let o=s,c=!1;if(gv)try{let u=new URL(window.location.href),d=s.startsWith("//")?new URL(u.protocol+s):new URL(s),h=Mr(d.pathname,a);d.origin===u.origin&&h!=null?s=h+d.search+d.hash:c=!0}catch{Zn(!1,`<Link to="${s}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:c,to:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var yv=["POST","PUT","PATCH","DELETE"];new Set(yv);var Y0=["GET",...yv];new Set(Y0);var Ol=p.createContext(null);Ol.displayName="DataRouter";var Vo=p.createContext(null);Vo.displayName="DataRouterState";var K0=p.createContext(!1),bv=p.createContext({isTransitioning:!1});bv.displayName="ViewTransition";var X0=p.createContext(new Map);X0.displayName="Fetchers";var Q0=p.createContext(null);Q0.displayName="Await";var Gn=p.createContext(null);Gn.displayName="Navigation";var Po=p.createContext(null);Po.displayName="Location";var Lr=p.createContext({outlet:null,matches:[],isDataRoute:!1});Lr.displayName="Route";var xf=p.createContext(null);xf.displayName="RouteError";var jv="REACT_ROUTER_ERROR",Z0="REDIRECT",J0="ROUTE_ERROR_RESPONSE";function ej(t){if(t.startsWith(`${jv}:${Z0}:{`))try{let a=JSON.parse(t.slice(28));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.location=="string"&&typeof a.reloadDocument=="boolean"&&typeof a.replace=="boolean")return a}catch{}}function tj(t){if(t.startsWith(`${jv}:${J0}:{`))try{let a=JSON.parse(t.slice(40));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string")return new G0(a.status,a.statusText,a.data)}catch{}}function nj(t,{relative:a}={}){Ft(Qs(),"useHref() may be used only in the context of a <Router> component.");let{basename:s,navigator:o}=p.useContext(Gn),{hash:c,pathname:u,search:d}=Zs(t,{relative:a}),h=u;return s!=="/"&&(h=u==="/"?s:ur([s,u])),o.createHref({pathname:h,search:d,hash:c})}function Qs(){return p.useContext(Po)!=null}function ia(){return Ft(Qs(),"useLocation() may be used only in the context of a <Router> component."),p.useContext(Po).location}var Sv="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function kv(t){p.useContext(Gn).static||p.useLayoutEffect(t)}function rj(){let{isDataRoute:t}=p.useContext(Lr);return t?xj():aj()}function aj(){Ft(Qs(),"useNavigate() may be used only in the context of a <Router> component.");let t=p.useContext(Ol),{basename:a,navigator:s}=p.useContext(Gn),{matches:o}=p.useContext(Lr),{pathname:c}=ia(),u=JSON.stringify(xv(o)),d=p.useRef(!1);return kv(()=>{d.current=!0}),p.useCallback((g,m={})=>{if(Zn(d.current,Sv),!d.current)return;if(typeof g=="number"){s.go(g);return}let y=hf(g,JSON.parse(u),c,m.relative==="path");t==null&&a!=="/"&&(y.pathname=y.pathname==="/"?a:ur([a,y.pathname])),(m.replace?s.replace:s.push)(y,m.state,m)},[a,s,u,c,t])}p.createContext(null);function Zs(t,{relative:a}={}){let{matches:s}=p.useContext(Lr),{pathname:o}=ia(),c=JSON.stringify(xv(s));return p.useMemo(()=>hf(t,JSON.parse(c),o,a==="path"),[t,c,o,a])}function lj(t,a,s){Ft(Qs(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=p.useContext(Gn),{matches:c}=p.useContext(Lr),u=c[c.length-1],d=u?u.params:{},h=u?u.pathname:"/",g=u?u.pathnameBase:"/",m=u&&u.route;{let E=m&&m.path||"";Cv(h,!m||E.endsWith("*")||E.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${E}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
59
|
+
*/var Ix="popstate";function Ux(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function w0(t={}){function a(c,u){let{pathname:d="/",search:h="",hash:g=""}=_l(c.location.hash.substring(1));return!d.startsWith("/")&&!d.startsWith(".")&&(d="/"+d),Xd("",{pathname:d,search:h,hash:g},u.state&&u.state.usr||null,u.state&&u.state.key||"default")}function s(c,u){let d=c.document.querySelector("base"),h="";if(d&&d.getAttribute("href")){let g=c.location.href,m=g.indexOf("#");h=m===-1?g:g.slice(0,m)}return h+"#"+(typeof u=="string"?u:Ps(u))}function o(c,u){Zn(c.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(u)})`)}return E0(a,s,o,t)}function Ft(t,a){if(t===!1||t===null||typeof t>"u")throw new Error(a)}function Zn(t,a){if(!t){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function C0(){return Math.random().toString(36).substring(2,10)}function Hx(t,a){return{usr:t.state,key:t.key,idx:a,masked:t.unstable_mask?{pathname:t.pathname,search:t.search,hash:t.hash}:void 0}}function Xd(t,a,s=null,o,c){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof a=="string"?_l(a):a,state:s,key:a&&a.key||o||C0(),unstable_mask:c}}function Ps({pathname:t="/",search:a="",hash:s=""}){return a&&a!=="?"&&(t+=a.charAt(0)==="?"?a:"?"+a),s&&s!=="#"&&(t+=s.charAt(0)==="#"?s:"#"+s),t}function _l(t){let a={};if(t){let s=t.indexOf("#");s>=0&&(a.hash=t.substring(s),t=t.substring(0,s));let o=t.indexOf("?");o>=0&&(a.search=t.substring(o),t=t.substring(0,o)),t&&(a.pathname=t)}return a}function E0(t,a,s,o={}){let{window:c=document.defaultView,v5Compat:u=!1}=o,d=c.history,h="POP",g=null,m=y();m==null&&(m=0,d.replaceState({...d.state,idx:m},""));function y(){return(d.state||{idx:null}).idx}function v(){h="POP";let C=y(),T=C==null?null:C-m;m=C,g&&g({action:h,location:w.location,delta:T})}function b(C,T){h="PUSH";let N=Ux(C)?C:Xd(w.location,C,T);s&&s(N,C),m=y()+1;let A=Hx(N,m),_=w.createHref(N.unstable_mask||N);try{d.pushState(A,"",_)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;c.location.assign(_)}u&&g&&g({action:h,location:w.location,delta:1})}function S(C,T){h="REPLACE";let N=Ux(C)?C:Xd(w.location,C,T);s&&s(N,C),m=y();let A=Hx(N,m),_=w.createHref(N.unstable_mask||N);d.replaceState(A,"",_),u&&g&&g({action:h,location:w.location,delta:0})}function k(C){return N0(C)}let w={get action(){return h},get location(){return t(c,d)},listen(C){if(g)throw new Error("A history only accepts one active listener");return c.addEventListener(Ix,v),g=C,()=>{c.removeEventListener(Ix,v),g=null}},createHref(C){return a(c,C)},createURL:k,encodeLocation(C){let T=k(C);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:b,replace:S,go(C){return d.go(C)}};return w}function N0(t,a=!1){let s="http://localhost";typeof window<"u"&&(s=window.location.origin!=="null"?window.location.origin:window.location.href),Ft(s,"No window.location.(origin|href) available to create URL");let o=typeof t=="string"?t:Ps(t);return o=o.replace(/ $/,"%20"),!a&&o.startsWith("//")&&(o=s+o),new URL(o,s)}function mv(t,a,s="/"){return T0(t,a,s,!1)}function T0(t,a,s,o){let c=typeof a=="string"?_l(a):a,u=Mr(c.pathname||"/",s);if(u==null)return null;let d=hv(t);R0(d);let h=null;for(let g=0;h==null&&g<d.length;++g){let m=H0(u);h=I0(d[g],m,o)}return h}function hv(t,a=[],s=[],o="",c=!1){let u=(d,h,g=c,m)=>{let y={relativePath:m===void 0?d.path||"":m,caseSensitive:d.caseSensitive===!0,childrenIndex:h,route:d};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(o)&&g)return;Ft(y.relativePath.startsWith(o),`Absolute route path "${y.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(o.length)}let v=ur([o,y.relativePath]),b=s.concat(y);d.children&&d.children.length>0&&(Ft(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),hv(d.children,a,b,v,g)),!(d.path==null&&!d.index)&&a.push({path:v,score:O0(v,d.index),routesMeta:b})};return t.forEach((d,h)=>{var g;if(d.path===""||!((g=d.path)!=null&&g.includes("?")))u(d,h);else for(let m of xv(d.path))u(d,h,!0,m)}),a}function xv(t){let a=t.split("/");if(a.length===0)return[];let[s,...o]=a,c=s.endsWith("?"),u=s.replace(/\?$/,"");if(o.length===0)return c?[u,""]:[u];let d=xv(o.join("/")),h=[];return h.push(...d.map(g=>g===""?u:[u,g].join("/"))),c&&h.push(...d),h.map(g=>t.startsWith("/")&&g===""?"/":g)}function R0(t){t.sort((a,s)=>a.score!==s.score?s.score-a.score:B0(a.routesMeta.map(o=>o.childrenIndex),s.routesMeta.map(o=>o.childrenIndex)))}var A0=/^:[\w-]+$/,M0=3,L0=2,z0=1,D0=10,_0=-2,$x=t=>t==="*";function O0(t,a){let s=t.split("/"),o=s.length;return s.some($x)&&(o+=_0),a&&(o+=L0),s.filter(c=>!$x(c)).reduce((c,u)=>c+(A0.test(u)?M0:u===""?z0:D0),o)}function B0(t,a){return t.length===a.length&&t.slice(0,-1).every((o,c)=>o===a[c])?t[t.length-1]-a[a.length-1]:0}function I0(t,a,s=!1){let{routesMeta:o}=t,c={},u="/",d=[];for(let h=0;h<o.length;++h){let g=o[h],m=h===o.length-1,y=u==="/"?a:a.slice(u.length)||"/",v=Oo({path:g.relativePath,caseSensitive:g.caseSensitive,end:m},y),b=g.route;if(!v&&m&&s&&!o[o.length-1].route.index&&(v=Oo({path:g.relativePath,caseSensitive:g.caseSensitive,end:!1},y)),!v)return null;Object.assign(c,v.params),d.push({params:c,pathname:ur([u,v.pathname]),pathnameBase:F0(ur([u,v.pathnameBase])),route:b}),v.pathnameBase!=="/"&&(u=ur([u,v.pathnameBase]))}return d}function Oo(t,a){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[s,o]=U0(t.path,t.caseSensitive,t.end),c=a.match(s);if(!c)return null;let u=c[0],d=u.replace(/(.)\/+$/,"$1"),h=c.slice(1);return{params:o.reduce((m,{paramName:y,isOptional:v},b)=>{if(y==="*"){let k=h[b]||"";d=u.slice(0,u.length-k.length).replace(/(.)\/+$/,"$1")}const S=h[b];return v&&!S?m[y]=void 0:m[y]=(S||"").replace(/%2F/g,"/"),m},{}),pathname:u,pathnameBase:d,pattern:t}}function U0(t,a=!1,s=!0){Zn(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let o=[],c="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,h,g,m,y)=>{if(o.push({paramName:h,isOptional:g!=null}),g){let v=y.charAt(m+d.length);return v&&v!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(o.push({paramName:"*"}),c+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?c+="\\/*$":t!==""&&t!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,a?void 0:"i"),o]}function H0(t){try{return t.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return Zn(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${a}).`),t}}function Mr(t,a){if(a==="/")return t;if(!t.toLowerCase().startsWith(a.toLowerCase()))return null;let s=a.endsWith("/")?a.length-1:a.length,o=t.charAt(s);return o&&o!=="/"?null:t.slice(s)||"/"}var $0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function V0(t,a="/"){let{pathname:s,search:o="",hash:c=""}=typeof t=="string"?_l(t):t,u;return s?(s=s.replace(/\/\/+/g,"/"),s.startsWith("/")?u=Vx(s.substring(1),"/"):u=Vx(s,a)):u=a,{pathname:u,search:G0(o),hash:W0(c)}}function Vx(t,a){let s=a.replace(/\/+$/,"").split("/");return t.split("/").forEach(c=>{c===".."?s.length>1&&s.pop():c!=="."&&s.push(c)}),s.length>1?s.join("/"):"/"}function xd(t,a,s,o){return`Cannot include a '${t}' character in a manually specified \`to.${a}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${s}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function P0(t){return t.filter((a,s)=>s===0||a.route.path&&a.route.path.length>0)}function gv(t){let a=P0(t);return a.map((s,o)=>o===a.length-1?s.pathname:s.pathnameBase)}function xf(t,a,s,o=!1){let c;typeof t=="string"?c=_l(t):(c={...t},Ft(!c.pathname||!c.pathname.includes("?"),xd("?","pathname","search",c)),Ft(!c.pathname||!c.pathname.includes("#"),xd("#","pathname","hash",c)),Ft(!c.search||!c.search.includes("#"),xd("#","search","hash",c)));let u=t===""||c.pathname==="",d=u?"/":c.pathname,h;if(d==null)h=s;else{let v=a.length-1;if(!o&&d.startsWith("..")){let b=d.split("/");for(;b[0]==="..";)b.shift(),v-=1;c.pathname=b.join("/")}h=v>=0?a[v]:"/"}let g=V0(c,h),m=d&&d!=="/"&&d.endsWith("/"),y=(u||d===".")&&s.endsWith("/");return!g.pathname.endsWith("/")&&(m||y)&&(g.pathname+="/"),g}var ur=t=>t.join("/").replace(/\/\/+/g,"/"),F0=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),G0=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,W0=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,q0=class{constructor(t,a,s,o=!1){this.status=t,this.statusText=a||"",this.internal=o,s instanceof Error?(this.data=s.toString(),this.error=s):this.data=s}};function Y0(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function K0(t){return t.map(a=>a.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var vv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function yv(t,a){let s=t;if(typeof s!="string"||!$0.test(s))return{absoluteURL:void 0,isExternal:!1,to:s};let o=s,c=!1;if(vv)try{let u=new URL(window.location.href),d=s.startsWith("//")?new URL(u.protocol+s):new URL(s),h=Mr(d.pathname,a);d.origin===u.origin&&h!=null?s=h+d.search+d.hash:c=!0}catch{Zn(!1,`<Link to="${s}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:c,to:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var bv=["POST","PUT","PATCH","DELETE"];new Set(bv);var X0=["GET",...bv];new Set(X0);var Ol=p.createContext(null);Ol.displayName="DataRouter";var Vo=p.createContext(null);Vo.displayName="DataRouterState";var Q0=p.createContext(!1),jv=p.createContext({isTransitioning:!1});jv.displayName="ViewTransition";var Z0=p.createContext(new Map);Z0.displayName="Fetchers";var J0=p.createContext(null);J0.displayName="Await";var Gn=p.createContext(null);Gn.displayName="Navigation";var Po=p.createContext(null);Po.displayName="Location";var Lr=p.createContext({outlet:null,matches:[],isDataRoute:!1});Lr.displayName="Route";var gf=p.createContext(null);gf.displayName="RouteError";var Sv="REACT_ROUTER_ERROR",ej="REDIRECT",tj="ROUTE_ERROR_RESPONSE";function nj(t){if(t.startsWith(`${Sv}:${ej}:{`))try{let a=JSON.parse(t.slice(28));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.location=="string"&&typeof a.reloadDocument=="boolean"&&typeof a.replace=="boolean")return a}catch{}}function rj(t){if(t.startsWith(`${Sv}:${tj}:{`))try{let a=JSON.parse(t.slice(40));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string")return new q0(a.status,a.statusText,a.data)}catch{}}function aj(t,{relative:a}={}){Ft(Qs(),"useHref() may be used only in the context of a <Router> component.");let{basename:s,navigator:o}=p.useContext(Gn),{hash:c,pathname:u,search:d}=Zs(t,{relative:a}),h=u;return s!=="/"&&(h=u==="/"?s:ur([s,u])),o.createHref({pathname:h,search:d,hash:c})}function Qs(){return p.useContext(Po)!=null}function ia(){return Ft(Qs(),"useLocation() may be used only in the context of a <Router> component."),p.useContext(Po).location}var kv="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function wv(t){p.useContext(Gn).static||p.useLayoutEffect(t)}function lj(){let{isDataRoute:t}=p.useContext(Lr);return t?vj():sj()}function sj(){Ft(Qs(),"useNavigate() may be used only in the context of a <Router> component.");let t=p.useContext(Ol),{basename:a,navigator:s}=p.useContext(Gn),{matches:o}=p.useContext(Lr),{pathname:c}=ia(),u=JSON.stringify(gv(o)),d=p.useRef(!1);return wv(()=>{d.current=!0}),p.useCallback((g,m={})=>{if(Zn(d.current,kv),!d.current)return;if(typeof g=="number"){s.go(g);return}let y=xf(g,JSON.parse(u),c,m.relative==="path");t==null&&a!=="/"&&(y.pathname=y.pathname==="/"?a:ur([a,y.pathname])),(m.replace?s.replace:s.push)(y,m.state,m)},[a,s,u,c,t])}p.createContext(null);function Zs(t,{relative:a}={}){let{matches:s}=p.useContext(Lr),{pathname:o}=ia(),c=JSON.stringify(gv(s));return p.useMemo(()=>xf(t,JSON.parse(c),o,a==="path"),[t,c,o,a])}function ij(t,a,s){Ft(Qs(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=p.useContext(Gn),{matches:c}=p.useContext(Lr),u=c[c.length-1],d=u?u.params:{},h=u?u.pathname:"/",g=u?u.pathnameBase:"/",m=u&&u.route;{let C=m&&m.path||"";Ev(h,!m||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${C}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
60
60
|
|
|
61
|
-
Please change the parent <Route path="${E}"> to <Route path="${E==="/"?"*":`${E}/*`}">.`)}let y=ia(),v;v=y;let b=v.pathname||"/",S=b;if(g!=="/"){let E=g.replace(/^\//,"").split("/");S="/"+b.replace(/^\//,"").split("/").slice(E.length).join("/")}let k=pv(t,{pathname:S});return Zn(m||k!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),Zn(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${v.pathname}${v.search}${v.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),uj(k&&k.map(E=>Object.assign({},E,{params:Object.assign({},d,E.params),pathname:ur([g,o.encodeLocation?o.encodeLocation(E.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?g:ur([g,o.encodeLocation?o.encodeLocation(E.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathnameBase])})),c,s)}function sj(){let t=hj(),a=W0(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),s=t instanceof Error?t.stack:null,o="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:o},u={padding:"2px 4px",backgroundColor:o},d=null;return console.error("Error handled by React Router default ErrorBoundary:",t),d=p.createElement(p.Fragment,null,p.createElement("p",null,"💿 Hey developer 👋"),p.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",p.createElement("code",{style:u},"ErrorBoundary")," or"," ",p.createElement("code",{style:u},"errorElement")," prop on your route.")),p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},a),s?p.createElement("pre",{style:c},s):null,d)}var ij=p.createElement(sj,null),wv=class extends p.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,a){return a.location!==t.location||a.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:a.error,location:a.location,revalidation:t.revalidation||a.revalidation}}componentDidCatch(t,a){this.props.onError?this.props.onError(t,a):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const s=tj(t.digest);s&&(t=s)}let a=t!==void 0?p.createElement(Lr.Provider,{value:this.props.routeContext},p.createElement(xf.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?p.createElement(oj,{error:t},a):a}};wv.contextType=K0;var gd=new WeakMap;function oj({children:t,error:a}){let{basename:s}=p.useContext(Gn);if(typeof a=="object"&&a&&"digest"in a&&typeof a.digest=="string"){let o=ej(a.digest);if(o){let c=gd.get(a);if(c)throw c;let u=vv(o.location,s);if(gv&&!gd.get(a))if(u.isExternal||o.reloadDocument)window.location.href=u.absoluteURL||u.to;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:o.replace}));throw gd.set(a,d),d}return p.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return t}function cj({routeContext:t,match:a,children:s}){let o=p.useContext(Ol);return o&&o.static&&o.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=a.route.id),p.createElement(Lr.Provider,{value:t},s)}function uj(t,a=[],s){let o=s==null?void 0:s.state;if(t==null){if(!o)return null;if(o.errors)t=o.matches;else if(a.length===0&&!o.initialized&&o.matches.length>0)t=o.matches;else return null}let c=t,u=o==null?void 0:o.errors;if(u!=null){let y=c.findIndex(v=>v.route.id&&(u==null?void 0:u[v.route.id])!==void 0);Ft(y>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),c=c.slice(0,Math.min(c.length,y+1))}let d=!1,h=-1;if(s&&o){d=o.renderFallback;for(let y=0;y<c.length;y++){let v=c[y];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(h=y),v.route.id){let{loaderData:b,errors:S}=o,k=v.route.loader&&!b.hasOwnProperty(v.route.id)&&(!S||S[v.route.id]===void 0);if(v.route.lazy||k){s.isStatic&&(d=!0),h>=0?c=c.slice(0,h+1):c=[c[0]];break}}}}let g=s==null?void 0:s.onError,m=o&&g?(y,v)=>{var b,S;g(y,{location:o.location,params:((S=(b=o.matches)==null?void 0:b[0])==null?void 0:S.params)??{},unstable_pattern:q0(o.matches),errorInfo:v})}:void 0;return c.reduceRight((y,v,b)=>{let S,k=!1,w=null,E=null;o&&(S=u&&v.route.id?u[v.route.id]:void 0,w=v.route.errorElement||ij,d&&(h<0&&b===0?(Cv("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,E=null):h===b&&(k=!0,E=v.route.hydrateFallbackElement||null)));let T=a.concat(c.slice(0,b+1)),N=()=>{let A;return S?A=w:k?A=E:v.route.Component?A=p.createElement(v.route.Component,null):v.route.element?A=v.route.element:A=y,p.createElement(cj,{match:v,routeContext:{outlet:y,matches:T,isDataRoute:o!=null},children:A})};return o&&(v.route.ErrorBoundary||v.route.errorElement||b===0)?p.createElement(wv,{location:o.location,revalidation:o.revalidation,component:w,error:S,children:N(),routeContext:{outlet:null,matches:T,isDataRoute:!0},onError:m}):N()},null)}function gf(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function dj(t){let a=p.useContext(Ol);return Ft(a,gf(t)),a}function fj(t){let a=p.useContext(Vo);return Ft(a,gf(t)),a}function pj(t){let a=p.useContext(Lr);return Ft(a,gf(t)),a}function vf(t){let a=pj(t),s=a.matches[a.matches.length-1];return Ft(s.route.id,`${t} can only be used on routes that contain a unique "id"`),s.route.id}function mj(){return vf("useRouteId")}function hj(){var o;let t=p.useContext(xf),a=fj("useRouteError"),s=vf("useRouteError");return t!==void 0?t:(o=a.errors)==null?void 0:o[s]}function xj(){let{router:t}=dj("useNavigate"),a=vf("useNavigate"),s=p.useRef(!1);return kv(()=>{s.current=!0}),p.useCallback(async(c,u={})=>{Zn(s.current,Sv),s.current&&(typeof c=="number"?await t.navigate(c):await t.navigate(c,{fromRouteId:a,...u}))},[t,a])}var Vx={};function Cv(t,a,s){!a&&!Vx[t]&&(Vx[t]=!0,Zn(!1,s))}p.memo(gj);function gj({routes:t,future:a,state:s,isStatic:o,onError:c}){return lj(t,void 0,{state:s,isStatic:o,onError:c})}function vj({basename:t="/",children:a=null,location:s,navigationType:o="POP",navigator:c,static:u=!1,unstable_useTransitions:d}){Ft(!Qs(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=t.replace(/^\/*/,"/"),g=p.useMemo(()=>({basename:h,navigator:c,static:u,unstable_useTransitions:d,future:{}}),[h,c,u,d]);typeof s=="string"&&(s=_l(s));let{pathname:m="/",search:y="",hash:v="",state:b=null,key:S="default",unstable_mask:k}=s,w=p.useMemo(()=>{let E=Mr(m,h);return E==null?null:{location:{pathname:E,search:y,hash:v,state:b,key:S,unstable_mask:k},navigationType:o}},[h,m,y,v,b,S,o,k]);return Zn(w!=null,`<Router basename="${h}"> is not able to match the URL "${m}${y}${v}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:p.createElement(Gn.Provider,{value:g},p.createElement(Po.Provider,{children:a,value:w}))}var Ro="get",Ao="application/x-www-form-urlencoded";function Fo(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function yj(t){return Fo(t)&&t.tagName.toLowerCase()==="button"}function bj(t){return Fo(t)&&t.tagName.toLowerCase()==="form"}function jj(t){return Fo(t)&&t.tagName.toLowerCase()==="input"}function Sj(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function kj(t,a){return t.button===0&&(!a||a==="_self")&&!Sj(t)}var vo=null;function wj(){if(vo===null)try{new FormData(document.createElement("form"),0),vo=!1}catch{vo=!0}return vo}var Cj=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function vd(t){return t!=null&&!Cj.has(t)?(Zn(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ao}"`),null):t}function Ej(t,a){let s,o,c,u,d;if(bj(t)){let h=t.getAttribute("action");o=h?Mr(h,a):null,s=t.getAttribute("method")||Ro,c=vd(t.getAttribute("enctype"))||Ao,u=new FormData(t)}else if(yj(t)||jj(t)&&(t.type==="submit"||t.type==="image")){let h=t.form;if(h==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let g=t.getAttribute("formaction")||h.getAttribute("action");if(o=g?Mr(g,a):null,s=t.getAttribute("formmethod")||h.getAttribute("method")||Ro,c=vd(t.getAttribute("formenctype"))||vd(h.getAttribute("enctype"))||Ao,u=new FormData(h,t),!wj()){let{name:m,type:y,value:v}=t;if(y==="image"){let b=m?`${m}.`:"";u.append(`${b}x`,"0"),u.append(`${b}y`,"0")}else m&&u.append(m,v)}}else{if(Fo(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');s=Ro,o=null,c=Ao,d=t}return u&&c==="text/plain"&&(d=u,u=void 0),{action:o,method:s.toLowerCase(),encType:c,formData:u,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function yf(t,a){if(t===!1||t===null||typeof t>"u")throw new Error(a)}function Nj(t,a,s,o){let c=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return s?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${o}`:c.pathname=`${c.pathname}.${o}`:c.pathname==="/"?c.pathname=`_root.${o}`:a&&Mr(c.pathname,a)==="/"?c.pathname=`${a.replace(/\/$/,"")}/_root.${o}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${o}`,c}async function Tj(t,a){if(t.id in a)return a[t.id];try{let s=await import(t.module);return a[t.id]=s,s}catch(s){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(s),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Rj(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function Aj(t,a,s){let o=await Promise.all(t.map(async c=>{let u=a.routes[c.route.id];if(u){let d=await Tj(u,s);return d.links?d.links():[]}return[]}));return Dj(o.flat(1).filter(Rj).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function Px(t,a,s,o,c,u){let d=(g,m)=>s[m]?g.route.id!==s[m].route.id:!0,h=(g,m)=>{var y;return s[m].pathname!==g.pathname||((y=s[m].route.path)==null?void 0:y.endsWith("*"))&&s[m].params["*"]!==g.params["*"]};return u==="assets"?a.filter((g,m)=>d(g,m)||h(g,m)):u==="data"?a.filter((g,m)=>{var v;let y=o.routes[g.route.id];if(!y||!y.hasLoader)return!1;if(d(g,m)||h(g,m))return!0;if(g.route.shouldRevalidate){let b=g.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((v=s[0])==null?void 0:v.params)||{},nextUrl:new URL(t,window.origin),nextParams:g.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function Mj(t,a,{includeHydrateFallback:s}={}){return Lj(t.map(o=>{let c=a.routes[o.route.id];if(!c)return[];let u=[c.module];return c.clientActionModule&&(u=u.concat(c.clientActionModule)),c.clientLoaderModule&&(u=u.concat(c.clientLoaderModule)),s&&c.hydrateFallbackModule&&(u=u.concat(c.hydrateFallbackModule)),c.imports&&(u=u.concat(c.imports)),u}).flat(1))}function Lj(t){return[...new Set(t)]}function zj(t){let a={},s=Object.keys(t).sort();for(let o of s)a[o]=t[o];return a}function Dj(t,a){let s=new Set;return new Set(a),t.reduce((o,c)=>{let u=JSON.stringify(zj(c));return s.has(u)||(s.add(u),o.push({key:u,link:c})),o},[])}function Ev(){let t=p.useContext(Ol);return yf(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function _j(){let t=p.useContext(Vo);return yf(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var bf=p.createContext(void 0);bf.displayName="FrameworkContext";function Nv(){let t=p.useContext(bf);return yf(t,"You must render this element inside a <HydratedRouter> element"),t}function Oj(t,a){let s=p.useContext(bf),[o,c]=p.useState(!1),[u,d]=p.useState(!1),{onFocus:h,onBlur:g,onMouseEnter:m,onMouseLeave:y,onTouchStart:v}=a,b=p.useRef(null);p.useEffect(()=>{if(t==="render"&&d(!0),t==="viewport"){let w=T=>{T.forEach(N=>{d(N.isIntersecting)})},E=new IntersectionObserver(w,{threshold:.5});return b.current&&E.observe(b.current),()=>{E.disconnect()}}},[t]),p.useEffect(()=>{if(o){let w=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(w)}}},[o]);let S=()=>{c(!0)},k=()=>{c(!1),d(!1)};return s?t!=="intent"?[u,b,{}]:[u,b,{onFocus:Ls(h,S),onBlur:Ls(g,k),onMouseEnter:Ls(m,S),onMouseLeave:Ls(y,k),onTouchStart:Ls(v,S)}]:[!1,b,{}]}function Ls(t,a){return s=>{t&&t(s),s.defaultPrevented||a(s)}}function Bj({page:t,...a}){let{router:s}=Ev(),o=p.useMemo(()=>pv(s.routes,t,s.basename),[s.routes,t,s.basename]);return o?p.createElement(Uj,{page:t,matches:o,...a}):null}function Ij(t){let{manifest:a,routeModules:s}=Nv(),[o,c]=p.useState([]);return p.useEffect(()=>{let u=!1;return Aj(t,a,s).then(d=>{u||c(d)}),()=>{u=!0}},[t,a,s]),o}function Uj({page:t,matches:a,...s}){let o=ia(),{future:c,manifest:u,routeModules:d}=Nv(),{basename:h}=Ev(),{loaderData:g,matches:m}=_j(),y=p.useMemo(()=>Px(t,a,m,u,o,"data"),[t,a,m,u,o]),v=p.useMemo(()=>Px(t,a,m,u,o,"assets"),[t,a,m,u,o]),b=p.useMemo(()=>{if(t===o.pathname+o.search+o.hash)return[];let w=new Set,E=!1;if(a.forEach(N=>{var _;let A=u.routes[N.route.id];!A||!A.hasLoader||(!y.some(D=>D.route.id===N.route.id)&&N.route.id in g&&((_=d[N.route.id])!=null&&_.shouldRevalidate)||A.hasClientLoader?E=!0:w.add(N.route.id))}),w.size===0)return[];let T=Nj(t,h,c.unstable_trailingSlashAwareDataRequests,"data");return E&&w.size>0&&T.searchParams.set("_routes",a.filter(N=>w.has(N.route.id)).map(N=>N.route.id).join(",")),[T.pathname+T.search]},[h,c.unstable_trailingSlashAwareDataRequests,g,o,u,y,a,t,d]),S=p.useMemo(()=>Mj(v,u),[v,u]),k=Ij(v);return p.createElement(p.Fragment,null,b.map(w=>p.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...s})),S.map(w=>p.createElement("link",{key:w,rel:"modulepreload",href:w,...s})),k.map(({key:w,link:E})=>p.createElement("link",{key:w,nonce:s.nonce,...E,crossOrigin:E.crossOrigin??s.crossOrigin})))}function Hj(...t){return a=>{t.forEach(s=>{typeof s=="function"?s(a):s!=null&&(s.current=a)})}}var $j=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{$j&&(window.__reactRouterVersion="7.13.1")}catch{}function Vj({basename:t,children:a,unstable_useTransitions:s,window:o}){let c=p.useRef();c.current==null&&(c.current=S0({window:o,v5Compat:!0}));let u=c.current,[d,h]=p.useState({action:u.action,location:u.location}),g=p.useCallback(m=>{s===!1?h(m):p.startTransition(()=>h(m))},[s]);return p.useLayoutEffect(()=>u.listen(g),[u,g]),p.createElement(vj,{basename:t,children:a,location:d.location,navigationType:d.action,navigator:u,unstable_useTransitions:s})}var Tv=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Rv=p.forwardRef(function({onClick:a,discover:s="render",prefetch:o="none",relative:c,reloadDocument:u,replace:d,unstable_mask:h,state:g,target:m,to:y,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:S,...k},w){let{basename:E,navigator:T,unstable_useTransitions:N}=p.useContext(Gn),A=typeof y=="string"&&Tv.test(y),_=vv(y,E);y=_.to;let D=nj(y,{relative:c}),F=ia(),C=null;if(h){let I=hf(h,[],F.unstable_mask?F.unstable_mask.pathname:"/",!0);E!=="/"&&(I.pathname=I.pathname==="/"?E:ur([E,I.pathname])),C=T.createHref(I)}let[B,L,U]=Oj(o,k),$=Wj(y,{replace:d,unstable_mask:h,state:g,target:m,preventScrollReset:v,relative:c,viewTransition:b,unstable_defaultShouldRevalidate:S,unstable_useTransitions:N});function q(I){a&&a(I),I.defaultPrevented||$(I)}let X=!(_.isExternal||u),ee=p.createElement("a",{...k,...U,href:(X?C:void 0)||_.absoluteURL||D,onClick:X?q:a,ref:Hj(w,L),target:m,"data-discover":!A&&s==="render"?"true":void 0});return B&&!A?p.createElement(p.Fragment,null,ee,p.createElement(Bj,{page:D})):ee});Rv.displayName="Link";var Pj=p.forwardRef(function({"aria-current":a="page",caseSensitive:s=!1,className:o="",end:c=!1,style:u,to:d,viewTransition:h,children:g,...m},y){let v=Zs(d,{relative:m.relative}),b=ia(),S=p.useContext(Vo),{navigator:k,basename:w}=p.useContext(Gn),E=S!=null&&Qj(v)&&h===!0,T=k.encodeLocation?k.encodeLocation(v).pathname:v.pathname,N=b.pathname,A=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;s||(N=N.toLowerCase(),A=A?A.toLowerCase():null,T=T.toLowerCase()),A&&w&&(A=Mr(A,w)||A);const _=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let D=N===T||!c&&N.startsWith(T)&&N.charAt(_)==="/",F=A!=null&&(A===T||!c&&A.startsWith(T)&&A.charAt(T.length)==="/"),C={isActive:D,isPending:F,isTransitioning:E},B=D?a:void 0,L;typeof o=="function"?L=o(C):L=[o,D?"active":null,F?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let U=typeof u=="function"?u(C):u;return p.createElement(Rv,{...m,"aria-current":B,className:L,ref:y,style:U,to:d,viewTransition:h},typeof g=="function"?g(C):g)});Pj.displayName="NavLink";var Fj=p.forwardRef(({discover:t="render",fetcherKey:a,navigate:s,reloadDocument:o,replace:c,state:u,method:d=Ro,action:h,onSubmit:g,relative:m,preventScrollReset:y,viewTransition:v,unstable_defaultShouldRevalidate:b,...S},k)=>{let{unstable_useTransitions:w}=p.useContext(Gn),E=Kj(),T=Xj(h,{relative:m}),N=d.toLowerCase()==="get"?"get":"post",A=typeof h=="string"&&Tv.test(h),_=D=>{if(g&&g(D),D.defaultPrevented)return;D.preventDefault();let F=D.nativeEvent.submitter,C=(F==null?void 0:F.getAttribute("formmethod"))||d,B=()=>E(F||D.currentTarget,{fetcherKey:a,method:C,navigate:s,replace:c,state:u,relative:m,preventScrollReset:y,viewTransition:v,unstable_defaultShouldRevalidate:b});w&&s!==!1?p.startTransition(()=>B()):B()};return p.createElement("form",{ref:k,method:N,action:T,onSubmit:o?g:_,...S,"data-discover":!A&&t==="render"?"true":void 0})});Fj.displayName="Form";function Gj(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Av(t){let a=p.useContext(Ol);return Ft(a,Gj(t)),a}function Wj(t,{target:a,replace:s,unstable_mask:o,state:c,preventScrollReset:u,relative:d,viewTransition:h,unstable_defaultShouldRevalidate:g,unstable_useTransitions:m}={}){let y=rj(),v=ia(),b=Zs(t,{relative:d});return p.useCallback(S=>{if(kj(S,a)){S.preventDefault();let k=s!==void 0?s:Ps(v)===Ps(b),w=()=>y(t,{replace:k,unstable_mask:o,state:c,preventScrollReset:u,relative:d,viewTransition:h,unstable_defaultShouldRevalidate:g});m?p.startTransition(()=>w()):w()}},[v,y,b,s,o,c,a,t,u,d,h,g,m])}var qj=0,Yj=()=>`__${String(++qj)}__`;function Kj(){let{router:t}=Av("useSubmit"),{basename:a}=p.useContext(Gn),s=mj(),o=t.fetch,c=t.navigate;return p.useCallback(async(u,d={})=>{let{action:h,method:g,encType:m,formData:y,body:v}=Ej(u,a);if(d.navigate===!1){let b=d.fetcherKey||Yj();await o(b,s,d.action||h,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:y,body:v,formMethod:d.method||g,formEncType:d.encType||m,flushSync:d.flushSync})}else await c(d.action||h,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:y,body:v,formMethod:d.method||g,formEncType:d.encType||m,replace:d.replace,state:d.state,fromRouteId:s,flushSync:d.flushSync,viewTransition:d.viewTransition})},[o,c,a,s])}function Xj(t,{relative:a}={}){let{basename:s}=p.useContext(Gn),o=p.useContext(Lr);Ft(o,"useFormAction must be used inside a RouteContext");let[c]=o.matches.slice(-1),u={...Zs(t||".",{relative:a})},d=ia();if(t==null){u.search=d.search;let h=new URLSearchParams(u.search),g=h.getAll("index");if(g.some(y=>y==="")){h.delete("index"),g.filter(v=>v).forEach(v=>h.append("index",v));let y=h.toString();u.search=y?`?${y}`:""}}return(!t||t===".")&&c.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),s!=="/"&&(u.pathname=u.pathname==="/"?s:ur([s,u.pathname])),Ps(u)}function Qj(t,{relative:a}={}){let s=p.useContext(bv);Ft(s!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=Av("useViewTransitionState"),c=Zs(t,{relative:a});if(!s.isTransitioning)return!1;let u=Mr(s.currentLocation.pathname,o)||s.currentLocation.pathname,d=Mr(s.nextLocation.pathname,o)||s.nextLocation.pathname;return Oo(c.pathname,d)!=null||Oo(c.pathname,u)!=null}var Go=fv();const Zj=dv(Go),Jj="modulepreload",eS=function(t){return"/"+t},Fx={},Ha=function(a,s,o){let c=Promise.resolve();if(s&&s.length>0){let d=function(m){return Promise.all(m.map(y=>Promise.resolve(y).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),g=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));c=d(s.map(m=>{if(m=eS(m),m in Fx)return;Fx[m]=!0;const y=m.endsWith(".css"),v=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${v}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":Jj,y||(b.as="script"),b.crossOrigin="",b.href=m,g&&b.setAttribute("nonce",g),document.head.appendChild(b),y)return new Promise((S,k)=>{b.addEventListener("load",S),b.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${m}`)))})}))}function u(d){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=d,window.dispatchEvent(h),!h.defaultPrevented)throw d}return c.then(d=>{for(const h of d||[])h.status==="rejected"&&u(h.reason);return a().catch(u)})},tS=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;function yd(t){if(typeof t!="string")return null;const a=t.trim();return a===""||!tS.test(a)||a==="0.0.0"?null:a}function Mv(t){const a=yd(t.frontmatterVersion);if(a)return{version:a,versionSource:"frontmatter"};const s=yd(t.registryCurrentVersion);if(s)return{version:s,versionSource:"registry"};const o=yd(t.pluginVersion);return o?{version:o,versionSource:"plugin"}:{version:"1.0.0",versionSource:"default"}}const Gx={own:"authoring-project",installed:"available-project",global:"available-personal"},Xd=new Set(["available-project","available-personal","available-plugin","authoring-project","authoring-plugin"]);function nS(t){if(typeof t=="string"){if(Xd.has(t))return t;if(Object.prototype.hasOwnProperty.call(Gx,t))return Gx[t]}return"authoring-project"}function rS(t){return t.startsWith("available-")?"available":"authoring"}function aS(t){const a=t.indexOf("-");return t.slice(a+1)}const Vn="";class Us extends Error{constructor(a,s){super(a),this.name="ApiError",this.status=s}}async function Ie(t,a){const s=await fetch(`${Vn}${t}`,a);if(!s.ok){const o=await s.json().catch(()=>({error:s.statusText}));throw new Us(o.error||`HTTP ${s.status}`,s.status)}return s.json()}async function Wx(t,a){const s=await fetch(t,a);return s.status>=502&&s.status<=504?(await new Promise(o=>setTimeout(o,250)),fetch(t,a)):s}function en(t){return typeof t=="string"&&t.length>0?t:null}function lS(t){return typeof t=="number"&&Number.isFinite(t)?t:null}function bd(t){if(!Array.isArray(t))return null;const a=t.filter(s=>typeof s=="string"&&s.length>0);return a.length>0?a:null}function sS(t){const a=t??{};let s;a.origin==="source"||a.origin==="installed"?s=a.origin:(s="source",console.warn(`[api.getSkills] skill ${String(a.plugin)}/${String(a.skill)} has invalid origin=${JSON.stringify(a.origin)}; defaulting to 'source'`));let o;a.scope==="own"||a.scope==="installed"||a.scope==="global"?o=a.scope:o=s==="installed"?"installed":"own";let c;a.installMethod==="authored"||a.installMethod==="copied"||a.installMethod==="symlinked"?c=a.installMethod:c=o==="own"?"authored":"copied";const u=typeof a.scopeV2=="string"&&Xd.has(a.scopeV2)?a.scopeV2:nS(a.scope),d=rS(u),h=aS(u),g=typeof a.precedenceRank=="number"?a.precedenceRank:void 0;let m;a.shadowedBy===null?m=null:typeof a.shadowedBy=="string"&&Xd.has(a.shadowedBy)?m=a.shadowedBy:m=void 0;const y={plugin:typeof a.plugin=="string"?a.plugin:"",skill:typeof a.skill=="string"?a.skill:"",dir:typeof a.dir=="string"?a.dir:"",hasEvals:!!a.hasEvals,hasBenchmark:!!a.hasBenchmark,evalCount:typeof a.evalCount=="number"?a.evalCount:0,assertionCount:typeof a.assertionCount=="number"?a.assertionCount:0,benchmarkStatus:a.benchmarkStatus==="pass"||a.benchmarkStatus==="fail"||a.benchmarkStatus==="pending"||a.benchmarkStatus==="stale"||a.benchmarkStatus==="missing"?a.benchmarkStatus:"missing",lastBenchmark:typeof a.lastBenchmark=="string"?a.lastBenchmark:null,origin:s,scope:o,isSymlink:typeof a.isSymlink=="boolean"?a.isSymlink:!1,symlinkTarget:en(a.symlinkTarget),installMethod:c,scopeV2:u,group:d,source:h,pluginName:en(a.pluginName),pluginNamespace:en(a.pluginNamespace),pluginMarketplace:en(a.pluginMarketplace),pluginManifestPath:en(a.pluginManifestPath),pluginVersion:en(a.pluginVersion),precedenceRank:g,shadowedBy:m,description:en(a.description),version:en(a.version),category:en(a.category),author:en(a.author),license:en(a.license),homepage:en(a.homepage),repoUrl:en(a.repoUrl),skillPath:en(a.skillPath),tags:bd(a.tags),deps:bd(a.deps),mcpDeps:bd(a.mcpDeps),entryPoint:en(a.entryPoint),lastModified:en(a.lastModified),sizeBytes:lS(a.sizeBytes),sourceAgent:en(a.sourceAgent)};if(a.provenance&&typeof a.provenance=="object"){const b=a.provenance;(b.promotedFrom==="installed"||b.promotedFrom==="global")&&typeof b.sourcePath=="string"&&typeof b.promotedAt=="number"?y.provenance={promotedFrom:b.promotedFrom,sourcePath:b.sourcePath,promotedAt:b.promotedAt,sourceSkillVersion:typeof b.sourceSkillVersion=="string"?b.sourceSkillVersion:void 0}:y.provenance=null}else a.provenance===null&&(y.provenance=null);typeof a.updateAvailable=="boolean"&&(y.updateAvailable=a.updateAvailable),typeof a.currentVersion=="string"&&(y.currentVersion=a.currentVersion),typeof a.latestVersion=="string"&&(y.latestVersion=a.latestVersion),typeof a.pinnedVersion=="string"&&(y.pinnedVersion=a.pinnedVersion);const v=Mv({frontmatterVersion:y.version??null,registryCurrentVersion:y.currentVersion??null,pluginVersion:y.pluginVersion??null});return y.resolvedVersion=v.version,y.versionSource=v.versionSource,y}const we={getConfig(){return Ie("/api/config")},setConfig(t,a){return Ie("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,model:a})})},async getSkills(t){const a=new URLSearchParams;t!=null&&t.scope&&a.set("scope",t.scope),t!=null&&t.agent&&a.set("agent",t.agent);const s=a.toString(),o=await Ie(`/api/skills${s?"?"+s:""}`);return Array.isArray(o)?o.map(sS):[]},getAgents(){return Ie("/api/agents")},getSkillDetail(t,a){return Ie(`/api/skills/${t}/${a}`)},async getEvals(t,a){const s=await Ie(`/api/skills/${t}/${a}/evals`);if(s&&typeof s=="object"&&"exists"in s){if(s.exists===!1)return{skill_name:a,evals:[]};const{exists:o,...c}=s;return c}return s},getEvalsEnvelope(t,a){return Ie(`/api/skills/${t}/${a}/evals`)},getActivationHistoryEnvelope(t,a){return Ie(`/api/skills/${t}/${a}/activation-history`)},saveEvals(t,a,s){return Ie(`/api/skills/${t}/${a}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})},generateEvals(t,a){return Ie(`/api/skills/${t}/${a}/generate-evals`,{method:"POST"})},async getLatestBenchmark(t,a){const s=await fetch(`${Vn}/api/skills/${t}/${a}/benchmark/latest`);if(!s.ok){const o=await s.json().catch(()=>({error:s.statusText}));throw new Us(o.error||`HTTP ${s.status}`,s.status)}return s.json()},getHistory(t,a,s){const o=new URLSearchParams;s!=null&&s.model&&o.set("model",s.model),s!=null&&s.type&&o.set("type",s.type),s!=null&&s.from&&o.set("from",s.from),s!=null&&s.to&&o.set("to",s.to);const c=o.toString();return Ie(`/api/skills/${t}/${a}/history${c?"?"+c:""}`)},getHistoryEntry(t,a,s){return Ie(`/api/skills/${t}/${a}/history/${encodeURIComponent(s)}`)},compareRuns(t,a,s,o){return Ie(`/api/skills/${t}/${a}/history-compare?a=${encodeURIComponent(s)}&b=${encodeURIComponent(o)}`)},getCaseHistory(t,a,s,o){const c=new URLSearchParams;o&&c.set("model",o);const u=c.toString();return Ie(`/api/skills/${t}/${a}/history/case/${s}${u?"?"+u:""}`)},deleteHistoryEntry(t,a,s){return Ie(`/api/skills/${t}/${a}/history/${encodeURIComponent(s)}`,{method:"DELETE"})},deleteSkill(t,a){return Ie(`/api/skills/${t}/${a}`,{method:"DELETE"})},improveSkill(t,a,s){return Ie(`/api/skills/${t}/${a}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})},instructEdit(t,a,s){return Ie(`/api/skills/${t}/${a}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"instruct",...s})})},applyImprovement(t,a,s){return Ie(`/api/skills/${t}/${a}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:s})})},getStats(t,a){return Ie(`/api/skills/${t}/${a}/stats`)},getDependencies(t,a){return Ie(`/api/skills/${t}/${a}/dependencies`)},getProjectLayout(){return Ie("/api/project-layout")},createSkill(t){return Ie("/api/skills/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},detectEngines(){return Ie("/api/studio/detect-engines")},saveDraft(t){return Ie("/api/skills/save-draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},getSkillCreatorStatus(){return Ie("/api/skill-creator-status")},generateSkill(t){return Ie("/api/skills/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},getSkillFiles(t,a){return Ie(`/api/skills/${t}/${a}/files`)},getSkillFile(t,a,s){return Ie(`/api/skills/${t}/${a}/file?path=${encodeURIComponent(s)}`)},saveSkillFile(t,a,s,o){return Ie(`/api/skills/${t}/${a}/file`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:s,content:o})})},getLeaderboard(t,a){return Ie(`/api/skills/${t}/${a}/leaderboard`)},getLeaderboardEntry(t,a,s){return Ie(`/api/skills/${t}/${a}/leaderboard/${encodeURIComponent(s)}`)},startSweep(t,a,s){const o=`${Vn}/api/skills/${t}/${a}/sweep`,c=new EventSource(o);return fetch(o,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(s)}),c},getCredentials(t,a){return Ie(`/api/credentials/${t}/${a}`)},setCredential(t,a,s,o){return Ie(`/api/credentials/${t}/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,value:o})})},getParams(t,a){return Ie(`/api/credentials/${t}/${a}/params`)},getParamsRevealed(t,a,s){const o=s?`reveal=true&key=${encodeURIComponent(s)}`:"reveal=true";return Ie(`/api/credentials/${t}/${a}/params?${o}`)},searchModels(){return Ie("/api/openrouter/models")},async getSkillVersions(t,a){const s=await Ie(`/api/skills/${t}/${a}/versions`);return Array.isArray(s)?s:Array.isArray(s.versions)?s.versions:[]},getSkillVersionsEnvelope(t,a){return Ie(`/api/skills/${t}/${a}/versions`)},getVersionDiff(t,a,s,o){return Ie(`/api/skills/${t}/${a}/versions/diff?from=${s}&to=${o}`)},startBatchUpdate(t){const a=`${Vn}/api/skills/batch-update`,s=new EventSource(a);return fetch(a,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({skills:t})}),s},startSkillUpdate(t,a){const s=`${Vn}/api/skills/${t}/${a}/update`,o=new EventSource(s);return fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"}}),o},async postSkillUpdate(t,a,s){let o,c;if(s&&typeof s.aborted=="boolean")o=s;else if(s&&typeof s=="object"){const y=s;o=y.signal,c=y.agentId}const u=c?`?agent=${encodeURIComponent(c)}`:"",d=`${Vn}/api/skills/${t}/${a}/update${u}`,h=await fetch(d,{method:"POST",headers:{"Content-Type":"application/json"},signal:o});let g,m="";if(h.body){const y=h.body.getReader(),v=new TextDecoder;let b=!1,S="";for(;!b;){const w=await y.read();if(b=w.done,w.value){const E=v.decode(w.value,{stream:!b});S+=E,m.length<200&&(m+=E)}}const k=S.match(/event:\s*done[\s\S]*?data:\s*(\{[^\n]+\})/);if(k)try{g=JSON.parse(k[1]).version}catch{}m=m.slice(0,200)}else{const y=await h.text();m=y.slice(0,200);const v=y.match(/event:\s*done[\s\S]*?data:\s*(\{[^\n]+\})/);if(v)try{g=JSON.parse(v[1]).version}catch{}}return{ok:h.ok,status:h.status,body:m,version:g}},async rescanSkill(t,a){const s=`${t}/${a}`,o=await fetch(`${Vn}/api/v1/skills/${encodeURIComponent(s)}/rescan`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!o.ok)throw new Error(`rescan failed: HTTP ${o.status}`);return await o.json()},async getSkillUpdates(){try{const t=await fetch(`${Vn}/api/skills/updates`);return t.ok?await t.json():[]}catch{return[]}},async checkSkillUpdates(t){if(t.length===0)return[];try{const a=[...t].sort(),s=await Wx(`${Vn}/api/v1/skills/check-updates`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({skills:a.map(c=>({name:c,currentVersion:"0.0.0"}))})});if(!s.ok)return[];const o=await s.json().catch(()=>null);return Array.isArray(o)?o:o&&typeof o=="object"&&Array.isArray(o.results)?o.results.map(c=>({skillId:typeof c.skillId=="string"?c.skillId:typeof c.name=="string"?c.name:"",version:typeof c.version=="string"?c.version:typeof c.latest=="string"?c.latest:"",eventId:typeof c.eventId=="string"?c.eventId:"",publishedAt:typeof c.publishedAt=="string"?c.publishedAt:"",diffSummary:typeof c.diffSummary=="string"?c.diffSummary:void 0,trackedForUpdates:typeof c.trackedForUpdates=="boolean"?c.trackedForUpdates:void 0,updateAvailable:typeof c.updateAvailable=="boolean"?c.updateAvailable:void 0,installed:typeof c.installed=="string"?c.installed:void 0,latest:typeof c.latest=="string"?c.latest:void 0,name:typeof c.name=="string"?c.name:void 0})):[]}catch{return[]}},async resolveInstalledSkillIds(t){if(t.length===0)return[];try{const a=await Wx(`${Vn}/api/v1/skills/check-updates`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({skills:t.map(u=>({name:u.name,currentVersion:u.currentVersion??"0.0.0"}))})});if(!a.ok)return t.map(u=>({plugin:u.plugin,skill:u.skill}));const s=await a.json().catch(()=>null),o=Array.isArray(s)?s:Array.isArray(s==null?void 0:s.results)?s.results:[],c=new Map(o.map(u=>[u.name,u]));return t.map(u=>{const d=c.get(u.name);return{plugin:u.plugin,skill:u.skill,uuid:typeof(d==null?void 0:d.id)=="string"&&d.id.length>0?d.id:void 0,slug:typeof(d==null?void 0:d.slug)=="string"&&d.slug.length>0?d.slug:void 0}})}catch{return t.map(s=>({plugin:s.plugin,skill:s.skill}))}},promoteSkill(t,a,s){const o=s!=null&&s.overwrite?"?overwrite=true":"";return jd(`/api/skills/${t}/${a}/promote${o}`,s==null?void 0:s.onEvent,s==null?void 0:s.signal)},testInstallSkill(t,a,s){const o=new URLSearchParams;(s==null?void 0:s.dest)==="global"&&o.set("dest","global"),s!=null&&s.overwrite&&o.set("overwrite","true");const c=o.toString();return jd(`/api/skills/${t}/${a}/test-install${c?"?"+c:""}`,s==null?void 0:s.onEvent,s==null?void 0:s.signal)},revertSkill(t,a,s){return jd(`/api/skills/${t}/${a}/revert`,s==null?void 0:s.onEvent,s==null?void 0:s.signal)},listStudioOps(t){const a=new URLSearchParams;(t==null?void 0:t.before)!=null&&a.set("before",String(t.before)),(t==null?void 0:t.limit)!=null&&a.set("limit",String(t.limit));const s=a.toString();return Ie(`/api/studio/ops${s?"?"+s:""}`)},deleteStudioOp(t){return Ie(`/api/studio/ops/${encodeURIComponent(t)}`,{method:"DELETE"})},studioOpsStream(){return new EventSource(`${Vn}/api/studio/ops/stream`)},gitRemote(){return Ie("/api/git/remote")},gitDiff(){return Ie("/api/git/diff",{method:"POST"})},gitCommitMessage(t){return Ie("/api/git/commit-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t??{})})},gitPublish(t){return Ie("/api/git/publish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t??{})})}};async function jd(t,a,s){const o=await fetch(`${Vn}${t}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},signal:s});if(!o.ok||!o.body){let y=`HTTP ${o.status}`,v;try{const S=await o.json();S.error&&(y=S.error),typeof S.code=="string"&&(v=S.code)}catch{}const b=new Us(y,o.status);throw v&&(b.code=v),b}const c=o.body.getReader(),u=new TextDecoder;let d="",h="",g=null,m=null;for(;;){const{done:y,value:v}=await c.read();if(y)break;d+=u.decode(v,{stream:!0});const b=d.split(`
|
|
62
|
-
`);d=b.pop()??"";for(const S of b)if(S.startsWith("event: "))h=S.slice(7).trim();else if(S.startsWith("data: ")){let k={};try{k=JSON.parse(S.slice(6))}catch{h="";continue}if(h==="started"||h==="copied"||h==="deleted"||h==="indexed"||h==="done"||h==="error"){const w={type:h,...k};a==null||a(w),w.type==="done"&&(g=w),w.type==="error"&&(m=w)}h=""}}if(m){const y=new Us(m.message,500);throw y.code=m.code,y}if(!g)throw new Us("Transfer stream ended without 'done' event",500);return g}function iS(t,a){if(!t||!a)return!1;const s=/^(\d+)\.(\d+)\.(\d+)/,o=t.match(s),c=a.match(s);if(!o||!c)return!1;const[,u,d,h]=o.map(Number),[,g,m,y]=c.map(Number);return u!==g?u>g:d!==m?d>m:h>=y}function oS(t,a){if(!a.length)return t;const s=new Map,o=new Map;for(const c of a){const u=c.name.split("/"),d=u.pop()||c.name;if(o.set(d,c),u.length>=1){const h=u[u.length-1];s.set(`${h}/${d}`,c)}}return t.map(c=>{if(c.origin!=="installed")return c;let u;if(c.pluginName?u=s.get(`${c.pluginName}/${c.skill}`):u=o.get(c.skill),!u)return c;const d=u.updateAvailable&&!iS(c.version,u.latest),h={...c,updateAvailable:d,currentVersion:u.installed,latestVersion:u.latest??void 0};typeof u.trackedForUpdates=="boolean"&&(h.trackedForUpdates=u.trackedForUpdates);const g=Mv({frontmatterVersion:h.version??null,registryCurrentVersion:h.currentVersion??null,pluginVersion:h.pluginVersion??null});return h.resolvedVersion=g.version,h.versionSource=g.versionSource,h})}const Mo=new Map,Oa=new Map,Bs=new Map;function En(t){Mo.delete(t),Oa.delete(t);const a=Bs.get(t);if(a)for(const s of a)s()}function Js(t,a,s={}){const{ttl:o=3e4,enabled:c=!0}=s,[,u]=p.useState(0),[d,h]=p.useState(void 0),[g,m]=p.useState(0),y=p.useRef(!0),v=p.useRef(t);v.current=t;const b=()=>{h(void 0),En(t),m(w=>w+1)};p.useEffect(()=>(y.current=!0,()=>{y.current=!1}),[]),p.useEffect(()=>{if(!c)return;const w=()=>{y.current&&u(E=>E+1)};return Bs.has(t)||Bs.set(t,new Set),Bs.get(t).add(w),()=>{var E;(E=Bs.get(t))==null||E.delete(w)}},[t,c]),p.useEffect(()=>{if(!c)return;const w=Mo.get(t);if(!(!w||Date.now()-w.fetchedAt>o))return;if(Oa.has(t)){const A=Oa.get(t),_=()=>{y.current&&v.current===t&&u(D=>D+1)};A.subscribers.push(_);return}const T={promise:Promise.resolve(),subscribers:[]},N=a().then(A=>{Mo.set(t,{data:A,fetchedAt:Date.now()}),Oa.delete(t),y.current&&v.current===t&&(h(void 0),u(_=>_+1));for(const _ of T.subscribers)_()},A=>{Oa.delete(t);const _=A instanceof Error?A:new Error(String(A));y.current&&v.current===t&&(h(_),u(D=>D+1));for(const D of T.subscribers)D()});T.promise=N,Oa.set(t,T)},[t,a,o,c,g]);const S=Mo.get(t),k=c&&!S&&!d&&Oa.has(t);return{data:S==null?void 0:S.data,loading:k,error:d,revalidate:b}}function cS(t){const[a,s]=p.useState(()=>typeof window>"u"?!1:window.matchMedia(t).matches);return p.useEffect(()=>{const o=window.matchMedia(t);s(o.matches);const c=u=>s(u.matches);return o.addEventListener("change",c),()=>o.removeEventListener("change",c)},[t]),a}const uS=500,Qd="vskill.updates.seenLastId";function dS(){if(typeof window>"u")return null;try{return window.localStorage.getItem(Qd)}catch{return null}}function Sd(t){if(!(typeof window>"u"))try{t==null?window.localStorage.removeItem(Qd):window.localStorage.setItem(Qd,t)}catch{}}function fS(){let t=new Map;const a=new Set,s=new Set,o=[];let c=dS();c&&(s.add(c),o.push(c));function u(){t=new Map(t);for(const h of Array.from(a))h()}function d(h){if(!s.has(h)){if(s.add(h),o.push(h),o.length>uS){const g=o.shift();g&&s.delete(g)}c=h,Sd(h)}}return{getSnapshot(){return t},subscribe(h){return a.add(h),()=>{a.delete(h)}},ingest(h){return s.has(h.eventId)?"duplicate":(d(h.eventId),t.set(h.skillId,{skillId:h.skillId,version:h.version,diffSummary:h.diffSummary,eventId:h.eventId,publishedAt:h.publishedAt,receivedAt:Date.now()}),u(),"stored")},dismiss(h){t.has(h)&&(t.delete(h),u())},clearSeen(){s.clear(),o.length=0,c=null,Sd(null)},mergeBulk(h){if(h.length!==0){for(const g of h)t.set(g.skillId,g);u()}},getSeenLastId(){return c},reset(){t=new Map,s.clear(),o.length=0,c=null,Sd(null),u()}}}const Da=fS(),pS=3e5,mS=500,hS=15e3,xS=6e4,gS=6e4,vS="/api/v1/skills/stream";function qx(t){const a=new Map;for(const s of t){const o=s.name.split("/").pop()||s.name;a.set(o,s)}return a}function Yx(t){let a=0;for(const s of t)s.updateAvailable&&a++;return a}function yS(t){if(!t||typeof t!="object")return!1;const a=t;return a.type==="skill.updated"&&typeof a.eventId=="string"&&typeof a.skillId=="string"&&typeof a.version=="string"}function bS(t){const a=(t==null?void 0:t.intervalMs)??pS,s=(t==null?void 0:t.debounceMs)??mS,o=(t==null?void 0:t.timeoutMs)??hS,c=(t==null?void 0:t.staleAfterMs)??xS,u=(t==null?void 0:t.disconnectFallbackMs)??gS,d=(t==null?void 0:t.streamUrlBase)??vS,h=p.useMemo(()=>!(t!=null&&t.skillIds)||t.skillIds.length===0?"":[...t.skillIds].sort().join(","),[t==null?void 0:t.skillIds]),g=p.useMemo(()=>{const M=(t==null?void 0:t.trackingSkillIds)??(t==null?void 0:t.skillIds)??[];return M.length===0?"":[...M].sort().join(",")},[t==null?void 0:t.trackingSkillIds,t==null?void 0:t.skillIds]),[m,y]=p.useState([]),[v,b]=p.useState(()=>new Map),[S,k]=p.useState(0),[w,E]=p.useState(!1),[T,N]=p.useState(null),[A,_]=p.useState(null),D=p.useRef(null),F=p.useRef(null),C=p.useRef(null),B=p.useRef(null),L=p.useRef(!0),[U,$]=p.useState(()=>h?"connecting":"fallback"),q=p.useRef(U);q.current=U;const X=p.useSyncExternalStore(M=>Da.subscribe(M),()=>Da.getSnapshot(),()=>Da.getSnapshot()),ee=X.size,I=p.useCallback(async()=>{E(!0);const M=new AbortController,Y=setTimeout(()=>M.abort(),o);try{const W=await Promise.race([we.getSkillUpdates(),new Promise((Q,oe)=>{M.signal.addEventListener("abort",()=>{oe(new Error("TIMEOUT"))})})]);if(W==="TIMEOUT")throw new Error("TIMEOUT");if(!L.current)return;y(W),b(qx(W)),k(Yx(W)),F.current=Date.now(),N(F.current),_(null)}catch(W){if(!L.current)return;_(W instanceof Error?W:new Error(String(W)))}finally{clearTimeout(Y),L.current&&E(!1)}},[o]),z=p.useCallback(()=>{if(D.current)return D.current;const M=I().finally(()=>{D.current=null});return D.current=M,M},[I]),O=p.useCallback(()=>{C.current==null&&(C.current=setInterval(()=>{z()},a))},[a,z]),P=p.useCallback(()=>{C.current!=null&&(clearInterval(C.current),C.current=null)},[]);p.useEffect(()=>{L.current=!0,(F.current==null||Date.now()-F.current>c)&&z(),(typeof document>"u"||document.visibilityState!=="hidden")&&O();const W=()=>{if(B.current&&(clearTimeout(B.current),B.current=null),document.visibilityState==="hidden"){P();return}B.current=setTimeout(()=>{B.current=null,(F.current==null||Date.now()-F.current>c)&&z(),O()},s)};return typeof document<"u"&&document.addEventListener("visibilitychange",W),()=>{L.current=!1,typeof document<"u"&&document.removeEventListener("visibilitychange",W),B.current&&clearTimeout(B.current),P()}},[]);const H=p.useCallback(async M=>{if(M.length!==0)try{const Y=await we.checkSkillUpdates(M);if(!L.current||Y.length===0)return;const W=Date.now(),Q=Y.filter(de=>de.skillId&&de.eventId&&de.version).map(de=>({skillId:de.skillId,version:de.version,eventId:de.eventId,publishedAt:de.publishedAt,diffSummary:de.diffSummary,receivedAt:W}));Q.length>0&&Da.mergeBulk(Q);const oe=Y.filter(de=>typeof de.trackedForUpdates=="boolean"||typeof de.updateAvailable=="boolean").map(de=>({name:de.name??de.skillId,installed:de.installed??"",latest:de.latest??null,updateAvailable:de.updateAvailable??!1,trackedForUpdates:typeof de.trackedForUpdates=="boolean"?de.trackedForUpdates:void 0}));oe.length>0&&y(de=>{const ve=new Map;for(const Re of de)ve.set(Re.name.split("/").pop()||Re.name,Re);let ce=0;for(const Re of oe){const Oe=Re.name.split("/").pop()||Re.name,le=ve.get(Oe);if(le){const he={...le};le.trackedForUpdates===void 0&&Re.trackedForUpdates!==void 0&&(he.trackedForUpdates=Re.trackedForUpdates),ve.set(Oe,he)}else ve.set(Oe,{name:Re.name,installed:Re.installed??"",latest:Re.latest??null,updateAvailable:Re.updateAvailable??!1,trackedForUpdates:Re.trackedForUpdates}),ce+=1}if(ce===0&&ve.size===de.length)return de;const je=[...ve.values()];return b(qx(je)),k(Yx(je)),je})}catch{}},[]);p.useEffect(()=>{const M=h||g;if(!M){$("fallback");return}if(typeof window>"u"||typeof EventSource>"u"){$("fallback");return}$("connecting");const Y=M.split(","),W=`${d}?skills=${encodeURIComponent(M)}`;let Q=null,oe=null,de=null;const ve=()=>{oe==null&&(oe=setTimeout(()=>{oe=null,L.current&&q.current!=="connected"&&$("fallback")},u))},ce=()=>{oe!=null&&(clearTimeout(oe),oe=null)};ve();const je=1e3,Re=()=>{L.current&&de==null&&(de=setTimeout(()=>{if(de=null,!!L.current&&!(Q&&Q.readyState!==EventSource.CLOSED)){if(Q)try{Q.close()}catch{}he()}},je))},Oe=pe=>{if(!L.current)return;let xe;try{xe=JSON.parse(pe.data)}catch{return}if(!yS(xe)||Da.ingest(xe)==="duplicate")return;if(typeof document>"u"||document.visibilityState!=="hidden"){const Ue=`${xe.skillId} updated to ${xe.version}`;window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:Ue,severity:"info",skillId:xe.skillId,version:xe.version,eventId:xe.eventId}}))}},le=()=>{L.current&&(Da.clearSeen(),H(Y))},he=()=>{L.current&&(Q=new EventSource(W),Q.onopen=()=>{L.current&&(ce(),$("connected"))},Q.onerror=()=>{L.current&&(ve(),Q&&Q.readyState===EventSource.CLOSED&&Re())},Q.onmessage=Oe,Q.addEventListener("gone",le))};return he(),()=>{if(ce(),de!=null&&(clearTimeout(de),de=null),Q){try{Q.removeEventListener("gone",le)}catch{}try{Q.close()}catch{}}}},[h,g,d,u,H]),p.useEffect(()=>{if(!g)return;const M=g.split(",");H(M)},[g,H]);const ae=p.useCallback(M=>{Da.dismiss(M)},[]);return{updates:m,updatesMap:v,updateCount:S,isRefreshing:w,lastFetchAt:T,error:A,refresh:z,updatesById:X,pushUpdateCount:ee,status:U,dismiss:ae}}function jS(t){const a=[];for(const s of t){const o=typeof s.uuid=="string"&&s.uuid.length>0,c=typeof s.slug=="string"&&s.slug.length>0;if(!o&&!c)continue;const u={};o&&(u.uuid=s.uuid),c&&(u.slug=s.slug),a.push(u)}return a}const SS={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list",updateNotificationDismissed:!1,revealSkillId:null};function kS(t,a){switch(a.type){case"SELECT_SKILL":return{...t,selectedSkill:a.skill,mode:"browse",mobileView:t.isMobile?"detail":t.mobileView};case"CLEAR_SELECTION":return{...t,selectedSkill:null};case"SET_MODE":return{...t,mode:a.mode,selectedSkill:a.mode==="create"?null:t.selectedSkill};case"SET_SEARCH":return{...t,searchQuery:a.query};case"SET_SKILLS":return{...t,skills:a.skills,skillsLoading:!1,skillsError:null};case"SET_SKILLS_ERROR":return{...t,skillsError:a.error,skillsLoading:!1};case"SET_SKILLS_LOADING":return{...t,skillsLoading:a.loading};case"SET_MOBILE":return{...t,isMobile:a.isMobile};case"SET_MOBILE_VIEW":return{...t,mobileView:a.view};case"DISMISS_UPDATE_NOTIFICATION":return{...t,updateNotificationDismissed:!0};case"REVEAL_SKILL":return{...t,selectedSkill:a.skill,revealSkillId:`${a.skill.plugin}/${a.skill.skill}`,mode:"browse",mobileView:t.isMobile?"detail":t.mobileView};case"CLEAR_REVEAL":return{...t,revealSkillId:null};default:return t}}const Lv=p.createContext(null),zv=Lv;function er(){const t=p.useContext(zv);if(!t)throw new Error("useStudio must be used within StudioProvider");return t}function wS({children:t}){const[a,s]=p.useReducer(kS,SS),o=cS("(max-width: 767px)");p.useEffect(()=>{s({type:"SET_MOBILE",isMobile:o})},[o]);const[c,u]=p.useState(()=>{try{const H=window.localStorage.getItem("vskill.studio.prefs");if(!H)return null;const ae=JSON.parse(H);return typeof ae.activeAgent=="string"?ae.activeAgent:null}catch{return null}}),[d,h]=p.useState(c!==null);p.useEffect(()=>{function H(ae){if(!(ae instanceof CustomEvent))return;const M=ae.detail;M!=null&&M.agentId&&(u(M.agentId),h(!0))}return window.addEventListener("studio:agent-changed",H),()=>window.removeEventListener("studio:agent-changed",H)},[]),p.useEffect(()=>{if(d)return;let H=!1;return we.getAgents().then(ae=>{if(H)return;const M=(ae==null?void 0:ae.suggested)??"claude-code";u(Y=>Y??M),h(!0)}).catch(()=>{H||(u(ae=>ae??"claude-code"),h(!0))}),()=>{H=!0}},[d]);const g=p.useCallback(()=>{if(!d||!c)return;s({type:"SET_SKILLS_LOADING",loading:!0});const H={agent:c};we.getSkills(H).then(ae=>{s({type:"SET_SKILLS",skills:ae});const Y=window.location.hash.match(/^#\/skills\/([^/]+)\/([^/?]+)/);if(Y){const[,W,Q]=Y,oe=ae.find(de=>de.plugin===W&&de.skill===Q);oe&&s({type:"SELECT_SKILL",skill:{plugin:W,skill:Q,origin:oe.origin}})}}).catch(ae=>s({type:"SET_SKILLS_ERROR",error:ae.message}))},[c,d]);p.useEffect(()=>{g()},[g]);const m=p.useCallback(H=>{s({type:"SELECT_SKILL",skill:H}),window.location.hash=`/skills/${H.plugin}/${H.skill}`},[]),y=p.useRef(a.skills);p.useEffect(()=>{y.current=a.skills},[a.skills]);const v=p.useCallback((H,ae)=>{const M=y.current,Y=H?M.find(oe=>oe.plugin===H&&oe.skill===ae):M.find(oe=>oe.skill===ae&&oe.source!=="plugin");if(!H&&!Y){typeof console<"u"&&console.warn(`[StudioContext] revealSkill: no plugin provided and skill "${ae}" not yet in state — skipping reveal`);return}const W=(Y==null?void 0:Y.plugin)??H,Q=(Y==null?void 0:Y.origin)??"source";s({type:"REVEAL_SKILL",skill:{plugin:W,skill:ae,origin:Q}}),window.location.hash=`/skills/${W}/${ae}`},[]),b=p.useCallback(()=>{s({type:"CLEAR_REVEAL"})},[]),S=p.useCallback(()=>{s({type:"CLEAR_SELECTION"}),window.location.hash.startsWith("#/skills/")&&history.replaceState(null,"",window.location.pathname+window.location.search)},[]),k=p.useCallback(H=>{s({type:"SET_MODE",mode:H})},[]),w=p.useCallback(H=>{s({type:"SET_SEARCH",query:H})},[]),E=p.useCallback(H=>{s({type:"SET_MOBILE_VIEW",view:H})},[]),T=p.useCallback(()=>{s({type:"DISMISS_UPDATE_NOTIFICATION"})},[]),N=p.useRef(new Map),A=p.useRef(""),_=p.useRef(!1),[D,F]=p.useState(""),C=p.useMemo(()=>a.skills.map(H=>`${H.plugin}/${H.skill}`),[a.skills]),B=p.useMemo(()=>D?D.split(",").filter(Boolean):[],[D]),L=bS({skillIds:B,trackingSkillIds:C}),U=p.useRef("");p.useEffect(()=>{const H=a.skills.filter(Q=>Q.origin==="installed");if(H.length===0){F(""),U.current="";return}const ae=new Map;for(const Q of L.updates)ae.set(Q.name.split("/").pop()||Q.name,Q);const M=H.map(Q=>{const oe=ae.get(Q.skill),de=Q.currentVersion??(oe==null?void 0:oe.installed)??Q.version??Q.pluginVersion??"1.0.0";return{plugin:Q.plugin,skill:Q.skill,name:(oe==null?void 0:oe.name)??Q.skill,currentVersion:de}}),Y=M.map(Q=>`${Q.plugin}/${Q.skill}@${Q.currentVersion}#${Q.name}`).sort().join("|");if(Y===U.current)return;U.current=Y;let W=!1;return we.resolveInstalledSkillIds(M).then(Q=>{if(W)return;const ve=[...jS(Q).flatMap(ce=>[ce.uuid,ce.slug].filter(Boolean))].sort().join(",");ve!==A.current&&(A.current=ve,N.current=new Map(Q.map(ce=>[`${ce.plugin}/${ce.skill}`,{uuid:ce.uuid,slug:ce.slug}])),F(ve))}).catch(Q=>{if(W||(U.current=""),!_.current){_.current=!0;const oe=Q instanceof Error?Q.message:String(Q);console.warn("[studio] resolveInstalledSkillIds failed (using polling fallback):",oe)}}),()=>{W=!0}},[a.skills,L.updates]);const $=p.useMemo(()=>{const H=a.skills.map(ae=>{if(!ae.updateAvailable&&ae.latestVersion===void 0&&ae.trackedForUpdates===void 0)return ae;const M={...ae};return delete M.updateAvailable,delete M.currentVersion,delete M.latestVersion,delete M.trackedForUpdates,M});return oS(H,L.updates)},[a.skills,L.updates]),q=p.useMemo(()=>{const H={source:0,installed:0};for(const ae of $)ae.updateAvailable&&(H[ae.origin]+=1);return H},[$]),X=p.useMemo(()=>({...a,skills:$}),[a,$]),ee=L.updateCount,I=L.refresh,z=L.isRefreshing,O=p.useCallback((H,ae)=>{I(),g(),En(`versions/${H}/${ae}`),L.dismiss(`${H}/${ae}`)},[I,g,L]),P=p.useMemo(()=>({state:X,selectSkill:m,clearSelection:S,setMode:k,setSearch:w,setMobileView:E,refreshSkills:g,updateCount:ee,dismissUpdateNotification:T,updates:L.updates,outdatedByOrigin:q,isRefreshingUpdates:z,refreshUpdates:I,revealSkill:v,clearReveal:b,updatesById:L.updatesById,pushUpdateCount:L.pushUpdateCount,updateStreamStatus:L.status,dismissPushUpdate:L.dismiss,activeAgent:c,onSkillUpdated:O}),[X,m,S,k,w,E,g,ee,T,L.updates,q,z,I,v,b,L.updatesById,L.pushUpdateCount,L.status,L.dismiss,c,O]);return r.jsx(zv.Provider,{value:P,children:t})}const CS={config:null,loading:!0};function ES(t,a){switch(a.type){case"SET_CONFIG":return{config:a.config,loading:!1};case"SET_LOADING":return{...t,loading:!0};default:return t}}const Dv=p.createContext(null);function $a(){const t=p.useContext(Dv);if(!t)throw new Error("useConfig must be used within ConfigProvider");return t}function NS({children:t}){const[a,s]=p.useReducer(ES,CS),o=p.useCallback(()=>{we.getConfig().then(d=>s({type:"SET_CONFIG",config:d})).catch(()=>{})},[]);p.useEffect(()=>{o()},[o]);const c=p.useCallback(async(d,h)=>{const g=await we.setConfig(d,h);return s({type:"SET_CONFIG",config:g}),g},[]),u=p.useMemo(()=>({config:a.config,loading:a.loading,updateConfig:c,refreshConfig:o}),[a,c,o]);return r.jsx(Dv.Provider,{value:u,children:t})}function TS({topRail:t,sidebar:a,main:s,statusBar:o,resizeHandle:c,banner:u,liveMessage:d,sidebarWidth:h=320,sidebarHidden:g=!1}){const m={"--top-rail-height":"48px","--status-bar-height":"28px","--sidebar-width":`${h}px`,display:"grid",gridTemplateRows:"var(--top-rail-height) 1fr var(--status-bar-height)",height:"100vh",overflow:"hidden",background:"var(--bg-canvas)",color:"var(--text-primary)"},y={display:"grid",gridTemplateColumns:g?"1fr":"var(--sidebar-width) auto 1fr",minHeight:0,overflow:"hidden"};return r.jsxs("div",{className:"studio-shell",style:m,children:[u,r.jsx("header",{style:{borderBottom:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:t}),r.jsxs("div",{style:y,children:[!g&&r.jsx("aside",{"aria-label":"Skills sidebar",style:{minHeight:0,overflow:"hidden",borderRight:c?"none":"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",flexDirection:"column"},children:a}),!g&&c,r.jsx("main",{style:{minHeight:0,overflow:"auto",background:"var(--bg-canvas)"},children:s})]}),r.jsx("footer",{role:"contentinfo",style:{borderTop:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:o}),r.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:d??""})]})}const Kx=["claude-cli","anthropic","openai","openrouter","cursor","codex-cli","gemini-cli","copilot","zed","ollama","lm-studio"],RS={"claude-cli":".claude",cursor:".cursor","codex-cli":".codex","gemini-cli":".gemini",copilot:".github",zed:".zed"},AS={"claude-cli":"claude",cursor:"cursor","codex-cli":"codex","gemini-cli":"gemini"},MS={"claude-cli":"cli-install",anthropic:"api-key",openai:"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"},LS={"claude-cli":"subscription",anthropic:"per-token",openai:"per-token",openrouter:"per-token",cursor:"subscription","codex-cli":"subscription","gemini-cli":"subscription",copilot:"subscription",zed:"subscription",ollama:"free","lm-studio":"free"};function zS(t,a){var h,g;const s=RS[t.id]??null,o=AS[t.id]??null,c=s?!!((h=a==null?void 0:a.wrapperFolders)!=null&&h[s]):!1,u=o?!!((g=a==null?void 0:a.binaries)!=null&&g[o]):!0,d=t.models.map(m=>({id:m.id,displayName:m.label,billingMode:LS[t.id]??"per-token",...m.pricing?{pricing:m.pricing}:{},...m.resolvedId?{resolvedId:m.resolvedId}:{}}));return{id:t.id,displayName:DS(t.id,t.label),wrapperFolder:s,wrapperFolderPresent:c,binaryAvailable:u,endpointReachable:t.id==="ollama"||t.id==="lm-studio"?t.available:null,available:t.available,ctaType:t.available?null:MS[t.id]??null,models:d,resolvedModel:t.resolvedModel??null}}function DS(t,a){return{"claude-cli":"Claude Code",anthropic:"Anthropic API",openai:"OpenAI API",openrouter:"OpenRouter",cursor:"Cursor","codex-cli":"Codex CLI","gemini-cli":"Gemini CLI",copilot:"GitHub Copilot",zed:"Zed",ollama:"Ollama","lm-studio":"LM Studio"}[t]??a}function _S(t){const a=new Map(t.map(o=>[o.id,o])),s=[];for(const o of Kx){const c=a.get(o);c&&s.push(c)}for(const o of t)Kx.includes(o.id)||s.push(o);return s}function OS(t){const[a,s]=p.useState(null),[o,c]=p.useState("loading"),[u,d]=p.useState(null),[h,g]=p.useState(null),m=p.useRef(null),y=p.useRef(0),v=p.useRef(t==null?void 0:t.onStaleCatalog),b=p.useRef(t==null?void 0:t.onSetActiveError);p.useEffect(()=>{v.current=t==null?void 0:t.onStaleCatalog,b.current=t==null?void 0:t.onSetActiveError},[t==null?void 0:t.onStaleCatalog,t==null?void 0:t.onSetActiveError]);const S=p.useCallback(async()=>{try{const N=await fetch("/api/config");if(!N.ok)throw new Error(`/api/config returned ${N.status}`);const A=await N.json(),_=_S((A.providers||[]).map(D=>zS(D,A.detection)));s({agents:_,activeAgent:A.provider??null,activeModel:A.model??null}),c("ready"),d(null)}catch(N){c("error"),d(N.message)}},[]);p.useEffect(()=>{S()},[S]);const k=p.useCallback(async()=>{var A;const N=Date.now();if(!(N-y.current<5*6e4))try{const _=await fetch("/api/openrouter/models");if(!_.ok){_.status!==400&&g(`OpenRouter catalog fetch failed (${_.status})`);return}const D=await _.json();y.current=N,g(null),s(B=>{if(!B)return B;const L=B.agents.map(U=>{if(U.id!=="openrouter")return U;const $=D.models.map(X=>({id:X.id,displayName:X.name,contextWindow:X.contextWindow,pricing:X.pricing,billingMode:"per-token"}));return{...U,models:$,catalogAgeMs:D.ageSec?D.ageSec*1e3:0,cacheStale:!!D.stale}});return{...B,agents:L}});const F=D.ageSec??0;(D.stale===!0||F>600)&&((A=v.current)==null||A.call(v,"openrouter",F*1e3))}catch(_){g(`OpenRouter catalog unreachable: ${_.message}`)}},[]),w=p.useCallback(N=>{m.current=N,N==="openrouter"&&k()},[k]),E=p.useCallback(()=>{y.current=0,S()},[S]),T=p.useCallback(async(N,A)=>{var F,C;let _;try{_=await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:N,model:A})})}catch(B){(F=b.current)==null||F.call(b,`Network error while setting ${N}: ${B.message}`);return}if(_.ok){s(B=>B&&{...B,activeAgent:N,activeModel:A});return}let D=`Failed to set ${N} (${_.status})`;try{const B=await _.json();B&&typeof B.error=="string"&&(D=B.error)}catch{}(C=b.current)==null||C.call(b,D)},[]);return{status:o,catalog:a,error:u,openRouterError:h,focusAgent:w,refresh:E,activeAgentId:(a==null?void 0:a.activeAgent)??null,activeModelId:(a==null?void 0:a.activeModel)??null,setActive:T}}function kd({variant:t,label:a,onActivate:s,installUrl:o,tooltip:c}){function u(h){if(h.stopPropagation(),t==="cli-install"&&o){window.open(o,"_blank","noopener,noreferrer");return}s()}function d(h){(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),u(h))}return r.jsx("button",{type:"button","data-testid":`locked-cta-${t}`,onClick:u,onKeyDown:d,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":a,...c?{title:c}:{},children:a})}function Zd({unlocked:t=!1,size:a=10}){return t?r.jsxs("svg",{width:a,height:a,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),r.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 3.5"})]}):r.jsxs("svg",{width:a,height:a,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),r.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 4.5V7"})]})}const BS={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 <skill> 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:(t,a)=>`${t} of ${a}`},IS={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"},US={tabOverview:"Overview",tabVersions:"Versions",tabBenchmark:"Benchmark",emptyHeadline:"Select a skill to see details.",emptyBody:"Pick one from the sidebar.",loadErrorHeadline:t=>`Couldn't load SKILL.md for ${t}.`,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:t=>`Viewing ${t} (Own)`,announceViewingInstalled:t=>`Viewing ${t} (Installed)`,moreFields:"More fields",sourceAgent:"Source agent",noMcpDependencies:"No MCP dependencies.",filesystemGroup:"Filesystem",benchmarkGroup:"Benchmark",metadataGroup:"Frontmatter"},HS={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.",delete:"Delete",deletePluginTooltip:"Plugin skills are managed by their owning plugin — uninstall the plugin to remove.",undo:"Undo"},$S={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"},VS={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"},PS={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."},FS={disconnected:"Disconnected — reconnecting…",reconnected:"Reconnected.",loading:"Loading skills…",loadingPlaceholderCount:"—"},GS={fieldRequired:"This field is required.",nameInvalid:"Use letters, numbers, and hyphens.",descriptionRequired:"Description is required.",saveFailed:"Save failed. Check the form for errors."},WS={boundaryHeadline:"Something broke in this view.",boundaryBody:"Reload the page to recover.",boundaryAction:"Reload"},qS={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:t=>`No models match "${t}"`,clearSearch:"Clear",currentlyActive:"Currently active"},YS={claudeCli:{name:"Claude Code",caption:"Delegates to the `claude` CLI — your existing Claude Code session handles quota.",missingBinary:"Claude Code not found. Install it: `npm install -g @anthropic-ai/claude-code`. Or choose a provider with an API key.",installCta:"Install Claude Code →",installUrl:"https://docs.claude.com/en/docs/claude-code"},anthropic:{name:"Anthropic API",caption:"Direct access via your Anthropic API key.",addKeyCta:"Add API key →",keyIssuanceUrl:"https://platform.claude.com/settings/keys",keyPrefix:"sk-ant-"},openai:{name:"OpenAI",caption:"GPT-4, GPT-5, and the o-series reasoning models.",addKeyCta:"Add API key →",keyIssuanceUrl:"https://platform.openai.com/api-keys",keyPrefix:"sk-",pastePlaceholder:"Paste OpenAI API key (sk-proj-...)"},openrouter:{name:"OpenRouter",caption:"300+ models from every major vendor.",addKeyCta:"Add API key →",emptyCardBody:"Add your OpenRouter API key to browse 300+ models",keyIssuanceUrl:"https://openrouter.ai/settings/keys",keyPrefix:"sk-or-"},cursor:{name:"Cursor",caption:"Cursor IDE composer.",installCta:"Install Cursor →"},codexCli:{name:"Codex CLI",caption:"OpenAI Codex CLI.",installCta:"Install Codex CLI →"},geminiCli:{name:"Gemini CLI",caption:"Google Gemini CLI.",installCta:"Install Gemini CLI →"},copilot:{name:"GitHub Copilot",caption:"GitHub Copilot CLI.",installCta:"Install Copilot →"},zed:{name:"Zed",caption:"Zed editor.",installCta:"Install Zed →"},ollama:{name:"Ollama",caption:"Local models, free.",startServiceCta:"Start service →"},lmStudio:{name:"LM Studio",caption:"Local models, free.",startServiceCta:"Start LM Studio server →",startServiceTooltip:"Open LM Studio → Developer tab → Start Server (default port 1234)."}},KS={subscriptionBilling:"· subscription",free:"· free"},XS={title:"Settings",sectionApiKeys:"API Keys",banner:"Keys are stored locally on this device only. Never synced, never committed to git, never transmitted off-device except to the provider's own API.",storagePath:t=>`Keys stored at ${t} · protected by file permissions (0600 on macOS/Linux)`,storagePathFallback:"Keys stored locally on this device.",copyPath:"Copy path",pathCopied:"Path copied.",show:"Show",hide:"Hide",paste:"Paste",save:"Save",remove:"Remove",removeConfirm:t=>`Remove ${t} API key?`,keyStoredAt:t=>`Key stored locally — updated ${t}`,noKey:"No key stored",enterNonEmpty:"Enter a non-empty key",prefixWarn:t=>`This doesn't look like a typical ${t} key. Save anyway?`,keySaved:t=>`${t} API key saved (local only, never synced)`,keyRemoved:t=>`${t} API key removed`},QS={providersLabel:"Providers",providerSummary:(t,a)=>`${t}/${a} providers`,locked:t=>`${t} — locked. Click to add a key.`,lockedCli:t=>`${t} — locked. Click for install instructions.`,unlocked:t=>`${t} — unlocked.`},ZS={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:t=>`Set up ${t}`,sharedFolderBanner:t=>`Shared folder — consumed by ${t}`},JS={ownLabel:"Own",installedLabel:"Installed",globalLabel:"Global",emptyOwn:"No authored skills — run vskill new.",emptyInstalled:t=>`No skills installed for ${t} in this project — run vskill install.`,emptyGlobal:t=>`No global skills for ${t} — run vskill install --global.`},e2={compactLabel:"Uses your Claude Code session · overflow billed at API rates",tooltip:"vSkill delegates to the `claude` CLI — your existing Claude Code session handles quota. If you've enabled extra usage in your account settings, excess runs 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 existing session. No API key needed — vskill just runs the official claude binary on your behalf.",learnMore:"Learn more"},t2={title:t=>`Set up ${t}`,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."},n2={groupAvailable:"Available",groupAuthoring:"Authoring",sourceProject:"Project",sourcePersonal:"Personal",sourcePlugin:"Plugins",authoringSkills:"Skills"},r2={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 — your existing Claude Code session handles quota.",loginHint:"If you're not logged in, run claude in your terminal and authenticate with your Anthropic account.",learnMoreUrl:"https://docs.claude.com/en/docs/claude-code"}},ne={sidebar:BS,shell:IS,detail:US,actions:HS,palette:$S,shortcuts:VS,toasts:PS,connection:FS,forms:GS,errors:WS,picker:qS,providers:YS,models:KS,settings:XS,statusBar:QS,scopePicker:ZS,scopeSection:JS,claudeCodeLabel:e2,setupDrawer:t2,setupProviders:r2,scopeLabels:n2},a2=new Set(["claude-cli","claude-code"]);function Xx(t){return a2.has(t)}const Qx=new Set(["claude-cli","claude-code","anthropic","openai","openrouter","cursor","codex-cli","gemini-cli","copilot","zed"]);function l2({agents:t,activeAgentId:a,focusedAgentId:s,onFocus:o,onSelect:c,onOpenSettings:u}){const d=t.filter(g=>Qx.has(g.id)),h=t.filter(g=>!Qx.has(g.id));return r.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:[d.map(g=>r.jsx(Zx,{agent:g,isActive:g.id===a,isFocused:g.id===s,onFocus:o,onSelect:c,onOpenSettings:u},g.id)),h.length>0&&r.jsx("div",{style:{borderTop:"1px solid var(--border-default, var(--border-subtle))",margin:"4px 0"},"aria-hidden":"true"}),h.map(g=>r.jsx(Zx,{agent:g,isActive:g.id===a,isFocused:g.id===s,onFocus:o,onSelect:c,onOpenSettings:u},g.id))]})}function Zx({agent:t,isActive:a,isFocused:s,onFocus:o,onSelect:c,onOpenSettings:u}){const{providers:d}=ne,h={"claude-cli":d.claudeCli.caption,anthropic:d.anthropic.caption,openrouter:d.openrouter.caption},g={"claude-cli":{label:d.claudeCli.installCta,url:d.claudeCli.installUrl},cursor:{label:d.cursor.installCta},"codex-cli":{label:d.codexCli.installCta},"gemini-cli":{label:d.geminiCli.installCta},copilot:{label:d.copilot.installCta},zed:{label:d.zed.installCta}},m=Xx(t.id),y={minHeight:36,height:m?"auto":36,padding:m?"6px 12px":"0 12px",display:"flex",alignItems:"center",gap:8,cursor:"pointer",position:"relative",background:s?"var(--surface-muted, var(--surface-3))":"transparent",borderLeft:a?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",fontSize:13,fontWeight:a?500:400,color:"var(--text-primary)"};return a&&(y.background="color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)"),r.jsxs("div",{role:"option","aria-selected":a,"data-testid":`agent-row-${t.id}`,"data-focused":s||void 0,tabIndex:s?0:-1,onMouseEnter:()=>o(t.id),onFocus:()=>o(t.id),onClick:()=>c(t.id),style:y,children:[t.wrapperFolder&&r.jsx("span",{"data-testid":`wrapper-dot-${t.id}`,"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",flexShrink:0,background:t.wrapperFolderPresent?"var(--accent, var(--color-accent))":"transparent",border:t.wrapperFolderPresent?"none":"1px solid var(--border-default, var(--border-subtle))"}}),!t.wrapperFolder&&r.jsx("span",{style:{width:6,height:6,flexShrink:0},"aria-hidden":"true"}),r.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[r.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.displayName}),Xx(t.id)&&r.jsx("span",{"data-testid":"claude-code-billing-label",title:ne.claudeCodeLabel.tooltip,style:{fontSize:10,color:"var(--text-secondary, var(--text-tertiary))",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:1},children:ne.claudeCodeLabel.compactLabel})]}),r.jsx("span",{"aria-label":t.available?"available":"locked",style:{color:t.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0},children:t.available?r.jsx(Zd,{unlocked:!0,size:10}):r.jsx(Zd,{size:10})}),a&&r.jsx("span",{style:{fontSize:10,textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600,color:"var(--accent-ink, var(--accent))",flexShrink:0},"data-testid":`active-badge-${t.id}`,children:ne.picker.currentlyActive}),!t.available&&t.ctaType==="api-key"&&r.jsx(kd,{variant:"api-key",label:t.id==="anthropic"?d.anthropic.addKeyCta:d.openrouter.addKeyCta,onActivate:()=>u(t.id)}),!t.available&&t.ctaType==="cli-install"&&g[t.id]&&r.jsx(kd,{variant:"cli-install",label:g[t.id].label,installUrl:g[t.id].url,onActivate:()=>{}}),!t.available&&t.ctaType==="start-service"&&r.jsx(kd,{variant:"start-service",label:t.id==="ollama"?d.ollama.startServiceCta:d.lmStudio.startServiceCta,onActivate:()=>u(t.id)}),h[t.id]&&r.jsx("span",{className:"sr-only","data-testid":`caption-${t.id}`,children:h[t.id]})]})}function s2(t,a,s,o){const d=t>=80,h=p.useRef(null),[g,m]=p.useState(0),y=p.useCallback(S=>{m(S.currentTarget.scrollTop)},[]),{visibleStart:v,visibleEnd:b}=p.useMemo(()=>{if(!d)return{visibleStart:0,visibleEnd:t};const S=Math.max(0,Math.floor(g/a)-4),k=Math.ceil(s/a)+8,w=Math.min(t,S+k);return{visibleStart:S,visibleEnd:w}},[d,g,a,s,t,4]);return{visibleStart:v,visibleEnd:b,totalHeight:t*a,offsetTop:v*a,virtualised:d,containerProps:{onScroll:y,ref:h,style:{overflowY:"auto",maxHeight:s,willChange:d?"transform":void 0}}}}const _v=44,i2=352,o2=60,Jx=480;function c2(t){var u,d;const a=t.contextWindow?t.contextWindow>=1e6?`${Math.round(t.contextWindow/1e6)}M`:t.contextWindow>=1e3?`${Math.round(t.contextWindow/1e3)}k`:String(t.contextWindow):null;if(t.billingMode==="subscription")return a?`${a} ctx ${ne.models.subscriptionBilling}`:ne.models.subscriptionBilling.trim();if(t.billingMode==="free")return a?`local · ${a} ctx · free`:"local · free";const s=((u=t.pricing)==null?void 0:u.prompt)??0,o=((d=t.pricing)==null?void 0:d.completion)??0,c=`$${s.toFixed(2)} / $${o.toFixed(2)} per 1M tokens`;return a?`${a} ctx · ${c}`:c}function u2(t,a){if(!a)return t;const s=a.toLowerCase();return t.filter(c=>c.displayName.toLowerCase().includes(s)).sort((c,u)=>{const d=c.displayName.toLowerCase().indexOf(s),h=u.displayName.toLowerCase().indexOf(s);return d!==h?d-h:c.displayName.length-u.displayName.length})}function d2({agent:t,activeModelId:a,focusedIndex:s=-1,onSelect:o,onOpenSettings:c}){const[u,d]=p.useState(""),[h,g]=p.useState(""),m=p.useRef(null);if(p.useEffect(()=>{const b=setTimeout(()=>g(u),o2);return()=>clearTimeout(b)},[u]),p.useEffect(()=>{t.id==="openrouter"&&t.available&&m.current&&m.current.focus()},[t.id,t.available]),t.id==="openrouter"&&!t.available)return r.jsxs("div",{"data-testid":"openrouter-empty-card",style:{width:Jx,padding:20,display:"flex",flexDirection:"column",gap:12},children:[r.jsx("p",{style:{margin:0,color:"var(--text-primary)",fontSize:13,lineHeight:1.5},children:ne.providers.openrouter.emptyCardBody}),r.jsx("button",{type:"button",onClick:()=>c("openrouter"),style:{alignSelf:"flex-start",padding:"6px 10px",borderRadius:6,background:"var(--accent, var(--color-accent))",color:"var(--bg-surface, white)",border:"none",fontSize:12,fontWeight:500,cursor:"pointer"},children:ne.providers.openrouter.addKeyCta})]});const y=p.useMemo(()=>u2(t.models,h),[t.models,h]),v=s2(y.length,_v,i2);return r.jsxs("div",{role:"listbox","aria-label":"Model","data-testid":"model-list",style:{width:Jx,display:"flex",flexDirection:"column"},children:[t.id==="openrouter"&&r.jsx("div",{style:{padding:8,borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:r.jsx("input",{ref:m,type:"text",placeholder:ne.picker.searchPlaceholder,value:u,onChange:b=>d(b.target.value),"data-testid":"model-search-input","aria-label":ne.picker.searchPlaceholder,style:{width:"100%",padding:"6px 8px",background:"var(--surface-2, var(--bg-surface))",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif"}})}),y.length===0&&h?r.jsxs("div",{style:{padding:16},"data-testid":"no-matches",children:[r.jsx("div",{style:{color:"var(--text-muted, var(--text-tertiary))",fontSize:12,marginBottom:8},children:ne.picker.noMatches(h)}),r.jsx("button",{type:"button",onClick:()=>d(""),style:{padding:"4px 8px",background:"transparent",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:ne.picker.clearSearch})]}):y.length===0?r.jsx("div",{style:{padding:16,color:"var(--text-muted, var(--text-tertiary))",fontSize:12},children:ne.picker.noModelsYet}):r.jsx("div",{...v.containerProps,children:r.jsx("div",{style:{height:v.virtualised?v.totalHeight:"auto",position:"relative"},children:r.jsx("div",{style:{transform:v.virtualised?`translateY(${v.offsetTop}px)`:void 0},children:y.slice(v.visibleStart,v.visibleEnd).map((b,S)=>{const k=v.visibleStart+S;return r.jsx(p2,{model:b,isActive:b.id===a,isFocused:s===k,onSelect:()=>o(b.id),resolvedModel:t.id==="claude-cli"?t.resolvedModel??null:null},b.id)})})})})]})}function f2(t,a,s){return a&&a.toLowerCase().includes(t.toLowerCase())?a:s??null}function p2({model:t,isActive:a,isFocused:s,onSelect:o,resolvedModel:c}){const u=c2(t),d=f2(t.id,c,t.resolvedId),h=d!==null,g=a?"color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)":s?"var(--surface-muted, var(--surface-3))":"transparent",m=a?"1px solid var(--accent, var(--color-accent))":"1px solid transparent";return r.jsxs("button",{type:"button",role:"option","aria-selected":a,"data-testid":`model-row-${t.id}`,"data-focused":s||void 0,onClick:o,title:t.id,style:{width:"100%",minHeight:_v,padding:"4px 12px",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:2,background:g,borderLeft:m,cursor:"pointer",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",textAlign:"left"},children:[r.jsx("span",{style:{fontSize:14,fontWeight:500,color:"var(--text-primary)"},children:t.displayName}),r.jsx("span",{style:{fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace",fontVariantNumeric:"tabular-nums",color:"var(--text-muted, var(--text-tertiary))"},children:u}),h&&r.jsxs("span",{"data-testid":`model-row-${t.id}-resolved`,style:{fontSize:11,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace",color:"var(--text-muted, var(--text-tertiary))"},children:["routing to ",d]})]})}const eg={anthropic:{stored:!1,updatedAt:null},openai:{stored:!1,updatedAt:null},openrouter:{stored:!1,updatedAt:null}};function m2(){const[t,a]=p.useState(null),[s,o]=p.useState(!0),[c,u]=p.useState(null),d=p.useCallback(async()=>{o(!0);try{const m=await fetch("/api/settings/keys");if(!m.ok)throw new Error(`GET /api/settings/keys returned ${m.status}`);const y=await m.json();a({...eg,...y}),u(null)}catch(m){u(m.message),a(eg)}finally{o(!1)}},[]);p.useEffect(()=>{d()},[d]);const h=p.useCallback(async(m,y)=>{const v=await fetch("/api/settings/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:m,key:y})});if(!v.ok){const S=await v.json().catch(()=>({error:v.statusText}));throw new Error(S.error||`POST /api/settings/keys returned ${v.status}`)}const b=await v.json();return await d(),b},[d]),g=p.useCallback(async m=>{const y=await fetch(`/api/settings/keys/${m}`,{method:"DELETE"});if(!y.ok)throw new Error(`DELETE /api/settings/keys/${m} returned ${y.status}`);await d()},[d]);return{state:t,loading:s,error:c,save:h,remove:g,refresh:d}}function h2({onMigrated:t,fetchImpl:a}){const[s,o]=p.useState({kind:"loading"}),c=a??globalThis.fetch,u=p.useCallback(async()=>{var m;try{const y=await c("/api/settings/migration-status");if(!y.ok){o({kind:"hidden"});return}const v=await y.json();v.pending&&(((m=v.darwinKeys)==null?void 0:m.length)??0)>0?o({kind:"visible",darwinKeys:v.darwinKeys??[]}):o({kind:"hidden"})}catch{o({kind:"hidden"})}},[c]);p.useEffect(()=>{u()},[u]);const d=p.useCallback(async()=>{o({kind:"working"});try{const m=await c("/api/settings/migration-perform",{method:"POST",headers:{"Content-Type":"application/json"}});if(!m.ok){o({kind:"error",message:`Migration failed (${m.status})`});return}const y=await m.json().catch(()=>({migrated:[]}));t==null||t(y.migrated??[]),await u()}catch(m){o({kind:"error",message:m.message})}},[c,u,t]),h=p.useCallback(async()=>{o({kind:"hidden"});try{await c("/api/settings/migration-acknowledge",{method:"POST",headers:{"Content-Type":"application/json"}})}catch{}},[c]);if(s.kind==="loading"||s.kind==="hidden")return null;if(s.kind==="error")return r.jsxs("div",{role:"status","data-testid":"migration-banner",style:{padding:"10px 12px",borderRadius:6,background:"color-mix(in srgb, var(--danger, #b33) 15%, transparent)",color:"var(--text-primary)",fontSize:12,marginBottom:12,display:"flex",alignItems:"center",gap:8},children:[r.jsx("span",{style:{flex:1},children:s.message}),r.jsx("button",{type:"button",onClick:()=>void u(),"data-testid":"migration-retry",style:wd,children:"Retry"})]});const g=s.kind==="working";return r.jsxs("div",{role:"note","data-testid":"migration-banner",style:{padding:"10px 12px",borderRadius:6,background:"color-mix(in srgb, var(--accent, var(--color-accent)) 12%, transparent)",color:"var(--text-primary)",fontSize:12,marginBottom:12,display:"flex",alignItems:"center",gap:8},children:[r.jsxs("div",{style:{flex:1},children:[r.jsx("strong",{style:{display:"block",marginBottom:2},children:"Migrate from macOS Keychain"}),r.jsx("span",{style:{color:"var(--text-muted, var(--text-tertiary))"},children:"We found stored credentials from a previous vskill version. Import them into the new on-disk store."})]}),r.jsx("button",{type:"button",onClick:()=>void d(),disabled:g,"data-testid":"migration-migrate",style:{...wd,background:"var(--accent, var(--color-accent))",color:"white",opacity:g?.6:1},children:g?"Importing…":"Migrate"}),r.jsx("button",{type:"button",onClick:()=>void h(),"data-testid":"migration-dismiss",style:{...wd,background:"transparent",border:"none",color:"var(--text-muted, var(--text-tertiary))",textDecoration:"underline",padding:"4px 6px"},children:"Dismiss for 30 days"})]})}const wd={padding:"4px 10px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},x2=[{id:"anthropic",name:ne.providers.anthropic.name,keyIssuanceUrl:ne.providers.anthropic.keyIssuanceUrl,prefix:ne.providers.anthropic.keyPrefix,placeholder:`Paste ${ne.providers.anthropic.name} key`},{id:"openai",name:ne.providers.openai.name,keyIssuanceUrl:ne.providers.openai.keyIssuanceUrl,prefix:ne.providers.openai.keyPrefix,placeholder:ne.providers.openai.pastePlaceholder},{id:"openrouter",name:ne.providers.openrouter.name,keyIssuanceUrl:ne.providers.openrouter.keyIssuanceUrl,prefix:ne.providers.openrouter.keyPrefix,placeholder:`Paste ${ne.providers.openrouter.name} key`}];function g2(t){const a=Date.now()-new Date(t).getTime();return a<6e4?"just now":a<36e5?`${Math.round(a/6e4)}m ago`:a<864e5?`${Math.round(a/36e5)}h ago`:new Date(t).toLocaleString()}function Ov({open:t,onClose:a,initialProvider:s,onToast:o}){const{state:c,save:u,remove:d,refresh:h}=m2(),g=p.useRef(null),m=p.useRef(null),[y,v]=p.useState(null);p.useEffect(()=>{if(!t)return;let S=!1;return(async()=>{try{const k=await fetch("/api/settings/storage-path");if(!k.ok)throw new Error(`GET /api/settings/storage-path returned ${k.status}`);const w=await k.json();S||v(w.path??null)}catch{S||v(null)}})(),()=>{S=!0}},[t]),p.useEffect(()=>{if(!t)return;const S=document.activeElement,k=setTimeout(()=>{var T;const w=s?`input[data-provider="${s}"]`:"input[data-provider]",E=(T=g.current)==null?void 0:T.querySelector(w);E==null||E.focus()},0);return()=>{var w;clearTimeout(k),(w=S==null?void 0:S.focus)==null||w.call(S)}},[t,s]),p.useEffect(()=>{if(!t)return;const S=k=>{if(k.key==="Escape"){k.preventDefault(),a();return}if(k.key==="Tab"&&g.current){const w=g.current.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(w.length===0)return;const E=w[0],T=w[w.length-1];k.shiftKey&&document.activeElement===E?(k.preventDefault(),T.focus()):!k.shiftKey&&document.activeElement===T&&(k.preventDefault(),E.focus())}};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[t,a]);const b=p.useCallback(async()=>{var S,k;if(y)try{await((k=(S=navigator.clipboard)==null?void 0:S.writeText)==null?void 0:k.call(S,y)),o==null||o(ne.settings.pathCopied)}catch{}},[o,y]);return t?r.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"settings-modal-title","data-testid":"settings-modal",style:{position:"fixed",inset:0,background:"color-mix(in srgb, black 40%, transparent)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},onClick:S=>{S.target===S.currentTarget&&a()},children:r.jsxs("div",{ref:g,style:{background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,width:560,maxHeight:"80vh",overflowY:"auto",padding:20,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",color:"var(--text-primary)"},onClick:S=>S.stopPropagation(),children:[r.jsx("h2",{id:"settings-modal-title",style:{margin:"0 0 16px 0",fontSize:16,fontWeight:600},children:ne.settings.title}),r.jsx(h2,{onMigrated:()=>{h()}}),r.jsx("div",{role:"note","data-testid":"settings-banner",style:{padding:"8px 12px",borderRadius:6,background:"color-mix(in srgb, var(--info, var(--accent-muted)) 20%, transparent)",color:"var(--text-primary)",fontSize:12,marginBottom:16},children:ne.settings.banner}),r.jsxs("section",{"aria-labelledby":"settings-api-keys-title",style:{marginBottom:20},children:[r.jsx("h3",{id:"settings-api-keys-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:ne.settings.sectionApiKeys}),x2.map(S=>r.jsx(v2,{providerId:S.id,providerName:S.name,keyIssuanceUrl:S.keyIssuanceUrl,prefix:S.prefix,placeholder:S.placeholder,metadata:c==null?void 0:c[S.id],onSave:async k=>{const w=await u(S.id,k);return o==null||o(ne.settings.keySaved(S.name)),w},onRemove:async()=>{await d(S.id),o==null||o(ne.settings.keyRemoved(S.name))},inputRef:S.id===(s??"anthropic")?m:void 0},S.id))]}),r.jsxs("div",{"data-testid":"settings-storage-path",style:{fontSize:11,color:"var(--text-muted, var(--text-tertiary))",fontStyle:"italic",display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[r.jsx("span",{style:{flex:1},children:y?ne.settings.storagePath(y):ne.settings.storagePathFallback}),r.jsx("button",{type:"button",onClick:b,disabled:!y,"data-testid":"settings-copy-path",style:{...Ba,opacity:y?1:.5,cursor:y?"pointer":"not-allowed"},children:ne.settings.copyPath})]}),r.jsx("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end"},children:r.jsx("button",{type:"button",onClick:a,style:{padding:"6px 12px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:"Close"})})]})}):null}function v2({providerId:t,providerName:a,keyIssuanceUrl:s,prefix:o,placeholder:c,metadata:u,onSave:d,onRemove:h,inputRef:g}){const[m,y]=p.useState(""),[v,b]=p.useState(!1),[S,k]=p.useState(!1),[w,E]=p.useState(!1),[T,N]=p.useState(null),A=m.trim(),_=A.length===0,D=A.length>0&&!A.startsWith(o),F=p.useCallback(async()=>{if(_)return;k(!0);const L=A;y("");try{const U=await d(L);U.warning?N(U.warning):N(null)}finally{k(!1)}},[_,d,A]),C=p.useCallback(async()=>{var L;try{if(!((L=navigator.clipboard)!=null&&L.readText))return;const U=await navigator.clipboard.readText();y(U)}catch{}},[]),B=p.useCallback(async()=>{E(!1),await h()},[h]);return r.jsxs("div",{"data-testid":`provider-row-${t}`,style:{padding:12,border:"1px solid var(--border-subtle)",borderRadius:6,marginBottom:8,display:"flex",flexDirection:"column",gap:8},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsx("strong",{style:{fontSize:13},children:a}),r.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",style:{fontSize:12,color:"var(--accent, var(--color-accent))"},children:"Get a key →"})]}),r.jsxs("div",{style:{display:"flex",gap:6},children:[r.jsx("input",{ref:g,type:v?"text":"password",value:m,onChange:L=>{y(L.target.value),N(null)},"data-provider":t,placeholder:c,style:{flex:1,padding:"6px 8px",border:"1px solid var(--border-subtle)",borderRadius:4,background:"var(--surface-2, var(--bg-surface))",color:"var(--text-primary)",fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"}}),r.jsx("button",{type:"button",onClick:()=>b(!v),style:Ba,children:v?ne.settings.hide:ne.settings.show}),r.jsx("button",{type:"button",onClick:C,style:Ba,children:ne.settings.paste})]}),D&&r.jsx("div",{role:"status","data-testid":`prefix-warn-${t}`,style:tg,children:ne.settings.prefixWarn(a)}),T&&r.jsx("div",{role:"status",style:tg,children:T}),r.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[r.jsx("button",{type:"button",onClick:F,disabled:_||S,"data-testid":`save-${t}`,style:{...Ba,background:_?"var(--surface-2)":"var(--accent, var(--color-accent))",color:_?"var(--text-muted)":"white",cursor:_?"not-allowed":"pointer"},children:ne.settings.save}),(u==null?void 0:u.stored)&&r.jsx(r.Fragment,{children:w?r.jsxs(r.Fragment,{children:[r.jsx("span",{style:{fontSize:12},children:ne.settings.removeConfirm(a)}),r.jsx("button",{type:"button",onClick:B,"data-testid":`remove-confirm-${t}`,style:{...Ba,background:"var(--danger, #b33)",color:"white"},children:"Confirm"}),r.jsx("button",{type:"button",onClick:()=>E(!1),style:Ba,children:"Cancel"})]}):r.jsx("button",{type:"button",onClick:()=>E(!0),"data-testid":`remove-${t}`,style:{...Ba,color:"var(--text-muted)"},children:ne.settings.remove})}),r.jsx("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},"data-testid":`status-${t}`,children:u!=null&&u.stored&&u.updatedAt?ne.settings.keyStoredAt(g2(u.updatedAt)):ne.settings.noKey})]})]})}const Ba={padding:"4px 8px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},tg={fontSize:11,color:"var(--warning, var(--text-muted))"};function y2(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function b2({onToast:t}){const{status:a,catalog:s,focusAgent:o,setActive:c}=OS({onStaleCatalog:(U,$)=>{const q=Math.round($/6e4);t==null||t(`Using cached ${U} catalog (${q} min old)`)},onSetActiveError:U=>t==null?void 0:t(U)}),[u,d]=p.useState(!1),[h,g]=p.useState(!1),[m,y]=p.useState(),[v,b]=p.useState(null),[S,k]=p.useState("agents"),[w,E]=p.useState(0),T=p.useRef(null);p.useRef(null),p.useEffect(()=>{var U;s&&!v&&b(s.activeAgent??((U=s.agents[0])==null?void 0:U.id)??null)},[s,v]);const N=(s==null?void 0:s.agents)??[],A=p.useMemo(()=>N.find(U=>U.id===v)??N[0],[N,v]);p.useEffect(()=>{E(0)},[v]);const _=p.useCallback(()=>{var U;d(!0),k("agents"),b((s==null?void 0:s.activeAgent)??((U=N[0])==null?void 0:U.id)??null),E(0)},[s,N]),D=p.useCallback(()=>{var U;d(!1),(U=T.current)==null||U.focus()},[]);p.useEffect(()=>{const U=$=>{var X;if(!($.metaKey||$.ctrlKey)||$.key.toLowerCase()!=="k")return;const q=(X=document.activeElement)==null?void 0:X.tagName;q==="INPUT"||q==="TEXTAREA"||($.preventDefault(),d(ee=>!ee))};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[]),p.useEffect(()=>{if(!u)return;const U=q=>{if(q.key==="Escape"){q.preventDefault(),D();return}if(q.key==="ArrowDown"){q.preventDefault(),$(1);return}if(q.key==="ArrowUp"){q.preventDefault(),$(-1);return}if(q.key==="ArrowRight"&&S==="agents"){q.preventDefault(),k("models"),E(X=>{const ee=((A==null?void 0:A.models.length)??1)-1;return Math.max(0,Math.min(X,Math.max(0,ee)))});return}if(q.key==="ArrowLeft"&&S==="models"){q.preventDefault(),k("agents");return}if(q.key==="Enter"){if(q.preventDefault(),S==="agents"&&A)k("models"),E(0);else if(S==="models"&&A){const X=Math.max(0,Math.min(A.models.length-1,w)),ee=A.models[X];ee&&(c(A.id,ee.id),D())}return}};function $(q){if(S==="agents"){const X=N.findIndex(I=>I.id===v),ee=N[Math.max(0,Math.min(N.length-1,X+q))];ee&&(b(ee.id),o(ee.id));return}if(S==="models"&&A){const X=A.models.length;if(X===0)return;E(ee=>{const I=ee+q;return Math.max(0,Math.min(X-1,I))})}}return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[u,S,N,v,A,w,D,o,c]);const F=p.useCallback(U=>{y(U==="anthropic"||U==="openrouter"?U:void 0),g(!0),d(!1)},[]),C=N.find(U=>U.id===(s==null?void 0:s.activeAgent)),B=C==null?void 0:C.models.find(U=>U.id===(s==null?void 0:s.activeModel)),L=p.useMemo(()=>{if(a!=="ready"||!s)return"Loading…";const U=(C==null?void 0:C.displayName)??"Agent",$=(B==null?void 0:B.displayName)??s.activeModel??"Model";return`${U} · ${$}`},[a,s,C,B]);return r.jsxs(r.Fragment,{children:[r.jsxs("button",{ref:T,type:"button","data-testid":"agent-model-picker-trigger",onClick:()=>u?D():_(),"aria-haspopup":"listbox","aria-expanded":u,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:[r.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:C!=null&&C.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0}}),r.jsx("span",{children:L})]}),u&&typeof document<"u"&&Go.createPortal(r.jsxs(j2,{reducedMotion:y2(),onClickOutside:D,children:[r.jsxs("div",{style:{display:"flex",height:440,maxHeight:"60vh"},children:[r.jsx(l2,{agents:N,activeAgentId:(s==null?void 0:s.activeAgent)??null,focusedAgentId:v,onFocus:U=>{b(U),o(U)},onSelect:U=>{b(U),o(U),k("models")},onOpenSettings:F}),A&&r.jsx(d2,{agent:A,activeModelId:(s==null?void 0:s.activeModel)??null,focusedIndex:S==="models"?w:-1,onSelect:U=>{c(A.id,U),D()},onOpenSettings:F})]}),r.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:[r.jsx("button",{type:"button",onClick:()=>F(),"data-testid":"picker-footer-settings",style:{background:"transparent",border:"none",color:"var(--text-primary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:ne.picker.settingsButton}),r.jsx("span",{style:{fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"},children:ne.picker.footerHint})]})]}),document.body),r.jsx(Ov,{open:h,onClose:()=>g(!1),initialProvider:m,onToast:t})]})}function j2({children:t,reducedMotion:a,onClickOutside:s}){const o=p.useRef(null);return p.useEffect(()=>{const c=u=>{o.current&&!o.current.contains(u.target)&&s()};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]),r.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:720,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,overflow:"hidden",zIndex:90,animation:a?void 0:"agentPickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[t,r.jsx("style",{children:`@keyframes agentPickerFadeIn {
|
|
61
|
+
Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let y=ia(),v;v=y;let b=v.pathname||"/",S=b;if(g!=="/"){let C=g.replace(/^\//,"").split("/");S="/"+b.replace(/^\//,"").split("/").slice(C.length).join("/")}let k=mv(t,{pathname:S});return Zn(m||k!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),Zn(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${v.pathname}${v.search}${v.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),fj(k&&k.map(C=>Object.assign({},C,{params:Object.assign({},d,C.params),pathname:ur([g,o.encodeLocation?o.encodeLocation(C.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?g:ur([g,o.encodeLocation?o.encodeLocation(C.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),c,s)}function oj(){let t=gj(),a=Y0(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),s=t instanceof Error?t.stack:null,o="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:o},u={padding:"2px 4px",backgroundColor:o},d=null;return console.error("Error handled by React Router default ErrorBoundary:",t),d=p.createElement(p.Fragment,null,p.createElement("p",null,"💿 Hey developer 👋"),p.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",p.createElement("code",{style:u},"ErrorBoundary")," or"," ",p.createElement("code",{style:u},"errorElement")," prop on your route.")),p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},a),s?p.createElement("pre",{style:c},s):null,d)}var cj=p.createElement(oj,null),Cv=class extends p.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,a){return a.location!==t.location||a.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:a.error,location:a.location,revalidation:t.revalidation||a.revalidation}}componentDidCatch(t,a){this.props.onError?this.props.onError(t,a):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const s=rj(t.digest);s&&(t=s)}let a=t!==void 0?p.createElement(Lr.Provider,{value:this.props.routeContext},p.createElement(gf.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?p.createElement(uj,{error:t},a):a}};Cv.contextType=Q0;var gd=new WeakMap;function uj({children:t,error:a}){let{basename:s}=p.useContext(Gn);if(typeof a=="object"&&a&&"digest"in a&&typeof a.digest=="string"){let o=nj(a.digest);if(o){let c=gd.get(a);if(c)throw c;let u=yv(o.location,s);if(vv&&!gd.get(a))if(u.isExternal||o.reloadDocument)window.location.href=u.absoluteURL||u.to;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:o.replace}));throw gd.set(a,d),d}return p.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return t}function dj({routeContext:t,match:a,children:s}){let o=p.useContext(Ol);return o&&o.static&&o.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=a.route.id),p.createElement(Lr.Provider,{value:t},s)}function fj(t,a=[],s){let o=s==null?void 0:s.state;if(t==null){if(!o)return null;if(o.errors)t=o.matches;else if(a.length===0&&!o.initialized&&o.matches.length>0)t=o.matches;else return null}let c=t,u=o==null?void 0:o.errors;if(u!=null){let y=c.findIndex(v=>v.route.id&&(u==null?void 0:u[v.route.id])!==void 0);Ft(y>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),c=c.slice(0,Math.min(c.length,y+1))}let d=!1,h=-1;if(s&&o){d=o.renderFallback;for(let y=0;y<c.length;y++){let v=c[y];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(h=y),v.route.id){let{loaderData:b,errors:S}=o,k=v.route.loader&&!b.hasOwnProperty(v.route.id)&&(!S||S[v.route.id]===void 0);if(v.route.lazy||k){s.isStatic&&(d=!0),h>=0?c=c.slice(0,h+1):c=[c[0]];break}}}}let g=s==null?void 0:s.onError,m=o&&g?(y,v)=>{var b,S;g(y,{location:o.location,params:((S=(b=o.matches)==null?void 0:b[0])==null?void 0:S.params)??{},unstable_pattern:K0(o.matches),errorInfo:v})}:void 0;return c.reduceRight((y,v,b)=>{let S,k=!1,w=null,C=null;o&&(S=u&&v.route.id?u[v.route.id]:void 0,w=v.route.errorElement||cj,d&&(h<0&&b===0?(Ev("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,C=null):h===b&&(k=!0,C=v.route.hydrateFallbackElement||null)));let T=a.concat(c.slice(0,b+1)),N=()=>{let A;return S?A=w:k?A=C:v.route.Component?A=p.createElement(v.route.Component,null):v.route.element?A=v.route.element:A=y,p.createElement(dj,{match:v,routeContext:{outlet:y,matches:T,isDataRoute:o!=null},children:A})};return o&&(v.route.ErrorBoundary||v.route.errorElement||b===0)?p.createElement(Cv,{location:o.location,revalidation:o.revalidation,component:w,error:S,children:N(),routeContext:{outlet:null,matches:T,isDataRoute:!0},onError:m}):N()},null)}function vf(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function pj(t){let a=p.useContext(Ol);return Ft(a,vf(t)),a}function mj(t){let a=p.useContext(Vo);return Ft(a,vf(t)),a}function hj(t){let a=p.useContext(Lr);return Ft(a,vf(t)),a}function yf(t){let a=hj(t),s=a.matches[a.matches.length-1];return Ft(s.route.id,`${t} can only be used on routes that contain a unique "id"`),s.route.id}function xj(){return yf("useRouteId")}function gj(){var o;let t=p.useContext(gf),a=mj("useRouteError"),s=yf("useRouteError");return t!==void 0?t:(o=a.errors)==null?void 0:o[s]}function vj(){let{router:t}=pj("useNavigate"),a=yf("useNavigate"),s=p.useRef(!1);return wv(()=>{s.current=!0}),p.useCallback(async(c,u={})=>{Zn(s.current,kv),s.current&&(typeof c=="number"?await t.navigate(c):await t.navigate(c,{fromRouteId:a,...u}))},[t,a])}var Px={};function Ev(t,a,s){!a&&!Px[t]&&(Px[t]=!0,Zn(!1,s))}p.memo(yj);function yj({routes:t,future:a,state:s,isStatic:o,onError:c}){return ij(t,void 0,{state:s,isStatic:o,onError:c})}function bj({basename:t="/",children:a=null,location:s,navigationType:o="POP",navigator:c,static:u=!1,unstable_useTransitions:d}){Ft(!Qs(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=t.replace(/^\/*/,"/"),g=p.useMemo(()=>({basename:h,navigator:c,static:u,unstable_useTransitions:d,future:{}}),[h,c,u,d]);typeof s=="string"&&(s=_l(s));let{pathname:m="/",search:y="",hash:v="",state:b=null,key:S="default",unstable_mask:k}=s,w=p.useMemo(()=>{let C=Mr(m,h);return C==null?null:{location:{pathname:C,search:y,hash:v,state:b,key:S,unstable_mask:k},navigationType:o}},[h,m,y,v,b,S,o,k]);return Zn(w!=null,`<Router basename="${h}"> is not able to match the URL "${m}${y}${v}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:p.createElement(Gn.Provider,{value:g},p.createElement(Po.Provider,{children:a,value:w}))}var Ro="get",Ao="application/x-www-form-urlencoded";function Fo(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function jj(t){return Fo(t)&&t.tagName.toLowerCase()==="button"}function Sj(t){return Fo(t)&&t.tagName.toLowerCase()==="form"}function kj(t){return Fo(t)&&t.tagName.toLowerCase()==="input"}function wj(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Cj(t,a){return t.button===0&&(!a||a==="_self")&&!wj(t)}var vo=null;function Ej(){if(vo===null)try{new FormData(document.createElement("form"),0),vo=!1}catch{vo=!0}return vo}var Nj=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function vd(t){return t!=null&&!Nj.has(t)?(Zn(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ao}"`),null):t}function Tj(t,a){let s,o,c,u,d;if(Sj(t)){let h=t.getAttribute("action");o=h?Mr(h,a):null,s=t.getAttribute("method")||Ro,c=vd(t.getAttribute("enctype"))||Ao,u=new FormData(t)}else if(jj(t)||kj(t)&&(t.type==="submit"||t.type==="image")){let h=t.form;if(h==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let g=t.getAttribute("formaction")||h.getAttribute("action");if(o=g?Mr(g,a):null,s=t.getAttribute("formmethod")||h.getAttribute("method")||Ro,c=vd(t.getAttribute("formenctype"))||vd(h.getAttribute("enctype"))||Ao,u=new FormData(h,t),!Ej()){let{name:m,type:y,value:v}=t;if(y==="image"){let b=m?`${m}.`:"";u.append(`${b}x`,"0"),u.append(`${b}y`,"0")}else m&&u.append(m,v)}}else{if(Fo(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');s=Ro,o=null,c=Ao,d=t}return u&&c==="text/plain"&&(d=u,u=void 0),{action:o,method:s.toLowerCase(),encType:c,formData:u,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function bf(t,a){if(t===!1||t===null||typeof t>"u")throw new Error(a)}function Rj(t,a,s,o){let c=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return s?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${o}`:c.pathname=`${c.pathname}.${o}`:c.pathname==="/"?c.pathname=`_root.${o}`:a&&Mr(c.pathname,a)==="/"?c.pathname=`${a.replace(/\/$/,"")}/_root.${o}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${o}`,c}async function Aj(t,a){if(t.id in a)return a[t.id];try{let s=await import(t.module);return a[t.id]=s,s}catch(s){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(s),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Mj(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function Lj(t,a,s){let o=await Promise.all(t.map(async c=>{let u=a.routes[c.route.id];if(u){let d=await Aj(u,s);return d.links?d.links():[]}return[]}));return Oj(o.flat(1).filter(Mj).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function Fx(t,a,s,o,c,u){let d=(g,m)=>s[m]?g.route.id!==s[m].route.id:!0,h=(g,m)=>{var y;return s[m].pathname!==g.pathname||((y=s[m].route.path)==null?void 0:y.endsWith("*"))&&s[m].params["*"]!==g.params["*"]};return u==="assets"?a.filter((g,m)=>d(g,m)||h(g,m)):u==="data"?a.filter((g,m)=>{var v;let y=o.routes[g.route.id];if(!y||!y.hasLoader)return!1;if(d(g,m)||h(g,m))return!0;if(g.route.shouldRevalidate){let b=g.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((v=s[0])==null?void 0:v.params)||{},nextUrl:new URL(t,window.origin),nextParams:g.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function zj(t,a,{includeHydrateFallback:s}={}){return Dj(t.map(o=>{let c=a.routes[o.route.id];if(!c)return[];let u=[c.module];return c.clientActionModule&&(u=u.concat(c.clientActionModule)),c.clientLoaderModule&&(u=u.concat(c.clientLoaderModule)),s&&c.hydrateFallbackModule&&(u=u.concat(c.hydrateFallbackModule)),c.imports&&(u=u.concat(c.imports)),u}).flat(1))}function Dj(t){return[...new Set(t)]}function _j(t){let a={},s=Object.keys(t).sort();for(let o of s)a[o]=t[o];return a}function Oj(t,a){let s=new Set;return new Set(a),t.reduce((o,c)=>{let u=JSON.stringify(_j(c));return s.has(u)||(s.add(u),o.push({key:u,link:c})),o},[])}function Nv(){let t=p.useContext(Ol);return bf(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function Bj(){let t=p.useContext(Vo);return bf(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var jf=p.createContext(void 0);jf.displayName="FrameworkContext";function Tv(){let t=p.useContext(jf);return bf(t,"You must render this element inside a <HydratedRouter> element"),t}function Ij(t,a){let s=p.useContext(jf),[o,c]=p.useState(!1),[u,d]=p.useState(!1),{onFocus:h,onBlur:g,onMouseEnter:m,onMouseLeave:y,onTouchStart:v}=a,b=p.useRef(null);p.useEffect(()=>{if(t==="render"&&d(!0),t==="viewport"){let w=T=>{T.forEach(N=>{d(N.isIntersecting)})},C=new IntersectionObserver(w,{threshold:.5});return b.current&&C.observe(b.current),()=>{C.disconnect()}}},[t]),p.useEffect(()=>{if(o){let w=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(w)}}},[o]);let S=()=>{c(!0)},k=()=>{c(!1),d(!1)};return s?t!=="intent"?[u,b,{}]:[u,b,{onFocus:Ls(h,S),onBlur:Ls(g,k),onMouseEnter:Ls(m,S),onMouseLeave:Ls(y,k),onTouchStart:Ls(v,S)}]:[!1,b,{}]}function Ls(t,a){return s=>{t&&t(s),s.defaultPrevented||a(s)}}function Uj({page:t,...a}){let{router:s}=Nv(),o=p.useMemo(()=>mv(s.routes,t,s.basename),[s.routes,t,s.basename]);return o?p.createElement($j,{page:t,matches:o,...a}):null}function Hj(t){let{manifest:a,routeModules:s}=Tv(),[o,c]=p.useState([]);return p.useEffect(()=>{let u=!1;return Lj(t,a,s).then(d=>{u||c(d)}),()=>{u=!0}},[t,a,s]),o}function $j({page:t,matches:a,...s}){let o=ia(),{future:c,manifest:u,routeModules:d}=Tv(),{basename:h}=Nv(),{loaderData:g,matches:m}=Bj(),y=p.useMemo(()=>Fx(t,a,m,u,o,"data"),[t,a,m,u,o]),v=p.useMemo(()=>Fx(t,a,m,u,o,"assets"),[t,a,m,u,o]),b=p.useMemo(()=>{if(t===o.pathname+o.search+o.hash)return[];let w=new Set,C=!1;if(a.forEach(N=>{var _;let A=u.routes[N.route.id];!A||!A.hasLoader||(!y.some(D=>D.route.id===N.route.id)&&N.route.id in g&&((_=d[N.route.id])!=null&&_.shouldRevalidate)||A.hasClientLoader?C=!0:w.add(N.route.id))}),w.size===0)return[];let T=Rj(t,h,c.unstable_trailingSlashAwareDataRequests,"data");return C&&w.size>0&&T.searchParams.set("_routes",a.filter(N=>w.has(N.route.id)).map(N=>N.route.id).join(",")),[T.pathname+T.search]},[h,c.unstable_trailingSlashAwareDataRequests,g,o,u,y,a,t,d]),S=p.useMemo(()=>zj(v,u),[v,u]),k=Hj(v);return p.createElement(p.Fragment,null,b.map(w=>p.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...s})),S.map(w=>p.createElement("link",{key:w,rel:"modulepreload",href:w,...s})),k.map(({key:w,link:C})=>p.createElement("link",{key:w,nonce:s.nonce,...C,crossOrigin:C.crossOrigin??s.crossOrigin})))}function Vj(...t){return a=>{t.forEach(s=>{typeof s=="function"?s(a):s!=null&&(s.current=a)})}}var Pj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Pj&&(window.__reactRouterVersion="7.13.1")}catch{}function Fj({basename:t,children:a,unstable_useTransitions:s,window:o}){let c=p.useRef();c.current==null&&(c.current=w0({window:o,v5Compat:!0}));let u=c.current,[d,h]=p.useState({action:u.action,location:u.location}),g=p.useCallback(m=>{s===!1?h(m):p.startTransition(()=>h(m))},[s]);return p.useLayoutEffect(()=>u.listen(g),[u,g]),p.createElement(bj,{basename:t,children:a,location:d.location,navigationType:d.action,navigator:u,unstable_useTransitions:s})}var Rv=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Av=p.forwardRef(function({onClick:a,discover:s="render",prefetch:o="none",relative:c,reloadDocument:u,replace:d,unstable_mask:h,state:g,target:m,to:y,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:S,...k},w){let{basename:C,navigator:T,unstable_useTransitions:N}=p.useContext(Gn),A=typeof y=="string"&&Rv.test(y),_=yv(y,C);y=_.to;let D=aj(y,{relative:c}),F=ia(),E=null;if(h){let I=xf(h,[],F.unstable_mask?F.unstable_mask.pathname:"/",!0);C!=="/"&&(I.pathname=I.pathname==="/"?C:ur([C,I.pathname])),E=T.createHref(I)}let[B,L,U]=Ij(o,k),$=Yj(y,{replace:d,unstable_mask:h,state:g,target:m,preventScrollReset:v,relative:c,viewTransition:b,unstable_defaultShouldRevalidate:S,unstable_useTransitions:N});function q(I){a&&a(I),I.defaultPrevented||$(I)}let X=!(_.isExternal||u),ee=p.createElement("a",{...k,...U,href:(X?E:void 0)||_.absoluteURL||D,onClick:X?q:a,ref:Vj(w,L),target:m,"data-discover":!A&&s==="render"?"true":void 0});return B&&!A?p.createElement(p.Fragment,null,ee,p.createElement(Uj,{page:D})):ee});Av.displayName="Link";var Gj=p.forwardRef(function({"aria-current":a="page",caseSensitive:s=!1,className:o="",end:c=!1,style:u,to:d,viewTransition:h,children:g,...m},y){let v=Zs(d,{relative:m.relative}),b=ia(),S=p.useContext(Vo),{navigator:k,basename:w}=p.useContext(Gn),C=S!=null&&Jj(v)&&h===!0,T=k.encodeLocation?k.encodeLocation(v).pathname:v.pathname,N=b.pathname,A=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;s||(N=N.toLowerCase(),A=A?A.toLowerCase():null,T=T.toLowerCase()),A&&w&&(A=Mr(A,w)||A);const _=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let D=N===T||!c&&N.startsWith(T)&&N.charAt(_)==="/",F=A!=null&&(A===T||!c&&A.startsWith(T)&&A.charAt(T.length)==="/"),E={isActive:D,isPending:F,isTransitioning:C},B=D?a:void 0,L;typeof o=="function"?L=o(E):L=[o,D?"active":null,F?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let U=typeof u=="function"?u(E):u;return p.createElement(Av,{...m,"aria-current":B,className:L,ref:y,style:U,to:d,viewTransition:h},typeof g=="function"?g(E):g)});Gj.displayName="NavLink";var Wj=p.forwardRef(({discover:t="render",fetcherKey:a,navigate:s,reloadDocument:o,replace:c,state:u,method:d=Ro,action:h,onSubmit:g,relative:m,preventScrollReset:y,viewTransition:v,unstable_defaultShouldRevalidate:b,...S},k)=>{let{unstable_useTransitions:w}=p.useContext(Gn),C=Qj(),T=Zj(h,{relative:m}),N=d.toLowerCase()==="get"?"get":"post",A=typeof h=="string"&&Rv.test(h),_=D=>{if(g&&g(D),D.defaultPrevented)return;D.preventDefault();let F=D.nativeEvent.submitter,E=(F==null?void 0:F.getAttribute("formmethod"))||d,B=()=>C(F||D.currentTarget,{fetcherKey:a,method:E,navigate:s,replace:c,state:u,relative:m,preventScrollReset:y,viewTransition:v,unstable_defaultShouldRevalidate:b});w&&s!==!1?p.startTransition(()=>B()):B()};return p.createElement("form",{ref:k,method:N,action:T,onSubmit:o?g:_,...S,"data-discover":!A&&t==="render"?"true":void 0})});Wj.displayName="Form";function qj(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Mv(t){let a=p.useContext(Ol);return Ft(a,qj(t)),a}function Yj(t,{target:a,replace:s,unstable_mask:o,state:c,preventScrollReset:u,relative:d,viewTransition:h,unstable_defaultShouldRevalidate:g,unstable_useTransitions:m}={}){let y=lj(),v=ia(),b=Zs(t,{relative:d});return p.useCallback(S=>{if(Cj(S,a)){S.preventDefault();let k=s!==void 0?s:Ps(v)===Ps(b),w=()=>y(t,{replace:k,unstable_mask:o,state:c,preventScrollReset:u,relative:d,viewTransition:h,unstable_defaultShouldRevalidate:g});m?p.startTransition(()=>w()):w()}},[v,y,b,s,o,c,a,t,u,d,h,g,m])}var Kj=0,Xj=()=>`__${String(++Kj)}__`;function Qj(){let{router:t}=Mv("useSubmit"),{basename:a}=p.useContext(Gn),s=xj(),o=t.fetch,c=t.navigate;return p.useCallback(async(u,d={})=>{let{action:h,method:g,encType:m,formData:y,body:v}=Tj(u,a);if(d.navigate===!1){let b=d.fetcherKey||Xj();await o(b,s,d.action||h,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:y,body:v,formMethod:d.method||g,formEncType:d.encType||m,flushSync:d.flushSync})}else await c(d.action||h,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:y,body:v,formMethod:d.method||g,formEncType:d.encType||m,replace:d.replace,state:d.state,fromRouteId:s,flushSync:d.flushSync,viewTransition:d.viewTransition})},[o,c,a,s])}function Zj(t,{relative:a}={}){let{basename:s}=p.useContext(Gn),o=p.useContext(Lr);Ft(o,"useFormAction must be used inside a RouteContext");let[c]=o.matches.slice(-1),u={...Zs(t||".",{relative:a})},d=ia();if(t==null){u.search=d.search;let h=new URLSearchParams(u.search),g=h.getAll("index");if(g.some(y=>y==="")){h.delete("index"),g.filter(v=>v).forEach(v=>h.append("index",v));let y=h.toString();u.search=y?`?${y}`:""}}return(!t||t===".")&&c.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),s!=="/"&&(u.pathname=u.pathname==="/"?s:ur([s,u.pathname])),Ps(u)}function Jj(t,{relative:a}={}){let s=p.useContext(jv);Ft(s!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=Mv("useViewTransitionState"),c=Zs(t,{relative:a});if(!s.isTransitioning)return!1;let u=Mr(s.currentLocation.pathname,o)||s.currentLocation.pathname,d=Mr(s.nextLocation.pathname,o)||s.nextLocation.pathname;return Oo(c.pathname,d)!=null||Oo(c.pathname,u)!=null}var Go=pv();const eS=fv(Go),tS="modulepreload",nS=function(t){return"/"+t},Gx={},Ha=function(a,s,o){let c=Promise.resolve();if(s&&s.length>0){let d=function(m){return Promise.all(m.map(y=>Promise.resolve(y).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),g=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));c=d(s.map(m=>{if(m=nS(m),m in Gx)return;Gx[m]=!0;const y=m.endsWith(".css"),v=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${v}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":tS,y||(b.as="script"),b.crossOrigin="",b.href=m,g&&b.setAttribute("nonce",g),document.head.appendChild(b),y)return new Promise((S,k)=>{b.addEventListener("load",S),b.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${m}`)))})}))}function u(d){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=d,window.dispatchEvent(h),!h.defaultPrevented)throw d}return c.then(d=>{for(const h of d||[])h.status==="rejected"&&u(h.reason);return a().catch(u)})},rS=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;function yd(t){if(typeof t!="string")return null;const a=t.trim();return a===""||!rS.test(a)||a==="0.0.0"?null:a}function Lv(t){const a=yd(t.frontmatterVersion);if(a)return{version:a,versionSource:"frontmatter"};const s=yd(t.registryCurrentVersion);if(s)return{version:s,versionSource:"registry"};const o=yd(t.pluginVersion);return o?{version:o,versionSource:"plugin"}:{version:"1.0.0",versionSource:"default"}}const Wx={own:"authoring-project",installed:"available-project",global:"available-personal"},Qd=new Set(["available-project","available-personal","available-plugin","authoring-project","authoring-plugin"]);function aS(t){if(typeof t=="string"){if(Qd.has(t))return t;if(Object.prototype.hasOwnProperty.call(Wx,t))return Wx[t]}return"authoring-project"}function lS(t){return t.startsWith("available-")?"available":"authoring"}function sS(t){const a=t.indexOf("-");return t.slice(a+1)}const Vn="";class Us extends Error{constructor(a,s){super(a),this.name="ApiError",this.status=s}}async function Ie(t,a){const s=await fetch(`${Vn}${t}`,a);if(!s.ok){const o=await s.json().catch(()=>({error:s.statusText}));throw new Us(o.error||`HTTP ${s.status}`,s.status)}return s.json()}async function qx(t,a){const s=await fetch(t,a);return s.status>=502&&s.status<=504?(await new Promise(o=>setTimeout(o,250)),fetch(t,a)):s}function en(t){return typeof t=="string"&&t.length>0?t:null}function iS(t){return typeof t=="number"&&Number.isFinite(t)?t:null}function bd(t){if(!Array.isArray(t))return null;const a=t.filter(s=>typeof s=="string"&&s.length>0);return a.length>0?a:null}function oS(t){const a=t??{};let s;a.origin==="source"||a.origin==="installed"?s=a.origin:(s="source",console.warn(`[api.getSkills] skill ${String(a.plugin)}/${String(a.skill)} has invalid origin=${JSON.stringify(a.origin)}; defaulting to 'source'`));let o;a.scope==="own"||a.scope==="installed"||a.scope==="global"?o=a.scope:o=s==="installed"?"installed":"own";let c;a.installMethod==="authored"||a.installMethod==="copied"||a.installMethod==="symlinked"?c=a.installMethod:c=o==="own"?"authored":"copied";const u=typeof a.scopeV2=="string"&&Qd.has(a.scopeV2)?a.scopeV2:aS(a.scope),d=lS(u),h=sS(u),g=typeof a.precedenceRank=="number"?a.precedenceRank:void 0;let m;a.shadowedBy===null?m=null:typeof a.shadowedBy=="string"&&Qd.has(a.shadowedBy)?m=a.shadowedBy:m=void 0;const y={plugin:typeof a.plugin=="string"?a.plugin:"",skill:typeof a.skill=="string"?a.skill:"",dir:typeof a.dir=="string"?a.dir:"",hasEvals:!!a.hasEvals,hasBenchmark:!!a.hasBenchmark,evalCount:typeof a.evalCount=="number"?a.evalCount:0,assertionCount:typeof a.assertionCount=="number"?a.assertionCount:0,benchmarkStatus:a.benchmarkStatus==="pass"||a.benchmarkStatus==="fail"||a.benchmarkStatus==="pending"||a.benchmarkStatus==="stale"||a.benchmarkStatus==="missing"?a.benchmarkStatus:"missing",lastBenchmark:typeof a.lastBenchmark=="string"?a.lastBenchmark:null,origin:s,scope:o,isSymlink:typeof a.isSymlink=="boolean"?a.isSymlink:!1,symlinkTarget:en(a.symlinkTarget),installMethod:c,scopeV2:u,group:d,source:h,pluginName:en(a.pluginName),pluginNamespace:en(a.pluginNamespace),pluginMarketplace:en(a.pluginMarketplace),pluginManifestPath:en(a.pluginManifestPath),pluginVersion:en(a.pluginVersion),precedenceRank:g,shadowedBy:m,description:en(a.description),version:en(a.version),category:en(a.category),author:en(a.author),license:en(a.license),homepage:en(a.homepage),repoUrl:en(a.repoUrl),skillPath:en(a.skillPath),tags:bd(a.tags),deps:bd(a.deps),mcpDeps:bd(a.mcpDeps),entryPoint:en(a.entryPoint),lastModified:en(a.lastModified),sizeBytes:iS(a.sizeBytes),sourceAgent:en(a.sourceAgent)};if(a.provenance&&typeof a.provenance=="object"){const b=a.provenance;(b.promotedFrom==="installed"||b.promotedFrom==="global")&&typeof b.sourcePath=="string"&&typeof b.promotedAt=="number"?y.provenance={promotedFrom:b.promotedFrom,sourcePath:b.sourcePath,promotedAt:b.promotedAt,sourceSkillVersion:typeof b.sourceSkillVersion=="string"?b.sourceSkillVersion:void 0}:y.provenance=null}else a.provenance===null&&(y.provenance=null);typeof a.updateAvailable=="boolean"&&(y.updateAvailable=a.updateAvailable),typeof a.currentVersion=="string"&&(y.currentVersion=a.currentVersion),typeof a.latestVersion=="string"&&(y.latestVersion=a.latestVersion),typeof a.pinnedVersion=="string"&&(y.pinnedVersion=a.pinnedVersion);const v=Lv({frontmatterVersion:y.version??null,registryCurrentVersion:y.currentVersion??null,pluginVersion:y.pluginVersion??null});return y.resolvedVersion=v.version,y.versionSource=v.versionSource,y}const we={getConfig(){return Ie("/api/config")},setConfig(t,a){return Ie("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,model:a})})},async getSkills(t){const a=new URLSearchParams;t!=null&&t.scope&&a.set("scope",t.scope),t!=null&&t.agent&&a.set("agent",t.agent);const s=a.toString(),o=await Ie(`/api/skills${s?"?"+s:""}`);return Array.isArray(o)?o.map(oS):[]},getAgents(){return Ie("/api/agents")},getSkillDetail(t,a){return Ie(`/api/skills/${t}/${a}`)},async getEvals(t,a){const s=await Ie(`/api/skills/${t}/${a}/evals`);if(s&&typeof s=="object"&&"exists"in s){if(s.exists===!1)return{skill_name:a,evals:[]};const{exists:o,...c}=s;return c}return s},getEvalsEnvelope(t,a){return Ie(`/api/skills/${t}/${a}/evals`)},getActivationHistoryEnvelope(t,a){return Ie(`/api/skills/${t}/${a}/activation-history`)},saveEvals(t,a,s){return Ie(`/api/skills/${t}/${a}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})},generateEvals(t,a){return Ie(`/api/skills/${t}/${a}/generate-evals`,{method:"POST"})},async getLatestBenchmark(t,a){const s=await fetch(`${Vn}/api/skills/${t}/${a}/benchmark/latest`);if(!s.ok){const o=await s.json().catch(()=>({error:s.statusText}));throw new Us(o.error||`HTTP ${s.status}`,s.status)}return s.json()},getHistory(t,a,s){const o=new URLSearchParams;s!=null&&s.model&&o.set("model",s.model),s!=null&&s.type&&o.set("type",s.type),s!=null&&s.from&&o.set("from",s.from),s!=null&&s.to&&o.set("to",s.to);const c=o.toString();return Ie(`/api/skills/${t}/${a}/history${c?"?"+c:""}`)},getHistoryEntry(t,a,s){return Ie(`/api/skills/${t}/${a}/history/${encodeURIComponent(s)}`)},compareRuns(t,a,s,o){return Ie(`/api/skills/${t}/${a}/history-compare?a=${encodeURIComponent(s)}&b=${encodeURIComponent(o)}`)},getCaseHistory(t,a,s,o){const c=new URLSearchParams;o&&c.set("model",o);const u=c.toString();return Ie(`/api/skills/${t}/${a}/history/case/${s}${u?"?"+u:""}`)},deleteHistoryEntry(t,a,s){return Ie(`/api/skills/${t}/${a}/history/${encodeURIComponent(s)}`,{method:"DELETE"})},deleteSkill(t,a){return Ie(`/api/skills/${t}/${a}`,{method:"DELETE"})},improveSkill(t,a,s){return Ie(`/api/skills/${t}/${a}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})},instructEdit(t,a,s){return Ie(`/api/skills/${t}/${a}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"instruct",...s})})},applyImprovement(t,a,s){return Ie(`/api/skills/${t}/${a}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:s})})},getStats(t,a){return Ie(`/api/skills/${t}/${a}/stats`)},getDependencies(t,a){return Ie(`/api/skills/${t}/${a}/dependencies`)},getProjectLayout(){return Ie("/api/project-layout")},createSkill(t){return Ie("/api/skills/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},detectEngines(){return Ie("/api/studio/detect-engines")},saveDraft(t){return Ie("/api/skills/save-draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},getSkillCreatorStatus(){return Ie("/api/skill-creator-status")},generateSkill(t){return Ie("/api/skills/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},getSkillFiles(t,a){return Ie(`/api/skills/${t}/${a}/files`)},getSkillFile(t,a,s){return Ie(`/api/skills/${t}/${a}/file?path=${encodeURIComponent(s)}`)},saveSkillFile(t,a,s,o){return Ie(`/api/skills/${t}/${a}/file`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:s,content:o})})},getLeaderboard(t,a){return Ie(`/api/skills/${t}/${a}/leaderboard`)},getLeaderboardEntry(t,a,s){return Ie(`/api/skills/${t}/${a}/leaderboard/${encodeURIComponent(s)}`)},startSweep(t,a,s){const o=`${Vn}/api/skills/${t}/${a}/sweep`,c=new EventSource(o);return fetch(o,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(s)}),c},getCredentials(t,a){return Ie(`/api/credentials/${t}/${a}`)},setCredential(t,a,s,o){return Ie(`/api/credentials/${t}/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,value:o})})},getParams(t,a){return Ie(`/api/credentials/${t}/${a}/params`)},getParamsRevealed(t,a,s){const o=s?`reveal=true&key=${encodeURIComponent(s)}`:"reveal=true";return Ie(`/api/credentials/${t}/${a}/params?${o}`)},searchModels(){return Ie("/api/openrouter/models")},async getSkillVersions(t,a){const s=await Ie(`/api/skills/${t}/${a}/versions`);return Array.isArray(s)?s:Array.isArray(s.versions)?s.versions:[]},getSkillVersionsEnvelope(t,a){return Ie(`/api/skills/${t}/${a}/versions`)},getVersionDiff(t,a,s,o){return Ie(`/api/skills/${t}/${a}/versions/diff?from=${s}&to=${o}`)},startBatchUpdate(t){const a=`${Vn}/api/skills/batch-update`,s=new EventSource(a);return fetch(a,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({skills:t})}),s},startSkillUpdate(t,a){const s=`${Vn}/api/skills/${t}/${a}/update`,o=new EventSource(s);return fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"}}),o},async postSkillUpdate(t,a,s){let o,c;if(s&&typeof s.aborted=="boolean")o=s;else if(s&&typeof s=="object"){const y=s;o=y.signal,c=y.agentId}const u=c?`?agent=${encodeURIComponent(c)}`:"",d=`${Vn}/api/skills/${t}/${a}/update${u}`,h=await fetch(d,{method:"POST",headers:{"Content-Type":"application/json"},signal:o});let g,m="";if(h.body){const y=h.body.getReader(),v=new TextDecoder;let b=!1,S="";for(;!b;){const w=await y.read();if(b=w.done,w.value){const C=v.decode(w.value,{stream:!b});S+=C,m.length<200&&(m+=C)}}const k=S.match(/event:\s*done[\s\S]*?data:\s*(\{[^\n]+\})/);if(k)try{g=JSON.parse(k[1]).version}catch{}m=m.slice(0,200)}else{const y=await h.text();m=y.slice(0,200);const v=y.match(/event:\s*done[\s\S]*?data:\s*(\{[^\n]+\})/);if(v)try{g=JSON.parse(v[1]).version}catch{}}return{ok:h.ok,status:h.status,body:m,version:g}},async rescanSkill(t,a){const s=`${t}/${a}`,o=await fetch(`${Vn}/api/v1/skills/${encodeURIComponent(s)}/rescan`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!o.ok)throw new Error(`rescan failed: HTTP ${o.status}`);return await o.json()},async getSkillUpdates(){try{const t=await fetch(`${Vn}/api/skills/updates`);return t.ok?await t.json():[]}catch{return[]}},async checkSkillUpdates(t){if(t.length===0)return[];try{const a=[...t].sort(),s=await qx(`${Vn}/api/v1/skills/check-updates`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({skills:a.map(c=>({name:c,currentVersion:"0.0.0"}))})});if(!s.ok)return[];const o=await s.json().catch(()=>null);return Array.isArray(o)?o:o&&typeof o=="object"&&Array.isArray(o.results)?o.results.map(c=>({skillId:typeof c.skillId=="string"?c.skillId:typeof c.name=="string"?c.name:"",version:typeof c.version=="string"?c.version:typeof c.latest=="string"?c.latest:"",eventId:typeof c.eventId=="string"?c.eventId:"",publishedAt:typeof c.publishedAt=="string"?c.publishedAt:"",diffSummary:typeof c.diffSummary=="string"?c.diffSummary:void 0,trackedForUpdates:typeof c.trackedForUpdates=="boolean"?c.trackedForUpdates:void 0,updateAvailable:typeof c.updateAvailable=="boolean"?c.updateAvailable:void 0,installed:typeof c.installed=="string"?c.installed:void 0,latest:typeof c.latest=="string"?c.latest:void 0,name:typeof c.name=="string"?c.name:void 0})):[]}catch{return[]}},async resolveInstalledSkillIds(t){if(t.length===0)return[];try{const a=await qx(`${Vn}/api/v1/skills/check-updates`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({skills:t.map(u=>({name:u.name,currentVersion:u.currentVersion??"0.0.0"}))})});if(!a.ok)return t.map(u=>({plugin:u.plugin,skill:u.skill}));const s=await a.json().catch(()=>null),o=Array.isArray(s)?s:Array.isArray(s==null?void 0:s.results)?s.results:[],c=new Map(o.map(u=>[u.name,u]));return t.map(u=>{const d=c.get(u.name);return{plugin:u.plugin,skill:u.skill,uuid:typeof(d==null?void 0:d.id)=="string"&&d.id.length>0?d.id:void 0,slug:typeof(d==null?void 0:d.slug)=="string"&&d.slug.length>0?d.slug:void 0}})}catch{return t.map(s=>({plugin:s.plugin,skill:s.skill}))}},promoteSkill(t,a,s){const o=s!=null&&s.overwrite?"?overwrite=true":"";return jd(`/api/skills/${t}/${a}/promote${o}`,s==null?void 0:s.onEvent,s==null?void 0:s.signal)},testInstallSkill(t,a,s){const o=new URLSearchParams;(s==null?void 0:s.dest)==="global"&&o.set("dest","global"),s!=null&&s.overwrite&&o.set("overwrite","true");const c=o.toString();return jd(`/api/skills/${t}/${a}/test-install${c?"?"+c:""}`,s==null?void 0:s.onEvent,s==null?void 0:s.signal)},revertSkill(t,a,s){return jd(`/api/skills/${t}/${a}/revert`,s==null?void 0:s.onEvent,s==null?void 0:s.signal)},listStudioOps(t){const a=new URLSearchParams;(t==null?void 0:t.before)!=null&&a.set("before",String(t.before)),(t==null?void 0:t.limit)!=null&&a.set("limit",String(t.limit));const s=a.toString();return Ie(`/api/studio/ops${s?"?"+s:""}`)},deleteStudioOp(t){return Ie(`/api/studio/ops/${encodeURIComponent(t)}`,{method:"DELETE"})},studioOpsStream(){return new EventSource(`${Vn}/api/studio/ops/stream`)},gitRemote(){return Ie("/api/git/remote")},gitDiff(){return Ie("/api/git/diff",{method:"POST"})},gitCommitMessage(t){return Ie("/api/git/commit-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t??{})})},gitPublish(t){return Ie("/api/git/publish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t??{})})}};async function jd(t,a,s){const o=await fetch(`${Vn}${t}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},signal:s});if(!o.ok||!o.body){let y=`HTTP ${o.status}`,v;try{const S=await o.json();S.error&&(y=S.error),typeof S.code=="string"&&(v=S.code)}catch{}const b=new Us(y,o.status);throw v&&(b.code=v),b}const c=o.body.getReader(),u=new TextDecoder;let d="",h="",g=null,m=null;for(;;){const{done:y,value:v}=await c.read();if(y)break;d+=u.decode(v,{stream:!0});const b=d.split(`
|
|
62
|
+
`);d=b.pop()??"";for(const S of b)if(S.startsWith("event: "))h=S.slice(7).trim();else if(S.startsWith("data: ")){let k={};try{k=JSON.parse(S.slice(6))}catch{h="";continue}if(h==="started"||h==="copied"||h==="deleted"||h==="indexed"||h==="done"||h==="error"){const w={type:h,...k};a==null||a(w),w.type==="done"&&(g=w),w.type==="error"&&(m=w)}h=""}}if(m){const y=new Us(m.message,500);throw y.code=m.code,y}if(!g)throw new Us("Transfer stream ended without 'done' event",500);return g}function cS(t,a){if(!t||!a)return!1;const s=/^(\d+)\.(\d+)\.(\d+)/,o=t.match(s),c=a.match(s);if(!o||!c)return!1;const[,u,d,h]=o.map(Number),[,g,m,y]=c.map(Number);return u!==g?u>g:d!==m?d>m:h>=y}function uS(t,a){if(!a.length)return t;const s=new Map,o=new Map;for(const c of a){const u=c.name.split("/"),d=u.pop()||c.name;if(o.set(d,c),u.length>=1){const h=u[u.length-1];s.set(`${h}/${d}`,c)}}return t.map(c=>{if(c.origin!=="installed")return c;let u;if(c.pluginName?u=s.get(`${c.pluginName}/${c.skill}`):u=o.get(c.skill),!u)return c;const d=u.updateAvailable&&!cS(c.version,u.latest),h={...c,updateAvailable:d,currentVersion:u.installed,latestVersion:u.latest??void 0};typeof u.trackedForUpdates=="boolean"&&(h.trackedForUpdates=u.trackedForUpdates);const g=Lv({frontmatterVersion:h.version??null,registryCurrentVersion:h.currentVersion??null,pluginVersion:h.pluginVersion??null});return h.resolvedVersion=g.version,h.versionSource=g.versionSource,h})}const Mo=new Map,Oa=new Map,Bs=new Map;function En(t){Mo.delete(t),Oa.delete(t);const a=Bs.get(t);if(a)for(const s of a)s()}function Js(t,a,s={}){const{ttl:o=3e4,enabled:c=!0}=s,[,u]=p.useState(0),[d,h]=p.useState(void 0),[g,m]=p.useState(0),y=p.useRef(!0),v=p.useRef(t);v.current=t;const b=()=>{h(void 0),En(t),m(w=>w+1)};p.useEffect(()=>(y.current=!0,()=>{y.current=!1}),[]),p.useEffect(()=>{if(!c)return;const w=()=>{y.current&&m(C=>C+1)};return Bs.has(t)||Bs.set(t,new Set),Bs.get(t).add(w),()=>{var C;(C=Bs.get(t))==null||C.delete(w)}},[t,c]),p.useEffect(()=>{if(!c)return;const w=Mo.get(t);if(!(!w||Date.now()-w.fetchedAt>o))return;if(Oa.has(t)){const A=Oa.get(t),_=()=>{y.current&&v.current===t&&u(D=>D+1)};A.subscribers.push(_);return}const T={promise:Promise.resolve(),subscribers:[]},N=a().then(A=>{Mo.set(t,{data:A,fetchedAt:Date.now()}),Oa.delete(t),y.current&&v.current===t&&(h(void 0),u(_=>_+1));for(const _ of T.subscribers)_()},A=>{Oa.delete(t);const _=A instanceof Error?A:new Error(String(A));y.current&&v.current===t&&(h(_),u(D=>D+1));for(const D of T.subscribers)D()});T.promise=N,Oa.set(t,T)},[t,a,o,c,g]);const S=Mo.get(t),k=c&&!S&&!d&&Oa.has(t);return{data:S==null?void 0:S.data,loading:k,error:d,revalidate:b}}function dS(t){const[a,s]=p.useState(()=>typeof window>"u"?!1:window.matchMedia(t).matches);return p.useEffect(()=>{const o=window.matchMedia(t);s(o.matches);const c=u=>s(u.matches);return o.addEventListener("change",c),()=>o.removeEventListener("change",c)},[t]),a}const fS=500,Zd="vskill.updates.seenLastId";function pS(){if(typeof window>"u")return null;try{return window.localStorage.getItem(Zd)}catch{return null}}function Sd(t){if(!(typeof window>"u"))try{t==null?window.localStorage.removeItem(Zd):window.localStorage.setItem(Zd,t)}catch{}}function mS(){let t=new Map;const a=new Set,s=new Set,o=[];let c=pS();c&&(s.add(c),o.push(c));function u(){t=new Map(t);for(const h of Array.from(a))h()}function d(h){if(!s.has(h)){if(s.add(h),o.push(h),o.length>fS){const g=o.shift();g&&s.delete(g)}c=h,Sd(h)}}return{getSnapshot(){return t},subscribe(h){return a.add(h),()=>{a.delete(h)}},ingest(h){return s.has(h.eventId)?"duplicate":(d(h.eventId),t.set(h.skillId,{skillId:h.skillId,version:h.version,diffSummary:h.diffSummary,eventId:h.eventId,publishedAt:h.publishedAt,receivedAt:Date.now()}),u(),"stored")},dismiss(h){t.has(h)&&(t.delete(h),u())},clearSeen(){s.clear(),o.length=0,c=null,Sd(null)},mergeBulk(h){if(h.length!==0){for(const g of h)t.set(g.skillId,g);u()}},getSeenLastId(){return c},reset(){t=new Map,s.clear(),o.length=0,c=null,Sd(null),u()}}}const Da=mS(),hS=3e5,xS=500,gS=15e3,vS=6e4,yS=6e4,bS="/api/v1/skills/stream";function Yx(t){const a=new Map;for(const s of t){const o=s.name.split("/").pop()||s.name;a.set(o,s)}return a}function Kx(t){let a=0;for(const s of t)s.updateAvailable&&a++;return a}function jS(t){if(!t||typeof t!="object")return!1;const a=t;return a.type==="skill.updated"&&typeof a.eventId=="string"&&typeof a.skillId=="string"&&typeof a.version=="string"}function SS(t){const a=(t==null?void 0:t.intervalMs)??hS,s=(t==null?void 0:t.debounceMs)??xS,o=(t==null?void 0:t.timeoutMs)??gS,c=(t==null?void 0:t.staleAfterMs)??vS,u=(t==null?void 0:t.disconnectFallbackMs)??yS,d=(t==null?void 0:t.streamUrlBase)??bS,h=p.useMemo(()=>!(t!=null&&t.skillIds)||t.skillIds.length===0?"":[...t.skillIds].sort().join(","),[t==null?void 0:t.skillIds]),g=p.useMemo(()=>{const M=(t==null?void 0:t.trackingSkillIds)??(t==null?void 0:t.skillIds)??[];return M.length===0?"":[...M].sort().join(",")},[t==null?void 0:t.trackingSkillIds,t==null?void 0:t.skillIds]),[m,y]=p.useState([]),[v,b]=p.useState(()=>new Map),[S,k]=p.useState(0),[w,C]=p.useState(!1),[T,N]=p.useState(null),[A,_]=p.useState(null),D=p.useRef(null),F=p.useRef(null),E=p.useRef(null),B=p.useRef(null),L=p.useRef(!0),[U,$]=p.useState(()=>h?"connecting":"fallback"),q=p.useRef(U);q.current=U;const X=p.useSyncExternalStore(M=>Da.subscribe(M),()=>Da.getSnapshot(),()=>Da.getSnapshot()),ee=X.size,I=p.useCallback(async()=>{C(!0);const M=new AbortController,Y=setTimeout(()=>M.abort(),o);try{const W=await Promise.race([we.getSkillUpdates(),new Promise((Q,oe)=>{M.signal.addEventListener("abort",()=>{oe(new Error("TIMEOUT"))})})]);if(W==="TIMEOUT")throw new Error("TIMEOUT");if(!L.current)return;y(W),b(Yx(W)),k(Kx(W)),F.current=Date.now(),N(F.current),_(null)}catch(W){if(!L.current)return;_(W instanceof Error?W:new Error(String(W)))}finally{clearTimeout(Y),L.current&&C(!1)}},[o]),z=p.useCallback(()=>{if(D.current)return D.current;const M=I().finally(()=>{D.current=null});return D.current=M,M},[I]),O=p.useCallback(()=>{E.current==null&&(E.current=setInterval(()=>{z()},a))},[a,z]),P=p.useCallback(()=>{E.current!=null&&(clearInterval(E.current),E.current=null)},[]);p.useEffect(()=>{L.current=!0,(F.current==null||Date.now()-F.current>c)&&z(),(typeof document>"u"||document.visibilityState!=="hidden")&&O();const W=()=>{if(B.current&&(clearTimeout(B.current),B.current=null),document.visibilityState==="hidden"){P();return}B.current=setTimeout(()=>{B.current=null,(F.current==null||Date.now()-F.current>c)&&z(),O()},s)};return typeof document<"u"&&document.addEventListener("visibilitychange",W),()=>{L.current=!1,typeof document<"u"&&document.removeEventListener("visibilitychange",W),B.current&&clearTimeout(B.current),P()}},[]);const H=p.useCallback(async M=>{if(M.length!==0)try{const Y=await we.checkSkillUpdates(M);if(!L.current||Y.length===0)return;const W=Date.now(),Q=Y.filter(de=>de.skillId&&de.eventId&&de.version).map(de=>({skillId:de.skillId,version:de.version,eventId:de.eventId,publishedAt:de.publishedAt,diffSummary:de.diffSummary,receivedAt:W}));Q.length>0&&Da.mergeBulk(Q);const oe=Y.filter(de=>typeof de.trackedForUpdates=="boolean"||typeof de.updateAvailable=="boolean").map(de=>({name:de.name??de.skillId,installed:de.installed??"",latest:de.latest??null,updateAvailable:de.updateAvailable??!1,trackedForUpdates:typeof de.trackedForUpdates=="boolean"?de.trackedForUpdates:void 0}));oe.length>0&&y(de=>{const ve=new Map;for(const Re of de)ve.set(Re.name.split("/").pop()||Re.name,Re);let ce=0;for(const Re of oe){const Oe=Re.name.split("/").pop()||Re.name,le=ve.get(Oe);if(le){const he={...le};le.trackedForUpdates===void 0&&Re.trackedForUpdates!==void 0&&(he.trackedForUpdates=Re.trackedForUpdates),ve.set(Oe,he)}else ve.set(Oe,{name:Re.name,installed:Re.installed??"",latest:Re.latest??null,updateAvailable:Re.updateAvailable??!1,trackedForUpdates:Re.trackedForUpdates}),ce+=1}if(ce===0&&ve.size===de.length)return de;const je=[...ve.values()];return b(Yx(je)),k(Kx(je)),je})}catch{}},[]);p.useEffect(()=>{const M=h||g;if(!M){$("fallback");return}if(typeof window>"u"||typeof EventSource>"u"){$("fallback");return}$("connecting");const Y=M.split(","),W=`${d}?skills=${encodeURIComponent(M)}`;let Q=null,oe=null,de=null;const ve=()=>{oe==null&&(oe=setTimeout(()=>{oe=null,L.current&&q.current!=="connected"&&$("fallback")},u))},ce=()=>{oe!=null&&(clearTimeout(oe),oe=null)};ve();const je=1e3,Re=()=>{L.current&&de==null&&(de=setTimeout(()=>{if(de=null,!!L.current&&!(Q&&Q.readyState!==EventSource.CLOSED)){if(Q)try{Q.close()}catch{}he()}},je))},Oe=pe=>{if(!L.current)return;let xe;try{xe=JSON.parse(pe.data)}catch{return}if(!jS(xe)||Da.ingest(xe)==="duplicate")return;if(typeof document>"u"||document.visibilityState!=="hidden"){const Ue=`${xe.skillId} updated to ${xe.version}`;window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:Ue,severity:"info",skillId:xe.skillId,version:xe.version,eventId:xe.eventId}}))}},le=()=>{L.current&&(Da.clearSeen(),H(Y))},he=()=>{L.current&&(Q=new EventSource(W),Q.onopen=()=>{L.current&&(ce(),$("connected"))},Q.onerror=()=>{L.current&&(ve(),Q&&Q.readyState===EventSource.CLOSED&&Re())},Q.onmessage=Oe,Q.addEventListener("gone",le))};return he(),()=>{if(ce(),de!=null&&(clearTimeout(de),de=null),Q){try{Q.removeEventListener("gone",le)}catch{}try{Q.close()}catch{}}}},[h,g,d,u,H]),p.useEffect(()=>{if(!g)return;const M=g.split(",");H(M)},[g,H]);const ae=p.useCallback(M=>{Da.dismiss(M)},[]);return{updates:m,updatesMap:v,updateCount:S,isRefreshing:w,lastFetchAt:T,error:A,refresh:z,updatesById:X,pushUpdateCount:ee,status:U,dismiss:ae}}function kS(t){const a=[];for(const s of t){const o=typeof s.uuid=="string"&&s.uuid.length>0,c=typeof s.slug=="string"&&s.slug.length>0;if(!o&&!c)continue;const u={};o&&(u.uuid=s.uuid),c&&(u.slug=s.slug),a.push(u)}return a}const wS={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list",updateNotificationDismissed:!1,revealSkillId:null};function CS(t,a){switch(a.type){case"SELECT_SKILL":return{...t,selectedSkill:a.skill,mode:"browse",mobileView:t.isMobile?"detail":t.mobileView};case"CLEAR_SELECTION":return{...t,selectedSkill:null};case"SET_MODE":return{...t,mode:a.mode,selectedSkill:a.mode==="create"?null:t.selectedSkill};case"SET_SEARCH":return{...t,searchQuery:a.query};case"SET_SKILLS":return{...t,skills:a.skills,skillsLoading:!1,skillsError:null};case"SET_SKILLS_ERROR":return{...t,skillsError:a.error,skillsLoading:!1};case"SET_SKILLS_LOADING":return{...t,skillsLoading:a.loading};case"SET_MOBILE":return{...t,isMobile:a.isMobile};case"SET_MOBILE_VIEW":return{...t,mobileView:a.view};case"DISMISS_UPDATE_NOTIFICATION":return{...t,updateNotificationDismissed:!0};case"REVEAL_SKILL":return{...t,selectedSkill:a.skill,revealSkillId:`${a.skill.plugin}/${a.skill.skill}`,mode:"browse",mobileView:t.isMobile?"detail":t.mobileView};case"CLEAR_REVEAL":return{...t,revealSkillId:null};default:return t}}const zv=p.createContext(null),Dv=zv;function er(){const t=p.useContext(Dv);if(!t)throw new Error("useStudio must be used within StudioProvider");return t}function ES({children:t}){const[a,s]=p.useReducer(CS,wS),o=dS("(max-width: 767px)");p.useEffect(()=>{s({type:"SET_MOBILE",isMobile:o})},[o]);const[c,u]=p.useState(()=>{try{const H=window.localStorage.getItem("vskill.studio.prefs");if(!H)return null;const ae=JSON.parse(H);return typeof ae.activeAgent=="string"?ae.activeAgent:null}catch{return null}}),[d,h]=p.useState(c!==null);p.useEffect(()=>{function H(ae){if(!(ae instanceof CustomEvent))return;const M=ae.detail;M!=null&&M.agentId&&(u(M.agentId),h(!0))}return window.addEventListener("studio:agent-changed",H),()=>window.removeEventListener("studio:agent-changed",H)},[]),p.useEffect(()=>{if(d)return;let H=!1;return we.getAgents().then(ae=>{if(H)return;const M=(ae==null?void 0:ae.suggested)??"claude-code";u(Y=>Y??M),h(!0)}).catch(()=>{H||(u(ae=>ae??"claude-code"),h(!0))}),()=>{H=!0}},[d]);const g=p.useCallback(()=>{if(!d||!c)return;s({type:"SET_SKILLS_LOADING",loading:!0});const H={agent:c};we.getSkills(H).then(ae=>{s({type:"SET_SKILLS",skills:ae});const Y=window.location.hash.match(/^#\/skills\/([^/]+)\/([^/?]+)/);if(Y){const[,W,Q]=Y,oe=ae.find(de=>de.plugin===W&&de.skill===Q);oe&&s({type:"SELECT_SKILL",skill:{plugin:W,skill:Q,origin:oe.origin}})}}).catch(ae=>s({type:"SET_SKILLS_ERROR",error:ae.message}))},[c,d]);p.useEffect(()=>{g()},[g]);const m=p.useCallback(H=>{s({type:"SELECT_SKILL",skill:H}),window.location.hash=`/skills/${H.plugin}/${H.skill}`},[]),y=p.useRef(a.skills);p.useEffect(()=>{y.current=a.skills},[a.skills]);const v=p.useCallback((H,ae)=>{const M=y.current,Y=H?M.find(oe=>oe.plugin===H&&oe.skill===ae):M.find(oe=>oe.skill===ae&&oe.source!=="plugin");if(!H&&!Y){typeof console<"u"&&console.warn(`[StudioContext] revealSkill: no plugin provided and skill "${ae}" not yet in state — skipping reveal`);return}const W=(Y==null?void 0:Y.plugin)??H,Q=(Y==null?void 0:Y.origin)??"source";s({type:"REVEAL_SKILL",skill:{plugin:W,skill:ae,origin:Q}}),window.location.hash=`/skills/${W}/${ae}`},[]),b=p.useCallback(()=>{s({type:"CLEAR_REVEAL"})},[]),S=p.useCallback(()=>{s({type:"CLEAR_SELECTION"}),window.location.hash.startsWith("#/skills/")&&history.replaceState(null,"",window.location.pathname+window.location.search)},[]),k=p.useCallback(H=>{s({type:"SET_MODE",mode:H})},[]),w=p.useCallback(H=>{s({type:"SET_SEARCH",query:H})},[]),C=p.useCallback(H=>{s({type:"SET_MOBILE_VIEW",view:H})},[]),T=p.useCallback(()=>{s({type:"DISMISS_UPDATE_NOTIFICATION"})},[]),N=p.useRef(new Map),A=p.useRef(""),_=p.useRef(!1),[D,F]=p.useState(""),E=p.useMemo(()=>a.skills.map(H=>`${H.plugin}/${H.skill}`),[a.skills]),B=p.useMemo(()=>D?D.split(",").filter(Boolean):[],[D]),L=SS({skillIds:B,trackingSkillIds:E}),U=p.useRef("");p.useEffect(()=>{const H=a.skills.filter(Q=>Q.origin==="installed");if(H.length===0){F(""),U.current="";return}const ae=new Map;for(const Q of L.updates)ae.set(Q.name.split("/").pop()||Q.name,Q);const M=H.map(Q=>{const oe=ae.get(Q.skill),de=Q.currentVersion??(oe==null?void 0:oe.installed)??Q.version??Q.pluginVersion??"1.0.0";return{plugin:Q.plugin,skill:Q.skill,name:(oe==null?void 0:oe.name)??Q.skill,currentVersion:de}}),Y=M.map(Q=>`${Q.plugin}/${Q.skill}@${Q.currentVersion}#${Q.name}`).sort().join("|");if(Y===U.current)return;U.current=Y;let W=!1;return we.resolveInstalledSkillIds(M).then(Q=>{if(W)return;const ve=[...kS(Q).flatMap(ce=>[ce.uuid,ce.slug].filter(Boolean))].sort().join(",");ve!==A.current&&(A.current=ve,N.current=new Map(Q.map(ce=>[`${ce.plugin}/${ce.skill}`,{uuid:ce.uuid,slug:ce.slug}])),F(ve))}).catch(Q=>{if(W||(U.current=""),!_.current){_.current=!0;const oe=Q instanceof Error?Q.message:String(Q);console.warn("[studio] resolveInstalledSkillIds failed (using polling fallback):",oe)}}),()=>{W=!0}},[a.skills,L.updates]);const $=p.useMemo(()=>{const H=a.skills.map(ae=>{if(!ae.updateAvailable&&ae.latestVersion===void 0&&ae.trackedForUpdates===void 0)return ae;const M={...ae};return delete M.updateAvailable,delete M.currentVersion,delete M.latestVersion,delete M.trackedForUpdates,M});return uS(H,L.updates)},[a.skills,L.updates]),q=p.useMemo(()=>{const H={source:0,installed:0};for(const ae of $)ae.updateAvailable&&(H[ae.origin]+=1);return H},[$]),X=p.useMemo(()=>({...a,skills:$}),[a,$]),ee=L.updateCount,I=L.refresh,z=L.isRefreshing,O=p.useCallback((H,ae)=>{I(),g(),En(`versions/${H}/${ae}`),L.dismiss(`${H}/${ae}`)},[I,g,L]),P=p.useMemo(()=>({state:X,selectSkill:m,clearSelection:S,setMode:k,setSearch:w,setMobileView:C,refreshSkills:g,updateCount:ee,dismissUpdateNotification:T,updates:L.updates,outdatedByOrigin:q,isRefreshingUpdates:z,refreshUpdates:I,revealSkill:v,clearReveal:b,updatesById:L.updatesById,pushUpdateCount:L.pushUpdateCount,updateStreamStatus:L.status,dismissPushUpdate:L.dismiss,activeAgent:c,onSkillUpdated:O}),[X,m,S,k,w,C,g,ee,T,L.updates,q,z,I,v,b,L.updatesById,L.pushUpdateCount,L.status,L.dismiss,c,O]);return r.jsx(Dv.Provider,{value:P,children:t})}const NS={config:null,loading:!0};function TS(t,a){switch(a.type){case"SET_CONFIG":return{config:a.config,loading:!1};case"SET_LOADING":return{...t,loading:!0};default:return t}}const _v=p.createContext(null);function $a(){const t=p.useContext(_v);if(!t)throw new Error("useConfig must be used within ConfigProvider");return t}function RS({children:t}){const[a,s]=p.useReducer(TS,NS),o=p.useCallback(()=>{we.getConfig().then(d=>s({type:"SET_CONFIG",config:d})).catch(()=>{})},[]);p.useEffect(()=>{o()},[o]);const c=p.useCallback(async(d,h)=>{const g=await we.setConfig(d,h);return s({type:"SET_CONFIG",config:g}),g},[]),u=p.useMemo(()=>({config:a.config,loading:a.loading,updateConfig:c,refreshConfig:o}),[a,c,o]);return r.jsx(_v.Provider,{value:u,children:t})}function AS({topRail:t,sidebar:a,main:s,statusBar:o,resizeHandle:c,banner:u,liveMessage:d,sidebarWidth:h=320,sidebarHidden:g=!1}){const m={"--top-rail-height":"48px","--status-bar-height":"28px","--sidebar-width":`${h}px`,display:"grid",gridTemplateRows:"var(--top-rail-height) 1fr var(--status-bar-height)",height:"100vh",overflow:"hidden",background:"var(--bg-canvas)",color:"var(--text-primary)"},y={display:"grid",gridTemplateColumns:g?"1fr":"var(--sidebar-width) auto 1fr",minHeight:0,overflow:"hidden"};return r.jsxs("div",{className:"studio-shell",style:m,children:[u,r.jsx("header",{style:{borderBottom:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:t}),r.jsxs("div",{style:y,children:[!g&&r.jsx("aside",{"aria-label":"Skills sidebar",style:{minHeight:0,overflow:"hidden",borderRight:c?"none":"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",flexDirection:"column"},children:a}),!g&&c,r.jsx("main",{style:{minHeight:0,overflow:"auto",background:"var(--bg-canvas)"},children:s})]}),r.jsx("footer",{role:"contentinfo",style:{borderTop:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:o}),r.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:d??""})]})}const Xx=["claude-cli","anthropic","openai","openrouter","cursor","codex-cli","gemini-cli","copilot","zed","ollama","lm-studio"],MS={"claude-cli":".claude",cursor:".cursor","codex-cli":".codex","gemini-cli":".gemini",copilot:".github",zed:".zed"},LS={"claude-cli":"claude",cursor:"cursor","codex-cli":"codex","gemini-cli":"gemini"},zS={"claude-cli":"cli-install",anthropic:"api-key",openai:"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"},DS={"claude-cli":"subscription",anthropic:"per-token",openai:"per-token",openrouter:"per-token",cursor:"subscription","codex-cli":"subscription","gemini-cli":"subscription",copilot:"subscription",zed:"subscription",ollama:"free","lm-studio":"free"};function _S(t,a){var h,g;const s=MS[t.id]??null,o=LS[t.id]??null,c=s?!!((h=a==null?void 0:a.wrapperFolders)!=null&&h[s]):!1,u=o?!!((g=a==null?void 0:a.binaries)!=null&&g[o]):!0,d=t.models.map(m=>({id:m.id,displayName:m.label,billingMode:DS[t.id]??"per-token",...m.pricing?{pricing:m.pricing}:{},...m.resolvedId?{resolvedId:m.resolvedId}:{}}));return{id:t.id,displayName:OS(t.id,t.label),wrapperFolder:s,wrapperFolderPresent:c,binaryAvailable:u,endpointReachable:t.id==="ollama"||t.id==="lm-studio"?t.available:null,available:t.available,ctaType:t.available?null:zS[t.id]??null,models:d,resolvedModel:t.resolvedModel??null}}function OS(t,a){return{"claude-cli":"Claude Code",anthropic:"Anthropic API",openai:"OpenAI API",openrouter:"OpenRouter",cursor:"Cursor","codex-cli":"Codex CLI","gemini-cli":"Gemini CLI",copilot:"GitHub Copilot",zed:"Zed",ollama:"Ollama","lm-studio":"LM Studio"}[t]??a}function BS(t){const a=new Map(t.map(o=>[o.id,o])),s=[];for(const o of Xx){const c=a.get(o);c&&s.push(c)}for(const o of t)Xx.includes(o.id)||s.push(o);return s}function IS(t){const[a,s]=p.useState(null),[o,c]=p.useState("loading"),[u,d]=p.useState(null),[h,g]=p.useState(null),m=p.useRef(null),y=p.useRef(0),v=p.useRef(t==null?void 0:t.onStaleCatalog),b=p.useRef(t==null?void 0:t.onSetActiveError);p.useEffect(()=>{v.current=t==null?void 0:t.onStaleCatalog,b.current=t==null?void 0:t.onSetActiveError},[t==null?void 0:t.onStaleCatalog,t==null?void 0:t.onSetActiveError]);const S=p.useCallback(async()=>{try{const N=await fetch("/api/config");if(!N.ok)throw new Error(`/api/config returned ${N.status}`);const A=await N.json(),_=BS((A.providers||[]).map(D=>_S(D,A.detection)));s({agents:_,activeAgent:A.provider??null,activeModel:A.model??null}),c("ready"),d(null)}catch(N){c("error"),d(N.message)}},[]);p.useEffect(()=>{S()},[S]);const k=p.useCallback(async()=>{var A;const N=Date.now();if(!(N-y.current<5*6e4))try{const _=await fetch("/api/openrouter/models");if(!_.ok){_.status!==400&&g(`OpenRouter catalog fetch failed (${_.status})`);return}const D=await _.json();y.current=N,g(null),s(B=>{if(!B)return B;const L=B.agents.map(U=>{if(U.id!=="openrouter")return U;const $=D.models.map(X=>({id:X.id,displayName:X.name,contextWindow:X.contextWindow,pricing:X.pricing,billingMode:"per-token"}));return{...U,models:$,catalogAgeMs:D.ageSec?D.ageSec*1e3:0,cacheStale:!!D.stale}});return{...B,agents:L}});const F=D.ageSec??0;(D.stale===!0||F>600)&&((A=v.current)==null||A.call(v,"openrouter",F*1e3))}catch(_){g(`OpenRouter catalog unreachable: ${_.message}`)}},[]),w=p.useCallback(N=>{m.current=N,N==="openrouter"&&k()},[k]),C=p.useCallback(()=>{y.current=0,S()},[S]),T=p.useCallback(async(N,A)=>{var F,E;let _;try{_=await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:N,model:A})})}catch(B){(F=b.current)==null||F.call(b,`Network error while setting ${N}: ${B.message}`);return}if(_.ok){s(B=>B&&{...B,activeAgent:N,activeModel:A});return}let D=`Failed to set ${N} (${_.status})`;try{const B=await _.json();B&&typeof B.error=="string"&&(D=B.error)}catch{}(E=b.current)==null||E.call(b,D)},[]);return{status:o,catalog:a,error:u,openRouterError:h,focusAgent:w,refresh:C,activeAgentId:(a==null?void 0:a.activeAgent)??null,activeModelId:(a==null?void 0:a.activeModel)??null,setActive:T}}function kd({variant:t,label:a,onActivate:s,installUrl:o,tooltip:c}){function u(h){if(h.stopPropagation(),t==="cli-install"&&o){window.open(o,"_blank","noopener,noreferrer");return}s()}function d(h){(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),u(h))}return r.jsx("button",{type:"button","data-testid":`locked-cta-${t}`,onClick:u,onKeyDown:d,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":a,...c?{title:c}:{},children:a})}function Jd({unlocked:t=!1,size:a=10}){return t?r.jsxs("svg",{width:a,height:a,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),r.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 3.5"})]}):r.jsxs("svg",{width:a,height:a,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),r.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 4.5V7"})]})}const US={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 <skill> 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:(t,a)=>`${t} of ${a}`},HS={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"},$S={tabOverview:"Overview",tabVersions:"Versions",tabBenchmark:"Benchmark",emptyHeadline:"Select a skill to see details.",emptyBody:"Pick one from the sidebar.",loadErrorHeadline:t=>`Couldn't load SKILL.md for ${t}.`,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:t=>`Viewing ${t} (Own)`,announceViewingInstalled:t=>`Viewing ${t} (Installed)`,moreFields:"More fields",sourceAgent:"Source agent",noMcpDependencies:"No MCP dependencies.",filesystemGroup:"Filesystem",benchmarkGroup:"Benchmark",metadataGroup:"Frontmatter"},VS={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.",delete:"Delete",deletePluginTooltip:"Plugin skills are managed by their owning plugin — uninstall the plugin to remove.",undo:"Undo"},PS={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"},FS={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"},GS={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."},WS={disconnected:"Disconnected — reconnecting…",reconnected:"Reconnected.",loading:"Loading skills…",loadingPlaceholderCount:"—"},qS={fieldRequired:"This field is required.",nameInvalid:"Use letters, numbers, and hyphens.",descriptionRequired:"Description is required.",saveFailed:"Save failed. Check the form for errors."},YS={boundaryHeadline:"Something broke in this view.",boundaryBody:"Reload the page to recover.",boundaryAction:"Reload"},KS={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:t=>`No models match "${t}"`,clearSearch:"Clear",currentlyActive:"Currently active"},XS={claudeCli:{name:"Claude Code",caption:"Delegates to the `claude` CLI — your existing Claude Code session handles quota.",missingBinary:"Claude Code not found. Install it: `npm install -g @anthropic-ai/claude-code`. Or choose a provider with an API key.",installCta:"Install Claude Code →",installUrl:"https://docs.claude.com/en/docs/claude-code"},anthropic:{name:"Anthropic API",caption:"Direct access via your Anthropic API key.",addKeyCta:"Add API key →",keyIssuanceUrl:"https://platform.claude.com/settings/keys",keyPrefix:"sk-ant-"},openai:{name:"OpenAI",caption:"GPT-4, GPT-5, and the o-series reasoning models.",addKeyCta:"Add API key →",keyIssuanceUrl:"https://platform.openai.com/api-keys",keyPrefix:"sk-",pastePlaceholder:"Paste OpenAI API key (sk-proj-...)"},openrouter:{name:"OpenRouter",caption:"300+ models from every major vendor.",addKeyCta:"Add API key →",emptyCardBody:"Add your OpenRouter API key to browse 300+ models",keyIssuanceUrl:"https://openrouter.ai/settings/keys",keyPrefix:"sk-or-"},cursor:{name:"Cursor",caption:"Cursor IDE composer.",installCta:"Install Cursor →"},codexCli:{name:"Codex CLI",caption:"OpenAI Codex CLI.",installCta:"Install Codex CLI →"},geminiCli:{name:"Gemini CLI",caption:"Google Gemini CLI.",installCta:"Install Gemini CLI →"},copilot:{name:"GitHub Copilot",caption:"GitHub Copilot CLI.",installCta:"Install Copilot →"},zed:{name:"Zed",caption:"Zed editor.",installCta:"Install Zed →"},ollama:{name:"Ollama",caption:"Local models, free.",startServiceCta:"Start service →"},lmStudio:{name:"LM Studio",caption:"Local models, free.",startServiceCta:"Start LM Studio server →",startServiceTooltip:"Open LM Studio → Developer tab → Start Server (default port 1234)."}},QS={subscriptionBilling:"· subscription",free:"· free"},ZS={title:"Settings",sectionApiKeys:"API Keys",banner:"Keys are stored locally on this device only. Never synced, never committed to git, never transmitted off-device except to the provider's own API.",storagePath:t=>`Keys stored at ${t} · protected by file permissions (0600 on macOS/Linux)`,storagePathFallback:"Keys stored locally on this device.",copyPath:"Copy path",pathCopied:"Path copied.",show:"Show",hide:"Hide",paste:"Paste",save:"Save",remove:"Remove",removeConfirm:t=>`Remove ${t} API key?`,keyStoredAt:t=>`Key stored locally — updated ${t}`,noKey:"No key stored",enterNonEmpty:"Enter a non-empty key",prefixWarn:t=>`This doesn't look like a typical ${t} key. Save anyway?`,keySaved:t=>`${t} API key saved (local only, never synced)`,keyRemoved:t=>`${t} API key removed`},JS={providersLabel:"Providers",providerSummary:(t,a)=>`${t}/${a} providers`,locked:t=>`${t} — locked. Click to add a key.`,lockedCli:t=>`${t} — locked. Click for install instructions.`,unlocked:t=>`${t} — unlocked.`},e2={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:t=>`Set up ${t}`,sharedFolderBanner:t=>`Shared folder — consumed by ${t}`},t2={ownLabel:"Own",installedLabel:"Installed",globalLabel:"Global",emptyOwn:"No authored skills — run vskill new.",emptyInstalled:t=>`No skills installed for ${t} in this project — run vskill install.`,emptyGlobal:t=>`No global skills for ${t} — run vskill install --global.`},n2={compactLabel:"Uses your Claude Code session · overflow billed at API rates",tooltip:"vSkill delegates to the `claude` CLI — your existing Claude Code session handles quota. If you've enabled extra usage in your account settings, excess runs 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 existing session. No API key needed — vskill just runs the official claude binary on your behalf.",learnMore:"Learn more"},r2={title:t=>`Set up ${t}`,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."},a2={groupAvailable:"Available",groupAuthoring:"Authoring",sourceProject:"Project",sourcePersonal:"Personal",sourcePlugin:"Plugins",authoringSkills:"Skills"},l2={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 — your existing Claude Code session handles quota.",loginHint:"If you're not logged in, run claude in your terminal and authenticate with your Anthropic account.",learnMoreUrl:"https://docs.claude.com/en/docs/claude-code"}},ne={sidebar:US,shell:HS,detail:$S,actions:VS,palette:PS,shortcuts:FS,toasts:GS,connection:WS,forms:qS,errors:YS,picker:KS,providers:XS,models:QS,settings:ZS,statusBar:JS,scopePicker:e2,scopeSection:t2,claudeCodeLabel:n2,setupDrawer:r2,setupProviders:l2,scopeLabels:a2},s2=new Set(["claude-cli","claude-code"]);function Qx(t){return s2.has(t)}const Zx=new Set(["claude-cli","claude-code","anthropic","openai","openrouter","cursor","codex-cli","gemini-cli","copilot","zed"]);function i2({agents:t,activeAgentId:a,focusedAgentId:s,onFocus:o,onSelect:c,onOpenSettings:u}){const d=t.filter(g=>Zx.has(g.id)),h=t.filter(g=>!Zx.has(g.id));return r.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:[d.map(g=>r.jsx(Jx,{agent:g,isActive:g.id===a,isFocused:g.id===s,onFocus:o,onSelect:c,onOpenSettings:u},g.id)),h.length>0&&r.jsx("div",{style:{borderTop:"1px solid var(--border-default, var(--border-subtle))",margin:"4px 0"},"aria-hidden":"true"}),h.map(g=>r.jsx(Jx,{agent:g,isActive:g.id===a,isFocused:g.id===s,onFocus:o,onSelect:c,onOpenSettings:u},g.id))]})}function Jx({agent:t,isActive:a,isFocused:s,onFocus:o,onSelect:c,onOpenSettings:u}){const{providers:d}=ne,h={"claude-cli":d.claudeCli.caption,anthropic:d.anthropic.caption,openrouter:d.openrouter.caption},g={"claude-cli":{label:d.claudeCli.installCta,url:d.claudeCli.installUrl},cursor:{label:d.cursor.installCta},"codex-cli":{label:d.codexCli.installCta},"gemini-cli":{label:d.geminiCli.installCta},copilot:{label:d.copilot.installCta},zed:{label:d.zed.installCta}},m=Qx(t.id),y={minHeight:36,height:m?"auto":36,padding:m?"6px 12px":"0 12px",display:"flex",alignItems:"center",gap:8,cursor:"pointer",position:"relative",background:s?"var(--surface-muted, var(--surface-3))":"transparent",borderLeft:a?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",fontSize:13,fontWeight:a?500:400,color:"var(--text-primary)"};return a&&(y.background="color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)"),r.jsxs("div",{role:"option","aria-selected":a,"data-testid":`agent-row-${t.id}`,"data-focused":s||void 0,tabIndex:s?0:-1,onMouseEnter:()=>o(t.id),onFocus:()=>o(t.id),onClick:()=>c(t.id),style:y,children:[t.wrapperFolder&&r.jsx("span",{"data-testid":`wrapper-dot-${t.id}`,"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",flexShrink:0,background:t.wrapperFolderPresent?"var(--accent, var(--color-accent))":"transparent",border:t.wrapperFolderPresent?"none":"1px solid var(--border-default, var(--border-subtle))"}}),!t.wrapperFolder&&r.jsx("span",{style:{width:6,height:6,flexShrink:0},"aria-hidden":"true"}),r.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[r.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.displayName}),Qx(t.id)&&r.jsx("span",{"data-testid":"claude-code-billing-label",title:ne.claudeCodeLabel.tooltip,style:{fontSize:10,color:"var(--text-secondary, var(--text-tertiary))",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:1},children:ne.claudeCodeLabel.compactLabel})]}),r.jsx("span",{"aria-label":t.available?"available":"locked",style:{color:t.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0},children:t.available?r.jsx(Jd,{unlocked:!0,size:10}):r.jsx(Jd,{size:10})}),a&&r.jsx("span",{style:{fontSize:10,textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600,color:"var(--accent-ink, var(--accent))",flexShrink:0},"data-testid":`active-badge-${t.id}`,children:ne.picker.currentlyActive}),!t.available&&t.ctaType==="api-key"&&r.jsx(kd,{variant:"api-key",label:t.id==="anthropic"?d.anthropic.addKeyCta:d.openrouter.addKeyCta,onActivate:()=>u(t.id)}),!t.available&&t.ctaType==="cli-install"&&g[t.id]&&r.jsx(kd,{variant:"cli-install",label:g[t.id].label,installUrl:g[t.id].url,onActivate:()=>{}}),!t.available&&t.ctaType==="start-service"&&r.jsx(kd,{variant:"start-service",label:t.id==="ollama"?d.ollama.startServiceCta:d.lmStudio.startServiceCta,onActivate:()=>u(t.id)}),h[t.id]&&r.jsx("span",{className:"sr-only","data-testid":`caption-${t.id}`,children:h[t.id]})]})}function o2(t,a,s,o){const d=t>=80,h=p.useRef(null),[g,m]=p.useState(0),y=p.useCallback(S=>{m(S.currentTarget.scrollTop)},[]),{visibleStart:v,visibleEnd:b}=p.useMemo(()=>{if(!d)return{visibleStart:0,visibleEnd:t};const S=Math.max(0,Math.floor(g/a)-4),k=Math.ceil(s/a)+8,w=Math.min(t,S+k);return{visibleStart:S,visibleEnd:w}},[d,g,a,s,t,4]);return{visibleStart:v,visibleEnd:b,totalHeight:t*a,offsetTop:v*a,virtualised:d,containerProps:{onScroll:y,ref:h,style:{overflowY:"auto",maxHeight:s,willChange:d?"transform":void 0}}}}const Ov=44,c2=352,u2=60,eg=480;function d2(t){var u,d;const a=t.contextWindow?t.contextWindow>=1e6?`${Math.round(t.contextWindow/1e6)}M`:t.contextWindow>=1e3?`${Math.round(t.contextWindow/1e3)}k`:String(t.contextWindow):null;if(t.billingMode==="subscription")return a?`${a} ctx ${ne.models.subscriptionBilling}`:ne.models.subscriptionBilling.trim();if(t.billingMode==="free")return a?`local · ${a} ctx · free`:"local · free";const s=((u=t.pricing)==null?void 0:u.prompt)??0,o=((d=t.pricing)==null?void 0:d.completion)??0,c=`$${s.toFixed(2)} / $${o.toFixed(2)} per 1M tokens`;return a?`${a} ctx · ${c}`:c}function f2(t,a){if(!a)return t;const s=a.toLowerCase();return t.filter(c=>c.displayName.toLowerCase().includes(s)).sort((c,u)=>{const d=c.displayName.toLowerCase().indexOf(s),h=u.displayName.toLowerCase().indexOf(s);return d!==h?d-h:c.displayName.length-u.displayName.length})}function p2({agent:t,activeModelId:a,focusedIndex:s=-1,onSelect:o,onOpenSettings:c}){const[u,d]=p.useState(""),[h,g]=p.useState(""),m=p.useRef(null);if(p.useEffect(()=>{const b=setTimeout(()=>g(u),u2);return()=>clearTimeout(b)},[u]),p.useEffect(()=>{t.id==="openrouter"&&t.available&&m.current&&m.current.focus()},[t.id,t.available]),t.id==="openrouter"&&!t.available)return r.jsxs("div",{"data-testid":"openrouter-empty-card",style:{width:eg,padding:20,display:"flex",flexDirection:"column",gap:12},children:[r.jsx("p",{style:{margin:0,color:"var(--text-primary)",fontSize:13,lineHeight:1.5},children:ne.providers.openrouter.emptyCardBody}),r.jsx("button",{type:"button",onClick:()=>c("openrouter"),style:{alignSelf:"flex-start",padding:"6px 10px",borderRadius:6,background:"var(--accent, var(--color-accent))",color:"var(--bg-surface, white)",border:"none",fontSize:12,fontWeight:500,cursor:"pointer"},children:ne.providers.openrouter.addKeyCta})]});const y=p.useMemo(()=>f2(t.models,h),[t.models,h]),v=o2(y.length,Ov,c2);return r.jsxs("div",{role:"listbox","aria-label":"Model","data-testid":"model-list",style:{width:eg,display:"flex",flexDirection:"column"},children:[t.id==="openrouter"&&r.jsx("div",{style:{padding:8,borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:r.jsx("input",{ref:m,type:"text",placeholder:ne.picker.searchPlaceholder,value:u,onChange:b=>d(b.target.value),"data-testid":"model-search-input","aria-label":ne.picker.searchPlaceholder,style:{width:"100%",padding:"6px 8px",background:"var(--surface-2, var(--bg-surface))",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif"}})}),y.length===0&&h?r.jsxs("div",{style:{padding:16},"data-testid":"no-matches",children:[r.jsx("div",{style:{color:"var(--text-muted, var(--text-tertiary))",fontSize:12,marginBottom:8},children:ne.picker.noMatches(h)}),r.jsx("button",{type:"button",onClick:()=>d(""),style:{padding:"4px 8px",background:"transparent",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:ne.picker.clearSearch})]}):y.length===0?r.jsx("div",{style:{padding:16,color:"var(--text-muted, var(--text-tertiary))",fontSize:12},children:ne.picker.noModelsYet}):r.jsx("div",{...v.containerProps,children:r.jsx("div",{style:{height:v.virtualised?v.totalHeight:"auto",position:"relative"},children:r.jsx("div",{style:{transform:v.virtualised?`translateY(${v.offsetTop}px)`:void 0},children:y.slice(v.visibleStart,v.visibleEnd).map((b,S)=>{const k=v.visibleStart+S;return r.jsx(h2,{model:b,isActive:b.id===a,isFocused:s===k,onSelect:()=>o(b.id),resolvedModel:t.id==="claude-cli"?t.resolvedModel??null:null},b.id)})})})})]})}function m2(t,a,s){return a&&a.toLowerCase().includes(t.toLowerCase())?a:s??null}function h2({model:t,isActive:a,isFocused:s,onSelect:o,resolvedModel:c}){const u=d2(t),d=m2(t.id,c,t.resolvedId),h=d!==null,g=a?"color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)":s?"var(--surface-muted, var(--surface-3))":"transparent",m=a?"1px solid var(--accent, var(--color-accent))":"1px solid transparent";return r.jsxs("button",{type:"button",role:"option","aria-selected":a,"data-testid":`model-row-${t.id}`,"data-focused":s||void 0,onClick:o,title:t.id,style:{width:"100%",minHeight:Ov,padding:"4px 12px",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:2,background:g,borderLeft:m,cursor:"pointer",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",textAlign:"left"},children:[r.jsx("span",{style:{fontSize:14,fontWeight:500,color:"var(--text-primary)"},children:t.displayName}),r.jsx("span",{style:{fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace",fontVariantNumeric:"tabular-nums",color:"var(--text-muted, var(--text-tertiary))"},children:u}),h&&r.jsxs("span",{"data-testid":`model-row-${t.id}-resolved`,style:{fontSize:11,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace",color:"var(--text-muted, var(--text-tertiary))"},children:["routing to ",d]})]})}const tg={anthropic:{stored:!1,updatedAt:null},openai:{stored:!1,updatedAt:null},openrouter:{stored:!1,updatedAt:null}};function x2(){const[t,a]=p.useState(null),[s,o]=p.useState(!0),[c,u]=p.useState(null),d=p.useCallback(async()=>{o(!0);try{const m=await fetch("/api/settings/keys");if(!m.ok)throw new Error(`GET /api/settings/keys returned ${m.status}`);const y=await m.json();a({...tg,...y}),u(null)}catch(m){u(m.message),a(tg)}finally{o(!1)}},[]);p.useEffect(()=>{d()},[d]);const h=p.useCallback(async(m,y)=>{const v=await fetch("/api/settings/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:m,key:y})});if(!v.ok){const S=await v.json().catch(()=>({error:v.statusText}));throw new Error(S.error||`POST /api/settings/keys returned ${v.status}`)}const b=await v.json();return await d(),b},[d]),g=p.useCallback(async m=>{const y=await fetch(`/api/settings/keys/${m}`,{method:"DELETE"});if(!y.ok)throw new Error(`DELETE /api/settings/keys/${m} returned ${y.status}`);await d()},[d]);return{state:t,loading:s,error:c,save:h,remove:g,refresh:d}}function g2({onMigrated:t,fetchImpl:a}){const[s,o]=p.useState({kind:"loading"}),c=a??globalThis.fetch,u=p.useCallback(async()=>{var m;try{const y=await c("/api/settings/migration-status");if(!y.ok){o({kind:"hidden"});return}const v=await y.json();v.pending&&(((m=v.darwinKeys)==null?void 0:m.length)??0)>0?o({kind:"visible",darwinKeys:v.darwinKeys??[]}):o({kind:"hidden"})}catch{o({kind:"hidden"})}},[c]);p.useEffect(()=>{u()},[u]);const d=p.useCallback(async()=>{o({kind:"working"});try{const m=await c("/api/settings/migration-perform",{method:"POST",headers:{"Content-Type":"application/json"}});if(!m.ok){o({kind:"error",message:`Migration failed (${m.status})`});return}const y=await m.json().catch(()=>({migrated:[]}));t==null||t(y.migrated??[]),await u()}catch(m){o({kind:"error",message:m.message})}},[c,u,t]),h=p.useCallback(async()=>{o({kind:"hidden"});try{await c("/api/settings/migration-acknowledge",{method:"POST",headers:{"Content-Type":"application/json"}})}catch{}},[c]);if(s.kind==="loading"||s.kind==="hidden")return null;if(s.kind==="error")return r.jsxs("div",{role:"status","data-testid":"migration-banner",style:{padding:"10px 12px",borderRadius:6,background:"color-mix(in srgb, var(--danger, #b33) 15%, transparent)",color:"var(--text-primary)",fontSize:12,marginBottom:12,display:"flex",alignItems:"center",gap:8},children:[r.jsx("span",{style:{flex:1},children:s.message}),r.jsx("button",{type:"button",onClick:()=>void u(),"data-testid":"migration-retry",style:wd,children:"Retry"})]});const g=s.kind==="working";return r.jsxs("div",{role:"note","data-testid":"migration-banner",style:{padding:"10px 12px",borderRadius:6,background:"color-mix(in srgb, var(--accent, var(--color-accent)) 12%, transparent)",color:"var(--text-primary)",fontSize:12,marginBottom:12,display:"flex",alignItems:"center",gap:8},children:[r.jsxs("div",{style:{flex:1},children:[r.jsx("strong",{style:{display:"block",marginBottom:2},children:"Migrate from macOS Keychain"}),r.jsx("span",{style:{color:"var(--text-muted, var(--text-tertiary))"},children:"We found stored credentials from a previous vskill version. Import them into the new on-disk store."})]}),r.jsx("button",{type:"button",onClick:()=>void d(),disabled:g,"data-testid":"migration-migrate",style:{...wd,background:"var(--accent, var(--color-accent))",color:"white",opacity:g?.6:1},children:g?"Importing…":"Migrate"}),r.jsx("button",{type:"button",onClick:()=>void h(),"data-testid":"migration-dismiss",style:{...wd,background:"transparent",border:"none",color:"var(--text-muted, var(--text-tertiary))",textDecoration:"underline",padding:"4px 6px"},children:"Dismiss for 30 days"})]})}const wd={padding:"4px 10px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},v2=[{id:"anthropic",name:ne.providers.anthropic.name,keyIssuanceUrl:ne.providers.anthropic.keyIssuanceUrl,prefix:ne.providers.anthropic.keyPrefix,placeholder:`Paste ${ne.providers.anthropic.name} key`},{id:"openai",name:ne.providers.openai.name,keyIssuanceUrl:ne.providers.openai.keyIssuanceUrl,prefix:ne.providers.openai.keyPrefix,placeholder:ne.providers.openai.pastePlaceholder},{id:"openrouter",name:ne.providers.openrouter.name,keyIssuanceUrl:ne.providers.openrouter.keyIssuanceUrl,prefix:ne.providers.openrouter.keyPrefix,placeholder:`Paste ${ne.providers.openrouter.name} key`}];function y2(t){const a=Date.now()-new Date(t).getTime();return a<6e4?"just now":a<36e5?`${Math.round(a/6e4)}m ago`:a<864e5?`${Math.round(a/36e5)}h ago`:new Date(t).toLocaleString()}function Bv({open:t,onClose:a,initialProvider:s,onToast:o}){const{state:c,save:u,remove:d,refresh:h}=x2(),g=p.useRef(null),m=p.useRef(null),[y,v]=p.useState(null);p.useEffect(()=>{if(!t)return;let S=!1;return(async()=>{try{const k=await fetch("/api/settings/storage-path");if(!k.ok)throw new Error(`GET /api/settings/storage-path returned ${k.status}`);const w=await k.json();S||v(w.path??null)}catch{S||v(null)}})(),()=>{S=!0}},[t]),p.useEffect(()=>{if(!t)return;const S=document.activeElement,k=setTimeout(()=>{var T;const w=s?`input[data-provider="${s}"]`:"input[data-provider]",C=(T=g.current)==null?void 0:T.querySelector(w);C==null||C.focus()},0);return()=>{var w;clearTimeout(k),(w=S==null?void 0:S.focus)==null||w.call(S)}},[t,s]),p.useEffect(()=>{if(!t)return;const S=k=>{if(k.key==="Escape"){k.preventDefault(),a();return}if(k.key==="Tab"&&g.current){const w=g.current.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(w.length===0)return;const C=w[0],T=w[w.length-1];k.shiftKey&&document.activeElement===C?(k.preventDefault(),T.focus()):!k.shiftKey&&document.activeElement===T&&(k.preventDefault(),C.focus())}};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[t,a]);const b=p.useCallback(async()=>{var S,k;if(y)try{await((k=(S=navigator.clipboard)==null?void 0:S.writeText)==null?void 0:k.call(S,y)),o==null||o(ne.settings.pathCopied)}catch{}},[o,y]);return t?r.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"settings-modal-title","data-testid":"settings-modal",style:{position:"fixed",inset:0,background:"color-mix(in srgb, black 40%, transparent)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},onClick:S=>{S.target===S.currentTarget&&a()},children:r.jsxs("div",{ref:g,style:{background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,width:560,maxHeight:"80vh",overflowY:"auto",padding:20,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",color:"var(--text-primary)"},onClick:S=>S.stopPropagation(),children:[r.jsx("h2",{id:"settings-modal-title",style:{margin:"0 0 16px 0",fontSize:16,fontWeight:600},children:ne.settings.title}),r.jsx(g2,{onMigrated:()=>{h()}}),r.jsx("div",{role:"note","data-testid":"settings-banner",style:{padding:"8px 12px",borderRadius:6,background:"color-mix(in srgb, var(--info, var(--accent-muted)) 20%, transparent)",color:"var(--text-primary)",fontSize:12,marginBottom:16},children:ne.settings.banner}),r.jsxs("section",{"aria-labelledby":"settings-api-keys-title",style:{marginBottom:20},children:[r.jsx("h3",{id:"settings-api-keys-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:ne.settings.sectionApiKeys}),v2.map(S=>r.jsx(b2,{providerId:S.id,providerName:S.name,keyIssuanceUrl:S.keyIssuanceUrl,prefix:S.prefix,placeholder:S.placeholder,metadata:c==null?void 0:c[S.id],onSave:async k=>{const w=await u(S.id,k);return o==null||o(ne.settings.keySaved(S.name)),w},onRemove:async()=>{await d(S.id),o==null||o(ne.settings.keyRemoved(S.name))},inputRef:S.id===(s??"anthropic")?m:void 0},S.id))]}),r.jsxs("div",{"data-testid":"settings-storage-path",style:{fontSize:11,color:"var(--text-muted, var(--text-tertiary))",fontStyle:"italic",display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[r.jsx("span",{style:{flex:1},children:y?ne.settings.storagePath(y):ne.settings.storagePathFallback}),r.jsx("button",{type:"button",onClick:b,disabled:!y,"data-testid":"settings-copy-path",style:{...Ba,opacity:y?1:.5,cursor:y?"pointer":"not-allowed"},children:ne.settings.copyPath})]}),r.jsx("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end"},children:r.jsx("button",{type:"button",onClick:a,style:{padding:"6px 12px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:"Close"})})]})}):null}function b2({providerId:t,providerName:a,keyIssuanceUrl:s,prefix:o,placeholder:c,metadata:u,onSave:d,onRemove:h,inputRef:g}){const[m,y]=p.useState(""),[v,b]=p.useState(!1),[S,k]=p.useState(!1),[w,C]=p.useState(!1),[T,N]=p.useState(null),A=m.trim(),_=A.length===0,D=A.length>0&&!A.startsWith(o),F=p.useCallback(async()=>{if(_)return;k(!0);const L=A;y("");try{const U=await d(L);U.warning?N(U.warning):N(null)}finally{k(!1)}},[_,d,A]),E=p.useCallback(async()=>{var L;try{if(!((L=navigator.clipboard)!=null&&L.readText))return;const U=await navigator.clipboard.readText();y(U)}catch{}},[]),B=p.useCallback(async()=>{C(!1),await h()},[h]);return r.jsxs("div",{"data-testid":`provider-row-${t}`,style:{padding:12,border:"1px solid var(--border-subtle)",borderRadius:6,marginBottom:8,display:"flex",flexDirection:"column",gap:8},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsx("strong",{style:{fontSize:13},children:a}),r.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",style:{fontSize:12,color:"var(--accent, var(--color-accent))"},children:"Get a key →"})]}),r.jsxs("div",{style:{display:"flex",gap:6},children:[r.jsx("input",{ref:g,type:v?"text":"password",value:m,onChange:L=>{y(L.target.value),N(null)},"data-provider":t,placeholder:c,style:{flex:1,padding:"6px 8px",border:"1px solid var(--border-subtle)",borderRadius:4,background:"var(--surface-2, var(--bg-surface))",color:"var(--text-primary)",fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"}}),r.jsx("button",{type:"button",onClick:()=>b(!v),style:Ba,children:v?ne.settings.hide:ne.settings.show}),r.jsx("button",{type:"button",onClick:E,style:Ba,children:ne.settings.paste})]}),D&&r.jsx("div",{role:"status","data-testid":`prefix-warn-${t}`,style:ng,children:ne.settings.prefixWarn(a)}),T&&r.jsx("div",{role:"status",style:ng,children:T}),r.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[r.jsx("button",{type:"button",onClick:F,disabled:_||S,"data-testid":`save-${t}`,style:{...Ba,background:_?"var(--surface-2)":"var(--accent, var(--color-accent))",color:_?"var(--text-muted)":"white",cursor:_?"not-allowed":"pointer"},children:ne.settings.save}),(u==null?void 0:u.stored)&&r.jsx(r.Fragment,{children:w?r.jsxs(r.Fragment,{children:[r.jsx("span",{style:{fontSize:12},children:ne.settings.removeConfirm(a)}),r.jsx("button",{type:"button",onClick:B,"data-testid":`remove-confirm-${t}`,style:{...Ba,background:"var(--danger, #b33)",color:"white"},children:"Confirm"}),r.jsx("button",{type:"button",onClick:()=>C(!1),style:Ba,children:"Cancel"})]}):r.jsx("button",{type:"button",onClick:()=>C(!0),"data-testid":`remove-${t}`,style:{...Ba,color:"var(--text-muted)"},children:ne.settings.remove})}),r.jsx("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},"data-testid":`status-${t}`,children:u!=null&&u.stored&&u.updatedAt?ne.settings.keyStoredAt(y2(u.updatedAt)):ne.settings.noKey})]})]})}const Ba={padding:"4px 8px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},ng={fontSize:11,color:"var(--warning, var(--text-muted))"};function j2(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function S2({onToast:t}){const{status:a,catalog:s,focusAgent:o,setActive:c}=IS({onStaleCatalog:(U,$)=>{const q=Math.round($/6e4);t==null||t(`Using cached ${U} catalog (${q} min old)`)},onSetActiveError:U=>t==null?void 0:t(U)}),[u,d]=p.useState(!1),[h,g]=p.useState(!1),[m,y]=p.useState(),[v,b]=p.useState(null),[S,k]=p.useState("agents"),[w,C]=p.useState(0),T=p.useRef(null);p.useRef(null),p.useEffect(()=>{var U;s&&!v&&b(s.activeAgent??((U=s.agents[0])==null?void 0:U.id)??null)},[s,v]);const N=(s==null?void 0:s.agents)??[],A=p.useMemo(()=>N.find(U=>U.id===v)??N[0],[N,v]);p.useEffect(()=>{C(0)},[v]);const _=p.useCallback(()=>{var U;d(!0),k("agents"),b((s==null?void 0:s.activeAgent)??((U=N[0])==null?void 0:U.id)??null),C(0)},[s,N]),D=p.useCallback(()=>{var U;d(!1),(U=T.current)==null||U.focus()},[]);p.useEffect(()=>{const U=$=>{var X;if(!($.metaKey||$.ctrlKey)||$.key.toLowerCase()!=="k")return;const q=(X=document.activeElement)==null?void 0:X.tagName;q==="INPUT"||q==="TEXTAREA"||($.preventDefault(),d(ee=>!ee))};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[]),p.useEffect(()=>{if(!u)return;const U=q=>{if(q.key==="Escape"){q.preventDefault(),D();return}if(q.key==="ArrowDown"){q.preventDefault(),$(1);return}if(q.key==="ArrowUp"){q.preventDefault(),$(-1);return}if(q.key==="ArrowRight"&&S==="agents"){q.preventDefault(),k("models"),C(X=>{const ee=((A==null?void 0:A.models.length)??1)-1;return Math.max(0,Math.min(X,Math.max(0,ee)))});return}if(q.key==="ArrowLeft"&&S==="models"){q.preventDefault(),k("agents");return}if(q.key==="Enter"){if(q.preventDefault(),S==="agents"&&A)k("models"),C(0);else if(S==="models"&&A){const X=Math.max(0,Math.min(A.models.length-1,w)),ee=A.models[X];ee&&(c(A.id,ee.id),D())}return}};function $(q){if(S==="agents"){const X=N.findIndex(I=>I.id===v),ee=N[Math.max(0,Math.min(N.length-1,X+q))];ee&&(b(ee.id),o(ee.id));return}if(S==="models"&&A){const X=A.models.length;if(X===0)return;C(ee=>{const I=ee+q;return Math.max(0,Math.min(X-1,I))})}}return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[u,S,N,v,A,w,D,o,c]);const F=p.useCallback(U=>{y(U==="anthropic"||U==="openrouter"?U:void 0),g(!0),d(!1)},[]),E=N.find(U=>U.id===(s==null?void 0:s.activeAgent)),B=E==null?void 0:E.models.find(U=>U.id===(s==null?void 0:s.activeModel)),L=p.useMemo(()=>{if(a!=="ready"||!s)return"Loading…";const U=(E==null?void 0:E.displayName)??"Agent",$=(B==null?void 0:B.displayName)??s.activeModel??"Model";return`${U} · ${$}`},[a,s,E,B]);return r.jsxs(r.Fragment,{children:[r.jsxs("button",{ref:T,type:"button","data-testid":"agent-model-picker-trigger",onClick:()=>u?D():_(),"aria-haspopup":"listbox","aria-expanded":u,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:[r.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:E!=null&&E.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0}}),r.jsx("span",{children:L})]}),u&&typeof document<"u"&&Go.createPortal(r.jsxs(k2,{reducedMotion:j2(),onClickOutside:D,children:[r.jsxs("div",{style:{display:"flex",height:440,maxHeight:"60vh"},children:[r.jsx(i2,{agents:N,activeAgentId:(s==null?void 0:s.activeAgent)??null,focusedAgentId:v,onFocus:U=>{b(U),o(U)},onSelect:U=>{b(U),o(U),k("models")},onOpenSettings:F}),A&&r.jsx(p2,{agent:A,activeModelId:(s==null?void 0:s.activeModel)??null,focusedIndex:S==="models"?w:-1,onSelect:U=>{c(A.id,U),D()},onOpenSettings:F})]}),r.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:[r.jsx("button",{type:"button",onClick:()=>F(),"data-testid":"picker-footer-settings",style:{background:"transparent",border:"none",color:"var(--text-primary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:ne.picker.settingsButton}),r.jsx("span",{style:{fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"},children:ne.picker.footerHint})]})]}),document.body),r.jsx(Bv,{open:h,onClose:()=>g(!1),initialProvider:m,onToast:t})]})}function k2({children:t,reducedMotion:a,onClickOutside:s}){const o=p.useRef(null);return p.useEffect(()=>{const c=u=>{o.current&&!o.current.contains(u.target)&&s()};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]),r.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:720,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,overflow:"hidden",zIndex:90,animation:a?void 0:"agentPickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[t,r.jsx("style",{children:`@keyframes agentPickerFadeIn {
|
|
63
63
|
from { opacity: 0; transform: translateX(-50%) translateY(2px); }
|
|
64
64
|
to { opacity: 1; transform: translateX(-50%) translateY(0); }
|
|
65
|
-
}`})]})}function ng(){typeof window>"u"||(window.location.hash="#/")}function S2({onHome:t}){const[a,s]=p.useState(!1),[o,c]=p.useState(!1),u=h=>{h.metaKey||h.ctrlKey||h.shiftKey||h.button!==0||(h.preventDefault(),ng(),t==null||t())},d=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),ng(),t==null||t())};return r.jsxs("a",{href:"#/",role:"link","data-testid":"studio-logo","aria-label":"Skill Studio — home",onClick:u,onKeyDown:d,onFocus:()=>s(!0),onBlur:()=>s(!1),onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),style:{display:"inline-flex",alignItems:"center",gap:10,flexShrink:0,padding:"4px 6px",margin:"-4px -6px",borderRadius:6,textDecoration:"none",color:"inherit",cursor:"pointer",outline:a?"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:[r.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:r.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:r.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}),r.jsx("span",{style:{fontSize:13,fontWeight:600,letterSpacing:"-0.01em",color:"var(--text-primary)"},children:"Skill Studio"})]})}const rg=p.memo(function({message:a,politeness:s="polite",role:o}){const c=o??(s==="assertive"?"alert":"status");return r.jsx("div",{"aria-live":s,"aria-atomic":"true",role:c,"data-testid":"aria-live","data-politeness":s,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0,padding:0,margin:-1},children:a})});function k2({toast:t,onDismiss:a}){const[s,o]=p.useState(!0),c=p.useRef(null);p.useEffect(()=>(c.current=requestAnimationFrame(()=>{c.current=requestAnimationFrame(()=>o(!1))}),()=>{c.current!=null&&cancelAnimationFrame(c.current)}),[]);const u={success:"var(--status-installed)",info:"var(--text-secondary)",error:"var(--color-accent, var(--accent-surface))"};return r.jsxs("div",{role:t.severity==="error"?"alert":"status","data-testid":"toast-item","data-severity":t.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 ${u[t.severity]}`,borderRadius:6,boxShadow:"0 8px 24px rgba(0,0,0,0.12)",fontFamily:"var(--font-sans)",fontSize:12,transform:s?"translateY(8px)":"translateY(0)",opacity:s?0:1,transition:"transform var(--duration-base, 180ms) var(--ease-standard, ease), opacity var(--duration-base, 180ms) var(--ease-standard, ease)"},children:[r.jsx("span",{style:{flex:1,minWidth:0},children:t.message}),t.action&&r.jsx("button",{type:"button",onClick:()=>{t.action.onInvoke(),a(t.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:t.action.label}),r.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>a(t.id),style:{background:"transparent",border:"none",padding:2,color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1},children:"×"})]})}function w2({toasts:t,onDismiss:a,liveMessage:s,liveAssertiveMessage:o}){return r.jsxs(r.Fragment,{children:[r.jsx(rg,{politeness:"polite",message:s}),r.jsx(rg,{politeness:"assertive",message:o}),t.length>0&&r.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:t.map(c=>r.jsx("div",{style:{pointerEvents:"auto"},children:r.jsx(k2,{toast:c,onDismiss:a})},c.id))})]})}const Bv=p.createContext(null);function Wo(){const t=p.useContext(Bv);if(!t)throw new Error("useToast must be used inside <ToastProvider>.");return t}function C2({children:t,maxVisible:a=4,defaultDurationMs:s=4e3}){const[o,c]=p.useState([]),[u,d]=p.useState(""),[h,g]=p.useState(""),m=p.useRef(new Map),y=p.useCallback(E=>{const T=m.current.get(E);T&&(clearTimeout(T),m.current.delete(E)),c(N=>N.filter(A=>A.id!==E))},[]),v=p.useCallback((E,T)=>{if(T<=0)return;const N=setTimeout(()=>{y(E)},T);m.current.set(E,N)},[y]),b=p.useCallback(E=>{const T=E.id??`toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,N={id:T,message:E.message,severity:E.severity??"info",durationMs:E.durationMs??s,action:E.action};return c(A=>[...A,N]),N.severity==="error"?g(N.message):d(N.message),v(T,N.durationMs),T},[s,v]),S=p.useCallback(()=>{for(const E of m.current.values())clearTimeout(E);m.current.clear(),c([])},[]);p.useEffect(()=>{function E(T){T.key==="Escape"&&c(N=>{if(N.length===0)return N;const A=N.slice(0,a),_=A[A.length-1],D=m.current.get(_.id);return D&&(clearTimeout(D),m.current.delete(_.id)),N.filter(F=>F.id!==_.id)})}return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[a]),p.useEffect(()=>()=>{for(const E of m.current.values())clearTimeout(E);m.current.clear()},[]);const k=o.slice(0,a),w=p.useMemo(()=>({toast:b,dismiss:y,clear:S}),[b,y,S]);return r.jsxs(Bv.Provider,{value:w,children:[t,r.jsx(w2,{toasts:k,onDismiss:y,liveMessage:u,liveAssertiveMessage:h})]})}const E2="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",N2=p.lazy(()=>Ha(()=>import("./UpdateDropdown-C6b6HzFl.js"),__vite__mapDeps([0,1])));function T2(){const{updateCount:t,updates:a,isRefreshingUpdates:s,refreshUpdates:o,selectSkill:c,revealSkill:u,skills:d,updatesById:h,activeAgent:g}=er(),{toast:m}=Wo(),y=p.useMemo(()=>{if(!h||h.size===0)return;const N=new Map;for(const[A,_]of h)_.diffSummary&&N.set(A,_.diffSummary);return N.size>0?N:void 0},[h]),[v,b]=p.useState(!1),S=p.useRef(null),k=p.useCallback(()=>b(!1),[]),w=t>0?"var(--text-primary)":"var(--text-secondary)",E=t>9?"9+":String(t),T=t===0?"No updates available":`${t} updates available, open summary`;return r.jsxs("span",{"data-testid":"update-bell-anchor",style:{position:"relative",display:"inline-flex"},children:[r.jsxs("button",{ref:S,type:"button","data-testid":"update-bell","aria-label":T,"aria-haspopup":"dialog","aria-expanded":v,onClick:()=>b(N=>!N),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:w,cursor:"pointer"},children:[r.jsx("img",{src:E2,alt:"",width:18,height:18,style:{display:"block",opacity:t>0?1:.75}}),t>0&&r.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:E})]}),v&&r.jsx(p.Suspense,{fallback:r.jsx("span",{"data-testid":"update-bell-fallback",children:"Loading…"}),children:r.jsx(N2,{updates:a,isRefreshing:s,diffSummariesById:y,onRefresh:()=>o(),onSelectSkill:N=>{const A=N.localSkill??N.name.split("/").pop()??"",_=N.localPlugin??"";if(u)u(_,A);else{const F=N.name.split("/"),C=F.length>=2?F[F.length-2]:F[0];c({plugin:C,skill:A,origin:"installed"})}if(!(d??[]).some(F=>F.skill===A&&(_===""||F.plugin===_))){const F=N.installLocations??[];if(F.length>0){const C=g?F.filter(L=>L.agent===g):[],B=g?F.filter(L=>L.agent!==g):F;if(C.length>0&&B.length>0){const L=B.length>=2?`Also installed under ${B.length} other locations.`:`Also installed under ${B[0].agentLabel}.`;m({severity:"info",message:L})}else{const L=F[0].agentLabel;m({severity:"info",message:`Skill installed under ${L} — switch to ${L} to view details.`})}}}k()},onViewAll:()=>{window.location.hash="#/updates",k()},onClose:k,anchorRef:S})})]})}function ag(t){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:navigate-scope",{detail:t}))}function R2({projectName:t,selected:a,onOpenPalette:s,onHome:o,projectPickerSlot:c,onRequestCreateSkill:u,findSkillsSlot:d}){const h=a?a.origin==="installed"?"Project":"Skills":null;return r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,height:"100%",width:"100%",padding:"0 16px",fontFamily:"var(--font-sans)"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexShrink:0},children:[r.jsx(S2,{onHome:o}),c?r.jsx("div",{style:{borderLeft:"1px solid var(--border-default)",paddingLeft:10,display:"flex",alignItems:"center"},children:c}):t&&r.jsx("span",{title:t,style:{fontSize:12,color:"var(--text-secondary)",borderLeft:"1px solid var(--border-default)",paddingLeft:10,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t})]}),r.jsx("nav",{"aria-label":"Breadcrumb",style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:6,fontSize:12,color:"var(--text-secondary)"},children:a&&h&&r.jsxs(r.Fragment,{children:[r.jsx(lg,{segment:"origin",onClick:()=>ag({scope:"origin",origin:a.origin}),style:{textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:a.origin==="installed"?"var(--status-installed)":"var(--status-own)"},children:h}),r.jsx(sg,{}),r.jsx(lg,{segment:"plugin",onClick:()=>ag({scope:"plugin",plugin:a.plugin}),style:{fontFamily:"var(--font-mono)",fontSize:11},children:a.plugin}),r.jsx(sg,{}),r.jsx("span",{"data-breadcrumb-segment":"skill","aria-current":"page",style:{color:"var(--text-primary)",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.skill})]})}),r.jsxs("div",{"data-toprail-right":"true",style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[d,u&&r.jsxs("button",{type:"button","data-slot":"create-skill-button",onClick:u,"aria-label":"Create a new skill",title:"Create a new skill",style:{display:"inline-flex",alignItems:"center",gap:6,height:28,padding:"0 12px",borderRadius:6,border:"1px solid var(--color-action, #2F5B8E)",background:"var(--color-action, #2F5B8E)",color:"var(--color-action-ink, #FFFFFF)",fontSize:12,fontWeight:600,fontFamily:"var(--font-sans)",cursor:"pointer",letterSpacing:"0.01em",boxShadow:"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)"},children:[r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[r.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),r.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"New Skill"]}),r.jsx("span",{"data-slot":"agent-model-picker",style:{minWidth:200},children:r.jsx(b2,{})}),r.jsx("span",{"data-slot":"update-bell",style:{display:"inline-flex"},children:r.jsx(T2,{})}),r.jsx("button",{type:"button",onClick:s,"aria-label":"Open command palette",title:"Command palette (⌘K)",style:{display:"inline-flex",alignItems:"center",gap:6,height:26,padding:"0 10px",borderRadius:4,border:"1px solid var(--border-default)",background:"transparent",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono)",cursor:"pointer"},children:r.jsx("span",{children:"⌘K"})})]})]})}function lg({segment:t,onClick:a,style:s,children:o}){return r.jsx("button",{type:"button","data-breadcrumb-segment":t,onClick:a,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",color:"var(--text-secondary)",fontFamily:"inherit",...s},onMouseEnter:c=>{c.currentTarget.style.color="var(--color-accent-ink)"},onMouseLeave:c=>{const u=(s==null?void 0:s.color)??"var(--text-secondary)";c.currentTarget.style.color=u},children:o})}function sg(){return r.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)",fontSize:10},children:"›"})}const qo="vskill-theme";function Iv(t){return t==="light"||t==="dark"||t==="auto"?t:"auto"}function A2(t,a){return t==="light"||t==="dark"?t:a?"dark":"light"}function M2(t){try{const a=t.getItem(qo);return Iv(a)}catch{return"auto"}}function L2(t,a){try{t.setItem(qo,a)}catch{}}function z2(t,a,s){t.dataset.theme=s,t.dataset.themeMode=a}function D2(t){if(!t)return!1;try{return t("(prefers-color-scheme: dark)").matches}catch{return!1}}const Uv=p.createContext(null);function _2({storage:t,matchMedia:a,target:s,children:o}){const c=t??(typeof window<"u"?window.localStorage:void 0),u=a??(typeof window<"u"?window.matchMedia.bind(window):void 0),d=s??(typeof document<"u"?document.documentElement:void 0),[h,g]=p.useState(()=>c?M2(c):"auto"),[m,y]=p.useState(()=>D2(u)),v=p.useMemo(()=>A2(h,m),[h,m]);p.useEffect(()=>{d&&z2(d,h,v)},[d,h,v]),p.useEffect(()=>{if(!u)return;const k=u("(prefers-color-scheme: dark)"),w=T=>y(T.matches);if(typeof k.addEventListener=="function")return k.addEventListener("change",w),()=>k.removeEventListener("change",w);const E=k;return E.addListener(w),()=>E.removeListener(w)},[u]),p.useEffect(()=>{if(typeof window>"u")return;const k=w=>{w.key===qo&&g(Iv(w.newValue))};return window.addEventListener("storage",k),()=>window.removeEventListener("storage",k)},[]),p.useEffect(()=>{if(!u||!d)return;let k;try{k=u("(prefers-contrast: more)")}catch{return}const w=N=>{N?d.dataset.contrast="more":d.dataset.contrast==="more"&&delete d.dataset.contrast};w(k.matches);const E=N=>w(N.matches);if(typeof k.addEventListener=="function")return k.addEventListener("change",E),()=>k.removeEventListener("change",E);const T=k;return T.addListener(E),()=>T.removeListener(E)},[u,d]);const b=p.useCallback(k=>{g(k),c&&L2(c,k)},[c]),S=p.useMemo(()=>({mode:h,resolvedTheme:v,setTheme:b}),[h,v,b]);return r.jsx(Uv.Provider,{value:S,children:o})}function Hv(){const t=p.useContext(Uv);if(!t)throw new Error("useTheme must be used inside <ThemeProvider>. Wrap the app root in main.tsx.");return t}const ig=["claude-cli","anthropic","openrouter","ollama","lm-studio"];function O2(t){const a=new Map(t.map(o=>[o.id,o])),s=[];for(const o of ig){const c=a.get(o);c&&s.push(c)}for(const o of t)ig.includes(o.id)||s.push(o);return s}function B2(t){const[a,s]=p.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(`(max-width: ${t}px)`).matches);return p.useEffect(()=>{var u;if(typeof window>"u"||!window.matchMedia)return;const o=window.matchMedia(`(max-width: ${t}px)`),c=()=>s(o.matches);return(u=o.addEventListener)==null||u.call(o,"change",c),()=>{var d;return(d=o.removeEventListener)==null?void 0:d.call(o,"change",c)}},[t]),a}function I2({providers:t,onOpenSettings:a,onOpenInstallHelp:s}){const o=O2(t),c=B2(640),[u,d]=p.useState(!1),h=p.useCallback(g=>{g.available||g.kind==="api-key"?a==null||a(g.id):s==null||s(g.id)},[a,s]);if(c){const g=o.filter(m=>m.available).length;return r.jsxs("div",{"data-testid":"providers-segment",style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[r.jsx("button",{type:"button","data-testid":"providers-summary",onClick:()=>d(!u),"aria-label":ne.statusBar.providerSummary(g,o.length),style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:ne.statusBar.providerSummary(g,o.length)}),u&&r.jsx("div",{role:"menu",style:{position:"absolute",bottom:"120%",right:0,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,padding:6,minWidth:180,display:"flex",flexDirection:"column",gap:2,zIndex:80},children:o.map(m=>r.jsx(og,{p:m,onClick:h},m.id))})]})}return r.jsx("div",{"data-testid":"providers-segment",style:{display:"inline-flex",alignItems:"center",gap:4},children:o.map(g=>r.jsx(og,{p:g,onClick:h,compact:!0},g.id))})}function og({p:t,onClick:a,compact:s}){const o=t.available?ne.statusBar.unlocked(t.label):t.kind==="cli-install"?ne.statusBar.lockedCli(t.label):ne.statusBar.locked(t.label);return r.jsxs("button",{type:"button","data-testid":`provider-glyph-${t.id}`,"data-available":t.available,"aria-label":o,title:o,onClick:()=>a(t),style:{display:"inline-flex",alignItems:"center",gap:4,background:"transparent",border:"none",color:t.available?"var(--status-installed)":"var(--text-muted, var(--text-tertiary))",cursor:"pointer",padding:s?"2px":"4px 6px",fontSize:11},children:[r.jsx(Zd,{unlocked:t.available,size:10}),!s&&r.jsx("span",{children:t.label})]})}function U2(){try{return typeof localStorage>"u"?null:localStorage.getItem(qo)}catch{return null}}function H2({projectPath:t,modelName:a,health:s="ok",onPathClick:o,providers:c,onOpenProviderSettings:u,onOpenProviderInstallHelp:d}){const{mode:h,resolvedTheme:g,setTheme:m}=Hv(),v=U2()==="auto",b=$2(h,g,v),S=s==="down"||s==="degraded"?"var(--status-own)":"var(--status-installed)";return r.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:[r.jsx("span",{title:a??"",style:{fontFamily:"var(--font-mono)"},children:a??"—"}),r.jsx(cg,{}),r.jsxs("span",{"aria-label":`Health: ${s}`,style:{display:"inline-flex",alignItems:"center",gap:6},children:[r.jsx(V2,{color:S}),r.jsx("span",{style:{textTransform:"capitalize"},children:s})]}),c&&c.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(cg,{}),r.jsx(I2,{providers:c,onOpenSettings:u,onOpenInstallHelp:d})]}),r.jsx("div",{style:{flex:1}}),r.jsxs("button",{type:"button","data-testid":"theme-toggle",onClick:()=>m(b),"aria-label":`Switch to ${b} theme`,title:`Theme: ${h} — click for ${b}`,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:[r.jsx(P2,{mode:h}),r.jsx("span",{style:{textTransform:"capitalize"},children:h})]})]})}function $2(t,a,s){return t==="light"?"dark":t==="dark"?"auto":s?"light":a==="light"?"dark":"light"}function V2({color:t}){return r.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:t,display:"inline-block",flexShrink:0}})}function cg(){return r.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)"},children:"|"})}function P2({mode:t}){return t==="dark"?r.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}):t==="light"?r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("circle",{cx:"12",cy:"12",r:"4"}),r.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"})]}):r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("circle",{cx:"12",cy:"12",r:"9"}),r.jsx("path",{d:"M12 3a9 9 0 0 0 0 18z",fill:"currentColor"})]})}const Jd=new Set;function $v(){for(const t of Jd)t()}const F2=5,G2=1e3,W2=6e4;function q2(){const[t,a]=p.useState(void 0),[s,o]=p.useState(!1),[c,u]=p.useState(!0),d=p.useRef(0),h=p.useRef(null),g=p.useRef(null),m=p.useRef(!0),y=p.useRef(0),[v,b]=p.useState(0),S=()=>{g.current!==null&&(clearTimeout(g.current),g.current=null)},k=p.useCallback(()=>{h.current&&(h.current.abort(),h.current=null)},[]),w=p.useCallback(async()=>{if(!m.current||document.visibilityState==="hidden")return;k();const T=new AbortController;h.current=T;try{const N=await fetch("/api/plugins",{signal:T.signal});if(!m.current)return;const A=await N.json();if(!m.current)return;d.current=0,a(A.plugins??[]),u(!1),o(!1),g.current=setTimeout(()=>{m.current&&b(_=>_+1)},W2)}catch(N){if(!m.current||N instanceof DOMException&&N.name==="AbortError")return;if(d.current+=1,u(!1),d.current>F2){o(!0);return}const A=G2*Math.pow(2,d.current-1);g.current=setTimeout(()=>{m.current&&b(_=>_+1)},A)}},[k]);p.useEffect(()=>(m.current=!0,()=>{m.current=!1,S(),k()}),[k]),p.useEffect(()=>{document.visibilityState!=="hidden"&&(S(),w())},[v,w]),p.useEffect(()=>{const T=()=>{document.visibilityState==="hidden"?(S(),k()):(d.current=0,o(!1),b(N=>N+1))};return document.addEventListener("visibilitychange",T),()=>{document.removeEventListener("visibilitychange",T)}},[k]);const E=p.useCallback(()=>{d.current=0,o(!1),S(),y.current+=1,b(T=>T+1)},[]);return p.useEffect(()=>(Jd.add(E),()=>{Jd.delete(E)}),[E]),{plugins:t,paused:s,loading:c,retry:E}}const Yo=0,oa=1,Bl=2,Vv=4;function ug(t){return()=>t}function Y2(t){t()}function Pv(t,a){return s=>t(a(s))}function dg(t,a){return()=>t(a)}function K2(t,a){return s=>t(a,s)}function jf(t){return t!==void 0}function X2(...t){return()=>{t.map(Y2)}}function Il(){}function Ko(t,a){return a(t),t}function Q2(t,a){return a(t)}function jt(...t){return t}function at(t,a){return t(oa,a)}function Fe(t,a){t(Yo,a)}function Sf(t){t(Bl)}function wt(t){return t(Vv)}function Te(t,a){return at(t,K2(a,Yo))}function Qn(t,a){const s=t(oa,o=>{s(),a(o)});return s}function fg(t){let a,s;return o=>c=>{a=c,s&&clearTimeout(s),s=setTimeout(()=>{o(a)},t)}}function Fv(t,a){return t===a}function bt(t=Fv){let a;return s=>o=>{t(a,o)||(a=o,s(o))}}function _e(t){return a=>s=>{t(s)&&a(s)}}function ke(t){return a=>Pv(a,t)}function or(t){return a=>()=>{a(t)}}function me(t,...a){const s=Z2(...a);return((o,c)=>{switch(o){case Bl:Sf(t);return;case oa:return at(t,s(c))}})}function cr(t,a){return s=>o=>{s(a=t(a,o))}}function Ua(t){return a=>s=>{t>0?t--:a(s)}}function Ar(t){let a=null,s;return o=>c=>{a=c,!s&&(s=setTimeout(()=>{s=void 0,o(a)},t))}}function Ge(...t){const a=new Array(t.length);let s=0,o=null;const c=2**t.length-1;return t.forEach((u,d)=>{const h=2**d;at(u,g=>{const m=s;s|=h,a[d]=g,m!==c&&s===c&&o&&(o(),o=null)})}),u=>d=>{const h=()=>{u([d].concat(a))};s===c?h():o=h}}function Z2(...t){return a=>t.reduceRight(Q2,a)}function J2(t){let a,s;const o=()=>a==null?void 0:a();return function(c,u){switch(c){case oa:return u?s===u?void 0:(o(),s=u,a=at(t,u),a):(o(),Il);case Bl:o(),s=null;return}}}function ge(t){let a=t;const s=Ze();return((o,c)=>{switch(o){case Yo:a=c;break;case oa:{c(a);break}case Vv:return a}return s(o,c)})}function rn(t,a){return Ko(ge(a),s=>Te(t,s))}function Ze(){const t=[];return((a,s)=>{switch(a){case Yo:t.slice().forEach(o=>{o(s)});return;case Bl:t.splice(0,t.length);return;case oa:return t.push(s),()=>{const o=t.indexOf(s);o>-1&&t.splice(o,1)}}})}function Nn(t){return Ko(Ze(),a=>Te(t,a))}function tt(t,a=[],{singleton:s}={singleton:!0}){return{constructor:t,dependencies:a,id:ek(),singleton:s}}const ek=()=>Symbol();function tk(t){const a=new Map,s=({constructor:o,dependencies:c,id:u,singleton:d})=>{if(d&&a.has(u))return a.get(u);const h=o(c.map(g=>s(g)));return d&&a.set(u,h),h};return s(t)}function It(...t){const a=Ze(),s=new Array(t.length);let o=0;const c=2**t.length-1;return t.forEach((u,d)=>{const h=2**d;at(u,g=>{s[d]=g,o|=h,o===c&&Fe(a,s)})}),function(u,d){switch(u){case Bl:{Sf(a);return}case oa:return o===c&&d(s),at(a,d)}}}function De(t,a=Fv){return me(t,bt(a))}function ef(...t){return function(a,s){switch(a){case Bl:return;case oa:return X2(...t.map(o=>at(o,s)))}}}const Pt={DEBUG:0,INFO:1,WARN:2,ERROR:3},nk={[Pt.DEBUG]:"debug",[Pt.ERROR]:"error",[Pt.INFO]:"log",[Pt.WARN]:"warn"},rk=()=>typeof globalThis>"u"?window:globalThis,ca=tt(()=>{const t=ge(Pt.ERROR);return{log:ge((a,s,o=Pt.INFO)=>{const c=rk().VIRTUOSO_LOG_LEVEL??wt(t);o>=c&&console[nk[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",a,s)}),logLevel:t}},[],{singleton:!0});function Va(t,a,s){return kf(t,a,s).callbackRef}function kf(t,a,s){const o=Ne.useRef(null);let c=d=>{};const u=Ne.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(d=>{const h=()=>{const g=d[0].target;g.offsetParent!==null&&t(g)};s?h():requestAnimationFrame(h)}):null,[t,s]);return c=d=>{d&&a?(u==null||u.observe(d),o.current=d):(o.current&&(u==null||u.unobserve(o.current)),o.current=null)},{callbackRef:c,ref:o}}function ak(t,a,s,o,c,u,d,h,g){const m=Ne.useCallback(y=>{const v=lk(y.children,a,h?"offsetWidth":"offsetHeight",c);let b=y.parentElement;for(;b.dataset.virtuosoScroller===void 0;)b=b.parentElement;const S=b.lastElementChild.dataset.viewportType==="window";let k;S&&(k=b.ownerDocument.defaultView);const w=d?h?d.scrollLeft:d.scrollTop:S?h?k.scrollX||k.document.documentElement.scrollLeft:k.scrollY||k.document.documentElement.scrollTop:h?b.scrollLeft:b.scrollTop,E=d?h?d.scrollWidth:d.scrollHeight:S?h?k.document.documentElement.scrollWidth:k.document.documentElement.scrollHeight:h?b.scrollWidth:b.scrollHeight,T=d?h?d.offsetWidth:d.offsetHeight:S?h?k.innerWidth:k.innerHeight:h?b.offsetWidth:b.offsetHeight;o({scrollHeight:E,scrollTop:Math.max(w,0),viewportHeight:T}),u==null||u(h?pg("column-gap",getComputedStyle(y).columnGap,c):pg("row-gap",getComputedStyle(y).rowGap,c)),v!==null&&t(v)},[t,a,c,u,d,o,h]);return kf(m,s,g)}function lk(t,a,s,o){const c=t.length;if(c===0)return null;const u=[];for(let d=0;d<c;d++){const h=t.item(d);if(h.dataset.index===void 0)continue;const g=parseInt(h.dataset.index),m=parseFloat(h.dataset.knownSize),y=a(h,s);if(y===0&&o("Zero-sized element, this should not happen",{child:h},Pt.ERROR),y===m)continue;const v=u[u.length-1];u.length===0||v.size!==y||v.endIndex!==g-1?u.push({endIndex:g,size:y,startIndex:g}):u[u.length-1].endIndex++}return u}function pg(t,a,s){return a!=="normal"&&(a==null?void 0:a.endsWith("px"))!==!0&&s(`${t} was not resolved to pixel value correctly`,a,Pt.WARN),a==="normal"?0:parseInt(a??"0",10)}function Gv(t,a,s){const o=Ne.useRef(null),c=Ne.useCallback(g=>{if(!(g!=null&&g.offsetParent))return;const m=g.getBoundingClientRect(),y=m.width;let v,b;if(a){const S=a.getBoundingClientRect(),k=m.top-S.top;b=S.height-Math.max(0,k),v=k+a.scrollTop}else{const S=d.current.ownerDocument.defaultView;b=S.innerHeight-Math.max(0,m.top),v=m.top+S.scrollY}o.current={listHeight:m.height,offsetTop:v,visibleHeight:b,visibleWidth:y},t(o.current)},[t,a]),{callbackRef:u,ref:d}=kf(c,!0,s),h=Ne.useCallback(()=>{c(d.current)},[c,d]);return Ne.useEffect(()=>{var m;if(a){a.addEventListener("scroll",h);const y=new ResizeObserver(()=>{requestAnimationFrame(h)});return y.observe(a),()=>{a.removeEventListener("scroll",h),y.unobserve(a)}}const g=(m=d.current)==null?void 0:m.ownerDocument.defaultView;return g==null||g.addEventListener("scroll",h),g==null||g.addEventListener("resize",h),()=>{g==null||g.removeEventListener("scroll",h),g==null||g.removeEventListener("resize",h)}},[h,a,d]),u}const cn=tt(()=>{const t=Ze(),a=Ze(),s=ge(0),o=Ze(),c=ge(0),u=Ze(),d=Ze(),h=ge(0),g=ge(0),m=ge(0),y=ge(0),v=Ze(),b=Ze(),S=ge(!1),k=ge(!1),w=ge(!1);return Te(me(t,ke(({scrollTop:E})=>E)),a),Te(me(t,ke(({scrollHeight:E})=>E)),d),Te(a,c),{deviation:s,fixedFooterHeight:m,fixedHeaderHeight:g,footerHeight:y,headerHeight:h,horizontalDirection:k,scrollBy:b,scrollContainerState:t,scrollHeight:d,scrollingInProgress:S,scrollTo:v,scrollTop:a,skipAnimationFrameInResizeObserver:w,smoothScrollTargetReached:o,statefulScrollTop:c,viewportHeight:u}},[],{singleton:!0}),Fs={lvl:0};function Wv(t,a){const s=t.length;if(s===0)return[];let{index:o,value:c}=a(t[0]);const u=[];for(let d=1;d<s;d++){const{index:h,value:g}=a(t[d]);u.push({end:h-1,start:o,value:c}),o=h,c=g}return u.push({end:1/0,start:o,value:c}),u}function ht(t){return t===Fs}function Gs(t,a){if(!ht(t))return a===t.k?t.v:a<t.k?Gs(t.l,a):Gs(t.r,a)}function Jn(t,a,s="k"){if(ht(t))return[-1/0,void 0];if(Number(t[s])===a)return[t.k,t.v];if(Number(t[s])<a){const o=Jn(t.r,a,s);return o[0]===-1/0?[t.k,t.v]:o}return Jn(t.l,a,s)}function Cn(t,a,s){return ht(t)?Kv(a,s,1):a===t.k?Vt(t,{k:a,v:s}):a<t.k?mg(Vt(t,{l:Cn(t.l,a,s)})):mg(Vt(t,{r:Cn(t.r,a,s)}))}function Ml(){return Fs}function Ll(t,a,s){if(ht(t))return[];const o=Jn(t,a)[0];return sk(nf(t,o,s))}function tf(t,a){if(ht(t))return Fs;const{k:s,l:o,r:c}=t;if(a===s){if(ht(o))return c;if(ht(c))return o;const[u,d]=Yv(o);return Lo(Vt(t,{k:u,l:qv(o),v:d}))}return a<s?Lo(Vt(t,{l:tf(o,a)})):Lo(Vt(t,{r:tf(c,a)}))}function Ia(t){return ht(t)?[]:[...Ia(t.l),{k:t.k,v:t.v},...Ia(t.r)]}function nf(t,a,s){if(ht(t))return[];const{k:o,l:c,r:u,v:d}=t;let h=[];return o>a&&(h=h.concat(nf(c,a,s))),o>=a&&o<=s&&h.push({k:o,v:d}),o<=s&&(h=h.concat(nf(u,a,s))),h}function Lo(t){const{l:a,lvl:s,r:o}=t;if(o.lvl>=s-1&&a.lvl>=s-1)return t;if(s>o.lvl+1){if(Cd(a))return Xv(Vt(t,{lvl:s-1}));if(!ht(a)&&!ht(a.r))return Vt(a.r,{l:Vt(a,{r:a.r.l}),lvl:s,r:Vt(t,{l:a.r.r,lvl:s-1})});throw new Error("Unexpected empty nodes")}if(Cd(t))return rf(Vt(t,{lvl:s-1}));if(!ht(o)&&!ht(o.l)){const c=o.l,u=Cd(c)?o.lvl-1:o.lvl;return Vt(c,{l:Vt(t,{lvl:s-1,r:c.l}),lvl:c.lvl+1,r:rf(Vt(o,{l:c.r,lvl:u}))})}throw new Error("Unexpected empty nodes")}function Vt(t,a){return Kv(a.k!==void 0?a.k:t.k,a.v!==void 0?a.v:t.v,a.lvl!==void 0?a.lvl:t.lvl,a.l!==void 0?a.l:t.l,a.r!==void 0?a.r:t.r)}function qv(t){return ht(t.r)?t.l:Lo(Vt(t,{r:qv(t.r)}))}function Cd(t){return ht(t)||t.lvl>t.r.lvl}function Yv(t){return ht(t.r)?[t.k,t.v]:Yv(t.r)}function Kv(t,a,s,o=Fs,c=Fs){return{k:t,l:o,lvl:s,r:c,v:a}}function mg(t){return rf(Xv(t))}function Xv(t){const{l:a}=t;return!ht(a)&&a.lvl===t.lvl?Vt(a,{r:Vt(t,{l:a.r})}):t}function rf(t){const{lvl:a,r:s}=t;return!ht(s)&&!ht(s.r)&&s.lvl===a&&s.r.lvl===a?Vt(s,{l:Vt(t,{r:s.l}),lvl:a+1}):t}function sk(t){return Wv(t,({k:a,v:s})=>({index:a,value:s}))}function Qv(t,a){return!!(t&&t.startIndex===a.startIndex&&t.endIndex===a.endIndex)}function Ws(t,a){return!!(t&&t[0]===a[0]&&t[1]===a[1])}const wf=tt(()=>({recalcInProgress:ge(!1)}),[],{singleton:!0});function Zv(t,a,s){return t[Bo(t,a,s)]}function Bo(t,a,s,o=0){let c=t.length-1;for(;o<=c;){const u=Math.floor((o+c)/2),d=t[u],h=s(d,a);if(h===0)return u;if(h===-1){if(c-o<2)return u-1;c=u-1}else{if(c===o)return u;o=u+1}}throw new Error(`Failed binary finding record in array - ${t.join(",")}, searched for ${a}`)}function ik(t,a,s,o){const c=Bo(t,a,o),u=Bo(t,s,o,c);return t.slice(c,u+1)}function sa(t,a){return Math.round(t.getBoundingClientRect()[a])}function Xo(t){return!ht(t.groupOffsetTree)}function Cf({index:t},a){return a===t?0:a<t?-1:1}function ok(){return{groupIndices:[],groupOffsetTree:Ml(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Ml()}}function ck(t,a){let s=ht(t)?0:1/0;for(const o of a){const{endIndex:c,size:u,startIndex:d}=o;if(s=Math.min(s,d),ht(t)){t=Cn(t,0,u);continue}const h=Ll(t,d-1,c+1);if(h.some(xk(o)))continue;let g=!1,m=!1;for(const{end:y,start:v,value:b}of h)g?(c>=v||u===b)&&(t=tf(t,v)):(m=b!==u,g=!0),y>c&&c>=v&&b!==u&&(t=Cn(t,c+1,b));m&&(t=Cn(t,d,u))}return[t,s]}function uk(t){return typeof t.groupIndex<"u"}function dk({offset:t},a){return a===t?0:a<t?-1:1}function qs(t,a,s){if(a.length===0)return 0;const{index:o,offset:c,size:u}=Zv(a,t,Cf),d=t-o,h=u*d+(d-1)*s+c;return h>0?h+s:h}function Jv(t,a){if(!Xo(a))return t;let s=0;for(;a.groupIndices[s]<=t+s;)s++;return t+s}function ey(t,a,s){if(uk(t))return a.groupIndices[t.groupIndex]+1;const o=t.index==="LAST"?s:t.index;let c=Jv(o,a);return c=Math.max(0,c,Math.min(s,c)),c}function fk(t,a,s,o=0){return o>0&&(a=Math.max(a,Zv(t,o,Cf).offset)),Wv(ik(t,a,s,dk),hk)}function pk(t,[a,s,o,c]){a.length>0&&o("received item sizes",a,Pt.DEBUG);const u=t.sizeTree;let d=u,h=0;if(s.length>0&&ht(u)&&a.length===2){const b=a[0].size,S=a[1].size;d=s.reduce((k,w)=>Cn(Cn(k,w,b),w+1,S),d)}else[d,h]=ck(d,a);if(d===u)return t;const{lastIndex:g,lastOffset:m,lastSize:y,offsetTree:v}=af(t.offsetTree,h,d,c);return{groupIndices:s,groupOffsetTree:s.reduce((b,S)=>Cn(b,S,qs(S,v,c)),Ml()),lastIndex:g,lastOffset:m,lastSize:y,offsetTree:v,sizeTree:d}}function mk(t){return Ia(t).map(({k:a,v:s},o,c)=>{const u=c[o+1];return{endIndex:u!==void 0?u.k-1:1/0,size:s,startIndex:a}})}function hg(t,a){let s=0,o=0;for(;s<t;)s+=a[o+1]-a[o]-1,o++;return o-(s===t?0:1)}function af(t,a,s,o){let c=t,u=0,d=0,h=0,g=0;if(a!==0){g=Bo(c,a-1,Cf),h=c[g].offset;const m=Jn(s,a-1);u=m[0],d=m[1],c.length&&c[g].size===Jn(s,a)[1]&&(g-=1),c=c.slice(0,g+1)}else c=[];for(const{start:m,value:y}of Ll(s,a,1/0)){const v=m-u,b=v*d+h+v*o;c.push({index:m,offset:b,size:y}),u=m,h=b,d=y}return{lastIndex:u,lastOffset:h,lastSize:d,offsetTree:c}}function hk(t){return{index:t.index,value:t}}function xk(t){const{endIndex:a,size:s,startIndex:o}=t;return c=>c.start===o&&(c.end===a||c.end===1/0)&&c.value===s}const gk={offsetHeight:"height",offsetWidth:"width"},dr=tt(([{log:t},{recalcInProgress:a}])=>{const s=Ze(),o=Ze(),c=rn(o,0),u=Ze(),d=Ze(),h=ge(0),g=ge([]),m=ge(void 0),y=ge(void 0),v=ge(void 0),b=ge(void 0),S=ge((C,B)=>sa(C,gk[B])),k=ge(void 0),w=ge(0),E=ok(),T=rn(me(s,Ge(g,t,w),cr(pk,E),bt()),E),N=rn(me(g,bt(),cr((C,B)=>({current:B,prev:C.current}),{current:[],prev:[]}),ke(({prev:C})=>C)),[]);Te(me(g,_e(C=>C.length>0),Ge(T,w),ke(([C,B,L])=>{const U=C.reduce(($,q,X)=>Cn($,q,qs(q,B.offsetTree,L)||X),Ml());return{...B,groupIndices:C,groupOffsetTree:U}})),T),Te(me(o,Ge(T),_e(([C,{lastIndex:B}])=>C<B),ke(([C,{lastIndex:B,lastSize:L}])=>[{endIndex:B,size:L,startIndex:C}])),s),Te(m,y);const A=rn(me(m,ke(C=>C===void 0)),!0);Te(me(y,_e(C=>C!==void 0&&ht(wt(T).sizeTree)),ke(C=>{const B=wt(v),L=wt(g).length>0;return B!==void 0&&B!==0?L?[{endIndex:0,size:B,startIndex:0},{endIndex:1,size:C,startIndex:1}]:[]:[{endIndex:0,size:C,startIndex:0}]})),s),Te(me(b,_e(C=>C!==void 0&&C.length>0&&ht(wt(T).sizeTree)),ke(C=>{const B=[];let L=C[0],U=0;for(let $=1;$<C.length;$++){const q=C[$];q!==L&&(B.push({endIndex:$-1,size:L,startIndex:U}),L=q,U=$)}return B.push({endIndex:C.length-1,size:L,startIndex:U}),B})),s),Te(me(g,Ge(v,y),_e(([,C,B])=>C!==void 0&&B!==void 0),ke(([C,B,L])=>{const U=[];for(let $=0;$<C.length;$++){const q=C[$],X=C[$+1];U.push({startIndex:q,endIndex:q,size:B}),X!==void 0&&U.push({startIndex:q+1,endIndex:X-1,size:L})}return U})),s);const _=Nn(me(s,Ge(T),cr(({sizes:C},[B,L])=>({changed:L!==C,sizes:L}),{changed:!1,sizes:E}),ke(C=>C.changed)));at(me(h,cr((C,B)=>({diff:C.prev-B,prev:B}),{diff:0,prev:0}),ke(C=>C.diff)),C=>{const{groupIndices:B}=wt(T);if(C>0)Fe(a,!0),Fe(u,C+hg(C,B));else if(C<0){const L=wt(N);L.length>0&&(C-=hg(-C,L)),Fe(d,C)}}),at(me(h,Ge(t)),([C,B])=>{C<0&&B("`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},Pt.ERROR)});const D=Nn(u);Te(me(u,Ge(T),ke(([C,B])=>{const L=B.groupIndices.length>0,U=[],$=B.lastSize;if(L){const q=Gs(B.sizeTree,0);let X=0,ee=0;for(;X<C;){const z=B.groupIndices[ee],O=B.groupIndices.length===ee+1?1/0:B.groupIndices[ee+1]-z-1;U.push({endIndex:z,size:q,startIndex:z}),U.push({endIndex:z+1+O-1,size:$,startIndex:z+1}),ee++,X+=O+1}const I=Ia(B.sizeTree);return X!==C&&I.shift(),I.reduce((z,{k:O,v:P})=>{let H=z.ranges;return z.prevSize!==0&&(H=[...z.ranges,{endIndex:O+C-1,size:z.prevSize,startIndex:z.prevIndex}]),{prevIndex:O+C,prevSize:P,ranges:H}},{prevIndex:C,prevSize:0,ranges:U}).ranges}return Ia(B.sizeTree).reduce((q,{k:X,v:ee})=>({prevIndex:X+C,prevSize:ee,ranges:[...q.ranges,{endIndex:X+C-1,size:q.prevSize,startIndex:q.prevIndex}]}),{prevIndex:0,prevSize:$,ranges:[]}).ranges})),s);const F=Nn(me(d,Ge(T,w),ke(([C,{offsetTree:B},L])=>{const U=-C;return qs(U,B,L)})));return Te(me(d,Ge(T,w),ke(([C,B,L])=>{if(B.groupIndices.length>0){if(ht(B.sizeTree))return B;let $=Ml();const q=wt(N);let X=0,ee=0,I=0;for(;X<-C;){I=q[ee];const z=q[ee+1]-I-1;ee++,X+=z+1}if($=Ia(B.sizeTree).reduce((z,{k:O,v:P})=>Cn(z,Math.max(0,O+C),P),$),X!==-C){const z=Gs(B.sizeTree,I);$=Cn($,0,z);const O=Jn(B.sizeTree,-C+1)[1];$=Cn($,1,O)}return{...B,sizeTree:$,...af(B.offsetTree,0,$,L)}}const U=Ia(B.sizeTree).reduce(($,{k:q,v:X})=>Cn($,Math.max(0,q+C),X),Ml());return{...B,sizeTree:U,...af(B.offsetTree,0,U,L)}})),T),{beforeUnshiftWith:D,data:k,defaultItemSize:y,firstItemIndex:h,fixedItemSize:m,fixedGroupSize:v,gap:w,groupIndices:g,heightEstimates:b,itemSize:S,listRefresh:_,shiftWith:d,shiftWithOffset:F,sizeRanges:s,sizes:T,statefulTotalCount:c,totalCount:o,trackItemSizes:A,unshiftWith:u}},jt(ca,wf),{singleton:!0});function vk(t){return t.reduce((a,s)=>(a.groupIndices.push(a.totalCount),a.totalCount+=s+1,a),{groupIndices:[],totalCount:0})}const ty=tt(([{groupIndices:t,sizes:a,totalCount:s},{headerHeight:o,scrollTop:c}])=>{const u=Ze(),d=Ze(),h=Nn(me(u,ke(vk)));return Te(me(h,ke(g=>g.totalCount)),s),Te(me(h,ke(g=>g.groupIndices)),t),Te(me(It(c,a,o),_e(([g,m])=>Xo(m)),ke(([g,m,y])=>Jn(m.groupOffsetTree,Math.max(g-y,0),"v")[0]),bt(),ke(g=>[g])),d),{groupCounts:u,topItemsIndexes:d}},jt(dr,cn)),ua=tt(([{log:t}])=>{const a=ge(!1),s=Nn(me(a,_e(o=>o),bt()));return at(a,o=>{o&&wt(t)("props updated",{},Pt.DEBUG)}),{didMount:s,propsReady:a}},jt(ca),{singleton:!0}),yk=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function ny(t){const a=typeof t=="number"?{index:t}:t;return a.align||(a.align="start"),(!a.behavior||!yk)&&(a.behavior="auto"),a.offset===void 0&&(a.offset=0),a}const ei=tt(([{gap:t,listRefresh:a,sizes:s,totalCount:o},{fixedFooterHeight:c,fixedHeaderHeight:u,footerHeight:d,headerHeight:h,scrollingInProgress:g,scrollTo:m,smoothScrollTargetReached:y,viewportHeight:v},{log:b}])=>{const S=Ze(),k=Ze(),w=ge(0);let E=null,T=null,N=null;function A(){E!==null&&(E(),E=null),N!==null&&(N(),N=null),T&&(clearTimeout(T),T=null),Fe(g,!1)}return Te(me(S,Ge(s,v,o,w,h,d,b),Ge(t,u,c),ke(([[_,D,F,C,B,L,U,$],q,X,ee])=>{const I=ny(_),{align:z,behavior:O,offset:P}=I,H=C-1,ae=ey(I,D,H);let M=qs(ae,D.offsetTree,q)+L;z==="end"?(M+=X+Jn(D.sizeTree,ae)[1]-F+ee,ae===H&&(M+=U)):z==="center"?M+=(X+Jn(D.sizeTree,ae)[1]-F+ee)/2:M-=B,P!==void 0&&P!==0&&(M+=P);const Y=W=>{A(),W?($("retrying to scroll to",{location:_},Pt.DEBUG),Fe(S,_)):(Fe(k,!0),$("list did not change, scroll successful",{},Pt.DEBUG))};if(A(),O==="smooth"){let W=!1;N=at(a,Q=>{W=W||Q}),E=Qn(y,()=>{Y(W)})}else E=Qn(me(a,bk(150)),Y);return T=setTimeout(()=>{A()},1200),Fe(g,!0),$("scrolling from index to",{behavior:O,index:ae,top:M},Pt.DEBUG),{behavior:O,top:M}})),m),{scrollTargetReached:k,scrollToIndex:S,topListHeight:w}},jt(dr,cn,ca),{singleton:!0});function bk(t){return a=>{const s=setTimeout(()=>{a(!1)},t);return o=>{o&&(a(!0),clearTimeout(s))}}}function Ef(t,a){t===0?a():requestAnimationFrame(()=>{Ef(t-1,a)})}function Nf(t,a){const s=a-1;return typeof t=="number"?t:t.index==="LAST"?s:t.index}const ti=tt(([{defaultItemSize:t,listRefresh:a,sizes:s},{scrollTop:o},{scrollTargetReached:c,scrollToIndex:u},{didMount:d}])=>{const h=ge(!0),g=ge(0),m=ge(!0);return Te(me(d,Ge(g),_e(([y,v])=>v!==0),or(!1)),h),Te(me(d,Ge(g),_e(([y,v])=>v!==0),or(!1)),m),at(me(It(a,d),Ge(h,s,t,m),_e(([[,y],v,{sizeTree:b},S,k])=>y&&(!ht(b)||jf(S))&&!v&&!k),Ge(g)),([,y])=>{Qn(c,()=>{Fe(m,!0)}),Ef(4,()=>{Qn(o,()=>{Fe(h,!0)}),Fe(u,y)})}),{initialItemFinalLocationReached:m,initialTopMostItemIndex:g,scrolledToInitialItem:h}},jt(dr,cn,ei,ua),{singleton:!0});function ry(t,a){return Math.abs(t-a)<1.01}const Ys="up",Hs="down",jk="none",Sk={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},kk=0,ni=tt(([{footerHeight:t,headerHeight:a,scrollBy:s,scrollContainerState:o,scrollTop:c,viewportHeight:u}])=>{const d=ge(!1),h=ge(!0),g=Ze(),m=Ze(),y=ge(4),v=ge(kk),b=rn(me(ef(me(De(c),Ua(1),or(!0)),me(De(c),Ua(1),or(!1),fg(100))),bt()),!1),S=rn(me(ef(me(s,or(!0)),me(s,or(!1),fg(200))),bt()),!1);Te(me(It(De(c),De(v)),ke(([N,A])=>N<=A),bt()),h),Te(me(h,Ar(50)),m);const k=Nn(me(It(o,De(u),De(a),De(t),De(y)),cr((N,[{scrollHeight:A,scrollTop:_},D,F,C,B])=>{const L=_+D-A>-B,U={scrollHeight:A,scrollTop:_,viewportHeight:D};if(L){let q,X;return _>N.state.scrollTop?(q="SCROLLED_DOWN",X=N.state.scrollTop-_):(q="SIZE_DECREASED",X=N.state.scrollTop-_||N.scrollTopDelta),{atBottom:!0,atBottomBecause:q,scrollTopDelta:X,state:U}}let $;return U.scrollHeight>N.state.scrollHeight?$="SIZE_INCREASED":D<N.state.viewportHeight?$="VIEWPORT_HEIGHT_DECREASING":_<N.state.scrollTop?$="SCROLLING_UPWARDS":$="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:$,state:U}},Sk),bt((N,A)=>N!==void 0&&N.atBottom===A.atBottom))),w=rn(me(o,cr((N,{scrollHeight:A,scrollTop:_,viewportHeight:D})=>{if(!ry(N.scrollHeight,A)){const F=A-(_+D)<1;return N.scrollTop!==_&&F?{changed:!0,jump:N.scrollTop-_,scrollHeight:A,scrollTop:_}:{changed:!0,jump:0,scrollHeight:A,scrollTop:_}}return{changed:!1,jump:0,scrollHeight:A,scrollTop:_}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),_e(N=>N.changed),ke(N=>N.jump)),0);Te(me(k,ke(N=>N.atBottom)),d),Te(me(d,Ar(50)),g);const E=ge(Hs);Te(me(o,ke(({scrollTop:N})=>N),bt(),cr((N,A)=>wt(S)?{direction:N.direction,prevScrollTop:A}:{direction:A<N.prevScrollTop?Ys:Hs,prevScrollTop:A},{direction:Hs,prevScrollTop:0}),ke(N=>N.direction)),E),Te(me(o,Ar(50),or(jk)),E);const T=ge(0);return Te(me(b,_e(N=>!N),or(0)),T),Te(me(c,Ar(100),Ge(b),_e(([N,A])=>A),cr(([N,A],[_])=>[A,_],[0,0]),ke(([N,A])=>A-N)),T),{atBottomState:k,atBottomStateChange:g,atBottomThreshold:y,atTopStateChange:m,atTopThreshold:v,isAtBottom:d,isAtTop:h,isScrolling:b,lastJumpDueToItemResize:w,scrollDirection:E,scrollVelocity:T}},jt(cn)),Ks="top",Xs="bottom",xg="none";function gg(t,a,s){return typeof t=="number"?s===Ys&&a===Ks||s===Hs&&a===Xs?t:0:s===Ys?a===Ks?t.main:t.reverse:a===Xs?t.main:t.reverse}function vg(t,a){return typeof t=="number"?t:t[a]??0}const Tf=tt(([{deviation:t,fixedHeaderHeight:a,headerHeight:s,scrollTop:o,viewportHeight:c}])=>{const u=Ze(),d=ge(0),h=ge(0),g=ge(0),m=rn(me(It(De(o),De(c),De(s),De(u,Ws),De(g),De(d),De(a),De(t),De(h)),ke(([y,v,b,[S,k],w,E,T,N,A])=>{const _=y-N,D=E+T,F=Math.max(b-_,0);let C=xg;const B=vg(A,Ks),L=vg(A,Xs);return S-=N,S+=b+T,k+=b+T,k-=N,S>y+D-B&&(C=Ys),k<y-F+v+L&&(C=Hs),C!==xg?[Math.max(_-b-gg(w,Ks,C)-B,0),_-F-T+v+gg(w,Xs,C)+L]:null}),_e(y=>y!==null),bt(Ws)),[0,0]);return{increaseViewportBy:h,listBoundary:u,overscan:g,topListHeight:d,visibleRange:m}},jt(cn),{singleton:!0});function wk(t,a,s){if(Xo(a)){const o=Jv(t,a);return[{index:Jn(a.groupOffsetTree,o)[0],offset:0,size:0},{data:s==null?void 0:s[0],index:o,offset:0,size:0}]}return[{data:s==null?void 0:s[0],index:t,offset:0,size:0}]}const Ed={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function zo(t,a,s,o,c,u){const{lastIndex:d,lastOffset:h,lastSize:g}=c;let m=0,y=0;if(t.length>0){m=t[0].offset;const w=t[t.length-1];y=w.offset+w.size}const v=s-d,b=h+v*g+(v-1)*o,S=m,k=b-y;return{bottom:y,firstItemIndex:u,items:yg(t,c,u),offsetBottom:k,offsetTop:m,top:S,topItems:yg(a,c,u),topListHeight:a.reduce((w,E)=>E.size+w,0),totalCount:s}}function ay(t,a,s,o,c,u){let d=0;if(s.groupIndices.length>0)for(const y of s.groupIndices){if(y-d>=t)break;d++}const h=t+d,g=Nf(a,h),m=Array.from({length:h}).map((y,v)=>({data:u[v+g],index:v+g,offset:0,size:0}));return zo(m,[],h,c,s,o)}function yg(t,a,s){if(t.length===0)return[];if(!Xo(a))return t.map(m=>({...m,index:m.index+s,originalIndex:m.index}));const o=t[0].index,c=t[t.length-1].index,u=[],d=Ll(a.groupOffsetTree,o,c);let h,g=0;for(const m of t){(!h||h.end<m.index)&&(h=d.shift(),g=a.groupIndices.indexOf(h.start));let y;m.index===h.start?y={index:g,type:"group"}:y={groupIndex:g,index:m.index-(g+1)+s},u.push({...y,data:m.data,offset:m.offset,originalIndex:m.index,size:m.size})}return u}function bg(t,a){return t===void 0?0:typeof t=="number"?t:t[a]??0}const Pa=tt(([{data:t,firstItemIndex:a,gap:s,sizes:o,totalCount:c},u,{listBoundary:d,topListHeight:h,visibleRange:g},{initialTopMostItemIndex:m,scrolledToInitialItem:y},{topListHeight:v},b,{didMount:S},{recalcInProgress:k}])=>{const w=ge([]),E=ge(0),T=Ze(),N=ge(0);Te(u.topItemsIndexes,w);const A=rn(me(It(S,k,De(g,Ws),De(c),De(o),De(m),y,De(w),De(a),De(s),De(N),t),_e(([C,B,,L,,,,,,,,U])=>{const $=U!==void 0&&U.length!==L;return C&&!B&&!$}),ke(([,,[C,B],L,U,$,q,X,ee,I,z,O])=>{var je,Re;const P=U,{offsetTree:H,sizeTree:ae}=P,M=wt(E);if(L===0)return{...Ed,totalCount:L};if(C===0&&B===0)return M===0?{...Ed,totalCount:L}:ay(M,$,U,ee,I,O||[]);if(ht(ae))return M>0?null:zo(wk(Nf($,L),P,O),[],L,I,P,ee);const Y=[];if(X.length>0){const Oe=X[0],le=X[X.length-1];let he=0;for(const pe of Ll(ae,Oe,le)){const xe=pe.value,be=Math.max(pe.start,Oe),Be=Math.min(pe.end,le);for(let Ue=be;Ue<=Be;Ue++)Y.push({data:O==null?void 0:O[Ue],index:Ue,offset:he,size:xe}),he+=xe}}if(!q)return zo([],Y,L,I,P,ee);const W=X.length>0?X[X.length-1]+1:0,Q=fk(H,C,B,W);if(Q.length===0)return null;const oe=L-1,de=Ko([],Oe=>{for(const le of Q){const he=le.value;let pe=he.offset,xe=le.start;const be=he.size;if(he.offset<C){xe+=Math.floor((C-he.offset+I)/(be+I));const Ue=xe-le.start;pe+=Ue*be+Ue*I}xe<W&&(pe+=(W-xe)*be,xe=W);const Be=Math.min(le.end,oe);for(let Ue=xe;Ue<=Be&&!(pe>=B);Ue++)Oe.push({data:O==null?void 0:O[Ue],index:Ue,offset:pe,size:be}),pe+=be+I}}),ve=bg(z,Ks),ce=bg(z,Xs);if(de.length>0&&(ve>0||ce>0)){const Oe=de[0],le=de[de.length-1];if(ve>0&&Oe.index>W){const he=Math.min(ve,Oe.index-W),pe=[];let xe=Oe.offset;for(let be=Oe.index-1;be>=Oe.index-he;be--){const Be=((je=Ll(ae,be,be)[0])==null?void 0:je.value)??Oe.size;xe-=Be+I,pe.unshift({data:O==null?void 0:O[be],index:be,offset:xe,size:Be})}de.unshift(...pe)}if(ce>0&&le.index<oe){const he=Math.min(ce,oe-le.index);let pe=le.offset+le.size+I;for(let xe=le.index+1;xe<=le.index+he;xe++){const be=((Re=Ll(ae,xe,xe)[0])==null?void 0:Re.value)??le.size;de.push({data:O==null?void 0:O[xe],index:xe,offset:pe,size:be}),pe+=be+I}}}return zo(de,Y,L,I,P,ee)}),_e(C=>C!==null),bt()),Ed);Te(me(t,_e(jf),ke(C=>C==null?void 0:C.length)),c),Te(me(A,ke(C=>C.topListHeight)),v),Te(v,h),Te(me(A,ke(C=>[C.top,C.bottom])),d),Te(me(A,ke(C=>C.items)),T);const _=Nn(me(A,_e(({items:C})=>C.length>0),Ge(c,t),_e(([{items:C},B])=>C[C.length-1].originalIndex===B-1),ke(([,C,B])=>[C-1,B]),bt(Ws),ke(([C])=>C))),D=Nn(me(A,Ar(200),_e(({items:C,topItems:B})=>C.length>0&&C[0].originalIndex===B.length),ke(({items:C})=>C[0].index),bt())),F=Nn(me(A,_e(({items:C})=>C.length>0),ke(({items:C})=>{let B=0,L=C.length-1;for(;C[B].type==="group"&&B<L;)B++;for(;C[L].type==="group"&&L>B;)L--;return{endIndex:C[L].index,startIndex:C[B].index}}),bt(Qv)));return{endReached:_,initialItemCount:E,itemsRendered:T,listState:A,minOverscanItemCount:N,rangeChanged:F,startReached:D,topItemsIndexes:w,...b}},jt(dr,ty,Tf,ti,ei,ni,ua,wf),{singleton:!0}),ly=tt(([{fixedFooterHeight:t,fixedHeaderHeight:a,footerHeight:s,headerHeight:o},{listState:c}])=>{const u=Ze(),d=rn(me(It(s,t,o,a,c),ke(([h,g,m,y,v])=>h+g+m+y+v.offsetBottom+v.bottom)),0);return Te(De(d),u),{totalListHeight:d,totalListHeightChanged:u}},jt(cn,Pa),{singleton:!0}),Ck=tt(([{viewportHeight:t},{totalListHeight:a}])=>{const s=ge(!1),o=rn(me(It(s,t,a),_e(([c])=>c),ke(([,c,u])=>Math.max(0,c-u)),Ar(0),bt()),0);return{alignToBottom:s,paddingTopAddition:o}},jt(cn,ly),{singleton:!0}),sy=tt(()=>({context:ge(null)})),Ek=({itemBottom:t,itemTop:a,locationParams:{align:s,behavior:o,...c},viewportBottom:u,viewportTop:d})=>a<d?{...c,align:s??"start",...o!==void 0?{behavior:o}:{}}:t>u?{...c,align:s??"end",...o!==void 0?{behavior:o}:{}}:null,iy=tt(([{gap:t,sizes:a,totalCount:s},{fixedFooterHeight:o,fixedHeaderHeight:c,headerHeight:u,scrollingInProgress:d,scrollTop:h,viewportHeight:g},{scrollToIndex:m}])=>{const y=Ze();return Te(me(y,Ge(a,g,s,u,c,o,h),Ge(t),ke(([[v,b,S,k,w,E,T,N],A])=>{const{calculateViewLocation:_=Ek,done:D,...F}=v,C=ey(v,b,k-1),B=qs(C,b.offsetTree,A)+w+E,L=B+Jn(b.sizeTree,C)[1],U=N+E,$=N+S-T,q=_({itemBottom:L,itemTop:B,locationParams:F,viewportBottom:$,viewportTop:U});return q!==null?D&&Qn(me(d,_e(X=>!X),Ua(wt(d)?1:2)),D):D==null||D(),q}),_e(v=>v!==null)),m),{scrollIntoView:y}},jt(dr,cn,ei,Pa,ca),{singleton:!0});function jg(t){return t===!1?!1:t==="smooth"?"smooth":"auto"}const Nk=(t,a)=>typeof t=="function"?jg(t(a)):a&&jg(t),Tk=tt(([{listRefresh:t,totalCount:a,fixedItemSize:s,data:o},{atBottomState:c,isAtBottom:u},{scrollToIndex:d},{scrolledToInitialItem:h},{didMount:g,propsReady:m},{log:y},{scrollingInProgress:v},{context:b},{scrollIntoView:S}])=>{const k=ge(!1),w=Ze();let E=null;function T(D){Fe(d,{align:"end",behavior:D,index:"LAST"})}at(me(It(me(De(a),Ua(1)),g),Ge(De(k),u,h,v),ke(([[D,F],C,B,L,U])=>{let $=F&&L,q="auto";return $&&(q=Nk(C,B||U),$=$&&q!==!1),{followOutputBehavior:q,shouldFollow:$,totalCount:D}}),_e(({shouldFollow:D})=>D)),({followOutputBehavior:D,totalCount:F})=>{E!==null&&(E(),E=null),wt(s)!==void 0?requestAnimationFrame(()=>{wt(y)("following output to ",{totalCount:F},Pt.DEBUG),T(D)}):E=Qn(t,()=>{wt(y)("following output to ",{totalCount:F},Pt.DEBUG),T(D),E=null})});function N(D){const F=Qn(c,C=>{D&&!C.atBottom&&C.notAtBottomBecause==="SIZE_INCREASED"&&E===null&&(wt(y)("scrolling to bottom due to increased size",{},Pt.DEBUG),T("auto"))});setTimeout(F,100)}at(me(It(De(k),a,m),_e(([D,,F])=>D!==!1&&F),cr(({value:D},[,F])=>({refreshed:D===F,value:F}),{refreshed:!1,value:0}),_e(({refreshed:D})=>D),Ge(k,a)),([,D])=>{wt(h)&&N(D!==!1)}),at(w,()=>{N(wt(k)!==!1)}),at(It(De(k),c),([D,F])=>{D!==!1&&!F.atBottom&&F.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&T("auto")});const A=ge(null),_=Ze();return Te(ef(me(De(o),ke(D=>(D==null?void 0:D.length)??0)),me(De(a))),_),at(me(It(me(_,Ua(1)),g),Ge(De(A),h,v,b),ke(([[D,F],C,B,L,U])=>F&&B&&(C==null?void 0:C({context:U,totalCount:D,scrollingInProgress:L}))),_e(D=>!!D),Ar(0)),D=>{E!==null&&(E(),E=null),wt(s)!==void 0?requestAnimationFrame(()=>{wt(y)("scrolling into view",{}),Fe(S,D)}):E=Qn(t,()=>{wt(y)("scrolling into view",{}),Fe(S,D),E=null})}),{autoscrollToBottom:w,followOutput:k,scrollIntoViewOnChange:A}},jt(dr,ni,ei,ti,ua,ca,cn,sy,iy)),Rk=tt(([{data:t,firstItemIndex:a,gap:s,sizes:o},{initialTopMostItemIndex:c},{initialItemCount:u,listState:d},{didMount:h}])=>(Te(me(h,Ge(u),_e(([,g])=>g!==0),Ge(c,o,a,s,t),ke(([[,g],m,y,v,b,S=[]])=>ay(g,m,y,v,b,S))),d),{}),jt(dr,ti,Pa,ua),{singleton:!0}),Ak=tt(([{didMount:t},{scrollTo:a},{listState:s}])=>{const o=ge(0);return at(me(t,Ge(o),_e(([,c])=>c!==0),ke(([,c])=>({top:c}))),c=>{Qn(me(s,Ua(1),_e(u=>u.items.length>1)),()=>{requestAnimationFrame(()=>{Fe(a,c)})})}),{initialScrollTop:o}},jt(ua,cn,Pa),{singleton:!0}),oy=tt(([{scrollVelocity:t}])=>{const a=ge(!1),s=Ze(),o=ge(!1);return Te(me(t,Ge(o,a,s),_e(([c,u])=>u!==!1&&u!==void 0),ke(([c,u,d,h])=>{const{enter:g,exit:m}=u;if(d){if(m(c,h))return!1}else if(g(c,h))return!0;return d}),bt()),a),at(me(It(a,t,s),Ge(o)),([[c,u,d],h])=>{c&&h!==!1&&h!==void 0&&h.change&&h.change(u,d)}),{isSeeking:a,scrollSeekConfiguration:o,scrollSeekRangeChanged:s,scrollVelocity:t}},jt(ni),{singleton:!0}),Rf=tt(([{scrollContainerState:t,scrollTo:a}])=>{const s=Ze(),o=Ze(),c=Ze(),u=ge(!1),d=ge(void 0);return Te(me(It(s,o),ke(([{scrollTop:h,viewportHeight:g},{offsetTop:m,listHeight:y}])=>({scrollHeight:y,scrollTop:Math.max(0,h-m),viewportHeight:g}))),t),Te(me(a,Ge(o),ke(([h,{offsetTop:g}])=>({...h,top:h.top+g}))),c),{customScrollParent:d,useWindowScroll:u,windowScrollContainerState:s,windowScrollTo:c,windowViewportRect:o}},jt(cn)),Mk=tt(([{sizeRanges:t,sizes:a},{headerHeight:s,scrollTop:o},{initialTopMostItemIndex:c},{didMount:u},{useWindowScroll:d,windowScrollContainerState:h,windowViewportRect:g}])=>{const m=Ze(),y=ge(void 0),v=ge(null),b=ge(null);return Te(h,v),Te(g,b),at(me(m,Ge(a,o,d,v,b,s)),([S,k,w,E,T,N,A])=>{const _=mk(k.sizeTree);E&&T!==null&&N!==null&&(w=T.scrollTop-N.offsetTop),w-=A,S({ranges:_,scrollTop:w})}),Te(me(y,_e(jf),ke(Lk)),c),Te(me(u,Ge(y),_e(([,S])=>S!==void 0),bt(),ke(([,S])=>S.ranges)),t),{getState:m,restoreStateFrom:y}},jt(dr,cn,ti,ua,Rf));function Lk(t){return{align:"start",index:0,offset:t.scrollTop}}const zk=tt(([{topItemsIndexes:t}])=>{const a=ge(0);return Te(me(a,_e(s=>s>=0),ke(s=>Array.from({length:s}).map((o,c)=>c))),t),{topItemCount:a}},jt(Pa));function cy(t){let a=!1,s;return(()=>(a||(a=!0,s=t()),s))}const Dk=cy(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),_k=tt(([{deviation:t,scrollBy:a,scrollingInProgress:s,scrollTop:o},{isAtBottom:c,isScrolling:u,lastJumpDueToItemResize:d,scrollDirection:h},{listState:g},{beforeUnshiftWith:m,gap:y,shiftWithOffset:v,sizes:b},{log:S},{recalcInProgress:k}])=>{const w=Nn(me(g,Ge(d),cr(([,T,N,A],[{bottom:_,items:D,offsetBottom:F,totalCount:C},B])=>{const L=_+F;let U=0;return N===C&&T.length>0&&D.length>0&&(D[0].originalIndex===0&&T[0].originalIndex===0||(U=L-A,U!==0&&(U+=B))),[U,D,C,L]},[0,[],0,0]),_e(([T])=>T!==0),Ge(o,h,s,c,S,k),_e(([,T,N,A,,,_])=>!_&&!A&&T!==0&&N===Ys),ke(([[T],,,,,N])=>(N("Upward scrolling compensation",{amount:T},Pt.DEBUG),T))));function E(T){T>0?(Fe(a,{behavior:"auto",top:-T}),Fe(t,0)):(Fe(t,0),Fe(a,{behavior:"auto",top:-T}))}return at(me(w,Ge(t,u)),([T,N,A])=>{A&&Dk()?Fe(t,N-T):E(-T)}),at(me(It(rn(u,!1),t,k),_e(([T,N,A])=>!T&&!A&&N!==0),ke(([T,N])=>N),Ar(1)),E),Te(me(v,ke(T=>({top:-T}))),a),at(me(m,Ge(b,y),ke(([T,{groupIndices:N,lastSize:A,sizeTree:_},D])=>{function F($){return $*(A+D)}if(N.length===0)return F(T);let C=0;const B=Gs(_,0);let L=0,U=0;for(;L<T;){L++,C+=B;let $=N.length===U+1?1/0:N[U+1]-N[U]-1;L+$>T&&(C-=B,$=T-L+1),L+=$,C+=F($),U++}return C})),T=>{Fe(t,T),requestAnimationFrame(()=>{Fe(a,{top:T}),requestAnimationFrame(()=>{Fe(t,0),Fe(k,!1)})})}),{deviation:t}},jt(cn,ni,Pa,dr,ca,wf)),Ok=tt(([t,a,s,o,c,u,d,h,g,m,y])=>({...t,...a,...s,...o,...c,...u,...d,...h,...g,...m,...y}),jt(Tf,Rk,ua,oy,ly,Ak,Ck,Rf,iy,ca,sy)),uy=tt(([{data:t,defaultItemSize:a,firstItemIndex:s,fixedItemSize:o,fixedGroupSize:c,gap:u,groupIndices:d,heightEstimates:h,itemSize:g,sizeRanges:m,sizes:y,statefulTotalCount:v,totalCount:b,trackItemSizes:S},{initialItemFinalLocationReached:k,initialTopMostItemIndex:w,scrolledToInitialItem:E},T,N,A,_,{scrollToIndex:D},F,{topItemCount:C},{groupCounts:B},L])=>{const{listState:U,minOverscanItemCount:$,topItemsIndexes:q,rangeChanged:X,...ee}=_;return Te(X,L.scrollSeekRangeChanged),Te(me(L.windowViewportRect,ke(I=>I.visibleHeight)),T.viewportHeight),{data:t,defaultItemHeight:a,firstItemIndex:s,fixedItemHeight:o,fixedGroupHeight:c,gap:u,groupCounts:B,heightEstimates:h,initialItemFinalLocationReached:k,initialTopMostItemIndex:w,scrolledToInitialItem:E,sizeRanges:m,topItemCount:C,topItemsIndexes:q,totalCount:b,...A,groupIndices:d,itemSize:g,listState:U,minOverscanItemCount:$,scrollToIndex:D,statefulTotalCount:v,trackItemSizes:S,rangeChanged:X,...ee,...L,...T,sizes:y,...N}},jt(dr,ti,cn,Mk,Tk,Pa,ei,_k,zk,ty,Ok));function Bk(t,a){const s={},o={};let c=0;const u=t.length;for(;c<u;)o[t[c]]=1,c+=1;for(const d in a)Object.hasOwn(o,d)||(s[d]=a[d]);return s}const yo=typeof document<"u"?Ne.useLayoutEffect:Ne.useEffect;function dy(t,a,s){const o=Object.keys(a.required||{}),c=Object.keys(a.optional||{}),u=Object.keys(a.methods||{}),d=Object.keys(a.events||{}),h=Ne.createContext({});function g(E,T){E.propsReady!==void 0&&Fe(E.propsReady,!1);for(const N of o){const A=E[a.required[N]];Fe(A,T[N])}for(const N of c)if(N in T){const A=E[a.optional[N]];Fe(A,T[N])}E.propsReady!==void 0&&Fe(E.propsReady,!0)}function m(E){return u.reduce((T,N)=>(T[N]=A=>{const _=E[a.methods[N]];Fe(_,A)},T),{})}function y(E){return d.reduce((T,N)=>(T[N]=J2(E[a.events[N]]),T),{})}const v=Ne.forwardRef(function(E,T){const{children:N,...A}=E,[_]=Ne.useState(()=>Ko(tk(t),C=>{g(C,A)})),[D]=Ne.useState(dg(y,_));yo(()=>{for(const C of d)C in A&&at(D[C],A[C]);return()=>{Object.values(D).map(Sf)}},[A,D,_]),yo(()=>{g(_,A)}),Ne.useImperativeHandle(T,ug(m(_)));const F=s;return r.jsx(h.Provider,{value:_,children:s!==void 0?r.jsx(F,{...Bk([...o,...c,...d],A),children:N}):N})}),b=E=>{const T=Ne.useContext(h);return Ne.useCallback(N=>{Fe(T[E],N)},[T,E])},S=E=>{const T=Ne.useContext(h)[E],N=Ne.useCallback(A=>at(T,A),[T]);return Ne.useSyncExternalStore(N,()=>wt(T),()=>wt(T))},k=E=>{const T=Ne.useContext(h)[E],[N,A]=Ne.useState(dg(wt,T));return yo(()=>at(T,_=>{_!==N&&A(ug(_))}),[T,N]),N},w=parseInt(Ne.version)>=18?S:k;return{Component:v,useEmitter:(E,T)=>{const N=Ne.useContext(h)[E];yo(()=>at(N,T),[T,N])},useEmitterValue:w,usePublisher:b}}const fy=Ne.createContext(void 0),py=Ne.createContext(void 0),Nd="-webkit-sticky",Sg="sticky",Af=cy(()=>{if(typeof document>"u")return Sg;const t=document.createElement("div");return t.style.position=Nd,t.style.position===Nd?Nd:Sg}),my=typeof document<"u"?Ne.useLayoutEffect:Ne.useEffect;function Td(t){return"self"in t}function Ik(t){return"body"in t}function hy(t,a,s,o=Il,c,u){const d=Ne.useRef(null),h=Ne.useRef(null),g=Ne.useRef(null),m=Ne.useCallback(b=>{let S,k,w;const E=b.target;if(Ik(E)||Td(E)){const N=Td(E)?E:E.defaultView;w=u===!0?N.scrollX:N.scrollY,S=u===!0?N.document.documentElement.scrollWidth:N.document.documentElement.scrollHeight,k=u===!0?N.innerWidth:N.innerHeight}else w=u===!0?E.scrollLeft:E.scrollTop,S=u===!0?E.scrollWidth:E.scrollHeight,k=u===!0?E.offsetWidth:E.offsetHeight;const T=()=>{t({scrollHeight:S,scrollTop:Math.max(w,0),viewportHeight:k})};b.suppressFlushSync===!0?T():Zj.flushSync(T),h.current!==null&&(w===h.current||w<=0||w===S-k)&&(h.current=null,a(!0),g.current&&(clearTimeout(g.current),g.current=null))},[t,a,u]);Ne.useEffect(()=>{const b=c||d.current;return o(c||d.current),m({suppressFlushSync:!0,target:b}),b.addEventListener("scroll",m,{passive:!0}),()=>{o(null),b.removeEventListener("scroll",m)}},[d,m,s,o,c]);function y(b){const S=d.current;if(!S||(u===!0?"offsetWidth"in S&&S.offsetWidth===0:"offsetHeight"in S&&S.offsetHeight===0))return;const k=b.behavior==="smooth";let w,E,T;Td(S)?(E=Math.max(sa(S.document.documentElement,u===!0?"width":"height"),u===!0?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight),w=u===!0?S.innerWidth:S.innerHeight,T=u===!0?window.scrollX:window.scrollY):(E=S[u===!0?"scrollWidth":"scrollHeight"],w=sa(S,u===!0?"width":"height"),T=S[u===!0?"scrollLeft":"scrollTop"]);const N=E-w;if(b.top=Math.ceil(Math.max(Math.min(N,b.top),0)),ry(w,E)||b.top===T){t({scrollHeight:E,scrollTop:T,viewportHeight:w}),k&&a(!0);return}k?(h.current=b.top,g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{g.current=null,h.current=null,a(!0)},1e3)):h.current=null,u===!0&&(b={...b.behavior!==void 0?{behavior:b.behavior}:{},left:b.top}),S.scrollTo(b)}function v(b){u===!0&&(b={...b.behavior!==void 0?{behavior:b.behavior}:{},...b.top!==void 0?{left:b.top}:{}}),d.current.scrollBy(b)}return{scrollByCallback:v,scrollerRef:d,scrollToCallback:y}}function Mf(t){return t}const Uk=tt(()=>{const t=ge(h=>`Item ${h}`),a=ge(h=>`Group ${h}`),s=ge({}),o=ge(Mf),c=ge("div"),u=ge(Il),d=(h,g=null)=>rn(me(s,ke(m=>m[h]),bt()),g);return{components:s,computeItemKey:o,EmptyPlaceholder:d("EmptyPlaceholder"),FooterComponent:d("Footer"),GroupComponent:d("Group","div"),groupContent:a,HeaderComponent:d("Header"),HeaderFooterTag:c,ItemComponent:d("Item","div"),itemContent:t,ListComponent:d("List","div"),ScrollerComponent:d("Scroller","div"),scrollerRef:u,ScrollSeekPlaceholder:d("ScrollSeekPlaceholder"),TopItemListComponent:d("TopItemList")}}),Hk=tt(([t,a])=>({...t,...a}),jt(uy,Uk)),$k=({height:t})=>r.jsx("div",{style:{height:t}}),Vk={overflowAnchor:"none",position:Af(),zIndex:1},xy={overflowAnchor:"none"},Pk={...xy,display:"inline-block",height:"100%"},kg=Ne.memo(function({showTopList:t=!1}){const a=$e("listState"),s=Pn("sizeRanges"),o=$e("useWindowScroll"),c=$e("customScrollParent"),u=Pn("windowScrollContainerState"),d=Pn("scrollContainerState"),h=c||o?u:d,g=$e("itemContent"),m=$e("context"),y=$e("groupContent"),v=$e("trackItemSizes"),b=$e("itemSize"),S=$e("log"),k=Pn("gap"),w=$e("horizontalDirection"),{callbackRef:E}=ak(s,b,v,t?Il:h,S,k,c,w,$e("skipAnimationFrameInResizeObserver")),[T,N]=Ne.useState(0);Lf("deviation",ee=>{T!==ee&&N(ee)});const A=$e("EmptyPlaceholder"),_=$e("ScrollSeekPlaceholder")??$k,D=$e("ListComponent"),F=$e("ItemComponent"),C=$e("GroupComponent"),B=$e("computeItemKey"),L=$e("isSeeking"),U=$e("groupIndices").length>0,$=$e("alignToBottom"),q=$e("initialItemFinalLocationReached"),X=t?{}:{boxSizing:"border-box",...w?{display:"inline-block",height:"100%",marginLeft:T!==0?T:$?"auto":0,paddingLeft:a.offsetTop,paddingRight:a.offsetBottom,whiteSpace:"nowrap"}:{marginTop:T!==0?T:$?"auto":0,paddingBottom:a.offsetBottom,paddingTop:a.offsetTop},...q?{}:{visibility:"hidden"}};return!t&&a.totalCount===0&&A!==null&&A!==void 0?r.jsx(A,{...nn(A,m)}):r.jsx(D,{...nn(D,m),"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list",ref:E,style:X,children:(t?a.topItems:a.items).map(ee=>{const I=ee.originalIndex,z=B(I+a.firstItemIndex,ee.data,m);return L?p.createElement(_,{...nn(_,m),height:ee.size,index:ee.index,key:z,type:ee.type||"item",...ee.type==="group"?{}:{groupIndex:ee.groupIndex}}):ee.type==="group"?p.createElement(C,{...nn(C,m),"data-index":I,"data-item-index":ee.index,"data-known-size":ee.size,key:z,style:Vk},y(ee.index,m)):p.createElement(F,{...nn(F,m),...qk(F,ee.data),"data-index":I,"data-item-group-index":ee.groupIndex,"data-item-index":ee.index,"data-known-size":ee.size,key:z,style:w?Pk:xy},U?g(ee.index,ee.groupIndex,ee.data,m):g(ee.index,ee.data,m))})})}),Fk={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Gk={outline:"none",overflowX:"auto",position:"relative"},Qo=t=>({height:"100%",position:"absolute",top:0,width:"100%",...t?{display:"flex",flexDirection:"column"}:void 0}),Wk={position:Af(),top:0,width:"100%",zIndex:1};function nn(t,a){if(typeof t!="string")return{context:a}}function qk(t,a){return{item:typeof t=="string"?void 0:a}}const Yk=Ne.memo(function(){const t=$e("HeaderComponent"),a=Pn("headerHeight"),s=$e("HeaderFooterTag"),o=Va(Ne.useMemo(()=>u=>{a(sa(u,"height"))},[a]),!0,$e("skipAnimationFrameInResizeObserver")),c=$e("context");return t!=null?r.jsx(s,{ref:o,children:r.jsx(t,{...nn(t,c)})}):null}),Kk=Ne.memo(function(){const t=$e("FooterComponent"),a=Pn("footerHeight"),s=$e("HeaderFooterTag"),o=Va(Ne.useMemo(()=>u=>{a(sa(u,"height"))},[a]),!0,$e("skipAnimationFrameInResizeObserver")),c=$e("context");return t!=null?r.jsx(s,{ref:o,children:r.jsx(t,{...nn(t,c)})}):null});function gy({useEmitter:t,useEmitterValue:a,usePublisher:s}){return Ne.memo(function({children:o,style:c,context:u,...d}){const h=s("scrollContainerState"),g=a("ScrollerComponent"),m=s("smoothScrollTargetReached"),y=a("scrollerRef"),v=a("horizontalDirection")||!1,{scrollByCallback:b,scrollerRef:S,scrollToCallback:k}=hy(h,m,g,y,void 0,v);return t("scrollTo",k),t("scrollBy",b),r.jsx(g,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:S,style:{...v?Gk:Fk,...c},tabIndex:0,...d,...nn(g,u),children:o})})}function vy({useEmitter:t,useEmitterValue:a,usePublisher:s}){return Ne.memo(function({children:o,style:c,context:u,...d}){const h=s("windowScrollContainerState"),g=a("ScrollerComponent"),m=s("smoothScrollTargetReached"),y=a("totalListHeight"),v=a("deviation"),b=a("customScrollParent"),S=Ne.useRef(null),k=a("scrollerRef"),{scrollByCallback:w,scrollerRef:E,scrollToCallback:T}=hy(h,m,g,k,b);return my(()=>{var N;return E.current=b||((N=S.current)==null?void 0:N.ownerDocument.defaultView),()=>{E.current=null}},[E,b]),t("windowScrollTo",T),t("scrollBy",w),r.jsx(g,{ref:S,"data-virtuoso-scroller":!0,style:{position:"relative",...c,...y!==0?{height:y+v}:void 0},...d,...nn(g,u),children:o})})}const Xk=({children:t})=>{const a=Ne.useContext(fy),s=Pn("viewportHeight"),o=Pn("fixedItemHeight"),c=$e("alignToBottom"),u=$e("horizontalDirection"),d=Ne.useMemo(()=>Pv(s,g=>sa(g,u?"width":"height")),[s,u]),h=Va(d,!0,$e("skipAnimationFrameInResizeObserver"));return Ne.useEffect(()=>{a&&(s(a.viewportHeight),o(a.itemHeight))},[a,s,o]),r.jsx("div",{"data-viewport-type":"element",ref:h,style:Qo(c),children:t})},Qk=({children:t})=>{const a=Ne.useContext(fy),s=Pn("windowViewportRect"),o=Pn("fixedItemHeight"),c=$e("customScrollParent"),u=Gv(s,c,$e("skipAnimationFrameInResizeObserver")),d=$e("alignToBottom");return Ne.useEffect(()=>{a&&(o(a.itemHeight),s({listHeight:0,offsetTop:0,visibleHeight:a.viewportHeight,visibleWidth:100}))},[a,s,o]),r.jsx("div",{"data-viewport-type":"window",ref:u,style:Qo(d),children:t})},Zk=({children:t})=>{const a=$e("TopItemListComponent")??"div",s=$e("headerHeight"),o={...Wk,marginTop:`${s}px`},c=$e("context");return r.jsx(a,{style:o,...nn(a,c),children:t})},Jk=Ne.memo(function(t){const a=$e("useWindowScroll"),s=$e("topItemsIndexes").length>0,o=$e("customScrollParent"),c=$e("context");return r.jsxs(o||a?nw:tw,{...t,context:c,children:[s&&r.jsx(Zk,{children:r.jsx(kg,{showTopList:!0})}),r.jsxs(o||a?Qk:Xk,{children:[r.jsx(Yk,{}),r.jsx(kg,{}),r.jsx(Kk,{})]})]})}),{Component:ew,useEmitter:Lf,useEmitterValue:$e,usePublisher:Pn}=dy(Hk,{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"}},Jk),tw=gy({useEmitter:Lf,useEmitterValue:$e,usePublisher:Pn}),nw=vy({useEmitter:Lf,useEmitterValue:$e,usePublisher:Pn}),rw=ew,aw=tt(()=>{const t=ge(m=>r.jsxs("td",{children:["Item $",m]})),a=ge(null),s=ge(m=>r.jsxs("td",{colSpan:1e3,children:["Group ",m]})),o=ge(null),c=ge(null),u=ge({}),d=ge(Mf),h=ge(Il),g=(m,y=null)=>rn(me(u,ke(v=>v[m]),bt()),y);return{components:u,computeItemKey:d,context:a,EmptyPlaceholder:g("EmptyPlaceholder"),FillerRow:g("FillerRow"),fixedFooterContent:c,fixedHeaderContent:o,itemContent:t,groupContent:s,ScrollerComponent:g("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:g("ScrollSeekPlaceholder"),TableBodyComponent:g("TableBody","tbody"),TableComponent:g("Table","table"),TableFooterComponent:g("TableFoot","tfoot"),TableHeadComponent:g("TableHead","thead"),TableRowComponent:g("TableRow","tr"),GroupComponent:g("Group","tr")}});jt(uy,aw);Af();const wg={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},lw={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Cg,floor:Io,max:$s,min:Rd,round:Eg}=Math;function Ng(t,a,s){return Array.from({length:a-t+1}).map((o,c)=>({data:s===null?null:s[c+t],index:c+t}))}function sw(t){return{...lw,items:t}}function bo(t,a){return t!==void 0&&t.width===a.width&&t.height===a.height}function iw(t,a){return t!==void 0&&t.column===a.column&&t.row===a.row}const ow=tt(([{increaseViewportBy:t,listBoundary:a,overscan:s,visibleRange:o},{footerHeight:c,headerHeight:u,scrollBy:d,scrollContainerState:h,scrollTo:g,scrollTop:m,smoothScrollTargetReached:y,viewportHeight:v},b,S,{didMount:k,propsReady:w},{customScrollParent:E,useWindowScroll:T,windowScrollContainerState:N,windowScrollTo:A,windowViewportRect:_},D])=>{const F=ge(0),C=ge(0),B=ge(wg),L=ge({height:0,width:0}),U=ge({height:0,width:0}),$=Ze(),q=Ze(),X=ge(0),ee=ge(null),I=ge({column:0,row:0}),z=Ze(),O=Ze(),P=ge(!1),H=ge(0),ae=ge(!0),M=ge(!1),Y=ge(!1);at(me(k,Ge(H),_e(([ce,je])=>je!==0)),()=>{Fe(ae,!1)}),at(me(It(k,ae,U,L,H,M),_e(([ce,je,Re,Oe,,le])=>ce&&!je&&Re.height!==0&&Oe.height!==0&&!le)),([,,,,ce])=>{Fe(M,!0),Ef(1,()=>{Fe($,ce)}),Qn(me(m),()=>{Fe(a,[0,0]),Fe(ae,!0)})}),Te(me(O,_e(ce=>ce!=null&&ce.scrollTop>0),or(0)),C),at(me(k,Ge(O),_e(([,ce])=>ce!=null)),([,ce])=>{ce&&(Fe(L,ce.viewport),Fe(U,ce.item),Fe(I,ce.gap),ce.scrollTop>0&&(Fe(P,!0),Qn(me(m,Ua(1)),je=>{Fe(P,!1)}),Fe(g,{top:ce.scrollTop})))}),Te(me(L,ke(({height:ce})=>ce)),v),Te(me(It(De(L,bo),De(U,bo),De(I,(ce,je)=>ce!==void 0&&ce.column===je.column&&ce.row===je.row),De(m)),ke(([ce,je,Re,Oe])=>({gap:Re,item:je,scrollTop:Oe,viewport:ce}))),z),Te(me(It(De(F),o,De(I,iw),De(U,bo),De(L,bo),De(ee),De(C),De(P),De(ae),De(H)),_e(([,,,,,,,ce])=>!ce),ke(([ce,[je,Re],Oe,le,he,pe,xe,,be,Be])=>{const{column:Ue,row:lt}=Oe,{height:Ct,width:gt}=le,{width:Tt}=he;if(xe===0&&(ce===0||Tt===0))return wg;if(gt===0){const An=Nf(Be,ce),Et=An+Math.max(xe-1,0);return sw(Ng(An,Et,pe))}const Gt=yy(Tt,gt,Ue);let We,nt;be?je===0&&Re===0&&xe>0?(We=0,nt=xe-1):(We=Gt*Io((je+lt)/(Ct+lt)),nt=Gt*Cg((Re+lt)/(Ct+lt))-1,nt=Rd(ce-1,$s(nt,Gt-1)),We=Rd(nt,$s(0,We))):(We=0,nt=-1);const xn=Ng(We,nt,pe),{bottom:ye,top:ot}=Tg(he,Oe,le,xn),Wt=Cg(ce/Gt),Kt=Wt*Ct+(Wt-1)*lt-ye;return{bottom:ye,itemHeight:Ct,items:xn,itemWidth:gt,offsetBottom:Kt,offsetTop:ot,top:ot}})),B),Te(me(ee,_e(ce=>ce!==null),ke(ce=>ce.length)),F),Te(me(It(L,U,B,I),_e(([ce,je,{items:Re}])=>Re.length>0&&je.height!==0&&ce.height!==0),ke(([ce,je,{items:Re},Oe])=>{const{bottom:le,top:he}=Tg(ce,Oe,je,Re);return[he,le]}),bt(Ws)),a);const W=ge(!1);Te(me(m,Ge(W),ke(([ce,je])=>je||ce!==0)),W);const Q=Nn(me(It(B,F),_e(([{items:ce}])=>ce.length>0),Ge(W),_e(([[ce,je],Re])=>{const Oe=ce.items[ce.items.length-1].index===je-1;return(Re||ce.bottom>0&&ce.itemHeight>0&&ce.offsetBottom===0&&ce.items.length===je)&&Oe}),ke(([[,ce]])=>ce-1),bt())),oe=Nn(me(De(B),_e(({items:ce})=>ce.length>0&&ce[0].index===0),or(0),bt())),de=Nn(me(De(B),Ge(P),_e(([{items:ce},je])=>ce.length>0&&!je),ke(([{items:ce}])=>({endIndex:ce[ce.length-1].index,startIndex:ce[0].index})),bt(Qv),Ar(0)));Te(de,S.scrollSeekRangeChanged),Te(me($,Ge(L,U,F,I),ke(([ce,je,Re,Oe,le])=>{const he=ny(ce),{align:pe,behavior:xe,offset:be}=he;let Be=he.index;Be==="LAST"&&(Be=Oe-1),Be=$s(0,Be,Rd(Oe-1,Be));let Ue=lf(je,le,Re,Be);return pe==="end"?Ue=Eg(Ue-je.height+Re.height):pe==="center"&&(Ue=Eg(Ue-je.height/2+Re.height/2)),be!==void 0&&be!==0&&(Ue+=be),{behavior:xe,top:Ue}})),g);const ve=rn(me(B,ke(ce=>ce.offsetBottom+ce.bottom)),0);return Te(me(_,ke(ce=>({height:ce.visibleHeight,width:ce.visibleWidth}))),L),{customScrollParent:E,data:ee,deviation:X,footerHeight:c,gap:I,headerHeight:u,increaseViewportBy:t,initialItemCount:C,itemDimensions:U,overscan:s,restoreStateFrom:O,scrollBy:d,scrollContainerState:h,scrollHeight:q,scrollTo:g,scrollToIndex:$,scrollTop:m,smoothScrollTargetReached:y,totalCount:F,useWindowScroll:T,viewportDimensions:L,windowScrollContainerState:N,windowScrollTo:A,windowViewportRect:_,...S,gridState:B,horizontalDirection:Y,initialTopMostItemIndex:H,totalListHeight:ve,...b,endReached:Q,propsReady:w,rangeChanged:de,startReached:oe,stateChanged:z,stateRestoreInProgress:P,...D}},jt(Tf,cn,ni,oy,ua,Rf,ca));function yy(t,a,s){return $s(1,Io((t+s)/(Io(a)+s)))}function Tg(t,a,s,o){const{height:c}=s;if(c===void 0||o.length===0)return{bottom:0,top:0};const u=lf(t,a,s,o[0].index);return{bottom:lf(t,a,s,o[o.length-1].index)+c,top:u}}function lf(t,a,s,o){const c=yy(t.width,s.width,a.column),u=Io(o/c),d=u*s.height+$s(0,u-1)*a.row;return d>0?d+a.row:d}const cw=tt(()=>{const t=ge(v=>`Item ${v}`),a=ge({}),s=ge(null),o=ge("virtuoso-grid-item"),c=ge("virtuoso-grid-list"),u=ge(Mf),d=ge("div"),h=ge(Il),g=(v,b=null)=>rn(me(a,ke(S=>S[v]),bt()),b),m=ge(!1),y=ge(!1);return Te(De(y),m),{components:a,computeItemKey:u,context:s,FooterComponent:g("Footer"),HeaderComponent:g("Header"),headerFooterTag:d,itemClassName:o,ItemComponent:g("Item","div"),itemContent:t,listClassName:c,ListComponent:g("List","div"),readyStateChanged:m,reportReadyState:y,ScrollerComponent:g("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:g("ScrollSeekPlaceholder","div")}}),uw=tt(([t,a])=>({...t,...a}),jt(ow,cw)),dw=Ne.memo(function(){const t=kt("gridState"),a=kt("listClassName"),s=kt("itemClassName"),o=kt("itemContent"),c=kt("computeItemKey"),u=kt("isSeeking"),d=Fn("scrollHeight"),h=kt("ItemComponent"),g=kt("ListComponent"),m=kt("ScrollSeekPlaceholder"),y=kt("context"),v=Fn("itemDimensions"),b=Fn("gap"),S=kt("log"),k=kt("stateRestoreInProgress"),w=Fn("reportReadyState"),E=Va(Ne.useMemo(()=>T=>{const N=T.parentElement.parentElement.scrollHeight;d(N);const A=T.firstChild;if(A!==null){const{height:_,width:D}=A.getBoundingClientRect();v({height:_,width:D})}b({column:Rg("column-gap",getComputedStyle(T).columnGap,S),row:Rg("row-gap",getComputedStyle(T).rowGap,S)})},[d,v,b,S]),!0,!1);return my(()=>{t.itemHeight>0&&t.itemWidth>0&&w(!0)},[t]),k?null:r.jsx(g,{className:a,ref:E,...nn(g,y),"data-testid":"virtuoso-item-list",style:{paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},children:t.items.map(T=>{const N=c(T.index,T.data,y);return u?r.jsx(m,{...nn(m,y),height:t.itemHeight,index:T.index,width:t.itemWidth},N):p.createElement(h,{...nn(h,y),className:s,"data-index":T.index,key:N},o(T.index,T.data,y))})})}),fw=Ne.memo(function(){const t=kt("HeaderComponent"),a=Fn("headerHeight"),s=kt("headerFooterTag"),o=Va(Ne.useMemo(()=>u=>{a(sa(u,"height"))},[a]),!0,!1),c=kt("context");return t!=null?r.jsx(s,{ref:o,children:r.jsx(t,{...nn(t,c)})}):null}),pw=Ne.memo(function(){const t=kt("FooterComponent"),a=Fn("footerHeight"),s=kt("headerFooterTag"),o=Va(Ne.useMemo(()=>u=>{a(sa(u,"height"))},[a]),!0,!1),c=kt("context");return t!=null?r.jsx(s,{ref:o,children:r.jsx(t,{...nn(t,c)})}):null}),mw=({children:t})=>{const a=Ne.useContext(py),s=Fn("itemDimensions"),o=Fn("viewportDimensions"),c=Va(Ne.useMemo(()=>u=>{o(u.getBoundingClientRect())},[o]),!0,!1);return Ne.useEffect(()=>{a&&(o({height:a.viewportHeight,width:a.viewportWidth}),s({height:a.itemHeight,width:a.itemWidth}))},[a,o,s]),r.jsx("div",{ref:c,style:Qo(!1),children:t})},hw=({children:t})=>{const a=Ne.useContext(py),s=Fn("windowViewportRect"),o=Fn("itemDimensions"),c=kt("customScrollParent"),u=Gv(s,c,!1);return Ne.useEffect(()=>{a&&(o({height:a.itemHeight,width:a.itemWidth}),s({listHeight:0,offsetTop:0,visibleHeight:a.viewportHeight,visibleWidth:a.viewportWidth}))},[a,s,o]),r.jsx("div",{ref:u,style:Qo(!1),children:t})},xw=Ne.memo(function({...t}){const a=kt("useWindowScroll"),s=kt("customScrollParent"),o=s||a?vw:gw,c=s||a?hw:mw,u=kt("context");return r.jsx(o,{...t,...nn(o,u),children:r.jsxs(c,{children:[r.jsx(fw,{}),r.jsx(dw,{}),r.jsx(pw,{})]})})}),{useEmitter:by,useEmitterValue:kt,usePublisher:Fn}=dy(uw,{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"}},xw),gw=gy({useEmitter:by,useEmitterValue:kt,usePublisher:Fn}),vw=vy({useEmitter:by,useEmitterValue:kt,usePublisher:Fn});function Rg(t,a,s){return a!=="normal"&&(a==null?void 0:a.endsWith("px"))!==!0&&s(`${t} was not resolved to pixel value correctly`,a,Pt.WARN),a==="normal"?0:parseInt(a??"0",10)}const yw={source:"vskill-sidebar-own-collapsed",installed:"vskill-sidebar-installed-collapsed"},jy={source:"Own",installed:"Installed"};function bw(t){try{const a=localStorage.getItem(t);if(a!=null)return a==="true"}catch{}try{if(typeof sessionStorage<"u"){const a=sessionStorage.getItem(t);if(a!=null)return a==="true"}}catch{}return!1}function jw(t,a){const s=a?"true":"false";try{localStorage.setItem(t,s)}catch{}try{typeof sessionStorage<"u"&&sessionStorage.setItem(t,s)}catch{}}function Ag({origin:t,count:a,filteredCount:s,updateCount:o,children:c}){const u=yw[t],[d,h]=p.useState(()=>bw(u)),g=p.useCallback(()=>{h(b=>{const S=!b;return jw(u,S),S})},[u]),m=jy[t],y=`sidebar-section-${t}-header`,v=`sidebar-section-${t}-group`;return r.jsxs("section",{"aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:[r.jsxs("button",{id:y,type:"button","data-testid":"sidebar-section-header","aria-expanded":!d,"aria-controls":v,onClick:g,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 12px 6px 14px",background:"transparent",border:"none",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",textAlign:"left"},children:[r.jsx(kw,{collapsed:d}),r.jsx("h2",{"aria-level":2,style:{fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)",margin:0},children:m}),r.jsx("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:s!=null&&s!==a?`(${s} of ${a})`:`(${a})`}),o!=null&&o>0&&r.jsx(Sw,{origin:t,updateCount:o})]}),!d&&r.jsx("div",{id:v,role:"group","aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:c})]})}function Sw({origin:t,updateCount:a}){const[s,o]=p.useState(!1),c=jy[t].toLowerCase(),u=`${a} updates available in ${c} section, view all`;return r.jsxs("span",{role:"link",tabIndex:0,"data-testid":"sidebar-section-update-chip","aria-label":u,onClick:d=>{d.stopPropagation(),window.location.hash="#/updates"},onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),d.stopPropagation(),window.location.hash="#/updates")},onFocus:()=>o(!0),onBlur:()=>o(!1),style:{display:"inline-flex",alignItems:"center",gap:2,fontSize:10,color:"var(--color-own)",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",cursor:"pointer",padding:"0 4px",borderRadius:3,outline:s?"2px solid var(--border-focus)":"none",outlineOffset:2},children:[a," updates",r.jsx("span",{"aria-hidden":"true",style:{fontSize:9,marginLeft:2},children:"▾"})]})}function kw({collapsed:t}){return r.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:t?"rotate(0deg)":"rotate(90deg)",transition:"transform var(--duration-fast, 120ms) var(--ease-standard, ease)",flexShrink:0},children:r.jsx("polyline",{points:"9 18 15 12 9 6"})})}function zf(t,a){const s=a.trim().toLowerCase();return s?t.skill.toLowerCase().includes(s)||t.plugin.toLowerCase().includes(s)||t.dir.toLowerCase().includes(s):!0}function ww({value:t,onChange:a,placeholder:s="Filter skills…",validationPattern:o,validationMessage:c="Invalid filter expression"}){const u=p.useRef(null),d=p.useId(),h=!!o&&t.trim()!==""&&!o.test(t);return p.useEffect(()=>{function g(m){var b;if(m.key!=="/")return;const y=m.target;if(!y)return;const v=y.tagName;v==="INPUT"||v==="TEXTAREA"||y.isContentEditable||(m.preventDefault(),(b=u.current)==null||b.focus())}return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[]),r.jsxs("div",{role:"search",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",borderBottom:"1px solid var(--border-default)"},children:[r.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:[r.jsx("circle",{cx:"11",cy:"11",r:"8"}),r.jsx("path",{d:"M21 21l-4.35-4.35"})]}),r.jsx("input",{ref:u,type:"search","aria-label":"Filter skills","aria-invalid":h?!0:void 0,"aria-describedby":h?d:void 0,value:t,placeholder:s,onChange:g=>a(g.currentTarget.value),onKeyDown:g=>{g.key==="Escape"&&(a(""),g.currentTarget.blur())},style:{flex:1,minWidth:0,border:"none",outline:"none",background:"transparent",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:12,padding:"2px 0"}}),h&&r.jsx("span",{id:d,role:"alert","aria-live":"polite",style:{fontFamily:"var(--font-sans)",fontSize:10,color:"var(--text-error, #B42318)",marginLeft:4,whiteSpace:"nowrap"},children:c}),r.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:t?"none":"inline-block"},children:"/"})]})}function Cw({target:t}){const a=typeof t=="string"&&t.length>0,s=a?`symlinked → ${t}`:"symlinked — cycle detected or target unresolved",o=a?`symlinked from ${t}`:"symlinked, target unresolved";return r.jsx("span",{"data-testid":"symlink-chip",role:"img","aria-label":o,title:s,tabIndex:0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:14,height:14,borderRadius:3,color:"var(--text-secondary)",flexShrink:0},children:r.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:[r.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"}),r.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 Ew({skill:t}){if(!t.updateAvailable)return null;const a=t.currentVersion??"",s=t.latestVersion,o=s?`Update available: ${a} → ${s}`.trim():"Update available";return r.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:r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M12 19V5"}),r.jsx("path",{d:"M5 12l7-7 7 7"})]})})}function Nw({skillId:t,trackedForUpdates:a}){let s=null;try{s=p.useContext(Lv)}catch{s=null}const o=s==null?void 0:s.updatesById.get(t);if(o){const c=`Update available → ${o.version}${o.diffSummary?` — ${o.diffSummary}`:""}`;return r.jsx("span",{"data-testid":"update-chip-update-dot","aria-label":`Update available: ${o.version}`,title:c,style:{display:"inline-block",width:8,height:8,borderRadius:999,background:"var(--color-accent, #2563eb)",flexShrink:0}})}return a?null:r.jsx("span",{"data-testid":"update-chip-untracked-dot","aria-label":"Not tracked for updates",title:"Not tracked — run `vskill outdated` manually",style:{display:"inline-block",width:6,height:6,borderRadius:999,background:"var(--text-muted, var(--text-secondary))",opacity:.55,flexShrink:0}})}function Tw(t,a,s){if(!(!t||t==="frontmatter"))return t==="plugin"?`Inherited from ${s&&s.trim()!==""?s:"plugin"} plugin v${a}`:t==="registry"?"Inherited from registry":"No version declared"}function ri(t){const{version:a,showPrefix:s=!0,size:o="md",source:c,pluginName:u}=t,d=typeof a=="string"?a.trim():"",h=d===""||d==="0.0.0"?"1.0.0":d,g=s&&!h.startsWith("v")?`v${h}`:h,m=o==="sm"?10:12,y=o==="sm"?1:2,v=o==="sm"?5:8,b=c!==void 0&&c!=="frontmatter",S=Tw(c,h,u),k=t.title??S,w={display:"inline-flex",alignItems:"center",padding:`${y}px ${v}px`,border:"1px solid var(--border, var(--border-default))",borderRadius:4,background:"var(--bg-subtle, var(--surface-1, transparent))",color:"var(--text-secondary)",fontFamily:"var(--font-mono, var(--font-geist-mono))",fontSize:m,fontVariantNumeric:"tabular-nums",lineHeight:1.2,whiteSpace:"nowrap",flexShrink:0};return b&&(w.fontStyle="italic"),r.jsx("span",{"data-testid":t["data-testid"]??"version-badge","data-version":h,"data-version-source":c,title:k,style:w,children:g})}function Rw({skill:t,isSelected:a,onSelect:s,onContextMenu:o}){const c=t.origin==="installed"?"var(--status-installed)":"var(--status-own)";return r.jsxs("button",{type:"button",onClick:s,onContextMenu:o?u=>{u.preventDefault(),o(u,t)}:void 0,"aria-current":a?"true":void 0,"aria-selected":!!a,"data-testid":"skill-row","data-selected":a,"data-origin":t.origin,"data-skill-id":`${t.plugin}/${t.skill}`,style:{display:"flex",alignItems:"center",gap:8,width:"100%",height:36,padding:"0 12px 0 14px",background:a?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",boxShadow:a?"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:[r.jsx("span",{"aria-hidden":"true","aria-label":t.updateAvailable?"Update available":void 0,title:t.updateAvailable?`Update available${t.latestVersion?` → ${t.latestVersion}`:""}`:void 0,style:{width:t.updateAvailable?10:6,height:t.updateAvailable?10:6,borderRadius:"50%",background:c,display:"inline-block",flexShrink:0,boxShadow:t.updateAvailable?"0 0 0 2px var(--color-own, #d97706)":"none",transition:"box-shadow 180ms ease, width 180ms ease, height 180ms ease"}}),r.jsx("span",{title:t.skill,style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.skill}),r.jsx(ri,{version:t.resolvedVersion??t.version??"1.0.0",source:t.versionSource??(t.version?"frontmatter":"default"),pluginName:t.pluginName??null,size:"sm",showPrefix:!1,"data-testid":"skill-row-version"}),t.isSymlink&&r.jsx(Cw,{target:t.symlinkTarget??null}),r.jsx(Ew,{skill:t}),r.jsx(Nw,{skillId:`${t.plugin}/${t.skill}`,trackedForUpdates:t.trackedForUpdates??!0})]})}const Uo=p.memo(Rw);function Aw({plugin:t,skills:a,selectedKey:s,onSelect:o,onContextMenu:c}){const u=[...a].sort((d,h)=>d.skill.localeCompare(h.skill));return r.jsxs("div",{role:"group","aria-label":`${t} (${a.length})`,children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[r.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:t,children:t}),r.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",a.length,")"]})]}),r.jsx("div",{role:"list",children:u.map(d=>{const h=!!s&&s.plugin===d.plugin&&s.skill===d.skill;return r.jsx("div",{role:"listitem",children:r.jsx(Uo,{skill:d,isSelected:h,onSelect:()=>o(d),onContextMenu:c})},`${d.plugin}/${d.skill}`)})})]})}function Mw(t,a){if(!t||typeof window>"u")return a;try{const s=window.localStorage.getItem(t);return s===null?a:s==="true"}catch{return a}}function Mg({skills:t,pluginName:a,initialCollapsed:s=!1,persistKey:o,renderSkill:c,headerActionSlot:u,forceOpen:d=!1}){var S;const h=a??((S=t[0])==null?void 0:S.pluginName)??"unknown-plugin",[g,m]=p.useState(()=>Mw(o,s)),y=d?!1:g,v=p.useCallback(()=>{m(k=>{const w=!k;if(o&&typeof window<"u")try{window.localStorage.setItem(o,String(w))}catch{}return w})},[o]),b=y?"▸":"▾";return r.jsxs("div",{"data-vskill-plugin-tree":h,role:"group","aria-label":`${h} (${t.length})`,children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",paddingRight:6},children:[r.jsxs("button",{type:"button",onClick:v,"aria-expanded":!y,style:{display:"flex",alignItems:"center",gap:6,flex:1,padding:"4px 4px 4px 18px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",color:"var(--text-primary)",fontSize:12,fontWeight:500},children:[r.jsx("span",{"aria-hidden":!0,className:"vskill-chevron tabular-nums",style:{width:16,display:"inline-block",textAlign:"center",fontSize:14,fontWeight:700,color:"var(--color-ink, var(--text-primary))"},children:b}),r.jsx("span",{className:"vskill-plugin-name",style:{fontFamily:"var(--font-mono)"},children:h}),r.jsxs("span",{className:"vskill-plugin-count tabular-nums",style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:["(",t.length,")"]})]}),u&&r.jsx("div",{style:{display:"inline-flex",alignItems:"center",flexShrink:0},children:u})]}),!y&&r.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:t.map(k=>r.jsx("div",{"data-vskill-plugin-skill":k.pluginNamespace??k.skill,children:c(k)},`${k.pluginNamespace??k.skill}`))})]})}function Lw({pluginName:t,enabled:a,onAfterAction:s}){const[o,c]=p.useState(!1),[u,d]=p.useState(null),[h,g]=p.useState(null),m=p.useRef(null);p.useEffect(()=>{if(!o)return;function v(b){m.current&&!m.current.contains(b.target)&&c(!1)}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]);async function y(v){d(v),g(null);try{if(v==="uninstall"&&!window.confirm(`Uninstall ${t}? This removes the plugin and its skills.`)){d(null);return}const b=await fetch(`/api/plugins/${encodeURIComponent(t)}/${v}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),S=await b.json().catch(()=>({}));if(!b.ok||!S.ok){g(S.error??`${v} failed (${b.status})`);return}En("skills"),$v(),s==null||s(),c(!1)}catch(b){g(b instanceof Error?b.message:String(b))}finally{d(null)}}return r.jsxs("div",{ref:m,style:{position:"relative",display:"inline-flex"},children:[r.jsx("button",{type:"button","aria-label":`Manage ${t}`,title:`Manage ${t}`,onClick:v=>{v.stopPropagation(),c(b=>!b)},"data-vskill-plugin-action-trigger":t,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:22,height:22,padding:0,marginLeft:4,border:"none",background:o?"var(--surface-2, rgba(0,0,0,0.08))":"transparent",color:"var(--text-tertiary)",borderRadius:4,cursor:"pointer",fontSize:14,lineHeight:1},onMouseEnter:v=>{v.currentTarget.style.color="var(--text-primary)",v.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.06))"},onMouseLeave:v=>{v.currentTarget.style.color="var(--text-tertiary)",v.currentTarget.style.background=o?"var(--surface-2, rgba(0,0,0,0.08))":"transparent"},children:"⋯"}),o&&r.jsxs("div",{role:"menu",style:{position:"absolute",top:"calc(100% + 2px)",right:0,minWidth:160,background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,boxShadow:"0 4px 6px -1px rgba(0,0,0,0.08), 0 8px 14px -4px rgba(0,0,0,0.12)",padding:4,zIndex:30,fontFamily:"var(--font-sans)"},children:[a?r.jsx(Ad,{onClick:()=>void y("disable"),disabled:u!==null,busy:u==="disable",label:"Disable",hint:"Keep installed, turn off"}):r.jsx(Ad,{onClick:()=>void y("enable"),disabled:u!==null,busy:u==="enable",label:"Enable",hint:"Activate plugin"}),r.jsx(Ad,{onClick:()=>void y("uninstall"),disabled:u!==null,busy:u==="uninstall",label:"Uninstall",hint:"Remove plugin + skills",danger:!0}),h&&r.jsx("div",{style:{padding:"6px 8px",fontSize:11,color:"var(--color-error, #b91c1c)",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4,marginTop:4,lineHeight:1.4,maxWidth:240,wordBreak:"break-word"},children:h})]})]})}function Ad({onClick:t,disabled:a,busy:s,label:o,hint:c,danger:u}){return r.jsxs("button",{type:"button",onClick:d=>{d.stopPropagation(),t()},disabled:a,role:"menuitem",style:{display:"block",width:"100%",padding:"6px 10px",textAlign:"left",border:"none",background:"transparent",borderRadius:4,cursor:a?"not-allowed":"pointer",color:u?"var(--color-error, #b91c1c)":"var(--text-primary)",opacity:a&&!s?.5:1,fontFamily:"inherit"},onMouseEnter:d=>{a||(d.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.05))")},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},children:[r.jsx("div",{style:{fontSize:12,fontWeight:500},children:s?`${o}…`:o}),r.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)"},children:c})]})}function Lg({name:t,count:a,className:s,variant:o,collapsed:c,onToggle:u,action:d}){const h=o==="authoring"?"var(--color-own, #f59e0b)":"var(--color-accent, #2f6f8f)",g=o==="authoring"?"color-mix(in oklch, var(--color-own, #f59e0b) 10%, var(--color-paper, #fff))":"color-mix(in oklch, var(--color-accent, #2f6f8f) 8%, var(--color-paper, #fff))",m=typeof u=="function",y={position:"sticky",top:0,zIndex:4,backdropFilter:"saturate(1.4) blur(10px)",WebkitBackdropFilter:"saturate(1.4) blur(10px)",background:g,borderLeft:`3px solid ${h}`,borderBottom:"1px solid var(--border-subtle, rgba(128,128,128,0.2))",padding:"7px 10px 7px 9px",fontFamily:"var(--font-serif, ui-serif)",fontSize:13,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-primary)",display:"flex",alignItems:"center",gap:8,width:"100%",cursor:m?"pointer":"default",border:"none",textAlign:"left"},v=c?"▸":"▾",b=r.jsxs(r.Fragment,{children:[m&&r.jsx("span",{"aria-hidden":!0,style:{fontSize:15,fontWeight:700,color:h,width:16,display:"inline-block",textAlign:"center",letterSpacing:0,textTransform:"none"},children:v}),r.jsx("span",{className:"vskill-group-header-name",children:t}),r.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:["(",a,")"]}),d&&r.jsx("span",{style:{marginLeft:"auto"},children:r.jsx(zw,{label:d.label,title:d.title,icon:d.icon,onClick:d.onClick,accent:h})})]});return m?r.jsx("button",{type:"button","data-vskill-group-header":t,className:["vskill-group-header select-none",s??""].join(" ").trim(),style:y,onClick:()=>u(!c),"aria-expanded":!c,children:b}):r.jsx("div",{"data-vskill-group-header":t,role:"heading","aria-level":3,className:["vskill-group-header select-none",s??""].join(" ").trim(),style:y,children:b})}function zw({label:t,title:a,icon:s,onClick:o,accent:c}){return r.jsxs("button",{type:"button","aria-label":t,title:a??t,onClick:u=>{u.stopPropagation(),o()},style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4,height:22,padding:"0 7px",border:`1px solid ${c}`,background:"transparent",color:c,borderRadius:4,fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",cursor:"pointer",fontFamily:"inherit"},onMouseEnter:u=>{u.currentTarget.style.background=`color-mix(in oklch, ${c} 15%, transparent)`},onMouseLeave:u=>{u.currentTarget.style.background="transparent"},children:[s,t]})}function Dw(){return r.jsxs("div",{"aria-hidden":"true",role:"presentation",style:{display:"flex",alignItems:"center",gap:8,height:36,padding:"0 12px 0 14px"},children:[r.jsx("span",{className:"placeholder",style:{width:6,height:6,borderRadius:"50%",flexShrink:0}}),r.jsx("span",{className:"placeholder",style:{height:10,flex:1,borderRadius:3,maxWidth:180}})]})}function _w(t){const a=t.key.split("+").map(h=>h.trim()).filter(Boolean);let s=!!t.meta,o=!!t.ctrl,c=!!t.shift,u=!!t.alt,d=t.key;if(a.length>1){for(const h of a.slice(0,-1)){const g=h.toLowerCase();g==="cmd"||g==="meta"||g==="⌘"?s=!0:g==="ctrl"||g==="control"?o=!0:g==="shift"?c=!0:(g==="alt"||g==="option")&&(u=!0)}d=a[a.length-1]}return{key:d.length===1?d.toLowerCase():d,meta:s,ctrl:o,shift:c,alt:u,allowInInputs:!!t.allowInInputs,handler:t.handler}}function Ow(t){if(!t||!(t instanceof HTMLElement))return!1;const a=t.tagName;if(a==="INPUT"||a==="TEXTAREA"||t.isContentEditable)return!0;const s=t.getAttribute("contenteditable");return s!=null&&s!=="false"||t.getAttribute("role")==="textbox"}function Bw(t,a){const s=!!t.metaKey,o=!!t.ctrlKey,c=!!t.shiftKey,u=!!t.altKey;return s!==a.meta||o!==a.ctrl||c!==a.shift||u!==a.alt?!1:(t.key.length===1?t.key.toLowerCase():t.key)===a.key}function sf(t,a={}){const{enabled:s=!0,target:o}=a,c=p.useRef([]),u=Array.isArray(t)?t:[t];c.current=u.map(_w),p.useEffect(()=>{if(!s)return;const d=o??(typeof window<"u"?window:void 0);if(!d)return;function h(g){const m=g,y=Ow(m.target);for(const v of c.current){if(!Bw(m,v))continue;const b=v.meta||v.ctrl||v.alt;if(!(y&&!v.allowInInputs&&!b)){v.handler(m);return}}}return d.addEventListener("keydown",h),()=>{d.removeEventListener("keydown",h)}},[s,o])}const Iw=200;function Uw(t){return t.scope==="own"||t.scope==="installed"||t.scope==="global"?t.scope:t.origin==="installed"?"installed":"own"}function Hw(t,a){const s={availableProject:[],availablePersonal:[],availablePlugin:[],authoringProject:[],authoringPlugin:[]};for(const c of t){const u=c.scopeV2??(c.scope==="installed"?"available-project":c.scope==="global"?"available-personal":"authoring-project");u==="available-project"?s.availableProject.push(c):u==="available-personal"?s.availablePersonal.push(c):u==="available-plugin"?s.availablePlugin.push(c):u==="authoring-plugin"?s.authoringPlugin.push(c):s.authoringProject.push(c)}function o(c){const u=c.filter(g=>zf(g,a)),d={};for(const g of u){const m=g.pluginName??g.plugin;(d[m]||(d[m]=[])).push(g)}const h=Object.entries(d).sort((g,m)=>g[0].localeCompare(m[0]));return{total:c.length,filtered:u.length,byPlugin:h}}return{availableProject:o(s.availableProject),availablePersonal:o(s.availablePersonal),availablePlugin:o(s.availablePlugin),authoringProject:o(s.authoringProject),authoringPlugin:o(s.authoringPlugin)}}function $w(t,a){const s=[],o=[],c=[];for(const d of t){const h=Uw(d);h==="global"?c.push(d):h==="installed"?o.push(d):s.push(d)}function u(d){var y;const h=d.filter(v=>zf(v,a)),g={};for(const v of h)(g[y=v.plugin]||(g[y]=[])).push(v);const m=Object.entries(g).sort((v,b)=>v[0].localeCompare(b[0]));return{total:d.length,filtered:h.length,byPlugin:m}}return{own:u(s),installed:u(o),global:u(c)}}function Vw(t,a){const s=[],o=[];for(const u of t)(u.origin==="installed"?o:s).push(u);function c(u){var m;const d=u.filter(y=>zf(y,a)),h={};for(const y of d)(h[m=y.plugin]||(h[m]=[])).push(y);const g=Object.entries(h).sort((y,v)=>y[0].localeCompare(v[0]));return{total:u.length,filtered:d.length,byPlugin:g}}return{own:c(s),installed:c(o)}}function Pw({skills:t,selectedKey:a,onSelect:s,isLoading:o,error:c,onRetry:u,onContextMenu:d,outdatedByOrigin:h,activeAgentId:g,outdatedByScope:m,topSlot:y,revealSkillId:v,onRevealComplete:b}){const S=!!g||t.some(W=>W.scope!==void 0&&W.scope!==null),k=g??"claude-cli",[w,E]=p.useState(""),T=p.useDeferredValue(w),N=p.useMemo(()=>$w(t,T),[t,T]),A=p.useMemo(()=>Hw(t,T),[t,T]),_=k==="claude-code",{plugins:D}=q2(),F=_?{plugins:D??[]}:void 0,C=p.useMemo(()=>{const W=new Map;for(const Q of(F==null?void 0:F.plugins)??[]){const oe=W.get(Q.name);W.set(Q.name,!!oe||!!Q.enabled)}return W},[F==null?void 0:F.plugins]),[B,L]=p.useState(()=>of(`vskill-sidebar-${k}-group-available-collapsed`)),[U,$]=p.useState(()=>of(`vskill-sidebar-${k}-group-authoring-collapsed`)),q=p.useCallback(W=>{L(W);try{window.localStorage.setItem(`vskill-sidebar-${k}-group-available-collapsed`,String(W))}catch{}},[k]),X=p.useCallback(W=>{$(W);try{window.localStorage.setItem(`vskill-sidebar-${k}-group-authoring-collapsed`,String(W))}catch{}},[k]),{own:ee,installed:I}=p.useMemo(()=>Vw(t,T),[t,T]),O=N.own.filtered+N.installed.filtered+N.global.filtered>=Iw,P=p.useMemo(()=>{const W=Q=>{const oe=[];for(const[,de]of Q){const ve=[...de].sort((ce,je)=>ce.skill.localeCompare(je.skill));oe.push(...ve)}return oe};return S?[...W(N.own.byPlugin),...W(N.installed.byPlugin),...W(N.global.byPlugin)]:[...W(ee.byPlugin),...W(I.byPlugin)]},[S,N.own.byPlugin,N.installed.byPlugin,N.global.byPlugin,ee.byPlugin,I.byPlugin]),H=p.useMemo(()=>a?P.findIndex(W=>W.plugin===a.plugin&&W.skill===a.skill):-1,[P,a]),ae=p.useCallback(W=>{if(P.length===0)return;const Q=H<0?W>0?0:P.length-1:Math.min(Math.max(H+W,0),P.length-1);s(P[Q])},[P,H,s]),M=p.useMemo(()=>{if(!v)return null;const[W,Q]=v.split("/");if(!W||!Q)return null;const oe=t.find(ce=>ce.plugin===W&&ce.skill===Q);if(!oe)return{plugin:W,skill:Q,bucket:null,pluginName:null};const de=oe.source==="plugin"?"plugin":"project",ve=de==="plugin"?oe.pluginName??W:null;return{plugin:W,skill:Q,bucket:de,pluginName:ve}},[v,t]),Y=p.useRef(null);return p.useEffect(()=>{if(!v){Y.current=null;return}if(Y.current===v)return;const W=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(v):v.replace(/["\\]/g,"\\$&"),Q=document.querySelector(`[data-skill-id="${W}"]`);Q&&(Y.current=v,Q.scrollIntoView({behavior:"smooth",block:"nearest"}),b==null||b())},[v,b,t]),sf([{key:"j",handler:()=>ae(1)},{key:"k",handler:()=>ae(-1)},{key:"Enter",handler:()=>{H>=0&&s(P[H])}}],{enabled:!o&&!c}),r.jsxs("div",{"data-testid":"sidebar",style:{display:"flex",flexDirection:"column",minHeight:0,height:"100%",fontFamily:"var(--font-sans)"},children:[y,r.jsx(ww,{value:w,onChange:E}),o&&r.jsx(Yw,{}),!o&&c&&r.jsx(Kw,{error:c,onRetry:u}),!o&&!c&&S&&r.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[r.jsx(Lg,{name:ne.scopeLabels.groupAvailable.toUpperCase(),variant:"available",collapsed:B,onToggle:q,count:A.availableProject.total+A.availablePersonal.total+A.availablePlugin.total}),!B&&r.jsxs(r.Fragment,{children:[r.jsx(zs,{label:ne.scopeLabels.sourceProject,storageKey:`vskill-sidebar-${k}-available-project-collapsed`,count:A.availableProject.total,filteredCount:w?A.availableProject.filtered:null,updateCount:(m==null?void 0:m.installed)??(h==null?void 0:h.installed),children:A.availableProject.filtered===0?r.jsx(Dg,{queryActive:!!w,agentId:k}):r.jsx(Ds,{items:A.availableProject.byPlugin,selectedKey:a,onSelect:s,onContextMenu:d,useVirtual:O})}),r.jsx(zs,{label:ne.scopeLabels.sourcePersonal,storageKey:`vskill-sidebar-${k}-available-personal-collapsed`,count:A.availablePersonal.total,filteredCount:w?A.availablePersonal.filtered:null,updateCount:m==null?void 0:m.global,children:A.availablePersonal.filtered===0?r.jsx(Gw,{queryActive:!!w,agentId:k}):r.jsx(Ds,{items:A.availablePersonal.byPlugin,selectedKey:a,onSelect:s,onContextMenu:d,useVirtual:O})}),_&&r.jsxs(zs,{label:ne.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${k}-available-plugin-collapsed`,count:A.availablePlugin.total,filteredCount:w?A.availablePlugin.filtered:null,children:[r.jsxs("button",{type:"button",onClick:()=>window.dispatchEvent(new CustomEvent("studio:open-marketplace")),style:{display:"flex",alignItems:"center",gap:6,margin:"4px 14px 6px",padding:"4px 8px",fontSize:11,fontWeight:500,border:"1px dashed var(--color-accent, #2f6f8f)",borderRadius:4,background:"transparent",color:"var(--color-accent, #2f6f8f)",cursor:"pointer"},children:[r.jsx("span",{"aria-hidden":!0,children:"🛒"})," Browse marketplaces…"]}),A.availablePlugin.filtered===0?r.jsx("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:"No plugin skills installed yet."}):A.availablePlugin.byPlugin.map(([W,Q])=>r.jsx(Mg,{pluginName:W,skills:Q,persistKey:`vskill-plugin-available-${W}-collapsed`,headerActionSlot:_?r.jsx(Lw,{pluginName:W,enabled:C.get(W)??!0}):void 0,renderSkill:oe=>r.jsx(Uo,{skill:oe,isSelected:(a==null?void 0:a.plugin)===oe.plugin&&(a==null?void 0:a.skill)===oe.skill,onSelect:()=>s(oe),onContextMenu:d})},`available-${W}`))]})]}),r.jsx(qw,{}),r.jsx(Lg,{name:ne.scopeLabels.groupAuthoring.toUpperCase(),variant:"authoring",collapsed:M?!1:U,onToggle:X,count:A.authoringProject.total+A.authoringPlugin.total,action:{label:"New",title:"Create a new skill (standalone or plugin)",icon:r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[r.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),r.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),onClick:()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:request-create-skill",{detail:{mode:"standalone"}}))}}}),(!U||M)&&r.jsxs(r.Fragment,{children:[r.jsx(zs,{label:ne.scopeLabels.authoringSkills,storageKey:`vskill-sidebar-${k}-authoring-project-collapsed`,count:A.authoringProject.total,filteredCount:w?A.authoringProject.filtered:null,updateCount:(m==null?void 0:m.own)??(h==null?void 0:h.source),forceOpen:(M==null?void 0:M.bucket)==="project",children:A.authoringProject.filtered===0?r.jsx(zg,{queryActive:!!w}):r.jsx(Ds,{items:A.authoringProject.byPlugin,selectedKey:a,onSelect:s,onContextMenu:d,useVirtual:O})}),_&&r.jsx(zs,{label:ne.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${k}-authoring-plugin-collapsed`,count:A.authoringPlugin.total,filteredCount:w?A.authoringPlugin.filtered:null,forceOpen:(M==null?void 0:M.bucket)==="plugin",children:A.authoringPlugin.filtered===0?r.jsxs("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:["No plugin sources in this project. Add ",r.jsx("code",{children:"<plugin>/.claude-plugin/plugin.json"}),"."]}):A.authoringPlugin.byPlugin.map(([W,Q])=>r.jsx(Mg,{pluginName:W,skills:Q,persistKey:`vskill-plugin-authoring-${W}-collapsed`,forceOpen:(M==null?void 0:M.bucket)==="plugin"&&M.pluginName===W,renderSkill:oe=>r.jsx(Uo,{skill:oe,isSelected:(a==null?void 0:a.plugin)===oe.plugin&&(a==null?void 0:a.skill)===oe.skill,onSelect:()=>s(oe),onContextMenu:d})},`authoring-${W}`))})]})]}),!o&&!c&&!S&&r.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[r.jsx(Ag,{origin:"source",count:ee.total,filteredCount:w?ee.filtered:null,updateCount:h==null?void 0:h.source,children:ee.filtered===0?r.jsx(zg,{queryActive:!!w}):r.jsx(Ds,{items:ee.byPlugin,selectedKey:a,onSelect:s,onContextMenu:d,useVirtual:O})}),r.jsx(Ww,{}),r.jsx(Ag,{origin:"installed",count:I.total,filteredCount:w?I.filtered:null,updateCount:h==null?void 0:h.installed,children:I.filtered===0?r.jsx(Dg,{queryActive:!!w}):r.jsx(Ds,{items:I.byPlugin,selectedKey:a,onSelect:s,onContextMenu:d,useVirtual:O})})]})]})}function of(t){if(typeof window>"u")return!1;try{return window.localStorage.getItem(t)==="true"}catch{return!1}}function zs({label:t,storageKey:a,count:s,filteredCount:o,updateCount:c,children:u,forceOpen:d=!1}){const[h,g]=p.useState(()=>of(a)),m=d?!1:h,y=p.useCallback(()=>{g(b=>{const S=!b;if(typeof window<"u")try{window.localStorage.setItem(a,String(S))}catch{}return S})},[a]),v=o!=null&&o!==s?`${o} of ${s}`:String(s);return r.jsxs("section",{"data-vskill-named-scope":t,children:[r.jsxs("button",{type:"button",onClick:y,"aria-expanded":!m,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:[r.jsx("span",{"aria-hidden":!0,style:{fontSize:14,fontWeight:700,color:"var(--color-ink, var(--text-primary))",width:16,display:"inline-block",textAlign:"center"},children:m?"▸":"▾"}),r.jsx("span",{style:{fontSize:12,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)"},children:t}),r.jsxs("span",{style:{fontSize:11,color:"var(--text-tertiary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",v,")"]}),c!=null&&c>0&&r.jsxs("span",{style:{marginLeft:"auto",fontSize:10,color:"var(--color-own, #f59e0b)"},children:[c," update",c!==1?"s":""]})]}),!m&&r.jsx("div",{style:{paddingLeft:18},children:u})]})}function Fw(t){const a=[];for(const[s,o]of t){const c=[...o].sort((u,d)=>u.skill.localeCompare(d.skill));a.push({kind:"header",plugin:s,count:c.length});for(const u of c)a.push({kind:"row",skill:u})}return a}function Ds({items:t,selectedKey:a,onSelect:s,onContextMenu:o,useVirtual:c}){if(c){const u=Fw(t);return r.jsx("div",{"data-virtualized":"true",style:{height:420,minHeight:200},children:r.jsx(rw,{overscan:4,totalCount:u.length,itemContent:d=>{const h=u[d];if(!h)return null;if(h.kind==="header")return r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[r.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)"},children:h.plugin}),r.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",h.count,")"]})]});const g=h.skill,m=!!a&&a.plugin===g.plugin&&a.skill===g.skill;return r.jsx(Uo,{skill:g,isSelected:m,onSelect:()=>s(g),onContextMenu:o})}})})}return r.jsx("div",{"data-virtualized":"false",children:t.map(([u,d])=>r.jsx(Aw,{plugin:u,skills:d,selectedKey:a,onSelect:s,onContextMenu:o},u))})}function zg({queryActive:t}){return t?r.jsx(zl,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):r.jsx(zl,{headline:"No skills yet.",body:r.jsxs(r.Fragment,{children:["Create one with ",r.jsx(Df,{children:"vskill new"})," or the"," ",r.jsx("strong",{style:{color:"var(--text-primary)"},children:"New skill"})," action in the top rail."]})})}function Dg({queryActive:t,agentId:a}){return t?r.jsx(zl,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):r.jsx(zl,{headline:a?`No skills installed for ${a} in this project.`:"No installed skills.",body:r.jsxs(r.Fragment,{children:["Run ",r.jsx(Df,{children:"vskill install <skill>"})," to add one."]})})}function Gw({queryActive:t,agentId:a}){return t?r.jsx(zl,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):r.jsx(zl,{headline:`No global skills for ${a}.`,body:r.jsxs(r.Fragment,{children:["Run ",r.jsx(Df,{children:"vskill install --global <skill>"})," to add one."]})})}function zl({headline:t,body:a}){return r.jsxs("div",{style:{padding:"12px 14px 16px",fontSize:12,color:"var(--text-secondary)",lineHeight:1.5},children:[r.jsx("div",{style:{fontWeight:500,color:"var(--text-primary)",marginBottom:4},children:t}),r.jsx("div",{children:a})]})}function Df({children:t}){return r.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:t})}function Ww(){return r.jsx("div",{"aria-hidden":"true",style:{height:1,background:"var(--border-default)",margin:"4px 14px"}})}function qw(){return r.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 Yw(){return r.jsx("div",{style:{padding:"8px 0"},children:[0,1,2,3,4,5].map(t=>r.jsx(Dw,{},t))})}function Kw({error:t,onRetry:a}){return r.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:[r.jsx("div",{style:{fontWeight:600,marginBottom:4},children:"Couldn't load skills."}),r.jsxs("details",{children:[r.jsx("summary",{style:{cursor:"pointer",color:"var(--text-secondary)",fontSize:11,marginBottom:4},children:Xw(t)}),r.jsx("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",margin:"6px 0 0"},children:t})]}),a&&r.jsx("button",{type:"button",onClick:a,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 Xw(t){const a=t.split(`
|
|
66
|
-
`)[0]??t;return a.length>80?a.slice(0,77)+"…":a}const
|
|
67
|
-
`);N=F.pop()||"";for(const
|
|
68
|
-
`);N=F.pop()||"";for(const C of F)if(C.startsWith("event: "))A=C.slice(7).trim();else if(C.startsWith("data: ")){try{const B=JSON.parse(C.slice(6)),L={event:A,data:B};a.current.onEvent(m,L)}catch{}A=""}}a.current.onDone(m)}catch(k){k.name!=="AbortError"&&a.current.onError(m,k.message)}finally{o(k=>{const w=new Set(k);return w.delete(m),w}),c.current.delete(m)}},[]),d=p.useCallback(m=>{var y;(y=c.current.get(m))==null||y.abort()},[]),h=p.useCallback(()=>{for(const m of c.current.values())m.abort()},[]),g=s.size>0;return{runningSet:s,startCase:u,stopCase:d,stopAll:h,isAnyCaseRunning:g}}const nC={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 rC(t,a){var s,o;switch(a.type){case"SET_LOADING":return{...t,loading:a.loading};case"SET_ERROR":return{...t,error:a.error};case"INIT_DATA":{const c=new Map;if(a.benchmark)for(const d of a.benchmark.cases)c.set(d.eval_id,{status:d.status,passRate:d.pass_rate,errorMessage:d.error_message||void 0,durationMs:d.durationMs,tokens:d.tokens,output:d.output,assertions:d.assertions.map(h=>({assertion_id:h.id,text:h.text,pass:h.pass,reasoning:h.reasoning}))});const u=((o=(s=a.evals)==null?void 0:s.evals[0])==null?void 0:o.id)??null;return{...t,skillContent:a.skillContent,savedContent:a.skillContent,isDirty:!1,evals:a.evals,evalsError:a.evalsError??null,latestBenchmark:a.benchmark,inlineResults:c,selectedCaseId:u,loading:!1,error:null}}case"SET_PANEL":return{...t,activePanel:a.panel};case"SET_CONTENT":return{...t,skillContent:a.content,isDirty:a.content!==t.savedContent};case"CONTENT_SAVED":return{...t,savedContent:t.skillContent,isDirty:!1};case"SET_EVALS":return{...t,evals:a.evals};case"SELECT_CASE":return{...t,selectedCaseId:a.caseId};case"CASE_RUN_START":{const c=new Map(t.caseRunStates);return c.set(a.caseId,{status:"running",startedAt:Date.now(),mode:a.mode}),{...t,caseRunStates:c,runMode:a.mode,activePanel:"run"}}case"CASE_RUN_COMPLETE":{const c=new Map(t.caseRunStates),u=c.get(a.caseId);c.set(a.caseId,{status:"complete",mode:u==null?void 0:u.mode});const d=new Map(t.inlineResults);return d.set(a.caseId,a.result),{...t,caseRunStates:c,inlineResults:d}}case"CASE_RUN_ERROR":{const c=new Map(t.caseRunStates),u=c.get(a.caseId);c.set(a.caseId,{status:"error",mode:u==null?void 0:u.mode});const d=new Map(t.inlineResults);return d.set(a.caseId,{status:"error",errorMessage:a.error,assertions:[]}),{...t,caseRunStates:c,inlineResults:d}}case"CASE_RUN_CANCEL":{const c=new Map(t.caseRunStates),u=c.get(a.caseId);return c.set(a.caseId,{status:"cancelled",mode:u==null?void 0:u.mode}),{...t,caseRunStates:c}}case"BULK_RUN_START":{const c=new Map(t.caseRunStates);for(const u of a.caseIds)c.set(u,{status:"queued",mode:a.mode});return{...t,caseRunStates:c,bulkRunActive:!0,runMode:a.mode,activePanel:"run"}}case"BULK_RUN_COMPLETE":return{...t,bulkRunActive:!1,latestBenchmark:a.benchmark??t.latestBenchmark,iterationCount:t.iterationCount+1};case"CANCEL_ALL":{const c=new Map(t.caseRunStates);for(const[u,d]of c)(d.status==="running"||d.status==="queued")&&c.set(u,{status:"cancelled"});return{...t,caseRunStates:c,bulkRunActive:!1}}case"UPDATE_INLINE_RESULT":{const c=new Map(t.inlineResults);return c.set(a.evalId,a.result),{...t,inlineResults:c}}case"OPEN_IMPROVE":return{...t,improveTarget:a.evalId,activePanel:"editor"};case"CLOSE_IMPROVE":return{...t,improveTarget:null};case"OPEN_AI_EDIT":return{...t,aiEditOpen:!0,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"CLOSE_AI_EDIT":return{...t,aiEditOpen:!1,aiEditLoading:!1,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"AI_EDIT_LOADING":return{...t,aiEditLoading:!0,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[]};case"AI_EDIT_PROGRESS":return{...t,aiEditProgress:[...t.aiEditProgress,a.entry]};case"AI_EDIT_RESULT":{const c=a.evalChanges??[],u=new Map;for(let d=0;d<c.length;d++)u.set(d,!0);return{...t,aiEditLoading:!1,aiEditResult:{improved:a.improved,reasoning:a.reasoning,evalChanges:c},aiEditEvalChanges:c,aiEditEvalSelections:u}}case"AI_EDIT_ERROR":return{...t,aiEditLoading:!1,aiEditError:a.message,aiEditClassifiedError:a.classified??null};case"GENERATE_EVALS_START":return{...t,generateEvalsLoading:!0,generateEvalsProgress:[],generateEvalsError:null};case"GENERATE_EVALS_PROGRESS":return{...t,generateEvalsProgress:[...t.generateEvalsProgress,a.entry]};case"GENERATE_EVALS_DONE":return{...t,generateEvalsLoading:!1,evals:a.evals};case"GENERATE_EVALS_ERROR":return{...t,generateEvalsLoading:!1,generateEvalsError:a.classified};case"TOGGLE_EVAL_CHANGE":{const c=new Map(t.aiEditEvalSelections);return c.set(a.index,!c.get(a.index)),{...t,aiEditEvalSelections:c}}case"SELECT_ALL_EVAL_CHANGES":{const c=new Map(t.aiEditEvalSelections);for(const u of c.keys())c.set(u,!0);return{...t,aiEditEvalSelections:c}}case"DESELECT_ALL_EVAL_CHANGES":{const c=new Map(t.aiEditEvalSelections);for(const u of c.keys())c.set(u,!1);return{...t,aiEditEvalSelections:c}}case"SET_EVALS_RETRY":return{...t,aiEditEvalsRetry:a.evalsFile};case"SET_REGRESSIONS":return{...t,regressions:a.regressions};case"INCREMENT_ITERATION":return{...t,iterationCount:t.iterationCount+1};case"SET_ACTIVATION_PROMPTS":return{...t,activationPrompts:a.prompts};case"ACTIVATION_START":return{...t,activationRunning:!0,activationResults:[],activationSummary:null,activationError:null,activationClassifyingStatus:null,activationStartedAt:Date.now()};case"ACTIVATION_RESULT":return{...t,activationResults:[...t.activationResults,a.result]};case"ACTIVATION_DONE":return{...t,activationRunning:!1,activationSummary:a.summary,activationClassifyingStatus:null};case"ACTIVATION_CLASSIFYING":return{...t,activationClassifyingStatus:`Classifying prompt ${a.index}/${a.total}...`};case"ACTIVATION_ERROR":return{...t,activationRunning:!1,activationError:a.error,activationClassifyingStatus:null};case"ACTIVATION_RESET":return{...t,activationResults:[],activationSummary:null,activationError:null};case"ACTIVATION_TIMEOUT":return{...t,activationRunning:!1,activationError:"Activation test timed out after 120 seconds"};case"ACTIVATION_CANCEL":return{...t,activationRunning:!1};case"GENERATE_PROMPTS_START":return{...t,generatingPrompts:!0,generatingPromptsError:null};case"GENERATE_PROMPTS_DONE":return{...t,generatingPrompts:!1};case"GENERATE_PROMPTS_ERROR":return{...t,generatingPrompts:!1,generatingPromptsError:a.error};case"ACTIVATION_HISTORY_LOADED":return{...t,activationHistory:a.runs,activationHistoryLoading:!1};default:return t}}function aC(t){if(t==="unit"||t==="integration")return t}function lC(t,a){const s=a.data;if(a.event==="output_ready"&&(t.output=s.output,s.durationMs!=null&&(t.durationMs=s.durationMs),s.tokens!=null&&(t.tokens=s.tokens)),a.event==="outputs_ready"&&(t.output=s.skillOutput,s.skillDurationMs!=null&&(t.durationMs=s.skillDurationMs),s.skillTokens!=null&&(t.tokens=s.skillTokens)),a.event==="assertion_result"){const o={assertion_id:s.assertion_id,text:s.text,pass:s.pass,reasoning:s.reasoning};t.assertions.find(c=>c.assertion_id===o.assertion_id)||t.assertions.push(o)}a.event==="case_complete"&&(t.status=s.status,t.passRate=s.pass_rate,t.errorMessage=s.error_message||void 0,t.classifiedError=s.classified_error||void 0)}const Ny=p.createContext(null);function Rn(){const t=p.useContext(Ny);if(!t)throw new Error("useWorkspace must be used within WorkspaceProvider");return t}function sC({plugin:t,skill:a,origin:s,children:o}){const c=s==="installed",[u,d]=p.useReducer(rC,{...nC,plugin:t,skill:a}),h=p.useRef(new Set),g=p.useRef(new Set),m=p.useRef(new Map),y=p.useCallback((le,he)=>{let pe=m.current.get(le);pe||(pe={assertions:[]},m.current.set(le,pe)),lC(pe,he),d({type:"UPDATE_INLINE_RESULT",evalId:le,result:{...pe,assertions:[...pe.assertions]}})},[]),v=p.useCallback(le=>{if(g.current.has(le))return;g.current.add(le);const he=m.current.get(le)??{assertions:[]};d({type:"CASE_RUN_COMPLETE",caseId:le,result:{...he,assertions:[...he.assertions]}}),h.current.has(le)&&(h.current.delete(le),h.current.size===0&&we.getLatestBenchmark(t,a).then(pe=>d({type:"BULK_RUN_COMPLETE",benchmark:pe})).catch(()=>d({type:"BULK_RUN_COMPLETE",benchmark:null})))},[t,a]),b=p.useCallback((le,he)=>{g.current.has(le)||(g.current.add(le),d({type:"CASE_RUN_ERROR",caseId:le,error:he}),h.current.has(le)&&(h.current.delete(le),h.current.size===0&&we.getLatestBenchmark(t,a).then(pe=>d({type:"BULK_RUN_COMPLETE",benchmark:pe})).catch(()=>d({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[t,a]),{startCase:S,stopCase:k,stopAll:w}=tC({onEvent:y,onDone:v,onError:b});p.useEffect(()=>()=>{w()},[w]);const E=p.useCallback(async()=>{try{const le=await fetch(`/api/skills/${t}/${a}/activation-history`);if(!le.ok){if(le.status===404){d({type:"ACTIVATION_HISTORY_LOADED",runs:[]});return}return}const he=await le.json();d({type:"ACTIVATION_HISTORY_LOADED",runs:he.runs||[]})}catch{}},[t,a]);p.useEffect(()=>{let le=!1;async function he(){try{const[pe,xe,be]=await Promise.allSettled([we.getSkillDetail(t,a),we.getEvals(t,a),we.getLatestBenchmark(t,a)]);if(le)return;let Be=null,Ue=null;if(xe.status==="fulfilled")Be=xe.value;else{const lt=xe.reason;Ue=(lt==null?void 0:lt.message)??"Failed to load test cases"}d({type:"INIT_DATA",skillContent:pe.status==="fulfilled"?pe.value.skillContent:"",evals:Be,evalsError:Ue,benchmark:be.status==="fulfilled"?be.value:null})}catch(pe){le||d({type:"SET_ERROR",error:pe.message})}}return he(),E(),()=>{le=!0}},[t,a,E]);const T=p.useCallback(async()=>{if(!c)try{await we.applyImprovement(t,a,u.skillContent),d({type:"CONTENT_SAVED"})}catch(le){d({type:"SET_ERROR",error:le.message})}},[c,t,a,u.skillContent]),N=p.useCallback(async le=>{if(!c)try{const he=await we.saveEvals(t,a,le);d({type:"SET_EVALS",evals:he})}catch(he){d({type:"SET_ERROR",error:he.message})}},[c,t,a]),A=p.useCallback((le,he="benchmark")=>{if(c)return;const pe=u.caseRunStates.get(le);if((pe==null?void 0:pe.status)!=="running")if(m.current.delete(le),g.current.delete(le),d({type:"CASE_RUN_START",caseId:le,mode:he}),he==="comparison"){const xe=`/api/skills/${t}/${a}/compare`;S(le,xe,{eval_ids:[le]})}else{const xe=`/api/skills/${t}/${a}/benchmark/case/${le}`;S(le,xe,he==="baseline"?{baseline_only:!0}:void 0)}},[c,t,a,u.caseRunStates,S]),_=p.useCallback((le="benchmark")=>{var xe;if(c)return;const he=((xe=u.evals)==null?void 0:xe.evals)??[];if(he.length===0)return;const pe=he.map(be=>be.id);for(const be of pe)m.current.delete(be),g.current.delete(be);d({type:"BULK_RUN_START",caseIds:pe,mode:le}),h.current=new Set(pe);for(const be of pe)if(le==="comparison")S(be,`/api/skills/${t}/${a}/compare`,{eval_ids:[be]});else{const Be=`/api/skills/${t}/${a}/benchmark/case/${be}`;S(be,Be,le==="baseline"?{baseline_only:!0}:void 0)}},[c,t,a,u.evals,S]),D=p.useCallback(le=>{k(le),d({type:"CASE_RUN_CANCEL",caseId:le}),h.current.delete(le),g.current.add(le)},[k]),F=p.useCallback(()=>{w(),d({type:"CANCEL_ALL"}),h.current.clear()},[w]),C=p.useCallback(async(le,he)=>{d({type:"OPEN_IMPROVE",evalId:le})},[]),B=p.useCallback(async(le,he)=>{try{await we.applyImprovement(t,a,he),d({type:"SET_CONTENT",content:he}),d({type:"CONTENT_SAVED"}),d({type:"CLOSE_IMPROVE"}),A(le,"benchmark")}catch(pe){d({type:"SET_ERROR",error:pe.message})}},[t,a,A]),L=Md(),U=p.useRef(null),$=p.useRef(0);p.useEffect(()=>{const le=L.events;for(let he=$.current;he<le.length;he++){const pe=le[he],xe=pe.data;if(pe.event==="progress"&&d({type:"AI_EDIT_PROGRESS",entry:{timestamp:Date.now(),phase:xe.phase,message:xe.message}}),pe.event==="done"){const be=xe.improved,Be=xe.reasoning,Ue=xe.evalChanges??[];d({type:"AI_EDIT_RESULT",improved:be,reasoning:Be,evalChanges:Ue})}if(pe.event==="error"){const be=xe;d({type:"AI_EDIT_ERROR",message:be.description||"Unknown error",classified:be})}}$.current=le.length},[L.events]),p.useEffect(()=>{L.error&&d({type:"AI_EDIT_ERROR",message:L.error})},[L.error]),p.useEffect(()=>()=>{L.stop()},[L.stop]);const q=p.useCallback(async(le,he,pe)=>{c||($.current=0,d({type:"AI_EDIT_LOADING"}),U.current=L.stop,L.start(`/api/skills/${t}/${a}/improve?sse`,{mode:"instruct",instruction:le,content:u.skillContent,evals:u.evals??{skill_name:a,evals:[]},provider:he,model:pe}))},[c,t,a,u.skillContent,u.evals,L]),X=p.useCallback(()=>{L.stop(),d({type:"AI_EDIT_ERROR",message:"Cancelled"})},[L]),ee=p.useCallback(async()=>{const le=u.aiEditResult;if(le!=null&&le.improved)try{if(await we.applyImprovement(t,a,le.improved),d({type:"SET_CONTENT",content:le.improved}),d({type:"CONTENT_SAVED"}),u.aiEditEvalChanges.length>0&&Array.from(u.aiEditEvalSelections.values()).some(Boolean)){const{mergeEvalChanges:pe}=await Ha(async()=>{const{mergeEvalChanges:Be}=await import("./mergeEvalChanges-Dpbbs4d4.js");return{mergeEvalChanges:Be}},[]),xe=u.evals??{skill_name:a,evals:[]},be=pe(xe,u.aiEditEvalChanges,u.aiEditEvalSelections);try{const Be=await we.saveEvals(t,a,be);d({type:"SET_EVALS",evals:Be})}catch(Be){d({type:"SET_EVALS_RETRY",evalsFile:be}),d({type:"SET_ERROR",error:`SKILL.md saved, but test cases failed to save: ${Be.message}. You can retry from the AI Edit panel.`});return}}d({type:"CLOSE_AI_EDIT"})}catch(he){d({type:"SET_ERROR",error:he.message})}},[t,a,u.aiEditResult,u.evals,u.aiEditEvalChanges,u.aiEditEvalSelections]),I=p.useCallback(()=>{d({type:"CLOSE_AI_EDIT"})},[]),z=p.useCallback(le=>{d({type:"TOGGLE_EVAL_CHANGE",index:le})},[]),O=p.useCallback(()=>{d({type:"SELECT_ALL_EVAL_CHANGES"})},[]),P=p.useCallback(()=>{d({type:"DESELECT_ALL_EVAL_CHANGES"})},[]),H=p.useCallback(async()=>{const le=u.aiEditEvalsRetry;if(le)try{const he=await we.saveEvals(t,a,le);d({type:"SET_EVALS",evals:he}),d({type:"SET_ERROR",error:null}),d({type:"CLOSE_AI_EDIT"})}catch(he){d({type:"SET_ERROR",error:`Retry failed: ${he.message}`})}},[t,a,u.aiEditEvalsRetry]),ae=p.useCallback(async()=>{try{const le=await we.getSkillDetail(t,a);d({type:"SET_CONTENT",content:le.skillContent}),d({type:"CONTENT_SAVED"})}catch{}},[t,a]),{config:M}=$a(),Y=Md(),W=p.useRef(0);p.useEffect(()=>{const le=Y.events;for(let he=W.current;he<le.length;he++){const pe=le[he],xe=pe.data;if(pe.event==="progress"&&d({type:"GENERATE_EVALS_PROGRESS",entry:{timestamp:Date.now(),phase:xe.phase,message:xe.message}}),pe.event==="done"){const be=xe;we.saveEvals(t,a,be).then(Be=>d({type:"GENERATE_EVALS_DONE",evals:Be})).catch(Be=>d({type:"SET_ERROR",error:Be.message}))}pe.event==="error"&&d({type:"GENERATE_EVALS_ERROR",classified:xe})}W.current=le.length},[Y.events,t,a]),p.useEffect(()=>{Y.error&&d({type:"SET_ERROR",error:Y.error})},[Y.error]),p.useEffect(()=>()=>{Y.stop()},[Y.stop]);const Q=p.useCallback(async le=>{if(c)return;W.current=0,d({type:"GENERATE_EVALS_START"});const he={};M!=null&&M.provider&&(he.provider=M.provider),M!=null&&M.model&&(he.model=M.model);const pe=aC(le==null?void 0:le.testType);pe&&(he.testType=pe),Y.start(`/api/skills/${t}/${a}/generate-evals?sse`,Object.keys(he).length>0?he:void 0)},[c,t,a,Y,M]),oe=Md(),de=p.useRef(0);p.useEffect(()=>()=>{oe.stop()},[oe.stop]),p.useEffect(()=>{const le=oe.events;for(let he=de.current;he<le.length;he++){const pe=le[he];if(pe.event==="classifying"){const xe=pe.data;d({type:"ACTIVATION_CLASSIFYING",index:xe.index,total:xe.total})}if(pe.event==="prompt_result"&&d({type:"ACTIVATION_RESULT",result:pe.data}),pe.event==="done"){ve.current&&(clearTimeout(ve.current),ve.current=null);const xe=pe.data;if(xe.error)d({type:"ACTIVATION_ERROR",error:xe.error});else{d({type:"ACTIVATION_DONE",summary:xe});const be={id:`run-${Date.now()}`,timestamp:new Date().toISOString(),model:(M==null?void 0:M.model)||"unknown",provider:(M==null?void 0:M.provider)||"unknown",promptCount:xe.total,summary:{precision:xe.precision,recall:xe.recall,reliability:xe.reliability,tp:xe.tp,tn:xe.tn,fp:xe.fp,fn:xe.fn}};d({type:"ACTIVATION_HISTORY_LOADED",runs:[be,...u.activationHistory??[]]})}}}de.current=le.length},[oe.events,M,u.activationHistory]),p.useEffect(()=>{oe.error&&(ve.current&&(clearTimeout(ve.current),ve.current=null),d({type:"ACTIVATION_ERROR",error:oe.error}))},[oe.error]);const ve=p.useRef(null),ce=p.useCallback(()=>{ve.current&&(clearTimeout(ve.current),ve.current=null),oe.stop(),d({type:"ACTIVATION_CANCEL",totalPrompts:0})},[oe]),je=p.useCallback(le=>{const pe=le.trim().split(`
|
|
65
|
+
}`})]})}function rg(){typeof window>"u"||(window.location.hash="#/")}function w2({onHome:t}){const[a,s]=p.useState(!1),[o,c]=p.useState(!1),u=h=>{h.metaKey||h.ctrlKey||h.shiftKey||h.button!==0||(h.preventDefault(),rg(),t==null||t())},d=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),rg(),t==null||t())};return r.jsxs("a",{href:"#/",role:"link","data-testid":"studio-logo","aria-label":"Skill Studio — home",onClick:u,onKeyDown:d,onFocus:()=>s(!0),onBlur:()=>s(!1),onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),style:{display:"inline-flex",alignItems:"center",gap:10,flexShrink:0,padding:"4px 6px",margin:"-4px -6px",borderRadius:6,textDecoration:"none",color:"inherit",cursor:"pointer",outline:a?"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:[r.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:r.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:r.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}),r.jsx("span",{style:{fontSize:13,fontWeight:600,letterSpacing:"-0.01em",color:"var(--text-primary)"},children:"Skill Studio"})]})}const ag=p.memo(function({message:a,politeness:s="polite",role:o}){const c=o??(s==="assertive"?"alert":"status");return r.jsx("div",{"aria-live":s,"aria-atomic":"true",role:c,"data-testid":"aria-live","data-politeness":s,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0,padding:0,margin:-1},children:a})});function C2({toast:t,onDismiss:a}){const[s,o]=p.useState(!0),c=p.useRef(null);p.useEffect(()=>(c.current=requestAnimationFrame(()=>{c.current=requestAnimationFrame(()=>o(!1))}),()=>{c.current!=null&&cancelAnimationFrame(c.current)}),[]);const u={success:"var(--status-installed)",info:"var(--text-secondary)",error:"var(--color-accent, var(--accent-surface))"};return r.jsxs("div",{role:t.severity==="error"?"alert":"status","data-testid":"toast-item","data-severity":t.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 ${u[t.severity]}`,borderRadius:6,boxShadow:"0 8px 24px rgba(0,0,0,0.12)",fontFamily:"var(--font-sans)",fontSize:12,transform:s?"translateY(8px)":"translateY(0)",opacity:s?0:1,transition:"transform var(--duration-base, 180ms) var(--ease-standard, ease), opacity var(--duration-base, 180ms) var(--ease-standard, ease)"},children:[r.jsx("span",{style:{flex:1,minWidth:0},children:t.message}),t.action&&r.jsx("button",{type:"button",onClick:()=>{t.action.onInvoke(),a(t.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:t.action.label}),r.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>a(t.id),style:{background:"transparent",border:"none",padding:2,color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1},children:"×"})]})}function E2({toasts:t,onDismiss:a,liveMessage:s,liveAssertiveMessage:o}){return r.jsxs(r.Fragment,{children:[r.jsx(ag,{politeness:"polite",message:s}),r.jsx(ag,{politeness:"assertive",message:o}),t.length>0&&r.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:t.map(c=>r.jsx("div",{style:{pointerEvents:"auto"},children:r.jsx(C2,{toast:c,onDismiss:a})},c.id))})]})}const Iv=p.createContext(null);function Wo(){const t=p.useContext(Iv);if(!t)throw new Error("useToast must be used inside <ToastProvider>.");return t}function N2({children:t,maxVisible:a=4,defaultDurationMs:s=4e3}){const[o,c]=p.useState([]),[u,d]=p.useState(""),[h,g]=p.useState(""),m=p.useRef(new Map),y=p.useCallback(C=>{const T=m.current.get(C);T&&(clearTimeout(T),m.current.delete(C)),c(N=>N.filter(A=>A.id!==C))},[]),v=p.useCallback((C,T)=>{if(T<=0)return;const N=setTimeout(()=>{y(C)},T);m.current.set(C,N)},[y]),b=p.useCallback(C=>{const T=C.id??`toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,N={id:T,message:C.message,severity:C.severity??"info",durationMs:C.durationMs??s,action:C.action};return c(A=>[...A,N]),N.severity==="error"?g(N.message):d(N.message),v(T,N.durationMs),T},[s,v]),S=p.useCallback(()=>{for(const C of m.current.values())clearTimeout(C);m.current.clear(),c([])},[]);p.useEffect(()=>{function C(T){T.key==="Escape"&&c(N=>{if(N.length===0)return N;const A=N.slice(0,a),_=A[A.length-1],D=m.current.get(_.id);return D&&(clearTimeout(D),m.current.delete(_.id)),N.filter(F=>F.id!==_.id)})}return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[a]),p.useEffect(()=>()=>{for(const C of m.current.values())clearTimeout(C);m.current.clear()},[]);const k=o.slice(0,a),w=p.useMemo(()=>({toast:b,dismiss:y,clear:S}),[b,y,S]);return r.jsxs(Iv.Provider,{value:w,children:[t,r.jsx(E2,{toasts:k,onDismiss:y,liveMessage:u,liveAssertiveMessage:h})]})}const T2="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",R2=p.lazy(()=>Ha(()=>import("./UpdateDropdown-1PXKezB7.js"),__vite__mapDeps([0,1])));function A2(){const{updateCount:t,updates:a,isRefreshingUpdates:s,refreshUpdates:o,selectSkill:c,revealSkill:u,skills:d,updatesById:h,activeAgent:g}=er(),{toast:m}=Wo(),y=p.useMemo(()=>{if(!h||h.size===0)return;const N=new Map;for(const[A,_]of h)_.diffSummary&&N.set(A,_.diffSummary);return N.size>0?N:void 0},[h]),[v,b]=p.useState(!1),S=p.useRef(null),k=p.useCallback(()=>b(!1),[]),w=t>0?"var(--text-primary)":"var(--text-secondary)",C=t>9?"9+":String(t),T=t===0?"No updates available":`${t} updates available, open summary`;return r.jsxs("span",{"data-testid":"update-bell-anchor",style:{position:"relative",display:"inline-flex"},children:[r.jsxs("button",{ref:S,type:"button","data-testid":"update-bell","aria-label":T,"aria-haspopup":"dialog","aria-expanded":v,onClick:()=>b(N=>!N),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:w,cursor:"pointer"},children:[r.jsx("img",{src:T2,alt:"",width:18,height:18,style:{display:"block",opacity:t>0?1:.75}}),t>0&&r.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:C})]}),v&&r.jsx(p.Suspense,{fallback:r.jsx("span",{"data-testid":"update-bell-fallback",children:"Loading…"}),children:r.jsx(R2,{updates:a,isRefreshing:s,diffSummariesById:y,onRefresh:()=>o(),onSelectSkill:N=>{const A=N.localSkill??N.name.split("/").pop()??"",_=N.localPlugin??"";if(u)u(_,A);else{const F=N.name.split("/"),E=F.length>=2?F[F.length-2]:F[0];c({plugin:E,skill:A,origin:"installed"})}if(!(d??[]).some(F=>F.skill===A&&(_===""||F.plugin===_))){const F=N.installLocations??[];if(F.length>0){const E=g?F.filter(L=>L.agent===g):[],B=g?F.filter(L=>L.agent!==g):F;if(E.length>0&&B.length>0){const L=B.length>=2?`Also installed under ${B.length} other locations.`:`Also installed under ${B[0].agentLabel}.`;m({severity:"info",message:L})}else{const L=F[0].agentLabel;m({severity:"info",message:`Skill installed under ${L} — switch to ${L} to view details.`})}}}k()},onViewAll:()=>{window.location.hash="#/updates",k()},onClose:k,anchorRef:S})})]})}function lg(t){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:navigate-scope",{detail:t}))}function M2({projectName:t,selected:a,onOpenPalette:s,onHome:o,projectPickerSlot:c,onRequestCreateSkill:u,findSkillsSlot:d}){const h=a?a.origin==="installed"?"Project":"Skills":null;return r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,height:"100%",width:"100%",padding:"0 16px",fontFamily:"var(--font-sans)"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexShrink:0},children:[r.jsx(w2,{onHome:o}),c?r.jsx("div",{style:{borderLeft:"1px solid var(--border-default)",paddingLeft:10,display:"flex",alignItems:"center"},children:c}):t&&r.jsx("span",{title:t,style:{fontSize:12,color:"var(--text-secondary)",borderLeft:"1px solid var(--border-default)",paddingLeft:10,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t})]}),r.jsx("nav",{"aria-label":"Breadcrumb",style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:6,fontSize:12,color:"var(--text-secondary)"},children:a&&h&&r.jsxs(r.Fragment,{children:[r.jsx(sg,{segment:"origin",onClick:()=>lg({scope:"origin",origin:a.origin}),style:{textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:a.origin==="installed"?"var(--status-installed)":"var(--status-own)"},children:h}),r.jsx(ig,{}),r.jsx(sg,{segment:"plugin",onClick:()=>lg({scope:"plugin",plugin:a.plugin}),style:{fontFamily:"var(--font-mono)",fontSize:11},children:a.plugin}),r.jsx(ig,{}),r.jsx("span",{"data-breadcrumb-segment":"skill","aria-current":"page",style:{color:"var(--text-primary)",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.skill})]})}),r.jsxs("div",{"data-toprail-right":"true",style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[d,u&&r.jsxs("button",{type:"button","data-slot":"create-skill-button",onClick:u,"aria-label":"Create a new skill",title:"Create a new skill",style:{display:"inline-flex",alignItems:"center",gap:6,height:28,padding:"0 12px",borderRadius:6,border:"1px solid var(--color-action, #2F5B8E)",background:"var(--color-action, #2F5B8E)",color:"var(--color-action-ink, #FFFFFF)",fontSize:12,fontWeight:600,fontFamily:"var(--font-sans)",cursor:"pointer",letterSpacing:"0.01em",boxShadow:"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)"},children:[r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[r.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),r.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"New Skill"]}),r.jsx("span",{"data-slot":"agent-model-picker",style:{minWidth:200},children:r.jsx(S2,{})}),r.jsx("span",{"data-slot":"update-bell",style:{display:"inline-flex"},children:r.jsx(A2,{})}),r.jsx("button",{type:"button",onClick:s,"aria-label":"Open command palette",title:"Command palette (⌘K)",style:{display:"inline-flex",alignItems:"center",gap:6,height:26,padding:"0 10px",borderRadius:4,border:"1px solid var(--border-default)",background:"transparent",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono)",cursor:"pointer"},children:r.jsx("span",{children:"⌘K"})})]})]})}function sg({segment:t,onClick:a,style:s,children:o}){return r.jsx("button",{type:"button","data-breadcrumb-segment":t,onClick:a,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",color:"var(--text-secondary)",fontFamily:"inherit",...s},onMouseEnter:c=>{c.currentTarget.style.color="var(--color-accent-ink)"},onMouseLeave:c=>{const u=(s==null?void 0:s.color)??"var(--text-secondary)";c.currentTarget.style.color=u},children:o})}function ig(){return r.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)",fontSize:10},children:"›"})}const qo="vskill-theme";function Uv(t){return t==="light"||t==="dark"||t==="auto"?t:"auto"}function L2(t,a){return t==="light"||t==="dark"?t:a?"dark":"light"}function z2(t){try{const a=t.getItem(qo);return Uv(a)}catch{return"auto"}}function D2(t,a){try{t.setItem(qo,a)}catch{}}function _2(t,a,s){t.dataset.theme=s,t.dataset.themeMode=a}function O2(t){if(!t)return!1;try{return t("(prefers-color-scheme: dark)").matches}catch{return!1}}const Hv=p.createContext(null);function B2({storage:t,matchMedia:a,target:s,children:o}){const c=t??(typeof window<"u"?window.localStorage:void 0),u=a??(typeof window<"u"?window.matchMedia.bind(window):void 0),d=s??(typeof document<"u"?document.documentElement:void 0),[h,g]=p.useState(()=>c?z2(c):"auto"),[m,y]=p.useState(()=>O2(u)),v=p.useMemo(()=>L2(h,m),[h,m]);p.useEffect(()=>{d&&_2(d,h,v)},[d,h,v]),p.useEffect(()=>{if(!u)return;const k=u("(prefers-color-scheme: dark)"),w=T=>y(T.matches);if(typeof k.addEventListener=="function")return k.addEventListener("change",w),()=>k.removeEventListener("change",w);const C=k;return C.addListener(w),()=>C.removeListener(w)},[u]),p.useEffect(()=>{if(typeof window>"u")return;const k=w=>{w.key===qo&&g(Uv(w.newValue))};return window.addEventListener("storage",k),()=>window.removeEventListener("storage",k)},[]),p.useEffect(()=>{if(!u||!d)return;let k;try{k=u("(prefers-contrast: more)")}catch{return}const w=N=>{N?d.dataset.contrast="more":d.dataset.contrast==="more"&&delete d.dataset.contrast};w(k.matches);const C=N=>w(N.matches);if(typeof k.addEventListener=="function")return k.addEventListener("change",C),()=>k.removeEventListener("change",C);const T=k;return T.addListener(C),()=>T.removeListener(C)},[u,d]);const b=p.useCallback(k=>{g(k),c&&D2(c,k)},[c]),S=p.useMemo(()=>({mode:h,resolvedTheme:v,setTheme:b}),[h,v,b]);return r.jsx(Hv.Provider,{value:S,children:o})}function $v(){const t=p.useContext(Hv);if(!t)throw new Error("useTheme must be used inside <ThemeProvider>. Wrap the app root in main.tsx.");return t}const og=["claude-cli","anthropic","openrouter","ollama","lm-studio"];function I2(t){const a=new Map(t.map(o=>[o.id,o])),s=[];for(const o of og){const c=a.get(o);c&&s.push(c)}for(const o of t)og.includes(o.id)||s.push(o);return s}function U2(t){const[a,s]=p.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(`(max-width: ${t}px)`).matches);return p.useEffect(()=>{var u;if(typeof window>"u"||!window.matchMedia)return;const o=window.matchMedia(`(max-width: ${t}px)`),c=()=>s(o.matches);return(u=o.addEventListener)==null||u.call(o,"change",c),()=>{var d;return(d=o.removeEventListener)==null?void 0:d.call(o,"change",c)}},[t]),a}function H2({providers:t,onOpenSettings:a,onOpenInstallHelp:s}){const o=I2(t),c=U2(640),[u,d]=p.useState(!1),h=p.useCallback(g=>{g.available||g.kind==="api-key"?a==null||a(g.id):s==null||s(g.id)},[a,s]);if(c){const g=o.filter(m=>m.available).length;return r.jsxs("div",{"data-testid":"providers-segment",style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[r.jsx("button",{type:"button","data-testid":"providers-summary",onClick:()=>d(!u),"aria-label":ne.statusBar.providerSummary(g,o.length),style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:ne.statusBar.providerSummary(g,o.length)}),u&&r.jsx("div",{role:"menu",style:{position:"absolute",bottom:"120%",right:0,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,padding:6,minWidth:180,display:"flex",flexDirection:"column",gap:2,zIndex:80},children:o.map(m=>r.jsx(cg,{p:m,onClick:h},m.id))})]})}return r.jsx("div",{"data-testid":"providers-segment",style:{display:"inline-flex",alignItems:"center",gap:4},children:o.map(g=>r.jsx(cg,{p:g,onClick:h,compact:!0},g.id))})}function cg({p:t,onClick:a,compact:s}){const o=t.available?ne.statusBar.unlocked(t.label):t.kind==="cli-install"?ne.statusBar.lockedCli(t.label):ne.statusBar.locked(t.label);return r.jsxs("button",{type:"button","data-testid":`provider-glyph-${t.id}`,"data-available":t.available,"aria-label":o,title:o,onClick:()=>a(t),style:{display:"inline-flex",alignItems:"center",gap:4,background:"transparent",border:"none",color:t.available?"var(--status-installed)":"var(--text-muted, var(--text-tertiary))",cursor:"pointer",padding:s?"2px":"4px 6px",fontSize:11},children:[r.jsx(Jd,{unlocked:t.available,size:10}),!s&&r.jsx("span",{children:t.label})]})}function $2(){try{return typeof localStorage>"u"?null:localStorage.getItem(qo)}catch{return null}}function V2({projectPath:t,modelName:a,health:s="ok",onPathClick:o,providers:c,onOpenProviderSettings:u,onOpenProviderInstallHelp:d}){const{mode:h,resolvedTheme:g,setTheme:m}=$v(),v=$2()==="auto",b=P2(h,g,v),S=s==="down"||s==="degraded"?"var(--status-own)":"var(--status-installed)";return r.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:[r.jsx("span",{title:a??"",style:{fontFamily:"var(--font-mono)"},children:a??"—"}),r.jsx(ug,{}),r.jsxs("span",{"aria-label":`Health: ${s}`,style:{display:"inline-flex",alignItems:"center",gap:6},children:[r.jsx(F2,{color:S}),r.jsx("span",{style:{textTransform:"capitalize"},children:s})]}),c&&c.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(ug,{}),r.jsx(H2,{providers:c,onOpenSettings:u,onOpenInstallHelp:d})]}),r.jsx("div",{style:{flex:1}}),r.jsxs("button",{type:"button","data-testid":"theme-toggle",onClick:()=>m(b),"aria-label":`Switch to ${b} theme`,title:`Theme: ${h} — click for ${b}`,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:[r.jsx(G2,{mode:h}),r.jsx("span",{style:{textTransform:"capitalize"},children:h})]})]})}function P2(t,a,s){return t==="light"?"dark":t==="dark"?"auto":s?"light":a==="light"?"dark":"light"}function F2({color:t}){return r.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:t,display:"inline-block",flexShrink:0}})}function ug(){return r.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)"},children:"|"})}function G2({mode:t}){return t==="dark"?r.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}):t==="light"?r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("circle",{cx:"12",cy:"12",r:"4"}),r.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"})]}):r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("circle",{cx:"12",cy:"12",r:"9"}),r.jsx("path",{d:"M12 3a9 9 0 0 0 0 18z",fill:"currentColor"})]})}const ef=new Set;function Vv(){for(const t of ef)t()}const W2=5,q2=1e3,Y2=6e4;function K2(){const[t,a]=p.useState(void 0),[s,o]=p.useState(!1),[c,u]=p.useState(!0),d=p.useRef(0),h=p.useRef(null),g=p.useRef(null),m=p.useRef(!0),y=p.useRef(0),[v,b]=p.useState(0),S=()=>{g.current!==null&&(clearTimeout(g.current),g.current=null)},k=p.useCallback(()=>{h.current&&(h.current.abort(),h.current=null)},[]),w=p.useCallback(async()=>{if(!m.current||document.visibilityState==="hidden")return;k();const T=new AbortController;h.current=T;try{const N=await fetch("/api/plugins",{signal:T.signal});if(!m.current)return;const A=await N.json();if(!m.current)return;d.current=0,a(A.plugins??[]),u(!1),o(!1),g.current=setTimeout(()=>{m.current&&b(_=>_+1)},Y2)}catch(N){if(!m.current||N instanceof DOMException&&N.name==="AbortError")return;if(d.current+=1,u(!1),d.current>W2){o(!0);return}const A=q2*Math.pow(2,d.current-1);g.current=setTimeout(()=>{m.current&&b(_=>_+1)},A)}},[k]);p.useEffect(()=>(m.current=!0,()=>{m.current=!1,S(),k()}),[k]),p.useEffect(()=>{document.visibilityState!=="hidden"&&(S(),w())},[v,w]),p.useEffect(()=>{const T=()=>{document.visibilityState==="hidden"?(S(),k()):(d.current=0,o(!1),b(N=>N+1))};return document.addEventListener("visibilitychange",T),()=>{document.removeEventListener("visibilitychange",T)}},[k]);const C=p.useCallback(()=>{d.current=0,o(!1),S(),y.current+=1,b(T=>T+1)},[]);return p.useEffect(()=>(ef.add(C),()=>{ef.delete(C)}),[C]),{plugins:t,paused:s,loading:c,retry:C}}const Yo=0,oa=1,Bl=2,Pv=4;function dg(t){return()=>t}function X2(t){t()}function Fv(t,a){return s=>t(a(s))}function fg(t,a){return()=>t(a)}function Q2(t,a){return s=>t(a,s)}function Sf(t){return t!==void 0}function Z2(...t){return()=>{t.map(X2)}}function Il(){}function Ko(t,a){return a(t),t}function J2(t,a){return a(t)}function jt(...t){return t}function at(t,a){return t(oa,a)}function Fe(t,a){t(Yo,a)}function kf(t){t(Bl)}function wt(t){return t(Pv)}function Te(t,a){return at(t,Q2(a,Yo))}function Qn(t,a){const s=t(oa,o=>{s(),a(o)});return s}function pg(t){let a,s;return o=>c=>{a=c,s&&clearTimeout(s),s=setTimeout(()=>{o(a)},t)}}function Gv(t,a){return t===a}function bt(t=Gv){let a;return s=>o=>{t(a,o)||(a=o,s(o))}}function _e(t){return a=>s=>{t(s)&&a(s)}}function ke(t){return a=>Fv(a,t)}function or(t){return a=>()=>{a(t)}}function me(t,...a){const s=ek(...a);return((o,c)=>{switch(o){case Bl:kf(t);return;case oa:return at(t,s(c))}})}function cr(t,a){return s=>o=>{s(a=t(a,o))}}function Ua(t){return a=>s=>{t>0?t--:a(s)}}function Ar(t){let a=null,s;return o=>c=>{a=c,!s&&(s=setTimeout(()=>{s=void 0,o(a)},t))}}function Ge(...t){const a=new Array(t.length);let s=0,o=null;const c=2**t.length-1;return t.forEach((u,d)=>{const h=2**d;at(u,g=>{const m=s;s|=h,a[d]=g,m!==c&&s===c&&o&&(o(),o=null)})}),u=>d=>{const h=()=>{u([d].concat(a))};s===c?h():o=h}}function ek(...t){return a=>t.reduceRight(J2,a)}function tk(t){let a,s;const o=()=>a==null?void 0:a();return function(c,u){switch(c){case oa:return u?s===u?void 0:(o(),s=u,a=at(t,u),a):(o(),Il);case Bl:o(),s=null;return}}}function ge(t){let a=t;const s=Ze();return((o,c)=>{switch(o){case Yo:a=c;break;case oa:{c(a);break}case Pv:return a}return s(o,c)})}function rn(t,a){return Ko(ge(a),s=>Te(t,s))}function Ze(){const t=[];return((a,s)=>{switch(a){case Yo:t.slice().forEach(o=>{o(s)});return;case Bl:t.splice(0,t.length);return;case oa:return t.push(s),()=>{const o=t.indexOf(s);o>-1&&t.splice(o,1)}}})}function Nn(t){return Ko(Ze(),a=>Te(t,a))}function tt(t,a=[],{singleton:s}={singleton:!0}){return{constructor:t,dependencies:a,id:nk(),singleton:s}}const nk=()=>Symbol();function rk(t){const a=new Map,s=({constructor:o,dependencies:c,id:u,singleton:d})=>{if(d&&a.has(u))return a.get(u);const h=o(c.map(g=>s(g)));return d&&a.set(u,h),h};return s(t)}function It(...t){const a=Ze(),s=new Array(t.length);let o=0;const c=2**t.length-1;return t.forEach((u,d)=>{const h=2**d;at(u,g=>{s[d]=g,o|=h,o===c&&Fe(a,s)})}),function(u,d){switch(u){case Bl:{kf(a);return}case oa:return o===c&&d(s),at(a,d)}}}function De(t,a=Gv){return me(t,bt(a))}function tf(...t){return function(a,s){switch(a){case Bl:return;case oa:return Z2(...t.map(o=>at(o,s)))}}}const Pt={DEBUG:0,INFO:1,WARN:2,ERROR:3},ak={[Pt.DEBUG]:"debug",[Pt.ERROR]:"error",[Pt.INFO]:"log",[Pt.WARN]:"warn"},lk=()=>typeof globalThis>"u"?window:globalThis,ca=tt(()=>{const t=ge(Pt.ERROR);return{log:ge((a,s,o=Pt.INFO)=>{const c=lk().VIRTUOSO_LOG_LEVEL??wt(t);o>=c&&console[ak[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",a,s)}),logLevel:t}},[],{singleton:!0});function Va(t,a,s){return wf(t,a,s).callbackRef}function wf(t,a,s){const o=Ne.useRef(null);let c=d=>{};const u=Ne.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(d=>{const h=()=>{const g=d[0].target;g.offsetParent!==null&&t(g)};s?h():requestAnimationFrame(h)}):null,[t,s]);return c=d=>{d&&a?(u==null||u.observe(d),o.current=d):(o.current&&(u==null||u.unobserve(o.current)),o.current=null)},{callbackRef:c,ref:o}}function sk(t,a,s,o,c,u,d,h,g){const m=Ne.useCallback(y=>{const v=ik(y.children,a,h?"offsetWidth":"offsetHeight",c);let b=y.parentElement;for(;b.dataset.virtuosoScroller===void 0;)b=b.parentElement;const S=b.lastElementChild.dataset.viewportType==="window";let k;S&&(k=b.ownerDocument.defaultView);const w=d?h?d.scrollLeft:d.scrollTop:S?h?k.scrollX||k.document.documentElement.scrollLeft:k.scrollY||k.document.documentElement.scrollTop:h?b.scrollLeft:b.scrollTop,C=d?h?d.scrollWidth:d.scrollHeight:S?h?k.document.documentElement.scrollWidth:k.document.documentElement.scrollHeight:h?b.scrollWidth:b.scrollHeight,T=d?h?d.offsetWidth:d.offsetHeight:S?h?k.innerWidth:k.innerHeight:h?b.offsetWidth:b.offsetHeight;o({scrollHeight:C,scrollTop:Math.max(w,0),viewportHeight:T}),u==null||u(h?mg("column-gap",getComputedStyle(y).columnGap,c):mg("row-gap",getComputedStyle(y).rowGap,c)),v!==null&&t(v)},[t,a,c,u,d,o,h]);return wf(m,s,g)}function ik(t,a,s,o){const c=t.length;if(c===0)return null;const u=[];for(let d=0;d<c;d++){const h=t.item(d);if(h.dataset.index===void 0)continue;const g=parseInt(h.dataset.index),m=parseFloat(h.dataset.knownSize),y=a(h,s);if(y===0&&o("Zero-sized element, this should not happen",{child:h},Pt.ERROR),y===m)continue;const v=u[u.length-1];u.length===0||v.size!==y||v.endIndex!==g-1?u.push({endIndex:g,size:y,startIndex:g}):u[u.length-1].endIndex++}return u}function mg(t,a,s){return a!=="normal"&&(a==null?void 0:a.endsWith("px"))!==!0&&s(`${t} was not resolved to pixel value correctly`,a,Pt.WARN),a==="normal"?0:parseInt(a??"0",10)}function Wv(t,a,s){const o=Ne.useRef(null),c=Ne.useCallback(g=>{if(!(g!=null&&g.offsetParent))return;const m=g.getBoundingClientRect(),y=m.width;let v,b;if(a){const S=a.getBoundingClientRect(),k=m.top-S.top;b=S.height-Math.max(0,k),v=k+a.scrollTop}else{const S=d.current.ownerDocument.defaultView;b=S.innerHeight-Math.max(0,m.top),v=m.top+S.scrollY}o.current={listHeight:m.height,offsetTop:v,visibleHeight:b,visibleWidth:y},t(o.current)},[t,a]),{callbackRef:u,ref:d}=wf(c,!0,s),h=Ne.useCallback(()=>{c(d.current)},[c,d]);return Ne.useEffect(()=>{var m;if(a){a.addEventListener("scroll",h);const y=new ResizeObserver(()=>{requestAnimationFrame(h)});return y.observe(a),()=>{a.removeEventListener("scroll",h),y.unobserve(a)}}const g=(m=d.current)==null?void 0:m.ownerDocument.defaultView;return g==null||g.addEventListener("scroll",h),g==null||g.addEventListener("resize",h),()=>{g==null||g.removeEventListener("scroll",h),g==null||g.removeEventListener("resize",h)}},[h,a,d]),u}const cn=tt(()=>{const t=Ze(),a=Ze(),s=ge(0),o=Ze(),c=ge(0),u=Ze(),d=Ze(),h=ge(0),g=ge(0),m=ge(0),y=ge(0),v=Ze(),b=Ze(),S=ge(!1),k=ge(!1),w=ge(!1);return Te(me(t,ke(({scrollTop:C})=>C)),a),Te(me(t,ke(({scrollHeight:C})=>C)),d),Te(a,c),{deviation:s,fixedFooterHeight:m,fixedHeaderHeight:g,footerHeight:y,headerHeight:h,horizontalDirection:k,scrollBy:b,scrollContainerState:t,scrollHeight:d,scrollingInProgress:S,scrollTo:v,scrollTop:a,skipAnimationFrameInResizeObserver:w,smoothScrollTargetReached:o,statefulScrollTop:c,viewportHeight:u}},[],{singleton:!0}),Fs={lvl:0};function qv(t,a){const s=t.length;if(s===0)return[];let{index:o,value:c}=a(t[0]);const u=[];for(let d=1;d<s;d++){const{index:h,value:g}=a(t[d]);u.push({end:h-1,start:o,value:c}),o=h,c=g}return u.push({end:1/0,start:o,value:c}),u}function ht(t){return t===Fs}function Gs(t,a){if(!ht(t))return a===t.k?t.v:a<t.k?Gs(t.l,a):Gs(t.r,a)}function Jn(t,a,s="k"){if(ht(t))return[-1/0,void 0];if(Number(t[s])===a)return[t.k,t.v];if(Number(t[s])<a){const o=Jn(t.r,a,s);return o[0]===-1/0?[t.k,t.v]:o}return Jn(t.l,a,s)}function Cn(t,a,s){return ht(t)?Xv(a,s,1):a===t.k?Vt(t,{k:a,v:s}):a<t.k?hg(Vt(t,{l:Cn(t.l,a,s)})):hg(Vt(t,{r:Cn(t.r,a,s)}))}function Ml(){return Fs}function Ll(t,a,s){if(ht(t))return[];const o=Jn(t,a)[0];return ok(rf(t,o,s))}function nf(t,a){if(ht(t))return Fs;const{k:s,l:o,r:c}=t;if(a===s){if(ht(o))return c;if(ht(c))return o;const[u,d]=Kv(o);return Lo(Vt(t,{k:u,l:Yv(o),v:d}))}return a<s?Lo(Vt(t,{l:nf(o,a)})):Lo(Vt(t,{r:nf(c,a)}))}function Ia(t){return ht(t)?[]:[...Ia(t.l),{k:t.k,v:t.v},...Ia(t.r)]}function rf(t,a,s){if(ht(t))return[];const{k:o,l:c,r:u,v:d}=t;let h=[];return o>a&&(h=h.concat(rf(c,a,s))),o>=a&&o<=s&&h.push({k:o,v:d}),o<=s&&(h=h.concat(rf(u,a,s))),h}function Lo(t){const{l:a,lvl:s,r:o}=t;if(o.lvl>=s-1&&a.lvl>=s-1)return t;if(s>o.lvl+1){if(Cd(a))return Qv(Vt(t,{lvl:s-1}));if(!ht(a)&&!ht(a.r))return Vt(a.r,{l:Vt(a,{r:a.r.l}),lvl:s,r:Vt(t,{l:a.r.r,lvl:s-1})});throw new Error("Unexpected empty nodes")}if(Cd(t))return af(Vt(t,{lvl:s-1}));if(!ht(o)&&!ht(o.l)){const c=o.l,u=Cd(c)?o.lvl-1:o.lvl;return Vt(c,{l:Vt(t,{lvl:s-1,r:c.l}),lvl:c.lvl+1,r:af(Vt(o,{l:c.r,lvl:u}))})}throw new Error("Unexpected empty nodes")}function Vt(t,a){return Xv(a.k!==void 0?a.k:t.k,a.v!==void 0?a.v:t.v,a.lvl!==void 0?a.lvl:t.lvl,a.l!==void 0?a.l:t.l,a.r!==void 0?a.r:t.r)}function Yv(t){return ht(t.r)?t.l:Lo(Vt(t,{r:Yv(t.r)}))}function Cd(t){return ht(t)||t.lvl>t.r.lvl}function Kv(t){return ht(t.r)?[t.k,t.v]:Kv(t.r)}function Xv(t,a,s,o=Fs,c=Fs){return{k:t,l:o,lvl:s,r:c,v:a}}function hg(t){return af(Qv(t))}function Qv(t){const{l:a}=t;return!ht(a)&&a.lvl===t.lvl?Vt(a,{r:Vt(t,{l:a.r})}):t}function af(t){const{lvl:a,r:s}=t;return!ht(s)&&!ht(s.r)&&s.lvl===a&&s.r.lvl===a?Vt(s,{l:Vt(t,{r:s.l}),lvl:a+1}):t}function ok(t){return qv(t,({k:a,v:s})=>({index:a,value:s}))}function Zv(t,a){return!!(t&&t.startIndex===a.startIndex&&t.endIndex===a.endIndex)}function Ws(t,a){return!!(t&&t[0]===a[0]&&t[1]===a[1])}const Cf=tt(()=>({recalcInProgress:ge(!1)}),[],{singleton:!0});function Jv(t,a,s){return t[Bo(t,a,s)]}function Bo(t,a,s,o=0){let c=t.length-1;for(;o<=c;){const u=Math.floor((o+c)/2),d=t[u],h=s(d,a);if(h===0)return u;if(h===-1){if(c-o<2)return u-1;c=u-1}else{if(c===o)return u;o=u+1}}throw new Error(`Failed binary finding record in array - ${t.join(",")}, searched for ${a}`)}function ck(t,a,s,o){const c=Bo(t,a,o),u=Bo(t,s,o,c);return t.slice(c,u+1)}function sa(t,a){return Math.round(t.getBoundingClientRect()[a])}function Xo(t){return!ht(t.groupOffsetTree)}function Ef({index:t},a){return a===t?0:a<t?-1:1}function uk(){return{groupIndices:[],groupOffsetTree:Ml(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Ml()}}function dk(t,a){let s=ht(t)?0:1/0;for(const o of a){const{endIndex:c,size:u,startIndex:d}=o;if(s=Math.min(s,d),ht(t)){t=Cn(t,0,u);continue}const h=Ll(t,d-1,c+1);if(h.some(vk(o)))continue;let g=!1,m=!1;for(const{end:y,start:v,value:b}of h)g?(c>=v||u===b)&&(t=nf(t,v)):(m=b!==u,g=!0),y>c&&c>=v&&b!==u&&(t=Cn(t,c+1,b));m&&(t=Cn(t,d,u))}return[t,s]}function fk(t){return typeof t.groupIndex<"u"}function pk({offset:t},a){return a===t?0:a<t?-1:1}function qs(t,a,s){if(a.length===0)return 0;const{index:o,offset:c,size:u}=Jv(a,t,Ef),d=t-o,h=u*d+(d-1)*s+c;return h>0?h+s:h}function ey(t,a){if(!Xo(a))return t;let s=0;for(;a.groupIndices[s]<=t+s;)s++;return t+s}function ty(t,a,s){if(fk(t))return a.groupIndices[t.groupIndex]+1;const o=t.index==="LAST"?s:t.index;let c=ey(o,a);return c=Math.max(0,c,Math.min(s,c)),c}function mk(t,a,s,o=0){return o>0&&(a=Math.max(a,Jv(t,o,Ef).offset)),qv(ck(t,a,s,pk),gk)}function hk(t,[a,s,o,c]){a.length>0&&o("received item sizes",a,Pt.DEBUG);const u=t.sizeTree;let d=u,h=0;if(s.length>0&&ht(u)&&a.length===2){const b=a[0].size,S=a[1].size;d=s.reduce((k,w)=>Cn(Cn(k,w,b),w+1,S),d)}else[d,h]=dk(d,a);if(d===u)return t;const{lastIndex:g,lastOffset:m,lastSize:y,offsetTree:v}=lf(t.offsetTree,h,d,c);return{groupIndices:s,groupOffsetTree:s.reduce((b,S)=>Cn(b,S,qs(S,v,c)),Ml()),lastIndex:g,lastOffset:m,lastSize:y,offsetTree:v,sizeTree:d}}function xk(t){return Ia(t).map(({k:a,v:s},o,c)=>{const u=c[o+1];return{endIndex:u!==void 0?u.k-1:1/0,size:s,startIndex:a}})}function xg(t,a){let s=0,o=0;for(;s<t;)s+=a[o+1]-a[o]-1,o++;return o-(s===t?0:1)}function lf(t,a,s,o){let c=t,u=0,d=0,h=0,g=0;if(a!==0){g=Bo(c,a-1,Ef),h=c[g].offset;const m=Jn(s,a-1);u=m[0],d=m[1],c.length&&c[g].size===Jn(s,a)[1]&&(g-=1),c=c.slice(0,g+1)}else c=[];for(const{start:m,value:y}of Ll(s,a,1/0)){const v=m-u,b=v*d+h+v*o;c.push({index:m,offset:b,size:y}),u=m,h=b,d=y}return{lastIndex:u,lastOffset:h,lastSize:d,offsetTree:c}}function gk(t){return{index:t.index,value:t}}function vk(t){const{endIndex:a,size:s,startIndex:o}=t;return c=>c.start===o&&(c.end===a||c.end===1/0)&&c.value===s}const yk={offsetHeight:"height",offsetWidth:"width"},dr=tt(([{log:t},{recalcInProgress:a}])=>{const s=Ze(),o=Ze(),c=rn(o,0),u=Ze(),d=Ze(),h=ge(0),g=ge([]),m=ge(void 0),y=ge(void 0),v=ge(void 0),b=ge(void 0),S=ge((E,B)=>sa(E,yk[B])),k=ge(void 0),w=ge(0),C=uk(),T=rn(me(s,Ge(g,t,w),cr(hk,C),bt()),C),N=rn(me(g,bt(),cr((E,B)=>({current:B,prev:E.current}),{current:[],prev:[]}),ke(({prev:E})=>E)),[]);Te(me(g,_e(E=>E.length>0),Ge(T,w),ke(([E,B,L])=>{const U=E.reduce(($,q,X)=>Cn($,q,qs(q,B.offsetTree,L)||X),Ml());return{...B,groupIndices:E,groupOffsetTree:U}})),T),Te(me(o,Ge(T),_e(([E,{lastIndex:B}])=>E<B),ke(([E,{lastIndex:B,lastSize:L}])=>[{endIndex:B,size:L,startIndex:E}])),s),Te(m,y);const A=rn(me(m,ke(E=>E===void 0)),!0);Te(me(y,_e(E=>E!==void 0&&ht(wt(T).sizeTree)),ke(E=>{const B=wt(v),L=wt(g).length>0;return B!==void 0&&B!==0?L?[{endIndex:0,size:B,startIndex:0},{endIndex:1,size:E,startIndex:1}]:[]:[{endIndex:0,size:E,startIndex:0}]})),s),Te(me(b,_e(E=>E!==void 0&&E.length>0&&ht(wt(T).sizeTree)),ke(E=>{const B=[];let L=E[0],U=0;for(let $=1;$<E.length;$++){const q=E[$];q!==L&&(B.push({endIndex:$-1,size:L,startIndex:U}),L=q,U=$)}return B.push({endIndex:E.length-1,size:L,startIndex:U}),B})),s),Te(me(g,Ge(v,y),_e(([,E,B])=>E!==void 0&&B!==void 0),ke(([E,B,L])=>{const U=[];for(let $=0;$<E.length;$++){const q=E[$],X=E[$+1];U.push({startIndex:q,endIndex:q,size:B}),X!==void 0&&U.push({startIndex:q+1,endIndex:X-1,size:L})}return U})),s);const _=Nn(me(s,Ge(T),cr(({sizes:E},[B,L])=>({changed:L!==E,sizes:L}),{changed:!1,sizes:C}),ke(E=>E.changed)));at(me(h,cr((E,B)=>({diff:E.prev-B,prev:B}),{diff:0,prev:0}),ke(E=>E.diff)),E=>{const{groupIndices:B}=wt(T);if(E>0)Fe(a,!0),Fe(u,E+xg(E,B));else if(E<0){const L=wt(N);L.length>0&&(E-=xg(-E,L)),Fe(d,E)}}),at(me(h,Ge(t)),([E,B])=>{E<0&&B("`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},Pt.ERROR)});const D=Nn(u);Te(me(u,Ge(T),ke(([E,B])=>{const L=B.groupIndices.length>0,U=[],$=B.lastSize;if(L){const q=Gs(B.sizeTree,0);let X=0,ee=0;for(;X<E;){const z=B.groupIndices[ee],O=B.groupIndices.length===ee+1?1/0:B.groupIndices[ee+1]-z-1;U.push({endIndex:z,size:q,startIndex:z}),U.push({endIndex:z+1+O-1,size:$,startIndex:z+1}),ee++,X+=O+1}const I=Ia(B.sizeTree);return X!==E&&I.shift(),I.reduce((z,{k:O,v:P})=>{let H=z.ranges;return z.prevSize!==0&&(H=[...z.ranges,{endIndex:O+E-1,size:z.prevSize,startIndex:z.prevIndex}]),{prevIndex:O+E,prevSize:P,ranges:H}},{prevIndex:E,prevSize:0,ranges:U}).ranges}return Ia(B.sizeTree).reduce((q,{k:X,v:ee})=>({prevIndex:X+E,prevSize:ee,ranges:[...q.ranges,{endIndex:X+E-1,size:q.prevSize,startIndex:q.prevIndex}]}),{prevIndex:0,prevSize:$,ranges:[]}).ranges})),s);const F=Nn(me(d,Ge(T,w),ke(([E,{offsetTree:B},L])=>{const U=-E;return qs(U,B,L)})));return Te(me(d,Ge(T,w),ke(([E,B,L])=>{if(B.groupIndices.length>0){if(ht(B.sizeTree))return B;let $=Ml();const q=wt(N);let X=0,ee=0,I=0;for(;X<-E;){I=q[ee];const z=q[ee+1]-I-1;ee++,X+=z+1}if($=Ia(B.sizeTree).reduce((z,{k:O,v:P})=>Cn(z,Math.max(0,O+E),P),$),X!==-E){const z=Gs(B.sizeTree,I);$=Cn($,0,z);const O=Jn(B.sizeTree,-E+1)[1];$=Cn($,1,O)}return{...B,sizeTree:$,...lf(B.offsetTree,0,$,L)}}const U=Ia(B.sizeTree).reduce(($,{k:q,v:X})=>Cn($,Math.max(0,q+E),X),Ml());return{...B,sizeTree:U,...lf(B.offsetTree,0,U,L)}})),T),{beforeUnshiftWith:D,data:k,defaultItemSize:y,firstItemIndex:h,fixedItemSize:m,fixedGroupSize:v,gap:w,groupIndices:g,heightEstimates:b,itemSize:S,listRefresh:_,shiftWith:d,shiftWithOffset:F,sizeRanges:s,sizes:T,statefulTotalCount:c,totalCount:o,trackItemSizes:A,unshiftWith:u}},jt(ca,Cf),{singleton:!0});function bk(t){return t.reduce((a,s)=>(a.groupIndices.push(a.totalCount),a.totalCount+=s+1,a),{groupIndices:[],totalCount:0})}const ny=tt(([{groupIndices:t,sizes:a,totalCount:s},{headerHeight:o,scrollTop:c}])=>{const u=Ze(),d=Ze(),h=Nn(me(u,ke(bk)));return Te(me(h,ke(g=>g.totalCount)),s),Te(me(h,ke(g=>g.groupIndices)),t),Te(me(It(c,a,o),_e(([g,m])=>Xo(m)),ke(([g,m,y])=>Jn(m.groupOffsetTree,Math.max(g-y,0),"v")[0]),bt(),ke(g=>[g])),d),{groupCounts:u,topItemsIndexes:d}},jt(dr,cn)),ua=tt(([{log:t}])=>{const a=ge(!1),s=Nn(me(a,_e(o=>o),bt()));return at(a,o=>{o&&wt(t)("props updated",{},Pt.DEBUG)}),{didMount:s,propsReady:a}},jt(ca),{singleton:!0}),jk=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function ry(t){const a=typeof t=="number"?{index:t}:t;return a.align||(a.align="start"),(!a.behavior||!jk)&&(a.behavior="auto"),a.offset===void 0&&(a.offset=0),a}const ei=tt(([{gap:t,listRefresh:a,sizes:s,totalCount:o},{fixedFooterHeight:c,fixedHeaderHeight:u,footerHeight:d,headerHeight:h,scrollingInProgress:g,scrollTo:m,smoothScrollTargetReached:y,viewportHeight:v},{log:b}])=>{const S=Ze(),k=Ze(),w=ge(0);let C=null,T=null,N=null;function A(){C!==null&&(C(),C=null),N!==null&&(N(),N=null),T&&(clearTimeout(T),T=null),Fe(g,!1)}return Te(me(S,Ge(s,v,o,w,h,d,b),Ge(t,u,c),ke(([[_,D,F,E,B,L,U,$],q,X,ee])=>{const I=ry(_),{align:z,behavior:O,offset:P}=I,H=E-1,ae=ty(I,D,H);let M=qs(ae,D.offsetTree,q)+L;z==="end"?(M+=X+Jn(D.sizeTree,ae)[1]-F+ee,ae===H&&(M+=U)):z==="center"?M+=(X+Jn(D.sizeTree,ae)[1]-F+ee)/2:M-=B,P!==void 0&&P!==0&&(M+=P);const Y=W=>{A(),W?($("retrying to scroll to",{location:_},Pt.DEBUG),Fe(S,_)):(Fe(k,!0),$("list did not change, scroll successful",{},Pt.DEBUG))};if(A(),O==="smooth"){let W=!1;N=at(a,Q=>{W=W||Q}),C=Qn(y,()=>{Y(W)})}else C=Qn(me(a,Sk(150)),Y);return T=setTimeout(()=>{A()},1200),Fe(g,!0),$("scrolling from index to",{behavior:O,index:ae,top:M},Pt.DEBUG),{behavior:O,top:M}})),m),{scrollTargetReached:k,scrollToIndex:S,topListHeight:w}},jt(dr,cn,ca),{singleton:!0});function Sk(t){return a=>{const s=setTimeout(()=>{a(!1)},t);return o=>{o&&(a(!0),clearTimeout(s))}}}function Nf(t,a){t===0?a():requestAnimationFrame(()=>{Nf(t-1,a)})}function Tf(t,a){const s=a-1;return typeof t=="number"?t:t.index==="LAST"?s:t.index}const ti=tt(([{defaultItemSize:t,listRefresh:a,sizes:s},{scrollTop:o},{scrollTargetReached:c,scrollToIndex:u},{didMount:d}])=>{const h=ge(!0),g=ge(0),m=ge(!0);return Te(me(d,Ge(g),_e(([y,v])=>v!==0),or(!1)),h),Te(me(d,Ge(g),_e(([y,v])=>v!==0),or(!1)),m),at(me(It(a,d),Ge(h,s,t,m),_e(([[,y],v,{sizeTree:b},S,k])=>y&&(!ht(b)||Sf(S))&&!v&&!k),Ge(g)),([,y])=>{Qn(c,()=>{Fe(m,!0)}),Nf(4,()=>{Qn(o,()=>{Fe(h,!0)}),Fe(u,y)})}),{initialItemFinalLocationReached:m,initialTopMostItemIndex:g,scrolledToInitialItem:h}},jt(dr,cn,ei,ua),{singleton:!0});function ay(t,a){return Math.abs(t-a)<1.01}const Ys="up",Hs="down",kk="none",wk={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Ck=0,ni=tt(([{footerHeight:t,headerHeight:a,scrollBy:s,scrollContainerState:o,scrollTop:c,viewportHeight:u}])=>{const d=ge(!1),h=ge(!0),g=Ze(),m=Ze(),y=ge(4),v=ge(Ck),b=rn(me(tf(me(De(c),Ua(1),or(!0)),me(De(c),Ua(1),or(!1),pg(100))),bt()),!1),S=rn(me(tf(me(s,or(!0)),me(s,or(!1),pg(200))),bt()),!1);Te(me(It(De(c),De(v)),ke(([N,A])=>N<=A),bt()),h),Te(me(h,Ar(50)),m);const k=Nn(me(It(o,De(u),De(a),De(t),De(y)),cr((N,[{scrollHeight:A,scrollTop:_},D,F,E,B])=>{const L=_+D-A>-B,U={scrollHeight:A,scrollTop:_,viewportHeight:D};if(L){let q,X;return _>N.state.scrollTop?(q="SCROLLED_DOWN",X=N.state.scrollTop-_):(q="SIZE_DECREASED",X=N.state.scrollTop-_||N.scrollTopDelta),{atBottom:!0,atBottomBecause:q,scrollTopDelta:X,state:U}}let $;return U.scrollHeight>N.state.scrollHeight?$="SIZE_INCREASED":D<N.state.viewportHeight?$="VIEWPORT_HEIGHT_DECREASING":_<N.state.scrollTop?$="SCROLLING_UPWARDS":$="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:$,state:U}},wk),bt((N,A)=>N!==void 0&&N.atBottom===A.atBottom))),w=rn(me(o,cr((N,{scrollHeight:A,scrollTop:_,viewportHeight:D})=>{if(!ay(N.scrollHeight,A)){const F=A-(_+D)<1;return N.scrollTop!==_&&F?{changed:!0,jump:N.scrollTop-_,scrollHeight:A,scrollTop:_}:{changed:!0,jump:0,scrollHeight:A,scrollTop:_}}return{changed:!1,jump:0,scrollHeight:A,scrollTop:_}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),_e(N=>N.changed),ke(N=>N.jump)),0);Te(me(k,ke(N=>N.atBottom)),d),Te(me(d,Ar(50)),g);const C=ge(Hs);Te(me(o,ke(({scrollTop:N})=>N),bt(),cr((N,A)=>wt(S)?{direction:N.direction,prevScrollTop:A}:{direction:A<N.prevScrollTop?Ys:Hs,prevScrollTop:A},{direction:Hs,prevScrollTop:0}),ke(N=>N.direction)),C),Te(me(o,Ar(50),or(kk)),C);const T=ge(0);return Te(me(b,_e(N=>!N),or(0)),T),Te(me(c,Ar(100),Ge(b),_e(([N,A])=>A),cr(([N,A],[_])=>[A,_],[0,0]),ke(([N,A])=>A-N)),T),{atBottomState:k,atBottomStateChange:g,atBottomThreshold:y,atTopStateChange:m,atTopThreshold:v,isAtBottom:d,isAtTop:h,isScrolling:b,lastJumpDueToItemResize:w,scrollDirection:C,scrollVelocity:T}},jt(cn)),Ks="top",Xs="bottom",gg="none";function vg(t,a,s){return typeof t=="number"?s===Ys&&a===Ks||s===Hs&&a===Xs?t:0:s===Ys?a===Ks?t.main:t.reverse:a===Xs?t.main:t.reverse}function yg(t,a){return typeof t=="number"?t:t[a]??0}const Rf=tt(([{deviation:t,fixedHeaderHeight:a,headerHeight:s,scrollTop:o,viewportHeight:c}])=>{const u=Ze(),d=ge(0),h=ge(0),g=ge(0),m=rn(me(It(De(o),De(c),De(s),De(u,Ws),De(g),De(d),De(a),De(t),De(h)),ke(([y,v,b,[S,k],w,C,T,N,A])=>{const _=y-N,D=C+T,F=Math.max(b-_,0);let E=gg;const B=yg(A,Ks),L=yg(A,Xs);return S-=N,S+=b+T,k+=b+T,k-=N,S>y+D-B&&(E=Ys),k<y-F+v+L&&(E=Hs),E!==gg?[Math.max(_-b-vg(w,Ks,E)-B,0),_-F-T+v+vg(w,Xs,E)+L]:null}),_e(y=>y!==null),bt(Ws)),[0,0]);return{increaseViewportBy:h,listBoundary:u,overscan:g,topListHeight:d,visibleRange:m}},jt(cn),{singleton:!0});function Ek(t,a,s){if(Xo(a)){const o=ey(t,a);return[{index:Jn(a.groupOffsetTree,o)[0],offset:0,size:0},{data:s==null?void 0:s[0],index:o,offset:0,size:0}]}return[{data:s==null?void 0:s[0],index:t,offset:0,size:0}]}const Ed={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function zo(t,a,s,o,c,u){const{lastIndex:d,lastOffset:h,lastSize:g}=c;let m=0,y=0;if(t.length>0){m=t[0].offset;const w=t[t.length-1];y=w.offset+w.size}const v=s-d,b=h+v*g+(v-1)*o,S=m,k=b-y;return{bottom:y,firstItemIndex:u,items:bg(t,c,u),offsetBottom:k,offsetTop:m,top:S,topItems:bg(a,c,u),topListHeight:a.reduce((w,C)=>C.size+w,0),totalCount:s}}function ly(t,a,s,o,c,u){let d=0;if(s.groupIndices.length>0)for(const y of s.groupIndices){if(y-d>=t)break;d++}const h=t+d,g=Tf(a,h),m=Array.from({length:h}).map((y,v)=>({data:u[v+g],index:v+g,offset:0,size:0}));return zo(m,[],h,c,s,o)}function bg(t,a,s){if(t.length===0)return[];if(!Xo(a))return t.map(m=>({...m,index:m.index+s,originalIndex:m.index}));const o=t[0].index,c=t[t.length-1].index,u=[],d=Ll(a.groupOffsetTree,o,c);let h,g=0;for(const m of t){(!h||h.end<m.index)&&(h=d.shift(),g=a.groupIndices.indexOf(h.start));let y;m.index===h.start?y={index:g,type:"group"}:y={groupIndex:g,index:m.index-(g+1)+s},u.push({...y,data:m.data,offset:m.offset,originalIndex:m.index,size:m.size})}return u}function jg(t,a){return t===void 0?0:typeof t=="number"?t:t[a]??0}const Pa=tt(([{data:t,firstItemIndex:a,gap:s,sizes:o,totalCount:c},u,{listBoundary:d,topListHeight:h,visibleRange:g},{initialTopMostItemIndex:m,scrolledToInitialItem:y},{topListHeight:v},b,{didMount:S},{recalcInProgress:k}])=>{const w=ge([]),C=ge(0),T=Ze(),N=ge(0);Te(u.topItemsIndexes,w);const A=rn(me(It(S,k,De(g,Ws),De(c),De(o),De(m),y,De(w),De(a),De(s),De(N),t),_e(([E,B,,L,,,,,,,,U])=>{const $=U!==void 0&&U.length!==L;return E&&!B&&!$}),ke(([,,[E,B],L,U,$,q,X,ee,I,z,O])=>{var je,Re;const P=U,{offsetTree:H,sizeTree:ae}=P,M=wt(C);if(L===0)return{...Ed,totalCount:L};if(E===0&&B===0)return M===0?{...Ed,totalCount:L}:ly(M,$,U,ee,I,O||[]);if(ht(ae))return M>0?null:zo(Ek(Tf($,L),P,O),[],L,I,P,ee);const Y=[];if(X.length>0){const Oe=X[0],le=X[X.length-1];let he=0;for(const pe of Ll(ae,Oe,le)){const xe=pe.value,be=Math.max(pe.start,Oe),Be=Math.min(pe.end,le);for(let Ue=be;Ue<=Be;Ue++)Y.push({data:O==null?void 0:O[Ue],index:Ue,offset:he,size:xe}),he+=xe}}if(!q)return zo([],Y,L,I,P,ee);const W=X.length>0?X[X.length-1]+1:0,Q=mk(H,E,B,W);if(Q.length===0)return null;const oe=L-1,de=Ko([],Oe=>{for(const le of Q){const he=le.value;let pe=he.offset,xe=le.start;const be=he.size;if(he.offset<E){xe+=Math.floor((E-he.offset+I)/(be+I));const Ue=xe-le.start;pe+=Ue*be+Ue*I}xe<W&&(pe+=(W-xe)*be,xe=W);const Be=Math.min(le.end,oe);for(let Ue=xe;Ue<=Be&&!(pe>=B);Ue++)Oe.push({data:O==null?void 0:O[Ue],index:Ue,offset:pe,size:be}),pe+=be+I}}),ve=jg(z,Ks),ce=jg(z,Xs);if(de.length>0&&(ve>0||ce>0)){const Oe=de[0],le=de[de.length-1];if(ve>0&&Oe.index>W){const he=Math.min(ve,Oe.index-W),pe=[];let xe=Oe.offset;for(let be=Oe.index-1;be>=Oe.index-he;be--){const Be=((je=Ll(ae,be,be)[0])==null?void 0:je.value)??Oe.size;xe-=Be+I,pe.unshift({data:O==null?void 0:O[be],index:be,offset:xe,size:Be})}de.unshift(...pe)}if(ce>0&&le.index<oe){const he=Math.min(ce,oe-le.index);let pe=le.offset+le.size+I;for(let xe=le.index+1;xe<=le.index+he;xe++){const be=((Re=Ll(ae,xe,xe)[0])==null?void 0:Re.value)??le.size;de.push({data:O==null?void 0:O[xe],index:xe,offset:pe,size:be}),pe+=be+I}}}return zo(de,Y,L,I,P,ee)}),_e(E=>E!==null),bt()),Ed);Te(me(t,_e(Sf),ke(E=>E==null?void 0:E.length)),c),Te(me(A,ke(E=>E.topListHeight)),v),Te(v,h),Te(me(A,ke(E=>[E.top,E.bottom])),d),Te(me(A,ke(E=>E.items)),T);const _=Nn(me(A,_e(({items:E})=>E.length>0),Ge(c,t),_e(([{items:E},B])=>E[E.length-1].originalIndex===B-1),ke(([,E,B])=>[E-1,B]),bt(Ws),ke(([E])=>E))),D=Nn(me(A,Ar(200),_e(({items:E,topItems:B})=>E.length>0&&E[0].originalIndex===B.length),ke(({items:E})=>E[0].index),bt())),F=Nn(me(A,_e(({items:E})=>E.length>0),ke(({items:E})=>{let B=0,L=E.length-1;for(;E[B].type==="group"&&B<L;)B++;for(;E[L].type==="group"&&L>B;)L--;return{endIndex:E[L].index,startIndex:E[B].index}}),bt(Zv)));return{endReached:_,initialItemCount:C,itemsRendered:T,listState:A,minOverscanItemCount:N,rangeChanged:F,startReached:D,topItemsIndexes:w,...b}},jt(dr,ny,Rf,ti,ei,ni,ua,Cf),{singleton:!0}),sy=tt(([{fixedFooterHeight:t,fixedHeaderHeight:a,footerHeight:s,headerHeight:o},{listState:c}])=>{const u=Ze(),d=rn(me(It(s,t,o,a,c),ke(([h,g,m,y,v])=>h+g+m+y+v.offsetBottom+v.bottom)),0);return Te(De(d),u),{totalListHeight:d,totalListHeightChanged:u}},jt(cn,Pa),{singleton:!0}),Nk=tt(([{viewportHeight:t},{totalListHeight:a}])=>{const s=ge(!1),o=rn(me(It(s,t,a),_e(([c])=>c),ke(([,c,u])=>Math.max(0,c-u)),Ar(0),bt()),0);return{alignToBottom:s,paddingTopAddition:o}},jt(cn,sy),{singleton:!0}),iy=tt(()=>({context:ge(null)})),Tk=({itemBottom:t,itemTop:a,locationParams:{align:s,behavior:o,...c},viewportBottom:u,viewportTop:d})=>a<d?{...c,align:s??"start",...o!==void 0?{behavior:o}:{}}:t>u?{...c,align:s??"end",...o!==void 0?{behavior:o}:{}}:null,oy=tt(([{gap:t,sizes:a,totalCount:s},{fixedFooterHeight:o,fixedHeaderHeight:c,headerHeight:u,scrollingInProgress:d,scrollTop:h,viewportHeight:g},{scrollToIndex:m}])=>{const y=Ze();return Te(me(y,Ge(a,g,s,u,c,o,h),Ge(t),ke(([[v,b,S,k,w,C,T,N],A])=>{const{calculateViewLocation:_=Tk,done:D,...F}=v,E=ty(v,b,k-1),B=qs(E,b.offsetTree,A)+w+C,L=B+Jn(b.sizeTree,E)[1],U=N+C,$=N+S-T,q=_({itemBottom:L,itemTop:B,locationParams:F,viewportBottom:$,viewportTop:U});return q!==null?D&&Qn(me(d,_e(X=>!X),Ua(wt(d)?1:2)),D):D==null||D(),q}),_e(v=>v!==null)),m),{scrollIntoView:y}},jt(dr,cn,ei,Pa,ca),{singleton:!0});function Sg(t){return t===!1?!1:t==="smooth"?"smooth":"auto"}const Rk=(t,a)=>typeof t=="function"?Sg(t(a)):a&&Sg(t),Ak=tt(([{listRefresh:t,totalCount:a,fixedItemSize:s,data:o},{atBottomState:c,isAtBottom:u},{scrollToIndex:d},{scrolledToInitialItem:h},{didMount:g,propsReady:m},{log:y},{scrollingInProgress:v},{context:b},{scrollIntoView:S}])=>{const k=ge(!1),w=Ze();let C=null;function T(D){Fe(d,{align:"end",behavior:D,index:"LAST"})}at(me(It(me(De(a),Ua(1)),g),Ge(De(k),u,h,v),ke(([[D,F],E,B,L,U])=>{let $=F&&L,q="auto";return $&&(q=Rk(E,B||U),$=$&&q!==!1),{followOutputBehavior:q,shouldFollow:$,totalCount:D}}),_e(({shouldFollow:D})=>D)),({followOutputBehavior:D,totalCount:F})=>{C!==null&&(C(),C=null),wt(s)!==void 0?requestAnimationFrame(()=>{wt(y)("following output to ",{totalCount:F},Pt.DEBUG),T(D)}):C=Qn(t,()=>{wt(y)("following output to ",{totalCount:F},Pt.DEBUG),T(D),C=null})});function N(D){const F=Qn(c,E=>{D&&!E.atBottom&&E.notAtBottomBecause==="SIZE_INCREASED"&&C===null&&(wt(y)("scrolling to bottom due to increased size",{},Pt.DEBUG),T("auto"))});setTimeout(F,100)}at(me(It(De(k),a,m),_e(([D,,F])=>D!==!1&&F),cr(({value:D},[,F])=>({refreshed:D===F,value:F}),{refreshed:!1,value:0}),_e(({refreshed:D})=>D),Ge(k,a)),([,D])=>{wt(h)&&N(D!==!1)}),at(w,()=>{N(wt(k)!==!1)}),at(It(De(k),c),([D,F])=>{D!==!1&&!F.atBottom&&F.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&T("auto")});const A=ge(null),_=Ze();return Te(tf(me(De(o),ke(D=>(D==null?void 0:D.length)??0)),me(De(a))),_),at(me(It(me(_,Ua(1)),g),Ge(De(A),h,v,b),ke(([[D,F],E,B,L,U])=>F&&B&&(E==null?void 0:E({context:U,totalCount:D,scrollingInProgress:L}))),_e(D=>!!D),Ar(0)),D=>{C!==null&&(C(),C=null),wt(s)!==void 0?requestAnimationFrame(()=>{wt(y)("scrolling into view",{}),Fe(S,D)}):C=Qn(t,()=>{wt(y)("scrolling into view",{}),Fe(S,D),C=null})}),{autoscrollToBottom:w,followOutput:k,scrollIntoViewOnChange:A}},jt(dr,ni,ei,ti,ua,ca,cn,iy,oy)),Mk=tt(([{data:t,firstItemIndex:a,gap:s,sizes:o},{initialTopMostItemIndex:c},{initialItemCount:u,listState:d},{didMount:h}])=>(Te(me(h,Ge(u),_e(([,g])=>g!==0),Ge(c,o,a,s,t),ke(([[,g],m,y,v,b,S=[]])=>ly(g,m,y,v,b,S))),d),{}),jt(dr,ti,Pa,ua),{singleton:!0}),Lk=tt(([{didMount:t},{scrollTo:a},{listState:s}])=>{const o=ge(0);return at(me(t,Ge(o),_e(([,c])=>c!==0),ke(([,c])=>({top:c}))),c=>{Qn(me(s,Ua(1),_e(u=>u.items.length>1)),()=>{requestAnimationFrame(()=>{Fe(a,c)})})}),{initialScrollTop:o}},jt(ua,cn,Pa),{singleton:!0}),cy=tt(([{scrollVelocity:t}])=>{const a=ge(!1),s=Ze(),o=ge(!1);return Te(me(t,Ge(o,a,s),_e(([c,u])=>u!==!1&&u!==void 0),ke(([c,u,d,h])=>{const{enter:g,exit:m}=u;if(d){if(m(c,h))return!1}else if(g(c,h))return!0;return d}),bt()),a),at(me(It(a,t,s),Ge(o)),([[c,u,d],h])=>{c&&h!==!1&&h!==void 0&&h.change&&h.change(u,d)}),{isSeeking:a,scrollSeekConfiguration:o,scrollSeekRangeChanged:s,scrollVelocity:t}},jt(ni),{singleton:!0}),Af=tt(([{scrollContainerState:t,scrollTo:a}])=>{const s=Ze(),o=Ze(),c=Ze(),u=ge(!1),d=ge(void 0);return Te(me(It(s,o),ke(([{scrollTop:h,viewportHeight:g},{offsetTop:m,listHeight:y}])=>({scrollHeight:y,scrollTop:Math.max(0,h-m),viewportHeight:g}))),t),Te(me(a,Ge(o),ke(([h,{offsetTop:g}])=>({...h,top:h.top+g}))),c),{customScrollParent:d,useWindowScroll:u,windowScrollContainerState:s,windowScrollTo:c,windowViewportRect:o}},jt(cn)),zk=tt(([{sizeRanges:t,sizes:a},{headerHeight:s,scrollTop:o},{initialTopMostItemIndex:c},{didMount:u},{useWindowScroll:d,windowScrollContainerState:h,windowViewportRect:g}])=>{const m=Ze(),y=ge(void 0),v=ge(null),b=ge(null);return Te(h,v),Te(g,b),at(me(m,Ge(a,o,d,v,b,s)),([S,k,w,C,T,N,A])=>{const _=xk(k.sizeTree);C&&T!==null&&N!==null&&(w=T.scrollTop-N.offsetTop),w-=A,S({ranges:_,scrollTop:w})}),Te(me(y,_e(Sf),ke(Dk)),c),Te(me(u,Ge(y),_e(([,S])=>S!==void 0),bt(),ke(([,S])=>S.ranges)),t),{getState:m,restoreStateFrom:y}},jt(dr,cn,ti,ua,Af));function Dk(t){return{align:"start",index:0,offset:t.scrollTop}}const _k=tt(([{topItemsIndexes:t}])=>{const a=ge(0);return Te(me(a,_e(s=>s>=0),ke(s=>Array.from({length:s}).map((o,c)=>c))),t),{topItemCount:a}},jt(Pa));function uy(t){let a=!1,s;return(()=>(a||(a=!0,s=t()),s))}const Ok=uy(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Bk=tt(([{deviation:t,scrollBy:a,scrollingInProgress:s,scrollTop:o},{isAtBottom:c,isScrolling:u,lastJumpDueToItemResize:d,scrollDirection:h},{listState:g},{beforeUnshiftWith:m,gap:y,shiftWithOffset:v,sizes:b},{log:S},{recalcInProgress:k}])=>{const w=Nn(me(g,Ge(d),cr(([,T,N,A],[{bottom:_,items:D,offsetBottom:F,totalCount:E},B])=>{const L=_+F;let U=0;return N===E&&T.length>0&&D.length>0&&(D[0].originalIndex===0&&T[0].originalIndex===0||(U=L-A,U!==0&&(U+=B))),[U,D,E,L]},[0,[],0,0]),_e(([T])=>T!==0),Ge(o,h,s,c,S,k),_e(([,T,N,A,,,_])=>!_&&!A&&T!==0&&N===Ys),ke(([[T],,,,,N])=>(N("Upward scrolling compensation",{amount:T},Pt.DEBUG),T))));function C(T){T>0?(Fe(a,{behavior:"auto",top:-T}),Fe(t,0)):(Fe(t,0),Fe(a,{behavior:"auto",top:-T}))}return at(me(w,Ge(t,u)),([T,N,A])=>{A&&Ok()?Fe(t,N-T):C(-T)}),at(me(It(rn(u,!1),t,k),_e(([T,N,A])=>!T&&!A&&N!==0),ke(([T,N])=>N),Ar(1)),C),Te(me(v,ke(T=>({top:-T}))),a),at(me(m,Ge(b,y),ke(([T,{groupIndices:N,lastSize:A,sizeTree:_},D])=>{function F($){return $*(A+D)}if(N.length===0)return F(T);let E=0;const B=Gs(_,0);let L=0,U=0;for(;L<T;){L++,E+=B;let $=N.length===U+1?1/0:N[U+1]-N[U]-1;L+$>T&&(E-=B,$=T-L+1),L+=$,E+=F($),U++}return E})),T=>{Fe(t,T),requestAnimationFrame(()=>{Fe(a,{top:T}),requestAnimationFrame(()=>{Fe(t,0),Fe(k,!1)})})}),{deviation:t}},jt(cn,ni,Pa,dr,ca,Cf)),Ik=tt(([t,a,s,o,c,u,d,h,g,m,y])=>({...t,...a,...s,...o,...c,...u,...d,...h,...g,...m,...y}),jt(Rf,Mk,ua,cy,sy,Lk,Nk,Af,oy,ca,iy)),dy=tt(([{data:t,defaultItemSize:a,firstItemIndex:s,fixedItemSize:o,fixedGroupSize:c,gap:u,groupIndices:d,heightEstimates:h,itemSize:g,sizeRanges:m,sizes:y,statefulTotalCount:v,totalCount:b,trackItemSizes:S},{initialItemFinalLocationReached:k,initialTopMostItemIndex:w,scrolledToInitialItem:C},T,N,A,_,{scrollToIndex:D},F,{topItemCount:E},{groupCounts:B},L])=>{const{listState:U,minOverscanItemCount:$,topItemsIndexes:q,rangeChanged:X,...ee}=_;return Te(X,L.scrollSeekRangeChanged),Te(me(L.windowViewportRect,ke(I=>I.visibleHeight)),T.viewportHeight),{data:t,defaultItemHeight:a,firstItemIndex:s,fixedItemHeight:o,fixedGroupHeight:c,gap:u,groupCounts:B,heightEstimates:h,initialItemFinalLocationReached:k,initialTopMostItemIndex:w,scrolledToInitialItem:C,sizeRanges:m,topItemCount:E,topItemsIndexes:q,totalCount:b,...A,groupIndices:d,itemSize:g,listState:U,minOverscanItemCount:$,scrollToIndex:D,statefulTotalCount:v,trackItemSizes:S,rangeChanged:X,...ee,...L,...T,sizes:y,...N}},jt(dr,ti,cn,zk,Ak,Pa,ei,Bk,_k,ny,Ik));function Uk(t,a){const s={},o={};let c=0;const u=t.length;for(;c<u;)o[t[c]]=1,c+=1;for(const d in a)Object.hasOwn(o,d)||(s[d]=a[d]);return s}const yo=typeof document<"u"?Ne.useLayoutEffect:Ne.useEffect;function fy(t,a,s){const o=Object.keys(a.required||{}),c=Object.keys(a.optional||{}),u=Object.keys(a.methods||{}),d=Object.keys(a.events||{}),h=Ne.createContext({});function g(C,T){C.propsReady!==void 0&&Fe(C.propsReady,!1);for(const N of o){const A=C[a.required[N]];Fe(A,T[N])}for(const N of c)if(N in T){const A=C[a.optional[N]];Fe(A,T[N])}C.propsReady!==void 0&&Fe(C.propsReady,!0)}function m(C){return u.reduce((T,N)=>(T[N]=A=>{const _=C[a.methods[N]];Fe(_,A)},T),{})}function y(C){return d.reduce((T,N)=>(T[N]=tk(C[a.events[N]]),T),{})}const v=Ne.forwardRef(function(C,T){const{children:N,...A}=C,[_]=Ne.useState(()=>Ko(rk(t),E=>{g(E,A)})),[D]=Ne.useState(fg(y,_));yo(()=>{for(const E of d)E in A&&at(D[E],A[E]);return()=>{Object.values(D).map(kf)}},[A,D,_]),yo(()=>{g(_,A)}),Ne.useImperativeHandle(T,dg(m(_)));const F=s;return r.jsx(h.Provider,{value:_,children:s!==void 0?r.jsx(F,{...Uk([...o,...c,...d],A),children:N}):N})}),b=C=>{const T=Ne.useContext(h);return Ne.useCallback(N=>{Fe(T[C],N)},[T,C])},S=C=>{const T=Ne.useContext(h)[C],N=Ne.useCallback(A=>at(T,A),[T]);return Ne.useSyncExternalStore(N,()=>wt(T),()=>wt(T))},k=C=>{const T=Ne.useContext(h)[C],[N,A]=Ne.useState(fg(wt,T));return yo(()=>at(T,_=>{_!==N&&A(dg(_))}),[T,N]),N},w=parseInt(Ne.version)>=18?S:k;return{Component:v,useEmitter:(C,T)=>{const N=Ne.useContext(h)[C];yo(()=>at(N,T),[T,N])},useEmitterValue:w,usePublisher:b}}const py=Ne.createContext(void 0),my=Ne.createContext(void 0),Nd="-webkit-sticky",kg="sticky",Mf=uy(()=>{if(typeof document>"u")return kg;const t=document.createElement("div");return t.style.position=Nd,t.style.position===Nd?Nd:kg}),hy=typeof document<"u"?Ne.useLayoutEffect:Ne.useEffect;function Td(t){return"self"in t}function Hk(t){return"body"in t}function xy(t,a,s,o=Il,c,u){const d=Ne.useRef(null),h=Ne.useRef(null),g=Ne.useRef(null),m=Ne.useCallback(b=>{let S,k,w;const C=b.target;if(Hk(C)||Td(C)){const N=Td(C)?C:C.defaultView;w=u===!0?N.scrollX:N.scrollY,S=u===!0?N.document.documentElement.scrollWidth:N.document.documentElement.scrollHeight,k=u===!0?N.innerWidth:N.innerHeight}else w=u===!0?C.scrollLeft:C.scrollTop,S=u===!0?C.scrollWidth:C.scrollHeight,k=u===!0?C.offsetWidth:C.offsetHeight;const T=()=>{t({scrollHeight:S,scrollTop:Math.max(w,0),viewportHeight:k})};b.suppressFlushSync===!0?T():eS.flushSync(T),h.current!==null&&(w===h.current||w<=0||w===S-k)&&(h.current=null,a(!0),g.current&&(clearTimeout(g.current),g.current=null))},[t,a,u]);Ne.useEffect(()=>{const b=c||d.current;return o(c||d.current),m({suppressFlushSync:!0,target:b}),b.addEventListener("scroll",m,{passive:!0}),()=>{o(null),b.removeEventListener("scroll",m)}},[d,m,s,o,c]);function y(b){const S=d.current;if(!S||(u===!0?"offsetWidth"in S&&S.offsetWidth===0:"offsetHeight"in S&&S.offsetHeight===0))return;const k=b.behavior==="smooth";let w,C,T;Td(S)?(C=Math.max(sa(S.document.documentElement,u===!0?"width":"height"),u===!0?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight),w=u===!0?S.innerWidth:S.innerHeight,T=u===!0?window.scrollX:window.scrollY):(C=S[u===!0?"scrollWidth":"scrollHeight"],w=sa(S,u===!0?"width":"height"),T=S[u===!0?"scrollLeft":"scrollTop"]);const N=C-w;if(b.top=Math.ceil(Math.max(Math.min(N,b.top),0)),ay(w,C)||b.top===T){t({scrollHeight:C,scrollTop:T,viewportHeight:w}),k&&a(!0);return}k?(h.current=b.top,g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{g.current=null,h.current=null,a(!0)},1e3)):h.current=null,u===!0&&(b={...b.behavior!==void 0?{behavior:b.behavior}:{},left:b.top}),S.scrollTo(b)}function v(b){u===!0&&(b={...b.behavior!==void 0?{behavior:b.behavior}:{},...b.top!==void 0?{left:b.top}:{}}),d.current.scrollBy(b)}return{scrollByCallback:v,scrollerRef:d,scrollToCallback:y}}function Lf(t){return t}const $k=tt(()=>{const t=ge(h=>`Item ${h}`),a=ge(h=>`Group ${h}`),s=ge({}),o=ge(Lf),c=ge("div"),u=ge(Il),d=(h,g=null)=>rn(me(s,ke(m=>m[h]),bt()),g);return{components:s,computeItemKey:o,EmptyPlaceholder:d("EmptyPlaceholder"),FooterComponent:d("Footer"),GroupComponent:d("Group","div"),groupContent:a,HeaderComponent:d("Header"),HeaderFooterTag:c,ItemComponent:d("Item","div"),itemContent:t,ListComponent:d("List","div"),ScrollerComponent:d("Scroller","div"),scrollerRef:u,ScrollSeekPlaceholder:d("ScrollSeekPlaceholder"),TopItemListComponent:d("TopItemList")}}),Vk=tt(([t,a])=>({...t,...a}),jt(dy,$k)),Pk=({height:t})=>r.jsx("div",{style:{height:t}}),Fk={overflowAnchor:"none",position:Mf(),zIndex:1},gy={overflowAnchor:"none"},Gk={...gy,display:"inline-block",height:"100%"},wg=Ne.memo(function({showTopList:t=!1}){const a=$e("listState"),s=Pn("sizeRanges"),o=$e("useWindowScroll"),c=$e("customScrollParent"),u=Pn("windowScrollContainerState"),d=Pn("scrollContainerState"),h=c||o?u:d,g=$e("itemContent"),m=$e("context"),y=$e("groupContent"),v=$e("trackItemSizes"),b=$e("itemSize"),S=$e("log"),k=Pn("gap"),w=$e("horizontalDirection"),{callbackRef:C}=sk(s,b,v,t?Il:h,S,k,c,w,$e("skipAnimationFrameInResizeObserver")),[T,N]=Ne.useState(0);zf("deviation",ee=>{T!==ee&&N(ee)});const A=$e("EmptyPlaceholder"),_=$e("ScrollSeekPlaceholder")??Pk,D=$e("ListComponent"),F=$e("ItemComponent"),E=$e("GroupComponent"),B=$e("computeItemKey"),L=$e("isSeeking"),U=$e("groupIndices").length>0,$=$e("alignToBottom"),q=$e("initialItemFinalLocationReached"),X=t?{}:{boxSizing:"border-box",...w?{display:"inline-block",height:"100%",marginLeft:T!==0?T:$?"auto":0,paddingLeft:a.offsetTop,paddingRight:a.offsetBottom,whiteSpace:"nowrap"}:{marginTop:T!==0?T:$?"auto":0,paddingBottom:a.offsetBottom,paddingTop:a.offsetTop},...q?{}:{visibility:"hidden"}};return!t&&a.totalCount===0&&A!==null&&A!==void 0?r.jsx(A,{...nn(A,m)}):r.jsx(D,{...nn(D,m),"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list",ref:C,style:X,children:(t?a.topItems:a.items).map(ee=>{const I=ee.originalIndex,z=B(I+a.firstItemIndex,ee.data,m);return L?p.createElement(_,{...nn(_,m),height:ee.size,index:ee.index,key:z,type:ee.type||"item",...ee.type==="group"?{}:{groupIndex:ee.groupIndex}}):ee.type==="group"?p.createElement(E,{...nn(E,m),"data-index":I,"data-item-index":ee.index,"data-known-size":ee.size,key:z,style:Fk},y(ee.index,m)):p.createElement(F,{...nn(F,m),...Kk(F,ee.data),"data-index":I,"data-item-group-index":ee.groupIndex,"data-item-index":ee.index,"data-known-size":ee.size,key:z,style:w?Gk:gy},U?g(ee.index,ee.groupIndex,ee.data,m):g(ee.index,ee.data,m))})})}),Wk={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},qk={outline:"none",overflowX:"auto",position:"relative"},Qo=t=>({height:"100%",position:"absolute",top:0,width:"100%",...t?{display:"flex",flexDirection:"column"}:void 0}),Yk={position:Mf(),top:0,width:"100%",zIndex:1};function nn(t,a){if(typeof t!="string")return{context:a}}function Kk(t,a){return{item:typeof t=="string"?void 0:a}}const Xk=Ne.memo(function(){const t=$e("HeaderComponent"),a=Pn("headerHeight"),s=$e("HeaderFooterTag"),o=Va(Ne.useMemo(()=>u=>{a(sa(u,"height"))},[a]),!0,$e("skipAnimationFrameInResizeObserver")),c=$e("context");return t!=null?r.jsx(s,{ref:o,children:r.jsx(t,{...nn(t,c)})}):null}),Qk=Ne.memo(function(){const t=$e("FooterComponent"),a=Pn("footerHeight"),s=$e("HeaderFooterTag"),o=Va(Ne.useMemo(()=>u=>{a(sa(u,"height"))},[a]),!0,$e("skipAnimationFrameInResizeObserver")),c=$e("context");return t!=null?r.jsx(s,{ref:o,children:r.jsx(t,{...nn(t,c)})}):null});function vy({useEmitter:t,useEmitterValue:a,usePublisher:s}){return Ne.memo(function({children:o,style:c,context:u,...d}){const h=s("scrollContainerState"),g=a("ScrollerComponent"),m=s("smoothScrollTargetReached"),y=a("scrollerRef"),v=a("horizontalDirection")||!1,{scrollByCallback:b,scrollerRef:S,scrollToCallback:k}=xy(h,m,g,y,void 0,v);return t("scrollTo",k),t("scrollBy",b),r.jsx(g,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:S,style:{...v?qk:Wk,...c},tabIndex:0,...d,...nn(g,u),children:o})})}function yy({useEmitter:t,useEmitterValue:a,usePublisher:s}){return Ne.memo(function({children:o,style:c,context:u,...d}){const h=s("windowScrollContainerState"),g=a("ScrollerComponent"),m=s("smoothScrollTargetReached"),y=a("totalListHeight"),v=a("deviation"),b=a("customScrollParent"),S=Ne.useRef(null),k=a("scrollerRef"),{scrollByCallback:w,scrollerRef:C,scrollToCallback:T}=xy(h,m,g,k,b);return hy(()=>{var N;return C.current=b||((N=S.current)==null?void 0:N.ownerDocument.defaultView),()=>{C.current=null}},[C,b]),t("windowScrollTo",T),t("scrollBy",w),r.jsx(g,{ref:S,"data-virtuoso-scroller":!0,style:{position:"relative",...c,...y!==0?{height:y+v}:void 0},...d,...nn(g,u),children:o})})}const Zk=({children:t})=>{const a=Ne.useContext(py),s=Pn("viewportHeight"),o=Pn("fixedItemHeight"),c=$e("alignToBottom"),u=$e("horizontalDirection"),d=Ne.useMemo(()=>Fv(s,g=>sa(g,u?"width":"height")),[s,u]),h=Va(d,!0,$e("skipAnimationFrameInResizeObserver"));return Ne.useEffect(()=>{a&&(s(a.viewportHeight),o(a.itemHeight))},[a,s,o]),r.jsx("div",{"data-viewport-type":"element",ref:h,style:Qo(c),children:t})},Jk=({children:t})=>{const a=Ne.useContext(py),s=Pn("windowViewportRect"),o=Pn("fixedItemHeight"),c=$e("customScrollParent"),u=Wv(s,c,$e("skipAnimationFrameInResizeObserver")),d=$e("alignToBottom");return Ne.useEffect(()=>{a&&(o(a.itemHeight),s({listHeight:0,offsetTop:0,visibleHeight:a.viewportHeight,visibleWidth:100}))},[a,s,o]),r.jsx("div",{"data-viewport-type":"window",ref:u,style:Qo(d),children:t})},ew=({children:t})=>{const a=$e("TopItemListComponent")??"div",s=$e("headerHeight"),o={...Yk,marginTop:`${s}px`},c=$e("context");return r.jsx(a,{style:o,...nn(a,c),children:t})},tw=Ne.memo(function(t){const a=$e("useWindowScroll"),s=$e("topItemsIndexes").length>0,o=$e("customScrollParent"),c=$e("context");return r.jsxs(o||a?aw:rw,{...t,context:c,children:[s&&r.jsx(ew,{children:r.jsx(wg,{showTopList:!0})}),r.jsxs(o||a?Jk:Zk,{children:[r.jsx(Xk,{}),r.jsx(wg,{}),r.jsx(Qk,{})]})]})}),{Component:nw,useEmitter:zf,useEmitterValue:$e,usePublisher:Pn}=fy(Vk,{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"}},tw),rw=vy({useEmitter:zf,useEmitterValue:$e,usePublisher:Pn}),aw=yy({useEmitter:zf,useEmitterValue:$e,usePublisher:Pn}),lw=nw,sw=tt(()=>{const t=ge(m=>r.jsxs("td",{children:["Item $",m]})),a=ge(null),s=ge(m=>r.jsxs("td",{colSpan:1e3,children:["Group ",m]})),o=ge(null),c=ge(null),u=ge({}),d=ge(Lf),h=ge(Il),g=(m,y=null)=>rn(me(u,ke(v=>v[m]),bt()),y);return{components:u,computeItemKey:d,context:a,EmptyPlaceholder:g("EmptyPlaceholder"),FillerRow:g("FillerRow"),fixedFooterContent:c,fixedHeaderContent:o,itemContent:t,groupContent:s,ScrollerComponent:g("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:g("ScrollSeekPlaceholder"),TableBodyComponent:g("TableBody","tbody"),TableComponent:g("Table","table"),TableFooterComponent:g("TableFoot","tfoot"),TableHeadComponent:g("TableHead","thead"),TableRowComponent:g("TableRow","tr"),GroupComponent:g("Group","tr")}});jt(dy,sw);Mf();const Cg={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},iw={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Eg,floor:Io,max:$s,min:Rd,round:Ng}=Math;function Tg(t,a,s){return Array.from({length:a-t+1}).map((o,c)=>({data:s===null?null:s[c+t],index:c+t}))}function ow(t){return{...iw,items:t}}function bo(t,a){return t!==void 0&&t.width===a.width&&t.height===a.height}function cw(t,a){return t!==void 0&&t.column===a.column&&t.row===a.row}const uw=tt(([{increaseViewportBy:t,listBoundary:a,overscan:s,visibleRange:o},{footerHeight:c,headerHeight:u,scrollBy:d,scrollContainerState:h,scrollTo:g,scrollTop:m,smoothScrollTargetReached:y,viewportHeight:v},b,S,{didMount:k,propsReady:w},{customScrollParent:C,useWindowScroll:T,windowScrollContainerState:N,windowScrollTo:A,windowViewportRect:_},D])=>{const F=ge(0),E=ge(0),B=ge(Cg),L=ge({height:0,width:0}),U=ge({height:0,width:0}),$=Ze(),q=Ze(),X=ge(0),ee=ge(null),I=ge({column:0,row:0}),z=Ze(),O=Ze(),P=ge(!1),H=ge(0),ae=ge(!0),M=ge(!1),Y=ge(!1);at(me(k,Ge(H),_e(([ce,je])=>je!==0)),()=>{Fe(ae,!1)}),at(me(It(k,ae,U,L,H,M),_e(([ce,je,Re,Oe,,le])=>ce&&!je&&Re.height!==0&&Oe.height!==0&&!le)),([,,,,ce])=>{Fe(M,!0),Nf(1,()=>{Fe($,ce)}),Qn(me(m),()=>{Fe(a,[0,0]),Fe(ae,!0)})}),Te(me(O,_e(ce=>ce!=null&&ce.scrollTop>0),or(0)),E),at(me(k,Ge(O),_e(([,ce])=>ce!=null)),([,ce])=>{ce&&(Fe(L,ce.viewport),Fe(U,ce.item),Fe(I,ce.gap),ce.scrollTop>0&&(Fe(P,!0),Qn(me(m,Ua(1)),je=>{Fe(P,!1)}),Fe(g,{top:ce.scrollTop})))}),Te(me(L,ke(({height:ce})=>ce)),v),Te(me(It(De(L,bo),De(U,bo),De(I,(ce,je)=>ce!==void 0&&ce.column===je.column&&ce.row===je.row),De(m)),ke(([ce,je,Re,Oe])=>({gap:Re,item:je,scrollTop:Oe,viewport:ce}))),z),Te(me(It(De(F),o,De(I,cw),De(U,bo),De(L,bo),De(ee),De(E),De(P),De(ae),De(H)),_e(([,,,,,,,ce])=>!ce),ke(([ce,[je,Re],Oe,le,he,pe,xe,,be,Be])=>{const{column:Ue,row:lt}=Oe,{height:Ct,width:gt}=le,{width:Tt}=he;if(xe===0&&(ce===0||Tt===0))return Cg;if(gt===0){const An=Tf(Be,ce),Et=An+Math.max(xe-1,0);return ow(Tg(An,Et,pe))}const Gt=by(Tt,gt,Ue);let We,nt;be?je===0&&Re===0&&xe>0?(We=0,nt=xe-1):(We=Gt*Io((je+lt)/(Ct+lt)),nt=Gt*Eg((Re+lt)/(Ct+lt))-1,nt=Rd(ce-1,$s(nt,Gt-1)),We=Rd(nt,$s(0,We))):(We=0,nt=-1);const xn=Tg(We,nt,pe),{bottom:ye,top:ot}=Rg(he,Oe,le,xn),Wt=Eg(ce/Gt),Kt=Wt*Ct+(Wt-1)*lt-ye;return{bottom:ye,itemHeight:Ct,items:xn,itemWidth:gt,offsetBottom:Kt,offsetTop:ot,top:ot}})),B),Te(me(ee,_e(ce=>ce!==null),ke(ce=>ce.length)),F),Te(me(It(L,U,B,I),_e(([ce,je,{items:Re}])=>Re.length>0&&je.height!==0&&ce.height!==0),ke(([ce,je,{items:Re},Oe])=>{const{bottom:le,top:he}=Rg(ce,Oe,je,Re);return[he,le]}),bt(Ws)),a);const W=ge(!1);Te(me(m,Ge(W),ke(([ce,je])=>je||ce!==0)),W);const Q=Nn(me(It(B,F),_e(([{items:ce}])=>ce.length>0),Ge(W),_e(([[ce,je],Re])=>{const Oe=ce.items[ce.items.length-1].index===je-1;return(Re||ce.bottom>0&&ce.itemHeight>0&&ce.offsetBottom===0&&ce.items.length===je)&&Oe}),ke(([[,ce]])=>ce-1),bt())),oe=Nn(me(De(B),_e(({items:ce})=>ce.length>0&&ce[0].index===0),or(0),bt())),de=Nn(me(De(B),Ge(P),_e(([{items:ce},je])=>ce.length>0&&!je),ke(([{items:ce}])=>({endIndex:ce[ce.length-1].index,startIndex:ce[0].index})),bt(Zv),Ar(0)));Te(de,S.scrollSeekRangeChanged),Te(me($,Ge(L,U,F,I),ke(([ce,je,Re,Oe,le])=>{const he=ry(ce),{align:pe,behavior:xe,offset:be}=he;let Be=he.index;Be==="LAST"&&(Be=Oe-1),Be=$s(0,Be,Rd(Oe-1,Be));let Ue=sf(je,le,Re,Be);return pe==="end"?Ue=Ng(Ue-je.height+Re.height):pe==="center"&&(Ue=Ng(Ue-je.height/2+Re.height/2)),be!==void 0&&be!==0&&(Ue+=be),{behavior:xe,top:Ue}})),g);const ve=rn(me(B,ke(ce=>ce.offsetBottom+ce.bottom)),0);return Te(me(_,ke(ce=>({height:ce.visibleHeight,width:ce.visibleWidth}))),L),{customScrollParent:C,data:ee,deviation:X,footerHeight:c,gap:I,headerHeight:u,increaseViewportBy:t,initialItemCount:E,itemDimensions:U,overscan:s,restoreStateFrom:O,scrollBy:d,scrollContainerState:h,scrollHeight:q,scrollTo:g,scrollToIndex:$,scrollTop:m,smoothScrollTargetReached:y,totalCount:F,useWindowScroll:T,viewportDimensions:L,windowScrollContainerState:N,windowScrollTo:A,windowViewportRect:_,...S,gridState:B,horizontalDirection:Y,initialTopMostItemIndex:H,totalListHeight:ve,...b,endReached:Q,propsReady:w,rangeChanged:de,startReached:oe,stateChanged:z,stateRestoreInProgress:P,...D}},jt(Rf,cn,ni,cy,ua,Af,ca));function by(t,a,s){return $s(1,Io((t+s)/(Io(a)+s)))}function Rg(t,a,s,o){const{height:c}=s;if(c===void 0||o.length===0)return{bottom:0,top:0};const u=sf(t,a,s,o[0].index);return{bottom:sf(t,a,s,o[o.length-1].index)+c,top:u}}function sf(t,a,s,o){const c=by(t.width,s.width,a.column),u=Io(o/c),d=u*s.height+$s(0,u-1)*a.row;return d>0?d+a.row:d}const dw=tt(()=>{const t=ge(v=>`Item ${v}`),a=ge({}),s=ge(null),o=ge("virtuoso-grid-item"),c=ge("virtuoso-grid-list"),u=ge(Lf),d=ge("div"),h=ge(Il),g=(v,b=null)=>rn(me(a,ke(S=>S[v]),bt()),b),m=ge(!1),y=ge(!1);return Te(De(y),m),{components:a,computeItemKey:u,context:s,FooterComponent:g("Footer"),HeaderComponent:g("Header"),headerFooterTag:d,itemClassName:o,ItemComponent:g("Item","div"),itemContent:t,listClassName:c,ListComponent:g("List","div"),readyStateChanged:m,reportReadyState:y,ScrollerComponent:g("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:g("ScrollSeekPlaceholder","div")}}),fw=tt(([t,a])=>({...t,...a}),jt(uw,dw)),pw=Ne.memo(function(){const t=kt("gridState"),a=kt("listClassName"),s=kt("itemClassName"),o=kt("itemContent"),c=kt("computeItemKey"),u=kt("isSeeking"),d=Fn("scrollHeight"),h=kt("ItemComponent"),g=kt("ListComponent"),m=kt("ScrollSeekPlaceholder"),y=kt("context"),v=Fn("itemDimensions"),b=Fn("gap"),S=kt("log"),k=kt("stateRestoreInProgress"),w=Fn("reportReadyState"),C=Va(Ne.useMemo(()=>T=>{const N=T.parentElement.parentElement.scrollHeight;d(N);const A=T.firstChild;if(A!==null){const{height:_,width:D}=A.getBoundingClientRect();v({height:_,width:D})}b({column:Ag("column-gap",getComputedStyle(T).columnGap,S),row:Ag("row-gap",getComputedStyle(T).rowGap,S)})},[d,v,b,S]),!0,!1);return hy(()=>{t.itemHeight>0&&t.itemWidth>0&&w(!0)},[t]),k?null:r.jsx(g,{className:a,ref:C,...nn(g,y),"data-testid":"virtuoso-item-list",style:{paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},children:t.items.map(T=>{const N=c(T.index,T.data,y);return u?r.jsx(m,{...nn(m,y),height:t.itemHeight,index:T.index,width:t.itemWidth},N):p.createElement(h,{...nn(h,y),className:s,"data-index":T.index,key:N},o(T.index,T.data,y))})})}),mw=Ne.memo(function(){const t=kt("HeaderComponent"),a=Fn("headerHeight"),s=kt("headerFooterTag"),o=Va(Ne.useMemo(()=>u=>{a(sa(u,"height"))},[a]),!0,!1),c=kt("context");return t!=null?r.jsx(s,{ref:o,children:r.jsx(t,{...nn(t,c)})}):null}),hw=Ne.memo(function(){const t=kt("FooterComponent"),a=Fn("footerHeight"),s=kt("headerFooterTag"),o=Va(Ne.useMemo(()=>u=>{a(sa(u,"height"))},[a]),!0,!1),c=kt("context");return t!=null?r.jsx(s,{ref:o,children:r.jsx(t,{...nn(t,c)})}):null}),xw=({children:t})=>{const a=Ne.useContext(my),s=Fn("itemDimensions"),o=Fn("viewportDimensions"),c=Va(Ne.useMemo(()=>u=>{o(u.getBoundingClientRect())},[o]),!0,!1);return Ne.useEffect(()=>{a&&(o({height:a.viewportHeight,width:a.viewportWidth}),s({height:a.itemHeight,width:a.itemWidth}))},[a,o,s]),r.jsx("div",{ref:c,style:Qo(!1),children:t})},gw=({children:t})=>{const a=Ne.useContext(my),s=Fn("windowViewportRect"),o=Fn("itemDimensions"),c=kt("customScrollParent"),u=Wv(s,c,!1);return Ne.useEffect(()=>{a&&(o({height:a.itemHeight,width:a.itemWidth}),s({listHeight:0,offsetTop:0,visibleHeight:a.viewportHeight,visibleWidth:a.viewportWidth}))},[a,s,o]),r.jsx("div",{ref:u,style:Qo(!1),children:t})},vw=Ne.memo(function({...t}){const a=kt("useWindowScroll"),s=kt("customScrollParent"),o=s||a?bw:yw,c=s||a?gw:xw,u=kt("context");return r.jsx(o,{...t,...nn(o,u),children:r.jsxs(c,{children:[r.jsx(mw,{}),r.jsx(pw,{}),r.jsx(hw,{})]})})}),{useEmitter:jy,useEmitterValue:kt,usePublisher:Fn}=fy(fw,{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"}},vw),yw=vy({useEmitter:jy,useEmitterValue:kt,usePublisher:Fn}),bw=yy({useEmitter:jy,useEmitterValue:kt,usePublisher:Fn});function Ag(t,a,s){return a!=="normal"&&(a==null?void 0:a.endsWith("px"))!==!0&&s(`${t} was not resolved to pixel value correctly`,a,Pt.WARN),a==="normal"?0:parseInt(a??"0",10)}const jw={source:"vskill-sidebar-own-collapsed",installed:"vskill-sidebar-installed-collapsed"},Sy={source:"Own",installed:"Installed"};function Sw(t){try{const a=localStorage.getItem(t);if(a!=null)return a==="true"}catch{}try{if(typeof sessionStorage<"u"){const a=sessionStorage.getItem(t);if(a!=null)return a==="true"}}catch{}return!1}function kw(t,a){const s=a?"true":"false";try{localStorage.setItem(t,s)}catch{}try{typeof sessionStorage<"u"&&sessionStorage.setItem(t,s)}catch{}}function Mg({origin:t,count:a,filteredCount:s,updateCount:o,children:c}){const u=jw[t],[d,h]=p.useState(()=>Sw(u)),g=p.useCallback(()=>{h(b=>{const S=!b;return kw(u,S),S})},[u]),m=Sy[t],y=`sidebar-section-${t}-header`,v=`sidebar-section-${t}-group`;return r.jsxs("section",{"aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:[r.jsxs("button",{id:y,type:"button","data-testid":"sidebar-section-header","aria-expanded":!d,"aria-controls":v,onClick:g,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 12px 6px 14px",background:"transparent",border:"none",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",textAlign:"left"},children:[r.jsx(Cw,{collapsed:d}),r.jsx("h2",{"aria-level":2,style:{fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)",margin:0},children:m}),r.jsx("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:s!=null&&s!==a?`(${s} of ${a})`:`(${a})`}),o!=null&&o>0&&r.jsx(ww,{origin:t,updateCount:o})]}),!d&&r.jsx("div",{id:v,role:"group","aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:c})]})}function ww({origin:t,updateCount:a}){const[s,o]=p.useState(!1),c=Sy[t].toLowerCase(),u=`${a} updates available in ${c} section, view all`;return r.jsxs("span",{role:"link",tabIndex:0,"data-testid":"sidebar-section-update-chip","aria-label":u,onClick:d=>{d.stopPropagation(),window.location.hash="#/updates"},onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),d.stopPropagation(),window.location.hash="#/updates")},onFocus:()=>o(!0),onBlur:()=>o(!1),style:{display:"inline-flex",alignItems:"center",gap:2,fontSize:10,color:"var(--color-own)",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",cursor:"pointer",padding:"0 4px",borderRadius:3,outline:s?"2px solid var(--border-focus)":"none",outlineOffset:2},children:[a," updates",r.jsx("span",{"aria-hidden":"true",style:{fontSize:9,marginLeft:2},children:"▾"})]})}function Cw({collapsed:t}){return r.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:t?"rotate(0deg)":"rotate(90deg)",transition:"transform var(--duration-fast, 120ms) var(--ease-standard, ease)",flexShrink:0},children:r.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Df(t,a){const s=a.trim().toLowerCase();return s?t.skill.toLowerCase().includes(s)||t.plugin.toLowerCase().includes(s)||t.dir.toLowerCase().includes(s):!0}function Ew({value:t,onChange:a,placeholder:s="Filter skills…",validationPattern:o,validationMessage:c="Invalid filter expression"}){const u=p.useRef(null),d=p.useId(),h=!!o&&t.trim()!==""&&!o.test(t);return p.useEffect(()=>{function g(m){var b;if(m.key!=="/")return;const y=m.target;if(!y)return;const v=y.tagName;v==="INPUT"||v==="TEXTAREA"||y.isContentEditable||(m.preventDefault(),(b=u.current)==null||b.focus())}return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[]),r.jsxs("div",{role:"search",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",borderBottom:"1px solid var(--border-default)"},children:[r.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:[r.jsx("circle",{cx:"11",cy:"11",r:"8"}),r.jsx("path",{d:"M21 21l-4.35-4.35"})]}),r.jsx("input",{ref:u,type:"search","aria-label":"Filter skills","aria-invalid":h?!0:void 0,"aria-describedby":h?d:void 0,value:t,placeholder:s,onChange:g=>a(g.currentTarget.value),onKeyDown:g=>{g.key==="Escape"&&(a(""),g.currentTarget.blur())},style:{flex:1,minWidth:0,border:"none",outline:"none",background:"transparent",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:12,padding:"2px 0"}}),h&&r.jsx("span",{id:d,role:"alert","aria-live":"polite",style:{fontFamily:"var(--font-sans)",fontSize:10,color:"var(--text-error, #B42318)",marginLeft:4,whiteSpace:"nowrap"},children:c}),r.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:t?"none":"inline-block"},children:"/"})]})}function Nw({target:t}){const a=typeof t=="string"&&t.length>0,s=a?`symlinked → ${t}`:"symlinked — cycle detected or target unresolved",o=a?`symlinked from ${t}`:"symlinked, target unresolved";return r.jsx("span",{"data-testid":"symlink-chip",role:"img","aria-label":o,title:s,tabIndex:0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:14,height:14,borderRadius:3,color:"var(--text-secondary)",flexShrink:0},children:r.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:[r.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"}),r.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 Tw({skill:t}){if(!t.updateAvailable)return null;const a=t.currentVersion??"",s=t.latestVersion,o=s?`Update available: ${a} → ${s}`.trim():"Update available";return r.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:r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M12 19V5"}),r.jsx("path",{d:"M5 12l7-7 7 7"})]})})}function Rw({skillId:t,trackedForUpdates:a}){let s=null;try{s=p.useContext(zv)}catch{s=null}const o=s==null?void 0:s.updatesById.get(t);if(o){const c=`Update available → ${o.version}${o.diffSummary?` — ${o.diffSummary}`:""}`;return r.jsx("span",{"data-testid":"update-chip-update-dot","aria-label":`Update available: ${o.version}`,title:c,style:{display:"inline-block",width:8,height:8,borderRadius:999,background:"var(--color-accent, #2563eb)",flexShrink:0}})}return a?null:r.jsx("span",{"data-testid":"update-chip-untracked-dot","aria-label":"Not tracked for updates",title:"Not tracked — run `vskill outdated` manually",style:{display:"inline-block",width:6,height:6,borderRadius:999,background:"var(--text-muted, var(--text-secondary))",opacity:.55,flexShrink:0}})}function Aw(t,a,s){if(!(!t||t==="frontmatter"))return t==="plugin"?`Inherited from ${s&&s.trim()!==""?s:"plugin"} plugin v${a}`:t==="registry"?"Inherited from registry":"No version declared"}function ri(t){const{version:a,showPrefix:s=!0,size:o="md",source:c,pluginName:u}=t,d=typeof a=="string"?a.trim():"",h=d===""||d==="0.0.0"?"1.0.0":d,g=s&&!h.startsWith("v")?`v${h}`:h,m=o==="sm"?10:12,y=o==="sm"?1:2,v=o==="sm"?5:8,b=c!==void 0&&c!=="frontmatter",S=Aw(c,h,u),k=t.title??S,w={display:"inline-flex",alignItems:"center",padding:`${y}px ${v}px`,border:"1px solid var(--border, var(--border-default))",borderRadius:4,background:"var(--bg-subtle, var(--surface-1, transparent))",color:"var(--text-secondary)",fontFamily:"var(--font-mono, var(--font-geist-mono))",fontSize:m,fontVariantNumeric:"tabular-nums",lineHeight:1.2,whiteSpace:"nowrap",flexShrink:0};return b&&(w.fontStyle="italic"),r.jsx("span",{"data-testid":t["data-testid"]??"version-badge","data-version":h,"data-version-source":c,title:k,style:w,children:g})}function Mw({skill:t,isSelected:a,onSelect:s,onContextMenu:o}){const c=t.origin==="installed"?"var(--status-installed)":"var(--status-own)";return r.jsxs("button",{type:"button",onClick:s,onContextMenu:o?u=>{u.preventDefault(),o(u,t)}:void 0,"aria-current":a?"true":void 0,"aria-selected":!!a,"data-testid":"skill-row","data-selected":a,"data-origin":t.origin,"data-skill-id":`${t.plugin}/${t.skill}`,style:{display:"flex",alignItems:"center",gap:8,width:"100%",height:36,padding:"0 12px 0 14px",background:a?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",boxShadow:a?"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:[r.jsx("span",{"aria-hidden":"true","aria-label":t.updateAvailable?"Update available":void 0,title:t.updateAvailable?`Update available${t.latestVersion?` → ${t.latestVersion}`:""}`:void 0,style:{width:t.updateAvailable?10:6,height:t.updateAvailable?10:6,borderRadius:"50%",background:c,display:"inline-block",flexShrink:0,boxShadow:t.updateAvailable?"0 0 0 2px var(--color-own, #d97706)":"none",transition:"box-shadow 180ms ease, width 180ms ease, height 180ms ease"}}),r.jsx("span",{title:t.skill,style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.skill}),r.jsx(ri,{version:t.resolvedVersion??t.version??"1.0.0",source:t.versionSource??(t.version?"frontmatter":"default"),pluginName:t.pluginName??null,size:"sm",showPrefix:!1,"data-testid":"skill-row-version"}),t.isSymlink&&r.jsx(Nw,{target:t.symlinkTarget??null}),r.jsx(Tw,{skill:t}),r.jsx(Rw,{skillId:`${t.plugin}/${t.skill}`,trackedForUpdates:t.trackedForUpdates??!0})]})}const Uo=p.memo(Mw);function Lw({plugin:t,skills:a,selectedKey:s,onSelect:o,onContextMenu:c}){const u=[...a].sort((d,h)=>d.skill.localeCompare(h.skill));return r.jsxs("div",{role:"group","aria-label":`${t} (${a.length})`,children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[r.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:t,children:t}),r.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",a.length,")"]})]}),r.jsx("div",{role:"list",children:u.map(d=>{const h=!!s&&s.plugin===d.plugin&&s.skill===d.skill;return r.jsx("div",{role:"listitem",children:r.jsx(Uo,{skill:d,isSelected:h,onSelect:()=>o(d),onContextMenu:c})},`${d.plugin}/${d.skill}`)})})]})}function zw(t,a){if(!t||typeof window>"u")return a;try{const s=window.localStorage.getItem(t);return s===null?a:s==="true"}catch{return a}}function Lg({skills:t,pluginName:a,initialCollapsed:s=!1,persistKey:o,renderSkill:c,headerActionSlot:u,forceOpen:d=!1}){var S;const h=a??((S=t[0])==null?void 0:S.pluginName)??"unknown-plugin",[g,m]=p.useState(()=>zw(o,s)),y=d?!1:g,v=p.useCallback(()=>{m(k=>{const w=!k;if(o&&typeof window<"u")try{window.localStorage.setItem(o,String(w))}catch{}return w})},[o]),b=y?"▸":"▾";return r.jsxs("div",{"data-vskill-plugin-tree":h,role:"group","aria-label":`${h} (${t.length})`,children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",paddingRight:6},children:[r.jsxs("button",{type:"button",onClick:v,"aria-expanded":!y,style:{display:"flex",alignItems:"center",gap:6,flex:1,padding:"4px 4px 4px 18px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",color:"var(--text-primary)",fontSize:12,fontWeight:500},children:[r.jsx("span",{"aria-hidden":!0,className:"vskill-chevron tabular-nums",style:{width:16,display:"inline-block",textAlign:"center",fontSize:14,fontWeight:700,color:"var(--color-ink, var(--text-primary))"},children:b}),r.jsx("span",{className:"vskill-plugin-name",style:{fontFamily:"var(--font-mono)"},children:h}),r.jsxs("span",{className:"vskill-plugin-count tabular-nums",style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:["(",t.length,")"]})]}),u&&r.jsx("div",{style:{display:"inline-flex",alignItems:"center",flexShrink:0},children:u})]}),!y&&r.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:t.map(k=>r.jsx("div",{"data-vskill-plugin-skill":k.pluginNamespace??k.skill,children:c(k)},`${k.pluginNamespace??k.skill}`))})]})}function ky({open:t,title:a,body:s,confirmLabel:o="Confirm",cancelLabel:c="Cancel",variant:u="default",onConfirm:d,onCancel:h}){const g=p.useRef(null),m=p.useRef(null),y=p.useRef(null);if(p.useEffect(()=>{if(t)return y.current=document.activeElement??null,requestAnimationFrame(()=>{var k;(k=m.current)==null||k.focus()}),()=>{var k,w;(w=(k=y.current)==null?void 0:k.focus)==null||w.call(k),y.current=null}},[t]),p.useEffect(()=>{if(!t)return;function k(w){if(w.key==="Escape"){w.preventDefault(),h();return}if(w.key==="Tab"&&g.current){const C=g.current.querySelectorAll("button:not([disabled])");if(C.length===0)return;const T=C[0],N=C[C.length-1];w.shiftKey&&document.activeElement===T?(w.preventDefault(),N.focus()):!w.shiftKey&&document.activeElement===N&&(w.preventDefault(),T.focus())}}return window.addEventListener("keydown",k,!0),()=>window.removeEventListener("keydown",k,!0)},[t,h]),!t)return null;const v="confirm-dialog-title",b="confirm-dialog-body",S=u==="destructive"?{background:"var(--red, #d92d20)",color:"#fff",border:"1px solid var(--red, #d92d20)"}:{background:"var(--accent-surface)",color:"var(--text-primary)",border:"1px solid var(--border-default)"};return r.jsx("div",{"data-testid":"confirm-dialog-overlay",onMouseDown:k=>{k.target===k.currentTarget&&h()},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},children:r.jsxs("div",{ref:g,role:"alertdialog","aria-modal":"true","aria-labelledby":v,"aria-describedby":b,"data-testid":"confirm-dialog",style:{background:"var(--bg-canvas)",color:"var(--text-primary)",border:"1px solid var(--border-default)",borderRadius:8,padding:20,width:"min(440px, 92vw)",boxShadow:"0 20px 48px rgba(0,0,0,0.32)",fontFamily:"var(--font-sans)"},children:[r.jsx("h2",{id:v,style:{margin:0,fontSize:16,fontWeight:600,marginBottom:8},children:a}),r.jsx("p",{id:b,style:{margin:0,fontSize:13,color:"var(--text-secondary)",marginBottom:16,lineHeight:1.5},children:s}),r.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:[r.jsx("button",{ref:m,type:"button","data-testid":"confirm-dialog-cancel",onClick:h,style:{padding:"6px 14px",borderRadius:6,cursor:"pointer",background:"transparent",color:"var(--text-primary)",border:"1px solid var(--border-default)",fontSize:13},children:c}),r.jsx("button",{type:"button","data-testid":"confirm-dialog-confirm",onClick:d,style:{padding:"6px 14px",borderRadius:6,cursor:"pointer",fontSize:13,...S},children:o})]})]})})}function Dw(t){const a=(typeof navigator<"u"?navigator.platform:"").toLowerCase();return a.includes("mac")?"system Trash":a.includes("win")?"Recycle Bin":"Trash"}function Ad(t,a){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:t,severity:a}}))}function _w({pluginName:t,enabled:a,onAfterAction:s}){const[o,c]=p.useState(!1),[u,d]=p.useState(null),[h,g]=p.useState(null),[m,y]=p.useState(!1),v=p.useRef(null);p.useEffect(()=>{if(!o)return;function k(w){v.current&&!v.current.contains(w.target)&&c(!1)}return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[o]);async function b(k){d(k),g(null);try{const w=await fetch(`/api/plugins/${encodeURIComponent(t)}/${k}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),C=await w.json().catch(()=>({}));if(!w.ok||!C.ok){const T=C.error??`${k} failed (${w.status})`;g(T),k==="uninstall"&&Ad(`Failed to uninstall ${t}: ${T}`,"error");return}if(k==="uninstall"){const T=C.fallback==="orphan-cache-removed"?`Removed orphaned ${t}`:`Uninstalled ${t}`;Ad(T,"success")}En("skills"),Vv(),s==null||s(),c(!1)}catch(w){const C=w instanceof Error?w.message:String(w);g(C),k==="uninstall"&&Ad(`Failed to uninstall ${t}: ${C}`,"error")}finally{d(null)}}function S(){y(!0)}return r.jsxs("div",{ref:v,style:{position:"relative",display:"inline-flex"},children:[r.jsx("button",{type:"button","aria-label":`Manage ${t}`,title:`Manage ${t}`,onClick:k=>{k.stopPropagation(),c(w=>!w)},"data-vskill-plugin-action-trigger":t,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:22,height:22,padding:0,marginLeft:4,border:"none",background:o?"var(--surface-2, rgba(0,0,0,0.08))":"transparent",color:"var(--text-tertiary)",borderRadius:4,cursor:"pointer",fontSize:14,lineHeight:1},onMouseEnter:k=>{k.currentTarget.style.color="var(--text-primary)",k.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.06))"},onMouseLeave:k=>{k.currentTarget.style.color="var(--text-tertiary)",k.currentTarget.style.background=o?"var(--surface-2, rgba(0,0,0,0.08))":"transparent"},children:"⋯"}),o&&r.jsxs("div",{role:"menu",style:{position:"absolute",top:"calc(100% + 2px)",right:0,minWidth:160,background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,boxShadow:"0 4px 6px -1px rgba(0,0,0,0.08), 0 8px 14px -4px rgba(0,0,0,0.12)",padding:4,zIndex:30,fontFamily:"var(--font-sans)"},children:[a?r.jsx(Md,{onClick:()=>void b("disable"),disabled:u!==null,busy:u==="disable",label:"Disable",hint:"Keep installed, turn off"}):r.jsx(Md,{onClick:()=>void b("enable"),disabled:u!==null,busy:u==="enable",label:"Enable",hint:"Activate plugin"}),r.jsx(Md,{onClick:S,disabled:u!==null,busy:u==="uninstall",label:"Uninstall",hint:"Remove plugin + skills",danger:!0}),h&&r.jsx("div",{style:{padding:"6px 8px",fontSize:11,color:"var(--color-error, #b91c1c)",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4,marginTop:4,lineHeight:1.4,maxWidth:240,wordBreak:"break-word"},children:h})]}),r.jsx(ky,{open:m,title:`Uninstall ${t}?`,body:`This removes the ${t} plugin and all of its skills. You can reinstall it later from the marketplace.`,confirmLabel:"Uninstall",cancelLabel:"Cancel",variant:"destructive",onCancel:()=>{y(!1),c(!1)},onConfirm:()=>{y(!1),b("uninstall")}})]})}function Md({onClick:t,disabled:a,busy:s,label:o,hint:c,danger:u}){return r.jsxs("button",{type:"button",onClick:d=>{d.stopPropagation(),t()},disabled:a,role:"menuitem",style:{display:"block",width:"100%",padding:"6px 10px",textAlign:"left",border:"none",background:"transparent",borderRadius:4,cursor:a?"not-allowed":"pointer",color:u?"var(--color-error, #b91c1c)":"var(--text-primary)",opacity:a&&!s?.5:1,fontFamily:"inherit"},onMouseEnter:d=>{a||(d.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.05))")},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},children:[r.jsx("div",{style:{fontSize:12,fontWeight:500},children:s?`${o}…`:o}),r.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)"},children:c})]})}function zg({name:t,count:a,className:s,variant:o,collapsed:c,onToggle:u,action:d}){const h=o==="authoring"?"var(--color-own, #f59e0b)":"var(--color-accent, #2f6f8f)",g=o==="authoring"?"color-mix(in oklch, var(--color-own, #f59e0b) 10%, var(--color-paper, #fff))":"color-mix(in oklch, var(--color-accent, #2f6f8f) 8%, var(--color-paper, #fff))",m=typeof u=="function",y={position:"sticky",top:0,zIndex:4,backdropFilter:"saturate(1.4) blur(10px)",WebkitBackdropFilter:"saturate(1.4) blur(10px)",background:g,borderLeft:`3px solid ${h}`,borderBottom:"1px solid var(--border-subtle, rgba(128,128,128,0.2))",padding:"7px 10px 7px 9px",fontFamily:"var(--font-serif, ui-serif)",fontSize:13,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-primary)",display:"flex",alignItems:"center",gap:8,width:"100%",cursor:m?"pointer":"default",border:"none",textAlign:"left"},v=c?"▸":"▾",b=r.jsxs(r.Fragment,{children:[m&&r.jsx("span",{"aria-hidden":!0,style:{fontSize:15,fontWeight:700,color:h,width:16,display:"inline-block",textAlign:"center",letterSpacing:0,textTransform:"none"},children:v}),r.jsx("span",{className:"vskill-group-header-name",children:t}),r.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:["(",a,")"]}),d&&r.jsx("span",{style:{marginLeft:"auto"},children:r.jsx(Ow,{label:d.label,title:d.title,icon:d.icon,onClick:d.onClick,accent:h})})]});return m?r.jsx("button",{type:"button","data-vskill-group-header":t,className:["vskill-group-header select-none",s??""].join(" ").trim(),style:y,onClick:()=>u(!c),"aria-expanded":!c,children:b}):r.jsx("div",{"data-vskill-group-header":t,role:"heading","aria-level":3,className:["vskill-group-header select-none",s??""].join(" ").trim(),style:y,children:b})}function Ow({label:t,title:a,icon:s,onClick:o,accent:c}){return r.jsxs("button",{type:"button","aria-label":t,title:a??t,onClick:u=>{u.stopPropagation(),o()},style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4,height:22,padding:"0 7px",border:`1px solid ${c}`,background:"transparent",color:c,borderRadius:4,fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",cursor:"pointer",fontFamily:"inherit"},onMouseEnter:u=>{u.currentTarget.style.background=`color-mix(in oklch, ${c} 15%, transparent)`},onMouseLeave:u=>{u.currentTarget.style.background="transparent"},children:[s,t]})}function Bw(){return r.jsxs("div",{"aria-hidden":"true",role:"presentation",style:{display:"flex",alignItems:"center",gap:8,height:36,padding:"0 12px 0 14px"},children:[r.jsx("span",{className:"placeholder",style:{width:6,height:6,borderRadius:"50%",flexShrink:0}}),r.jsx("span",{className:"placeholder",style:{height:10,flex:1,borderRadius:3,maxWidth:180}})]})}function Iw(t){const a=t.key.split("+").map(h=>h.trim()).filter(Boolean);let s=!!t.meta,o=!!t.ctrl,c=!!t.shift,u=!!t.alt,d=t.key;if(a.length>1){for(const h of a.slice(0,-1)){const g=h.toLowerCase();g==="cmd"||g==="meta"||g==="⌘"?s=!0:g==="ctrl"||g==="control"?o=!0:g==="shift"?c=!0:(g==="alt"||g==="option")&&(u=!0)}d=a[a.length-1]}return{key:d.length===1?d.toLowerCase():d,meta:s,ctrl:o,shift:c,alt:u,allowInInputs:!!t.allowInInputs,handler:t.handler}}function Uw(t){if(!t||!(t instanceof HTMLElement))return!1;const a=t.tagName;if(a==="INPUT"||a==="TEXTAREA"||t.isContentEditable)return!0;const s=t.getAttribute("contenteditable");return s!=null&&s!=="false"||t.getAttribute("role")==="textbox"}function Hw(t,a){const s=!!t.metaKey,o=!!t.ctrlKey,c=!!t.shiftKey,u=!!t.altKey;return s!==a.meta||o!==a.ctrl||c!==a.shift||u!==a.alt?!1:(t.key.length===1?t.key.toLowerCase():t.key)===a.key}function of(t,a={}){const{enabled:s=!0,target:o}=a,c=p.useRef([]),u=Array.isArray(t)?t:[t];c.current=u.map(Iw),p.useEffect(()=>{if(!s)return;const d=o??(typeof window<"u"?window:void 0);if(!d)return;function h(g){const m=g,y=Uw(m.target);for(const v of c.current){if(!Hw(m,v))continue;const b=v.meta||v.ctrl||v.alt;if(!(y&&!v.allowInInputs&&!b)){v.handler(m);return}}}return d.addEventListener("keydown",h),()=>{d.removeEventListener("keydown",h)}},[s,o])}const $w=200;function Vw(t){return t.scope==="own"||t.scope==="installed"||t.scope==="global"?t.scope:t.origin==="installed"?"installed":"own"}function Pw(t,a){const s={availableProject:[],availablePersonal:[],availablePlugin:[],authoringProject:[],authoringPlugin:[]};for(const c of t){const u=c.scopeV2??(c.scope==="installed"?"available-project":c.scope==="global"?"available-personal":"authoring-project");u==="available-project"?s.availableProject.push(c):u==="available-personal"?s.availablePersonal.push(c):u==="available-plugin"?s.availablePlugin.push(c):u==="authoring-plugin"?s.authoringPlugin.push(c):s.authoringProject.push(c)}function o(c){const u=c.filter(g=>Df(g,a)),d={};for(const g of u){const m=g.pluginName??g.plugin;(d[m]||(d[m]=[])).push(g)}const h=Object.entries(d).sort((g,m)=>g[0].localeCompare(m[0]));return{total:c.length,filtered:u.length,byPlugin:h}}return{availableProject:o(s.availableProject),availablePersonal:o(s.availablePersonal),availablePlugin:o(s.availablePlugin),authoringProject:o(s.authoringProject),authoringPlugin:o(s.authoringPlugin)}}function Fw(t,a){const s=[],o=[],c=[];for(const d of t){const h=Vw(d);h==="global"?c.push(d):h==="installed"?o.push(d):s.push(d)}function u(d){var y;const h=d.filter(v=>Df(v,a)),g={};for(const v of h)(g[y=v.plugin]||(g[y]=[])).push(v);const m=Object.entries(g).sort((v,b)=>v[0].localeCompare(b[0]));return{total:d.length,filtered:h.length,byPlugin:m}}return{own:u(s),installed:u(o),global:u(c)}}function Gw(t,a){const s=[],o=[];for(const u of t)(u.origin==="installed"?o:s).push(u);function c(u){var m;const d=u.filter(y=>Df(y,a)),h={};for(const y of d)(h[m=y.plugin]||(h[m]=[])).push(y);const g=Object.entries(h).sort((y,v)=>y[0].localeCompare(v[0]));return{total:u.length,filtered:d.length,byPlugin:g}}return{own:c(s),installed:c(o)}}function Ww({skills:t,selectedKey:a,onSelect:s,isLoading:o,error:c,onRetry:u,onContextMenu:d,outdatedByOrigin:h,activeAgentId:g,outdatedByScope:m,topSlot:y,revealSkillId:v,onRevealComplete:b}){const S=!!g||t.some(W=>W.scope!==void 0&&W.scope!==null),k=g??"claude-cli",[w,C]=p.useState(""),T=p.useDeferredValue(w),N=p.useMemo(()=>Fw(t,T),[t,T]),A=p.useMemo(()=>Pw(t,T),[t,T]),_=k==="claude-code",{plugins:D}=K2(),F=_?{plugins:D??[]}:void 0,E=p.useMemo(()=>{const W=new Map;for(const Q of(F==null?void 0:F.plugins)??[]){const oe=W.get(Q.name);W.set(Q.name,!!oe||!!Q.enabled)}return W},[F==null?void 0:F.plugins]),[B,L]=p.useState(()=>cf(`vskill-sidebar-${k}-group-available-collapsed`)),[U,$]=p.useState(()=>cf(`vskill-sidebar-${k}-group-authoring-collapsed`)),q=p.useCallback(W=>{L(W);try{window.localStorage.setItem(`vskill-sidebar-${k}-group-available-collapsed`,String(W))}catch{}},[k]),X=p.useCallback(W=>{$(W);try{window.localStorage.setItem(`vskill-sidebar-${k}-group-authoring-collapsed`,String(W))}catch{}},[k]),{own:ee,installed:I}=p.useMemo(()=>Gw(t,T),[t,T]),O=N.own.filtered+N.installed.filtered+N.global.filtered>=$w,P=p.useMemo(()=>{const W=Q=>{const oe=[];for(const[,de]of Q){const ve=[...de].sort((ce,je)=>ce.skill.localeCompare(je.skill));oe.push(...ve)}return oe};return S?[...W(N.own.byPlugin),...W(N.installed.byPlugin),...W(N.global.byPlugin)]:[...W(ee.byPlugin),...W(I.byPlugin)]},[S,N.own.byPlugin,N.installed.byPlugin,N.global.byPlugin,ee.byPlugin,I.byPlugin]),H=p.useMemo(()=>a?P.findIndex(W=>W.plugin===a.plugin&&W.skill===a.skill):-1,[P,a]),ae=p.useCallback(W=>{if(P.length===0)return;const Q=H<0?W>0?0:P.length-1:Math.min(Math.max(H+W,0),P.length-1);s(P[Q])},[P,H,s]),M=p.useMemo(()=>{if(!v)return null;const[W,Q]=v.split("/");if(!W||!Q)return null;const oe=t.find(ce=>ce.plugin===W&&ce.skill===Q);if(!oe)return{plugin:W,skill:Q,bucket:null,pluginName:null};const de=oe.source==="plugin"?"plugin":"project",ve=de==="plugin"?oe.pluginName??W:null;return{plugin:W,skill:Q,bucket:de,pluginName:ve}},[v,t]),Y=p.useRef(null);return p.useEffect(()=>{if(!v){Y.current=null;return}if(Y.current===v)return;const W=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(v):v.replace(/["\\]/g,"\\$&"),Q=document.querySelector(`[data-skill-id="${W}"]`);Q&&(Y.current=v,Q.scrollIntoView({behavior:"smooth",block:"nearest"}),b==null||b())},[v,b,t]),of([{key:"j",handler:()=>ae(1)},{key:"k",handler:()=>ae(-1)},{key:"Enter",handler:()=>{H>=0&&s(P[H])}}],{enabled:!o&&!c}),r.jsxs("div",{"data-testid":"sidebar",style:{display:"flex",flexDirection:"column",minHeight:0,height:"100%",fontFamily:"var(--font-sans)"},children:[y,r.jsx(Ew,{value:w,onChange:C}),o&&r.jsx(Qw,{}),!o&&c&&r.jsx(Zw,{error:c,onRetry:u}),!o&&!c&&S&&r.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[r.jsx(zg,{name:ne.scopeLabels.groupAvailable.toUpperCase(),variant:"available",collapsed:B,onToggle:q,count:A.availableProject.total+A.availablePersonal.total+A.availablePlugin.total}),!B&&r.jsxs(r.Fragment,{children:[r.jsx(zs,{label:ne.scopeLabels.sourceProject,storageKey:`vskill-sidebar-${k}-available-project-collapsed`,count:A.availableProject.total,filteredCount:w?A.availableProject.filtered:null,updateCount:(m==null?void 0:m.installed)??(h==null?void 0:h.installed),children:A.availableProject.filtered===0?r.jsx(_g,{queryActive:!!w,agentId:k}):r.jsx(Ds,{items:A.availableProject.byPlugin,selectedKey:a,onSelect:s,onContextMenu:d,useVirtual:O})}),r.jsx(zs,{label:ne.scopeLabels.sourcePersonal,storageKey:`vskill-sidebar-${k}-available-personal-collapsed`,count:A.availablePersonal.total,filteredCount:w?A.availablePersonal.filtered:null,updateCount:m==null?void 0:m.global,children:A.availablePersonal.filtered===0?r.jsx(Yw,{queryActive:!!w,agentId:k}):r.jsx(Ds,{items:A.availablePersonal.byPlugin,selectedKey:a,onSelect:s,onContextMenu:d,useVirtual:O})}),_&&r.jsxs(zs,{label:ne.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${k}-available-plugin-collapsed`,count:A.availablePlugin.total,filteredCount:w?A.availablePlugin.filtered:null,children:[r.jsxs("button",{type:"button",onClick:()=>window.dispatchEvent(new CustomEvent("studio:open-marketplace")),style:{display:"flex",alignItems:"center",gap:6,margin:"4px 14px 6px",padding:"4px 8px",fontSize:11,fontWeight:500,border:"1px dashed var(--color-accent, #2f6f8f)",borderRadius:4,background:"transparent",color:"var(--color-accent, #2f6f8f)",cursor:"pointer"},children:[r.jsx("span",{"aria-hidden":!0,children:"🛒"})," Browse marketplaces…"]}),A.availablePlugin.filtered===0?r.jsx("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:"No plugin skills installed yet."}):A.availablePlugin.byPlugin.map(([W,Q])=>r.jsx(Lg,{pluginName:W,skills:Q,persistKey:`vskill-plugin-available-${W}-collapsed`,headerActionSlot:_?r.jsx(_w,{pluginName:W,enabled:E.get(W)??!0}):void 0,renderSkill:oe=>r.jsx(Uo,{skill:oe,isSelected:(a==null?void 0:a.plugin)===oe.plugin&&(a==null?void 0:a.skill)===oe.skill,onSelect:()=>s(oe),onContextMenu:d})},`available-${W}`))]})]}),r.jsx(Xw,{}),r.jsx(zg,{name:ne.scopeLabels.groupAuthoring.toUpperCase(),variant:"authoring",collapsed:M?!1:U,onToggle:X,count:A.authoringProject.total+A.authoringPlugin.total,action:{label:"New",title:"Create a new skill (standalone or plugin)",icon:r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[r.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),r.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),onClick:()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:request-create-skill",{detail:{mode:"standalone"}}))}}}),(!U||M)&&r.jsxs(r.Fragment,{children:[r.jsx(zs,{label:ne.scopeLabels.authoringSkills,storageKey:`vskill-sidebar-${k}-authoring-project-collapsed`,count:A.authoringProject.total,filteredCount:w?A.authoringProject.filtered:null,updateCount:(m==null?void 0:m.own)??(h==null?void 0:h.source),forceOpen:(M==null?void 0:M.bucket)==="project",children:A.authoringProject.filtered===0?r.jsx(Dg,{queryActive:!!w}):r.jsx(Ds,{items:A.authoringProject.byPlugin,selectedKey:a,onSelect:s,onContextMenu:d,useVirtual:O})}),_&&r.jsx(zs,{label:ne.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${k}-authoring-plugin-collapsed`,count:A.authoringPlugin.total,filteredCount:w?A.authoringPlugin.filtered:null,forceOpen:(M==null?void 0:M.bucket)==="plugin",children:A.authoringPlugin.filtered===0?r.jsxs("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:["No plugin sources in this project. Add ",r.jsx("code",{children:"<plugin>/.claude-plugin/plugin.json"}),"."]}):A.authoringPlugin.byPlugin.map(([W,Q])=>r.jsx(Lg,{pluginName:W,skills:Q,persistKey:`vskill-plugin-authoring-${W}-collapsed`,forceOpen:(M==null?void 0:M.bucket)==="plugin"&&M.pluginName===W,renderSkill:oe=>r.jsx(Uo,{skill:oe,isSelected:(a==null?void 0:a.plugin)===oe.plugin&&(a==null?void 0:a.skill)===oe.skill,onSelect:()=>s(oe),onContextMenu:d})},`authoring-${W}`))})]})]}),!o&&!c&&!S&&r.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[r.jsx(Mg,{origin:"source",count:ee.total,filteredCount:w?ee.filtered:null,updateCount:h==null?void 0:h.source,children:ee.filtered===0?r.jsx(Dg,{queryActive:!!w}):r.jsx(Ds,{items:ee.byPlugin,selectedKey:a,onSelect:s,onContextMenu:d,useVirtual:O})}),r.jsx(Kw,{}),r.jsx(Mg,{origin:"installed",count:I.total,filteredCount:w?I.filtered:null,updateCount:h==null?void 0:h.installed,children:I.filtered===0?r.jsx(_g,{queryActive:!!w}):r.jsx(Ds,{items:I.byPlugin,selectedKey:a,onSelect:s,onContextMenu:d,useVirtual:O})})]})]})}function cf(t){if(typeof window>"u")return!1;try{return window.localStorage.getItem(t)==="true"}catch{return!1}}function zs({label:t,storageKey:a,count:s,filteredCount:o,updateCount:c,children:u,forceOpen:d=!1}){const[h,g]=p.useState(()=>cf(a)),m=d?!1:h,y=p.useCallback(()=>{g(b=>{const S=!b;if(typeof window<"u")try{window.localStorage.setItem(a,String(S))}catch{}return S})},[a]),v=o!=null&&o!==s?`${o} of ${s}`:String(s);return r.jsxs("section",{"data-vskill-named-scope":t,children:[r.jsxs("button",{type:"button",onClick:y,"aria-expanded":!m,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:[r.jsx("span",{"aria-hidden":!0,style:{fontSize:14,fontWeight:700,color:"var(--color-ink, var(--text-primary))",width:16,display:"inline-block",textAlign:"center"},children:m?"▸":"▾"}),r.jsx("span",{style:{fontSize:12,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)"},children:t}),r.jsxs("span",{style:{fontSize:11,color:"var(--text-tertiary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",v,")"]}),c!=null&&c>0&&r.jsxs("span",{style:{marginLeft:"auto",fontSize:10,color:"var(--color-own, #f59e0b)"},children:[c," update",c!==1?"s":""]})]}),!m&&r.jsx("div",{style:{paddingLeft:18},children:u})]})}function qw(t){const a=[];for(const[s,o]of t){const c=[...o].sort((u,d)=>u.skill.localeCompare(d.skill));a.push({kind:"header",plugin:s,count:c.length});for(const u of c)a.push({kind:"row",skill:u})}return a}function Ds({items:t,selectedKey:a,onSelect:s,onContextMenu:o,useVirtual:c}){if(c){const u=qw(t);return r.jsx("div",{"data-virtualized":"true",style:{height:420,minHeight:200},children:r.jsx(lw,{overscan:4,totalCount:u.length,itemContent:d=>{const h=u[d];if(!h)return null;if(h.kind==="header")return r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[r.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)"},children:h.plugin}),r.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",h.count,")"]})]});const g=h.skill,m=!!a&&a.plugin===g.plugin&&a.skill===g.skill;return r.jsx(Uo,{skill:g,isSelected:m,onSelect:()=>s(g),onContextMenu:o})}})})}return r.jsx("div",{"data-virtualized":"false",children:t.map(([u,d])=>r.jsx(Lw,{plugin:u,skills:d,selectedKey:a,onSelect:s,onContextMenu:o},u))})}function Dg({queryActive:t}){return t?r.jsx(zl,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):r.jsx(zl,{headline:"No skills yet.",body:r.jsxs(r.Fragment,{children:["Create one with ",r.jsx(_f,{children:"vskill new"})," or the"," ",r.jsx("strong",{style:{color:"var(--text-primary)"},children:"New skill"})," action in the top rail."]})})}function _g({queryActive:t,agentId:a}){return t?r.jsx(zl,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):r.jsx(zl,{headline:a?`No skills installed for ${a} in this project.`:"No installed skills.",body:r.jsxs(r.Fragment,{children:["Run ",r.jsx(_f,{children:"vskill install <skill>"})," to add one."]})})}function Yw({queryActive:t,agentId:a}){return t?r.jsx(zl,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):r.jsx(zl,{headline:`No global skills for ${a}.`,body:r.jsxs(r.Fragment,{children:["Run ",r.jsx(_f,{children:"vskill install --global <skill>"})," to add one."]})})}function zl({headline:t,body:a}){return r.jsxs("div",{style:{padding:"12px 14px 16px",fontSize:12,color:"var(--text-secondary)",lineHeight:1.5},children:[r.jsx("div",{style:{fontWeight:500,color:"var(--text-primary)",marginBottom:4},children:t}),r.jsx("div",{children:a})]})}function _f({children:t}){return r.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:t})}function Kw(){return r.jsx("div",{"aria-hidden":"true",style:{height:1,background:"var(--border-default)",margin:"4px 14px"}})}function Xw(){return r.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 Qw(){return r.jsx("div",{style:{padding:"8px 0"},children:[0,1,2,3,4,5].map(t=>r.jsx(Bw,{},t))})}function Zw({error:t,onRetry:a}){return r.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:[r.jsx("div",{style:{fontWeight:600,marginBottom:4},children:"Couldn't load skills."}),r.jsxs("details",{children:[r.jsx("summary",{style:{cursor:"pointer",color:"var(--text-secondary)",fontSize:11,marginBottom:4},children:Jw(t)}),r.jsx("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",margin:"6px 0 0"},children:t})]}),a&&r.jsx("button",{type:"button",onClick:a,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 Jw(t){const a=t.split(`
|
|
66
|
+
`)[0]??t;return a.length>80?a.slice(0,77)+"…":a}const wy=240,Cy=480,Ey="vskill-sidebar-width",Vs=320;function Of(t){return Number.isFinite(t)?Math.round(Math.max(wy,Math.min(Cy,t))):Vs}function eC(){try{const t=localStorage.getItem(Ey);if(!t)return Vs;const a=Number(t);return Number.isFinite(a)?Of(a):Vs}catch{return Vs}}function tC(t){try{localStorage.setItem(Ey,String(Of(t)))}catch{}}function nC({initialWidth:t,onChange:a}){const s=p.useRef({startX:0,startWidth:t,pointerId:null}),o=p.useRef(t);return p.useEffect(()=>{o.current=t},[t]),p.useEffect(()=>{function c(d){if(s.current.pointerId==null||d.pointerId!==s.current.pointerId)return;const h=d.clientX-s.current.startX,g=Of(s.current.startWidth+h);o.current=g,a(g)}function u(d){s.current.pointerId==null||d.pointerId!==s.current.pointerId||(s.current.pointerId=null,tC(o.current))}return window.addEventListener("pointermove",c),window.addEventListener("pointerup",u),window.addEventListener("pointercancel",u),()=>{window.removeEventListener("pointermove",c),window.removeEventListener("pointerup",u),window.removeEventListener("pointercancel",u)}},[a]),r.jsx("div",{role:"separator","aria-orientation":"vertical","aria-valuemin":wy,"aria-valuemax":Cy,"aria-valuenow":t,"aria-label":"Resize sidebar",title:"Drag to resize sidebar",onPointerDown:c=>{const u=c.currentTarget;s.current.startX=c.clientX,s.current.startWidth=o.current,s.current.pointerId=c.pointerId;try{u.setPointerCapture(c.pointerId)}catch{}},style:{width:4,alignSelf:"stretch",cursor:"col-resize",background:"var(--border-default)",userSelect:"none",touchAction:"none"}})}function rC({connected:t,hint:a,onRetry:s}){return t?null:r.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:[r.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--status-own)",display:"inline-block",flexShrink:0}}),r.jsx("span",{style:{fontWeight:500},children:"Disconnected — reconnecting…"}),a&&r.jsx("span",{style:{color:"var(--text-secondary)",fontSize:11},children:a}),r.jsx("div",{style:{flex:1}}),s&&r.jsx("button",{type:"button",onClick:s,style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"2px 8px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:"Retry now"})]})}function Ny(t,a){if(t!==401||typeof window>"u"||!a||typeof a!="object")return;const s=a;s.error==="invalid_api_key"&&(s.provider!=="anthropic"&&s.provider!=="openai"&&s.provider!=="openrouter"||window.dispatchEvent(new CustomEvent("studio:api-key-error",{detail:{provider:s.provider}})))}function Ty(t){if(t!==void 0)try{return JSON.stringify(t)}catch(a){console.error("Failed to serialize request body:",a);try{const s=new WeakSet;return JSON.stringify(t,(o,c)=>{if(typeof c=="object"&&c!==null){if(s.has(c))return"[Circular]";s.add(c)}return c})}catch{return JSON.stringify({error:"Request body could not be serialized"})}}}function Ld(){const[t,a]=p.useState([]),[s,o]=p.useState(!1),[c,u]=p.useState(!1),[d,h]=p.useState(null),g=p.useRef(null),m=p.useCallback(async(v,b)=>{a([]),o(!0),u(!1),h(null);const S=new AbortController;g.current=S;try{const k=Ty(b),w=await fetch(v,{method:"POST",headers:{"Content-Type":"application/json"},body:k,signal:S.signal});if(!w.ok||!w.body){let _=`HTTP ${w.status}`,D;try{D=await w.json(),D&&typeof D=="object"&&"error"in D&&typeof D.error=="string"&&(_=D.error)}catch{}throw Ny(w.status,D),new Error(_)}const C=w.body.getReader(),T=new TextDecoder;let N="",A="";for(;;){const{done:_,value:D}=await C.read();if(_)break;N+=T.decode(D,{stream:!0});const F=N.split(`
|
|
67
|
+
`);N=F.pop()||"";for(const E of F)if(E.startsWith("event: "))A=E.slice(7).trim();else if(E.startsWith("data: ")){try{const B=JSON.parse(E.slice(6)),L={event:A,data:B};A==="done"?(u(!0),a(U=>[...U,L])):a(U=>[...U,L])}catch{}A=""}}}catch(k){k.name!=="AbortError"&&h(k.message)}finally{o(!1),g.current=null}},[]),y=p.useCallback(()=>{var v;(v=g.current)==null||v.abort()},[]);return{events:t,running:s,done:c,error:d,start:m,stop:y}}function aC(t){const a=p.useRef(t);a.current=t;const[s,o]=p.useState(new Set),c=p.useRef(new Map),u=p.useCallback(async(m,y,v)=>{var S;(S=c.current.get(m))==null||S.abort();const b=new AbortController;c.current.set(m,b),o(k=>{const w=new Set(k);return w.add(m),w});try{const k=Ty(v),w=await fetch(y,{method:"POST",headers:{"Content-Type":"application/json"},body:k,signal:b.signal});if(!w.ok||!w.body){let _=`HTTP ${w.status}`,D;try{D=await w.json(),D&&typeof D=="object"&&"error"in D&&typeof D.error=="string"&&(_=D.error)}catch{}throw Ny(w.status,D),new Error(_)}const C=w.body.getReader(),T=new TextDecoder;let N="",A="";for(;;){const{done:_,value:D}=await C.read();if(_)break;N+=T.decode(D,{stream:!0});const F=N.split(`
|
|
68
|
+
`);N=F.pop()||"";for(const E of F)if(E.startsWith("event: "))A=E.slice(7).trim();else if(E.startsWith("data: ")){try{const B=JSON.parse(E.slice(6)),L={event:A,data:B};a.current.onEvent(m,L)}catch{}A=""}}a.current.onDone(m)}catch(k){k.name!=="AbortError"&&a.current.onError(m,k.message)}finally{o(k=>{const w=new Set(k);return w.delete(m),w}),c.current.delete(m)}},[]),d=p.useCallback(m=>{var y;(y=c.current.get(m))==null||y.abort()},[]),h=p.useCallback(()=>{for(const m of c.current.values())m.abort()},[]),g=s.size>0;return{runningSet:s,startCase:u,stopCase:d,stopAll:h,isAnyCaseRunning:g}}const lC={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 sC(t,a){var s,o;switch(a.type){case"SET_LOADING":return{...t,loading:a.loading};case"SET_ERROR":return{...t,error:a.error};case"INIT_DATA":{const c=new Map;if(a.benchmark)for(const d of a.benchmark.cases)c.set(d.eval_id,{status:d.status,passRate:d.pass_rate,errorMessage:d.error_message||void 0,durationMs:d.durationMs,tokens:d.tokens,output:d.output,assertions:d.assertions.map(h=>({assertion_id:h.id,text:h.text,pass:h.pass,reasoning:h.reasoning}))});const u=((o=(s=a.evals)==null?void 0:s.evals[0])==null?void 0:o.id)??null;return{...t,skillContent:a.skillContent,savedContent:a.skillContent,isDirty:!1,evals:a.evals,evalsError:a.evalsError??null,latestBenchmark:a.benchmark,inlineResults:c,selectedCaseId:u,loading:!1,error:null}}case"SET_PANEL":return{...t,activePanel:a.panel};case"SET_CONTENT":return{...t,skillContent:a.content,isDirty:a.content!==t.savedContent};case"CONTENT_SAVED":return{...t,savedContent:t.skillContent,isDirty:!1};case"SET_EVALS":return{...t,evals:a.evals};case"SELECT_CASE":return{...t,selectedCaseId:a.caseId};case"CASE_RUN_START":{const c=new Map(t.caseRunStates);return c.set(a.caseId,{status:"running",startedAt:Date.now(),mode:a.mode}),{...t,caseRunStates:c,runMode:a.mode,activePanel:"run"}}case"CASE_RUN_COMPLETE":{const c=new Map(t.caseRunStates),u=c.get(a.caseId);c.set(a.caseId,{status:"complete",mode:u==null?void 0:u.mode});const d=new Map(t.inlineResults);return d.set(a.caseId,a.result),{...t,caseRunStates:c,inlineResults:d}}case"CASE_RUN_ERROR":{const c=new Map(t.caseRunStates),u=c.get(a.caseId);c.set(a.caseId,{status:"error",mode:u==null?void 0:u.mode});const d=new Map(t.inlineResults);return d.set(a.caseId,{status:"error",errorMessage:a.error,assertions:[]}),{...t,caseRunStates:c,inlineResults:d}}case"CASE_RUN_CANCEL":{const c=new Map(t.caseRunStates),u=c.get(a.caseId);return c.set(a.caseId,{status:"cancelled",mode:u==null?void 0:u.mode}),{...t,caseRunStates:c}}case"BULK_RUN_START":{const c=new Map(t.caseRunStates);for(const u of a.caseIds)c.set(u,{status:"queued",mode:a.mode});return{...t,caseRunStates:c,bulkRunActive:!0,runMode:a.mode,activePanel:"run"}}case"BULK_RUN_COMPLETE":return{...t,bulkRunActive:!1,latestBenchmark:a.benchmark??t.latestBenchmark,iterationCount:t.iterationCount+1};case"CANCEL_ALL":{const c=new Map(t.caseRunStates);for(const[u,d]of c)(d.status==="running"||d.status==="queued")&&c.set(u,{status:"cancelled"});return{...t,caseRunStates:c,bulkRunActive:!1}}case"UPDATE_INLINE_RESULT":{const c=new Map(t.inlineResults);return c.set(a.evalId,a.result),{...t,inlineResults:c}}case"OPEN_IMPROVE":return{...t,improveTarget:a.evalId,activePanel:"editor"};case"CLOSE_IMPROVE":return{...t,improveTarget:null};case"OPEN_AI_EDIT":return{...t,aiEditOpen:!0,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"CLOSE_AI_EDIT":return{...t,aiEditOpen:!1,aiEditLoading:!1,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"AI_EDIT_LOADING":return{...t,aiEditLoading:!0,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[]};case"AI_EDIT_PROGRESS":return{...t,aiEditProgress:[...t.aiEditProgress,a.entry]};case"AI_EDIT_RESULT":{const c=a.evalChanges??[],u=new Map;for(let d=0;d<c.length;d++)u.set(d,!0);return{...t,aiEditLoading:!1,aiEditResult:{improved:a.improved,reasoning:a.reasoning,evalChanges:c},aiEditEvalChanges:c,aiEditEvalSelections:u}}case"AI_EDIT_ERROR":return{...t,aiEditLoading:!1,aiEditError:a.message,aiEditClassifiedError:a.classified??null};case"GENERATE_EVALS_START":return{...t,generateEvalsLoading:!0,generateEvalsProgress:[],generateEvalsError:null};case"GENERATE_EVALS_PROGRESS":return{...t,generateEvalsProgress:[...t.generateEvalsProgress,a.entry]};case"GENERATE_EVALS_DONE":return{...t,generateEvalsLoading:!1,evals:a.evals};case"GENERATE_EVALS_ERROR":return{...t,generateEvalsLoading:!1,generateEvalsError:a.classified};case"TOGGLE_EVAL_CHANGE":{const c=new Map(t.aiEditEvalSelections);return c.set(a.index,!c.get(a.index)),{...t,aiEditEvalSelections:c}}case"SELECT_ALL_EVAL_CHANGES":{const c=new Map(t.aiEditEvalSelections);for(const u of c.keys())c.set(u,!0);return{...t,aiEditEvalSelections:c}}case"DESELECT_ALL_EVAL_CHANGES":{const c=new Map(t.aiEditEvalSelections);for(const u of c.keys())c.set(u,!1);return{...t,aiEditEvalSelections:c}}case"SET_EVALS_RETRY":return{...t,aiEditEvalsRetry:a.evalsFile};case"SET_REGRESSIONS":return{...t,regressions:a.regressions};case"INCREMENT_ITERATION":return{...t,iterationCount:t.iterationCount+1};case"SET_ACTIVATION_PROMPTS":return{...t,activationPrompts:a.prompts};case"ACTIVATION_START":return{...t,activationRunning:!0,activationResults:[],activationSummary:null,activationError:null,activationClassifyingStatus:null,activationStartedAt:Date.now()};case"ACTIVATION_RESULT":return{...t,activationResults:[...t.activationResults,a.result]};case"ACTIVATION_DONE":return{...t,activationRunning:!1,activationSummary:a.summary,activationClassifyingStatus:null};case"ACTIVATION_CLASSIFYING":return{...t,activationClassifyingStatus:`Classifying prompt ${a.index}/${a.total}...`};case"ACTIVATION_ERROR":return{...t,activationRunning:!1,activationError:a.error,activationClassifyingStatus:null};case"ACTIVATION_RESET":return{...t,activationResults:[],activationSummary:null,activationError:null};case"ACTIVATION_TIMEOUT":return{...t,activationRunning:!1,activationError:"Activation test timed out after 120 seconds"};case"ACTIVATION_CANCEL":return{...t,activationRunning:!1};case"GENERATE_PROMPTS_START":return{...t,generatingPrompts:!0,generatingPromptsError:null};case"GENERATE_PROMPTS_DONE":return{...t,generatingPrompts:!1};case"GENERATE_PROMPTS_ERROR":return{...t,generatingPrompts:!1,generatingPromptsError:a.error};case"ACTIVATION_HISTORY_LOADED":return{...t,activationHistory:a.runs,activationHistoryLoading:!1};default:return t}}function iC(t){if(t==="unit"||t==="integration")return t}function oC(t,a){const s=a.data;if(a.event==="output_ready"&&(t.output=s.output,s.durationMs!=null&&(t.durationMs=s.durationMs),s.tokens!=null&&(t.tokens=s.tokens)),a.event==="outputs_ready"&&(t.output=s.skillOutput,s.skillDurationMs!=null&&(t.durationMs=s.skillDurationMs),s.skillTokens!=null&&(t.tokens=s.skillTokens)),a.event==="assertion_result"){const o={assertion_id:s.assertion_id,text:s.text,pass:s.pass,reasoning:s.reasoning};t.assertions.find(c=>c.assertion_id===o.assertion_id)||t.assertions.push(o)}a.event==="case_complete"&&(t.status=s.status,t.passRate=s.pass_rate,t.errorMessage=s.error_message||void 0,t.classifiedError=s.classified_error||void 0)}const Ry=p.createContext(null);function Rn(){const t=p.useContext(Ry);if(!t)throw new Error("useWorkspace must be used within WorkspaceProvider");return t}function cC({plugin:t,skill:a,origin:s,children:o}){const c=s==="installed",[u,d]=p.useReducer(sC,{...lC,plugin:t,skill:a}),h=p.useRef(new Set),g=p.useRef(new Set),m=p.useRef(new Map),y=p.useCallback((le,he)=>{let pe=m.current.get(le);pe||(pe={assertions:[]},m.current.set(le,pe)),oC(pe,he),d({type:"UPDATE_INLINE_RESULT",evalId:le,result:{...pe,assertions:[...pe.assertions]}})},[]),v=p.useCallback(le=>{if(g.current.has(le))return;g.current.add(le);const he=m.current.get(le)??{assertions:[]};d({type:"CASE_RUN_COMPLETE",caseId:le,result:{...he,assertions:[...he.assertions]}}),h.current.has(le)&&(h.current.delete(le),h.current.size===0&&we.getLatestBenchmark(t,a).then(pe=>d({type:"BULK_RUN_COMPLETE",benchmark:pe})).catch(()=>d({type:"BULK_RUN_COMPLETE",benchmark:null})))},[t,a]),b=p.useCallback((le,he)=>{g.current.has(le)||(g.current.add(le),d({type:"CASE_RUN_ERROR",caseId:le,error:he}),h.current.has(le)&&(h.current.delete(le),h.current.size===0&&we.getLatestBenchmark(t,a).then(pe=>d({type:"BULK_RUN_COMPLETE",benchmark:pe})).catch(()=>d({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[t,a]),{startCase:S,stopCase:k,stopAll:w}=aC({onEvent:y,onDone:v,onError:b});p.useEffect(()=>()=>{w()},[w]);const C=p.useCallback(async()=>{try{const le=await fetch(`/api/skills/${t}/${a}/activation-history`);if(!le.ok){if(le.status===404){d({type:"ACTIVATION_HISTORY_LOADED",runs:[]});return}return}const he=await le.json();d({type:"ACTIVATION_HISTORY_LOADED",runs:he.runs||[]})}catch{}},[t,a]);p.useEffect(()=>{let le=!1;async function he(){try{const[pe,xe,be]=await Promise.allSettled([we.getSkillDetail(t,a),we.getEvals(t,a),we.getLatestBenchmark(t,a)]);if(le)return;let Be=null,Ue=null;if(xe.status==="fulfilled")Be=xe.value;else{const lt=xe.reason;Ue=(lt==null?void 0:lt.message)??"Failed to load test cases"}d({type:"INIT_DATA",skillContent:pe.status==="fulfilled"?pe.value.skillContent:"",evals:Be,evalsError:Ue,benchmark:be.status==="fulfilled"?be.value:null})}catch(pe){le||d({type:"SET_ERROR",error:pe.message})}}return he(),C(),()=>{le=!0}},[t,a,C]);const T=p.useCallback(async()=>{if(!c)try{await we.applyImprovement(t,a,u.skillContent),d({type:"CONTENT_SAVED"})}catch(le){d({type:"SET_ERROR",error:le.message})}},[c,t,a,u.skillContent]),N=p.useCallback(async le=>{if(!c)try{const he=await we.saveEvals(t,a,le);d({type:"SET_EVALS",evals:he})}catch(he){d({type:"SET_ERROR",error:he.message})}},[c,t,a]),A=p.useCallback((le,he="benchmark")=>{if(c)return;const pe=u.caseRunStates.get(le);if((pe==null?void 0:pe.status)!=="running")if(m.current.delete(le),g.current.delete(le),d({type:"CASE_RUN_START",caseId:le,mode:he}),he==="comparison"){const xe=`/api/skills/${t}/${a}/compare`;S(le,xe,{eval_ids:[le]})}else{const xe=`/api/skills/${t}/${a}/benchmark/case/${le}`;S(le,xe,he==="baseline"?{baseline_only:!0}:void 0)}},[c,t,a,u.caseRunStates,S]),_=p.useCallback((le="benchmark")=>{var xe;if(c)return;const he=((xe=u.evals)==null?void 0:xe.evals)??[];if(he.length===0)return;const pe=he.map(be=>be.id);for(const be of pe)m.current.delete(be),g.current.delete(be);d({type:"BULK_RUN_START",caseIds:pe,mode:le}),h.current=new Set(pe);for(const be of pe)if(le==="comparison")S(be,`/api/skills/${t}/${a}/compare`,{eval_ids:[be]});else{const Be=`/api/skills/${t}/${a}/benchmark/case/${be}`;S(be,Be,le==="baseline"?{baseline_only:!0}:void 0)}},[c,t,a,u.evals,S]),D=p.useCallback(le=>{k(le),d({type:"CASE_RUN_CANCEL",caseId:le}),h.current.delete(le),g.current.add(le)},[k]),F=p.useCallback(()=>{w(),d({type:"CANCEL_ALL"}),h.current.clear()},[w]),E=p.useCallback(async(le,he)=>{d({type:"OPEN_IMPROVE",evalId:le})},[]),B=p.useCallback(async(le,he)=>{try{await we.applyImprovement(t,a,he),d({type:"SET_CONTENT",content:he}),d({type:"CONTENT_SAVED"}),d({type:"CLOSE_IMPROVE"}),A(le,"benchmark")}catch(pe){d({type:"SET_ERROR",error:pe.message})}},[t,a,A]),L=Ld(),U=p.useRef(null),$=p.useRef(0);p.useEffect(()=>{const le=L.events;for(let he=$.current;he<le.length;he++){const pe=le[he],xe=pe.data;if(pe.event==="progress"&&d({type:"AI_EDIT_PROGRESS",entry:{timestamp:Date.now(),phase:xe.phase,message:xe.message}}),pe.event==="done"){const be=xe.improved,Be=xe.reasoning,Ue=xe.evalChanges??[];d({type:"AI_EDIT_RESULT",improved:be,reasoning:Be,evalChanges:Ue})}if(pe.event==="error"){const be=xe;d({type:"AI_EDIT_ERROR",message:be.description||"Unknown error",classified:be})}}$.current=le.length},[L.events]),p.useEffect(()=>{L.error&&d({type:"AI_EDIT_ERROR",message:L.error})},[L.error]),p.useEffect(()=>()=>{L.stop()},[L.stop]);const q=p.useCallback(async(le,he,pe)=>{c||($.current=0,d({type:"AI_EDIT_LOADING"}),U.current=L.stop,L.start(`/api/skills/${t}/${a}/improve?sse`,{mode:"instruct",instruction:le,content:u.skillContent,evals:u.evals??{skill_name:a,evals:[]},provider:he,model:pe}))},[c,t,a,u.skillContent,u.evals,L]),X=p.useCallback(()=>{L.stop(),d({type:"AI_EDIT_ERROR",message:"Cancelled"})},[L]),ee=p.useCallback(async()=>{const le=u.aiEditResult;if(le!=null&&le.improved)try{if(await we.applyImprovement(t,a,le.improved),d({type:"SET_CONTENT",content:le.improved}),d({type:"CONTENT_SAVED"}),u.aiEditEvalChanges.length>0&&Array.from(u.aiEditEvalSelections.values()).some(Boolean)){const{mergeEvalChanges:pe}=await Ha(async()=>{const{mergeEvalChanges:Be}=await import("./mergeEvalChanges-Dpbbs4d4.js");return{mergeEvalChanges:Be}},[]),xe=u.evals??{skill_name:a,evals:[]},be=pe(xe,u.aiEditEvalChanges,u.aiEditEvalSelections);try{const Be=await we.saveEvals(t,a,be);d({type:"SET_EVALS",evals:Be})}catch(Be){d({type:"SET_EVALS_RETRY",evalsFile:be}),d({type:"SET_ERROR",error:`SKILL.md saved, but test cases failed to save: ${Be.message}. You can retry from the AI Edit panel.`});return}}d({type:"CLOSE_AI_EDIT"})}catch(he){d({type:"SET_ERROR",error:he.message})}},[t,a,u.aiEditResult,u.evals,u.aiEditEvalChanges,u.aiEditEvalSelections]),I=p.useCallback(()=>{d({type:"CLOSE_AI_EDIT"})},[]),z=p.useCallback(le=>{d({type:"TOGGLE_EVAL_CHANGE",index:le})},[]),O=p.useCallback(()=>{d({type:"SELECT_ALL_EVAL_CHANGES"})},[]),P=p.useCallback(()=>{d({type:"DESELECT_ALL_EVAL_CHANGES"})},[]),H=p.useCallback(async()=>{const le=u.aiEditEvalsRetry;if(le)try{const he=await we.saveEvals(t,a,le);d({type:"SET_EVALS",evals:he}),d({type:"SET_ERROR",error:null}),d({type:"CLOSE_AI_EDIT"})}catch(he){d({type:"SET_ERROR",error:`Retry failed: ${he.message}`})}},[t,a,u.aiEditEvalsRetry]),ae=p.useCallback(async()=>{try{const le=await we.getSkillDetail(t,a);d({type:"SET_CONTENT",content:le.skillContent}),d({type:"CONTENT_SAVED"})}catch{}},[t,a]),{config:M}=$a(),Y=Ld(),W=p.useRef(0);p.useEffect(()=>{const le=Y.events;for(let he=W.current;he<le.length;he++){const pe=le[he],xe=pe.data;if(pe.event==="progress"&&d({type:"GENERATE_EVALS_PROGRESS",entry:{timestamp:Date.now(),phase:xe.phase,message:xe.message}}),pe.event==="done"){const be=xe;we.saveEvals(t,a,be).then(Be=>d({type:"GENERATE_EVALS_DONE",evals:Be})).catch(Be=>d({type:"SET_ERROR",error:Be.message}))}pe.event==="error"&&d({type:"GENERATE_EVALS_ERROR",classified:xe})}W.current=le.length},[Y.events,t,a]),p.useEffect(()=>{Y.error&&d({type:"SET_ERROR",error:Y.error})},[Y.error]),p.useEffect(()=>()=>{Y.stop()},[Y.stop]);const Q=p.useCallback(async le=>{if(c)return;W.current=0,d({type:"GENERATE_EVALS_START"});const he={};M!=null&&M.provider&&(he.provider=M.provider),M!=null&&M.model&&(he.model=M.model);const pe=iC(le==null?void 0:le.testType);pe&&(he.testType=pe),Y.start(`/api/skills/${t}/${a}/generate-evals?sse`,Object.keys(he).length>0?he:void 0)},[c,t,a,Y,M]),oe=Ld(),de=p.useRef(0);p.useEffect(()=>()=>{oe.stop()},[oe.stop]),p.useEffect(()=>{const le=oe.events;for(let he=de.current;he<le.length;he++){const pe=le[he];if(pe.event==="classifying"){const xe=pe.data;d({type:"ACTIVATION_CLASSIFYING",index:xe.index,total:xe.total})}if(pe.event==="prompt_result"&&d({type:"ACTIVATION_RESULT",result:pe.data}),pe.event==="done"){ve.current&&(clearTimeout(ve.current),ve.current=null);const xe=pe.data;if(xe.error)d({type:"ACTIVATION_ERROR",error:xe.error});else{d({type:"ACTIVATION_DONE",summary:xe});const be={id:`run-${Date.now()}`,timestamp:new Date().toISOString(),model:(M==null?void 0:M.model)||"unknown",provider:(M==null?void 0:M.provider)||"unknown",promptCount:xe.total,summary:{precision:xe.precision,recall:xe.recall,reliability:xe.reliability,tp:xe.tp,tn:xe.tn,fp:xe.fp,fn:xe.fn}};d({type:"ACTIVATION_HISTORY_LOADED",runs:[be,...u.activationHistory??[]]})}}}de.current=le.length},[oe.events,M,u.activationHistory]),p.useEffect(()=>{oe.error&&(ve.current&&(clearTimeout(ve.current),ve.current=null),d({type:"ACTIVATION_ERROR",error:oe.error}))},[oe.error]);const ve=p.useRef(null),ce=p.useCallback(()=>{ve.current&&(clearTimeout(ve.current),ve.current=null),oe.stop(),d({type:"ACTIVATION_CANCEL",totalPrompts:0})},[oe]),je=p.useCallback(le=>{const pe=le.trim().split(`
|
|
69
69
|
`).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"});de.current=0,d({type:"ACTIVATION_START"}),d({type:"SET_ACTIVATION_PROMPTS",prompts:le});const xe={prompts:pe};M!=null&&M.provider&&(xe.provider=M.provider),M!=null&&M.model&&(xe.model=M.model),oe.start(`/api/skills/${t}/${a}/activation-test`,xe),ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>{oe.stop(),d({type:"ACTIVATION_TIMEOUT"}),ve.current=null},12e4)},[t,a,oe,M]),Re=p.useCallback(async(le=8)=>{d({type:"GENERATE_PROMPTS_START"});try{const he={count:le};M!=null&&M.provider&&(he.provider=M.provider),M!=null&&M.model&&(he.model=M.model);const pe=await fetch(`/api/skills/${t}/${a}/activation-prompts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(he)});if(!pe.ok){let gt=`HTTP ${pe.status}`;try{const Tt=await pe.json();Tt.error&&(gt=Tt.error)}catch{}throw new Error(gt)}const xe=pe.body.getReader(),be=new TextDecoder;let Be="",Ue="",lt=[];for(;;){const{done:gt,value:Tt}=await xe.read();if(gt)break;Be+=be.decode(Tt,{stream:!0});const Gt=Be.split(`
|
|
70
70
|
`);Be=Gt.pop()||"";for(const We of Gt)if(We.startsWith("event: "))Ue=We.slice(7).trim();else if(We.startsWith("data: ")){try{const nt=JSON.parse(We.slice(6));if(Ue==="done"){if(nt.error)throw new Error(nt.error);lt=nt.prompts||[]}if(Ue==="error")throw new Error(nt.message||nt.description||"Generation failed")}catch(nt){if(!(nt instanceof SyntaxError))throw nt}Ue=""}}const Ct=lt.map(gt=>`${gt.expected==="should_activate"?"+":"!"}${gt.prompt}`).join(`
|
|
71
|
-
`);d({type:"SET_ACTIVATION_PROMPTS",prompts:Ct}),d({type:"GENERATE_PROMPTS_DONE"})}catch(he){d({type:"GENERATE_PROMPTS_ERROR",error:he.message})}},[t,a,M]),Oe=p.useMemo(()=>({state:u,dispatch:d,isReadOnly:c,saveContent:T,saveEvals:N,runCase:A,runAll:_,cancelCase:D,cancelAll:F,improveForCase:
|
|
72
|
-
`),s=[];for(const o of a)if(!(o.startsWith("--- ")||o.startsWith("+++ "))){if(o.startsWith("@@")){s.push({type:"header",content:o});continue}if(o.startsWith("+")){s.push({type:"add",content:o.slice(1)});continue}if(o.startsWith("-")){s.push({type:"remove",content:o.slice(1)});continue}(o.startsWith(" ")||o===""&&s.length>0)&&s.push({type:"context",content:o.startsWith(" ")?o.slice(1):""})}return s}function Of({contentDiff:t,fromLabel:a,toLabel:s,diffSummary:o,maxHeight:c=480,collapsible:u=!1,renderContext:d="inline",onRetry:h}){const[g,m]=p.useState(u),[y,v]=p.useState("unified"),b=p.useRef(null),S=p.useRef(null),k=p.useMemo(()=>iC(t),[t]),w=p.useMemo(()=>{const D=k.filter(C=>C.type==="add").length,F=k.filter(C=>C.type==="remove").length;return{added:D,removed:F}},[k]),E=p.useMemo(()=>{let D=0,F=0;return k.filter(C=>C.type!=="header").map(C=>C.type==="remove"?(D++,{...C,origNum:D,newNum:null}):C.type==="add"?(F++,{...C,origNum:null,newNum:F}):(D++,F++,{...C,origNum:D,newNum:F}))},[k]),T=p.useMemo(()=>{const D=[],F=[];for(const C of E)if(C.type==="remove")D.push(C);else if(C.type==="add")F.push(C);else{for(;D.length<F.length;)D.push({type:"context",content:"",origNum:null,newNum:null});for(;F.length<D.length;)F.push({type:"context",content:"",origNum:null,newNum:null});D.push(C),F.push(C)}for(;D.length<F.length;)D.push({type:"context",content:"",origNum:null,newNum:null});for(;F.length<D.length;)F.push({type:"context",content:"",origNum:null,newNum:null});return{left:D,right:F}},[E]),N=p.useCallback(D=>{const F=D==="left"?b.current:S.current,C=D==="left"?S.current:b.current;F&&C&&(C.scrollTop=F.scrollTop)},[]);if(!t||k.length===0)return r.jsxs("div",{className:"rounded-lg p-6 text-center",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[r.jsx("div",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"Unable to load diff. Try again."}),h&&r.jsx("button",{onClick:h,className:"btn btn-secondary text-[12px]",children:"Retry"})]});const A=d==="modal"?"fixed inset-0 z-50 flex items-center justify-center bg-black/50":"",_=r.jsxs("div",{className:"rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:[a," → ",s]}),r.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[r.jsxs("span",{style:{color:"var(--green)"},children:["+",w.added]}),r.jsxs("span",{style:{color:"var(--red)"},children:["-",w.removed]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{onClick:()=>v(y==="unified"?"side-by-side":"unified"),className:"btn btn-ghost text-[11px]",children:y==="unified"?"Side-by-side":"Unified"}),u&&r.jsx("button",{onClick:()=>m(!g),className:"btn btn-ghost text-[11px]",children:g?"Expand":"Collapse"})]})]}),o&&r.jsx("div",{className:"mx-4 mt-3 px-4 py-2 rounded-lg text-[12px]",style:{background:"var(--accent-muted)",color:"var(--text-secondary)"},children:o}),!g&&(y==="unified"?r.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:c,overflowY:"auto"},children:r.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:r.jsx("tbody",{children:E.map((D,F)=>r.jsxs("tr",{style:{background:D.type==="add"?"rgba(34,197,94,0.08)":D.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[r.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:D.type==="remove"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:D.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:D.origNum??""}),r.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:D.type==="add"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:D.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:D.newNum??""}),r.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:D.type==="add"?"var(--green)":D.type==="remove"?"var(--red)":"transparent",borderRight:D.type==="add"?"2px solid var(--green)":D.type==="remove"?"2px solid var(--red)":"2px solid transparent"},children:D.type==="add"?"+":D.type==="remove"?"-":" "}),r.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:D.type==="add"?"var(--green)":D.type==="remove"?"var(--red)":"var(--text-secondary)"},children:D.content||""})]},F))})})}):r.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:[r.jsx("div",{ref:b,style:{maxHeight:c,overflowY:"auto",borderRight:"1px solid var(--border-subtle)"},onScroll:()=>N("left"),children:r.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:r.jsx("tbody",{children:T.left.map((D,F)=>r.jsxs("tr",{style:{background:D.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[r.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:D.origNum??""}),r.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:D.type==="remove"?"var(--red)":"var(--text-secondary)"},children:D.content||""})]},F))})})}),r.jsx("div",{ref:S,style:{maxHeight:c,overflowY:"auto"},onScroll:()=>N("right"),children:r.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:r.jsx("tbody",{children:T.right.map((D,F)=>r.jsxs("tr",{style:{background:D.type==="add"?"rgba(34,197,94,0.08)":"transparent"},children:[r.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:D.newNum??""}),r.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:D.type==="add"?"var(--green)":"var(--text-secondary)"},children:D.content||""})]},F))})})})]}))]});return d==="modal"?r.jsx("div",{className:A,children:r.jsx("div",{style:{width:"80%",maxWidth:900},children:_})}):_}const Ld="https://verified-skill.com/submit",oC=/^https:\/\/github\.com\/[^/?#@:]+\/[^/?#@:]+(?:[/?#].*)?$/;function cC(t){if(!t)return Ld;const a=t.trim();return!a||!oC.test(a)?Ld:`${Ld}?repo=${encodeURIComponent(a)}`}const uC={sm:{icon:12,fontSize:"0.625rem",gap:"0.25rem",px:"0.375rem",py:"0.125rem",height:"18px",radius:"3px"},md:{icon:14,fontSize:"0.6875rem",gap:"0.3rem",px:"0.5rem",py:"0.15rem",height:"22px",radius:"4px"},lg:{icon:16,fontSize:"0.75rem",gap:"0.375rem",px:"0.625rem",py:"0.2rem",height:"26px",radius:"4px"}};function dC({size:t}){return r.jsxs("svg",{width:t,height:t,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[r.jsx("path",{d:"M10 1L3 4.5V9.5C3 13.64 5.99 17.52 10 18.5C14.01 17.52 17 13.64 17 9.5V4.5L10 1Z",fill:"currentColor",fillOpacity:"0.15",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),r.jsx("path",{d:"M7.5 10.5L9.5 12.5L13 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}function fC({size:t}){return r.jsxs("svg",{width:t,height:t,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[r.jsx("path",{d:"M10 1L11.9 4.1L15.5 3.5L14.2 7L17 9.5L14.2 12L15.5 15.5L11.9 14.9L10 18L8.1 14.9L4.5 15.5L5.8 12L3 9.5L5.8 7L4.5 3.5L8.1 4.1L10 1Z",fill:"currentColor",fillOpacity:"0.15",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),r.jsx("path",{d:"M10 6.5L10.9 8.6L13.1 8.8L11.4 10.3L11.9 12.5L10 11.3L8.1 12.5L8.6 10.3L6.9 8.8L9.1 8.6L10 6.5Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"0.4",strokeLinejoin:"round"})]})}const _g={VERIFIED:{color:"var(--tier-verified)",bg:"var(--tier-verified-bg)",border:"var(--tier-verified-border)"},CERTIFIED:{color:"var(--tier-certified)",bg:"var(--tier-certified-bg)",border:"var(--tier-certified-border)"},TAINTED:{color:"var(--tier-tainted)",bg:"var(--tier-tainted-bg)",border:"var(--tier-tainted-border)"}},pC={VERIFIED:"Security-Scanned",CERTIFIED:"Trusted Publisher",TAINTED:"Tainted"};function Ty(t){return pC[t]??t}function mC({size:t}){return r.jsxs("svg",{width:t,height:t,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[r.jsx("path",{d:"M10 2L1.5 17.5H18.5L10 2Z",fill:"currentColor",fillOpacity:"0.15",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),r.jsx("path",{d:"M10 8V12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),r.jsx("circle",{cx:"10",cy:"14.5",r:"1",fill:"currentColor"})]})}function hC({tier:t,size:a}){return t==="TAINTED"?r.jsx(mC,{size:a}):t==="CERTIFIED"?r.jsx(fC,{size:a}):r.jsx(dC,{size:a})}function uR({tier:t,size:a="md",isTainted:s}){const o=uC[a],c=s?"TAINTED":t,u=_g[c]??_g.VERIFIED;return r.jsxs("span",{"data-testid":"tier-badge","data-tier":c,style:{display:"inline-flex",alignItems:"center",gap:o.gap,padding:`${o.py} ${o.px}`,height:o.height,borderRadius:o.radius,fontFamily:"var(--font-geist-mono)",fontSize:o.fontSize,fontWeight:600,letterSpacing:"0.03em",whiteSpace:"nowrap",color:u.color,backgroundColor:u.bg,border:`1px solid ${u.border}`,lineHeight:1},children:[r.jsx(hC,{tier:c,size:o.icon}),Ty(c)]})}const Og={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 xC(t,a){return t?t.length>a?t.slice(0,a)+"…":t:""}function gC(){const{state:t}=Rn(),{plugin:a,skill:s}=t,o=er(),{onSkillUpdated:c,updateCount:u}=o,d=p.useMemo(()=>o.state.skills.find(z=>z.plugin===a&&z.skill===s)??null,[o.state.skills,a,s]),h=`versions/${a}/${s}`,g=p.useCallback(()=>we.getSkillVersions(a,s),[a,s]),{data:m,loading:y}=Js(h,g),[v,b]=p.useState(null),[S,k]=p.useState(null),[w,E]=p.useState(null),[T,N]=p.useState(!1),[A,_]=p.useState("idle"),[D,F]=p.useState(null),C=p.useRef(null),B=p.useRef(null),L=p.useMemo(()=>(m==null?void 0:m.find(z=>z.isInstalled))??null,[m]),U=p.useMemo(()=>(m==null?void 0:m[0])??null,[m]),$=L&&U&&L.version!==U.version,q=p.useCallback(z=>{v?!S&&z!==v?k(z):(b(z),k(null),E(null)):(b(z),E(null))},[v,S]),X=p.useCallback(async(z,O)=>{N(!0);try{const P=await we.getVersionDiff(a,s,z,O);E(P)}catch{E(null)}finally{N(!1)}},[a,s]);p.useEffect(()=>{if(v&&S){const z=m||[],O=z.findIndex(M=>M.version===v),P=z.findIndex(M=>M.version===S),[H,ae]=O>P?[v,S]:[S,v];X(H,ae)}},[v,S,m,X]);const ee=p.useCallback(()=>{!L||!U||(b(L.version),k(U.version))},[L,U]),I=p.useCallback(async()=>{_("updating"),F(null);const z=new AbortController;C.current=z;try{const O=await we.postSkillUpdate(a,s,z.signal);if(O.ok)_("done"),c(a,s);else{const P=`Update failed (HTTP ${O.status}): ${O.body||"no response body"}`;_("error"),F(P)}}catch(O){if(O instanceof DOMException&&O.name==="AbortError")return;const P=O instanceof Error?O.message:"Network error";_("error"),F(P)}finally{C.current===z&&(C.current=null)}},[a,s,c]);if(p.useEffect(()=>()=>{var z;(z=C.current)==null||z.abort(),C.current=null},[]),y)return r.jsxs("div",{className:"p-5",children:[r.jsx("div",{className:"skeleton h-5 w-40 mb-4"}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"skeleton h-14 rounded-lg"}),r.jsx("div",{className:"skeleton h-14 rounded-lg"}),r.jsx("div",{className:"skeleton h-14 rounded-lg"})]})]});if(!m||m.length===0){if((d==null?void 0:d.origin)==="source"){const O=cC((d==null?void 0:d.homepage)??null);return r.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-16 px-8","data-testid":"versions-empty-state-local",children:[r.jsx("div",{className:"text-[14px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"No published versions yet"}),r.jsx("div",{className:"text-[13px] text-center mb-5 max-w-md",style:{color:"var(--text-tertiary)",lineHeight:1.5},children:"This skill is local-only — the version history shown here is sourced from verified-skill.com. Submit your skill to start tracking versions and share it with others."}),r.jsx("a",{href:O,target:"_blank",rel:"noopener noreferrer",className:"btn btn-primary text-[12px]","data-testid":"versions-empty-state-cta",children:"Submit on verified-skill.com"})]})}return d!=null&&d.version?r.jsxs("div",{className:"p-5",children:[r.jsx("div",{className:"text-[14px] font-semibold mb-4",style:{color:"var(--text-primary)"},children:"Version History"}),r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"absolute left-3 top-0 bottom-0",style:{width:2,background:"var(--border-subtle)"}}),r.jsxs("div",{"data-testid":"version-row-local",className:"w-full text-left pl-8 pr-4 py-3 relative rounded-lg",style:{background:"transparent",border:"1px solid transparent"},children:[r.jsx("span",{className:"absolute left-1.5 top-4 rounded-full",style:{width:10,height:10,background:"var(--accent)",border:"2px solid var(--accent)"}}),r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:d.version}),r.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"LOCAL"}),r.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"})]})}),r.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"Local-only — this skill is not registered on verified-skill.com, so no upstream history is available."})]})]})]}):r.jsx("div",{className:"flex flex-col items-center justify-center h-full py-16","data-testid":"versions-empty-state-installed",children:r.jsx("div",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No version history available"})})}return r.jsxs("div",{className:"p-5",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Version History"}),r.jsxs("div",{className:"flex items-center gap-2",children:[$&&r.jsx("button",{onClick:ee,className:"btn btn-secondary text-[11px]",children:"View changes since installed"}),$&&A!=="done"&&(A==="error"?r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"text-[11px]",style:{color:"var(--red)"},children:D||"Update failed"}),r.jsx("button",{onClick:I,className:"btn btn-secondary text-[11px]",children:"Retry"})]}):r.jsx("button",{onClick:I,disabled:A!=="idle",className:"btn btn-primary text-[11px]",children:A==="idle"?`Update to ${U==null?void 0:U.version}`:A==="updating"?"Starting update...":A==="scanning"?"Scanning...":"Installing..."})),u>1&&r.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,")"]})]})]}),v&&!S&&r.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 ",v]}),r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"absolute left-3 top-0 bottom-0",style:{width:2,background:"var(--border-subtle)"}}),r.jsx("div",{className:"space-y-1",children:m.map(z=>{const O=Og[z.certTier]||Og.COMMUNITY,P=z.version===v||z.version===S,H=z.isInstalled;return r.jsxs("button",{onClick:()=>q(z.version),className:"w-full text-left pl-8 pr-4 py-3 relative rounded-lg transition-all duration-150",style:{background:P?"var(--accent-muted)":"transparent",border:P?"1px solid var(--accent)":"1px solid transparent",cursor:"pointer"},onMouseEnter:ae=>{P||(ae.currentTarget.style.background="var(--surface-1)")},onMouseLeave:ae=>{P||(ae.currentTarget.style.background="transparent")},children:[r.jsx("span",{className:"absolute left-1.5 top-4 rounded-full",style:{width:H?10:8,height:H?10:8,background:H?"var(--accent)":"var(--surface-3)",border:H?"2px solid var(--accent)":"2px solid var(--border-default)"}}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:z.version}),r.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:O.bg,color:O.text},children:Ty(z.certTier)}),H&&r.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"})]}),r.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:new Date(z.createdAt).toLocaleDateString()})]}),z.diffSummary&&r.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:xC(z.diffSummary,80)})]},z.version)})}),r.jsx("div",{ref:B,style:{height:1}})]}),T&&r.jsx("div",{className:"mt-4",children:r.jsx("div",{className:"skeleton h-48 rounded-xl"})}),w&&!T&&r.jsx("div",{className:"mt-4",children:r.jsx(Of,{contentDiff:w.contentDiff,fromLabel:w.from,toLabel:w.to,diffSummary:w.diffSummary,renderContext:"inline",onRetry:()=>v&&S&&X(w.from,w.to)})})]})}function vC(t){const a=t.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!a)return{metadata:{},body:t};const s=a[1],o=a[2].trim(),c={},u=s.split(`
|
|
73
|
-
`);let d="",h=!1;for(const g of u){const m=g.match(/^[ \t]+([\w-]+):\s*(.*)$/);if(m&&d&&h){const b=m[1],S=m[2].trim();let k=c[d];if((typeof k!="object"||Array.isArray(k))&&(k={},c[d]=k),!S)k[b]=[];else{const w=S.match(/^\[(.+)\]$/);w?k[b]=w[1].split(",").map(
|
|
74
|
-
`),s=[];let o=0;for(;o<a.length;)if(a[o].trim().startsWith("|")&&o+1<a.length&&a[o+1].trim().startsWith("|")&&/\|[\s-:]+\|/.test(a[o+1])){const c=
|
|
75
|
-
`)}function
|
|
71
|
+
`);d({type:"SET_ACTIVATION_PROMPTS",prompts:Ct}),d({type:"GENERATE_PROMPTS_DONE"})}catch(he){d({type:"GENERATE_PROMPTS_ERROR",error:he.message})}},[t,a,M]),Oe=p.useMemo(()=>({state:u,dispatch:d,isReadOnly:c,saveContent:T,saveEvals:N,runCase:A,runAll:_,cancelCase:D,cancelAll:F,improveForCase:E,applyImproveAndRerun:B,refreshSkillContent:ae,generateEvals:Q,runActivationTest:je,cancelActivation:ce,generateActivationPrompts:Re,fetchActivationHistory:C,submitAiEdit:q,cancelAiEdit:X,applyAiEdit:ee,discardAiEdit:I,toggleEvalChange:z,selectAllEvalChanges:O,deselectAllEvalChanges:P,retryEvalsSave:H}),[u,c,T,N,A,_,D,F,E,B,ae,Q,je,ce,Re,C,q,X,ee,I,z,O,P,H]);return r.jsx(Ry.Provider,{value:Oe,children:o})}function uC(t){if(!t)return[];const a=t.split(`
|
|
72
|
+
`),s=[];for(const o of a)if(!(o.startsWith("--- ")||o.startsWith("+++ "))){if(o.startsWith("@@")){s.push({type:"header",content:o});continue}if(o.startsWith("+")){s.push({type:"add",content:o.slice(1)});continue}if(o.startsWith("-")){s.push({type:"remove",content:o.slice(1)});continue}(o.startsWith(" ")||o===""&&s.length>0)&&s.push({type:"context",content:o.startsWith(" ")?o.slice(1):""})}return s}function Bf({contentDiff:t,fromLabel:a,toLabel:s,diffSummary:o,maxHeight:c=480,collapsible:u=!1,renderContext:d="inline",onRetry:h}){const[g,m]=p.useState(u),[y,v]=p.useState("unified"),b=p.useRef(null),S=p.useRef(null),k=p.useMemo(()=>uC(t),[t]),w=p.useMemo(()=>{const D=k.filter(E=>E.type==="add").length,F=k.filter(E=>E.type==="remove").length;return{added:D,removed:F}},[k]),C=p.useMemo(()=>{let D=0,F=0;return k.filter(E=>E.type!=="header").map(E=>E.type==="remove"?(D++,{...E,origNum:D,newNum:null}):E.type==="add"?(F++,{...E,origNum:null,newNum:F}):(D++,F++,{...E,origNum:D,newNum:F}))},[k]),T=p.useMemo(()=>{const D=[],F=[];for(const E of C)if(E.type==="remove")D.push(E);else if(E.type==="add")F.push(E);else{for(;D.length<F.length;)D.push({type:"context",content:"",origNum:null,newNum:null});for(;F.length<D.length;)F.push({type:"context",content:"",origNum:null,newNum:null});D.push(E),F.push(E)}for(;D.length<F.length;)D.push({type:"context",content:"",origNum:null,newNum:null});for(;F.length<D.length;)F.push({type:"context",content:"",origNum:null,newNum:null});return{left:D,right:F}},[C]),N=p.useCallback(D=>{const F=D==="left"?b.current:S.current,E=D==="left"?S.current:b.current;F&&E&&(E.scrollTop=F.scrollTop)},[]);if(!t||k.length===0)return r.jsxs("div",{className:"rounded-lg p-6 text-center",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[r.jsx("div",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"Unable to load diff. Try again."}),h&&r.jsx("button",{onClick:h,className:"btn btn-secondary text-[12px]",children:"Retry"})]});const A=d==="modal"?"fixed inset-0 z-50 flex items-center justify-center bg-black/50":"",_=r.jsxs("div",{className:"rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:[a," → ",s]}),r.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[r.jsxs("span",{style:{color:"var(--green)"},children:["+",w.added]}),r.jsxs("span",{style:{color:"var(--red)"},children:["-",w.removed]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{onClick:()=>v(y==="unified"?"side-by-side":"unified"),className:"btn btn-ghost text-[11px]",children:y==="unified"?"Side-by-side":"Unified"}),u&&r.jsx("button",{onClick:()=>m(!g),className:"btn btn-ghost text-[11px]",children:g?"Expand":"Collapse"})]})]}),o&&r.jsx("div",{className:"mx-4 mt-3 px-4 py-2 rounded-lg text-[12px]",style:{background:"var(--accent-muted)",color:"var(--text-secondary)"},children:o}),!g&&(y==="unified"?r.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:c,overflowY:"auto"},children:r.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:r.jsx("tbody",{children:C.map((D,F)=>r.jsxs("tr",{style:{background:D.type==="add"?"rgba(34,197,94,0.08)":D.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[r.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:D.type==="remove"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:D.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:D.origNum??""}),r.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:D.type==="add"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:D.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:D.newNum??""}),r.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:D.type==="add"?"var(--green)":D.type==="remove"?"var(--red)":"transparent",borderRight:D.type==="add"?"2px solid var(--green)":D.type==="remove"?"2px solid var(--red)":"2px solid transparent"},children:D.type==="add"?"+":D.type==="remove"?"-":" "}),r.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:D.type==="add"?"var(--green)":D.type==="remove"?"var(--red)":"var(--text-secondary)"},children:D.content||""})]},F))})})}):r.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:[r.jsx("div",{ref:b,style:{maxHeight:c,overflowY:"auto",borderRight:"1px solid var(--border-subtle)"},onScroll:()=>N("left"),children:r.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:r.jsx("tbody",{children:T.left.map((D,F)=>r.jsxs("tr",{style:{background:D.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[r.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:D.origNum??""}),r.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:D.type==="remove"?"var(--red)":"var(--text-secondary)"},children:D.content||""})]},F))})})}),r.jsx("div",{ref:S,style:{maxHeight:c,overflowY:"auto"},onScroll:()=>N("right"),children:r.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:r.jsx("tbody",{children:T.right.map((D,F)=>r.jsxs("tr",{style:{background:D.type==="add"?"rgba(34,197,94,0.08)":"transparent"},children:[r.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:D.newNum??""}),r.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:D.type==="add"?"var(--green)":"var(--text-secondary)"},children:D.content||""})]},F))})})})]}))]});return d==="modal"?r.jsx("div",{className:A,children:r.jsx("div",{style:{width:"80%",maxWidth:900},children:_})}):_}const zd="https://verified-skill.com/submit",dC=/^https:\/\/github\.com\/[^/?#@:]+\/[^/?#@:]+(?:[/?#].*)?$/;function fC(t){if(!t)return zd;const a=t.trim();return!a||!dC.test(a)?zd:`${zd}?repo=${encodeURIComponent(a)}`}const pC={sm:{icon:12,fontSize:"0.625rem",gap:"0.25rem",px:"0.375rem",py:"0.125rem",height:"18px",radius:"3px"},md:{icon:14,fontSize:"0.6875rem",gap:"0.3rem",px:"0.5rem",py:"0.15rem",height:"22px",radius:"4px"},lg:{icon:16,fontSize:"0.75rem",gap:"0.375rem",px:"0.625rem",py:"0.2rem",height:"26px",radius:"4px"}};function mC({size:t}){return r.jsxs("svg",{width:t,height:t,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[r.jsx("path",{d:"M10 1L3 4.5V9.5C3 13.64 5.99 17.52 10 18.5C14.01 17.52 17 13.64 17 9.5V4.5L10 1Z",fill:"currentColor",fillOpacity:"0.15",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),r.jsx("path",{d:"M7.5 10.5L9.5 12.5L13 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}function hC({size:t}){return r.jsxs("svg",{width:t,height:t,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[r.jsx("path",{d:"M10 1L11.9 4.1L15.5 3.5L14.2 7L17 9.5L14.2 12L15.5 15.5L11.9 14.9L10 18L8.1 14.9L4.5 15.5L5.8 12L3 9.5L5.8 7L4.5 3.5L8.1 4.1L10 1Z",fill:"currentColor",fillOpacity:"0.15",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),r.jsx("path",{d:"M10 6.5L10.9 8.6L13.1 8.8L11.4 10.3L11.9 12.5L10 11.3L8.1 12.5L8.6 10.3L6.9 8.8L9.1 8.6L10 6.5Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"0.4",strokeLinejoin:"round"})]})}const Og={VERIFIED:{color:"var(--tier-verified)",bg:"var(--tier-verified-bg)",border:"var(--tier-verified-border)"},CERTIFIED:{color:"var(--tier-certified)",bg:"var(--tier-certified-bg)",border:"var(--tier-certified-border)"},TAINTED:{color:"var(--tier-tainted)",bg:"var(--tier-tainted-bg)",border:"var(--tier-tainted-border)"}},xC={VERIFIED:"Security-Scanned",CERTIFIED:"Trusted Publisher",TAINTED:"Tainted"};function Ay(t){return xC[t]??t}function gC({size:t}){return r.jsxs("svg",{width:t,height:t,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[r.jsx("path",{d:"M10 2L1.5 17.5H18.5L10 2Z",fill:"currentColor",fillOpacity:"0.15",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),r.jsx("path",{d:"M10 8V12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),r.jsx("circle",{cx:"10",cy:"14.5",r:"1",fill:"currentColor"})]})}function vC({tier:t,size:a}){return t==="TAINTED"?r.jsx(gC,{size:a}):t==="CERTIFIED"?r.jsx(hC,{size:a}):r.jsx(mC,{size:a})}function dR({tier:t,size:a="md",isTainted:s}){const o=pC[a],c=s?"TAINTED":t,u=Og[c]??Og.VERIFIED;return r.jsxs("span",{"data-testid":"tier-badge","data-tier":c,style:{display:"inline-flex",alignItems:"center",gap:o.gap,padding:`${o.py} ${o.px}`,height:o.height,borderRadius:o.radius,fontFamily:"var(--font-geist-mono)",fontSize:o.fontSize,fontWeight:600,letterSpacing:"0.03em",whiteSpace:"nowrap",color:u.color,backgroundColor:u.bg,border:`1px solid ${u.border}`,lineHeight:1},children:[r.jsx(vC,{tier:c,size:o.icon}),Ay(c)]})}const Bg={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 yC(t,a){return t?t.length>a?t.slice(0,a)+"…":t:""}function bC(){const{state:t}=Rn(),{plugin:a,skill:s}=t,o=er(),{onSkillUpdated:c,updateCount:u}=o,d=p.useMemo(()=>o.state.skills.find(z=>z.plugin===a&&z.skill===s)??null,[o.state.skills,a,s]),h=`versions/${a}/${s}`,g=p.useCallback(()=>we.getSkillVersions(a,s),[a,s]),{data:m,loading:y}=Js(h,g),[v,b]=p.useState(null),[S,k]=p.useState(null),[w,C]=p.useState(null),[T,N]=p.useState(!1),[A,_]=p.useState("idle"),[D,F]=p.useState(null),E=p.useRef(null),B=p.useRef(null),L=p.useMemo(()=>(m==null?void 0:m.find(z=>z.isInstalled))??null,[m]),U=p.useMemo(()=>(m==null?void 0:m[0])??null,[m]),$=L&&U&&L.version!==U.version,q=p.useCallback(z=>{v?!S&&z!==v?k(z):(b(z),k(null),C(null)):(b(z),C(null))},[v,S]),X=p.useCallback(async(z,O)=>{N(!0);try{const P=await we.getVersionDiff(a,s,z,O);C(P)}catch{C(null)}finally{N(!1)}},[a,s]);p.useEffect(()=>{if(v&&S){const z=m||[],O=z.findIndex(M=>M.version===v),P=z.findIndex(M=>M.version===S),[H,ae]=O>P?[v,S]:[S,v];X(H,ae)}},[v,S,m,X]);const ee=p.useCallback(()=>{!L||!U||(b(L.version),k(U.version))},[L,U]),I=p.useCallback(async()=>{_("updating"),F(null);const z=new AbortController;E.current=z;try{const O=await we.postSkillUpdate(a,s,z.signal);if(O.ok)_("done"),c(a,s);else{const P=`Update failed (HTTP ${O.status}): ${O.body||"no response body"}`;_("error"),F(P)}}catch(O){if(O instanceof DOMException&&O.name==="AbortError")return;const P=O instanceof Error?O.message:"Network error";_("error"),F(P)}finally{E.current===z&&(E.current=null)}},[a,s,c]);if(p.useEffect(()=>()=>{var z;(z=E.current)==null||z.abort(),E.current=null},[]),y)return r.jsxs("div",{className:"p-5",children:[r.jsx("div",{className:"skeleton h-5 w-40 mb-4"}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"skeleton h-14 rounded-lg"}),r.jsx("div",{className:"skeleton h-14 rounded-lg"}),r.jsx("div",{className:"skeleton h-14 rounded-lg"})]})]});if(!m||m.length===0){if((d==null?void 0:d.origin)==="source"){const O=fC((d==null?void 0:d.homepage)??null);return r.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-16 px-8","data-testid":"versions-empty-state-local",children:[r.jsx("div",{className:"text-[14px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"No published versions yet"}),r.jsx("div",{className:"text-[13px] text-center mb-5 max-w-md",style:{color:"var(--text-tertiary)",lineHeight:1.5},children:"This skill is local-only — the version history shown here is sourced from verified-skill.com. Submit your skill to start tracking versions and share it with others."}),r.jsx("a",{href:O,target:"_blank",rel:"noopener noreferrer",className:"btn btn-primary text-[12px]","data-testid":"versions-empty-state-cta",children:"Submit on verified-skill.com"})]})}return d!=null&&d.version?r.jsxs("div",{className:"p-5",children:[r.jsx("div",{className:"text-[14px] font-semibold mb-4",style:{color:"var(--text-primary)"},children:"Version History"}),r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"absolute left-3 top-0 bottom-0",style:{width:2,background:"var(--border-subtle)"}}),r.jsxs("div",{"data-testid":"version-row-local",className:"w-full text-left pl-8 pr-4 py-3 relative rounded-lg",style:{background:"transparent",border:"1px solid transparent"},children:[r.jsx("span",{className:"absolute left-1.5 top-4 rounded-full",style:{width:10,height:10,background:"var(--accent)",border:"2px solid var(--accent)"}}),r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:d.version}),r.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"LOCAL"}),r.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"})]})}),r.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"Local-only — this skill is not registered on verified-skill.com, so no upstream history is available."})]})]})]}):r.jsx("div",{className:"flex flex-col items-center justify-center h-full py-16","data-testid":"versions-empty-state-installed",children:r.jsx("div",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No version history available"})})}return r.jsxs("div",{className:"p-5",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Version History"}),r.jsxs("div",{className:"flex items-center gap-2",children:[$&&r.jsx("button",{onClick:ee,className:"btn btn-secondary text-[11px]",children:"View changes since installed"}),$&&A!=="done"&&(A==="error"?r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"text-[11px]",style:{color:"var(--red)"},children:D||"Update failed"}),r.jsx("button",{onClick:I,className:"btn btn-secondary text-[11px]",children:"Retry"})]}):r.jsx("button",{onClick:I,disabled:A!=="idle",className:"btn btn-primary text-[11px]",children:A==="idle"?`Update to ${U==null?void 0:U.version}`:A==="updating"?"Starting update...":A==="scanning"?"Scanning...":"Installing..."})),u>1&&r.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,")"]})]})]}),v&&!S&&r.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 ",v]}),r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"absolute left-3 top-0 bottom-0",style:{width:2,background:"var(--border-subtle)"}}),r.jsx("div",{className:"space-y-1",children:m.map(z=>{const O=Bg[z.certTier]||Bg.COMMUNITY,P=z.version===v||z.version===S,H=z.isInstalled;return r.jsxs("button",{onClick:()=>q(z.version),className:"w-full text-left pl-8 pr-4 py-3 relative rounded-lg transition-all duration-150",style:{background:P?"var(--accent-muted)":"transparent",border:P?"1px solid var(--accent)":"1px solid transparent",cursor:"pointer"},onMouseEnter:ae=>{P||(ae.currentTarget.style.background="var(--surface-1)")},onMouseLeave:ae=>{P||(ae.currentTarget.style.background="transparent")},children:[r.jsx("span",{className:"absolute left-1.5 top-4 rounded-full",style:{width:H?10:8,height:H?10:8,background:H?"var(--accent)":"var(--surface-3)",border:H?"2px solid var(--accent)":"2px solid var(--border-default)"}}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:z.version}),r.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:O.bg,color:O.text},children:Ay(z.certTier)}),H&&r.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"})]}),r.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:new Date(z.createdAt).toLocaleDateString()})]}),z.diffSummary&&r.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:yC(z.diffSummary,80)})]},z.version)})}),r.jsx("div",{ref:B,style:{height:1}})]}),T&&r.jsx("div",{className:"mt-4",children:r.jsx("div",{className:"skeleton h-48 rounded-xl"})}),w&&!T&&r.jsx("div",{className:"mt-4",children:r.jsx(Bf,{contentDiff:w.contentDiff,fromLabel:w.from,toLabel:w.to,diffSummary:w.diffSummary,renderContext:"inline",onRetry:()=>v&&S&&X(w.from,w.to)})})]})}function jC(t){const a=t.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!a)return{metadata:{},body:t};const s=a[1],o=a[2].trim(),c={},u=s.split(`
|
|
73
|
+
`);let d="",h=!1;for(const g of u){const m=g.match(/^[ \t]+([\w-]+):\s*(.*)$/);if(m&&d&&h){const b=m[1],S=m[2].trim();let k=c[d];if((typeof k!="object"||Array.isArray(k))&&(k={},c[d]=k),!S)k[b]=[];else{const w=S.match(/^\[(.+)\]$/);w?k[b]=w[1].split(",").map(C=>C.trim().replace(/^["']|["']$/g,"")).filter(Boolean):k[b]=S.replace(/^["']|["']$/g,"")}continue}const y=g.match(/^\s+-\s+(.+)$/);if(y&&d){h=!1;const b=c[d];Array.isArray(b)?b.push(y[1].trim().replace(/^["']|["']$/g,"")):c[d]=[y[1].trim().replace(/^["']|["']$/g,"")];continue}const v=g.match(/^([\w-]+):\s*(.*)$/);if(v){d=v[1];const b=v[2].trim();if(h=!1,!b){c[d]={},h=!0;continue}const S=b.match(/^\[(.+)\]$/);if(S){c[d]=S[1].split(",").map(k=>k.trim().replace(/^["']|["']$/g,"")).filter(Boolean);continue}c[d]=b.replace(/^["']|["']$/g,"")}}return{metadata:c,body:o}}function Zo(t){if(!t)return"";try{let a=t.replace(/^---\n[\s\S]*?\n---\n?/,""),s=SC(a);return s=s.replace(/```(\w*)\n([\s\S]*?)```/g,'<pre style="background:var(--surface-2);padding:0.75rem;border-radius:6px;overflow-x:auto;font-size:12px;line-height:1.5;margin:0.5rem 0;border:1px solid var(--border-subtle)"><code>$2</code></pre>'),s=s.replace(/^### (.+)$/gm,'<div style="font-weight:600;font-size:14px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),s=s.replace(/^## (.+)$/gm,'<div style="font-weight:700;font-size:15px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),s=s.replace(/^# (.+)$/gm,'<div style="font-weight:700;font-size:1rem;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),s=s.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer" style="color:var(--accent);text-decoration:underline">$1</a>'),s=s.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),s=s.replace(/\*([^*]+)\*/g,"<em>$1</em>"),s=s.replace(/`([^`]+)`/g,'<code style="background:var(--surface-3);padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em">$1</code>'),s=s.replace(/^- (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">• $1</div>'),s=s.replace(/^(\d+)\. (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">$1. $2</div>'),s=s.replace(/\n\n/g,'<div style="height:0.5rem"></div>'),s=s.replace(/\n/g,"<br/>"),s}catch{return`<pre style="white-space:pre-wrap;font-size:12px;line-height:1.5">${t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}</pre>`}}function SC(t){const a=t.split(`
|
|
74
|
+
`),s=[];let o=0;for(;o<a.length;)if(a[o].trim().startsWith("|")&&o+1<a.length&&a[o+1].trim().startsWith("|")&&/\|[\s-:]+\|/.test(a[o+1])){const c=Ig(a[o]);o+=2;const u=[];for(;o<a.length&&a[o].trim().startsWith("|");)u.push(Ig(a[o])),o++;const d='style="text-align:left;padding:0.4rem 0.6rem;font-weight:600;font-size:12px;color:var(--text-primary);border-bottom:1px solid var(--border-default)"',h='style="padding:0.4rem 0.6rem;font-size:12px;color:var(--text-secondary);border-bottom:1px solid var(--border-subtle)"';let g='<table style="width:100%;border-collapse:collapse;margin:0.5rem 0;border:1px solid var(--border-subtle);border-radius:6px;overflow:hidden">';g+="<thead><tr>";for(const m of c)g+=`<th ${d}>${m}</th>`;g+="</tr></thead><tbody>";for(const m of u){g+="<tr>";for(const y of m)g+=`<td ${h}>${y}</td>`;g+="</tr>"}g+="</tbody></table>",s.push(g)}else s.push(a[o]),o++;return s.join(`
|
|
75
|
+
`)}function Ig(t){return t.split("|").map(a=>a.trim()).filter(a=>a.length>0)}function Jo(t,a){const s=t.split(`
|
|
76
76
|
`),o=a.split(`
|
|
77
|
-
`);if(s.length>1e3||o.length>1e3)return[...s.map(y=>({type:"unchanged",content:y}))];const c=s.length,u=o.length,d=Array.from({length:c+1},()=>new Array(u+1).fill(0));for(let y=1;y<=c;y++)for(let v=1;v<=u;v++)s[y-1]===o[v-1]?d[y][v]=d[y-1][v-1]+1:d[y][v]=Math.max(d[y-1][v],d[y][v-1]);const h=[];let g=c,m=u;for(;g>0||m>0;)g>0&&m>0&&s[g-1]===o[m-1]?(h.push({type:"unchanged",content:s[g-1]}),g--,m--):m>0&&(g===0||d[g][m-1]>=d[g-1][m])?(h.push({type:"added",content:o[m-1]}),m--):(h.push({type:"removed",content:s[g-1]}),g--);return h.reverse()}function
|
|
78
|
-
`);ae=Q.pop()||"";for(const oe of Q)if(oe.startsWith("event: "))M=oe.slice(7).trim();else if(oe.startsWith("data: ")){try{const de=JSON.parse(oe.slice(6));M==="progress"?F(ve=>[...ve,{phase:de.phase,message:de.message,timestamp:Date.now()}]):M==="done"||M==="complete"?(k(de.improved),E(de.reasoning||""),b(Jo(de.original||s,de.improved)),u("diff_shown")):M==="error"&&(N(de.message||de.description||"Unknown error"),de.category&&_(de),u("open"))}catch{}M=""}}}catch(O){O.name!=="AbortError"&&(N(O.message),u("open"))}finally{L.current=null}}async function X(){B(!0);try{await we.applyImprovement(t,a,S),o(S),u("closed")}catch(z){N(z.message)}finally{B(!1)}}function ee(){u("closed"),b([]),k(""),E(""),N(null)}if(c==="closed")return r.jsxs("button",{onClick:()=>u("open"),className:"btn btn-secondary mb-5",disabled:!s,children:[r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),r.jsx("path",{d:"M2 17l10 5 10-5"}),r.jsx("path",{d:"M2 12l10 5 10-5"})]}),"Improve Skill"]});const I=U();return r.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden animate-fade-in",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[r.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:[r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),r.jsx("path",{d:"M2 17l10 5 10-5"}),r.jsx("path",{d:"M2 12l10 5 10-5"})]})}),r.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Skill Improvement"})]}),r.jsx("button",{onClick:ee,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:z=>{z.currentTarget.style.background="var(--surface-3)"},onMouseLeave:z=>{z.currentTarget.style.background="transparent"},children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),r.jsxs("div",{className:"px-5 py-4",children:[(c==="open"||c==="loading")&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-end gap-3 mb-4",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),r.jsx("select",{className:"input-field text-[12px] py-1.5",value:h,onChange:z=>{g(z.target.value);const O=d==null?void 0:d.providers.find(P=>P.id===z.target.value);O!=null&&O.models[0]&&y(O.models[0].id)},disabled:c==="loading",children:d==null?void 0:d.providers.filter(z=>z.available).map(z=>r.jsx("option",{value:z.id,children:z.label},z.id))})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),r.jsx("select",{className:"input-field text-[12px] py-1.5",value:m,onChange:z=>y(z.target.value),disabled:c==="loading",children:I==null?void 0:I.models.map(z=>r.jsx("option",{value:z.id,children:z.label},z.id))})]}),c==="loading"?r.jsx("button",{onClick:$,className:"btn btn-secondary flex-shrink-0",children:"Cancel"}):r.jsx("button",{onClick:q,className:"btn btn-primary flex-shrink-0",children:"Improve"})]}),c==="loading"&&D.length>0&&r.jsx("div",{className:"mt-3",children:r.jsx(ai,{entries:D,isRunning:!0})})]}),T&&r.jsx("div",{className:"mb-4",children:A?r.jsx(ec,{error:A,onRetry:q,onDismiss:()=>{N(null),_(null)}}):r.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:T})}),c==="diff_shown"&&r.jsxs(r.Fragment,{children:[w&&r.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:[r.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),w]}),r.jsx("div",{className:"rounded-lg overflow-hidden mb-4",style:{border:"1px solid var(--border-subtle)",maxHeight:"400px",overflowY:"auto"},children:v.map((z,O)=>r.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:z.type==="added"?"rgba(34,197,94,0.1)":z.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:z.type==="added"?"var(--green)":z.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:z.type==="added"?"3px solid var(--green)":z.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[r.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:z.type==="added"?"+":z.type==="removed"?"-":" "}),z.content]},O))}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:X,disabled:C,className:"btn btn-primary",children:C?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"spinner",style:{width:12,height:12}})," Applying..."]}):r.jsxs(r.Fragment,{children:[r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})})," Apply"]})}),r.jsx("button",{onClick:ee,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}const Ug={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"}},SC={remove:"var(--red)",modify:"#fbbf24",add:"var(--green)"};function kC({change:t,index:a,selected:s,onToggle:o,originalEval:c}){var v;const[u,d]=p.useState(!1),h=Ug[t.action]??Ug.add,g=SC[t.action]??"var(--border-subtle)",m=t.action==="remove"?(c==null?void 0:c.name)??`Eval #${t.evalId}`:((v=t.eval)==null?void 0:v.name)??"Unnamed",y=p.useCallback(()=>o(a),[o,a]);return r.jsxs("div",{className:"rounded-lg transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderLeft:`3px solid ${g}`,opacity:s?1:.5},children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[r.jsx("input",{type:"checkbox",checked:s,onChange:y,className:"flex-shrink-0",style:{accentColor:"var(--accent)"}}),r.jsx("span",{className:"pill text-[9px] font-bold flex-shrink-0",style:{background:h.bg,color:h.color,padding:"1px 6px"},children:h.label}),r.jsx("span",{className:"text-[12px] font-medium truncate",style:{color:"var(--text-primary)"},children:m}),r.jsx("span",{className:"text-[11px] truncate flex-1",style:{color:"var(--text-tertiary)"},children:t.reason}),r.jsx("button",{onClick:()=>d(!u),className:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:b=>{b.currentTarget.style.background="var(--surface-3)"},onMouseLeave:b=>{b.currentTarget.style.background="transparent"},children:r.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:u?"rotate(90deg)":"rotate(0)",transition:"transform 0.15s ease"},children:r.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),u&&r.jsxs("div",{className:"px-4 pb-3 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[t.action==="add"&&t.eval&&r.jsx(wC,{evalCase:t.eval}),t.action==="modify"&&t.eval&&c&&r.jsx(CC,{original:c,proposed:t.eval}),t.action==="remove"&&c&&r.jsx(EC,{evalCase:c})]})]})}function wC({evalCase:t}){var a;return r.jsxs("div",{className:"pt-2.5 space-y-2",children:[r.jsx(cf,{label:"Prompt",value:t.prompt}),r.jsx(cf,{label:"Expected",value:t.expected_output}),r.jsxs("div",{children:[r.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((a=t.assertions)==null?void 0:a.length)??0,")"]}),r.jsx("div",{className:"mt-1 space-y-1",children:(t.assertions??[]).map(s=>r.jsxs("div",{className:"text-[11px] flex items-start gap-1.5",style:{color:"var(--text-secondary)"},children:[r.jsx("span",{style:{color:"var(--green)"},children:"+"})," ",s.text]},s.id))})]})]})}function CC({original:t,proposed:a}){const s=[];t.name!==a.name&&s.push({label:"Name",old:t.name,new:a.name}),t.prompt!==a.prompt&&s.push({label:"Prompt",old:t.prompt,new:a.prompt}),t.expected_output!==a.expected_output&&s.push({label:"Expected",old:t.expected_output,new:a.expected_output});const o=t.assertions??[],c=a.assertions??[],u=new Set(o.map(m=>m.text)),d=new Set(c.map(m=>m.text)),h=c.filter(m=>!u.has(m.text)),g=o.filter(m=>!d.has(m.text));return r.jsxs("div",{className:"pt-2.5 space-y-2",children:[s.map(m=>r.jsxs("div",{children:[r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:m.label}),r.jsxs("div",{className:"mt-1 text-[11px] font-mono rounded p-2",style:{background:"var(--surface-1)"},children:[r.jsxs("div",{style:{color:"var(--red)",textDecoration:"line-through"},children:["- ",uf(m.old,120)]}),r.jsxs("div",{style:{color:"var(--green)"},children:["+ ",uf(m.new,120)]})]})]},m.label)),(h.length>0||g.length>0)&&r.jsxs("div",{children:[r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Assertions"}),r.jsxs("div",{className:"mt-1 space-y-0.5",children:[g.map(m=>r.jsxs("div",{className:"text-[11px]",style:{color:"var(--red)"},children:["- ",m.text]},m.id)),h.map(m=>r.jsxs("div",{className:"text-[11px]",style:{color:"var(--green)"},children:["+ ",m.text]},m.id))]})]}),s.length===0&&h.length===0&&g.length===0&&r.jsx("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"No visible field changes"})]})}function EC({evalCase:t}){var a;return r.jsxs("div",{className:"pt-2.5 space-y-2",style:{opacity:.7},children:[r.jsx(cf,{label:"Prompt",value:t.prompt}),r.jsxs("div",{children:[r.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((a=t.assertions)==null?void 0:a.length)??0,")"]}),r.jsx("div",{className:"mt-1 space-y-0.5",children:(t.assertions??[]).map(s=>r.jsx("div",{className:"text-[11px]",style:{color:"var(--red)",textDecoration:"line-through"},children:s.text},s.id))})]})]})}function cf({label:t,value:a}){return r.jsxs("div",{children:[r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:t}),r.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:uf(a,300)})]})}function uf(t,a){return t.length>a?t.slice(0,a)+"...":t}const Hg={remove:0,modify:1,add:2};function NC({changes:t,selections:a,currentEvals:s,onToggle:o,onSelectAll:c,onDeselectAll:u}){if(t.length===0)return null;const d=t.map((g,m)=>({change:g,originalIndex:m}));d.sort((g,m)=>(Hg[g.change.action]??2)-(Hg[m.change.action]??2));const h=Array.from(a.values()).filter(Boolean).length;return r.jsxs("div",{className:"mt-3 animate-fade-in",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"Test Case Changes"}),r.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",h,"/",t.length," selected)"]})]}),r.jsxs("div",{className:"flex gap-1.5",children:[r.jsx("button",{onClick:c,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--accent)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--accent-muted)"},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:"Select All"}),r.jsx("button",{onClick:u,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--surface-3)"},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:"Deselect All"})]})]}),r.jsx("div",{className:"space-y-1.5 overflow-auto",style:{maxHeight:240},children:d.map(({change:g,originalIndex:m})=>r.jsx(kC,{change:g,index:m,selected:a.get(m)??!1,onToggle:o,originalEval:g.evalId!=null?s.find(y=>y.id===g.evalId):void 0},m))})]})}function TC(){var z;const{state:t,dispatch:a,submitAiEdit:s,applyAiEdit:o,discardAiEdit:c,cancelAiEdit:u,toggleEvalChange:d,selectAllEvalChanges:h,deselectAllEvalChanges:g,retryEvalsSave:m}=Rn(),{aiEditLoading:y,aiEditResult:v,aiEditError:b,aiEditClassifiedError:S,aiEditProgress:k,aiEditEvalChanges:w,aiEditEvalSelections:E,aiEditEvalsRetry:T}=t,[N,A]=p.useState(""),{config:_}=$a(),[D,F]=p.useState("claude-cli"),[C,B]=p.useState("opus"),L=p.useRef(null);p.useEffect(()=>{var O;(O=L.current)==null||O.focus()},[]),p.useEffect(()=>{if(!_)return;_.providers.find(P=>P.id==="claude-cli"&&P.available)&&(F("claude-cli"),B("opus"))},[_]);const U=_==null?void 0:_.providers.find(O=>O.id===D&&O.available),$=p.useCallback(()=>{const O=N.trim();!O||y||s(O,D,C)},[N,y,s,D,C]),q=p.useCallback(O=>{O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),$()),O.key==="Escape"&&(O.preventDefault(),y?u():c())},[$,y,u,c]),X=p.useCallback(()=>{a({type:"CLOSE_AI_EDIT"}),a({type:"OPEN_AI_EDIT"})},[a]),ee=v?Jo(t.skillContent,v.improved):[],I=((z=t.evals)==null?void 0:z.evals)??[];return r.jsxs("div",{className:"animate-fade-in",style:{background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[r.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:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M15 4V2"}),r.jsx("path",{d:"M15 16v-2"}),r.jsx("path",{d:"M8 9h2"}),r.jsx("path",{d:"M20 9h2"}),r.jsx("path",{d:"M17.8 11.8L19 13"}),r.jsx("path",{d:"M15 9h.01"}),r.jsx("path",{d:"M17.8 6.2L19 5"}),r.jsx("path",{d:"M11 6.2L9.7 5"}),r.jsx("path",{d:"M3 21l9-9"})]})}),r.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Edit"}),r.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:"Describe what to change — Enter to submit, Esc to dismiss"})]}),r.jsx("button",{onClick:c,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:O=>{O.currentTarget.style.background="var(--surface-3)"},onMouseLeave:O=>{O.currentTarget.style.background="transparent"},children:r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),r.jsxs("div",{className:"px-4 py-3",children:[!v&&r.jsxs(r.Fragment,{children:[r.jsx("textarea",{ref:L,value:N,onChange:O=>A(O.target.value),onKeyDown:q,placeholder:"e.g., Add an error handling section...",disabled:y,rows:4,className:"w-full resize-y outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",borderRadius:6,padding:"10px 12px",fontSize:12.5,lineHeight:1.5,fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",minHeight:96,maxHeight:240}}),r.jsxs("div",{className:"flex items-end gap-2.5 mt-2",children:[r.jsxs("div",{style:{minWidth:200},children:[r.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),r.jsx("select",{className:"input-field text-[11px] py-1",value:D,onChange:O=>{F(O.target.value);const P=_==null?void 0:_.providers.find(H=>H.id===O.target.value);P!=null&&P.models[0]&&B(P.models[0].id)},disabled:y,style:{width:"100%"},children:_==null?void 0:_.providers.filter(O=>O.available).map(O=>r.jsx("option",{value:O.id,children:O.label},O.id))})]}),r.jsxs("div",{style:{minWidth:200},children:[r.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Model"}),r.jsx("select",{className:"input-field text-[11px] py-1",value:C,onChange:O=>B(O.target.value),disabled:y,style:{width:"100%"},children:U==null?void 0:U.models.map(O=>r.jsx("option",{value:O.id,children:O.label},O.id))})]}),r.jsx("div",{className:"flex-1"}),y?r.jsx("button",{onClick:u,className:"btn btn-secondary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Cancel"}):r.jsx("button",{onClick:$,disabled:!N.trim(),className:"btn btn-primary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Submit"})]}),y&&k.length>0&&r.jsx("div",{className:"mt-2.5",children:r.jsx(ai,{entries:k,isRunning:!0})})]}),b&&r.jsx("div",{className:"mt-3",children:S?r.jsx(ec,{error:S,onRetry:X,onDismiss:c}):r.jsx("div",{className:"px-3 py-2.5 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:b})}),v&&r.jsxs("div",{className:"animate-fade-in",children:[v.reasoning&&r.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:[r.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),v.reasoning]}),r.jsx("div",{className:"mb-1",children:r.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"})}),r.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:300,overflowY:"auto"},children:ee.map((O,P)=>r.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:[r.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:O.type==="added"?"+":O.type==="removed"?"-":" "}),O.content]},P))}),r.jsx(NC,{changes:w,selections:E,currentEvals:I,onToggle:d,onSelectAll:h,onDeselectAll:g}),T&&r.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:[r.jsx("span",{children:"Test case save failed. SKILL.md was saved successfully."}),r.jsx("button",{onClick:m,className:"btn text-[11px]",style:{background:"rgba(251,191,36,0.2)",color:"#fbbf24",padding:"3px 10px"},children:"Retry Save"})]}),r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsxs("button",{onClick:o,className:"btn btn-primary text-[11px]",style:{padding:"5px 12px"},children:[r.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),r.jsx("button",{onClick:c,className:"btn btn-secondary text-[11px]",style:{padding:"5px 12px"},children:"Discard"}),r.jsx("button",{onClick:X,className:"btn btn-ghost text-[11px]",style:{padding:"5px 12px"},children:"Try Again"})]})]})]})]})}function RC(t,a){const[s,o]=p.useState([]),[c,u]=p.useState("SKILL.md"),[d,h]=p.useState(null),[g,m]=p.useState(!1),[y,v]=p.useState(null),b=p.useCallback(async()=>{try{const w=await we.getSkillFiles(t,a);o(w.files)}catch{o([])}},[t,a]);p.useEffect(()=>{u("SKILL.md"),h(null),v(null),b()},[t,a,b]);const S=p.useCallback(async w=>{if(u(w),w==="SKILL.md"){h(null),v(null);return}m(!0),v(null);try{const E=await we.getSkillFile(t,a,w);h(E)}catch(E){v(`Unable to open file: ${E.message}`),h(null)}finally{m(!1)}},[t,a]),k=p.useCallback(()=>{b()},[b]);return{files:s,activeFile:c,secondaryContent:d,loading:g,error:y,selectFile:S,refresh:k,isSkillMd:c==="SKILL.md"}}function AC(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function MC(t){const a=[],s=new Map;for(const o of t){const c=o.path.split("/"),d={name:c[c.length-1],path:o.path,type:o.type,size:o.size,children:[]};s.set(o.path,d)}for(const o of t){const c=o.path.split("/");if(c.length===1){const u=s.get(o.path);u&&a.push(u)}else{const u=c.slice(0,-1).join("/"),d=s.get(u),h=s.get(o.path);d&&h&&d.children.push(h)}}return a}function Ry({expanded:t}){return r.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:t?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s"},children:r.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Ay(){return r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:r.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 LC(){return r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),r.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function zC(){return r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("polyline",{points:"23 4 23 10 17 10"}),r.jsx("polyline",{points:"1 20 1 14 7 14"}),r.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 My({node:t,depth:a,activeFile:s,onSelect:o}){const[c,u]=p.useState(!0),d=t.path===s;return t.type==="dir"?r.jsxs("div",{children:[r.jsxs("button",{onClick:()=>u(!c),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+a*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:[r.jsx(Ry,{expanded:c}),r.jsx(Ay,{}),r.jsxs("span",{children:[t.name,"/"]})]}),c&&t.children.map(h=>r.jsx(My,{node:h,depth:a+1,activeFile:s,onSelect:o},h.path))]}):r.jsxs("button",{onClick:()=>o(t.path),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+a*14}px`,paddingTop:2,paddingBottom:2,background:d?"var(--accent-muted)":"none",border:"none",cursor:"pointer",color:d?"var(--accent)":"var(--text-tertiary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left",borderRadius:3},children:[r.jsx("span",{style:{width:10}}),r.jsx(LC,{}),r.jsx("span",{style:{flex:1},children:t.name}),r.jsx("span",{style:{fontSize:9,color:"var(--text-tertiary)",marginRight:4,whiteSpace:"nowrap"},children:AC(t.size)})]})}function DC({files:t,activeFile:a,onSelect:s,onRefresh:o}){const[c,u]=p.useState(!1),d=p.useMemo(()=>MC(t),[t]);return r.jsxs("div",{style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 8px",cursor:"pointer",userSelect:"none"},onClick:()=>u(!c),children:[r.jsx(Ry,{expanded:c}),r.jsx(Ay,{}),r.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a}),r.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:r.jsx(zC,{})})]}),c&&r.jsx("div",{style:{maxHeight:240,overflowY:"auto",padding:"2px 4px 4px"},children:d.length===0?r.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 8px"},children:"No files found"}):d.map(h=>r.jsx(My,{node:h,depth:0,activeFile:a,onSelect:s},h.path))})]})}function jo(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function _C(t){try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}function OC(t){const a=t.toLowerCase();return a.endsWith(".json")?"json":a.endsWith(".md")?"md":"other"}function $g({content:t}){return r.jsx("textarea",{readOnly:!0,value:t,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 Vg({content:t,fileType:a}){if(a==="json"){const s=_C(t);return r.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:s})}return a==="md"?r.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:Zo(t)}}):r.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:t})}function Pg(t){try{return JSON.stringify(JSON.parse(t),null,2).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"([^"\\]|\\.)*"\s*:/g,s=>`<span style="color:#6383ff">${s}</span>`).replace(/:\s*"([^"\\]|\\.)*"/g,s=>`<span style="color:#22c55e">${s.slice(0,2)}<span style="color:#22c55e">${s.slice(2)}</span></span>`).replace(/:\s*(-?\d+\.?\d*)/g,(s,o)=>`: <span style="color:#fb923c">${o}</span>`).replace(/:\s*(true|false|null)/g,(s,o)=>`: <span style="color:#a855f7">${o}</span>`)}catch{return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}}function BC({file:t,loading:a,error:s,viewMode:o,plugin:c,skill:u,onSaved:d,onDirtyChange:h}){const[g,m]=p.useState(o),[y,v]=p.useState(!1),[b,S]=p.useState(""),[k,w]=p.useState(!1),[E,T]=p.useState(null),N=o!==g?o:g;p.useEffect(()=>{h==null||h(y)},[y,h]);const A=p.useCallback(()=>{(t==null?void 0:t.content)!=null&&(S(t.content),v(!0))},[t]),_=p.useCallback(()=>{v(!1)},[]),D=p.useCallback(async()=>{if(!(!c||!u||!t)){w(!0);try{await we.saveSkillFile(c,u,t.path,b),T("Saved"),v(!1),d==null||d(),setTimeout(()=>T(null),2e3)}catch(B){T(`Save failed: ${B.message}`),setTimeout(()=>T(null),3e3)}finally{w(!1)}}},[c,u,t,b,d]);if(p.useEffect(()=>{if(!y)return;const B=L=>{(L.ctrlKey||L.metaKey)&&L.key==="s"&&(L.preventDefault(),D())};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[y,D]),a)return r.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:"Loading…"});if(s)return r.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:r.jsxs("div",{style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"16px 20px",maxWidth:400,textAlign:"center"},children:[r.jsx("div",{style:{fontSize:13,color:"var(--text-primary)",fontWeight:600,marginBottom:6},children:"Unable to open file"}),r.jsx("div",{style:{fontSize:12,color:"var(--text-tertiary)"},children:s})]})});if(!t)return null;if(t.binary)return r.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:["Binary file (",jo(t.size),") — cannot be displayed"]});const F=t.content??"",C=OC(t.path);return r.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[t.truncated&&r.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 ",jo(512*1024)," — ",jo(t.size)," total"]}),r.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(B=>r.jsx("button",{onClick:()=>m(B),style:{padding:"2px 8px",fontSize:11,background:N===B?"var(--accent-muted)":"none",color:N===B?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer",textTransform:"capitalize"},children:B},B)),r.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",display:"flex",alignItems:"center",gap:6},children:[jo(t.size),c&&u&&!t.binary&&!y&&r.jsx("button",{onClick:A,style:{padding:"1px 6px",fontSize:10,background:"var(--accent-muted)",color:"var(--accent)",border:"none",borderRadius:3,cursor:"pointer"},children:"Edit"}),y&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:D,disabled:k,style:{padding:"1px 6px",fontSize:10,background:"var(--accent)",color:"#fff",border:"none",borderRadius:3,cursor:"pointer",opacity:k?.6:1},children:k?"Saving...":"Save"}),r.jsx("button",{onClick:_,style:{padding:"1px 6px",fontSize:10,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer"},children:"Cancel"})]})]})]}),E&&r.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}),r.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:y?r.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:[r.jsx("textarea",{value:b,onChange:B=>S(B.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}}),r.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:[r.jsx("span",{style:{flex:1,fontSize:11,color:"var(--text-tertiary)"},children:"Unsaved changes"}),r.jsx("button",{onClick:D,disabled:k,style:{padding:"3px 12px",fontSize:11,background:"var(--accent)",color:"#fff",border:"none",borderRadius:4,cursor:"pointer",opacity:k?.6:1},children:k?"Saving...":"Save"}),r.jsx("button",{onClick:_,style:{padding:"3px 12px",fontSize:11,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer"},children:"Cancel"})]})]}):N==="split"&&C!=="other"?r.jsxs(r.Fragment,{children:[r.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",borderRight:"1px solid var(--border-subtle)"},children:r.jsx($g,{content:F})}),r.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:C==="json"?r.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:Pg(F)}}):r.jsx(Vg,{content:F,fileType:C})})]}):N==="preview"&&C!=="other"?C==="json"?r.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:Pg(F)}}):r.jsx(Vg,{content:F,fileType:C}):r.jsx($g,{content:F})})]})}const IC=/^git@github\.com:([^/]+)\/(.+?)(?:\.git)?$/,UC=/^https:\/\/github\.com\/([^/]+)\/(.+?)(?:\.git)?$/;function HC(t){const a=t.trim();if(!a)throw new Error("normalizeRemoteUrl: empty input");let s=a.match(IC);if(s)return`https://github.com/${s[1]}/${s[2]}`;if(s=a.match(UC),s)return`https://github.com/${s[1]}/${s[2]}`;throw new Error(`normalizeRemoteUrl: unrecognized remote URL: ${t}`)}function Ly(t){const a=HC(t);return`https://verified-skill.com/submit?repo=${encodeURIComponent(a)}`}function Fg(t,a){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:t,severity:a}}))}function $C({remoteUrl:t,fileCount:a,provider:s,model:o,onClose:c}){const[u,d]=p.useState(""),[h,g]=p.useState(!1),[m,y]=p.useState(!1),[v,b]=p.useState(null),S=p.useCallback(async()=>{g(!0),b(null);try{const E=await we.gitCommitMessage({provider:s,model:o});d(E.message)}catch(E){const T=E instanceof Error?E.message:String(E);b(T)}finally{g(!1)}},[s,o]);p.useEffect(()=>{S()},[]);const k=p.useCallback(async()=>{const E=u.trim();if(!(!E||m)){y(!0);try{const T=await we.gitPublish({commitMessage:E}),N=T.remoteUrl??t,A=Ly(N);window.open(A,"_blank","noopener,noreferrer");const _=(T.commitSha??"").slice(0,7),D=T.branch??"";Fg(`Opening verified-skill.com — ${_} on ${D}`,"info"),c()}catch(T){const N=T instanceof Error?T.message:String(T),A=N.length>200?N.slice(0,200)+"…":N;Fg(`Publish failed: ${A}`,"error")}finally{y(!1)}}},[u,m,t,c]),w=u.trim().length>0&&!m&&!h;return r.jsxs("div",{role:"dialog","aria-label":"Publish",style:{position:"fixed",right:16,bottom:16,width:420,maxWidth:"calc(100vw - 32px)",background:"var(--bg-elevated, #1a1a1a)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:14,boxShadow:"0 8px 32px rgba(0,0,0,0.4)",zIndex:1e3,fontSize:12,color:"var(--text-primary)"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[r.jsx("strong",{style:{fontSize:13},children:"Publish"}),r.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[a," file",a===1?"":"s"," changed"]})]}),r.jsx("label",{htmlFor:"commit-message",style:{display:"block",marginBottom:4,color:"var(--text-secondary)"},children:"Commit message"}),r.jsx("textarea",{id:"commit-message",value:u,onChange:E=>d(E.target.value),rows:5,disabled:h,placeholder:h?"Generating with AI…":"Enter a commit message",style:{width:"100%",background:"var(--bg-subtle)",border:"1px solid var(--border-subtle)",borderRadius:4,padding:"6px 8px",fontFamily:"var(--font-mono, monospace)",fontSize:12,color:"var(--text-primary)",resize:"vertical"}}),v&&r.jsxs("div",{style:{color:"var(--error, #f87171)",marginTop:6,fontSize:11},children:["AI generation failed: ",v]}),r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:10},children:[r.jsx("button",{type:"button","aria-label":"Regenerate",onClick:S,disabled:h||m,className:"btn btn-ghost text-[11px]",style:{padding:"4px 10px"},children:h?"Generating…":"Regenerate"}),r.jsxs("div",{style:{display:"flex",gap:6},children:[r.jsx("button",{type:"button","aria-label":"Cancel",onClick:c,disabled:m,className:"btn btn-ghost text-[11px]",style:{padding:"4px 10px"},children:"Cancel"}),r.jsx("button",{type:"button","aria-label":"Commit & Push",onClick:k,disabled:!w,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:m?"Publishing…":"Commit & Push"})]})]})]})}function Gg(t,a){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:t,severity:a}}))}function VC({remoteUrl:t,provider:a,model:s}){const[o,c]=p.useState(!1),[u,d]=p.useState(!1),[h,g]=p.useState(0),m=p.useCallback(async()=>{if(!(o||u)){c(!0);try{let v=!1,b=0;try{const N=await we.gitDiff();v=!!N.hasChanges,b=N.fileCount??0}catch{}if(v){g(b),d(!0);return}const S=await we.gitPublish(),k=S.remoteUrl??t,w=Ly(k);window.open(w,"_blank","noopener,noreferrer");const E=(S.commitSha??"").slice(0,7),T=S.branch??"";Gg(`Opening verified-skill.com — ${E} on ${T}`,"info")}catch(v){const b=v instanceof Error?v.message:String(v),S=b.length>200?b.slice(0,200)+"…":b;Gg(`Publish failed: ${S}`,"error")}finally{c(!1)}}},[o,u,t]),y=p.useCallback(()=>d(!1),[]);return r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button","aria-label":"Publish",onClick:m,disabled:o,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},title:"Push committed changes and open verified-skill.com to submit",children:o?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Publishing…"]}):"Publish"}),u&&r.jsx($C,{remoteUrl:t,fileCount:h,provider:a,model:s,onClose:y})]})}const PC={hasRemote:!1,remoteUrl:null,branch:null,loading:!0,error:null};function FC(){const[t,a]=p.useState(PC);return p.useEffect(()=>{let s=!1;return we.gitRemote().then(o=>{s||a({hasRemote:!!o.hasRemote,remoteUrl:o.remoteUrl??null,branch:o.branch??null,loading:!1,error:null})}).catch(o=>{s||a({hasRemote:!1,remoteUrl:null,branch:null,loading:!1,error:o instanceof Error?o:new Error(String(o))})}),()=>{s=!0}},[]),t}function GC({size:t=15}){return r.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("polyline",{points:"16 18 22 12 16 6"}),r.jsx("polyline",{points:"8 6 2 12 8 18"})]})}function WC({size:t=15}){return r.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),r.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})}function qC({size:t=15}){return r.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),r.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function YC({size:t=15}){return r.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M15 4V2"}),r.jsx("path",{d:"M15 16v-2"}),r.jsx("path",{d:"M8 9h2"}),r.jsx("path",{d:"M20 9h2"}),r.jsx("path",{d:"M17.8 11.8L19 13"}),r.jsx("path",{d:"M15 9h.01"}),r.jsx("path",{d:"M17.8 6.2L19 5"}),r.jsx("path",{d:"M11 6.2L9.7 5"}),r.jsx("path",{d:"M3 21l9-9"})]})}function zd({size:t=15}){return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M12 3l1.5 5.5L19 10l-5.5 1.5L12 17l-1.5-5.5L5 10l5.5-1.5L12 3z"})})}function KC(){const{state:t,dispatch:a,saveContent:s,isReadOnly:o}=Rn(),{plugin:c,skill:u,skillContent:d,isDirty:h,improveTarget:g,aiEditOpen:m}=t,[y,v]=p.useState("split"),[b,S]=p.useState(!1),k=p.useRef(null),[w,E]=p.useState(!1),[T,N]=p.useState(""),[A,_]=p.useState(!1),[D,F]=p.useState(null),[C,B]=p.useState([]),[L,U]=p.useState([]),[$,q]=p.useState(null),X=p.useRef(null),{config:ee}=$a(),I=FC(),{files:z,activeFile:O,secondaryContent:P,loading:H,error:ae,selectFile:M,refresh:Y,isSkillMd:W}=RC(c??"",u??""),[Q,oe]=p.useState(!1),de=p.useCallback(ye=>{Q&&!window.confirm("You have unsaved changes. Discard?")||M(ye)},[Q,M]);p.useEffect(()=>()=>{var ye;(ye=X.current)==null||ye.abort()},[]);const{metadata:ve,body:ce}=vC(d),je=ve["allowed-tools"],Re=Array.isArray(je)?je:typeof je=="string"?[je]:[],Oe=ve.name,le=ve.description,he=ve.metadata,pe=typeof he=="object"&&!Array.isArray(he)?he:null,xe=ve.version||(pe==null?void 0:pe.version),be=ve.tags||(pe==null?void 0:pe.tags),Be=Array.isArray(be)?be:typeof be=="string"?be.split(",").map(ye=>ye.trim()).filter(Boolean):[],Ue=new Set(["name","description","metadata","allowed-tools","version","tags"]),lt=Object.entries(ve).filter(([ye])=>!Ue.has(ye)),Ct=p.useCallback(async()=>{S(!0),await s(),S(!1)},[s]),gt=p.useCallback(ye=>{(ye.ctrlKey||ye.metaKey)&&ye.key==="s"&&(ye.preventDefault(),ye.stopPropagation(),h&&Ct()),(ye.ctrlKey||ye.metaKey)&&ye.key==="k"&&(ye.preventDefault(),ye.stopPropagation(),a({type:m?"CLOSE_AI_EDIT":"OPEN_AI_EDIT"}))},[h,Ct,m,a]),Tt=p.useCallback(async()=>{var ot,Wt;if(!T.trim())return;(ot=X.current)==null||ot.abort();const ye=new AbortController;X.current=ye,_(!0),q(null),U([]),F(null),B([]);try{const Kt=(ee==null?void 0:ee.provider)||"claude-cli",An=(ee==null?void 0:ee.model)||"sonnet",Et=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:T,provider:Kt,model:An}),signal:ye.signal});if(!Et.ok||!Et.body){let Wn=`HTTP ${Et.status}`;try{const tr=await Et.json();tr.error&&(Wn=tr.error)}catch{}throw new Error(Wn)}const Mn=Et.body.getReader(),Ut=new TextDecoder;let Rt="",ct="";for(;;){const{done:Wn,value:tr}=await Mn.read();if(Wn)break;Rt+=Ut.decode(tr,{stream:!0});const da=Rt.split(`
|
|
77
|
+
`);if(s.length>1e3||o.length>1e3)return[...s.map(y=>({type:"unchanged",content:y}))];const c=s.length,u=o.length,d=Array.from({length:c+1},()=>new Array(u+1).fill(0));for(let y=1;y<=c;y++)for(let v=1;v<=u;v++)s[y-1]===o[v-1]?d[y][v]=d[y-1][v-1]+1:d[y][v]=Math.max(d[y-1][v],d[y][v-1]);const h=[];let g=c,m=u;for(;g>0||m>0;)g>0&&m>0&&s[g-1]===o[m-1]?(h.push({type:"unchanged",content:s[g-1]}),g--,m--):m>0&&(g===0||d[g][m-1]>=d[g-1][m])?(h.push({type:"added",content:o[m-1]}),m--):(h.push({type:"removed",content:s[g-1]}),g--);return h.reverse()}function kC(t,a){if(a&&new Set(["generating","comparing","judging","judging_assertion","preparing","parsing","generating_skill","generating_baseline","scoring","action_items"]).has(t))return r.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 r.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{background:o.has(t)?"var(--accent)":"var(--green)"}})}function ai({entries:t,isRunning:a}){const[s,o]=p.useState(!1),c=p.useRef(null);return p.useEffect(()=>{c.current&&!s&&(c.current.scrollTop=c.current.scrollHeight)},[t,s]),t.length===0&&!a?null:r.jsxs("div",{className:"mt-2 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[r.jsxs("button",{onClick:()=>o(!s),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:u=>{u.currentTarget.style.color="var(--text-primary)"},onMouseLeave:u=>{u.currentTarget.style.color="var(--text-tertiary)"},children:[r.jsxs("span",{className:"flex items-center gap-2",children:[a&&r.jsx("div",{className:"spinner",style:{width:10,height:10}}),"Progress Log (",t.length,")"]}),r.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{transform:s?"rotate(0)":"rotate(180deg)",transition:"transform 0.2s ease"},children:r.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),!s&&r.jsx("div",{ref:c,className:"px-3 pb-3 space-y-1 max-h-48 overflow-y-auto",children:t.map((u,d)=>{const h=d===t.length-1&&a,g=d===0?"0s":`+${((u.timestamp-t[0].timestamp)/1e3).toFixed(1)}s`;return r.jsxs("div",{className:"flex items-center gap-2 text-[11px] animate-fade-in",style:{opacity:h?1:.7},children:[kC(u.phase,h),r.jsx("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)",width:40},children:g}),r.jsx("span",{style:{color:h?"var(--text-primary)":"var(--text-secondary)"},children:u.message}),u.current!=null&&u.total!=null&&r.jsxs("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)"},children:["[",u.current,"/",u.total,"]"]})]},d)})})]})}const Ug={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 ec({error:t,onRetry:a,onDismiss:s}){const[o,c]=p.useState(null),u=p.useRef(null);p.useEffect(()=>(t.category==="rate_limit"&&t.retryAfterMs?c(Math.ceil(t.retryAfterMs/1e3)):c(null),()=>{u.current&&clearInterval(u.current)}),[t]),p.useEffect(()=>{if(!(o==null||o<=0))return u.current=setInterval(()=>{c(g=>g==null||g<=1?(u.current&&clearInterval(u.current),0):g-1)},1e3),()=>{u.current&&clearInterval(u.current)}},[o!=null&&o>0]);const d=Ug[t.category]||Ug.unknown,h=o!=null&&o>0;return r.jsxs("div",{className:"rounded-lg overflow-hidden animate-fade-in",style:{border:`1px solid color-mix(in srgb, ${d.color} 30%, transparent)`,background:`color-mix(in srgb, ${d.color} 6%, var(--surface-1))`},children:[r.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{style:{fontSize:14},children:d.icon}),r.jsx("span",{className:"text-[12px] font-semibold",style:{color:d.color},children:t.title})]}),s&&r.jsx("button",{onClick:s,className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)"},children:r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),r.jsxs("div",{className:"px-3.5 pb-3",children:[r.jsx("p",{className:"text-[11.5px] mb-1.5",style:{color:"var(--text-secondary)"},children:t.description}),r.jsx("p",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:t.hint}),(a||o!=null)&&r.jsx("div",{className:"flex items-center gap-2 mt-2.5",children:a&&r.jsx("button",{onClick:a,disabled:h,className:"btn btn-secondary text-[11px]",style:{padding:"4px 10px",opacity:h?.5:1},children:h?`Retry in ${o}s`:"Retry"})})]})]})}function wC({plugin:t,skill:a,skillContent:s,onApplied:o}){const[c,u]=p.useState("closed"),{config:d}=$a(),[h,g]=p.useState("claude-cli"),[m,y]=p.useState("opus"),[v,b]=p.useState([]),[S,k]=p.useState(""),[w,C]=p.useState(""),[T,N]=p.useState(null),[A,_]=p.useState(null),[D,F]=p.useState([]),[E,B]=p.useState(!1),L=p.useRef(null);p.useEffect(()=>{if(!d)return;d.providers.find(O=>O.id==="claude-cli"&&O.available)&&(g("claude-cli"),y("opus"))},[d]),p.useEffect(()=>()=>{var z;(z=L.current)==null||z.abort()},[]);function U(){return d==null?void 0:d.providers.find(z=>z.id===h&&z.available)}const $=p.useCallback(()=>{var z;(z=L.current)==null||z.abort(),u("open")},[]);async function q(){u("loading"),N(null),_(null),F([]);const z=new AbortController;L.current=z;try{const O=await fetch(`/api/skills/${encodeURIComponent(t)}/${encodeURIComponent(a)}/improve?sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:h,model:m}),signal:z.signal});if(!O.ok||!O.body){let Y=`HTTP ${O.status}`;try{const W=await O.json();W.error&&(Y=W.error)}catch{}throw new Error(Y)}const P=O.body.getReader(),H=new TextDecoder;let ae="",M="";for(;;){const{done:Y,value:W}=await P.read();if(Y)break;ae+=H.decode(W,{stream:!0});const Q=ae.split(`
|
|
78
|
+
`);ae=Q.pop()||"";for(const oe of Q)if(oe.startsWith("event: "))M=oe.slice(7).trim();else if(oe.startsWith("data: ")){try{const de=JSON.parse(oe.slice(6));M==="progress"?F(ve=>[...ve,{phase:de.phase,message:de.message,timestamp:Date.now()}]):M==="done"||M==="complete"?(k(de.improved),C(de.reasoning||""),b(Jo(de.original||s,de.improved)),u("diff_shown")):M==="error"&&(N(de.message||de.description||"Unknown error"),de.category&&_(de),u("open"))}catch{}M=""}}}catch(O){O.name!=="AbortError"&&(N(O.message),u("open"))}finally{L.current=null}}async function X(){B(!0);try{await we.applyImprovement(t,a,S),o(S),u("closed")}catch(z){N(z.message)}finally{B(!1)}}function ee(){u("closed"),b([]),k(""),C(""),N(null)}if(c==="closed")return r.jsxs("button",{onClick:()=>u("open"),className:"btn btn-secondary mb-5",disabled:!s,children:[r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),r.jsx("path",{d:"M2 17l10 5 10-5"}),r.jsx("path",{d:"M2 12l10 5 10-5"})]}),"Improve Skill"]});const I=U();return r.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden animate-fade-in",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[r.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:[r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),r.jsx("path",{d:"M2 17l10 5 10-5"}),r.jsx("path",{d:"M2 12l10 5 10-5"})]})}),r.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Skill Improvement"})]}),r.jsx("button",{onClick:ee,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:z=>{z.currentTarget.style.background="var(--surface-3)"},onMouseLeave:z=>{z.currentTarget.style.background="transparent"},children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),r.jsxs("div",{className:"px-5 py-4",children:[(c==="open"||c==="loading")&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-end gap-3 mb-4",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),r.jsx("select",{className:"input-field text-[12px] py-1.5",value:h,onChange:z=>{g(z.target.value);const O=d==null?void 0:d.providers.find(P=>P.id===z.target.value);O!=null&&O.models[0]&&y(O.models[0].id)},disabled:c==="loading",children:d==null?void 0:d.providers.filter(z=>z.available).map(z=>r.jsx("option",{value:z.id,children:z.label},z.id))})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),r.jsx("select",{className:"input-field text-[12px] py-1.5",value:m,onChange:z=>y(z.target.value),disabled:c==="loading",children:I==null?void 0:I.models.map(z=>r.jsx("option",{value:z.id,children:z.label},z.id))})]}),c==="loading"?r.jsx("button",{onClick:$,className:"btn btn-secondary flex-shrink-0",children:"Cancel"}):r.jsx("button",{onClick:q,className:"btn btn-primary flex-shrink-0",children:"Improve"})]}),c==="loading"&&D.length>0&&r.jsx("div",{className:"mt-3",children:r.jsx(ai,{entries:D,isRunning:!0})})]}),T&&r.jsx("div",{className:"mb-4",children:A?r.jsx(ec,{error:A,onRetry:q,onDismiss:()=>{N(null),_(null)}}):r.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:T})}),c==="diff_shown"&&r.jsxs(r.Fragment,{children:[w&&r.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:[r.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),w]}),r.jsx("div",{className:"rounded-lg overflow-hidden mb-4",style:{border:"1px solid var(--border-subtle)",maxHeight:"400px",overflowY:"auto"},children:v.map((z,O)=>r.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:z.type==="added"?"rgba(34,197,94,0.1)":z.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:z.type==="added"?"var(--green)":z.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:z.type==="added"?"3px solid var(--green)":z.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[r.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:z.type==="added"?"+":z.type==="removed"?"-":" "}),z.content]},O))}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:X,disabled:E,className:"btn btn-primary",children:E?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"spinner",style:{width:12,height:12}})," Applying..."]}):r.jsxs(r.Fragment,{children:[r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})})," Apply"]})}),r.jsx("button",{onClick:ee,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}const Hg={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"}},CC={remove:"var(--red)",modify:"#fbbf24",add:"var(--green)"};function EC({change:t,index:a,selected:s,onToggle:o,originalEval:c}){var v;const[u,d]=p.useState(!1),h=Hg[t.action]??Hg.add,g=CC[t.action]??"var(--border-subtle)",m=t.action==="remove"?(c==null?void 0:c.name)??`Eval #${t.evalId}`:((v=t.eval)==null?void 0:v.name)??"Unnamed",y=p.useCallback(()=>o(a),[o,a]);return r.jsxs("div",{className:"rounded-lg transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderLeft:`3px solid ${g}`,opacity:s?1:.5},children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[r.jsx("input",{type:"checkbox",checked:s,onChange:y,className:"flex-shrink-0",style:{accentColor:"var(--accent)"}}),r.jsx("span",{className:"pill text-[9px] font-bold flex-shrink-0",style:{background:h.bg,color:h.color,padding:"1px 6px"},children:h.label}),r.jsx("span",{className:"text-[12px] font-medium truncate",style:{color:"var(--text-primary)"},children:m}),r.jsx("span",{className:"text-[11px] truncate flex-1",style:{color:"var(--text-tertiary)"},children:t.reason}),r.jsx("button",{onClick:()=>d(!u),className:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:b=>{b.currentTarget.style.background="var(--surface-3)"},onMouseLeave:b=>{b.currentTarget.style.background="transparent"},children:r.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:u?"rotate(90deg)":"rotate(0)",transition:"transform 0.15s ease"},children:r.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),u&&r.jsxs("div",{className:"px-4 pb-3 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[t.action==="add"&&t.eval&&r.jsx(NC,{evalCase:t.eval}),t.action==="modify"&&t.eval&&c&&r.jsx(TC,{original:c,proposed:t.eval}),t.action==="remove"&&c&&r.jsx(RC,{evalCase:c})]})]})}function NC({evalCase:t}){var a;return r.jsxs("div",{className:"pt-2.5 space-y-2",children:[r.jsx(uf,{label:"Prompt",value:t.prompt}),r.jsx(uf,{label:"Expected",value:t.expected_output}),r.jsxs("div",{children:[r.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((a=t.assertions)==null?void 0:a.length)??0,")"]}),r.jsx("div",{className:"mt-1 space-y-1",children:(t.assertions??[]).map(s=>r.jsxs("div",{className:"text-[11px] flex items-start gap-1.5",style:{color:"var(--text-secondary)"},children:[r.jsx("span",{style:{color:"var(--green)"},children:"+"})," ",s.text]},s.id))})]})]})}function TC({original:t,proposed:a}){const s=[];t.name!==a.name&&s.push({label:"Name",old:t.name,new:a.name}),t.prompt!==a.prompt&&s.push({label:"Prompt",old:t.prompt,new:a.prompt}),t.expected_output!==a.expected_output&&s.push({label:"Expected",old:t.expected_output,new:a.expected_output});const o=t.assertions??[],c=a.assertions??[],u=new Set(o.map(m=>m.text)),d=new Set(c.map(m=>m.text)),h=c.filter(m=>!u.has(m.text)),g=o.filter(m=>!d.has(m.text));return r.jsxs("div",{className:"pt-2.5 space-y-2",children:[s.map(m=>r.jsxs("div",{children:[r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:m.label}),r.jsxs("div",{className:"mt-1 text-[11px] font-mono rounded p-2",style:{background:"var(--surface-1)"},children:[r.jsxs("div",{style:{color:"var(--red)",textDecoration:"line-through"},children:["- ",df(m.old,120)]}),r.jsxs("div",{style:{color:"var(--green)"},children:["+ ",df(m.new,120)]})]})]},m.label)),(h.length>0||g.length>0)&&r.jsxs("div",{children:[r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Assertions"}),r.jsxs("div",{className:"mt-1 space-y-0.5",children:[g.map(m=>r.jsxs("div",{className:"text-[11px]",style:{color:"var(--red)"},children:["- ",m.text]},m.id)),h.map(m=>r.jsxs("div",{className:"text-[11px]",style:{color:"var(--green)"},children:["+ ",m.text]},m.id))]})]}),s.length===0&&h.length===0&&g.length===0&&r.jsx("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"No visible field changes"})]})}function RC({evalCase:t}){var a;return r.jsxs("div",{className:"pt-2.5 space-y-2",style:{opacity:.7},children:[r.jsx(uf,{label:"Prompt",value:t.prompt}),r.jsxs("div",{children:[r.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((a=t.assertions)==null?void 0:a.length)??0,")"]}),r.jsx("div",{className:"mt-1 space-y-0.5",children:(t.assertions??[]).map(s=>r.jsx("div",{className:"text-[11px]",style:{color:"var(--red)",textDecoration:"line-through"},children:s.text},s.id))})]})]})}function uf({label:t,value:a}){return r.jsxs("div",{children:[r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:t}),r.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:df(a,300)})]})}function df(t,a){return t.length>a?t.slice(0,a)+"...":t}const $g={remove:0,modify:1,add:2};function AC({changes:t,selections:a,currentEvals:s,onToggle:o,onSelectAll:c,onDeselectAll:u}){if(t.length===0)return null;const d=t.map((g,m)=>({change:g,originalIndex:m}));d.sort((g,m)=>($g[g.change.action]??2)-($g[m.change.action]??2));const h=Array.from(a.values()).filter(Boolean).length;return r.jsxs("div",{className:"mt-3 animate-fade-in",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"Test Case Changes"}),r.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",h,"/",t.length," selected)"]})]}),r.jsxs("div",{className:"flex gap-1.5",children:[r.jsx("button",{onClick:c,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--accent)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--accent-muted)"},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:"Select All"}),r.jsx("button",{onClick:u,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--surface-3)"},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:"Deselect All"})]})]}),r.jsx("div",{className:"space-y-1.5 overflow-auto",style:{maxHeight:240},children:d.map(({change:g,originalIndex:m})=>r.jsx(EC,{change:g,index:m,selected:a.get(m)??!1,onToggle:o,originalEval:g.evalId!=null?s.find(y=>y.id===g.evalId):void 0},m))})]})}function MC(){var z;const{state:t,dispatch:a,submitAiEdit:s,applyAiEdit:o,discardAiEdit:c,cancelAiEdit:u,toggleEvalChange:d,selectAllEvalChanges:h,deselectAllEvalChanges:g,retryEvalsSave:m}=Rn(),{aiEditLoading:y,aiEditResult:v,aiEditError:b,aiEditClassifiedError:S,aiEditProgress:k,aiEditEvalChanges:w,aiEditEvalSelections:C,aiEditEvalsRetry:T}=t,[N,A]=p.useState(""),{config:_}=$a(),[D,F]=p.useState("claude-cli"),[E,B]=p.useState("opus"),L=p.useRef(null);p.useEffect(()=>{var O;(O=L.current)==null||O.focus()},[]),p.useEffect(()=>{if(!_)return;_.providers.find(P=>P.id==="claude-cli"&&P.available)&&(F("claude-cli"),B("opus"))},[_]);const U=_==null?void 0:_.providers.find(O=>O.id===D&&O.available),$=p.useCallback(()=>{const O=N.trim();!O||y||s(O,D,E)},[N,y,s,D,E]),q=p.useCallback(O=>{O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),$()),O.key==="Escape"&&(O.preventDefault(),y?u():c())},[$,y,u,c]),X=p.useCallback(()=>{a({type:"CLOSE_AI_EDIT"}),a({type:"OPEN_AI_EDIT"})},[a]),ee=v?Jo(t.skillContent,v.improved):[],I=((z=t.evals)==null?void 0:z.evals)??[];return r.jsxs("div",{className:"animate-fade-in",style:{background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[r.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:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M15 4V2"}),r.jsx("path",{d:"M15 16v-2"}),r.jsx("path",{d:"M8 9h2"}),r.jsx("path",{d:"M20 9h2"}),r.jsx("path",{d:"M17.8 11.8L19 13"}),r.jsx("path",{d:"M15 9h.01"}),r.jsx("path",{d:"M17.8 6.2L19 5"}),r.jsx("path",{d:"M11 6.2L9.7 5"}),r.jsx("path",{d:"M3 21l9-9"})]})}),r.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Edit"}),r.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:"Describe what to change — Enter to submit, Esc to dismiss"})]}),r.jsx("button",{onClick:c,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:O=>{O.currentTarget.style.background="var(--surface-3)"},onMouseLeave:O=>{O.currentTarget.style.background="transparent"},children:r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),r.jsxs("div",{className:"px-4 py-3",children:[!v&&r.jsxs(r.Fragment,{children:[r.jsx("textarea",{ref:L,value:N,onChange:O=>A(O.target.value),onKeyDown:q,placeholder:"e.g., Add an error handling section...",disabled:y,rows:4,className:"w-full resize-y outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",borderRadius:6,padding:"10px 12px",fontSize:12.5,lineHeight:1.5,fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",minHeight:96,maxHeight:240}}),r.jsxs("div",{className:"flex items-end gap-2.5 mt-2",children:[r.jsxs("div",{style:{minWidth:200},children:[r.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),r.jsx("select",{className:"input-field text-[11px] py-1",value:D,onChange:O=>{F(O.target.value);const P=_==null?void 0:_.providers.find(H=>H.id===O.target.value);P!=null&&P.models[0]&&B(P.models[0].id)},disabled:y,style:{width:"100%"},children:_==null?void 0:_.providers.filter(O=>O.available).map(O=>r.jsx("option",{value:O.id,children:O.label},O.id))})]}),r.jsxs("div",{style:{minWidth:200},children:[r.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Model"}),r.jsx("select",{className:"input-field text-[11px] py-1",value:E,onChange:O=>B(O.target.value),disabled:y,style:{width:"100%"},children:U==null?void 0:U.models.map(O=>r.jsx("option",{value:O.id,children:O.label},O.id))})]}),r.jsx("div",{className:"flex-1"}),y?r.jsx("button",{onClick:u,className:"btn btn-secondary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Cancel"}):r.jsx("button",{onClick:$,disabled:!N.trim(),className:"btn btn-primary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Submit"})]}),y&&k.length>0&&r.jsx("div",{className:"mt-2.5",children:r.jsx(ai,{entries:k,isRunning:!0})})]}),b&&r.jsx("div",{className:"mt-3",children:S?r.jsx(ec,{error:S,onRetry:X,onDismiss:c}):r.jsx("div",{className:"px-3 py-2.5 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:b})}),v&&r.jsxs("div",{className:"animate-fade-in",children:[v.reasoning&&r.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:[r.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),v.reasoning]}),r.jsx("div",{className:"mb-1",children:r.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"})}),r.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:300,overflowY:"auto"},children:ee.map((O,P)=>r.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:[r.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:O.type==="added"?"+":O.type==="removed"?"-":" "}),O.content]},P))}),r.jsx(AC,{changes:w,selections:C,currentEvals:I,onToggle:d,onSelectAll:h,onDeselectAll:g}),T&&r.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:[r.jsx("span",{children:"Test case save failed. SKILL.md was saved successfully."}),r.jsx("button",{onClick:m,className:"btn text-[11px]",style:{background:"rgba(251,191,36,0.2)",color:"#fbbf24",padding:"3px 10px"},children:"Retry Save"})]}),r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsxs("button",{onClick:o,className:"btn btn-primary text-[11px]",style:{padding:"5px 12px"},children:[r.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),r.jsx("button",{onClick:c,className:"btn btn-secondary text-[11px]",style:{padding:"5px 12px"},children:"Discard"}),r.jsx("button",{onClick:X,className:"btn btn-ghost text-[11px]",style:{padding:"5px 12px"},children:"Try Again"})]})]})]})]})}function LC(t,a){const[s,o]=p.useState([]),[c,u]=p.useState("SKILL.md"),[d,h]=p.useState(null),[g,m]=p.useState(!1),[y,v]=p.useState(null),b=p.useCallback(async()=>{try{const w=await we.getSkillFiles(t,a);o(w.files)}catch{o([])}},[t,a]);p.useEffect(()=>{u("SKILL.md"),h(null),v(null),b()},[t,a,b]);const S=p.useCallback(async w=>{if(u(w),w==="SKILL.md"){h(null),v(null);return}m(!0),v(null);try{const C=await we.getSkillFile(t,a,w);h(C)}catch(C){v(`Unable to open file: ${C.message}`),h(null)}finally{m(!1)}},[t,a]),k=p.useCallback(()=>{b()},[b]);return{files:s,activeFile:c,secondaryContent:d,loading:g,error:y,selectFile:S,refresh:k,isSkillMd:c==="SKILL.md"}}function zC(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function DC(t){const a=[],s=new Map;for(const o of t){const c=o.path.split("/"),d={name:c[c.length-1],path:o.path,type:o.type,size:o.size,children:[]};s.set(o.path,d)}for(const o of t){const c=o.path.split("/");if(c.length===1){const u=s.get(o.path);u&&a.push(u)}else{const u=c.slice(0,-1).join("/"),d=s.get(u),h=s.get(o.path);d&&h&&d.children.push(h)}}return a}function My({expanded:t}){return r.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:t?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s"},children:r.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Ly(){return r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:r.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 _C(){return r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),r.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function OC(){return r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("polyline",{points:"23 4 23 10 17 10"}),r.jsx("polyline",{points:"1 20 1 14 7 14"}),r.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 zy({node:t,depth:a,activeFile:s,onSelect:o}){const[c,u]=p.useState(!0),d=t.path===s;return t.type==="dir"?r.jsxs("div",{children:[r.jsxs("button",{onClick:()=>u(!c),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+a*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:[r.jsx(My,{expanded:c}),r.jsx(Ly,{}),r.jsxs("span",{children:[t.name,"/"]})]}),c&&t.children.map(h=>r.jsx(zy,{node:h,depth:a+1,activeFile:s,onSelect:o},h.path))]}):r.jsxs("button",{onClick:()=>o(t.path),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+a*14}px`,paddingTop:2,paddingBottom:2,background:d?"var(--accent-muted)":"none",border:"none",cursor:"pointer",color:d?"var(--accent)":"var(--text-tertiary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left",borderRadius:3},children:[r.jsx("span",{style:{width:10}}),r.jsx(_C,{}),r.jsx("span",{style:{flex:1},children:t.name}),r.jsx("span",{style:{fontSize:9,color:"var(--text-tertiary)",marginRight:4,whiteSpace:"nowrap"},children:zC(t.size)})]})}function BC({files:t,activeFile:a,onSelect:s,onRefresh:o}){const[c,u]=p.useState(!1),d=p.useMemo(()=>DC(t),[t]);return r.jsxs("div",{style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 8px",cursor:"pointer",userSelect:"none"},onClick:()=>u(!c),children:[r.jsx(My,{expanded:c}),r.jsx(Ly,{}),r.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a}),r.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:r.jsx(OC,{})})]}),c&&r.jsx("div",{style:{maxHeight:240,overflowY:"auto",padding:"2px 4px 4px"},children:d.length===0?r.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 8px"},children:"No files found"}):d.map(h=>r.jsx(zy,{node:h,depth:0,activeFile:a,onSelect:s},h.path))})]})}function jo(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function IC(t){try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}function UC(t){const a=t.toLowerCase();return a.endsWith(".json")?"json":a.endsWith(".md")?"md":"other"}function Vg({content:t}){return r.jsx("textarea",{readOnly:!0,value:t,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 Pg({content:t,fileType:a}){if(a==="json"){const s=IC(t);return r.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:s})}return a==="md"?r.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:Zo(t)}}):r.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:t})}function Fg(t){try{return JSON.stringify(JSON.parse(t),null,2).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"([^"\\]|\\.)*"\s*:/g,s=>`<span style="color:#6383ff">${s}</span>`).replace(/:\s*"([^"\\]|\\.)*"/g,s=>`<span style="color:#22c55e">${s.slice(0,2)}<span style="color:#22c55e">${s.slice(2)}</span></span>`).replace(/:\s*(-?\d+\.?\d*)/g,(s,o)=>`: <span style="color:#fb923c">${o}</span>`).replace(/:\s*(true|false|null)/g,(s,o)=>`: <span style="color:#a855f7">${o}</span>`)}catch{return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}}function HC({file:t,loading:a,error:s,viewMode:o,plugin:c,skill:u,onSaved:d,onDirtyChange:h}){const[g,m]=p.useState(o),[y,v]=p.useState(!1),[b,S]=p.useState(""),[k,w]=p.useState(!1),[C,T]=p.useState(null),N=o!==g?o:g;p.useEffect(()=>{h==null||h(y)},[y,h]);const A=p.useCallback(()=>{(t==null?void 0:t.content)!=null&&(S(t.content),v(!0))},[t]),_=p.useCallback(()=>{v(!1)},[]),D=p.useCallback(async()=>{if(!(!c||!u||!t)){w(!0);try{await we.saveSkillFile(c,u,t.path,b),T("Saved"),v(!1),d==null||d(),setTimeout(()=>T(null),2e3)}catch(B){T(`Save failed: ${B.message}`),setTimeout(()=>T(null),3e3)}finally{w(!1)}}},[c,u,t,b,d]);if(p.useEffect(()=>{if(!y)return;const B=L=>{(L.ctrlKey||L.metaKey)&&L.key==="s"&&(L.preventDefault(),D())};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[y,D]),a)return r.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:"Loading…"});if(s)return r.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:r.jsxs("div",{style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"16px 20px",maxWidth:400,textAlign:"center"},children:[r.jsx("div",{style:{fontSize:13,color:"var(--text-primary)",fontWeight:600,marginBottom:6},children:"Unable to open file"}),r.jsx("div",{style:{fontSize:12,color:"var(--text-tertiary)"},children:s})]})});if(!t)return null;if(t.binary)return r.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:["Binary file (",jo(t.size),") — cannot be displayed"]});const F=t.content??"",E=UC(t.path);return r.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[t.truncated&&r.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 ",jo(512*1024)," — ",jo(t.size)," total"]}),r.jsxs("div",{style:{display:"flex",gap:4,padding:"4px 8px",borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[(E==="md"||E==="json")&&["raw","split","preview"].map(B=>r.jsx("button",{onClick:()=>m(B),style:{padding:"2px 8px",fontSize:11,background:N===B?"var(--accent-muted)":"none",color:N===B?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer",textTransform:"capitalize"},children:B},B)),r.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",display:"flex",alignItems:"center",gap:6},children:[jo(t.size),c&&u&&!t.binary&&!y&&r.jsx("button",{onClick:A,style:{padding:"1px 6px",fontSize:10,background:"var(--accent-muted)",color:"var(--accent)",border:"none",borderRadius:3,cursor:"pointer"},children:"Edit"}),y&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:D,disabled:k,style:{padding:"1px 6px",fontSize:10,background:"var(--accent)",color:"#fff",border:"none",borderRadius:3,cursor:"pointer",opacity:k?.6:1},children:k?"Saving...":"Save"}),r.jsx("button",{onClick:_,style:{padding:"1px 6px",fontSize:10,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer"},children:"Cancel"})]})]})]}),C&&r.jsx("div",{style:{padding:"4px 12px",background:C.startsWith("Save failed")?"var(--red-muted)":"var(--green-muted)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:C.startsWith("Save failed")?"var(--red)":"var(--green)"},children:C}),r.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:y?r.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:[r.jsx("textarea",{value:b,onChange:B=>S(B.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}}),r.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:[r.jsx("span",{style:{flex:1,fontSize:11,color:"var(--text-tertiary)"},children:"Unsaved changes"}),r.jsx("button",{onClick:D,disabled:k,style:{padding:"3px 12px",fontSize:11,background:"var(--accent)",color:"#fff",border:"none",borderRadius:4,cursor:"pointer",opacity:k?.6:1},children:k?"Saving...":"Save"}),r.jsx("button",{onClick:_,style:{padding:"3px 12px",fontSize:11,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer"},children:"Cancel"})]})]}):N==="split"&&E!=="other"?r.jsxs(r.Fragment,{children:[r.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",borderRight:"1px solid var(--border-subtle)"},children:r.jsx(Vg,{content:F})}),r.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:E==="json"?r.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:Fg(F)}}):r.jsx(Pg,{content:F,fileType:E})})]}):N==="preview"&&E!=="other"?E==="json"?r.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:Fg(F)}}):r.jsx(Pg,{content:F,fileType:E}):r.jsx(Vg,{content:F})})]})}const $C=/^git@github\.com:([^/]+)\/(.+?)(?:\.git)?$/,VC=/^https:\/\/github\.com\/([^/]+)\/(.+?)(?:\.git)?$/;function PC(t){const a=t.trim();if(!a)throw new Error("normalizeRemoteUrl: empty input");let s=a.match($C);if(s)return`https://github.com/${s[1]}/${s[2]}`;if(s=a.match(VC),s)return`https://github.com/${s[1]}/${s[2]}`;throw new Error(`normalizeRemoteUrl: unrecognized remote URL: ${t}`)}function Dy(t){const a=PC(t);return`https://verified-skill.com/submit?repo=${encodeURIComponent(a)}`}function Gg(t,a){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:t,severity:a}}))}function FC({remoteUrl:t,fileCount:a,provider:s,model:o,onClose:c}){const[u,d]=p.useState(""),[h,g]=p.useState(!1),[m,y]=p.useState(!1),[v,b]=p.useState(null),S=p.useCallback(async()=>{g(!0),b(null);try{const C=await we.gitCommitMessage({provider:s,model:o});d(C.message)}catch(C){const T=C instanceof Error?C.message:String(C);b(T)}finally{g(!1)}},[s,o]);p.useEffect(()=>{S()},[]);const k=p.useCallback(async()=>{const C=u.trim();if(!(!C||m)){y(!0);try{const T=await we.gitPublish({commitMessage:C}),N=T.remoteUrl??t,A=Dy(N);window.open(A,"_blank","noopener,noreferrer");const _=(T.commitSha??"").slice(0,7),D=T.branch??"";Gg(`Opening verified-skill.com — ${_} on ${D}`,"info"),c()}catch(T){const N=T instanceof Error?T.message:String(T),A=N.length>200?N.slice(0,200)+"…":N;Gg(`Publish failed: ${A}`,"error")}finally{y(!1)}}},[u,m,t,c]),w=u.trim().length>0&&!m&&!h;return r.jsxs("div",{role:"dialog","aria-label":"Publish",style:{position:"fixed",right:16,bottom:16,width:420,maxWidth:"calc(100vw - 32px)",background:"var(--bg-elevated, #1a1a1a)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:14,boxShadow:"0 8px 32px rgba(0,0,0,0.4)",zIndex:1e3,fontSize:12,color:"var(--text-primary)"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[r.jsx("strong",{style:{fontSize:13},children:"Publish"}),r.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[a," file",a===1?"":"s"," changed"]})]}),r.jsx("label",{htmlFor:"commit-message",style:{display:"block",marginBottom:4,color:"var(--text-secondary)"},children:"Commit message"}),r.jsx("textarea",{id:"commit-message",value:u,onChange:C=>d(C.target.value),rows:5,disabled:h,placeholder:h?"Generating with AI…":"Enter a commit message",style:{width:"100%",background:"var(--bg-subtle)",border:"1px solid var(--border-subtle)",borderRadius:4,padding:"6px 8px",fontFamily:"var(--font-mono, monospace)",fontSize:12,color:"var(--text-primary)",resize:"vertical"}}),v&&r.jsxs("div",{style:{color:"var(--error, #f87171)",marginTop:6,fontSize:11},children:["AI generation failed: ",v]}),r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:10},children:[r.jsx("button",{type:"button","aria-label":"Regenerate",onClick:S,disabled:h||m,className:"btn btn-ghost text-[11px]",style:{padding:"4px 10px"},children:h?"Generating…":"Regenerate"}),r.jsxs("div",{style:{display:"flex",gap:6},children:[r.jsx("button",{type:"button","aria-label":"Cancel",onClick:c,disabled:m,className:"btn btn-ghost text-[11px]",style:{padding:"4px 10px"},children:"Cancel"}),r.jsx("button",{type:"button","aria-label":"Commit & Push",onClick:k,disabled:!w,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:m?"Publishing…":"Commit & Push"})]})]})]})}function Wg(t,a){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:t,severity:a}}))}function GC({remoteUrl:t,provider:a,model:s}){const[o,c]=p.useState(!1),[u,d]=p.useState(!1),[h,g]=p.useState(0),m=p.useCallback(async()=>{if(!(o||u)){c(!0);try{let v=!1,b=0;try{const N=await we.gitDiff();v=!!N.hasChanges,b=N.fileCount??0}catch{}if(v){g(b),d(!0);return}const S=await we.gitPublish(),k=S.remoteUrl??t,w=Dy(k);window.open(w,"_blank","noopener,noreferrer");const C=(S.commitSha??"").slice(0,7),T=S.branch??"";Wg(`Opening verified-skill.com — ${C} on ${T}`,"info")}catch(v){const b=v instanceof Error?v.message:String(v),S=b.length>200?b.slice(0,200)+"…":b;Wg(`Publish failed: ${S}`,"error")}finally{c(!1)}}},[o,u,t]),y=p.useCallback(()=>d(!1),[]);return r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button","aria-label":"Publish",onClick:m,disabled:o,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},title:"Push committed changes and open verified-skill.com to submit",children:o?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Publishing…"]}):"Publish"}),u&&r.jsx(FC,{remoteUrl:t,fileCount:h,provider:a,model:s,onClose:y})]})}const WC={hasRemote:!1,remoteUrl:null,branch:null,loading:!0,error:null};function qC(){const[t,a]=p.useState(WC);return p.useEffect(()=>{let s=!1;return we.gitRemote().then(o=>{s||a({hasRemote:!!o.hasRemote,remoteUrl:o.remoteUrl??null,branch:o.branch??null,loading:!1,error:null})}).catch(o=>{s||a({hasRemote:!1,remoteUrl:null,branch:null,loading:!1,error:o instanceof Error?o:new Error(String(o))})}),()=>{s=!0}},[]),t}function YC({size:t=15}){return r.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("polyline",{points:"16 18 22 12 16 6"}),r.jsx("polyline",{points:"8 6 2 12 8 18"})]})}function KC({size:t=15}){return r.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),r.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})}function XC({size:t=15}){return r.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),r.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function QC({size:t=15}){return r.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M15 4V2"}),r.jsx("path",{d:"M15 16v-2"}),r.jsx("path",{d:"M8 9h2"}),r.jsx("path",{d:"M20 9h2"}),r.jsx("path",{d:"M17.8 11.8L19 13"}),r.jsx("path",{d:"M15 9h.01"}),r.jsx("path",{d:"M17.8 6.2L19 5"}),r.jsx("path",{d:"M11 6.2L9.7 5"}),r.jsx("path",{d:"M3 21l9-9"})]})}function Dd({size:t=15}){return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M12 3l1.5 5.5L19 10l-5.5 1.5L12 17l-1.5-5.5L5 10l5.5-1.5L12 3z"})})}function ZC(){const{state:t,dispatch:a,saveContent:s,isReadOnly:o}=Rn(),{plugin:c,skill:u,skillContent:d,isDirty:h,improveTarget:g,aiEditOpen:m}=t,[y,v]=p.useState("split"),[b,S]=p.useState(!1),k=p.useRef(null),[w,C]=p.useState(!1),[T,N]=p.useState(""),[A,_]=p.useState(!1),[D,F]=p.useState(null),[E,B]=p.useState([]),[L,U]=p.useState([]),[$,q]=p.useState(null),X=p.useRef(null),{config:ee}=$a(),I=qC(),{files:z,activeFile:O,secondaryContent:P,loading:H,error:ae,selectFile:M,refresh:Y,isSkillMd:W}=LC(c??"",u??""),[Q,oe]=p.useState(!1),de=p.useCallback(ye=>{Q&&!window.confirm("You have unsaved changes. Discard?")||M(ye)},[Q,M]);p.useEffect(()=>()=>{var ye;(ye=X.current)==null||ye.abort()},[]);const{metadata:ve,body:ce}=jC(d),je=ve["allowed-tools"],Re=Array.isArray(je)?je:typeof je=="string"?[je]:[],Oe=ve.name,le=ve.description,he=ve.metadata,pe=typeof he=="object"&&!Array.isArray(he)?he:null,xe=ve.version||(pe==null?void 0:pe.version),be=ve.tags||(pe==null?void 0:pe.tags),Be=Array.isArray(be)?be:typeof be=="string"?be.split(",").map(ye=>ye.trim()).filter(Boolean):[],Ue=new Set(["name","description","metadata","allowed-tools","version","tags"]),lt=Object.entries(ve).filter(([ye])=>!Ue.has(ye)),Ct=p.useCallback(async()=>{S(!0),await s(),S(!1)},[s]),gt=p.useCallback(ye=>{(ye.ctrlKey||ye.metaKey)&&ye.key==="s"&&(ye.preventDefault(),ye.stopPropagation(),h&&Ct()),(ye.ctrlKey||ye.metaKey)&&ye.key==="k"&&(ye.preventDefault(),ye.stopPropagation(),a({type:m?"CLOSE_AI_EDIT":"OPEN_AI_EDIT"}))},[h,Ct,m,a]),Tt=p.useCallback(async()=>{var ot,Wt;if(!T.trim())return;(ot=X.current)==null||ot.abort();const ye=new AbortController;X.current=ye,_(!0),q(null),U([]),F(null),B([]);try{const Kt=(ee==null?void 0:ee.provider)||"claude-cli",An=(ee==null?void 0:ee.model)||"sonnet",Et=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:T,provider:Kt,model:An}),signal:ye.signal});if(!Et.ok||!Et.body){let Wn=`HTTP ${Et.status}`;try{const tr=await Et.json();tr.error&&(Wn=tr.error)}catch{}throw new Error(Wn)}const Mn=Et.body.getReader(),Ut=new TextDecoder;let Rt="",ct="";for(;;){const{done:Wn,value:tr}=await Mn.read();if(Wn)break;Rt+=Ut.decode(tr,{stream:!0});const da=Rt.split(`
|
|
79
79
|
`);Rt=da.pop()||"";for(const gn of da)if(gn.startsWith("event: "))ct=gn.slice(7).trim();else if(gn.startsWith("data: ")){try{const Nt=JSON.parse(gn.slice(6));if(ct==="progress")U(Le=>[...Le,{phase:Nt.phase,message:Nt.message,timestamp:Date.now()}]);else if(ct==="done"||ct==="complete"){const Le=["---"];Nt.name&&Le.push(`name: ${Nt.name}`),Nt.description&&Le.push(`description: "${Nt.description.replace(/"/g,'\\"')}"`),Nt.model&&Le.push(`model: ${Nt.model}`),(Wt=Nt.allowedTools)!=null&&Wt.trim()&&Le.push(`allowed-tools: ${Nt.allowedTools.trim()}`),Le.push("---","",Nt.body||"");const se=Le.join(`
|
|
80
|
-
`);F(se),B(Jo(d,se)),_(!1)}else ct==="error"&&(q(Nt.message||Nt.description||"Generation failed"),_(!1))}catch{}ct=""}}}catch(Kt){Kt.name!=="AbortError"&&q(Kt.message)}finally{_(!1),X.current=null}},[T,ee,d]),Gt=p.useCallback(()=>{D&&a({type:"SET_CONTENT",content:D}),E(!1),F(null),B([]),N(""),U([])},[D,a]),We=p.useCallback(()=>{E(!1),F(null),B([]),N(""),U([]),q(null)},[]),nt=p.useCallback(()=>{var ye;w?((ye=X.current)==null||ye.abort(),We()):(m&&a({type:"CLOSE_AI_EDIT"}),E(!0))},[w,m,a,We]),xn=[{mode:"raw",icon:r.jsx(GC,{}),label:"Editor"},{mode:"split",icon:r.jsx(WC,{}),label:"Split"},{mode:"preview",icon:r.jsx(qC,{}),label:"Preview"}];return r.jsxs("div",{className:"flex flex-col h-full",onKeyDown:gt,tabIndex:-1,children:[r.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:[r.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:xn.map(({mode:ye,icon:ot,label:Wt})=>r.jsxs("button",{onClick:()=>v(ye),title:Wt,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:[ot,r.jsx("span",{style:{letterSpacing:"0.01em"},children:Wt})]},ye))}),W?o?r.jsx("div",{className:"flex items-center gap-2",children:r.jsxs("span",{className:"flex items-center gap-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),r.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Read-only"]})}):r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("button",{onClick:()=>{m?a({type:"CLOSE_AI_EDIT"}):(w&&We(),a({type:"OPEN_AI_EDIT"}))},title:"Edit with AI (Ctrl+K)",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:m?600:400,border:"none",cursor:"pointer",color:m?"var(--purple)":"var(--text-tertiary)",background:m?"var(--purple-muted)":"transparent"},children:[r.jsx(YC,{size:13}),r.jsx("span",{children:"AI Edit"})]}),r.jsxs("button",{onClick:nt,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:w?600:400,border:"none",cursor:"pointer",color:w?"var(--purple)":"var(--text-tertiary)",background:w?"var(--purple-muted)":"transparent"},children:[r.jsx(zd,{size:13}),r.jsx("span",{children:"Regenerate"})]}),r.jsx("div",{style:{width:1,height:16,background:"var(--border-subtle)"}}),h&&r.jsx("button",{onClick:()=>a({type:"SET_CONTENT",content:t.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),r.jsx("button",{onClick:Ct,disabled:!h||b,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:b?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Saving..."]}):"Save"}),I.hasRemote&&I.remoteUrl&&r.jsx(VC,{remoteUrl:I.remoteUrl,provider:ee==null?void 0:ee.provider,model:ee==null?void 0:ee.model})]}):null]}),c&&u&&r.jsx(DC,{files:z,activeFile:O,onSelect:de,onRefresh:Y}),!W&&r.jsx(BC,{file:P,loading:H,error:ae,viewMode:y,plugin:c??void 0,skill:u??void 0,onSaved:()=>{M(O),Y()},onDirtyChange:oe}),W&&r.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:y==="raw"||y==="preview"?"1fr":"1fr 1fr"},children:[y!=="preview"&&r.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:y==="split"?"1px solid var(--border-subtle)":"none"},children:r.jsx("textarea",{ref:k,value:d,onChange:ye=>{o||a({type:"SET_CONTENT",content:ye.target.value})},onKeyDown:gt,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"&&r.jsx("div",{className:"overflow-auto",style:{background:"var(--surface-0)"},children:r.jsxs("div",{className:"animate-fade-in",style:{padding:"20px 24px",maxWidth:720},children:[(Oe||xe||le)&&r.jsxs("div",{style:{marginBottom:20},children:[r.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[Oe&&r.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:Oe}),xe&&r.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",xe]})]}),le&&r.jsx("p",{style:{fontSize:12.5,lineHeight:1.65,color:"var(--text-secondary)",margin:0,paddingLeft:12,borderLeft:"2px solid var(--accent)",maxWidth:600},children:le})]}),Be.length>0&&r.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:Be.map(ye=>r.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))}),Re.length>0&&r.jsx("div",{style:{marginBottom:16},children:r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",marginRight:4},children:"Tools"}),Re.map(ye=>r.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))]})}),lt.length>0&&r.jsx("div",{style:{marginBottom:16,padding:"8px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:lt.map(([ye,ot],Wt)=>{const Kt=Array.isArray(ot)?ot.join(", "):typeof ot=="object"?Object.entries(ot).map(([An,Et])=>`${An}: ${Array.isArray(Et)?Et.join(", "):Et}`).join(" | "):ot;return r.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:Wt>0?"1px solid var(--border-subtle)":"none"},children:[r.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",minWidth:80,flexShrink:0},children:ye}),r.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:Kt})]},ye)})}),(Oe||le||Be.length>0||Re.length>0||lt.length>0)&&ce&&r.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),ce&&r.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Zo(ce)}})]})})]}),W&&m&&r.jsx(TC,{}),W&&w&&r.jsx("div",{className:"animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:r.jsxs("div",{className:"px-4 py-3",children:[!D&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(zd,{size:14}),r.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerate Skill"})]}),r.jsx("div",{className:"flex gap-2 mb-2",children:r.jsx("textarea",{value:T,onChange:ye=>N(ye.target.value),placeholder:"Describe what this skill should do...",rows:2,disabled:A,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:A?.5:1},onKeyDown:ye=>{ye.key==="Enter"&&(ye.ctrlKey||ye.metaKey)&&T.trim()&&!A&&(ye.preventDefault(),Tt())}})}),r.jsxs("div",{className:"flex items-center gap-2",children:[A?r.jsx("button",{onClick:()=>{var ye;(ye=X.current)==null||ye.abort(),_(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):r.jsx("button",{onClick:Tt,disabled:!T.trim(),className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:"Generate"}),r.jsx("button",{onClick:We,className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Close"})]}),A&&L.length>0&&r.jsx("div",{className:"mt-2",children:r.jsx(ai,{entries:L,isRunning:!0})}),$&&r.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:[$,r.jsx("button",{onClick:Tt,className:"ml-2 underline",style:{color:"var(--red)"},children:"Retry"})]})]}),D&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(zd,{size:14}),r.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerated — Review Changes"})]}),r.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:"300px",overflowY:"auto"},children:C.map((ye,ot)=>r.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:[r.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:ye.type==="added"?"+":ye.type==="removed"?"-":" "}),ye.content]},ot))}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("button",{onClick:Gt,className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:[r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),r.jsx("button",{onClick:We,className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Discard"})]})]})]})}),W&&g!==null&&c&&u&&r.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:r.jsx(jC,{plugin:c,skill:u,skillContent:d,onApplied:ye=>{a({type:"SET_CONTENT",content:ye}),a({type:"CONTENT_SAVED"}),a({type:"CLOSE_IMPROVE"})}})})]})}function Rl(t){return t.testType==="integration"?"integration":"unit"}function Dl(t){return t>=.8?"var(--green)":t>=.5?"var(--yellow)":"var(--red)"}function zy(t){const a=new Date(t);return a.toLocaleDateString(void 0,{month:"short",day:"numeric"})+", "+a.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function Dy(t){return t==null?"--":t>=1e3?`${(t/1e3).toFixed(1)}s`:`${t}ms`}const XC=new Set(["benchmark","comparison","baseline"]);function Wg(t,a,s,o){return t.map(({rate:c,idx:u,total:d})=>{const h=o+u/(d-1)*(a-o*2),g=o+(s-o*2)-c*(s-o*2);return`${h},${g}`})}function _y({entries:t}){const a=t.filter(v=>XC.has(v.type)).slice().reverse(),s=a.map((v,b,S)=>({rate:v.pass_rate,idx:b,total:S.length})).filter((v,b)=>{const S=a[b].type;return S==="benchmark"||S==="comparison"}),o=a.flatMap((v,b)=>v.type==="baseline"?[{rate:v.pass_rate,idx:b,total:a.length}]:v.type==="comparison"&&v.baselinePassRate!=null?[{rate:v.baselinePassRate,idx:b,total:a.length}]:[]);if(s.length<2&&o.length<2)return null;const c=80,u=24,d=2,h=s.length>=2?Wg(s,c,u,d):[],g=o.length>=2?Wg(o,c,u,d):[],m=h[h.length-1],y=g[g.length-1];return r.jsxs("svg",{width:c,height:u,style:{display:"block",flexShrink:0},children:[g.length>0&&r.jsx("polyline",{points:g.join(" "),fill:"none",stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:"3 2"}),h.length>0&&r.jsx("polyline",{points:h.join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),y&&r.jsx("circle",{cx:parseFloat(y.split(",")[0]),cy:parseFloat(y.split(",")[1]),r:2.5,fill:"var(--text-tertiary)"}),m&&r.jsx("circle",{cx:parseFloat(m.split(",")[0]),cy:parseFloat(m.split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function Oy(t,a,s){const o=isNaN(a)?0:a,c=[],u=[],d=[];if((t==="PASS"||t==="EFFECTIVE")&&o>=.7){const m=c.length>0?` Met criteria: ${c.map(y=>y.criterion).join(", ")}.`:"";return{explanation:`${t} (score ${o.toFixed(2)}): evaluation met expectations.${m}`}}if(t==="FAIL"||t==="DEGRADING"){const m=u.length>0?` Failed criteria: ${u.map(v=>v.criterion).join(", ")}.`:"",y=[...u.map(v=>`Improve "${v.criterion}" (score: ${v.score.toFixed(2)})`),...d.map(v=>`Strengthen "${v.criterion}" (score: ${v.score.toFixed(2)})`)];return y.length===0&&y.push("Review prompt instructions and add more specific guidance"),{explanation:`${t} (score ${o.toFixed(2)}): evaluation did not meet expectations.${m}`,recommendations:y}}if(t==="INEFFECTIVE"){if(o<.2){const y=[...u.map(v=>`Rework "${v.criterion}" — currently at ${v.score.toFixed(2)}`),"Consider adding examples to your system prompt","Review the rubric criteria for achievability"];return{explanation:`${t} (score ${o.toFixed(2)}): evaluation is significantly below expectations.`,recommendations:y}}const m=[...u.map(y=>`Rework "${y.criterion}" — currently at ${y.score.toFixed(2)}`),...d.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return m.length===0&&m.push("Consider restructuring your prompt approach"),{explanation:`${t} (score ${o.toFixed(2)}): below expectations but showing some capability.`,recommendations:m}}if(t==="MARGINAL"){const m=[...d.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`),...u.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return m.length===0&&m.push(c.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Review prompt instructions for areas of improvement"),{explanation:`${t} (score ${o.toFixed(2)}): moderate improvement detected.`,recommendations:m}}if(t==="EMERGING"){const m=[...u.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`),...d.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return m.length===0&&m.push(c.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Add more specific guidance to your prompt instructions"),{explanation:`${t} (score ${o.toFixed(2)}): early promise — focus on weak areas to improve.`,recommendations:m}}const h=c.length>0?` Passing: ${c.map(m=>m.criterion).join(", ")}.`:"",g=d.length>0?` Needs improvement: ${d.map(m=>m.criterion).join(", ")}.`:"";return{explanation:`${t} (score ${o.toFixed(2)}): mixed results.${h}${g}`}}const By={EFFECTIVE:"Strong Improvement",MARGINAL:"Moderate Improvement",EMERGING:"Early Promise",INEFFECTIVE:"Needs Work",DEGRADING:"Regression"};function QC(t){return Object.hasOwn(By,t)}function ZC(t){return QC(t)?By[t]:t}function JC(){const{state:t}=Rn(),{plugin:a,skill:s}=t,[o,c]=p.useState([]),[u,d]=p.useState([]),[h,g]=p.useState(!0),[m,y]=p.useState(null),[v,b]=p.useState(new Set),[S,k]=p.useState({}),[w,E]=p.useState(null),[T,N]=p.useState(""),[A,_]=p.useState(!1),[D,F]=p.useState(""),[C,B]=p.useState(""),L=p.useCallback(async()=>{g(!0),y(null);try{const[I,z]=await Promise.all([we.getCredentials(a,s),we.getParams(a,s)]);c(I.credentials),d(z.params)}catch(I){y(I instanceof Error?I.message:"Failed to load parameters"),c([]),d([])}finally{g(!1)}},[a,s]);p.useEffect(()=>{L()},[L]);const U=p.useCallback(async(I,z)=>{_(!0),y(null);try{await we.setCredential(a,s,I,z),E(null),N(""),await L()}catch(O){y(O instanceof Error?O.message:`Failed to save ${I}`)}finally{_(!1)}},[a,s,L]),$=p.useCallback(async()=>{const I=D.trim().toUpperCase(),z=C.trim();if(!(!I||!z)){_(!0),y(null);try{await we.setCredential(a,s,I,z),F(""),B(""),await L()}catch(O){y(O instanceof Error?O.message:`Failed to add ${I}`)}finally{_(!1)}}},[a,s,D,C,L]),q=p.useCallback(async I=>{if(v.has(I)){b(z=>{const O=new Set(z);return O.delete(I),O}),k(z=>{const O={...z};return delete O[I],O});return}try{const O=(await we.getParamsRevealed(a,s,I)).params.find(P=>P.name===I);O!=null&&O.value&&(k(P=>({...P,[I]:O.value})),b(P=>new Set(P).add(I)))}catch{}},[a,s,v]),X=new Set(o.map(I=>I.name)),ee=[...o.map(I=>{const z=u.find(O=>O.name===I.name);return{name:I.name,status:I.status,maskedValue:(z==null?void 0:z.maskedValue)??""}}),...u.filter(I=>!X.has(I.name)).map(I=>({name:I.name,status:I.status,maskedValue:I.maskedValue}))];return r.jsxs("div",{className:"py-2 px-3",children:[r.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters"}),m&&r.jsx("div",{className:"text-[10px] px-2 py-1.5 rounded mb-2",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},role:"alert",children:m}),h&&ee.length===0&&r.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!h&&ee.length===0&&!m&&r.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),ee.map(I=>r.jsxs("div",{className:"flex items-center gap-2 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx("span",{className:"text-[10px] font-mono flex-1 truncate",style:{color:"var(--text-primary)"},children:I.name}),r.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:I.status==="ready"?"var(--green-muted)":"var(--red-muted)",color:I.status==="ready"?"var(--green)":"var(--red)"},children:I.status}),(I.maskedValue||I.status==="ready")&&r.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[v.has(I.name)?S[I.name]??I.maskedValue:I.maskedValue||"***",r.jsx("button",{onClick:()=>q(I.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${v.has(I.name)?"Hide":"Reveal"} value for ${I.name}`,children:v.has(I.name)?"hide":"show"})]}),w===I.name?r.jsxs("div",{className:"flex gap-1",children:[r.jsx("input",{value:T,onChange:z=>N(z.target.value),onKeyDown:z=>{z.key==="Enter"&&T.trim()&&U(I.name,T)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${I.name}`,autoFocus:!0}),r.jsx("button",{onClick:()=>U(I.name,T),disabled:A||!T.trim(),className:"text-[10px] font-medium",style:{color:"var(--green)",background:"none",border:"none",cursor:"pointer"},children:"Save"}),r.jsx("button",{onClick:()=>{E(null),N("")},className:"text-[10px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]}):r.jsx("button",{onClick:()=>{E(I.name),N("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},I.name)),r.jsxs("div",{className:"mt-3 pt-2",style:{borderTop:"1px solid var(--border-subtle)"},children:[r.jsx("div",{className:"text-[10px] font-medium mb-1.5",style:{color:"var(--text-secondary)"},children:"Add New Parameter"}),r.jsxs("div",{className:"flex gap-1.5",children:[r.jsx("input",{value:D,onChange:I=>F(I.target.value),className:"input-field text-[10px] font-mono flex-1",placeholder:"KEY_NAME","aria-label":"Parameter key name"}),r.jsx("input",{value:C,onChange:I=>B(I.target.value),onKeyDown:I=>{I.key==="Enter"&&D.trim()&&C.trim()&&$()},className:"input-field text-[10px] font-mono flex-1",placeholder:"value",type:"password","aria-label":"Parameter value"}),r.jsx("button",{onClick:$,disabled:A||!D.trim()||!C.trim(),className:"text-[10px] font-medium px-2 py-1 rounded",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"none",cursor:A?"not-allowed":"pointer"},children:"Add"})]})]})]})}const _s="This is an installed copy (read-only). Open the source skill to edit.";function eE(t,a,s){const[o,c]=p.useState(null),[u,d]=p.useState(!1),h=p.useRef("");p.useEffect(()=>{const m=`${t}/${a}/${s}`;h.current!==m&&(h.current=m,d(!0),we.getCaseHistory(t,a,s).then(y=>c(y)).catch(()=>c([])).finally(()=>d(!1)))},[t,a,s]);const g=p.useCallback(()=>{d(!0),h.current="",we.getCaseHistory(t,a,s).then(m=>c(m)).catch(()=>c([])).finally(()=>d(!1))},[t,a,s]);return{entries:o,loading:u,refetch:g}}function tE(t,a,s){const o={flaky:!1,nonDiscriminating:!1,regression:!1};if(!s||s.length===0)return o;const u=s.slice(0,10).map(g=>g.assertions.find(m=>m.id===t)).filter(Boolean);if(u.length>=2){const m=u.filter(y=>y.pass).length/u.length;m>=.3&&m<=.7&&(o.flaky=!0)}const d=s.find(g=>g.type==="benchmark"),h=s.find(g=>g.type==="baseline");if(d&&h){const g=d.assertions.find(y=>y.id===t),m=h.assertions.find(y=>y.id===t);g!=null&&g.pass&&(m!=null&&m.pass)&&(o.nonDiscriminating=!0)}if(a&&!a.pass&&s.length>=1){const m=s[0].assertions.find(y=>y.id===t);m!=null&&m.pass&&(o.regression=!0)}return o}function nE(){var P;const{state:t,dispatch:a,saveEvals:s,runCase:o,runAll:c,cancelCase:u,cancelAll:d,generateEvals:h,isReadOnly:g}=Rn(),{evals:m,evalsError:y,selectedCaseId:v,inlineResults:b,caseRunStates:S,generateEvalsLoading:k,generateEvalsProgress:w,generateEvalsError:E}=t,T=p.useMemo(()=>{for(const H of S.values())if(H.status==="running"||H.status==="queued")return!0;return!1},[S]),[N,A]=p.useState(!1),[_,D]=p.useState("all"),F={skill_name:t.skill,evals:[]},C=m??F,B=C.evals,L=p.useMemo(()=>_==="all"?B:B.filter(H=>Rl(H)===_),[_,B]),U=L.find(H=>H.id===v)??null;p.useEffect(()=>{v!==null&&!L.find(H=>H.id===v)&&a({type:"SELECT_CASE",caseId:L.length>0?L[0].id:null})},[L,v,a]);const[$,q]=p.useState([]),X=p.useMemo(()=>B.some(H=>Rl(H)==="integration"),[B]);p.useEffect(()=>{X&&we.getCredentials(t.plugin,t.skill).then(H=>q(H.credentials)).catch(()=>q([]))},[t.plugin,t.skill,X]);const ee=p.useMemo(()=>new Set($.filter(H=>H.status==="missing").map(H=>H.name)),[$]),[I,z]=p.useState(!1),O=p.useCallback(H=>{z(!1),h(H?{testType:H}:void 0)},[h]);return!m||B.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[r.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?r.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("circle",{cx:"12",cy:"12",r:"10"}),r.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),r.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}):r.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M9 11l3 3L22 4"}),r.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),r.jsx("div",{className:"text-center",children:y?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--red)"},children:"Invalid evals.json"}),r.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}),r.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"})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No test cases yet"}),r.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Create test cases to start evaluating your skill"})]})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:()=>A(!0),disabled:g,title:g?_s:void 0,className:"btn btn-primary text-[12px]",children:"Create Test Case"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsxs("div",{className:"flex",children:[r.jsx("button",{onClick:()=>O("unit"),disabled:k||g,title:g?_s:void 0,className:"btn btn-secondary text-[12px]",style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:k?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}})," Generating..."]}):"Generate Unit Tests"}),r.jsx("button",{onClick:()=>z(!I),disabled:k||g,title:g?_s:void 0,className:"btn btn-secondary text-[12px]",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid var(--border-default)",padding:"4px 6px"},children:r.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:r.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),I&&r.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:r.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:H=>{H.currentTarget.style.background="var(--surface-2)"},onMouseLeave:H=>{H.currentTarget.style.background="transparent"},children:"Generate Integration Tests"})})]})]}),k&&w.length>0&&r.jsx("div",{className:"w-full max-w-md mt-3",children:r.jsx(ai,{entries:w,isRunning:!0})}),E&&r.jsx("div",{className:"w-full max-w-md mt-3",children:r.jsx(ec,{error:E,onRetry:()=>O()})}),N&&r.jsx(qg,{evals:C,onSave:H=>{s(H),A(!1)},onCancel:()=>A(!1)})]}):r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"280px 1fr",height:"100%",overflow:"hidden"},children:[r.jsxs("div",{className:"overflow-auto",style:{borderRight:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[r.jsxs("div",{className:"px-3 py-2",style:{borderBottom:"1px solid var(--border-subtle)",display:"flex",flexWrap:"wrap",alignItems:"center",rowGap:6,columnGap:8},children:[r.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",flex:"1 1 auto",minWidth:0},children:["Test Cases (",L.length,")"]}),r.jsx("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6,marginLeft:"auto",flexShrink:0},children:T?r.jsx("button",{onClick:d,className:"btn text-[10px] px-2 py-0.5",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)",whiteSpace:"nowrap"},children:"Cancel All"}):r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:()=>c("benchmark"),disabled:L.length===0||g,title:g?_s:void 0,className:"btn btn-primary text-[10px] px-2 py-0.5",style:{whiteSpace:"nowrap"},children:"Run All"}),r.jsx("button",{onClick:()=>c("comparison"),disabled:L.length===0||g,title:g?_s:void 0,className:"btn btn-secondary text-[10px] px-2 py-0.5",style:{whiteSpace:"nowrap"},children:"Compare All"})]})})]}),r.jsx("div",{className:"flex px-3 py-1.5 gap-1",style:{borderBottom:"1px solid var(--border-subtle)"},children:["all","unit","integration"].map(H=>r.jsx("button",{onClick:()=>D(H),style:{padding:"2px 8px",fontSize:10,fontWeight:_===H?600:400,background:_===H?"var(--accent-muted)":"transparent",color:_===H?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:H==="all"?`All (${B.length})`:H==="unit"?`Unit (${B.filter(ae=>Rl(ae)==="unit").length})`:`Integration (${B.filter(ae=>Rl(ae)==="integration").length})`},H))}),r.jsxs("div",{className:"py-1",children:[L.length===0&&B.length>0&&r.jsxs("div",{className:"flex items-center justify-center py-8 px-3 text-[12px]",style:{color:"var(--text-tertiary)"},children:["No ",_==="all"?"":_+" ","tests yet"]}),L.map(H=>{var W;const ae=b.get(H.id),M=v===H.id,Y=Rl(H);return r.jsxs("button",{onClick:()=>a({type:"SELECT_CASE",caseId:H.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:M?"var(--accent-muted)":"transparent",borderLeft:M?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:Q=>{M||(Q.currentTarget.style.background="var(--surface-2)")},onMouseLeave:Q=>{M||(Q.currentTarget.style.background="transparent")},children:[r.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[r.jsxs("span",{className:"text-[12px] font-medium truncate flex items-center gap-1.5",style:{color:M?"var(--text-primary)":"var(--text-secondary)"},children:["#",H.id," ",H.name,r.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:9999,background:Y==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:Y==="unit"?"var(--accent)":"var(--orange)",whiteSpace:"nowrap"},children:Y==="unit"?"U":"I"}),Y==="integration"&&((W=H.requiredCredentials)==null?void 0:W.some(Q=>ee.has(Q)))&&r.jsx("span",{title:"Configure credentials to run",children:r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),r.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})})]}),r.jsx(Iy,{result:ae})]}),r.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[H.assertions.length," assertion",H.assertions.length!==1?"s":"",(ae==null?void 0:ae.passRate)!=null&&r.jsx(lE,{passRate:ae.passRate})]})]},H.id)})]}),r.jsx("div",{className:"px-3 py-2",children:!g&&r.jsx("button",{onClick:()=>A(!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:H=>{H.currentTarget.style.borderColor="var(--accent)",H.currentTarget.style.color="var(--accent)"},onMouseLeave:H=>{H.currentTarget.style.borderColor="var(--border-default)",H.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})}),r.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:r.jsx(JC,{})})]}),r.jsx("div",{className:"overflow-auto",children:U?r.jsx(rE,{evalCase:U,result:b.get(U.id),evals:m,caseStatus:((P=S.get(U.id))==null?void 0:P.status)??"idle",onSaveEvals:s,onRun:H=>o(H,"benchmark"),onCompare:H=>o(H,"comparison"),onCancel:H=>u(H),onImprove:H=>a({type:"OPEN_IMPROVE",evalId:H})}):r.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"Select a test case"})}),N&&r.jsx(qg,{evals:C,onSave:H=>{s(H),A(!1)},onCancel:()=>A(!1)})]})}function rE({evalCase:t,result:a,evals:s,caseStatus:o,onSaveEvals:c,onRun:u,onCompare:d,onCancel:h,onImprove:g}){const{state:m,isReadOnly:y}=Rn(),{plugin:v,skill:b}=m,{entries:S,loading:k}=eE(v,b,t.id),[w,E]=p.useState(!1),[T,N]=p.useState(t.prompt),[A,_]=p.useState(!1),[D,F]=p.useState(t.expected_output);p.useState(()=>{N(t.prompt),F(t.expected_output)});const C=p.useCallback(H=>{c({...s,evals:s.evals.map(ae=>ae.id===H.id?H:ae)})},[s,c]),B=p.useCallback(()=>{C({...t,prompt:T}),E(!1)},[t,T,C]),L=p.useCallback(()=>{C({...t,expected_output:D}),_(!1)},[t,D,C]),U=p.useCallback(()=>{C({...t,assertions:[...t.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[t,C]),$=p.useCallback((H,ae)=>{C({...t,assertions:t.assertions.map(M=>M.id===H?{...M,text:ae}:M)})},[t,C]),q=p.useCallback(H=>{C({...t,assertions:t.assertions.filter(ae=>ae.id!==H)})},[t,C]),X=p.useCallback(()=>{confirm("Delete this test case?")&&c({...s,evals:s.evals.filter(H=>H.id!==t.id)})},[s,t.id,c]),ee=a&&a.assertions.length>0&&a.assertions.every(H=>H.pass),I=a&&a.assertions.some(H=>!H.pass),z=Rl(t),O=t.requiredCredentials??[],P=z==="integration"&&O.length>0;return r.jsxs("div",{className:"p-5 animate-fade-in",children:[r.jsxs("div",{className:"mb-4",style:{display:"flex",flexWrap:"wrap",alignItems:"center",rowGap:8,columnGap:12},children:[r.jsxs("div",{className:"flex items-center gap-2",style:{flex:"1 1 240px",minWidth:0},children:[r.jsxs("span",{className:"text-[16px] font-semibold",title:`#${t.id} ${t.name}`,style:{color:"var(--text-primary)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["#",t.id," ",t.name]}),y?r.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:z==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:z==="unit"?"var(--accent)":"var(--orange)"},children:z==="unit"?"Unit":"Integration"}):r.jsx("button",{onClick:()=>{if((z==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:ae,requirements:M,cleanup:Y,...W}=t;C({...W,testType:"unit"})}else C({...t,testType:"integration"})},title:`Click to switch to ${z==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:z==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:z==="unit"?"var(--accent)":"var(--orange)",border:"none",cursor:"pointer"},children:z==="unit"?"Unit":"Integration"}),r.jsx(Iy,{result:a})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:8,marginLeft:"auto",flexShrink:0},children:[o==="running"||o==="queued"?r.jsxs("button",{onClick:()=>h(t.id),className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)",whiteSpace:"nowrap"},children:[r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:r.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel"]}):r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:()=>u(t.id),disabled:y,className:"btn btn-primary text-[12px]",style:{whiteSpace:"nowrap"},children:"Run"}),r.jsx("button",{onClick:()=>d(t.id),disabled:y,className:"btn btn-secondary text-[12px]",style:{whiteSpace:"nowrap"},children:"A/B Compare"})]}),I&&!y&&o!=="running"&&o!=="queued"&&r.jsx("button",{onClick:()=>g(t.id),className:"btn btn-secondary text-[12px]",style:{whiteSpace:"nowrap"},children:"Fix with AI"}),!y&&o!=="running"&&o!=="queued"&&r.jsx("button",{onClick:X,className:"btn btn-ghost text-[12px]","aria-label":"Delete test case",title:"Delete test case",style:{color:"var(--red)"},children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("polyline",{points:"3 6 5 6 21 6"}),r.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&&z==="integration"&&r.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:[r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),r.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),r.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),r.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--accent)"},children:"Run locally in vSkill Studio"})]}),ee&&r.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:[r.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",children:[r.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),r.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),r.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--green)"},children:"All assertions passing"})]}),P&&r.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),r.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),r.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--orange)"},children:"Required Credentials"})]}),r.jsx("div",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:"This integration test requires the following environment variables:"}),r.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:O.map(H=>r.jsx("span",{style:{fontSize:10,fontFamily:"var(--font-mono, monospace)",padding:"2px 6px",borderRadius:4,background:"var(--orange-muted)",color:"var(--orange)"},children:H},H))})]}),!y&&z==="integration"&&r.jsx(oE,{evalCase:t,onUpdate:C}),r.jsx(So,{title:"Prompt",children:w?r.jsxs("div",{children:[r.jsx("textarea",{value:T,onChange:H=>N(H.target.value),className:"input-field w-full",rows:4,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsx("button",{onClick:B,className:"btn btn-primary text-[12px]",children:"Save"}),r.jsx("button",{onClick:()=>{N(t.prompt),E(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):r.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:H=>{y||(H.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:H=>{H.currentTarget.style.borderColor="var(--border-subtle)"},children:t.prompt||r.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:y?"No prompt":"Click to edit prompt..."})})}),r.jsx(So,{title:"Expected Output",children:A?r.jsxs("div",{children:[r.jsx("textarea",{value:D,onChange:H=>F(H.target.value),className:"input-field w-full",rows:3,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsx("button",{onClick:L,className:"btn btn-primary text-[12px]",children:"Save"}),r.jsx("button",{onClick:()=>{F(t.expected_output),_(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):r.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||_(!0)},onMouseEnter:H=>{y||(H.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:H=>{H.currentTarget.style.borderColor="var(--border-subtle)"},children:t.expected_output||r.jsx("span",{style:{fontStyle:"italic"},children:y?"No expected output":"Click to edit expected output..."})})}),r.jsx(So,{title:`Assertions (${t.assertions.length})`,action:y?void 0:r.jsx("button",{onClick:U,className:"btn btn-ghost text-[11px]",children:"+ Add"}),children:t.assertions.length===0?r.jsx("div",{className:"text-[12px] text-center py-4",style:{color:"var(--text-tertiary)"},children:'No assertions. Click "+ Add" to create one.'}):r.jsx("div",{className:"space-y-2",children:t.assertions.map(H=>{const ae=a==null?void 0:a.assertions.find(Y=>Y.assertion_id===H.id),M=tE(H.id,ae,S);return r.jsx(aE,{assertion:H,result:ae,badges:M,isReadOnly:y,onUpdate:Y=>$(H.id,Y),onDelete:()=>q(H.id)},H.id)})})}),(a==null?void 0:a.output)&&r.jsx(sE,{output:a.output,durationMs:a.durationMs,tokens:a.tokens}),a&&a.passRate!=null&&a.passRate<.2&&(()=>{const H=Oy("INEFFECTIVE",a.passRate);return H.recommendations&&H.recommendations.length>0?r.jsx(So,{title:"Recommendations",children:r.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("circle",{cx:"12",cy:"12",r:"10"}),r.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),r.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),r.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--orange)"},children:"This eval is significantly below expectations"})]}),r.jsx("ul",{className:"space-y-1.5 ml-1",children:H.recommendations.map((ae,M)=>r.jsxs("li",{className:"flex items-start gap-2 text-[12px]",style:{color:"var(--text-secondary)"},children:[r.jsx("span",{style:{color:"var(--orange)",fontWeight:600,flexShrink:0},children:"•"}),ae]},M))})]})}):null})(),r.jsx(iE,{evalId:t.id,sharedEntries:S,sharedLoading:k})]},t.id)}function aE({assertion:t,result:a,badges:s,isReadOnly:o,onUpdate:c,onDelete:u}){const[d,h]=p.useState(!1),[g,m]=p.useState(t.text),[y,v]=p.useState(!1),b=()=>{c(g),h(!1)};return r.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:r.jsxs("div",{className:"flex items-start gap-2",children:[a?r.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",background:a.pass?"var(--green-muted)":"var(--red-muted)"},children:a.pass?r.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})}):r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):r.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,border:"1.5px dashed var(--text-tertiary)",background:"transparent"},title:"Not run yet"}),(s==null?void 0:s.regression)&&r.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:r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),r.jsx("polyline",{points:"19 12 12 19 5 12"})]})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[r.jsx("span",{className:"text-[10px] font-mono font-semibold",style:{color:"var(--text-tertiary)"},children:t.id}),(s==null?void 0:s.flaky)&&r.jsx("span",{title:"Flaky: 30-70% pass rate across recent runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"var(--yellow-muted)",color:"var(--yellow)",whiteSpace:"nowrap"},children:"Flaky"}),(s==null?void 0:s.nonDiscriminating)&&r.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."})]}),d?r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{value:g,onChange:S=>m(S.target.value),onKeyDown:S=>{S.key==="Enter"&&b(),S.key==="Escape"&&h(!1)},className:"input-field flex-1 text-[12px]",autoFocus:!0}),r.jsx("button",{onClick:b,className:"btn btn-primary text-[11px]",children:"Save"})]}):r.jsx("div",{className:"text-[12px]",style:{color:"var(--text-secondary)",cursor:o?"default":"pointer"},onClick:()=>{o||(m(t.text),h(!0))},children:t.text}),(a==null?void 0:a.reasoning)&&r.jsx("button",{onClick:()=>v(!y),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:y?"Hide reasoning":"Show reasoning"}),y&&(a==null?void 0:a.reasoning)&&r.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:a.reasoning})]}),!o&&r.jsx("button",{onClick:u,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:r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})}function So({title:t,action:a,children:s}){return r.jsxs("div",{className:"mb-5",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:t}),a]}),s]})}function Iy({result:t}){const[a,s]=p.useState(!1);if(!t||t.status==null)return r.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"--"});const o=t.status==="pass",c=t.passRate??0,d=Oy(o?"PASS":"FAIL",c);return r.jsxs("span",{className:"pill text-[10px]",style:{background:o?"var(--green-muted)":"var(--red-muted)",color:o?"var(--green)":"var(--red)",position:"relative",cursor:"default"},onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),"aria-describedby":a?"verdict-tooltip":void 0,children:[t.passRate!=null?`${Math.round(t.passRate*100)}%`:t.status,a&&r.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:d.explanation})]})}function lE({passRate:t}){const a=Math.round(t*100);return r.jsx("div",{className:"flex items-center gap-1",children:r.jsx("div",{className:"rounded-full overflow-hidden",style:{width:32,height:4,background:"var(--surface-4)"},children:r.jsx("div",{className:"h-full rounded-full",style:{width:`${a}%`,background:a>=80?"var(--green)":a>=50?"var(--yellow)":"var(--red)"}})})})}function sE({output:t,durationMs:a,tokens:s}){const[o,c]=p.useState(!1);return r.jsxs("div",{className:"mb-5",children:[r.jsxs("button",{onClick:()=>c(!o),className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[r.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:r.jsx("polyline",{points:"9 18 15 12 9 6"})}),"LLM Output",a!=null&&r.jsxs("span",{style:{fontWeight:400},children:["(",(a/1e3).toFixed(1),"s)"]}),s!=null&&r.jsxs("span",{style:{fontWeight:400},children:["(",s," tokens)"]})]}),o&&r.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:t})]})}function Dd(t){return t==="baseline"?"right":t==="comparison"?"full":"left"}function _d({entry:t}){return r.jsxs("div",{className:"rounded-lg px-3 py-2.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[r.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:zy(t.timestamp)}),r.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:t.model}),r.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:t.type==="benchmark"?"var(--accent-muted)":t.type==="comparison"?"var(--purple-muted)":"var(--orange-muted)",color:t.type==="benchmark"?"var(--accent)":t.type==="comparison"?"var(--purple)":"var(--orange)"},children:t.type}),r.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:Dl(t.pass_rate)},children:[Math.round(t.pass_rate*100),"%"]})]}),r.jsxs("div",{className:"flex items-center gap-4 mb-1.5 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[t.durationMs!=null&&r.jsx("span",{children:Dy(t.durationMs)}),t.tokens!=null&&r.jsxs("span",{children:[t.tokens>=1e3?`${(t.tokens/1e3).toFixed(1)}k`:t.tokens," tok"]})]}),t.type==="comparison"&&t.baselinePassRate!=null&&(()=>{const a=t.pass_rate-t.baselinePassRate,s=a>.001?"skill":a<-.001?"baseline":"tie",o=a>0?"+":"",c=s==="skill"?"var(--green)":s==="baseline"?"var(--red)":"var(--text-tertiary)";return r.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[r.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"vs baseline:"}),r.jsxs("span",{className:"text-[11px] font-semibold",style:{color:a>=0?"var(--green)":"var(--red)"},children:[o,(a*100).toFixed(1),"%"]}),r.jsx("span",{className:"pill text-[9px]",style:{padding:"1px 5px",background:"var(--surface-3)",color:c},children:s})]})})(),r.jsx("div",{className:"space-y-0.5",children:t.assertions.map(a=>r.jsxs("div",{className:"flex items-start gap-1.5",children:[r.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:14,height:14,display:"flex",alignItems:"center",justifyContent:"center",background:a.pass?"var(--green-muted)":"var(--red-muted)"},children:a.pass?r.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})}):r.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),r.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:a.text})]},a.id))})]})}function iE({evalId:t,sharedEntries:a,sharedLoading:s}){const{state:o,dispatch:c}=Rn(),{plugin:u,skill:d}=o,[h,g]=p.useState(!0),m=a??null,y=s??!1,v=p.useCallback(()=>{g(w=>!w)},[]),b=m?m.slice(0,10):[],S=b.some(w=>{const E=Dd(w.type);return E==="left"||E==="full"}),k=b.some(w=>{const E=Dd(w.type);return E==="right"||E==="full"});return r.jsxs("div",{className:"mb-5",children:[r.jsxs("button",{onClick:v,className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[r.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:r.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Execution History",m&&m.length>0&&r.jsxs("span",{style:{fontWeight:400},children:["(",m.length," run",m.length!==1?"s":"",")"]})]}),h&&r.jsx("div",{className:"animate-fade-in",children:y?r.jsxs("div",{className:"flex items-center gap-2 py-3",children:[r.jsx("div",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),r.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):!m||m.length===0?r.jsx("div",{className:"text-[12px] py-3",style:{color:"var(--text-tertiary)"},children:"No history for this case"}):r.jsxs("div",{children:[b.length>=2&&r.jsx("div",{className:"mb-2",children:r.jsx(_y,{entries:b})}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[r.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"1"},children:"Skill"}),r.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"2"},children:"Baseline"}),!S&&r.jsx("div",{style:{gridColumn:"1",fontSize:12,color:"var(--text-tertiary)"},children:"No skill runs"}),!k&&r.jsx("div",{style:{gridColumn:"2",fontSize:12,color:"var(--text-tertiary)"},children:"No baseline runs"}),b.map((w,E)=>{const T=Dd(w.type);return T==="full"?r.jsx("div",{style:{gridColumn:"1 / -1"},children:r.jsx(_d,{entry:w})},E):T==="left"?r.jsxs(p.Fragment,{children:[r.jsx("div",{style:{gridColumn:"1"},children:r.jsx(_d,{entry:w})}),r.jsx("div",{style:{gridColumn:"2"}})]},E):r.jsxs(p.Fragment,{children:[r.jsx("div",{style:{gridColumn:"1"}}),r.jsx("div",{style:{gridColumn:"2"},children:r.jsx(_d,{entry:w})})]},E)})]}),r.jsx("button",{onClick:()=>c({type:"SET_PANEL",panel:"history"}),className:"mt-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--accent)"},onMouseEnter:w=>{w.currentTarget.style.textDecoration="underline"},onMouseLeave:w=>{w.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function qg({evals:t,onSave:a,onCancel:s}){const[o,c]=p.useState(""),[u,d]=p.useState(""),[h,g]=p.useState(""),[m,y]=p.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[v,b]=p.useState("unit"),[S,k]=p.useState(""),[w,E]=p.useState([]),[T,N]=p.useState(""),[A,_]=p.useState(""),D=Math.max(0,...t.evals.map(L=>L.id))+1,F=L=>{b(L),L==="unit"&&(E([]),k(""),N(""),_(""))},C=()=>{const L=S.trim().toUpperCase();L&&!w.includes(L)&&E([...w,L]),k("")},B=()=>{if(!o.trim()||!u.trim())return;const L={id:D,name:o.trim(),prompt:u.trim(),expected_output:h.trim(),files:[],assertions:m.filter(U=>U.text.trim()),...v==="integration"?{testType:"integration",...w.length>0?{requiredCredentials:w}:{},...T||A?{requirements:{...T?{platform:T}:{},...A?{chromeProfile:A}:{}}}:{}}:{}};a({...t,evals:[...t.evals,L]})};return r.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:r.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:[r.jsx("div",{className:"text-[15px] font-semibold mb-4",style:{color:"var(--text-primary)"},children:"New Test Case"}),r.jsxs("div",{className:"mb-3",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1.5 block",style:{color:"var(--text-tertiary)"},children:"Type"}),r.jsx("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)",display:"inline-flex"},children:["unit","integration"].map(L=>r.jsx("button",{onClick:()=>F(L),className:"px-3 py-1 rounded-md text-[12px] font-medium transition-all duration-150",style:{background:v===L?L==="unit"?"var(--accent-muted)":"var(--orange-muted)":"transparent",color:v===L?L==="unit"?"var(--accent)":"var(--orange)":"var(--text-tertiary)",border:"none",cursor:"pointer",textTransform:"capitalize"},children:L},L))})]}),r.jsxs("label",{className:"block mb-3",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Name"}),r.jsx("input",{value:o,onChange:L=>c(L.target.value),className:"input-field",placeholder:"e.g., auth-check",autoFocus:!0})]}),r.jsxs("label",{className:"block mb-3",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Prompt"}),r.jsx("textarea",{value:u,onChange:L=>d(L.target.value),className:"input-field",rows:3,placeholder:"User prompt to test..."})]}),r.jsxs("label",{className:"block mb-3",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Expected Output"}),r.jsx("textarea",{value:h,onChange:L=>g(L.target.value),className:"input-field",rows:2,placeholder:"Description of expected behavior..."})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Assertions"}),m.map((L,U)=>r.jsxs("div",{className:"flex gap-2 mb-2",children:[r.jsx("input",{value:L.text,onChange:$=>y(m.map((q,X)=>X===U?{...q,text:$.target.value}:q)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),m.length>1&&r.jsx("button",{onClick:()=>y(m.filter(($,q)=>q!==U)),className:"btn btn-ghost p-1",style:{color:"var(--text-tertiary)"},children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},L.id)),r.jsx("button",{onClick:()=>y([...m,{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--accent)"},children:"+ Add Assertion"})]}),v==="integration"&&r.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},children:"Integration Settings"}),r.jsxs("div",{className:"mb-3",children:[r.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),r.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:w.map(L=>r.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:[L,r.jsx("button",{onClick:()=>E(w.filter(U=>U!==L)),style:{color:"var(--orange)",lineHeight:1},children:r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},L))}),r.jsxs("div",{className:"flex gap-1.5",children:[r.jsx("input",{value:S,onChange:L=>k(L.target.value),onKeyDown:L=>{L.key==="Enter"&&(L.preventDefault(),C())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., SLACK_BOT_TOKEN"}),r.jsx("button",{onClick:C,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),r.jsxs("label",{className:"block mb-3",children:[r.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),r.jsx("input",{value:T,onChange:L=>N(L.target.value),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),r.jsxs("label",{className:"block",children:[r.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),r.jsx("input",{value:A,onChange:L=>_(L.target.value),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx("button",{onClick:s,className:"btn btn-secondary text-[12px]",children:"Cancel"}),r.jsx("button",{onClick:B,disabled:!o.trim()||!u.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function oE({evalCase:t,onUpdate:a}){var d,h;const[s,o]=p.useState(""),c=()=>{const g=s.trim().toUpperCase();g&&!(t.requiredCredentials??[]).includes(g)&&a({...t,requiredCredentials:[...t.requiredCredentials??[],g]}),o("")},u=g=>{const m=(t.requiredCredentials??[]).filter(y=>y!==g);a({...t,requiredCredentials:m.length>0?m:void 0})};return r.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},children:"Integration Settings"}),r.jsxs("div",{className:"mb-2.5",children:[r.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),r.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:(t.requiredCredentials??[]).map(g=>r.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"var(--orange-muted)",color:"var(--orange)"},children:[g,r.jsx("button",{onClick:()=>u(g),style:{color:"var(--orange)",lineHeight:1},children:r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g))}),r.jsxs("div",{className:"flex gap-1.5",children:[r.jsx("input",{value:s,onChange:g=>o(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),c())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., GITHUB_TOKEN"}),r.jsx("button",{onClick:c,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),r.jsxs("div",{className:"mb-2.5",children:[r.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),r.jsx("input",{value:((d=t.requirements)==null?void 0:d.platform)??"",onChange:g=>a({...t,requirements:{...t.requirements,platform:g.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),r.jsx("input",{value:((h=t.requirements)==null?void 0:h.chromeProfile)??"",onChange:g=>a({...t,requirements:{...t.requirements,chromeProfile:g.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]})}function Tn(t,a){return a==="free"?"Free":a==="subscription"&&t==null?"Included":t==null?"N/A":t>=1?`$${t.toFixed(2)}`:t===0?"$0.00":t>=.001?`$${t.toFixed(4)}`:`$${t.toPrecision(3).replace(/0+$/,"").replace(/\.$/,"")}`}function Uy(t,a){return t==null||a==null?"N/A":`${t.toLocaleString("en-US")} in / ${a.toLocaleString("en-US")} out`}function cE(t){return t==="baseline"?"Baseline Pass Rate":"Skill Pass Rate"}function uE(t,a){let s="";if(a){const c=new Date(a);isNaN(c.getTime())||(s=c.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}))}return[t,s].filter(Boolean).join(" · ")}function dE(t,a,s){const o=s===1?"test case":"test cases";if(t===0)return`Your skill performs the same as the baseline across ${s} ${o}`;const c=Math.round(Math.abs(t)*a);if(c===0)return`Your skill performs the same as the baseline across ${s} ${o}`;const u=t>0?"more":"fewer";return`Your skill passes ${c} ${u} assertions across ${s} ${o}`}function Yg(t,a){const s=o=>{const c=o/5*100;return isFinite(c)?Math.round(Math.min(100,Math.max(0,c))):0};return{skill:s(t),baseline:s(a)}}function fE(t){return t==="skill"?{text:"Skill wins",isSkill:!0}:t==="baseline"?{text:"Baseline wins",isSkill:!1}:{text:"Tie",isSkill:!1}}function pE(t,a){const s=t+a,o=s*10,c=s*25,u=d=>d>=60?`${Math.round(d/60)}m`:`${d}s`;return`${u(o)}–${u(c)}`}const mE={anthropic:.01,openrouter:.01,ollama:0,"lm-studio":0,"claude-cli":0,"codex-cli":0,"gemini-cli":0};function hE(t,a){if(!t)return null;const s=mE[t];if(s==null||s===0)return null;const o=s*a*.5,c=s*a*2;return`${Tn(o)}–${Tn(c)}`}function xE(){const{state:t,runCase:a,runAll:s,cancelCase:o,cancelAll:c,isReadOnly:u}=Rn(),{evals:d,caseRunStates:h,bulkRunActive:g,latestBenchmark:m,inlineResults:y}=t,{config:v}=$a(),b=(d==null?void 0:d.evals)??[],S=p.useMemo(()=>{for(const C of h.values())if(C.status==="running"||C.status==="queued")return!0;return!1},[h]),k=b.filter(C=>{const B=h.get(C.id);return B&&(B.status==="complete"||B.status==="error"||B.status==="cancelled")}).length,w=b.filter(C=>{const B=h.get(C.id);return B&&(B.status==="running"||B.status==="queued")}).length,E=p.useRef(null),[T,N]=p.useState(0);p.useEffect(()=>{if(S&&!E.current&&(E.current=Date.now()),!S){E.current=null,N(0);return}const C=setInterval(()=>{E.current&&N(Math.round((Date.now()-E.current)/1e3))},1e3);return()=>clearInterval(C)},[S]);const A=b.reduce((C,B)=>C+B.assertions.length,0),_=b.length+A,D=p.useMemo(()=>pE(b.length,A),[b.length,A]),F=p.useMemo(()=>hE((v==null?void 0:v.provider)??null,_),[v==null?void 0:v.provider,_]);return r.jsxs("div",{className:"p-5",children:[u&&r.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:[r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),r.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Installed skill — benchmarking is disabled. Edit the source skill to run benchmarks."]}),r.jsxs("div",{className:"rounded-xl p-4 mb-5",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Benchmark"}),S&&r.jsxs("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:[w," running"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[S&&r.jsxs("button",{onClick:c,className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:[r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:r.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel All"]}),r.jsx("button",{onClick:()=>s("comparison"),disabled:b.length===0||S||u,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"}),r.jsx("button",{onClick:()=>s("benchmark"),disabled:b.length===0||S||u,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using your skill only",children:"Test Skill"}),r.jsx("button",{onClick:()=>s("baseline"),disabled:b.length===0||S||u,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using the baseline (no skill) for reference",children:"Test Baseline"})]}),!S&&b.length>0&&r.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[10px]",style:{color:"var(--text-tertiary)"},children:[r.jsxs("span",{children:["Est. duration: ",D]}),F&&r.jsxs("span",{children:["Est. cost: ",F]}),!F&&(v==null?void 0:v.provider)&&(v.provider==="claude-cli"||v.provider==="codex-cli")&&r.jsx("span",{children:"Cost: Included"}),!F&&(v==null?void 0:v.provider)&&(v.provider==="ollama"||v.provider==="lm-studio"||v.provider==="gemini-cli")&&r.jsx("span",{children:"Cost: Free"})]})]}),S&&b.length>0&&r.jsxs("div",{className:"mb-5",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("span",{className:"text-[12px] font-medium",style:{color:"var(--text-secondary)"},children:["Progress: ",k,"/",b.length," cases"]}),r.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(k/b.length*100),"%"]})]}),r.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:r.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${k/b.length*100}%`,background:"var(--accent)"}})}),r.jsxs("div",{className:"flex items-center justify-between mt-1.5",children:[r.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Elapsed: ",T>=60?`${Math.floor(T/60)}m ${T%60}s`:`${T}s`]}),r.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Est. total: ",D]})]})]}),r.jsx("div",{className:"space-y-3 stagger-children",children:b.map(C=>{const B=y.get(C.id),L=h.get(C.id),U=(L==null?void 0:L.status)??"idle",$=m==null?void 0:m.cases.find(q=>q.eval_id===C.id);return r.jsx(vE,{name:C.name,evalId:C.id,result:B,caseCost:$==null?void 0:$.cost,caseBillingMode:$==null?void 0:$.billingMode,caseInputTokens:$==null?void 0:$.inputTokens,caseOutputTokens:$==null?void 0:$.outputTokens,caseStatus:U,runMode:(L==null?void 0:L.mode)??null,comparisonDetail:$==null?void 0:$.comparisonDetail,isReadOnly:u,onRun:q=>a(q,"benchmark"),onBaseline:q=>a(q,"baseline"),onCompare:q=>a(q,"comparison"),onCancel:q=>o(q)},C.id)})}),!S&&m&&m.cases.length>0&&r.jsxs("div",{className:"mt-5",children:[r.jsxs("div",{className:"rounded-xl p-4 mb-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:cE(m.type)}),r.jsx("span",{className:"text-[20px] font-bold",style:{color:(m.overall_pass_rate??0)>=.8?"var(--green)":(m.overall_pass_rate??0)>=.5?"var(--yellow)":"var(--red)"},children:m.overall_pass_rate!=null?`${Math.round(m.overall_pass_rate*100)}%`:"--"})]}),m.totalDurationMs!=null&&r.jsxs("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:["Total: ",(m.totalDurationMs/1e3).toFixed(1),"s",m.model&&` | Model: ${m.model}`,m.totalInputTokens!=null&&m.totalOutputTokens!=null&&` | Tokens: ${Uy(m.totalInputTokens,m.totalOutputTokens)}`,m.totalCost!=null&&` | Cost: ${Tn(m.totalCost)}`]}),m.overall_pass_rate>=.9999&&!m.comparison&&r.jsx("button",{onClick:()=>s("comparison"),disabled:b.length===0||u,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:b.length===0?.5:1},children:"Run Final A/B Comparison"})]}),m.comparison&&r.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[r.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Skill vs Baseline"}),(()=>{const C=uE(m.model,m.timestamp);return C?r.jsx("div",{className:"text-[10px] mt-0.5 mb-3",style:{color:"var(--text-tertiary)"},children:C}):r.jsx("div",{className:"mb-3"})})(),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsx(Kg,{label:"Skill",value:m.comparison.skillPassRate,color:"var(--accent)"}),r.jsx(Kg,{label:"Baseline",value:m.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),r.jsxs("div",{className:"mt-3 text-[12px] font-medium",style:{color:m.comparison.delta>0?"var(--green)":m.comparison.delta<0?"var(--red)":"var(--text-tertiary)"},children:["Delta: ",m.comparison.delta>0?"+":"",(m.comparison.delta*100).toFixed(1),"%",m.verdict&&` | ${ZC(m.verdict)}`]}),(()=>{const C=m.cases.reduce((L,U)=>L+U.assertions.length,0),B=dE(m.comparison.delta,C,m.cases.length);return r.jsx("div",{className:"mt-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:B})})()]})]})]})}const gE={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 vE({name:t,evalId:a,result:s,caseCost:o,caseBillingMode:c,caseInputTokens:u,caseOutputTokens:d,caseStatus:h,runMode:g,comparisonDetail:m,isReadOnly:y,onRun:v,onBaseline:b,onCompare:S,onCancel:k}){const[w,E]=p.useState(!1),T=h==="running"||h==="queued",N=h==="complete"||h==="error";return r.jsxs("div",{className:"rounded-xl overflow-hidden transition-all duration-200",style:{background:"var(--surface-1)",border:T?"1px solid var(--accent)":"1px solid var(--border-subtle)",boxShadow:T?"0 0 12px rgba(99, 131, 255, 0.15)":"none"},children:[r.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[h==="running"&&r.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),h==="queued"&&r.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--text-tertiary)"},children:"queued"}),r.jsxs("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:["#",a," ",t]}),g&&(T||N)&&(()=>{const A=gE[g];return A?r.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:A.bg,color:A.color,padding:"1px 6px"},children:A.label}):null})()]}),r.jsxs("div",{className:"flex items-center gap-2",children:[T?r.jsx("button",{onClick:()=>k(a),className:"btn text-[10px] px-2 py-1",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:"Cancel"}):r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:()=>S(a),disabled:y,className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),r.jsx("button",{onClick:()=>v(a),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),r.jsx("button",{onClick:()=>b(a),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Base"})]}),s&&s.status!=null&&r.jsx("span",{className:"pill text-[10px]",style:{background:s.status==="pass"?"var(--green-muted)":"var(--red-muted)",color:s.status==="pass"?"var(--green)":"var(--red)"},children:s.passRate!=null?`${Math.round(s.passRate*100)}%`:s.status}),u!=null&&d!=null&&r.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:Uy(u,d)}),o!=null&&r.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:Tn(o,c)}),h==="cancelled"&&r.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"cancelled"})]})]}),s&&s.assertions.length>0&&r.jsxs("div",{className:"px-4 pb-3",children:[r.jsx("div",{className:"space-y-1",children:s.assertions.map(A=>r.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[r.jsx("span",{style:{color:A.pass?"var(--green)":"var(--red)"},children:A.pass?"PASS":"FAIL"}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:A.text})]},A.assertion_id))}),s.output&&r.jsx("button",{onClick:()=>E(!w),className:"text-[11px] mt-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:w?"Hide output":"Show output"}),w&&s.output&&r.jsx("pre",{className:"text-[11px] mt-2 p-3 rounded-lg overflow-auto",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:200,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap"},children:s.output})]}),m&&r.jsx("div",{className:"px-4 pb-3",children:r.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:r.jsx("div",{className:"flex items-center gap-4 text-[11px] flex-wrap",children:(()=>{const A=Yg(m.skillContentScore,m.baselineContentScore),_=Yg(m.skillStructureScore,m.baselineStructureScore),D=fE(m.winner);return r.jsxs(r.Fragment,{children:[r.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Content: Skill ",A.skill,"% / Baseline ",A.baseline,"%"]}),r.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),r.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Structure: Skill ",_.skill,"% / Baseline ",_.baseline,"%"]}),r.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),r.jsx("span",{style:{color:D.isSkill?"var(--accent)":"var(--text-tertiary)",fontWeight:500},children:D.text})]})})()})})}),s&&s.errorMessage&&r.jsx(yE,{errorMessage:s.errorMessage,classifiedError:s.classifiedError})]})}const Od={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function yE({errorMessage:t,classifiedError:a}){const[s,o]=p.useState(!1),c=(a==null?void 0:a.title)??"Error",u=a==null?void 0:a.hint,d=a?Od[a.category]??Od.unknown:Od.unknown;return r.jsx("div",{className:"px-4 pb-3",children:r.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:"var(--red-muted)",border:"1px solid var(--red-muted)"},children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[r.jsx("span",{style:{fontSize:12},children:d}),r.jsx("span",{className:"text-[11.5px] font-semibold flex-1",style:{color:"var(--red)"},children:c}),r.jsx("button",{onClick:()=>o(!s),className:"text-[10px] px-1.5 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},children:s?"Hide details":"Details"})]}),u&&r.jsx("div",{className:"px-3 pb-2 text-[10.5px]",style:{color:"var(--text-secondary)"},children:u}),s&&r.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:t})]})})}function Kg({label:t,value:a,color:s}){return r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:t}),r.jsxs("span",{className:"text-[12px] font-semibold",style:{color:s},children:[Math.round(a*100),"%"]})]}),r.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:r.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${a*100}%`,background:s}})})]})}const Xg={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 bE(){const{state:t,dispatch:a,runActivationTest:s,cancelActivation:o,generateActivationPrompts:c}=Rn(),{plugin:u,skill:d,activationPrompts:h,activationResults:g,activationSummary:m,activationRunning:y,activationError:v,activationStartedAt:b,activationClassifyingStatus:S,generatingPrompts:k,generatingPromptsError:w,activationHistory:E}=t,{state:T}=er(),N=T.skills.find(P=>P.plugin===u&&P.skill===d),A=(N==null?void 0:N.resolvedVersion)??(N==null?void 0:N.version)??null,[_,D]=p.useState(h),[F,C]=p.useState(null),[B,L]=p.useState(!1);p.useEffect(()=>{h&&h!==_&&D(h)},[h]),p.useEffect(()=>{a({type:"SET_ACTIVATION_PROMPTS",prompts:_})},[_,a]),p.useEffect(()=>{fetch(`/api/skills/${u}/${d}/description`).then(P=>P.json()).then(P=>C(P.rawContent||P.description||null)).catch(()=>C(null))},[u,d]);function U(){s(_)}function $(){c(8)}const q=_.trim().split(`
|
|
80
|
+
`);F(se),B(Jo(d,se)),_(!1)}else ct==="error"&&(q(Nt.message||Nt.description||"Generation failed"),_(!1))}catch{}ct=""}}}catch(Kt){Kt.name!=="AbortError"&&q(Kt.message)}finally{_(!1),X.current=null}},[T,ee,d]),Gt=p.useCallback(()=>{D&&a({type:"SET_CONTENT",content:D}),C(!1),F(null),B([]),N(""),U([])},[D,a]),We=p.useCallback(()=>{C(!1),F(null),B([]),N(""),U([]),q(null)},[]),nt=p.useCallback(()=>{var ye;w?((ye=X.current)==null||ye.abort(),We()):(m&&a({type:"CLOSE_AI_EDIT"}),C(!0))},[w,m,a,We]),xn=[{mode:"raw",icon:r.jsx(YC,{}),label:"Editor"},{mode:"split",icon:r.jsx(KC,{}),label:"Split"},{mode:"preview",icon:r.jsx(XC,{}),label:"Preview"}];return r.jsxs("div",{className:"flex flex-col h-full",onKeyDown:gt,tabIndex:-1,children:[r.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:[r.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:xn.map(({mode:ye,icon:ot,label:Wt})=>r.jsxs("button",{onClick:()=>v(ye),title:Wt,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:[ot,r.jsx("span",{style:{letterSpacing:"0.01em"},children:Wt})]},ye))}),W?o?r.jsx("div",{className:"flex items-center gap-2",children:r.jsxs("span",{className:"flex items-center gap-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),r.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Read-only"]})}):r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("button",{onClick:()=>{m?a({type:"CLOSE_AI_EDIT"}):(w&&We(),a({type:"OPEN_AI_EDIT"}))},title:"Edit with AI (Ctrl+K)",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:m?600:400,border:"none",cursor:"pointer",color:m?"var(--purple)":"var(--text-tertiary)",background:m?"var(--purple-muted)":"transparent"},children:[r.jsx(QC,{size:13}),r.jsx("span",{children:"AI Edit"})]}),r.jsxs("button",{onClick:nt,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:w?600:400,border:"none",cursor:"pointer",color:w?"var(--purple)":"var(--text-tertiary)",background:w?"var(--purple-muted)":"transparent"},children:[r.jsx(Dd,{size:13}),r.jsx("span",{children:"Regenerate"})]}),r.jsx("div",{style:{width:1,height:16,background:"var(--border-subtle)"}}),h&&r.jsx("button",{onClick:()=>a({type:"SET_CONTENT",content:t.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),r.jsx("button",{onClick:Ct,disabled:!h||b,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:b?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Saving..."]}):"Save"}),I.hasRemote&&I.remoteUrl&&r.jsx(GC,{remoteUrl:I.remoteUrl,provider:ee==null?void 0:ee.provider,model:ee==null?void 0:ee.model})]}):null]}),c&&u&&r.jsx(BC,{files:z,activeFile:O,onSelect:de,onRefresh:Y}),!W&&r.jsx(HC,{file:P,loading:H,error:ae,viewMode:y,plugin:c??void 0,skill:u??void 0,onSaved:()=>{M(O),Y()},onDirtyChange:oe}),W&&r.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:y==="raw"||y==="preview"?"1fr":"1fr 1fr"},children:[y!=="preview"&&r.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:y==="split"?"1px solid var(--border-subtle)":"none"},children:r.jsx("textarea",{ref:k,value:d,onChange:ye=>{o||a({type:"SET_CONTENT",content:ye.target.value})},onKeyDown:gt,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"&&r.jsx("div",{className:"overflow-auto",style:{background:"var(--surface-0)"},children:r.jsxs("div",{className:"animate-fade-in",style:{padding:"20px 24px",maxWidth:720},children:[(Oe||xe||le)&&r.jsxs("div",{style:{marginBottom:20},children:[r.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[Oe&&r.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:Oe}),xe&&r.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",xe]})]}),le&&r.jsx("p",{style:{fontSize:12.5,lineHeight:1.65,color:"var(--text-secondary)",margin:0,paddingLeft:12,borderLeft:"2px solid var(--accent)",maxWidth:600},children:le})]}),Be.length>0&&r.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:Be.map(ye=>r.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))}),Re.length>0&&r.jsx("div",{style:{marginBottom:16},children:r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",marginRight:4},children:"Tools"}),Re.map(ye=>r.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))]})}),lt.length>0&&r.jsx("div",{style:{marginBottom:16,padding:"8px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:lt.map(([ye,ot],Wt)=>{const Kt=Array.isArray(ot)?ot.join(", "):typeof ot=="object"?Object.entries(ot).map(([An,Et])=>`${An}: ${Array.isArray(Et)?Et.join(", "):Et}`).join(" | "):ot;return r.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:Wt>0?"1px solid var(--border-subtle)":"none"},children:[r.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",minWidth:80,flexShrink:0},children:ye}),r.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:Kt})]},ye)})}),(Oe||le||Be.length>0||Re.length>0||lt.length>0)&&ce&&r.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),ce&&r.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Zo(ce)}})]})})]}),W&&m&&r.jsx(MC,{}),W&&w&&r.jsx("div",{className:"animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:r.jsxs("div",{className:"px-4 py-3",children:[!D&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Dd,{size:14}),r.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerate Skill"})]}),r.jsx("div",{className:"flex gap-2 mb-2",children:r.jsx("textarea",{value:T,onChange:ye=>N(ye.target.value),placeholder:"Describe what this skill should do...",rows:2,disabled:A,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:A?.5:1},onKeyDown:ye=>{ye.key==="Enter"&&(ye.ctrlKey||ye.metaKey)&&T.trim()&&!A&&(ye.preventDefault(),Tt())}})}),r.jsxs("div",{className:"flex items-center gap-2",children:[A?r.jsx("button",{onClick:()=>{var ye;(ye=X.current)==null||ye.abort(),_(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):r.jsx("button",{onClick:Tt,disabled:!T.trim(),className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:"Generate"}),r.jsx("button",{onClick:We,className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Close"})]}),A&&L.length>0&&r.jsx("div",{className:"mt-2",children:r.jsx(ai,{entries:L,isRunning:!0})}),$&&r.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:[$,r.jsx("button",{onClick:Tt,className:"ml-2 underline",style:{color:"var(--red)"},children:"Retry"})]})]}),D&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Dd,{size:14}),r.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerated — Review Changes"})]}),r.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:"300px",overflowY:"auto"},children:E.map((ye,ot)=>r.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:[r.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:ye.type==="added"?"+":ye.type==="removed"?"-":" "}),ye.content]},ot))}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("button",{onClick:Gt,className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:[r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),r.jsx("button",{onClick:We,className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Discard"})]})]})]})}),W&&g!==null&&c&&u&&r.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:r.jsx(wC,{plugin:c,skill:u,skillContent:d,onApplied:ye=>{a({type:"SET_CONTENT",content:ye}),a({type:"CONTENT_SAVED"}),a({type:"CLOSE_IMPROVE"})}})})]})}function Rl(t){return t.testType==="integration"?"integration":"unit"}function Dl(t){return t>=.8?"var(--green)":t>=.5?"var(--yellow)":"var(--red)"}function _y(t){const a=new Date(t);return a.toLocaleDateString(void 0,{month:"short",day:"numeric"})+", "+a.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function Oy(t){return t==null?"--":t>=1e3?`${(t/1e3).toFixed(1)}s`:`${t}ms`}const JC=new Set(["benchmark","comparison","baseline"]);function qg(t,a,s,o){return t.map(({rate:c,idx:u,total:d})=>{const h=o+u/(d-1)*(a-o*2),g=o+(s-o*2)-c*(s-o*2);return`${h},${g}`})}function By({entries:t}){const a=t.filter(v=>JC.has(v.type)).slice().reverse(),s=a.map((v,b,S)=>({rate:v.pass_rate,idx:b,total:S.length})).filter((v,b)=>{const S=a[b].type;return S==="benchmark"||S==="comparison"}),o=a.flatMap((v,b)=>v.type==="baseline"?[{rate:v.pass_rate,idx:b,total:a.length}]:v.type==="comparison"&&v.baselinePassRate!=null?[{rate:v.baselinePassRate,idx:b,total:a.length}]:[]);if(s.length<2&&o.length<2)return null;const c=80,u=24,d=2,h=s.length>=2?qg(s,c,u,d):[],g=o.length>=2?qg(o,c,u,d):[],m=h[h.length-1],y=g[g.length-1];return r.jsxs("svg",{width:c,height:u,style:{display:"block",flexShrink:0},children:[g.length>0&&r.jsx("polyline",{points:g.join(" "),fill:"none",stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:"3 2"}),h.length>0&&r.jsx("polyline",{points:h.join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),y&&r.jsx("circle",{cx:parseFloat(y.split(",")[0]),cy:parseFloat(y.split(",")[1]),r:2.5,fill:"var(--text-tertiary)"}),m&&r.jsx("circle",{cx:parseFloat(m.split(",")[0]),cy:parseFloat(m.split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function Iy(t,a,s){const o=isNaN(a)?0:a,c=[],u=[],d=[];if((t==="PASS"||t==="EFFECTIVE")&&o>=.7){const m=c.length>0?` Met criteria: ${c.map(y=>y.criterion).join(", ")}.`:"";return{explanation:`${t} (score ${o.toFixed(2)}): evaluation met expectations.${m}`}}if(t==="FAIL"||t==="DEGRADING"){const m=u.length>0?` Failed criteria: ${u.map(v=>v.criterion).join(", ")}.`:"",y=[...u.map(v=>`Improve "${v.criterion}" (score: ${v.score.toFixed(2)})`),...d.map(v=>`Strengthen "${v.criterion}" (score: ${v.score.toFixed(2)})`)];return y.length===0&&y.push("Review prompt instructions and add more specific guidance"),{explanation:`${t} (score ${o.toFixed(2)}): evaluation did not meet expectations.${m}`,recommendations:y}}if(t==="INEFFECTIVE"){if(o<.2){const y=[...u.map(v=>`Rework "${v.criterion}" — currently at ${v.score.toFixed(2)}`),"Consider adding examples to your system prompt","Review the rubric criteria for achievability"];return{explanation:`${t} (score ${o.toFixed(2)}): evaluation is significantly below expectations.`,recommendations:y}}const m=[...u.map(y=>`Rework "${y.criterion}" — currently at ${y.score.toFixed(2)}`),...d.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return m.length===0&&m.push("Consider restructuring your prompt approach"),{explanation:`${t} (score ${o.toFixed(2)}): below expectations but showing some capability.`,recommendations:m}}if(t==="MARGINAL"){const m=[...d.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`),...u.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return m.length===0&&m.push(c.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Review prompt instructions for areas of improvement"),{explanation:`${t} (score ${o.toFixed(2)}): moderate improvement detected.`,recommendations:m}}if(t==="EMERGING"){const m=[...u.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`),...d.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return m.length===0&&m.push(c.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Add more specific guidance to your prompt instructions"),{explanation:`${t} (score ${o.toFixed(2)}): early promise — focus on weak areas to improve.`,recommendations:m}}const h=c.length>0?` Passing: ${c.map(m=>m.criterion).join(", ")}.`:"",g=d.length>0?` Needs improvement: ${d.map(m=>m.criterion).join(", ")}.`:"";return{explanation:`${t} (score ${o.toFixed(2)}): mixed results.${h}${g}`}}const Uy={EFFECTIVE:"Strong Improvement",MARGINAL:"Moderate Improvement",EMERGING:"Early Promise",INEFFECTIVE:"Needs Work",DEGRADING:"Regression"};function eE(t){return Object.hasOwn(Uy,t)}function tE(t){return eE(t)?Uy[t]:t}function nE(){const{state:t}=Rn(),{plugin:a,skill:s}=t,[o,c]=p.useState([]),[u,d]=p.useState([]),[h,g]=p.useState(!0),[m,y]=p.useState(null),[v,b]=p.useState(new Set),[S,k]=p.useState({}),[w,C]=p.useState(null),[T,N]=p.useState(""),[A,_]=p.useState(!1),[D,F]=p.useState(""),[E,B]=p.useState(""),L=p.useCallback(async()=>{g(!0),y(null);try{const[I,z]=await Promise.all([we.getCredentials(a,s),we.getParams(a,s)]);c(I.credentials),d(z.params)}catch(I){y(I instanceof Error?I.message:"Failed to load parameters"),c([]),d([])}finally{g(!1)}},[a,s]);p.useEffect(()=>{L()},[L]);const U=p.useCallback(async(I,z)=>{_(!0),y(null);try{await we.setCredential(a,s,I,z),C(null),N(""),await L()}catch(O){y(O instanceof Error?O.message:`Failed to save ${I}`)}finally{_(!1)}},[a,s,L]),$=p.useCallback(async()=>{const I=D.trim().toUpperCase(),z=E.trim();if(!(!I||!z)){_(!0),y(null);try{await we.setCredential(a,s,I,z),F(""),B(""),await L()}catch(O){y(O instanceof Error?O.message:`Failed to add ${I}`)}finally{_(!1)}}},[a,s,D,E,L]),q=p.useCallback(async I=>{if(v.has(I)){b(z=>{const O=new Set(z);return O.delete(I),O}),k(z=>{const O={...z};return delete O[I],O});return}try{const O=(await we.getParamsRevealed(a,s,I)).params.find(P=>P.name===I);O!=null&&O.value&&(k(P=>({...P,[I]:O.value})),b(P=>new Set(P).add(I)))}catch{}},[a,s,v]),X=new Set(o.map(I=>I.name)),ee=[...o.map(I=>{const z=u.find(O=>O.name===I.name);return{name:I.name,status:I.status,maskedValue:(z==null?void 0:z.maskedValue)??""}}),...u.filter(I=>!X.has(I.name)).map(I=>({name:I.name,status:I.status,maskedValue:I.maskedValue}))];return r.jsxs("div",{className:"py-2 px-3",children:[r.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters"}),m&&r.jsx("div",{className:"text-[10px] px-2 py-1.5 rounded mb-2",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},role:"alert",children:m}),h&&ee.length===0&&r.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!h&&ee.length===0&&!m&&r.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),ee.map(I=>r.jsxs("div",{className:"flex items-center gap-2 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx("span",{className:"text-[10px] font-mono flex-1 truncate",style:{color:"var(--text-primary)"},children:I.name}),r.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:I.status==="ready"?"var(--green-muted)":"var(--red-muted)",color:I.status==="ready"?"var(--green)":"var(--red)"},children:I.status}),(I.maskedValue||I.status==="ready")&&r.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[v.has(I.name)?S[I.name]??I.maskedValue:I.maskedValue||"***",r.jsx("button",{onClick:()=>q(I.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${v.has(I.name)?"Hide":"Reveal"} value for ${I.name}`,children:v.has(I.name)?"hide":"show"})]}),w===I.name?r.jsxs("div",{className:"flex gap-1",children:[r.jsx("input",{value:T,onChange:z=>N(z.target.value),onKeyDown:z=>{z.key==="Enter"&&T.trim()&&U(I.name,T)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${I.name}`,autoFocus:!0}),r.jsx("button",{onClick:()=>U(I.name,T),disabled:A||!T.trim(),className:"text-[10px] font-medium",style:{color:"var(--green)",background:"none",border:"none",cursor:"pointer"},children:"Save"}),r.jsx("button",{onClick:()=>{C(null),N("")},className:"text-[10px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]}):r.jsx("button",{onClick:()=>{C(I.name),N("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},I.name)),r.jsxs("div",{className:"mt-3 pt-2",style:{borderTop:"1px solid var(--border-subtle)"},children:[r.jsx("div",{className:"text-[10px] font-medium mb-1.5",style:{color:"var(--text-secondary)"},children:"Add New Parameter"}),r.jsxs("div",{className:"flex gap-1.5",children:[r.jsx("input",{value:D,onChange:I=>F(I.target.value),className:"input-field text-[10px] font-mono flex-1",placeholder:"KEY_NAME","aria-label":"Parameter key name"}),r.jsx("input",{value:E,onChange:I=>B(I.target.value),onKeyDown:I=>{I.key==="Enter"&&D.trim()&&E.trim()&&$()},className:"input-field text-[10px] font-mono flex-1",placeholder:"value",type:"password","aria-label":"Parameter value"}),r.jsx("button",{onClick:$,disabled:A||!D.trim()||!E.trim(),className:"text-[10px] font-medium px-2 py-1 rounded",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"none",cursor:A?"not-allowed":"pointer"},children:"Add"})]})]})]})}const _s="This is an installed copy (read-only). Open the source skill to edit.";function rE(t,a,s){const[o,c]=p.useState(null),[u,d]=p.useState(!1),h=p.useRef("");p.useEffect(()=>{const m=`${t}/${a}/${s}`;h.current!==m&&(h.current=m,d(!0),we.getCaseHistory(t,a,s).then(y=>c(y)).catch(()=>c([])).finally(()=>d(!1)))},[t,a,s]);const g=p.useCallback(()=>{d(!0),h.current="",we.getCaseHistory(t,a,s).then(m=>c(m)).catch(()=>c([])).finally(()=>d(!1))},[t,a,s]);return{entries:o,loading:u,refetch:g}}function aE(t,a,s){const o={flaky:!1,nonDiscriminating:!1,regression:!1};if(!s||s.length===0)return o;const u=s.slice(0,10).map(g=>g.assertions.find(m=>m.id===t)).filter(Boolean);if(u.length>=2){const m=u.filter(y=>y.pass).length/u.length;m>=.3&&m<=.7&&(o.flaky=!0)}const d=s.find(g=>g.type==="benchmark"),h=s.find(g=>g.type==="baseline");if(d&&h){const g=d.assertions.find(y=>y.id===t),m=h.assertions.find(y=>y.id===t);g!=null&&g.pass&&(m!=null&&m.pass)&&(o.nonDiscriminating=!0)}if(a&&!a.pass&&s.length>=1){const m=s[0].assertions.find(y=>y.id===t);m!=null&&m.pass&&(o.regression=!0)}return o}function lE(){var P;const{state:t,dispatch:a,saveEvals:s,runCase:o,runAll:c,cancelCase:u,cancelAll:d,generateEvals:h,isReadOnly:g}=Rn(),{evals:m,evalsError:y,selectedCaseId:v,inlineResults:b,caseRunStates:S,generateEvalsLoading:k,generateEvalsProgress:w,generateEvalsError:C}=t,T=p.useMemo(()=>{for(const H of S.values())if(H.status==="running"||H.status==="queued")return!0;return!1},[S]),[N,A]=p.useState(!1),[_,D]=p.useState("all"),F={skill_name:t.skill,evals:[]},E=m??F,B=E.evals,L=p.useMemo(()=>_==="all"?B:B.filter(H=>Rl(H)===_),[_,B]),U=L.find(H=>H.id===v)??null;p.useEffect(()=>{v!==null&&!L.find(H=>H.id===v)&&a({type:"SELECT_CASE",caseId:L.length>0?L[0].id:null})},[L,v,a]);const[$,q]=p.useState([]),X=p.useMemo(()=>B.some(H=>Rl(H)==="integration"),[B]);p.useEffect(()=>{X&&we.getCredentials(t.plugin,t.skill).then(H=>q(H.credentials)).catch(()=>q([]))},[t.plugin,t.skill,X]);const ee=p.useMemo(()=>new Set($.filter(H=>H.status==="missing").map(H=>H.name)),[$]),[I,z]=p.useState(!1),O=p.useCallback(H=>{z(!1),h(H?{testType:H}:void 0)},[h]);return!m||B.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[r.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?r.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("circle",{cx:"12",cy:"12",r:"10"}),r.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),r.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}):r.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M9 11l3 3L22 4"}),r.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),r.jsx("div",{className:"text-center",children:y?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--red)"},children:"Invalid evals.json"}),r.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}),r.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"})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No test cases yet"}),r.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Create test cases to start evaluating your skill"})]})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:()=>A(!0),disabled:g,title:g?_s:void 0,className:"btn btn-primary text-[12px]",children:"Create Test Case"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsxs("div",{className:"flex",children:[r.jsx("button",{onClick:()=>O("unit"),disabled:k||g,title:g?_s:void 0,className:"btn btn-secondary text-[12px]",style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:k?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}})," Generating..."]}):"Generate Unit Tests"}),r.jsx("button",{onClick:()=>z(!I),disabled:k||g,title:g?_s:void 0,className:"btn btn-secondary text-[12px]",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid var(--border-default)",padding:"4px 6px"},children:r.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:r.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),I&&r.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:r.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:H=>{H.currentTarget.style.background="var(--surface-2)"},onMouseLeave:H=>{H.currentTarget.style.background="transparent"},children:"Generate Integration Tests"})})]})]}),k&&w.length>0&&r.jsx("div",{className:"w-full max-w-md mt-3",children:r.jsx(ai,{entries:w,isRunning:!0})}),C&&r.jsx("div",{className:"w-full max-w-md mt-3",children:r.jsx(ec,{error:C,onRetry:()=>O()})}),N&&r.jsx(Yg,{evals:E,onSave:H=>{s(H),A(!1)},onCancel:()=>A(!1)})]}):r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"280px 1fr",height:"100%",overflow:"hidden"},children:[r.jsxs("div",{className:"overflow-auto",style:{borderRight:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[r.jsxs("div",{className:"px-3 py-2",style:{borderBottom:"1px solid var(--border-subtle)",display:"flex",flexWrap:"wrap",alignItems:"center",rowGap:6,columnGap:8},children:[r.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",flex:"1 1 auto",minWidth:0},children:["Test Cases (",L.length,")"]}),r.jsx("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6,marginLeft:"auto",flexShrink:0},children:T?r.jsx("button",{onClick:d,className:"btn text-[10px] px-2 py-0.5",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)",whiteSpace:"nowrap"},children:"Cancel All"}):r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:()=>c("benchmark"),disabled:L.length===0||g,title:g?_s:void 0,className:"btn btn-primary text-[10px] px-2 py-0.5",style:{whiteSpace:"nowrap"},children:"Run All"}),r.jsx("button",{onClick:()=>c("comparison"),disabled:L.length===0||g,title:g?_s:void 0,className:"btn btn-secondary text-[10px] px-2 py-0.5",style:{whiteSpace:"nowrap"},children:"Compare All"})]})})]}),r.jsx("div",{className:"flex px-3 py-1.5 gap-1",style:{borderBottom:"1px solid var(--border-subtle)"},children:["all","unit","integration"].map(H=>r.jsx("button",{onClick:()=>D(H),style:{padding:"2px 8px",fontSize:10,fontWeight:_===H?600:400,background:_===H?"var(--accent-muted)":"transparent",color:_===H?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:H==="all"?`All (${B.length})`:H==="unit"?`Unit (${B.filter(ae=>Rl(ae)==="unit").length})`:`Integration (${B.filter(ae=>Rl(ae)==="integration").length})`},H))}),r.jsxs("div",{className:"py-1",children:[L.length===0&&B.length>0&&r.jsxs("div",{className:"flex items-center justify-center py-8 px-3 text-[12px]",style:{color:"var(--text-tertiary)"},children:["No ",_==="all"?"":_+" ","tests yet"]}),L.map(H=>{var W;const ae=b.get(H.id),M=v===H.id,Y=Rl(H);return r.jsxs("button",{onClick:()=>a({type:"SELECT_CASE",caseId:H.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:M?"var(--accent-muted)":"transparent",borderLeft:M?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:Q=>{M||(Q.currentTarget.style.background="var(--surface-2)")},onMouseLeave:Q=>{M||(Q.currentTarget.style.background="transparent")},children:[r.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[r.jsxs("span",{className:"text-[12px] font-medium truncate flex items-center gap-1.5",style:{color:M?"var(--text-primary)":"var(--text-secondary)"},children:["#",H.id," ",H.name,r.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:9999,background:Y==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:Y==="unit"?"var(--accent)":"var(--orange)",whiteSpace:"nowrap"},children:Y==="unit"?"U":"I"}),Y==="integration"&&((W=H.requiredCredentials)==null?void 0:W.some(Q=>ee.has(Q)))&&r.jsx("span",{title:"Configure credentials to run",children:r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),r.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})})]}),r.jsx(Hy,{result:ae})]}),r.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[H.assertions.length," assertion",H.assertions.length!==1?"s":"",(ae==null?void 0:ae.passRate)!=null&&r.jsx(oE,{passRate:ae.passRate})]})]},H.id)})]}),r.jsx("div",{className:"px-3 py-2",children:!g&&r.jsx("button",{onClick:()=>A(!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:H=>{H.currentTarget.style.borderColor="var(--accent)",H.currentTarget.style.color="var(--accent)"},onMouseLeave:H=>{H.currentTarget.style.borderColor="var(--border-default)",H.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})}),r.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:r.jsx(nE,{})})]}),r.jsx("div",{className:"overflow-auto",children:U?r.jsx(sE,{evalCase:U,result:b.get(U.id),evals:m,caseStatus:((P=S.get(U.id))==null?void 0:P.status)??"idle",onSaveEvals:s,onRun:H=>o(H,"benchmark"),onCompare:H=>o(H,"comparison"),onCancel:H=>u(H),onImprove:H=>a({type:"OPEN_IMPROVE",evalId:H})}):r.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"Select a test case"})}),N&&r.jsx(Yg,{evals:E,onSave:H=>{s(H),A(!1)},onCancel:()=>A(!1)})]})}function sE({evalCase:t,result:a,evals:s,caseStatus:o,onSaveEvals:c,onRun:u,onCompare:d,onCancel:h,onImprove:g}){const{state:m,isReadOnly:y}=Rn(),{plugin:v,skill:b}=m,{entries:S,loading:k}=rE(v,b,t.id),[w,C]=p.useState(!1),[T,N]=p.useState(t.prompt),[A,_]=p.useState(!1),[D,F]=p.useState(t.expected_output);p.useState(()=>{N(t.prompt),F(t.expected_output)});const E=p.useCallback(H=>{c({...s,evals:s.evals.map(ae=>ae.id===H.id?H:ae)})},[s,c]),B=p.useCallback(()=>{E({...t,prompt:T}),C(!1)},[t,T,E]),L=p.useCallback(()=>{E({...t,expected_output:D}),_(!1)},[t,D,E]),U=p.useCallback(()=>{E({...t,assertions:[...t.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[t,E]),$=p.useCallback((H,ae)=>{E({...t,assertions:t.assertions.map(M=>M.id===H?{...M,text:ae}:M)})},[t,E]),q=p.useCallback(H=>{E({...t,assertions:t.assertions.filter(ae=>ae.id!==H)})},[t,E]),X=p.useCallback(()=>{confirm("Delete this test case?")&&c({...s,evals:s.evals.filter(H=>H.id!==t.id)})},[s,t.id,c]),ee=a&&a.assertions.length>0&&a.assertions.every(H=>H.pass),I=a&&a.assertions.some(H=>!H.pass),z=Rl(t),O=t.requiredCredentials??[],P=z==="integration"&&O.length>0;return r.jsxs("div",{className:"p-5 animate-fade-in",children:[r.jsxs("div",{className:"mb-4",style:{display:"flex",flexWrap:"wrap",alignItems:"center",rowGap:8,columnGap:12},children:[r.jsxs("div",{className:"flex items-center gap-2",style:{flex:"1 1 240px",minWidth:0},children:[r.jsxs("span",{className:"text-[16px] font-semibold",title:`#${t.id} ${t.name}`,style:{color:"var(--text-primary)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["#",t.id," ",t.name]}),y?r.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:z==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:z==="unit"?"var(--accent)":"var(--orange)"},children:z==="unit"?"Unit":"Integration"}):r.jsx("button",{onClick:()=>{if((z==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:ae,requirements:M,cleanup:Y,...W}=t;E({...W,testType:"unit"})}else E({...t,testType:"integration"})},title:`Click to switch to ${z==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:z==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:z==="unit"?"var(--accent)":"var(--orange)",border:"none",cursor:"pointer"},children:z==="unit"?"Unit":"Integration"}),r.jsx(Hy,{result:a})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:8,marginLeft:"auto",flexShrink:0},children:[o==="running"||o==="queued"?r.jsxs("button",{onClick:()=>h(t.id),className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)",whiteSpace:"nowrap"},children:[r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:r.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel"]}):r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:()=>u(t.id),disabled:y,className:"btn btn-primary text-[12px]",style:{whiteSpace:"nowrap"},children:"Run"}),r.jsx("button",{onClick:()=>d(t.id),disabled:y,className:"btn btn-secondary text-[12px]",style:{whiteSpace:"nowrap"},children:"A/B Compare"})]}),I&&!y&&o!=="running"&&o!=="queued"&&r.jsx("button",{onClick:()=>g(t.id),className:"btn btn-secondary text-[12px]",style:{whiteSpace:"nowrap"},children:"Fix with AI"}),!y&&o!=="running"&&o!=="queued"&&r.jsx("button",{onClick:X,className:"btn btn-ghost text-[12px]","aria-label":"Delete test case",title:"Delete test case",style:{color:"var(--red)"},children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("polyline",{points:"3 6 5 6 21 6"}),r.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&&z==="integration"&&r.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:[r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),r.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),r.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),r.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--accent)"},children:"Run locally in vSkill Studio"})]}),ee&&r.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:[r.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",children:[r.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),r.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),r.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--green)"},children:"All assertions passing"})]}),P&&r.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),r.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),r.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--orange)"},children:"Required Credentials"})]}),r.jsx("div",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:"This integration test requires the following environment variables:"}),r.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:O.map(H=>r.jsx("span",{style:{fontSize:10,fontFamily:"var(--font-mono, monospace)",padding:"2px 6px",borderRadius:4,background:"var(--orange-muted)",color:"var(--orange)"},children:H},H))})]}),!y&&z==="integration"&&r.jsx(dE,{evalCase:t,onUpdate:E}),r.jsx(So,{title:"Prompt",children:w?r.jsxs("div",{children:[r.jsx("textarea",{value:T,onChange:H=>N(H.target.value),className:"input-field w-full",rows:4,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsx("button",{onClick:B,className:"btn btn-primary text-[12px]",children:"Save"}),r.jsx("button",{onClick:()=>{N(t.prompt),C(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):r.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||C(!0)},onMouseEnter:H=>{y||(H.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:H=>{H.currentTarget.style.borderColor="var(--border-subtle)"},children:t.prompt||r.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:y?"No prompt":"Click to edit prompt..."})})}),r.jsx(So,{title:"Expected Output",children:A?r.jsxs("div",{children:[r.jsx("textarea",{value:D,onChange:H=>F(H.target.value),className:"input-field w-full",rows:3,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsx("button",{onClick:L,className:"btn btn-primary text-[12px]",children:"Save"}),r.jsx("button",{onClick:()=>{F(t.expected_output),_(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):r.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||_(!0)},onMouseEnter:H=>{y||(H.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:H=>{H.currentTarget.style.borderColor="var(--border-subtle)"},children:t.expected_output||r.jsx("span",{style:{fontStyle:"italic"},children:y?"No expected output":"Click to edit expected output..."})})}),r.jsx(So,{title:`Assertions (${t.assertions.length})`,action:y?void 0:r.jsx("button",{onClick:U,className:"btn btn-ghost text-[11px]",children:"+ Add"}),children:t.assertions.length===0?r.jsx("div",{className:"text-[12px] text-center py-4",style:{color:"var(--text-tertiary)"},children:'No assertions. Click "+ Add" to create one.'}):r.jsx("div",{className:"space-y-2",children:t.assertions.map(H=>{const ae=a==null?void 0:a.assertions.find(Y=>Y.assertion_id===H.id),M=aE(H.id,ae,S);return r.jsx(iE,{assertion:H,result:ae,badges:M,isReadOnly:y,onUpdate:Y=>$(H.id,Y),onDelete:()=>q(H.id)},H.id)})})}),(a==null?void 0:a.output)&&r.jsx(cE,{output:a.output,durationMs:a.durationMs,tokens:a.tokens}),a&&a.passRate!=null&&a.passRate<.2&&(()=>{const H=Iy("INEFFECTIVE",a.passRate);return H.recommendations&&H.recommendations.length>0?r.jsx(So,{title:"Recommendations",children:r.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("circle",{cx:"12",cy:"12",r:"10"}),r.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),r.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),r.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--orange)"},children:"This eval is significantly below expectations"})]}),r.jsx("ul",{className:"space-y-1.5 ml-1",children:H.recommendations.map((ae,M)=>r.jsxs("li",{className:"flex items-start gap-2 text-[12px]",style:{color:"var(--text-secondary)"},children:[r.jsx("span",{style:{color:"var(--orange)",fontWeight:600,flexShrink:0},children:"•"}),ae]},M))})]})}):null})(),r.jsx(uE,{evalId:t.id,sharedEntries:S,sharedLoading:k})]},t.id)}function iE({assertion:t,result:a,badges:s,isReadOnly:o,onUpdate:c,onDelete:u}){const[d,h]=p.useState(!1),[g,m]=p.useState(t.text),[y,v]=p.useState(!1),b=()=>{c(g),h(!1)};return r.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:r.jsxs("div",{className:"flex items-start gap-2",children:[a?r.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",background:a.pass?"var(--green-muted)":"var(--red-muted)"},children:a.pass?r.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})}):r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):r.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,border:"1.5px dashed var(--text-tertiary)",background:"transparent"},title:"Not run yet"}),(s==null?void 0:s.regression)&&r.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:r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),r.jsx("polyline",{points:"19 12 12 19 5 12"})]})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[r.jsx("span",{className:"text-[10px] font-mono font-semibold",style:{color:"var(--text-tertiary)"},children:t.id}),(s==null?void 0:s.flaky)&&r.jsx("span",{title:"Flaky: 30-70% pass rate across recent runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"var(--yellow-muted)",color:"var(--yellow)",whiteSpace:"nowrap"},children:"Flaky"}),(s==null?void 0:s.nonDiscriminating)&&r.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."})]}),d?r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{value:g,onChange:S=>m(S.target.value),onKeyDown:S=>{S.key==="Enter"&&b(),S.key==="Escape"&&h(!1)},className:"input-field flex-1 text-[12px]",autoFocus:!0}),r.jsx("button",{onClick:b,className:"btn btn-primary text-[11px]",children:"Save"})]}):r.jsx("div",{className:"text-[12px]",style:{color:"var(--text-secondary)",cursor:o?"default":"pointer"},onClick:()=>{o||(m(t.text),h(!0))},children:t.text}),(a==null?void 0:a.reasoning)&&r.jsx("button",{onClick:()=>v(!y),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:y?"Hide reasoning":"Show reasoning"}),y&&(a==null?void 0:a.reasoning)&&r.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:a.reasoning})]}),!o&&r.jsx("button",{onClick:u,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:r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})}function So({title:t,action:a,children:s}){return r.jsxs("div",{className:"mb-5",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:t}),a]}),s]})}function Hy({result:t}){const[a,s]=p.useState(!1);if(!t||t.status==null)return r.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"--"});const o=t.status==="pass",c=t.passRate??0,d=Iy(o?"PASS":"FAIL",c);return r.jsxs("span",{className:"pill text-[10px]",style:{background:o?"var(--green-muted)":"var(--red-muted)",color:o?"var(--green)":"var(--red)",position:"relative",cursor:"default"},onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),"aria-describedby":a?"verdict-tooltip":void 0,children:[t.passRate!=null?`${Math.round(t.passRate*100)}%`:t.status,a&&r.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:d.explanation})]})}function oE({passRate:t}){const a=Math.round(t*100);return r.jsx("div",{className:"flex items-center gap-1",children:r.jsx("div",{className:"rounded-full overflow-hidden",style:{width:32,height:4,background:"var(--surface-4)"},children:r.jsx("div",{className:"h-full rounded-full",style:{width:`${a}%`,background:a>=80?"var(--green)":a>=50?"var(--yellow)":"var(--red)"}})})})}function cE({output:t,durationMs:a,tokens:s}){const[o,c]=p.useState(!1);return r.jsxs("div",{className:"mb-5",children:[r.jsxs("button",{onClick:()=>c(!o),className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[r.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:r.jsx("polyline",{points:"9 18 15 12 9 6"})}),"LLM Output",a!=null&&r.jsxs("span",{style:{fontWeight:400},children:["(",(a/1e3).toFixed(1),"s)"]}),s!=null&&r.jsxs("span",{style:{fontWeight:400},children:["(",s," tokens)"]})]}),o&&r.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:t})]})}function _d(t){return t==="baseline"?"right":t==="comparison"?"full":"left"}function Od({entry:t}){return r.jsxs("div",{className:"rounded-lg px-3 py-2.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[r.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:_y(t.timestamp)}),r.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:t.model}),r.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:t.type==="benchmark"?"var(--accent-muted)":t.type==="comparison"?"var(--purple-muted)":"var(--orange-muted)",color:t.type==="benchmark"?"var(--accent)":t.type==="comparison"?"var(--purple)":"var(--orange)"},children:t.type}),r.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:Dl(t.pass_rate)},children:[Math.round(t.pass_rate*100),"%"]})]}),r.jsxs("div",{className:"flex items-center gap-4 mb-1.5 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[t.durationMs!=null&&r.jsx("span",{children:Oy(t.durationMs)}),t.tokens!=null&&r.jsxs("span",{children:[t.tokens>=1e3?`${(t.tokens/1e3).toFixed(1)}k`:t.tokens," tok"]})]}),t.type==="comparison"&&t.baselinePassRate!=null&&(()=>{const a=t.pass_rate-t.baselinePassRate,s=a>.001?"skill":a<-.001?"baseline":"tie",o=a>0?"+":"",c=s==="skill"?"var(--green)":s==="baseline"?"var(--red)":"var(--text-tertiary)";return r.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[r.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"vs baseline:"}),r.jsxs("span",{className:"text-[11px] font-semibold",style:{color:a>=0?"var(--green)":"var(--red)"},children:[o,(a*100).toFixed(1),"%"]}),r.jsx("span",{className:"pill text-[9px]",style:{padding:"1px 5px",background:"var(--surface-3)",color:c},children:s})]})})(),r.jsx("div",{className:"space-y-0.5",children:t.assertions.map(a=>r.jsxs("div",{className:"flex items-start gap-1.5",children:[r.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:14,height:14,display:"flex",alignItems:"center",justifyContent:"center",background:a.pass?"var(--green-muted)":"var(--red-muted)"},children:a.pass?r.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})}):r.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),r.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:a.text})]},a.id))})]})}function uE({evalId:t,sharedEntries:a,sharedLoading:s}){const{state:o,dispatch:c}=Rn(),{plugin:u,skill:d}=o,[h,g]=p.useState(!0),m=a??null,y=s??!1,v=p.useCallback(()=>{g(w=>!w)},[]),b=m?m.slice(0,10):[],S=b.some(w=>{const C=_d(w.type);return C==="left"||C==="full"}),k=b.some(w=>{const C=_d(w.type);return C==="right"||C==="full"});return r.jsxs("div",{className:"mb-5",children:[r.jsxs("button",{onClick:v,className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[r.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:r.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Execution History",m&&m.length>0&&r.jsxs("span",{style:{fontWeight:400},children:["(",m.length," run",m.length!==1?"s":"",")"]})]}),h&&r.jsx("div",{className:"animate-fade-in",children:y?r.jsxs("div",{className:"flex items-center gap-2 py-3",children:[r.jsx("div",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),r.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):!m||m.length===0?r.jsx("div",{className:"text-[12px] py-3",style:{color:"var(--text-tertiary)"},children:"No history for this case"}):r.jsxs("div",{children:[b.length>=2&&r.jsx("div",{className:"mb-2",children:r.jsx(By,{entries:b})}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[r.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"1"},children:"Skill"}),r.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"2"},children:"Baseline"}),!S&&r.jsx("div",{style:{gridColumn:"1",fontSize:12,color:"var(--text-tertiary)"},children:"No skill runs"}),!k&&r.jsx("div",{style:{gridColumn:"2",fontSize:12,color:"var(--text-tertiary)"},children:"No baseline runs"}),b.map((w,C)=>{const T=_d(w.type);return T==="full"?r.jsx("div",{style:{gridColumn:"1 / -1"},children:r.jsx(Od,{entry:w})},C):T==="left"?r.jsxs(p.Fragment,{children:[r.jsx("div",{style:{gridColumn:"1"},children:r.jsx(Od,{entry:w})}),r.jsx("div",{style:{gridColumn:"2"}})]},C):r.jsxs(p.Fragment,{children:[r.jsx("div",{style:{gridColumn:"1"}}),r.jsx("div",{style:{gridColumn:"2"},children:r.jsx(Od,{entry:w})})]},C)})]}),r.jsx("button",{onClick:()=>c({type:"SET_PANEL",panel:"history"}),className:"mt-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--accent)"},onMouseEnter:w=>{w.currentTarget.style.textDecoration="underline"},onMouseLeave:w=>{w.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function Yg({evals:t,onSave:a,onCancel:s}){const[o,c]=p.useState(""),[u,d]=p.useState(""),[h,g]=p.useState(""),[m,y]=p.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[v,b]=p.useState("unit"),[S,k]=p.useState(""),[w,C]=p.useState([]),[T,N]=p.useState(""),[A,_]=p.useState(""),D=Math.max(0,...t.evals.map(L=>L.id))+1,F=L=>{b(L),L==="unit"&&(C([]),k(""),N(""),_(""))},E=()=>{const L=S.trim().toUpperCase();L&&!w.includes(L)&&C([...w,L]),k("")},B=()=>{if(!o.trim()||!u.trim())return;const L={id:D,name:o.trim(),prompt:u.trim(),expected_output:h.trim(),files:[],assertions:m.filter(U=>U.text.trim()),...v==="integration"?{testType:"integration",...w.length>0?{requiredCredentials:w}:{},...T||A?{requirements:{...T?{platform:T}:{},...A?{chromeProfile:A}:{}}}:{}}:{}};a({...t,evals:[...t.evals,L]})};return r.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:r.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:[r.jsx("div",{className:"text-[15px] font-semibold mb-4",style:{color:"var(--text-primary)"},children:"New Test Case"}),r.jsxs("div",{className:"mb-3",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1.5 block",style:{color:"var(--text-tertiary)"},children:"Type"}),r.jsx("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)",display:"inline-flex"},children:["unit","integration"].map(L=>r.jsx("button",{onClick:()=>F(L),className:"px-3 py-1 rounded-md text-[12px] font-medium transition-all duration-150",style:{background:v===L?L==="unit"?"var(--accent-muted)":"var(--orange-muted)":"transparent",color:v===L?L==="unit"?"var(--accent)":"var(--orange)":"var(--text-tertiary)",border:"none",cursor:"pointer",textTransform:"capitalize"},children:L},L))})]}),r.jsxs("label",{className:"block mb-3",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Name"}),r.jsx("input",{value:o,onChange:L=>c(L.target.value),className:"input-field",placeholder:"e.g., auth-check",autoFocus:!0})]}),r.jsxs("label",{className:"block mb-3",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Prompt"}),r.jsx("textarea",{value:u,onChange:L=>d(L.target.value),className:"input-field",rows:3,placeholder:"User prompt to test..."})]}),r.jsxs("label",{className:"block mb-3",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Expected Output"}),r.jsx("textarea",{value:h,onChange:L=>g(L.target.value),className:"input-field",rows:2,placeholder:"Description of expected behavior..."})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Assertions"}),m.map((L,U)=>r.jsxs("div",{className:"flex gap-2 mb-2",children:[r.jsx("input",{value:L.text,onChange:$=>y(m.map((q,X)=>X===U?{...q,text:$.target.value}:q)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),m.length>1&&r.jsx("button",{onClick:()=>y(m.filter(($,q)=>q!==U)),className:"btn btn-ghost p-1",style:{color:"var(--text-tertiary)"},children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},L.id)),r.jsx("button",{onClick:()=>y([...m,{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--accent)"},children:"+ Add Assertion"})]}),v==="integration"&&r.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},children:"Integration Settings"}),r.jsxs("div",{className:"mb-3",children:[r.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),r.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:w.map(L=>r.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:[L,r.jsx("button",{onClick:()=>C(w.filter(U=>U!==L)),style:{color:"var(--orange)",lineHeight:1},children:r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},L))}),r.jsxs("div",{className:"flex gap-1.5",children:[r.jsx("input",{value:S,onChange:L=>k(L.target.value),onKeyDown:L=>{L.key==="Enter"&&(L.preventDefault(),E())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., SLACK_BOT_TOKEN"}),r.jsx("button",{onClick:E,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),r.jsxs("label",{className:"block mb-3",children:[r.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),r.jsx("input",{value:T,onChange:L=>N(L.target.value),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),r.jsxs("label",{className:"block",children:[r.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),r.jsx("input",{value:A,onChange:L=>_(L.target.value),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx("button",{onClick:s,className:"btn btn-secondary text-[12px]",children:"Cancel"}),r.jsx("button",{onClick:B,disabled:!o.trim()||!u.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function dE({evalCase:t,onUpdate:a}){var d,h;const[s,o]=p.useState(""),c=()=>{const g=s.trim().toUpperCase();g&&!(t.requiredCredentials??[]).includes(g)&&a({...t,requiredCredentials:[...t.requiredCredentials??[],g]}),o("")},u=g=>{const m=(t.requiredCredentials??[]).filter(y=>y!==g);a({...t,requiredCredentials:m.length>0?m:void 0})};return r.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},children:"Integration Settings"}),r.jsxs("div",{className:"mb-2.5",children:[r.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),r.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:(t.requiredCredentials??[]).map(g=>r.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"var(--orange-muted)",color:"var(--orange)"},children:[g,r.jsx("button",{onClick:()=>u(g),style:{color:"var(--orange)",lineHeight:1},children:r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g))}),r.jsxs("div",{className:"flex gap-1.5",children:[r.jsx("input",{value:s,onChange:g=>o(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),c())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., GITHUB_TOKEN"}),r.jsx("button",{onClick:c,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),r.jsxs("div",{className:"mb-2.5",children:[r.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),r.jsx("input",{value:((d=t.requirements)==null?void 0:d.platform)??"",onChange:g=>a({...t,requirements:{...t.requirements,platform:g.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),r.jsx("input",{value:((h=t.requirements)==null?void 0:h.chromeProfile)??"",onChange:g=>a({...t,requirements:{...t.requirements,chromeProfile:g.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]})}function Tn(t,a){return a==="free"?"Free":a==="subscription"&&t==null?"Included":t==null?"N/A":t>=1?`$${t.toFixed(2)}`:t===0?"$0.00":t>=.001?`$${t.toFixed(4)}`:`$${t.toPrecision(3).replace(/0+$/,"").replace(/\.$/,"")}`}function $y(t,a){return t==null||a==null?"N/A":`${t.toLocaleString("en-US")} in / ${a.toLocaleString("en-US")} out`}function fE(t){return t==="baseline"?"Baseline Pass Rate":"Skill Pass Rate"}function pE(t,a){let s="";if(a){const c=new Date(a);isNaN(c.getTime())||(s=c.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}))}return[t,s].filter(Boolean).join(" · ")}function mE(t,a,s){const o=s===1?"test case":"test cases";if(t===0)return`Your skill performs the same as the baseline across ${s} ${o}`;const c=Math.round(Math.abs(t)*a);if(c===0)return`Your skill performs the same as the baseline across ${s} ${o}`;const u=t>0?"more":"fewer";return`Your skill passes ${c} ${u} assertions across ${s} ${o}`}function Kg(t,a){const s=o=>{const c=o/5*100;return isFinite(c)?Math.round(Math.min(100,Math.max(0,c))):0};return{skill:s(t),baseline:s(a)}}function hE(t){return t==="skill"?{text:"Skill wins",isSkill:!0}:t==="baseline"?{text:"Baseline wins",isSkill:!1}:{text:"Tie",isSkill:!1}}function xE(t,a){const s=t+a,o=s*10,c=s*25,u=d=>d>=60?`${Math.round(d/60)}m`:`${d}s`;return`${u(o)}–${u(c)}`}const gE={anthropic:.01,openrouter:.01,ollama:0,"lm-studio":0,"claude-cli":0,"codex-cli":0,"gemini-cli":0};function vE(t,a){if(!t)return null;const s=gE[t];if(s==null||s===0)return null;const o=s*a*.5,c=s*a*2;return`${Tn(o)}–${Tn(c)}`}function yE(){const{state:t,runCase:a,runAll:s,cancelCase:o,cancelAll:c,isReadOnly:u}=Rn(),{evals:d,caseRunStates:h,bulkRunActive:g,latestBenchmark:m,inlineResults:y}=t,{config:v}=$a(),b=(d==null?void 0:d.evals)??[],S=p.useMemo(()=>{for(const E of h.values())if(E.status==="running"||E.status==="queued")return!0;return!1},[h]),k=b.filter(E=>{const B=h.get(E.id);return B&&(B.status==="complete"||B.status==="error"||B.status==="cancelled")}).length,w=b.filter(E=>{const B=h.get(E.id);return B&&(B.status==="running"||B.status==="queued")}).length,C=p.useRef(null),[T,N]=p.useState(0);p.useEffect(()=>{if(S&&!C.current&&(C.current=Date.now()),!S){C.current=null,N(0);return}const E=setInterval(()=>{C.current&&N(Math.round((Date.now()-C.current)/1e3))},1e3);return()=>clearInterval(E)},[S]);const A=b.reduce((E,B)=>E+B.assertions.length,0),_=b.length+A,D=p.useMemo(()=>xE(b.length,A),[b.length,A]),F=p.useMemo(()=>vE((v==null?void 0:v.provider)??null,_),[v==null?void 0:v.provider,_]);return r.jsxs("div",{className:"p-5",children:[u&&r.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:[r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),r.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Installed skill — benchmarking is disabled. Edit the source skill to run benchmarks."]}),r.jsxs("div",{className:"rounded-xl p-4 mb-5",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Benchmark"}),S&&r.jsxs("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:[w," running"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[S&&r.jsxs("button",{onClick:c,className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:[r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:r.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel All"]}),r.jsx("button",{onClick:()=>s("comparison"),disabled:b.length===0||S||u,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"}),r.jsx("button",{onClick:()=>s("benchmark"),disabled:b.length===0||S||u,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using your skill only",children:"Test Skill"}),r.jsx("button",{onClick:()=>s("baseline"),disabled:b.length===0||S||u,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using the baseline (no skill) for reference",children:"Test Baseline"})]}),!S&&b.length>0&&r.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[10px]",style:{color:"var(--text-tertiary)"},children:[r.jsxs("span",{children:["Est. duration: ",D]}),F&&r.jsxs("span",{children:["Est. cost: ",F]}),!F&&(v==null?void 0:v.provider)&&(v.provider==="claude-cli"||v.provider==="codex-cli")&&r.jsx("span",{children:"Cost: Included"}),!F&&(v==null?void 0:v.provider)&&(v.provider==="ollama"||v.provider==="lm-studio"||v.provider==="gemini-cli")&&r.jsx("span",{children:"Cost: Free"})]})]}),S&&b.length>0&&r.jsxs("div",{className:"mb-5",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("span",{className:"text-[12px] font-medium",style:{color:"var(--text-secondary)"},children:["Progress: ",k,"/",b.length," cases"]}),r.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(k/b.length*100),"%"]})]}),r.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:r.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${k/b.length*100}%`,background:"var(--accent)"}})}),r.jsxs("div",{className:"flex items-center justify-between mt-1.5",children:[r.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Elapsed: ",T>=60?`${Math.floor(T/60)}m ${T%60}s`:`${T}s`]}),r.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Est. total: ",D]})]})]}),r.jsx("div",{className:"space-y-3 stagger-children",children:b.map(E=>{const B=y.get(E.id),L=h.get(E.id),U=(L==null?void 0:L.status)??"idle",$=m==null?void 0:m.cases.find(q=>q.eval_id===E.id);return r.jsx(jE,{name:E.name,evalId:E.id,result:B,caseCost:$==null?void 0:$.cost,caseBillingMode:$==null?void 0:$.billingMode,caseInputTokens:$==null?void 0:$.inputTokens,caseOutputTokens:$==null?void 0:$.outputTokens,caseStatus:U,runMode:(L==null?void 0:L.mode)??null,comparisonDetail:$==null?void 0:$.comparisonDetail,isReadOnly:u,onRun:q=>a(q,"benchmark"),onBaseline:q=>a(q,"baseline"),onCompare:q=>a(q,"comparison"),onCancel:q=>o(q)},E.id)})}),!S&&m&&m.cases.length>0&&r.jsxs("div",{className:"mt-5",children:[r.jsxs("div",{className:"rounded-xl p-4 mb-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:fE(m.type)}),r.jsx("span",{className:"text-[20px] font-bold",style:{color:(m.overall_pass_rate??0)>=.8?"var(--green)":(m.overall_pass_rate??0)>=.5?"var(--yellow)":"var(--red)"},children:m.overall_pass_rate!=null?`${Math.round(m.overall_pass_rate*100)}%`:"--"})]}),m.totalDurationMs!=null&&r.jsxs("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:["Total: ",(m.totalDurationMs/1e3).toFixed(1),"s",m.model&&` | Model: ${m.model}`,m.totalInputTokens!=null&&m.totalOutputTokens!=null&&` | Tokens: ${$y(m.totalInputTokens,m.totalOutputTokens)}`,m.totalCost!=null&&` | Cost: ${Tn(m.totalCost)}`]}),m.overall_pass_rate>=.9999&&!m.comparison&&r.jsx("button",{onClick:()=>s("comparison"),disabled:b.length===0||u,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:b.length===0?.5:1},children:"Run Final A/B Comparison"})]}),m.comparison&&r.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[r.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Skill vs Baseline"}),(()=>{const E=pE(m.model,m.timestamp);return E?r.jsx("div",{className:"text-[10px] mt-0.5 mb-3",style:{color:"var(--text-tertiary)"},children:E}):r.jsx("div",{className:"mb-3"})})(),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsx(Xg,{label:"Skill",value:m.comparison.skillPassRate,color:"var(--accent)"}),r.jsx(Xg,{label:"Baseline",value:m.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),r.jsxs("div",{className:"mt-3 text-[12px] font-medium",style:{color:m.comparison.delta>0?"var(--green)":m.comparison.delta<0?"var(--red)":"var(--text-tertiary)"},children:["Delta: ",m.comparison.delta>0?"+":"",(m.comparison.delta*100).toFixed(1),"%",m.verdict&&` | ${tE(m.verdict)}`]}),(()=>{const E=m.cases.reduce((L,U)=>L+U.assertions.length,0),B=mE(m.comparison.delta,E,m.cases.length);return r.jsx("div",{className:"mt-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:B})})()]})]})]})}const bE={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 jE({name:t,evalId:a,result:s,caseCost:o,caseBillingMode:c,caseInputTokens:u,caseOutputTokens:d,caseStatus:h,runMode:g,comparisonDetail:m,isReadOnly:y,onRun:v,onBaseline:b,onCompare:S,onCancel:k}){const[w,C]=p.useState(!1),T=h==="running"||h==="queued",N=h==="complete"||h==="error";return r.jsxs("div",{className:"rounded-xl overflow-hidden transition-all duration-200",style:{background:"var(--surface-1)",border:T?"1px solid var(--accent)":"1px solid var(--border-subtle)",boxShadow:T?"0 0 12px rgba(99, 131, 255, 0.15)":"none"},children:[r.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[h==="running"&&r.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),h==="queued"&&r.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--text-tertiary)"},children:"queued"}),r.jsxs("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:["#",a," ",t]}),g&&(T||N)&&(()=>{const A=bE[g];return A?r.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:A.bg,color:A.color,padding:"1px 6px"},children:A.label}):null})()]}),r.jsxs("div",{className:"flex items-center gap-2",children:[T?r.jsx("button",{onClick:()=>k(a),className:"btn text-[10px] px-2 py-1",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:"Cancel"}):r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:()=>S(a),disabled:y,className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),r.jsx("button",{onClick:()=>v(a),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),r.jsx("button",{onClick:()=>b(a),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Base"})]}),s&&s.status!=null&&r.jsx("span",{className:"pill text-[10px]",style:{background:s.status==="pass"?"var(--green-muted)":"var(--red-muted)",color:s.status==="pass"?"var(--green)":"var(--red)"},children:s.passRate!=null?`${Math.round(s.passRate*100)}%`:s.status}),u!=null&&d!=null&&r.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:$y(u,d)}),o!=null&&r.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:Tn(o,c)}),h==="cancelled"&&r.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"cancelled"})]})]}),s&&s.assertions.length>0&&r.jsxs("div",{className:"px-4 pb-3",children:[r.jsx("div",{className:"space-y-1",children:s.assertions.map(A=>r.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[r.jsx("span",{style:{color:A.pass?"var(--green)":"var(--red)"},children:A.pass?"PASS":"FAIL"}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:A.text})]},A.assertion_id))}),s.output&&r.jsx("button",{onClick:()=>C(!w),className:"text-[11px] mt-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:w?"Hide output":"Show output"}),w&&s.output&&r.jsx("pre",{className:"text-[11px] mt-2 p-3 rounded-lg overflow-auto",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:200,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap"},children:s.output})]}),m&&r.jsx("div",{className:"px-4 pb-3",children:r.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:r.jsx("div",{className:"flex items-center gap-4 text-[11px] flex-wrap",children:(()=>{const A=Kg(m.skillContentScore,m.baselineContentScore),_=Kg(m.skillStructureScore,m.baselineStructureScore),D=hE(m.winner);return r.jsxs(r.Fragment,{children:[r.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Content: Skill ",A.skill,"% / Baseline ",A.baseline,"%"]}),r.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),r.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Structure: Skill ",_.skill,"% / Baseline ",_.baseline,"%"]}),r.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),r.jsx("span",{style:{color:D.isSkill?"var(--accent)":"var(--text-tertiary)",fontWeight:500},children:D.text})]})})()})})}),s&&s.errorMessage&&r.jsx(SE,{errorMessage:s.errorMessage,classifiedError:s.classifiedError})]})}const Bd={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function SE({errorMessage:t,classifiedError:a}){const[s,o]=p.useState(!1),c=(a==null?void 0:a.title)??"Error",u=a==null?void 0:a.hint,d=a?Bd[a.category]??Bd.unknown:Bd.unknown;return r.jsx("div",{className:"px-4 pb-3",children:r.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:"var(--red-muted)",border:"1px solid var(--red-muted)"},children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[r.jsx("span",{style:{fontSize:12},children:d}),r.jsx("span",{className:"text-[11.5px] font-semibold flex-1",style:{color:"var(--red)"},children:c}),r.jsx("button",{onClick:()=>o(!s),className:"text-[10px] px-1.5 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},children:s?"Hide details":"Details"})]}),u&&r.jsx("div",{className:"px-3 pb-2 text-[10.5px]",style:{color:"var(--text-secondary)"},children:u}),s&&r.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:t})]})})}function Xg({label:t,value:a,color:s}){return r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:t}),r.jsxs("span",{className:"text-[12px] font-semibold",style:{color:s},children:[Math.round(a*100),"%"]})]}),r.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:r.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${a*100}%`,background:s}})})]})}const Qg={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 kE(){const{state:t,dispatch:a,runActivationTest:s,cancelActivation:o,generateActivationPrompts:c}=Rn(),{plugin:u,skill:d,activationPrompts:h,activationResults:g,activationSummary:m,activationRunning:y,activationError:v,activationStartedAt:b,activationClassifyingStatus:S,generatingPrompts:k,generatingPromptsError:w,activationHistory:C}=t,{state:T}=er(),N=T.skills.find(P=>P.plugin===u&&P.skill===d),A=(N==null?void 0:N.resolvedVersion)??(N==null?void 0:N.version)??null,[_,D]=p.useState(h),[F,E]=p.useState(null),[B,L]=p.useState(!1);p.useEffect(()=>{h&&h!==_&&D(h)},[h]),p.useEffect(()=>{a({type:"SET_ACTIVATION_PROMPTS",prompts:_})},[_,a]),p.useEffect(()=>{fetch(`/api/skills/${u}/${d}/description`).then(P=>P.json()).then(P=>E(P.rawContent||P.description||null)).catch(()=>E(null))},[u,d]);function U(){s(_)}function $(){c(8)}const q=_.trim().split(`
|
|
81
81
|
`).filter(Boolean).length,X=g.filter(P=>P.classification==="TP"||P.classification==="TN"),ee=g.filter(P=>P.classification==="FP"||P.classification==="FN"),I=(F==null?void 0:F.replace(/^---[\s\S]*?---\s*/,"").trim())??null,z=_.trim().length>0,O=I?Zo(I):"";return r.jsxs("div",{className:"p-5 space-y-5",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Activation Test"}),r.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."})]}),r.jsxs("div",{className:"grid grid-cols-[3fr_2fr] gap-4 items-stretch",children:[r.jsxs("div",{className:"glass-card p-4 flex flex-col gap-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Test Prompts"}),r.jsx("div",{className:"flex gap-1.5",children:r.jsx("button",{onClick:$,disabled:k||!I||y,className:"text-[10px] px-2.5 py-1 rounded-md transition-colors duration-150 flex items-center gap-1.5",style:{background:k?"var(--surface-3)":"var(--surface-2)",color:I?"var(--accent)":"var(--text-tertiary)",border:"1px solid var(--border-subtle)",opacity:I?1:.5,cursor:I?"pointer":"not-allowed"},title:I?void 0:"No skill description available",onMouseEnter:P=>{I&&!k&&(P.currentTarget.style.background="var(--surface-3)")},onMouseLeave:P=>{k||(P.currentTarget.style.background="var(--surface-2)")},children:k?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"spinner",style:{borderTopColor:"var(--accent)",borderColor:"var(--border-subtle)",width:10,height:10}}),"Generating..."]}):r.jsxs(r.Fragment,{children:[r.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:r.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"})}),z?"Regenerate":"Generate"," Test Prompts"]})})})]}),!I&&!y&&r.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."}),w&&r.jsx("div",{className:"text-[11px] px-2 py-1 rounded",style:{color:"var(--red)",background:"var(--red-muted)"},children:w}),r.jsx("textarea",{className:"input-field resize-y font-mono text-[12px]",style:{minHeight:140,height:140},value:_,onChange:P=>D(P.target.value),placeholder:`How do I write a unit test?
|
|
82
82
|
What edge cases should I test?
|
|
83
83
|
+Deploy this to production
|
|
84
84
|
!What's the weather like today?
|
|
85
|
-
!Write me a poem about flowers`}),r.jsxs("div",{className:"flex items-center flex-wrap gap-x-3 gap-y-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:[r.jsx("span",{children:"One prompt per line"}),r.jsx(ko,{}),r.jsx("span",{children:"No prefix = auto-classify"}),r.jsx(ko,{}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"+"}),"= must activate"]}),r.jsx(ko,{}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"!"}),"= must NOT activate"]}),r.jsx(ko,{}),r.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[q," prompt",q!==1?"s":""]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("button",{onClick:U,disabled:y||!_.trim(),className:"btn btn-primary",children:y?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"spinner",style:{borderTopColor:"var(--color-paper)",borderColor:"var(--border-default)",width:14,height:14}}),"Testing..."]}):r.jsxs(r.Fragment,{children:[r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("circle",{cx:"12",cy:"12",r:"10"}),r.jsx("circle",{cx:"12",cy:"12",r:"6"}),r.jsx("circle",{cx:"12",cy:"12",r:"2"})]}),"Run Activation Test"]})}),y&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:o,className:"btn btn-secondary text-[12px]",children:"Cancel"}),r.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[S||`${g.length} / ${q} prompts tested`,b&&r.jsx(wE,{startedAt:b})]})]})]})]}),r.jsxs("div",{className:"glass-card flex flex-col overflow-hidden",children:[r.jsx("div",{className:"px-4 pt-3.5 pb-2.5 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Skill Description"})}),r.jsx("div",{className:"flex-1 overflow-auto px-4 py-3",style:{minHeight:0},children:I?r.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:O}}):r.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No description available"})})]})]}),v&&r.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:v}),y&&g.length===0&&r.jsxs("div",{className:"text-center py-12 animate-fade-in",children:[r.jsx("div",{className:"spinner-lg mx-auto mb-4"}),r.jsx("p",{className:"text-[14px]",style:{color:"var(--text-secondary)"},children:"Testing activation against skill description..."})]}),g.length>0&&r.jsxs("div",{className:"space-y-5",children:[ee.length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("circle",{cx:"12",cy:"12",r:"10"}),r.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),r.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),r.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--red)"},children:["Incorrect (",ee.length,")"]}),r.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"— These need attention"})]}),r.jsx("div",{className:"space-y-1.5 stagger-children",children:ee.map((P,H)=>r.jsx(Qg,{result:P},`incorrect-${H}`))})]}),X.length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("circle",{cx:"12",cy:"12",r:"10"}),r.jsx("polyline",{points:"16 10 11 15 8 12"})]}),r.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--green)"},children:["Correct (",X.length,")"]})]}),r.jsx("div",{className:"space-y-1.5 stagger-children",children:X.map((P,H)=>r.jsx(Qg,{result:P},`correct-${H}`))})]})]}),m&&r.jsxs("div",{className:"glass-card p-6 animate-fade-in-scale",style:{borderColor:"var(--border-active)",borderWidth:2},children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-2",style:{color:"var(--text-tertiary)"},children:"Summary"}),m.autoClassifiedCount!=null&&m.autoClassifiedCount>0&&r.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:[m.autoClassifiedCount," of ",m.total," prompts auto-classified from skill name and tags"]}),r.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[r.jsx(Bd,{label:"Precision",value:m.precision,description:"Of all activations, how many were correct?",detail:`${m.tp} true / ${m.tp+m.fp} total activations`}),r.jsx(Bd,{label:"Recall",value:m.recall,description:"Of expected activations, how many fired?",detail:`${m.tp} activated / ${m.tp+m.fn} expected`}),r.jsx(Bd,{label:"Reliability",value:m.reliability,description:"Overall correct classification rate",detail:`${m.tp+m.tn} correct / ${m.total} total`})]}),r.jsxs("div",{className:"pt-4",style:{borderTop:"1px solid var(--border-subtle)"},children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-3 text-center",style:{color:"var(--text-tertiary)"},children:"Confusion Matrix"}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 max-w-xs mx-auto",children:[r.jsx(wo,{label:"True Positive",abbr:"TP",count:m.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),r.jsx(wo,{label:"False Positive",abbr:"FP",count:m.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),r.jsx(wo,{label:"False Negative",abbr:"FN",count:m.fn,bg:"var(--red-muted)",color:"var(--red)",description:"Missed activation"}),r.jsx(wo,{label:"True Negative",abbr:"TN",count:m.tn,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly silent"})]})]})]}),r.jsx(jE,{history:E,expanded:B,onToggle:()=>L(!B),skillVersion:A})]})}function jE({history:t,expanded:a,onToggle:s,skillVersion:o}){return t===null?null:r.jsxs("div",{className:"glass-card overflow-hidden",children:[r.jsxs("button",{className:"w-full px-4 py-3 flex items-center justify-between text-left",style:{borderBottom:a?"1px solid var(--border-subtle)":"none"},onClick:s,children:[r.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:["Test History",t.length>0&&r.jsxs("span",{className:"ml-2 font-normal",style:{color:"var(--text-tertiary)"},children:["(",t.length," run",t.length!==1?"s":"",")"]})]}),r.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:a?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},children:r.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),a&&r.jsx("div",{className:"px-4 py-3",children:t.length===0?r.jsx("div",{className:"text-[12px] py-4 text-center",style:{color:"var(--text-tertiary)"},children:"No test runs yet"}):r.jsx("div",{className:"space-y-2",children:t.map(c=>r.jsx(SE,{run:c,skillVersion:o},c.id))})})]})}function SE({run:t,skillVersion:a}){const s=Math.round(t.summary.reliability*100),o=s>=80?"var(--green)":s>=60?"var(--yellow)":"var(--red)",c=s>=80?"Good":s>=60?"Needs Work":"Poor",u=o;return r.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{background:"var(--surface-1)"},children:[r.jsx("div",{className:"flex-1 min-w-0",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:kE(t.timestamp)}),r.jsx(ri,{version:a??null,size:"sm","data-testid":"activation-row-version"}),r.jsx("span",{className:"pill text-[9px] px-1.5",style:{background:"var(--surface-2)",color:"var(--text-tertiary)"},children:t.model||t.provider}),r.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[t.promptCount," prompts"]})]})}),r.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[r.jsxs("span",{className:"text-[12px] font-semibold",style:{color:o,fontVariantNumeric:"tabular-nums"},children:[s,"%"]}),r.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:c})]})]})}function kE(t){const a=Date.now(),s=new Date(t).getTime(),o=Math.floor((a-s)/1e3);if(o<60)return"just now";const c=Math.floor(o/60);if(c<60)return`${c}m ago`;const u=Math.floor(c/60);if(u<24)return`${u}h ago`;const d=Math.floor(u/24);return d<7?`${d}d ago`:new Date(t).toLocaleDateString()}function ko(){return r.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function Qg({result:t}){const a=Xg[t.classification]||Xg.FN,s=t.classification==="TP"||t.classification==="TN";return r.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl transition-all duration-200",style:{background:a.bg,border:"1px solid transparent"},children:[r.jsx("div",{className:"flex-shrink-0 mt-0.5",children:r.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:`color-mix(in srgb, ${a.text} 20%, transparent)`},children:s?r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:a.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})}):r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:a.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"flex items-center gap-2 mb-1",children:r.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:t.prompt})}),r.jsxs("div",{className:"flex items-center gap-3 text-[12px]",children:[r.jsx("span",{className:"pill",style:{background:"var(--surface-3)",color:a.text,fontWeight:700,fontSize:"10px",padding:"1px 6px"},children:t.classification}),r.jsx("span",{style:{color:t.activate?"var(--green)":"var(--text-tertiary)"},children:t.activate?"Activated":"Silent"}),r.jsxs("span",{style:{color:"var(--text-tertiary)"},children:["Expected: ",t.expected==="should_activate"?"activate":"stay silent"]}),r.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[t.confidence," confidence"]}),t.autoClassified&&r.jsx("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)",fontSize:"9px",padding:"1px 5px"},children:"auto"})]}),t.reasoning&&r.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--text-tertiary)"},children:t.reasoning})]})]})}function Bd({label:t,value:a,description:s,detail:o}){const c=Math.round(a*100),u=c>=80?"var(--green)":c>=60?"var(--yellow)":"var(--red)";return r.jsxs("div",{className:"text-center",children:[r.jsxs("div",{className:"text-[28px] font-bold tracking-tight",style:{color:u},children:[c,"%"]}),r.jsx("div",{className:"text-[12px] font-medium mt-0.5",style:{color:"var(--text-secondary)"},children:t}),r.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--text-tertiary)"},children:s}),r.jsx("div",{className:"text-[10px] mt-0.5 font-mono",style:{color:"var(--text-tertiary)"},children:o})]})}function wo({abbr:t,count:a,bg:s,color:o,description:c}){return r.jsxs("div",{className:"text-center p-3 rounded-lg",style:{background:s},children:[r.jsx("div",{className:"text-[20px] font-bold",style:{color:o},children:a}),r.jsx("div",{className:"text-[11px] font-semibold",style:{color:o},children:t}),r.jsx("div",{className:"text-[9px] mt-0.5",style:{color:"var(--text-tertiary)"},children:c})]})}function wE({startedAt:t}){const[a,s]=p.useState(0);return p.useEffect(()=>{const o=setInterval(()=>s(Math.floor((Date.now()-t)/1e3)),1e3);return()=>clearInterval(o)},[t]),r.jsxs("span",{className:"ml-2",children:["(",a,"s)"]})}const Id={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},Zg={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},df=600,ff=180,sn=40,Ud=df-sn*2,ra=ff-sn*2,CE=[25,50,75,100];function Jg(t){return new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function EE(t){return t==null?"--":`${(t/1e3).toFixed(1)}s`}function NE({entries:t,onPointClick:a}){const[s,o]=p.useState(null),c=p.useMemo(()=>[...t].reverse(),[t]);if(c.length<2)return null;const u=c.length,d=c.map((m,y)=>{const v=sn+y/(u-1)*Ud,b=m.passRate*100,S=sn+ra-b/100*ra;return{x:v,y:S,pct:b,entry:m}}),h=d.map(m=>`${m.x},${m.y}`).join(" "),g=Array.from(new Set(c.map(m=>m.type)));return r.jsxs("div",{className:"glass-card p-5 animate-fade-in",style:{position:"relative",overflowX:u>=20?"auto":void 0},children:[r.jsx("div",{className:"text-[13px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"Pass Rate Trend"}),r.jsx("div",{className:"flex items-center gap-5 mb-3",children:g.map(m=>r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:Id[m]??"var(--text-tertiary)"}}),r.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:Zg[m]??m})]},m))}),r.jsxs("svg",{width:df,height:ff,viewBox:`0 0 ${df} ${ff}`,style:{display:"block",overflow:"visible"},children:[CE.map(m=>{const y=sn+ra-m/100*ra;return r.jsxs("g",{children:[r.jsx("line",{x1:sn,y1:y,x2:sn+Ud,y2:y,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),r.jsxs("text",{x:sn-8,y:y+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[m,"%"]})]},m)}),r.jsx("line",{x1:sn,y1:sn+ra,x2:sn+Ud,y2:sn+ra,stroke:"var(--border-subtle)",strokeWidth:1}),r.jsx("text",{x:sn-8,y:sn+ra+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:"0%"}),r.jsx("polyline",{points:h,fill:"none",stroke:"var(--border-subtle)",strokeWidth:1.5,strokeLinejoin:"round"}),d.map((m,y)=>r.jsx("circle",{cx:m.x,cy:m.y,r:5,fill:Id[m.entry.type]??"var(--text-tertiary)",stroke:"var(--surface-2)",strokeWidth:2,style:{cursor:"pointer",transition:"r 0.15s ease"},onMouseEnter:v=>{v.currentTarget.setAttribute("r","7"),o({x:m.x,y:m.y,entry:m.entry})},onMouseLeave:v=>{v.currentTarget.setAttribute("r","5"),o(null)},onClick:()=>a==null?void 0:a(m.entry)},y)),TE(u).map(m=>r.jsx("text",{x:d[m].x,y:sn+ra+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:Jg(c[m].timestamp)},m))]}),s&&r.jsxs("div",{style:{position:"absolute",left:s.x,top:s.y-12,transform:"translate(-50%, -100%)",background:"var(--surface-3)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"8px 12px",pointerEvents:"none",zIndex:10,whiteSpace:"nowrap"},children:[r.jsx("div",{className:"text-[11px] font-medium",style:{color:"var(--text-primary)"},children:Jg(s.entry.timestamp)}),r.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-tertiary)"},children:s.entry.model}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:Id[s.entry.type]??"var(--text-tertiary)",color:"#fff"},children:Zg[s.entry.type]??s.entry.type}),r.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:[Math.round(s.entry.passRate*100),"%"]})]}),r.jsxs("div",{className:"text-[10px] mt-1.5 flex items-center gap-3",style:{color:"var(--text-tertiary)"},children:[r.jsx("span",{children:EE(s.entry.totalDurationMs)}),r.jsx("span",{children:s.entry.totalTokens!=null?`${s.entry.totalTokens} tokens`:"--"})]})]})]})}function TE(t){if(t<=3)return Array.from({length:t},(o,c)=>c);if(t<=6)return[0,Math.floor(t/2),t-1];if(t<20)return[0,Math.floor(t/3),Math.floor(2*t/3),t-1];const a=Math.ceil(t/10),s=[0];for(let o=a;o<t-1;o+=a)s.push(o);return s.push(t-1),s}const Is=new Map;let on=null,Do=null,Co=1e3,Al=0;function Hy(){if(on)return;on=new EventSource("/api/events");const t=a=>s=>{let o={};try{o=s.data?JSON.parse(s.data):{}}catch{}const c=Is.get(a);if(c)for(const u of c)u(o)};on.addEventListener("benchmark:complete",t("benchmark:complete")),on.addEventListener("history:written",t("history:written")),on.addEventListener("leaderboard:updated",t("leaderboard:updated")),on.onerror=()=>{on==null||on.close(),on=null,Al>0&&(Do=setTimeout(()=>{Co=Math.min(Co*2,3e4),Hy()},Co))},on.onopen=()=>{Co=1e3}}function RE(){Do!=null&&(clearTimeout(Do),Do=null),on==null||on.close(),on=null}function AE(t,a){return Is.has(t)||Is.set(t,new Set),Is.get(t).add(a),Al++,Hy(),()=>{var s;(s=Is.get(t))==null||s.delete(a),Al--,Al<=0&&(Al=0,queueMicrotask(()=>{Al<=0&&RE()}))}}function Ho(t,a){const s=p.useRef(a);s.current=a,p.useEffect(()=>AE(t,c=>s.current(c)),[t])}function $o(t){return t>=.8?"var(--green)":t>=.5?"var(--yellow)":"var(--red)"}function ME(t){return t>=1e3?`${(t/1e3).toFixed(1)}s`:`${Math.round(t)}ms`}function LE({rate:t,label:a}){const s=Math.round(t*100);return r.jsx("div",{className:"flex items-center gap-3",children:r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-primary)",maxWidth:"70%"},children:a}),r.jsxs("span",{className:"text-[11px] font-semibold",style:{color:$o(t)},children:[s,"%"]})]}),r.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{background:"var(--surface-3)"},children:r.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${s}%`,background:$o(t)}})})]})})}function zE({points:t}){if(t.length<2)return null;const a=200,s=48,o=4,c=t.length,u=t.map((g,m)=>{const y=o+m/(c-1)*(a-o*2),v=o+(s-o*2)-g.passRate*(s-o*2);return{x:y,y:v}}),d=`M ${u[0].x},${s-o} `+u.map(g=>`L ${g.x},${g.y}`).join(" ")+` L ${u[u.length-1].x},${s-o} Z`,h=u.map((g,m)=>`${m===0?"M":"L"} ${g.x},${g.y}`).join(" ");return r.jsxs("svg",{width:a,height:s,style:{display:"block"},children:[r.jsx("path",{d,fill:"var(--accent-muted)"}),r.jsx("path",{d:h,fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),r.jsx("circle",{cx:u[u.length-1].x,cy:u[u.length-1].y,r:3,fill:"var(--accent)"})]})}function DE({plugin:t,skill:a}){const s=`stats/${t}/${a}`,o=p.useCallback(()=>we.getStats(t,a),[t,a]),{data:c,loading:u}=Js(s,o),d=p.useCallback(()=>En(s),[s]);if(Ho("benchmark:complete",d),Ho("history:written",d),u)return r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"skeleton h-24 rounded-xl"}),r.jsx("div",{className:"skeleton h-48 rounded-xl"}),r.jsx("div",{className:"skeleton h-36 rounded-xl"})]});if(!c||c.totalRuns===0)return r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center mx-auto mb-3",style:{background:"var(--surface-2)"},children:r.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",children:[r.jsx("path",{d:"M18 20V10"}),r.jsx("path",{d:"M12 20V4"}),r.jsx("path",{d:"M6 20v-6"})]})}),r.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark data yet"}),r.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"Run some benchmarks to see statistics"})]});const h=c.trendPoints.length>0?c.trendPoints[c.trendPoints.length-1].passRate:0,g=c.trendPoints.length>0?c.trendPoints[0].passRate:0,m=h-g,y=c.assertionStats.slice(0,10);return r.jsxs("div",{className:"space-y-4 stagger-children",children:[r.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[r.jsxs("div",{className:"glass-card p-4",children:[r.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Runs"}),r.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:c.totalRuns})]}),r.jsxs("div",{className:"glass-card p-4",children:[r.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Latest Pass Rate"}),r.jsxs("div",{className:"text-[24px] font-bold",style:{color:$o(h)},children:[Math.round(h*100),"%"]})]}),r.jsxs("div",{className:"glass-card p-4",children:[r.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Trend"}),r.jsxs("div",{className:"text-[24px] font-bold",style:{color:m>=0?"var(--green)":"var(--red)"},children:[m>=0?"+":"",Math.round(m*100),"%"]})]}),r.jsxs("div",{className:"glass-card p-4",children:[r.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Models Tested"}),r.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:c.modelStats.length})]}),c.totalCost!=null&&r.jsxs("div",{className:"glass-card p-4",children:[r.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Cost"}),r.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:Tn(c.totalCost)})]}),c.costPerRun!=null&&r.jsxs("div",{className:"glass-card p-4",children:[r.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Avg Cost/Run"}),r.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:Tn(c.costPerRun)})]})]}),c.trendPoints.length>=2&&r.jsxs("div",{className:"glass-card p-5",children:[r.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Pass Rate Over Time"}),r.jsx(zE,{points:c.trendPoints})]}),c.modelStats.length>0&&r.jsxs("div",{className:"glass-card p-5",children:[r.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Model Performance"}),r.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[r.jsx("thead",{children:r.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx("th",{style:{textAlign:"left",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Model"}),r.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Runs"}),r.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Pass Rate"}),r.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Duration"}),r.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Cost"})]})}),r.jsx("tbody",{children:c.modelStats.map(v=>r.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx("td",{style:{padding:"8px",color:"var(--text-primary)",fontWeight:500},children:v.model}),r.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:v.runs}),r.jsx("td",{style:{padding:"8px",textAlign:"center"},children:r.jsxs("span",{className:"font-semibold",style:{color:$o(v.avgPassRate)},children:[Math.round(v.avgPassRate*100),"%"]})}),r.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:ME(v.avgDurationMs)}),r.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:v.avgCost!=null?Tn(v.avgCost):"N/A"})]},v.model))})]})]}),y.length>0&&r.jsxs("div",{className:"glass-card p-5",children:[r.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Weakest Assertions"}),r.jsx("div",{className:"space-y-3",children:y.map(v=>r.jsxs("button",{className:"block w-full text-left rounded-lg p-2 -mx-2 transition-colors duration-150",style:{background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--surface-2)"},onMouseLeave:b=>{b.currentTarget.style.background="transparent"},onClick:()=>{},children:[r.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[r.jsxs("span",{className:"text-[10px] font-mono px-1 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",v.evalId]}),r.jsx("span",{className:"text-[10px] truncate",style:{color:"var(--text-tertiary)"},children:v.evalName}),r.jsxs("span",{className:"text-[10px] ml-auto flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[v.totalRuns," runs"]})]}),r.jsx(LE,{rate:v.passRate,label:v.text})]},`${v.evalId}:${v.id}`))})]})]})}function _E({plugin:t,skill:a}){const[s,o]=p.useState(null),[c,u]=p.useState(null),[d,h]=p.useState({}),[g,m]=p.useState({});p.useEffect(()=>{we.getEvals(t,a).then(o).catch(()=>o(null))},[t,a]);async function y(v){if(c===v){u(null);return}if(u(v),!d[v]){m(b=>({...b,[v]:!0}));try{const b=await we.getCaseHistory(t,a,v);h(S=>({...S,[v]:b}))}catch{h(b=>({...b,[v]:[]}))}finally{m(b=>({...b,[v]:!1}))}}}return s?r.jsx("div",{className:"space-y-2 stagger-children",children:s.evals.map(v=>{const b=d[v.id]||[],S=c===v.id,k=g[v.id],w=b.length>0?b[0].pass_rate:null;return r.jsxs("div",{className:"glass-card overflow-hidden",children:[r.jsxs("button",{onClick:()=>y(v.id),className:"w-full text-left p-4 flex items-center gap-3 transition-colors duration-150",style:{background:S?"var(--surface-2)":"transparent"},onMouseEnter:E=>{S||(E.currentTarget.style.background="var(--surface-2)")},onMouseLeave:E=>{S||(E.currentTarget.style.background="transparent")},children:[r.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:r.jsx("polyline",{points:"9 18 15 12 9 6"})}),r.jsxs("span",{className:"text-[11px] font-mono px-1.5 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",v.id]}),r.jsx("span",{className:"text-[13px] font-medium flex-1 truncate",style:{color:"var(--text-primary)"},children:v.name}),b.length>=2&&r.jsx(_y,{entries:b}),w!=null&&r.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:Dl(w)},children:[Math.round(w*100),"%"]}),b.length>0&&r.jsxs("span",{className:"text-[10px] flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[b.length," runs"]})]}),S&&r.jsx("div",{className:"border-t animate-fade-in",style:{borderColor:"var(--border-subtle)"},children:k?r.jsxs("div",{className:"p-4 flex items-center gap-2",children:[r.jsx("div",{className:"spinner",style:{width:14,height:14}}),r.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):b.length===0?r.jsx("div",{className:"p-4",children:r.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No history for this eval case"})}):r.jsx("div",{className:"divide-y",style:{borderColor:"var(--border-subtle)"},children:b.map((E,T)=>r.jsxs("div",{className:"p-4",style:{background:T===0?"var(--surface-2)":"transparent"},children:[r.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[r.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:zy(E.timestamp)}),r.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:E.model}),r.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}),r.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:Dl(E.pass_rate)},children:[Math.round(E.pass_rate*100),"%"]})]}),r.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&&r.jsx("span",{children:Dy(E.durationMs)}),E.tokens!=null&&r.jsxs("span",{children:[E.tokens>=1e3?`${(E.tokens/1e3).toFixed(1)}k`:E.tokens," tok"]})]}),r.jsx("div",{className:"space-y-1",children:E.assertions.map(N=>r.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[r.jsx("div",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:N.pass?"var(--green)":"var(--red)"},children:r.jsx("svg",{width:"7",height:"7",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",children:N.pass?r.jsx("polyline",{points:"20 6 9 17 4 12"}):r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"text-[11px]",style:{color:"var(--text-primary)"},children:N.text}),N.reasoning&&r.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:N.reasoning})]})]},N.id))})]},T))})})]},v.id)})}):r.jsx("div",{className:"text-center py-12",children:r.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No eval cases found"})})}function OE(){const{state:t,dispatch:a}=Rn(),{plugin:s,skill:o}=t,{state:c}=er(),u=c.skills.find(P=>P.plugin===s&&P.skill===o),d=(u==null?void 0:u.resolvedVersion)??(u==null?void 0:u.version)??null,[h,g]=p.useState("timeline"),[m,y]=p.useState(""),[v,b]=p.useState(""),[S,k]=p.useState(!1),[w,E]=p.useState([]),[T,N]=p.useState(null),[A,_]=p.useState(!1),[D,F]=p.useState(null),[C,B]=p.useState(!1),L=`history/${s}/${o}?model=${m}&type=${v}`,U=p.useCallback(()=>we.getHistory(s,o,{model:m||void 0,type:v||void 0}),[s,o,m,v]),{data:$,loading:q}=Js(L,U),X=$??[];p.useEffect(()=>{!$||$.length<2||we.compareRuns(s,o,$[0].timestamp,$[1].timestamp).then(P=>{const H=P.regressions.filter(ae=>ae.change==="regression");a({type:"SET_REGRESSIONS",regressions:H})}).catch(()=>{})},[$,s,o,a]);const ee=p.useCallback(()=>En(L),[L]);Ho("history:written",ee);const I=p.useCallback(async P=>{if(S){E(H=>H.includes(P)?H.filter(ae=>ae!==P):H.length>=2?[H[1],P]:[...H,P]);return}B(!0);try{const H=await we.getHistoryEntry(s,o,P);F(H)}catch{}finally{B(!1)}},[s,o,S]),z=p.useCallback(async()=>{if(w.length===2){_(!0);try{const P=await we.compareRuns(s,o,w[0],w[1]);N(P)}catch{}finally{_(!1)}}},[s,o,w]),O=[...new Set(X.map(P=>P.model))];return q?r.jsxs("div",{className:"p-5",children:[r.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),r.jsx("div",{className:"skeleton h-48 rounded-xl mb-4"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"skeleton h-12 rounded-lg"}),r.jsx("div",{className:"skeleton h-12 rounded-lg"})]})]}):r.jsxs("div",{className:"p-5",children:[r.jsx("div",{className:"flex items-center gap-1 mb-4",children:["timeline","per-eval","statistics"].map(P=>r.jsx("button",{onClick:()=>g(P),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:h===P?"var(--accent-muted)":"transparent",color:h===P?"var(--accent)":"var(--text-tertiary)"},children:P==="timeline"?"Timeline":P==="per-eval"?"Per Eval":"Statistics"},P))}),h==="timeline"&&r.jsxs("div",{children:[X.length>0&&r.jsx("div",{className:"mb-5 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:r.jsx(NE,{entries:X,onPointClick:P=>I(P.timestamp)})}),r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsxs("select",{value:m,onChange:P=>y(P.target.value),className:"input-field text-[12px]",style:{width:150},children:[r.jsx("option",{value:"",children:"All Models"}),O.map(P=>r.jsx("option",{value:P,children:P},P))]}),r.jsxs("select",{value:v,onChange:P=>b(P.target.value),className:"input-field text-[12px]",style:{width:150},children:[r.jsx("option",{value:"",children:"All Types"}),r.jsx("option",{value:"benchmark",children:"Benchmark"}),r.jsx("option",{value:"comparison",children:"Comparison"}),r.jsx("option",{value:"baseline",children:"Baseline"}),r.jsx("option",{value:"model-compare",children:"Model Compare"}),r.jsx("option",{value:"improve",children:"AI Improve"}),r.jsx("option",{value:"instruct",children:"AI Edit"}),r.jsx("option",{value:"ai-generate",children:"AI Generate"}),r.jsx("option",{value:"eval-generate",children:"Eval Generate"})]}),r.jsx("div",{className:"flex-1"}),r.jsx("button",{onClick:()=>{k(!S),E([]),N(null)},className:`btn text-[12px] ${S?"btn-primary":"btn-secondary"}`,children:S?"Exit Compare":"Compare Runs"}),S&&w.length===2&&r.jsx("button",{onClick:z,disabled:A,className:"btn btn-primary text-[12px]",children:A?"Comparing...":"Compare"})]}),r.jsx("div",{className:"space-y-2",children:X.length===0?r.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):X.map(P=>{const H=w.includes(P.timestamp);return r.jsx("button",{onClick:()=>I(P.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:H?"var(--accent-muted)":"var(--surface-1)",border:H?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:ae=>{H||(ae.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:ae=>{H||(ae.currentTarget.style.borderColor="var(--border-subtle)")},children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[S&&r.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:H?"var(--accent)":"var(--border-default)",background:H?"var(--accent)":"transparent"},children:H&&r.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})})}),r.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:new Date(P.timestamp).toLocaleString()}),r.jsx("span",{className:"pill text-[9px]",style:{background:P.type==="comparison"?"var(--purple-muted)":P.type==="baseline"?"var(--surface-3)":P.type==="model-compare"?"var(--accent-muted)":P.type==="improve"||P.type==="instruct"?"var(--purple-muted)":P.type==="ai-generate"?"var(--green-muted)":P.type==="eval-generate"?"var(--orange-muted)":"var(--accent-muted)",color:P.type==="comparison"?"var(--purple)":P.type==="baseline"?"var(--text-tertiary)":P.type==="model-compare"?"var(--accent)":P.type==="improve"||P.type==="instruct"?"var(--purple)":P.type==="ai-generate"?"var(--green)":P.type==="eval-generate"?"var(--orange)":"var(--accent)"},children:P.type==="model-compare"?"model compare":P.type==="improve"?"ai improve":P.type==="instruct"?"ai edit":P.type==="ai-generate"?"ai generate":P.type==="eval-generate"?"eval generate":P.type})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(ri,{version:d,size:"sm","data-testid":"history-row-version"}),r.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:P.model}),P.totalCost!=null&&P.totalCost>0&&r.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--text-tertiary)"},children:Tn(P.totalCost)}),r.jsxs("span",{className:"text-[12px] font-semibold",style:{color:P.passRate>=.8?"var(--green)":P.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(P.passRate*100),"%"]})]})]})},P.timestamp)})}),T&&r.jsx(BE,{result:T}),D&&!S&&r.jsx(IE,{run:D,onClose:()=>F(null)})]}),h==="per-eval"&&r.jsx(_E,{plugin:s,skill:o}),h==="statistics"&&r.jsx(DE,{plugin:s,skill:o})]})}function BE({result:t}){const a=t.regressions.filter(o=>o.change==="regression"),s=t.regressions.filter(o=>o.change==="improvement");return r.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Comparison: ",new Date(t.runA.timestamp).toLocaleDateString()," vs ",new Date(t.runB.timestamp).toLocaleDateString()]}),(t.runA.totalCost!=null||t.runB.totalCost!=null)&&r.jsxs("div",{className:"flex items-center gap-4 mb-3 text-[11px]",style:{color:"var(--text-secondary)"},children:[r.jsxs("span",{children:["Run A cost: ",Tn(t.runA.totalCost??null)]}),r.jsxs("span",{children:["Run B cost: ",Tn(t.runB.totalCost??null)]}),t.runA.totalCost!=null&&t.runB.totalCost!=null&&r.jsxs("span",{style:{color:t.runB.totalCost<=t.runA.totalCost?"var(--green)":"var(--red)"},children:["Delta: ",Tn(t.runB.totalCost-t.runA.totalCost)]})]}),a.length>0&&r.jsxs("div",{className:"mb-3",children:[r.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--red)"},children:["Regressions (",a.length,")"]}),a.map(o=>r.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",r.jsx("span",{style:{color:"var(--red)"},children:o.assertionId})," (was passing, now failing)"]},`${o.evalId}-${o.assertionId}`))]}),s.length>0&&r.jsxs("div",{className:"mb-3",children:[r.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--green)"},children:["Improvements (",s.length,")"]}),s.map(o=>r.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",r.jsx("span",{style:{color:"var(--green)"},children:o.assertionId})," (was failing, now passing)"]},`${o.evalId}-${o.assertionId}`))]}),r.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 mt-3",style:{color:"var(--text-tertiary)"},children:"Case Diffs"}),r.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:r.jsxs("table",{className:"w-full text-[12px]",children:[r.jsx("thead",{children:r.jsxs("tr",{style:{background:"var(--surface-2)"},children:[r.jsx("th",{className:"text-left px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Case"}),r.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run A"}),r.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run B"})]})}),r.jsx("tbody",{children:t.caseDiffs.map(o=>r.jsxs("tr",{style:{borderTop:"1px solid var(--border-subtle)"},children:[r.jsxs("td",{className:"px-3 py-2",style:{color:"var(--text-secondary)"},children:["#",o.eval_id," ",o.eval_name]}),r.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}),r.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 IE({run:t,onClose:a}){return(t.type==="improve"||t.type==="instruct")&&t.improve?r.jsx(UE,{run:t,onClose:a}):r.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:["Run: ",new Date(t.timestamp).toLocaleString()]}),r.jsx("button",{onClick:a,className:"btn btn-ghost text-[11px]",children:"Close"})]}),r.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:["Model: ",t.model," | Cases: ",t.cases.length," | Pass Rate: ",t.overall_pass_rate!=null?`${Math.round(t.overall_pass_rate*100)}%`:"--",t.totalCost!=null&&t.totalCost>0&&` | Cost: ${Tn(t.totalCost)}`]}),r.jsx("div",{className:"space-y-2",children:t.cases.map(s=>r.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)"},children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-[12px]",style:{color:"var(--text-secondary)"},children:["#",s.eval_id," ",s.eval_name]}),r.jsxs("div",{className:"flex items-center gap-2",children:[s.cost!=null&&s.cost>0&&r.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--text-tertiary)"},children:Tn(s.cost)}),r.jsx("span",{className:"text-[11px] font-semibold",style:{color:s.status==="pass"?"var(--green)":"var(--red)"},children:s.pass_rate!=null?`${Math.round(s.pass_rate*100)}%`:s.status})]})]})},s.eval_id))})]})}function UE({run:t,onClose:a}){var u;const s=p.useMemo(()=>t.improve?Jo(t.improve.original,t.improve.improved):[],[t.improve]),o=p.useMemo(()=>{const d=s.filter(g=>g.type==="added").length,h=s.filter(g=>g.type==="removed").length;return{added:d,removed:h}},[s]),c=p.useMemo(()=>{let d=0,h=0;return s.map(g=>g.type==="removed"?(d++,{...g,origNum:d,newNum:null}):g.type==="added"?(h++,{...g,origNum:null,newNum:h}):(d++,h++,{...g,origNum:d,newNum:h}))},[s]);return r.jsxs("div",{className:"mt-4 rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[r.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:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{background:"var(--purple-muted)"},children:r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--purple)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),r.jsx("path",{d:"M2 17l10 5 10-5"}),r.jsx("path",{d:"M2 12l10 5 10-5"})]})}),r.jsxs("div",{children:[r.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"}),r.jsxs("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[new Date(t.timestamp).toLocaleString()," · ",t.model]})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[r.jsxs("span",{style:{color:"var(--green)"},children:["+",o.added]}),r.jsxs("span",{style:{color:"var(--red)"},children:["-",o.removed]})]}),r.jsx("button",{onClick:a,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:d=>{d.currentTarget.style.background="var(--surface-3)"},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),((u=t.improve)==null?void 0:u.reasoning)&&r.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:[r.jsx("span",{className:"font-semibold",style:{color:"var(--purple)"},children:"AI Reasoning: "}),t.improve.reasoning]}),r.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:480,overflowY:"auto"},children:r.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:r.jsx("tbody",{children:c.map((d,h)=>r.jsxs("tr",{style:{background:d.type==="added"?"var(--green-muted)":d.type==="removed"?"var(--red-muted)":"transparent"},children:[r.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:d.type==="removed"?"var(--red)":"var(--text-tertiary)",opacity:d.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:d.origNum??""}),r.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:d.type==="added"?"var(--green)":"var(--text-tertiary)",opacity:d.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:d.newNum??""}),r.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:d.type==="added"?"var(--green)":d.type==="removed"?"var(--red)":"transparent",borderRight:d.type==="added"?"2px solid var(--green)":d.type==="removed"?"2px solid var(--red)":"2px solid transparent"},children:d.type==="added"?"+":d.type==="removed"?"-":" "}),r.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:d.type==="added"?"var(--green)":d.type==="removed"?"var(--red)":"var(--text-secondary)"},children:d.content||""})]},h))})})})]})}function $y({data:t}){if(t.length<2)return r.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:"--"});const a=t.slice(-10),s=80,o=24,c=2,u=s-c*2,d=o-c*2,h=a.length,g=Math.min(...a),y=Math.max(...a)-g||1,v=a.map((k,w)=>{const E=c+w/(h-1)*u,T=c+d-(k-g)/y*d;return`${E.toFixed(1)},${T.toFixed(1)}`}),b=a[a.length-1],S=Dl(b);return r.jsxs("svg",{width:s,height:o,viewBox:`0 0 ${s} ${o}`,style:{display:"block"},children:[r.jsx("polyline",{points:v.join(" "),fill:"none",stroke:S,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),(()=>{const[k,w]=v[v.length-1].split(",");return r.jsx("circle",{cx:k,cy:w,r:2.5,fill:S})})()]})}function HE(){return r.jsxs("span",{className:"pill",style:{background:"var(--yellow-muted)",color:"var(--yellow)",fontSize:9,fontWeight:700,gap:3},children:[r.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"var(--yellow)",stroke:"none",children:r.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 $E({pct:t}){const a=t>=10?"var(--green)":t>=0?"var(--yellow)":"var(--red)",s=t>=10?"var(--green-muted)":t>=0?"var(--yellow-muted)":"var(--red-muted)",o=t>=0?"+":"";return r.jsxs("span",{className:"pill",style:{background:s,color:a,fontSize:10,fontWeight:600},children:[o,t.toFixed(1),"%"]})}function VE({score:t,rating:a}){const s={excellent:{bg:"var(--green-muted)",fg:"var(--green)"},good:{bg:"var(--green-muted)",fg:"var(--green)"},marginal:{bg:"var(--yellow-muted)",fg:"var(--yellow)"},minimal:{bg:"var(--yellow-muted)",fg:"var(--yellow)"},harmful:{bg:"var(--red-muted)",fg:"var(--red)"}},o=s[a]??s.minimal,c=t>=0?"+":"";return r.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[r.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"Skill Quality:"}),r.jsxs("span",{className:"pill",style:{background:o.bg,color:o.fg,fontSize:11,fontWeight:600},children:[c,t.toFixed(1),"% (",a.toUpperCase(),")"]})]})}function PE({warning:t}){return r.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:[r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--yellow)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.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"}),r.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),r.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),r.jsx("span",{className:"text-[11px]",style:{color:"var(--yellow)"},children:t})]})}function FE({active:t,onChange:a,hasBaseline:s}){return r.jsxs("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)"},children:[r.jsx("button",{onClick:()=>a("rankings"),className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:t==="rankings"?"var(--surface-3)":"transparent",color:t==="rankings"?"var(--text-primary)":"var(--text-tertiary)"},children:"Rankings"}),r.jsx("button",{onClick:()=>a("amplification"),disabled:!s,className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:t==="amplification"?"var(--surface-3)":"transparent",color:s&&t==="amplification"?"var(--text-primary)":"var(--text-tertiary)",opacity:s?1:.5,cursor:s?"pointer":"not-allowed"},title:s?"View skill amplification data":"Run sweep with --baseline to see amplification data",children:"Skill Amplification"})]})}function GE(t){var o,c,u;if(t.length===0)return[];const a=new Map;for(const d of t)for(const h of d.models){if(h.status==="error")continue;const g=`${h.provider}/${h.model}`;a.has(g)||a.set(g,{provider:h.provider,passRates:[],lastRubric:null,lastDuration:0,lastCost:null,lastBaselinePassRate:void 0,lastSkillDelta:void 0,lastAmplificationPct:void 0,lastCompositeScore:void 0,hasBaseline:!1});const m=a.get(g);m.passRates.push(h.passRate.mean),m.lastRubric=((o=h.rubricScore)==null?void 0:o.mean)??null,m.lastDuration=h.duration.mean,m.lastCost=((c=h.cost)==null?void 0:c.total)??null,m.lastCompositeScore=h.compositeScore,h.baselinePassRate!=null&&(m.lastBaselinePassRate=h.baselinePassRate.mean,m.lastSkillDelta=(u=h.skillDelta)==null?void 0:u.mean,m.lastAmplificationPct=h.amplificationPct,m.hasBaseline=!0)}const s=[];for(const[d,h]of a){const[g,...m]=d.split("/");s.push({rank:0,model:m.join("/"),provider:g,passRate:h.passRates[h.passRates.length-1],rubricScore:h.lastRubric,duration:h.lastDuration,cost:h.lastCost,sparklineData:h.passRates,isBest:!1,baselinePassRate:h.lastBaselinePassRate,skillDelta:h.lastSkillDelta,amplificationPct:h.lastAmplificationPct,compositeScore:h.lastCompositeScore,hasBaseline:h.hasBaseline})}return s.sort((d,h)=>{const g=d.compositeScore??d.passRate;return(h.compositeScore??h.passRate)-g}),s.forEach((d,h)=>{d.rank=h+1}),s.length>0&&(s[0].isBest=!0),s}const Vy=(t="left")=>({padding:"10px 12px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary)",textAlign:t,whiteSpace:"nowrap"});function WE({entries:t}){return r.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:r.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[r.jsx("thead",{children:r.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","Pass Rate","Rubric","Duration","Cost","Trend"].map(a=>r.jsx("th",{style:Vy(a==="#"?"center":"left"),children:a},a))})}),r.jsx("tbody",{children:t.map(a=>r.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:s=>{s.currentTarget.style.background="var(--surface-2)"},onMouseLeave:s=>{s.currentTarget.style.background="transparent"},children:[r.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:a.rank}),r.jsx("td",{style:{padding:"10px 12px"},children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:a.model}),r.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:a.provider}),a.isBest&&r.jsx(HE,{})]})}),r.jsx("td",{style:{padding:"10px 12px"},children:r.jsxs("span",{className:"pill",style:{background:a.passRate>=.7?"var(--green-muted)":a.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:Dl(a.passRate),fontSize:11,fontWeight:600},children:[Math.round(a.passRate*100),"%"]})}),r.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:a.rubricScore!=null?a.rubricScore.toFixed(1):"--"}),r.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:a.duration<1e3?`${Math.round(a.duration)}ms`:`${(a.duration/1e3).toFixed(1)}s`}),r.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:a.cost!=null?`$${a.cost.toFixed(4)}`:"N/A"}),r.jsx("td",{style:{padding:"10px 12px"},children:r.jsx($y,{data:a.sparklineData})})]},`${a.provider}/${a.model}`))})]})})}function qE({entries:t}){const a=[...t].filter(s=>s.hasBaseline).sort((s,o)=>(o.amplificationPct??0)-(s.amplificationPct??0));return a.length===0?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"text-center",children:r.jsxs("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:["No baseline data available. Run sweep with ",r.jsx("code",{children:"--baseline"})," flag."]})})}):r.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:r.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[r.jsx("thead",{children:r.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","With Skill","Without Skill","Delta","Amplification","Trend"].map(s=>r.jsx("th",{style:Vy(s==="#"?"center":"left"),children:s},s))})}),r.jsx("tbody",{children:a.map((s,o)=>r.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:c=>{c.currentTarget.style.background="var(--surface-2)"},onMouseLeave:c=>{c.currentTarget.style.background="transparent"},children:[r.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:o+1}),r.jsx("td",{style:{padding:"10px 12px"},children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:s.model}),r.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:s.provider})]})}),r.jsx("td",{style:{padding:"10px 12px"},children:r.jsxs("span",{className:"pill",style:{background:s.passRate>=.7?"var(--green-muted)":s.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:Dl(s.passRate),fontSize:11,fontWeight:600},children:[Math.round(s.passRate*100),"%"]})}),r.jsx("td",{style:{padding:"10px 12px"},children:s.baselinePassRate!=null?r.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:[Math.round(s.baselinePassRate*100),"%"]}):"--"}),r.jsx("td",{style:{padding:"10px 12px"},children:s.skillDelta!=null?r.jsxs("span",{className:"text-[11px] font-medium",style:{color:s.skillDelta>=0?"var(--green)":"var(--red)"},children:[s.skillDelta>=0?"+":"",(s.skillDelta*100).toFixed(1),"pp"]}):"--"}),r.jsx("td",{style:{padding:"10px 12px"},children:s.amplificationPct!=null&&isFinite(s.amplificationPct)?r.jsx($E,{pct:s.amplificationPct}):"--"}),r.jsx("td",{style:{padding:"10px 12px"},children:r.jsx($y,{data:s.sparklineData})})]},`${s.provider}/${s.model}`))})]})})}function YE(){const{state:t}=Rn(),{plugin:a,skill:s}=t,[o,c]=p.useState("rankings"),u=`leaderboard/${a}/${s}`,d=p.useCallback(()=>we.getLeaderboard(a,s),[a,s]),{data:h,loading:g,error:m}=Js(u,d),y=(h==null?void 0:h.entries)??[],v=(m==null?void 0:m.message)??null;p.useEffect(()=>{c("rankings")},[a,s]);const b=p.useCallback(()=>En(u),[u]);Ho("leaderboard:updated",b);const S=p.useMemo(()=>GE(y),[y]),k=S.some(T=>T.hasBaseline),w=y[0],E=w==null?void 0:w.judgeBiasWarning;return g?r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx("div",{className:"spinner spinner-lg"})}):v?r.jsx("div",{className:"flex items-center justify-center h-full px-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--red)"},children:"Failed to load leaderboard"}),r.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:v})]})}):S.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:"var(--accent-muted)"},children:r.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M18 20V10"}),r.jsx("path",{d:"M12 20V4"}),r.jsx("path",{d:"M6 20v-6"})]})}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No sweep results yet"}),r.jsx("div",{className:"text-[12px] mb-3",style:{color:"var(--text-tertiary)"},children:"Run your first model sweep to compare performance across models:"}),r.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"'}),r.jsxs("div",{className:"text-[11px] mt-2",style:{color:"var(--text-tertiary)"},children:["Add ",r.jsx("code",{children:"--baseline"})," to measure skill amplification per model."]})]})]}):r.jsxs("div",{className:"p-5 animate-fade-in",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"text-[15px] font-semibold",style:{color:"var(--text-primary)"},children:"Model Leaderboard"}),r.jsx(FE,{active:o,onChange:c,hasBaseline:k})]}),r.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[y.length," sweep",y.length!==1?"s":""," · ",S.length," model",S.length!==1?"s":""]})]}),E&&r.jsx(PE,{warning:E}),o==="rankings"?r.jsx(WE,{entries:S}):r.jsx(qE,{entries:S}),o==="amplification"&&(w==null?void 0:w.skillQualityScore)!=null&&(w==null?void 0:w.skillQualityRating)&&r.jsx(VE,{score:w.skillQualityScore,rating:w.skillQualityRating})]})}function KE({plugin:t,skill:a}){const[s,o]=p.useState([]),[c,u]=p.useState([]),[d,h]=p.useState(!0),[g,m]=p.useState(null);p.useEffect(()=>{we.getDependencies(t,a).then(v=>{o(v.mcpDependencies),u(v.skillDependencies)}).catch(()=>{}).finally(()=>h(!1))},[t,a]);async function y(v,b){try{await navigator.clipboard.writeText(b),m(v),setTimeout(()=>m(null),2e3)}catch{}}return d?null:s.length===0&&c.length===0?r.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"}):r.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[r.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:[r.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(234,179,8,0.15)"},children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#eab308",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.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"}),r.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"})]})}),r.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Dependencies"}),r.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:s.length+c.length})]}),r.jsxs("div",{className:"px-5 py-4",children:[s.length>0&&r.jsxs("div",{className:"space-y-3 mb-4",children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"MCP Servers"}),s.map(v=>r.jsxs("div",{className:"p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:v.server}),r.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:v.transport})]}),r.jsx("button",{onClick:()=>y(v.server,v.configSnippet),className:"btn btn-ghost text-[11px] py-1 px-2",style:{color:g===v.server?"var(--green)":"var(--accent)"},children:g===v.server?r.jsxs(r.Fragment,{children:[r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})})," Copied!"]}):r.jsxs(r.Fragment,{children:[r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),r.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"]})})]}),r.jsx("div",{className:"text-[11px] mb-2 font-mono",style:{color:"var(--text-tertiary)"},children:v.url}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:v.matchedTools.map(b=>r.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:b},b))})]},v.server))]}),c.length>0&&r.jsxs("div",{children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Skill Dependencies"}),r.jsx("div",{className:"space-y-1.5",children:c.map(v=>r.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:[r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.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"})}),r.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:v.name}),r.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:v.source==="frontmatter"?"frontmatter":"referenced"})]},v.name))})]})]})]})}function ev({plugin:t,skill:a}){const[s,o]=p.useState([]),[c,u]=p.useState(!0),[d,h]=p.useState(null),[g,m]=p.useState(""),[y,v]=p.useState(!1),[b,S]=p.useState(null),[k,w]=p.useState(""),[E,T]=p.useState(""),[N,A]=p.useState(!1),[_,D]=p.useState(new Set),F=p.useCallback(async()=>{u(!0);try{const[U,$]=await Promise.all([we.getCredentials(t,a).catch(()=>({credentials:[]})),we.getParams(t,a).catch(()=>({params:[]}))]),q=new Map($.params.map(I=>[I.name,I])),X=new Set,ee=[];for(const I of U.credentials){X.add(I.name);const z=q.get(I.name);ee.push({name:I.name,status:I.status==="ready"||I.status==="resolved"?"ready":"missing",source:I.source,maskedValue:z==null?void 0:z.maskedValue})}for(const I of $.params)X.has(I.name)||ee.push({name:I.name,status:I.status,maskedValue:I.maskedValue});o(ee)}finally{u(!1)}},[t,a]);p.useEffect(()=>{F()},[F]);const C=p.useCallback(async U=>{if(_.has(U)){D($=>{const q=new Set($);return q.delete(U),q}),o($=>$.map(q=>q.name===U?{...q,revealedValue:void 0}:q));return}try{const q=(await we.getParamsRevealed(t,a,U)).params.find(X=>X.name===U);q&&(o(X=>X.map(ee=>ee.name===U?{...ee,revealedValue:q.value}:ee)),D(X=>new Set(X).add(U)))}catch{}},[t,a,_]),B=async(U,$)=>{if(!(!U.trim()||!$.trim())){v(!0),S(null);try{await we.setCredential(t,a,U,$),h(null),m(""),D(new Set),F()}catch(q){S(q.message)}finally{v(!1)}}},L=async()=>{if(!(!k.trim()||!E.trim())){v(!0),S(null);try{await we.setCredential(t,a,k.trim().toUpperCase(),E),w(""),T(""),A(!1),F()}catch(U){S(U.message)}finally{v(!1)}}};return c?r.jsxs("div",{className:"mt-6",children:[r.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),r.jsx("div",{className:"skeleton h-20 rounded-xl"})]}):r.jsxs("div",{className:"mt-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),r.jsx("button",{onClick:()=>A(!N),className:"text-[11px] transition-colors duration-150",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"+ Add Parameter"})]}),b&&r.jsx("div",{className:"mb-2 px-3 py-2 rounded-lg text-[11px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:b}),s.length===0&&!N?r.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"}):r.jsx("div",{className:"rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:s.map(U=>r.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:[r.jsx("span",{className:"text-[11px] font-mono font-medium truncate",style:{color:"var(--text-primary)",minWidth:80},children:U.name}),U.maskedValue&&r.jsx("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)",maxWidth:120},children:_.has(U.name)&&U.revealedValue!=null?U.revealedValue:U.maskedValue}),U.maskedValue&&r.jsx("button",{onClick:()=>C(U.name),className:"btn btn-ghost px-1",title:_.has(U.name)?"Hide value":"Reveal value",style:{color:"var(--text-tertiary)",lineHeight:1},children:_.has(U.name)?r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.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"}),r.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"}),r.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),r.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),r.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:U.status==="ready"?"var(--green-muted)":"var(--orange-muted)",color:U.status==="ready"?"var(--green)":"var(--orange)"},children:U.status==="ready"?"ready":"missing"}),U.source&&r.jsx("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:U.source}),d===U.name?r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("input",{value:g,onChange:$=>m($.target.value),onKeyDown:$=>{$.key==="Enter"&&B(U.name,g)},className:"input-field text-[11px] font-mono",style:{width:160},placeholder:"Value...",autoFocus:!0}),r.jsx("button",{onClick:()=>B(U.name,g),disabled:y||!g.trim(),className:"btn btn-primary text-[10px] px-2 py-0.5",children:y?"...":"Save"}),r.jsx("button",{onClick:()=>{h(null),m("")},className:"btn btn-ghost text-[10px] px-1",children:r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}):r.jsx("button",{onClick:()=>{h(U.name),m("")},className:"btn btn-ghost text-[10px] px-2 py-0.5",style:{color:"var(--accent)"},children:"Edit"})]},U.name))}),N&&r.jsxs("div",{className:"mt-2 p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"flex gap-2 mb-2",children:[r.jsx("input",{value:k,onChange:U=>w(U.target.value),className:"input-field flex-1 text-[11px] font-mono",placeholder:"KEY_NAME",autoFocus:!0}),r.jsx("input",{value:E,onChange:U=>T(U.target.value),onKeyDown:U=>{U.key==="Enter"&&L()},className:"input-field flex-1 text-[11px] font-mono",placeholder:"Value",type:"password"})]}),r.jsxs("div",{className:"flex justify-end gap-1.5",children:[r.jsx("button",{onClick:()=>{A(!1),w(""),T("")},className:"btn btn-ghost text-[10px]",children:"Cancel"}),r.jsx("button",{onClick:L,disabled:y||!k.trim()||!E.trim(),className:"btn btn-primary text-[10px]",children:y?"Saving...":"Save"})]})]})]})}function XE(){const{state:t}=Rn(),{plugin:a,skill:s}=t,[o,c]=p.useState(null),[u,d]=p.useState(!0);return p.useEffect(()=>{we.getDependencies(a,s).then(c).catch(()=>{}).finally(()=>d(!1))},[a,s]),u?r.jsxs("div",{className:"p-5",children:[r.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),r.jsx("div",{className:"skeleton h-32 rounded-xl"})]}):o?r.jsxs("div",{className:"p-5 max-w-3xl",children:[r.jsx(KE,{plugin:a,skill:s}),r.jsx(ev,{plugin:a,skill:s})]}):r.jsxs("div",{className:"p-5 max-w-3xl",children:[r.jsx("div",{className:"text-[13px] mb-4",style:{color:"var(--text-tertiary)"},children:"No MCP dependency information available"}),r.jsx(ev,{plugin:a,skill:s})]})}function QE(t){const a={prompt:t.prompt,provider:t.provider,model:t.model};return t.targetAgents&&t.targetAgents.length>0&&(a.targetAgents=t.targetAgents),a}function ZE(t){var c;const a=t.userName.trim().length>0,s=t.userPlugin.trim().length>0||t.userNewPlugin.trim().length>0,o=t.forceLayout===3;return{applyName:a?null:t.aiName??null,applySuggestedPlugin:!o&&!s&&!!((c=t.aiSuggestedPlugin)!=null&&c.plugin),suggestedPluginValue:o||s?null:t.aiSuggestedPlugin??null}}function pf(t,a=!0){let s=t.toLowerCase().replace(/[^a-z0-9]+/g,"-");return a&&(s=s.replace(/^-+|-+$/g,"")),s}function JE(t,a,s,o){const u=`.../${t.split("/").slice(-2).join("/")}`;switch(a){case 1:return`${u}/${s}/skills/${o}/SKILL.md`;case 2:return`${u}/plugins/${s}/skills/${o}/SKILL.md`;case 3:return`${u}/skills/${o}/SKILL.md`}}function eN({onCreated:t,resolveAiConfigOverride:a,forceLayout:s}){const[o,c]=p.useState("ai"),[u,d]=p.useState(null),[h,g]=p.useState(!0),{config:m}=$a(),[y,v]=p.useState(""),[b,S]=p.useState(s??3),[k,w]=p.useState(""),[E,T]=p.useState(""),[N,A]=p.useState(""),[_,D]=p.useState(""),[F,C]=p.useState(""),[B,L]=p.useState(""),[U,$]=p.useState("write"),[q,X]=p.useState([]),[ee,I]=p.useState(!1),[z,O]=p.useState(null),[P,H]=p.useState(null),[ae,M]=p.useState("vskill"),[Y,W]=p.useState("1.0.0"),[Q,oe]=p.useState(!0),de=p.useCallback(async()=>{try{const Le=await we.detectEngines();H(Le),M(se=>se!=="vskill"?se:Le.vskillSkillBuilder?"vskill":Le.anthropicSkillCreator?"anthropic-skill-creator":"none")}catch{H({vskillSkillBuilder:!1,anthropicSkillCreator:!1,vskillVersion:null,anthropicPath:null})}},[]);p.useEffect(()=>{de()},[de]);const[ve,ce]=p.useState(""),[je,Re]=p.useState(!1),[Oe,le]=p.useState(!1),[he,pe]=p.useState(null),[xe,be]=p.useState(null),[Be,Ue]=p.useState([]),lt=p.useRef(null),Ct=p.useRef(null),gt=p.useRef(null),Tt=p.useRef(null),Gt=p.useRef(null),[We,nt]=p.useState(!1),[xn,ye]=p.useState(!1),ot=p.useRef(y),Wt=p.useRef(k),Kt=p.useRef(E);p.useEffect(()=>{ot.current=y},[y]),p.useEffect(()=>{Wt.current=k},[k]),p.useEffect(()=>{Kt.current=E},[E]),p.useEffect(()=>{we.getProjectLayout().then(Le=>{if(d(Le),s)return;S(Le.suggestedLayout);const se=Le.detectedLayouts.find(Se=>Se.layout===Le.suggestedLayout);se!=null&&se.existingPlugins.length&&w(se.existingPlugins[0])}).catch(()=>{}).finally(()=>g(!1))},[s]),p.useEffect(()=>{var Le;o==="ai"&&((Le=lt.current)==null||Le.focus())},[o]),p.useEffect(()=>()=>{var Le;(Le=Ct.current)==null||Le.abort()},[]);const An=p.useMemo(()=>{var Le;return u?((Le=u.detectedLayouts.find(se=>se.layout===b))==null?void 0:Le.existingPlugins)||[]:[]},[u,b]),Et=k==="__new__"?E:k,Mn=u?JE(u.root,b,Et||"{plugin}",y||"{skill}"):"",Ut=p.useMemo(()=>u?u.detectedLayouts.filter(Le=>Le.layout!==4):[],[u]),Rt=p.useMemo(()=>{if(!u)return null;const Le=u.detectedLayouts.find(Me=>Me.layout===2&&Me.existingPlugins.length>0),se=u.detectedLayouts.find(Me=>Me.layout===1&&Me.existingPlugins.length>0),Se=Le||se;return Se?{layout:Se.layout,plugins:Se.existingPlugins}:null},[u]),ct=p.useCallback(()=>{if(a)return a();if(!m)return{provider:"claude-cli",model:"sonnet"};const Le=m.provider||"claude-cli",se=m.model||"sonnet";return{provider:Le,model:se}},[m,a]),Wn=p.useCallback(()=>{var Le;(Le=Ct.current)==null||Le.abort(),Re(!1)},[]),tr=p.useCallback(()=>{pe(null),be(null)},[]),da=p.useCallback(async()=>{var Me,Fa;if(pe(null),be(null),Ue([]),gt.current=null,Tt.current=null,!ve.trim()){pe("Describe what your skill should do");return}Re(!0);const Le=new AbortController;Ct.current=Le;const{provider:se,model:Se}=ct();try{const qn=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(QE({prompt:ve.trim(),provider:se,model:Se,targetAgents:q})),signal:Le.signal});if(!qn.ok||!qn.body){let pa=`HTTP ${qn.status}`;try{const ma=await qn.json();ma.error&&(pa=ma.error)}catch{}throw new Error(pa)}const Ul=qn.body.getReader(),fa=new TextDecoder;let Hl="",nr="";for(;;){const{done:pa,value:ma}=await Ul.read();if(pa)break;Hl+=fa.decode(ma,{stream:!0});const Ga=Hl.split(`
|
|
86
|
-
`);Hl=Ga.pop()||"";for(const zr of Ga)if(zr.startsWith("event: "))nr=zr.slice(7).trim();else if(zr.startsWith("data: ")){try{const ut=JSON.parse(zr.slice(6));if(nr==="progress")Ue(ha=>[...ha,{phase:ut.phase,message:ut.message,timestamp:Date.now()}]);else if(nr==="provenance")Tt.current={resolvedModelId:typeof ut.resolvedModelId=="string"?ut.resolvedModelId:null,snapshotDate:typeof ut.snapshotDate=="string"?ut.snapshotDate:null};else if(nr==="done"||nr==="complete"){const ha={prompt:ve.trim(),provider:ct().provider,model:ct().model,resolvedModelId:((Me=Tt.current)==null?void 0:Me.resolvedModelId)??null,snapshotDate:((Fa=Tt.current)==null?void 0:Fa.snapshotDate)??null,reasoning:ut.reasoning||""},an=
|
|
85
|
+
!Write me a poem about flowers`}),r.jsxs("div",{className:"flex items-center flex-wrap gap-x-3 gap-y-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:[r.jsx("span",{children:"One prompt per line"}),r.jsx(ko,{}),r.jsx("span",{children:"No prefix = auto-classify"}),r.jsx(ko,{}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"+"}),"= must activate"]}),r.jsx(ko,{}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"!"}),"= must NOT activate"]}),r.jsx(ko,{}),r.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[q," prompt",q!==1?"s":""]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("button",{onClick:U,disabled:y||!_.trim(),className:"btn btn-primary",children:y?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"spinner",style:{borderTopColor:"var(--color-paper)",borderColor:"var(--border-default)",width:14,height:14}}),"Testing..."]}):r.jsxs(r.Fragment,{children:[r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("circle",{cx:"12",cy:"12",r:"10"}),r.jsx("circle",{cx:"12",cy:"12",r:"6"}),r.jsx("circle",{cx:"12",cy:"12",r:"2"})]}),"Run Activation Test"]})}),y&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:o,className:"btn btn-secondary text-[12px]",children:"Cancel"}),r.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[S||`${g.length} / ${q} prompts tested`,b&&r.jsx(NE,{startedAt:b})]})]})]})]}),r.jsxs("div",{className:"glass-card flex flex-col overflow-hidden",children:[r.jsx("div",{className:"px-4 pt-3.5 pb-2.5 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Skill Description"})}),r.jsx("div",{className:"flex-1 overflow-auto px-4 py-3",style:{minHeight:0},children:I?r.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:O}}):r.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No description available"})})]})]}),v&&r.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:v}),y&&g.length===0&&r.jsxs("div",{className:"text-center py-12 animate-fade-in",children:[r.jsx("div",{className:"spinner-lg mx-auto mb-4"}),r.jsx("p",{className:"text-[14px]",style:{color:"var(--text-secondary)"},children:"Testing activation against skill description..."})]}),g.length>0&&r.jsxs("div",{className:"space-y-5",children:[ee.length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("circle",{cx:"12",cy:"12",r:"10"}),r.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),r.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),r.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--red)"},children:["Incorrect (",ee.length,")"]}),r.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"— These need attention"})]}),r.jsx("div",{className:"space-y-1.5 stagger-children",children:ee.map((P,H)=>r.jsx(Zg,{result:P},`incorrect-${H}`))})]}),X.length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("circle",{cx:"12",cy:"12",r:"10"}),r.jsx("polyline",{points:"16 10 11 15 8 12"})]}),r.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--green)"},children:["Correct (",X.length,")"]})]}),r.jsx("div",{className:"space-y-1.5 stagger-children",children:X.map((P,H)=>r.jsx(Zg,{result:P},`correct-${H}`))})]})]}),m&&r.jsxs("div",{className:"glass-card p-6 animate-fade-in-scale",style:{borderColor:"var(--border-active)",borderWidth:2},children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-2",style:{color:"var(--text-tertiary)"},children:"Summary"}),m.autoClassifiedCount!=null&&m.autoClassifiedCount>0&&r.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:[m.autoClassifiedCount," of ",m.total," prompts auto-classified from skill name and tags"]}),r.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[r.jsx(Id,{label:"Precision",value:m.precision,description:"Of all activations, how many were correct?",detail:`${m.tp} true / ${m.tp+m.fp} total activations`}),r.jsx(Id,{label:"Recall",value:m.recall,description:"Of expected activations, how many fired?",detail:`${m.tp} activated / ${m.tp+m.fn} expected`}),r.jsx(Id,{label:"Reliability",value:m.reliability,description:"Overall correct classification rate",detail:`${m.tp+m.tn} correct / ${m.total} total`})]}),r.jsxs("div",{className:"pt-4",style:{borderTop:"1px solid var(--border-subtle)"},children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-3 text-center",style:{color:"var(--text-tertiary)"},children:"Confusion Matrix"}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 max-w-xs mx-auto",children:[r.jsx(wo,{label:"True Positive",abbr:"TP",count:m.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),r.jsx(wo,{label:"False Positive",abbr:"FP",count:m.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),r.jsx(wo,{label:"False Negative",abbr:"FN",count:m.fn,bg:"var(--red-muted)",color:"var(--red)",description:"Missed activation"}),r.jsx(wo,{label:"True Negative",abbr:"TN",count:m.tn,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly silent"})]})]})]}),r.jsx(wE,{history:C,expanded:B,onToggle:()=>L(!B),skillVersion:A})]})}function wE({history:t,expanded:a,onToggle:s,skillVersion:o}){return t===null?null:r.jsxs("div",{className:"glass-card overflow-hidden",children:[r.jsxs("button",{className:"w-full px-4 py-3 flex items-center justify-between text-left",style:{borderBottom:a?"1px solid var(--border-subtle)":"none"},onClick:s,children:[r.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:["Test History",t.length>0&&r.jsxs("span",{className:"ml-2 font-normal",style:{color:"var(--text-tertiary)"},children:["(",t.length," run",t.length!==1?"s":"",")"]})]}),r.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:a?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},children:r.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),a&&r.jsx("div",{className:"px-4 py-3",children:t.length===0?r.jsx("div",{className:"text-[12px] py-4 text-center",style:{color:"var(--text-tertiary)"},children:"No test runs yet"}):r.jsx("div",{className:"space-y-2",children:t.map(c=>r.jsx(CE,{run:c,skillVersion:o},c.id))})})]})}function CE({run:t,skillVersion:a}){const s=Math.round(t.summary.reliability*100),o=s>=80?"var(--green)":s>=60?"var(--yellow)":"var(--red)",c=s>=80?"Good":s>=60?"Needs Work":"Poor",u=o;return r.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{background:"var(--surface-1)"},children:[r.jsx("div",{className:"flex-1 min-w-0",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:EE(t.timestamp)}),r.jsx(ri,{version:a??null,size:"sm","data-testid":"activation-row-version"}),r.jsx("span",{className:"pill text-[9px] px-1.5",style:{background:"var(--surface-2)",color:"var(--text-tertiary)"},children:t.model||t.provider}),r.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[t.promptCount," prompts"]})]})}),r.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[r.jsxs("span",{className:"text-[12px] font-semibold",style:{color:o,fontVariantNumeric:"tabular-nums"},children:[s,"%"]}),r.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:c})]})]})}function EE(t){const a=Date.now(),s=new Date(t).getTime(),o=Math.floor((a-s)/1e3);if(o<60)return"just now";const c=Math.floor(o/60);if(c<60)return`${c}m ago`;const u=Math.floor(c/60);if(u<24)return`${u}h ago`;const d=Math.floor(u/24);return d<7?`${d}d ago`:new Date(t).toLocaleDateString()}function ko(){return r.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function Zg({result:t}){const a=Qg[t.classification]||Qg.FN,s=t.classification==="TP"||t.classification==="TN";return r.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl transition-all duration-200",style:{background:a.bg,border:"1px solid transparent"},children:[r.jsx("div",{className:"flex-shrink-0 mt-0.5",children:r.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:`color-mix(in srgb, ${a.text} 20%, transparent)`},children:s?r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:a.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})}):r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:a.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"flex items-center gap-2 mb-1",children:r.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:t.prompt})}),r.jsxs("div",{className:"flex items-center gap-3 text-[12px]",children:[r.jsx("span",{className:"pill",style:{background:"var(--surface-3)",color:a.text,fontWeight:700,fontSize:"10px",padding:"1px 6px"},children:t.classification}),r.jsx("span",{style:{color:t.activate?"var(--green)":"var(--text-tertiary)"},children:t.activate?"Activated":"Silent"}),r.jsxs("span",{style:{color:"var(--text-tertiary)"},children:["Expected: ",t.expected==="should_activate"?"activate":"stay silent"]}),r.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[t.confidence," confidence"]}),t.autoClassified&&r.jsx("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)",fontSize:"9px",padding:"1px 5px"},children:"auto"})]}),t.reasoning&&r.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--text-tertiary)"},children:t.reasoning})]})]})}function Id({label:t,value:a,description:s,detail:o}){const c=Math.round(a*100),u=c>=80?"var(--green)":c>=60?"var(--yellow)":"var(--red)";return r.jsxs("div",{className:"text-center",children:[r.jsxs("div",{className:"text-[28px] font-bold tracking-tight",style:{color:u},children:[c,"%"]}),r.jsx("div",{className:"text-[12px] font-medium mt-0.5",style:{color:"var(--text-secondary)"},children:t}),r.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--text-tertiary)"},children:s}),r.jsx("div",{className:"text-[10px] mt-0.5 font-mono",style:{color:"var(--text-tertiary)"},children:o})]})}function wo({abbr:t,count:a,bg:s,color:o,description:c}){return r.jsxs("div",{className:"text-center p-3 rounded-lg",style:{background:s},children:[r.jsx("div",{className:"text-[20px] font-bold",style:{color:o},children:a}),r.jsx("div",{className:"text-[11px] font-semibold",style:{color:o},children:t}),r.jsx("div",{className:"text-[9px] mt-0.5",style:{color:"var(--text-tertiary)"},children:c})]})}function NE({startedAt:t}){const[a,s]=p.useState(0);return p.useEffect(()=>{const o=setInterval(()=>s(Math.floor((Date.now()-t)/1e3)),1e3);return()=>clearInterval(o)},[t]),r.jsxs("span",{className:"ml-2",children:["(",a,"s)"]})}const Ud={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},Jg={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},ff=600,pf=180,sn=40,Hd=ff-sn*2,ra=pf-sn*2,TE=[25,50,75,100];function ev(t){return new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function RE(t){return t==null?"--":`${(t/1e3).toFixed(1)}s`}function AE({entries:t,onPointClick:a}){const[s,o]=p.useState(null),c=p.useMemo(()=>[...t].reverse(),[t]);if(c.length<2)return null;const u=c.length,d=c.map((m,y)=>{const v=sn+y/(u-1)*Hd,b=m.passRate*100,S=sn+ra-b/100*ra;return{x:v,y:S,pct:b,entry:m}}),h=d.map(m=>`${m.x},${m.y}`).join(" "),g=Array.from(new Set(c.map(m=>m.type)));return r.jsxs("div",{className:"glass-card p-5 animate-fade-in",style:{position:"relative",overflowX:u>=20?"auto":void 0},children:[r.jsx("div",{className:"text-[13px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"Pass Rate Trend"}),r.jsx("div",{className:"flex items-center gap-5 mb-3",children:g.map(m=>r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:Ud[m]??"var(--text-tertiary)"}}),r.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:Jg[m]??m})]},m))}),r.jsxs("svg",{width:ff,height:pf,viewBox:`0 0 ${ff} ${pf}`,style:{display:"block",overflow:"visible"},children:[TE.map(m=>{const y=sn+ra-m/100*ra;return r.jsxs("g",{children:[r.jsx("line",{x1:sn,y1:y,x2:sn+Hd,y2:y,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),r.jsxs("text",{x:sn-8,y:y+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[m,"%"]})]},m)}),r.jsx("line",{x1:sn,y1:sn+ra,x2:sn+Hd,y2:sn+ra,stroke:"var(--border-subtle)",strokeWidth:1}),r.jsx("text",{x:sn-8,y:sn+ra+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:"0%"}),r.jsx("polyline",{points:h,fill:"none",stroke:"var(--border-subtle)",strokeWidth:1.5,strokeLinejoin:"round"}),d.map((m,y)=>r.jsx("circle",{cx:m.x,cy:m.y,r:5,fill:Ud[m.entry.type]??"var(--text-tertiary)",stroke:"var(--surface-2)",strokeWidth:2,style:{cursor:"pointer",transition:"r 0.15s ease"},onMouseEnter:v=>{v.currentTarget.setAttribute("r","7"),o({x:m.x,y:m.y,entry:m.entry})},onMouseLeave:v=>{v.currentTarget.setAttribute("r","5"),o(null)},onClick:()=>a==null?void 0:a(m.entry)},y)),ME(u).map(m=>r.jsx("text",{x:d[m].x,y:sn+ra+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:ev(c[m].timestamp)},m))]}),s&&r.jsxs("div",{style:{position:"absolute",left:s.x,top:s.y-12,transform:"translate(-50%, -100%)",background:"var(--surface-3)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"8px 12px",pointerEvents:"none",zIndex:10,whiteSpace:"nowrap"},children:[r.jsx("div",{className:"text-[11px] font-medium",style:{color:"var(--text-primary)"},children:ev(s.entry.timestamp)}),r.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-tertiary)"},children:s.entry.model}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:Ud[s.entry.type]??"var(--text-tertiary)",color:"#fff"},children:Jg[s.entry.type]??s.entry.type}),r.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:[Math.round(s.entry.passRate*100),"%"]})]}),r.jsxs("div",{className:"text-[10px] mt-1.5 flex items-center gap-3",style:{color:"var(--text-tertiary)"},children:[r.jsx("span",{children:RE(s.entry.totalDurationMs)}),r.jsx("span",{children:s.entry.totalTokens!=null?`${s.entry.totalTokens} tokens`:"--"})]})]})]})}function ME(t){if(t<=3)return Array.from({length:t},(o,c)=>c);if(t<=6)return[0,Math.floor(t/2),t-1];if(t<20)return[0,Math.floor(t/3),Math.floor(2*t/3),t-1];const a=Math.ceil(t/10),s=[0];for(let o=a;o<t-1;o+=a)s.push(o);return s.push(t-1),s}const Is=new Map;let on=null,Do=null,Co=1e3,Al=0;function Vy(){if(on)return;on=new EventSource("/api/events");const t=a=>s=>{let o={};try{o=s.data?JSON.parse(s.data):{}}catch{}const c=Is.get(a);if(c)for(const u of c)u(o)};on.addEventListener("benchmark:complete",t("benchmark:complete")),on.addEventListener("history:written",t("history:written")),on.addEventListener("leaderboard:updated",t("leaderboard:updated")),on.onerror=()=>{on==null||on.close(),on=null,Al>0&&(Do=setTimeout(()=>{Co=Math.min(Co*2,3e4),Vy()},Co))},on.onopen=()=>{Co=1e3}}function LE(){Do!=null&&(clearTimeout(Do),Do=null),on==null||on.close(),on=null}function zE(t,a){return Is.has(t)||Is.set(t,new Set),Is.get(t).add(a),Al++,Vy(),()=>{var s;(s=Is.get(t))==null||s.delete(a),Al--,Al<=0&&(Al=0,queueMicrotask(()=>{Al<=0&&LE()}))}}function Ho(t,a){const s=p.useRef(a);s.current=a,p.useEffect(()=>zE(t,c=>s.current(c)),[t])}function $o(t){return t>=.8?"var(--green)":t>=.5?"var(--yellow)":"var(--red)"}function DE(t){return t>=1e3?`${(t/1e3).toFixed(1)}s`:`${Math.round(t)}ms`}function _E({rate:t,label:a}){const s=Math.round(t*100);return r.jsx("div",{className:"flex items-center gap-3",children:r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-primary)",maxWidth:"70%"},children:a}),r.jsxs("span",{className:"text-[11px] font-semibold",style:{color:$o(t)},children:[s,"%"]})]}),r.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{background:"var(--surface-3)"},children:r.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${s}%`,background:$o(t)}})})]})})}function OE({points:t}){if(t.length<2)return null;const a=200,s=48,o=4,c=t.length,u=t.map((g,m)=>{const y=o+m/(c-1)*(a-o*2),v=o+(s-o*2)-g.passRate*(s-o*2);return{x:y,y:v}}),d=`M ${u[0].x},${s-o} `+u.map(g=>`L ${g.x},${g.y}`).join(" ")+` L ${u[u.length-1].x},${s-o} Z`,h=u.map((g,m)=>`${m===0?"M":"L"} ${g.x},${g.y}`).join(" ");return r.jsxs("svg",{width:a,height:s,style:{display:"block"},children:[r.jsx("path",{d,fill:"var(--accent-muted)"}),r.jsx("path",{d:h,fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),r.jsx("circle",{cx:u[u.length-1].x,cy:u[u.length-1].y,r:3,fill:"var(--accent)"})]})}function BE({plugin:t,skill:a}){const s=`stats/${t}/${a}`,o=p.useCallback(()=>we.getStats(t,a),[t,a]),{data:c,loading:u}=Js(s,o),d=p.useCallback(()=>En(s),[s]);if(Ho("benchmark:complete",d),Ho("history:written",d),u)return r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"skeleton h-24 rounded-xl"}),r.jsx("div",{className:"skeleton h-48 rounded-xl"}),r.jsx("div",{className:"skeleton h-36 rounded-xl"})]});if(!c||c.totalRuns===0)return r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center mx-auto mb-3",style:{background:"var(--surface-2)"},children:r.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",children:[r.jsx("path",{d:"M18 20V10"}),r.jsx("path",{d:"M12 20V4"}),r.jsx("path",{d:"M6 20v-6"})]})}),r.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark data yet"}),r.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"Run some benchmarks to see statistics"})]});const h=c.trendPoints.length>0?c.trendPoints[c.trendPoints.length-1].passRate:0,g=c.trendPoints.length>0?c.trendPoints[0].passRate:0,m=h-g,y=c.assertionStats.slice(0,10);return r.jsxs("div",{className:"space-y-4 stagger-children",children:[r.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[r.jsxs("div",{className:"glass-card p-4",children:[r.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Runs"}),r.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:c.totalRuns})]}),r.jsxs("div",{className:"glass-card p-4",children:[r.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Latest Pass Rate"}),r.jsxs("div",{className:"text-[24px] font-bold",style:{color:$o(h)},children:[Math.round(h*100),"%"]})]}),r.jsxs("div",{className:"glass-card p-4",children:[r.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Trend"}),r.jsxs("div",{className:"text-[24px] font-bold",style:{color:m>=0?"var(--green)":"var(--red)"},children:[m>=0?"+":"",Math.round(m*100),"%"]})]}),r.jsxs("div",{className:"glass-card p-4",children:[r.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Models Tested"}),r.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:c.modelStats.length})]}),c.totalCost!=null&&r.jsxs("div",{className:"glass-card p-4",children:[r.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Cost"}),r.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:Tn(c.totalCost)})]}),c.costPerRun!=null&&r.jsxs("div",{className:"glass-card p-4",children:[r.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Avg Cost/Run"}),r.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:Tn(c.costPerRun)})]})]}),c.trendPoints.length>=2&&r.jsxs("div",{className:"glass-card p-5",children:[r.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Pass Rate Over Time"}),r.jsx(OE,{points:c.trendPoints})]}),c.modelStats.length>0&&r.jsxs("div",{className:"glass-card p-5",children:[r.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Model Performance"}),r.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[r.jsx("thead",{children:r.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx("th",{style:{textAlign:"left",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Model"}),r.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Runs"}),r.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Pass Rate"}),r.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Duration"}),r.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Cost"})]})}),r.jsx("tbody",{children:c.modelStats.map(v=>r.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx("td",{style:{padding:"8px",color:"var(--text-primary)",fontWeight:500},children:v.model}),r.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:v.runs}),r.jsx("td",{style:{padding:"8px",textAlign:"center"},children:r.jsxs("span",{className:"font-semibold",style:{color:$o(v.avgPassRate)},children:[Math.round(v.avgPassRate*100),"%"]})}),r.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:DE(v.avgDurationMs)}),r.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:v.avgCost!=null?Tn(v.avgCost):"N/A"})]},v.model))})]})]}),y.length>0&&r.jsxs("div",{className:"glass-card p-5",children:[r.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Weakest Assertions"}),r.jsx("div",{className:"space-y-3",children:y.map(v=>r.jsxs("button",{className:"block w-full text-left rounded-lg p-2 -mx-2 transition-colors duration-150",style:{background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--surface-2)"},onMouseLeave:b=>{b.currentTarget.style.background="transparent"},onClick:()=>{},children:[r.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[r.jsxs("span",{className:"text-[10px] font-mono px-1 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",v.evalId]}),r.jsx("span",{className:"text-[10px] truncate",style:{color:"var(--text-tertiary)"},children:v.evalName}),r.jsxs("span",{className:"text-[10px] ml-auto flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[v.totalRuns," runs"]})]}),r.jsx(_E,{rate:v.passRate,label:v.text})]},`${v.evalId}:${v.id}`))})]})]})}function IE({plugin:t,skill:a}){const[s,o]=p.useState(null),[c,u]=p.useState(null),[d,h]=p.useState({}),[g,m]=p.useState({});p.useEffect(()=>{we.getEvals(t,a).then(o).catch(()=>o(null))},[t,a]);async function y(v){if(c===v){u(null);return}if(u(v),!d[v]){m(b=>({...b,[v]:!0}));try{const b=await we.getCaseHistory(t,a,v);h(S=>({...S,[v]:b}))}catch{h(b=>({...b,[v]:[]}))}finally{m(b=>({...b,[v]:!1}))}}}return s?r.jsx("div",{className:"space-y-2 stagger-children",children:s.evals.map(v=>{const b=d[v.id]||[],S=c===v.id,k=g[v.id],w=b.length>0?b[0].pass_rate:null;return r.jsxs("div",{className:"glass-card overflow-hidden",children:[r.jsxs("button",{onClick:()=>y(v.id),className:"w-full text-left p-4 flex items-center gap-3 transition-colors duration-150",style:{background:S?"var(--surface-2)":"transparent"},onMouseEnter:C=>{S||(C.currentTarget.style.background="var(--surface-2)")},onMouseLeave:C=>{S||(C.currentTarget.style.background="transparent")},children:[r.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:r.jsx("polyline",{points:"9 18 15 12 9 6"})}),r.jsxs("span",{className:"text-[11px] font-mono px-1.5 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",v.id]}),r.jsx("span",{className:"text-[13px] font-medium flex-1 truncate",style:{color:"var(--text-primary)"},children:v.name}),b.length>=2&&r.jsx(By,{entries:b}),w!=null&&r.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:Dl(w)},children:[Math.round(w*100),"%"]}),b.length>0&&r.jsxs("span",{className:"text-[10px] flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[b.length," runs"]})]}),S&&r.jsx("div",{className:"border-t animate-fade-in",style:{borderColor:"var(--border-subtle)"},children:k?r.jsxs("div",{className:"p-4 flex items-center gap-2",children:[r.jsx("div",{className:"spinner",style:{width:14,height:14}}),r.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):b.length===0?r.jsx("div",{className:"p-4",children:r.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No history for this eval case"})}):r.jsx("div",{className:"divide-y",style:{borderColor:"var(--border-subtle)"},children:b.map((C,T)=>r.jsxs("div",{className:"p-4",style:{background:T===0?"var(--surface-2)":"transparent"},children:[r.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[r.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:_y(C.timestamp)}),r.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:C.model}),r.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:C.type==="benchmark"?"rgba(99,131,255,0.15)":C.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:C.type==="benchmark"?"#6383ff":C.type==="comparison"?"var(--purple)":"#fb923c"},children:C.type}),r.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:Dl(C.pass_rate)},children:[Math.round(C.pass_rate*100),"%"]})]}),r.jsxs("div",{className:"flex items-center gap-4 mb-2 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[C.durationMs!=null&&r.jsx("span",{children:Oy(C.durationMs)}),C.tokens!=null&&r.jsxs("span",{children:[C.tokens>=1e3?`${(C.tokens/1e3).toFixed(1)}k`:C.tokens," tok"]})]}),r.jsx("div",{className:"space-y-1",children:C.assertions.map(N=>r.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[r.jsx("div",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:N.pass?"var(--green)":"var(--red)"},children:r.jsx("svg",{width:"7",height:"7",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",children:N.pass?r.jsx("polyline",{points:"20 6 9 17 4 12"}):r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"text-[11px]",style:{color:"var(--text-primary)"},children:N.text}),N.reasoning&&r.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:N.reasoning})]})]},N.id))})]},T))})})]},v.id)})}):r.jsx("div",{className:"text-center py-12",children:r.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No eval cases found"})})}function UE(){const{state:t,dispatch:a}=Rn(),{plugin:s,skill:o}=t,{state:c}=er(),u=c.skills.find(P=>P.plugin===s&&P.skill===o),d=(u==null?void 0:u.resolvedVersion)??(u==null?void 0:u.version)??null,[h,g]=p.useState("timeline"),[m,y]=p.useState(""),[v,b]=p.useState(""),[S,k]=p.useState(!1),[w,C]=p.useState([]),[T,N]=p.useState(null),[A,_]=p.useState(!1),[D,F]=p.useState(null),[E,B]=p.useState(!1),L=`history/${s}/${o}?model=${m}&type=${v}`,U=p.useCallback(()=>we.getHistory(s,o,{model:m||void 0,type:v||void 0}),[s,o,m,v]),{data:$,loading:q}=Js(L,U),X=$??[];p.useEffect(()=>{!$||$.length<2||we.compareRuns(s,o,$[0].timestamp,$[1].timestamp).then(P=>{const H=P.regressions.filter(ae=>ae.change==="regression");a({type:"SET_REGRESSIONS",regressions:H})}).catch(()=>{})},[$,s,o,a]);const ee=p.useCallback(()=>En(L),[L]);Ho("history:written",ee);const I=p.useCallback(async P=>{if(S){C(H=>H.includes(P)?H.filter(ae=>ae!==P):H.length>=2?[H[1],P]:[...H,P]);return}B(!0);try{const H=await we.getHistoryEntry(s,o,P);F(H)}catch{}finally{B(!1)}},[s,o,S]),z=p.useCallback(async()=>{if(w.length===2){_(!0);try{const P=await we.compareRuns(s,o,w[0],w[1]);N(P)}catch{}finally{_(!1)}}},[s,o,w]),O=[...new Set(X.map(P=>P.model))];return q?r.jsxs("div",{className:"p-5",children:[r.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),r.jsx("div",{className:"skeleton h-48 rounded-xl mb-4"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"skeleton h-12 rounded-lg"}),r.jsx("div",{className:"skeleton h-12 rounded-lg"})]})]}):r.jsxs("div",{className:"p-5",children:[r.jsx("div",{className:"flex items-center gap-1 mb-4",children:["timeline","per-eval","statistics"].map(P=>r.jsx("button",{onClick:()=>g(P),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:h===P?"var(--accent-muted)":"transparent",color:h===P?"var(--accent)":"var(--text-tertiary)"},children:P==="timeline"?"Timeline":P==="per-eval"?"Per Eval":"Statistics"},P))}),h==="timeline"&&r.jsxs("div",{children:[X.length>0&&r.jsx("div",{className:"mb-5 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:r.jsx(AE,{entries:X,onPointClick:P=>I(P.timestamp)})}),r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsxs("select",{value:m,onChange:P=>y(P.target.value),className:"input-field text-[12px]",style:{width:150},children:[r.jsx("option",{value:"",children:"All Models"}),O.map(P=>r.jsx("option",{value:P,children:P},P))]}),r.jsxs("select",{value:v,onChange:P=>b(P.target.value),className:"input-field text-[12px]",style:{width:150},children:[r.jsx("option",{value:"",children:"All Types"}),r.jsx("option",{value:"benchmark",children:"Benchmark"}),r.jsx("option",{value:"comparison",children:"Comparison"}),r.jsx("option",{value:"baseline",children:"Baseline"}),r.jsx("option",{value:"model-compare",children:"Model Compare"}),r.jsx("option",{value:"improve",children:"AI Improve"}),r.jsx("option",{value:"instruct",children:"AI Edit"}),r.jsx("option",{value:"ai-generate",children:"AI Generate"}),r.jsx("option",{value:"eval-generate",children:"Eval Generate"})]}),r.jsx("div",{className:"flex-1"}),r.jsx("button",{onClick:()=>{k(!S),C([]),N(null)},className:`btn text-[12px] ${S?"btn-primary":"btn-secondary"}`,children:S?"Exit Compare":"Compare Runs"}),S&&w.length===2&&r.jsx("button",{onClick:z,disabled:A,className:"btn btn-primary text-[12px]",children:A?"Comparing...":"Compare"})]}),r.jsx("div",{className:"space-y-2",children:X.length===0?r.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):X.map(P=>{const H=w.includes(P.timestamp);return r.jsx("button",{onClick:()=>I(P.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:H?"var(--accent-muted)":"var(--surface-1)",border:H?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:ae=>{H||(ae.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:ae=>{H||(ae.currentTarget.style.borderColor="var(--border-subtle)")},children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[S&&r.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:H?"var(--accent)":"var(--border-default)",background:H?"var(--accent)":"transparent"},children:H&&r.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})})}),r.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:new Date(P.timestamp).toLocaleString()}),r.jsx("span",{className:"pill text-[9px]",style:{background:P.type==="comparison"?"var(--purple-muted)":P.type==="baseline"?"var(--surface-3)":P.type==="model-compare"?"var(--accent-muted)":P.type==="improve"||P.type==="instruct"?"var(--purple-muted)":P.type==="ai-generate"?"var(--green-muted)":P.type==="eval-generate"?"var(--orange-muted)":"var(--accent-muted)",color:P.type==="comparison"?"var(--purple)":P.type==="baseline"?"var(--text-tertiary)":P.type==="model-compare"?"var(--accent)":P.type==="improve"||P.type==="instruct"?"var(--purple)":P.type==="ai-generate"?"var(--green)":P.type==="eval-generate"?"var(--orange)":"var(--accent)"},children:P.type==="model-compare"?"model compare":P.type==="improve"?"ai improve":P.type==="instruct"?"ai edit":P.type==="ai-generate"?"ai generate":P.type==="eval-generate"?"eval generate":P.type})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(ri,{version:d,size:"sm","data-testid":"history-row-version"}),r.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:P.model}),P.totalCost!=null&&P.totalCost>0&&r.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--text-tertiary)"},children:Tn(P.totalCost)}),r.jsxs("span",{className:"text-[12px] font-semibold",style:{color:P.passRate>=.8?"var(--green)":P.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(P.passRate*100),"%"]})]})]})},P.timestamp)})}),T&&r.jsx(HE,{result:T}),D&&!S&&r.jsx($E,{run:D,onClose:()=>F(null)})]}),h==="per-eval"&&r.jsx(IE,{plugin:s,skill:o}),h==="statistics"&&r.jsx(BE,{plugin:s,skill:o})]})}function HE({result:t}){const a=t.regressions.filter(o=>o.change==="regression"),s=t.regressions.filter(o=>o.change==="improvement");return r.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Comparison: ",new Date(t.runA.timestamp).toLocaleDateString()," vs ",new Date(t.runB.timestamp).toLocaleDateString()]}),(t.runA.totalCost!=null||t.runB.totalCost!=null)&&r.jsxs("div",{className:"flex items-center gap-4 mb-3 text-[11px]",style:{color:"var(--text-secondary)"},children:[r.jsxs("span",{children:["Run A cost: ",Tn(t.runA.totalCost??null)]}),r.jsxs("span",{children:["Run B cost: ",Tn(t.runB.totalCost??null)]}),t.runA.totalCost!=null&&t.runB.totalCost!=null&&r.jsxs("span",{style:{color:t.runB.totalCost<=t.runA.totalCost?"var(--green)":"var(--red)"},children:["Delta: ",Tn(t.runB.totalCost-t.runA.totalCost)]})]}),a.length>0&&r.jsxs("div",{className:"mb-3",children:[r.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--red)"},children:["Regressions (",a.length,")"]}),a.map(o=>r.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",r.jsx("span",{style:{color:"var(--red)"},children:o.assertionId})," (was passing, now failing)"]},`${o.evalId}-${o.assertionId}`))]}),s.length>0&&r.jsxs("div",{className:"mb-3",children:[r.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--green)"},children:["Improvements (",s.length,")"]}),s.map(o=>r.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",r.jsx("span",{style:{color:"var(--green)"},children:o.assertionId})," (was failing, now passing)"]},`${o.evalId}-${o.assertionId}`))]}),r.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 mt-3",style:{color:"var(--text-tertiary)"},children:"Case Diffs"}),r.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:r.jsxs("table",{className:"w-full text-[12px]",children:[r.jsx("thead",{children:r.jsxs("tr",{style:{background:"var(--surface-2)"},children:[r.jsx("th",{className:"text-left px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Case"}),r.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run A"}),r.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run B"})]})}),r.jsx("tbody",{children:t.caseDiffs.map(o=>r.jsxs("tr",{style:{borderTop:"1px solid var(--border-subtle)"},children:[r.jsxs("td",{className:"px-3 py-2",style:{color:"var(--text-secondary)"},children:["#",o.eval_id," ",o.eval_name]}),r.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}),r.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 $E({run:t,onClose:a}){return(t.type==="improve"||t.type==="instruct")&&t.improve?r.jsx(VE,{run:t,onClose:a}):r.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:["Run: ",new Date(t.timestamp).toLocaleString()]}),r.jsx("button",{onClick:a,className:"btn btn-ghost text-[11px]",children:"Close"})]}),r.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:["Model: ",t.model," | Cases: ",t.cases.length," | Pass Rate: ",t.overall_pass_rate!=null?`${Math.round(t.overall_pass_rate*100)}%`:"--",t.totalCost!=null&&t.totalCost>0&&` | Cost: ${Tn(t.totalCost)}`]}),r.jsx("div",{className:"space-y-2",children:t.cases.map(s=>r.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)"},children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-[12px]",style:{color:"var(--text-secondary)"},children:["#",s.eval_id," ",s.eval_name]}),r.jsxs("div",{className:"flex items-center gap-2",children:[s.cost!=null&&s.cost>0&&r.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--text-tertiary)"},children:Tn(s.cost)}),r.jsx("span",{className:"text-[11px] font-semibold",style:{color:s.status==="pass"?"var(--green)":"var(--red)"},children:s.pass_rate!=null?`${Math.round(s.pass_rate*100)}%`:s.status})]})]})},s.eval_id))})]})}function VE({run:t,onClose:a}){var u;const s=p.useMemo(()=>t.improve?Jo(t.improve.original,t.improve.improved):[],[t.improve]),o=p.useMemo(()=>{const d=s.filter(g=>g.type==="added").length,h=s.filter(g=>g.type==="removed").length;return{added:d,removed:h}},[s]),c=p.useMemo(()=>{let d=0,h=0;return s.map(g=>g.type==="removed"?(d++,{...g,origNum:d,newNum:null}):g.type==="added"?(h++,{...g,origNum:null,newNum:h}):(d++,h++,{...g,origNum:d,newNum:h}))},[s]);return r.jsxs("div",{className:"mt-4 rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[r.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:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{background:"var(--purple-muted)"},children:r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--purple)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),r.jsx("path",{d:"M2 17l10 5 10-5"}),r.jsx("path",{d:"M2 12l10 5 10-5"})]})}),r.jsxs("div",{children:[r.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"}),r.jsxs("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[new Date(t.timestamp).toLocaleString()," · ",t.model]})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[r.jsxs("span",{style:{color:"var(--green)"},children:["+",o.added]}),r.jsxs("span",{style:{color:"var(--red)"},children:["-",o.removed]})]}),r.jsx("button",{onClick:a,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:d=>{d.currentTarget.style.background="var(--surface-3)"},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),((u=t.improve)==null?void 0:u.reasoning)&&r.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:[r.jsx("span",{className:"font-semibold",style:{color:"var(--purple)"},children:"AI Reasoning: "}),t.improve.reasoning]}),r.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:480,overflowY:"auto"},children:r.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:r.jsx("tbody",{children:c.map((d,h)=>r.jsxs("tr",{style:{background:d.type==="added"?"var(--green-muted)":d.type==="removed"?"var(--red-muted)":"transparent"},children:[r.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:d.type==="removed"?"var(--red)":"var(--text-tertiary)",opacity:d.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:d.origNum??""}),r.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:d.type==="added"?"var(--green)":"var(--text-tertiary)",opacity:d.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:d.newNum??""}),r.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:d.type==="added"?"var(--green)":d.type==="removed"?"var(--red)":"transparent",borderRight:d.type==="added"?"2px solid var(--green)":d.type==="removed"?"2px solid var(--red)":"2px solid transparent"},children:d.type==="added"?"+":d.type==="removed"?"-":" "}),r.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:d.type==="added"?"var(--green)":d.type==="removed"?"var(--red)":"var(--text-secondary)"},children:d.content||""})]},h))})})})]})}function Py({data:t}){if(t.length<2)return r.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:"--"});const a=t.slice(-10),s=80,o=24,c=2,u=s-c*2,d=o-c*2,h=a.length,g=Math.min(...a),y=Math.max(...a)-g||1,v=a.map((k,w)=>{const C=c+w/(h-1)*u,T=c+d-(k-g)/y*d;return`${C.toFixed(1)},${T.toFixed(1)}`}),b=a[a.length-1],S=Dl(b);return r.jsxs("svg",{width:s,height:o,viewBox:`0 0 ${s} ${o}`,style:{display:"block"},children:[r.jsx("polyline",{points:v.join(" "),fill:"none",stroke:S,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),(()=>{const[k,w]=v[v.length-1].split(",");return r.jsx("circle",{cx:k,cy:w,r:2.5,fill:S})})()]})}function PE(){return r.jsxs("span",{className:"pill",style:{background:"var(--yellow-muted)",color:"var(--yellow)",fontSize:9,fontWeight:700,gap:3},children:[r.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"var(--yellow)",stroke:"none",children:r.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 FE({pct:t}){const a=t>=10?"var(--green)":t>=0?"var(--yellow)":"var(--red)",s=t>=10?"var(--green-muted)":t>=0?"var(--yellow-muted)":"var(--red-muted)",o=t>=0?"+":"";return r.jsxs("span",{className:"pill",style:{background:s,color:a,fontSize:10,fontWeight:600},children:[o,t.toFixed(1),"%"]})}function GE({score:t,rating:a}){const s={excellent:{bg:"var(--green-muted)",fg:"var(--green)"},good:{bg:"var(--green-muted)",fg:"var(--green)"},marginal:{bg:"var(--yellow-muted)",fg:"var(--yellow)"},minimal:{bg:"var(--yellow-muted)",fg:"var(--yellow)"},harmful:{bg:"var(--red-muted)",fg:"var(--red)"}},o=s[a]??s.minimal,c=t>=0?"+":"";return r.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[r.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"Skill Quality:"}),r.jsxs("span",{className:"pill",style:{background:o.bg,color:o.fg,fontSize:11,fontWeight:600},children:[c,t.toFixed(1),"% (",a.toUpperCase(),")"]})]})}function WE({warning:t}){return r.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:[r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--yellow)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.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"}),r.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),r.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),r.jsx("span",{className:"text-[11px]",style:{color:"var(--yellow)"},children:t})]})}function qE({active:t,onChange:a,hasBaseline:s}){return r.jsxs("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)"},children:[r.jsx("button",{onClick:()=>a("rankings"),className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:t==="rankings"?"var(--surface-3)":"transparent",color:t==="rankings"?"var(--text-primary)":"var(--text-tertiary)"},children:"Rankings"}),r.jsx("button",{onClick:()=>a("amplification"),disabled:!s,className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:t==="amplification"?"var(--surface-3)":"transparent",color:s&&t==="amplification"?"var(--text-primary)":"var(--text-tertiary)",opacity:s?1:.5,cursor:s?"pointer":"not-allowed"},title:s?"View skill amplification data":"Run sweep with --baseline to see amplification data",children:"Skill Amplification"})]})}function YE(t){var o,c,u;if(t.length===0)return[];const a=new Map;for(const d of t)for(const h of d.models){if(h.status==="error")continue;const g=`${h.provider}/${h.model}`;a.has(g)||a.set(g,{provider:h.provider,passRates:[],lastRubric:null,lastDuration:0,lastCost:null,lastBaselinePassRate:void 0,lastSkillDelta:void 0,lastAmplificationPct:void 0,lastCompositeScore:void 0,hasBaseline:!1});const m=a.get(g);m.passRates.push(h.passRate.mean),m.lastRubric=((o=h.rubricScore)==null?void 0:o.mean)??null,m.lastDuration=h.duration.mean,m.lastCost=((c=h.cost)==null?void 0:c.total)??null,m.lastCompositeScore=h.compositeScore,h.baselinePassRate!=null&&(m.lastBaselinePassRate=h.baselinePassRate.mean,m.lastSkillDelta=(u=h.skillDelta)==null?void 0:u.mean,m.lastAmplificationPct=h.amplificationPct,m.hasBaseline=!0)}const s=[];for(const[d,h]of a){const[g,...m]=d.split("/");s.push({rank:0,model:m.join("/"),provider:g,passRate:h.passRates[h.passRates.length-1],rubricScore:h.lastRubric,duration:h.lastDuration,cost:h.lastCost,sparklineData:h.passRates,isBest:!1,baselinePassRate:h.lastBaselinePassRate,skillDelta:h.lastSkillDelta,amplificationPct:h.lastAmplificationPct,compositeScore:h.lastCompositeScore,hasBaseline:h.hasBaseline})}return s.sort((d,h)=>{const g=d.compositeScore??d.passRate;return(h.compositeScore??h.passRate)-g}),s.forEach((d,h)=>{d.rank=h+1}),s.length>0&&(s[0].isBest=!0),s}const Fy=(t="left")=>({padding:"10px 12px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary)",textAlign:t,whiteSpace:"nowrap"});function KE({entries:t}){return r.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:r.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[r.jsx("thead",{children:r.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","Pass Rate","Rubric","Duration","Cost","Trend"].map(a=>r.jsx("th",{style:Fy(a==="#"?"center":"left"),children:a},a))})}),r.jsx("tbody",{children:t.map(a=>r.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:s=>{s.currentTarget.style.background="var(--surface-2)"},onMouseLeave:s=>{s.currentTarget.style.background="transparent"},children:[r.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:a.rank}),r.jsx("td",{style:{padding:"10px 12px"},children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:a.model}),r.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:a.provider}),a.isBest&&r.jsx(PE,{})]})}),r.jsx("td",{style:{padding:"10px 12px"},children:r.jsxs("span",{className:"pill",style:{background:a.passRate>=.7?"var(--green-muted)":a.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:Dl(a.passRate),fontSize:11,fontWeight:600},children:[Math.round(a.passRate*100),"%"]})}),r.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:a.rubricScore!=null?a.rubricScore.toFixed(1):"--"}),r.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:a.duration<1e3?`${Math.round(a.duration)}ms`:`${(a.duration/1e3).toFixed(1)}s`}),r.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:a.cost!=null?`$${a.cost.toFixed(4)}`:"N/A"}),r.jsx("td",{style:{padding:"10px 12px"},children:r.jsx(Py,{data:a.sparklineData})})]},`${a.provider}/${a.model}`))})]})})}function XE({entries:t}){const a=[...t].filter(s=>s.hasBaseline).sort((s,o)=>(o.amplificationPct??0)-(s.amplificationPct??0));return a.length===0?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"text-center",children:r.jsxs("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:["No baseline data available. Run sweep with ",r.jsx("code",{children:"--baseline"})," flag."]})})}):r.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:r.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[r.jsx("thead",{children:r.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","With Skill","Without Skill","Delta","Amplification","Trend"].map(s=>r.jsx("th",{style:Fy(s==="#"?"center":"left"),children:s},s))})}),r.jsx("tbody",{children:a.map((s,o)=>r.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:c=>{c.currentTarget.style.background="var(--surface-2)"},onMouseLeave:c=>{c.currentTarget.style.background="transparent"},children:[r.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:o+1}),r.jsx("td",{style:{padding:"10px 12px"},children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:s.model}),r.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:s.provider})]})}),r.jsx("td",{style:{padding:"10px 12px"},children:r.jsxs("span",{className:"pill",style:{background:s.passRate>=.7?"var(--green-muted)":s.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:Dl(s.passRate),fontSize:11,fontWeight:600},children:[Math.round(s.passRate*100),"%"]})}),r.jsx("td",{style:{padding:"10px 12px"},children:s.baselinePassRate!=null?r.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:[Math.round(s.baselinePassRate*100),"%"]}):"--"}),r.jsx("td",{style:{padding:"10px 12px"},children:s.skillDelta!=null?r.jsxs("span",{className:"text-[11px] font-medium",style:{color:s.skillDelta>=0?"var(--green)":"var(--red)"},children:[s.skillDelta>=0?"+":"",(s.skillDelta*100).toFixed(1),"pp"]}):"--"}),r.jsx("td",{style:{padding:"10px 12px"},children:s.amplificationPct!=null&&isFinite(s.amplificationPct)?r.jsx(FE,{pct:s.amplificationPct}):"--"}),r.jsx("td",{style:{padding:"10px 12px"},children:r.jsx(Py,{data:s.sparklineData})})]},`${s.provider}/${s.model}`))})]})})}function QE(){const{state:t}=Rn(),{plugin:a,skill:s}=t,[o,c]=p.useState("rankings"),u=`leaderboard/${a}/${s}`,d=p.useCallback(()=>we.getLeaderboard(a,s),[a,s]),{data:h,loading:g,error:m}=Js(u,d),y=(h==null?void 0:h.entries)??[],v=(m==null?void 0:m.message)??null;p.useEffect(()=>{c("rankings")},[a,s]);const b=p.useCallback(()=>En(u),[u]);Ho("leaderboard:updated",b);const S=p.useMemo(()=>YE(y),[y]),k=S.some(T=>T.hasBaseline),w=y[0],C=w==null?void 0:w.judgeBiasWarning;return g?r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx("div",{className:"spinner spinner-lg"})}):v?r.jsx("div",{className:"flex items-center justify-center h-full px-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--red)"},children:"Failed to load leaderboard"}),r.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:v})]})}):S.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:"var(--accent-muted)"},children:r.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M18 20V10"}),r.jsx("path",{d:"M12 20V4"}),r.jsx("path",{d:"M6 20v-6"})]})}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No sweep results yet"}),r.jsx("div",{className:"text-[12px] mb-3",style:{color:"var(--text-tertiary)"},children:"Run your first model sweep to compare performance across models:"}),r.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"'}),r.jsxs("div",{className:"text-[11px] mt-2",style:{color:"var(--text-tertiary)"},children:["Add ",r.jsx("code",{children:"--baseline"})," to measure skill amplification per model."]})]})]}):r.jsxs("div",{className:"p-5 animate-fade-in",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"text-[15px] font-semibold",style:{color:"var(--text-primary)"},children:"Model Leaderboard"}),r.jsx(qE,{active:o,onChange:c,hasBaseline:k})]}),r.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[y.length," sweep",y.length!==1?"s":""," · ",S.length," model",S.length!==1?"s":""]})]}),C&&r.jsx(WE,{warning:C}),o==="rankings"?r.jsx(KE,{entries:S}):r.jsx(XE,{entries:S}),o==="amplification"&&(w==null?void 0:w.skillQualityScore)!=null&&(w==null?void 0:w.skillQualityRating)&&r.jsx(GE,{score:w.skillQualityScore,rating:w.skillQualityRating})]})}function ZE({plugin:t,skill:a}){const[s,o]=p.useState([]),[c,u]=p.useState([]),[d,h]=p.useState(!0),[g,m]=p.useState(null);p.useEffect(()=>{we.getDependencies(t,a).then(v=>{o(v.mcpDependencies),u(v.skillDependencies)}).catch(()=>{}).finally(()=>h(!1))},[t,a]);async function y(v,b){try{await navigator.clipboard.writeText(b),m(v),setTimeout(()=>m(null),2e3)}catch{}}return d?null:s.length===0&&c.length===0?r.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"}):r.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[r.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:[r.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(234,179,8,0.15)"},children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#eab308",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.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"}),r.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"})]})}),r.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Dependencies"}),r.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:s.length+c.length})]}),r.jsxs("div",{className:"px-5 py-4",children:[s.length>0&&r.jsxs("div",{className:"space-y-3 mb-4",children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"MCP Servers"}),s.map(v=>r.jsxs("div",{className:"p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:v.server}),r.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:v.transport})]}),r.jsx("button",{onClick:()=>y(v.server,v.configSnippet),className:"btn btn-ghost text-[11px] py-1 px-2",style:{color:g===v.server?"var(--green)":"var(--accent)"},children:g===v.server?r.jsxs(r.Fragment,{children:[r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})})," Copied!"]}):r.jsxs(r.Fragment,{children:[r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),r.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"]})})]}),r.jsx("div",{className:"text-[11px] mb-2 font-mono",style:{color:"var(--text-tertiary)"},children:v.url}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:v.matchedTools.map(b=>r.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:b},b))})]},v.server))]}),c.length>0&&r.jsxs("div",{children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Skill Dependencies"}),r.jsx("div",{className:"space-y-1.5",children:c.map(v=>r.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:[r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.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"})}),r.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:v.name}),r.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:v.source==="frontmatter"?"frontmatter":"referenced"})]},v.name))})]})]})]})}function tv({plugin:t,skill:a}){const[s,o]=p.useState([]),[c,u]=p.useState(!0),[d,h]=p.useState(null),[g,m]=p.useState(""),[y,v]=p.useState(!1),[b,S]=p.useState(null),[k,w]=p.useState(""),[C,T]=p.useState(""),[N,A]=p.useState(!1),[_,D]=p.useState(new Set),F=p.useCallback(async()=>{u(!0);try{const[U,$]=await Promise.all([we.getCredentials(t,a).catch(()=>({credentials:[]})),we.getParams(t,a).catch(()=>({params:[]}))]),q=new Map($.params.map(I=>[I.name,I])),X=new Set,ee=[];for(const I of U.credentials){X.add(I.name);const z=q.get(I.name);ee.push({name:I.name,status:I.status==="ready"||I.status==="resolved"?"ready":"missing",source:I.source,maskedValue:z==null?void 0:z.maskedValue})}for(const I of $.params)X.has(I.name)||ee.push({name:I.name,status:I.status,maskedValue:I.maskedValue});o(ee)}finally{u(!1)}},[t,a]);p.useEffect(()=>{F()},[F]);const E=p.useCallback(async U=>{if(_.has(U)){D($=>{const q=new Set($);return q.delete(U),q}),o($=>$.map(q=>q.name===U?{...q,revealedValue:void 0}:q));return}try{const q=(await we.getParamsRevealed(t,a,U)).params.find(X=>X.name===U);q&&(o(X=>X.map(ee=>ee.name===U?{...ee,revealedValue:q.value}:ee)),D(X=>new Set(X).add(U)))}catch{}},[t,a,_]),B=async(U,$)=>{if(!(!U.trim()||!$.trim())){v(!0),S(null);try{await we.setCredential(t,a,U,$),h(null),m(""),D(new Set),F()}catch(q){S(q.message)}finally{v(!1)}}},L=async()=>{if(!(!k.trim()||!C.trim())){v(!0),S(null);try{await we.setCredential(t,a,k.trim().toUpperCase(),C),w(""),T(""),A(!1),F()}catch(U){S(U.message)}finally{v(!1)}}};return c?r.jsxs("div",{className:"mt-6",children:[r.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),r.jsx("div",{className:"skeleton h-20 rounded-xl"})]}):r.jsxs("div",{className:"mt-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),r.jsx("button",{onClick:()=>A(!N),className:"text-[11px] transition-colors duration-150",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"+ Add Parameter"})]}),b&&r.jsx("div",{className:"mb-2 px-3 py-2 rounded-lg text-[11px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:b}),s.length===0&&!N?r.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"}):r.jsx("div",{className:"rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:s.map(U=>r.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:[r.jsx("span",{className:"text-[11px] font-mono font-medium truncate",style:{color:"var(--text-primary)",minWidth:80},children:U.name}),U.maskedValue&&r.jsx("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)",maxWidth:120},children:_.has(U.name)&&U.revealedValue!=null?U.revealedValue:U.maskedValue}),U.maskedValue&&r.jsx("button",{onClick:()=>E(U.name),className:"btn btn-ghost px-1",title:_.has(U.name)?"Hide value":"Reveal value",style:{color:"var(--text-tertiary)",lineHeight:1},children:_.has(U.name)?r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.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"}),r.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"}),r.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),r.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),r.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:U.status==="ready"?"var(--green-muted)":"var(--orange-muted)",color:U.status==="ready"?"var(--green)":"var(--orange)"},children:U.status==="ready"?"ready":"missing"}),U.source&&r.jsx("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:U.source}),d===U.name?r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("input",{value:g,onChange:$=>m($.target.value),onKeyDown:$=>{$.key==="Enter"&&B(U.name,g)},className:"input-field text-[11px] font-mono",style:{width:160},placeholder:"Value...",autoFocus:!0}),r.jsx("button",{onClick:()=>B(U.name,g),disabled:y||!g.trim(),className:"btn btn-primary text-[10px] px-2 py-0.5",children:y?"...":"Save"}),r.jsx("button",{onClick:()=>{h(null),m("")},className:"btn btn-ghost text-[10px] px-1",children:r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}):r.jsx("button",{onClick:()=>{h(U.name),m("")},className:"btn btn-ghost text-[10px] px-2 py-0.5",style:{color:"var(--accent)"},children:"Edit"})]},U.name))}),N&&r.jsxs("div",{className:"mt-2 p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"flex gap-2 mb-2",children:[r.jsx("input",{value:k,onChange:U=>w(U.target.value),className:"input-field flex-1 text-[11px] font-mono",placeholder:"KEY_NAME",autoFocus:!0}),r.jsx("input",{value:C,onChange:U=>T(U.target.value),onKeyDown:U=>{U.key==="Enter"&&L()},className:"input-field flex-1 text-[11px] font-mono",placeholder:"Value",type:"password"})]}),r.jsxs("div",{className:"flex justify-end gap-1.5",children:[r.jsx("button",{onClick:()=>{A(!1),w(""),T("")},className:"btn btn-ghost text-[10px]",children:"Cancel"}),r.jsx("button",{onClick:L,disabled:y||!k.trim()||!C.trim(),className:"btn btn-primary text-[10px]",children:y?"Saving...":"Save"})]})]})]})}function JE(){const{state:t}=Rn(),{plugin:a,skill:s}=t,[o,c]=p.useState(null),[u,d]=p.useState(!0);return p.useEffect(()=>{we.getDependencies(a,s).then(c).catch(()=>{}).finally(()=>d(!1))},[a,s]),u?r.jsxs("div",{className:"p-5",children:[r.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),r.jsx("div",{className:"skeleton h-32 rounded-xl"})]}):o?r.jsxs("div",{className:"p-5 max-w-3xl",children:[r.jsx(ZE,{plugin:a,skill:s}),r.jsx(tv,{plugin:a,skill:s})]}):r.jsxs("div",{className:"p-5 max-w-3xl",children:[r.jsx("div",{className:"text-[13px] mb-4",style:{color:"var(--text-tertiary)"},children:"No MCP dependency information available"}),r.jsx(tv,{plugin:a,skill:s})]})}function eN(t){const a={prompt:t.prompt,provider:t.provider,model:t.model};return t.targetAgents&&t.targetAgents.length>0&&(a.targetAgents=t.targetAgents),a}function tN(t){var c;const a=t.userName.trim().length>0,s=t.userPlugin.trim().length>0||t.userNewPlugin.trim().length>0,o=t.forceLayout===3;return{applyName:a?null:t.aiName??null,applySuggestedPlugin:!o&&!s&&!!((c=t.aiSuggestedPlugin)!=null&&c.plugin),suggestedPluginValue:o||s?null:t.aiSuggestedPlugin??null}}function mf(t,a=!0){let s=t.toLowerCase().replace(/[^a-z0-9]+/g,"-");return a&&(s=s.replace(/^-+|-+$/g,"")),s}function nN(t,a,s,o){const u=`.../${t.split("/").slice(-2).join("/")}`;switch(a){case 1:return`${u}/${s}/skills/${o}/SKILL.md`;case 2:return`${u}/plugins/${s}/skills/${o}/SKILL.md`;case 3:return`${u}/skills/${o}/SKILL.md`}}function rN({onCreated:t,resolveAiConfigOverride:a,forceLayout:s}){const[o,c]=p.useState("ai"),[u,d]=p.useState(null),[h,g]=p.useState(!0),{config:m}=$a(),[y,v]=p.useState(""),[b,S]=p.useState(s??3),[k,w]=p.useState(""),[C,T]=p.useState(""),[N,A]=p.useState(""),[_,D]=p.useState(""),[F,E]=p.useState(""),[B,L]=p.useState(""),[U,$]=p.useState("write"),[q,X]=p.useState([]),[ee,I]=p.useState(!1),[z,O]=p.useState(null),[P,H]=p.useState(null),[ae,M]=p.useState("vskill"),[Y,W]=p.useState("1.0.0"),[Q,oe]=p.useState(!0),de=p.useCallback(async()=>{try{const Le=await we.detectEngines();H(Le),M(se=>se!=="vskill"?se:Le.vskillSkillBuilder?"vskill":Le.anthropicSkillCreator?"anthropic-skill-creator":"none")}catch{H({vskillSkillBuilder:!1,anthropicSkillCreator:!1,vskillVersion:null,anthropicPath:null})}},[]);p.useEffect(()=>{de()},[de]);const[ve,ce]=p.useState(""),[je,Re]=p.useState(!1),[Oe,le]=p.useState(!1),[he,pe]=p.useState(null),[xe,be]=p.useState(null),[Be,Ue]=p.useState([]),lt=p.useRef(null),Ct=p.useRef(null),gt=p.useRef(null),Tt=p.useRef(null),Gt=p.useRef(null),[We,nt]=p.useState(!1),[xn,ye]=p.useState(!1),ot=p.useRef(y),Wt=p.useRef(k),Kt=p.useRef(C);p.useEffect(()=>{ot.current=y},[y]),p.useEffect(()=>{Wt.current=k},[k]),p.useEffect(()=>{Kt.current=C},[C]),p.useEffect(()=>{we.getProjectLayout().then(Le=>{if(d(Le),s)return;S(Le.suggestedLayout);const se=Le.detectedLayouts.find(Se=>Se.layout===Le.suggestedLayout);se!=null&&se.existingPlugins.length&&w(se.existingPlugins[0])}).catch(()=>{}).finally(()=>g(!1))},[s]),p.useEffect(()=>{var Le;o==="ai"&&((Le=lt.current)==null||Le.focus())},[o]),p.useEffect(()=>()=>{var Le;(Le=Ct.current)==null||Le.abort()},[]);const An=p.useMemo(()=>{var Le;return u?((Le=u.detectedLayouts.find(se=>se.layout===b))==null?void 0:Le.existingPlugins)||[]:[]},[u,b]),Et=k==="__new__"?C:k,Mn=u?nN(u.root,b,Et||"{plugin}",y||"{skill}"):"",Ut=p.useMemo(()=>u?u.detectedLayouts.filter(Le=>Le.layout!==4):[],[u]),Rt=p.useMemo(()=>{if(!u)return null;const Le=u.detectedLayouts.find(Me=>Me.layout===2&&Me.existingPlugins.length>0),se=u.detectedLayouts.find(Me=>Me.layout===1&&Me.existingPlugins.length>0),Se=Le||se;return Se?{layout:Se.layout,plugins:Se.existingPlugins}:null},[u]),ct=p.useCallback(()=>{if(a)return a();if(!m)return{provider:"claude-cli",model:"sonnet"};const Le=m.provider||"claude-cli",se=m.model||"sonnet";return{provider:Le,model:se}},[m,a]),Wn=p.useCallback(()=>{var Le;(Le=Ct.current)==null||Le.abort(),Re(!1)},[]),tr=p.useCallback(()=>{pe(null),be(null)},[]),da=p.useCallback(async()=>{var Me,Fa;if(pe(null),be(null),Ue([]),gt.current=null,Tt.current=null,!ve.trim()){pe("Describe what your skill should do");return}Re(!0);const Le=new AbortController;Ct.current=Le;const{provider:se,model:Se}=ct();try{const qn=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(eN({prompt:ve.trim(),provider:se,model:Se,targetAgents:q})),signal:Le.signal});if(!qn.ok||!qn.body){let pa=`HTTP ${qn.status}`;try{const ma=await qn.json();ma.error&&(pa=ma.error)}catch{}throw new Error(pa)}const Ul=qn.body.getReader(),fa=new TextDecoder;let Hl="",nr="";for(;;){const{done:pa,value:ma}=await Ul.read();if(pa)break;Hl+=fa.decode(ma,{stream:!0});const Ga=Hl.split(`
|
|
86
|
+
`);Hl=Ga.pop()||"";for(const zr of Ga)if(zr.startsWith("event: "))nr=zr.slice(7).trim();else if(zr.startsWith("data: ")){try{const ut=JSON.parse(zr.slice(6));if(nr==="progress")Ue(ha=>[...ha,{phase:ut.phase,message:ut.message,timestamp:Date.now()}]);else if(nr==="provenance")Tt.current={resolvedModelId:typeof ut.resolvedModelId=="string"?ut.resolvedModelId:null,snapshotDate:typeof ut.snapshotDate=="string"?ut.snapshotDate:null};else if(nr==="done"||nr==="complete"){const ha={prompt:ve.trim(),provider:ct().provider,model:ct().model,resolvedModelId:((Me=Tt.current)==null?void 0:Me.resolvedModelId)??null,snapshotDate:((Fa=Tt.current)==null?void 0:Fa.snapshotDate)??null,reasoning:ut.reasoning||""},an=tN({userName:ot.current,userPlugin:Wt.current,userNewPlugin:Kt.current,aiName:ut.name,aiSuggestedPlugin:ut.suggestedPlugin&&ut.suggestedPlugin.plugin?{plugin:ut.suggestedPlugin.plugin,layout:ut.suggestedPlugin.layout}:null,forceLayout:s});if(an.applyName!==null&&v(an.applyName),A(ut.description),D(ut.model||""),E(ut.allowedTools||""),L(ut.body),le(!0),gt.current=ha,c("manual"),s===3)S(3),w(""),T("");else if(an.applySuggestedPlugin&&an.suggestedPluginValue){const dt=an.suggestedPluginValue;if(((u==null?void 0:u.detectedLayouts.flatMap(rr=>rr.existingPlugins))??[]).includes(dt.plugin))if(w(dt.plugin),dt.layout&&(dt.layout===1||dt.layout===2))S(dt.layout);else{const rr=u==null?void 0:u.detectedLayouts.find(tc=>tc.existingPlugins.includes(dt.plugin));rr&&(rr.layout===1||rr.layout===2)&&S(rr.layout)}else w("__new__"),T(dt.plugin)}else!an.applySuggestedPlugin&&Wt.current.trim().length===0&&Kt.current.trim().length===0&&b===3&&Rt&&ye(!0);const Ht={name:ut.name,plugin:Et||"",layout:b,description:ut.description,model:ut.model||void 0,allowedTools:ut.allowedTools||void 0,body:ut.body,aiMeta:ha};we.saveDraft(Ht).then(dt=>{nt(!0),dt!=null&&dt.dir&&(Gt.current=dt.dir)}).catch(()=>{})}else nr==="error"&&(pe(ut.message||ut.description||"Unknown error"),ut.category&&be(ut))}catch{}nr=""}}}catch(qn){qn.name!=="AbortError"&&pe(qn.message)}finally{Re(!1),Ct.current=null}},[ve,ct,b,Rt,Et,u,q,s]),gn=p.useCallback(async()=>{if(O(null),!y.trim()){O("Skill name is required");return}if(!N.trim()){O("Description is required");return}if(b!==3&&!Et.trim()){O("Plugin name is required");return}if(!Q){O("Version is not valid semver");return}I(!0);try{const Le=await we.createSkill({name:mf(y),plugin:Et||"",layout:b,description:N,model:_||void 0,allowedTools:F||void 0,body:B,aiMeta:gt.current||void 0,draftDir:Gt.current||void 0,version:Y.trim()||void 0,engine:ae});Gt.current=null,t(Le.plugin,Le.skill)}catch(Le){O(Le.message)}finally{I(!1)}},[y,N,b,Et,_,F,B,Y,Q,ae,t]),Nt=p.useCallback(()=>{Rt&&(S(Rt.layout),w(Rt.plugins[0]),ye(!1))},[Rt]);return{mode:o,setMode:c,layout:u,layoutLoading:h,selectedLayout:b,setSelectedLayout:S,creatableLayouts:Ut,availablePlugins:An,pathPreview:Mn,plugin:k,setPlugin:w,newPlugin:C,setNewPlugin:T,effectivePlugin:Et,name:y,setName:v,description:N,setDescription:A,model:_,setModel:D,allowedTools:F,setAllowedTools:E,body:B,setBody:L,bodyViewMode:U,setBodyViewMode:$,aiPrompt:ve,setAiPrompt:ce,generating:je,aiGenerated:Oe,aiError:he,aiClassifiedError:xe,aiProgress:Be,promptRef:lt,handleGenerate:da,handleCancelGenerate:Wn,clearAiError:tr,targetAgents:q,setTargetAgents:X,draftSaved:We,showPluginRecommendation:xn,setShowPluginRecommendation:ye,pluginLayoutInfo:Rt,applyPluginRecommendation:Nt,creating:ee,error:z,handleCreate:gn,engineDetection:P,refreshEngineDetection:de,engine:ae,setEngine:M,version:Y,setVersion:W,versionValid:Q,setVersionValid:oe,standaloneLocked:s===3}}function Gy(){return r.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:r.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 aN(){return r.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),r.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function Wy({node:t,depth:a=0}){var s;return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",style:{paddingLeft:`${a*16}px`,color:t.type==="dir"?"var(--text-secondary)":"var(--text-tertiary)",fontSize:12,fontFamily:"var(--font-mono, monospace)"},children:[t.type==="dir"?r.jsx(Gy,{}):r.jsx(aN,{}),r.jsxs("span",{children:[t.name,t.type==="dir"?"/":""]})]}),(s=t.children)==null?void 0:s.map(o=>r.jsx(Wy,{node:o,depth:a+1},o.name))]})}function lN(t,a,s){const o=[];a&&o.push({name:"evals.json",type:"file"}),o.push({name:"history",type:"dir"});const c=[{name:"SKILL.md",type:"file"},{name:"evals",type:"dir",children:o}];return s&&c.push({name:"draft.json",type:"file"}),{name:t||"{skill}",type:"dir",children:c}}function sN({skillName:t,hasEvals:a,isDraft:s}){const o=lN(t,a,s);return r.jsxs("div",{className:"glass-card p-4",children:[r.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[r.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"var(--accent-muted)"},children:r.jsx(Gy,{})}),"Skill Structure"]}),r.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-0)",border:"1px solid var(--border-subtle)"},children:r.jsx(Wy,{node:o})})]})}const aa={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function $d({size:t=14,color:a="currentColor"}){return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:a,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.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 iN({onCreated:t,onCancel:a}){const s=rN({onCreated:t});return r.jsxs("div",{className:"px-8 py-6 max-w-4xl animate-fade-in overflow-auto h-full",children:[r.jsxs("div",{className:"mb-5",children:[r.jsx("h2",{className:"text-[20px] font-semibold tracking-tight",style:{color:"var(--text-primary)"},children:"Create a New Skill"}),r.jsx("div",{className:"flex items-center justify-between mt-2",children:r.jsxs("div",{className:"inline-flex rounded-lg p-0.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[r.jsx("button",{onClick:()=>s.setMode("ai"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:s.mode==="ai"?"rgba(168,85,247,0.15)":"transparent",color:s.mode==="ai"?"#a855f7":"var(--text-tertiary)",boxShadow:s.mode==="ai"?"0 1px 3px rgba(168,85,247,0.15)":"none",cursor:"pointer",border:"none"},children:r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx($d,{size:12}),"AI-Assisted"]})}),r.jsx("button",{onClick:()=>s.setMode("manual"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:s.mode==="manual"?"var(--surface-4, var(--surface-3))":"transparent",color:s.mode==="manual"?"var(--text-primary)":"var(--text-tertiary)",boxShadow:s.mode==="manual"?"0 1px 3px rgba(0,0,0,0.1)":"none",cursor:"pointer",border:"none"},children:"Manual"})]})})]}),s.layoutLoading&&r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"skeleton h-10 w-full rounded-lg"}),r.jsx("div",{className:"skeleton h-10 w-full rounded-lg"})]}),!s.layoutLoading&&s.layout&&s.mode==="ai"&&r.jsxs("div",{className:"space-y-4 animate-fade-in",children:[r.jsxs("div",{className:"glass-card p-4",children:[r.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[r.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:r.jsx($d,{size:11,color:"#a855f7"})}),"Describe Your Skill"]}),r.jsx("textarea",{ref:s.promptRef,value:s.aiPrompt,onChange:o=>s.setAiPrompt(o.target.value),placeholder:`e.g., A skill that helps format SQL queries, optimize them for performance, and explain query execution plans.
|
|
87
87
|
|
|
88
|
-
Include any specific behaviors, constraints, or output formats you want.`,rows:5,disabled:s.generating,className:"w-full px-3 py-2.5 rounded-lg text-[13px] resize-y",style:{...aa,minHeight:"120px"},onKeyDown:o=>{o.key==="Enter"&&(o.metaKey||o.ctrlKey)&&(o.preventDefault(),s.handleGenerate())}}),r.jsx("p",{className:"text-[11px] mt-2",style:{color:"var(--text-quaternary, var(--text-tertiary))"},children:"Cmd+Enter to generate"})]}),s.generating&&s.aiProgress.length>0&&r.jsx(ai,{entries:s.aiProgress,isRunning:!0}),s.aiError&&r.jsx("div",{children:s.aiClassifiedError?r.jsx(ec,{error:s.aiClassifiedError,onRetry:s.handleGenerate,onDismiss:s.clearAiError}):r.jsxs("div",{children:[r.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:s.aiError}),r.jsx("button",{onClick:s.handleGenerate,className:"mt-2 text-[12px] font-medium",style:{color:"#a855f7",background:"none",border:"none",cursor:"pointer"},children:"Retry"})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[s.generating?r.jsx("button",{onClick:s.handleCancelGenerate,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:"var(--surface-3)",color:"var(--text-secondary)",border:"none",cursor:"pointer"},children:"Cancel Generation"}):r.jsxs("button",{onClick:s.handleGenerate,disabled:!s.aiPrompt.trim(),className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:s.aiPrompt.trim()?"#a855f7":"var(--surface-3)",color:s.aiPrompt.trim()?"#fff":"var(--text-tertiary)",cursor:s.aiPrompt.trim()?"pointer":"not-allowed",border:"none"},children:[r.jsx(Hd,{size:14}),"Generate"]}),r.jsx("button",{onClick:a,className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"}),!s.generating&&r.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:["or fill in the form manually",r.jsx("button",{onClick:()=>s.setMode("manual"),className:"ml-1 font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"below"})]})]})]}),!s.layoutLoading&&s.layout&&s.mode==="manual"&&r.jsxs("div",{className:"space-y-4 animate-fade-in",children:[r.jsxs("div",{className:"glass-card p-4",children:[r.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Location"}),s.creatableLayouts.length>1&&r.jsxs("div",{className:"mb-3",children:[r.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Layout"}),r.jsx("div",{className:"flex gap-2",children:s.creatableLayouts.map(o=>r.jsx("button",{onClick:()=>{s.setSelectedLayout(o.layout),s.setPlugin(o.existingPlugins[0]||""),s.setNewPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:s.selectedLayout===o.layout?"var(--accent)":"var(--surface-3)",color:s.selectedLayout===o.layout?"#fff":"var(--text-secondary)",border:`1px solid ${s.selectedLayout===o.layout?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},children:o.label},o.layout))})]}),s.selectedLayout!==3&&r.jsxs("div",{className:"mb-3",children:[r.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Plugin"}),r.jsxs("select",{value:s.plugin,onChange:o=>{s.setPlugin(o.target.value),s.setNewPlugin("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:aa,children:[s.availablePlugins.map(o=>r.jsx("option",{value:o,children:o},o)),r.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),s.plugin==="__new__"&&r.jsx("input",{type:"text",value:s.newPlugin,onChange:o=>s.setNewPlugin(pf(o.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:aa})]}),r.jsx("div",{className:"px-3 py-2 rounded-lg text-[11px] font-mono",style:{background:"var(--surface-0)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:s.pathPreview})]}),s.showPluginRecommendation&&s.pluginLayoutInfo&&s.selectedLayout===3&&r.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:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#3b82f6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("circle",{cx:"12",cy:"12",r:"10"}),r.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),r.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),r.jsxs("span",{children:["Plugins detected (",r.jsx("strong",{children:s.pluginLayoutInfo.plugins.slice(0,3).join(", ")}),"). Add this skill to a plugin for better organization."]})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[r.jsx("button",{onClick:s.applyPluginRecommendation,className:"px-3 py-1 rounded-md text-[11px] font-medium",style:{background:"#3b82f6",color:"#fff",border:"none",cursor:"pointer"},children:"Use plugin"}),r.jsx("button",{onClick:()=>s.setShowPluginRecommendation(!1),className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),r.jsxs("div",{className:"glass-card p-4",children:[r.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Skill Details"}),r.jsxs("div",{className:"mb-3",children:[r.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Name ",r.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),r.jsx("input",{type:"text",value:s.name,onChange:o=>s.setName(pf(o.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:aa})]}),r.jsxs("div",{className:"mb-3",children:[r.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Description ",r.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),r.jsx("textarea",{value:s.description,onChange:o=>s.setDescription(o.target.value),placeholder:"Brief description",rows:3,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-y",style:{...aa,minHeight:"72px"}})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),r.jsxs("select",{value:s.model,onChange:o=>s.setModel(o.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:aa,children:[r.jsx("option",{value:"",children:"Any"}),r.jsx("option",{value:"opus",children:"Opus"}),r.jsx("option",{value:"sonnet",children:"Sonnet"}),r.jsx("option",{value:"haiku",children:"Haiku"})]})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Allowed Tools"}),r.jsx("input",{type:"text",value:s.allowedTools,onChange:o=>s.setAllowedTools(o.target.value),placeholder:"Read, Write, Edit...",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:aa})]})]})]}),r.jsxs("div",{className:"glass-card p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--accent-muted)"},children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),r.jsx("polyline",{points:"14 2 14 8 20 8"}),r.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),r.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),r.jsxs("div",{children:[r.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md"}),r.jsx("span",{className:"text-[11px] ml-2",style:{color:"var(--text-tertiary)"},children:"Skill Definition"})]})]}),r.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:["write","preview"].map(o=>r.jsxs("button",{onClick:()=>s.setBodyViewMode(o),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:s.bodyViewMode===o?"var(--surface-4)":"transparent",color:s.bodyViewMode===o?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:s.bodyViewMode===o?600:400,border:"none",cursor:"pointer"},children:[o==="write"?r.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("polyline",{points:"16 18 22 12 16 6"}),r.jsx("polyline",{points:"8 6 2 12 8 18"})]}):r.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),r.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),r.jsx("span",{children:o==="write"?"Write":"Preview"})]},o))})]}),s.bodyViewMode==="write"?r.jsx("textarea",{value:s.body,onChange:o=>s.setBody(o.target.value),placeholder:`# /my-skill
|
|
88
|
+
Include any specific behaviors, constraints, or output formats you want.`,rows:5,disabled:s.generating,className:"w-full px-3 py-2.5 rounded-lg text-[13px] resize-y",style:{...aa,minHeight:"120px"},onKeyDown:o=>{o.key==="Enter"&&(o.metaKey||o.ctrlKey)&&(o.preventDefault(),s.handleGenerate())}}),r.jsx("p",{className:"text-[11px] mt-2",style:{color:"var(--text-quaternary, var(--text-tertiary))"},children:"Cmd+Enter to generate"})]}),s.generating&&s.aiProgress.length>0&&r.jsx(ai,{entries:s.aiProgress,isRunning:!0}),s.aiError&&r.jsx("div",{children:s.aiClassifiedError?r.jsx(ec,{error:s.aiClassifiedError,onRetry:s.handleGenerate,onDismiss:s.clearAiError}):r.jsxs("div",{children:[r.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:s.aiError}),r.jsx("button",{onClick:s.handleGenerate,className:"mt-2 text-[12px] font-medium",style:{color:"#a855f7",background:"none",border:"none",cursor:"pointer"},children:"Retry"})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[s.generating?r.jsx("button",{onClick:s.handleCancelGenerate,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:"var(--surface-3)",color:"var(--text-secondary)",border:"none",cursor:"pointer"},children:"Cancel Generation"}):r.jsxs("button",{onClick:s.handleGenerate,disabled:!s.aiPrompt.trim(),className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:s.aiPrompt.trim()?"#a855f7":"var(--surface-3)",color:s.aiPrompt.trim()?"#fff":"var(--text-tertiary)",cursor:s.aiPrompt.trim()?"pointer":"not-allowed",border:"none"},children:[r.jsx($d,{size:14}),"Generate"]}),r.jsx("button",{onClick:a,className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"}),!s.generating&&r.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:["or fill in the form manually",r.jsx("button",{onClick:()=>s.setMode("manual"),className:"ml-1 font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"below"})]})]})]}),!s.layoutLoading&&s.layout&&s.mode==="manual"&&r.jsxs("div",{className:"space-y-4 animate-fade-in",children:[r.jsxs("div",{className:"glass-card p-4",children:[r.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Location"}),s.creatableLayouts.length>1&&r.jsxs("div",{className:"mb-3",children:[r.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Layout"}),r.jsx("div",{className:"flex gap-2",children:s.creatableLayouts.map(o=>r.jsx("button",{onClick:()=>{s.setSelectedLayout(o.layout),s.setPlugin(o.existingPlugins[0]||""),s.setNewPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:s.selectedLayout===o.layout?"var(--accent)":"var(--surface-3)",color:s.selectedLayout===o.layout?"#fff":"var(--text-secondary)",border:`1px solid ${s.selectedLayout===o.layout?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},children:o.label},o.layout))})]}),s.selectedLayout!==3&&r.jsxs("div",{className:"mb-3",children:[r.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Plugin"}),r.jsxs("select",{value:s.plugin,onChange:o=>{s.setPlugin(o.target.value),s.setNewPlugin("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:aa,children:[s.availablePlugins.map(o=>r.jsx("option",{value:o,children:o},o)),r.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),s.plugin==="__new__"&&r.jsx("input",{type:"text",value:s.newPlugin,onChange:o=>s.setNewPlugin(mf(o.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:aa})]}),r.jsx("div",{className:"px-3 py-2 rounded-lg text-[11px] font-mono",style:{background:"var(--surface-0)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:s.pathPreview})]}),s.showPluginRecommendation&&s.pluginLayoutInfo&&s.selectedLayout===3&&r.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:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#3b82f6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("circle",{cx:"12",cy:"12",r:"10"}),r.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),r.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),r.jsxs("span",{children:["Plugins detected (",r.jsx("strong",{children:s.pluginLayoutInfo.plugins.slice(0,3).join(", ")}),"). Add this skill to a plugin for better organization."]})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[r.jsx("button",{onClick:s.applyPluginRecommendation,className:"px-3 py-1 rounded-md text-[11px] font-medium",style:{background:"#3b82f6",color:"#fff",border:"none",cursor:"pointer"},children:"Use plugin"}),r.jsx("button",{onClick:()=>s.setShowPluginRecommendation(!1),className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),r.jsxs("div",{className:"glass-card p-4",children:[r.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Skill Details"}),r.jsxs("div",{className:"mb-3",children:[r.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Name ",r.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),r.jsx("input",{type:"text",value:s.name,onChange:o=>s.setName(mf(o.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:aa})]}),r.jsxs("div",{className:"mb-3",children:[r.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Description ",r.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),r.jsx("textarea",{value:s.description,onChange:o=>s.setDescription(o.target.value),placeholder:"Brief description",rows:3,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-y",style:{...aa,minHeight:"72px"}})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),r.jsxs("select",{value:s.model,onChange:o=>s.setModel(o.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:aa,children:[r.jsx("option",{value:"",children:"Any"}),r.jsx("option",{value:"opus",children:"Opus"}),r.jsx("option",{value:"sonnet",children:"Sonnet"}),r.jsx("option",{value:"haiku",children:"Haiku"})]})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Allowed Tools"}),r.jsx("input",{type:"text",value:s.allowedTools,onChange:o=>s.setAllowedTools(o.target.value),placeholder:"Read, Write, Edit...",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:aa})]})]})]}),r.jsxs("div",{className:"glass-card p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--accent-muted)"},children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),r.jsx("polyline",{points:"14 2 14 8 20 8"}),r.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),r.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),r.jsxs("div",{children:[r.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md"}),r.jsx("span",{className:"text-[11px] ml-2",style:{color:"var(--text-tertiary)"},children:"Skill Definition"})]})]}),r.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:["write","preview"].map(o=>r.jsxs("button",{onClick:()=>s.setBodyViewMode(o),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:s.bodyViewMode===o?"var(--surface-4)":"transparent",color:s.bodyViewMode===o?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:s.bodyViewMode===o?600:400,border:"none",cursor:"pointer"},children:[o==="write"?r.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("polyline",{points:"16 18 22 12 16 6"}),r.jsx("polyline",{points:"8 6 2 12 8 18"})]}):r.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),r.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),r.jsx("span",{children:o==="write"?"Write":"Preview"})]},o))})]}),s.bodyViewMode==="write"?r.jsx("textarea",{value:s.body,onChange:o=>s.setBody(o.target.value),placeholder:`# /my-skill
|
|
89
89
|
|
|
90
90
|
You are an expert at...
|
|
91
|
-
`,rows:8,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{...aa,minHeight:"150px"}}):s.body.trim()?r.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:Zo(s.body)}}):r.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:r.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Start writing to see preview"})})]}),r.jsx(rN,{skillName:s.name||"{skill}",hasEvals:!1,isDraft:s.draftSaved}),s.error&&r.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:s.error}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("button",{onClick:s.handleCreate,disabled:s.creating||!s.name||!s.description,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:s.creating||!s.name||!s.description?"var(--surface-3)":"var(--accent)",color:s.creating||!s.name||!s.description?"var(--text-tertiary)":"#fff",cursor:s.creating||!s.name||!s.description?"not-allowed":"pointer",border:"none"},children:s.creating?"Creating...":"Create Skill"}),r.jsx("button",{onClick:a,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 lN(){return r.jsx("div",{className:"w-16 h-16 rounded-2xl flex items-center justify-center",style:{background:"var(--surface-2)"},children:r.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:[r.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"}),r.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),r.jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]})})}function _o({variant:t,message:a,onRetry:s}){const{setMode:o,setSearch:c}=er(),[u,d]=p.useState(!1);return t==="no-selection"?r.jsxs("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:[r.jsx("div",{className:"mb-5",children:u?r.jsx(lN,{}):r.jsx("img",{src:"/images/empty-studio.webp",width:128,height:128,alt:"",onError:()=>d(!0),style:{objectFit:"contain"}})}),r.jsx("p",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Select a skill to view details"}),r.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Choose a skill from the list to edit, test, and evaluate"})]}):t==="no-skills"?r.jsxs("div",{className:"text-center py-12 px-4 animate-fade-in-scale",children:[r.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mx-auto mb-4",style:{background:"var(--surface-2)"},children:r.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:r.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"})})}),r.jsx("p",{className:"text-[14px] font-medium",style:{color:"var(--text-secondary)"},children:"No skills found"}),r.jsxs("p",{className:"text-[12px] mt-1 mb-4",style:{color:"var(--text-tertiary)"},children:["Check your ",r.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"]}),r.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:[r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),r.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Create Your First Skill"]})]}):t==="error"?r.jsx("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:r.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:[r.jsx("p",{className:"text-[13px] mb-3",style:{color:"var(--red)"},children:a||"Failed to load skill data"}),s&&r.jsx("button",{onClick:s,className:"px-4 py-2 rounded-lg text-[12px] font-medium",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"none",cursor:"pointer"},children:"Retry"})]})}):r.jsxs("div",{className:"px-4 py-8 text-center animate-fade-in",children:[r.jsx("p",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"No skills match your search"}),r.jsx("button",{onClick:()=>c(""),className:"text-[12px] font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer",textDecoration:"underline"},children:"Clear search"})]})}function sN(t,a){const[s,o]=t.split(".").map(Number),[c,u]=a.split(".").map(Number);return c>s?"major":u>o?"minor":"patch"}const iN={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 Gy(){const[t,a]=p.useState([]),[s,o]=p.useState(!0),[c,u]=p.useState(new Set),[d,h]=p.useState(new Map),[g,m]=p.useState(!1),[y,v]=p.useState(new Set),[b,S]=p.useState(new Map),[k,w]=p.useState(null),[E,T]=p.useState(null),[N,A]=p.useState(!1),_=p.useCallback(async()=>{o(!0);try{const $=await we.getSkillUpdates();a($.filter(q=>q.updateAvailable))}catch{a([])}finally{o(!1)}},[]);p.useEffect(()=>{_()},[_]);const D=p.useMemo(()=>t.filter($=>!$.pinned),[t]),F=p.useCallback($=>{u(q=>{const X=new Set(q);return X.has($)?X.delete($):X.add($),X})},[]),C=p.useCallback(()=>{c.size===D.length?u(new Set):u(new Set(D.map($=>$.name)))},[c,D]),B=p.useCallback(()=>{const $=[...c];if(!$.length)return;m(!0),h(new Map($.map(X=>[X,{skill:X,status:"pending"}])));const q=we.startBatchUpdate($);q.addEventListener("progress",X=>{try{const ee=JSON.parse(X.data);h(I=>new Map(I).set(ee.skill,ee))}catch{}}),q.addEventListener("done",X=>{q.close(),m(!1);try{const ee=JSON.parse(X.data);w(`Updated ${ee.updated??0} skills, ${ee.failed??0} failed`),setTimeout(()=>w(null),5e3)}catch{}_()}),q.addEventListener("error",()=>{q.close(),m(!1),w("Batch update failed"),setTimeout(()=>w(null),5e3)})},[c,_]),L=p.useCallback(async $=>{const q=$.name.split("/"),X=q.length>=3?q[q.length-2]:q[0],ee=q[q.length-1];v(I=>new Set(I).add($.name)),S(I=>{const z=new Map(I);return z.delete($.name),z});try{const I=await we.postSkillUpdate(X,ee);if(I.ok)_();else{const z=`Update failed (HTTP ${I.status}): ${I.body}`;S(O=>new Map(O).set($.name,z)),w(`Couldn't update ${ee} — HTTP ${I.status}`),setTimeout(()=>w(null),5e3)}}catch(I){const z=I instanceof Error?I.message:"Network error";S(O=>new Map(O).set($.name,z)),w(`Couldn't update ${ee} — ${z}`),setTimeout(()=>w(null),5e3)}finally{v(I=>{const z=new Set(I);return z.delete($.name),z})}},[_]),U=p.useCallback(async $=>{if(!$.latest)return;const q=$.name.split("/"),X=q.length>=3?q[q.length-2]:q[0],ee=q[q.length-1];A(!0);try{const I=await we.getVersionDiff(X,ee,$.installed,$.latest);T({skill:$,diff:I})}catch{T(null)}finally{A(!1)}},[]);return s?r.jsxs("div",{"data-testid":"updates-panel",className:"p-6",children:[r.jsx("div",{className:"skeleton h-6 w-48 mb-4"}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"skeleton h-16 rounded-lg"}),r.jsx("div",{className:"skeleton h-16 rounded-lg"})]})]}):t.length===0?r.jsxs("div",{"data-testid":"updates-panel",className:"flex flex-col items-center justify-center h-full py-16",children:[r.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:[r.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),r.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),r.jsx("div",{className:"text-[15px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"All skills are up to date"}),r.jsx("div",{className:"text-[12px] mb-4",style:{color:"var(--text-tertiary)"},children:"No updates available for installed skills."}),r.jsx("button",{onClick:_,className:"btn btn-secondary text-[12px]",children:"Refresh"})]}):r.jsxs("div",{"data-testid":"updates-panel",className:"p-6",children:[k&&r.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:k}),r.jsxs("div",{className:"flex items-center justify-between mb-5",children:[r.jsxs("div",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["Available Updates (",D.length,")"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{onClick:_,className:"btn btn-ghost text-[12px]",disabled:g,children:"Refresh"}),r.jsx("button",{onClick:B,disabled:c.size===0||g,className:"btn btn-primary text-[12px]",children:g?"Updating...":`Update Selected (${c.size})`})]})]}),r.jsx("div",{className:"flex items-center gap-2 mb-3",children:r.jsxs("button",{onClick:C,className:"flex items-center gap-2 text-[12px] font-medium",style:{color:"var(--text-secondary)",background:"transparent",border:"none",cursor:"pointer"},children:[r.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:c.size===D.length&&D.length>0?"var(--accent)":"var(--border-default)",background:c.size===D.length&&D.length>0?"var(--accent)":"transparent"},children:c.size===D.length&&D.length>0&&r.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})})}),"Select All"]})}),r.jsx("div",{className:"space-y-2",children:t.map($=>{const q=$.name.split("/").pop()||$.name,X=$.latest?sN($.installed,$.latest):"patch",ee=iN[X],I=!!$.pinned,z=y.has($.name),O=d.get($.name),P=c.has($.name);return r.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:I?.7:1},children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("button",{onClick:()=>!I&&F($.name),disabled:I,className:"flex-shrink-0",style:{background:"transparent",border:"none",cursor:I?"not-allowed":"pointer"},children:r.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:P?"var(--accent)":"var(--border-default)",background:P?"var(--accent)":"transparent",opacity:I?.4:1},children:P&&r.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})})})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[r.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:q}),I&&r.jsx("span",{className:"text-[10px]",title:"Pinned — unpin from CLI to update",children:"📌"}),r.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:ee.bg,color:ee.text},children:X})]}),r.jsxs("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[$.installed," → ",$.latest||"?",I&&` (pinned at ${$.pinnedVersion||$.installed})`]})]}),O&&r.jsxs("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:O.status==="done"?"var(--green-muted)":O.status==="error"?"var(--red-muted)":"var(--yellow-muted)",color:O.status==="done"?"var(--green)":O.status==="error"?"var(--red)":"var(--yellow)"},children:[O.status,O.error&&`: ${O.error}`]}),r.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[r.jsx("button",{onClick:()=>U($),className:"btn btn-ghost text-[11px]",disabled:N,children:"View Changes"}),r.jsx("button",{onClick:()=>L($),disabled:I||z||g,title:I?"Pinned — unpin from CLI to update":"",className:`btn ${I?"btn-ghost":"btn-primary"} text-[11px]`,children:z?r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx("span",{className:"spinner spinner-sm"})," Updating"]}):(O==null?void 0:O.status)==="done"?r.jsx("span",{style:{color:"var(--green)"},children:"✓"}):"Update"})]})]})},$.name)})}),E&&r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>T(null),children:r.jsxs("div",{style:{width:"80%",maxWidth:900},onClick:$=>$.stopPropagation(),children:[r.jsx("div",{className:"mb-2 flex justify-end",children:r.jsx("button",{onClick:()=>T(null),className:"btn btn-ghost text-[12px]",children:"Close"})}),r.jsx(Of,{contentDiff:E.diff.contentDiff,fromLabel:E.diff.from,toLabel:E.diff.to,diffSummary:E.diff.diffSummary,renderContext:"inline"})]})})]})}const oN=Object.freeze(Object.defineProperty({__proto__:null,UpdatesPanel:Gy},Symbol.toStringTag,{value:"Module"}));function cN(t){return t==null?"var(--text-tertiary)":t>=.7?"var(--green)":t>=.4?"var(--yellow)":"var(--red)"}function uN(t){return t==null?"var(--surface-3)":t>=.7?"var(--green-muted)":t>=.4?"var(--yellow-muted)":"var(--red-muted)"}function dN(t){if(!t||typeof t!="string")return null;const a=t.trim();if(!a)return null;if(!a.includes("://")){const[s]=a.split("/");return s&&/^[A-Za-z0-9][A-Za-z0-9-]{0,38}$/.test(s)?s:null}try{const s=new URL(a),o=s.hostname.toLowerCase();if(o!=="github.com"&&o!=="www.github.com"&&o!=="raw.githubusercontent.com")return null;const u=s.pathname.split("/").filter(Boolean)[0];return!u||!/^[A-Za-z0-9][A-Za-z0-9-]{0,38}$/.test(u)?null:u}catch{return null}}function Wy(t){const{author:a,repoUrl:s}=t,o=dN(s??null),c=a&&a.trim()!==""?a:o??"—",[u,d]=p.useState(!1),h=p.useCallback(async()=>{var g;try{await((g=navigator.clipboard)==null?void 0:g.writeText(c)),d(!0),setTimeout(()=>d(!1),1500)}catch{}},[c]);return o?r.jsx("a",{"data-testid":t["data-testid"]??"author-link",href:`https://github.com/${o}`,target:"_blank",rel:"noopener noreferrer",style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-accent, var(--text-primary))",textDecoration:"none",borderBottom:"1px dotted var(--border-default, var(--border))",whiteSpace:"nowrap"},children:c}):!a||a.trim()===""?r.jsx("span",{"data-testid":t["data-testid"]??"author-link-empty",style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)"},children:"—"}):r.jsxs("button",{type:"button","data-testid":t["data-testid"]??"author-copy",title:`Copy "${c}"`,onClick:h,style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 6px",border:"1px solid var(--border-default, var(--border))",borderRadius:4,background:"transparent",fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",cursor:"pointer",whiteSpace:"nowrap"},children:[c,r.jsx("span",{"aria-hidden":"true",style:{fontSize:10,opacity:.7},children:u?"✓":"⧉"})]})}function fN(t){let a=t.split("#")[0].split("?")[0].replace(/\/+$/,"");return a=a.replace(/\/(?:tree|blob)\/[^/]+(?:\/.*)?$/,""),a}function pN(t,a){const s=fN(t),o=(a??"").replace(/^\/+/,"").replace(/\/+$/,"");return o?`${s}/blob/HEAD/${o}`:`${s}/blob/HEAD/`}function tv(t){if(!t)return"source";const a=t.replace(/\/+$/,""),s=a.lastIndexOf("/");return s===-1?a:a.slice(s+1)}function qy(t){const{repoUrl:a,skillPath:s,absolutePath:o}=t,[c,u]=p.useState(!1),d=typeof a=="string"&&a.trim()!==""&&/^https?:\/\//.test(a.trim()),h=s?tv(s):o?tv(o):"source",g=p.useCallback(async()=>{var v;const y=o??s??"";if(y)try{await((v=navigator.clipboard)==null?void 0:v.writeText(y)),u(!0),setTimeout(()=>u(!1),1500)}catch{}},[o,s]);if(d){const y=pN(a,s);return r.jsxs("a",{"data-testid":t["data-testid"]??"source-file-link",href:y,target:"_blank",rel:"noopener noreferrer",title:y,style:{display:"inline-flex",alignItems:"center",gap:4,fontFamily:"var(--font-mono, var(--font-geist-mono))",fontSize:12,color:"var(--text-accent, var(--text-primary))",textDecoration:"none",whiteSpace:"nowrap",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis"},children:[r.jsx("span",{children:h}),r.jsx("span",{"aria-hidden":"true",children:"↗"})]})}if(!o&&!s)return r.jsx("span",{"data-testid":t["data-testid"]??"source-file-empty",style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)"},children:"—"});const m=o??s??"";return r.jsxs("button",{type:"button","data-testid":t["data-testid"]??"source-file-copy",title:`Copy ${m}`,onClick:g,style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 6px",border:"1px solid var(--border-default, var(--border))",borderRadius:4,background:"transparent",fontFamily:"var(--font-mono, var(--font-geist-mono))",fontSize:12,color:"var(--text-secondary)",cursor:"pointer",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[r.jsx("span",{children:h}),r.jsx("span",{"aria-hidden":"true",style:{fontSize:10,opacity:.7},children:c?"✓":"⧉"})]})}function nv(t,a="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:t,severity:a}}))}function Yy(t){return t.skill?hN({skill:t.skill}):gN({state:t.state,isReadOnly:t.isReadOnly,onDelete:t.onDelete})}function mN(t,a=48){if(t.length<=a)return t;const s=t.slice(0,12),o=t.slice(t.length-(a-12-1));return`${s}…${o}`}function hN({skill:t}){const[a,s]=p.useState(!1),o=p.useCallback(async()=>{var d;try{await((d=navigator.clipboard)==null?void 0:d.writeText(t.dir)),s(!0),setTimeout(()=>s(!1),1500),nv(ne.toasts.pathCopied,"info")}catch{nv(ne.toasts.permissionDenied,"error")}},[t.dir]),c=t.origin==="installed"?"Project":"Skills",u=t.origin==="installed"?"var(--status-installed)":"var(--status-own)";return r.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:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",marginBottom:4},children:[r.jsx("span",{"data-testid":"detail-header-plugin",children:t.plugin}),r.jsx("span",{"aria-hidden":"true",style:{color:"var(--text-secondary)"},children:"›"}),r.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--text-secondary)",fontSize:11,letterSpacing:.3,textTransform:"uppercase"},children:[r.jsx("span",{"data-origin-dot":t.origin,"aria-label":`Origin: ${c}`,style:{display:"inline-block",width:7,height:7,borderRadius:999,background:u}}),c]})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,marginBottom:8},children:[r.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:t.skill}),r.jsx("span",{"data-testid":"detail-header-version",children:r.jsx(ri,{version:t.resolvedVersion??t.version??null,source:t.versionSource,pluginName:t.pluginName??null})})]}),r.jsxs("div",{"data-testid":"detail-header-byline",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:10,margin:"0 0 8px",fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)"},children:[r.jsx(Wy,{author:t.author??null,repoUrl:t.repoUrl??t.homepage??null}),r.jsx(qy,{repoUrl:t.repoUrl??null,skillPath:t.skillPath??null,absolutePath:t.dir})]}),r.jsx(xN,{skill:t}),r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[r.jsx("button",{type:"button","data-testid":"detail-header-path-chip",title:t.dir,"aria-label":`Copy path ${t.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:mN(t.dir||"—")}),r.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:[r.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),r.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),a?"Copied":"Copy"]})]})]})}function xN({skill:t}){const a=t.installMethod,s=t.symlinkTarget;if(!a)return null;let o="";switch(a){case"symlinked":o=s?`Symlinked from ${s}`:"Symlinked (target unresolved)";break;case"copied":o="Copied (independent)";break;case"authored":o="Authored";break;default:return null}return r.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:[r.jsx("span",{style:{fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",fontSize:10,color:"var(--text-tertiary)"},children:"Install method"}),r.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:o})]})}function gN({state:t,isReadOnly:a,onDelete:s}){const{plugin:o,skill:c,evals:u,latestBenchmark:d,isDirty:h,caseRunStates:g,regressions:m,iterationCount:y}=t,v=Array.from(g.values()).some(T=>T.status==="running"||T.status==="queued"),b=d==null?void 0:d.overall_pass_rate,S=(u==null?void 0:u.evals.reduce((T,N)=>T+N.assertions.length,0))??0,k=(u==null?void 0:u.evals.length)??0,w=cN(b),E=uN(b);return r.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:[r.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[r.jsx("span",{style:{color:"var(--text-tertiary)"},children:o}),r.jsx(vN,{}),r.jsx("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:c}),a&&r.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:[r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),r.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"installed"]}),h&&r.jsx("span",{className:"ml-2 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded",style:{background:"var(--yellow-muted)",color:"var(--yellow)"},children:"unsaved"}),v&&r.jsxs("span",{className:"ml-2 flex items-center gap-1.5 text-[11px]",style:{color:"var(--accent)"},children:[r.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}}),"Running..."]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[!a&&s&&r.jsx("button",{disabled:v,onClick:()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:request-delete",{detail:{skill:{plugin:o,skill:c,dir:"",hasEvals:!1,hasBenchmark:!1,evalCount:0,assertionCount:0,benchmarkStatus:"missing",lastBenchmark:null,origin:"source"}}}))},title:"Delete skill",className:"flex items-center justify-center transition-colors duration-150",style:{background:"none",border:"none",cursor:v?"not-allowed":"pointer",color:"var(--text-tertiary)",padding:4,opacity:v?.4:1,borderRadius:4},onMouseEnter:T=>{v||(T.currentTarget.style.color="var(--red)")},onMouseLeave:T=>{T.currentTarget.style.color="var(--text-tertiary)"},children:r.jsx(yN,{})}),m.length>0&&r.jsxs("span",{className:"pill",style:{background:"var(--red-muted)",color:"var(--red)"},children:[r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[r.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"}),r.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),r.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),m.length," regression",m.length>1?"s":""]}),y>0&&r.jsxs("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)"},children:["Iter ",y]}),r.jsx("span",{className:"pill",style:{background:E,color:w},children:b!=null?`${Math.round(b*100)}%`:"--"}),r.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[k," case",k!==1?"s":""," / ",S," assert",S!==1?"s":""]})]})]})}function vN(){return r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",children:r.jsx("polyline",{points:"9 18 15 12 9 6"})})}function yN(){return r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("polyline",{points:"3 6 5 6 21 6"}),r.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"}),r.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),r.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}function la(t){const{title:a,label:s,value:o,subtitle:c,description:u,linkLabel:d,children:h,onClick:g}=t,m=a??s??"",y=typeof g=="function",v=b=>{y&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),g==null||g())};return r.jsxs("div",{className:y?"metric-card metric-card-link":"metric-card","data-testid":t["data-testid"],role:y?"button":void 0,tabIndex:y?0:void 0,onClick:y?()=>g==null?void 0:g():void 0,onKeyDown:y?v:void 0,style:{background:"var(--card-bg, var(--bg-surface))",border:"1px solid var(--border, var(--border-default))",borderRadius:6,padding:"1rem",display:"flex",flexDirection:"column",gap:"0.375rem",minWidth:0,height:"100%",cursor:y?"pointer":void 0,wordBreak:"break-word",overflowWrap:"anywhere"},children:[m?r.jsx("div",{"data-testid":t["data-testid"]?`${t["data-testid"]}-title`:void 0,style:{fontFamily:"var(--font-geist-mono, var(--font-mono))",fontSize:"0.5625rem",fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--card-text-muted, var(--text-secondary))"},children:m}):null,r.jsx("div",{"data-testid":t["data-testid"]?`${t["data-testid"]}-value`:void 0,style:{fontFamily:"var(--font-geist-mono, var(--font-mono))",fontSize:"1.375rem",fontWeight:700,color:"var(--card-text, var(--text-primary))",lineHeight:1,fontVariantNumeric:"tabular-nums"},children:String(o)}),c?r.jsx("div",{style:{fontFamily:"var(--font-geist-mono, var(--font-mono))",fontSize:"0.625rem",color:"var(--card-text-muted, var(--text-secondary))"},children:c}):null,u?r.jsx("div",{style:{fontFamily:"var(--font-geist-mono, var(--font-mono))",fontSize:"0.5625rem",color:"var(--card-text-muted, var(--text-secondary))",lineHeight:1.4,opacity:.7},children:u}):null,h?r.jsx("div",{style:{flex:1,marginTop:"0.25rem"},children:h}):null,d?r.jsx("div",{style:{marginTop:"auto",paddingTop:"0.375rem",borderTop:"1px solid var(--border, var(--border-default))",fontFamily:"var(--font-geist-mono, var(--font-mono))",fontSize:"0.625rem",color:"var(--card-text-muted, var(--text-secondary))"},children:d}):null]})}const bN="Benchmarks are the aggregated score of this skill's evals (evals.yaml) run against its tests (tests/). Each test case produces a verdict; the benchmark is the mean pass rate.";function jN(t){const{onNavigate:a}=t,[s,o]=p.useState(t.open??!1),c=p.useCallback(()=>o(!1),[]);p.useEffect(()=>{if(!s)return;const d=h=>{h.key==="Escape"&&c()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[s,c]);const u=p.useCallback(d=>{a==null||a(d),o(!1)},[a]);return r.jsxs("span",{"data-testid":t["data-testid"]??"benchmark-info",style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[r.jsx("button",{type:"button","data-testid":"benchmark-info-trigger","aria-label":"About benchmarks","aria-expanded":!!s,onClick:()=>o(d=>!d),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:18,height:18,padding:0,border:"1px solid var(--border-default, var(--border))",borderRadius:999,background:"transparent",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-sans)",cursor:"pointer",lineHeight:1},children:"ℹ"}),s&&r.jsxs("div",{role:"dialog","data-testid":"benchmark-info-popover",style:{position:"absolute",top:"100%",right:0,marginTop:6,zIndex:20,width:280,padding:"10px 12px",background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border))",borderRadius:6,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-primary)",boxShadow:"0 4px 16px rgba(0,0,0,0.08)"},children:[r.jsx("p",{style:{margin:"0 0 8px",lineHeight:1.45},children:bN}),r.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[r.jsx("button",{type:"button","data-testid":"benchmark-info-link-tests",onClick:()=>u("tests"),style:$d,children:"Tests →"}),r.jsx("button",{type:"button","data-testid":"benchmark-info-link-run",onClick:()=>u("run"),style:$d,children:"Run →"}),r.jsx("button",{type:"button","data-testid":"benchmark-info-close",onClick:c,style:{...$d,marginLeft:"auto",color:"var(--text-secondary)"},children:"Close"})]})]})]})}const $d={background:"transparent",border:"none",padding:0,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-accent, var(--text-primary))",cursor:"pointer",textDecoration:"underline"};function SN(t){if(t==null||!Number.isFinite(t))return"—";if(t<1024)return`${t} B`;const a=t/1024;if(a<1024)return a>=10?`${Math.round(a)} KB`:`${a.toFixed(1).replace(/\.0$/,"")} KB`;const s=a/1024;return s>=10?`${Math.round(s)} MB`:`${s.toFixed(1).replace(/\.0$/,"")} MB`}function Os(t){if(!t)return"—";const a=new Date(t);if(Number.isNaN(a.getTime()))return t;const s=Date.now()-a.getTime(),o=Math.floor(s/1e3);if(o<60)return"just now";const c=Math.floor(o/60);if(c<60)return`${c} min ago`;const u=Math.floor(c/60);if(u<24)return`${u} hr ago`;const d=Math.floor(u/24);if(d<30)return`${d} day${d===1?"":"s"} ago`;const h=Math.floor(d/30);if(h<12)return`${h} month${h===1?"":"s"} ago`;const g=Math.floor(h/12);return`${g} year${g===1?"":"s"} ago`}function kN(t){switch(t.benchmarkStatus){case"pass":case"fail":case"stale":return t.benchmarkStatus==="pass"?"100%":t.benchmarkStatus==="fail"?"0%":"—";default:return"—"}}function wN(t){const a=t.installMethod;if(!a)return null;const s=a==="authored"?"Authored":a==="copied"?"Copied":"Symlinked";return r.jsx("span",{"data-testid":"overview-install-method",style:{display:"inline-flex",alignItems:"center",padding:"1px 6px",border:"1px solid var(--border-default, var(--border))",borderRadius:4,fontFamily:"var(--font-mono, var(--font-geist-mono))",fontSize:10,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:.4},children:s})}function CN(t){var y,v;const{skill:a,onNavigate:s,activationsCount:o=0,lastRunIso:c=null,repoUrl:u,skillPathInRepo:d}=t,h=u??(EN(a.homepage)?a.homepage??null:null),g=((y=a.mcpDeps)==null?void 0:y.length)??0,m=((v=a.deps)==null?void 0:v.length)??0;return r.jsxs("div",{"data-testid":"skill-overview",className:"skill-overview",style:{display:"flex",flexDirection:"column",gap:12,padding:16},children:[r.jsxs("header",{"data-testid":"skill-overview-header",style:{position:"sticky",top:0,zIndex:5,display:"flex",flexDirection:"column",gap:6,padding:"10px 12px",background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border))",borderRadius:8},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap"},children:[r.jsx("h2",{"data-testid":"skill-overview-name",style:{fontFamily:"var(--font-serif, var(--font-sans))",fontSize:18,fontWeight:500,color:"var(--text-primary)",margin:0,lineHeight:1.2},children:a.skill}),r.jsx(ri,{version:a.resolvedVersion??a.version??null,source:a.versionSource,pluginName:a.pluginName??null}),wN(a)]}),r.jsxs("div",{"data-testid":"skill-overview-byline",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:10,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)"},children:[r.jsx(Wy,{author:a.author??null,repoUrl:h}),a.category?r.jsxs("span",{children:["· ",a.category]}):null,r.jsx(qy,{repoUrl:h,skillPath:d??null,absolutePath:a.dir}),a.lastModified?r.jsxs("span",{title:a.lastModified,children:["· Updated ",Os(a.lastModified)]}):null]})]}),r.jsxs("div",{"data-testid":"skill-overview-grid",className:"skill-overview-grid",style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:"0.75rem",alignItems:"stretch"},children:[r.jsx(la,{title:"Benchmark",value:kN(a),subtitle:a.lastBenchmark?Os(a.lastBenchmark):"Never run","data-testid":"metric-benchmark",onClick:s?()=>s("run"):void 0,children:r.jsx("div",{style:{marginTop:4,display:"inline-flex",alignItems:"center"},children:r.jsx(jN,{onNavigate:s})})}),r.jsx(la,{title:"Tests",value:a.evalCount??0,subtitle:`${a.assertionCount??0} assertions`,"data-testid":"metric-tests",onClick:s?()=>s("tests"):void 0}),r.jsx(la,{title:"Activations",value:o,subtitle:c?`Last: ${Os(c)}`:"Never","data-testid":"metric-activations",onClick:s?()=>s("activation"):void 0}),r.jsx(la,{title:"Last run",value:Os(c??a.lastBenchmark??null),"data-testid":"metric-last-run",onClick:s?()=>s("history"):void 0}),r.jsx(la,{title:"MCP deps",value:g,subtitle:g>0&&a.mcpDeps?a.mcpDeps.slice(0,3).join(", "):"None","data-testid":"metric-mcp-deps",onClick:s?()=>s("deps"):void 0}),r.jsx(la,{title:"Skill deps",value:m,subtitle:m>0&&a.deps?a.deps.slice(0,3).join(", "):"None","data-testid":"metric-skill-deps",onClick:s?()=>s("deps"):void 0}),r.jsx(la,{title:"Size",value:SN(a.sizeBytes),"data-testid":"metric-size"}),r.jsx(la,{title:"Last modified",value:Os(a.lastModified),subtitle:a.lastModified??void 0,"data-testid":"metric-last-modified"})]})]})}function EN(t){return t?/^https?:\/\/(?:www\.)?(?:github\.com|raw\.githubusercontent\.com)\//.test(t):!1}function NN({skill:t}){const{onSkillUpdated:a}=er(),{toast:s}=Wo(),[o,c]=p.useState("idle"),[u,d]=p.useState(null),[h,g]=p.useState(!1),[m,y]=p.useState(null),[v,b]=p.useState(!1),S=p.useRef(null),k=p.useCallback(async()=>{if(!t||o==="updating")return;const N=new AbortController;S.current=N,c("updating"),d(null);try{const A=await we.postSkillUpdate(t.plugin,t.skill,N.signal);if(A.ok)c("done"),a(t.plugin,t.skill),s({message:`Updated ${t.skill}.`,severity:"success",durationMs:4e3});else{const _=`Update failed (HTTP ${A.status}): ${A.body}`;c("idle"),d(_),s({message:`Couldn't update ${t.skill} — HTTP ${A.status}`,severity:"error",durationMs:0,action:{label:"Retry",onInvoke:()=>{k()}}})}}catch(A){if(A instanceof DOMException&&A.name==="AbortError")return;const _=A instanceof Error?A.message:"Network error";c("idle"),d(_),s({message:`Couldn't update ${t.skill} — ${_}`,severity:"error",durationMs:0,action:{label:"Retry",onInvoke:()=>{k()}}})}finally{S.current===N&&(S.current=null)}},[t,o,a,s]);if(p.useEffect(()=>{if(!h||m!=null||!t||!t.latestVersion)return;let N=!1;return b(!0),we.getVersionDiff(t.plugin,t.skill,t.currentVersion??"",t.latestVersion).then(A=>{N||y(A)}).catch(()=>{N||y(null)}).finally(()=>{N||b(!1)}),()=>{N=!0}},[h,m,t==null?void 0:t.plugin,t==null?void 0:t.skill,t==null?void 0:t.latestVersion,t==null?void 0:t.currentVersion,t]),p.useEffect(()=>()=>{var N;(N=S.current)==null||N.abort()},[]),!t||t.updateAvailable!==!0)return null;const w=t.latestVersion,E=o==="updating"?"Updating…":w?`Update to ${w}`:"Update",T=o==="updating";return r.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:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[r.jsx("button",{type:"button","data-testid":"update-action-button",onClick:()=>{k()},disabled:T,style:{height:36,padding:"0 14px",background:"var(--color-ink)",color:"var(--color-paper)",border:"none",borderRadius:4,cursor:T?"not-allowed":"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500},children:E}),r.jsx("button",{type:"button","data-testid":"update-action-toggle-changelog",onClick:()=>g(N=>!N),disabled:T||!w,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"})]}),o==="updating"&&r.jsx("div",{"data-testid":"update-action-progress",role:"status",style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-muted, var(--text-secondary))"},children:"Updating…"}),u&&o!=="updating"&&r.jsx("div",{"data-testid":"update-action-error",role:"alert",style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--color-error, #d32f2f)"},children:u}),h&&w&&r.jsxs("div",{"data-testid":"update-action-changelog",style:{paddingTop:8},children:[v&&r.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Loading changelog…"}),!v&&m&&r.jsx(Of,{contentDiff:m.contentDiff,fromLabel:m.from,toLabel:m.to,diffSummary:m.diffSummary??void 0,renderContext:"inline"}),!v&&!m&&r.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Couldn't load changelog."})]})]})}const TN=3e4;function RN({plugin:t,skill:a,trackedForUpdates:s=!0,discoveryBackedOff:o=!1}){const c=er(),[u,d]=p.useState(!1),[h,g]=p.useState(!1),[,m]=p.useState(0),y=p.useRef(null),v=p.useRef(null),b=`${t}/${a}`,S=c.updatesById.get(b);if(p.useEffect(()=>{if(!u)return;const w=setInterval(()=>m(E=>(E+1)%1e6),250);return()=>clearInterval(w)},[u]),p.useEffect(()=>{if(!u||!S)return;const w=v.current??0;S.receivedAt<w||(y.current&&(clearTimeout(y.current),y.current=null),d(!1),g(!1),v.current=null)},[u,S]),p.useEffect(()=>()=>{y.current&&clearTimeout(y.current)},[]),s===!1||o)return null;const k=async()=>{if(!u){g(!1),d(!0),v.current=Date.now(),y.current=setTimeout(()=>{d(!1),g(!0),y.current=null,v.current=null},TN);try{await we.rescanSkill(t,a)}catch{y.current&&(clearTimeout(y.current),y.current=null),d(!1),v.current=null}}};return r.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[r.jsx("button",{type:"button","data-testid":"check-now-button",onClick:k,disabled:u,style:{height:26,padding:"0 10px",background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:12,cursor:u?"not-allowed":"pointer"},children:"Check now"}),u&&r.jsx("span",{"data-testid":"check-now-spinner","aria-label":"Checking for updates",role:"status",style:{display:"inline-block",width:10,height:10,borderRadius:"50%",border:"2px solid var(--text-secondary)",borderTopColor:"transparent",animation:"check-now-spin 800ms linear infinite"}}),h&&r.jsx("span",{"data-testid":"check-now-no-changes",style:{fontSize:11,color:"var(--text-secondary)",fontFamily:"var(--font-sans)"},children:"No changes detected"})]})}const Ky=["overview","editor","tests","run","activation","history","leaderboard","deps","versions"],AN={overview:"Overview",editor:"Editor",tests:"Tests",run:"Run",activation:"Activation",history:"History",leaderboard:"Leaderboard",deps:"Deps",versions:"Versions"};function MN(t){return typeof t=="string"&&Ky.includes(t)}function LN(){if(typeof window>"u")return"overview";const a=new URLSearchParams(window.location.search).get("panel");return MN(a)?a:"overview"}function Vd(){const{state:t,setMobileView:a}=er();return t.isMobile?r.jsxs("button",{onClick:()=>a("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:[r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back to skills"]}):null}function zN(t={}){if(t.selectedSkillInfo!==void 0||t.loadError!==void 0)return DN(t);const{state:a,selectSkill:s,setMode:o,refreshSkills:c}=er(),[u,d]=p.useState(typeof window<"u"?window.location.hash:"");if(p.useEffect(()=>{const m=()=>d(window.location.hash);return window.addEventListener("hashchange",m),()=>window.removeEventListener("hashchange",m)},[]),u==="#/updates")return r.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[r.jsx(Vd,{}),r.jsx(Gy,{})]});if(a.mode==="create")return r.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[r.jsx(Vd,{}),r.jsx(aN,{onCreated:(m,y)=>{o("browse"),c(),s({plugin:m,skill:y,origin:"source"})},onCancel:()=>o("browse")})]});if(!a.selectedSkill)return a.skillsError?r.jsx(_o,{variant:"error",message:a.skillsError,onRetry:c}):!a.skillsLoading&&a.skills.length===0?r.jsx(_o,{variant:"no-skills"}):r.jsx(_o,{variant:"no-selection"});const h=a.selectedSkill,g=a.skills.find(m=>m.plugin===h.plugin&&m.skill===h.skill)??null;return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsx(Vd,{}),r.jsx(_N,{skillInfo:g,allSkills:a.skills,onSelectSkill:m=>s(m)})]})}function DN(t){const a=t.selectedSkillInfo??null,s=t.activeDetailTab??"overview";if(a==null)return BN();if(t.loadError)return IN(a,t.loadError);const o=t.allSkills&&t.onSelectSkill?{allSkills:t.allSkills,onSelectSkill:t.onSelectSkill}:void 0;return Xy(a,s,t.onDetailTabChange,o)}function _N({skillInfo:t,allSkills:a,onSelectSkill:s}){const[o,c]=p.useState(LN());p.useEffect(()=>{if(typeof window>"u")return;const d=new URLSearchParams(window.location.search);o==="overview"?d.delete("panel"):d.set("panel",o);const h=d.toString(),g=`${window.location.pathname}${h?"?"+h:""}${window.location.hash}`;window.history.replaceState(null,"",g)},[o]);const u=p.useMemo(()=>t?Xy(t,o,c,{}):r.jsx(_o,{variant:"no-selection"}),[t,o,a,s]);return r.jsx("div",{className:"flex flex-col h-full",style:{background:"var(--bg-canvas)"},children:u})}function ON(t,a){return r.jsx("div",{role:"tablist","aria-label":"Detail sections","data-testid":"detail-tab-bar",style:{display:"flex",alignItems:"stretch",gap:4,borderBottom:"1px solid var(--border-default)",padding:"0 16px",background:"var(--bg-canvas)",overflowX:"auto"},children:Ky.map(s=>{const o=s===t;return r.jsx("button",{type:"button",role:"tab","aria-selected":o,tabIndex:o?0:-1,id:`detail-tab-${s}`,"aria-controls":`detail-panel-${s}`,"data-testid":`detail-tab-${s}`,onClick:()=>a==null?void 0:a(s),style:{background:"transparent",border:"none",borderBottom:o?"2px solid var(--text-primary)":"2px solid transparent",padding:"10px 8px",marginBottom:-1,fontFamily:"var(--font-sans)",fontSize:13,fontWeight:o?500:400,color:o?"var(--text-primary)":"var(--text-secondary)",cursor:"pointer",whiteSpace:"nowrap"},children:AN[s]},s)})})}function BN(){return r.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:32,background:"var(--bg-canvas)"},children:[r.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"}),r.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 IN(t,a){return r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:24,background:"var(--bg-canvas)",height:"100%"},children:[Yy({skill:t}),r.jsxs("section",{role:"alert",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px"},children:[r.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 ",t.skill]}),r.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:"0 0 12px",wordBreak:"break-word"},children:a})]})]})}function UN({active:t}){return t==="editor"?r.jsx(KC,{}):t==="tests"?r.jsx(nE,{}):t==="run"?r.jsx(xE,{}):t==="activation"?r.jsx(bE,{}):t==="history"?r.jsx(OE,{}):t==="leaderboard"?r.jsx(YE,{}):t==="deps"?r.jsx(XE,{}):t==="versions"?r.jsx(gC,{}):null}function HN({active:t}){const{state:a,dispatch:s}=Rn();return p.useEffect(()=>{t!=="overview"&&a.activePanel!==t&&s({type:"SET_PANEL",panel:t})},[t,a.activePanel,s]),null}function Xy(t,a,s,o){const c=h=>{s==null||s(h)},u=r.jsx(CN,{skill:t,onNavigate:c,repoUrl:t.homepage??null}),d=o!=null?r.jsxs(sC,{plugin:t.plugin,skill:t.skill,origin:t.origin,children:[r.jsx(HN,{active:a}),r.jsx(UN,{active:a})]},`${t.plugin}/${t.skill}`):r.jsxs("div",{style:{padding:16,fontFamily:"var(--font-sans)",color:"var(--text-secondary)",fontSize:13},children:["Select a skill from the sidebar to load its ",a," view."]});return r.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--bg-canvas)"},children:[r.jsx("div",{style:{padding:16,paddingBottom:12},children:Yy({skill:t})}),r.jsx(NN,{skill:t}),t.origin==="installed"&&r.jsxs("div",{"data-testid":"read-only-banner",style:{display:"flex",alignItems:"center",gap:8,padding:"8px 16px",background:"var(--surface-2)",color:"var(--text-secondary)",borderBottom:"1px solid var(--border-subtle)",fontFamily:"var(--font-sans)",fontSize:12},children:[r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,color:"var(--text-tertiary)"},children:[r.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),r.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),r.jsx("span",{children:"This is an installed copy of the skill. Editing, generating tests, and running evals are disabled. Open the source skill to make changes."})]}),t.origin==="installed"&&r.jsx("div",{style:{padding:"8px 16px",borderBottom:"1px solid var(--border-default)"},children:r.jsx(RN,{plugin:t.plugin,skill:t.skill,trackedForUpdates:t.trackedForUpdates})}),ON(a,s),r.jsx("div",{role:"tabpanel",id:`detail-panel-${a}`,"aria-labelledby":`detail-tab-${a}`,"data-testid":`detail-panel-${a}`,style:{flex:1,minHeight:0,overflow:"auto"},children:a==="overview"?u:d})]})}function $N(){const{updateCount:t,state:a,dismissUpdateNotification:s}=er(),o=t>0&&!a.updateNotificationDismissed;return p.useEffect(()=>{if(!o)return;const c=setTimeout(()=>s(),1e4);return()=>clearTimeout(c)},[o,s]),o?r.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:[r.jsxs("span",{children:[t," update",t===1?"":"s"," available"]}),r.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"}),r.jsx("button",{onClick:s,className:"text-[14px] leading-none",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",padding:"0 2px"},"aria-label":"Dismiss",children:"✕"})]}):null}const VN=[{name:ne.shortcuts.groupNavigation,items:[{keys:"/",label:ne.shortcuts.search},{keys:"j",label:ne.shortcuts.moveDown},{keys:"k",label:ne.shortcuts.moveUp},{keys:"Enter",label:ne.shortcuts.openSelected},{keys:"Esc",label:"Close / clear"}]},{name:ne.shortcuts.groupActions,items:[{keys:"⌘K",label:ne.shortcuts.openPalette},{keys:"?",label:ne.shortcuts.openShortcuts},{keys:"⌘B",label:ne.shortcuts.toggleSidebar},{keys:"E",label:ne.actions.edit}]},{name:ne.shortcuts.groupTheme,items:[{keys:"⌘⇧D",label:ne.shortcuts.toggleTheme}]}];function PN({open:t,onClose:a,groups:s=VN,title:o=ne.shortcuts.title}){const c=p.useRef(null),u=p.useRef(null);return p.useEffect(()=>{var d;if(t)return c.current=document.activeElement??null,(d=u.current)==null||d.focus(),()=>{var h,g;(g=(h=c.current)==null?void 0:h.focus)==null||g.call(h),c.current=null}},[t]),p.useEffect(()=>{if(!t)return;function d(h){var g;if(h.key==="Escape"){h.preventDefault(),a();return}h.key==="Tab"&&(h.preventDefault(),(g=u.current)==null||g.focus())}return window.addEventListener("keydown",d,!0),()=>window.removeEventListener("keydown",d,!0)},[t,a]),t?r.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:d=>{d.target===d.currentTarget&&a()},children:r.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:[r.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[r.jsx("h2",{id:"shortcut-modal-title",style:{margin:0,fontFamily:"var(--font-serif)",fontWeight:500,fontSize:18},children:o}),r.jsx("button",{ref:u,type:"button","aria-label":"Close",onClick:a,style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"2px 8px",color:"var(--text-secondary)",cursor:"pointer",fontSize:13},children:"Esc"})]}),s.map(d=>r.jsxs("section",{style:{marginBottom:12},children:[r.jsx("h3",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--text-secondary)",margin:"0 0 6px"},children:d.name}),r.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:d.items.map(h=>r.jsxs("li",{style:{display:"flex",justifyContent:"space-between",padding:"4px 0",borderTop:"1px solid var(--border-default)",fontSize:13},children:[r.jsx("span",{children:h.label}),r.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})]},`${d.name}:${h.keys}`))})]},d.name))]})}):null}function FN(t){const a=ne.actions,s=[{action:"open",label:a.open},{action:"copy-path",label:a.copyPath},{action:"reveal",label:a.revealInEditor},{action:"run-benchmark",label:a.runBenchmark}];if(t.origin==="source")return[...s,{action:"edit",label:a.edit},{action:"duplicate",label:a.duplicate},{action:"delete",label:a.delete}];const o=[...s];return t.updateAvailable&&o.push({action:"update",label:a.update}),o.push({action:"uninstall",label:a.uninstall}),o.push({action:"delete",label:a.delete,disabled:!0,title:a.deletePluginTooltip}),o}function GN({state:t,onClose:a,onAction:s,itemsOverride:o}){const c=p.useRef(null),u=p.useRef(null),[d,h]=p.useState(0),g=p.useMemo(()=>t.skill?o??FN(t.skill):[],[t.skill,o]),m=p.useMemo(()=>{if(typeof window>"u")return{left:t.x,top:t.y};const v=8,b=220,S=44+g.length*28;let k=t.x,w=t.y;return k+b+v>window.innerWidth&&(k=Math.max(v,t.x-b)),w+S+v>window.innerHeight&&(w=Math.max(v,t.y-S)),{left:k,top:w}},[t.x,t.y,g.length]);p.useEffect(()=>{if(t.open)return u.current=document.activeElement??null,h(0),requestAnimationFrame(()=>{var v;(v=c.current)==null||v.focus()}),()=>{var v,b;(b=(v=u.current)==null?void 0:v.focus)==null||b.call(v),u.current=null}},[t.open]);const y=p.useCallback(()=>{if(!t.skill)return;const v=g[d];!v||v.disabled||(s(v.action,t.skill),a())},[g,d,t.skill,s,a]);return p.useEffect(()=>{if(!t.open)return;function v(S){if(S.key==="Escape"){S.preventDefault(),a();return}if(S.key==="ArrowDown"){S.preventDefault(),h(k=>Math.min(k+1,Math.max(g.length-1,0)));return}if(S.key==="ArrowUp"){S.preventDefault(),h(k=>Math.max(k-1,0));return}if(S.key==="Enter"||S.key===" "){S.preventDefault(),y();return}}function b(S){c.current&&S.target instanceof Node&&(c.current.contains(S.target)||a())}return window.addEventListener("keydown",v,!0),window.addEventListener("mousedown",b,!0),()=>{window.removeEventListener("keydown",v,!0),window.removeEventListener("mousedown",b,!0)}},[t.open,a,g.length,y]),!t.open||!t.skill?null:r.jsx("div",{ref:c,role:"menu",tabIndex:-1,"data-testid":"context-menu",style:{position:"fixed",left:m.left,top:m.top,zIndex:70,minWidth:200,padding:4,background:"var(--bg-canvas)",border:"1px solid var(--border-default)",borderRadius:6,boxShadow:"0 12px 32px rgba(0,0,0,0.16)",fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)",outline:"none"},children:g.map((v,b)=>r.jsx("div",{role:"menuitem","aria-disabled":v.disabled||void 0,title:v.title||void 0,"data-action":v.action,"data-selected":b===d||void 0,onMouseEnter:()=>h(b),onClick:()=>{v.disabled||(s(v.action,t.skill),a())},style:{padding:"5px 10px",borderRadius:4,cursor:v.disabled?"default":"pointer",opacity:v.disabled?.5:1,background:b===d?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent"},children:v.label},v.action))})}function WN({open:t,title:a,body:s,confirmLabel:o="Confirm",cancelLabel:c="Cancel",variant:u="default",onConfirm:d,onCancel:h}){const g=p.useRef(null),m=p.useRef(null),y=p.useRef(null);if(p.useEffect(()=>{if(t)return y.current=document.activeElement??null,requestAnimationFrame(()=>{var k;(k=m.current)==null||k.focus()}),()=>{var k,w;(w=(k=y.current)==null?void 0:k.focus)==null||w.call(k),y.current=null}},[t]),p.useEffect(()=>{if(!t)return;function k(w){if(w.key==="Escape"){w.preventDefault(),h();return}if(w.key==="Tab"&&g.current){const E=g.current.querySelectorAll("button:not([disabled])");if(E.length===0)return;const T=E[0],N=E[E.length-1];w.shiftKey&&document.activeElement===T?(w.preventDefault(),N.focus()):!w.shiftKey&&document.activeElement===N&&(w.preventDefault(),T.focus())}}return window.addEventListener("keydown",k,!0),()=>window.removeEventListener("keydown",k,!0)},[t,h]),!t)return null;const v="confirm-dialog-title",b="confirm-dialog-body",S=u==="destructive"?{background:"var(--red, #d92d20)",color:"#fff",border:"1px solid var(--red, #d92d20)"}:{background:"var(--accent-surface)",color:"var(--text-primary)",border:"1px solid var(--border-default)"};return r.jsx("div",{"data-testid":"confirm-dialog-overlay",onMouseDown:k=>{k.target===k.currentTarget&&h()},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},children:r.jsxs("div",{ref:g,role:"alertdialog","aria-modal":"true","aria-labelledby":v,"aria-describedby":b,"data-testid":"confirm-dialog",style:{background:"var(--bg-canvas)",color:"var(--text-primary)",border:"1px solid var(--border-default)",borderRadius:8,padding:20,width:"min(440px, 92vw)",boxShadow:"0 20px 48px rgba(0,0,0,0.32)",fontFamily:"var(--font-sans)"},children:[r.jsx("h2",{id:v,style:{margin:0,fontSize:16,fontWeight:600,marginBottom:8},children:a}),r.jsx("p",{id:b,style:{margin:0,fontSize:13,color:"var(--text-secondary)",marginBottom:16,lineHeight:1.5},children:s}),r.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:[r.jsx("button",{ref:m,type:"button","data-testid":"confirm-dialog-cancel",onClick:h,style:{padding:"6px 14px",borderRadius:6,cursor:"pointer",background:"transparent",color:"var(--text-primary)",border:"1px solid var(--border-default)",fontSize:13},children:c}),r.jsx("button",{type:"button","data-testid":"confirm-dialog-confirm",onClick:d,style:{padding:"6px 14px",borderRadius:6,cursor:"pointer",fontSize:13,...S},children:o})]})]})})}function qN(t){const a=(typeof navigator<"u"?navigator.platform:"").toLowerCase();return a.includes("mac")?"system Trash":a.includes("win")?"Recycle Bin":"Trash"}const rv=t=>`${t.plugin}/${t.skill}`;function YN(t){const a=t==null?void 0:t.delayMs,s=t==null?void 0:t.onCommit,o=t==null?void 0:t.onFailure,c=p.useRef(s),u=p.useRef(o);c.current=s,u.current=o;const d=p.useRef(new Map),[,h]=p.useState(0),g=p.useCallback(()=>h(k=>k+1),[]),m=p.useCallback(async k=>{var w,E;try{await we.deleteSkill(k.skill.plugin,k.skill.skill),(w=c.current)==null||w.call(c,k.skill)}catch(T){(E=u.current)==null||E.call(u,k.skill,T)}finally{d.current.delete(rv(k.skill)),g()}},[g]),y=p.useCallback(k=>{const w=rv(k),E=d.current.get(w);E!=null&&E.timeoutId&&clearTimeout(E.timeoutId);const T={skill:k,timeoutId:null};T.timeoutId=setTimeout(()=>{T.timeoutId=null,m(T)},a),d.current.set(w,T),g()},[a,m,g]),v=p.useCallback(k=>{const w=d.current.get(k);w&&(w.timeoutId&&clearTimeout(w.timeoutId),d.current.delete(k),g())},[g]),b=p.useCallback(async()=>{const k=Array.from(d.current.values());for(const w of k)w.timeoutId&&(clearTimeout(w.timeoutId),w.timeoutId=null);await Promise.all(k.map(w=>m(w)))},[m]),S=p.useCallback(k=>d.current.has(k),[]);return p.useEffect(()=>{const k=()=>{b()};return window.addEventListener("beforeunload",k),()=>{window.removeEventListener("beforeunload",k)}},[b]),p.useEffect(()=>{const k=d.current;return()=>{for(const w of k.values())w.timeoutId&&clearTimeout(w.timeoutId);k.clear()}},[]),{enqueueDelete:y,cancelDelete:v,flushPending:b,isPending:S}}const KN={"anthropic-api":{name:ne.setupProviders.anthropic.name,description:ne.setupProviders.anthropic.description,envVars:ne.setupProviders.anthropic.envVars,keyUrl:ne.setupProviders.anthropic.keyUrl,learnMoreUrl:ne.setupProviders.anthropic.learnMoreUrl},openai:{name:ne.setupProviders.openai.name,description:ne.setupProviders.openai.description,envVars:ne.setupProviders.openai.envVars,keyUrl:ne.setupProviders.openai.keyUrl,learnMoreUrl:ne.setupProviders.openai.learnMoreUrl},openrouter:{name:ne.setupProviders.openrouter.name,description:ne.setupProviders.openrouter.description,envVars:ne.setupProviders.openrouter.envVars,keyUrl:ne.setupProviders.openrouter.keyUrl,learnMoreUrl:ne.setupProviders.openrouter.learnMoreUrl},gemini:{name:ne.setupProviders.gemini.name,description:ne.setupProviders.gemini.description,envVars:ne.setupProviders.gemini.envVars,keyUrl:ne.setupProviders.gemini.keyUrl,learnMoreUrl:ne.setupProviders.gemini.learnMoreUrl},ollama:{name:ne.setupProviders.ollama.name,description:ne.setupProviders.ollama.description,envVars:ne.setupProviders.ollama.envVars,install:[ne.setupProviders.ollama.installCmd],start:[ne.setupProviders.ollama.startCmd],pullExample:ne.setupProviders.ollama.pullExample,learnMoreUrl:ne.setupProviders.ollama.learnMoreUrl},"lm-studio":{name:ne.setupProviders.lmStudio.name,description:ne.setupProviders.lmStudio.description,envVars:ne.setupProviders.lmStudio.envVars,install:[ne.setupProviders.lmStudio.installCmd],start:[ne.setupProviders.lmStudio.startCmd],pullExample:ne.setupProviders.lmStudio.pullExample,learnMoreUrl:ne.setupProviders.lmStudio.learnMoreUrl},"claude-code":{name:ne.setupProviders.claudeCode.name,description:ne.setupProviders.claudeCode.description,envVars:[],notes:[ne.setupProviders.claudeCode.loginHint,ne.claudeCodeLabel.compactLabel],learnMoreUrl:ne.setupProviders.claudeCode.learnMoreUrl}};function XN(t){return t?KN[t]??null:null}function QN({open:t,providerKey:a,onClose:s}){const o=p.useRef(null);if(p.useEffect(()=>{if(!t)return;const d=h=>{h.key==="Escape"&&(h.preventDefault(),s())};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,s]),p.useEffect(()=>{if(!t)return;const d=o.current;if(!d)return;const h=d.querySelector("button, a[href], [tabindex]:not([tabindex='-1']), input, textarea, select");h==null||h.focus()},[t]),!t||typeof document>"u")return null;const c=XN(a),u=(c==null?void 0:c.name)??ne.setupDrawer.fallbackTitle;return Go.createPortal(r.jsxs(r.Fragment,{children:[r.jsx("div",{"data-testid":"setup-drawer-backdrop","aria-hidden":"true",onClick:s,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:99,animation:"vskillDrawerBackdropIn 120ms ease"}}),r.jsxs("div",{"data-testid":"setup-drawer",ref:o,role:"dialog","aria-modal":"true","aria-label":ne.setupDrawer.title(u),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:[r.jsx(ZN,{title:u,onClose:s}),r.jsx("div",{"data-testid":"setup-drawer-body",style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:c?r.jsx(JN,{content:c}):r.jsx(eT,{})}),r.jsx("style",{children:`@keyframes vskillDrawerIn {
|
|
91
|
+
`,rows:8,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{...aa,minHeight:"150px"}}):s.body.trim()?r.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:Zo(s.body)}}):r.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:r.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Start writing to see preview"})})]}),r.jsx(sN,{skillName:s.name||"{skill}",hasEvals:!1,isDraft:s.draftSaved}),s.error&&r.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:s.error}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("button",{onClick:s.handleCreate,disabled:s.creating||!s.name||!s.description,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:s.creating||!s.name||!s.description?"var(--surface-3)":"var(--accent)",color:s.creating||!s.name||!s.description?"var(--text-tertiary)":"#fff",cursor:s.creating||!s.name||!s.description?"not-allowed":"pointer",border:"none"},children:s.creating?"Creating...":"Create Skill"}),r.jsx("button",{onClick:a,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 oN(){return r.jsx("div",{className:"w-16 h-16 rounded-2xl flex items-center justify-center",style:{background:"var(--surface-2)"},children:r.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:[r.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"}),r.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),r.jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]})})}function _o({variant:t,message:a,onRetry:s}){const{setMode:o,setSearch:c}=er(),[u,d]=p.useState(!1);return t==="no-selection"?r.jsxs("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:[r.jsx("div",{className:"mb-5",children:u?r.jsx(oN,{}):r.jsx("img",{src:"/images/empty-studio.webp",width:128,height:128,alt:"",onError:()=>d(!0),style:{objectFit:"contain"}})}),r.jsx("p",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Select a skill to view details"}),r.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Choose a skill from the list to edit, test, and evaluate"})]}):t==="no-skills"?r.jsxs("div",{className:"text-center py-12 px-4 animate-fade-in-scale",children:[r.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mx-auto mb-4",style:{background:"var(--surface-2)"},children:r.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:r.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"})})}),r.jsx("p",{className:"text-[14px] font-medium",style:{color:"var(--text-secondary)"},children:"No skills found"}),r.jsxs("p",{className:"text-[12px] mt-1 mb-4",style:{color:"var(--text-tertiary)"},children:["Check your ",r.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"]}),r.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:[r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),r.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Create Your First Skill"]})]}):t==="error"?r.jsx("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:r.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:[r.jsx("p",{className:"text-[13px] mb-3",style:{color:"var(--red)"},children:a||"Failed to load skill data"}),s&&r.jsx("button",{onClick:s,className:"px-4 py-2 rounded-lg text-[12px] font-medium",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"none",cursor:"pointer"},children:"Retry"})]})}):r.jsxs("div",{className:"px-4 py-8 text-center animate-fade-in",children:[r.jsx("p",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"No skills match your search"}),r.jsx("button",{onClick:()=>c(""),className:"text-[12px] font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer",textDecoration:"underline"},children:"Clear search"})]})}function cN(t,a){const[s,o]=t.split(".").map(Number),[c,u]=a.split(".").map(Number);return c>s?"major":u>o?"minor":"patch"}const uN={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 qy(){const[t,a]=p.useState([]),[s,o]=p.useState(!0),[c,u]=p.useState(new Set),[d,h]=p.useState(new Map),[g,m]=p.useState(!1),[y,v]=p.useState(new Set),[b,S]=p.useState(new Map),[k,w]=p.useState(null),[C,T]=p.useState(null),[N,A]=p.useState(!1),_=p.useCallback(async()=>{o(!0);try{const $=await we.getSkillUpdates();a($.filter(q=>q.updateAvailable))}catch{a([])}finally{o(!1)}},[]);p.useEffect(()=>{_()},[_]);const D=p.useMemo(()=>t.filter($=>!$.pinned),[t]),F=p.useCallback($=>{u(q=>{const X=new Set(q);return X.has($)?X.delete($):X.add($),X})},[]),E=p.useCallback(()=>{c.size===D.length?u(new Set):u(new Set(D.map($=>$.name)))},[c,D]),B=p.useCallback(()=>{const $=[...c];if(!$.length)return;m(!0),h(new Map($.map(X=>[X,{skill:X,status:"pending"}])));const q=we.startBatchUpdate($);q.addEventListener("progress",X=>{try{const ee=JSON.parse(X.data);h(I=>new Map(I).set(ee.skill,ee))}catch{}}),q.addEventListener("done",X=>{q.close(),m(!1);try{const ee=JSON.parse(X.data);w(`Updated ${ee.updated??0} skills, ${ee.failed??0} failed`),setTimeout(()=>w(null),5e3)}catch{}_()}),q.addEventListener("error",()=>{q.close(),m(!1),w("Batch update failed"),setTimeout(()=>w(null),5e3)})},[c,_]),L=p.useCallback(async $=>{const q=$.name.split("/"),X=q.length>=3?q[q.length-2]:q[0],ee=q[q.length-1];v(I=>new Set(I).add($.name)),S(I=>{const z=new Map(I);return z.delete($.name),z});try{const I=await we.postSkillUpdate(X,ee);if(I.ok)_();else{const z=`Update failed (HTTP ${I.status}): ${I.body}`;S(O=>new Map(O).set($.name,z)),w(`Couldn't update ${ee} — HTTP ${I.status}`),setTimeout(()=>w(null),5e3)}}catch(I){const z=I instanceof Error?I.message:"Network error";S(O=>new Map(O).set($.name,z)),w(`Couldn't update ${ee} — ${z}`),setTimeout(()=>w(null),5e3)}finally{v(I=>{const z=new Set(I);return z.delete($.name),z})}},[_]),U=p.useCallback(async $=>{if(!$.latest)return;const q=$.name.split("/"),X=q.length>=3?q[q.length-2]:q[0],ee=q[q.length-1];A(!0);try{const I=await we.getVersionDiff(X,ee,$.installed,$.latest);T({skill:$,diff:I})}catch{T(null)}finally{A(!1)}},[]);return s?r.jsxs("div",{"data-testid":"updates-panel",className:"p-6",children:[r.jsx("div",{className:"skeleton h-6 w-48 mb-4"}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"skeleton h-16 rounded-lg"}),r.jsx("div",{className:"skeleton h-16 rounded-lg"})]})]}):t.length===0?r.jsxs("div",{"data-testid":"updates-panel",className:"flex flex-col items-center justify-center h-full py-16",children:[r.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:[r.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),r.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),r.jsx("div",{className:"text-[15px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"All skills are up to date"}),r.jsx("div",{className:"text-[12px] mb-4",style:{color:"var(--text-tertiary)"},children:"No updates available for installed skills."}),r.jsx("button",{onClick:_,className:"btn btn-secondary text-[12px]",children:"Refresh"})]}):r.jsxs("div",{"data-testid":"updates-panel",className:"p-6",children:[k&&r.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:k}),r.jsxs("div",{className:"flex items-center justify-between mb-5",children:[r.jsxs("div",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["Available Updates (",D.length,")"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{onClick:_,className:"btn btn-ghost text-[12px]",disabled:g,children:"Refresh"}),r.jsx("button",{onClick:B,disabled:c.size===0||g,className:"btn btn-primary text-[12px]",children:g?"Updating...":`Update Selected (${c.size})`})]})]}),r.jsx("div",{className:"flex items-center gap-2 mb-3",children:r.jsxs("button",{onClick:E,className:"flex items-center gap-2 text-[12px] font-medium",style:{color:"var(--text-secondary)",background:"transparent",border:"none",cursor:"pointer"},children:[r.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:c.size===D.length&&D.length>0?"var(--accent)":"var(--border-default)",background:c.size===D.length&&D.length>0?"var(--accent)":"transparent"},children:c.size===D.length&&D.length>0&&r.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})})}),"Select All"]})}),r.jsx("div",{className:"space-y-2",children:t.map($=>{const q=$.name.split("/").pop()||$.name,X=$.latest?cN($.installed,$.latest):"patch",ee=uN[X],I=!!$.pinned,z=y.has($.name),O=d.get($.name),P=c.has($.name);return r.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:I?.7:1},children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("button",{onClick:()=>!I&&F($.name),disabled:I,className:"flex-shrink-0",style:{background:"transparent",border:"none",cursor:I?"not-allowed":"pointer"},children:r.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:P?"var(--accent)":"var(--border-default)",background:P?"var(--accent)":"transparent",opacity:I?.4:1},children:P&&r.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})})})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[r.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:q}),I&&r.jsx("span",{className:"text-[10px]",title:"Pinned — unpin from CLI to update",children:"📌"}),r.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:ee.bg,color:ee.text},children:X})]}),r.jsxs("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[$.installed," → ",$.latest||"?",I&&` (pinned at ${$.pinnedVersion||$.installed})`]})]}),O&&r.jsxs("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:O.status==="done"?"var(--green-muted)":O.status==="error"?"var(--red-muted)":"var(--yellow-muted)",color:O.status==="done"?"var(--green)":O.status==="error"?"var(--red)":"var(--yellow)"},children:[O.status,O.error&&`: ${O.error}`]}),r.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[r.jsx("button",{onClick:()=>U($),className:"btn btn-ghost text-[11px]",disabled:N,children:"View Changes"}),r.jsx("button",{onClick:()=>L($),disabled:I||z||g,title:I?"Pinned — unpin from CLI to update":"",className:`btn ${I?"btn-ghost":"btn-primary"} text-[11px]`,children:z?r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx("span",{className:"spinner spinner-sm"})," Updating"]}):(O==null?void 0:O.status)==="done"?r.jsx("span",{style:{color:"var(--green)"},children:"✓"}):"Update"})]})]})},$.name)})}),C&&r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>T(null),children:r.jsxs("div",{style:{width:"80%",maxWidth:900},onClick:$=>$.stopPropagation(),children:[r.jsx("div",{className:"mb-2 flex justify-end",children:r.jsx("button",{onClick:()=>T(null),className:"btn btn-ghost text-[12px]",children:"Close"})}),r.jsx(Bf,{contentDiff:C.diff.contentDiff,fromLabel:C.diff.from,toLabel:C.diff.to,diffSummary:C.diff.diffSummary,renderContext:"inline"})]})})]})}const dN=Object.freeze(Object.defineProperty({__proto__:null,UpdatesPanel:qy},Symbol.toStringTag,{value:"Module"}));function fN(t){return t==null?"var(--text-tertiary)":t>=.7?"var(--green)":t>=.4?"var(--yellow)":"var(--red)"}function pN(t){return t==null?"var(--surface-3)":t>=.7?"var(--green-muted)":t>=.4?"var(--yellow-muted)":"var(--red-muted)"}function mN(t){if(!t||typeof t!="string")return null;const a=t.trim();if(!a)return null;if(!a.includes("://")){const[s]=a.split("/");return s&&/^[A-Za-z0-9][A-Za-z0-9-]{0,38}$/.test(s)?s:null}try{const s=new URL(a),o=s.hostname.toLowerCase();if(o!=="github.com"&&o!=="www.github.com"&&o!=="raw.githubusercontent.com")return null;const u=s.pathname.split("/").filter(Boolean)[0];return!u||!/^[A-Za-z0-9][A-Za-z0-9-]{0,38}$/.test(u)?null:u}catch{return null}}function Yy(t){const{author:a,repoUrl:s}=t,o=mN(s??null),c=a&&a.trim()!==""?a:o??"—",[u,d]=p.useState(!1),h=p.useCallback(async()=>{var g;try{await((g=navigator.clipboard)==null?void 0:g.writeText(c)),d(!0),setTimeout(()=>d(!1),1500)}catch{}},[c]);return o?r.jsx("a",{"data-testid":t["data-testid"]??"author-link",href:`https://github.com/${o}`,target:"_blank",rel:"noopener noreferrer",style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-accent, var(--text-primary))",textDecoration:"none",borderBottom:"1px dotted var(--border-default, var(--border))",whiteSpace:"nowrap"},children:c}):!a||a.trim()===""?r.jsx("span",{"data-testid":t["data-testid"]??"author-link-empty",style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)"},children:"—"}):r.jsxs("button",{type:"button","data-testid":t["data-testid"]??"author-copy",title:`Copy "${c}"`,onClick:h,style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 6px",border:"1px solid var(--border-default, var(--border))",borderRadius:4,background:"transparent",fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",cursor:"pointer",whiteSpace:"nowrap"},children:[c,r.jsx("span",{"aria-hidden":"true",style:{fontSize:10,opacity:.7},children:u?"✓":"⧉"})]})}function hN(t){let a=t.split("#")[0].split("?")[0].replace(/\/+$/,"");return a=a.replace(/\/(?:tree|blob)\/[^/]+(?:\/.*)?$/,""),a}function xN(t,a){const s=hN(t),o=(a??"").replace(/^\/+/,"").replace(/\/+$/,"");return o?`${s}/blob/HEAD/${o}`:`${s}/blob/HEAD/`}function nv(t){if(!t)return"source";const a=t.replace(/\/+$/,""),s=a.lastIndexOf("/");return s===-1?a:a.slice(s+1)}function Ky(t){const{repoUrl:a,skillPath:s,absolutePath:o}=t,[c,u]=p.useState(!1),d=typeof a=="string"&&a.trim()!==""&&/^https?:\/\//.test(a.trim()),h=s?nv(s):o?nv(o):"source",g=p.useCallback(async()=>{var v;const y=o??s??"";if(y)try{await((v=navigator.clipboard)==null?void 0:v.writeText(y)),u(!0),setTimeout(()=>u(!1),1500)}catch{}},[o,s]);if(d){const y=xN(a,s);return r.jsxs("a",{"data-testid":t["data-testid"]??"source-file-link",href:y,target:"_blank",rel:"noopener noreferrer",title:y,style:{display:"inline-flex",alignItems:"center",gap:4,fontFamily:"var(--font-mono, var(--font-geist-mono))",fontSize:12,color:"var(--text-accent, var(--text-primary))",textDecoration:"none",whiteSpace:"nowrap",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis"},children:[r.jsx("span",{children:h}),r.jsx("span",{"aria-hidden":"true",children:"↗"})]})}if(!o&&!s)return r.jsx("span",{"data-testid":t["data-testid"]??"source-file-empty",style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)"},children:"—"});const m=o??s??"";return r.jsxs("button",{type:"button","data-testid":t["data-testid"]??"source-file-copy",title:`Copy ${m}`,onClick:g,style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 6px",border:"1px solid var(--border-default, var(--border))",borderRadius:4,background:"transparent",fontFamily:"var(--font-mono, var(--font-geist-mono))",fontSize:12,color:"var(--text-secondary)",cursor:"pointer",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[r.jsx("span",{children:h}),r.jsx("span",{"aria-hidden":"true",style:{fontSize:10,opacity:.7},children:c?"✓":"⧉"})]})}function rv(t,a="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:t,severity:a}}))}function Xy(t){return t.skill?vN({skill:t.skill}):bN({state:t.state,isReadOnly:t.isReadOnly,onDelete:t.onDelete})}function gN(t,a=48){if(t.length<=a)return t;const s=t.slice(0,12),o=t.slice(t.length-(a-12-1));return`${s}…${o}`}function vN({skill:t}){const[a,s]=p.useState(!1),o=p.useCallback(async()=>{var d;try{await((d=navigator.clipboard)==null?void 0:d.writeText(t.dir)),s(!0),setTimeout(()=>s(!1),1500),rv(ne.toasts.pathCopied,"info")}catch{rv(ne.toasts.permissionDenied,"error")}},[t.dir]),c=t.origin==="installed"?"Project":"Skills",u=t.origin==="installed"?"var(--status-installed)":"var(--status-own)";return r.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:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",marginBottom:4},children:[r.jsx("span",{"data-testid":"detail-header-plugin",children:t.plugin}),r.jsx("span",{"aria-hidden":"true",style:{color:"var(--text-secondary)"},children:"›"}),r.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--text-secondary)",fontSize:11,letterSpacing:.3,textTransform:"uppercase"},children:[r.jsx("span",{"data-origin-dot":t.origin,"aria-label":`Origin: ${c}`,style:{display:"inline-block",width:7,height:7,borderRadius:999,background:u}}),c]})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,marginBottom:8},children:[r.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:t.skill}),r.jsx("span",{"data-testid":"detail-header-version",children:r.jsx(ri,{version:t.resolvedVersion??t.version??null,source:t.versionSource,pluginName:t.pluginName??null})})]}),r.jsxs("div",{"data-testid":"detail-header-byline",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:10,margin:"0 0 8px",fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)"},children:[r.jsx(Yy,{author:t.author??null,repoUrl:t.repoUrl??t.homepage??null}),r.jsx(Ky,{repoUrl:t.repoUrl??null,skillPath:t.skillPath??null,absolutePath:t.dir})]}),r.jsx(yN,{skill:t}),r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[r.jsx("button",{type:"button","data-testid":"detail-header-path-chip",title:t.dir,"aria-label":`Copy path ${t.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:gN(t.dir||"—")}),r.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:[r.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),r.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),a?"Copied":"Copy"]})]})]})}function yN({skill:t}){const a=t.installMethod,s=t.symlinkTarget;if(!a)return null;let o="";switch(a){case"symlinked":o=s?`Symlinked from ${s}`:"Symlinked (target unresolved)";break;case"copied":o="Copied (independent)";break;case"authored":o="Authored";break;default:return null}return r.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:[r.jsx("span",{style:{fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",fontSize:10,color:"var(--text-tertiary)"},children:"Install method"}),r.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:o})]})}function bN({state:t,isReadOnly:a,onDelete:s}){const{plugin:o,skill:c,evals:u,latestBenchmark:d,isDirty:h,caseRunStates:g,regressions:m,iterationCount:y}=t,v=Array.from(g.values()).some(T=>T.status==="running"||T.status==="queued"),b=d==null?void 0:d.overall_pass_rate,S=(u==null?void 0:u.evals.reduce((T,N)=>T+N.assertions.length,0))??0,k=(u==null?void 0:u.evals.length)??0,w=fN(b),C=pN(b);return r.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:[r.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[r.jsx("span",{style:{color:"var(--text-tertiary)"},children:o}),r.jsx(jN,{}),r.jsx("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:c}),a&&r.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:[r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),r.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"installed"]}),h&&r.jsx("span",{className:"ml-2 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded",style:{background:"var(--yellow-muted)",color:"var(--yellow)"},children:"unsaved"}),v&&r.jsxs("span",{className:"ml-2 flex items-center gap-1.5 text-[11px]",style:{color:"var(--accent)"},children:[r.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}}),"Running..."]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[!a&&s&&r.jsx("button",{disabled:v,onClick:()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:request-delete",{detail:{skill:{plugin:o,skill:c,dir:"",hasEvals:!1,hasBenchmark:!1,evalCount:0,assertionCount:0,benchmarkStatus:"missing",lastBenchmark:null,origin:"source"}}}))},title:"Delete skill",className:"flex items-center justify-center transition-colors duration-150",style:{background:"none",border:"none",cursor:v?"not-allowed":"pointer",color:"var(--text-tertiary)",padding:4,opacity:v?.4:1,borderRadius:4},onMouseEnter:T=>{v||(T.currentTarget.style.color="var(--red)")},onMouseLeave:T=>{T.currentTarget.style.color="var(--text-tertiary)"},children:r.jsx(SN,{})}),m.length>0&&r.jsxs("span",{className:"pill",style:{background:"var(--red-muted)",color:"var(--red)"},children:[r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[r.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"}),r.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),r.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),m.length," regression",m.length>1?"s":""]}),y>0&&r.jsxs("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)"},children:["Iter ",y]}),r.jsx("span",{className:"pill",style:{background:C,color:w},children:b!=null?`${Math.round(b*100)}%`:"--"}),r.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[k," case",k!==1?"s":""," / ",S," assert",S!==1?"s":""]})]})]})}function jN(){return r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",children:r.jsx("polyline",{points:"9 18 15 12 9 6"})})}function SN(){return r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("polyline",{points:"3 6 5 6 21 6"}),r.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"}),r.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),r.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}function la(t){const{title:a,label:s,value:o,subtitle:c,description:u,linkLabel:d,children:h,onClick:g}=t,m=a??s??"",y=typeof g=="function",v=b=>{y&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),g==null||g())};return r.jsxs("div",{className:y?"metric-card metric-card-link":"metric-card","data-testid":t["data-testid"],role:y?"button":void 0,tabIndex:y?0:void 0,onClick:y?()=>g==null?void 0:g():void 0,onKeyDown:y?v:void 0,style:{background:"var(--card-bg, var(--bg-surface))",border:"1px solid var(--border, var(--border-default))",borderRadius:6,padding:"1rem",display:"flex",flexDirection:"column",gap:"0.375rem",minWidth:0,height:"100%",cursor:y?"pointer":void 0,wordBreak:"break-word",overflowWrap:"anywhere"},children:[m?r.jsx("div",{"data-testid":t["data-testid"]?`${t["data-testid"]}-title`:void 0,style:{fontFamily:"var(--font-geist-mono, var(--font-mono))",fontSize:"0.5625rem",fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--card-text-muted, var(--text-secondary))"},children:m}):null,r.jsx("div",{"data-testid":t["data-testid"]?`${t["data-testid"]}-value`:void 0,style:{fontFamily:"var(--font-geist-mono, var(--font-mono))",fontSize:"1.375rem",fontWeight:700,color:"var(--card-text, var(--text-primary))",lineHeight:1,fontVariantNumeric:"tabular-nums"},children:String(o)}),c?r.jsx("div",{style:{fontFamily:"var(--font-geist-mono, var(--font-mono))",fontSize:"0.625rem",color:"var(--card-text-muted, var(--text-secondary))"},children:c}):null,u?r.jsx("div",{style:{fontFamily:"var(--font-geist-mono, var(--font-mono))",fontSize:"0.5625rem",color:"var(--card-text-muted, var(--text-secondary))",lineHeight:1.4,opacity:.7},children:u}):null,h?r.jsx("div",{style:{flex:1,marginTop:"0.25rem"},children:h}):null,d?r.jsx("div",{style:{marginTop:"auto",paddingTop:"0.375rem",borderTop:"1px solid var(--border, var(--border-default))",fontFamily:"var(--font-geist-mono, var(--font-mono))",fontSize:"0.625rem",color:"var(--card-text-muted, var(--text-secondary))"},children:d}):null]})}const kN="Benchmarks are the aggregated score of this skill's evals (evals.yaml) run against its tests (tests/). Each test case produces a verdict; the benchmark is the mean pass rate.";function wN(t){const{onNavigate:a}=t,[s,o]=p.useState(t.open??!1),c=p.useCallback(()=>o(!1),[]);p.useEffect(()=>{if(!s)return;const d=h=>{h.key==="Escape"&&c()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[s,c]);const u=p.useCallback(d=>{a==null||a(d),o(!1)},[a]);return r.jsxs("span",{"data-testid":t["data-testid"]??"benchmark-info",style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[r.jsx("button",{type:"button","data-testid":"benchmark-info-trigger","aria-label":"About benchmarks","aria-expanded":!!s,onClick:()=>o(d=>!d),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:18,height:18,padding:0,border:"1px solid var(--border-default, var(--border))",borderRadius:999,background:"transparent",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-sans)",cursor:"pointer",lineHeight:1},children:"ℹ"}),s&&r.jsxs("div",{role:"dialog","data-testid":"benchmark-info-popover",style:{position:"absolute",top:"100%",right:0,marginTop:6,zIndex:20,width:280,padding:"10px 12px",background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border))",borderRadius:6,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-primary)",boxShadow:"0 4px 16px rgba(0,0,0,0.08)"},children:[r.jsx("p",{style:{margin:"0 0 8px",lineHeight:1.45},children:kN}),r.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[r.jsx("button",{type:"button","data-testid":"benchmark-info-link-tests",onClick:()=>u("tests"),style:Vd,children:"Tests →"}),r.jsx("button",{type:"button","data-testid":"benchmark-info-link-run",onClick:()=>u("run"),style:Vd,children:"Run →"}),r.jsx("button",{type:"button","data-testid":"benchmark-info-close",onClick:c,style:{...Vd,marginLeft:"auto",color:"var(--text-secondary)"},children:"Close"})]})]})]})}const Vd={background:"transparent",border:"none",padding:0,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-accent, var(--text-primary))",cursor:"pointer",textDecoration:"underline"};function CN(t){if(t==null||!Number.isFinite(t))return"—";if(t<1024)return`${t} B`;const a=t/1024;if(a<1024)return a>=10?`${Math.round(a)} KB`:`${a.toFixed(1).replace(/\.0$/,"")} KB`;const s=a/1024;return s>=10?`${Math.round(s)} MB`:`${s.toFixed(1).replace(/\.0$/,"")} MB`}function Os(t){if(!t)return"—";const a=new Date(t);if(Number.isNaN(a.getTime()))return t;const s=Date.now()-a.getTime(),o=Math.floor(s/1e3);if(o<60)return"just now";const c=Math.floor(o/60);if(c<60)return`${c} min ago`;const u=Math.floor(c/60);if(u<24)return`${u} hr ago`;const d=Math.floor(u/24);if(d<30)return`${d} day${d===1?"":"s"} ago`;const h=Math.floor(d/30);if(h<12)return`${h} month${h===1?"":"s"} ago`;const g=Math.floor(h/12);return`${g} year${g===1?"":"s"} ago`}function EN(t){switch(t.benchmarkStatus){case"pass":case"fail":case"stale":return t.benchmarkStatus==="pass"?"100%":t.benchmarkStatus==="fail"?"0%":"—";default:return"—"}}function NN(t){const a=t.installMethod;if(!a)return null;const s=a==="authored"?"Authored":a==="copied"?"Copied":"Symlinked";return r.jsx("span",{"data-testid":"overview-install-method",style:{display:"inline-flex",alignItems:"center",padding:"1px 6px",border:"1px solid var(--border-default, var(--border))",borderRadius:4,fontFamily:"var(--font-mono, var(--font-geist-mono))",fontSize:10,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:.4},children:s})}function TN(t){var y,v;const{skill:a,onNavigate:s,activationsCount:o=0,lastRunIso:c=null,repoUrl:u,skillPathInRepo:d}=t,h=u??(RN(a.homepage)?a.homepage??null:null),g=((y=a.mcpDeps)==null?void 0:y.length)??0,m=((v=a.deps)==null?void 0:v.length)??0;return r.jsxs("div",{"data-testid":"skill-overview",className:"skill-overview",style:{display:"flex",flexDirection:"column",gap:12,padding:16},children:[r.jsxs("header",{"data-testid":"skill-overview-header",style:{position:"sticky",top:0,zIndex:5,display:"flex",flexDirection:"column",gap:6,padding:"10px 12px",background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border))",borderRadius:8},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap"},children:[r.jsx("h2",{"data-testid":"skill-overview-name",style:{fontFamily:"var(--font-serif, var(--font-sans))",fontSize:18,fontWeight:500,color:"var(--text-primary)",margin:0,lineHeight:1.2},children:a.skill}),r.jsx(ri,{version:a.resolvedVersion??a.version??null,source:a.versionSource,pluginName:a.pluginName??null}),NN(a)]}),r.jsxs("div",{"data-testid":"skill-overview-byline",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:10,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)"},children:[r.jsx(Yy,{author:a.author??null,repoUrl:h}),a.category?r.jsxs("span",{children:["· ",a.category]}):null,r.jsx(Ky,{repoUrl:h,skillPath:d??null,absolutePath:a.dir}),a.lastModified?r.jsxs("span",{title:a.lastModified,children:["· Updated ",Os(a.lastModified)]}):null]})]}),r.jsxs("div",{"data-testid":"skill-overview-grid",className:"skill-overview-grid",style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:"0.75rem",alignItems:"stretch"},children:[r.jsx(la,{title:"Benchmark",value:EN(a),subtitle:a.lastBenchmark?Os(a.lastBenchmark):"Never run","data-testid":"metric-benchmark",onClick:s?()=>s("run"):void 0,children:r.jsx("div",{style:{marginTop:4,display:"inline-flex",alignItems:"center"},children:r.jsx(wN,{onNavigate:s})})}),r.jsx(la,{title:"Tests",value:a.evalCount??0,subtitle:`${a.assertionCount??0} assertions`,"data-testid":"metric-tests",onClick:s?()=>s("tests"):void 0}),r.jsx(la,{title:"Activations",value:o,subtitle:c?`Last: ${Os(c)}`:"Never","data-testid":"metric-activations",onClick:s?()=>s("activation"):void 0}),r.jsx(la,{title:"Last run",value:Os(c??a.lastBenchmark??null),"data-testid":"metric-last-run",onClick:s?()=>s("history"):void 0}),r.jsx(la,{title:"MCP deps",value:g,subtitle:g>0&&a.mcpDeps?a.mcpDeps.slice(0,3).join(", "):"None","data-testid":"metric-mcp-deps",onClick:s?()=>s("deps"):void 0}),r.jsx(la,{title:"Skill deps",value:m,subtitle:m>0&&a.deps?a.deps.slice(0,3).join(", "):"None","data-testid":"metric-skill-deps",onClick:s?()=>s("deps"):void 0}),r.jsx(la,{title:"Size",value:CN(a.sizeBytes),"data-testid":"metric-size"}),r.jsx(la,{title:"Last modified",value:Os(a.lastModified),subtitle:a.lastModified??void 0,"data-testid":"metric-last-modified"})]})]})}function RN(t){return t?/^https?:\/\/(?:www\.)?(?:github\.com|raw\.githubusercontent\.com)\//.test(t):!1}function AN({skill:t}){const{onSkillUpdated:a}=er(),{toast:s}=Wo(),[o,c]=p.useState("idle"),[u,d]=p.useState(null),[h,g]=p.useState(!1),[m,y]=p.useState(null),[v,b]=p.useState(!1),S=p.useRef(null),k=p.useCallback(async()=>{if(!t||o==="updating")return;const N=new AbortController;S.current=N,c("updating"),d(null);try{const A=await we.postSkillUpdate(t.plugin,t.skill,N.signal);if(A.ok)c("done"),a(t.plugin,t.skill),s({message:`Updated ${t.skill}.`,severity:"success",durationMs:4e3});else{const _=`Update failed (HTTP ${A.status}): ${A.body}`;c("idle"),d(_),s({message:`Couldn't update ${t.skill} — HTTP ${A.status}`,severity:"error",durationMs:0,action:{label:"Retry",onInvoke:()=>{k()}}})}}catch(A){if(A instanceof DOMException&&A.name==="AbortError")return;const _=A instanceof Error?A.message:"Network error";c("idle"),d(_),s({message:`Couldn't update ${t.skill} — ${_}`,severity:"error",durationMs:0,action:{label:"Retry",onInvoke:()=>{k()}}})}finally{S.current===N&&(S.current=null)}},[t,o,a,s]);if(p.useEffect(()=>{if(!h||m!=null||!t||!t.latestVersion)return;let N=!1;return b(!0),we.getVersionDiff(t.plugin,t.skill,t.currentVersion??"",t.latestVersion).then(A=>{N||y(A)}).catch(()=>{N||y(null)}).finally(()=>{N||b(!1)}),()=>{N=!0}},[h,m,t==null?void 0:t.plugin,t==null?void 0:t.skill,t==null?void 0:t.latestVersion,t==null?void 0:t.currentVersion,t]),p.useEffect(()=>()=>{var N;(N=S.current)==null||N.abort()},[]),!t||t.updateAvailable!==!0)return null;const w=t.latestVersion,C=o==="updating"?"Updating…":w?`Update to ${w}`:"Update",T=o==="updating";return r.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:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[r.jsx("button",{type:"button","data-testid":"update-action-button",onClick:()=>{k()},disabled:T,style:{height:36,padding:"0 14px",background:"var(--color-ink)",color:"var(--color-paper)",border:"none",borderRadius:4,cursor:T?"not-allowed":"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500},children:C}),r.jsx("button",{type:"button","data-testid":"update-action-toggle-changelog",onClick:()=>g(N=>!N),disabled:T||!w,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"})]}),o==="updating"&&r.jsx("div",{"data-testid":"update-action-progress",role:"status",style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-muted, var(--text-secondary))"},children:"Updating…"}),u&&o!=="updating"&&r.jsx("div",{"data-testid":"update-action-error",role:"alert",style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--color-error, #d32f2f)"},children:u}),h&&w&&r.jsxs("div",{"data-testid":"update-action-changelog",style:{paddingTop:8},children:[v&&r.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Loading changelog…"}),!v&&m&&r.jsx(Bf,{contentDiff:m.contentDiff,fromLabel:m.from,toLabel:m.to,diffSummary:m.diffSummary??void 0,renderContext:"inline"}),!v&&!m&&r.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Couldn't load changelog."})]})]})}const MN=3e4;function LN({plugin:t,skill:a,trackedForUpdates:s=!0,discoveryBackedOff:o=!1}){const c=er(),[u,d]=p.useState(!1),[h,g]=p.useState(!1),[,m]=p.useState(0),y=p.useRef(null),v=p.useRef(null),b=`${t}/${a}`,S=c.updatesById.get(b);if(p.useEffect(()=>{if(!u)return;const w=setInterval(()=>m(C=>(C+1)%1e6),250);return()=>clearInterval(w)},[u]),p.useEffect(()=>{if(!u||!S)return;const w=v.current??0;S.receivedAt<w||(y.current&&(clearTimeout(y.current),y.current=null),d(!1),g(!1),v.current=null)},[u,S]),p.useEffect(()=>()=>{y.current&&clearTimeout(y.current)},[]),s===!1||o)return null;const k=async()=>{if(!u){g(!1),d(!0),v.current=Date.now(),y.current=setTimeout(()=>{d(!1),g(!0),y.current=null,v.current=null},MN);try{await we.rescanSkill(t,a)}catch{y.current&&(clearTimeout(y.current),y.current=null),d(!1),v.current=null}}};return r.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[r.jsx("button",{type:"button","data-testid":"check-now-button",onClick:k,disabled:u,style:{height:26,padding:"0 10px",background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:12,cursor:u?"not-allowed":"pointer"},children:"Check now"}),u&&r.jsx("span",{"data-testid":"check-now-spinner","aria-label":"Checking for updates",role:"status",style:{display:"inline-block",width:10,height:10,borderRadius:"50%",border:"2px solid var(--text-secondary)",borderTopColor:"transparent",animation:"check-now-spin 800ms linear infinite"}}),h&&r.jsx("span",{"data-testid":"check-now-no-changes",style:{fontSize:11,color:"var(--text-secondary)",fontFamily:"var(--font-sans)"},children:"No changes detected"})]})}const Qy=["overview","editor","tests","run","activation","history","leaderboard","deps","versions"],zN={overview:"Overview",editor:"Editor",tests:"Tests",run:"Run",activation:"Activation",history:"History",leaderboard:"Leaderboard",deps:"Deps",versions:"Versions"};function DN(t){return typeof t=="string"&&Qy.includes(t)}function _N(){if(typeof window>"u")return"overview";const a=new URLSearchParams(window.location.search).get("panel");return DN(a)?a:"overview"}function Pd(){const{state:t,setMobileView:a}=er();return t.isMobile?r.jsxs("button",{onClick:()=>a("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:[r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back to skills"]}):null}function ON(t={}){if(t.selectedSkillInfo!==void 0||t.loadError!==void 0)return BN(t);const{state:a,selectSkill:s,setMode:o,refreshSkills:c}=er(),[u,d]=p.useState(typeof window<"u"?window.location.hash:"");if(p.useEffect(()=>{const m=()=>d(window.location.hash);return window.addEventListener("hashchange",m),()=>window.removeEventListener("hashchange",m)},[]),u==="#/updates")return r.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[r.jsx(Pd,{}),r.jsx(qy,{})]});if(a.mode==="create")return r.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[r.jsx(Pd,{}),r.jsx(iN,{onCreated:(m,y)=>{o("browse"),c(),s({plugin:m,skill:y,origin:"source"})},onCancel:()=>o("browse")})]});if(!a.selectedSkill)return a.skillsError?r.jsx(_o,{variant:"error",message:a.skillsError,onRetry:c}):!a.skillsLoading&&a.skills.length===0?r.jsx(_o,{variant:"no-skills"}):r.jsx(_o,{variant:"no-selection"});const h=a.selectedSkill,g=a.skills.find(m=>m.plugin===h.plugin&&m.skill===h.skill)??null;return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsx(Pd,{}),r.jsx(IN,{skillInfo:g,allSkills:a.skills,onSelectSkill:m=>s(m)})]})}function BN(t){const a=t.selectedSkillInfo??null,s=t.activeDetailTab??"overview";if(a==null)return HN();if(t.loadError)return $N(a,t.loadError);const o=t.allSkills&&t.onSelectSkill?{allSkills:t.allSkills,onSelectSkill:t.onSelectSkill}:void 0;return Zy(a,s,t.onDetailTabChange,o)}function IN({skillInfo:t,allSkills:a,onSelectSkill:s}){const[o,c]=p.useState(_N());p.useEffect(()=>{if(typeof window>"u")return;const d=new URLSearchParams(window.location.search);o==="overview"?d.delete("panel"):d.set("panel",o);const h=d.toString(),g=`${window.location.pathname}${h?"?"+h:""}${window.location.hash}`;window.history.replaceState(null,"",g)},[o]);const u=p.useMemo(()=>t?Zy(t,o,c,{}):r.jsx(_o,{variant:"no-selection"}),[t,o,a,s]);return r.jsx("div",{className:"flex flex-col h-full",style:{background:"var(--bg-canvas)"},children:u})}function UN(t,a){return r.jsx("div",{role:"tablist","aria-label":"Detail sections","data-testid":"detail-tab-bar",style:{display:"flex",alignItems:"stretch",gap:4,borderBottom:"1px solid var(--border-default)",padding:"0 16px",background:"var(--bg-canvas)",overflowX:"auto"},children:Qy.map(s=>{const o=s===t;return r.jsx("button",{type:"button",role:"tab","aria-selected":o,tabIndex:o?0:-1,id:`detail-tab-${s}`,"aria-controls":`detail-panel-${s}`,"data-testid":`detail-tab-${s}`,onClick:()=>a==null?void 0:a(s),style:{background:"transparent",border:"none",borderBottom:o?"2px solid var(--text-primary)":"2px solid transparent",padding:"10px 8px",marginBottom:-1,fontFamily:"var(--font-sans)",fontSize:13,fontWeight:o?500:400,color:o?"var(--text-primary)":"var(--text-secondary)",cursor:"pointer",whiteSpace:"nowrap"},children:zN[s]},s)})})}function HN(){return r.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:32,background:"var(--bg-canvas)"},children:[r.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"}),r.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 $N(t,a){return r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:24,background:"var(--bg-canvas)",height:"100%"},children:[Xy({skill:t}),r.jsxs("section",{role:"alert",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px"},children:[r.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 ",t.skill]}),r.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:"0 0 12px",wordBreak:"break-word"},children:a})]})]})}function VN({active:t}){return t==="editor"?r.jsx(ZC,{}):t==="tests"?r.jsx(lE,{}):t==="run"?r.jsx(yE,{}):t==="activation"?r.jsx(kE,{}):t==="history"?r.jsx(UE,{}):t==="leaderboard"?r.jsx(QE,{}):t==="deps"?r.jsx(JE,{}):t==="versions"?r.jsx(bC,{}):null}function PN({active:t}){const{state:a,dispatch:s}=Rn();return p.useEffect(()=>{t!=="overview"&&a.activePanel!==t&&s({type:"SET_PANEL",panel:t})},[t,a.activePanel,s]),null}function Zy(t,a,s,o){const c=h=>{s==null||s(h)},u=r.jsx(TN,{skill:t,onNavigate:c,repoUrl:t.homepage??null}),d=o!=null?r.jsxs(cC,{plugin:t.plugin,skill:t.skill,origin:t.origin,children:[r.jsx(PN,{active:a}),r.jsx(VN,{active:a})]},`${t.plugin}/${t.skill}`):r.jsxs("div",{style:{padding:16,fontFamily:"var(--font-sans)",color:"var(--text-secondary)",fontSize:13},children:["Select a skill from the sidebar to load its ",a," view."]});return r.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--bg-canvas)"},children:[r.jsx("div",{style:{padding:16,paddingBottom:12},children:Xy({skill:t})}),r.jsx(AN,{skill:t}),t.origin==="installed"&&r.jsxs("div",{"data-testid":"read-only-banner",style:{display:"flex",alignItems:"center",gap:8,padding:"8px 16px",background:"var(--surface-2)",color:"var(--text-secondary)",borderBottom:"1px solid var(--border-subtle)",fontFamily:"var(--font-sans)",fontSize:12},children:[r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,color:"var(--text-tertiary)"},children:[r.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),r.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),r.jsx("span",{children:"This is an installed copy of the skill. Editing, generating tests, and running evals are disabled. Open the source skill to make changes."})]}),t.origin==="installed"&&r.jsx("div",{style:{padding:"8px 16px",borderBottom:"1px solid var(--border-default)"},children:r.jsx(LN,{plugin:t.plugin,skill:t.skill,trackedForUpdates:t.trackedForUpdates})}),UN(a,s),r.jsx("div",{role:"tabpanel",id:`detail-panel-${a}`,"aria-labelledby":`detail-tab-${a}`,"data-testid":`detail-panel-${a}`,style:{flex:1,minHeight:0,overflow:"auto"},children:a==="overview"?u:d})]})}function FN(){const{updateCount:t,state:a,dismissUpdateNotification:s}=er(),o=t>0&&!a.updateNotificationDismissed;return p.useEffect(()=>{if(!o)return;const c=setTimeout(()=>s(),1e4);return()=>clearTimeout(c)},[o,s]),o?r.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:[r.jsxs("span",{children:[t," update",t===1?"":"s"," available"]}),r.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"}),r.jsx("button",{onClick:s,className:"text-[14px] leading-none",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",padding:"0 2px"},"aria-label":"Dismiss",children:"✕"})]}):null}const GN=[{name:ne.shortcuts.groupNavigation,items:[{keys:"/",label:ne.shortcuts.search},{keys:"j",label:ne.shortcuts.moveDown},{keys:"k",label:ne.shortcuts.moveUp},{keys:"Enter",label:ne.shortcuts.openSelected},{keys:"Esc",label:"Close / clear"}]},{name:ne.shortcuts.groupActions,items:[{keys:"⌘K",label:ne.shortcuts.openPalette},{keys:"?",label:ne.shortcuts.openShortcuts},{keys:"⌘B",label:ne.shortcuts.toggleSidebar},{keys:"E",label:ne.actions.edit}]},{name:ne.shortcuts.groupTheme,items:[{keys:"⌘⇧D",label:ne.shortcuts.toggleTheme}]}];function WN({open:t,onClose:a,groups:s=GN,title:o=ne.shortcuts.title}){const c=p.useRef(null),u=p.useRef(null);return p.useEffect(()=>{var d;if(t)return c.current=document.activeElement??null,(d=u.current)==null||d.focus(),()=>{var h,g;(g=(h=c.current)==null?void 0:h.focus)==null||g.call(h),c.current=null}},[t]),p.useEffect(()=>{if(!t)return;function d(h){var g;if(h.key==="Escape"){h.preventDefault(),a();return}h.key==="Tab"&&(h.preventDefault(),(g=u.current)==null||g.focus())}return window.addEventListener("keydown",d,!0),()=>window.removeEventListener("keydown",d,!0)},[t,a]),t?r.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:d=>{d.target===d.currentTarget&&a()},children:r.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:[r.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[r.jsx("h2",{id:"shortcut-modal-title",style:{margin:0,fontFamily:"var(--font-serif)",fontWeight:500,fontSize:18},children:o}),r.jsx("button",{ref:u,type:"button","aria-label":"Close",onClick:a,style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"2px 8px",color:"var(--text-secondary)",cursor:"pointer",fontSize:13},children:"Esc"})]}),s.map(d=>r.jsxs("section",{style:{marginBottom:12},children:[r.jsx("h3",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--text-secondary)",margin:"0 0 6px"},children:d.name}),r.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:d.items.map(h=>r.jsxs("li",{style:{display:"flex",justifyContent:"space-between",padding:"4px 0",borderTop:"1px solid var(--border-default)",fontSize:13},children:[r.jsx("span",{children:h.label}),r.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})]},`${d.name}:${h.keys}`))})]},d.name))]})}):null}function qN(t){const a=ne.actions,s=[{action:"open",label:a.open},{action:"copy-path",label:a.copyPath},{action:"reveal",label:a.revealInEditor},{action:"run-benchmark",label:a.runBenchmark}];if(t.origin==="source")return[...s,{action:"edit",label:a.edit},{action:"duplicate",label:a.duplicate},{action:"delete",label:a.delete}];const o=[...s];return t.updateAvailable&&o.push({action:"update",label:a.update}),o.push({action:"uninstall",label:a.uninstall}),o.push({action:"delete",label:a.delete,disabled:!0,title:a.deletePluginTooltip}),o}function YN({state:t,onClose:a,onAction:s,itemsOverride:o}){const c=p.useRef(null),u=p.useRef(null),[d,h]=p.useState(0),g=p.useMemo(()=>t.skill?o??qN(t.skill):[],[t.skill,o]),m=p.useMemo(()=>{if(typeof window>"u")return{left:t.x,top:t.y};const v=8,b=220,S=44+g.length*28;let k=t.x,w=t.y;return k+b+v>window.innerWidth&&(k=Math.max(v,t.x-b)),w+S+v>window.innerHeight&&(w=Math.max(v,t.y-S)),{left:k,top:w}},[t.x,t.y,g.length]);p.useEffect(()=>{if(t.open)return u.current=document.activeElement??null,h(0),requestAnimationFrame(()=>{var v;(v=c.current)==null||v.focus()}),()=>{var v,b;(b=(v=u.current)==null?void 0:v.focus)==null||b.call(v),u.current=null}},[t.open]);const y=p.useCallback(()=>{if(!t.skill)return;const v=g[d];!v||v.disabled||(s(v.action,t.skill),a())},[g,d,t.skill,s,a]);return p.useEffect(()=>{if(!t.open)return;function v(S){if(S.key==="Escape"){S.preventDefault(),a();return}if(S.key==="ArrowDown"){S.preventDefault(),h(k=>Math.min(k+1,Math.max(g.length-1,0)));return}if(S.key==="ArrowUp"){S.preventDefault(),h(k=>Math.max(k-1,0));return}if(S.key==="Enter"||S.key===" "){S.preventDefault(),y();return}}function b(S){c.current&&S.target instanceof Node&&(c.current.contains(S.target)||a())}return window.addEventListener("keydown",v,!0),window.addEventListener("mousedown",b,!0),()=>{window.removeEventListener("keydown",v,!0),window.removeEventListener("mousedown",b,!0)}},[t.open,a,g.length,y]),!t.open||!t.skill?null:r.jsx("div",{ref:c,role:"menu",tabIndex:-1,"data-testid":"context-menu",style:{position:"fixed",left:m.left,top:m.top,zIndex:70,minWidth:200,padding:4,background:"var(--bg-canvas)",border:"1px solid var(--border-default)",borderRadius:6,boxShadow:"0 12px 32px rgba(0,0,0,0.16)",fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)",outline:"none"},children:g.map((v,b)=>r.jsx("div",{role:"menuitem","aria-disabled":v.disabled||void 0,title:v.title||void 0,"data-action":v.action,"data-selected":b===d||void 0,onMouseEnter:()=>h(b),onClick:()=>{v.disabled||(s(v.action,t.skill),a())},style:{padding:"5px 10px",borderRadius:4,cursor:v.disabled?"default":"pointer",opacity:v.disabled?.5:1,background:b===d?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent"},children:v.label},v.action))})}const av=t=>`${t.plugin}/${t.skill}`;function KN(t){const a=t==null?void 0:t.delayMs,s=t==null?void 0:t.onCommit,o=t==null?void 0:t.onFailure,c=p.useRef(s),u=p.useRef(o);c.current=s,u.current=o;const d=p.useRef(new Map),[,h]=p.useState(0),g=p.useCallback(()=>h(k=>k+1),[]),m=p.useCallback(async k=>{var w,C;try{await we.deleteSkill(k.skill.plugin,k.skill.skill),(w=c.current)==null||w.call(c,k.skill)}catch(T){(C=u.current)==null||C.call(u,k.skill,T)}finally{d.current.delete(av(k.skill)),g()}},[g]),y=p.useCallback(k=>{const w=av(k),C=d.current.get(w);C!=null&&C.timeoutId&&clearTimeout(C.timeoutId);const T={skill:k,timeoutId:null};T.timeoutId=setTimeout(()=>{T.timeoutId=null,m(T)},a),d.current.set(w,T),g()},[a,m,g]),v=p.useCallback(k=>{const w=d.current.get(k);w&&(w.timeoutId&&clearTimeout(w.timeoutId),d.current.delete(k),g())},[g]),b=p.useCallback(async()=>{const k=Array.from(d.current.values());for(const w of k)w.timeoutId&&(clearTimeout(w.timeoutId),w.timeoutId=null);await Promise.all(k.map(w=>m(w)))},[m]),S=p.useCallback(k=>d.current.has(k),[]);return p.useEffect(()=>{const k=()=>{b()};return window.addEventListener("beforeunload",k),()=>{window.removeEventListener("beforeunload",k)}},[b]),p.useEffect(()=>{const k=d.current;return()=>{for(const w of k.values())w.timeoutId&&clearTimeout(w.timeoutId);k.clear()}},[]),{enqueueDelete:y,cancelDelete:v,flushPending:b,isPending:S}}const XN={"anthropic-api":{name:ne.setupProviders.anthropic.name,description:ne.setupProviders.anthropic.description,envVars:ne.setupProviders.anthropic.envVars,keyUrl:ne.setupProviders.anthropic.keyUrl,learnMoreUrl:ne.setupProviders.anthropic.learnMoreUrl},openai:{name:ne.setupProviders.openai.name,description:ne.setupProviders.openai.description,envVars:ne.setupProviders.openai.envVars,keyUrl:ne.setupProviders.openai.keyUrl,learnMoreUrl:ne.setupProviders.openai.learnMoreUrl},openrouter:{name:ne.setupProviders.openrouter.name,description:ne.setupProviders.openrouter.description,envVars:ne.setupProviders.openrouter.envVars,keyUrl:ne.setupProviders.openrouter.keyUrl,learnMoreUrl:ne.setupProviders.openrouter.learnMoreUrl},gemini:{name:ne.setupProviders.gemini.name,description:ne.setupProviders.gemini.description,envVars:ne.setupProviders.gemini.envVars,keyUrl:ne.setupProviders.gemini.keyUrl,learnMoreUrl:ne.setupProviders.gemini.learnMoreUrl},ollama:{name:ne.setupProviders.ollama.name,description:ne.setupProviders.ollama.description,envVars:ne.setupProviders.ollama.envVars,install:[ne.setupProviders.ollama.installCmd],start:[ne.setupProviders.ollama.startCmd],pullExample:ne.setupProviders.ollama.pullExample,learnMoreUrl:ne.setupProviders.ollama.learnMoreUrl},"lm-studio":{name:ne.setupProviders.lmStudio.name,description:ne.setupProviders.lmStudio.description,envVars:ne.setupProviders.lmStudio.envVars,install:[ne.setupProviders.lmStudio.installCmd],start:[ne.setupProviders.lmStudio.startCmd],pullExample:ne.setupProviders.lmStudio.pullExample,learnMoreUrl:ne.setupProviders.lmStudio.learnMoreUrl},"claude-code":{name:ne.setupProviders.claudeCode.name,description:ne.setupProviders.claudeCode.description,envVars:[],notes:[ne.setupProviders.claudeCode.loginHint,ne.claudeCodeLabel.compactLabel],learnMoreUrl:ne.setupProviders.claudeCode.learnMoreUrl}};function QN(t){return t?XN[t]??null:null}function ZN({open:t,providerKey:a,onClose:s}){const o=p.useRef(null);if(p.useEffect(()=>{if(!t)return;const d=h=>{h.key==="Escape"&&(h.preventDefault(),s())};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,s]),p.useEffect(()=>{if(!t)return;const d=o.current;if(!d)return;const h=d.querySelector("button, a[href], [tabindex]:not([tabindex='-1']), input, textarea, select");h==null||h.focus()},[t]),!t||typeof document>"u")return null;const c=QN(a),u=(c==null?void 0:c.name)??ne.setupDrawer.fallbackTitle;return Go.createPortal(r.jsxs(r.Fragment,{children:[r.jsx("div",{"data-testid":"setup-drawer-backdrop","aria-hidden":"true",onClick:s,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:99,animation:"vskillDrawerBackdropIn 120ms ease"}}),r.jsxs("div",{"data-testid":"setup-drawer",ref:o,role:"dialog","aria-modal":"true","aria-label":ne.setupDrawer.title(u),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:[r.jsx(JN,{title:u,onClose:s}),r.jsx("div",{"data-testid":"setup-drawer-body",style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:c?r.jsx(eT,{content:c}):r.jsx(tT,{})}),r.jsx("style",{children:`@keyframes vskillDrawerIn {
|
|
92
92
|
from { transform: translateX(100%); }
|
|
93
93
|
to { transform: translateX(0); }
|
|
94
94
|
}
|
|
95
95
|
@keyframes vskillDrawerBackdropIn {
|
|
96
96
|
from { opacity: 0; }
|
|
97
97
|
to { opacity: 1; }
|
|
98
|
-
}`})]})]}),document.body)}function
|
|
98
|
+
}`})]})]}),document.body)}function JN({title:t,onClose:a}){return r.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 20px",borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:[r.jsx("h2",{style:{fontFamily:"var(--font-serif)",fontSize:18,fontWeight:500,margin:0,color:"var(--text-primary)"},children:ne.setupDrawer.title(t)}),r.jsx("button",{type:"button","data-testid":"setup-drawer-close",onClick:a,"aria-label":ne.setupDrawer.close,style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:18,padding:4,lineHeight:1},children:"×"})]})}function eT({content:t}){var a,s;return r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[r.jsx("p",{style:{fontSize:14,lineHeight:1.5,color:"var(--text-primary)",margin:0},children:t.description}),t.notes&&t.notes.length>0&&r.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:6},children:t.notes.map(o=>r.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))}),t.envVars.length>0&&r.jsxs("section",{children:[r.jsx("h3",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",margin:"0 0 8px"},children:ne.setupDrawer.requiredEnv}),r.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:6},children:t.envVars.map(o=>r.jsx("li",{children:r.jsx(nT,{name:o})},o))})]}),t.keyUrl&&r.jsx(rT,{href:t.keyUrl,label:ne.setupDrawer.getKey,testId:"setup-drawer-get-key"}),(t.install||t.start||t.pullExample)&&r.jsxs("section",{children:[r.jsx("h3",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",margin:"0 0 8px"},children:ne.setupDrawer.installRun}),r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(a=t.install)==null?void 0:a.map((o,c)=>r.jsx(Fd,{code:o},`install-${c}`)),(s=t.start)==null?void 0:s.map((o,c)=>r.jsx(Fd,{code:o},`start-${c}`)),t.pullExample&&r.jsx(Fd,{code:t.pullExample})]})]}),r.jsx("footer",{style:{marginTop:8},children:r.jsxs("a",{href:t.learnMoreUrl,target:"_blank",rel:"noopener noreferrer","data-testid":"setup-drawer-learn-more",style:{fontSize:12,color:"var(--color-accent, var(--accent-surface))",textDecoration:"none"},children:[ne.setupDrawer.learnMore," →"]})})]})}function tT(){return r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[r.jsx("h3",{style:{margin:0,fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:ne.setupDrawer.fallbackTitle}),r.jsx("p",{style:{margin:0,fontSize:13,color:"var(--text-secondary)",lineHeight:1.5},children:ne.setupDrawer.fallbackBody})]})}function nT({name:t}){const a=async()=>{var s;try{await((s=navigator.clipboard)==null?void 0:s.writeText(t))}catch{}};return r.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:[r.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",flex:1},children:t}),r.jsx("button",{type:"button",onClick:a,"aria-label":`Copy ${t} to clipboard`,style:{background:"transparent",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:3,padding:"2px 8px",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-sans)",cursor:"pointer"},children:ne.setupDrawer.copy})]})}function Fd({code:t}){return r.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:t})}function rT({href:t,label:a,testId:s}){return r.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer","data-testid":s,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6,padding:"8px 14px",borderRadius:6,border:"1px solid var(--border-default, var(--border-subtle))",background:"color-mix(in srgb, var(--accent-surface) 12%, transparent)",color:"var(--text-primary)",textDecoration:"none",fontSize:13,fontWeight:500,fontFamily:"var(--font-sans)",width:"fit-content"},children:[a," →"]})}function aT(){const[t,a]=p.useState(!1),[s,o]=p.useState(null),c=p.useRef(null),u=p.useCallback((h,g)=>{var m;c.current=typeof document<"u"?document.activeElement:null,(m=g==null?void 0:g.beforeOpen)==null||m.call(g),o(h),a(!0)},[]),d=p.useCallback(()=>{a(!1);const h=c.current;h&&"focus"in h&&typeof h.focus=="function"&&queueMicrotask(()=>h.focus())},[]);return p.useMemo(()=>({open:u,close:d,isOpen:t,providerKey:s}),[u,d,t,s])}function lT(t){const a=[],s=[],o=new Set;for(const c of t){if(c.presence==="absent"||c.health==="missing"){s.push({kind:"individual",key:c.id,agent:c});continue}if(c.sharedFolderGroup&&c.sharedFolderGroup.length>1){const u=[...c.sharedFolderGroup].sort().join("+");if(o.has(u))continue;o.add(u);const d=t.filter(h=>c.sharedFolderGroup.includes(h.id));a.push({kind:"aggregate",key:`shared:${u}`,consumers:d,sharedFolderPath:c.sharedFolderPath??"~/.config/agents/skills",combinedCount:d.reduce((h,g)=>h+g.globalCount,0)});continue}a.push({kind:"individual",key:c.id,agent:c})}return{detected:a,notDetected:s}}function sT({agents:t,activeAgentId:a,focusedAgentId:s,onFocusAgent:o,onSwitch:c,onOpenSetup:u,onClose:d}){const h=p.useRef(null);p.useEffect(()=>{const y=v=>{v.key==="Escape"&&(v.preventDefault(),d())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[d]),p.useEffect(()=>{const y=b=>{h.current&&!h.current.contains(b.target)&&d()},v=setTimeout(()=>{document.addEventListener("mousedown",y)},0);return()=>{clearTimeout(v),document.removeEventListener("mousedown",y)}},[d]);const g=p.useMemo(()=>lT(t),[t]),m=t.find(y=>y.id===s)??t.find(y=>y.id===a)??t[0];return typeof document>"u"?null:Go.createPortal(r.jsxs("div",{ref:h,"data-testid":"agent-scope-picker-popover",role:"dialog","aria-label":ne.scopePicker.popoverTitle,style:{position:"fixed",top:96,left:"50%",transform:"translateX(-50%)",width:600,maxWidth:"calc(100vw - 32px)",background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,boxShadow:"0 18px 40px rgba(0,0,0,0.25)",overflow:"hidden",zIndex:90,animation:"scopePickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[r.jsxs("div",{style:{display:"flex",height:360,maxHeight:"60vh"},children:[r.jsxs("section",{"data-testid":"agent-scope-picker-agents",style:{width:260,borderRight:"1px solid var(--border-default, var(--border-subtle))",overflowY:"auto",padding:"6px 0"},children:[g.detected.length===0&&g.notDetected.length===0&&r.jsx(lv,{}),g.detected.map(y=>y.kind==="aggregate"?r.jsx(oT,{row:y,onFocus:()=>{var v;return o(((v=y.consumers[0])==null?void 0:v.id)??a??"")}},y.key):r.jsx(iT,{agent:y.agent,focused:y.agent.id===s,active:y.agent.id===a,onClick:()=>o(y.agent.id)},y.key)),g.notDetected.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{"data-testid":"agent-scope-not-detected-subheading",title:"These agents were not found on this machine. Hover a row to see which folder detection looked for.",style:{padding:"10px 14px 4px",fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-tertiary)"},children:ne.scopePicker.notDetectedSubheading}),g.notDetected.map(y=>r.jsx(cT,{agent:y.agent},y.key))]})]}),r.jsx("section",{"data-testid":"agent-scope-picker-stats",style:{flex:1,overflowY:"auto",padding:"14px 16px"},children:m?r.jsx(uT,{agent:m,activeAgentId:a,onSwitch:()=>c(m.id)}):r.jsx(lv,{})})]}),r.jsx("style",{children:`@keyframes scopePickerFadeIn {
|
|
99
99
|
from { opacity: 0; transform: translateX(-50%) translateY(2px); }
|
|
100
100
|
to { opacity: 1; transform: translateX(-50%) translateY(0); }
|
|
101
|
-
}`})]}),document.body)}function sT({agent:t,focused:a,active:s,onClick:o}){const c=t.health==="ok"?"var(--color-ok, #22c55e)":t.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)";return r.jsxs("button",{type:"button","data-testid":"agent-scope-row","data-agent-id":t.id,"data-active":s?"true":"false",onClick:o,style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 14px",background:a?"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:[r.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:c,flexShrink:0}}),r.jsx("span",{style:{flex:1,fontSize:13},children:t.displayName}),r.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[t.installedCount,"·",t.globalCount]})]})}function iT({row:t,onFocus:a}){return r.jsxs("button",{type:"button","data-testid":"agent-scope-shared-folder-row",onClick:a,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:[r.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)"},children:t.sharedFolderPath}),r.jsxs("span",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[t.consumers.map(s=>r.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:10,background:"color-mix(in srgb, var(--color-global) 20%, transparent)",color:"var(--text-primary)"},children:s.id},s.id)),r.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontFamily:"var(--font-mono)"},children:["· ",t.combinedCount," skills"]})]})]})}function oT({agent:t}){const a=t.isRemoteOnly?`${t.displayName} is a web-only product — no local CLI or folder to detect.`:t.resolvedGlobalDir?`Looked for ${t.resolvedGlobalDir} — not found.`:`${t.displayName} was not found on this machine.`;return r.jsxs("div",{"data-testid":`agent-scope-not-detected-row-${t.id}`,title:a,style:{display:"flex",alignItems:"center",gap:10,padding:"6px 14px",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:12},children:[r.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--text-tertiary)",flexShrink:0}}),r.jsx("span",{style:{flex:1},children:t.displayName}),t.isRemoteOnly&&r.jsx("span",{"data-testid":`agent-scope-remote-badge-${t.id}`,"aria-label":"Remote-only agent",title:"Web-only agent — no local CLI to install skills into. Use the agent's web UI to load skills.",style:{background:"color-mix(in srgb, var(--text-tertiary) 18%, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:10,padding:"1px 8px",color:"var(--text-secondary)",fontSize:10,letterSpacing:"0.04em",textTransform:"uppercase"},children:"Remote"})]})}function cT({agent:t,activeAgentId:a,onSwitch:s}){const o=t.id===a,c=t.isRemoteOnly===!0,u=o||c,d=o?"Active":c?"Remote-only":ne.scopePicker.switchCta;return r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[r.jsxs("div",{children:[r.jsx("div",{style:{fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:t.displayName}),r.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:2},children:c?"Remote service — no local install":dT(t.health)})]}),r.jsxs("dl",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"4px 12px",margin:0,fontSize:12},children:[r.jsx(Fd,{label:ne.scopePicker.statsInstalled,value:String(t.installedCount)}),r.jsx(Fd,{label:ne.scopePicker.statsGlobal,value:String(t.globalCount)}),r.jsx(Fd,{label:ne.scopePicker.statsLastSync,value:t.lastSync?uT(t.lastSync):"—"})]}),r.jsx("button",{type:"button","data-testid":"agent-scope-switch",onClick:s,disabled:u,title:c?"This agent has no local CLI to switch to":void 0,style:{alignSelf:"flex-start",padding:"8px 14px",borderRadius:6,border:"1px solid var(--border-default, var(--border-subtle))",background:u?"transparent":"color-mix(in srgb, var(--accent-surface) 20%, transparent)",color:"var(--text-primary)",fontSize:12,fontWeight:500,fontFamily:"var(--font-sans)",cursor:u?"default":"pointer",opacity:u?.5:1},children:d})]})}function Fd({label:t,value:a}){return r.jsxs(r.Fragment,{children:[r.jsx("dt",{style:{color:"var(--text-secondary)",margin:0},children:t}),r.jsx("dd",{style:{color:"var(--text-primary)",margin:0,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums"},children:a})]})}function av(){return r.jsx("div",{style:{padding:"16px 18px",fontSize:12,color:"var(--text-secondary)"},children:"No agents detected yet."})}function uT(t){try{const a=new Date(t).getTime(),s=Date.now()-a;if(Number.isNaN(a))return"—";const o=Math.round(s/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const c=Math.round(o/60);return c<24?`${c}h ago`:`${Math.round(c/24)}d ago`}catch{return"—"}}function dT(t){switch(t){case"ok":return ne.scopePicker.statsHealthOk;case"stale":return ne.scopePicker.statsHealthStale;case"missing":return ne.scopePicker.statsHealthMissing}}function fT(t){const a=new Map;for(const s of t.sharedFolders??[])for(const o of s.consumers)a.set(o,s);return t.agents.map(s=>{const o=a.get(s.id);return{id:s.id,displayName:s.displayName,presence:s.detected?"detected":"absent",installedCount:s.localSkillCount,globalCount:s.globalSkillCount,lastSync:s.lastSync,health:s.health,sharedFolderGroup:o?o.consumers:void 0,sharedFolderPath:o?o.path:void 0,isRemoteOnly:s.isRemoteOnly,resolvedGlobalDir:s.resolvedGlobalDir}})}function pT({agents:t,activeAgentId:a,onActiveAgentChange:s,onOpenSetup:o}){const[c,u]=p.useState(!1),[d,h]=p.useState(null),g=p.useRef(null),m=p.useMemo(()=>t.find(S=>S.id===a)??t[0]??null,[t,a]),y=p.useMemo(()=>m?m.health==="ok"?"var(--color-ok, #22c55e)":m.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)":"var(--text-tertiary)",[m]),v=p.useCallback(()=>{var S;u(!1),(S=g.current)==null||S.focus()},[]),b=p.useCallback(S=>{s(S),u(!1)},[s]);return r.jsxs(r.Fragment,{children:[r.jsxs("button",{ref:g,type:"button","data-testid":"agent-scope-picker-trigger","aria-haspopup":"dialog","aria-expanded":c,onClick:()=>u(S=>!S),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),u(!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:[r.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:y,flexShrink:0}}),r.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(m==null?void 0:m.displayName)??"Select agent"}),r.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:["(",(m==null?void 0:m.installedCount)??0," · ",(m==null?void 0:m.globalCount)??0,")"]}),r.jsx("span",{"aria-hidden":"true",style:{fontSize:10,color:"var(--text-secondary)"},children:"▾"})]}),c&&r.jsx(lT,{agents:t,activeAgentId:a,focusedAgentId:d??a,onFocusAgent:h,onSwitch:b,onOpenSetup:S=>{o(S),v()},onClose:v})]})}const Qy="vskill-ccode-banner-dismissed",mT=new Set(["claude-cli","claude-code"]);function hT(){try{return sessionStorage.getItem(Qy)==="true"}catch{return!1}}function xT(){try{sessionStorage.setItem(Qy,"true")}catch{}}function gT({activeAgentId:t}){const[a,s]=p.useState(()=>hT()),o=p.useCallback(()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:open-setup-drawer",{detail:{provider:"claude-code"}}))},[]),c=p.useCallback(()=>{xT(),s(!0)},[]);return!t||!mT.has(t)||a?null:r.jsxs("div",{"data-testid":"claude-code-first-use-banner",role:"note","aria-label":"Claude Code session 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:[r.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--color-ok, #22c55e)",marginTop:6,flexShrink:0}}),r.jsxs("div",{style:{flex:1,minWidth:0},children:[r.jsxs("span",{children:[ne.claudeCodeLabel.firstUseBanner," "]}),r.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-learn-more",onClick:o,style:{background:"transparent",border:"none",padding:0,color:"var(--color-accent, var(--accent-surface))",cursor:"pointer",textDecoration:"underline",fontFamily:"inherit",fontSize:"inherit"},children:ne.claudeCodeLabel.learnMore})]}),r.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-dismiss",onClick:c,"aria-label":"Dismiss Claude Code info banner",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1,padding:2,flexShrink:0},children:"×"})]})}function vT(){const[t,a]=p.useState(null),[s,o]=p.useState("loading"),[c,u]=p.useState(null),d=p.useCallback(async()=>{try{const h=await we.getAgents();a(h),o("ready"),u(null)}catch(h){o("error"),u(h.message)}},[]);return p.useEffect(()=>{d()},[d]),p.useEffect(()=>{const h=()=>void d();return window.addEventListener("studio:agent-changed",h),()=>window.removeEventListener("studio:agent-changed",h)},[d]),{status:s,response:t,error:c,refresh:()=>void d()}}const Eo="workspace",yT=["skills","agents"];async function bT(){const t=await fetch("/api/workspace");if(!t.ok)throw new Error(`GET /api/workspace failed: ${t.status}`);return await t.json()}async function jT(t){const a=await fetch("/api/workspace/active",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:t})});if(!a.ok){const s=await a.json().catch(()=>({}));throw new Error(s.error??`POST /api/workspace/active failed: ${a.status}`)}return await a.json()}async function ST(t){const a=await fetch("/api/workspace/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!a.ok){const s=await a.json().catch(()=>({}));throw new Error(s.error??`POST /api/workspace/projects failed: ${a.status}`)}return await a.json()}async function kT(t){const a=await fetch(`/api/workspace/projects/${encodeURIComponent(t)}`,{method:"DELETE"});if(!a.ok){const s=await a.json().catch(()=>({}));throw new Error(s.error??`DELETE /api/workspace/projects/${t} failed: ${a.status}`)}return await a.json()}function Gd(){for(const t of yT)En(t)}function wT(){const{data:t,loading:a,error:s,revalidate:o}=Js(Eo,bT),c=t,u=c==null?void 0:c.projects.find(m=>m.id===c.activeProjectId),d=p.useCallback(async m=>{await jT(m),En(Eo),Gd()},[]),h=p.useCallback(async m=>{await ST(m),En(Eo),Gd()},[]),g=p.useCallback(async m=>{await kT(m),En(Eo),Gd()},[]);return{workspace:c,activeProject:u,loading:a,error:s,switchProject:d,addProject:h,removeProject:g,revalidate:o}}function CT({workspace:t,onSwitch:a,onAdd:s,onRemove:o,isPathStale:c}){const[u,d]=p.useState(!1),[h,g]=p.useState(!1),[m,y]=p.useState(""),[v,b]=p.useState(null),[S,k]=p.useState(null),[w,E]=p.useState(null),[T,N]=p.useState(!1),A=p.useRef(null),_=(t==null?void 0:t.projects)??[],D=_.find(L=>L.id===(t==null?void 0:t.activeProjectId));p.useEffect(()=>{if(!u)return;function L(U){A.current&&!A.current.contains(U.target)&&(d(!1),g(!1),b(null))}return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[u]);async function F(){b(null);const L=m.trim();if(!L){b("Paste an absolute path (e.g. /Users/you/projects/my-skill)");return}if(!L.startsWith("/")&&!/^[A-Za-z]:[\\/]/.test(L)){b("Path must be absolute. In Terminal, cd to the folder and run: pwd — then paste the result here.");return}try{await s({path:L}),y(""),g(!1)}catch(U){const $=U instanceof Error?U.message:String(U);/does not exist/i.test($)?b(`Path not found on disk: ${L}`):/Duplicate/i.test($)?b("That project is already registered."):b($)}}async function C(){if(b(null),typeof window<"u"&&"showDirectoryPicker"in window)try{const L=await window.showDirectoryPicker();y(L.name),g(!0)}catch{}else g(!0)}function B(L){if(L.length<=50)return L;const U=L.split("/");return U.length<=4?L:`${U.slice(0,3).join("/")}/…/${U.slice(-2).join("/")}`}return r.jsxs("div",{ref:A,"data-vskill-project-picker":!0,style:{position:"relative",display:"inline-block"},children:[r.jsxs("button",{type:"button",onClick:()=>d(L=>!L),"aria-expanded":u,"aria-haspopup":"menu",title:(D==null?void 0:D.path)??"No project selected",style:{display:"flex",alignItems:"center",gap:8,padding:"4px 10px",border:"1px solid transparent",borderRadius:6,background:u?"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:[r.jsx("span",{"aria-hidden":!0,style:{width:8,height:8,borderRadius:"50%",flexShrink:0,backgroundColor:(D==null?void 0:D.colorDot)??"var(--text-tertiary, #999)"}}),r.jsx("span",{style:{maxWidth:180,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D?D.name:"No project"}),r.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-tertiary, #999)",marginLeft:2},children:u?"▴":"▾"})]}),u&&r.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:[_.length===0&&r.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."}),_.length>0&&r.jsx("ul",{role:"none",style:{listStyle:"none",margin:0,padding:4,maxHeight:320,overflowY:"auto"},children:_.map(L=>{const U=c?c(L.path):!1,$=L.id===(t==null?void 0:t.activeProjectId),q=S===L.id;return r.jsxs("li",{role:"menuitem","data-stale":U?"true":"false",onMouseEnter:()=>k(L.id),onMouseLeave:()=>k(X=>X===L.id?null:X),onClick:()=>{if(!U){if($){d(!1);return}E(L)}},style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:6,cursor:U?"not-allowed":"pointer",background:q&&!U?"var(--surface-2, rgba(0,0,0,0.04))":$?"var(--surface-1, rgba(0,0,0,0.02))":"transparent",opacity:U?.5:1,transition:"background-color 120ms ease"},children:[r.jsx("span",{"aria-hidden":!0,style:{width:10,height:10,borderRadius:"50%",flexShrink:0,backgroundColor:L.colorDot,boxShadow:$?"0 0 0 2px color-mix(in oklch, currentColor 20%, transparent)":"none"}}),r.jsxs("div",{style:{flex:1,minWidth:0},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13,fontWeight:$?600:500,color:"var(--text-primary)",lineHeight:1.3},children:[r.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:L.name}),$&&r.jsx("span",{"aria-label":"Active",style:{fontSize:10,color:"var(--color-action, #2F5B8E)",letterSpacing:"0.05em",textTransform:"uppercase",fontWeight:600},children:"Active"})]}),r.jsx("div",{title:L.path,style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-tertiary)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:B(L.path)}),U&&r.jsx("div",{style:{fontSize:10,color:"var(--color-own, #b45309)",marginTop:2},children:"Path no longer exists"})]}),r.jsx("button",{type:"button","aria-label":`Remove ${L.name}`,onClick:X=>{X.stopPropagation(),o(L.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:q?1:0,transition:"opacity 120ms ease, color 120ms ease, background-color 120ms ease",flexShrink:0},onMouseEnter:X=>{X.currentTarget.style.color="var(--color-error, #b91c1c)",X.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-error, #b91c1c) 10%, transparent)"},onMouseLeave:X=>{X.currentTarget.style.color="var(--text-tertiary)",X.currentTarget.style.backgroundColor="transparent"},children:r.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:[r.jsx("polyline",{points:"3 6 5 6 21 6"}),r.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),r.jsx("path",{d:"M10 11v6"}),r.jsx("path",{d:"M14 11v6"}),r.jsx("path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]})})]},L.id)})}),r.jsxs("div",{style:{borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",padding:h?8:6},children:[!h&&r.jsxs("button",{type:"button",onClick:()=>void C(),className:"vskill-project-add",style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 10px",border:"none",borderRadius:6,background:"transparent",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500,color:"var(--color-action, #2F5B8E)",transition:"background-color 120ms ease"},onMouseEnter:L=>{L.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-action, #2F5B8E) 10%, transparent)"},onMouseLeave:L=>{L.currentTarget.style.backgroundColor="transparent"},children:[r.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:[r.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),r.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add project"]}),h&&r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[r.jsx("input",{type:"text",value:m,onChange:L=>y(L.target.value),onKeyDown:L=>{L.key==="Enter"&&F(),L.key==="Escape"&&(g(!1),b(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"}}),r.jsxs("div",{style:{display:"flex",gap:6,justifyContent:"flex-end"},children:[r.jsx("button",{type:"button",onClick:()=>{g(!1),b(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"}),r.jsx("button",{type:"button",onClick:()=>void F(),style:{padding:"4px 10px",fontSize:12,border:"none",borderRadius:4,background:"var(--color-action, #2F5B8E)",color:"var(--color-paper, #fff)",cursor:"pointer",fontWeight:500},children:"Add"})]}),v&&r.jsx("div",{style:{fontSize:11,color:"var(--color-error, #b91c1c)"},children:v})]})]})]}),w&&r.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Switch project instructions",style:{position:"fixed",inset:0,zIndex:80,display:"flex",alignItems:"center",justifyContent:"center"},onClick:()=>E(null),children:[r.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.40)"}}),r.jsxs("div",{onClick:L=>L.stopPropagation(),style:{position:"relative",width:"min(520px, 92vw)",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:10,boxShadow:"0 10px 15px -3px rgba(0,0,0,0.12), 0 20px 40px -8px rgba(0,0,0,0.18)",padding:18,fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[r.jsxs("h2",{style:{margin:0,fontSize:16,fontWeight:600,fontFamily:"var(--font-serif, ui-serif)",marginBottom:8},children:["Switch to ",w.name]}),r.jsx("p",{style:{fontSize:13,color:"var(--text-secondary)",lineHeight:1.5,margin:0,marginBottom:12},children:"Skill Studio's skill scanner reads from the folder it was launched in, so switching projects from the browser isn't possible. Quit this server and relaunch from the target folder:"}),r.jsx("div",{style:{background:"var(--surface-1, #0f0f10)",color:"var(--text-primary)",padding:"10px 12px",borderRadius:6,fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.55,whiteSpace:"pre-wrap",wordBreak:"break-all",border:"1px solid var(--border-subtle, rgba(255,255,255,0.08))"},children:`cd "${w.path}" && npx vskill@latest studio`}),r.jsxs("div",{style:{display:"flex",gap:8,marginTop:14,justifyContent:"flex-end"},children:[r.jsx("button",{type:"button",onClick:async()=>{try{await navigator.clipboard.writeText(`cd "${w.path}" && npx vskill@latest studio`),N(!0),setTimeout(()=>N(!1),1600)}catch{}},style:{padding:"7px 14px",fontSize:13,fontWeight:600,border:"1px solid var(--color-action, #2F5B8E)",borderRadius:6,background:"var(--color-action, #2F5B8E)",color:"#ffffff",cursor:"pointer",boxShadow:"0 1px 2px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.12)"},children:T?"Copied!":"Copy command"}),r.jsx("button",{type:"button",onClick:()=>E(null),style:{padding:"7px 12px",fontSize:13,fontWeight:500,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Close"})]})]})]})]})}function ET(t,a){const s=a.trim().toLowerCase().split(/\s+/).filter(Boolean);return s.length===0?t:t.filter(o=>{const c=`${o.name} ${o.path}`.toLowerCase();return s.every(u=>c.includes(u))})}function NT({open:t,projects:a,onSwitch:s,onClose:o}){const[c,u]=p.useState(""),[d,h]=p.useState(0),g=p.useMemo(()=>ET(a,c),[a,c]);p.useEffect(()=>{t||(u(""),h(0))},[t]),p.useEffect(()=>{d>=g.length&&h(0)},[g.length,d]);const m=y=>{if(y.key==="Escape"){y.preventDefault(),o();return}if(y.key==="ArrowDown"){y.preventDefault(),h(v=>Math.min(v+1,Math.max(g.length-1,0)));return}if(y.key==="ArrowUp"){y.preventDefault(),h(v=>Math.max(v-1,0));return}if(y.key==="Enter"){y.preventDefault();const v=g[d];v&&(s(v.id),o())}};return t?r.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:[r.jsx("div",{className:"absolute inset-0 bg-black/30",onClick:o}),r.jsxs("div",{className:"relative w-[520px] max-w-[92vw] bg-background border rounded shadow-lg",children:[r.jsx("input",{type:"text",autoFocus:!0,value:c,onChange:y=>u(y.target.value),onKeyDown:m,placeholder:"Switch project…",className:"w-full px-3 py-2 text-sm border-b outline-none"}),r.jsxs("ul",{role:"listbox",className:"max-h-80 overflow-auto",children:[g.length===0&&r.jsx("li",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No matches."}),g.map((y,v)=>r.jsxs("li",{role:"option","aria-selected":v===d,"data-highlighted":v===d,className:["flex items-center gap-2 px-3 py-2 text-sm cursor-pointer",v===d?"bg-muted":""].join(" "),onMouseEnter:()=>h(v),onClick:()=>{s(y.id),o()},children:[r.jsx("span",{"aria-hidden":!0,className:"inline-block w-2 h-2 rounded-full",style:{backgroundColor:y.colorDot}}),r.jsxs("span",{className:"flex-1",children:[r.jsx("span",{className:"vskill-palette-name",children:y.name}),r.jsx("span",{className:"ml-2 vskill-palette-path text-xs font-mono text-muted-foreground",children:y.path})]})]},y.id))]})]})]}):null}const lv=/^[a-z][a-z0-9-]{0,62}[a-z0-9]$/;function TT({open:t,onClose:a,initialMode:s="standalone",isClaudeCode:o,projectRoot:c,onCreated:u}){const[d,h]=p.useState("destination"),[g,m]=p.useState(s),[y,v]=p.useState(""),[b,S]=p.useState(""),[k,w]=p.useState(""),[E,T]=p.useState([]),[N,A]=p.useState(!1),[_,D]=p.useState(null);if(p.useEffect(()=>{t&&(h("destination"),m(s),v(""),S(""),w(""),D(null))},[t,s]),p.useEffect(()=>{if(!t)return;let I=!0;return fetch("/api/authoring/plugins").then(z=>z.json()).then(z=>{I&&T(z.plugins??[])}).catch(()=>{}),()=>{I=!1}},[t]),p.useEffect(()=>{if(!t)return;function I(z){z.key==="Escape"&&(z.preventDefault(),a())}return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[t,a]),!t)return null;const F=E.length>0,C=o&&F,B=o,L=lv.test(y),U=g==="existing-plugin"?b.length>0:lv.test(b),$=!N&&L&&(g==="standalone"||U),q=RT(c,g,b,y);async function X(){D(null),A(!0);try{const O=new URLSearchParams;O.set("mode",g),O.set("skillName",y),b&&O.set("pluginName",b);const P=await fetch(`/api/authoring/skill-exists?${O.toString()}`),H=await P.json();if(!P.ok){D(H.error??`Check failed: ${P.status}`);return}if(H.exists){D(`Skill '${y}' already exists${H.path?` at ${H.path}`:""}`);return}}catch(O){D(O instanceof Error?O.message:String(O));return}finally{A(!1)}const I=new URLSearchParams;I.set("mode",g),I.set("skillName",y),k.trim()&&I.set("description",k.trim()),b&&I.set("pluginName",b);const z=`#/create?${I.toString()}`;typeof window<"u"&&(window.location.hash=z),a()}async function ee(){D(null),A(!0);try{const I=await fetch("/api/authoring/create-skill",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:g,skillName:y,description:k.trim()||void 0,pluginName:g==="standalone"?void 0:b})}),z=await I.json();if(!I.ok||!z.ok){D(z.error??`Create failed: ${I.status}`);return}En("skills"),u==null||u({mode:g,skillName:y,pluginName:z.pluginName??null,skillMdPath:z.skillMdPath}),a()}catch(I){D(I instanceof Error?I.message:String(I))}finally{A(!1)}}return r.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Create skill","data-vskill-create-skill-modal":!0,style:{position:"fixed",inset:0,zIndex:100,display:"flex",alignItems:"center",justifyContent:"center"},children:[r.jsx("div",{onClick:a,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.45)"}}),r.jsxs("div",{style:{position:"relative",width:"min(560px, 92vw)",maxHeight:"86vh",overflow:"auto",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:10,boxShadow:"0 10px 15px -3px rgba(0,0,0,0.12), 0 20px 40px -8px rgba(0,0,0,0.18)",fontFamily:"var(--font-sans)"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.08))"},children:[r.jsx("h2",{style:{margin:0,fontSize:16,fontWeight:600,color:"var(--text-primary)",fontFamily:"var(--font-serif, ui-serif)",letterSpacing:"0.01em"},children:d==="destination"?"Create a skill":"Name and describe"}),r.jsxs("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginLeft:"auto",fontVariantNumeric:"tabular-nums"},children:["Step ",d==="destination"?"1":"2"," of 2"]})]}),d==="destination"&&r.jsxs("div",{style:{padding:14,display:"flex",flexDirection:"column",gap:10},children:[r.jsx(Wd,{title:"Standalone skill",subtitle:"A single skill in this project",description:"Lives at <project>/skills/<name>/SKILL.md. Works with every agent.",icon:"📄",selected:g==="standalone",onClick:()=>m("standalone")}),r.jsx(Wd,{title:"Add to existing plugin",subtitle:C?`${E.length} plugin source${E.length===1?"":"s"} in this project`:o?"No plugin sources in this project yet":"Claude Code only",description:"Appends a skill to an existing <plugin>/.claude-plugin/plugin.json source.",icon:"🧩",disabled:!C,selected:g==="existing-plugin",onClick:()=>C&&m("existing-plugin")}),r.jsx(Wd,{title:"New plugin",subtitle:B?"Bundles one or more skills for distribution":"Claude Code only",description:"Scaffolds <plugin>/.claude-plugin/plugin.json and its first skill.",icon:"📦",disabled:!B,selected:g==="new-plugin",onClick:()=>B&&m("new-plugin")})]}),d==="details"&&r.jsxs("div",{style:{padding:16,display:"flex",flexDirection:"column",gap:12},children:[g==="new-plugin"&&r.jsx(No,{label:"Plugin name",hint:"kebab-case",children:r.jsx("input",{type:"text",value:b,onChange:I=>S(I.target.value.trim()),placeholder:"my-first-plugin",autoFocus:!0,style:To(!b||U)})}),g==="existing-plugin"&&r.jsx(No,{label:"Plugin",children:r.jsxs("select",{value:b,onChange:I=>S(I.target.value),style:{...To(!0),fontFamily:"var(--font-mono)"},children:[r.jsx("option",{value:"",children:"Select a plugin…"}),E.map(I=>r.jsx("option",{value:I.name,children:I.name},I.path))]})}),r.jsx(No,{label:"Skill name",hint:"kebab-case",children:r.jsx("input",{type:"text",value:y,onChange:I=>v(I.target.value.trim()),placeholder:"my-new-skill",autoFocus:g!=="new-plugin",style:To(!y||L)})}),r.jsx(No,{label:"Description",hint:"One short sentence — shown in frontmatter",children:r.jsx("textarea",{value:k,onChange:I=>w(I.target.value),rows:2,placeholder:"Does a thing when Claude needs X",style:{...To(!0),resize:"vertical",minHeight:52,fontFamily:"var(--font-sans)"}})}),q&&r.jsxs("div",{style:{padding:"8px 10px",fontSize:11,fontFamily:"var(--font-mono)",color:"var(--text-secondary)",background:"var(--surface-1, rgba(0,0,0,0.03))",border:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",borderRadius:4,wordBreak:"break-all"},children:[r.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginBottom:2,fontFamily:"var(--font-sans)"},children:"Will create:"}),q.map((I,z)=>r.jsx("div",{children:I},z))]}),_&&r.jsx("div",{style:{fontSize:12,color:"var(--color-error, #b91c1c)",padding:"6px 10px",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4},children:_})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,padding:"12px 16px",borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",background:"var(--surface-1, rgba(0,0,0,0.02))"},children:[r.jsx("button",{type:"button",onClick:a,style:qd,children:"Cancel"}),d==="destination"&&r.jsx("button",{type:"button",onClick:()=>h("details"),style:sv,children:"Continue →"}),d==="details"&&r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",onClick:()=>h("destination"),style:qd,children:"← Back"}),r.jsx("button",{type:"button",onClick:()=>void X(),disabled:!$,style:{...qd,opacity:$?1:.5,cursor:$?"pointer":"not-allowed"},title:"Opens the AI generation flow with this destination pre-selected (choose Claude Code, Anthropic API, OpenRouter, or local models)",children:"Generate with AI"}),r.jsx("button",{type:"button",onClick:()=>void ee(),disabled:!$,style:{...sv,opacity:$?1:.5,cursor:$?"pointer":"not-allowed"},title:"Creates an empty SKILL.md scaffold you can fill in by hand",children:N?"Creating…":"Create empty scaffold"})]})]})]})]})}function Wd({title:t,subtitle:a,description:s,icon:o,selected:c,disabled:u,onClick:d}){return r.jsxs("button",{type:"button",onClick:d,disabled:u,"aria-pressed":c,style:{display:"flex",gap:12,padding:"12px 14px",textAlign:"left",borderRadius:8,border:c?"2px solid var(--color-accent, #2f6f8f)":"1px solid var(--border-default, rgba(0,0,0,0.12))",background:c?"color-mix(in oklch, var(--color-accent, #2f6f8f) 8%, var(--color-paper, #fff))":u?"var(--surface-1, rgba(0,0,0,0.02))":"var(--color-paper, #fff)",color:u?"var(--text-tertiary)":"var(--text-primary)",cursor:u?"not-allowed":"pointer",opacity:u?.6:1,fontFamily:"inherit",width:"100%",transition:"border-color 120ms ease, background-color 120ms ease"},children:[r.jsx("span",{"aria-hidden":!0,style:{fontSize:22,lineHeight:1,marginTop:2},children:o}),r.jsxs("div",{style:{flex:1,minWidth:0},children:[r.jsx("div",{style:{fontSize:14,fontWeight:600,lineHeight:1.3},children:t}),r.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginTop:2,textTransform:"uppercase",letterSpacing:"0.04em"},children:a}),r.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",marginTop:6,lineHeight:1.5},children:s})]})]})}function No({label:t,hint:a,children:s}){return r.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4},children:[r.jsxs("span",{style:{display:"flex",alignItems:"baseline",gap:8},children:[r.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-primary)"},children:t}),a&&r.jsx("span",{style:{fontSize:11,color:"var(--text-tertiary)"},children:a})]}),s]})}function To(t){return{width:"100%",padding:"7px 10px",fontSize:13,fontFamily:"var(--font-mono)",border:`1px solid ${t?"var(--border-default, rgba(0,0,0,0.12))":"var(--color-error, #b91c1c)"}`,borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none",boxSizing:"border-box"}}const sv={padding:"8px 16px",fontSize:13,fontWeight:600,border:"1px solid var(--color-action, #2F5B8E)",borderRadius:6,background:"var(--color-action, #2F5B8E)",color:"var(--color-action-ink, #FFFFFF)",cursor:"pointer",fontFamily:"inherit",boxShadow:"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)",letterSpacing:"0.01em"},qd={padding:"7px 12px",fontSize:13,fontWeight:500,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,background:"transparent",color:"var(--text-primary)",cursor:"pointer",fontFamily:"inherit"};function RT(t,a,s,o){const c=o||"<skill-name>",u=s||"<plugin-name>",d=t||"<project>";return a==="standalone"?[`${d}/skills/${c}/SKILL.md`]:a==="existing-plugin"?[`${d}/${u}/skills/${c}/SKILL.md`]:a==="new-plugin"?[`${d}/${u}/.claude-plugin/plugin.json`,`${d}/${u}/skills/${c}/SKILL.md`]:null}function Zy(t){return t.trim().toLowerCase()}function AT(t,a){const s=Zy(a);return s?t.filter(o=>o.name.toLowerCase().includes(s)||o.source.toLowerCase().includes(s)):t}function MT(t,a){const s=Zy(a);return s?t.filter(o=>[o.name,o.description??"",o.category??"",o.author??""].join(" ").toLowerCase().includes(s)):t}function LT({open:t,onClose:a,onInstall:s,onUninstall:o,installedNames:c}){const[u,d]=p.useState(null),[h,g]=p.useState([]),[m,y]=p.useState(null),[v,b]=p.useState(null),[S,k]=p.useState(!1),[w,E]=p.useState(null),[T,N]=p.useState(""),[A,_]=p.useState("");p.useEffect(()=>{m?N(""):_("")},[m]);const D=p.useMemo(()=>AT(h,T),[h,T]),F=p.useMemo(()=>MT((v==null?void 0:v.plugins)??[],A),[v,A]);return p.useEffect(()=>{t&&(k(!0),E(null),fetch("/api/plugins/marketplaces").then(C=>C.json()).then(C=>{if(C.error)throw new Error(C.error);g(C.marketplaces??[])}).catch(C=>E(C instanceof Error?C.message:String(C))).finally(()=>k(!1)))},[t]),p.useEffect(()=>{if(!m){b(null);return}k(!0),E(null),fetch(`/api/plugins/marketplaces/${encodeURIComponent(m)}`).then(C=>C.json()).then(C=>{if(C.error)throw new Error(C.error);b(C)}).catch(C=>E(C instanceof Error?C.message:String(C))).finally(()=>k(!1))},[m]),p.useEffect(()=>{if(!t)return;function C(B){B.key==="Escape"&&a()}return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[t,a]),t?r.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Plugin marketplace","data-vskill-marketplace-drawer":!0,style:{position:"fixed",inset:0,zIndex:80},children:[r.jsx("div",{onClick:a,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.38)"}}),r.jsxs("aside",{style:{position:"absolute",top:0,right:0,bottom:0,width:"min(480px, 94vw)",background:"var(--color-paper, #fff)",borderLeft:"1px solid var(--border-default, rgba(0,0,0,0.12))",boxShadow:"-10px 0 30px -8px rgba(0,0,0,0.18)",display:"flex",flexDirection:"column",fontFamily:"var(--font-sans)"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.08))"},children:[m&&r.jsx("button",{type:"button",onClick:()=>y(null),"aria-label":"Back to marketplaces",style:{border:"none",background:"transparent",fontSize:14,color:"var(--text-secondary)",cursor:"pointer",padding:0},children:"← Back"}),r.jsx("h2",{style:{margin:0,fontSize:15,fontWeight:600,color:"var(--text-primary)",fontFamily:"var(--font-serif, ui-serif)",flex:1},children:m?(v==null?void 0:v.name)??m:"Browse plugins"}),r.jsx("button",{type:"button",onClick:a,"aria-label":"Close",style:{border:"none",background:"transparent",fontSize:16,color:"var(--text-secondary)",cursor:"pointer",padding:"4px 6px"},children:"✕"})]}),r.jsxs("div",{style:{flex:1,overflowY:"auto",padding:12},children:[S&&r.jsx("div",{style:{padding:12,fontSize:12,color:"var(--text-tertiary)"},children:"Loading…"}),w&&r.jsx("div",{style:{padding:10,fontSize:12,color:"var(--color-error, #b91c1c)",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4},children:w}),!m&&!S&&h.length===0&&!w&&r.jsx(zT,{}),!m&&h.length>0&&r.jsx(iv,{value:T,onChange:N,placeholder:"Search marketplaces…",ariaLabel:"Search marketplaces",testId:"marketplace-search"}),!m&&h.length>0&&D.length===0&&r.jsxs("div",{style:{padding:12,fontSize:12,color:"var(--text-tertiary)"},children:["No marketplaces match “",T,"”."]}),!m&&D.map(C=>r.jsxs("button",{type:"button",onClick:()=>y(C.name),style:_T,onMouseEnter:B=>{B.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.04))"},onMouseLeave:B=>{B.currentTarget.style.background="transparent"},children:[r.jsx("div",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)"},children:C.name}),r.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:C.source})]},C.name)),m&&v&&r.jsxs(r.Fragment,{children:[v.description&&r.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",padding:"0 6px 12px",lineHeight:1.5},children:v.description}),v.plugins.length===0&&r.jsx("div",{style:{padding:12,fontSize:12,color:"var(--text-tertiary)"},children:"This marketplace has no plugins catalogued yet."}),v.plugins.length>0&&r.jsx(iv,{value:A,onChange:_,placeholder:"Search plugins…",ariaLabel:"Search plugins",testId:"plugin-search"}),v.plugins.length>0&&F.length===0&&r.jsxs("div",{style:{padding:12,fontSize:12,color:"var(--text-tertiary)"},children:["No plugins match “",A,"”."]}),F.map(C=>{const B=c.has(C.name);return r.jsx("div",{style:{padding:"10px 8px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.05))"},children:r.jsxs("div",{style:{display:"flex",alignItems:"start",gap:8},children:[r.jsxs("div",{style:{flex:1,minWidth:0},children:[r.jsxs("div",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)",display:"flex",alignItems:"baseline",gap:8},children:[C.name,C.version&&r.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)"},children:C.version}),C.category&&r.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:10,background:"var(--surface-2, rgba(0,0,0,0.05))",color:"var(--text-secondary)"},children:C.category})]}),C.description&&r.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:4,lineHeight:1.5},children:C.description})]}),B&&o?r.jsx("button",{type:"button",disabled:u===C.name,onClick:async()=>{d(C.name);try{await o(C.name)}finally{d(null)}},"aria-label":`Uninstall ${C.name}`,style:{flexShrink:0,padding:"5px 12px",fontSize:12,fontWeight:600,border:"1px solid var(--color-error, #b91c1c)",borderRadius:4,background:"transparent",color:"var(--color-error, #b91c1c)",cursor:u===C.name?"wait":"pointer",opacity:u===C.name?.6:1,fontFamily:"inherit"},children:u===C.name?"Uninstalling…":"Uninstall"}):r.jsx("button",{type:"button",disabled:B,onClick:()=>s(C.name,m),style:{flexShrink:0,padding:"5px 12px",fontSize:12,fontWeight:600,border:B?"none":"1px solid var(--color-action, #2F5B8E)",borderRadius:4,background:B?"var(--surface-2, rgba(0,0,0,0.05))":"var(--color-action, #2F5B8E)",color:B?"var(--text-tertiary)":"var(--color-action-ink, #FFFFFF)",cursor:B?"default":"pointer",fontFamily:"inherit",boxShadow:B?"none":"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)"},children:B?"Installed":"Install"})]})},C.name)})]})]}),!m&&r.jsx("div",{style:{borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",padding:12},children:r.jsx(DT,{onAdded:()=>{En("marketplaces"),fetch("/api/plugins/marketplaces").then(C=>C.json()).then(C=>g(C.marketplaces??[]))}})})]})]}):null}function iv({value:t,onChange:a,placeholder:s,ariaLabel:o,testId:c}){return r.jsx("div",{style:{padding:"0 4px 10px"},children:r.jsx("input",{type:"search",value:t,onChange:u=>a(u.target.value),placeholder:s,"aria-label":o,"data-testid":c,style:{width:"100%",padding:"6px 10px",fontSize:12,fontFamily:"var(--font-sans)",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",boxSizing:"border-box"}})})}function zT(){return r.jsxs("div",{style:{padding:20,fontSize:12,color:"var(--text-tertiary)",lineHeight:1.6},children:["No marketplaces configured yet. Add one below — examples:",r.jsxs("ul",{style:{marginTop:8,paddingLeft:16},children:[r.jsx("li",{children:r.jsx("code",{children:"anthropics/claude-plugins-official"})}),r.jsx("li",{children:r.jsx("code",{children:"openai/codex-plugin-cc"})})]})]})}function DT({onAdded:t}){const[a,s]=p.useState(""),[o,c]=p.useState(!1),[u,d]=p.useState(null);async function h(){const g=a.trim();if(g){c(!0),d(null);try{const m=await fetch("/api/plugins/marketplaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:g})}),y=await m.json().catch(()=>({}));if(!m.ok||!y.ok){d(y.error??`Add failed (${m.status})`);return}s(""),t()}catch(m){d(m instanceof Error?m.message:String(m))}finally{c(!1)}}}return r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[r.jsx("label",{style:{fontSize:11,color:"var(--text-tertiary)",fontWeight:500},children:"Add marketplace (GitHub owner/repo, URL, or path)"}),r.jsxs("div",{style:{display:"flex",gap:6},children:[r.jsx("input",{type:"text",value:a,onChange:g=>s(g.target.value),onKeyDown:g=>{g.key==="Enter"&&h()},placeholder:"anthropics/claude-plugins-official",disabled:o,style:{flex:1,padding:"6px 8px",fontSize:12,fontFamily:"var(--font-mono)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none"}}),r.jsx("button",{type:"button",onClick:()=>void h(),disabled:o||!a.trim(),style:{padding:"6px 14px",fontSize:12,fontWeight:600,border:"1px solid var(--color-action, #2F5B8E)",borderRadius:4,background:"var(--color-action, #2F5B8E)",color:"var(--color-action-ink, #FFFFFF)",cursor:o||!a.trim()?"not-allowed":"pointer",opacity:o||!a.trim()?.5:1,boxShadow:"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)",fontFamily:"inherit"},children:o?"Adding…":"Add"})]}),u&&r.jsx("div",{style:{fontSize:11,color:"var(--color-error, #b91c1c)"},children:u})]})}const _T={display:"block",width:"100%",textAlign:"left",padding:"10px 12px",border:"none",borderRadius:6,background:"transparent",cursor:"pointer",fontFamily:"inherit",marginBottom:2},Yd=12;function OT({job:t,onDone:a}){const[s,o]=p.useState([]),[c,u]=p.useState("running"),[d,h]=p.useState(!1);if(p.useEffect(()=>{if(!t)return;o([]),u("running"),h(!1);const v=new AbortController;let b=[],S="running";return(async()=>{try{const k=await fetch("/api/plugins/install/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({plugin:t.ref}),signal:v.signal});if(!k.ok||!k.body){u("failed"),a({ok:!1,code:k.status,lines:[`HTTP ${k.status}`]});return}const w=k.body.getReader(),E=new TextDecoder;let T="";for(;;){const{value:N,done:A}=await w.read();if(A)break;T+=E.decode(N,{stream:!0});const _=T.split(/\n\n/);T=_.pop()??"";for(const D of _){const F=D.match(/^data:\s*(.*)$/m);if(F)try{const C=JSON.parse(F[1]);C.type==="stdout"&&C.line?(b=[...b,C.line].slice(-Yd),o(b)):C.type==="stderr"&&C.line?(b=[...b,`⚠ ${C.line}`].slice(-Yd),o(b)):C.type==="done"?(S=C.ok?"ok":"failed",u(S),$v(),En("skills"),a({ok:C.ok??!1,code:C.code??null,lines:b})):C.type==="error"&&C.error&&(b=[...b,`✘ ${C.error}`].slice(-Yd),o(b))}catch{}}}S==="running"&&a({ok:!0,code:0,lines:b})}catch(k){if(k.name==="AbortError")return;u("failed"),a({ok:!1,code:null,lines:[...b,k instanceof Error?k.message:String(k)]})}})(),()=>v.abort()},[t==null?void 0:t.ref]),!t)return null;const g=c==="ok"?"var(--color-installed, #2F6A4A)":c==="failed"?"var(--color-error, #b91c1c)":"var(--color-accent, #2f6f8f)",m=c==="ok"?"✔":c==="failed"?"✘":"…",y=c==="ok"?"Installed":c==="failed"?"Install failed":"Installing";return r.jsxs("div",{role:"status","aria-live":"polite","data-vskill-install-toast":!0,style:{position:"fixed",bottom:16,right:16,width:"min(420px, 92vw)",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderLeft:`3px solid ${g}`,borderRadius:6,boxShadow:"0 10px 20px -6px rgba(0,0,0,0.18)",zIndex:90,fontFamily:"var(--font-sans)",overflow:"hidden"},children:[r.jsxs("button",{type:"button",onClick:()=>h(v=>!v),style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"10px 12px",border:"none",background:"transparent",cursor:"pointer",textAlign:"left",fontFamily:"inherit"},children:[r.jsx("span",{"aria-hidden":!0,style:{fontSize:16,color:g,width:16,textAlign:"center"},children:c==="running"?r.jsx(BT,{}):m}),r.jsxs("span",{style:{flex:1,minWidth:0},children:[r.jsxs("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-primary)"},children:[y,": ",t.plugin,r.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)",marginLeft:4},children:["@",t.marketplace]})]}),!d&&s.length>0&&r.jsx("span",{style:{display:"block",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s[s.length-1]})]}),r.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-tertiary)"},children:d?"▾":"▸"})]}),d&&r.jsx("pre",{style:{margin:0,padding:"0 12px 12px",maxHeight:180,overflowY:"auto",fontFamily:"var(--font-mono)",fontSize:10,lineHeight:1.5,color:"var(--text-secondary)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:s.length===0?"Waiting for output…":s.join(`
|
|
102
|
-
`)})]})}function BT(){return r.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:10,height:10,borderRadius:"50%",border:"2px solid var(--color-accent, #2f6f8f)",borderTopColor:"transparent",animation:"vskill-spin 800ms linear infinite"},children:r.jsx("style",{children:"@keyframes vskill-spin { to { transform: rotate(360deg); } }"})})}const IT=3e3,UT={anthropic:"Anthropic",openai:"OpenAI",openrouter:"OpenRouter"};function ov(t){return t==="anthropic"||t==="openai"||t==="openrouter"}function HT(){const{toast:t}=Wo(),a=p.useRef(new Map),s=p.useCallback(o=>{if(!ov(o.provider))return;const c=Date.now(),u=a.current.get(o.provider)??0;if(c-u<IT)return;a.current.set(o.provider,c);const d=UT[o.provider];t({message:`${d} API key invalid or missing. Open Settings →`,severity:"error",action:{label:"Open Settings",onInvoke:()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:open-settings",{detail:{provider:o.provider}}))}}})},[t]);return p.useEffect(()=>{function o(c){const u=c.detail;!u||!ov(u.provider)||s({provider:u.provider})}return window.addEventListener("studio:api-key-error",o),()=>window.removeEventListener("studio:api-key-error",o)},[s]),{report:s}}const Jy="vskill.studio.prefs";function eb(){try{return typeof window>"u"?null:window.localStorage??null}catch{return null}}function tb(){const t=eb();if(!t)return{};try{const a=t.getItem(Jy);if(!a)return{};const s=JSON.parse(a);return s&&typeof s=="object"&&!Array.isArray(s)?s:{}}catch{return{}}}function $T(t,a){const s=eb();if(s)try{const c={...tb(),[t]:a};s.setItem(Jy,JSON.stringify(c))}catch{}}function VT(t,a){const o=tb()[t];return o===void 0?a:o}const cv={open:!1,x:0,y:0,skill:null};function PT(t,a){return{open:!0,x:t.clientX,y:t.clientY,skill:a}}function _a(t,a="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:t,severity:a}}))}function FT(t){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:request-delete",{detail:{skill:t}}))}function GT(t,a){var s;switch(t){case"copy-path":try{(s=navigator.clipboard)==null||s.writeText(a.dir)}catch{_a(ne.toasts.permissionDenied,"error");return}_a(ne.toasts.pathCopied,"info");return;case"open":case"reveal":case"edit":_a(ne.actions.editPlaceholder,"info");return;case"run-benchmark":_a(ne.toasts.benchmarkQueued,"info");return;case"duplicate":_a(ne.toasts.skillDuplicated,"info");return;case"update":_a(ne.toasts.skillUpdated,"info");return;case"uninstall":_a(ne.actions.editPlaceholder,"info");return;case"delete":FT(a);return;default:return}}function WT(t){return t.startsWith("#/create")}function qT(t){return t.startsWith("#/updates")}function nb(t){const[a,s]=p.useState(()=>typeof window<"u"&&t(window.location.hash));return p.useEffect(()=>{function o(){s(t(window.location.hash))}return window.addEventListener("hashchange",o),o(),()=>window.removeEventListener("hashchange",o)},[]),a}function YT(){return nb(WT)}function KT(){return nb(qT)}function XT(){var o,c;if(typeof navigator>"u")return"⌘⇧K";const t=((o=navigator.platform)==null?void 0:o.toUpperCase())??"",a=((c=navigator.userAgent)==null?void 0:c.toUpperCase())??"";return t.includes("MAC")||a.includes("MAC")?"⌘⇧K":"Ctrl+Shift+K"}function QT(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function ZT(){const[t,a]=p.useState("⌘⇧K");p.useEffect(()=>{a(XT())},[]);const s=QT();function o(){window.dispatchEvent(new CustomEvent("openFindSkills"))}return r.jsxs("button",{type:"button",onClick:o,"aria-label":`Find verified skills — opens search (${t})`,title:`Find verified skills (${t})`,"data-testid":"find-skills-nav-button",style:{display:"inline-flex",alignItems:"center",gap:6,height:28,padding:"0 12px",borderRadius:6,border:"1px solid var(--border-default)",background:"transparent",color:"var(--text-secondary)",fontSize:12,fontWeight:500,fontFamily:"var(--font-sans)",cursor:"pointer",letterSpacing:"0.01em"},children:[r.jsxs("svg",{"data-icon":"search","aria-hidden":"true",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("circle",{cx:"11",cy:"11",r:"8"}),r.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),r.jsx("span",{children:"Find skills"}),r.jsx("kbd",{"data-animated":s?"false":"true",style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-faint)",border:"1px solid var(--border-default)",borderRadius:4,padding:"1px 5px",marginLeft:2,lineHeight:1},children:t})]})}const JT=p.lazy(()=>Ha(()=>import("./CommandPalette-C0OajJac.js"),__vite__mapDeps([2,1]))),eR=p.lazy(()=>Ha(()=>import("./FindSkillsPalette-Fd_xvWRc.js"),__vite__mapDeps([3,1])).then(t=>({default:t.FindSkillsPalette}))),tR=p.lazy(()=>Ha(()=>import("./SkillDetailPanel-cxwua4jw.js"),__vite__mapDeps([4,5,1])).then(t=>({default:t.SkillDetailPanel}))),nR=p.lazy(()=>Ha(()=>import("./CreateSkillPage-BHTsGTx2.js"),__vite__mapDeps([6,1])).then(t=>({default:t.CreateSkillPage}))),rR=p.lazy(()=>Ha(()=>Promise.resolve().then(()=>oN),void 0).then(t=>({default:t.UpdatesPanel})));function aR(){return r.jsx(NS,{children:r.jsx(wS,{children:r.jsxs(C2,{children:[r.jsx(lR,{}),r.jsx($N,{})]})})})}function lR(){var Nt,Le;const{state:t,selectSkill:a,clearSelection:s,refreshSkills:o,outdatedByOrigin:c,revealSkill:u,clearReveal:d}=er(),{config:h}=$a(),{mode:g,resolvedTheme:m,setTheme:y}=Hv(),{toast:v}=Wo(),[b,S]=p.useState(()=>Qw()),[k]=p.useState(!0),[w,E]=p.useState(!1),[T,N]=p.useState(!1),[A,_]=p.useState(!1),[D,F]=p.useState("overview"),[C,B]=p.useState(cv),L=p.useCallback((se,Se)=>{B(PT(se,Se))},[]),U=vT(),[$,q]=p.useState(()=>VT("activeAgent",null)),X=p.useCallback(se=>{q(se),$T("activeAgent",se),typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:agent-changed",{detail:{agentId:se}}))},[]);p.useEffect(()=>{var se;!$&&((se=U.response)!=null&&se.suggested)&&X(U.response.suggested)},[$,(Nt=U.response)==null?void 0:Nt.suggested,X]);const ee=p.useMemo(()=>U.response?fT(U.response):[],[U.response]),{workspace:I,switchProject:z,addProject:O,removeProject:P,activeProject:H}=wT(),[ae,M]=p.useState(!1),[Y,W]=p.useState(!1),[Q,oe]=p.useState("standalone"),de=p.useCallback((se="standalone")=>{oe(se),W(!0)},[]);p.useEffect(()=>{function se(Se){if(!(Se instanceof CustomEvent))return;const Me=Se.detail;de((Me==null?void 0:Me.mode)??"standalone")}return window.addEventListener("studio:request-create-skill",se),()=>window.removeEventListener("studio:request-create-skill",se)},[de]);const[ve,ce]=p.useState(!1),[je,Re]=p.useState(null);p.useEffect(()=>{function se(){ce(!0)}return window.addEventListener("studio:open-marketplace",se),()=>window.removeEventListener("studio:open-marketplace",se)},[]);const Oe=p.useMemo(()=>{const se=new Set;for(const Se of t.skills)Se.source==="plugin"&&Se.pluginName&&se.add(Se.pluginName);return se},[t.skills]);sf([{key:"p",meta:!0,handler:se=>{var Me;const Se=typeof document<"u"?document.activeElement:null;Se&&Se.tagName==="INPUT"||((Me=se==null?void 0:se.preventDefault)==null||Me.call(se),M(Fa=>!Fa))}}],{enabled:!0});const le=rT(),he=le.open;p.useEffect(()=>{function se(Se){if(!(Se instanceof CustomEvent))return;const Me=Se.detail;Me!=null&&Me.provider&&he(Me.provider)}return window.addEventListener("studio:open-setup-drawer",se),()=>window.removeEventListener("studio:open-setup-drawer",se)},[he]);const pe=p.useCallback(()=>{B(cv)},[]);p.useEffect(()=>{function se(Se){if(!(Se instanceof CustomEvent))return;const Me=Se.detail;Me!=null&&Me.message&&v({message:Me.message,severity:Me.severity??"info"})}return window.addEventListener("studio:toast",se),()=>window.removeEventListener("studio:toast",se)},[v]),HT();const[xe,be]=p.useState(!1),[Be,Ue]=p.useState(void 0);p.useEffect(()=>{function se(Se){if(!(Se instanceof CustomEvent))return;const Me=Se.detail;Ue(Me==null?void 0:Me.provider),be(!0)}return window.addEventListener("studio:open-settings",se),()=>window.removeEventListener("studio:open-settings",se)},[]),p.useEffect(()=>{document.documentElement.style.setProperty("--sidebar-width",`${b}px`)},[b]);const[lt,Ct]=p.useState(null),[gt,Tt]=p.useState(()=>new Set),Gt=p.useRef(!1),We=p.useMemo(()=>qN(),[]),nt=p.useCallback(se=>`${se.plugin}/${se.skill}`,[]),xn=p.useCallback(se=>{Tt(Se=>{const Me=new Set(Se);return Me.add(nt(se)),Me})},[nt]),ye=p.useCallback(se=>{Tt(Se=>{const Me=new Set(Se);return Me.delete(nt(se)),Me})},[nt]),ot=YN({delayMs:1e4,onCommit:se=>{o(),ye(se)},onFailure:(se,Se)=>{ye(se),v({message:`Couldn't delete ${se.skill}: ${Se.message}`,severity:"error",durationMs:0,action:{label:ne.actions.retry,onInvoke:()=>{xn(se),ot.enqueueDelete(se)}}})}});p.useEffect(()=>{function se(Se){if(!(Se instanceof CustomEvent))return;const Me=Se.detail;Me!=null&&Me.skill&&Ct(Me.skill)}return window.addEventListener("studio:request-delete",se),()=>window.removeEventListener("studio:request-delete",se)},[]);const Wt=p.useCallback(()=>{const se=lt;if(Ct(null),!se)return;const Se={plugin:se.plugin,skill:se.skill};xn(Se),ot.enqueueDelete(Se);const Me=Gt.current?"":`Sent to your ${We}. Open Trash to restore. `;Gt.current=!0,v({message:`${Me}Deleted ${se.skill}`,severity:"info",durationMs:1e4,action:{label:ne.actions.undo,onInvoke:()=>{ot.cancelDelete(nt(Se)),ye(Se)}}})},[lt,xn,ye,ot,v,We,nt]),Kt=p.useCallback(()=>{Ct(null)},[]),An=p.useMemo(()=>t.skills.filter(se=>!gt.has(nt(se))),[t.skills,gt,nt]),Et=p.useMemo(()=>t.selectedSkill?t.skills.find(se=>se.plugin===t.selectedSkill.plugin&&se.skill===t.selectedSkill.skill)??null:null,[t.skills,t.selectedSkill]),Mn=p.useCallback(se=>{a({plugin:se.plugin,skill:se.skill,origin:se.origin})},[a]),Ut=p.useMemo(()=>{if(!t.selectedSkill)return"";const se=t.selectedSkill.origin==="installed"?"Installed":"Own";return`Viewing ${t.selectedSkill.skill} (${se})`},[t.selectedSkill]),Rt=p.useMemo(()=>[{id:"switch-theme",label:ne.palette.actionSwitchTheme,description:"Cycle light / dark / auto",keywords:["theme","dark","light","mode"],onInvoke:()=>y(g==="light"?"dark":g==="dark"?"auto":"light")},{id:"toggle-sidebar",label:"Toggle sidebar",description:"Show or hide the skills sidebar",keywords:["sidebar","panel","hide","show","cmd+b"],onInvoke:()=>_(se=>!se)},{id:"show-shortcuts",label:"Show keyboard shortcuts",description:"Open the cheatsheet",keywords:["help","keys"],onInvoke:()=>N(!0)},{id:"refresh-skills",label:"Refresh skills",description:"Re-scan local + installed",keywords:["reload","scan"],onInvoke:()=>o()}],[g,y,o]),[ct,Wn]=p.useState(null);sf([{key:"cmd+k",handler:()=>E(se=>!se)},{key:"ctrl+k",handler:()=>E(se=>!se)},{key:"cmd+shift+k",handler:()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("openFindSkills"))}},{key:"ctrl+shift+k",handler:()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("openFindSkills"))}},{key:"?",handler:()=>N(se=>!se)},{key:"cmd+shift+d",handler:()=>y(m==="light"?"dark":"light")},{key:"ctrl+shift+d",handler:()=>y(m==="light"?"dark":"light")},{key:"cmd+b",handler:()=>_(se=>!se)},{key:"ctrl+b",handler:()=>_(se=>!se)},{key:"e",handler:()=>v({message:ne.actions.editPlaceholder,severity:"info"})}]);const tr=YT(),gn=KT()?r.jsx(p.Suspense,{fallback:r.jsx("div",{style:{padding:40},children:"Loading…"}),children:r.jsx(rR,{})}):tr?r.jsx(p.Suspense,{fallback:r.jsx("div",{style:{padding:40},children:"Loading…"}),children:r.jsx(nR,{})}):r.jsx(zN,{selectedSkillInfo:Et,activeDetailTab:D,onDetailTabChange:F,allSkills:t.skills,onSelectSkill:Mn});return r.jsxs(r.Fragment,{children:[r.jsx(TS,{sidebarWidth:b,sidebarHidden:A||t.isMobile&&t.mobileView==="detail",banner:r.jsx(eC,{connected:k}),liveMessage:Ut,topRail:r.jsx(R2,{projectName:(h==null?void 0:h.projectName)??null,selected:t.selectedSkill,onOpenPalette:()=>E(!0),onHome:s,onRequestCreateSkill:()=>de("standalone"),projectPickerSlot:I&&I.projects.length>0?r.jsx(CT,{workspace:I,onSwitch:z,onAdd:O,onRemove:P}):void 0,findSkillsSlot:r.jsx(ZT,{})}),sidebar:r.jsx(Pw,{skills:An,selectedKey:t.selectedSkill?{plugin:t.selectedSkill.plugin,skill:t.selectedSkill.skill}:null,onSelect:Mn,isLoading:t.skillsLoading,error:t.skillsError??null,onRetry:o,onContextMenu:L,outdatedByOrigin:c,activeAgentId:$,revealSkillId:t.revealSkillId,onRevealComplete:d,topSlot:U.status==="ready"&&ee.length>0?r.jsxs(r.Fragment,{children:[r.jsx(pT,{agents:ee,activeAgentId:$,onActiveAgentChange:X,onOpenSetup:se=>le.open(se)}),r.jsx(gT,{activeAgentId:$})]}):null}),resizeHandle:r.jsx(Jw,{initialWidth:b??Vs,onChange:S}),main:gn,statusBar:r.jsx(H2,{projectPath:(h==null?void 0:h.root)??null,modelName:(h==null?void 0:h.model)??null,health:h!=null&&h.error?"degraded":"ok",providers:(Le=h==null?void 0:h.providers)==null?void 0:Le.map(se=>{const Se=se.id;return{id:Se,label:se.label,available:se.available,kind:Se==="ollama"||Se==="lm-studio"?"start-service":Se==="anthropic"||Se==="openrouter"?"api-key":"cli-install"}})})}),r.jsx(PN,{open:T,onClose:()=>N(!1)}),r.jsx(QN,{open:le.isOpen,providerKey:le.providerKey,onClose:le.close}),r.jsx(GN,{state:C,onClose:pe,onAction:(se,Se)=>GT(se,Se)}),w&&r.jsx(p.Suspense,{fallback:null,children:r.jsx(JT,{open:w,onClose:()=>E(!1),commands:Rt})}),r.jsx(p.Suspense,{fallback:null,children:r.jsx(eR,{onSelect:se=>{const Se=se.name.split("/");Se.length===3&&Wn({owner:Se[0],repo:Se[1],slug:Se[2],displayName:se.displayName??se.name})}})}),ct&&r.jsx(p.Suspense,{fallback:null,children:r.jsx(tR,{selectedSkill:ct,onClose:()=>Wn(null)})}),r.jsx(NT,{open:ae,projects:(I==null?void 0:I.projects)??[],onSwitch:se=>{z(se)},onClose:()=>M(!1)}),r.jsx(TT,{open:Y,onClose:()=>W(!1),initialMode:Q,isClaudeCode:$==="claude-code",projectRoot:(H==null?void 0:H.path)??(h==null?void 0:h.projectName)??"",onCreated:se=>{o(),setTimeout(()=>{u(se.pluginName??"",se.skillName)},500)}}),r.jsx(LT,{open:ve,onClose:()=>ce(!1),installedNames:Oe,onInstall:(se,Se)=>{Re({plugin:se,marketplace:Se,ref:`${se}@${Se}`}),ce(!1)},onUninstall:async se=>{if(window.confirm(`Uninstall ${se}? This removes the plugin and its skills.`))try{const Se=await fetch(`/api/plugins/${encodeURIComponent(se)}/uninstall`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),Me=await Se.json().catch(()=>({}));if(!Se.ok||!Me.ok){v({message:Me.error??`Uninstall failed (${Se.status})`,severity:"error"});return}v({message:`Uninstalled ${se}.`,severity:"info"}),o()}catch(Se){v({message:Se instanceof Error?Se.message:String(Se),severity:"error"})}}}),r.jsx(Ov,{open:xe,onClose:()=>be(!1),initialProvider:Be,onToast:se=>v({message:se,severity:"info"})}),r.jsx(OT,{job:je,onDone:se=>{se.ok&&(o(),setTimeout(()=>Re(null),3e3))}}),r.jsx(WN,{open:lt!==null,title:lt?`Delete "${lt.skill}"?`:"",body:`It will be sent to your ${We}. You can recover it from there.`,confirmLabel:"Delete",cancelLabel:"Cancel",variant:"destructive",onConfirm:Wt,onCancel:Kt})]})}const uv="vskill.migrations.scope-rename.v1",sR={own:"authoring-project",installed:"available-project",global:"available-personal"},iR=/^vskill-sidebar-(.+)-(own|installed|global)-collapsed$/;function oR(t){if(t.getItem(uv)==="done")return;const a=[];for(let s=0;s<t.length;s++){const o=t.key(s);if(!o)continue;const c=o.match(iR);if(!c)continue;const[,u,d]=c,h=sR[d];if(!h)continue;const g=t.getItem(o);g!==null&&a.push({oldKey:o,newKey:`vskill-sidebar-${u}-${h}-collapsed`,value:g})}for(const{oldKey:s,newKey:o,value:c}of a)t.getItem(o)===null&&t.setItem(o,c),t.removeItem(s);t.setItem(uv,"done")}if(typeof PerformanceObserver<"u")try{const t=new PerformanceObserver(a=>{for(const s of a.getEntries())if(s.name==="first-contentful-paint"){window.__vskillPaint=s.startTime,t.disconnect();return}});t.observe({type:"paint",buffered:!0})}catch{}if(typeof window<"u"&&window.localStorage)try{oR(window.localStorage)}catch{}j0.createRoot(document.getElementById("root")).render(r.jsx(p.StrictMode,{children:r.jsx(Vj,{children:r.jsx(_2,{children:r.jsx(aR,{})})})}));export{ec as E,Rv as L,ai as P,Ne as R,rN as S,uR as T,Ha as _,$a as a,tb as b,eN as c,Zo as d,Wo as e,er as f,VT as g,we as h,Ty as i,r as j,p as r,ne as s,pf as t,rj as u,$T as w};
|
|
101
|
+
}`})]}),document.body)}function iT({agent:t,focused:a,active:s,onClick:o}){const c=t.health==="ok"?"var(--color-ok, #22c55e)":t.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)";return r.jsxs("button",{type:"button","data-testid":"agent-scope-row","data-agent-id":t.id,"data-active":s?"true":"false",onClick:o,style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 14px",background:a?"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:[r.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:c,flexShrink:0}}),r.jsx("span",{style:{flex:1,fontSize:13},children:t.displayName}),r.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[t.installedCount,"·",t.globalCount]})]})}function oT({row:t,onFocus:a}){return r.jsxs("button",{type:"button","data-testid":"agent-scope-shared-folder-row",onClick:a,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:[r.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)"},children:t.sharedFolderPath}),r.jsxs("span",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[t.consumers.map(s=>r.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:10,background:"color-mix(in srgb, var(--color-global) 20%, transparent)",color:"var(--text-primary)"},children:s.id},s.id)),r.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontFamily:"var(--font-mono)"},children:["· ",t.combinedCount," skills"]})]})]})}function cT({agent:t}){const a=t.isRemoteOnly?`${t.displayName} is a web-only product — no local CLI or folder to detect.`:t.resolvedGlobalDir?`Looked for ${t.resolvedGlobalDir} — not found.`:`${t.displayName} was not found on this machine.`;return r.jsxs("div",{"data-testid":`agent-scope-not-detected-row-${t.id}`,title:a,style:{display:"flex",alignItems:"center",gap:10,padding:"6px 14px",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:12},children:[r.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--text-tertiary)",flexShrink:0}}),r.jsx("span",{style:{flex:1},children:t.displayName}),t.isRemoteOnly&&r.jsx("span",{"data-testid":`agent-scope-remote-badge-${t.id}`,"aria-label":"Remote-only agent",title:"Web-only agent — no local CLI to install skills into. Use the agent's web UI to load skills.",style:{background:"color-mix(in srgb, var(--text-tertiary) 18%, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:10,padding:"1px 8px",color:"var(--text-secondary)",fontSize:10,letterSpacing:"0.04em",textTransform:"uppercase"},children:"Remote"})]})}function uT({agent:t,activeAgentId:a,onSwitch:s}){const o=t.id===a,c=t.isRemoteOnly===!0,u=o||c,d=o?"Active":c?"Remote-only":ne.scopePicker.switchCta;return r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[r.jsxs("div",{children:[r.jsx("div",{style:{fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:t.displayName}),r.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:2},children:c?"Remote service — no local install":fT(t.health)})]}),r.jsxs("dl",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"4px 12px",margin:0,fontSize:12},children:[r.jsx(Gd,{label:ne.scopePicker.statsInstalled,value:String(t.installedCount)}),r.jsx(Gd,{label:ne.scopePicker.statsGlobal,value:String(t.globalCount)}),r.jsx(Gd,{label:ne.scopePicker.statsLastSync,value:t.lastSync?dT(t.lastSync):"—"})]}),r.jsx("button",{type:"button","data-testid":"agent-scope-switch",onClick:s,disabled:u,title:c?"This agent has no local CLI to switch to":void 0,style:{alignSelf:"flex-start",padding:"8px 14px",borderRadius:6,border:"1px solid var(--border-default, var(--border-subtle))",background:u?"transparent":"color-mix(in srgb, var(--accent-surface) 20%, transparent)",color:"var(--text-primary)",fontSize:12,fontWeight:500,fontFamily:"var(--font-sans)",cursor:u?"default":"pointer",opacity:u?.5:1},children:d})]})}function Gd({label:t,value:a}){return r.jsxs(r.Fragment,{children:[r.jsx("dt",{style:{color:"var(--text-secondary)",margin:0},children:t}),r.jsx("dd",{style:{color:"var(--text-primary)",margin:0,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums"},children:a})]})}function lv(){return r.jsx("div",{style:{padding:"16px 18px",fontSize:12,color:"var(--text-secondary)"},children:"No agents detected yet."})}function dT(t){try{const a=new Date(t).getTime(),s=Date.now()-a;if(Number.isNaN(a))return"—";const o=Math.round(s/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const c=Math.round(o/60);return c<24?`${c}h ago`:`${Math.round(c/24)}d ago`}catch{return"—"}}function fT(t){switch(t){case"ok":return ne.scopePicker.statsHealthOk;case"stale":return ne.scopePicker.statsHealthStale;case"missing":return ne.scopePicker.statsHealthMissing}}function pT(t){const a=new Map;for(const s of t.sharedFolders??[])for(const o of s.consumers)a.set(o,s);return t.agents.map(s=>{const o=a.get(s.id);return{id:s.id,displayName:s.displayName,presence:s.detected?"detected":"absent",installedCount:s.localSkillCount,globalCount:s.globalSkillCount,lastSync:s.lastSync,health:s.health,sharedFolderGroup:o?o.consumers:void 0,sharedFolderPath:o?o.path:void 0,isRemoteOnly:s.isRemoteOnly,resolvedGlobalDir:s.resolvedGlobalDir}})}function mT({agents:t,activeAgentId:a,onActiveAgentChange:s,onOpenSetup:o}){const[c,u]=p.useState(!1),[d,h]=p.useState(null),g=p.useRef(null),m=p.useMemo(()=>t.find(S=>S.id===a)??t[0]??null,[t,a]),y=p.useMemo(()=>m?m.health==="ok"?"var(--color-ok, #22c55e)":m.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)":"var(--text-tertiary)",[m]),v=p.useCallback(()=>{var S;u(!1),(S=g.current)==null||S.focus()},[]),b=p.useCallback(S=>{s(S),u(!1)},[s]);return r.jsxs(r.Fragment,{children:[r.jsxs("button",{ref:g,type:"button","data-testid":"agent-scope-picker-trigger","aria-haspopup":"dialog","aria-expanded":c,onClick:()=>u(S=>!S),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),u(!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:[r.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:y,flexShrink:0}}),r.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(m==null?void 0:m.displayName)??"Select agent"}),r.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:["(",(m==null?void 0:m.installedCount)??0," · ",(m==null?void 0:m.globalCount)??0,")"]}),r.jsx("span",{"aria-hidden":"true",style:{fontSize:10,color:"var(--text-secondary)"},children:"▾"})]}),c&&r.jsx(sT,{agents:t,activeAgentId:a,focusedAgentId:d??a,onFocusAgent:h,onSwitch:b,onOpenSetup:S=>{o(S),v()},onClose:v})]})}const Jy="vskill-ccode-banner-dismissed",hT=new Set(["claude-cli","claude-code"]);function xT(){try{return sessionStorage.getItem(Jy)==="true"}catch{return!1}}function gT(){try{sessionStorage.setItem(Jy,"true")}catch{}}function vT({activeAgentId:t}){const[a,s]=p.useState(()=>xT()),o=p.useCallback(()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:open-setup-drawer",{detail:{provider:"claude-code"}}))},[]),c=p.useCallback(()=>{gT(),s(!0)},[]);return!t||!hT.has(t)||a?null:r.jsxs("div",{"data-testid":"claude-code-first-use-banner",role:"note","aria-label":"Claude Code session 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:[r.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--color-ok, #22c55e)",marginTop:6,flexShrink:0}}),r.jsxs("div",{style:{flex:1,minWidth:0},children:[r.jsxs("span",{children:[ne.claudeCodeLabel.firstUseBanner," "]}),r.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-learn-more",onClick:o,style:{background:"transparent",border:"none",padding:0,color:"var(--color-accent, var(--accent-surface))",cursor:"pointer",textDecoration:"underline",fontFamily:"inherit",fontSize:"inherit"},children:ne.claudeCodeLabel.learnMore})]}),r.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-dismiss",onClick:c,"aria-label":"Dismiss Claude Code info banner",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1,padding:2,flexShrink:0},children:"×"})]})}function yT(){const[t,a]=p.useState(null),[s,o]=p.useState("loading"),[c,u]=p.useState(null),d=p.useCallback(async()=>{try{const h=await we.getAgents();a(h),o("ready"),u(null)}catch(h){o("error"),u(h.message)}},[]);return p.useEffect(()=>{d()},[d]),p.useEffect(()=>{const h=()=>void d();return window.addEventListener("studio:agent-changed",h),()=>window.removeEventListener("studio:agent-changed",h)},[d]),{status:s,response:t,error:c,refresh:()=>void d()}}const Eo="workspace",bT=["skills","agents"];async function jT(){const t=await fetch("/api/workspace");if(!t.ok)throw new Error(`GET /api/workspace failed: ${t.status}`);return await t.json()}async function ST(t){const a=await fetch("/api/workspace/active",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:t})});if(!a.ok){const s=await a.json().catch(()=>({}));throw new Error(s.error??`POST /api/workspace/active failed: ${a.status}`)}return await a.json()}async function kT(t){const a=await fetch("/api/workspace/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!a.ok){const s=await a.json().catch(()=>({}));throw new Error(s.error??`POST /api/workspace/projects failed: ${a.status}`)}return await a.json()}async function wT(t){const a=await fetch(`/api/workspace/projects/${encodeURIComponent(t)}`,{method:"DELETE"});if(!a.ok){const s=await a.json().catch(()=>({}));throw new Error(s.error??`DELETE /api/workspace/projects/${t} failed: ${a.status}`)}return await a.json()}function Wd(){for(const t of bT)En(t)}function CT(){const{data:t,loading:a,error:s,revalidate:o}=Js(Eo,jT),c=t,u=c==null?void 0:c.projects.find(m=>m.id===c.activeProjectId),d=p.useCallback(async m=>{await ST(m),En(Eo),Wd()},[]),h=p.useCallback(async m=>{await kT(m),En(Eo),Wd()},[]),g=p.useCallback(async m=>{await wT(m),En(Eo),Wd()},[]);return{workspace:c,activeProject:u,loading:a,error:s,switchProject:d,addProject:h,removeProject:g,revalidate:o}}function ET({workspace:t,onSwitch:a,onAdd:s,onRemove:o,isPathStale:c}){const[u,d]=p.useState(!1),[h,g]=p.useState(!1),[m,y]=p.useState(""),[v,b]=p.useState(null),[S,k]=p.useState(null),[w,C]=p.useState(null),[T,N]=p.useState(!1),A=p.useRef(null),_=(t==null?void 0:t.projects)??[],D=_.find(L=>L.id===(t==null?void 0:t.activeProjectId));p.useEffect(()=>{if(!u)return;function L(U){A.current&&!A.current.contains(U.target)&&(d(!1),g(!1),b(null))}return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[u]);async function F(){b(null);const L=m.trim();if(!L){b("Paste an absolute path (e.g. /Users/you/projects/my-skill)");return}if(!L.startsWith("/")&&!/^[A-Za-z]:[\\/]/.test(L)){b("Path must be absolute. In Terminal, cd to the folder and run: pwd — then paste the result here.");return}try{await s({path:L}),y(""),g(!1)}catch(U){const $=U instanceof Error?U.message:String(U);/does not exist/i.test($)?b(`Path not found on disk: ${L}`):/Duplicate/i.test($)?b("That project is already registered."):b($)}}async function E(){if(b(null),typeof window<"u"&&"showDirectoryPicker"in window)try{const L=await window.showDirectoryPicker();y(L.name),g(!0)}catch{}else g(!0)}function B(L){if(L.length<=50)return L;const U=L.split("/");return U.length<=4?L:`${U.slice(0,3).join("/")}/…/${U.slice(-2).join("/")}`}return r.jsxs("div",{ref:A,"data-vskill-project-picker":!0,style:{position:"relative",display:"inline-block"},children:[r.jsxs("button",{type:"button",onClick:()=>d(L=>!L),"aria-expanded":u,"aria-haspopup":"menu",title:(D==null?void 0:D.path)??"No project selected",style:{display:"flex",alignItems:"center",gap:8,padding:"4px 10px",border:"1px solid transparent",borderRadius:6,background:u?"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:[r.jsx("span",{"aria-hidden":!0,style:{width:8,height:8,borderRadius:"50%",flexShrink:0,backgroundColor:(D==null?void 0:D.colorDot)??"var(--text-tertiary, #999)"}}),r.jsx("span",{style:{maxWidth:180,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D?D.name:"No project"}),r.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-tertiary, #999)",marginLeft:2},children:u?"▴":"▾"})]}),u&&r.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:[_.length===0&&r.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."}),_.length>0&&r.jsx("ul",{role:"none",style:{listStyle:"none",margin:0,padding:4,maxHeight:320,overflowY:"auto"},children:_.map(L=>{const U=c?c(L.path):!1,$=L.id===(t==null?void 0:t.activeProjectId),q=S===L.id;return r.jsxs("li",{role:"menuitem","data-stale":U?"true":"false",onMouseEnter:()=>k(L.id),onMouseLeave:()=>k(X=>X===L.id?null:X),onClick:()=>{if(!U){if($){d(!1);return}C(L)}},style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:6,cursor:U?"not-allowed":"pointer",background:q&&!U?"var(--surface-2, rgba(0,0,0,0.04))":$?"var(--surface-1, rgba(0,0,0,0.02))":"transparent",opacity:U?.5:1,transition:"background-color 120ms ease"},children:[r.jsx("span",{"aria-hidden":!0,style:{width:10,height:10,borderRadius:"50%",flexShrink:0,backgroundColor:L.colorDot,boxShadow:$?"0 0 0 2px color-mix(in oklch, currentColor 20%, transparent)":"none"}}),r.jsxs("div",{style:{flex:1,minWidth:0},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13,fontWeight:$?600:500,color:"var(--text-primary)",lineHeight:1.3},children:[r.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:L.name}),$&&r.jsx("span",{"aria-label":"Active",style:{fontSize:10,color:"var(--color-action, #2F5B8E)",letterSpacing:"0.05em",textTransform:"uppercase",fontWeight:600},children:"Active"})]}),r.jsx("div",{title:L.path,style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-tertiary)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:B(L.path)}),U&&r.jsx("div",{style:{fontSize:10,color:"var(--color-own, #b45309)",marginTop:2},children:"Path no longer exists"})]}),r.jsx("button",{type:"button","aria-label":`Remove ${L.name}`,onClick:X=>{X.stopPropagation(),o(L.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:q?1:0,transition:"opacity 120ms ease, color 120ms ease, background-color 120ms ease",flexShrink:0},onMouseEnter:X=>{X.currentTarget.style.color="var(--color-error, #b91c1c)",X.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-error, #b91c1c) 10%, transparent)"},onMouseLeave:X=>{X.currentTarget.style.color="var(--text-tertiary)",X.currentTarget.style.backgroundColor="transparent"},children:r.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:[r.jsx("polyline",{points:"3 6 5 6 21 6"}),r.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),r.jsx("path",{d:"M10 11v6"}),r.jsx("path",{d:"M14 11v6"}),r.jsx("path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]})})]},L.id)})}),r.jsxs("div",{style:{borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",padding:h?8:6},children:[!h&&r.jsxs("button",{type:"button",onClick:()=>void E(),className:"vskill-project-add",style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 10px",border:"none",borderRadius:6,background:"transparent",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500,color:"var(--color-action, #2F5B8E)",transition:"background-color 120ms ease"},onMouseEnter:L=>{L.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-action, #2F5B8E) 10%, transparent)"},onMouseLeave:L=>{L.currentTarget.style.backgroundColor="transparent"},children:[r.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:[r.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),r.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add project"]}),h&&r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[r.jsx("input",{type:"text",value:m,onChange:L=>y(L.target.value),onKeyDown:L=>{L.key==="Enter"&&F(),L.key==="Escape"&&(g(!1),b(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"}}),r.jsxs("div",{style:{display:"flex",gap:6,justifyContent:"flex-end"},children:[r.jsx("button",{type:"button",onClick:()=>{g(!1),b(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"}),r.jsx("button",{type:"button",onClick:()=>void F(),style:{padding:"4px 10px",fontSize:12,border:"none",borderRadius:4,background:"var(--color-action, #2F5B8E)",color:"var(--color-paper, #fff)",cursor:"pointer",fontWeight:500},children:"Add"})]}),v&&r.jsx("div",{style:{fontSize:11,color:"var(--color-error, #b91c1c)"},children:v})]})]})]}),w&&r.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Switch project instructions",style:{position:"fixed",inset:0,zIndex:80,display:"flex",alignItems:"center",justifyContent:"center"},onClick:()=>C(null),children:[r.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.40)"}}),r.jsxs("div",{onClick:L=>L.stopPropagation(),style:{position:"relative",width:"min(520px, 92vw)",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:10,boxShadow:"0 10px 15px -3px rgba(0,0,0,0.12), 0 20px 40px -8px rgba(0,0,0,0.18)",padding:18,fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[r.jsxs("h2",{style:{margin:0,fontSize:16,fontWeight:600,fontFamily:"var(--font-serif, ui-serif)",marginBottom:8},children:["Switch to ",w.name]}),r.jsx("p",{style:{fontSize:13,color:"var(--text-secondary)",lineHeight:1.5,margin:0,marginBottom:12},children:"Skill Studio's skill scanner reads from the folder it was launched in, so switching projects from the browser isn't possible. Quit this server and relaunch from the target folder:"}),r.jsx("div",{style:{background:"var(--surface-1, #0f0f10)",color:"var(--text-primary)",padding:"10px 12px",borderRadius:6,fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.55,whiteSpace:"pre-wrap",wordBreak:"break-all",border:"1px solid var(--border-subtle, rgba(255,255,255,0.08))"},children:`cd "${w.path}" && npx vskill@latest studio`}),r.jsxs("div",{style:{display:"flex",gap:8,marginTop:14,justifyContent:"flex-end"},children:[r.jsx("button",{type:"button",onClick:async()=>{try{await navigator.clipboard.writeText(`cd "${w.path}" && npx vskill@latest studio`),N(!0),setTimeout(()=>N(!1),1600)}catch{}},style:{padding:"7px 14px",fontSize:13,fontWeight:600,border:"1px solid var(--color-action, #2F5B8E)",borderRadius:6,background:"var(--color-action, #2F5B8E)",color:"#ffffff",cursor:"pointer",boxShadow:"0 1px 2px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.12)"},children:T?"Copied!":"Copy command"}),r.jsx("button",{type:"button",onClick:()=>C(null),style:{padding:"7px 12px",fontSize:13,fontWeight:500,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Close"})]})]})]})]})}function NT(t,a){const s=a.trim().toLowerCase().split(/\s+/).filter(Boolean);return s.length===0?t:t.filter(o=>{const c=`${o.name} ${o.path}`.toLowerCase();return s.every(u=>c.includes(u))})}function TT({open:t,projects:a,onSwitch:s,onClose:o}){const[c,u]=p.useState(""),[d,h]=p.useState(0),g=p.useMemo(()=>NT(a,c),[a,c]);p.useEffect(()=>{t||(u(""),h(0))},[t]),p.useEffect(()=>{d>=g.length&&h(0)},[g.length,d]);const m=y=>{if(y.key==="Escape"){y.preventDefault(),o();return}if(y.key==="ArrowDown"){y.preventDefault(),h(v=>Math.min(v+1,Math.max(g.length-1,0)));return}if(y.key==="ArrowUp"){y.preventDefault(),h(v=>Math.max(v-1,0));return}if(y.key==="Enter"){y.preventDefault();const v=g[d];v&&(s(v.id),o())}};return t?r.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:[r.jsx("div",{className:"absolute inset-0 bg-black/30",onClick:o}),r.jsxs("div",{className:"relative w-[520px] max-w-[92vw] bg-background border rounded shadow-lg",children:[r.jsx("input",{type:"text",autoFocus:!0,value:c,onChange:y=>u(y.target.value),onKeyDown:m,placeholder:"Switch project…",className:"w-full px-3 py-2 text-sm border-b outline-none"}),r.jsxs("ul",{role:"listbox",className:"max-h-80 overflow-auto",children:[g.length===0&&r.jsx("li",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No matches."}),g.map((y,v)=>r.jsxs("li",{role:"option","aria-selected":v===d,"data-highlighted":v===d,className:["flex items-center gap-2 px-3 py-2 text-sm cursor-pointer",v===d?"bg-muted":""].join(" "),onMouseEnter:()=>h(v),onClick:()=>{s(y.id),o()},children:[r.jsx("span",{"aria-hidden":!0,className:"inline-block w-2 h-2 rounded-full",style:{backgroundColor:y.colorDot}}),r.jsxs("span",{className:"flex-1",children:[r.jsx("span",{className:"vskill-palette-name",children:y.name}),r.jsx("span",{className:"ml-2 vskill-palette-path text-xs font-mono text-muted-foreground",children:y.path})]})]},y.id))]})]})]}):null}const sv=/^[a-z][a-z0-9-]{0,62}[a-z0-9]$/;function RT({open:t,onClose:a,initialMode:s="standalone",isClaudeCode:o,projectRoot:c,onCreated:u}){const[d,h]=p.useState("destination"),[g,m]=p.useState(s),[y,v]=p.useState(""),[b,S]=p.useState(""),[k,w]=p.useState(""),[C,T]=p.useState([]),[N,A]=p.useState(!1),[_,D]=p.useState(null);if(p.useEffect(()=>{t&&(h("destination"),m(s),v(""),S(""),w(""),D(null))},[t,s]),p.useEffect(()=>{if(!t)return;let I=!0;return fetch("/api/authoring/plugins").then(z=>z.json()).then(z=>{I&&T(z.plugins??[])}).catch(()=>{}),()=>{I=!1}},[t]),p.useEffect(()=>{if(!t)return;function I(z){z.key==="Escape"&&(z.preventDefault(),a())}return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[t,a]),!t)return null;const F=C.length>0,E=o&&F,B=o,L=sv.test(y),U=g==="existing-plugin"?b.length>0:sv.test(b),$=!N&&L&&(g==="standalone"||U),q=AT(c,g,b,y);async function X(){D(null),A(!0);try{const O=new URLSearchParams;O.set("mode",g),O.set("skillName",y),b&&O.set("pluginName",b);const P=await fetch(`/api/authoring/skill-exists?${O.toString()}`),H=await P.json();if(!P.ok){D(H.error??`Check failed: ${P.status}`);return}if(H.exists){D(`Skill '${y}' already exists${H.path?` at ${H.path}`:""}`);return}}catch(O){D(O instanceof Error?O.message:String(O));return}finally{A(!1)}const I=new URLSearchParams;I.set("mode",g),I.set("skillName",y),k.trim()&&I.set("description",k.trim()),b&&I.set("pluginName",b);const z=`#/create?${I.toString()}`;typeof window<"u"&&(window.location.hash=z),a()}async function ee(){D(null),A(!0);try{const I=await fetch("/api/authoring/create-skill",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:g,skillName:y,description:k.trim()||void 0,pluginName:g==="standalone"?void 0:b})}),z=await I.json();if(!I.ok||!z.ok){D(z.error??`Create failed: ${I.status}`);return}En("skills"),u==null||u({mode:g,skillName:y,pluginName:z.pluginName??null,skillMdPath:z.skillMdPath}),a()}catch(I){D(I instanceof Error?I.message:String(I))}finally{A(!1)}}return r.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Create skill","data-vskill-create-skill-modal":!0,style:{position:"fixed",inset:0,zIndex:100,display:"flex",alignItems:"center",justifyContent:"center"},children:[r.jsx("div",{onClick:a,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.45)"}}),r.jsxs("div",{style:{position:"relative",width:"min(560px, 92vw)",maxHeight:"86vh",overflow:"auto",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:10,boxShadow:"0 10px 15px -3px rgba(0,0,0,0.12), 0 20px 40px -8px rgba(0,0,0,0.18)",fontFamily:"var(--font-sans)"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.08))"},children:[r.jsx("h2",{style:{margin:0,fontSize:16,fontWeight:600,color:"var(--text-primary)",fontFamily:"var(--font-serif, ui-serif)",letterSpacing:"0.01em"},children:d==="destination"?"Create a skill":"Name and describe"}),r.jsxs("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginLeft:"auto",fontVariantNumeric:"tabular-nums"},children:["Step ",d==="destination"?"1":"2"," of 2"]})]}),d==="destination"&&r.jsxs("div",{style:{padding:14,display:"flex",flexDirection:"column",gap:10},children:[r.jsx(qd,{title:"Standalone skill",subtitle:"A single skill in this project",description:"Lives at <project>/skills/<name>/SKILL.md. Works with every agent.",icon:"📄",selected:g==="standalone",onClick:()=>m("standalone")}),r.jsx(qd,{title:"Add to existing plugin",subtitle:E?`${C.length} plugin source${C.length===1?"":"s"} in this project`:o?"No plugin sources in this project yet":"Claude Code only",description:"Appends a skill to an existing <plugin>/.claude-plugin/plugin.json source.",icon:"🧩",disabled:!E,selected:g==="existing-plugin",onClick:()=>E&&m("existing-plugin")}),r.jsx(qd,{title:"New plugin",subtitle:B?"Bundles one or more skills for distribution":"Claude Code only",description:"Scaffolds <plugin>/.claude-plugin/plugin.json and its first skill.",icon:"📦",disabled:!B,selected:g==="new-plugin",onClick:()=>B&&m("new-plugin")})]}),d==="details"&&r.jsxs("div",{style:{padding:16,display:"flex",flexDirection:"column",gap:12},children:[g==="new-plugin"&&r.jsx(No,{label:"Plugin name",hint:"kebab-case",children:r.jsx("input",{type:"text",value:b,onChange:I=>S(I.target.value.trim()),placeholder:"my-first-plugin",autoFocus:!0,style:To(!b||U)})}),g==="existing-plugin"&&r.jsx(No,{label:"Plugin",children:r.jsxs("select",{value:b,onChange:I=>S(I.target.value),style:{...To(!0),fontFamily:"var(--font-mono)"},children:[r.jsx("option",{value:"",children:"Select a plugin…"}),C.map(I=>r.jsx("option",{value:I.name,children:I.name},I.path))]})}),r.jsx(No,{label:"Skill name",hint:"kebab-case",children:r.jsx("input",{type:"text",value:y,onChange:I=>v(I.target.value.trim()),placeholder:"my-new-skill",autoFocus:g!=="new-plugin",style:To(!y||L)})}),r.jsx(No,{label:"Description",hint:"One short sentence — shown in frontmatter",children:r.jsx("textarea",{value:k,onChange:I=>w(I.target.value),rows:2,placeholder:"Does a thing when Claude needs X",style:{...To(!0),resize:"vertical",minHeight:52,fontFamily:"var(--font-sans)"}})}),q&&r.jsxs("div",{style:{padding:"8px 10px",fontSize:11,fontFamily:"var(--font-mono)",color:"var(--text-secondary)",background:"var(--surface-1, rgba(0,0,0,0.03))",border:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",borderRadius:4,wordBreak:"break-all"},children:[r.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginBottom:2,fontFamily:"var(--font-sans)"},children:"Will create:"}),q.map((I,z)=>r.jsx("div",{children:I},z))]}),_&&r.jsx("div",{style:{fontSize:12,color:"var(--color-error, #b91c1c)",padding:"6px 10px",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4},children:_})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,padding:"12px 16px",borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",background:"var(--surface-1, rgba(0,0,0,0.02))"},children:[r.jsx("button",{type:"button",onClick:a,style:Yd,children:"Cancel"}),d==="destination"&&r.jsx("button",{type:"button",onClick:()=>h("details"),style:iv,children:"Continue →"}),d==="details"&&r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",onClick:()=>h("destination"),style:Yd,children:"← Back"}),r.jsx("button",{type:"button",onClick:()=>void X(),disabled:!$,style:{...Yd,opacity:$?1:.5,cursor:$?"pointer":"not-allowed"},title:"Opens the AI generation flow with this destination pre-selected (choose Claude Code, Anthropic API, OpenRouter, or local models)",children:"Generate with AI"}),r.jsx("button",{type:"button",onClick:()=>void ee(),disabled:!$,style:{...iv,opacity:$?1:.5,cursor:$?"pointer":"not-allowed"},title:"Creates an empty SKILL.md scaffold you can fill in by hand",children:N?"Creating…":"Create empty scaffold"})]})]})]})]})}function qd({title:t,subtitle:a,description:s,icon:o,selected:c,disabled:u,onClick:d}){return r.jsxs("button",{type:"button",onClick:d,disabled:u,"aria-pressed":c,style:{display:"flex",gap:12,padding:"12px 14px",textAlign:"left",borderRadius:8,border:c?"2px solid var(--color-accent, #2f6f8f)":"1px solid var(--border-default, rgba(0,0,0,0.12))",background:c?"color-mix(in oklch, var(--color-accent, #2f6f8f) 8%, var(--color-paper, #fff))":u?"var(--surface-1, rgba(0,0,0,0.02))":"var(--color-paper, #fff)",color:u?"var(--text-tertiary)":"var(--text-primary)",cursor:u?"not-allowed":"pointer",opacity:u?.6:1,fontFamily:"inherit",width:"100%",transition:"border-color 120ms ease, background-color 120ms ease"},children:[r.jsx("span",{"aria-hidden":!0,style:{fontSize:22,lineHeight:1,marginTop:2},children:o}),r.jsxs("div",{style:{flex:1,minWidth:0},children:[r.jsx("div",{style:{fontSize:14,fontWeight:600,lineHeight:1.3},children:t}),r.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginTop:2,textTransform:"uppercase",letterSpacing:"0.04em"},children:a}),r.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",marginTop:6,lineHeight:1.5},children:s})]})]})}function No({label:t,hint:a,children:s}){return r.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4},children:[r.jsxs("span",{style:{display:"flex",alignItems:"baseline",gap:8},children:[r.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-primary)"},children:t}),a&&r.jsx("span",{style:{fontSize:11,color:"var(--text-tertiary)"},children:a})]}),s]})}function To(t){return{width:"100%",padding:"7px 10px",fontSize:13,fontFamily:"var(--font-mono)",border:`1px solid ${t?"var(--border-default, rgba(0,0,0,0.12))":"var(--color-error, #b91c1c)"}`,borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none",boxSizing:"border-box"}}const iv={padding:"8px 16px",fontSize:13,fontWeight:600,border:"1px solid var(--color-action, #2F5B8E)",borderRadius:6,background:"var(--color-action, #2F5B8E)",color:"var(--color-action-ink, #FFFFFF)",cursor:"pointer",fontFamily:"inherit",boxShadow:"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)",letterSpacing:"0.01em"},Yd={padding:"7px 12px",fontSize:13,fontWeight:500,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,background:"transparent",color:"var(--text-primary)",cursor:"pointer",fontFamily:"inherit"};function AT(t,a,s,o){const c=o||"<skill-name>",u=s||"<plugin-name>",d=t||"<project>";return a==="standalone"?[`${d}/skills/${c}/SKILL.md`]:a==="existing-plugin"?[`${d}/${u}/skills/${c}/SKILL.md`]:a==="new-plugin"?[`${d}/${u}/.claude-plugin/plugin.json`,`${d}/${u}/skills/${c}/SKILL.md`]:null}function eb(t){return t.trim().toLowerCase()}function MT(t,a){const s=eb(a);return s?t.filter(o=>o.name.toLowerCase().includes(s)||o.source.toLowerCase().includes(s)):t}function LT(t,a){const s=eb(a);return s?t.filter(o=>[o.name,o.description??"",o.category??"",o.author??""].join(" ").toLowerCase().includes(s)):t}function zT({open:t,onClose:a,onInstall:s,onUninstall:o,installedNames:c}){const[u,d]=p.useState(null),[h,g]=p.useState([]),[m,y]=p.useState(null),[v,b]=p.useState(null),[S,k]=p.useState(!1),[w,C]=p.useState(null),[T,N]=p.useState(""),[A,_]=p.useState("");p.useEffect(()=>{m?N(""):_("")},[m]);const D=p.useMemo(()=>MT(h,T),[h,T]),F=p.useMemo(()=>LT((v==null?void 0:v.plugins)??[],A),[v,A]);return p.useEffect(()=>{t&&(k(!0),C(null),fetch("/api/plugins/marketplaces").then(E=>E.json()).then(E=>{if(E.error)throw new Error(E.error);g(E.marketplaces??[])}).catch(E=>C(E instanceof Error?E.message:String(E))).finally(()=>k(!1)))},[t]),p.useEffect(()=>{if(!m){b(null);return}k(!0),C(null),fetch(`/api/plugins/marketplaces/${encodeURIComponent(m)}`).then(E=>E.json()).then(E=>{if(E.error)throw new Error(E.error);b(E)}).catch(E=>C(E instanceof Error?E.message:String(E))).finally(()=>k(!1))},[m]),p.useEffect(()=>{if(!t)return;function E(B){B.key==="Escape"&&a()}return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[t,a]),t?r.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Plugin marketplace","data-vskill-marketplace-drawer":!0,style:{position:"fixed",inset:0,zIndex:80},children:[r.jsx("div",{onClick:a,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.38)"}}),r.jsxs("aside",{style:{position:"absolute",top:0,right:0,bottom:0,width:"min(480px, 94vw)",background:"var(--color-paper, #fff)",borderLeft:"1px solid var(--border-default, rgba(0,0,0,0.12))",boxShadow:"-10px 0 30px -8px rgba(0,0,0,0.18)",display:"flex",flexDirection:"column",fontFamily:"var(--font-sans)"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.08))"},children:[m&&r.jsx("button",{type:"button",onClick:()=>y(null),"aria-label":"Back to marketplaces",style:{border:"none",background:"transparent",fontSize:14,color:"var(--text-secondary)",cursor:"pointer",padding:0},children:"← Back"}),r.jsx("h2",{style:{margin:0,fontSize:15,fontWeight:600,color:"var(--text-primary)",fontFamily:"var(--font-serif, ui-serif)",flex:1},children:m?(v==null?void 0:v.name)??m:"Browse plugins"}),r.jsx("button",{type:"button",onClick:a,"aria-label":"Close",style:{border:"none",background:"transparent",fontSize:16,color:"var(--text-secondary)",cursor:"pointer",padding:"4px 6px"},children:"✕"})]}),r.jsxs("div",{style:{flex:1,overflowY:"auto",padding:12},children:[S&&r.jsx("div",{style:{padding:12,fontSize:12,color:"var(--text-tertiary)"},children:"Loading…"}),w&&r.jsx("div",{style:{padding:10,fontSize:12,color:"var(--color-error, #b91c1c)",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4},children:w}),!m&&!S&&h.length===0&&!w&&r.jsx(DT,{}),!m&&h.length>0&&r.jsx(ov,{value:T,onChange:N,placeholder:"Search marketplaces…",ariaLabel:"Search marketplaces",testId:"marketplace-search"}),!m&&h.length>0&&D.length===0&&r.jsxs("div",{style:{padding:12,fontSize:12,color:"var(--text-tertiary)"},children:["No marketplaces match “",T,"”."]}),!m&&D.map(E=>r.jsxs("button",{type:"button",onClick:()=>y(E.name),style:OT,onMouseEnter:B=>{B.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.04))"},onMouseLeave:B=>{B.currentTarget.style.background="transparent"},children:[r.jsx("div",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)"},children:E.name}),r.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:E.source})]},E.name)),m&&v&&r.jsxs(r.Fragment,{children:[v.description&&r.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",padding:"0 6px 12px",lineHeight:1.5},children:v.description}),v.plugins.length===0&&r.jsx("div",{style:{padding:12,fontSize:12,color:"var(--text-tertiary)"},children:"This marketplace has no plugins catalogued yet."}),v.plugins.length>0&&r.jsx(ov,{value:A,onChange:_,placeholder:"Search plugins…",ariaLabel:"Search plugins",testId:"plugin-search"}),v.plugins.length>0&&F.length===0&&r.jsxs("div",{style:{padding:12,fontSize:12,color:"var(--text-tertiary)"},children:["No plugins match “",A,"”."]}),F.map(E=>{const B=c.has(E.name);return r.jsx("div",{style:{padding:"10px 8px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.05))"},children:r.jsxs("div",{style:{display:"flex",alignItems:"start",gap:8},children:[r.jsxs("div",{style:{flex:1,minWidth:0},children:[r.jsxs("div",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)",display:"flex",alignItems:"baseline",gap:8},children:[E.name,E.version&&r.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)"},children:E.version}),E.category&&r.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:10,background:"var(--surface-2, rgba(0,0,0,0.05))",color:"var(--text-secondary)"},children:E.category})]}),E.description&&r.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:4,lineHeight:1.5},children:E.description})]}),B&&o?r.jsx("button",{type:"button",disabled:u===E.name,onClick:async()=>{d(E.name);try{await o(E.name)}finally{d(null)}},"aria-label":`Uninstall ${E.name}`,style:{flexShrink:0,padding:"5px 12px",fontSize:12,fontWeight:600,border:"1px solid var(--color-error, #b91c1c)",borderRadius:4,background:"transparent",color:"var(--color-error, #b91c1c)",cursor:u===E.name?"wait":"pointer",opacity:u===E.name?.6:1,fontFamily:"inherit"},children:u===E.name?"Uninstalling…":"Uninstall"}):r.jsx("button",{type:"button",disabled:B,onClick:()=>s(E.name,m),style:{flexShrink:0,padding:"5px 12px",fontSize:12,fontWeight:600,border:B?"none":"1px solid var(--color-action, #2F5B8E)",borderRadius:4,background:B?"var(--surface-2, rgba(0,0,0,0.05))":"var(--color-action, #2F5B8E)",color:B?"var(--text-tertiary)":"var(--color-action-ink, #FFFFFF)",cursor:B?"default":"pointer",fontFamily:"inherit",boxShadow:B?"none":"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)"},children:B?"Installed":"Install"})]})},E.name)})]})]}),!m&&r.jsx("div",{style:{borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",padding:12},children:r.jsx(_T,{onAdded:()=>{En("marketplaces"),fetch("/api/plugins/marketplaces").then(E=>E.json()).then(E=>g(E.marketplaces??[]))}})})]})]}):null}function ov({value:t,onChange:a,placeholder:s,ariaLabel:o,testId:c}){return r.jsx("div",{style:{padding:"0 4px 10px"},children:r.jsx("input",{type:"search",value:t,onChange:u=>a(u.target.value),placeholder:s,"aria-label":o,"data-testid":c,style:{width:"100%",padding:"6px 10px",fontSize:12,fontFamily:"var(--font-sans)",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",boxSizing:"border-box"}})})}function DT(){return r.jsxs("div",{style:{padding:20,fontSize:12,color:"var(--text-tertiary)",lineHeight:1.6},children:["No marketplaces configured yet. Add one below — examples:",r.jsxs("ul",{style:{marginTop:8,paddingLeft:16},children:[r.jsx("li",{children:r.jsx("code",{children:"anthropics/claude-plugins-official"})}),r.jsx("li",{children:r.jsx("code",{children:"openai/codex-plugin-cc"})})]})]})}function _T({onAdded:t}){const[a,s]=p.useState(""),[o,c]=p.useState(!1),[u,d]=p.useState(null);async function h(){const g=a.trim();if(g){c(!0),d(null);try{const m=await fetch("/api/plugins/marketplaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:g})}),y=await m.json().catch(()=>({}));if(!m.ok||!y.ok){d(y.error??`Add failed (${m.status})`);return}s(""),t()}catch(m){d(m instanceof Error?m.message:String(m))}finally{c(!1)}}}return r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[r.jsx("label",{style:{fontSize:11,color:"var(--text-tertiary)",fontWeight:500},children:"Add marketplace (GitHub owner/repo, URL, or path)"}),r.jsxs("div",{style:{display:"flex",gap:6},children:[r.jsx("input",{type:"text",value:a,onChange:g=>s(g.target.value),onKeyDown:g=>{g.key==="Enter"&&h()},placeholder:"anthropics/claude-plugins-official",disabled:o,style:{flex:1,padding:"6px 8px",fontSize:12,fontFamily:"var(--font-mono)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none"}}),r.jsx("button",{type:"button",onClick:()=>void h(),disabled:o||!a.trim(),style:{padding:"6px 14px",fontSize:12,fontWeight:600,border:"1px solid var(--color-action, #2F5B8E)",borderRadius:4,background:"var(--color-action, #2F5B8E)",color:"var(--color-action-ink, #FFFFFF)",cursor:o||!a.trim()?"not-allowed":"pointer",opacity:o||!a.trim()?.5:1,boxShadow:"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)",fontFamily:"inherit"},children:o?"Adding…":"Add"})]}),u&&r.jsx("div",{style:{fontSize:11,color:"var(--color-error, #b91c1c)"},children:u})]})}const OT={display:"block",width:"100%",textAlign:"left",padding:"10px 12px",border:"none",borderRadius:6,background:"transparent",cursor:"pointer",fontFamily:"inherit",marginBottom:2},Kd=12;function BT({job:t,onDone:a}){const[s,o]=p.useState([]),[c,u]=p.useState("running"),[d,h]=p.useState(!1);if(p.useEffect(()=>{if(!t)return;o([]),u("running"),h(!1);const v=new AbortController;let b=[],S="running";return(async()=>{try{const k=await fetch("/api/plugins/install/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({plugin:t.ref}),signal:v.signal});if(!k.ok||!k.body){u("failed"),a({ok:!1,code:k.status,lines:[`HTTP ${k.status}`]});return}const w=k.body.getReader(),C=new TextDecoder;let T="";for(;;){const{value:N,done:A}=await w.read();if(A)break;T+=C.decode(N,{stream:!0});const _=T.split(/\n\n/);T=_.pop()??"";for(const D of _){const F=D.match(/^data:\s*(.*)$/m);if(F)try{const E=JSON.parse(F[1]);E.type==="stdout"&&E.line?(b=[...b,E.line].slice(-Kd),o(b)):E.type==="stderr"&&E.line?(b=[...b,`⚠ ${E.line}`].slice(-Kd),o(b)):E.type==="done"?(S=E.ok?"ok":"failed",u(S),Vv(),En("skills"),a({ok:E.ok??!1,code:E.code??null,lines:b})):E.type==="error"&&E.error&&(b=[...b,`✘ ${E.error}`].slice(-Kd),o(b))}catch{}}}S==="running"&&a({ok:!0,code:0,lines:b})}catch(k){if(k.name==="AbortError")return;u("failed"),a({ok:!1,code:null,lines:[...b,k instanceof Error?k.message:String(k)]})}})(),()=>v.abort()},[t==null?void 0:t.ref]),!t)return null;const g=c==="ok"?"var(--color-installed, #2F6A4A)":c==="failed"?"var(--color-error, #b91c1c)":"var(--color-accent, #2f6f8f)",m=c==="ok"?"✔":c==="failed"?"✘":"…",y=c==="ok"?"Installed":c==="failed"?"Install failed":"Installing";return r.jsxs("div",{role:"status","aria-live":"polite","data-vskill-install-toast":!0,style:{position:"fixed",bottom:16,right:16,width:"min(420px, 92vw)",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderLeft:`3px solid ${g}`,borderRadius:6,boxShadow:"0 10px 20px -6px rgba(0,0,0,0.18)",zIndex:90,fontFamily:"var(--font-sans)",overflow:"hidden"},children:[r.jsxs("button",{type:"button",onClick:()=>h(v=>!v),style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"10px 12px",border:"none",background:"transparent",cursor:"pointer",textAlign:"left",fontFamily:"inherit"},children:[r.jsx("span",{"aria-hidden":!0,style:{fontSize:16,color:g,width:16,textAlign:"center"},children:c==="running"?r.jsx(IT,{}):m}),r.jsxs("span",{style:{flex:1,minWidth:0},children:[r.jsxs("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-primary)"},children:[y,": ",t.plugin,r.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)",marginLeft:4},children:["@",t.marketplace]})]}),!d&&s.length>0&&r.jsx("span",{style:{display:"block",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s[s.length-1]})]}),r.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-tertiary)"},children:d?"▾":"▸"})]}),d&&r.jsx("pre",{style:{margin:0,padding:"0 12px 12px",maxHeight:180,overflowY:"auto",fontFamily:"var(--font-mono)",fontSize:10,lineHeight:1.5,color:"var(--text-secondary)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:s.length===0?"Waiting for output…":s.join(`
|
|
102
|
+
`)})]})}function IT(){return r.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:10,height:10,borderRadius:"50%",border:"2px solid var(--color-accent, #2f6f8f)",borderTopColor:"transparent",animation:"vskill-spin 800ms linear infinite"},children:r.jsx("style",{children:"@keyframes vskill-spin { to { transform: rotate(360deg); } }"})})}const UT=3e3,HT={anthropic:"Anthropic",openai:"OpenAI",openrouter:"OpenRouter"};function cv(t){return t==="anthropic"||t==="openai"||t==="openrouter"}function $T(){const{toast:t}=Wo(),a=p.useRef(new Map),s=p.useCallback(o=>{if(!cv(o.provider))return;const c=Date.now(),u=a.current.get(o.provider)??0;if(c-u<UT)return;a.current.set(o.provider,c);const d=HT[o.provider];t({message:`${d} API key invalid or missing. Open Settings →`,severity:"error",action:{label:"Open Settings",onInvoke:()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:open-settings",{detail:{provider:o.provider}}))}}})},[t]);return p.useEffect(()=>{function o(c){const u=c.detail;!u||!cv(u.provider)||s({provider:u.provider})}return window.addEventListener("studio:api-key-error",o),()=>window.removeEventListener("studio:api-key-error",o)},[s]),{report:s}}const tb="vskill.studio.prefs";function nb(){try{return typeof window>"u"?null:window.localStorage??null}catch{return null}}function rb(){const t=nb();if(!t)return{};try{const a=t.getItem(tb);if(!a)return{};const s=JSON.parse(a);return s&&typeof s=="object"&&!Array.isArray(s)?s:{}}catch{return{}}}function VT(t,a){const s=nb();if(s)try{const c={...rb(),[t]:a};s.setItem(tb,JSON.stringify(c))}catch{}}function PT(t,a){const o=rb()[t];return o===void 0?a:o}const uv={open:!1,x:0,y:0,skill:null};function FT(t,a){return{open:!0,x:t.clientX,y:t.clientY,skill:a}}function _a(t,a="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:t,severity:a}}))}function GT(t){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:request-delete",{detail:{skill:t}}))}function WT(t,a){var s;switch(t){case"copy-path":try{(s=navigator.clipboard)==null||s.writeText(a.dir)}catch{_a(ne.toasts.permissionDenied,"error");return}_a(ne.toasts.pathCopied,"info");return;case"open":case"reveal":case"edit":_a(ne.actions.editPlaceholder,"info");return;case"run-benchmark":_a(ne.toasts.benchmarkQueued,"info");return;case"duplicate":_a(ne.toasts.skillDuplicated,"info");return;case"update":_a(ne.toasts.skillUpdated,"info");return;case"uninstall":_a(ne.actions.editPlaceholder,"info");return;case"delete":GT(a);return;default:return}}function qT(t){return t.startsWith("#/create")}function YT(t){return t.startsWith("#/updates")}function ab(t){const[a,s]=p.useState(()=>typeof window<"u"&&t(window.location.hash));return p.useEffect(()=>{function o(){s(t(window.location.hash))}return window.addEventListener("hashchange",o),o(),()=>window.removeEventListener("hashchange",o)},[]),a}function KT(){return ab(qT)}function XT(){return ab(YT)}function QT(){var o,c;if(typeof navigator>"u")return"⌘⇧K";const t=((o=navigator.platform)==null?void 0:o.toUpperCase())??"",a=((c=navigator.userAgent)==null?void 0:c.toUpperCase())??"";return t.includes("MAC")||a.includes("MAC")?"⌘⇧K":"Ctrl+Shift+K"}function ZT(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function JT(){const[t,a]=p.useState("⌘⇧K");p.useEffect(()=>{a(QT())},[]);const s=ZT();function o(){window.dispatchEvent(new CustomEvent("openFindSkills"))}return r.jsxs("button",{type:"button",onClick:o,"aria-label":`Find verified skills — opens search (${t})`,title:`Find verified skills (${t})`,"data-testid":"find-skills-nav-button",style:{display:"inline-flex",alignItems:"center",gap:6,height:28,padding:"0 12px",borderRadius:6,border:"1px solid var(--border-default)",background:"transparent",color:"var(--text-secondary)",fontSize:12,fontWeight:500,fontFamily:"var(--font-sans)",cursor:"pointer",letterSpacing:"0.01em"},children:[r.jsxs("svg",{"data-icon":"search","aria-hidden":"true",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("circle",{cx:"11",cy:"11",r:"8"}),r.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),r.jsx("span",{children:"Find skills"}),r.jsx("kbd",{"data-animated":s?"false":"true",style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-faint)",border:"1px solid var(--border-default)",borderRadius:4,padding:"1px 5px",marginLeft:2,lineHeight:1},children:t})]})}const eR=p.lazy(()=>Ha(()=>import("./CommandPalette-B1lpjr8F.js"),__vite__mapDeps([2,1]))),tR=p.lazy(()=>Ha(()=>import("./FindSkillsPalette-BaZE9bu1.js"),__vite__mapDeps([3,1])).then(t=>({default:t.FindSkillsPalette}))),nR=p.lazy(()=>Ha(()=>import("./SkillDetailPanel-DncmK2MR.js"),__vite__mapDeps([4,5,1])).then(t=>({default:t.SkillDetailPanel}))),rR=p.lazy(()=>Ha(()=>import("./CreateSkillPage-Dv1SXZYl.js"),__vite__mapDeps([6,1])).then(t=>({default:t.CreateSkillPage}))),aR=p.lazy(()=>Ha(()=>Promise.resolve().then(()=>dN),void 0).then(t=>({default:t.UpdatesPanel})));function lR(){return r.jsx(RS,{children:r.jsx(ES,{children:r.jsxs(N2,{children:[r.jsx(sR,{}),r.jsx(FN,{})]})})})}function sR(){var Nt,Le;const{state:t,selectSkill:a,clearSelection:s,refreshSkills:o,outdatedByOrigin:c,revealSkill:u,clearReveal:d}=er(),{config:h}=$a(),{mode:g,resolvedTheme:m,setTheme:y}=$v(),{toast:v}=Wo(),[b,S]=p.useState(()=>eC()),[k]=p.useState(!0),[w,C]=p.useState(!1),[T,N]=p.useState(!1),[A,_]=p.useState(!1),[D,F]=p.useState("overview"),[E,B]=p.useState(uv),L=p.useCallback((se,Se)=>{B(FT(se,Se))},[]),U=yT(),[$,q]=p.useState(()=>PT("activeAgent",null)),X=p.useCallback(se=>{q(se),VT("activeAgent",se),typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:agent-changed",{detail:{agentId:se}}))},[]);p.useEffect(()=>{var se;!$&&((se=U.response)!=null&&se.suggested)&&X(U.response.suggested)},[$,(Nt=U.response)==null?void 0:Nt.suggested,X]);const ee=p.useMemo(()=>U.response?pT(U.response):[],[U.response]),{workspace:I,switchProject:z,addProject:O,removeProject:P,activeProject:H}=CT(),[ae,M]=p.useState(!1),[Y,W]=p.useState(!1),[Q,oe]=p.useState("standalone"),de=p.useCallback((se="standalone")=>{oe(se),W(!0)},[]);p.useEffect(()=>{function se(Se){if(!(Se instanceof CustomEvent))return;const Me=Se.detail;de((Me==null?void 0:Me.mode)??"standalone")}return window.addEventListener("studio:request-create-skill",se),()=>window.removeEventListener("studio:request-create-skill",se)},[de]);const[ve,ce]=p.useState(!1),[je,Re]=p.useState(null);p.useEffect(()=>{function se(){ce(!0)}return window.addEventListener("studio:open-marketplace",se),()=>window.removeEventListener("studio:open-marketplace",se)},[]);const Oe=p.useMemo(()=>{const se=new Set;for(const Se of t.skills)Se.source==="plugin"&&Se.pluginName&&se.add(Se.pluginName);return se},[t.skills]);of([{key:"p",meta:!0,handler:se=>{var Me;const Se=typeof document<"u"?document.activeElement:null;Se&&Se.tagName==="INPUT"||((Me=se==null?void 0:se.preventDefault)==null||Me.call(se),M(Fa=>!Fa))}}],{enabled:!0});const le=aT(),he=le.open;p.useEffect(()=>{function se(Se){if(!(Se instanceof CustomEvent))return;const Me=Se.detail;Me!=null&&Me.provider&&he(Me.provider)}return window.addEventListener("studio:open-setup-drawer",se),()=>window.removeEventListener("studio:open-setup-drawer",se)},[he]);const pe=p.useCallback(()=>{B(uv)},[]);p.useEffect(()=>{function se(Se){if(!(Se instanceof CustomEvent))return;const Me=Se.detail;Me!=null&&Me.message&&v({message:Me.message,severity:Me.severity??"info"})}return window.addEventListener("studio:toast",se),()=>window.removeEventListener("studio:toast",se)},[v]),$T();const[xe,be]=p.useState(!1),[Be,Ue]=p.useState(void 0);p.useEffect(()=>{function se(Se){if(!(Se instanceof CustomEvent))return;const Me=Se.detail;Ue(Me==null?void 0:Me.provider),be(!0)}return window.addEventListener("studio:open-settings",se),()=>window.removeEventListener("studio:open-settings",se)},[]),p.useEffect(()=>{document.documentElement.style.setProperty("--sidebar-width",`${b}px`)},[b]);const[lt,Ct]=p.useState(null),[gt,Tt]=p.useState(()=>new Set),Gt=p.useRef(!1),We=p.useMemo(()=>Dw(),[]),nt=p.useCallback(se=>`${se.plugin}/${se.skill}`,[]),xn=p.useCallback(se=>{Tt(Se=>{const Me=new Set(Se);return Me.add(nt(se)),Me})},[nt]),ye=p.useCallback(se=>{Tt(Se=>{const Me=new Set(Se);return Me.delete(nt(se)),Me})},[nt]),ot=KN({delayMs:1e4,onCommit:se=>{o(),ye(se)},onFailure:(se,Se)=>{ye(se),v({message:`Couldn't delete ${se.skill}: ${Se.message}`,severity:"error",durationMs:0,action:{label:ne.actions.retry,onInvoke:()=>{xn(se),ot.enqueueDelete(se)}}})}});p.useEffect(()=>{function se(Se){if(!(Se instanceof CustomEvent))return;const Me=Se.detail;Me!=null&&Me.skill&&Ct(Me.skill)}return window.addEventListener("studio:request-delete",se),()=>window.removeEventListener("studio:request-delete",se)},[]);const Wt=p.useCallback(()=>{const se=lt;if(Ct(null),!se)return;const Se={plugin:se.plugin,skill:se.skill};xn(Se),ot.enqueueDelete(Se);const Me=Gt.current?"":`Sent to your ${We}. Open Trash to restore. `;Gt.current=!0,v({message:`${Me}Deleted ${se.skill}`,severity:"info",durationMs:1e4,action:{label:ne.actions.undo,onInvoke:()=>{ot.cancelDelete(nt(Se)),ye(Se)}}})},[lt,xn,ye,ot,v,We,nt]),Kt=p.useCallback(()=>{Ct(null)},[]),An=p.useMemo(()=>t.skills.filter(se=>!gt.has(nt(se))),[t.skills,gt,nt]),Et=p.useMemo(()=>t.selectedSkill?t.skills.find(se=>se.plugin===t.selectedSkill.plugin&&se.skill===t.selectedSkill.skill)??null:null,[t.skills,t.selectedSkill]),Mn=p.useCallback(se=>{a({plugin:se.plugin,skill:se.skill,origin:se.origin})},[a]),Ut=p.useMemo(()=>{if(!t.selectedSkill)return"";const se=t.selectedSkill.origin==="installed"?"Installed":"Own";return`Viewing ${t.selectedSkill.skill} (${se})`},[t.selectedSkill]),Rt=p.useMemo(()=>[{id:"switch-theme",label:ne.palette.actionSwitchTheme,description:"Cycle light / dark / auto",keywords:["theme","dark","light","mode"],onInvoke:()=>y(g==="light"?"dark":g==="dark"?"auto":"light")},{id:"toggle-sidebar",label:"Toggle sidebar",description:"Show or hide the skills sidebar",keywords:["sidebar","panel","hide","show","cmd+b"],onInvoke:()=>_(se=>!se)},{id:"show-shortcuts",label:"Show keyboard shortcuts",description:"Open the cheatsheet",keywords:["help","keys"],onInvoke:()=>N(!0)},{id:"refresh-skills",label:"Refresh skills",description:"Re-scan local + installed",keywords:["reload","scan"],onInvoke:()=>o()}],[g,y,o]),[ct,Wn]=p.useState(null);of([{key:"cmd+k",handler:()=>C(se=>!se)},{key:"ctrl+k",handler:()=>C(se=>!se)},{key:"cmd+shift+k",handler:()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("openFindSkills"))}},{key:"ctrl+shift+k",handler:()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("openFindSkills"))}},{key:"?",handler:()=>N(se=>!se)},{key:"cmd+shift+d",handler:()=>y(m==="light"?"dark":"light")},{key:"ctrl+shift+d",handler:()=>y(m==="light"?"dark":"light")},{key:"cmd+b",handler:()=>_(se=>!se)},{key:"ctrl+b",handler:()=>_(se=>!se)},{key:"e",handler:()=>v({message:ne.actions.editPlaceholder,severity:"info"})}]);const tr=KT(),gn=XT()?r.jsx(p.Suspense,{fallback:r.jsx("div",{style:{padding:40},children:"Loading…"}),children:r.jsx(aR,{})}):tr?r.jsx(p.Suspense,{fallback:r.jsx("div",{style:{padding:40},children:"Loading…"}),children:r.jsx(rR,{})}):r.jsx(ON,{selectedSkillInfo:Et,activeDetailTab:D,onDetailTabChange:F,allSkills:t.skills,onSelectSkill:Mn});return r.jsxs(r.Fragment,{children:[r.jsx(AS,{sidebarWidth:b,sidebarHidden:A||t.isMobile&&t.mobileView==="detail",banner:r.jsx(rC,{connected:k}),liveMessage:Ut,topRail:r.jsx(M2,{projectName:(h==null?void 0:h.projectName)??null,selected:t.selectedSkill,onOpenPalette:()=>C(!0),onHome:s,onRequestCreateSkill:()=>de("standalone"),projectPickerSlot:I&&I.projects.length>0?r.jsx(ET,{workspace:I,onSwitch:z,onAdd:O,onRemove:P}):void 0,findSkillsSlot:r.jsx(JT,{})}),sidebar:r.jsx(Ww,{skills:An,selectedKey:t.selectedSkill?{plugin:t.selectedSkill.plugin,skill:t.selectedSkill.skill}:null,onSelect:Mn,isLoading:t.skillsLoading,error:t.skillsError??null,onRetry:o,onContextMenu:L,outdatedByOrigin:c,activeAgentId:$,revealSkillId:t.revealSkillId,onRevealComplete:d,topSlot:U.status==="ready"&&ee.length>0?r.jsxs(r.Fragment,{children:[r.jsx(mT,{agents:ee,activeAgentId:$,onActiveAgentChange:X,onOpenSetup:se=>le.open(se)}),r.jsx(vT,{activeAgentId:$})]}):null}),resizeHandle:r.jsx(nC,{initialWidth:b??Vs,onChange:S}),main:gn,statusBar:r.jsx(V2,{projectPath:(h==null?void 0:h.root)??null,modelName:(h==null?void 0:h.model)??null,health:h!=null&&h.error?"degraded":"ok",providers:(Le=h==null?void 0:h.providers)==null?void 0:Le.map(se=>{const Se=se.id;return{id:Se,label:se.label,available:se.available,kind:Se==="ollama"||Se==="lm-studio"?"start-service":Se==="anthropic"||Se==="openrouter"?"api-key":"cli-install"}})})}),r.jsx(WN,{open:T,onClose:()=>N(!1)}),r.jsx(ZN,{open:le.isOpen,providerKey:le.providerKey,onClose:le.close}),r.jsx(YN,{state:E,onClose:pe,onAction:(se,Se)=>WT(se,Se)}),w&&r.jsx(p.Suspense,{fallback:null,children:r.jsx(eR,{open:w,onClose:()=>C(!1),commands:Rt})}),r.jsx(p.Suspense,{fallback:null,children:r.jsx(tR,{onSelect:se=>{const Se=se.name.split("/");Se.length===3&&Wn({owner:Se[0],repo:Se[1],slug:Se[2],displayName:se.displayName??se.name})}})}),ct&&r.jsx(p.Suspense,{fallback:null,children:r.jsx(nR,{selectedSkill:ct,onClose:()=>Wn(null)})}),r.jsx(TT,{open:ae,projects:(I==null?void 0:I.projects)??[],onSwitch:se=>{z(se)},onClose:()=>M(!1)}),r.jsx(RT,{open:Y,onClose:()=>W(!1),initialMode:Q,isClaudeCode:$==="claude-code",projectRoot:(H==null?void 0:H.path)??(h==null?void 0:h.projectName)??"",onCreated:se=>{o(),setTimeout(()=>{u(se.pluginName??"",se.skillName)},500)}}),r.jsx(zT,{open:ve,onClose:()=>ce(!1),installedNames:Oe,onInstall:(se,Se)=>{Re({plugin:se,marketplace:Se,ref:`${se}@${Se}`}),ce(!1)},onUninstall:async se=>{if(window.confirm(`Uninstall ${se}? This removes the plugin and its skills.`))try{const Se=await fetch(`/api/plugins/${encodeURIComponent(se)}/uninstall`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),Me=await Se.json().catch(()=>({}));if(!Se.ok||!Me.ok){v({message:Me.error??`Uninstall failed (${Se.status})`,severity:"error"});return}v({message:`Uninstalled ${se}.`,severity:"info"}),o()}catch(Se){v({message:Se instanceof Error?Se.message:String(Se),severity:"error"})}}}),r.jsx(Bv,{open:xe,onClose:()=>be(!1),initialProvider:Be,onToast:se=>v({message:se,severity:"info"})}),r.jsx(BT,{job:je,onDone:se=>{se.ok&&(o(),setTimeout(()=>Re(null),3e3))}}),r.jsx(ky,{open:lt!==null,title:lt?`Delete "${lt.skill}"?`:"",body:`It will be sent to your ${We}. You can recover it from there.`,confirmLabel:"Delete",cancelLabel:"Cancel",variant:"destructive",onConfirm:Wt,onCancel:Kt})]})}const dv="vskill.migrations.scope-rename.v1",iR={own:"authoring-project",installed:"available-project",global:"available-personal"},oR=/^vskill-sidebar-(.+)-(own|installed|global)-collapsed$/;function cR(t){if(t.getItem(dv)==="done")return;const a=[];for(let s=0;s<t.length;s++){const o=t.key(s);if(!o)continue;const c=o.match(oR);if(!c)continue;const[,u,d]=c,h=iR[d];if(!h)continue;const g=t.getItem(o);g!==null&&a.push({oldKey:o,newKey:`vskill-sidebar-${u}-${h}-collapsed`,value:g})}for(const{oldKey:s,newKey:o,value:c}of a)t.getItem(o)===null&&t.setItem(o,c),t.removeItem(s);t.setItem(dv,"done")}if(typeof PerformanceObserver<"u")try{const t=new PerformanceObserver(a=>{for(const s of a.getEntries())if(s.name==="first-contentful-paint"){window.__vskillPaint=s.startTime,t.disconnect();return}});t.observe({type:"paint",buffered:!0})}catch{}if(typeof window<"u"&&window.localStorage)try{cR(window.localStorage)}catch{}k0.createRoot(document.getElementById("root")).render(r.jsx(p.StrictMode,{children:r.jsx(Fj,{children:r.jsx(B2,{children:r.jsx(lR,{})})})}));export{ec as E,Av as L,ai as P,Ne as R,sN as S,dR as T,Ha as _,$a as a,rb as b,rN as c,Zo as d,Wo as e,er as f,PT as g,we as h,Ay as i,r as j,p as r,ne as s,mf as t,lj as u,VT as w};
|