vskill 0.5.112 → 0.5.114
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/commands/add.js +8 -0
- package/dist/commands/add.js.map +1 -1
- package/dist/eval-server/api-routes.d.ts +8 -0
- package/dist/eval-server/api-routes.js +55 -2
- package/dist/eval-server/api-routes.js.map +1 -1
- package/dist/eval-server/detect-engines-route.d.ts +8 -0
- package/dist/eval-server/detect-engines-route.js +31 -0
- package/dist/eval-server/detect-engines-route.js.map +1 -0
- package/dist/eval-server/install-engine-routes-helpers.d.ts +7 -0
- package/dist/eval-server/install-engine-routes-helpers.js +25 -0
- package/dist/eval-server/install-engine-routes-helpers.js.map +1 -0
- package/dist/eval-server/install-engine-routes.d.ts +32 -0
- package/dist/eval-server/install-engine-routes.js +210 -0
- package/dist/eval-server/install-engine-routes.js.map +1 -0
- package/dist/eval-server/platform-proxy.js +17 -0
- package/dist/eval-server/platform-proxy.js.map +1 -1
- package/dist/eval-server/skill-create-routes.d.ts +14 -0
- package/dist/eval-server/skill-create-routes.js +34 -3
- package/dist/eval-server/skill-create-routes.js.map +1 -1
- package/dist/eval-ui/assets/{CommandPalette-BmPDARqF.js → CommandPalette-DyknO-U5.js} +1 -1
- package/dist/eval-ui/assets/CreateSkillPage-CIhAMdn-.js +13 -0
- package/dist/eval-ui/assets/{UpdateDropdown-DRPVz-9R.js → UpdateDropdown-BKkSZEVM.js} +1 -1
- package/dist/eval-ui/assets/index-C0lGF333.css +1 -0
- package/dist/eval-ui/assets/index-DE8Rbu7o.js +102 -0
- package/dist/eval-ui/index.html +2 -2
- package/dist/lockfile/types.d.ts +4 -0
- package/dist/studio/routes/index.js +4 -0
- package/dist/studio/routes/index.js.map +1 -1
- package/dist/utils/skill-builder-detection.d.ts +19 -0
- package/dist/utils/skill-builder-detection.js +118 -0
- package/dist/utils/skill-builder-detection.js.map +1 -0
- package/dist/utils/skill-creator-detection.d.ts +8 -0
- package/dist/utils/skill-creator-detection.js +67 -0
- package/dist/utils/skill-creator-detection.js.map +1 -1
- package/package.json +1 -1
- package/dist/eval-ui/assets/CreateSkillPage-C9oCWsMA.js +0 -12
- package/dist/eval-ui/assets/index-CyYEYhQ8.css +0 -1
- package/dist/eval-ui/assets/index-TyJIV4hi.js +0 -102
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-DRPVz-9R.js","assets/fonts-i7Lkz2zN.css","assets/CommandPalette-BmPDARqF.js","assets/CreateSkillPage-C9oCWsMA.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
/* empty css */(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const 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 av(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var sd={exports:{}},ws={};/**
|
|
3
|
-
* @license React
|
|
4
|
-
* react-jsx-runtime.production.js
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the MIT license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var kx;function J1(){if(kx)return ws;kx=1;var t=Symbol.for("react.transitional.element"),r=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 ws.Fragment=r,ws.jsx=s,ws.jsxs=s,ws}var wx;function e0(){return wx||(wx=1,sd.exports=J1()),sd.exports}var a=e0(),id={exports:{}},Ie={};/**
|
|
11
|
-
* @license React
|
|
12
|
-
* react.production.js
|
|
13
|
-
*
|
|
14
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
-
*
|
|
16
|
-
* This source code is licensed under the MIT license found in the
|
|
17
|
-
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var Cx;function t0(){if(Cx)return Ie;Cx=1;var t=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),d=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),b=Symbol.iterator;function k(D){return D===null||typeof D!="object"?null:(D=b&&D[b]||D["@@iterator"],typeof D=="function"?D:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,C={};function T(D,P,ee){this.props=D,this.context=P,this.refs=C,this.updater=ee||S}T.prototype.isReactComponent={},T.prototype.setState=function(D,P){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,P,"setState")},T.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function R(){}R.prototype=T.prototype;function L(D,P,ee){this.props=D,this.context=P,this.refs=C,this.updater=ee||S}var B=L.prototype=new R;B.constructor=L,w(B,T.prototype),B.isPureReactComponent=!0;var z=Array.isArray;function F(){}var E={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function N(D,P,ee){var re=ee.ref;return{$$typeof:t,type:D,key:P,ref:re!==void 0?re:null,props:ee}}function _(D,P){return N(D.type,P,D.props)}function V(D){return typeof D=="object"&&D!==null&&D.$$typeof===t}function W(D){var P={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(ee){return P[ee]})}var Y=/\/+/g;function X(D,P){return typeof D=="object"&&D!==null&&D.key!=null?W(""+D.key):P.toString(36)}function H(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(F,F):(D.status="pending",D.then(function(P){D.status==="pending"&&(D.status="fulfilled",D.value=P)},function(P){D.status==="pending"&&(D.status="rejected",D.reason=P)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function M(D,P,ee,re,xe){var ce=typeof D;(ce==="undefined"||ce==="boolean")&&(D=null);var ye=!1;if(D===null)ye=!0;else switch(ce){case"bigint":case"string":case"number":ye=!0;break;case"object":switch(D.$$typeof){case t:case r:ye=!0;break;case y:return ye=D._init,M(ye(D._payload),P,ee,re,xe)}}if(ye)return xe=xe(D),ye=re===""?"."+X(D,0):re,z(xe)?(ee="",ye!=null&&(ee=ye.replace(Y,"$&/")+"/"),M(xe,P,ee,"",function(Re){return Re})):xe!=null&&(V(xe)&&(xe=_(xe,ee+(xe.key==null||D&&D.key===xe.key?"":(""+xe.key).replace(Y,"$&/")+"/")+ye)),P.push(xe)),1;ye=0;var de=re===""?".":re+":";if(z(D))for(var je=0;je<D.length;je++)re=D[je],ce=de+X(re,je),ye+=M(re,P,ee,ce,xe);else if(je=k(D),typeof je=="function")for(D=je.call(D),je=0;!(re=D.next()).done;)re=re.value,ce=de+X(re,je++),ye+=M(re,P,ee,ce,xe);else if(ce==="object"){if(typeof D.then=="function")return M(H(D),P,ee,re,xe);throw P=String(D),Error("Objects are not valid as a React child (found: "+(P==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":P)+"). If you meant to render a collection of children, use an array instead.")}return ye}function O(D,P,ee){if(D==null)return D;var re=[],xe=0;return M(D,re,"","",function(ce){return P.call(ee,ce,xe++)}),re}function U(D){if(D._status===-1){var P=D._result;P=P(),P.then(function(ee){(D._status===0||D._status===-1)&&(D._status=1,D._result=ee)},function(ee){(D._status===0||D._status===-1)&&(D._status=2,D._result=ee)}),D._status===-1&&(D._status=0,D._result=P)}if(D._status===1)return D._result.default;throw D._result}var G=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var P=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(P))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},ue={map:O,forEach:function(D,P,ee){O(D,function(){P.apply(this,arguments)},ee)},count:function(D){var P=0;return O(D,function(){P++}),P},toArray:function(D){return O(D,function(P){return P})||[]},only:function(D){if(!V(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Ie.Activity=v,Ie.Children=ue,Ie.Component=T,Ie.Fragment=s,Ie.Profiler=c,Ie.PureComponent=L,Ie.StrictMode=o,Ie.Suspense=g,Ie.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=E,Ie.__COMPILER_RUNTIME={__proto__:null,c:function(D){return E.H.useMemoCache(D)}},Ie.cache=function(D){return function(){return D.apply(null,arguments)}},Ie.cacheSignal=function(){return null},Ie.cloneElement=function(D,P,ee){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var re=w({},D.props),xe=D.key;if(P!=null)for(ce in P.key!==void 0&&(xe=""+P.key),P)!I.call(P,ce)||ce==="key"||ce==="__self"||ce==="__source"||ce==="ref"&&P.ref===void 0||(re[ce]=P[ce]);var ce=arguments.length-2;if(ce===1)re.children=ee;else if(1<ce){for(var ye=Array(ce),de=0;de<ce;de++)ye[de]=arguments[de+2];re.children=ye}return N(D.type,xe,re)},Ie.createContext=function(D){return D={$$typeof:d,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:u,_context:D},D},Ie.createElement=function(D,P,ee){var re,xe={},ce=null;if(P!=null)for(re in P.key!==void 0&&(ce=""+P.key),P)I.call(P,re)&&re!=="key"&&re!=="__self"&&re!=="__source"&&(xe[re]=P[re]);var ye=arguments.length-2;if(ye===1)xe.children=ee;else if(1<ye){for(var de=Array(ye),je=0;je<ye;je++)de[je]=arguments[je+2];xe.children=de}if(D&&D.defaultProps)for(re in ye=D.defaultProps,ye)xe[re]===void 0&&(xe[re]=ye[re]);return N(D,ce,xe)},Ie.createRef=function(){return{current:null}},Ie.forwardRef=function(D){return{$$typeof:h,render:D}},Ie.isValidElement=V,Ie.lazy=function(D){return{$$typeof:y,_payload:{_status:-1,_result:D},_init:U}},Ie.memo=function(D,P){return{$$typeof:p,type:D,compare:P===void 0?null:P}},Ie.startTransition=function(D){var P=E.T,ee={};E.T=ee;try{var re=D(),xe=E.S;xe!==null&&xe(ee,re),typeof re=="object"&&re!==null&&typeof re.then=="function"&&re.then(F,G)}catch(ce){G(ce)}finally{P!==null&&ee.types!==null&&(P.types=ee.types),E.T=P}},Ie.unstable_useCacheRefresh=function(){return E.H.useCacheRefresh()},Ie.use=function(D){return E.H.use(D)},Ie.useActionState=function(D,P,ee){return E.H.useActionState(D,P,ee)},Ie.useCallback=function(D,P){return E.H.useCallback(D,P)},Ie.useContext=function(D){return E.H.useContext(D)},Ie.useDebugValue=function(){},Ie.useDeferredValue=function(D,P){return E.H.useDeferredValue(D,P)},Ie.useEffect=function(D,P){return E.H.useEffect(D,P)},Ie.useEffectEvent=function(D){return E.H.useEffectEvent(D)},Ie.useId=function(){return E.H.useId()},Ie.useImperativeHandle=function(D,P,ee){return E.H.useImperativeHandle(D,P,ee)},Ie.useInsertionEffect=function(D,P){return E.H.useInsertionEffect(D,P)},Ie.useLayoutEffect=function(D,P){return E.H.useLayoutEffect(D,P)},Ie.useMemo=function(D,P){return E.H.useMemo(D,P)},Ie.useOptimistic=function(D,P){return E.H.useOptimistic(D,P)},Ie.useReducer=function(D,P,ee){return E.H.useReducer(D,P,ee)},Ie.useRef=function(D){return E.H.useRef(D)},Ie.useState=function(D){return E.H.useState(D)},Ie.useSyncExternalStore=function(D,P,ee){return E.H.useSyncExternalStore(D,P,ee)},Ie.useTransition=function(){return E.H.useTransition()},Ie.version="19.2.4",Ie}var Ex;function of(){return Ex||(Ex=1,id.exports=t0()),id.exports}var m=of();const Ne=av(m);var od={exports:{}},Cs={},cd={exports:{}},ud={};/**
|
|
19
|
-
* @license React
|
|
20
|
-
* scheduler.production.js
|
|
21
|
-
*
|
|
22
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the MIT license found in the
|
|
25
|
-
* LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/var Nx;function n0(){return Nx||(Nx=1,(function(t){function r(M,O){var U=M.length;M.push(O);e:for(;0<U;){var G=U-1>>>1,ue=M[G];if(0<c(ue,O))M[G]=O,M[U]=ue,U=G;else break e}}function s(M){return M.length===0?null:M[0]}function o(M){if(M.length===0)return null;var O=M[0],U=M.pop();if(U!==O){M[0]=U;e:for(var G=0,ue=M.length,D=ue>>>1;G<D;){var P=2*(G+1)-1,ee=M[P],re=P+1,xe=M[re];if(0>c(ee,U))re<ue&&0>c(xe,ee)?(M[G]=xe,M[re]=U,G=re):(M[G]=ee,M[P]=U,G=P);else if(re<ue&&0>c(xe,U))M[G]=xe,M[re]=U,G=re;else break e}}return O}function c(M,O){var U=M.sortIndex-O.sortIndex;return U!==0?U:M.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=[],p=[],y=1,v=null,b=3,k=!1,S=!1,w=!1,C=!1,T=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;function B(M){for(var O=s(p);O!==null;){if(O.callback===null)o(p);else if(O.startTime<=M)o(p),O.sortIndex=O.expirationTime,r(g,O);else break;O=s(p)}}function z(M){if(w=!1,B(M),!S)if(s(g)!==null)S=!0,F||(F=!0,W());else{var O=s(p);O!==null&&H(z,O.startTime-M)}}var F=!1,E=-1,I=5,N=-1;function _(){return C?!0:!(t.unstable_now()-N<I)}function V(){if(C=!1,F){var M=t.unstable_now();N=M;var O=!0;try{e:{S=!1,w&&(w=!1,R(E),E=-1),k=!0;var U=b;try{t:{for(B(M),v=s(g);v!==null&&!(v.expirationTime>M&&_());){var G=v.callback;if(typeof G=="function"){v.callback=null,b=v.priorityLevel;var ue=G(v.expirationTime<=M);if(M=t.unstable_now(),typeof ue=="function"){v.callback=ue,B(M),O=!0;break t}v===s(g)&&o(g),B(M)}else o(g);v=s(g)}if(v!==null)O=!0;else{var D=s(p);D!==null&&H(z,D.startTime-M),O=!1}}break e}finally{v=null,b=U,k=!1}O=void 0}}finally{O?W():F=!1}}}var W;if(typeof L=="function")W=function(){L(V)};else if(typeof MessageChannel<"u"){var Y=new MessageChannel,X=Y.port2;Y.port1.onmessage=V,W=function(){X.postMessage(null)}}else W=function(){T(V,0)};function H(M,O){E=T(function(){M(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(M){M.callback=null},t.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<M?Math.floor(1e3/M):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_next=function(M){switch(b){case 1:case 2:case 3:var O=3;break;default:O=b}var U=b;b=O;try{return M()}finally{b=U}},t.unstable_requestPaint=function(){C=!0},t.unstable_runWithPriority=function(M,O){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var U=b;b=M;try{return O()}finally{b=U}},t.unstable_scheduleCallback=function(M,O,U){var G=t.unstable_now();switch(typeof U=="object"&&U!==null?(U=U.delay,U=typeof U=="number"&&0<U?G+U:G):U=G,M){case 1:var ue=-1;break;case 2:ue=250;break;case 5:ue=1073741823;break;case 4:ue=1e4;break;default:ue=5e3}return ue=U+ue,M={id:y++,callback:O,priorityLevel:M,startTime:U,expirationTime:ue,sortIndex:-1},U>G?(M.sortIndex=U,r(p,M),s(g)===null&&M===s(p)&&(w?(R(E),E=-1):w=!0,H(z,U-G))):(M.sortIndex=ue,r(g,M),S||k||(S=!0,F||(F=!0,W()))),M},t.unstable_shouldYield=_,t.unstable_wrapCallback=function(M){var O=b;return function(){var U=b;b=O;try{return M.apply(this,arguments)}finally{b=U}}}})(ud)),ud}var Tx;function a0(){return Tx||(Tx=1,cd.exports=n0()),cd.exports}var dd={exports:{}},Jt={};/**
|
|
27
|
-
* @license React
|
|
28
|
-
* react-dom.production.js
|
|
29
|
-
*
|
|
30
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
31
|
-
*
|
|
32
|
-
* This source code is licensed under the MIT license found in the
|
|
33
|
-
* LICENSE file in the root directory of this source tree.
|
|
34
|
-
*/var Rx;function r0(){if(Rx)return Jt;Rx=1;var t=of();function r(g){var p="https://react.dev/errors/"+g;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)p+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+g+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var o={d:{f:s,r:function(){throw Error(r(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},c=Symbol.for("react.portal");function u(g,p,y){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:v==null?null:""+v,children:g,containerInfo:p,implementation:y}}var d=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(g,p){if(g==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Jt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Jt.createPortal=function(g,p){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(r(299));return u(g,p,null,y)},Jt.flushSync=function(g){var p=d.T,y=o.p;try{if(d.T=null,o.p=2,g)return g()}finally{d.T=p,o.p=y,o.d.f()}},Jt.preconnect=function(g,p){typeof g=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,o.d.C(g,p))},Jt.prefetchDNS=function(g){typeof g=="string"&&o.d.D(g)},Jt.preinit=function(g,p){if(typeof g=="string"&&p&&typeof p.as=="string"){var y=p.as,v=h(y,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,k=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;y==="style"?o.d.S(g,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:v,integrity:b,fetchPriority:k}):y==="script"&&o.d.X(g,{crossOrigin:v,integrity:b,fetchPriority:k,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Jt.preinitModule=function(g,p){if(typeof g=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var y=h(p.as,p.crossOrigin);o.d.M(g,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&o.d.M(g)},Jt.preload=function(g,p){if(typeof g=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,v=h(y,p.crossOrigin);o.d.L(g,y,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Jt.preloadModule=function(g,p){if(typeof g=="string")if(p){var y=h(p.as,p.crossOrigin);o.d.m(g,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else o.d.m(g)},Jt.requestFormReset=function(g){o.d.r(g)},Jt.unstable_batchedUpdates=function(g,p){return g(p)},Jt.useFormState=function(g,p,y){return d.H.useFormState(g,p,y)},Jt.useFormStatus=function(){return d.H.useHostTransitionStatus()},Jt.version="19.2.4",Jt}var Ax;function rv(){if(Ax)return dd.exports;Ax=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(r){console.error(r)}}return t(),dd.exports=r0(),dd.exports}/**
|
|
35
|
-
* @license React
|
|
36
|
-
* react-dom-client.production.js
|
|
37
|
-
*
|
|
38
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
39
|
-
*
|
|
40
|
-
* This source code is licensed under the MIT license found in the
|
|
41
|
-
* LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/var Mx;function l0(){if(Mx)return Cs;Mx=1;var t=a0(),r=of(),s=rv();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 p(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,A=f.child;A;){if(A===l){j=!0,l=f,i=x;break}if(A===i){j=!0,i=f,l=x;break}A=A.sibling}if(!j){for(A=x.child;A;){if(A===l){j=!0,l=x,i=f;break}if(A===i){j=!0,i=x,l=f;break}A=A.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"),k=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),L=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),F=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),N=Symbol.for("react.activity"),_=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function W(e){return e===null||typeof e!="object"?null:(e=V&&e[V]||e["@@iterator"],typeof e=="function"?e:null)}var Y=Symbol.for("react.client.reference");function X(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Y?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 z:return"Suspense";case F:return"SuspenseList";case N:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case S:return"Portal";case L:return e.displayName||"Context";case R:return(e._context.displayName||"Context")+".Consumer";case B: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:X(e.type)||"Memo";case I:n=e._payload,e=e._init;try{return X(e(n))}catch{}}return null}var H=Array.isArray,M=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U={pending:!1,data:null,method:null,action:null},G=[],ue=-1;function D(e){return{current:e}}function P(e){0>ue||(e.current=G[ue],G[ue]=null,ue--)}function ee(e,n){ue++,G[ue]=e.current,e.current=n}var re=D(null),xe=D(null),ce=D(null),ye=D(null);function de(e,n){switch(ee(ce,n),ee(xe,e),ee(re,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?Wh(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=Wh(n),e=qh(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}P(re),ee(re,e)}function je(){P(re),P(xe),P(ce)}function Re(e){e.memoizedState!==null&&ee(ye,e);var n=re.current,l=qh(n,e.type);n!==l&&(ee(xe,e),ee(re,l))}function Le(e){xe.current===e&&(P(re),P(xe)),ye.current===e&&(P(ye),bs._currentValue=U)}var ae,fe;function me(e){if(ae===void 0)try{throw Error()}catch(l){var n=l.stack.trim().match(/\n( *(at )?)/);ae=n&&n[1]||"",fe=-1<l.stack.indexOf(`
|
|
43
|
-
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
-
`+ae+e+fe}var he=!1;function be(e,n){if(!e||he)return"";he=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(n){var oe=function(){throw Error()};if(Object.defineProperty(oe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(oe,[])}catch(ne){var J=ne}Reflect.construct(e,[],oe)}else{try{oe.call()}catch(ne){J=ne}e.call(oe.prototype)}}else{try{throw Error()}catch(ne){J=ne}(oe=e())&&typeof oe.catch=="function"&&oe.catch(function(){})}}catch(ne){if(ne&&J&&typeof ne.stack=="string")return[ne.stack,J.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],A=x[1];if(j&&A){var $=j.split(`
|
|
45
|
-
`),Z=A.split(`
|
|
46
|
-
`);for(f=i=0;i<$.length&&!$[i].includes("DetermineComponentFrameRoot");)i++;for(;f<Z.length&&!Z[f].includes("DetermineComponentFrameRoot");)f++;if(i===$.length||f===Z.length)for(i=$.length-1,f=Z.length-1;1<=i&&0<=f&&$[i]!==Z[f];)f--;for(;1<=i&&0<=f;i--,f--)if($[i]!==Z[f]){if(i!==1||f!==1)do if(i--,f--,0>f||$[i]!==Z[f]){var le=`
|
|
47
|
-
`+$[i].replace(" at new "," at ");return e.displayName&&le.includes("<anonymous>")&&(le=le.replace("<anonymous>",e.displayName)),le}while(1<=i&&0<=f);break}}}finally{he=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?me(l):""}function Be(e,n){switch(e.tag){case 26:case 27:case 5:return me(e.type);case 16:return me("Lazy");case 13:return e.child!==n&&n!==null?me("Suspense Fallback"):me("Suspense");case 19:return me("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 me("Activity");default:return""}}function Oe(e){try{var n="",l=null;do n+=Be(e,l),l=e,e=e.return;while(e);return n}catch(i){return`
|
|
48
|
-
Error generating stack: `+i.message+`
|
|
49
|
-
`+i.stack}}var st=Object.prototype.hasOwnProperty,At=t.unstable_scheduleCallback,gt=t.unstable_cancelCallback,Gt=t.unstable_shouldYield,vt=t.unstable_requestPaint,Ze=t.unstable_now,at=t.unstable_getCurrentPriorityLevel,ve=t.unstable_ImmediatePriority,ct=t.unstable_UserBlockingPriority,Nt=t.unstable_NormalPriority,nn=t.unstable_LowPriority,Rn=t.unstable_IdlePriority,Vt=t.log,oa=t.unstable_setDisableYieldValue,$e=null,Je=null;function yt(e){if(typeof Vt=="function"&&oa(e),Je&&typeof Je.setStrictMode=="function")try{Je.setStrictMode($e,e)}catch{}}var ut=Math.clz32?Math.clz32:Gn,Fn=Math.log,Qt=Math.LN2;function Gn(e){return e>>>=0,e===0?32:31-(Fn(e)/Qt|0)|0}var se=256,we=262144,ze=4194304;function un(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 ca(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 A=i&134217727;return A!==0?(i=A&~x,i!==0?f=un(i):(j&=A,j!==0?f=un(j):l||(l=A&~e,l!==0&&(f=un(l))))):(A=i&~x,A!==0?f=un(A):j!==0?f=un(j):l||(l=i&~e,l!==0&&(f=un(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 La(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function Ir(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 dt(){var e=ze;return ze<<=1,(ze&62914560)===0&&(ze=4194304),e}function za(e){for(var n=[],l=0;31>l;l++)n.push(e);return n}function An(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Yo(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 A=e.entanglements,$=e.expirationTimes,Z=e.hiddenUpdates;for(l=j&~l;0<l;){var le=31-ut(l),oe=1<<le;A[le]=0,$[le]=-1;var J=Z[le];if(J!==null)for(Z[le]=null,le=0;le<J.length;le++){var ne=J[le];ne!==null&&(ne.lane&=-536870913)}l&=~oe}i!==0&&Zt(e,i,0),x!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=x&~(j&~n))}function Zt(e,n,l){e.pendingLanes|=n,e.suspendedLanes&=~n;var i=31-ut(n);e.entangledLanes|=n,e.entanglements[i]=e.entanglements[i]|1073741824|l&261930}function Ko(e,n){var l=e.entangledLanes|=n;for(e=e.entanglements;l;){var i=31-ut(l),f=1<<i;f&n|e[i]&n&&(e[i]|=n),l&=~f}}function ua(e,n){var l=n&-n;return l=(l&42)!==0?1:Dl(l),(l&(e.suspendedLanes|n))!==0?0:l}function Dl(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Xo(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Mf(){var e=O.p;return e!==0?e:(e=window.event,e===void 0?32:xx(e.type))}function Lf(e,n){var l=O.p;try{return O.p=e,n()}finally{O.p=l}}var Da=Math.random().toString(36).slice(2),Wt="__reactFiber$"+Da,dn="__reactProps$"+Da,Hr="__reactContainer$"+Da,Qo="__reactEvents$"+Da,Vy="__reactListeners$"+Da,Py="__reactHandles$"+Da,zf="__reactResources$"+Da,_l="__reactMarker$"+Da;function Zo(e){delete e[Wt],delete e[dn],delete e[Qo],delete e[Vy],delete e[Py]}function Ur(e){var n=e[Wt];if(n)return n;for(var l=e.parentNode;l;){if(n=l[Hr]||l[Wt]){if(l=n.alternate,n.child!==null||l!==null&&l.child!==null)for(e=ex(e);e!==null;){if(l=e[Wt])return l;e=ex(e)}return n}e=l,l=e.parentNode}return null}function $r(e){if(e=e[Wt]||e[Hr]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Ol(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(o(33))}function Vr(e){var n=e[zf];return n||(n=e[zf]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Pt(e){e[_l]=!0}var Df=new Set,_f={};function fr(e,n){Pr(e,n),Pr(e+"Capture",n)}function Pr(e,n){for(_f[e]=n,e=0;e<n.length;e++)Df.add(n[e])}var Fy=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]*$"),Of={},Bf={};function Gy(e){return st.call(Bf,e)?!0:st.call(Of,e)?!1:Fy.test(e)?Bf[e]=!0:(Of[e]=!0,!1)}function Qs(e,n,l){if(Gy(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 Zs(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 da(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 Mn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function If(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Wy(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 Jo(e){if(!e._valueTracker){var n=If(e)?"checked":"value";e._valueTracker=Wy(e,n,""+e[n])}}function Hf(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var l=n.getValue(),i="";return e&&(i=If(e)?e.checked?"true":"false":e.value),e=i,e!==l?(n.setValue(e),!0):!1}function Js(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var qy=/[\n"\\]/g;function Ln(e){return e.replace(qy,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function ec(e,n,l,i,f,x,j,A){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=""+Mn(n)):e.value!==""+Mn(n)&&(e.value=""+Mn(n)):j!=="submit"&&j!=="reset"||e.removeAttribute("value"),n!=null?tc(e,j,Mn(n)):l!=null?tc(e,j,Mn(l)):i!=null&&e.removeAttribute("value"),f==null&&x!=null&&(e.defaultChecked=!!x),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?e.name=""+Mn(A):e.removeAttribute("name")}function Uf(e,n,l,i,f,x,j,A){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)){Jo(e);return}l=l!=null?""+Mn(l):"",n=n!=null?""+Mn(n):l,A||n===e.value||(e.value=n),e.defaultValue=n}i=i??f,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=A?e.checked:!!i,e.defaultChecked=!!i,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(e.name=j),Jo(e)}function tc(e,n,l){n==="number"&&Js(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Fr(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=""+Mn(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 $f(e,n,l){if(n!=null&&(n=""+Mn(n),n!==e.value&&(e.value=n),l==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=l!=null?""+Mn(l):""}function Vf(e,n,l,i){if(n==null){if(i!=null){if(l!=null)throw Error(o(92));if(H(i)){if(1<i.length)throw Error(o(93));i=i[0]}l=i}l==null&&(l=""),n=l}l=Mn(n),e.defaultValue=l,i=e.textContent,i===l&&i!==""&&i!==null&&(e.value=i),Jo(e)}function Gr(e,n){if(n){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=n;return}}e.textContent=n}var Yy=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 Pf(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||Yy.has(n)?n==="float"?e.cssFloat=l:e[n]=(""+l).trim():e[n]=l+"px"}function Ff(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&&Pf(e,f,i)}else for(var x in n)n.hasOwnProperty(x)&&Pf(e,x,n[x])}function nc(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ky=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"]]),Xy=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function ei(e){return Xy.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function fa(){}var ac=null;function rc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Wr=null,qr=null;function Gf(e){var n=$r(e);if(n&&(e=n.stateNode)){var l=e[dn]||null;e:switch(e=n.stateNode,n.type){case"input":if(ec(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="'+Ln(""+n)+'"][type="radio"]'),n=0;n<l.length;n++){var i=l[n];if(i!==e&&i.form===e.form){var f=i[dn]||null;if(!f)throw Error(o(90));ec(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&&Hf(i)}break e;case"textarea":$f(e,l.value,l.defaultValue);break e;case"select":n=l.value,n!=null&&Fr(e,!!l.multiple,n,!1)}}}var lc=!1;function Wf(e,n,l){if(lc)return e(n,l);lc=!0;try{var i=e(n);return i}finally{if(lc=!1,(Wr!==null||qr!==null)&&($i(),Wr&&(n=Wr,e=qr,qr=Wr=null,Gf(n),e)))for(n=0;n<e.length;n++)Gf(e[n])}}function Bl(e,n){var l=e.stateNode;if(l===null)return null;var i=l[dn]||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 pa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),sc=!1;if(pa)try{var Il={};Object.defineProperty(Il,"passive",{get:function(){sc=!0}}),window.addEventListener("test",Il,Il),window.removeEventListener("test",Il,Il)}catch{sc=!1}var _a=null,ic=null,ti=null;function qf(){if(ti)return ti;var e,n=ic,l=n.length,i,f="value"in _a?_a.value:_a.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 ti=f.slice(e,1<i?1-i:void 0)}function ni(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 ai(){return!0}function Yf(){return!1}function fn(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 A in e)e.hasOwnProperty(A)&&(l=e[A],this[A]=l?l(x):x[A]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?ai:Yf,this.isPropagationStopped=Yf,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=ai)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=ai)},persist:function(){},isPersistent:ai}),n}var pr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ri=fn(pr),Hl=v({},pr,{view:0,detail:0}),Qy=fn(Hl),oc,cc,Ul,li=v({},Hl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:dc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Ul&&(Ul&&e.type==="mousemove"?(oc=e.screenX-Ul.screenX,cc=e.screenY-Ul.screenY):cc=oc=0,Ul=e),oc)},movementY:function(e){return"movementY"in e?e.movementY:cc}}),Kf=fn(li),Zy=v({},li,{dataTransfer:0}),Jy=fn(Zy),eb=v({},Hl,{relatedTarget:0}),uc=fn(eb),tb=v({},pr,{animationName:0,elapsedTime:0,pseudoElement:0}),nb=fn(tb),ab=v({},pr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),rb=fn(ab),lb=v({},pr,{data:0}),Xf=fn(lb),sb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ib={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"},ob={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function cb(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=ob[e])?!!n[e]:!1}function dc(){return cb}var ub=v({},Hl,{key:function(e){if(e.key){var n=sb[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=ni(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ib[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:dc,charCode:function(e){return e.type==="keypress"?ni(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ni(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),db=fn(ub),fb=v({},li,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Qf=fn(fb),pb=v({},Hl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:dc}),mb=fn(pb),hb=v({},pr,{propertyName:0,elapsedTime:0,pseudoElement:0}),xb=fn(hb),gb=v({},li,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),vb=fn(gb),yb=v({},pr,{newState:0,oldState:0}),bb=fn(yb),jb=[9,13,27,32],fc=pa&&"CompositionEvent"in window,$l=null;pa&&"documentMode"in document&&($l=document.documentMode);var Sb=pa&&"TextEvent"in window&&!$l,Zf=pa&&(!fc||$l&&8<$l&&11>=$l),Jf=" ",ep=!1;function tp(e,n){switch(e){case"keyup":return jb.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function np(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Yr=!1;function kb(e,n){switch(e){case"compositionend":return np(n);case"keypress":return n.which!==32?null:(ep=!0,Jf);case"textInput":return e=n.data,e===Jf&&ep?null:e;default:return null}}function wb(e,n){if(Yr)return e==="compositionend"||!fc&&tp(e,n)?(e=qf(),ti=ic=_a=null,Yr=!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 Zf&&n.locale!=="ko"?null:n.data;default:return null}}var Cb={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 ap(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Cb[e.type]:n==="textarea"}function rp(e,n,l,i){Wr?qr?qr.push(i):qr=[i]:Wr=i,n=Yi(n,"onChange"),0<n.length&&(l=new ri("onChange","change",null,l,i),e.push({event:l,listeners:n}))}var Vl=null,Pl=null;function Eb(e){Uh(e,0)}function si(e){var n=Ol(e);if(Hf(n))return e}function lp(e,n){if(e==="change")return n}var sp=!1;if(pa){var pc;if(pa){var mc="oninput"in document;if(!mc){var ip=document.createElement("div");ip.setAttribute("oninput","return;"),mc=typeof ip.oninput=="function"}pc=mc}else pc=!1;sp=pc&&(!document.documentMode||9<document.documentMode)}function op(){Vl&&(Vl.detachEvent("onpropertychange",cp),Pl=Vl=null)}function cp(e){if(e.propertyName==="value"&&si(Pl)){var n=[];rp(n,Pl,e,rc(e)),Wf(Eb,n)}}function Nb(e,n,l){e==="focusin"?(op(),Vl=n,Pl=l,Vl.attachEvent("onpropertychange",cp)):e==="focusout"&&op()}function Tb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return si(Pl)}function Rb(e,n){if(e==="click")return si(n)}function Ab(e,n){if(e==="input"||e==="change")return si(n)}function Mb(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var vn=typeof Object.is=="function"?Object.is:Mb;function Fl(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(!st.call(n,f)||!vn(e[f],n[f]))return!1}return!0}function up(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function dp(e,n){var l=up(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=up(l)}}function fp(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?fp(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function pp(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Js(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=Js(e.document)}return n}function hc(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 Lb=pa&&"documentMode"in document&&11>=document.documentMode,Kr=null,xc=null,Gl=null,gc=!1;function mp(e,n,l){var i=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;gc||Kr==null||Kr!==Js(i)||(i=Kr,"selectionStart"in i&&hc(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Gl&&Fl(Gl,i)||(Gl=i,i=Yi(xc,"onSelect"),0<i.length&&(n=new ri("onSelect","select",null,n,l),e.push({event:n,listeners:i}),n.target=Kr)))}function mr(e,n){var l={};return l[e.toLowerCase()]=n.toLowerCase(),l["Webkit"+e]="webkit"+n,l["Moz"+e]="moz"+n,l}var Xr={animationend:mr("Animation","AnimationEnd"),animationiteration:mr("Animation","AnimationIteration"),animationstart:mr("Animation","AnimationStart"),transitionrun:mr("Transition","TransitionRun"),transitionstart:mr("Transition","TransitionStart"),transitioncancel:mr("Transition","TransitionCancel"),transitionend:mr("Transition","TransitionEnd")},vc={},hp={};pa&&(hp=document.createElement("div").style,"AnimationEvent"in window||(delete Xr.animationend.animation,delete Xr.animationiteration.animation,delete Xr.animationstart.animation),"TransitionEvent"in window||delete Xr.transitionend.transition);function hr(e){if(vc[e])return vc[e];if(!Xr[e])return e;var n=Xr[e],l;for(l in n)if(n.hasOwnProperty(l)&&l in hp)return vc[e]=n[l];return e}var xp=hr("animationend"),gp=hr("animationiteration"),vp=hr("animationstart"),zb=hr("transitionrun"),Db=hr("transitionstart"),_b=hr("transitioncancel"),yp=hr("transitionend"),bp=new Map,yc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");yc.push("scrollEnd");function Wn(e,n){bp.set(e,n),fr(n,[e])}var ii=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)},zn=[],Qr=0,bc=0;function oi(){for(var e=Qr,n=bc=Qr=0;n<e;){var l=zn[n];zn[n++]=null;var i=zn[n];zn[n++]=null;var f=zn[n];zn[n++]=null;var x=zn[n];if(zn[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&&jp(l,f,x)}}function ci(e,n,l,i){zn[Qr++]=e,zn[Qr++]=n,zn[Qr++]=l,zn[Qr++]=i,bc|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function jc(e,n,l,i){return ci(e,n,l,i),ui(e)}function xr(e,n){return ci(e,null,null,n),ui(e)}function jp(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-ut(l),e=x.hiddenUpdates,i=e[f],i===null?e[f]=[n]:i.push(n),n.lane=l|536870912),x):null}function ui(e){if(50<ps)throw ps=0,Au=null,Error(o(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Zr={};function Ob(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 Ob(e,n,l,i)}function Sc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ma(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 Sp(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 di(e,n,l,i,f,x){var j=0;if(i=e,typeof e=="function")Sc(e)&&(j=1);else if(typeof e=="string")j=$1(e,l,re.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case N:return e=yn(31,l,n,f),e.elementType=N,e.lanes=x,e;case w:return gr(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 z:return e=yn(13,l,n,f),e.elementType=z,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 L:j=10;break e;case R:j=9;break e;case B:j=11;break e;case E:j=14;break e;case I: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 gr(e,n,l,i){return e=yn(7,e,i,n),e.lanes=l,e}function kc(e,n,l){return e=yn(6,e,null,n),e.lanes=l,e}function kp(e){var n=yn(18,null,null,0);return n.stateNode=e,n}function wc(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 wp=new WeakMap;function Dn(e,n){if(typeof e=="object"&&e!==null){var l=wp.get(e);return l!==void 0?l:(n={value:e,source:n,stack:Oe(n)},wp.set(e,n),n)}return{value:e,source:n,stack:Oe(n)}}var Jr=[],el=0,fi=null,Wl=0,_n=[],On=0,Oa=null,Jn=1,ea="";function ha(e,n){Jr[el++]=Wl,Jr[el++]=fi,fi=e,Wl=n}function Cp(e,n,l){_n[On++]=Jn,_n[On++]=ea,_n[On++]=Oa,Oa=e;var i=Jn;e=ea;var f=32-ut(i)-1;i&=~(1<<f),l+=1;var x=32-ut(n)+f;if(30<x){var j=f-f%5;x=(i&(1<<j)-1).toString(32),i>>=j,f-=j,Jn=1<<32-ut(n)+f|l<<f|i,ea=x+e}else Jn=1<<x|l<<f|i,ea=e}function Cc(e){e.return!==null&&(ha(e,1),Cp(e,1,0))}function Ec(e){for(;e===fi;)fi=Jr[--el],Jr[el]=null,Wl=Jr[--el],Jr[el]=null;for(;e===Oa;)Oa=_n[--On],_n[On]=null,ea=_n[--On],_n[On]=null,Jn=_n[--On],_n[On]=null}function Ep(e,n){_n[On++]=Jn,_n[On++]=ea,_n[On++]=Oa,Jn=n.id,ea=n.overflow,Oa=e}var qt=null,bt=null,Xe=!1,Ba=null,Bn=!1,Nc=Error(o(519));function Ia(e){var n=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ql(Dn(n,e)),Nc}function Np(e){var n=e.stateNode,l=e.type,i=e.memoizedProps;switch(n[Wt]=e,n[dn]=i,l){case"dialog":qe("cancel",n),qe("close",n);break;case"iframe":case"object":case"embed":qe("load",n);break;case"video":case"audio":for(l=0;l<hs.length;l++)qe(hs[l],n);break;case"source":qe("error",n);break;case"img":case"image":case"link":qe("error",n),qe("load",n);break;case"details":qe("toggle",n);break;case"input":qe("invalid",n),Uf(n,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":qe("invalid",n);break;case"textarea":qe("invalid",n),Vf(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||Fh(n.textContent,l)?(i.popover!=null&&(qe("beforetoggle",n),qe("toggle",n)),i.onScroll!=null&&qe("scroll",n),i.onScrollEnd!=null&&qe("scrollend",n),i.onClick!=null&&(n.onclick=fa),n=!0):n=!1,n||Ia(e,!0)}function Tp(e){for(qt=e.return;qt;)switch(qt.tag){case 5:case 31:case 13:Bn=!1;return;case 27:case 3:Bn=!0;return;default:qt=qt.return}}function tl(e){if(e!==qt)return!1;if(!Xe)return Tp(e),Xe=!0,!1;var n=e.tag,l;if((l=n!==3&&n!==27)&&((l=n===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||Gu(e.type,e.memoizedProps)),l=!l),l&&bt&&Ia(e),Tp(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));bt=Jh(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));bt=Jh(e)}else n===27?(n=bt,Za(e.type)?(e=Xu,Xu=null,bt=e):bt=n):bt=qt?Hn(e.stateNode.nextSibling):null;return!0}function vr(){bt=qt=null,Xe=!1}function Tc(){var e=Ba;return e!==null&&(xn===null?xn=e:xn.push.apply(xn,e),Ba=null),e}function ql(e){Ba===null?Ba=[e]:Ba.push(e)}var Rc=D(null),yr=null,xa=null;function Ha(e,n,l){ee(Rc,n._currentValue),n._currentValue=l}function ga(e){e._currentValue=Rc.current,P(Rc)}function Ac(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 Mc(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 A=x;x=f;for(var $=0;$<n.length;$++)if(A.context===n[$]){x.lanes|=l,A=x.alternate,A!==null&&(A.lanes|=l),Ac(x.return,l,e),i||(j=null);break e}x=A.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),Ac(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 nl(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 A=f.type;vn(f.pendingProps.value,j.value)||(e!==null?e.push(A):e=[A])}}else if(f===ye.current){if(j=f.alternate,j===null)throw Error(o(387));j.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(bs):e=[bs])}f=f.return}e!==null&&Mc(n,e,l,i),n.flags|=262144}function pi(e){for(e=e.firstContext;e!==null;){if(!vn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function br(e){yr=e,xa=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Yt(e){return Rp(yr,e)}function mi(e,n){return yr===null&&br(e),Rp(e,n)}function Rp(e,n){var l=n._currentValue;if(n={context:n,memoizedValue:l,next:null},xa===null){if(e===null)throw Error(o(308));xa=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else xa=xa.next=n;return l}var Bb=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()})}},Ib=t.unstable_scheduleCallback,Hb=t.unstable_NormalPriority,zt={$$typeof:L,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Lc(){return{controller:new Bb,data:new Map,refCount:0}}function Yl(e){e.refCount--,e.refCount===0&&Ib(Hb,function(){e.controller.abort()})}var Kl=null,zc=0,al=0,rl=null;function Ub(e,n){if(Kl===null){var l=Kl=[];zc=0,al=Ou(),rl={status:"pending",value:void 0,then:function(i){l.push(i)}}}return zc++,n.then(Ap,Ap),n}function Ap(){if(--zc===0&&Kl!==null){rl!==null&&(rl.status="fulfilled");var e=Kl;Kl=null,al=0,rl=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function $b(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 Mp=M.S;M.S=function(e,n){mh=Ze(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Ub(e,n),Mp!==null&&Mp(e,n)};var jr=D(null);function Dc(){var e=jr.current;return e!==null?e:xt.pooledCache}function hi(e,n){n===null?ee(jr,jr.current):ee(jr,n.pool)}function Lp(){var e=Dc();return e===null?null:{parent:zt._currentValue,pool:e}}var ll=Error(o(460)),_c=Error(o(474)),xi=Error(o(542)),gi={then:function(){}};function zp(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Dp(e,n,l){switch(l=e[l],l===void 0?e.push(n):l!==n&&(n.then(fa,fa),n=l),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Op(e),e;default:if(typeof n.status=="string")n.then(fa,fa);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,Op(e),e}throw kr=n,ll}}function Sr(e){try{var n=e._init;return n(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(kr=l,ll):l}}var kr=null;function _p(){if(kr===null)throw Error(o(459));var e=kr;return kr=null,e}function Op(e){if(e===ll||e===xi)throw Error(o(483))}var sl=null,Xl=0;function vi(e){var n=Xl;return Xl+=1,sl===null&&(sl=[]),Dp(sl,e,n)}function Ql(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function yi(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 Bp(e){function n(K,q){if(e){var Q=K.deletions;Q===null?(K.deletions=[q],K.flags|=16):Q.push(q)}}function l(K,q){if(!e)return null;for(;q!==null;)n(K,q),q=q.sibling;return null}function i(K){for(var q=new Map;K!==null;)K.key!==null?q.set(K.key,K):q.set(K.index,K),K=K.sibling;return q}function f(K,q){return K=ma(K,q),K.index=0,K.sibling=null,K}function x(K,q,Q){return K.index=Q,e?(Q=K.alternate,Q!==null?(Q=Q.index,Q<q?(K.flags|=67108866,q):Q):(K.flags|=67108866,q)):(K.flags|=1048576,q)}function j(K){return e&&K.alternate===null&&(K.flags|=67108866),K}function A(K,q,Q,ie){return q===null||q.tag!==6?(q=kc(Q,K.mode,ie),q.return=K,q):(q=f(q,Q),q.return=K,q)}function $(K,q,Q,ie){var Ae=Q.type;return Ae===w?le(K,q,Q.props.children,ie,Q.key):q!==null&&(q.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===I&&Sr(Ae)===q.type)?(q=f(q,Q.props),Ql(q,Q),q.return=K,q):(q=di(Q.type,Q.key,Q.props,null,K.mode,ie),Ql(q,Q),q.return=K,q)}function Z(K,q,Q,ie){return q===null||q.tag!==4||q.stateNode.containerInfo!==Q.containerInfo||q.stateNode.implementation!==Q.implementation?(q=wc(Q,K.mode,ie),q.return=K,q):(q=f(q,Q.children||[]),q.return=K,q)}function le(K,q,Q,ie,Ae){return q===null||q.tag!==7?(q=gr(Q,K.mode,ie,Ae),q.return=K,q):(q=f(q,Q),q.return=K,q)}function oe(K,q,Q){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=kc(""+q,K.mode,Q),q.return=K,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case k:return Q=di(q.type,q.key,q.props,null,K.mode,Q),Ql(Q,q),Q.return=K,Q;case S:return q=wc(q,K.mode,Q),q.return=K,q;case I:return q=Sr(q),oe(K,q,Q)}if(H(q)||W(q))return q=gr(q,K.mode,Q,null),q.return=K,q;if(typeof q.then=="function")return oe(K,vi(q),Q);if(q.$$typeof===L)return oe(K,mi(K,q),Q);yi(K,q)}return null}function J(K,q,Q,ie){var Ae=q!==null?q.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Ae!==null?null:A(K,q,""+Q,ie);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case k:return Q.key===Ae?$(K,q,Q,ie):null;case S:return Q.key===Ae?Z(K,q,Q,ie):null;case I:return Q=Sr(Q),J(K,q,Q,ie)}if(H(Q)||W(Q))return Ae!==null?null:le(K,q,Q,ie,null);if(typeof Q.then=="function")return J(K,q,vi(Q),ie);if(Q.$$typeof===L)return J(K,q,mi(K,Q),ie);yi(K,Q)}return null}function ne(K,q,Q,ie,Ae){if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return K=K.get(Q)||null,A(q,K,""+ie,Ae);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case k:return K=K.get(ie.key===null?Q:ie.key)||null,$(q,K,ie,Ae);case S:return K=K.get(ie.key===null?Q:ie.key)||null,Z(q,K,ie,Ae);case I:return ie=Sr(ie),ne(K,q,Q,ie,Ae)}if(H(ie)||W(ie))return K=K.get(Q)||null,le(q,K,ie,Ae,null);if(typeof ie.then=="function")return ne(K,q,Q,vi(ie),Ae);if(ie.$$typeof===L)return ne(K,q,Q,mi(q,ie),Ae);yi(q,ie)}return null}function ke(K,q,Q,ie){for(var Ae=null,et=null,Ce=q,Ve=q=0,Ke=null;Ce!==null&&Ve<Q.length;Ve++){Ce.index>Ve?(Ke=Ce,Ce=null):Ke=Ce.sibling;var tt=J(K,Ce,Q[Ve],ie);if(tt===null){Ce===null&&(Ce=Ke);break}e&&Ce&&tt.alternate===null&&n(K,Ce),q=x(tt,q,Ve),et===null?Ae=tt:et.sibling=tt,et=tt,Ce=Ke}if(Ve===Q.length)return l(K,Ce),Xe&&ha(K,Ve),Ae;if(Ce===null){for(;Ve<Q.length;Ve++)Ce=oe(K,Q[Ve],ie),Ce!==null&&(q=x(Ce,q,Ve),et===null?Ae=Ce:et.sibling=Ce,et=Ce);return Xe&&ha(K,Ve),Ae}for(Ce=i(Ce);Ve<Q.length;Ve++)Ke=ne(Ce,K,Ve,Q[Ve],ie),Ke!==null&&(e&&Ke.alternate!==null&&Ce.delete(Ke.key===null?Ve:Ke.key),q=x(Ke,q,Ve),et===null?Ae=Ke:et.sibling=Ke,et=Ke);return e&&Ce.forEach(function(ar){return n(K,ar)}),Xe&&ha(K,Ve),Ae}function Me(K,q,Q,ie){if(Q==null)throw Error(o(151));for(var Ae=null,et=null,Ce=q,Ve=q=0,Ke=null,tt=Q.next();Ce!==null&&!tt.done;Ve++,tt=Q.next()){Ce.index>Ve?(Ke=Ce,Ce=null):Ke=Ce.sibling;var ar=J(K,Ce,tt.value,ie);if(ar===null){Ce===null&&(Ce=Ke);break}e&&Ce&&ar.alternate===null&&n(K,Ce),q=x(ar,q,Ve),et===null?Ae=ar:et.sibling=ar,et=ar,Ce=Ke}if(tt.done)return l(K,Ce),Xe&&ha(K,Ve),Ae;if(Ce===null){for(;!tt.done;Ve++,tt=Q.next())tt=oe(K,tt.value,ie),tt!==null&&(q=x(tt,q,Ve),et===null?Ae=tt:et.sibling=tt,et=tt);return Xe&&ha(K,Ve),Ae}for(Ce=i(Ce);!tt.done;Ve++,tt=Q.next())tt=ne(Ce,K,Ve,tt.value,ie),tt!==null&&(e&&tt.alternate!==null&&Ce.delete(tt.key===null?Ve:tt.key),q=x(tt,q,Ve),et===null?Ae=tt:et.sibling=tt,et=tt);return e&&Ce.forEach(function(Z1){return n(K,Z1)}),Xe&&ha(K,Ve),Ae}function mt(K,q,Q,ie){if(typeof Q=="object"&&Q!==null&&Q.type===w&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case k:e:{for(var Ae=Q.key;q!==null;){if(q.key===Ae){if(Ae=Q.type,Ae===w){if(q.tag===7){l(K,q.sibling),ie=f(q,Q.props.children),ie.return=K,K=ie;break e}}else if(q.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===I&&Sr(Ae)===q.type){l(K,q.sibling),ie=f(q,Q.props),Ql(ie,Q),ie.return=K,K=ie;break e}l(K,q);break}else n(K,q);q=q.sibling}Q.type===w?(ie=gr(Q.props.children,K.mode,ie,Q.key),ie.return=K,K=ie):(ie=di(Q.type,Q.key,Q.props,null,K.mode,ie),Ql(ie,Q),ie.return=K,K=ie)}return j(K);case S:e:{for(Ae=Q.key;q!==null;){if(q.key===Ae)if(q.tag===4&&q.stateNode.containerInfo===Q.containerInfo&&q.stateNode.implementation===Q.implementation){l(K,q.sibling),ie=f(q,Q.children||[]),ie.return=K,K=ie;break e}else{l(K,q);break}else n(K,q);q=q.sibling}ie=wc(Q,K.mode,ie),ie.return=K,K=ie}return j(K);case I:return Q=Sr(Q),mt(K,q,Q,ie)}if(H(Q))return ke(K,q,Q,ie);if(W(Q)){if(Ae=W(Q),typeof Ae!="function")throw Error(o(150));return Q=Ae.call(Q),Me(K,q,Q,ie)}if(typeof Q.then=="function")return mt(K,q,vi(Q),ie);if(Q.$$typeof===L)return mt(K,q,mi(K,Q),ie);yi(K,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,q!==null&&q.tag===6?(l(K,q.sibling),ie=f(q,Q),ie.return=K,K=ie):(l(K,q),ie=kc(Q,K.mode,ie),ie.return=K,K=ie),j(K)):l(K,q)}return function(K,q,Q,ie){try{Xl=0;var Ae=mt(K,q,Q,ie);return sl=null,Ae}catch(Ce){if(Ce===ll||Ce===xi)throw Ce;var et=yn(29,Ce,null,K.mode);return et.lanes=ie,et.return=K,et}finally{}}}var wr=Bp(!0),Ip=Bp(!1),Ua=!1;function Oc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Bc(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function $a(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Va(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=ui(e),jp(e,null,l),n}return ci(e,i,n,l),ui(e)}function Zl(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,Ko(e,l)}}function Ic(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 Hc=!1;function Jl(){if(Hc){var e=rl;if(e!==null)throw e}}function es(e,n,l,i){Hc=!1;var f=e.updateQueue;Ua=!1;var x=f.firstBaseUpdate,j=f.lastBaseUpdate,A=f.shared.pending;if(A!==null){f.shared.pending=null;var $=A,Z=$.next;$.next=null,j===null?x=Z:j.next=Z,j=$;var le=e.alternate;le!==null&&(le=le.updateQueue,A=le.lastBaseUpdate,A!==j&&(A===null?le.firstBaseUpdate=Z:A.next=Z,le.lastBaseUpdate=$))}if(x!==null){var oe=f.baseState;j=0,le=Z=$=null,A=x;do{var J=A.lane&-536870913,ne=J!==A.lane;if(ne?(Ye&J)===J:(i&J)===J){J!==0&&J===al&&(Hc=!0),le!==null&&(le=le.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var ke=e,Me=A;J=n;var mt=l;switch(Me.tag){case 1:if(ke=Me.payload,typeof ke=="function"){oe=ke.call(mt,oe,J);break e}oe=ke;break e;case 3:ke.flags=ke.flags&-65537|128;case 0:if(ke=Me.payload,J=typeof ke=="function"?ke.call(mt,oe,J):ke,J==null)break e;oe=v({},oe,J);break e;case 2:Ua=!0}}J=A.callback,J!==null&&(e.flags|=64,ne&&(e.flags|=8192),ne=f.callbacks,ne===null?f.callbacks=[J]:ne.push(J))}else ne={lane:J,tag:A.tag,payload:A.payload,callback:A.callback,next:null},le===null?(Z=le=ne,$=oe):le=le.next=ne,j|=J;if(A=A.next,A===null){if(A=f.shared.pending,A===null)break;ne=A,A=ne.next,ne.next=null,f.lastBaseUpdate=ne,f.shared.pending=null}}while(!0);le===null&&($=oe),f.baseState=$,f.firstBaseUpdate=Z,f.lastBaseUpdate=le,x===null&&(f.shared.lanes=0),qa|=j,e.lanes=j,e.memoizedState=oe}}function Hp(e,n){if(typeof e!="function")throw Error(o(191,e));e.call(n)}function Up(e,n){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)Hp(l[e],n)}var il=D(null),bi=D(0);function $p(e,n){e=Ea,ee(bi,e),ee(il,n),Ea=e|n.baseLanes}function Uc(){ee(bi,Ea),ee(il,il.current)}function $c(){Ea=bi.current,P(il),P(bi)}var bn=D(null),In=null;function Pa(e){var n=e.alternate;ee(Mt,Mt.current&1),ee(bn,e),In===null&&(n===null||il.current!==null||n.memoizedState!==null)&&(In=e)}function Vc(e){ee(Mt,Mt.current),ee(bn,e),In===null&&(In=e)}function Vp(e){e.tag===22?(ee(Mt,Mt.current),ee(bn,e),In===null&&(In=e)):Fa()}function Fa(){ee(Mt,Mt.current),ee(bn,bn.current)}function jn(e){P(bn),In===e&&(In=null),P(Mt)}var Mt=D(0);function ji(e){for(var n=e;n!==null;){if(n.tag===13){var l=n.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Yu(l)||Ku(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 va=0,Ue=null,ft=null,Dt=null,Si=!1,ol=!1,Cr=!1,ki=0,ts=0,cl=null,Vb=0;function Tt(){throw Error(o(321))}function Pc(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 Fc(e,n,l,i,f,x){return va=x,Ue=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,M.H=e===null||e.memoizedState===null?Cm:lu,Cr=!1,x=l(i,f),Cr=!1,ol&&(x=Fp(n,l,i,f)),Pp(e),x}function Pp(e){M.H=rs;var n=ft!==null&&ft.next!==null;if(va=0,Dt=ft=Ue=null,Si=!1,ts=0,cl=null,n)throw Error(o(300));e===null||_t||(e=e.dependencies,e!==null&&pi(e)&&(_t=!0))}function Fp(e,n,l,i){Ue=e;var f=0;do{if(ol&&(cl=null),ts=0,ol=!1,25<=f)throw Error(o(301));if(f+=1,Dt=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)}M.H=Em,x=n(l,i)}while(ol);return x}function Pb(){var e=M.H,n=e.useState()[0];return n=typeof n.then=="function"?ns(n):n,e=e.useState()[0],(ft!==null?ft.memoizedState:null)!==e&&(Ue.flags|=1024),n}function Gc(){var e=ki!==0;return ki=0,e}function Wc(e,n,l){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~l}function qc(e){if(Si){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Si=!1}va=0,Dt=ft=Ue=null,ol=!1,ts=ki=0,cl=null}function an(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Dt===null?Ue.memoizedState=Dt=e:Dt=Dt.next=e,Dt}function Lt(){if(ft===null){var e=Ue.alternate;e=e!==null?e.memoizedState:null}else e=ft.next;var n=Dt===null?Ue.memoizedState:Dt.next;if(n!==null)Dt=n,ft=e;else{if(e===null)throw Ue.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},Dt===null?Ue.memoizedState=Dt=e:Dt=Dt.next=e}return Dt}function wi(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ns(e){var n=ts;return ts+=1,cl===null&&(cl=[]),e=Dp(cl,e,n),n=Ue,(Dt===null?n.memoizedState:Dt.next)===null&&(n=n.alternate,M.H=n===null||n.memoizedState===null?Cm:lu),e}function Ci(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ns(e);if(e.$$typeof===L)return Yt(e)}throw Error(o(438,String(e)))}function Yc(e){var n=null,l=Ue.updateQueue;if(l!==null&&(n=l.memoCache),n==null){var i=Ue.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=wi(),Ue.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]=_;return n.index++,l}function ya(e,n){return typeof n=="function"?n(e):n}function Ei(e){var n=Lt();return Kc(n,ft,e)}function Kc(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 A=j=null,$=null,Z=n,le=!1;do{var oe=Z.lane&-536870913;if(oe!==Z.lane?(Ye&oe)===oe:(va&oe)===oe){var J=Z.revertLane;if(J===0)$!==null&&($=$.next={lane:0,revertLane:0,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null}),oe===al&&(le=!0);else if((va&J)===J){Z=Z.next,J===al&&(le=!0);continue}else oe={lane:0,revertLane:Z.revertLane,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},$===null?(A=$=oe,j=x):$=$.next=oe,Ue.lanes|=J,qa|=J;oe=Z.action,Cr&&l(x,oe),x=Z.hasEagerState?Z.eagerState:l(x,oe)}else J={lane:oe,revertLane:Z.revertLane,gesture:Z.gesture,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},$===null?(A=$=J,j=x):$=$.next=J,Ue.lanes|=oe,qa|=oe;Z=Z.next}while(Z!==null&&Z!==n);if($===null?j=x:$.next=A,!vn(x,e.memoizedState)&&(_t=!0,le&&(l=rl,l!==null)))throw l;e.memoizedState=x,e.baseState=j,e.baseQueue=$,i.lastRenderedState=x}return f===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function Xc(e){var n=Lt(),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)||(_t=!0),n.memoizedState=x,n.baseQueue===null&&(n.baseState=x),l.lastRenderedState=x}return[x,i]}function Gp(e,n,l){var i=Ue,f=Lt(),x=Xe;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,_t=!0),f=f.queue,Jc(Yp.bind(null,i,f,e),[e]),f.getSnapshot!==n||j||Dt!==null&&Dt.memoizedState.tag&1){if(i.flags|=2048,ul(9,{destroy:void 0},qp.bind(null,i,f,l,n),null),xt===null)throw Error(o(349));x||(va&127)!==0||Wp(i,n,l)}return l}function Wp(e,n,l){e.flags|=16384,e={getSnapshot:n,value:l},n=Ue.updateQueue,n===null?(n=wi(),Ue.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,Kp(n)&&Xp(e)}function Yp(e,n,l){return l(function(){Kp(n)&&Xp(e)})}function Kp(e){var n=e.getSnapshot;e=e.value;try{var l=n();return!vn(e,l)}catch{return!0}}function Xp(e){var n=xr(e,2);n!==null&&gn(n,e,2)}function Qc(e){var n=an();if(typeof e=="function"){var l=e;if(e=l(),Cr){yt(!0);try{l()}finally{yt(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ya,lastRenderedState:e},n}function Qp(e,n,l,i){return e.baseState=l,Kc(e,ft,typeof i=="function"?i:ya)}function Fb(e,n,l,i,f){if(Ri(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)}};M.T!==null?l(!0):x.isTransition=!1,i(x),l=n.pending,l===null?(x.next=n.pending=x,Zp(n,x)):(x.next=l.next,n.pending=l.next=x)}}function Zp(e,n){var l=n.action,i=n.payload,f=e.state;if(n.isTransition){var x=M.T,j={};M.T=j;try{var A=l(f,i),$=M.S;$!==null&&$(j,A),Jp(e,n,A)}catch(Z){Zc(e,n,Z)}finally{x!==null&&j.types!==null&&(x.types=j.types),M.T=x}}else try{x=l(f,i),Jp(e,n,x)}catch(Z){Zc(e,n,Z)}}function Jp(e,n,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(i){em(e,n,i)},function(i){return Zc(e,n,i)}):em(e,n,l)}function em(e,n,l){n.status="fulfilled",n.value=l,tm(n),e.state=l,n=e.pending,n!==null&&(l=n.next,l===n?e.pending=null:(l=l.next,n.next=l,Zp(e,l)))}function Zc(e,n,l){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do n.status="rejected",n.reason=l,tm(n),n=n.next;while(n!==i)}e.action=null}function tm(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function nm(e,n){return n}function am(e,n){if(Xe){var l=xt.formState;if(l!==null){e:{var i=Ue;if(Xe){if(bt){t:{for(var f=bt,x=Bn;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){bt=Hn(f.nextSibling),i=f.data==="F!";break e}}Ia(i)}i=!1}i&&(n=l[0])}}return l=an(),l.memoizedState=l.baseState=n,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:nm,lastRenderedState:n},l.queue=i,l=Sm.bind(null,Ue,i),i.dispatch=l,i=Qc(!1),x=ru.bind(null,Ue,!1,i.queue),i=an(),f={state:n,dispatch:null,action:e,pending:null},i.queue=f,l=Fb.bind(null,Ue,f,x,l),f.dispatch=l,i.memoizedState=e,[n,l,!1]}function rm(e){var n=Lt();return lm(n,ft,e)}function lm(e,n,l){if(n=Kc(e,n,nm)[0],e=Ei(ya)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var i=ns(n)}catch(j){throw j===ll?xi:j}else i=n;n=Lt();var f=n.queue,x=f.dispatch;return l!==n.memoizedState&&(Ue.flags|=2048,ul(9,{destroy:void 0},Gb.bind(null,f,l),null)),[i,x,e]}function Gb(e,n){e.action=n}function sm(e){var n=Lt(),l=ft;if(l!==null)return lm(n,l,e);Lt(),n=n.memoizedState,l=Lt();var i=l.queue.dispatch;return l.memoizedState=e,[n,i,!1]}function ul(e,n,l,i){return e={tag:e,create:l,deps:i,inst:n,next:null},n=Ue.updateQueue,n===null&&(n=wi(),Ue.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 im(){return Lt().memoizedState}function Ni(e,n,l,i){var f=an();Ue.flags|=e,f.memoizedState=ul(1|n,{destroy:void 0},l,i===void 0?null:i)}function Ti(e,n,l,i){var f=Lt();i=i===void 0?null:i;var x=f.memoizedState.inst;ft!==null&&i!==null&&Pc(i,ft.memoizedState.deps)?f.memoizedState=ul(n,x,l,i):(Ue.flags|=e,f.memoizedState=ul(1|n,x,l,i))}function om(e,n){Ni(8390656,8,e,n)}function Jc(e,n){Ti(2048,8,e,n)}function Wb(e){Ue.flags|=4;var n=Ue.updateQueue;if(n===null)n=wi(),Ue.updateQueue=n,n.events=[e];else{var l=n.events;l===null?n.events=[e]:l.push(e)}}function cm(e){var n=Lt().memoizedState;return Wb({ref:n,nextImpl:e}),function(){if((rt&2)!==0)throw Error(o(440));return n.impl.apply(void 0,arguments)}}function um(e,n){return Ti(4,2,e,n)}function dm(e,n){return Ti(4,4,e,n)}function fm(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 pm(e,n,l){l=l!=null?l.concat([e]):null,Ti(4,4,fm.bind(null,n,e),l)}function eu(){}function mm(e,n){var l=Lt();n=n===void 0?null:n;var i=l.memoizedState;return n!==null&&Pc(n,i[1])?i[0]:(l.memoizedState=[e,n],e)}function hm(e,n){var l=Lt();n=n===void 0?null:n;var i=l.memoizedState;if(n!==null&&Pc(n,i[1]))return i[0];if(i=e(),Cr){yt(!0);try{e()}finally{yt(!1)}}return l.memoizedState=[i,n],i}function tu(e,n,l){return l===void 0||(va&1073741824)!==0&&(Ye&261930)===0?e.memoizedState=n:(e.memoizedState=l,e=xh(),Ue.lanes|=e,qa|=e,l)}function xm(e,n,l,i){return vn(l,n)?l:il.current!==null?(e=tu(e,l,i),vn(e,n)||(_t=!0),e):(va&42)===0||(va&1073741824)!==0&&(Ye&261930)===0?(_t=!0,e.memoizedState=l):(e=xh(),Ue.lanes|=e,qa|=e,n)}function gm(e,n,l,i,f){var x=O.p;O.p=x!==0&&8>x?x:8;var j=M.T,A={};M.T=A,ru(e,!1,n,l);try{var $=f(),Z=M.S;if(Z!==null&&Z(A,$),$!==null&&typeof $=="object"&&typeof $.then=="function"){var le=$b($,i);as(e,n,le,wn(e))}else as(e,n,i,wn(e))}catch(oe){as(e,n,{then:function(){},status:"rejected",reason:oe},wn())}finally{O.p=x,j!==null&&A.types!==null&&(j.types=A.types),M.T=j}}function qb(){}function nu(e,n,l,i){if(e.tag!==5)throw Error(o(476));var f=vm(e).queue;gm(e,f,n,U,l===null?qb:function(){return ym(e),l(i)})}function vm(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:U,baseState:U,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ya,lastRenderedState:U},next:null};var l={};return n.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ya,lastRenderedState:l},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function ym(e){var n=vm(e);n.next===null&&(n=e.alternate.memoizedState),as(e,n.next.queue,{},wn())}function au(){return Yt(bs)}function bm(){return Lt().memoizedState}function jm(){return Lt().memoizedState}function Yb(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var l=wn();e=$a(l);var i=Va(n,e,l);i!==null&&(gn(i,n,l),Zl(i,n,l)),n={cache:Lc()},e.payload=n;return}n=n.return}}function Kb(e,n,l){var i=wn();l={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Ri(e)?km(n,l):(l=jc(e,n,l,i),l!==null&&(gn(l,e,i),wm(l,n,i)))}function Sm(e,n,l){var i=wn();as(e,n,l,i)}function as(e,n,l,i){var f={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Ri(e))km(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,A=x(j,l);if(f.hasEagerState=!0,f.eagerState=A,vn(A,j))return ci(e,n,f,0),xt===null&&oi(),!1}catch{}finally{}if(l=jc(e,n,f,i),l!==null)return gn(l,e,i),wm(l,n,i),!0}return!1}function ru(e,n,l,i){if(i={lane:2,revertLane:Ou(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Ri(e)){if(n)throw Error(o(479))}else n=jc(e,l,i,2),n!==null&&gn(n,e,2)}function Ri(e){var n=e.alternate;return e===Ue||n!==null&&n===Ue}function km(e,n){ol=Si=!0;var l=e.pending;l===null?n.next=n:(n.next=l.next,l.next=n),e.pending=n}function wm(e,n,l){if((l&4194048)!==0){var i=n.lanes;i&=e.pendingLanes,l|=i,n.lanes=l,Ko(e,l)}}var rs={readContext:Yt,use:Ci,useCallback:Tt,useContext:Tt,useEffect:Tt,useImperativeHandle:Tt,useLayoutEffect:Tt,useInsertionEffect:Tt,useMemo:Tt,useReducer:Tt,useRef:Tt,useState:Tt,useDebugValue:Tt,useDeferredValue:Tt,useTransition:Tt,useSyncExternalStore:Tt,useId:Tt,useHostTransitionStatus:Tt,useFormState:Tt,useActionState:Tt,useOptimistic:Tt,useMemoCache:Tt,useCacheRefresh:Tt};rs.useEffectEvent=Tt;var Cm={readContext:Yt,use:Ci,useCallback:function(e,n){return an().memoizedState=[e,n===void 0?null:n],e},useContext:Yt,useEffect:om,useImperativeHandle:function(e,n,l){l=l!=null?l.concat([e]):null,Ni(4194308,4,fm.bind(null,n,e),l)},useLayoutEffect:function(e,n){return Ni(4194308,4,e,n)},useInsertionEffect:function(e,n){Ni(4,2,e,n)},useMemo:function(e,n){var l=an();n=n===void 0?null:n;var i=e();if(Cr){yt(!0);try{e()}finally{yt(!1)}}return l.memoizedState=[i,n],i},useReducer:function(e,n,l){var i=an();if(l!==void 0){var f=l(n);if(Cr){yt(!0);try{l(n)}finally{yt(!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=Kb.bind(null,Ue,e),[i.memoizedState,e]},useRef:function(e){var n=an();return e={current:e},n.memoizedState=e},useState:function(e){e=Qc(e);var n=e.queue,l=Sm.bind(null,Ue,n);return n.dispatch=l,[e.memoizedState,l]},useDebugValue:eu,useDeferredValue:function(e,n){var l=an();return tu(l,e,n)},useTransition:function(){var e=Qc(!1);return e=gm.bind(null,Ue,e.queue,!0,!1),an().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,l){var i=Ue,f=an();if(Xe){if(l===void 0)throw Error(o(407));l=l()}else{if(l=n(),xt===null)throw Error(o(349));(Ye&127)!==0||Wp(i,n,l)}f.memoizedState=l;var x={value:l,getSnapshot:n};return f.queue=x,om(Yp.bind(null,i,x,e),[e]),i.flags|=2048,ul(9,{destroy:void 0},qp.bind(null,i,x,l,n),null),l},useId:function(){var e=an(),n=xt.identifierPrefix;if(Xe){var l=ea,i=Jn;l=(i&~(1<<32-ut(i)-1)).toString(32)+l,n="_"+n+"R_"+l,l=ki++,0<l&&(n+="H"+l.toString(32)),n+="_"}else l=Vb++,n="_"+n+"r_"+l.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:au,useFormState:am,useActionState:am,useOptimistic:function(e){var n=an();n.memoizedState=n.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=l,n=ru.bind(null,Ue,!0,l),l.dispatch=n,[e,n]},useMemoCache:Yc,useCacheRefresh:function(){return an().memoizedState=Yb.bind(null,Ue)},useEffectEvent:function(e){var n=an(),l={impl:e};return n.memoizedState=l,function(){if((rt&2)!==0)throw Error(o(440));return l.impl.apply(void 0,arguments)}}},lu={readContext:Yt,use:Ci,useCallback:mm,useContext:Yt,useEffect:Jc,useImperativeHandle:pm,useInsertionEffect:um,useLayoutEffect:dm,useMemo:hm,useReducer:Ei,useRef:im,useState:function(){return Ei(ya)},useDebugValue:eu,useDeferredValue:function(e,n){var l=Lt();return xm(l,ft.memoizedState,e,n)},useTransition:function(){var e=Ei(ya)[0],n=Lt().memoizedState;return[typeof e=="boolean"?e:ns(e),n]},useSyncExternalStore:Gp,useId:bm,useHostTransitionStatus:au,useFormState:rm,useActionState:rm,useOptimistic:function(e,n){var l=Lt();return Qp(l,ft,e,n)},useMemoCache:Yc,useCacheRefresh:jm};lu.useEffectEvent=cm;var Em={readContext:Yt,use:Ci,useCallback:mm,useContext:Yt,useEffect:Jc,useImperativeHandle:pm,useInsertionEffect:um,useLayoutEffect:dm,useMemo:hm,useReducer:Xc,useRef:im,useState:function(){return Xc(ya)},useDebugValue:eu,useDeferredValue:function(e,n){var l=Lt();return ft===null?tu(l,e,n):xm(l,ft.memoizedState,e,n)},useTransition:function(){var e=Xc(ya)[0],n=Lt().memoizedState;return[typeof e=="boolean"?e:ns(e),n]},useSyncExternalStore:Gp,useId:bm,useHostTransitionStatus:au,useFormState:sm,useActionState:sm,useOptimistic:function(e,n){var l=Lt();return ft!==null?Qp(l,ft,e,n):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:Yc,useCacheRefresh:jm};Em.useEffectEvent=cm;function su(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 iu={enqueueSetState:function(e,n,l){e=e._reactInternals;var i=wn(),f=$a(i);f.payload=n,l!=null&&(f.callback=l),n=Va(e,f,i),n!==null&&(gn(n,e,i),Zl(n,e,i))},enqueueReplaceState:function(e,n,l){e=e._reactInternals;var i=wn(),f=$a(i);f.tag=1,f.payload=n,l!=null&&(f.callback=l),n=Va(e,f,i),n!==null&&(gn(n,e,i),Zl(n,e,i))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var l=wn(),i=$a(l);i.tag=2,n!=null&&(i.callback=n),n=Va(e,i,l),n!==null&&(gn(n,e,l),Zl(n,e,l))}};function Nm(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?!Fl(l,i)||!Fl(f,x):!0}function Tm(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&&iu.enqueueReplaceState(n,n.state,null)}function Er(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 Rm(e){ii(e)}function Am(e){console.error(e)}function Mm(e){ii(e)}function Ai(e,n){try{var l=e.onUncaughtError;l(n.value,{componentStack:n.stack})}catch(i){setTimeout(function(){throw i})}}function Lm(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 ou(e,n,l){return l=$a(l),l.tag=3,l.payload={element:null},l.callback=function(){Ai(e,n)},l}function zm(e){return e=$a(e),e.tag=3,e}function Dm(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(){Lm(n,l,i)}}var j=l.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(e.callback=function(){Lm(n,l,i),typeof f!="function"&&(Ya===null?Ya=new Set([this]):Ya.add(this));var A=i.stack;this.componentDidCatch(i.value,{componentStack:A!==null?A:""})})}function Xb(e,n,l,i,f){if(l.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(n=l.alternate,n!==null&&nl(n,l,f,!0),l=bn.current,l!==null){switch(l.tag){case 31:case 13:return In===null?Vi():l.alternate===null&&Rt===0&&(Rt=3),l.flags&=-257,l.flags|=65536,l.lanes=f,i===gi?l.flags|=16384:(n=l.updateQueue,n===null?l.updateQueue=new Set([i]):n.add(i),zu(e,i,f)),!1;case 22:return l.flags|=65536,i===gi?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)),zu(e,i,f)),!1}throw Error(o(435,l.tag))}return zu(e,i,f),Vi(),!1}if(Xe)return n=bn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,i!==Nc&&(e=Error(o(422),{cause:i}),ql(Dn(e,l)))):(i!==Nc&&(n=Error(o(423),{cause:i}),ql(Dn(n,l))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,i=Dn(i,l),f=ou(e.stateNode,i,f),Ic(e,f),Rt!==4&&(Rt=2)),!1;var x=Error(o(520),{cause:i});if(x=Dn(x,l),fs===null?fs=[x]:fs.push(x),Rt!==4&&(Rt=2),n===null)return!0;i=Dn(i,l),l=n;do{switch(l.tag){case 3:return l.flags|=65536,e=f&-f,l.lanes|=e,e=ou(l.stateNode,i,e),Ic(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"&&(Ya===null||!Ya.has(x))))return l.flags|=65536,f&=-f,l.lanes|=f,f=zm(f),Dm(f,e,l,i),Ic(l,f),!1}l=l.return}while(l!==null);return!1}var cu=Error(o(461)),_t=!1;function Kt(e,n,l,i){n.child=e===null?Ip(n,null,l,i):wr(n,e.child,l,i)}function _m(e,n,l,i,f){l=l.render;var x=n.ref;if("ref"in i){var j={};for(var A in i)A!=="ref"&&(j[A]=i[A])}else j=i;return br(n),i=Fc(e,n,l,j,x,f),A=Gc(),e!==null&&!_t?(Wc(e,n,f),ba(e,n,f)):(Xe&&A&&Cc(n),n.flags|=1,Kt(e,n,i,f),n.child)}function Om(e,n,l,i,f){if(e===null){var x=l.type;return typeof x=="function"&&!Sc(x)&&x.defaultProps===void 0&&l.compare===null?(n.tag=15,n.type=x,Bm(e,n,x,i,f)):(e=di(l.type,null,i,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(x=e.child,!gu(e,f)){var j=x.memoizedProps;if(l=l.compare,l=l!==null?l:Fl,l(j,i)&&e.ref===n.ref)return ba(e,n,f)}return n.flags|=1,e=ma(x,i),e.ref=n.ref,e.return=n,n.child=e}function Bm(e,n,l,i,f){if(e!==null){var x=e.memoizedProps;if(Fl(x,i)&&e.ref===n.ref)if(_t=!1,n.pendingProps=i=x,gu(e,f))(e.flags&131072)!==0&&(_t=!0);else return n.lanes=e.lanes,ba(e,n,f)}return uu(e,n,l,i,f)}function Im(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 Hm(e,n,x,l,i)}if((l&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&hi(n,x!==null?x.cachePool:null),x!==null?$p(n,x):Uc(),Vp(n);else return i=n.lanes=536870912,Hm(e,n,x!==null?x.baseLanes|l:l,l,i)}else x!==null?(hi(n,x.cachePool),$p(n,x),Fa(),n.memoizedState=null):(e!==null&&hi(n,null),Uc(),Fa());return Kt(e,n,f,l),n.child}function ls(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Hm(e,n,l,i,f){var x=Dc();return x=x===null?null:{parent:zt._currentValue,pool:x},n.memoizedState={baseLanes:l,cachePool:x},e!==null&&hi(n,null),Uc(),Vp(n),e!==null&&nl(e,n,i,!0),n.childLanes=f,null}function Mi(e,n){return n=zi({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function Um(e,n,l){return wr(n,e.child,null,l),e=Mi(n,n.pendingProps),e.flags|=2,jn(n),n.memoizedState=null,e}function Qb(e,n,l){var i=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Xe){if(i.mode==="hidden")return e=Mi(n,i),n.lanes=536870912,ls(null,e);if(Vc(n),(e=bt)?(e=Zh(e,Bn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Oa!==null?{id:Jn,overflow:ea}:null,retryLane:536870912,hydrationErrors:null},l=kp(e),l.return=n,n.child=l,qt=n,bt=null)):e=null,e===null)throw Ia(n);return n.lanes=536870912,null}return Mi(n,i)}var x=e.memoizedState;if(x!==null){var j=x.dehydrated;if(Vc(n),f)if(n.flags&256)n.flags&=-257,n=Um(e,n,l);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(o(558));else if(_t||nl(e,n,l,!1),f=(l&e.childLanes)!==0,_t||f){if(i=xt,i!==null&&(j=ua(i,l),j!==0&&j!==x.retryLane))throw x.retryLane=j,xr(e,j),gn(i,e,j),cu;Vi(),n=Um(e,n,l)}else e=x.treeContext,bt=Hn(j.nextSibling),qt=n,Xe=!0,Ba=null,Bn=!1,e!==null&&Ep(n,e),n=Mi(n,i),n.flags|=4096;return n}return e=ma(e.child,{mode:i.mode,children:i.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Li(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 uu(e,n,l,i,f){return br(n),l=Fc(e,n,l,i,void 0,f),i=Gc(),e!==null&&!_t?(Wc(e,n,f),ba(e,n,f)):(Xe&&i&&Cc(n),n.flags|=1,Kt(e,n,l,f),n.child)}function $m(e,n,l,i,f,x){return br(n),n.updateQueue=null,l=Fp(n,i,l,f),Pp(e),i=Gc(),e!==null&&!_t?(Wc(e,n,x),ba(e,n,x)):(Xe&&i&&Cc(n),n.flags|=1,Kt(e,n,l,x),n.child)}function Vm(e,n,l,i,f){if(br(n),n.stateNode===null){var x=Zr,j=l.contextType;typeof j=="object"&&j!==null&&(x=Yt(j)),x=new l(i,x),n.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=iu,n.stateNode=x,x._reactInternals=n,x=n.stateNode,x.props=i,x.state=n.memoizedState,x.refs={},Oc(n),j=l.contextType,x.context=typeof j=="object"&&j!==null?Yt(j):Zr,x.state=n.memoizedState,j=l.getDerivedStateFromProps,typeof j=="function"&&(su(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&&iu.enqueueReplaceState(x,x.state,null),es(n,i,x,f),Jl(),x.state=n.memoizedState),typeof x.componentDidMount=="function"&&(n.flags|=4194308),i=!0}else if(e===null){x=n.stateNode;var A=n.memoizedProps,$=Er(l,A);x.props=$;var Z=x.context,le=l.contextType;j=Zr,typeof le=="object"&&le!==null&&(j=Yt(le));var oe=l.getDerivedStateFromProps;le=typeof oe=="function"||typeof x.getSnapshotBeforeUpdate=="function",A=n.pendingProps!==A,le||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(A||Z!==j)&&Tm(n,x,i,j),Ua=!1;var J=n.memoizedState;x.state=J,es(n,i,x,f),Jl(),Z=n.memoizedState,A||J!==Z||Ua?(typeof oe=="function"&&(su(n,l,oe,i),Z=n.memoizedState),($=Ua||Nm(n,l,$,i,J,Z,j))?(le||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=Z),x.props=i,x.state=Z,x.context=j,i=$):(typeof x.componentDidMount=="function"&&(n.flags|=4194308),i=!1)}else{x=n.stateNode,Bc(e,n),j=n.memoizedProps,le=Er(l,j),x.props=le,oe=n.pendingProps,J=x.context,Z=l.contextType,$=Zr,typeof Z=="object"&&Z!==null&&($=Yt(Z)),A=l.getDerivedStateFromProps,(Z=typeof A=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(j!==oe||J!==$)&&Tm(n,x,i,$),Ua=!1,J=n.memoizedState,x.state=J,es(n,i,x,f),Jl();var ne=n.memoizedState;j!==oe||J!==ne||Ua||e!==null&&e.dependencies!==null&&pi(e.dependencies)?(typeof A=="function"&&(su(n,l,A,i),ne=n.memoizedState),(le=Ua||Nm(n,l,le,i,J,ne,$)||e!==null&&e.dependencies!==null&&pi(e.dependencies))?(Z||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(i,ne,$),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(i,ne,$)),typeof x.componentDidUpdate=="function"&&(n.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof x.componentDidUpdate!="function"||j===e.memoizedProps&&J===e.memoizedState||(n.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||j===e.memoizedProps&&J===e.memoizedState||(n.flags|=1024),n.memoizedProps=i,n.memoizedState=ne),x.props=i,x.state=ne,x.context=$,i=le):(typeof x.componentDidUpdate!="function"||j===e.memoizedProps&&J===e.memoizedState||(n.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||j===e.memoizedProps&&J===e.memoizedState||(n.flags|=1024),i=!1)}return x=i,Li(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=wr(n,e.child,null,f),n.child=wr(n,null,l,f)):Kt(e,n,l,f),n.memoizedState=x.state,e=n.child):e=ba(e,n,f),e}function Pm(e,n,l,i){return vr(),n.flags|=256,Kt(e,n,l,i),n.child}var du={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function fu(e){return{baseLanes:e,cachePool:Lp()}}function pu(e,n,l){return e=e!==null?e.childLanes&~l:0,n&&(e|=kn),e}function Fm(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:(Mt.current&2)!==0),j&&(f=!0,n.flags&=-129),j=(n.flags&32)!==0,n.flags&=-33,e===null){if(Xe){if(f?Pa(n):Fa(),(e=bt)?(e=Zh(e,Bn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Oa!==null?{id:Jn,overflow:ea}:null,retryLane:536870912,hydrationErrors:null},l=kp(e),l.return=n,n.child=l,qt=n,bt=null)):e=null,e===null)throw Ia(n);return Ku(e)?n.lanes=32:n.lanes=536870912,null}var A=i.children;return i=i.fallback,f?(Fa(),f=n.mode,A=zi({mode:"hidden",children:A},f),i=gr(i,f,l,null),A.return=n,i.return=n,A.sibling=i,n.child=A,i=n.child,i.memoizedState=fu(l),i.childLanes=pu(e,j,l),n.memoizedState=du,ls(null,i)):(Pa(n),mu(n,A))}var $=e.memoizedState;if($!==null&&(A=$.dehydrated,A!==null)){if(x)n.flags&256?(Pa(n),n.flags&=-257,n=hu(e,n,l)):n.memoizedState!==null?(Fa(),n.child=e.child,n.flags|=128,n=null):(Fa(),A=i.fallback,f=n.mode,i=zi({mode:"visible",children:i.children},f),A=gr(A,f,l,null),A.flags|=2,i.return=n,A.return=n,i.sibling=A,n.child=i,wr(n,e.child,null,l),i=n.child,i.memoizedState=fu(l),i.childLanes=pu(e,j,l),n.memoizedState=du,n=ls(null,i));else if(Pa(n),Ku(A)){if(j=A.nextSibling&&A.nextSibling.dataset,j)var Z=j.dgst;j=Z,i=Error(o(419)),i.stack="",i.digest=j,ql({value:i,source:null,stack:null}),n=hu(e,n,l)}else if(_t||nl(e,n,l,!1),j=(l&e.childLanes)!==0,_t||j){if(j=xt,j!==null&&(i=ua(j,l),i!==0&&i!==$.retryLane))throw $.retryLane=i,xr(e,i),gn(j,e,i),cu;Yu(A)||Vi(),n=hu(e,n,l)}else Yu(A)?(n.flags|=192,n.child=e.child,n=null):(e=$.treeContext,bt=Hn(A.nextSibling),qt=n,Xe=!0,Ba=null,Bn=!1,e!==null&&Ep(n,e),n=mu(n,i.children),n.flags|=4096);return n}return f?(Fa(),A=i.fallback,f=n.mode,$=e.child,Z=$.sibling,i=ma($,{mode:"hidden",children:i.children}),i.subtreeFlags=$.subtreeFlags&65011712,Z!==null?A=ma(Z,A):(A=gr(A,f,l,null),A.flags|=2),A.return=n,i.return=n,i.sibling=A,n.child=i,ls(null,i),i=n.child,A=e.child.memoizedState,A===null?A=fu(l):(f=A.cachePool,f!==null?($=zt._currentValue,f=f.parent!==$?{parent:$,pool:$}:f):f=Lp(),A={baseLanes:A.baseLanes|l,cachePool:f}),i.memoizedState=A,i.childLanes=pu(e,j,l),n.memoizedState=du,ls(e.child,i)):(Pa(n),l=e.child,e=l.sibling,l=ma(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 mu(e,n){return n=zi({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function zi(e,n){return e=yn(22,e,null,n),e.lanes=0,e}function hu(e,n,l){return wr(n,e.child,null,l),e=mu(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Gm(e,n,l){e.lanes|=n;var i=e.alternate;i!==null&&(i.lanes|=n),Ac(e.return,n,l)}function xu(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 Wm(e,n,l){var i=n.pendingProps,f=i.revealOrder,x=i.tail;i=i.children;var j=Mt.current,A=(j&2)!==0;if(A?(j=j&1|2,n.flags|=128):j&=1,ee(Mt,j),Kt(e,n,i,l),i=Xe?Wl:0,!A&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Gm(e,l,n);else if(e.tag===19)Gm(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&&ji(e)===null&&(f=l),l=l.sibling;l=f,l===null?(f=n.child,n.child=null):(f=l.sibling,l.sibling=null),xu(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&&ji(e)===null){n.child=f;break}e=f.sibling,f.sibling=l,l=f,f=e}xu(n,!0,l,null,x,i);break;case"together":xu(n,!1,null,null,void 0,i);break;default:n.memoizedState=null}return n.child}function ba(e,n,l){if(e!==null&&(n.dependencies=e.dependencies),qa|=n.lanes,(l&n.childLanes)===0)if(e!==null){if(nl(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=ma(e,e.pendingProps),n.child=l,l.return=n;e.sibling!==null;)e=e.sibling,l=l.sibling=ma(e,e.pendingProps),l.return=n;l.sibling=null}return n.child}function gu(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&pi(e)))}function Zb(e,n,l){switch(n.tag){case 3:de(n,n.stateNode.containerInfo),Ha(n,zt,e.memoizedState.cache),vr();break;case 27:case 5:Re(n);break;case 4:de(n,n.stateNode.containerInfo);break;case 10:Ha(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Vc(n),null;break;case 13:var i=n.memoizedState;if(i!==null)return i.dehydrated!==null?(Pa(n),n.flags|=128,null):(l&n.child.childLanes)!==0?Fm(e,n,l):(Pa(n),e=ba(e,n,l),e!==null?e.sibling:null);Pa(n);break;case 19:var f=(e.flags&128)!==0;if(i=(l&n.childLanes)!==0,i||(nl(e,n,l,!1),i=(l&n.childLanes)!==0),f){if(i)return Wm(e,n,l);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),ee(Mt,Mt.current),i)break;return null;case 22:return n.lanes=0,Im(e,n,l,n.pendingProps);case 24:Ha(n,zt,e.memoizedState.cache)}return ba(e,n,l)}function qm(e,n,l){if(e!==null)if(e.memoizedProps!==n.pendingProps)_t=!0;else{if(!gu(e,l)&&(n.flags&128)===0)return _t=!1,Zb(e,n,l);_t=(e.flags&131072)!==0}else _t=!1,Xe&&(n.flags&1048576)!==0&&Cp(n,Wl,n.index);switch(n.lanes=0,n.tag){case 16:e:{var i=n.pendingProps;if(e=Sr(n.elementType),n.type=e,typeof e=="function")Sc(e)?(i=Er(e,i),n.tag=1,n=Vm(null,n,e,i,l)):(n.tag=0,n=uu(null,n,e,i,l));else{if(e!=null){var f=e.$$typeof;if(f===B){n.tag=11,n=_m(null,n,e,i,l);break e}else if(f===E){n.tag=14,n=Om(null,n,e,i,l);break e}}throw n=X(e)||e,Error(o(306,n,""))}}return n;case 0:return uu(e,n,n.type,n.pendingProps,l);case 1:return i=n.type,f=Er(i,n.pendingProps),Vm(e,n,i,f,l);case 3:e:{if(de(n,n.stateNode.containerInfo),e===null)throw Error(o(387));i=n.pendingProps;var x=n.memoizedState;f=x.element,Bc(e,n),es(n,i,null,l);var j=n.memoizedState;if(i=j.cache,Ha(n,zt,i),i!==x.cache&&Mc(n,[zt],l,!0),Jl(),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=Pm(e,n,i,l);break e}else if(i!==f){f=Dn(Error(o(424)),n),ql(f),n=Pm(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(bt=Hn(e.firstChild),qt=n,Xe=!0,Ba=null,Bn=!0,l=Ip(n,null,i,l),n.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(vr(),i===f){n=ba(e,n,l);break e}Kt(e,n,i,l)}n=n.child}return n;case 26:return Li(e,n),e===null?(l=rx(n.type,null,n.pendingProps,null))?n.memoizedState=l:Xe||(l=n.type,e=n.pendingProps,i=Ki(ce.current).createElement(l),i[Wt]=n,i[dn]=e,Xt(i,l,e),Pt(i),n.stateNode=i):n.memoizedState=rx(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return Re(n),e===null&&Xe&&(i=n.stateNode=tx(n.type,n.pendingProps,ce.current),qt=n,Bn=!0,f=bt,Za(n.type)?(Xu=f,bt=Hn(i.firstChild)):bt=f),Kt(e,n,n.pendingProps.children,l),Li(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Xe&&((f=i=bt)&&(i=T1(i,n.type,n.pendingProps,Bn),i!==null?(n.stateNode=i,qt=n,bt=Hn(i.firstChild),Bn=!1,f=!0):f=!1),f||Ia(n)),Re(n),f=n.type,x=n.pendingProps,j=e!==null?e.memoizedProps:null,i=x.children,Gu(f,x)?i=null:j!==null&&Gu(f,j)&&(n.flags|=32),n.memoizedState!==null&&(f=Fc(e,n,Pb,null,null,l),bs._currentValue=f),Li(e,n),Kt(e,n,i,l),n.child;case 6:return e===null&&Xe&&((e=l=bt)&&(l=R1(l,n.pendingProps,Bn),l!==null?(n.stateNode=l,qt=n,bt=null,e=!0):e=!1),e||Ia(n)),null;case 13:return Fm(e,n,l);case 4:return de(n,n.stateNode.containerInfo),i=n.pendingProps,e===null?n.child=wr(n,null,i,l):Kt(e,n,i,l),n.child;case 11:return _m(e,n,n.type,n.pendingProps,l);case 7:return Kt(e,n,n.pendingProps,l),n.child;case 8:return Kt(e,n,n.pendingProps.children,l),n.child;case 12:return Kt(e,n,n.pendingProps.children,l),n.child;case 10:return i=n.pendingProps,Ha(n,n.type,i.value),Kt(e,n,i.children,l),n.child;case 9:return f=n.type._context,i=n.pendingProps.children,br(n),f=Yt(f),i=i(f),n.flags|=1,Kt(e,n,i,l),n.child;case 14:return Om(e,n,n.type,n.pendingProps,l);case 15:return Bm(e,n,n.type,n.pendingProps,l);case 19:return Wm(e,n,l);case 31:return Qb(e,n,l);case 22:return Im(e,n,l,n.pendingProps);case 24:return br(n),i=Yt(zt),e===null?(f=Dc(),f===null&&(f=xt,x=Lc(),f.pooledCache=x,x.refCount++,x!==null&&(f.pooledCacheLanes|=l),f=x),n.memoizedState={parent:i,cache:f},Oc(n),Ha(n,zt,f)):((e.lanes&l)!==0&&(Bc(e,n),es(n,null,null,l),Jl()),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),Ha(n,zt,i)):(i=x.cache,Ha(n,zt,i),i!==f.cache&&Mc(n,[zt],l,!0))),Kt(e,n,n.pendingProps.children,l),n.child;case 29:throw n.pendingProps}throw Error(o(156,n.tag))}function ja(e){e.flags|=4}function vu(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(bh())e.flags|=8192;else throw kr=gi,_c}else e.flags&=-16777217}function Ym(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!cx(n))if(bh())e.flags|=8192;else throw kr=gi,_c}function Di(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?dt():536870912,e.lanes|=n,ml|=n)}function ss(e,n){if(!Xe)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 jt(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 Jb(e,n,l){var i=n.pendingProps;switch(Ec(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jt(n),null;case 1:return jt(n),null;case 3:return l=n.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),n.memoizedState.cache!==i&&(n.flags|=2048),ga(zt),je(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(tl(n)?ja(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Tc())),jt(n),null;case 26:var f=n.type,x=n.memoizedState;return e===null?(ja(n),x!==null?(jt(n),Ym(n,x)):(jt(n),vu(n,f,null,i,l))):x?x!==e.memoizedState?(ja(n),jt(n),Ym(n,x)):(jt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==i&&ja(n),jt(n),vu(n,f,e,i,l)),null;case 27:if(Le(n),l=ce.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==i&&ja(n);else{if(!i){if(n.stateNode===null)throw Error(o(166));return jt(n),null}e=re.current,tl(n)?Np(n):(e=tx(f,i,l),n.stateNode=e,ja(n))}return jt(n),null;case 5:if(Le(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==i&&ja(n);else{if(!i){if(n.stateNode===null)throw Error(o(166));return jt(n),null}if(x=re.current,tl(n))Np(n);else{var j=Ki(ce.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[Wt]=n,x[dn]=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(Xt(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&&ja(n)}}return jt(n),vu(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,l),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==i&&ja(n);else{if(typeof i!="string"&&n.stateNode===null)throw Error(o(166));if(e=ce.current,tl(n)){if(e=n.stateNode,l=n.memoizedProps,i=null,f=qt,f!==null)switch(f.tag){case 27:case 5:i=f.memoizedProps}e[Wt]=n,e=!!(e.nodeValue===l||i!==null&&i.suppressHydrationWarning===!0||Fh(e.nodeValue,l)),e||Ia(n,!0)}else e=Ki(e).createTextNode(i),e[Wt]=n,n.stateNode=e}return jt(n),null;case 31:if(l=n.memoizedState,e===null||e.memoizedState!==null){if(i=tl(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[Wt]=n}else vr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;jt(n),e=!1}else l=Tc(),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 jt(n),null;case 13:if(i=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=tl(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[Wt]=n}else vr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;jt(n),f=!1}else f=Tc(),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),Di(n,n.updateQueue),jt(n),null);case 4:return je(),e===null&&Uu(n.stateNode.containerInfo),jt(n),null;case 10:return ga(n.type),jt(n),null;case 19:if(P(Mt),i=n.memoizedState,i===null)return jt(n),null;if(f=(n.flags&128)!==0,x=i.rendering,x===null)if(f)ss(i,!1);else{if(Rt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(x=ji(e),x!==null){for(n.flags|=128,ss(i,!1),e=x.updateQueue,n.updateQueue=e,Di(n,e),n.subtreeFlags=0,e=l,l=n.child;l!==null;)Sp(l,e),l=l.sibling;return ee(Mt,Mt.current&1|2),Xe&&ha(n,i.treeForkCount),n.child}e=e.sibling}i.tail!==null&&Ze()>Hi&&(n.flags|=128,f=!0,ss(i,!1),n.lanes=4194304)}else{if(!f)if(e=ji(x),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,Di(n,e),ss(i,!0),i.tail===null&&i.tailMode==="hidden"&&!x.alternate&&!Xe)return jt(n),null}else 2*Ze()-i.renderingStartTime>Hi&&l!==536870912&&(n.flags|=128,f=!0,ss(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=Ze(),e.sibling=null,l=Mt.current,ee(Mt,f?l&1|2:l&1),Xe&&ha(n,i.treeForkCount),e):(jt(n),null);case 22:case 23:return jn(n),$c(),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&&(jt(n),n.subtreeFlags&6&&(n.flags|=8192)):jt(n),l=n.updateQueue,l!==null&&Di(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&&P(jr),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),ga(zt),jt(n),null;case 25:return null;case 30:return null}throw Error(o(156,n.tag))}function e1(e,n){switch(Ec(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return ga(zt),je(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return Le(n),null;case 31:if(n.memoizedState!==null){if(jn(n),n.alternate===null)throw Error(o(340));vr()}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));vr()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return P(Mt),null;case 4:return je(),null;case 10:return ga(n.type),null;case 22:case 23:return jn(n),$c(),e!==null&&P(jr),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return ga(zt),null;case 25:return null;default:return null}}function Km(e,n){switch(Ec(n),n.tag){case 3:ga(zt),je();break;case 26:case 27:case 5:Le(n);break;case 4:je();break;case 31:n.memoizedState!==null&&jn(n);break;case 13:jn(n);break;case 19:P(Mt);break;case 10:ga(n.type);break;case 22:case 23:jn(n),$c(),e!==null&&P(jr);break;case 24:ga(zt)}}function is(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(A){ot(n,n.return,A)}}function Ga(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,A=j.destroy;if(A!==void 0){j.destroy=void 0,f=n;var $=l,Z=A;try{Z()}catch(le){ot(f,$,le)}}}i=i.next}while(i!==x)}}catch(le){ot(n,n.return,le)}}function Xm(e){var n=e.updateQueue;if(n!==null){var l=e.stateNode;try{Up(n,l)}catch(i){ot(e,e.return,i)}}}function Qm(e,n,l){l.props=Er(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(i){ot(e,n,i)}}function os(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){ot(e,n,f)}}function ta(e,n){var l=e.ref,i=e.refCleanup;if(l!==null)if(typeof i=="function")try{i()}catch(f){ot(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){ot(e,n,f)}else l.current=null}function Zm(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){ot(e,e.return,f)}}function yu(e,n,l){try{var i=e.stateNode;S1(i,e.type,l,n),i[dn]=n}catch(f){ot(e,e.return,f)}}function Jm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Za(e.type)||e.tag===4}function bu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Jm(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&&Za(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ju(e,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=fa));else if(i!==4&&(i===27&&Za(e.type)&&(l=e.stateNode,n=null),e=e.child,e!==null))for(ju(e,n,l),e=e.sibling;e!==null;)ju(e,n,l),e=e.sibling}function _i(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&&Za(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(_i(e,n,l),e=e.sibling;e!==null;)_i(e,n,l),e=e.sibling}function eh(e){var n=e.stateNode,l=e.memoizedProps;try{for(var i=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);Xt(n,i,l),n[Wt]=e,n[dn]=l}catch(x){ot(e,e.return,x)}}var Sa=!1,Ot=!1,Su=!1,th=typeof WeakSet=="function"?WeakSet:Set,Ft=null;function t1(e,n){if(e=e.containerInfo,Pu=no,e=pp(e),hc(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var i=l.getSelection&&l.getSelection();if(i&&i.rangeCount!==0){l=i.anchorNode;var f=i.anchorOffset,x=i.focusNode;i=i.focusOffset;try{l.nodeType,x.nodeType}catch{l=null;break e}var j=0,A=-1,$=-1,Z=0,le=0,oe=e,J=null;t:for(;;){for(var ne;oe!==l||f!==0&&oe.nodeType!==3||(A=j+f),oe!==x||i!==0&&oe.nodeType!==3||($=j+i),oe.nodeType===3&&(j+=oe.nodeValue.length),(ne=oe.firstChild)!==null;)J=oe,oe=ne;for(;;){if(oe===e)break t;if(J===l&&++Z===f&&(A=j),J===x&&++le===i&&($=j),(ne=oe.nextSibling)!==null)break;oe=J,J=oe.parentNode}oe=ne}l=A===-1||$===-1?null:{start:A,end:$}}else l=null}l=l||{start:0,end:0}}else l=null;for(Fu={focusedElem:e,selectionRange:l},no=!1,Ft=n;Ft!==null;)if(n=Ft,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Ft=e;else for(;Ft!==null;){switch(n=Ft,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 ke=Er(l.type,f);e=i.getSnapshotBeforeUpdate(ke,x),i.__reactInternalSnapshotBeforeUpdate=e}catch(Me){ot(l,l.return,Me)}}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,Ft=e;break}Ft=n.return}}function nh(e,n,l){var i=l.flags;switch(l.tag){case 0:case 11:case 15:wa(e,l),i&4&&is(5,l);break;case 1:if(wa(e,l),i&4)if(e=l.stateNode,n===null)try{e.componentDidMount()}catch(j){ot(l,l.return,j)}else{var f=Er(l.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(j){ot(l,l.return,j)}}i&64&&Xm(l),i&512&&os(l,l.return);break;case 3:if(wa(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{Up(e,n)}catch(j){ot(l,l.return,j)}}break;case 27:n===null&&i&4&&eh(l);case 26:case 5:wa(e,l),n===null&&i&4&&Zm(l),i&512&&os(l,l.return);break;case 12:wa(e,l);break;case 31:wa(e,l),i&4&&lh(e,l);break;case 13:wa(e,l),i&4&&sh(e,l),i&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=u1.bind(null,l),A1(e,l))));break;case 22:if(i=l.memoizedState!==null||Sa,!i){n=n!==null&&n.memoizedState!==null||Ot,f=Sa;var x=Ot;Sa=i,(Ot=n)&&!x?Ca(e,l,(l.subtreeFlags&8772)!==0):wa(e,l),Sa=f,Ot=x}break;case 30:break;default:wa(e,l)}}function ah(e){var n=e.alternate;n!==null&&(e.alternate=null,ah(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Zo(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 wt=null,pn=!1;function ka(e,n,l){for(l=l.child;l!==null;)rh(e,n,l),l=l.sibling}function rh(e,n,l){if(Je&&typeof Je.onCommitFiberUnmount=="function")try{Je.onCommitFiberUnmount($e,l)}catch{}switch(l.tag){case 26:Ot||ta(l,n),ka(e,n,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Ot||ta(l,n);var i=wt,f=pn;Za(l.type)&&(wt=l.stateNode,pn=!1),ka(e,n,l),gs(l.stateNode),wt=i,pn=f;break;case 5:Ot||ta(l,n);case 6:if(i=wt,f=pn,wt=null,ka(e,n,l),wt=i,pn=f,wt!==null)if(pn)try{(wt.nodeType===9?wt.body:wt.nodeName==="HTML"?wt.ownerDocument.body:wt).removeChild(l.stateNode)}catch(x){ot(l,n,x)}else try{wt.removeChild(l.stateNode)}catch(x){ot(l,n,x)}break;case 18:wt!==null&&(pn?(e=wt,Xh(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),Sl(e)):Xh(wt,l.stateNode));break;case 4:i=wt,f=pn,wt=l.stateNode.containerInfo,pn=!0,ka(e,n,l),wt=i,pn=f;break;case 0:case 11:case 14:case 15:Ga(2,l,n),Ot||Ga(4,l,n),ka(e,n,l);break;case 1:Ot||(ta(l,n),i=l.stateNode,typeof i.componentWillUnmount=="function"&&Qm(l,n,i)),ka(e,n,l);break;case 21:ka(e,n,l);break;case 22:Ot=(i=Ot)||l.memoizedState!==null,ka(e,n,l),Ot=i;break;default:ka(e,n,l)}}function lh(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Sl(e)}catch(l){ot(n,n.return,l)}}}function sh(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Sl(e)}catch(l){ot(n,n.return,l)}}function n1(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new th),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new th),n;default:throw Error(o(435,e.tag))}}function Oi(e,n){var l=n1(e);n.forEach(function(i){if(!l.has(i)){l.add(i);var f=d1.bind(null,e,i);i.then(f,f)}})}function mn(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,A=j;e:for(;A!==null;){switch(A.tag){case 27:if(Za(A.type)){wt=A.stateNode,pn=!1;break e}break;case 5:wt=A.stateNode,pn=!1;break e;case 3:case 4:wt=A.stateNode.containerInfo,pn=!0;break e}A=A.return}if(wt===null)throw Error(o(160));rh(x,j,f),wt=null,pn=!1,x=f.alternate,x!==null&&(x.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)ih(n,e),n=n.sibling}var qn=null;function ih(e,n){var l=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:mn(n,e),hn(e),i&4&&(Ga(3,e,e.return),is(3,e),Ga(5,e,e.return));break;case 1:mn(n,e),hn(e),i&512&&(Ot||l===null||ta(l,l.return)),i&64&&Sa&&(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=qn;if(mn(n,e),hn(e),i&512&&(Ot||l===null||ta(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[Wt]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=f.createElement(i),f.head.insertBefore(x,f.querySelector("head > title"))),Xt(x,i,l),x[Wt]=e,Pt(x),i=x;break e;case"link":var j=ix("link","href",f).get(i+(l.href||""));if(j){for(var A=0;A<j.length;A++)if(x=j[A],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(A,1);break t}}x=f.createElement(i),Xt(x,i,l),f.head.appendChild(x);break;case"meta":if(j=ix("meta","content",f).get(i+(l.content||""))){for(A=0;A<j.length;A++)if(x=j[A],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(A,1);break t}}x=f.createElement(i),Xt(x,i,l),f.head.appendChild(x);break;default:throw Error(o(468,i))}x[Wt]=e,Pt(x),i=x}e.stateNode=i}else ox(f,e.type,e.stateNode);else e.stateNode=sx(f,i,e.memoizedProps);else x!==i?(x===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):x.count--,i===null?ox(f,e.type,e.stateNode):sx(f,i,e.memoizedProps)):i===null&&e.stateNode!==null&&yu(e,e.memoizedProps,l.memoizedProps)}break;case 27:mn(n,e),hn(e),i&512&&(Ot||l===null||ta(l,l.return)),l!==null&&i&4&&yu(e,e.memoizedProps,l.memoizedProps);break;case 5:if(mn(n,e),hn(e),i&512&&(Ot||l===null||ta(l,l.return)),e.flags&32){f=e.stateNode;try{Gr(f,"")}catch(ke){ot(e,e.return,ke)}}i&4&&e.stateNode!=null&&(f=e.memoizedProps,yu(e,f,l!==null?l.memoizedProps:f)),i&1024&&(Su=!0);break;case 6:if(mn(n,e),hn(e),i&4){if(e.stateNode===null)throw Error(o(162));i=e.memoizedProps,l=e.stateNode;try{l.nodeValue=i}catch(ke){ot(e,e.return,ke)}}break;case 3:if(Zi=null,f=qn,qn=Xi(n.containerInfo),mn(n,e),qn=f,hn(e),i&4&&l!==null&&l.memoizedState.isDehydrated)try{Sl(n.containerInfo)}catch(ke){ot(e,e.return,ke)}Su&&(Su=!1,oh(e));break;case 4:i=qn,qn=Xi(e.stateNode.containerInfo),mn(n,e),hn(e),qn=i;break;case 12:mn(n,e),hn(e);break;case 31:mn(n,e),hn(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Oi(e,i)));break;case 13:mn(n,e),hn(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Ii=Ze()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Oi(e,i)));break;case 22:f=e.memoizedState!==null;var $=l!==null&&l.memoizedState!==null,Z=Sa,le=Ot;if(Sa=Z||f,Ot=le||$,mn(n,e),Ot=le,Sa=Z,hn(e),i&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(l===null||$||Sa||Ot||Nr(e)),l=null,n=e;;){if(n.tag===5||n.tag===26){if(l===null){$=l=n;try{if(x=$.stateNode,f)j=x.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{A=$.stateNode;var oe=$.memoizedProps.style,J=oe!=null&&oe.hasOwnProperty("display")?oe.display:null;A.style.display=J==null||typeof J=="boolean"?"":(""+J).trim()}}catch(ke){ot($,$.return,ke)}}}else if(n.tag===6){if(l===null){$=n;try{$.stateNode.nodeValue=f?"":$.memoizedProps}catch(ke){ot($,$.return,ke)}}}else if(n.tag===18){if(l===null){$=n;try{var ne=$.stateNode;f?Qh(ne,!0):Qh($.stateNode,!1)}catch(ke){ot($,$.return,ke)}}}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,Oi(e,l))));break;case 19:mn(n,e),hn(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Oi(e,i)));break;case 30:break;case 21:break;default:mn(n,e),hn(e)}}function hn(e){var n=e.flags;if(n&2){try{for(var l,i=e.return;i!==null;){if(Jm(i)){l=i;break}i=i.return}if(l==null)throw Error(o(160));switch(l.tag){case 27:var f=l.stateNode,x=bu(e);_i(e,x,f);break;case 5:var j=l.stateNode;l.flags&32&&(Gr(j,""),l.flags&=-33);var A=bu(e);_i(e,A,j);break;case 3:case 4:var $=l.stateNode.containerInfo,Z=bu(e);ju(e,Z,$);break;default:throw Error(o(161))}}catch(le){ot(e,e.return,le)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function oh(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;oh(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function wa(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)nh(e,n.alternate,n),n=n.sibling}function Nr(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Ga(4,n,n.return),Nr(n);break;case 1:ta(n,n.return);var l=n.stateNode;typeof l.componentWillUnmount=="function"&&Qm(n,n.return,l),Nr(n);break;case 27:gs(n.stateNode);case 26:case 5:ta(n,n.return),Nr(n);break;case 22:n.memoizedState===null&&Nr(n);break;case 30:Nr(n);break;default:Nr(n)}e=e.sibling}}function Ca(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:Ca(f,x,l),is(4,x);break;case 1:if(Ca(f,x,l),i=x,f=i.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(Z){ot(i,i.return,Z)}if(i=x,f=i.updateQueue,f!==null){var A=i.stateNode;try{var $=f.shared.hiddenCallbacks;if($!==null)for(f.shared.hiddenCallbacks=null,f=0;f<$.length;f++)Hp($[f],A)}catch(Z){ot(i,i.return,Z)}}l&&j&64&&Xm(x),os(x,x.return);break;case 27:eh(x);case 26:case 5:Ca(f,x,l),l&&i===null&&j&4&&Zm(x),os(x,x.return);break;case 12:Ca(f,x,l);break;case 31:Ca(f,x,l),l&&j&4&&lh(f,x);break;case 13:Ca(f,x,l),l&&j&4&&sh(f,x);break;case 22:x.memoizedState===null&&Ca(f,x,l),os(x,x.return);break;case 30:break;default:Ca(f,x,l)}n=n.sibling}}function ku(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&&Yl(l))}function wu(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Yl(e))}function Yn(e,n,l,i){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)ch(e,n,l,i),n=n.sibling}function ch(e,n,l,i){var f=n.flags;switch(n.tag){case 0:case 11:case 15:Yn(e,n,l,i),f&2048&&is(9,n);break;case 1:Yn(e,n,l,i);break;case 3:Yn(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&&Yl(e)));break;case 12:if(f&2048){Yn(e,n,l,i),e=n.stateNode;try{var x=n.memoizedProps,j=x.id,A=x.onPostCommit;typeof A=="function"&&A(j,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch($){ot(n,n.return,$)}}else Yn(e,n,l,i);break;case 31:Yn(e,n,l,i);break;case 13:Yn(e,n,l,i);break;case 23:break;case 22:x=n.stateNode,j=n.alternate,n.memoizedState!==null?x._visibility&2?Yn(e,n,l,i):cs(e,n):x._visibility&2?Yn(e,n,l,i):(x._visibility|=2,dl(e,n,l,i,(n.subtreeFlags&10256)!==0||!1)),f&2048&&ku(j,n);break;case 24:Yn(e,n,l,i),f&2048&&wu(n.alternate,n);break;default:Yn(e,n,l,i)}}function dl(e,n,l,i,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var x=e,j=n,A=l,$=i,Z=j.flags;switch(j.tag){case 0:case 11:case 15:dl(x,j,A,$,f),is(8,j);break;case 23:break;case 22:var le=j.stateNode;j.memoizedState!==null?le._visibility&2?dl(x,j,A,$,f):cs(x,j):(le._visibility|=2,dl(x,j,A,$,f)),f&&Z&2048&&ku(j.alternate,j);break;case 24:dl(x,j,A,$,f),f&&Z&2048&&wu(j.alternate,j);break;default:dl(x,j,A,$,f)}n=n.sibling}}function cs(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:cs(l,i),f&2048&&ku(i.alternate,i);break;case 24:cs(l,i),f&2048&&wu(i.alternate,i);break;default:cs(l,i)}n=n.sibling}}var us=8192;function fl(e,n,l){if(e.subtreeFlags&us)for(e=e.child;e!==null;)uh(e,n,l),e=e.sibling}function uh(e,n,l){switch(e.tag){case 26:fl(e,n,l),e.flags&us&&e.memoizedState!==null&&V1(l,qn,e.memoizedState,e.memoizedProps);break;case 5:fl(e,n,l);break;case 3:case 4:var i=qn;qn=Xi(e.stateNode.containerInfo),fl(e,n,l),qn=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=us,us=16777216,fl(e,n,l),us=i):fl(e,n,l));break;default:fl(e,n,l)}}function dh(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 ds(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];Ft=i,ph(i,e)}dh(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)fh(e),e=e.sibling}function fh(e){switch(e.tag){case 0:case 11:case 15:ds(e),e.flags&2048&&Ga(9,e,e.return);break;case 3:ds(e);break;case 12:ds(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Bi(e)):ds(e);break;default:ds(e)}}function Bi(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];Ft=i,ph(i,e)}dh(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Ga(8,n,n.return),Bi(n);break;case 22:l=n.stateNode,l._visibility&2&&(l._visibility&=-3,Bi(n));break;default:Bi(n)}e=e.sibling}}function ph(e,n){for(;Ft!==null;){var l=Ft;switch(l.tag){case 0:case 11:case 15:Ga(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:Yl(l.memoizedState.cache)}if(i=l.child,i!==null)i.return=l,Ft=i;else e:for(l=e;Ft!==null;){i=Ft;var f=i.sibling,x=i.return;if(ah(i),i===l){Ft=null;break e}if(f!==null){f.return=x,Ft=f;break e}Ft=x}}}var a1={getCacheForType:function(e){var n=Yt(zt),l=n.data.get(e);return l===void 0&&(l=e(),n.data.set(e,l)),l},cacheSignal:function(){return Yt(zt).controller.signal}},r1=typeof WeakMap=="function"?WeakMap:Map,rt=0,xt=null,We=null,Ye=0,it=0,Sn=null,Wa=!1,pl=!1,Cu=!1,Ea=0,Rt=0,qa=0,Tr=0,Eu=0,kn=0,ml=0,fs=null,xn=null,Nu=!1,Ii=0,mh=0,Hi=1/0,Ui=null,Ya=null,It=0,Ka=null,hl=null,Na=0,Tu=0,Ru=null,hh=null,ps=0,Au=null;function wn(){return(rt&2)!==0&&Ye!==0?Ye&-Ye:M.T!==null?Ou():Mf()}function xh(){if(kn===0)if((Ye&536870912)===0||Xe){var e=we;we<<=1,(we&3932160)===0&&(we=262144),kn=e}else kn=536870912;return e=bn.current,e!==null&&(e.flags|=32),kn}function gn(e,n,l){(e===xt&&(it===2||it===9)||e.cancelPendingCommit!==null)&&(xl(e,0),Xa(e,Ye,kn,!1)),An(e,l),((rt&2)===0||e!==xt)&&(e===xt&&((rt&2)===0&&(Tr|=l),Rt===4&&Xa(e,Ye,kn,!1)),na(e))}function gh(e,n,l){if((rt&6)!==0)throw Error(o(327));var i=!l&&(n&127)===0&&(n&e.expiredLanes)===0||La(e,n),f=i?i1(e,n):Lu(e,n,!0),x=i;do{if(f===0){pl&&!i&&Xa(e,n,0,!1);break}else{if(l=e.current.alternate,x&&!l1(l)){f=Lu(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 A=e;f=fs;var $=A.current.memoizedState.isDehydrated;if($&&(xl(A,j).flags|=256),j=Lu(A,j,!1),j!==2){if(Cu&&!$){A.errorRecoveryDisabledLanes|=x,Tr|=x,f=4;break e}x=xn,xn=f,x!==null&&(xn===null?xn=x:xn.push.apply(xn,x))}f=j}if(x=!1,f!==2)continue}}if(f===1){xl(e,0),Xa(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:Xa(i,n,kn,!Wa);break e;case 2:xn=null;break;case 3:case 5:break;default:throw Error(o(329))}if((n&62914560)===n&&(f=Ii+300-Ze(),10<f)){if(Xa(i,n,kn,!Wa),ca(i,0,!0)!==0)break e;Na=n,i.timeoutHandle=Yh(vh.bind(null,i,l,xn,Ui,Nu,n,kn,Tr,ml,Wa,x,"Throttled",-0,0),f);break e}vh(i,l,xn,Ui,Nu,n,kn,Tr,ml,Wa,x,null,-0,0)}}break}while(!0);na(e)}function vh(e,n,l,i,f,x,j,A,$,Z,le,oe,J,ne){if(e.timeoutHandle=-1,oe=n.subtreeFlags,oe&8192||(oe&16785408)===16785408){oe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:fa},uh(n,x,oe);var ke=(x&62914560)===x?Ii-Ze():(x&4194048)===x?mh-Ze():0;if(ke=P1(oe,ke),ke!==null){Na=x,e.cancelPendingCommit=ke(Eh.bind(null,e,n,x,l,i,f,j,A,$,le,oe,null,J,ne)),Xa(e,x,j,!Z);return}}Eh(e,n,x,l,i,f,j,A,$)}function l1(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 Xa(e,n,l,i){n&=~Eu,n&=~Tr,e.suspendedLanes|=n,e.pingedLanes&=~n,i&&(e.warmLanes|=n),i=e.expirationTimes;for(var f=n;0<f;){var x=31-ut(f),j=1<<x;i[x]=-1,f&=~j}l!==0&&Zt(e,l,n)}function $i(){return(rt&6)===0?(ms(0),!1):!0}function Mu(){if(We!==null){if(it===0)var e=We.return;else e=We,xa=yr=null,qc(e),sl=null,Xl=0,e=We;for(;e!==null;)Km(e.alternate,e),e=e.return;We=null}}function xl(e,n){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,C1(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),Na=0,Mu(),xt=e,We=l=ma(e.current,null),Ye=n,it=0,Sn=null,Wa=!1,pl=La(e,n),Cu=!1,ml=kn=Eu=Tr=qa=Rt=0,xn=fs=null,Nu=!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-ut(i),x=1<<f;n|=e[f],i&=~x}return Ea=n,oi(),l}function yh(e,n){Ue=null,M.H=rs,n===ll||n===xi?(n=_p(),it=3):n===_c?(n=_p(),it=4):it=n===cu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Sn=n,We===null&&(Rt=1,Ai(e,Dn(n,e.current)))}function bh(){var e=bn.current;return e===null?!0:(Ye&4194048)===Ye?In===null:(Ye&62914560)===Ye||(Ye&536870912)!==0?e===In:!1}function jh(){var e=M.H;return M.H=rs,e===null?rs:e}function Sh(){var e=M.A;return M.A=a1,e}function Vi(){Rt=4,Wa||(Ye&4194048)!==Ye&&bn.current!==null||(pl=!0),(qa&134217727)===0&&(Tr&134217727)===0||xt===null||Xa(xt,Ye,kn,!1)}function Lu(e,n,l){var i=rt;rt|=2;var f=jh(),x=Sh();(xt!==e||Ye!==n)&&(Ui=null,xl(e,n)),n=!1;var j=Rt;e:do try{if(it!==0&&We!==null){var A=We,$=Sn;switch(it){case 8:Mu(),j=6;break e;case 3:case 2:case 9:case 6:bn.current===null&&(n=!0);var Z=it;if(it=0,Sn=null,gl(e,A,$,Z),l&&pl){j=0;break e}break;default:Z=it,it=0,Sn=null,gl(e,A,$,Z)}}s1(),j=Rt;break}catch(le){yh(e,le)}while(!0);return n&&e.shellSuspendCounter++,xa=yr=null,rt=i,M.H=f,M.A=x,We===null&&(xt=null,Ye=0,oi()),j}function s1(){for(;We!==null;)kh(We)}function i1(e,n){var l=rt;rt|=2;var i=jh(),f=Sh();xt!==e||Ye!==n?(Ui=null,Hi=Ze()+500,xl(e,n)):pl=La(e,n);e:do try{if(it!==0&&We!==null){n=We;var x=Sn;t:switch(it){case 1:it=0,Sn=null,gl(e,n,x,1);break;case 2:case 9:if(zp(x)){it=0,Sn=null,wh(n);break}n=function(){it!==2&&it!==9||xt!==e||(it=7),na(e)},x.then(n,n);break e;case 3:it=7;break e;case 4:it=5;break e;case 7:zp(x)?(it=0,Sn=null,wh(n)):(it=0,Sn=null,gl(e,n,x,7));break;case 5:var j=null;switch(We.tag){case 26:j=We.memoizedState;case 5:case 27:var A=We;if(j?cx(j):A.stateNode.complete){it=0,Sn=null;var $=A.sibling;if($!==null)We=$;else{var Z=A.return;Z!==null?(We=Z,Pi(Z)):We=null}break t}}it=0,Sn=null,gl(e,n,x,5);break;case 6:it=0,Sn=null,gl(e,n,x,6);break;case 8:Mu(),Rt=6;break e;default:throw Error(o(462))}}o1();break}catch(le){yh(e,le)}while(!0);return xa=yr=null,M.H=i,M.A=f,rt=l,We!==null?0:(xt=null,Ye=0,oi(),Rt)}function o1(){for(;We!==null&&!Gt();)kh(We)}function kh(e){var n=qm(e.alternate,e,Ea);e.memoizedProps=e.pendingProps,n===null?Pi(e):We=n}function wh(e){var n=e,l=n.alternate;switch(n.tag){case 15:case 0:n=$m(l,n,n.pendingProps,n.type,void 0,Ye);break;case 11:n=$m(l,n,n.pendingProps,n.type.render,n.ref,Ye);break;case 5:qc(n);default:Km(l,n),n=We=Sp(n,Ea),n=qm(l,n,Ea)}e.memoizedProps=e.pendingProps,n===null?Pi(e):We=n}function gl(e,n,l,i){xa=yr=null,qc(n),sl=null,Xl=0;var f=n.return;try{if(Xb(e,f,n,l,Ye)){Rt=1,Ai(e,Dn(l,e.current)),We=null;return}}catch(x){if(f!==null)throw We=f,x;Rt=1,Ai(e,Dn(l,e.current)),We=null;return}n.flags&32768?(Xe||i===1?e=!0:pl||(Ye&536870912)!==0?e=!1:(Wa=e=!0,(i===2||i===9||i===3||i===6)&&(i=bn.current,i!==null&&i.tag===13&&(i.flags|=16384))),Ch(n,e)):Pi(n)}function Pi(e){var n=e;do{if((n.flags&32768)!==0){Ch(n,Wa);return}e=n.return;var l=Jb(n.alternate,n,Ea);if(l!==null){We=l;return}if(n=n.sibling,n!==null){We=n;return}We=n=e}while(n!==null);Rt===0&&(Rt=5)}function Ch(e,n){do{var l=e1(e.alternate,e);if(l!==null){l.flags&=32767,We=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!n&&(e=e.sibling,e!==null)){We=e;return}We=e=l}while(e!==null);Rt=6,We=null}function Eh(e,n,l,i,f,x,j,A,$){e.cancelPendingCommit=null;do Fi();while(It!==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|=bc,Yo(e,l,x,j,A,$),e===xt&&(We=xt=null,Ye=0),hl=n,Ka=e,Na=l,Tu=x,Ru=f,hh=i,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,f1(Nt,function(){return Mh(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||i){i=M.T,M.T=null,f=O.p,O.p=2,j=rt,rt|=4;try{t1(e,n,l)}finally{rt=j,O.p=f,M.T=i}}It=1,Nh(),Th(),Rh()}}function Nh(){if(It===1){It=0;var e=Ka,n=hl,l=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||l){l=M.T,M.T=null;var i=O.p;O.p=2;var f=rt;rt|=4;try{ih(n,e);var x=Fu,j=pp(e.containerInfo),A=x.focusedElem,$=x.selectionRange;if(j!==A&&A&&A.ownerDocument&&fp(A.ownerDocument.documentElement,A)){if($!==null&&hc(A)){var Z=$.start,le=$.end;if(le===void 0&&(le=Z),"selectionStart"in A)A.selectionStart=Z,A.selectionEnd=Math.min(le,A.value.length);else{var oe=A.ownerDocument||document,J=oe&&oe.defaultView||window;if(J.getSelection){var ne=J.getSelection(),ke=A.textContent.length,Me=Math.min($.start,ke),mt=$.end===void 0?Me:Math.min($.end,ke);!ne.extend&&Me>mt&&(j=mt,mt=Me,Me=j);var K=dp(A,Me),q=dp(A,mt);if(K&&q&&(ne.rangeCount!==1||ne.anchorNode!==K.node||ne.anchorOffset!==K.offset||ne.focusNode!==q.node||ne.focusOffset!==q.offset)){var Q=oe.createRange();Q.setStart(K.node,K.offset),ne.removeAllRanges(),Me>mt?(ne.addRange(Q),ne.extend(q.node,q.offset)):(Q.setEnd(q.node,q.offset),ne.addRange(Q))}}}}for(oe=[],ne=A;ne=ne.parentNode;)ne.nodeType===1&&oe.push({element:ne,left:ne.scrollLeft,top:ne.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<oe.length;A++){var ie=oe[A];ie.element.scrollLeft=ie.left,ie.element.scrollTop=ie.top}}no=!!Pu,Fu=Pu=null}finally{rt=f,O.p=i,M.T=l}}e.current=n,It=2}}function Th(){if(It===2){It=0;var e=Ka,n=hl,l=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||l){l=M.T,M.T=null;var i=O.p;O.p=2;var f=rt;rt|=4;try{nh(e,n.alternate,n)}finally{rt=f,O.p=i,M.T=l}}It=3}}function Rh(){if(It===4||It===3){It=0,vt();var e=Ka,n=hl,l=Na,i=hh;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?It=5:(It=0,hl=Ka=null,Ah(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(Ya=null),Xo(l),n=n.stateNode,Je&&typeof Je.onCommitFiberRoot=="function")try{Je.onCommitFiberRoot($e,n,void 0,(n.current.flags&128)===128)}catch{}if(i!==null){n=M.T,f=O.p,O.p=2,M.T=null;try{for(var x=e.onRecoverableError,j=0;j<i.length;j++){var A=i[j];x(A.value,{componentStack:A.stack})}}finally{M.T=n,O.p=f}}(Na&3)!==0&&Fi(),na(e),f=e.pendingLanes,(l&261930)!==0&&(f&42)!==0?e===Au?ps++:(ps=0,Au=e):ps=0,ms(0)}}function Ah(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,Yl(n)))}function Fi(){return Nh(),Th(),Rh(),Mh()}function Mh(){if(It!==5)return!1;var e=Ka,n=Tu;Tu=0;var l=Xo(Na),i=M.T,f=O.p;try{O.p=32>l?32:l,M.T=null,l=Ru,Ru=null;var x=Ka,j=Na;if(It=0,hl=Ka=null,Na=0,(rt&6)!==0)throw Error(o(331));var A=rt;if(rt|=4,fh(x.current),ch(x,x.current,j,l),rt=A,ms(0,!1),Je&&typeof Je.onPostCommitFiberRoot=="function")try{Je.onPostCommitFiberRoot($e,x)}catch{}return!0}finally{O.p=f,M.T=i,Ah(e,n)}}function Lh(e,n,l){n=Dn(l,n),n=ou(e.stateNode,n,2),e=Va(e,n,2),e!==null&&(An(e,2),na(e))}function ot(e,n,l){if(e.tag===3)Lh(e,e,l);else for(;n!==null;){if(n.tag===3){Lh(n,e,l);break}else if(n.tag===1){var i=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Ya===null||!Ya.has(i))){e=Dn(l,e),l=zm(2),i=Va(n,l,2),i!==null&&(Dm(l,i,n,e),An(i,2),na(i));break}}n=n.return}}function zu(e,n,l){var i=e.pingCache;if(i===null){i=e.pingCache=new r1;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)||(Cu=!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&&(Ye&l)===l&&(Rt===4||Rt===3&&(Ye&62914560)===Ye&&300>Ze()-Ii?(rt&2)===0&&xl(e,0):Eu|=l,ml===Ye&&(ml=0)),na(e)}function zh(e,n){n===0&&(n=dt()),e=xr(e,n),e!==null&&(An(e,n),na(e))}function u1(e){var n=e.memoizedState,l=0;n!==null&&(l=n.retryLane),zh(e,l)}function d1(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),zh(e,l)}function f1(e,n){return At(e,n)}var Gi=null,vl=null,Du=!1,Wi=!1,_u=!1,Qa=0;function na(e){e!==vl&&e.next===null&&(vl===null?Gi=vl=e:vl=vl.next=e),Wi=!0,Du||(Du=!0,m1())}function ms(e,n){if(!_u&&Wi){_u=!0;do for(var l=!1,i=Gi;i!==null;){if(e!==0){var f=i.pendingLanes;if(f===0)var x=0;else{var j=i.suspendedLanes,A=i.pingedLanes;x=(1<<31-ut(42|e)+1)-1,x&=f&~(j&~A),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(l=!0,Bh(i,x))}else x=Ye,x=ca(i,i===xt?x:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(x&3)===0||La(i,x)||(l=!0,Bh(i,x));i=i.next}while(l);_u=!1}}function p1(){Dh()}function Dh(){Wi=Du=!1;var e=0;Qa!==0&&w1()&&(e=Qa);for(var n=Ze(),l=null,i=Gi;i!==null;){var f=i.next,x=_h(i,n);x===0?(i.next=null,l===null?Gi=f:l.next=f,f===null&&(vl=l)):(l=i,(e!==0||(x&3)!==0)&&(Wi=!0)),i=f}It!==0&&It!==5||ms(e),Qa!==0&&(Qa=0)}function _h(e,n){for(var l=e.suspendedLanes,i=e.pingedLanes,f=e.expirationTimes,x=e.pendingLanes&-62914561;0<x;){var j=31-ut(x),A=1<<j,$=f[j];$===-1?((A&l)===0||(A&i)!==0)&&(f[j]=Ir(A,n)):$<=n&&(e.expiredLanes|=A),x&=~A}if(n=xt,l=Ye,l=ca(e,e===n?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,l===0||e===n&&(it===2||it===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&>(i),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||La(e,l)){if(n=l&-l,n===e.callbackPriority)return n;switch(i!==null&>(i),Xo(l)){case 2:case 8:l=ct;break;case 32:l=Nt;break;case 268435456:l=Rn;break;default:l=Nt}return i=Oh.bind(null,e),l=At(l,i),e.callbackPriority=n,e.callbackNode=l,n}return i!==null&&i!==null&>(i),e.callbackPriority=2,e.callbackNode=null,2}function Oh(e,n){if(It!==0&&It!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(Fi()&&e.callbackNode!==l)return null;var i=Ye;return i=ca(e,e===xt?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(gh(e,i,n),_h(e,Ze()),e.callbackNode!=null&&e.callbackNode===l?Oh.bind(null,e):null)}function Bh(e,n){if(Fi())return null;gh(e,n,!0)}function m1(){E1(function(){(rt&6)!==0?At(ve,p1):Dh()})}function Ou(){if(Qa===0){var e=al;e===0&&(e=se,se<<=1,(se&261888)===0&&(se=256)),Qa=e}return Qa}function Ih(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ei(""+e)}function Hh(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 h1(e,n,l,i,f){if(n==="submit"&&l&&l.stateNode===f){var x=Ih((f[dn]||null).action),j=i.submitter;j&&(n=(n=j[dn]||null)?Ih(n.formAction):j.getAttribute("formAction"),n!==null&&(x=n,j=null));var A=new ri("action","action",null,i,f);e.push({event:A,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Qa!==0){var $=j?Hh(f,j):new FormData(f);nu(l,{pending:!0,data:$,method:f.method,action:x},null,$)}}else typeof x=="function"&&(A.preventDefault(),$=j?Hh(f,j):new FormData(f),nu(l,{pending:!0,data:$,method:f.method,action:x},x,$))},currentTarget:f}]})}}for(var Bu=0;Bu<yc.length;Bu++){var Iu=yc[Bu],x1=Iu.toLowerCase(),g1=Iu[0].toUpperCase()+Iu.slice(1);Wn(x1,"on"+g1)}Wn(xp,"onAnimationEnd"),Wn(gp,"onAnimationIteration"),Wn(vp,"onAnimationStart"),Wn("dblclick","onDoubleClick"),Wn("focusin","onFocus"),Wn("focusout","onBlur"),Wn(zb,"onTransitionRun"),Wn(Db,"onTransitionStart"),Wn(_b,"onTransitionCancel"),Wn(yp,"onTransitionEnd"),Pr("onMouseEnter",["mouseout","mouseover"]),Pr("onMouseLeave",["mouseout","mouseover"]),Pr("onPointerEnter",["pointerout","pointerover"]),Pr("onPointerLeave",["pointerout","pointerover"]),fr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),fr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),fr("onBeforeInput",["compositionend","keypress","textInput","paste"]),fr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),fr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),fr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var hs="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(" "),v1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(hs));function Uh(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 A=i[j],$=A.instance,Z=A.currentTarget;if(A=A.listener,$!==x&&f.isPropagationStopped())break e;x=A,f.currentTarget=Z;try{x(f)}catch(le){ii(le)}f.currentTarget=null,x=$}else for(j=0;j<i.length;j++){if(A=i[j],$=A.instance,Z=A.currentTarget,A=A.listener,$!==x&&f.isPropagationStopped())break e;x=A,f.currentTarget=Z;try{x(f)}catch(le){ii(le)}f.currentTarget=null,x=$}}}}function qe(e,n){var l=n[Qo];l===void 0&&(l=n[Qo]=new Set);var i=e+"__bubble";l.has(i)||($h(n,e,2,!1),l.add(i))}function Hu(e,n,l){var i=0;n&&(i|=4),$h(l,e,i,n)}var qi="_reactListening"+Math.random().toString(36).slice(2);function Uu(e){if(!e[qi]){e[qi]=!0,Df.forEach(function(l){l!=="selectionchange"&&(v1.has(l)||Hu(l,!1,e),Hu(l,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[qi]||(n[qi]=!0,Hu("selectionchange",!1,n))}}function $h(e,n,l,i){switch(xx(n)){case 2:var f=W1;break;case 8:f=q1;break;default:f=td}l=f.bind(null,n,l,e),f=void 0,!sc||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 $u(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 A=i.stateNode.containerInfo;if(A===f)break;if(j===4)for(j=i.return;j!==null;){var $=j.tag;if(($===3||$===4)&&j.stateNode.containerInfo===f)return;j=j.return}for(;A!==null;){if(j=Ur(A),j===null)return;if($=j.tag,$===5||$===6||$===26||$===27){i=x=j;continue e}A=A.parentNode}}i=i.return}Wf(function(){var Z=x,le=rc(l),oe=[];e:{var J=bp.get(e);if(J!==void 0){var ne=ri,ke=e;switch(e){case"keypress":if(ni(l)===0)break e;case"keydown":case"keyup":ne=db;break;case"focusin":ke="focus",ne=uc;break;case"focusout":ke="blur",ne=uc;break;case"beforeblur":case"afterblur":ne=uc;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ne=Kf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ne=Jy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ne=mb;break;case xp:case gp:case vp:ne=nb;break;case yp:ne=xb;break;case"scroll":case"scrollend":ne=Qy;break;case"wheel":ne=vb;break;case"copy":case"cut":case"paste":ne=rb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ne=Qf;break;case"toggle":case"beforetoggle":ne=bb}var Me=(n&4)!==0,mt=!Me&&(e==="scroll"||e==="scrollend"),K=Me?J!==null?J+"Capture":null:J;Me=[];for(var q=Z,Q;q!==null;){var ie=q;if(Q=ie.stateNode,ie=ie.tag,ie!==5&&ie!==26&&ie!==27||Q===null||K===null||(ie=Bl(q,K),ie!=null&&Me.push(xs(q,ie,Q))),mt)break;q=q.return}0<Me.length&&(J=new ne(J,ke,null,l,le),oe.push({event:J,listeners:Me}))}}if((n&7)===0){e:{if(J=e==="mouseover"||e==="pointerover",ne=e==="mouseout"||e==="pointerout",J&&l!==ac&&(ke=l.relatedTarget||l.fromElement)&&(Ur(ke)||ke[Hr]))break e;if((ne||J)&&(J=le.window===le?le:(J=le.ownerDocument)?J.defaultView||J.parentWindow:window,ne?(ke=l.relatedTarget||l.toElement,ne=Z,ke=ke?Ur(ke):null,ke!==null&&(mt=u(ke),Me=ke.tag,ke!==mt||Me!==5&&Me!==27&&Me!==6)&&(ke=null)):(ne=null,ke=Z),ne!==ke)){if(Me=Kf,ie="onMouseLeave",K="onMouseEnter",q="mouse",(e==="pointerout"||e==="pointerover")&&(Me=Qf,ie="onPointerLeave",K="onPointerEnter",q="pointer"),mt=ne==null?J:Ol(ne),Q=ke==null?J:Ol(ke),J=new Me(ie,q+"leave",ne,l,le),J.target=mt,J.relatedTarget=Q,ie=null,Ur(le)===Z&&(Me=new Me(K,q+"enter",ke,l,le),Me.target=Q,Me.relatedTarget=mt,ie=Me),mt=ie,ne&&ke)t:{for(Me=y1,K=ne,q=ke,Q=0,ie=K;ie;ie=Me(ie))Q++;ie=0;for(var Ae=q;Ae;Ae=Me(Ae))ie++;for(;0<Q-ie;)K=Me(K),Q--;for(;0<ie-Q;)q=Me(q),ie--;for(;Q--;){if(K===q||q!==null&&K===q.alternate){Me=K;break t}K=Me(K),q=Me(q)}Me=null}else Me=null;ne!==null&&Vh(oe,J,ne,Me,!1),ke!==null&&mt!==null&&Vh(oe,mt,ke,Me,!0)}}e:{if(J=Z?Ol(Z):window,ne=J.nodeName&&J.nodeName.toLowerCase(),ne==="select"||ne==="input"&&J.type==="file")var et=lp;else if(ap(J))if(sp)et=Ab;else{et=Tb;var Ce=Nb}else ne=J.nodeName,!ne||ne.toLowerCase()!=="input"||J.type!=="checkbox"&&J.type!=="radio"?Z&&nc(Z.elementType)&&(et=lp):et=Rb;if(et&&(et=et(e,Z))){rp(oe,et,l,le);break e}Ce&&Ce(e,J,Z),e==="focusout"&&Z&&J.type==="number"&&Z.memoizedProps.value!=null&&tc(J,"number",J.value)}switch(Ce=Z?Ol(Z):window,e){case"focusin":(ap(Ce)||Ce.contentEditable==="true")&&(Kr=Ce,xc=Z,Gl=null);break;case"focusout":Gl=xc=Kr=null;break;case"mousedown":gc=!0;break;case"contextmenu":case"mouseup":case"dragend":gc=!1,mp(oe,l,le);break;case"selectionchange":if(Lb)break;case"keydown":case"keyup":mp(oe,l,le)}var Ve;if(fc)e:{switch(e){case"compositionstart":var Ke="onCompositionStart";break e;case"compositionend":Ke="onCompositionEnd";break e;case"compositionupdate":Ke="onCompositionUpdate";break e}Ke=void 0}else Yr?tp(e,l)&&(Ke="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(Ke="onCompositionStart");Ke&&(Zf&&l.locale!=="ko"&&(Yr||Ke!=="onCompositionStart"?Ke==="onCompositionEnd"&&Yr&&(Ve=qf()):(_a=le,ic="value"in _a?_a.value:_a.textContent,Yr=!0)),Ce=Yi(Z,Ke),0<Ce.length&&(Ke=new Xf(Ke,e,null,l,le),oe.push({event:Ke,listeners:Ce}),Ve?Ke.data=Ve:(Ve=np(l),Ve!==null&&(Ke.data=Ve)))),(Ve=Sb?kb(e,l):wb(e,l))&&(Ke=Yi(Z,"onBeforeInput"),0<Ke.length&&(Ce=new Xf("onBeforeInput","beforeinput",null,l,le),oe.push({event:Ce,listeners:Ke}),Ce.data=Ve)),h1(oe,e,Z,l,le)}Uh(oe,n)})}function xs(e,n,l){return{instance:e,listener:n,currentTarget:l}}function Yi(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=Bl(e,l),f!=null&&i.unshift(xs(e,f,x)),f=Bl(e,n),f!=null&&i.push(xs(e,f,x))),e.tag===3)return i;e=e.return}return[]}function y1(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Vh(e,n,l,i,f){for(var x=n._reactName,j=[];l!==null&&l!==i;){var A=l,$=A.alternate,Z=A.stateNode;if(A=A.tag,$!==null&&$===i)break;A!==5&&A!==26&&A!==27||Z===null||($=Z,f?(Z=Bl(l,x),Z!=null&&j.unshift(xs(l,Z,$))):f||(Z=Bl(l,x),Z!=null&&j.push(xs(l,Z,$)))),l=l.return}j.length!==0&&e.push({event:n,listeners:j})}var b1=/\r\n?/g,j1=/\u0000|\uFFFD/g;function Ph(e){return(typeof e=="string"?e:""+e).replace(b1,`
|
|
50
|
-
`).replace(j1,"")}function Fh(e,n){return n=Ph(n),Ph(e)===n}function pt(e,n,l,i,f,x){switch(l){case"children":typeof i=="string"?n==="body"||n==="textarea"&&i===""||Gr(e,i):(typeof i=="number"||typeof i=="bigint")&&n!=="body"&&Gr(e,""+i);break;case"className":Zs(e,"class",i);break;case"tabIndex":Zs(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":Zs(e,l,i);break;case"style":Ff(e,i,x);break;case"data":if(n!=="object"){Zs(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=ei(""+i),e.setAttribute(l,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof 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=ei(""+i),e.setAttribute(l,i);break;case"onClick":i!=null&&(e.onclick=fa);break;case"onScroll":i!=null&&qe("scroll",e);break;case"onScrollEnd":i!=null&&qe("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=ei(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,""+i):e.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":i===!0?e.setAttribute(l,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,i):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(l,i):e.removeAttribute(l);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(l):e.setAttribute(l,i);break;case"popover":qe("beforetoggle",e),qe("toggle",e),Qs(e,"popover",i);break;case"xlinkActuate":da(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":da(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":da(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":da(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":da(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":da(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":da(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":da(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":da(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":Qs(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Ky.get(l)||l,Qs(e,l,i))}}function Vu(e,n,l,i,f,x){switch(l){case"style":Ff(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"?Gr(e,i):(typeof i=="number"||typeof i=="bigint")&&Gr(e,""+i);break;case"onScroll":i!=null&&qe("scroll",e);break;case"onScrollEnd":i!=null&&qe("scrollend",e);break;case"onClick":i!=null&&(e.onclick=fa);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!_f.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[dn]||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,""):Qs(e,l,i)}}}function Xt(e,n,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",e),qe("load",e);var 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":qe("invalid",e);var A=x=j=f=null,$=null,Z=null;for(i in l)if(l.hasOwnProperty(i)){var le=l[i];if(le!=null)switch(i){case"name":f=le;break;case"type":j=le;break;case"checked":$=le;break;case"defaultChecked":Z=le;break;case"value":x=le;break;case"defaultValue":A=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(o(137,n));break;default:pt(e,n,i,le,l,null)}}Uf(e,x,A,$,Z,j,f,!1);return;case"select":qe("invalid",e),i=j=x=null;for(f in l)if(l.hasOwnProperty(f)&&(A=l[f],A!=null))switch(f){case"value":x=A;break;case"defaultValue":j=A;break;case"multiple":i=A;default:pt(e,n,f,A,l,null)}n=x,l=j,e.multiple=!!i,n!=null?Fr(e,!!i,n,!1):l!=null&&Fr(e,!!i,l,!0);return;case"textarea":qe("invalid",e),x=f=i=null;for(j in l)if(l.hasOwnProperty(j)&&(A=l[j],A!=null))switch(j){case"value":i=A;break;case"defaultValue":f=A;break;case"children":x=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(o(91));break;default:pt(e,n,j,A,l,null)}Vf(e,i,f,x);return;case"option":for($ in l)if(l.hasOwnProperty($)&&(i=l[$],i!=null))switch($){case"selected":e.selected=i&&typeof i!="function"&&typeof i!="symbol";break;default:pt(e,n,$,i,l,null)}return;case"dialog":qe("beforetoggle",e),qe("toggle",e),qe("cancel",e),qe("close",e);break;case"iframe":case"object":qe("load",e);break;case"video":case"audio":for(i=0;i<hs.length;i++)qe(hs[i],e);break;case"image":qe("error",e),qe("load",e);break;case"details":qe("toggle",e);break;case"embed":case"source":case"link":qe("error",e),qe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Z in l)if(l.hasOwnProperty(Z)&&(i=l[Z],i!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,n));default:pt(e,n,Z,i,l,null)}return;default:if(nc(n)){for(le in l)l.hasOwnProperty(le)&&(i=l[le],i!==void 0&&Vu(e,n,le,i,l,void 0));return}}for(A in l)l.hasOwnProperty(A)&&(i=l[A],i!=null&&pt(e,n,A,i,l,null))}function S1(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,A=null,$=null,Z=null,le=null;for(ne in l){var oe=l[ne];if(l.hasOwnProperty(ne)&&oe!=null)switch(ne){case"checked":break;case"value":break;case"defaultValue":$=oe;default:i.hasOwnProperty(ne)||pt(e,n,ne,null,i,oe)}}for(var J in i){var ne=i[J];if(oe=l[J],i.hasOwnProperty(J)&&(ne!=null||oe!=null))switch(J){case"type":x=ne;break;case"name":f=ne;break;case"checked":Z=ne;break;case"defaultChecked":le=ne;break;case"value":j=ne;break;case"defaultValue":A=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(o(137,n));break;default:ne!==oe&&pt(e,n,J,ne,i,oe)}}ec(e,j,A,$,Z,le,x,f);return;case"select":ne=j=A=J=null;for(x in l)if($=l[x],l.hasOwnProperty(x)&&$!=null)switch(x){case"value":break;case"multiple":ne=$;default:i.hasOwnProperty(x)||pt(e,n,x,null,i,$)}for(f in i)if(x=i[f],$=l[f],i.hasOwnProperty(f)&&(x!=null||$!=null))switch(f){case"value":J=x;break;case"defaultValue":A=x;break;case"multiple":j=x;default:x!==$&&pt(e,n,f,x,i,$)}n=A,l=j,i=ne,J!=null?Fr(e,!!l,J,!1):!!i!=!!l&&(n!=null?Fr(e,!!l,n,!0):Fr(e,!!l,l?[]:"",!1));return;case"textarea":ne=J=null;for(A in l)if(f=l[A],l.hasOwnProperty(A)&&f!=null&&!i.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:pt(e,n,A,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":J=f;break;case"defaultValue":ne=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)}$f(e,J,ne);return;case"option":for(var ke in l)if(J=l[ke],l.hasOwnProperty(ke)&&J!=null&&!i.hasOwnProperty(ke))switch(ke){case"selected":e.selected=!1;break;default:pt(e,n,ke,null,i,J)}for($ in i)if(J=i[$],ne=l[$],i.hasOwnProperty($)&&J!==ne&&(J!=null||ne!=null))switch($){case"selected":e.selected=J&&typeof J!="function"&&typeof J!="symbol";break;default:pt(e,n,$,J,i,ne)}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 Me in l)J=l[Me],l.hasOwnProperty(Me)&&J!=null&&!i.hasOwnProperty(Me)&&pt(e,n,Me,null,i,J);for(Z in i)if(J=i[Z],ne=l[Z],i.hasOwnProperty(Z)&&J!==ne&&(J!=null||ne!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(o(137,n));break;default:pt(e,n,Z,J,i,ne)}return;default:if(nc(n)){for(var mt in l)J=l[mt],l.hasOwnProperty(mt)&&J!==void 0&&!i.hasOwnProperty(mt)&&Vu(e,n,mt,void 0,i,J);for(le in i)J=i[le],ne=l[le],!i.hasOwnProperty(le)||J===ne||J===void 0&&ne===void 0||Vu(e,n,le,J,i,ne);return}}for(var K in l)J=l[K],l.hasOwnProperty(K)&&J!=null&&!i.hasOwnProperty(K)&&pt(e,n,K,null,i,J);for(oe in i)J=i[oe],ne=l[oe],!i.hasOwnProperty(oe)||J===ne||J==null&&ne==null||pt(e,n,oe,J,i,ne)}function Gh(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function k1(){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,A=f.duration;if(x&&A&&Gh(j)){for(j=0,A=f.responseEnd,i+=1;i<l.length;i++){var $=l[i],Z=$.startTime;if(Z>A)break;var le=$.transferSize,oe=$.initiatorType;le&&Gh(oe)&&($=$.responseEnd,j+=le*($<A?1:(A-Z)/($-Z)))}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 Pu=null,Fu=null;function Ki(e){return e.nodeType===9?e:e.ownerDocument}function Wh(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 Gu(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 Wu=null;function w1(){var e=window.event;return e&&e.type==="popstate"?e===Wu?!1:(Wu=e,!0):(Wu=null,!1)}var Yh=typeof setTimeout=="function"?setTimeout:void 0,C1=typeof clearTimeout=="function"?clearTimeout:void 0,Kh=typeof Promise=="function"?Promise:void 0,E1=typeof queueMicrotask=="function"?queueMicrotask:typeof Kh<"u"?function(e){return Kh.resolve(null).then(e).catch(N1)}:Yh;function N1(e){setTimeout(function(){throw e})}function Za(e){return e==="head"}function Xh(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),Sl(n);return}i--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")i++;else if(l==="html")gs(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,gs(l);for(var x=l.firstChild;x;){var j=x.nextSibling,A=x.nodeName;x[_l]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&x.rel.toLowerCase()==="stylesheet"||l.removeChild(x),x=j}}else l==="body"&&gs(e.ownerDocument.body);l=f}while(l);Sl(n)}function Qh(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),Zo(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function T1(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 R1(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 Zh(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 Yu(e){return e.data==="$?"||e.data==="$~"}function Ku(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function A1(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 Xu=null;function Jh(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 ex(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 tx(e,n,l){switch(n=Ki(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 gs(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Zo(e)}var Un=new Map,nx=new Set;function Xi(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ta=O.d;O.d={f:M1,r:L1,D:z1,C:D1,L:_1,m:O1,X:I1,S:B1,M:H1};function M1(){var e=Ta.f(),n=$i();return e||n}function L1(e){var n=$r(e);n!==null&&n.tag===5&&n.type==="form"?ym(n):Ta.r(e)}var yl=typeof document>"u"?null:document;function ax(e,n,l){var i=yl;if(i&&typeof n=="string"&&n){var f=Ln(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof l=="string"&&(f+='[crossorigin="'+l+'"]'),nx.has(f)||(nx.add(f),e={rel:e,crossOrigin:l,href:n},i.querySelector(f)===null&&(n=i.createElement("link"),Xt(n,"link",e),Pt(n),i.head.appendChild(n)))}}function z1(e){Ta.D(e),ax("dns-prefetch",e,null)}function D1(e,n){Ta.C(e,n),ax("preconnect",e,n)}function _1(e,n,l){Ta.L(e,n,l);var i=yl;if(i&&e&&n){var f='link[rel="preload"][as="'+Ln(n)+'"]';n==="image"&&l&&l.imageSrcSet?(f+='[imagesrcset="'+Ln(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(f+='[imagesizes="'+Ln(l.imageSizes)+'"]')):f+='[href="'+Ln(e)+'"]';var x=f;switch(n){case"style":x=bl(e);break;case"script":x=jl(e)}Un.has(x)||(e=v({rel:"preload",href:n==="image"&&l&&l.imageSrcSet?void 0:e,as:n},l),Un.set(x,e),i.querySelector(f)!==null||n==="style"&&i.querySelector(vs(x))||n==="script"&&i.querySelector(ys(x))||(n=i.createElement("link"),Xt(n,"link",e),Pt(n),i.head.appendChild(n)))}}function O1(e,n){Ta.m(e,n);var l=yl;if(l&&e){var i=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+Ln(i)+'"][href="'+Ln(e)+'"]',x=f;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=jl(e)}if(!Un.has(x)&&(e=v({rel:"modulepreload",href:e},n),Un.set(x,e),l.querySelector(f)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(ys(x)))return}i=l.createElement("link"),Xt(i,"link",e),Pt(i),l.head.appendChild(i)}}}function B1(e,n,l){Ta.S(e,n,l);var i=yl;if(i&&e){var f=Vr(i).hoistableStyles,x=bl(e);n=n||"default";var j=f.get(x);if(!j){var A={loading:0,preload:null};if(j=i.querySelector(vs(x)))A.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":n},l),(l=Un.get(x))&&Qu(e,l);var $=j=i.createElement("link");Pt($),Xt($,"link",e),$._p=new Promise(function(Z,le){$.onload=Z,$.onerror=le}),$.addEventListener("load",function(){A.loading|=1}),$.addEventListener("error",function(){A.loading|=2}),A.loading|=4,Qi(j,n,i)}j={type:"stylesheet",instance:j,count:1,state:A},f.set(x,j)}}}function I1(e,n){Ta.X(e,n);var l=yl;if(l&&e){var i=Vr(l).hoistableScripts,f=jl(e),x=i.get(f);x||(x=l.querySelector(ys(f)),x||(e=v({src:e,async:!0},n),(n=Un.get(f))&&Zu(e,n),x=l.createElement("script"),Pt(x),Xt(x,"link",e),l.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},i.set(f,x))}}function H1(e,n){Ta.M(e,n);var l=yl;if(l&&e){var i=Vr(l).hoistableScripts,f=jl(e),x=i.get(f);x||(x=l.querySelector(ys(f)),x||(e=v({src:e,async:!0,type:"module"},n),(n=Un.get(f))&&Zu(e,n),x=l.createElement("script"),Pt(x),Xt(x,"link",e),l.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},i.set(f,x))}}function rx(e,n,l,i){var f=(f=ce.current)?Xi(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=bl(l.href),l=Vr(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=bl(l.href);var x=Vr(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(vs(e)))&&!x._p&&(j.instance=x,j.state.loading=5),Un.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},Un.set(e,l),x||U1(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=jl(l),l=Vr(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 bl(e){return'href="'+Ln(e)+'"'}function vs(e){return'link[rel="stylesheet"]['+e+"]"}function lx(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function U1(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}),Xt(n,"link",l),Pt(n),e.head.appendChild(n))}function jl(e){return'[src="'+Ln(e)+'"]'}function ys(e){return"script[async]"+e}function sx(e,n,l){if(n.count++,n.instance===null)switch(n.type){case"style":var i=e.querySelector('style[data-href~="'+Ln(l.href)+'"]');if(i)return n.instance=i,Pt(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"),Pt(i),Xt(i,"style",f),Qi(i,l.precedence,e),n.instance=i;case"stylesheet":f=bl(l.href);var x=e.querySelector(vs(f));if(x)return n.state.loading|=4,n.instance=x,Pt(x),x;i=lx(l),(f=Un.get(f))&&Qu(i,f),x=(e.ownerDocument||e).createElement("link"),Pt(x);var j=x;return j._p=new Promise(function(A,$){j.onload=A,j.onerror=$}),Xt(x,"link",i),n.state.loading|=4,Qi(x,l.precedence,e),n.instance=x;case"script":return x=jl(l.src),(f=e.querySelector(ys(x)))?(n.instance=f,Pt(f),f):(i=l,(f=Un.get(x))&&(i=v({},l),Zu(i,f)),e=e.ownerDocument||e,f=e.createElement("script"),Pt(f),Xt(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,Qi(i,l.precedence,e));return n.instance}function Qi(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 A=i[j];if(A.dataset.precedence===n)x=A;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 Qu(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Zu(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var Zi=null;function ix(e,n,l){if(Zi===null){var i=new Map,f=Zi=new Map;f.set(l,i)}else f=Zi,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[Wt]||e==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var j=x.getAttribute(n)||"";j=e+j;var A=i.get(j);A?A.push(x):i.set(j,[x])}}return i}function ox(e,n,l){e=e.ownerDocument||e,e.head.insertBefore(l,n==="title"?e.querySelector("head > title"):null)}function $1(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 cx(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function V1(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=bl(i.href),x=n.querySelector(vs(f));if(x){n=x._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Ji.bind(e),n.then(e,e)),l.state.loading|=4,l.instance=x,Pt(x);return}x=n.ownerDocument||n,i=lx(i),(f=Un.get(f))&&Qu(i,f),x=x.createElement("link"),Pt(x);var j=x;j._p=new Promise(function(A,$){j.onload=A,j.onerror=$}),Xt(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=Ji.bind(e),n.addEventListener("load",l),n.addEventListener("error",l))}}var Ju=0;function P1(e,n){return e.stylesheets&&e.count===0&&to(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var i=setTimeout(function(){if(e.stylesheets&&to(e,e.stylesheets),e.unsuspend){var x=e.unsuspend;e.unsuspend=null,x()}},6e4+n);0<e.imgBytes&&Ju===0&&(Ju=62500*k1());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&to(e,e.stylesheets),e.unsuspend)){var x=e.unsuspend;e.unsuspend=null,x()}},(e.imgBytes>Ju?50:800)+n);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(f)}}:null}function Ji(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)to(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var eo=null;function to(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,eo=new Map,n.forEach(F1,e),eo=null,Ji.call(e))}function F1(e,n){if(!(n.state.loading&4)){var l=eo.get(e);if(l)var i=l.get(null);else{l=new Map,eo.set(e,l);for(var 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=Ji.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 bs={$$typeof:L,Provider:null,Consumer:null,_currentValue:U,_currentValue2:U,_threadCount:0};function G1(e,n,l,i,f,x,j,A,$){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=za(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=za(0),this.hiddenUpdates=za(null),this.identifierPrefix=i,this.onUncaughtError=f,this.onCaughtError=x,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=$,this.incompleteTransitions=new Map}function ux(e,n,l,i,f,x,j,A,$,Z,le,oe){return e=new G1(e,n,l,j,$,Z,le,oe,A),n=1,x===!0&&(n|=24),x=yn(3,null,null,n),e.current=x,x.stateNode=e,n=Lc(),n.refCount++,e.pooledCache=n,n.refCount++,x.memoizedState={element:i,isDehydrated:l,cache:n},Oc(x),e}function dx(e){return e?(e=Zr,e):Zr}function fx(e,n,l,i,f,x){f=dx(f),i.context===null?i.context=f:i.pendingContext=f,i=$a(n),i.payload={element:l},x=x===void 0?null:x,x!==null&&(i.callback=x),l=Va(e,i,n),l!==null&&(gn(l,e,n),Zl(l,e,n))}function px(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<n?l:n}}function ed(e,n){px(e,n),(e=e.alternate)&&px(e,n)}function mx(e){if(e.tag===13||e.tag===31){var n=xr(e,67108864);n!==null&&gn(n,e,67108864),ed(e,67108864)}}function hx(e){if(e.tag===13||e.tag===31){var n=wn();n=Dl(n);var l=xr(e,n);l!==null&&gn(l,e,n),ed(e,n)}}var no=!0;function W1(e,n,l,i){var f=M.T;M.T=null;var x=O.p;try{O.p=2,td(e,n,l,i)}finally{O.p=x,M.T=f}}function q1(e,n,l,i){var f=M.T;M.T=null;var x=O.p;try{O.p=8,td(e,n,l,i)}finally{O.p=x,M.T=f}}function td(e,n,l,i){if(no){var f=nd(i);if(f===null)$u(e,n,i,ao,l),gx(e,i);else if(K1(f,e,n,l,i))i.stopPropagation();else if(gx(e,i),n&4&&-1<Y1.indexOf(e)){for(;f!==null;){var x=$r(f);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var j=un(x.pendingLanes);if(j!==0){var A=x;for(A.pendingLanes|=2,A.entangledLanes|=2;j;){var $=1<<31-ut(j);A.entanglements[1]|=$,j&=~$}na(x),(rt&6)===0&&(Hi=Ze()+500,ms(0))}}break;case 31:case 13:A=xr(x,2),A!==null&&gn(A,x,2),$i(),ed(x,2)}if(x=nd(i),x===null&&$u(e,n,i,ao,l),x===f)break;f=x}f!==null&&i.stopPropagation()}else $u(e,n,i,null,l)}}function nd(e){return e=rc(e),ad(e)}var ao=null;function ad(e){if(ao=null,e=Ur(e),e!==null){var 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 ao=e,null}function xx(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(at()){case ve:return 2;case ct:return 8;case Nt:case nn:return 32;case Rn:return 268435456;default:return 32}default:return 32}}var rd=!1,Ja=null,er=null,tr=null,js=new Map,Ss=new Map,nr=[],Y1="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 gx(e,n){switch(e){case"focusin":case"focusout":Ja=null;break;case"dragenter":case"dragleave":er=null;break;case"mouseover":case"mouseout":tr=null;break;case"pointerover":case"pointerout":js.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ss.delete(n.pointerId)}}function ks(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=$r(n),n!==null&&mx(n)),e):(e.eventSystemFlags|=i,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function K1(e,n,l,i,f){switch(n){case"focusin":return Ja=ks(Ja,e,n,l,i,f),!0;case"dragenter":return er=ks(er,e,n,l,i,f),!0;case"mouseover":return tr=ks(tr,e,n,l,i,f),!0;case"pointerover":var x=f.pointerId;return js.set(x,ks(js.get(x)||null,e,n,l,i,f)),!0;case"gotpointercapture":return x=f.pointerId,Ss.set(x,ks(Ss.get(x)||null,e,n,l,i,f)),!0}return!1}function vx(e){var n=Ur(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,Lf(e.priority,function(){hx(l)});return}}else if(n===31){if(n=h(l),n!==null){e.blockedOn=n,Lf(e.priority,function(){hx(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 ro(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var l=nd(e.nativeEvent);if(l===null){l=e.nativeEvent;var i=new l.constructor(l.type,l);ac=i,l.target.dispatchEvent(i),ac=null}else return n=$r(l),n!==null&&mx(n),e.blockedOn=l,!1;n.shift()}return!0}function yx(e,n,l){ro(e)&&l.delete(n)}function X1(){rd=!1,Ja!==null&&ro(Ja)&&(Ja=null),er!==null&&ro(er)&&(er=null),tr!==null&&ro(tr)&&(tr=null),js.forEach(yx),Ss.forEach(yx)}function lo(e,n){e.blockedOn===n&&(e.blockedOn=null,rd||(rd=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,X1)))}var so=null;function bx(e){so!==e&&(so=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){so===e&&(so=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(ad(i||l)===null)continue;break}var x=$r(l);x!==null&&(e.splice(n,3),n-=3,nu(x,{pending:!0,data:f,method:l.method,action:i},i,f))}}))}function Sl(e){function n($){return lo($,e)}Ja!==null&&lo(Ja,e),er!==null&&lo(er,e),tr!==null&&lo(tr,e),js.forEach(n),Ss.forEach(n);for(var l=0;l<nr.length;l++){var i=nr[l];i.blockedOn===e&&(i.blockedOn=null)}for(;0<nr.length&&(l=nr[0],l.blockedOn===null);)vx(l),l.blockedOn===null&&nr.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[dn]||null;if(typeof x=="function")j||bx(l);else if(j){var A=null;if(x&&x.hasAttribute("formAction")){if(f=x,j=x[dn]||null)A=j.formAction;else if(ad(f)!==null)continue}else A=j.action;typeof A=="function"?l[i+1]=A:(l.splice(i,3),i-=3),bx(l)}}}function jx(){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 ld(e){this._internalRoot=e}io.prototype.render=ld.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(o(409));var l=n.current,i=wn();fx(l,i,e,n,null,null)},io.prototype.unmount=ld.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;fx(e.current,2,null,e,null,null),$i(),n[Hr]=null}};function io(e){this._internalRoot=e}io.prototype.unstable_scheduleHydration=function(e){if(e){var n=Mf();e={blockedOn:null,target:e,priority:n};for(var l=0;l<nr.length&&n!==0&&n<nr[l].priority;l++);nr.splice(l,0,e),l===0&&vx(e)}};var Sx=r.version;if(Sx!=="19.2.4")throw Error(o(527,Sx,"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=p(n),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var Q1={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var oo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!oo.isDisabled&&oo.supportsFiber)try{$e=oo.inject(Q1),Je=oo}catch{}}return Cs.createRoot=function(e,n){if(!c(e))throw Error(o(299));var l=!1,i="",f=Rm,x=Am,j=Mm;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=ux(e,1,!1,null,null,l,i,null,f,x,j,jx),e[Hr]=n.current,Uu(e),new ld(n)},Cs.hydrateRoot=function(e,n,l){if(!c(e))throw Error(o(299));var i=!1,f="",x=Rm,j=Am,A=Mm,$=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&&(A=l.onRecoverableError),l.formState!==void 0&&($=l.formState)),n=ux(e,1,!0,n,l??null,i,f,$,x,j,A,jx),n.context=dx(null),l=n.current,i=wn(),i=Dl(i),f=$a(i),f.callback=null,Va(l,f,i),l=i,n.current.lanes=l,An(n,l),na(n),e[Hr]=n.current,Uu(e),new io(n)},Cs.version="19.2.4",Cs}var Lx;function s0(){if(Lx)return od.exports;Lx=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(r){console.error(r)}}return t(),od.exports=l0(),od.exports}var i0=s0();/**
|
|
51
|
-
* react-router v7.13.1
|
|
52
|
-
*
|
|
53
|
-
* Copyright (c) Remix Software Inc.
|
|
54
|
-
*
|
|
55
|
-
* This source code is licensed under the MIT license found in the
|
|
56
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
57
|
-
*
|
|
58
|
-
* @license MIT
|
|
59
|
-
*/var zx="popstate";function Dx(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function o0(t={}){function r(c,u){let{pathname:d="/",search:h="",hash:g=""}=Rl(c.location.hash.substring(1));return!d.startsWith("/")&&!d.startsWith(".")&&(d="/"+d),Fd("",{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,p=g.indexOf("#");h=p===-1?g:g.slice(0,p)}return h+"#"+(typeof u=="string"?u:Os(u))}function o(c,u){Xn(c.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(u)})`)}return u0(r,s,o,t)}function $t(t,r){if(t===!1||t===null||typeof t>"u")throw new Error(r)}function Xn(t,r){if(!t){typeof console<"u"&&console.warn(r);try{throw new Error(r)}catch{}}}function c0(){return Math.random().toString(36).substring(2,10)}function _x(t,r){return{usr:t.state,key:t.key,idx:r,masked:t.unstable_mask?{pathname:t.pathname,search:t.search,hash:t.hash}:void 0}}function Fd(t,r,s=null,o,c){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof r=="string"?Rl(r):r,state:s,key:r&&r.key||o||c0(),unstable_mask:c}}function Os({pathname:t="/",search:r="",hash:s=""}){return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),s&&s!=="#"&&(t+=s.charAt(0)==="#"?s:"#"+s),t}function Rl(t){let r={};if(t){let s=t.indexOf("#");s>=0&&(r.hash=t.substring(s),t=t.substring(0,s));let o=t.indexOf("?");o>=0&&(r.search=t.substring(o),t=t.substring(0,o)),t&&(r.pathname=t)}return r}function u0(t,r,s,o={}){let{window:c=document.defaultView,v5Compat:u=!1}=o,d=c.history,h="POP",g=null,p=y();p==null&&(p=0,d.replaceState({...d.state,idx:p},""));function y(){return(d.state||{idx:null}).idx}function v(){h="POP";let C=y(),T=C==null?null:C-p;p=C,g&&g({action:h,location:w.location,delta:T})}function b(C,T){h="PUSH";let R=Dx(C)?C:Fd(w.location,C,T);s&&s(R,C),p=y()+1;let L=_x(R,p),B=w.createHref(R.unstable_mask||R);try{d.pushState(L,"",B)}catch(z){if(z instanceof DOMException&&z.name==="DataCloneError")throw z;c.location.assign(B)}u&&g&&g({action:h,location:w.location,delta:1})}function k(C,T){h="REPLACE";let R=Dx(C)?C:Fd(w.location,C,T);s&&s(R,C),p=y();let L=_x(R,p),B=w.createHref(R.unstable_mask||R);d.replaceState(L,"",B),u&&g&&g({action:h,location:w.location,delta:0})}function S(C){return d0(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(zx,v),g=C,()=>{c.removeEventListener(zx,v),g=null}},createHref(C){return r(c,C)},createURL:S,encodeLocation(C){let T=S(C);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:b,replace:k,go(C){return d.go(C)}};return w}function d0(t,r=!1){let s="http://localhost";typeof window<"u"&&(s=window.location.origin!=="null"?window.location.origin:window.location.href),$t(s,"No window.location.(origin|href) available to create URL");let o=typeof t=="string"?t:Os(t);return o=o.replace(/ $/,"%20"),!r&&o.startsWith("//")&&(o=s+o),new URL(o,s)}function lv(t,r,s="/"){return f0(t,r,s,!1)}function f0(t,r,s,o){let c=typeof r=="string"?Rl(r):r,u=Aa(c.pathname||"/",s);if(u==null)return null;let d=sv(t);p0(d);let h=null;for(let g=0;h==null&&g<d.length;++g){let p=w0(u);h=S0(d[g],p,o)}return h}function sv(t,r=[],s=[],o="",c=!1){let u=(d,h,g=c,p)=>{let y={relativePath:p===void 0?d.path||"":p,caseSensitive:d.caseSensitive===!0,childrenIndex:h,route:d};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(o)&&g)return;$t(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=sa([o,y.relativePath]),b=s.concat(y);d.children&&d.children.length>0&&($t(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),sv(d.children,r,b,v,g)),!(d.path==null&&!d.index)&&r.push({path:v,score:b0(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 p of iv(d.path))u(d,h,!0,p)}),r}function iv(t){let r=t.split("/");if(r.length===0)return[];let[s,...o]=r,c=s.endsWith("?"),u=s.replace(/\?$/,"");if(o.length===0)return c?[u,""]:[u];let d=iv(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 p0(t){t.sort((r,s)=>r.score!==s.score?s.score-r.score:j0(r.routesMeta.map(o=>o.childrenIndex),s.routesMeta.map(o=>o.childrenIndex)))}var m0=/^:[\w-]+$/,h0=3,x0=2,g0=1,v0=10,y0=-2,Ox=t=>t==="*";function b0(t,r){let s=t.split("/"),o=s.length;return s.some(Ox)&&(o+=y0),r&&(o+=x0),s.filter(c=>!Ox(c)).reduce((c,u)=>c+(m0.test(u)?h0:u===""?g0:v0),o)}function j0(t,r){return t.length===r.length&&t.slice(0,-1).every((o,c)=>o===r[c])?t[t.length-1]-r[r.length-1]:0}function S0(t,r,s=!1){let{routesMeta:o}=t,c={},u="/",d=[];for(let h=0;h<o.length;++h){let g=o[h],p=h===o.length-1,y=u==="/"?r:r.slice(u.length)||"/",v=To({path:g.relativePath,caseSensitive:g.caseSensitive,end:p},y),b=g.route;if(!v&&p&&s&&!o[o.length-1].route.index&&(v=To({path:g.relativePath,caseSensitive:g.caseSensitive,end:!1},y)),!v)return null;Object.assign(c,v.params),d.push({params:c,pathname:sa([u,v.pathname]),pathnameBase:T0(sa([u,v.pathnameBase])),route:b}),v.pathnameBase!=="/"&&(u=sa([u,v.pathnameBase]))}return d}function To(t,r){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[s,o]=k0(t.path,t.caseSensitive,t.end),c=r.match(s);if(!c)return null;let u=c[0],d=u.replace(/(.)\/+$/,"$1"),h=c.slice(1);return{params:o.reduce((p,{paramName:y,isOptional:v},b)=>{if(y==="*"){let S=h[b]||"";d=u.slice(0,u.length-S.length).replace(/(.)\/+$/,"$1")}const k=h[b];return v&&!k?p[y]=void 0:p[y]=(k||"").replace(/%2F/g,"/"),p},{}),pathname:u,pathnameBase:d,pattern:t}}function k0(t,r=!1,s=!0){Xn(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,p,y)=>{if(o.push({paramName:h,isOptional:g!=null}),g){let v=y.charAt(p+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,r?void 0:"i"),o]}function w0(t){try{return t.split("/").map(r=>decodeURIComponent(r).replace(/\//g,"%2F")).join("/")}catch(r){return Xn(!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 (${r}).`),t}}function Aa(t,r){if(r==="/")return t;if(!t.toLowerCase().startsWith(r.toLowerCase()))return null;let s=r.endsWith("/")?r.length-1:r.length,o=t.charAt(s);return o&&o!=="/"?null:t.slice(s)||"/"}var C0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function E0(t,r="/"){let{pathname:s,search:o="",hash:c=""}=typeof t=="string"?Rl(t):t,u;return s?(s=s.replace(/\/\/+/g,"/"),s.startsWith("/")?u=Bx(s.substring(1),"/"):u=Bx(s,r)):u=r,{pathname:u,search:R0(o),hash:A0(c)}}function Bx(t,r){let s=r.replace(/\/+$/,"").split("/");return t.split("/").forEach(c=>{c===".."?s.length>1&&s.pop():c!=="."&&s.push(c)}),s.length>1?s.join("/"):"/"}function fd(t,r,s,o){return`Cannot include a '${t}' character in a manually specified \`to.${r}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${s}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function N0(t){return t.filter((r,s)=>s===0||r.route.path&&r.route.path.length>0)}function ov(t){let r=N0(t);return r.map((s,o)=>o===r.length-1?s.pathname:s.pathnameBase)}function cf(t,r,s,o=!1){let c;typeof t=="string"?c=Rl(t):(c={...t},$t(!c.pathname||!c.pathname.includes("?"),fd("?","pathname","search",c)),$t(!c.pathname||!c.pathname.includes("#"),fd("#","pathname","hash",c)),$t(!c.search||!c.search.includes("#"),fd("#","search","hash",c)));let u=t===""||c.pathname==="",d=u?"/":c.pathname,h;if(d==null)h=s;else{let v=r.length-1;if(!o&&d.startsWith("..")){let b=d.split("/");for(;b[0]==="..";)b.shift(),v-=1;c.pathname=b.join("/")}h=v>=0?r[v]:"/"}let g=E0(c,h),p=d&&d!=="/"&&d.endsWith("/"),y=(u||d===".")&&s.endsWith("/");return!g.pathname.endsWith("/")&&(p||y)&&(g.pathname+="/"),g}var sa=t=>t.join("/").replace(/\/\/+/g,"/"),T0=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),R0=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,A0=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,M0=class{constructor(t,r,s,o=!1){this.status=t,this.statusText=r||"",this.internal=o,s instanceof Error?(this.data=s.toString(),this.error=s):this.data=s}};function L0(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function z0(t){return t.map(r=>r.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var cv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function uv(t,r){let s=t;if(typeof s!="string"||!C0.test(s))return{absoluteURL:void 0,isExternal:!1,to:s};let o=s,c=!1;if(cv)try{let u=new URL(window.location.href),d=s.startsWith("//")?new URL(u.protocol+s):new URL(s),h=Aa(d.pathname,r);d.origin===u.origin&&h!=null?s=h+d.search+d.hash:c=!0}catch{Xn(!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 dv=["POST","PUT","PATCH","DELETE"];new Set(dv);var D0=["GET",...dv];new Set(D0);var Al=m.createContext(null);Al.displayName="DataRouter";var Do=m.createContext(null);Do.displayName="DataRouterState";var _0=m.createContext(!1),fv=m.createContext({isTransitioning:!1});fv.displayName="ViewTransition";var O0=m.createContext(new Map);O0.displayName="Fetchers";var B0=m.createContext(null);B0.displayName="Await";var Pn=m.createContext(null);Pn.displayName="Navigation";var _o=m.createContext(null);_o.displayName="Location";var Ma=m.createContext({outlet:null,matches:[],isDataRoute:!1});Ma.displayName="Route";var uf=m.createContext(null);uf.displayName="RouteError";var pv="REACT_ROUTER_ERROR",I0="REDIRECT",H0="ROUTE_ERROR_RESPONSE";function U0(t){if(t.startsWith(`${pv}:${I0}:{`))try{let r=JSON.parse(t.slice(28));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string"&&typeof r.location=="string"&&typeof r.reloadDocument=="boolean"&&typeof r.replace=="boolean")return r}catch{}}function $0(t){if(t.startsWith(`${pv}:${H0}:{`))try{let r=JSON.parse(t.slice(40));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string")return new M0(r.status,r.statusText,r.data)}catch{}}function V0(t,{relative:r}={}){$t(Fs(),"useHref() may be used only in the context of a <Router> component.");let{basename:s,navigator:o}=m.useContext(Pn),{hash:c,pathname:u,search:d}=Gs(t,{relative:r}),h=u;return s!=="/"&&(h=u==="/"?s:sa([s,u])),o.createHref({pathname:h,search:d,hash:c})}function Fs(){return m.useContext(_o)!=null}function or(){return $t(Fs(),"useLocation() may be used only in the context of a <Router> component."),m.useContext(_o).location}var mv="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function hv(t){m.useContext(Pn).static||m.useLayoutEffect(t)}function P0(){let{isDataRoute:t}=m.useContext(Ma);return t?nj():F0()}function F0(){$t(Fs(),"useNavigate() may be used only in the context of a <Router> component.");let t=m.useContext(Al),{basename:r,navigator:s}=m.useContext(Pn),{matches:o}=m.useContext(Ma),{pathname:c}=or(),u=JSON.stringify(ov(o)),d=m.useRef(!1);return hv(()=>{d.current=!0}),m.useCallback((g,p={})=>{if(Xn(d.current,mv),!d.current)return;if(typeof g=="number"){s.go(g);return}let y=cf(g,JSON.parse(u),c,p.relative==="path");t==null&&r!=="/"&&(y.pathname=y.pathname==="/"?r:sa([r,y.pathname])),(p.replace?s.replace:s.push)(y,p.state,p)},[r,s,u,c,t])}m.createContext(null);function Gs(t,{relative:r}={}){let{matches:s}=m.useContext(Ma),{pathname:o}=or(),c=JSON.stringify(ov(s));return m.useMemo(()=>cf(t,JSON.parse(c),o,r==="path"),[t,c,o,r])}function G0(t,r,s){$t(Fs(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=m.useContext(Pn),{matches:c}=m.useContext(Ma),u=c[c.length-1],d=u?u.params:{},h=u?u.pathname:"/",g=u?u.pathnameBase:"/",p=u&&u.route;{let C=p&&p.path||"";gv(h,!p||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
|
-
|
|
61
|
-
Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let y=or(),v;v=y;let b=v.pathname||"/",k=b;if(g!=="/"){let C=g.replace(/^\//,"").split("/");k="/"+b.replace(/^\//,"").split("/").slice(C.length).join("/")}let S=lv(t,{pathname:k});return Xn(p||S!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),Xn(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.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.`),X0(S&&S.map(C=>Object.assign({},C,{params:Object.assign({},d,C.params),pathname:sa([g,o.encodeLocation?o.encodeLocation(C.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?g:sa([g,o.encodeLocation?o.encodeLocation(C.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),c,s)}function W0(){let t=tj(),r=L0(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=m.createElement(m.Fragment,null,m.createElement("p",null,"💿 Hey developer 👋"),m.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",m.createElement("code",{style:u},"ErrorBoundary")," or"," ",m.createElement("code",{style:u},"errorElement")," prop on your route.")),m.createElement(m.Fragment,null,m.createElement("h2",null,"Unexpected Application Error!"),m.createElement("h3",{style:{fontStyle:"italic"}},r),s?m.createElement("pre",{style:c},s):null,d)}var q0=m.createElement(W0,null),xv=class extends m.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,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){this.props.onError?this.props.onError(t,r):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=$0(t.digest);s&&(t=s)}let r=t!==void 0?m.createElement(Ma.Provider,{value:this.props.routeContext},m.createElement(uf.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?m.createElement(Y0,{error:t},r):r}};xv.contextType=_0;var pd=new WeakMap;function Y0({children:t,error:r}){let{basename:s}=m.useContext(Pn);if(typeof r=="object"&&r&&"digest"in r&&typeof r.digest=="string"){let o=U0(r.digest);if(o){let c=pd.get(r);if(c)throw c;let u=uv(o.location,s);if(cv&&!pd.get(r))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 pd.set(r,d),d}return m.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return t}function K0({routeContext:t,match:r,children:s}){let o=m.useContext(Al);return o&&o.static&&o.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=r.route.id),m.createElement(Ma.Provider,{value:t},s)}function X0(t,r=[],s){let o=s==null?void 0:s.state;if(t==null){if(!o)return null;if(o.errors)t=o.matches;else if(r.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);$t(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:k}=o,S=v.route.loader&&!b.hasOwnProperty(v.route.id)&&(!k||k[v.route.id]===void 0);if(v.route.lazy||S){s.isStatic&&(d=!0),h>=0?c=c.slice(0,h+1):c=[c[0]];break}}}}let g=s==null?void 0:s.onError,p=o&&g?(y,v)=>{var b,k;g(y,{location:o.location,params:((k=(b=o.matches)==null?void 0:b[0])==null?void 0:k.params)??{},unstable_pattern:z0(o.matches),errorInfo:v})}:void 0;return c.reduceRight((y,v,b)=>{let k,S=!1,w=null,C=null;o&&(k=u&&v.route.id?u[v.route.id]:void 0,w=v.route.errorElement||q0,d&&(h<0&&b===0?(gv("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,C=null):h===b&&(S=!0,C=v.route.hydrateFallbackElement||null)));let T=r.concat(c.slice(0,b+1)),R=()=>{let L;return k?L=w:S?L=C:v.route.Component?L=m.createElement(v.route.Component,null):v.route.element?L=v.route.element:L=y,m.createElement(K0,{match:v,routeContext:{outlet:y,matches:T,isDataRoute:o!=null},children:L})};return o&&(v.route.ErrorBoundary||v.route.errorElement||b===0)?m.createElement(xv,{location:o.location,revalidation:o.revalidation,component:w,error:k,children:R(),routeContext:{outlet:null,matches:T,isDataRoute:!0},onError:p}):R()},null)}function df(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Q0(t){let r=m.useContext(Al);return $t(r,df(t)),r}function Z0(t){let r=m.useContext(Do);return $t(r,df(t)),r}function J0(t){let r=m.useContext(Ma);return $t(r,df(t)),r}function ff(t){let r=J0(t),s=r.matches[r.matches.length-1];return $t(s.route.id,`${t} can only be used on routes that contain a unique "id"`),s.route.id}function ej(){return ff("useRouteId")}function tj(){var o;let t=m.useContext(uf),r=Z0("useRouteError"),s=ff("useRouteError");return t!==void 0?t:(o=r.errors)==null?void 0:o[s]}function nj(){let{router:t}=Q0("useNavigate"),r=ff("useNavigate"),s=m.useRef(!1);return hv(()=>{s.current=!0}),m.useCallback(async(c,u={})=>{Xn(s.current,mv),s.current&&(typeof c=="number"?await t.navigate(c):await t.navigate(c,{fromRouteId:r,...u}))},[t,r])}var Ix={};function gv(t,r,s){!r&&!Ix[t]&&(Ix[t]=!0,Xn(!1,s))}m.memo(aj);function aj({routes:t,future:r,state:s,isStatic:o,onError:c}){return G0(t,void 0,{state:s,isStatic:o,onError:c})}function rj({basename:t="/",children:r=null,location:s,navigationType:o="POP",navigator:c,static:u=!1,unstable_useTransitions:d}){$t(!Fs(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=t.replace(/^\/*/,"/"),g=m.useMemo(()=>({basename:h,navigator:c,static:u,unstable_useTransitions:d,future:{}}),[h,c,u,d]);typeof s=="string"&&(s=Rl(s));let{pathname:p="/",search:y="",hash:v="",state:b=null,key:k="default",unstable_mask:S}=s,w=m.useMemo(()=>{let C=Aa(p,h);return C==null?null:{location:{pathname:C,search:y,hash:v,state:b,key:k,unstable_mask:S},navigationType:o}},[h,p,y,v,b,k,o,S]);return Xn(w!=null,`<Router basename="${h}"> is not able to match the URL "${p}${y}${v}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:m.createElement(Pn.Provider,{value:g},m.createElement(_o.Provider,{children:r,value:w}))}var jo="get",So="application/x-www-form-urlencoded";function Oo(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function lj(t){return Oo(t)&&t.tagName.toLowerCase()==="button"}function sj(t){return Oo(t)&&t.tagName.toLowerCase()==="form"}function ij(t){return Oo(t)&&t.tagName.toLowerCase()==="input"}function oj(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function cj(t,r){return t.button===0&&(!r||r==="_self")&&!oj(t)}var co=null;function uj(){if(co===null)try{new FormData(document.createElement("form"),0),co=!1}catch{co=!0}return co}var dj=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function md(t){return t!=null&&!dj.has(t)?(Xn(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${So}"`),null):t}function fj(t,r){let s,o,c,u,d;if(sj(t)){let h=t.getAttribute("action");o=h?Aa(h,r):null,s=t.getAttribute("method")||jo,c=md(t.getAttribute("enctype"))||So,u=new FormData(t)}else if(lj(t)||ij(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?Aa(g,r):null,s=t.getAttribute("formmethod")||h.getAttribute("method")||jo,c=md(t.getAttribute("formenctype"))||md(h.getAttribute("enctype"))||So,u=new FormData(h,t),!uj()){let{name:p,type:y,value:v}=t;if(y==="image"){let b=p?`${p}.`:"";u.append(`${b}x`,"0"),u.append(`${b}y`,"0")}else p&&u.append(p,v)}}else{if(Oo(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');s=jo,o=null,c=So,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 pf(t,r){if(t===!1||t===null||typeof t>"u")throw new Error(r)}function pj(t,r,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}`:r&&Aa(c.pathname,r)==="/"?c.pathname=`${r.replace(/\/$/,"")}/_root.${o}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${o}`,c}async function mj(t,r){if(t.id in r)return r[t.id];try{let s=await import(t.module);return r[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 hj(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 xj(t,r,s){let o=await Promise.all(t.map(async c=>{let u=r.routes[c.route.id];if(u){let d=await mj(u,s);return d.links?d.links():[]}return[]}));return bj(o.flat(1).filter(hj).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function Hx(t,r,s,o,c,u){let d=(g,p)=>s[p]?g.route.id!==s[p].route.id:!0,h=(g,p)=>{var y;return s[p].pathname!==g.pathname||((y=s[p].route.path)==null?void 0:y.endsWith("*"))&&s[p].params["*"]!==g.params["*"]};return u==="assets"?r.filter((g,p)=>d(g,p)||h(g,p)):u==="data"?r.filter((g,p)=>{var v;let y=o.routes[g.route.id];if(!y||!y.hasLoader)return!1;if(d(g,p)||h(g,p))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 gj(t,r,{includeHydrateFallback:s}={}){return vj(t.map(o=>{let c=r.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 vj(t){return[...new Set(t)]}function yj(t){let r={},s=Object.keys(t).sort();for(let o of s)r[o]=t[o];return r}function bj(t,r){let s=new Set;return new Set(r),t.reduce((o,c)=>{let u=JSON.stringify(yj(c));return s.has(u)||(s.add(u),o.push({key:u,link:c})),o},[])}function vv(){let t=m.useContext(Al);return pf(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function jj(){let t=m.useContext(Do);return pf(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var mf=m.createContext(void 0);mf.displayName="FrameworkContext";function yv(){let t=m.useContext(mf);return pf(t,"You must render this element inside a <HydratedRouter> element"),t}function Sj(t,r){let s=m.useContext(mf),[o,c]=m.useState(!1),[u,d]=m.useState(!1),{onFocus:h,onBlur:g,onMouseEnter:p,onMouseLeave:y,onTouchStart:v}=r,b=m.useRef(null);m.useEffect(()=>{if(t==="render"&&d(!0),t==="viewport"){let w=T=>{T.forEach(R=>{d(R.isIntersecting)})},C=new IntersectionObserver(w,{threshold:.5});return b.current&&C.observe(b.current),()=>{C.disconnect()}}},[t]),m.useEffect(()=>{if(o){let w=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(w)}}},[o]);let k=()=>{c(!0)},S=()=>{c(!1),d(!1)};return s?t!=="intent"?[u,b,{}]:[u,b,{onFocus:Es(h,k),onBlur:Es(g,S),onMouseEnter:Es(p,k),onMouseLeave:Es(y,S),onTouchStart:Es(v,k)}]:[!1,b,{}]}function Es(t,r){return s=>{t&&t(s),s.defaultPrevented||r(s)}}function kj({page:t,...r}){let{router:s}=vv(),o=m.useMemo(()=>lv(s.routes,t,s.basename),[s.routes,t,s.basename]);return o?m.createElement(Cj,{page:t,matches:o,...r}):null}function wj(t){let{manifest:r,routeModules:s}=yv(),[o,c]=m.useState([]);return m.useEffect(()=>{let u=!1;return xj(t,r,s).then(d=>{u||c(d)}),()=>{u=!0}},[t,r,s]),o}function Cj({page:t,matches:r,...s}){let o=or(),{future:c,manifest:u,routeModules:d}=yv(),{basename:h}=vv(),{loaderData:g,matches:p}=jj(),y=m.useMemo(()=>Hx(t,r,p,u,o,"data"),[t,r,p,u,o]),v=m.useMemo(()=>Hx(t,r,p,u,o,"assets"),[t,r,p,u,o]),b=m.useMemo(()=>{if(t===o.pathname+o.search+o.hash)return[];let w=new Set,C=!1;if(r.forEach(R=>{var B;let L=u.routes[R.route.id];!L||!L.hasLoader||(!y.some(z=>z.route.id===R.route.id)&&R.route.id in g&&((B=d[R.route.id])!=null&&B.shouldRevalidate)||L.hasClientLoader?C=!0:w.add(R.route.id))}),w.size===0)return[];let T=pj(t,h,c.unstable_trailingSlashAwareDataRequests,"data");return C&&w.size>0&&T.searchParams.set("_routes",r.filter(R=>w.has(R.route.id)).map(R=>R.route.id).join(",")),[T.pathname+T.search]},[h,c.unstable_trailingSlashAwareDataRequests,g,o,u,y,r,t,d]),k=m.useMemo(()=>gj(v,u),[v,u]),S=wj(v);return m.createElement(m.Fragment,null,b.map(w=>m.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...s})),k.map(w=>m.createElement("link",{key:w,rel:"modulepreload",href:w,...s})),S.map(({key:w,link:C})=>m.createElement("link",{key:w,nonce:s.nonce,...C,crossOrigin:C.crossOrigin??s.crossOrigin})))}function Ej(...t){return r=>{t.forEach(s=>{typeof s=="function"?s(r):s!=null&&(s.current=r)})}}var Nj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Nj&&(window.__reactRouterVersion="7.13.1")}catch{}function Tj({basename:t,children:r,unstable_useTransitions:s,window:o}){let c=m.useRef();c.current==null&&(c.current=o0({window:o,v5Compat:!0}));let u=c.current,[d,h]=m.useState({action:u.action,location:u.location}),g=m.useCallback(p=>{s===!1?h(p):m.startTransition(()=>h(p))},[s]);return m.useLayoutEffect(()=>u.listen(g),[u,g]),m.createElement(rj,{basename:t,children:r,location:d.location,navigationType:d.action,navigator:u,unstable_useTransitions:s})}var bv=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,jv=m.forwardRef(function({onClick:r,discover:s="render",prefetch:o="none",relative:c,reloadDocument:u,replace:d,unstable_mask:h,state:g,target:p,to:y,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:k,...S},w){let{basename:C,navigator:T,unstable_useTransitions:R}=m.useContext(Pn),L=typeof y=="string"&&bv.test(y),B=uv(y,C);y=B.to;let z=V0(y,{relative:c}),F=or(),E=null;if(h){let H=cf(h,[],F.unstable_mask?F.unstable_mask.pathname:"/",!0);C!=="/"&&(H.pathname=H.pathname==="/"?C:sa([C,H.pathname])),E=T.createHref(H)}let[I,N,_]=Sj(o,S),V=Lj(y,{replace:d,unstable_mask:h,state:g,target:p,preventScrollReset:v,relative:c,viewTransition:b,unstable_defaultShouldRevalidate:k,unstable_useTransitions:R});function W(H){r&&r(H),H.defaultPrevented||V(H)}let Y=!(B.isExternal||u),X=m.createElement("a",{...S,..._,href:(Y?E:void 0)||B.absoluteURL||z,onClick:Y?W:r,ref:Ej(w,N),target:p,"data-discover":!L&&s==="render"?"true":void 0});return I&&!L?m.createElement(m.Fragment,null,X,m.createElement(kj,{page:z})):X});jv.displayName="Link";var Rj=m.forwardRef(function({"aria-current":r="page",caseSensitive:s=!1,className:o="",end:c=!1,style:u,to:d,viewTransition:h,children:g,...p},y){let v=Gs(d,{relative:p.relative}),b=or(),k=m.useContext(Do),{navigator:S,basename:w}=m.useContext(Pn),C=k!=null&&Bj(v)&&h===!0,T=S.encodeLocation?S.encodeLocation(v).pathname:v.pathname,R=b.pathname,L=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;s||(R=R.toLowerCase(),L=L?L.toLowerCase():null,T=T.toLowerCase()),L&&w&&(L=Aa(L,w)||L);const B=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let z=R===T||!c&&R.startsWith(T)&&R.charAt(B)==="/",F=L!=null&&(L===T||!c&&L.startsWith(T)&&L.charAt(T.length)==="/"),E={isActive:z,isPending:F,isTransitioning:C},I=z?r:void 0,N;typeof o=="function"?N=o(E):N=[o,z?"active":null,F?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let _=typeof u=="function"?u(E):u;return m.createElement(jv,{...p,"aria-current":I,className:N,ref:y,style:_,to:d,viewTransition:h},typeof g=="function"?g(E):g)});Rj.displayName="NavLink";var Aj=m.forwardRef(({discover:t="render",fetcherKey:r,navigate:s,reloadDocument:o,replace:c,state:u,method:d=jo,action:h,onSubmit:g,relative:p,preventScrollReset:y,viewTransition:v,unstable_defaultShouldRevalidate:b,...k},S)=>{let{unstable_useTransitions:w}=m.useContext(Pn),C=_j(),T=Oj(h,{relative:p}),R=d.toLowerCase()==="get"?"get":"post",L=typeof h=="string"&&bv.test(h),B=z=>{if(g&&g(z),z.defaultPrevented)return;z.preventDefault();let F=z.nativeEvent.submitter,E=(F==null?void 0:F.getAttribute("formmethod"))||d,I=()=>C(F||z.currentTarget,{fetcherKey:r,method:E,navigate:s,replace:c,state:u,relative:p,preventScrollReset:y,viewTransition:v,unstable_defaultShouldRevalidate:b});w&&s!==!1?m.startTransition(()=>I()):I()};return m.createElement("form",{ref:S,method:R,action:T,onSubmit:o?g:B,...k,"data-discover":!L&&t==="render"?"true":void 0})});Aj.displayName="Form";function Mj(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Sv(t){let r=m.useContext(Al);return $t(r,Mj(t)),r}function Lj(t,{target:r,replace:s,unstable_mask:o,state:c,preventScrollReset:u,relative:d,viewTransition:h,unstable_defaultShouldRevalidate:g,unstable_useTransitions:p}={}){let y=P0(),v=or(),b=Gs(t,{relative:d});return m.useCallback(k=>{if(cj(k,r)){k.preventDefault();let S=s!==void 0?s:Os(v)===Os(b),w=()=>y(t,{replace:S,unstable_mask:o,state:c,preventScrollReset:u,relative:d,viewTransition:h,unstable_defaultShouldRevalidate:g});p?m.startTransition(()=>w()):w()}},[v,y,b,s,o,c,r,t,u,d,h,g,p])}var zj=0,Dj=()=>`__${String(++zj)}__`;function _j(){let{router:t}=Sv("useSubmit"),{basename:r}=m.useContext(Pn),s=ej(),o=t.fetch,c=t.navigate;return m.useCallback(async(u,d={})=>{let{action:h,method:g,encType:p,formData:y,body:v}=fj(u,r);if(d.navigate===!1){let b=d.fetcherKey||Dj();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||p,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||p,replace:d.replace,state:d.state,fromRouteId:s,flushSync:d.flushSync,viewTransition:d.viewTransition})},[o,c,r,s])}function Oj(t,{relative:r}={}){let{basename:s}=m.useContext(Pn),o=m.useContext(Ma);$t(o,"useFormAction must be used inside a RouteContext");let[c]=o.matches.slice(-1),u={...Gs(t||".",{relative:r})},d=or();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:sa([s,u.pathname])),Os(u)}function Bj(t,{relative:r}={}){let s=m.useContext(fv);$t(s!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=Sv("useViewTransitionState"),c=Gs(t,{relative:r});if(!s.isTransitioning)return!1;let u=Aa(s.currentLocation.pathname,o)||s.currentLocation.pathname,d=Aa(s.nextLocation.pathname,o)||s.nextLocation.pathname;return To(c.pathname,d)!=null||To(c.pathname,u)!=null}var Bo=rv();const Ij=av(Bo),Hj="modulepreload",Uj=function(t){return"/"+t},Ux={},Io=function(r,s,o){let c=Promise.resolve();if(s&&s.length>0){let d=function(p){return Promise.all(p.map(y=>Promise.resolve(y).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),g=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));c=d(s.map(p=>{if(p=Uj(p),p in Ux)return;Ux[p]=!0;const y=p.endsWith(".css"),v=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${v}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":Hj,y||(b.as="script"),b.crossOrigin="",b.href=p,g&&b.setAttribute("nonce",g),document.head.appendChild(b),y)return new Promise((k,S)=>{b.addEventListener("load",k),b.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${p}`)))})}))}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 r().catch(u)})},$x={own:"authoring-project",installed:"available-project",global:"available-personal"},Gd=new Set(["available-project","available-personal","available-plugin","authoring-project","authoring-plugin"]);function $j(t){if(typeof t=="string"){if(Gd.has(t))return t;if(Object.prototype.hasOwnProperty.call($x,t))return $x[t]}return"authoring-project"}function Vj(t){return t.startsWith("available-")?"available":"authoring"}function Pj(t){const r=t.indexOf("-");return t.slice(r+1)}const aa="";class Ls extends Error{constructor(r,s){super(r),this.name="ApiError",this.status=s}}async function Pe(t,r){const s=await fetch(`${aa}${t}`,r);if(!s.ok){const o=await s.json().catch(()=>({error:s.statusText}));throw new Ls(o.error||`HTTP ${s.status}`,s.status)}return s.json()}function rn(t){return typeof t=="string"&&t.length>0?t:null}function Fj(t){return typeof t=="number"&&Number.isFinite(t)?t:null}function hd(t){if(!Array.isArray(t))return null;const r=t.filter(s=>typeof s=="string"&&s.length>0);return r.length>0?r:null}function Gj(t){const r=t??{};let s;r.origin==="source"||r.origin==="installed"?s=r.origin:(s="source",console.warn(`[api.getSkills] skill ${String(r.plugin)}/${String(r.skill)} has invalid origin=${JSON.stringify(r.origin)}; defaulting to 'source'`));let o;r.scope==="own"||r.scope==="installed"||r.scope==="global"?o=r.scope:o=s==="installed"?"installed":"own";let c;r.installMethod==="authored"||r.installMethod==="copied"||r.installMethod==="symlinked"?c=r.installMethod:c=o==="own"?"authored":"copied";const u=typeof r.scopeV2=="string"&&Gd.has(r.scopeV2)?r.scopeV2:$j(r.scope),d=Vj(u),h=Pj(u),g=typeof r.precedenceRank=="number"?r.precedenceRank:void 0;let p;r.shadowedBy===null?p=null:typeof r.shadowedBy=="string"&&Gd.has(r.shadowedBy)?p=r.shadowedBy:p=void 0;const y={plugin:typeof r.plugin=="string"?r.plugin:"",skill:typeof r.skill=="string"?r.skill:"",dir:typeof r.dir=="string"?r.dir:"",hasEvals:!!r.hasEvals,hasBenchmark:!!r.hasBenchmark,evalCount:typeof r.evalCount=="number"?r.evalCount:0,assertionCount:typeof r.assertionCount=="number"?r.assertionCount:0,benchmarkStatus:r.benchmarkStatus==="pass"||r.benchmarkStatus==="fail"||r.benchmarkStatus==="pending"||r.benchmarkStatus==="stale"||r.benchmarkStatus==="missing"?r.benchmarkStatus:"missing",lastBenchmark:typeof r.lastBenchmark=="string"?r.lastBenchmark:null,origin:s,scope:o,isSymlink:typeof r.isSymlink=="boolean"?r.isSymlink:!1,symlinkTarget:rn(r.symlinkTarget),installMethod:c,scopeV2:u,group:d,source:h,pluginName:rn(r.pluginName),pluginNamespace:rn(r.pluginNamespace),pluginMarketplace:rn(r.pluginMarketplace),pluginManifestPath:rn(r.pluginManifestPath),pluginVersion:rn(r.pluginVersion),precedenceRank:g,shadowedBy:p,description:rn(r.description),version:rn(r.version),category:rn(r.category),author:rn(r.author),license:rn(r.license),homepage:rn(r.homepage),tags:hd(r.tags),deps:hd(r.deps),mcpDeps:hd(r.mcpDeps),entryPoint:rn(r.entryPoint),lastModified:rn(r.lastModified),sizeBytes:Fj(r.sizeBytes),sourceAgent:rn(r.sourceAgent)};if(r.provenance&&typeof r.provenance=="object"){const v=r.provenance;(v.promotedFrom==="installed"||v.promotedFrom==="global")&&typeof v.sourcePath=="string"&&typeof v.promotedAt=="number"?y.provenance={promotedFrom:v.promotedFrom,sourcePath:v.sourcePath,promotedAt:v.promotedAt,sourceSkillVersion:typeof v.sourceSkillVersion=="string"?v.sourceSkillVersion:void 0}:y.provenance=null}else r.provenance===null&&(y.provenance=null);return typeof r.updateAvailable=="boolean"&&(y.updateAvailable=r.updateAvailable),typeof r.currentVersion=="string"&&(y.currentVersion=r.currentVersion),typeof r.latestVersion=="string"&&(y.latestVersion=r.latestVersion),typeof r.pinnedVersion=="string"&&(y.pinnedVersion=r.pinnedVersion),y}const Ee={getConfig(){return Pe("/api/config")},setConfig(t,r){return Pe("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,model:r})})},async getSkills(t){const r=new URLSearchParams;t!=null&&t.scope&&r.set("scope",t.scope),t!=null&&t.agent&&r.set("agent",t.agent);const s=r.toString(),o=await Pe(`/api/skills${s?"?"+s:""}`);return Array.isArray(o)?o.map(Gj):[]},getAgents(){return Pe("/api/agents")},getSkillDetail(t,r){return Pe(`/api/skills/${t}/${r}`)},async getEvals(t,r){const s=await Pe(`/api/skills/${t}/${r}/evals`);if(s&&typeof s=="object"&&"exists"in s){if(s.exists===!1)return{skill_name:r,evals:[]};const{exists:o,...c}=s;return c}return s},getEvalsEnvelope(t,r){return Pe(`/api/skills/${t}/${r}/evals`)},getActivationHistoryEnvelope(t,r){return Pe(`/api/skills/${t}/${r}/activation-history`)},saveEvals(t,r,s){return Pe(`/api/skills/${t}/${r}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})},generateEvals(t,r){return Pe(`/api/skills/${t}/${r}/generate-evals`,{method:"POST"})},async getLatestBenchmark(t,r){const s=await fetch(`${aa}/api/skills/${t}/${r}/benchmark/latest`);if(!s.ok){const o=await s.json().catch(()=>({error:s.statusText}));throw new Ls(o.error||`HTTP ${s.status}`,s.status)}return s.json()},getHistory(t,r,s){const o=new URLSearchParams;s!=null&&s.model&&o.set("model",s.model),s!=null&&s.type&&o.set("type",s.type),s!=null&&s.from&&o.set("from",s.from),s!=null&&s.to&&o.set("to",s.to);const c=o.toString();return Pe(`/api/skills/${t}/${r}/history${c?"?"+c:""}`)},getHistoryEntry(t,r,s){return Pe(`/api/skills/${t}/${r}/history/${encodeURIComponent(s)}`)},compareRuns(t,r,s,o){return Pe(`/api/skills/${t}/${r}/history-compare?a=${encodeURIComponent(s)}&b=${encodeURIComponent(o)}`)},getCaseHistory(t,r,s,o){const c=new URLSearchParams;o&&c.set("model",o);const u=c.toString();return Pe(`/api/skills/${t}/${r}/history/case/${s}${u?"?"+u:""}`)},deleteHistoryEntry(t,r,s){return Pe(`/api/skills/${t}/${r}/history/${encodeURIComponent(s)}`,{method:"DELETE"})},deleteSkill(t,r){return Pe(`/api/skills/${t}/${r}`,{method:"DELETE"})},improveSkill(t,r,s){return Pe(`/api/skills/${t}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})},instructEdit(t,r,s){return Pe(`/api/skills/${t}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"instruct",...s})})},applyImprovement(t,r,s){return Pe(`/api/skills/${t}/${r}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:s})})},getStats(t,r){return Pe(`/api/skills/${t}/${r}/stats`)},getDependencies(t,r){return Pe(`/api/skills/${t}/${r}/dependencies`)},getProjectLayout(){return Pe("/api/project-layout")},createSkill(t){return Pe("/api/skills/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},saveDraft(t){return Pe("/api/skills/save-draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},getSkillCreatorStatus(){return Pe("/api/skill-creator-status")},generateSkill(t){return Pe("/api/skills/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},getSkillFiles(t,r){return Pe(`/api/skills/${t}/${r}/files`)},getSkillFile(t,r,s){return Pe(`/api/skills/${t}/${r}/file?path=${encodeURIComponent(s)}`)},saveSkillFile(t,r,s,o){return Pe(`/api/skills/${t}/${r}/file`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:s,content:o})})},getLeaderboard(t,r){return Pe(`/api/skills/${t}/${r}/leaderboard`)},getLeaderboardEntry(t,r,s){return Pe(`/api/skills/${t}/${r}/leaderboard/${encodeURIComponent(s)}`)},startSweep(t,r,s){const o=`${aa}/api/skills/${t}/${r}/sweep`,c=new EventSource(o);return fetch(o,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(s)}),c},getCredentials(t,r){return Pe(`/api/credentials/${t}/${r}`)},setCredential(t,r,s,o){return Pe(`/api/credentials/${t}/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,value:o})})},getParams(t,r){return Pe(`/api/credentials/${t}/${r}/params`)},getParamsRevealed(t,r,s){const o=s?`reveal=true&key=${encodeURIComponent(s)}`:"reveal=true";return Pe(`/api/credentials/${t}/${r}/params?${o}`)},searchModels(){return Pe("/api/openrouter/models")},async getSkillVersions(t,r){const s=await Pe(`/api/skills/${t}/${r}/versions`);return Array.isArray(s)?s:Array.isArray(s.versions)?s.versions:[]},getSkillVersionsEnvelope(t,r){return Pe(`/api/skills/${t}/${r}/versions`)},getVersionDiff(t,r,s,o){return Pe(`/api/skills/${t}/${r}/versions/diff?from=${s}&to=${o}`)},startBatchUpdate(t){const r=`${aa}/api/skills/batch-update`,s=new EventSource(r);return fetch(r,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({skills:t})}),s},startSkillUpdate(t,r){const s=`${aa}/api/skills/${t}/${r}/update`,o=new EventSource(s);return fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"}}),o},async rescanSkill(t,r){const s=`${t}/${r}`,o=await fetch(`${aa}/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(`${aa}/api/skills/updates`);return t.ok?await t.json():[]}catch{return[]}},async checkSkillUpdates(t){if(t.length===0)return[];try{const r=await fetch(`${aa}/api/v1/skills/check-updates`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({skills:[...t].sort()})});if(!r.ok)return[];const s=await r.json().catch(()=>null);return Array.isArray(s)?s:s&&typeof s=="object"&&Array.isArray(s.results)?s.results.map(o=>({skillId:typeof o.skillId=="string"?o.skillId:typeof o.name=="string"?o.name:"",version:typeof o.version=="string"?o.version:typeof o.latest=="string"?o.latest:"",eventId:typeof o.eventId=="string"?o.eventId:"",publishedAt:typeof o.publishedAt=="string"?o.publishedAt:"",diffSummary:typeof o.diffSummary=="string"?o.diffSummary:void 0,trackedForUpdates:typeof o.trackedForUpdates=="boolean"?o.trackedForUpdates:void 0,updateAvailable:typeof o.updateAvailable=="boolean"?o.updateAvailable:void 0,installed:typeof o.installed=="string"?o.installed:void 0,latest:typeof o.latest=="string"?o.latest:void 0,name:typeof o.name=="string"?o.name:void 0})):[]}catch{return[]}},promoteSkill(t,r,s){const o=s!=null&&s.overwrite?"?overwrite=true":"";return xd(`/api/skills/${t}/${r}/promote${o}`,s==null?void 0:s.onEvent,s==null?void 0:s.signal)},testInstallSkill(t,r,s){const o=new URLSearchParams;(s==null?void 0:s.dest)==="global"&&o.set("dest","global"),s!=null&&s.overwrite&&o.set("overwrite","true");const c=o.toString();return xd(`/api/skills/${t}/${r}/test-install${c?"?"+c:""}`,s==null?void 0:s.onEvent,s==null?void 0:s.signal)},revertSkill(t,r,s){return xd(`/api/skills/${t}/${r}/revert`,s==null?void 0:s.onEvent,s==null?void 0:s.signal)},listStudioOps(t){const r=new URLSearchParams;(t==null?void 0:t.before)!=null&&r.set("before",String(t.before)),(t==null?void 0:t.limit)!=null&&r.set("limit",String(t.limit));const s=r.toString();return Pe(`/api/studio/ops${s?"?"+s:""}`)},deleteStudioOp(t){return Pe(`/api/studio/ops/${encodeURIComponent(t)}`,{method:"DELETE"})},studioOpsStream(){return new EventSource(`${aa}/api/studio/ops/stream`)}};async function xd(t,r,s){const o=await fetch(`${aa}${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 k=await o.json();k.error&&(y=k.error),typeof k.code=="string"&&(v=k.code)}catch{}const b=new Ls(y,o.status);throw v&&(b.code=v),b}const c=o.body.getReader(),u=new TextDecoder;let d="",h="",g=null,p=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 k of b)if(k.startsWith("event: "))h=k.slice(7).trim();else if(k.startsWith("data: ")){let S={};try{S=JSON.parse(k.slice(6))}catch{h="";continue}if(h==="started"||h==="copied"||h==="deleted"||h==="indexed"||h==="done"||h==="error"){const w={type:h,...S};r==null||r(w),w.type==="done"&&(g=w),w.type==="error"&&(p=w)}h=""}}if(p){const y=new Ls(p.message,500);throw y.code=p.code,y}if(!g)throw new Ls("Transfer stream ended without 'done' event",500);return g}function Wj(t,r){if(!r.length)return t;const s=new Map;for(const o of r){const c=o.name.split("/").pop()||o.name;s.set(c,o)}return t.map(o=>{const c=s.get(o.skill);if(!c)return o;const u={...o,updateAvailable:c.updateAvailable,currentVersion:c.installed,latestVersion:c.latest??void 0};return typeof c.trackedForUpdates=="boolean"&&(u.trackedForUpdates=c.trackedForUpdates),u})}function qj(t){const[r,s]=m.useState(()=>typeof window>"u"?!1:window.matchMedia(t).matches);return m.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]),r}const Yj=500,Wd="vskill.updates.seenLastId";function Kj(){if(typeof window>"u")return null;try{return window.localStorage.getItem(Wd)}catch{return null}}function gd(t){if(!(typeof window>"u"))try{t==null?window.localStorage.removeItem(Wd):window.localStorage.setItem(Wd,t)}catch{}}function Xj(){let t=new Map;const r=new Set,s=new Set,o=[];let c=Kj();c&&(s.add(c),o.push(c));function u(){t=new Map(t);for(const h of Array.from(r))h()}function d(h){if(!s.has(h)){if(s.add(h),o.push(h),o.length>Yj){const g=o.shift();g&&s.delete(g)}c=h,gd(h)}}return{getSnapshot(){return t},subscribe(h){return r.add(h),()=>{r.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,gd(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,gd(null),u()}}}const Rr=Xj(),Qj=3e5,Zj=500,Jj=15e3,eS=6e4,tS=6e4,nS="/api/v1/skills/stream";function Vx(t){const r=new Map;for(const s of t){const o=s.name.split("/").pop()||s.name;r.set(o,s)}return r}function Px(t){let r=0;for(const s of t)s.updateAvailable&&r++;return r}function aS(t){if(!t||typeof t!="object")return!1;const r=t;return r.type==="skill.updated"&&typeof r.eventId=="string"&&typeof r.skillId=="string"&&typeof r.version=="string"}function rS(t){const r=(t==null?void 0:t.intervalMs)??Qj,s=(t==null?void 0:t.debounceMs)??Zj,o=(t==null?void 0:t.timeoutMs)??Jj,c=(t==null?void 0:t.staleAfterMs)??eS,u=(t==null?void 0:t.disconnectFallbackMs)??tS,d=(t==null?void 0:t.streamUrlBase)??nS,h=m.useMemo(()=>!(t!=null&&t.skillIds)||t.skillIds.length===0?"":[...t.skillIds].sort().join(","),[t==null?void 0:t.skillIds]),g=m.useMemo(()=>{const D=(t==null?void 0:t.trackingSkillIds)??(t==null?void 0:t.skillIds)??[];return D.length===0?"":[...D].sort().join(",")},[t==null?void 0:t.trackingSkillIds,t==null?void 0:t.skillIds]),[p,y]=m.useState([]),[v,b]=m.useState(()=>new Map),[k,S]=m.useState(0),[w,C]=m.useState(!1),[T,R]=m.useState(null),[L,B]=m.useState(null),z=m.useRef(null),F=m.useRef(null),E=m.useRef(null),I=m.useRef(null),N=m.useRef(!0),[_,V]=m.useState(()=>h?"connecting":"fallback"),W=m.useRef(_);W.current=_;const Y=m.useSyncExternalStore(D=>Rr.subscribe(D),()=>Rr.getSnapshot(),()=>Rr.getSnapshot()),X=Y.size,H=m.useCallback(async()=>{C(!0);const D=new AbortController,P=setTimeout(()=>D.abort(),o);try{const ee=await Promise.race([Ee.getSkillUpdates(),new Promise((re,xe)=>{D.signal.addEventListener("abort",()=>{xe(new Error("TIMEOUT"))})})]);if(ee==="TIMEOUT")throw new Error("TIMEOUT");if(!N.current)return;y(ee),b(Vx(ee)),S(Px(ee)),F.current=Date.now(),R(F.current),B(null)}catch(ee){if(!N.current)return;B(ee instanceof Error?ee:new Error(String(ee)))}finally{clearTimeout(P),N.current&&C(!1)}},[o]),M=m.useCallback(()=>{if(z.current)return z.current;const D=H().finally(()=>{z.current=null});return z.current=D,D},[H]),O=m.useCallback(()=>{E.current==null&&(E.current=setInterval(()=>{M()},r))},[r,M]),U=m.useCallback(()=>{E.current!=null&&(clearInterval(E.current),E.current=null)},[]);m.useEffect(()=>{N.current=!0,(F.current==null||Date.now()-F.current>c)&&M(),(typeof document>"u"||document.visibilityState!=="hidden")&&O();const ee=()=>{if(I.current&&(clearTimeout(I.current),I.current=null),document.visibilityState==="hidden"){U();return}I.current=setTimeout(()=>{I.current=null,(F.current==null||Date.now()-F.current>c)&&M(),O()},s)};return typeof document<"u"&&document.addEventListener("visibilitychange",ee),()=>{N.current=!1,typeof document<"u"&&document.removeEventListener("visibilitychange",ee),I.current&&clearTimeout(I.current),U()}},[]);const G=m.useCallback(async D=>{if(D.length!==0)try{const P=await Ee.checkSkillUpdates(D);if(!N.current||P.length===0)return;const ee=Date.now(),re=P.filter(ce=>ce.skillId&&ce.eventId&&ce.version).map(ce=>({skillId:ce.skillId,version:ce.version,eventId:ce.eventId,publishedAt:ce.publishedAt,diffSummary:ce.diffSummary,receivedAt:ee}));re.length>0&&Rr.mergeBulk(re);const xe=P.filter(ce=>typeof ce.trackedForUpdates=="boolean"||typeof ce.updateAvailable=="boolean").map(ce=>({name:ce.name??ce.skillId,installed:ce.installed??"",latest:ce.latest??null,updateAvailable:ce.updateAvailable??!1,trackedForUpdates:typeof ce.trackedForUpdates=="boolean"?ce.trackedForUpdates:void 0}));xe.length>0&&y(ce=>{const ye=new Map;for(const Re of ce)ye.set(Re.name.split("/").pop()||Re.name,Re);let de=0;for(const Re of xe){const Le=Re.name.split("/").pop()||Re.name,ae=ye.get(Le);if(ae){const fe={...ae};ae.trackedForUpdates===void 0&&Re.trackedForUpdates!==void 0&&(fe.trackedForUpdates=Re.trackedForUpdates),ye.set(Le,fe)}else ye.set(Le,{name:Re.name,installed:Re.installed??"",latest:Re.latest??null,updateAvailable:Re.updateAvailable??!1,trackedForUpdates:Re.trackedForUpdates}),de+=1}if(de===0&&ye.size===ce.length)return ce;const je=[...ye.values()];return b(Vx(je)),S(Px(je)),je})}catch{}},[]);m.useEffect(()=>{const D=h||g;if(!D){V("fallback");return}if(typeof window>"u"||typeof EventSource>"u"){V("fallback");return}V("connecting");const P=D.split(","),ee=`${d}?skills=${encodeURIComponent(D)}`;let re=null,xe=null,ce=null;const ye=()=>{xe==null&&(xe=setTimeout(()=>{xe=null,N.current&&W.current!=="connected"&&V("fallback")},u))},de=()=>{xe!=null&&(clearTimeout(xe),xe=null)};ye();const je=1e3,Re=()=>{N.current&&ce==null&&(ce=setTimeout(()=>{if(ce=null,!!N.current&&!(re&&re.readyState!==EventSource.CLOSED)){if(re)try{re.close()}catch{}fe()}},je))},Le=me=>{if(!N.current)return;let he;try{he=JSON.parse(me.data)}catch{return}if(!aS(he)||Rr.ingest(he)==="duplicate")return;if(typeof document>"u"||document.visibilityState!=="hidden"){const Oe=`${he.skillId} updated to ${he.version}`;window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:Oe,severity:"info",skillId:he.skillId,version:he.version,eventId:he.eventId}}))}},ae=()=>{N.current&&(Rr.clearSeen(),G(P))},fe=()=>{N.current&&(re=new EventSource(ee),re.onopen=()=>{N.current&&(de(),V("connected"))},re.onerror=()=>{N.current&&(ye(),re&&re.readyState===EventSource.CLOSED&&Re())},re.onmessage=Le,re.addEventListener("gone",ae))};return fe(),()=>{if(de(),ce!=null&&(clearTimeout(ce),ce=null),re){try{re.removeEventListener("gone",ae)}catch{}try{re.close()}catch{}}}},[h,g,d,u,G]),m.useEffect(()=>{if(!g)return;const D=g.split(",");G(D)},[g,G]);const ue=m.useCallback(D=>{Rr.dismiss(D)},[]);return{updates:p,updatesMap:v,updateCount:k,isRefreshing:w,lastFetchAt:T,error:L,refresh:M,updatesById:Y,pushUpdateCount:X,status:_,dismiss:ue}}const lS={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list",updateNotificationDismissed:!1,revealSkillId:null};function sS(t,r){switch(r.type){case"SELECT_SKILL":return{...t,selectedSkill:r.skill,mode:"browse",mobileView:t.isMobile?"detail":t.mobileView};case"CLEAR_SELECTION":return{...t,selectedSkill:null};case"SET_MODE":return{...t,mode:r.mode,selectedSkill:r.mode==="create"?null:t.selectedSkill};case"SET_SEARCH":return{...t,searchQuery:r.query};case"SET_SKILLS":return{...t,skills:r.skills,skillsLoading:!1,skillsError:null};case"SET_SKILLS_ERROR":return{...t,skillsError:r.error,skillsLoading:!1};case"SET_SKILLS_LOADING":return{...t,skillsLoading:r.loading};case"SET_MOBILE":return{...t,isMobile:r.isMobile};case"SET_MOBILE_VIEW":return{...t,mobileView:r.view};case"DISMISS_UPDATE_NOTIFICATION":return{...t,updateNotificationDismissed:!0};case"REVEAL_SKILL":return{...t,selectedSkill:r.skill,revealSkillId:`${r.skill.plugin}/${r.skill.skill}`,mode:"browse",mobileView:t.isMobile?"detail":t.mobileView};case"CLEAR_REVEAL":return{...t,revealSkillId:null};default:return t}}const kv=m.createContext(null),wv=kv;function Zn(){const t=m.useContext(wv);if(!t)throw new Error("useStudio must be used within StudioProvider");return t}function iS({children:t}){const[r,s]=m.useReducer(sS,lS),o=qj("(max-width: 767px)");m.useEffect(()=>{s({type:"SET_MOBILE",isMobile:o})},[o]);const[c,u]=m.useState(()=>{try{const W=window.localStorage.getItem("vskill.studio.prefs");if(!W)return null;const Y=JSON.parse(W);return typeof Y.activeAgent=="string"?Y.activeAgent:null}catch{return null}}),[d,h]=m.useState(c!==null);m.useEffect(()=>{function W(Y){if(!(Y instanceof CustomEvent))return;const X=Y.detail;X!=null&&X.agentId&&(u(X.agentId),h(!0))}return window.addEventListener("studio:agent-changed",W),()=>window.removeEventListener("studio:agent-changed",W)},[]),m.useEffect(()=>{if(d)return;let W=!1;return Ee.getAgents().then(Y=>{if(W)return;const X=(Y==null?void 0:Y.suggested)??"claude-code";u(H=>H??X),h(!0)}).catch(()=>{W||(u(Y=>Y??"claude-code"),h(!0))}),()=>{W=!0}},[d]);const g=m.useCallback(()=>{if(!d||!c)return;s({type:"SET_SKILLS_LOADING",loading:!0});const W={agent:c};Ee.getSkills(W).then(Y=>{s({type:"SET_SKILLS",skills:Y});const H=window.location.hash.match(/^#\/skills\/([^/]+)\/([^/?]+)/);if(H){const[,M,O]=H,U=Y.find(G=>G.plugin===M&&G.skill===O);U&&s({type:"SELECT_SKILL",skill:{plugin:M,skill:O,origin:U.origin}})}}).catch(Y=>s({type:"SET_SKILLS_ERROR",error:Y.message}))},[c,d]);m.useEffect(()=>{g()},[g]);const p=m.useCallback(W=>{s({type:"SELECT_SKILL",skill:W}),window.location.hash=`/skills/${W.plugin}/${W.skill}`},[]),y=m.useRef(r.skills);m.useEffect(()=>{y.current=r.skills},[r.skills]);const v=m.useCallback((W,Y)=>{const X=y.current,H=W?X.find(U=>U.plugin===W&&U.skill===Y):X.find(U=>U.skill===Y&&U.source!=="plugin");if(!W&&!H){typeof console<"u"&&console.warn(`[StudioContext] revealSkill: no plugin provided and skill "${Y}" not yet in state — skipping reveal`);return}const M=(H==null?void 0:H.plugin)??W,O=(H==null?void 0:H.origin)??"source";s({type:"REVEAL_SKILL",skill:{plugin:M,skill:Y,origin:O}}),window.location.hash=`/skills/${M}/${Y}`},[]),b=m.useCallback(()=>{s({type:"CLEAR_REVEAL"})},[]),k=m.useCallback(()=>{s({type:"CLEAR_SELECTION"}),window.location.hash.startsWith("#/skills/")&&history.replaceState(null,"",window.location.pathname+window.location.search)},[]),S=m.useCallback(W=>{s({type:"SET_MODE",mode:W})},[]),w=m.useCallback(W=>{s({type:"SET_SEARCH",query:W})},[]),C=m.useCallback(W=>{s({type:"SET_MOBILE_VIEW",view:W})},[]),T=m.useCallback(()=>{s({type:"DISMISS_UPDATE_NOTIFICATION"})},[]),R=m.useMemo(()=>{const W=[];for(const Y of r.skills)Y.origin==="installed"&&W.push(`${Y.plugin}/${Y.skill}`);return W},[r.skills]),L=m.useMemo(()=>r.skills.map(W=>`${W.plugin}/${W.skill}`),[r.skills]),B=rS({skillIds:R,trackingSkillIds:L}),z=m.useMemo(()=>{const W=r.skills.map(Y=>{if(!Y.updateAvailable&&Y.latestVersion===void 0&&Y.trackedForUpdates===void 0)return Y;const X={...Y};return delete X.updateAvailable,delete X.currentVersion,delete X.latestVersion,delete X.trackedForUpdates,X});return Wj(W,B.updates)},[r.skills,B.updates]),F=m.useMemo(()=>{const W={source:0,installed:0};for(const Y of z)Y.updateAvailable&&(W[Y.origin]+=1);return W},[z]),E=m.useMemo(()=>({...r,skills:z}),[r,z]),I=B.updateCount,N=B.refresh,_=B.isRefreshing,V=m.useMemo(()=>({state:E,selectSkill:p,clearSelection:k,setMode:S,setSearch:w,setMobileView:C,refreshSkills:g,updateCount:I,dismissUpdateNotification:T,updates:B.updates,outdatedByOrigin:F,isRefreshingUpdates:_,refreshUpdates:N,revealSkill:v,clearReveal:b,updatesById:B.updatesById,pushUpdateCount:B.pushUpdateCount,updateStreamStatus:B.status,dismissPushUpdate:B.dismiss}),[E,p,k,S,w,C,g,I,T,B.updates,F,_,N,v,b,B.updatesById,B.pushUpdateCount,B.status,B.dismiss]);return a.jsx(wv.Provider,{value:V,children:t})}const oS={config:null,loading:!0};function cS(t,r){switch(r.type){case"SET_CONFIG":return{config:r.config,loading:!1};case"SET_LOADING":return{...t,loading:!0};default:return t}}const Cv=m.createContext(null);function _r(){const t=m.useContext(Cv);if(!t)throw new Error("useConfig must be used within ConfigProvider");return t}function uS({children:t}){const[r,s]=m.useReducer(cS,oS),o=m.useCallback(()=>{Ee.getConfig().then(d=>s({type:"SET_CONFIG",config:d})).catch(()=>{})},[]);m.useEffect(()=>{o()},[o]);const c=m.useCallback(async(d,h)=>{const g=await Ee.setConfig(d,h);return s({type:"SET_CONFIG",config:g}),g},[]),u=m.useMemo(()=>({config:r.config,loading:r.loading,updateConfig:c,refreshConfig:o}),[r,c,o]);return a.jsx(Cv.Provider,{value:u,children:t})}function dS({topRail:t,sidebar:r,main:s,statusBar:o,resizeHandle:c,banner:u,liveMessage:d,sidebarWidth:h=320,sidebarHidden:g=!1}){const p={"--top-rail-height":"48px","--status-bar-height":"28px","--sidebar-width":`${h}px`,display:"grid",gridTemplateRows:"var(--top-rail-height) 1fr var(--status-bar-height)",height:"100vh",overflow:"hidden",background:"var(--bg-canvas)",color:"var(--text-primary)"},y={display:"grid",gridTemplateColumns:g?"1fr":"var(--sidebar-width) auto 1fr",minHeight:0,overflow:"hidden"};return a.jsxs("div",{className:"studio-shell",style:p,children:[u,a.jsx("header",{style:{borderBottom:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:t}),a.jsxs("div",{style:y,children:[!g&&a.jsx("aside",{"aria-label":"Skills sidebar",style:{minHeight:0,overflow:"hidden",borderRight:c?"none":"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",flexDirection:"column"},children:r}),!g&&c,a.jsx("main",{style:{minHeight:0,overflow:"auto",background:"var(--bg-canvas)"},children:s})]}),a.jsx("footer",{role:"contentinfo",style:{borderTop:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:o}),a.jsx("div",{"aria-live":"polite",role:"status",style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0},children:d??""})]})}const Fx=["claude-cli","anthropic","openai","openrouter","cursor","codex-cli","gemini-cli","copilot","zed","ollama","lm-studio"],fS={"claude-cli":".claude",cursor:".cursor","codex-cli":".codex","gemini-cli":".gemini",copilot:".github",zed:".zed"},pS={"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"},hS={"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 xS(t,r){var h,g;const s=fS[t.id]??null,o=pS[t.id]??null,c=s?!!((h=r==null?void 0:r.wrapperFolders)!=null&&h[s]):!1,u=o?!!((g=r==null?void 0:r.binaries)!=null&&g[o]):!0,d=t.models.map(p=>({id:p.id,displayName:p.label,billingMode:hS[t.id]??"per-token",...p.pricing?{pricing:p.pricing}:{},...p.resolvedId?{resolvedId:p.resolvedId}:{}}));return{id:t.id,displayName:gS(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 gS(t,r){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]??r}function vS(t){const r=new Map(t.map(o=>[o.id,o])),s=[];for(const o of Fx){const c=r.get(o);c&&s.push(c)}for(const o of t)Fx.includes(o.id)||s.push(o);return s}function yS(t){const[r,s]=m.useState(null),[o,c]=m.useState("loading"),[u,d]=m.useState(null),[h,g]=m.useState(null),p=m.useRef(null),y=m.useRef(0),v=m.useRef(t==null?void 0:t.onStaleCatalog),b=m.useRef(t==null?void 0:t.onSetActiveError);m.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 k=m.useCallback(async()=>{try{const R=await fetch("/api/config");if(!R.ok)throw new Error(`/api/config returned ${R.status}`);const L=await R.json(),B=vS((L.providers||[]).map(z=>xS(z,L.detection)));s({agents:B,activeAgent:L.provider??null,activeModel:L.model??null}),c("ready"),d(null)}catch(R){c("error"),d(R.message)}},[]);m.useEffect(()=>{k()},[k]);const S=m.useCallback(async()=>{var L;const R=Date.now();if(!(R-y.current<5*6e4))try{const B=await fetch("/api/openrouter/models");if(!B.ok){B.status!==400&&g(`OpenRouter catalog fetch failed (${B.status})`);return}const z=await B.json();y.current=R,g(null),s(I=>{if(!I)return I;const N=I.agents.map(_=>{if(_.id!=="openrouter")return _;const V=z.models.map(Y=>({id:Y.id,displayName:Y.name,contextWindow:Y.contextWindow,pricing:Y.pricing,billingMode:"per-token"}));return{..._,models:V,catalogAgeMs:z.ageSec?z.ageSec*1e3:0,cacheStale:!!z.stale}});return{...I,agents:N}});const F=z.ageSec??0;(z.stale===!0||F>600)&&((L=v.current)==null||L.call(v,"openrouter",F*1e3))}catch(B){g(`OpenRouter catalog unreachable: ${B.message}`)}},[]),w=m.useCallback(R=>{p.current=R,R==="openrouter"&&S()},[S]),C=m.useCallback(()=>{y.current=0,k()},[k]),T=m.useCallback(async(R,L)=>{var F,E;let B;try{B=await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:R,model:L})})}catch(I){(F=b.current)==null||F.call(b,`Network error while setting ${R}: ${I.message}`);return}if(B.ok){s(I=>I&&{...I,activeAgent:R,activeModel:L});return}let z=`Failed to set ${R} (${B.status})`;try{const I=await B.json();I&&typeof I.error=="string"&&(z=I.error)}catch{}(E=b.current)==null||E.call(b,z)},[]);return{status:o,catalog:r,error:u,openRouterError:h,focusAgent:w,refresh:C,activeAgentId:(r==null?void 0:r.activeAgent)??null,activeModelId:(r==null?void 0:r.activeModel)??null,setActive:T}}function vd({variant:t,label:r,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 a.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":r,...c?{title:c}:{},children:r})}function qd({unlocked:t=!1,size:r=10}){return t?a.jsxs("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),a.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 3.5"})]}):a.jsxs("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),a.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 4.5V7"})]})}const 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 <plugin> to add one.",emptyFilteredHeadline:"No matches in this section.",emptyFilteredBody:"Clear the search or try another query.",loadErrorHeadline:"Couldn't load skills.",loadErrorRetry:"Retry",duplicateBadge:"synced from Own",updateAvailableBadge:"Update available",countBadgeFiltered:(t,r)=>`${t} of ${r}`},jS={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"},SS={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"},kS={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"},wS={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"},CS={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"},ES={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."},NS={disconnected:"Disconnected — reconnecting…",reconnected:"Reconnected.",loading:"Loading skills…",loadingPlaceholderCount:"—"},TS={fieldRequired:"This field is required.",nameInvalid:"Use letters, numbers, and hyphens.",descriptionRequired:"Description is required.",saveFailed:"Save failed. Check the form for errors."},RS={boundaryHeadline:"Something broke in this view.",boundaryBody:"Reload the page to recover.",boundaryAction:"Reload"},AS={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"},MS={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)."}},LS={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`},DS={providersLabel:"Providers",providerSummary:(t,r)=>`${t}/${r} providers`,locked:t=>`${t} — locked. Click to add a key.`,lockedCli:t=>`${t} — locked. Click for install instructions.`,unlocked:t=>`${t} — unlocked.`},_S={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}`},OS={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.`},BS={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"},IS={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."},HS={groupAvailable:"Available",groupAuthoring:"Authoring",sourceProject:"Project",sourcePersonal:"Personal",sourcePlugin:"Plugins",authoringSkills:"Skills"},US={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"}},te={sidebar:bS,shell:jS,detail:SS,actions:kS,palette:wS,shortcuts:CS,toasts:ES,connection:NS,forms:TS,errors:RS,picker:AS,providers:MS,models:LS,settings:zS,statusBar:DS,scopePicker:_S,scopeSection:OS,claudeCodeLabel:BS,setupDrawer:IS,setupProviders:US,scopeLabels:HS},$S=new Set(["claude-cli","claude-code"]);function Gx(t){return $S.has(t)}const Wx=new Set(["claude-cli","claude-code","anthropic","openai","openrouter","cursor","codex-cli","gemini-cli","copilot","zed"]);function VS({agents:t,activeAgentId:r,focusedAgentId:s,onFocus:o,onSelect:c,onOpenSettings:u}){const d=t.filter(g=>Wx.has(g.id)),h=t.filter(g=>!Wx.has(g.id));return a.jsxs("div",{role:"listbox","aria-label":"Agent","data-testid":"agent-list",style:{width:240,borderRight:"1px solid var(--border-default, var(--border-subtle))",display:"flex",flexDirection:"column",overflowY:"auto"},children:[d.map(g=>a.jsx(qx,{agent:g,isActive:g.id===r,isFocused:g.id===s,onFocus:o,onSelect:c,onOpenSettings:u},g.id)),h.length>0&&a.jsx("div",{style:{borderTop:"1px solid var(--border-default, var(--border-subtle))",margin:"4px 0"},"aria-hidden":"true"}),h.map(g=>a.jsx(qx,{agent:g,isActive:g.id===r,isFocused:g.id===s,onFocus:o,onSelect:c,onOpenSettings:u},g.id))]})}function qx({agent:t,isActive:r,isFocused:s,onFocus:o,onSelect:c,onOpenSettings:u}){const{providers:d}=te,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}},p=Gx(t.id),y={minHeight:36,height:p?"auto":36,padding:p?"6px 12px":"0 12px",display:"flex",alignItems:"center",gap:8,cursor:"pointer",position:"relative",background:s?"var(--surface-muted, var(--surface-3))":"transparent",borderLeft:r?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",fontSize:13,fontWeight:r?500:400,color:"var(--text-primary)"};return r&&(y.background="color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)"),a.jsxs("div",{role:"option","aria-selected":r,"data-testid":`agent-row-${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&&a.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&&a.jsx("span",{style:{width:6,height:6,flexShrink:0},"aria-hidden":"true"}),a.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[a.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.displayName}),Gx(t.id)&&a.jsx("span",{"data-testid":"claude-code-billing-label",title:te.claudeCodeLabel.tooltip,style:{fontSize:10,color:"var(--text-secondary, var(--text-tertiary))",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:1},children:te.claudeCodeLabel.compactLabel})]}),a.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?a.jsx(qd,{unlocked:!0,size:10}):a.jsx(qd,{size:10})}),r&&a.jsx("span",{style:{fontSize:10,textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600,color:"var(--accent-ink, var(--accent))",flexShrink:0},"data-testid":`active-badge-${t.id}`,children:te.picker.currentlyActive}),!t.available&&t.ctaType==="api-key"&&a.jsx(vd,{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]&&a.jsx(vd,{variant:"cli-install",label:g[t.id].label,installUrl:g[t.id].url,onActivate:()=>{}}),!t.available&&t.ctaType==="start-service"&&a.jsx(vd,{variant:"start-service",label:t.id==="ollama"?d.ollama.startServiceCta:d.lmStudio.startServiceCta,onActivate:()=>u(t.id)}),h[t.id]&&a.jsx("span",{className:"sr-only","data-testid":`caption-${t.id}`,children:h[t.id]})]})}function PS(t,r,s,o){const d=t>=80,h=m.useRef(null),[g,p]=m.useState(0),y=m.useCallback(k=>{p(k.currentTarget.scrollTop)},[]),{visibleStart:v,visibleEnd:b}=m.useMemo(()=>{if(!d)return{visibleStart:0,visibleEnd:t};const k=Math.max(0,Math.floor(g/r)-4),S=Math.ceil(s/r)+8,w=Math.min(t,k+S);return{visibleStart:k,visibleEnd:w}},[d,g,r,s,t,4]);return{visibleStart:v,visibleEnd:b,totalHeight:t*r,offsetTop:v*r,virtualised:d,containerProps:{onScroll:y,ref:h,style:{overflowY:"auto",maxHeight:s,willChange:d?"transform":void 0}}}}const Ev=44,FS=352,GS=60,Yx=480;function WS(t){var u,d;const r=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 r?`${r} ctx ${te.models.subscriptionBilling}`:te.models.subscriptionBilling.trim();if(t.billingMode==="free")return r?`local · ${r} 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 r?`${r} ctx · ${c}`:c}function qS(t,r){if(!r)return t;const s=r.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 YS({agent:t,activeModelId:r,focusedIndex:s=-1,onSelect:o,onOpenSettings:c}){const[u,d]=m.useState(""),[h,g]=m.useState(""),p=m.useRef(null);if(m.useEffect(()=>{const b=setTimeout(()=>g(u),GS);return()=>clearTimeout(b)},[u]),m.useEffect(()=>{t.id==="openrouter"&&t.available&&p.current&&p.current.focus()},[t.id,t.available]),t.id==="openrouter"&&!t.available)return a.jsxs("div",{"data-testid":"openrouter-empty-card",style:{width:Yx,padding:20,display:"flex",flexDirection:"column",gap:12},children:[a.jsx("p",{style:{margin:0,color:"var(--text-primary)",fontSize:13,lineHeight:1.5},children:te.providers.openrouter.emptyCardBody}),a.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:te.providers.openrouter.addKeyCta})]});const y=m.useMemo(()=>qS(t.models,h),[t.models,h]),v=PS(y.length,Ev,FS);return a.jsxs("div",{role:"listbox","aria-label":"Model","data-testid":"model-list",style:{width:Yx,display:"flex",flexDirection:"column"},children:[t.id==="openrouter"&&a.jsx("div",{style:{padding:8,borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:a.jsx("input",{ref:p,type:"text",placeholder:te.picker.searchPlaceholder,value:u,onChange:b=>d(b.target.value),"data-testid":"model-search-input","aria-label":te.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?a.jsxs("div",{style:{padding:16},"data-testid":"no-matches",children:[a.jsx("div",{style:{color:"var(--text-muted, var(--text-tertiary))",fontSize:12,marginBottom:8},children:te.picker.noMatches(h)}),a.jsx("button",{type:"button",onClick:()=>d(""),style:{padding:"4px 8px",background:"transparent",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:te.picker.clearSearch})]}):y.length===0?a.jsx("div",{style:{padding:16,color:"var(--text-muted, var(--text-tertiary))",fontSize:12},children:te.picker.noModelsYet}):a.jsx("div",{...v.containerProps,children:a.jsx("div",{style:{height:v.virtualised?v.totalHeight:"auto",position:"relative"},children:a.jsx("div",{style:{transform:v.virtualised?`translateY(${v.offsetTop}px)`:void 0},children:y.slice(v.visibleStart,v.visibleEnd).map((b,k)=>{const S=v.visibleStart+k;return a.jsx(XS,{model:b,isActive:b.id===r,isFocused:s===S,onSelect:()=>o(b.id),resolvedModel:t.id==="claude-cli"?t.resolvedModel??null:null},b.id)})})})})]})}function KS(t,r,s){return r&&r.toLowerCase().includes(t.toLowerCase())?r:s??null}function XS({model:t,isActive:r,isFocused:s,onSelect:o,resolvedModel:c}){const u=WS(t),d=KS(t.id,c,t.resolvedId),h=d!==null,g=r?"color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)":s?"var(--surface-muted, var(--surface-3))":"transparent",p=r?"1px solid var(--accent, var(--color-accent))":"1px solid transparent";return a.jsxs("button",{type:"button",role:"option","aria-selected":r,"data-testid":`model-row-${t.id}`,"data-focused":s||void 0,onClick:o,title:t.id,style:{width:"100%",minHeight:Ev,padding:"4px 12px",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:2,background:g,borderLeft:p,cursor:"pointer",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",textAlign:"left"},children:[a.jsx("span",{style:{fontSize:14,fontWeight:500,color:"var(--text-primary)"},children:t.displayName}),a.jsx("span",{style:{fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace",fontVariantNumeric:"tabular-nums",color:"var(--text-muted, var(--text-tertiary))"},children:u}),h&&a.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 Kx={anthropic:{stored:!1,updatedAt:null},openai:{stored:!1,updatedAt:null},openrouter:{stored:!1,updatedAt:null}};function QS(){const[t,r]=m.useState(null),[s,o]=m.useState(!0),[c,u]=m.useState(null),d=m.useCallback(async()=>{o(!0);try{const p=await fetch("/api/settings/keys");if(!p.ok)throw new Error(`GET /api/settings/keys returned ${p.status}`);const y=await p.json();r({...Kx,...y}),u(null)}catch(p){u(p.message),r(Kx)}finally{o(!1)}},[]);m.useEffect(()=>{d()},[d]);const h=m.useCallback(async(p,y)=>{const v=await fetch("/api/settings/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:p,key:y})});if(!v.ok){const k=await v.json().catch(()=>({error:v.statusText}));throw new Error(k.error||`POST /api/settings/keys returned ${v.status}`)}const b=await v.json();return await d(),b},[d]),g=m.useCallback(async p=>{const y=await fetch(`/api/settings/keys/${p}`,{method:"DELETE"});if(!y.ok)throw new Error(`DELETE /api/settings/keys/${p} returned ${y.status}`);await d()},[d]);return{state:t,loading:s,error:c,save:h,remove:g,refresh:d}}function ZS({onMigrated:t,fetchImpl:r}){const[s,o]=m.useState({kind:"loading"}),c=r??globalThis.fetch,u=m.useCallback(async()=>{var p;try{const y=await c("/api/settings/migration-status");if(!y.ok){o({kind:"hidden"});return}const v=await y.json();v.pending&&(((p=v.darwinKeys)==null?void 0:p.length)??0)>0?o({kind:"visible",darwinKeys:v.darwinKeys??[]}):o({kind:"hidden"})}catch{o({kind:"hidden"})}},[c]);m.useEffect(()=>{u()},[u]);const d=m.useCallback(async()=>{o({kind:"working"});try{const p=await c("/api/settings/migration-perform",{method:"POST",headers:{"Content-Type":"application/json"}});if(!p.ok){o({kind:"error",message:`Migration failed (${p.status})`});return}const y=await p.json().catch(()=>({migrated:[]}));t==null||t(y.migrated??[]),await u()}catch(p){o({kind:"error",message:p.message})}},[c,u,t]),h=m.useCallback(async()=>{o({kind:"hidden"});try{await c("/api/settings/migration-acknowledge",{method:"POST",headers:{"Content-Type":"application/json"}})}catch{}},[c]);if(s.kind==="loading"||s.kind==="hidden")return null;if(s.kind==="error")return a.jsxs("div",{role:"status","data-testid":"migration-banner",style:{padding:"10px 12px",borderRadius:6,background:"color-mix(in srgb, var(--danger, #b33) 15%, transparent)",color:"var(--text-primary)",fontSize:12,marginBottom:12,display:"flex",alignItems:"center",gap:8},children:[a.jsx("span",{style:{flex:1},children:s.message}),a.jsx("button",{type:"button",onClick:()=>void u(),"data-testid":"migration-retry",style:yd,children:"Retry"})]});const g=s.kind==="working";return a.jsxs("div",{role:"note","data-testid":"migration-banner",style:{padding:"10px 12px",borderRadius:6,background:"color-mix(in srgb, var(--accent, var(--color-accent)) 12%, transparent)",color:"var(--text-primary)",fontSize:12,marginBottom:12,display:"flex",alignItems:"center",gap:8},children:[a.jsxs("div",{style:{flex:1},children:[a.jsx("strong",{style:{display:"block",marginBottom:2},children:"Migrate from macOS Keychain"}),a.jsx("span",{style:{color:"var(--text-muted, var(--text-tertiary))"},children:"We found stored credentials from a previous vskill version. Import them into the new on-disk store."})]}),a.jsx("button",{type:"button",onClick:()=>void d(),disabled:g,"data-testid":"migration-migrate",style:{...yd,background:"var(--accent, var(--color-accent))",color:"white",opacity:g?.6:1},children:g?"Importing…":"Migrate"}),a.jsx("button",{type:"button",onClick:()=>void h(),"data-testid":"migration-dismiss",style:{...yd,background:"transparent",border:"none",color:"var(--text-muted, var(--text-tertiary))",textDecoration:"underline",padding:"4px 6px"},children:"Dismiss for 30 days"})]})}const yd={padding:"4px 10px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},JS=[{id:"anthropic",name:te.providers.anthropic.name,keyIssuanceUrl:te.providers.anthropic.keyIssuanceUrl,prefix:te.providers.anthropic.keyPrefix,placeholder:`Paste ${te.providers.anthropic.name} key`},{id:"openai",name:te.providers.openai.name,keyIssuanceUrl:te.providers.openai.keyIssuanceUrl,prefix:te.providers.openai.keyPrefix,placeholder:te.providers.openai.pastePlaceholder},{id:"openrouter",name:te.providers.openrouter.name,keyIssuanceUrl:te.providers.openrouter.keyIssuanceUrl,prefix:te.providers.openrouter.keyPrefix,placeholder:`Paste ${te.providers.openrouter.name} key`}];function e2(t){const r=Date.now()-new Date(t).getTime();return r<6e4?"just now":r<36e5?`${Math.round(r/6e4)}m ago`:r<864e5?`${Math.round(r/36e5)}h ago`:new Date(t).toLocaleString()}function Nv({open:t,onClose:r,initialProvider:s,onToast:o}){const{state:c,save:u,remove:d,refresh:h}=QS(),g=m.useRef(null),p=m.useRef(null),[y,v]=m.useState(null);m.useEffect(()=>{if(!t)return;let k=!1;return(async()=>{try{const S=await fetch("/api/settings/storage-path");if(!S.ok)throw new Error(`GET /api/settings/storage-path returned ${S.status}`);const w=await S.json();k||v(w.path??null)}catch{k||v(null)}})(),()=>{k=!0}},[t]),m.useEffect(()=>{if(!t)return;const k=document.activeElement,S=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(S),(w=k==null?void 0:k.focus)==null||w.call(k)}},[t,s]),m.useEffect(()=>{if(!t)return;const k=S=>{if(S.key==="Escape"){S.preventDefault(),r();return}if(S.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];S.shiftKey&&document.activeElement===C?(S.preventDefault(),T.focus()):!S.shiftKey&&document.activeElement===T&&(S.preventDefault(),C.focus())}};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[t,r]);const b=m.useCallback(async()=>{var k,S;if(y)try{await((S=(k=navigator.clipboard)==null?void 0:k.writeText)==null?void 0:S.call(k,y)),o==null||o(te.settings.pathCopied)}catch{}},[o,y]);return t?a.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"settings-modal-title","data-testid":"settings-modal",style:{position:"fixed",inset:0,background:"color-mix(in srgb, black 40%, transparent)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},onClick:k=>{k.target===k.currentTarget&&r()},children:a.jsxs("div",{ref:g,style:{background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,width:560,maxHeight:"80vh",overflowY:"auto",padding:20,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",color:"var(--text-primary)"},onClick:k=>k.stopPropagation(),children:[a.jsx("h2",{id:"settings-modal-title",style:{margin:"0 0 16px 0",fontSize:16,fontWeight:600},children:te.settings.title}),a.jsx(ZS,{onMigrated:()=>{h()}}),a.jsx("div",{role:"note","data-testid":"settings-banner",style:{padding:"8px 12px",borderRadius:6,background:"color-mix(in srgb, var(--info, var(--accent-muted)) 20%, transparent)",color:"var(--text-primary)",fontSize:12,marginBottom:16},children:te.settings.banner}),a.jsxs("section",{"aria-labelledby":"settings-api-keys-title",style:{marginBottom:20},children:[a.jsx("h3",{id:"settings-api-keys-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:te.settings.sectionApiKeys}),JS.map(k=>a.jsx(t2,{providerId:k.id,providerName:k.name,keyIssuanceUrl:k.keyIssuanceUrl,prefix:k.prefix,placeholder:k.placeholder,metadata:c==null?void 0:c[k.id],onSave:async S=>{const w=await u(k.id,S);return o==null||o(te.settings.keySaved(k.name)),w},onRemove:async()=>{await d(k.id),o==null||o(te.settings.keyRemoved(k.name))},inputRef:k.id===(s??"anthropic")?p:void 0},k.id))]}),a.jsxs("div",{"data-testid":"settings-storage-path",style:{fontSize:11,color:"var(--text-muted, var(--text-tertiary))",fontStyle:"italic",display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[a.jsx("span",{style:{flex:1},children:y?te.settings.storagePath(y):te.settings.storagePathFallback}),a.jsx("button",{type:"button",onClick:b,disabled:!y,"data-testid":"settings-copy-path",style:{...Mr,opacity:y?1:.5,cursor:y?"pointer":"not-allowed"},children:te.settings.copyPath})]}),a.jsx("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end"},children:a.jsx("button",{type:"button",onClick:r,style:{padding:"6px 12px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:"Close"})})]})}):null}function t2({providerId:t,providerName:r,keyIssuanceUrl:s,prefix:o,placeholder:c,metadata:u,onSave:d,onRemove:h,inputRef:g}){const[p,y]=m.useState(""),[v,b]=m.useState(!1),[k,S]=m.useState(!1),[w,C]=m.useState(!1),[T,R]=m.useState(null),L=p.trim(),B=L.length===0,z=L.length>0&&!L.startsWith(o),F=m.useCallback(async()=>{if(B)return;S(!0);const N=L;y("");try{const _=await d(N);_.warning?R(_.warning):R(null)}finally{S(!1)}},[B,d,L]),E=m.useCallback(async()=>{var N;try{if(!((N=navigator.clipboard)!=null&&N.readText))return;const _=await navigator.clipboard.readText();y(_)}catch{}},[]),I=m.useCallback(async()=>{C(!1),await h()},[h]);return a.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:[a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a.jsx("strong",{style:{fontSize:13},children:r}),a.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",style:{fontSize:12,color:"var(--accent, var(--color-accent))"},children:"Get a key →"})]}),a.jsxs("div",{style:{display:"flex",gap:6},children:[a.jsx("input",{ref:g,type:v?"text":"password",value:p,onChange:N=>{y(N.target.value),R(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"}}),a.jsx("button",{type:"button",onClick:()=>b(!v),style:Mr,children:v?te.settings.hide:te.settings.show}),a.jsx("button",{type:"button",onClick:E,style:Mr,children:te.settings.paste})]}),z&&a.jsx("div",{role:"status","data-testid":`prefix-warn-${t}`,style:Xx,children:te.settings.prefixWarn(r)}),T&&a.jsx("div",{role:"status",style:Xx,children:T}),a.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[a.jsx("button",{type:"button",onClick:F,disabled:B||k,"data-testid":`save-${t}`,style:{...Mr,background:B?"var(--surface-2)":"var(--accent, var(--color-accent))",color:B?"var(--text-muted)":"white",cursor:B?"not-allowed":"pointer"},children:te.settings.save}),(u==null?void 0:u.stored)&&a.jsx(a.Fragment,{children:w?a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{fontSize:12},children:te.settings.removeConfirm(r)}),a.jsx("button",{type:"button",onClick:I,"data-testid":`remove-confirm-${t}`,style:{...Mr,background:"var(--danger, #b33)",color:"white"},children:"Confirm"}),a.jsx("button",{type:"button",onClick:()=>C(!1),style:Mr,children:"Cancel"})]}):a.jsx("button",{type:"button",onClick:()=>C(!0),"data-testid":`remove-${t}`,style:{...Mr,color:"var(--text-muted)"},children:te.settings.remove})}),a.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?te.settings.keyStoredAt(e2(u.updatedAt)):te.settings.noKey})]})]})}const Mr={padding:"4px 8px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},Xx={fontSize:11,color:"var(--warning, var(--text-muted))"};function n2(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function a2({onToast:t}){const{status:r,catalog:s,focusAgent:o,setActive:c}=yS({onStaleCatalog:(_,V)=>{const W=Math.round(V/6e4);t==null||t(`Using cached ${_} catalog (${W} min old)`)},onSetActiveError:_=>t==null?void 0:t(_)}),[u,d]=m.useState(!1),[h,g]=m.useState(!1),[p,y]=m.useState(),[v,b]=m.useState(null),[k,S]=m.useState("agents"),[w,C]=m.useState(0),T=m.useRef(null);m.useRef(null),m.useEffect(()=>{var _;s&&!v&&b(s.activeAgent??((_=s.agents[0])==null?void 0:_.id)??null)},[s,v]);const R=(s==null?void 0:s.agents)??[],L=m.useMemo(()=>R.find(_=>_.id===v)??R[0],[R,v]);m.useEffect(()=>{C(0)},[v]);const B=m.useCallback(()=>{var _;d(!0),S("agents"),b((s==null?void 0:s.activeAgent)??((_=R[0])==null?void 0:_.id)??null),C(0)},[s,R]),z=m.useCallback(()=>{var _;d(!1),(_=T.current)==null||_.focus()},[]);m.useEffect(()=>{const _=V=>{var Y;if(!(V.metaKey||V.ctrlKey)||V.key.toLowerCase()!=="k")return;const W=(Y=document.activeElement)==null?void 0:Y.tagName;W==="INPUT"||W==="TEXTAREA"||(V.preventDefault(),d(X=>!X))};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[]),m.useEffect(()=>{if(!u)return;const _=W=>{if(W.key==="Escape"){W.preventDefault(),z();return}if(W.key==="ArrowDown"){W.preventDefault(),V(1);return}if(W.key==="ArrowUp"){W.preventDefault(),V(-1);return}if(W.key==="ArrowRight"&&k==="agents"){W.preventDefault(),S("models"),C(Y=>{const X=((L==null?void 0:L.models.length)??1)-1;return Math.max(0,Math.min(Y,Math.max(0,X)))});return}if(W.key==="ArrowLeft"&&k==="models"){W.preventDefault(),S("agents");return}if(W.key==="Enter"){if(W.preventDefault(),k==="agents"&&L)S("models"),C(0);else if(k==="models"&&L){const Y=Math.max(0,Math.min(L.models.length-1,w)),X=L.models[Y];X&&(c(L.id,X.id),z())}return}};function V(W){if(k==="agents"){const Y=R.findIndex(H=>H.id===v),X=R[Math.max(0,Math.min(R.length-1,Y+W))];X&&(b(X.id),o(X.id));return}if(k==="models"&&L){const Y=L.models.length;if(Y===0)return;C(X=>{const H=X+W;return Math.max(0,Math.min(Y-1,H))})}}return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[u,k,R,v,L,w,z,o,c]);const F=m.useCallback(_=>{y(_==="anthropic"||_==="openrouter"?_:void 0),g(!0),d(!1)},[]),E=R.find(_=>_.id===(s==null?void 0:s.activeAgent)),I=E==null?void 0:E.models.find(_=>_.id===(s==null?void 0:s.activeModel)),N=m.useMemo(()=>{if(r!=="ready"||!s)return"Loading…";const _=(E==null?void 0:E.displayName)??"Agent",V=(I==null?void 0:I.displayName)??s.activeModel??"Model";return`${_} · ${V}`},[r,s,E,I]);return a.jsxs(a.Fragment,{children:[a.jsxs("button",{ref:T,type:"button","data-testid":"agent-model-picker-trigger",onClick:()=>u?z():B(),"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:[a.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}}),a.jsx("span",{children:N})]}),u&&typeof document<"u"&&Bo.createPortal(a.jsxs(r2,{reducedMotion:n2(),onClickOutside:z,children:[a.jsxs("div",{style:{display:"flex",height:440,maxHeight:"60vh"},children:[a.jsx(VS,{agents:R,activeAgentId:(s==null?void 0:s.activeAgent)??null,focusedAgentId:v,onFocus:_=>{b(_),o(_)},onSelect:_=>{b(_),o(_),S("models")},onOpenSettings:F}),L&&a.jsx(YS,{agent:L,activeModelId:(s==null?void 0:s.activeModel)??null,focusedIndex:k==="models"?w:-1,onSelect:_=>{c(L.id,_),z()},onOpenSettings:F})]}),a.jsxs("div",{style:{height:32,borderTop:"1px solid var(--border-default, var(--border-subtle))",padding:"0 12px",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},children:[a.jsx("button",{type:"button",onClick:()=>F(),"data-testid":"picker-footer-settings",style:{background:"transparent",border:"none",color:"var(--text-primary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:te.picker.settingsButton}),a.jsx("span",{style:{fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"},children:te.picker.footerHint})]})]}),document.body),a.jsx(Nv,{open:h,onClose:()=>g(!1),initialProvider:p,onToast:t})]})}function r2({children:t,reducedMotion:r,onClickOutside:s}){const o=m.useRef(null);return m.useEffect(()=>{const c=u=>{o.current&&!o.current.contains(u.target)&&s()};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]),a.jsxs("div",{ref:o,"data-testid":"agent-model-picker-popover",role:"dialog","aria-label":"Select agent and model",style:{position:"fixed",top:56,left:"50%",transform:"translateX(-50%)",width:720,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,overflow:"hidden",zIndex:90,animation:r?void 0:"agentPickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[t,a.jsx("style",{children:`@keyframes agentPickerFadeIn {
|
|
63
|
-
from { opacity: 0; transform: translateX(-50%) translateY(2px); }
|
|
64
|
-
to { opacity: 1; transform: translateX(-50%) translateY(0); }
|
|
65
|
-
}`})]})}function Qx(){typeof window>"u"||(window.location.hash="#/")}function l2({onHome:t}){const[r,s]=m.useState(!1),[o,c]=m.useState(!1),u=h=>{h.metaKey||h.ctrlKey||h.shiftKey||h.button!==0||(h.preventDefault(),Qx(),t==null||t())},d=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),Qx(),t==null||t())};return a.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:r?"2px solid var(--border-focus)":"none",outlineOffset:2,background:o?"color-mix(in srgb, var(--text-primary) 4%, transparent)":"transparent",transition:"background-color var(--duration-fast, 120ms) var(--ease-standard, ease)"},children:[a.jsx("span",{"aria-hidden":"true",style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:6,background:"color-mix(in srgb, var(--accent-surface) 20%, transparent)"},children:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent-surface)",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}),a.jsx("span",{style:{fontSize:13,fontWeight:600,letterSpacing:"-0.01em",color:"var(--text-primary)"},children:"Skill Studio"})]})}const s2="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",i2=m.lazy(()=>Io(()=>import("./UpdateDropdown-DRPVz-9R.js"),__vite__mapDeps([0,1])));function o2(){const{updateCount:t,updates:r,isRefreshingUpdates:s,refreshUpdates:o,selectSkill:c,updatesById:u}=Zn(),d=m.useMemo(()=>{if(!u||u.size===0)return;const S=new Map;for(const[w,C]of u)C.diffSummary&&S.set(w,C.diffSummary);return S.size>0?S:void 0},[u]),[h,g]=m.useState(!1),p=m.useRef(null),y=m.useCallback(()=>g(!1),[]),v=t>0?"var(--text-primary)":"var(--text-secondary)",b=t>9?"9+":String(t),k=t===0?"No updates available":`${t} updates available, open summary`;return a.jsxs("span",{"data-testid":"update-bell-anchor",style:{position:"relative",display:"inline-flex"},children:[a.jsxs("button",{ref:p,type:"button","data-testid":"update-bell","aria-label":k,"aria-haspopup":"dialog","aria-expanded":h,onClick:()=>g(S=>!S),style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",height:26,width:26,padding:0,borderRadius:4,border:"1px solid transparent",background:"transparent",color:v,cursor:"pointer"},children:[a.jsx("img",{src:s2,alt:"",width:18,height:18,style:{display:"block",opacity:t>0?1:.75}}),t>0&&a.jsx("span",{"data-testid":"update-bell-badge","aria-hidden":"true",style:{position:"absolute",top:-2,right:-2,minWidth:14,height:14,padding:"0 3px",borderRadius:999,background:"var(--color-own)",color:"var(--color-paper)",fontSize:9,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:600,lineHeight:1},children:b})]}),h&&a.jsx(m.Suspense,{fallback:a.jsx("span",{"data-testid":"update-bell-fallback",children:"Loading…"}),children:a.jsx(i2,{updates:r,isRefreshing:s,diffSummariesById:d,onRefresh:()=>o(),onSelectSkill:S=>{const w=S.name.split("/"),C=w.length>=2?w[w.length-2]:w[0],T=w[w.length-1];c({plugin:C,skill:T,origin:"installed"}),y()},onViewAll:()=>{window.location.hash="#/updates",y()},onClose:y,anchorRef:p})})]})}function Zx(t){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:navigate-scope",{detail:t}))}function c2({projectName:t,selected:r,onOpenPalette:s,onHome:o,projectPickerSlot:c,onRequestCreateSkill:u}){const d=r?r.origin==="installed"?"Project":"Skills":null;return a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,height:"100%",width:"100%",padding:"0 16px",fontFamily:"var(--font-sans)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexShrink:0},children:[a.jsx(l2,{onHome:o}),c?a.jsx("div",{style:{borderLeft:"1px solid var(--border-default)",paddingLeft:10,display:"flex",alignItems:"center"},children:c}):t&&a.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})]}),a.jsx("nav",{"aria-label":"Breadcrumb",style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:6,fontSize:12,color:"var(--text-secondary)"},children:r&&d&&a.jsxs(a.Fragment,{children:[a.jsx(Jx,{segment:"origin",onClick:()=>Zx({scope:"origin",origin:r.origin}),style:{textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:r.origin==="installed"?"var(--status-installed)":"var(--status-own)"},children:d}),a.jsx(eg,{}),a.jsx(Jx,{segment:"plugin",onClick:()=>Zx({scope:"plugin",plugin:r.plugin}),style:{fontFamily:"var(--font-mono)",fontSize:11},children:r.plugin}),a.jsx(eg,{}),a.jsx("span",{"data-breadcrumb-segment":"skill","aria-current":"page",style:{color:"var(--text-primary)",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.skill})]})}),a.jsxs("div",{"data-toprail-right":"true",style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[u&&a.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:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"New Skill"]}),a.jsx("span",{"data-slot":"agent-model-picker",style:{minWidth:200},children:a.jsx(a2,{})}),a.jsx("span",{"data-slot":"update-bell",style:{display:"inline-flex"},children:a.jsx(o2,{})}),a.jsx("button",{type:"button",onClick:s,"aria-label":"Open command palette",title:"Command palette (⌘K)",style:{display:"inline-flex",alignItems:"center",gap:6,height:26,padding:"0 10px",borderRadius:4,border:"1px solid var(--border-default)",background:"transparent",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono)",cursor:"pointer"},children:a.jsx("span",{children:"⌘K"})})]})]})}function Jx({segment:t,onClick:r,style:s,children:o}){return a.jsx("button",{type:"button","data-breadcrumb-segment":t,onClick:r,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",color:"var(--text-secondary)",fontFamily:"inherit",...s},onMouseEnter:c=>{c.currentTarget.style.color="var(--color-accent-ink)"},onMouseLeave:c=>{const u=(s==null?void 0:s.color)??"var(--text-secondary)";c.currentTarget.style.color=u},children:o})}function eg(){return a.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)",fontSize:10},children:"›"})}const Ho="vskill-theme";function Tv(t){return t==="light"||t==="dark"||t==="auto"?t:"auto"}function u2(t,r){return t==="light"||t==="dark"?t:r?"dark":"light"}function d2(t){try{const r=t.getItem(Ho);return Tv(r)}catch{return"auto"}}function f2(t,r){try{t.setItem(Ho,r)}catch{}}function p2(t,r,s){t.dataset.theme=s,t.dataset.themeMode=r}function m2(t){if(!t)return!1;try{return t("(prefers-color-scheme: dark)").matches}catch{return!1}}const Rv=m.createContext(null);function h2({storage:t,matchMedia:r,target:s,children:o}){const c=t??(typeof window<"u"?window.localStorage:void 0),u=r??(typeof window<"u"?window.matchMedia.bind(window):void 0),d=s??(typeof document<"u"?document.documentElement:void 0),[h,g]=m.useState(()=>c?d2(c):"auto"),[p,y]=m.useState(()=>m2(u)),v=m.useMemo(()=>u2(h,p),[h,p]);m.useEffect(()=>{d&&p2(d,h,v)},[d,h,v]),m.useEffect(()=>{if(!u)return;const S=u("(prefers-color-scheme: dark)"),w=T=>y(T.matches);if(typeof S.addEventListener=="function")return S.addEventListener("change",w),()=>S.removeEventListener("change",w);const C=S;return C.addListener(w),()=>C.removeListener(w)},[u]),m.useEffect(()=>{if(typeof window>"u")return;const S=w=>{w.key===Ho&&g(Tv(w.newValue))};return window.addEventListener("storage",S),()=>window.removeEventListener("storage",S)},[]),m.useEffect(()=>{if(!u||!d)return;let S;try{S=u("(prefers-contrast: more)")}catch{return}const w=R=>{R?d.dataset.contrast="more":d.dataset.contrast==="more"&&delete d.dataset.contrast};w(S.matches);const C=R=>w(R.matches);if(typeof S.addEventListener=="function")return S.addEventListener("change",C),()=>S.removeEventListener("change",C);const T=S;return T.addListener(C),()=>T.removeListener(C)},[u,d]);const b=m.useCallback(S=>{g(S),c&&f2(c,S)},[c]),k=m.useMemo(()=>({mode:h,resolvedTheme:v,setTheme:b}),[h,v,b]);return a.jsx(Rv.Provider,{value:k,children:o})}function Av(){const t=m.useContext(Rv);if(!t)throw new Error("useTheme must be used inside <ThemeProvider>. Wrap the app root in main.tsx.");return t}const tg=["claude-cli","anthropic","openrouter","ollama","lm-studio"];function x2(t){const r=new Map(t.map(o=>[o.id,o])),s=[];for(const o of tg){const c=r.get(o);c&&s.push(c)}for(const o of t)tg.includes(o.id)||s.push(o);return s}function g2(t){const[r,s]=m.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(`(max-width: ${t}px)`).matches);return m.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]),r}function v2({providers:t,onOpenSettings:r,onOpenInstallHelp:s}){const o=x2(t),c=g2(640),[u,d]=m.useState(!1),h=m.useCallback(g=>{g.available||g.kind==="api-key"?r==null||r(g.id):s==null||s(g.id)},[r,s]);if(c){const g=o.filter(p=>p.available).length;return a.jsxs("div",{"data-testid":"providers-segment",style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[a.jsx("button",{type:"button","data-testid":"providers-summary",onClick:()=>d(!u),"aria-label":te.statusBar.providerSummary(g,o.length),style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:te.statusBar.providerSummary(g,o.length)}),u&&a.jsx("div",{role:"menu",style:{position:"absolute",bottom:"120%",right:0,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,padding:6,minWidth:180,display:"flex",flexDirection:"column",gap:2,zIndex:80},children:o.map(p=>a.jsx(ng,{p,onClick:h},p.id))})]})}return a.jsx("div",{"data-testid":"providers-segment",style:{display:"inline-flex",alignItems:"center",gap:4},children:o.map(g=>a.jsx(ng,{p:g,onClick:h,compact:!0},g.id))})}function ng({p:t,onClick:r,compact:s}){const o=t.available?te.statusBar.unlocked(t.label):t.kind==="cli-install"?te.statusBar.lockedCli(t.label):te.statusBar.locked(t.label);return a.jsxs("button",{type:"button","data-testid":`provider-glyph-${t.id}`,"data-available":t.available,"aria-label":o,title:o,onClick:()=>r(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:[a.jsx(qd,{unlocked:t.available,size:10}),!s&&a.jsx("span",{children:t.label})]})}function y2(){try{return typeof localStorage>"u"?null:localStorage.getItem(Ho)}catch{return null}}function b2({projectPath:t,modelName:r,health:s="ok",onPathClick:o,providers:c,onOpenProviderSettings:u,onOpenProviderInstallHelp:d}){const{mode:h,resolvedTheme:g,setTheme:p}=Av(),v=y2()==="auto",b=j2(h,g,v),k=s==="down"||s==="degraded"?"var(--status-own)":"var(--status-installed)";return a.jsxs("div",{role:"contentinfo",style:{display:"flex",alignItems:"center",gap:12,height:"100%",width:"100%",padding:"0 12px",fontSize:11,fontFamily:"var(--font-sans)",color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[a.jsx("span",{title:r??"",style:{fontFamily:"var(--font-mono)"},children:r??"—"}),a.jsx(ag,{}),a.jsxs("span",{"aria-label":`Health: ${s}`,style:{display:"inline-flex",alignItems:"center",gap:6},children:[a.jsx(S2,{color:k}),a.jsx("span",{style:{textTransform:"capitalize"},children:s})]}),c&&c.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(ag,{}),a.jsx(v2,{providers:c,onOpenSettings:u,onOpenInstallHelp:d})]}),a.jsx("div",{style:{flex:1}}),a.jsxs("button",{type:"button","data-testid":"theme-toggle",onClick:()=>p(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:[a.jsx(k2,{mode:h}),a.jsx("span",{style:{textTransform:"capitalize"},children:h})]})]})}function j2(t,r,s){return t==="light"?"dark":t==="dark"?"auto":s?"light":r==="light"?"dark":"light"}function S2({color:t}){return a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:t,display:"inline-block",flexShrink:0}})}function ag(){return a.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)"},children:"|"})}function k2({mode:t}){return t==="dark"?a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}):t==="light"?a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"4"}),a.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}):a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"9"}),a.jsx("path",{d:"M12 3a9 9 0 0 0 0 18z",fill:"currentColor"})]})}const ko=new Map,Lr=new Map,As=new Map;function on(t){ko.delete(t),Lr.delete(t);const r=As.get(t);if(r)for(const s of r)s()}function Ml(t,r,s={}){const{ttl:o=3e4,enabled:c=!0}=s,[,u]=m.useState(0),d=m.useRef(!0),h=m.useRef(t);h.current=t;const g=()=>on(t);m.useEffect(()=>(d.current=!0,()=>{d.current=!1}),[]),m.useEffect(()=>{if(!c)return;const b=()=>{d.current&&u(k=>k+1)};return As.has(t)||As.set(t,new Set),As.get(t).add(b),()=>{var k;(k=As.get(t))==null||k.delete(b)}},[t,c]),m.useEffect(()=>{if(!c)return;const b=ko.get(t);if(!(!b||Date.now()-b.fetchedAt>o))return;if(Lr.has(t)){const C=Lr.get(t),T=()=>{d.current&&h.current===t&&u(R=>R+1)};C.subscribers.push(T);return}const S={promise:Promise.resolve(),subscribers:[]},w=r().then(C=>{ko.set(t,{data:C,fetchedAt:Date.now()}),Lr.delete(t),d.current&&h.current===t&&u(T=>T+1);for(const T of S.subscribers)T()},C=>{Lr.delete(t),d.current&&h.current===t&&u(T=>T+1);for(const T of S.subscribers)T();throw C});S.promise=w,Lr.set(t,S)},[t,r,o,c]);const p=ko.get(t),y=c&&!p&&Lr.has(t);return{data:p==null?void 0:p.data,loading:y||c&&!p,error:void 0,revalidate:g}}const Uo=0,cr=1,Ll=2,Mv=4;function rg(t){return()=>t}function w2(t){t()}function Lv(t,r){return s=>t(r(s))}function lg(t,r){return()=>t(r)}function C2(t,r){return s=>t(r,s)}function hf(t){return t!==void 0}function E2(...t){return()=>{t.map(w2)}}function zl(){}function $o(t,r){return r(t),t}function N2(t,r){return r(t)}function kt(...t){return t}function lt(t,r){return t(cr,r)}function Fe(t,r){t(Uo,r)}function xf(t){t(Ll)}function Et(t){return t(Mv)}function Te(t,r){return lt(t,C2(r,Uo))}function Kn(t,r){const s=t(cr,o=>{s(),r(o)});return s}function sg(t){let r,s;return o=>c=>{r=c,s&&clearTimeout(s),s=setTimeout(()=>{o(r)},t)}}function zv(t,r){return t===r}function St(t=zv){let r;return s=>o=>{t(r,o)||(r=o,s(o))}}function _e(t){return r=>s=>{t(s)&&r(s)}}function Se(t){return r=>Lv(r,t)}function ra(t){return r=>()=>{r(t)}}function pe(t,...r){const s=T2(...r);return((o,c)=>{switch(o){case Ll:xf(t);return;case cr:return lt(t,s(c))}})}function la(t,r){return s=>o=>{s(r=t(r,o))}}function Dr(t){return r=>s=>{t>0?t--:r(s)}}function Ra(t){let r=null,s;return o=>c=>{r=c,!s&&(s=setTimeout(()=>{s=void 0,o(r)},t))}}function Ge(...t){const r=new Array(t.length);let s=0,o=null;const c=2**t.length-1;return t.forEach((u,d)=>{const h=2**d;lt(u,g=>{const p=s;s|=h,r[d]=g,p!==c&&s===c&&o&&(o(),o=null)})}),u=>d=>{const h=()=>{u([d].concat(r))};s===c?h():o=h}}function T2(...t){return r=>t.reduceRight(N2,r)}function R2(t){let r,s;const o=()=>r==null?void 0:r();return function(c,u){switch(c){case cr:return u?s===u?void 0:(o(),s=u,r=lt(t,u),r):(o(),zl);case Ll:o(),s=null;return}}}function ge(t){let r=t;const s=Qe();return((o,c)=>{switch(o){case Uo:r=c;break;case cr:{c(r);break}case Mv:return r}return s(o,c)})}function tn(t,r){return $o(ge(r),s=>Te(t,s))}function Qe(){const t=[];return((r,s)=>{switch(r){case Uo:t.slice().forEach(o=>{o(s)});return;case Ll:t.splice(0,t.length);return;case cr:return t.push(s),()=>{const o=t.indexOf(s);o>-1&&t.splice(o,1)}}})}function En(t){return $o(Qe(),r=>Te(t,r))}function nt(t,r=[],{singleton:s}={singleton:!0}){return{constructor:t,dependencies:r,id:A2(),singleton:s}}const A2=()=>Symbol();function M2(t){const r=new Map,s=({constructor:o,dependencies:c,id:u,singleton:d})=>{if(d&&r.has(u))return r.get(u);const h=o(c.map(g=>s(g)));return d&&r.set(u,h),h};return s(t)}function Bt(...t){const r=Qe(),s=new Array(t.length);let o=0;const c=2**t.length-1;return t.forEach((u,d)=>{const h=2**d;lt(u,g=>{s[d]=g,o|=h,o===c&&Fe(r,s)})}),function(u,d){switch(u){case Ll:{xf(r);return}case cr:return o===c&&d(s),lt(r,d)}}}function De(t,r=zv){return pe(t,St(r))}function Yd(...t){return function(r,s){switch(r){case Ll:return;case cr:return E2(...t.map(o=>lt(o,s)))}}}const Ut={DEBUG:0,INFO:1,WARN:2,ERROR:3},L2={[Ut.DEBUG]:"debug",[Ut.ERROR]:"error",[Ut.INFO]:"log",[Ut.WARN]:"warn"},z2=()=>typeof globalThis>"u"?window:globalThis,ur=nt(()=>{const t=ge(Ut.ERROR);return{log:ge((r,s,o=Ut.INFO)=>{const c=z2().VIRTUOSO_LOG_LEVEL??Et(t);o>=c&&console[L2[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",r,s)}),logLevel:t}},[],{singleton:!0});function Or(t,r,s){return gf(t,r,s).callbackRef}function gf(t,r,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&&r?(u==null||u.observe(d),o.current=d):(o.current&&(u==null||u.unobserve(o.current)),o.current=null)},{callbackRef:c,ref:o}}function D2(t,r,s,o,c,u,d,h,g){const p=Ne.useCallback(y=>{const v=_2(y.children,r,h?"offsetWidth":"offsetHeight",c);let b=y.parentElement;for(;b.dataset.virtuosoScroller===void 0;)b=b.parentElement;const k=b.lastElementChild.dataset.viewportType==="window";let S;k&&(S=b.ownerDocument.defaultView);const w=d?h?d.scrollLeft:d.scrollTop:k?h?S.scrollX||S.document.documentElement.scrollLeft:S.scrollY||S.document.documentElement.scrollTop:h?b.scrollLeft:b.scrollTop,C=d?h?d.scrollWidth:d.scrollHeight:k?h?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight:h?b.scrollWidth:b.scrollHeight,T=d?h?d.offsetWidth:d.offsetHeight:k?h?S.innerWidth:S.innerHeight:h?b.offsetWidth:b.offsetHeight;o({scrollHeight:C,scrollTop:Math.max(w,0),viewportHeight:T}),u==null||u(h?ig("column-gap",getComputedStyle(y).columnGap,c):ig("row-gap",getComputedStyle(y).rowGap,c)),v!==null&&t(v)},[t,r,c,u,d,o,h]);return gf(p,s,g)}function _2(t,r,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),p=parseFloat(h.dataset.knownSize),y=r(h,s);if(y===0&&o("Zero-sized element, this should not happen",{child:h},Ut.ERROR),y===p)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 ig(t,r,s){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&s(`${t} was not resolved to pixel value correctly`,r,Ut.WARN),r==="normal"?0:parseInt(r??"0",10)}function Dv(t,r,s){const o=Ne.useRef(null),c=Ne.useCallback(g=>{if(!(g!=null&&g.offsetParent))return;const p=g.getBoundingClientRect(),y=p.width;let v,b;if(r){const k=r.getBoundingClientRect(),S=p.top-k.top;b=k.height-Math.max(0,S),v=S+r.scrollTop}else{const k=d.current.ownerDocument.defaultView;b=k.innerHeight-Math.max(0,p.top),v=p.top+k.scrollY}o.current={listHeight:p.height,offsetTop:v,visibleHeight:b,visibleWidth:y},t(o.current)},[t,r]),{callbackRef:u,ref:d}=gf(c,!0,s),h=Ne.useCallback(()=>{c(d.current)},[c,d]);return Ne.useEffect(()=>{var p;if(r){r.addEventListener("scroll",h);const y=new ResizeObserver(()=>{requestAnimationFrame(h)});return y.observe(r),()=>{r.removeEventListener("scroll",h),y.unobserve(r)}}const g=(p=d.current)==null?void 0:p.ownerDocument.defaultView;return g==null||g.addEventListener("scroll",h),g==null||g.addEventListener("resize",h),()=>{g==null||g.removeEventListener("scroll",h),g==null||g.removeEventListener("resize",h)}},[h,r,d]),u}const cn=nt(()=>{const t=Qe(),r=Qe(),s=ge(0),o=Qe(),c=ge(0),u=Qe(),d=Qe(),h=ge(0),g=ge(0),p=ge(0),y=ge(0),v=Qe(),b=Qe(),k=ge(!1),S=ge(!1),w=ge(!1);return Te(pe(t,Se(({scrollTop:C})=>C)),r),Te(pe(t,Se(({scrollHeight:C})=>C)),d),Te(r,c),{deviation:s,fixedFooterHeight:p,fixedHeaderHeight:g,footerHeight:y,headerHeight:h,horizontalDirection:S,scrollBy:b,scrollContainerState:t,scrollHeight:d,scrollingInProgress:k,scrollTo:v,scrollTop:r,skipAnimationFrameInResizeObserver:w,smoothScrollTargetReached:o,statefulScrollTop:c,viewportHeight:u}},[],{singleton:!0}),Bs={lvl:0};function _v(t,r){const s=t.length;if(s===0)return[];let{index:o,value:c}=r(t[0]);const u=[];for(let d=1;d<s;d++){const{index:h,value:g}=r(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===Bs}function Is(t,r){if(!ht(t))return r===t.k?t.v:r<t.k?Is(t.l,r):Is(t.r,r)}function Qn(t,r,s="k"){if(ht(t))return[-1/0,void 0];if(Number(t[s])===r)return[t.k,t.v];if(Number(t[s])<r){const o=Qn(t.r,r,s);return o[0]===-1/0?[t.k,t.v]:o}return Qn(t.l,r,s)}function Cn(t,r,s){return ht(t)?Iv(r,s,1):r===t.k?Ht(t,{k:r,v:s}):r<t.k?og(Ht(t,{l:Cn(t.l,r,s)})):og(Ht(t,{r:Cn(t.r,r,s)}))}function Cl(){return Bs}function El(t,r,s){if(ht(t))return[];const o=Qn(t,r)[0];return O2(Xd(t,o,s))}function Kd(t,r){if(ht(t))return Bs;const{k:s,l:o,r:c}=t;if(r===s){if(ht(o))return c;if(ht(c))return o;const[u,d]=Bv(o);return wo(Ht(t,{k:u,l:Ov(o),v:d}))}return r<s?wo(Ht(t,{l:Kd(o,r)})):wo(Ht(t,{r:Kd(c,r)}))}function zr(t){return ht(t)?[]:[...zr(t.l),{k:t.k,v:t.v},...zr(t.r)]}function Xd(t,r,s){if(ht(t))return[];const{k:o,l:c,r:u,v:d}=t;let h=[];return o>r&&(h=h.concat(Xd(c,r,s))),o>=r&&o<=s&&h.push({k:o,v:d}),o<=s&&(h=h.concat(Xd(u,r,s))),h}function wo(t){const{l:r,lvl:s,r:o}=t;if(o.lvl>=s-1&&r.lvl>=s-1)return t;if(s>o.lvl+1){if(bd(r))return Hv(Ht(t,{lvl:s-1}));if(!ht(r)&&!ht(r.r))return Ht(r.r,{l:Ht(r,{r:r.r.l}),lvl:s,r:Ht(t,{l:r.r.r,lvl:s-1})});throw new Error("Unexpected empty nodes")}if(bd(t))return Qd(Ht(t,{lvl:s-1}));if(!ht(o)&&!ht(o.l)){const c=o.l,u=bd(c)?o.lvl-1:o.lvl;return Ht(c,{l:Ht(t,{lvl:s-1,r:c.l}),lvl:c.lvl+1,r:Qd(Ht(o,{l:c.r,lvl:u}))})}throw new Error("Unexpected empty nodes")}function Ht(t,r){return Iv(r.k!==void 0?r.k:t.k,r.v!==void 0?r.v:t.v,r.lvl!==void 0?r.lvl:t.lvl,r.l!==void 0?r.l:t.l,r.r!==void 0?r.r:t.r)}function Ov(t){return ht(t.r)?t.l:wo(Ht(t,{r:Ov(t.r)}))}function bd(t){return ht(t)||t.lvl>t.r.lvl}function Bv(t){return ht(t.r)?[t.k,t.v]:Bv(t.r)}function Iv(t,r,s,o=Bs,c=Bs){return{k:t,l:o,lvl:s,r:c,v:r}}function og(t){return Qd(Hv(t))}function Hv(t){const{l:r}=t;return!ht(r)&&r.lvl===t.lvl?Ht(r,{r:Ht(t,{l:r.r})}):t}function Qd(t){const{lvl:r,r:s}=t;return!ht(s)&&!ht(s.r)&&s.lvl===r&&s.r.lvl===r?Ht(s,{l:Ht(t,{r:s.l}),lvl:r+1}):t}function O2(t){return _v(t,({k:r,v:s})=>({index:r,value:s}))}function Uv(t,r){return!!(t&&t.startIndex===r.startIndex&&t.endIndex===r.endIndex)}function Hs(t,r){return!!(t&&t[0]===r[0]&&t[1]===r[1])}const vf=nt(()=>({recalcInProgress:ge(!1)}),[],{singleton:!0});function $v(t,r,s){return t[Ro(t,r,s)]}function Ro(t,r,s,o=0){let c=t.length-1;for(;o<=c;){const u=Math.floor((o+c)/2),d=t[u],h=s(d,r);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 ${r}`)}function B2(t,r,s,o){const c=Ro(t,r,o),u=Ro(t,s,o,c);return t.slice(c,u+1)}function ir(t,r){return Math.round(t.getBoundingClientRect()[r])}function Vo(t){return!ht(t.groupOffsetTree)}function yf({index:t},r){return r===t?0:r<t?-1:1}function I2(){return{groupIndices:[],groupOffsetTree:Cl(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Cl()}}function H2(t,r){let s=ht(t)?0:1/0;for(const o of r){const{endIndex:c,size:u,startIndex:d}=o;if(s=Math.min(s,d),ht(t)){t=Cn(t,0,u);continue}const h=El(t,d-1,c+1);if(h.some(W2(o)))continue;let g=!1,p=!1;for(const{end:y,start:v,value:b}of h)g?(c>=v||u===b)&&(t=Kd(t,v)):(p=b!==u,g=!0),y>c&&c>=v&&b!==u&&(t=Cn(t,c+1,b));p&&(t=Cn(t,d,u))}return[t,s]}function U2(t){return typeof t.groupIndex<"u"}function $2({offset:t},r){return r===t?0:r<t?-1:1}function Us(t,r,s){if(r.length===0)return 0;const{index:o,offset:c,size:u}=$v(r,t,yf),d=t-o,h=u*d+(d-1)*s+c;return h>0?h+s:h}function Vv(t,r){if(!Vo(r))return t;let s=0;for(;r.groupIndices[s]<=t+s;)s++;return t+s}function Pv(t,r,s){if(U2(t))return r.groupIndices[t.groupIndex]+1;const o=t.index==="LAST"?s:t.index;let c=Vv(o,r);return c=Math.max(0,c,Math.min(s,c)),c}function V2(t,r,s,o=0){return o>0&&(r=Math.max(r,$v(t,o,yf).offset)),_v(B2(t,r,s,$2),G2)}function P2(t,[r,s,o,c]){r.length>0&&o("received item sizes",r,Ut.DEBUG);const u=t.sizeTree;let d=u,h=0;if(s.length>0&&ht(u)&&r.length===2){const b=r[0].size,k=r[1].size;d=s.reduce((S,w)=>Cn(Cn(S,w,b),w+1,k),d)}else[d,h]=H2(d,r);if(d===u)return t;const{lastIndex:g,lastOffset:p,lastSize:y,offsetTree:v}=Zd(t.offsetTree,h,d,c);return{groupIndices:s,groupOffsetTree:s.reduce((b,k)=>Cn(b,k,Us(k,v,c)),Cl()),lastIndex:g,lastOffset:p,lastSize:y,offsetTree:v,sizeTree:d}}function F2(t){return zr(t).map(({k:r,v:s},o,c)=>{const u=c[o+1];return{endIndex:u!==void 0?u.k-1:1/0,size:s,startIndex:r}})}function cg(t,r){let s=0,o=0;for(;s<t;)s+=r[o+1]-r[o]-1,o++;return o-(s===t?0:1)}function Zd(t,r,s,o){let c=t,u=0,d=0,h=0,g=0;if(r!==0){g=Ro(c,r-1,yf),h=c[g].offset;const p=Qn(s,r-1);u=p[0],d=p[1],c.length&&c[g].size===Qn(s,r)[1]&&(g-=1),c=c.slice(0,g+1)}else c=[];for(const{start:p,value:y}of El(s,r,1/0)){const v=p-u,b=v*d+h+v*o;c.push({index:p,offset:b,size:y}),u=p,h=b,d=y}return{lastIndex:u,lastOffset:h,lastSize:d,offsetTree:c}}function G2(t){return{index:t.index,value:t}}function W2(t){const{endIndex:r,size:s,startIndex:o}=t;return c=>c.start===o&&(c.end===r||c.end===1/0)&&c.value===s}const q2={offsetHeight:"height",offsetWidth:"width"},ia=nt(([{log:t},{recalcInProgress:r}])=>{const s=Qe(),o=Qe(),c=tn(o,0),u=Qe(),d=Qe(),h=ge(0),g=ge([]),p=ge(void 0),y=ge(void 0),v=ge(void 0),b=ge(void 0),k=ge((E,I)=>ir(E,q2[I])),S=ge(void 0),w=ge(0),C=I2(),T=tn(pe(s,Ge(g,t,w),la(P2,C),St()),C),R=tn(pe(g,St(),la((E,I)=>({current:I,prev:E.current}),{current:[],prev:[]}),Se(({prev:E})=>E)),[]);Te(pe(g,_e(E=>E.length>0),Ge(T,w),Se(([E,I,N])=>{const _=E.reduce((V,W,Y)=>Cn(V,W,Us(W,I.offsetTree,N)||Y),Cl());return{...I,groupIndices:E,groupOffsetTree:_}})),T),Te(pe(o,Ge(T),_e(([E,{lastIndex:I}])=>E<I),Se(([E,{lastIndex:I,lastSize:N}])=>[{endIndex:I,size:N,startIndex:E}])),s),Te(p,y);const L=tn(pe(p,Se(E=>E===void 0)),!0);Te(pe(y,_e(E=>E!==void 0&&ht(Et(T).sizeTree)),Se(E=>{const I=Et(v),N=Et(g).length>0;return I!==void 0&&I!==0?N?[{endIndex:0,size:I,startIndex:0},{endIndex:1,size:E,startIndex:1}]:[]:[{endIndex:0,size:E,startIndex:0}]})),s),Te(pe(b,_e(E=>E!==void 0&&E.length>0&&ht(Et(T).sizeTree)),Se(E=>{const I=[];let N=E[0],_=0;for(let V=1;V<E.length;V++){const W=E[V];W!==N&&(I.push({endIndex:V-1,size:N,startIndex:_}),N=W,_=V)}return I.push({endIndex:E.length-1,size:N,startIndex:_}),I})),s),Te(pe(g,Ge(v,y),_e(([,E,I])=>E!==void 0&&I!==void 0),Se(([E,I,N])=>{const _=[];for(let V=0;V<E.length;V++){const W=E[V],Y=E[V+1];_.push({startIndex:W,endIndex:W,size:I}),Y!==void 0&&_.push({startIndex:W+1,endIndex:Y-1,size:N})}return _})),s);const B=En(pe(s,Ge(T),la(({sizes:E},[I,N])=>({changed:N!==E,sizes:N}),{changed:!1,sizes:C}),Se(E=>E.changed)));lt(pe(h,la((E,I)=>({diff:E.prev-I,prev:I}),{diff:0,prev:0}),Se(E=>E.diff)),E=>{const{groupIndices:I}=Et(T);if(E>0)Fe(r,!0),Fe(u,E+cg(E,I));else if(E<0){const N=Et(R);N.length>0&&(E-=cg(-E,N)),Fe(d,E)}}),lt(pe(h,Ge(t)),([E,I])=>{E<0&&I("`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},Ut.ERROR)});const z=En(u);Te(pe(u,Ge(T),Se(([E,I])=>{const N=I.groupIndices.length>0,_=[],V=I.lastSize;if(N){const W=Is(I.sizeTree,0);let Y=0,X=0;for(;Y<E;){const M=I.groupIndices[X],O=I.groupIndices.length===X+1?1/0:I.groupIndices[X+1]-M-1;_.push({endIndex:M,size:W,startIndex:M}),_.push({endIndex:M+1+O-1,size:V,startIndex:M+1}),X++,Y+=O+1}const H=zr(I.sizeTree);return Y!==E&&H.shift(),H.reduce((M,{k:O,v:U})=>{let G=M.ranges;return M.prevSize!==0&&(G=[...M.ranges,{endIndex:O+E-1,size:M.prevSize,startIndex:M.prevIndex}]),{prevIndex:O+E,prevSize:U,ranges:G}},{prevIndex:E,prevSize:0,ranges:_}).ranges}return zr(I.sizeTree).reduce((W,{k:Y,v:X})=>({prevIndex:Y+E,prevSize:X,ranges:[...W.ranges,{endIndex:Y+E-1,size:W.prevSize,startIndex:W.prevIndex}]}),{prevIndex:0,prevSize:V,ranges:[]}).ranges})),s);const F=En(pe(d,Ge(T,w),Se(([E,{offsetTree:I},N])=>{const _=-E;return Us(_,I,N)})));return Te(pe(d,Ge(T,w),Se(([E,I,N])=>{if(I.groupIndices.length>0){if(ht(I.sizeTree))return I;let V=Cl();const W=Et(R);let Y=0,X=0,H=0;for(;Y<-E;){H=W[X];const M=W[X+1]-H-1;X++,Y+=M+1}if(V=zr(I.sizeTree).reduce((M,{k:O,v:U})=>Cn(M,Math.max(0,O+E),U),V),Y!==-E){const M=Is(I.sizeTree,H);V=Cn(V,0,M);const O=Qn(I.sizeTree,-E+1)[1];V=Cn(V,1,O)}return{...I,sizeTree:V,...Zd(I.offsetTree,0,V,N)}}const _=zr(I.sizeTree).reduce((V,{k:W,v:Y})=>Cn(V,Math.max(0,W+E),Y),Cl());return{...I,sizeTree:_,...Zd(I.offsetTree,0,_,N)}})),T),{beforeUnshiftWith:z,data:S,defaultItemSize:y,firstItemIndex:h,fixedItemSize:p,fixedGroupSize:v,gap:w,groupIndices:g,heightEstimates:b,itemSize:k,listRefresh:B,shiftWith:d,shiftWithOffset:F,sizeRanges:s,sizes:T,statefulTotalCount:c,totalCount:o,trackItemSizes:L,unshiftWith:u}},kt(ur,vf),{singleton:!0});function Y2(t){return t.reduce((r,s)=>(r.groupIndices.push(r.totalCount),r.totalCount+=s+1,r),{groupIndices:[],totalCount:0})}const Fv=nt(([{groupIndices:t,sizes:r,totalCount:s},{headerHeight:o,scrollTop:c}])=>{const u=Qe(),d=Qe(),h=En(pe(u,Se(Y2)));return Te(pe(h,Se(g=>g.totalCount)),s),Te(pe(h,Se(g=>g.groupIndices)),t),Te(pe(Bt(c,r,o),_e(([g,p])=>Vo(p)),Se(([g,p,y])=>Qn(p.groupOffsetTree,Math.max(g-y,0),"v")[0]),St(),Se(g=>[g])),d),{groupCounts:u,topItemsIndexes:d}},kt(ia,cn)),dr=nt(([{log:t}])=>{const r=ge(!1),s=En(pe(r,_e(o=>o),St()));return lt(r,o=>{o&&Et(t)("props updated",{},Ut.DEBUG)}),{didMount:s,propsReady:r}},kt(ur),{singleton:!0}),K2=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Gv(t){const r=typeof t=="number"?{index:t}:t;return r.align||(r.align="start"),(!r.behavior||!K2)&&(r.behavior="auto"),r.offset===void 0&&(r.offset=0),r}const Ws=nt(([{gap:t,listRefresh:r,sizes:s,totalCount:o},{fixedFooterHeight:c,fixedHeaderHeight:u,footerHeight:d,headerHeight:h,scrollingInProgress:g,scrollTo:p,smoothScrollTargetReached:y,viewportHeight:v},{log:b}])=>{const k=Qe(),S=Qe(),w=ge(0);let C=null,T=null,R=null;function L(){C!==null&&(C(),C=null),R!==null&&(R(),R=null),T&&(clearTimeout(T),T=null),Fe(g,!1)}return Te(pe(k,Ge(s,v,o,w,h,d,b),Ge(t,u,c),Se(([[B,z,F,E,I,N,_,V],W,Y,X])=>{const H=Gv(B),{align:M,behavior:O,offset:U}=H,G=E-1,ue=Pv(H,z,G);let D=Us(ue,z.offsetTree,W)+N;M==="end"?(D+=Y+Qn(z.sizeTree,ue)[1]-F+X,ue===G&&(D+=_)):M==="center"?D+=(Y+Qn(z.sizeTree,ue)[1]-F+X)/2:D-=I,U!==void 0&&U!==0&&(D+=U);const P=ee=>{L(),ee?(V("retrying to scroll to",{location:B},Ut.DEBUG),Fe(k,B)):(Fe(S,!0),V("list did not change, scroll successful",{},Ut.DEBUG))};if(L(),O==="smooth"){let ee=!1;R=lt(r,re=>{ee=ee||re}),C=Kn(y,()=>{P(ee)})}else C=Kn(pe(r,X2(150)),P);return T=setTimeout(()=>{L()},1200),Fe(g,!0),V("scrolling from index to",{behavior:O,index:ue,top:D},Ut.DEBUG),{behavior:O,top:D}})),p),{scrollTargetReached:S,scrollToIndex:k,topListHeight:w}},kt(ia,cn,ur),{singleton:!0});function X2(t){return r=>{const s=setTimeout(()=>{r(!1)},t);return o=>{o&&(r(!0),clearTimeout(s))}}}function bf(t,r){t===0?r():requestAnimationFrame(()=>{bf(t-1,r)})}function jf(t,r){const s=r-1;return typeof t=="number"?t:t.index==="LAST"?s:t.index}const qs=nt(([{defaultItemSize:t,listRefresh:r,sizes:s},{scrollTop:o},{scrollTargetReached:c,scrollToIndex:u},{didMount:d}])=>{const h=ge(!0),g=ge(0),p=ge(!0);return Te(pe(d,Ge(g),_e(([y,v])=>v!==0),ra(!1)),h),Te(pe(d,Ge(g),_e(([y,v])=>v!==0),ra(!1)),p),lt(pe(Bt(r,d),Ge(h,s,t,p),_e(([[,y],v,{sizeTree:b},k,S])=>y&&(!ht(b)||hf(k))&&!v&&!S),Ge(g)),([,y])=>{Kn(c,()=>{Fe(p,!0)}),bf(4,()=>{Kn(o,()=>{Fe(h,!0)}),Fe(u,y)})}),{initialItemFinalLocationReached:p,initialTopMostItemIndex:g,scrolledToInitialItem:h}},kt(ia,cn,Ws,dr),{singleton:!0});function Wv(t,r){return Math.abs(t-r)<1.01}const $s="up",zs="down",Q2="none",Z2={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},J2=0,Ys=nt(([{footerHeight:t,headerHeight:r,scrollBy:s,scrollContainerState:o,scrollTop:c,viewportHeight:u}])=>{const d=ge(!1),h=ge(!0),g=Qe(),p=Qe(),y=ge(4),v=ge(J2),b=tn(pe(Yd(pe(De(c),Dr(1),ra(!0)),pe(De(c),Dr(1),ra(!1),sg(100))),St()),!1),k=tn(pe(Yd(pe(s,ra(!0)),pe(s,ra(!1),sg(200))),St()),!1);Te(pe(Bt(De(c),De(v)),Se(([R,L])=>R<=L),St()),h),Te(pe(h,Ra(50)),p);const S=En(pe(Bt(o,De(u),De(r),De(t),De(y)),la((R,[{scrollHeight:L,scrollTop:B},z,F,E,I])=>{const N=B+z-L>-I,_={scrollHeight:L,scrollTop:B,viewportHeight:z};if(N){let W,Y;return B>R.state.scrollTop?(W="SCROLLED_DOWN",Y=R.state.scrollTop-B):(W="SIZE_DECREASED",Y=R.state.scrollTop-B||R.scrollTopDelta),{atBottom:!0,atBottomBecause:W,scrollTopDelta:Y,state:_}}let V;return _.scrollHeight>R.state.scrollHeight?V="SIZE_INCREASED":z<R.state.viewportHeight?V="VIEWPORT_HEIGHT_DECREASING":B<R.state.scrollTop?V="SCROLLING_UPWARDS":V="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:V,state:_}},Z2),St((R,L)=>R!==void 0&&R.atBottom===L.atBottom))),w=tn(pe(o,la((R,{scrollHeight:L,scrollTop:B,viewportHeight:z})=>{if(!Wv(R.scrollHeight,L)){const F=L-(B+z)<1;return R.scrollTop!==B&&F?{changed:!0,jump:R.scrollTop-B,scrollHeight:L,scrollTop:B}:{changed:!0,jump:0,scrollHeight:L,scrollTop:B}}return{changed:!1,jump:0,scrollHeight:L,scrollTop:B}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),_e(R=>R.changed),Se(R=>R.jump)),0);Te(pe(S,Se(R=>R.atBottom)),d),Te(pe(d,Ra(50)),g);const C=ge(zs);Te(pe(o,Se(({scrollTop:R})=>R),St(),la((R,L)=>Et(k)?{direction:R.direction,prevScrollTop:L}:{direction:L<R.prevScrollTop?$s:zs,prevScrollTop:L},{direction:zs,prevScrollTop:0}),Se(R=>R.direction)),C),Te(pe(o,Ra(50),ra(Q2)),C);const T=ge(0);return Te(pe(b,_e(R=>!R),ra(0)),T),Te(pe(c,Ra(100),Ge(b),_e(([R,L])=>L),la(([R,L],[B])=>[L,B],[0,0]),Se(([R,L])=>L-R)),T),{atBottomState:S,atBottomStateChange:g,atBottomThreshold:y,atTopStateChange:p,atTopThreshold:v,isAtBottom:d,isAtTop:h,isScrolling:b,lastJumpDueToItemResize:w,scrollDirection:C,scrollVelocity:T}},kt(cn)),Vs="top",Ps="bottom",ug="none";function dg(t,r,s){return typeof t=="number"?s===$s&&r===Vs||s===zs&&r===Ps?t:0:s===$s?r===Vs?t.main:t.reverse:r===Ps?t.main:t.reverse}function fg(t,r){return typeof t=="number"?t:t[r]??0}const Sf=nt(([{deviation:t,fixedHeaderHeight:r,headerHeight:s,scrollTop:o,viewportHeight:c}])=>{const u=Qe(),d=ge(0),h=ge(0),g=ge(0),p=tn(pe(Bt(De(o),De(c),De(s),De(u,Hs),De(g),De(d),De(r),De(t),De(h)),Se(([y,v,b,[k,S],w,C,T,R,L])=>{const B=y-R,z=C+T,F=Math.max(b-B,0);let E=ug;const I=fg(L,Vs),N=fg(L,Ps);return k-=R,k+=b+T,S+=b+T,S-=R,k>y+z-I&&(E=$s),S<y-F+v+N&&(E=zs),E!==ug?[Math.max(B-b-dg(w,Vs,E)-I,0),B-F-T+v+dg(w,Ps,E)+N]:null}),_e(y=>y!==null),St(Hs)),[0,0]);return{increaseViewportBy:h,listBoundary:u,overscan:g,topListHeight:d,visibleRange:p}},kt(cn),{singleton:!0});function ek(t,r,s){if(Vo(r)){const o=Vv(t,r);return[{index:Qn(r.groupOffsetTree,o)[0],offset:0,size:0},{data:s==null?void 0:s[0],index:o,offset:0,size:0}]}return[{data:s==null?void 0:s[0],index:t,offset:0,size:0}]}const jd={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Co(t,r,s,o,c,u){const{lastIndex:d,lastOffset:h,lastSize:g}=c;let p=0,y=0;if(t.length>0){p=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,k=p,S=b-y;return{bottom:y,firstItemIndex:u,items:pg(t,c,u),offsetBottom:S,offsetTop:p,top:k,topItems:pg(r,c,u),topListHeight:r.reduce((w,C)=>C.size+w,0),totalCount:s}}function qv(t,r,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=jf(r,h),p=Array.from({length:h}).map((y,v)=>({data:u[v+g],index:v+g,offset:0,size:0}));return Co(p,[],h,c,s,o)}function pg(t,r,s){if(t.length===0)return[];if(!Vo(r))return t.map(p=>({...p,index:p.index+s,originalIndex:p.index}));const o=t[0].index,c=t[t.length-1].index,u=[],d=El(r.groupOffsetTree,o,c);let h,g=0;for(const p of t){(!h||h.end<p.index)&&(h=d.shift(),g=r.groupIndices.indexOf(h.start));let y;p.index===h.start?y={index:g,type:"group"}:y={groupIndex:g,index:p.index-(g+1)+s},u.push({...y,data:p.data,offset:p.offset,originalIndex:p.index,size:p.size})}return u}function mg(t,r){return t===void 0?0:typeof t=="number"?t:t[r]??0}const Br=nt(([{data:t,firstItemIndex:r,gap:s,sizes:o,totalCount:c},u,{listBoundary:d,topListHeight:h,visibleRange:g},{initialTopMostItemIndex:p,scrolledToInitialItem:y},{topListHeight:v},b,{didMount:k},{recalcInProgress:S}])=>{const w=ge([]),C=ge(0),T=Qe(),R=ge(0);Te(u.topItemsIndexes,w);const L=tn(pe(Bt(k,S,De(g,Hs),De(c),De(o),De(p),y,De(w),De(r),De(s),De(R),t),_e(([E,I,,N,,,,,,,,_])=>{const V=_!==void 0&&_.length!==N;return E&&!I&&!V}),Se(([,,[E,I],N,_,V,W,Y,X,H,M,O])=>{var je,Re;const U=_,{offsetTree:G,sizeTree:ue}=U,D=Et(C);if(N===0)return{...jd,totalCount:N};if(E===0&&I===0)return D===0?{...jd,totalCount:N}:qv(D,V,_,X,H,O||[]);if(ht(ue))return D>0?null:Co(ek(jf(V,N),U,O),[],N,H,U,X);const P=[];if(Y.length>0){const Le=Y[0],ae=Y[Y.length-1];let fe=0;for(const me of El(ue,Le,ae)){const he=me.value,be=Math.max(me.start,Le),Be=Math.min(me.end,ae);for(let Oe=be;Oe<=Be;Oe++)P.push({data:O==null?void 0:O[Oe],index:Oe,offset:fe,size:he}),fe+=he}}if(!W)return Co([],P,N,H,U,X);const ee=Y.length>0?Y[Y.length-1]+1:0,re=V2(G,E,I,ee);if(re.length===0)return null;const xe=N-1,ce=$o([],Le=>{for(const ae of re){const fe=ae.value;let me=fe.offset,he=ae.start;const be=fe.size;if(fe.offset<E){he+=Math.floor((E-fe.offset+H)/(be+H));const Oe=he-ae.start;me+=Oe*be+Oe*H}he<ee&&(me+=(ee-he)*be,he=ee);const Be=Math.min(ae.end,xe);for(let Oe=he;Oe<=Be&&!(me>=I);Oe++)Le.push({data:O==null?void 0:O[Oe],index:Oe,offset:me,size:be}),me+=be+H}}),ye=mg(M,Vs),de=mg(M,Ps);if(ce.length>0&&(ye>0||de>0)){const Le=ce[0],ae=ce[ce.length-1];if(ye>0&&Le.index>ee){const fe=Math.min(ye,Le.index-ee),me=[];let he=Le.offset;for(let be=Le.index-1;be>=Le.index-fe;be--){const Be=((je=El(ue,be,be)[0])==null?void 0:je.value)??Le.size;he-=Be+H,me.unshift({data:O==null?void 0:O[be],index:be,offset:he,size:Be})}ce.unshift(...me)}if(de>0&&ae.index<xe){const fe=Math.min(de,xe-ae.index);let me=ae.offset+ae.size+H;for(let he=ae.index+1;he<=ae.index+fe;he++){const be=((Re=El(ue,he,he)[0])==null?void 0:Re.value)??ae.size;ce.push({data:O==null?void 0:O[he],index:he,offset:me,size:be}),me+=be+H}}}return Co(ce,P,N,H,U,X)}),_e(E=>E!==null),St()),jd);Te(pe(t,_e(hf),Se(E=>E==null?void 0:E.length)),c),Te(pe(L,Se(E=>E.topListHeight)),v),Te(v,h),Te(pe(L,Se(E=>[E.top,E.bottom])),d),Te(pe(L,Se(E=>E.items)),T);const B=En(pe(L,_e(({items:E})=>E.length>0),Ge(c,t),_e(([{items:E},I])=>E[E.length-1].originalIndex===I-1),Se(([,E,I])=>[E-1,I]),St(Hs),Se(([E])=>E))),z=En(pe(L,Ra(200),_e(({items:E,topItems:I})=>E.length>0&&E[0].originalIndex===I.length),Se(({items:E})=>E[0].index),St())),F=En(pe(L,_e(({items:E})=>E.length>0),Se(({items:E})=>{let I=0,N=E.length-1;for(;E[I].type==="group"&&I<N;)I++;for(;E[N].type==="group"&&N>I;)N--;return{endIndex:E[N].index,startIndex:E[I].index}}),St(Uv)));return{endReached:B,initialItemCount:C,itemsRendered:T,listState:L,minOverscanItemCount:R,rangeChanged:F,startReached:z,topItemsIndexes:w,...b}},kt(ia,Fv,Sf,qs,Ws,Ys,dr,vf),{singleton:!0}),Yv=nt(([{fixedFooterHeight:t,fixedHeaderHeight:r,footerHeight:s,headerHeight:o},{listState:c}])=>{const u=Qe(),d=tn(pe(Bt(s,t,o,r,c),Se(([h,g,p,y,v])=>h+g+p+y+v.offsetBottom+v.bottom)),0);return Te(De(d),u),{totalListHeight:d,totalListHeightChanged:u}},kt(cn,Br),{singleton:!0}),tk=nt(([{viewportHeight:t},{totalListHeight:r}])=>{const s=ge(!1),o=tn(pe(Bt(s,t,r),_e(([c])=>c),Se(([,c,u])=>Math.max(0,c-u)),Ra(0),St()),0);return{alignToBottom:s,paddingTopAddition:o}},kt(cn,Yv),{singleton:!0}),Kv=nt(()=>({context:ge(null)})),nk=({itemBottom:t,itemTop:r,locationParams:{align:s,behavior:o,...c},viewportBottom:u,viewportTop:d})=>r<d?{...c,align:s??"start",...o!==void 0?{behavior:o}:{}}:t>u?{...c,align:s??"end",...o!==void 0?{behavior:o}:{}}:null,Xv=nt(([{gap:t,sizes:r,totalCount:s},{fixedFooterHeight:o,fixedHeaderHeight:c,headerHeight:u,scrollingInProgress:d,scrollTop:h,viewportHeight:g},{scrollToIndex:p}])=>{const y=Qe();return Te(pe(y,Ge(r,g,s,u,c,o,h),Ge(t),Se(([[v,b,k,S,w,C,T,R],L])=>{const{calculateViewLocation:B=nk,done:z,...F}=v,E=Pv(v,b,S-1),I=Us(E,b.offsetTree,L)+w+C,N=I+Qn(b.sizeTree,E)[1],_=R+C,V=R+k-T,W=B({itemBottom:N,itemTop:I,locationParams:F,viewportBottom:V,viewportTop:_});return W!==null?z&&Kn(pe(d,_e(Y=>!Y),Dr(Et(d)?1:2)),z):z==null||z(),W}),_e(v=>v!==null)),p),{scrollIntoView:y}},kt(ia,cn,Ws,Br,ur),{singleton:!0});function hg(t){return t===!1?!1:t==="smooth"?"smooth":"auto"}const ak=(t,r)=>typeof t=="function"?hg(t(r)):r&&hg(t),rk=nt(([{listRefresh:t,totalCount:r,fixedItemSize:s,data:o},{atBottomState:c,isAtBottom:u},{scrollToIndex:d},{scrolledToInitialItem:h},{didMount:g,propsReady:p},{log:y},{scrollingInProgress:v},{context:b},{scrollIntoView:k}])=>{const S=ge(!1),w=Qe();let C=null;function T(z){Fe(d,{align:"end",behavior:z,index:"LAST"})}lt(pe(Bt(pe(De(r),Dr(1)),g),Ge(De(S),u,h,v),Se(([[z,F],E,I,N,_])=>{let V=F&&N,W="auto";return V&&(W=ak(E,I||_),V=V&&W!==!1),{followOutputBehavior:W,shouldFollow:V,totalCount:z}}),_e(({shouldFollow:z})=>z)),({followOutputBehavior:z,totalCount:F})=>{C!==null&&(C(),C=null),Et(s)!==void 0?requestAnimationFrame(()=>{Et(y)("following output to ",{totalCount:F},Ut.DEBUG),T(z)}):C=Kn(t,()=>{Et(y)("following output to ",{totalCount:F},Ut.DEBUG),T(z),C=null})});function R(z){const F=Kn(c,E=>{z&&!E.atBottom&&E.notAtBottomBecause==="SIZE_INCREASED"&&C===null&&(Et(y)("scrolling to bottom due to increased size",{},Ut.DEBUG),T("auto"))});setTimeout(F,100)}lt(pe(Bt(De(S),r,p),_e(([z,,F])=>z!==!1&&F),la(({value:z},[,F])=>({refreshed:z===F,value:F}),{refreshed:!1,value:0}),_e(({refreshed:z})=>z),Ge(S,r)),([,z])=>{Et(h)&&R(z!==!1)}),lt(w,()=>{R(Et(S)!==!1)}),lt(Bt(De(S),c),([z,F])=>{z!==!1&&!F.atBottom&&F.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&T("auto")});const L=ge(null),B=Qe();return Te(Yd(pe(De(o),Se(z=>(z==null?void 0:z.length)??0)),pe(De(r))),B),lt(pe(Bt(pe(B,Dr(1)),g),Ge(De(L),h,v,b),Se(([[z,F],E,I,N,_])=>F&&I&&(E==null?void 0:E({context:_,totalCount:z,scrollingInProgress:N}))),_e(z=>!!z),Ra(0)),z=>{C!==null&&(C(),C=null),Et(s)!==void 0?requestAnimationFrame(()=>{Et(y)("scrolling into view",{}),Fe(k,z)}):C=Kn(t,()=>{Et(y)("scrolling into view",{}),Fe(k,z),C=null})}),{autoscrollToBottom:w,followOutput:S,scrollIntoViewOnChange:L}},kt(ia,Ys,Ws,qs,dr,ur,cn,Kv,Xv)),lk=nt(([{data:t,firstItemIndex:r,gap:s,sizes:o},{initialTopMostItemIndex:c},{initialItemCount:u,listState:d},{didMount:h}])=>(Te(pe(h,Ge(u),_e(([,g])=>g!==0),Ge(c,o,r,s,t),Se(([[,g],p,y,v,b,k=[]])=>qv(g,p,y,v,b,k))),d),{}),kt(ia,qs,Br,dr),{singleton:!0}),sk=nt(([{didMount:t},{scrollTo:r},{listState:s}])=>{const o=ge(0);return lt(pe(t,Ge(o),_e(([,c])=>c!==0),Se(([,c])=>({top:c}))),c=>{Kn(pe(s,Dr(1),_e(u=>u.items.length>1)),()=>{requestAnimationFrame(()=>{Fe(r,c)})})}),{initialScrollTop:o}},kt(dr,cn,Br),{singleton:!0}),Qv=nt(([{scrollVelocity:t}])=>{const r=ge(!1),s=Qe(),o=ge(!1);return Te(pe(t,Ge(o,r,s),_e(([c,u])=>u!==!1&&u!==void 0),Se(([c,u,d,h])=>{const{enter:g,exit:p}=u;if(d){if(p(c,h))return!1}else if(g(c,h))return!0;return d}),St()),r),lt(pe(Bt(r,t,s),Ge(o)),([[c,u,d],h])=>{c&&h!==!1&&h!==void 0&&h.change&&h.change(u,d)}),{isSeeking:r,scrollSeekConfiguration:o,scrollSeekRangeChanged:s,scrollVelocity:t}},kt(Ys),{singleton:!0}),kf=nt(([{scrollContainerState:t,scrollTo:r}])=>{const s=Qe(),o=Qe(),c=Qe(),u=ge(!1),d=ge(void 0);return Te(pe(Bt(s,o),Se(([{scrollTop:h,viewportHeight:g},{offsetTop:p,listHeight:y}])=>({scrollHeight:y,scrollTop:Math.max(0,h-p),viewportHeight:g}))),t),Te(pe(r,Ge(o),Se(([h,{offsetTop:g}])=>({...h,top:h.top+g}))),c),{customScrollParent:d,useWindowScroll:u,windowScrollContainerState:s,windowScrollTo:c,windowViewportRect:o}},kt(cn)),ik=nt(([{sizeRanges:t,sizes:r},{headerHeight:s,scrollTop:o},{initialTopMostItemIndex:c},{didMount:u},{useWindowScroll:d,windowScrollContainerState:h,windowViewportRect:g}])=>{const p=Qe(),y=ge(void 0),v=ge(null),b=ge(null);return Te(h,v),Te(g,b),lt(pe(p,Ge(r,o,d,v,b,s)),([k,S,w,C,T,R,L])=>{const B=F2(S.sizeTree);C&&T!==null&&R!==null&&(w=T.scrollTop-R.offsetTop),w-=L,k({ranges:B,scrollTop:w})}),Te(pe(y,_e(hf),Se(ok)),c),Te(pe(u,Ge(y),_e(([,k])=>k!==void 0),St(),Se(([,k])=>k.ranges)),t),{getState:p,restoreStateFrom:y}},kt(ia,cn,qs,dr,kf));function ok(t){return{align:"start",index:0,offset:t.scrollTop}}const ck=nt(([{topItemsIndexes:t}])=>{const r=ge(0);return Te(pe(r,_e(s=>s>=0),Se(s=>Array.from({length:s}).map((o,c)=>c))),t),{topItemCount:r}},kt(Br));function Zv(t){let r=!1,s;return(()=>(r||(r=!0,s=t()),s))}const uk=Zv(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),dk=nt(([{deviation:t,scrollBy:r,scrollingInProgress:s,scrollTop:o},{isAtBottom:c,isScrolling:u,lastJumpDueToItemResize:d,scrollDirection:h},{listState:g},{beforeUnshiftWith:p,gap:y,shiftWithOffset:v,sizes:b},{log:k},{recalcInProgress:S}])=>{const w=En(pe(g,Ge(d),la(([,T,R,L],[{bottom:B,items:z,offsetBottom:F,totalCount:E},I])=>{const N=B+F;let _=0;return R===E&&T.length>0&&z.length>0&&(z[0].originalIndex===0&&T[0].originalIndex===0||(_=N-L,_!==0&&(_+=I))),[_,z,E,N]},[0,[],0,0]),_e(([T])=>T!==0),Ge(o,h,s,c,k,S),_e(([,T,R,L,,,B])=>!B&&!L&&T!==0&&R===$s),Se(([[T],,,,,R])=>(R("Upward scrolling compensation",{amount:T},Ut.DEBUG),T))));function C(T){T>0?(Fe(r,{behavior:"auto",top:-T}),Fe(t,0)):(Fe(t,0),Fe(r,{behavior:"auto",top:-T}))}return lt(pe(w,Ge(t,u)),([T,R,L])=>{L&&uk()?Fe(t,R-T):C(-T)}),lt(pe(Bt(tn(u,!1),t,S),_e(([T,R,L])=>!T&&!L&&R!==0),Se(([T,R])=>R),Ra(1)),C),Te(pe(v,Se(T=>({top:-T}))),r),lt(pe(p,Ge(b,y),Se(([T,{groupIndices:R,lastSize:L,sizeTree:B},z])=>{function F(V){return V*(L+z)}if(R.length===0)return F(T);let E=0;const I=Is(B,0);let N=0,_=0;for(;N<T;){N++,E+=I;let V=R.length===_+1?1/0:R[_+1]-R[_]-1;N+V>T&&(E-=I,V=T-N+1),N+=V,E+=F(V),_++}return E})),T=>{Fe(t,T),requestAnimationFrame(()=>{Fe(r,{top:T}),requestAnimationFrame(()=>{Fe(t,0),Fe(S,!1)})})}),{deviation:t}},kt(cn,Ys,Br,ia,ur,vf)),fk=nt(([t,r,s,o,c,u,d,h,g,p,y])=>({...t,...r,...s,...o,...c,...u,...d,...h,...g,...p,...y}),kt(Sf,lk,dr,Qv,Yv,sk,tk,kf,Xv,ur,Kv)),Jv=nt(([{data:t,defaultItemSize:r,firstItemIndex:s,fixedItemSize:o,fixedGroupSize:c,gap:u,groupIndices:d,heightEstimates:h,itemSize:g,sizeRanges:p,sizes:y,statefulTotalCount:v,totalCount:b,trackItemSizes:k},{initialItemFinalLocationReached:S,initialTopMostItemIndex:w,scrolledToInitialItem:C},T,R,L,B,{scrollToIndex:z},F,{topItemCount:E},{groupCounts:I},N])=>{const{listState:_,minOverscanItemCount:V,topItemsIndexes:W,rangeChanged:Y,...X}=B;return Te(Y,N.scrollSeekRangeChanged),Te(pe(N.windowViewportRect,Se(H=>H.visibleHeight)),T.viewportHeight),{data:t,defaultItemHeight:r,firstItemIndex:s,fixedItemHeight:o,fixedGroupHeight:c,gap:u,groupCounts:I,heightEstimates:h,initialItemFinalLocationReached:S,initialTopMostItemIndex:w,scrolledToInitialItem:C,sizeRanges:p,topItemCount:E,topItemsIndexes:W,totalCount:b,...L,groupIndices:d,itemSize:g,listState:_,minOverscanItemCount:V,scrollToIndex:z,statefulTotalCount:v,trackItemSizes:k,rangeChanged:Y,...X,...N,...T,sizes:y,...R}},kt(ia,qs,cn,ik,rk,Br,Ws,dk,ck,Fv,fk));function pk(t,r){const s={},o={};let c=0;const u=t.length;for(;c<u;)o[t[c]]=1,c+=1;for(const d in r)Object.hasOwn(o,d)||(s[d]=r[d]);return s}const uo=typeof document<"u"?Ne.useLayoutEffect:Ne.useEffect;function ey(t,r,s){const o=Object.keys(r.required||{}),c=Object.keys(r.optional||{}),u=Object.keys(r.methods||{}),d=Object.keys(r.events||{}),h=Ne.createContext({});function g(C,T){C.propsReady!==void 0&&Fe(C.propsReady,!1);for(const R of o){const L=C[r.required[R]];Fe(L,T[R])}for(const R of c)if(R in T){const L=C[r.optional[R]];Fe(L,T[R])}C.propsReady!==void 0&&Fe(C.propsReady,!0)}function p(C){return u.reduce((T,R)=>(T[R]=L=>{const B=C[r.methods[R]];Fe(B,L)},T),{})}function y(C){return d.reduce((T,R)=>(T[R]=R2(C[r.events[R]]),T),{})}const v=Ne.forwardRef(function(C,T){const{children:R,...L}=C,[B]=Ne.useState(()=>$o(M2(t),E=>{g(E,L)})),[z]=Ne.useState(lg(y,B));uo(()=>{for(const E of d)E in L&<(z[E],L[E]);return()=>{Object.values(z).map(xf)}},[L,z,B]),uo(()=>{g(B,L)}),Ne.useImperativeHandle(T,rg(p(B)));const F=s;return a.jsx(h.Provider,{value:B,children:s!==void 0?a.jsx(F,{...pk([...o,...c,...d],L),children:R}):R})}),b=C=>{const T=Ne.useContext(h);return Ne.useCallback(R=>{Fe(T[C],R)},[T,C])},k=C=>{const T=Ne.useContext(h)[C],R=Ne.useCallback(L=>lt(T,L),[T]);return Ne.useSyncExternalStore(R,()=>Et(T),()=>Et(T))},S=C=>{const T=Ne.useContext(h)[C],[R,L]=Ne.useState(lg(Et,T));return uo(()=>lt(T,B=>{B!==R&&L(rg(B))}),[T,R]),R},w=parseInt(Ne.version)>=18?k:S;return{Component:v,useEmitter:(C,T)=>{const R=Ne.useContext(h)[C];uo(()=>lt(R,T),[T,R])},useEmitterValue:w,usePublisher:b}}const ty=Ne.createContext(void 0),ny=Ne.createContext(void 0),Sd="-webkit-sticky",xg="sticky",wf=Zv(()=>{if(typeof document>"u")return xg;const t=document.createElement("div");return t.style.position=Sd,t.style.position===Sd?Sd:xg}),ay=typeof document<"u"?Ne.useLayoutEffect:Ne.useEffect;function kd(t){return"self"in t}function mk(t){return"body"in t}function ry(t,r,s,o=zl,c,u){const d=Ne.useRef(null),h=Ne.useRef(null),g=Ne.useRef(null),p=Ne.useCallback(b=>{let k,S,w;const C=b.target;if(mk(C)||kd(C)){const R=kd(C)?C:C.defaultView;w=u===!0?R.scrollX:R.scrollY,k=u===!0?R.document.documentElement.scrollWidth:R.document.documentElement.scrollHeight,S=u===!0?R.innerWidth:R.innerHeight}else w=u===!0?C.scrollLeft:C.scrollTop,k=u===!0?C.scrollWidth:C.scrollHeight,S=u===!0?C.offsetWidth:C.offsetHeight;const T=()=>{t({scrollHeight:k,scrollTop:Math.max(w,0),viewportHeight:S})};b.suppressFlushSync===!0?T():Ij.flushSync(T),h.current!==null&&(w===h.current||w<=0||w===k-S)&&(h.current=null,r(!0),g.current&&(clearTimeout(g.current),g.current=null))},[t,r,u]);Ne.useEffect(()=>{const b=c||d.current;return o(c||d.current),p({suppressFlushSync:!0,target:b}),b.addEventListener("scroll",p,{passive:!0}),()=>{o(null),b.removeEventListener("scroll",p)}},[d,p,s,o,c]);function y(b){const k=d.current;if(!k||(u===!0?"offsetWidth"in k&&k.offsetWidth===0:"offsetHeight"in k&&k.offsetHeight===0))return;const S=b.behavior==="smooth";let w,C,T;kd(k)?(C=Math.max(ir(k.document.documentElement,u===!0?"width":"height"),u===!0?k.document.documentElement.scrollWidth:k.document.documentElement.scrollHeight),w=u===!0?k.innerWidth:k.innerHeight,T=u===!0?window.scrollX:window.scrollY):(C=k[u===!0?"scrollWidth":"scrollHeight"],w=ir(k,u===!0?"width":"height"),T=k[u===!0?"scrollLeft":"scrollTop"]);const R=C-w;if(b.top=Math.ceil(Math.max(Math.min(R,b.top),0)),Wv(w,C)||b.top===T){t({scrollHeight:C,scrollTop:T,viewportHeight:w}),S&&r(!0);return}S?(h.current=b.top,g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{g.current=null,h.current=null,r(!0)},1e3)):h.current=null,u===!0&&(b={...b.behavior!==void 0?{behavior:b.behavior}:{},left:b.top}),k.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 Cf(t){return t}const hk=nt(()=>{const t=ge(h=>`Item ${h}`),r=ge(h=>`Group ${h}`),s=ge({}),o=ge(Cf),c=ge("div"),u=ge(zl),d=(h,g=null)=>tn(pe(s,Se(p=>p[h]),St()),g);return{components:s,computeItemKey:o,EmptyPlaceholder:d("EmptyPlaceholder"),FooterComponent:d("Footer"),GroupComponent:d("Group","div"),groupContent:r,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")}}),xk=nt(([t,r])=>({...t,...r}),kt(Jv,hk)),gk=({height:t})=>a.jsx("div",{style:{height:t}}),vk={overflowAnchor:"none",position:wf(),zIndex:1},ly={overflowAnchor:"none"},yk={...ly,display:"inline-block",height:"100%"},gg=Ne.memo(function({showTopList:t=!1}){const r=He("listState"),s=$n("sizeRanges"),o=He("useWindowScroll"),c=He("customScrollParent"),u=$n("windowScrollContainerState"),d=$n("scrollContainerState"),h=c||o?u:d,g=He("itemContent"),p=He("context"),y=He("groupContent"),v=He("trackItemSizes"),b=He("itemSize"),k=He("log"),S=$n("gap"),w=He("horizontalDirection"),{callbackRef:C}=D2(s,b,v,t?zl:h,k,S,c,w,He("skipAnimationFrameInResizeObserver")),[T,R]=Ne.useState(0);Ef("deviation",X=>{T!==X&&R(X)});const L=He("EmptyPlaceholder"),B=He("ScrollSeekPlaceholder")??gk,z=He("ListComponent"),F=He("ItemComponent"),E=He("GroupComponent"),I=He("computeItemKey"),N=He("isSeeking"),_=He("groupIndices").length>0,V=He("alignToBottom"),W=He("initialItemFinalLocationReached"),Y=t?{}:{boxSizing:"border-box",...w?{display:"inline-block",height:"100%",marginLeft:T!==0?T:V?"auto":0,paddingLeft:r.offsetTop,paddingRight:r.offsetBottom,whiteSpace:"nowrap"}:{marginTop:T!==0?T:V?"auto":0,paddingBottom:r.offsetBottom,paddingTop:r.offsetTop},...W?{}:{visibility:"hidden"}};return!t&&r.totalCount===0&&L!==null&&L!==void 0?a.jsx(L,{...en(L,p)}):a.jsx(z,{...en(z,p),"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list",ref:C,style:Y,children:(t?r.topItems:r.items).map(X=>{const H=X.originalIndex,M=I(H+r.firstItemIndex,X.data,p);return N?m.createElement(B,{...en(B,p),height:X.size,index:X.index,key:M,type:X.type||"item",...X.type==="group"?{}:{groupIndex:X.groupIndex}}):X.type==="group"?m.createElement(E,{...en(E,p),"data-index":H,"data-item-index":X.index,"data-known-size":X.size,key:M,style:vk},y(X.index,p)):m.createElement(F,{...en(F,p),...kk(F,X.data),"data-index":H,"data-item-group-index":X.groupIndex,"data-item-index":X.index,"data-known-size":X.size,key:M,style:w?yk:ly},_?g(X.index,X.groupIndex,X.data,p):g(X.index,X.data,p))})})}),bk={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},jk={outline:"none",overflowX:"auto",position:"relative"},Po=t=>({height:"100%",position:"absolute",top:0,width:"100%",...t?{display:"flex",flexDirection:"column"}:void 0}),Sk={position:wf(),top:0,width:"100%",zIndex:1};function en(t,r){if(typeof t!="string")return{context:r}}function kk(t,r){return{item:typeof t=="string"?void 0:r}}const wk=Ne.memo(function(){const t=He("HeaderComponent"),r=$n("headerHeight"),s=He("HeaderFooterTag"),o=Or(Ne.useMemo(()=>u=>{r(ir(u,"height"))},[r]),!0,He("skipAnimationFrameInResizeObserver")),c=He("context");return t!=null?a.jsx(s,{ref:o,children:a.jsx(t,{...en(t,c)})}):null}),Ck=Ne.memo(function(){const t=He("FooterComponent"),r=$n("footerHeight"),s=He("HeaderFooterTag"),o=Or(Ne.useMemo(()=>u=>{r(ir(u,"height"))},[r]),!0,He("skipAnimationFrameInResizeObserver")),c=He("context");return t!=null?a.jsx(s,{ref:o,children:a.jsx(t,{...en(t,c)})}):null});function sy({useEmitter:t,useEmitterValue:r,usePublisher:s}){return Ne.memo(function({children:o,style:c,context:u,...d}){const h=s("scrollContainerState"),g=r("ScrollerComponent"),p=s("smoothScrollTargetReached"),y=r("scrollerRef"),v=r("horizontalDirection")||!1,{scrollByCallback:b,scrollerRef:k,scrollToCallback:S}=ry(h,p,g,y,void 0,v);return t("scrollTo",S),t("scrollBy",b),a.jsx(g,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:k,style:{...v?jk:bk,...c},tabIndex:0,...d,...en(g,u),children:o})})}function iy({useEmitter:t,useEmitterValue:r,usePublisher:s}){return Ne.memo(function({children:o,style:c,context:u,...d}){const h=s("windowScrollContainerState"),g=r("ScrollerComponent"),p=s("smoothScrollTargetReached"),y=r("totalListHeight"),v=r("deviation"),b=r("customScrollParent"),k=Ne.useRef(null),S=r("scrollerRef"),{scrollByCallback:w,scrollerRef:C,scrollToCallback:T}=ry(h,p,g,S,b);return ay(()=>{var R;return C.current=b||((R=k.current)==null?void 0:R.ownerDocument.defaultView),()=>{C.current=null}},[C,b]),t("windowScrollTo",T),t("scrollBy",w),a.jsx(g,{ref:k,"data-virtuoso-scroller":!0,style:{position:"relative",...c,...y!==0?{height:y+v}:void 0},...d,...en(g,u),children:o})})}const Ek=({children:t})=>{const r=Ne.useContext(ty),s=$n("viewportHeight"),o=$n("fixedItemHeight"),c=He("alignToBottom"),u=He("horizontalDirection"),d=Ne.useMemo(()=>Lv(s,g=>ir(g,u?"width":"height")),[s,u]),h=Or(d,!0,He("skipAnimationFrameInResizeObserver"));return Ne.useEffect(()=>{r&&(s(r.viewportHeight),o(r.itemHeight))},[r,s,o]),a.jsx("div",{"data-viewport-type":"element",ref:h,style:Po(c),children:t})},Nk=({children:t})=>{const r=Ne.useContext(ty),s=$n("windowViewportRect"),o=$n("fixedItemHeight"),c=He("customScrollParent"),u=Dv(s,c,He("skipAnimationFrameInResizeObserver")),d=He("alignToBottom");return Ne.useEffect(()=>{r&&(o(r.itemHeight),s({listHeight:0,offsetTop:0,visibleHeight:r.viewportHeight,visibleWidth:100}))},[r,s,o]),a.jsx("div",{"data-viewport-type":"window",ref:u,style:Po(d),children:t})},Tk=({children:t})=>{const r=He("TopItemListComponent")??"div",s=He("headerHeight"),o={...Sk,marginTop:`${s}px`},c=He("context");return a.jsx(r,{style:o,...en(r,c),children:t})},Rk=Ne.memo(function(t){const r=He("useWindowScroll"),s=He("topItemsIndexes").length>0,o=He("customScrollParent"),c=He("context");return a.jsxs(o||r?Lk:Mk,{...t,context:c,children:[s&&a.jsx(Tk,{children:a.jsx(gg,{showTopList:!0})}),a.jsxs(o||r?Nk:Ek,{children:[a.jsx(wk,{}),a.jsx(gg,{}),a.jsx(Ck,{})]})]})}),{Component:Ak,useEmitter:Ef,useEmitterValue:He,usePublisher:$n}=ey(xk,{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"}},Rk),Mk=sy({useEmitter:Ef,useEmitterValue:He,usePublisher:$n}),Lk=iy({useEmitter:Ef,useEmitterValue:He,usePublisher:$n}),zk=Ak,Dk=nt(()=>{const t=ge(p=>a.jsxs("td",{children:["Item $",p]})),r=ge(null),s=ge(p=>a.jsxs("td",{colSpan:1e3,children:["Group ",p]})),o=ge(null),c=ge(null),u=ge({}),d=ge(Cf),h=ge(zl),g=(p,y=null)=>tn(pe(u,Se(v=>v[p]),St()),y);return{components:u,computeItemKey:d,context:r,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")}});kt(Jv,Dk);wf();const vg={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},_k={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:yg,floor:Ao,max:Ds,min:wd,round:bg}=Math;function jg(t,r,s){return Array.from({length:r-t+1}).map((o,c)=>({data:s===null?null:s[c+t],index:c+t}))}function Ok(t){return{..._k,items:t}}function fo(t,r){return t!==void 0&&t.width===r.width&&t.height===r.height}function Bk(t,r){return t!==void 0&&t.column===r.column&&t.row===r.row}const Ik=nt(([{increaseViewportBy:t,listBoundary:r,overscan:s,visibleRange:o},{footerHeight:c,headerHeight:u,scrollBy:d,scrollContainerState:h,scrollTo:g,scrollTop:p,smoothScrollTargetReached:y,viewportHeight:v},b,k,{didMount:S,propsReady:w},{customScrollParent:C,useWindowScroll:T,windowScrollContainerState:R,windowScrollTo:L,windowViewportRect:B},z])=>{const F=ge(0),E=ge(0),I=ge(vg),N=ge({height:0,width:0}),_=ge({height:0,width:0}),V=Qe(),W=Qe(),Y=ge(0),X=ge(null),H=ge({column:0,row:0}),M=Qe(),O=Qe(),U=ge(!1),G=ge(0),ue=ge(!0),D=ge(!1),P=ge(!1);lt(pe(S,Ge(G),_e(([de,je])=>je!==0)),()=>{Fe(ue,!1)}),lt(pe(Bt(S,ue,_,N,G,D),_e(([de,je,Re,Le,,ae])=>de&&!je&&Re.height!==0&&Le.height!==0&&!ae)),([,,,,de])=>{Fe(D,!0),bf(1,()=>{Fe(V,de)}),Kn(pe(p),()=>{Fe(r,[0,0]),Fe(ue,!0)})}),Te(pe(O,_e(de=>de!=null&&de.scrollTop>0),ra(0)),E),lt(pe(S,Ge(O),_e(([,de])=>de!=null)),([,de])=>{de&&(Fe(N,de.viewport),Fe(_,de.item),Fe(H,de.gap),de.scrollTop>0&&(Fe(U,!0),Kn(pe(p,Dr(1)),je=>{Fe(U,!1)}),Fe(g,{top:de.scrollTop})))}),Te(pe(N,Se(({height:de})=>de)),v),Te(pe(Bt(De(N,fo),De(_,fo),De(H,(de,je)=>de!==void 0&&de.column===je.column&&de.row===je.row),De(p)),Se(([de,je,Re,Le])=>({gap:Re,item:je,scrollTop:Le,viewport:de}))),M),Te(pe(Bt(De(F),o,De(H,Bk),De(_,fo),De(N,fo),De(X),De(E),De(U),De(ue),De(G)),_e(([,,,,,,,de])=>!de),Se(([de,[je,Re],Le,ae,fe,me,he,,be,Be])=>{const{column:Oe,row:st}=Le,{height:At,width:gt}=ae,{width:Gt}=fe;if(he===0&&(de===0||Gt===0))return vg;if(gt===0){const Vt=jf(Be,de),oa=Vt+Math.max(he-1,0);return Ok(jg(Vt,oa,me))}const vt=oy(Gt,gt,Oe);let Ze,at;be?je===0&&Re===0&&he>0?(Ze=0,at=he-1):(Ze=vt*Ao((je+st)/(At+st)),at=vt*yg((Re+st)/(At+st))-1,at=wd(de-1,Ds(at,vt-1)),Ze=wd(at,Ds(0,Ze))):(Ze=0,at=-1);const ve=jg(Ze,at,me),{bottom:ct,top:Nt}=Sg(fe,Le,ae,ve),nn=yg(de/vt),Rn=nn*At+(nn-1)*st-ct;return{bottom:ct,itemHeight:At,items:ve,itemWidth:gt,offsetBottom:Rn,offsetTop:Nt,top:Nt}})),I),Te(pe(X,_e(de=>de!==null),Se(de=>de.length)),F),Te(pe(Bt(N,_,I,H),_e(([de,je,{items:Re}])=>Re.length>0&&je.height!==0&&de.height!==0),Se(([de,je,{items:Re},Le])=>{const{bottom:ae,top:fe}=Sg(de,Le,je,Re);return[fe,ae]}),St(Hs)),r);const ee=ge(!1);Te(pe(p,Ge(ee),Se(([de,je])=>je||de!==0)),ee);const re=En(pe(Bt(I,F),_e(([{items:de}])=>de.length>0),Ge(ee),_e(([[de,je],Re])=>{const Le=de.items[de.items.length-1].index===je-1;return(Re||de.bottom>0&&de.itemHeight>0&&de.offsetBottom===0&&de.items.length===je)&&Le}),Se(([[,de]])=>de-1),St())),xe=En(pe(De(I),_e(({items:de})=>de.length>0&&de[0].index===0),ra(0),St())),ce=En(pe(De(I),Ge(U),_e(([{items:de},je])=>de.length>0&&!je),Se(([{items:de}])=>({endIndex:de[de.length-1].index,startIndex:de[0].index})),St(Uv),Ra(0)));Te(ce,k.scrollSeekRangeChanged),Te(pe(V,Ge(N,_,F,H),Se(([de,je,Re,Le,ae])=>{const fe=Gv(de),{align:me,behavior:he,offset:be}=fe;let Be=fe.index;Be==="LAST"&&(Be=Le-1),Be=Ds(0,Be,wd(Le-1,Be));let Oe=Jd(je,ae,Re,Be);return me==="end"?Oe=bg(Oe-je.height+Re.height):me==="center"&&(Oe=bg(Oe-je.height/2+Re.height/2)),be!==void 0&&be!==0&&(Oe+=be),{behavior:he,top:Oe}})),g);const ye=tn(pe(I,Se(de=>de.offsetBottom+de.bottom)),0);return Te(pe(B,Se(de=>({height:de.visibleHeight,width:de.visibleWidth}))),N),{customScrollParent:C,data:X,deviation:Y,footerHeight:c,gap:H,headerHeight:u,increaseViewportBy:t,initialItemCount:E,itemDimensions:_,overscan:s,restoreStateFrom:O,scrollBy:d,scrollContainerState:h,scrollHeight:W,scrollTo:g,scrollToIndex:V,scrollTop:p,smoothScrollTargetReached:y,totalCount:F,useWindowScroll:T,viewportDimensions:N,windowScrollContainerState:R,windowScrollTo:L,windowViewportRect:B,...k,gridState:I,horizontalDirection:P,initialTopMostItemIndex:G,totalListHeight:ye,...b,endReached:re,propsReady:w,rangeChanged:ce,startReached:xe,stateChanged:M,stateRestoreInProgress:U,...z}},kt(Sf,cn,Ys,Qv,dr,kf,ur));function oy(t,r,s){return Ds(1,Ao((t+s)/(Ao(r)+s)))}function Sg(t,r,s,o){const{height:c}=s;if(c===void 0||o.length===0)return{bottom:0,top:0};const u=Jd(t,r,s,o[0].index);return{bottom:Jd(t,r,s,o[o.length-1].index)+c,top:u}}function Jd(t,r,s,o){const c=oy(t.width,s.width,r.column),u=Ao(o/c),d=u*s.height+Ds(0,u-1)*r.row;return d>0?d+r.row:d}const Hk=nt(()=>{const t=ge(v=>`Item ${v}`),r=ge({}),s=ge(null),o=ge("virtuoso-grid-item"),c=ge("virtuoso-grid-list"),u=ge(Cf),d=ge("div"),h=ge(zl),g=(v,b=null)=>tn(pe(r,Se(k=>k[v]),St()),b),p=ge(!1),y=ge(!1);return Te(De(y),p),{components:r,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:p,reportReadyState:y,ScrollerComponent:g("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:g("ScrollSeekPlaceholder","div")}}),Uk=nt(([t,r])=>({...t,...r}),kt(Ik,Hk)),$k=Ne.memo(function(){const t=Ct("gridState"),r=Ct("listClassName"),s=Ct("itemClassName"),o=Ct("itemContent"),c=Ct("computeItemKey"),u=Ct("isSeeking"),d=Vn("scrollHeight"),h=Ct("ItemComponent"),g=Ct("ListComponent"),p=Ct("ScrollSeekPlaceholder"),y=Ct("context"),v=Vn("itemDimensions"),b=Vn("gap"),k=Ct("log"),S=Ct("stateRestoreInProgress"),w=Vn("reportReadyState"),C=Or(Ne.useMemo(()=>T=>{const R=T.parentElement.parentElement.scrollHeight;d(R);const L=T.firstChild;if(L!==null){const{height:B,width:z}=L.getBoundingClientRect();v({height:B,width:z})}b({column:kg("column-gap",getComputedStyle(T).columnGap,k),row:kg("row-gap",getComputedStyle(T).rowGap,k)})},[d,v,b,k]),!0,!1);return ay(()=>{t.itemHeight>0&&t.itemWidth>0&&w(!0)},[t]),S?null:a.jsx(g,{className:r,ref:C,...en(g,y),"data-testid":"virtuoso-item-list",style:{paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},children:t.items.map(T=>{const R=c(T.index,T.data,y);return u?a.jsx(p,{...en(p,y),height:t.itemHeight,index:T.index,width:t.itemWidth},R):m.createElement(h,{...en(h,y),className:s,"data-index":T.index,key:R},o(T.index,T.data,y))})})}),Vk=Ne.memo(function(){const t=Ct("HeaderComponent"),r=Vn("headerHeight"),s=Ct("headerFooterTag"),o=Or(Ne.useMemo(()=>u=>{r(ir(u,"height"))},[r]),!0,!1),c=Ct("context");return t!=null?a.jsx(s,{ref:o,children:a.jsx(t,{...en(t,c)})}):null}),Pk=Ne.memo(function(){const t=Ct("FooterComponent"),r=Vn("footerHeight"),s=Ct("headerFooterTag"),o=Or(Ne.useMemo(()=>u=>{r(ir(u,"height"))},[r]),!0,!1),c=Ct("context");return t!=null?a.jsx(s,{ref:o,children:a.jsx(t,{...en(t,c)})}):null}),Fk=({children:t})=>{const r=Ne.useContext(ny),s=Vn("itemDimensions"),o=Vn("viewportDimensions"),c=Or(Ne.useMemo(()=>u=>{o(u.getBoundingClientRect())},[o]),!0,!1);return Ne.useEffect(()=>{r&&(o({height:r.viewportHeight,width:r.viewportWidth}),s({height:r.itemHeight,width:r.itemWidth}))},[r,o,s]),a.jsx("div",{ref:c,style:Po(!1),children:t})},Gk=({children:t})=>{const r=Ne.useContext(ny),s=Vn("windowViewportRect"),o=Vn("itemDimensions"),c=Ct("customScrollParent"),u=Dv(s,c,!1);return Ne.useEffect(()=>{r&&(o({height:r.itemHeight,width:r.itemWidth}),s({listHeight:0,offsetTop:0,visibleHeight:r.viewportHeight,visibleWidth:r.viewportWidth}))},[r,s,o]),a.jsx("div",{ref:u,style:Po(!1),children:t})},Wk=Ne.memo(function({...t}){const r=Ct("useWindowScroll"),s=Ct("customScrollParent"),o=s||r?Yk:qk,c=s||r?Gk:Fk,u=Ct("context");return a.jsx(o,{...t,...en(o,u),children:a.jsxs(c,{children:[a.jsx(Vk,{}),a.jsx($k,{}),a.jsx(Pk,{})]})})}),{useEmitter:cy,useEmitterValue:Ct,usePublisher:Vn}=ey(Uk,{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"}},Wk),qk=sy({useEmitter:cy,useEmitterValue:Ct,usePublisher:Vn}),Yk=iy({useEmitter:cy,useEmitterValue:Ct,usePublisher:Vn});function kg(t,r,s){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&s(`${t} was not resolved to pixel value correctly`,r,Ut.WARN),r==="normal"?0:parseInt(r??"0",10)}const Kk={source:"vskill-sidebar-own-collapsed",installed:"vskill-sidebar-installed-collapsed"},uy={source:"Own",installed:"Installed"};function Xk(t){try{const r=localStorage.getItem(t);if(r!=null)return r==="true"}catch{}try{if(typeof sessionStorage<"u"){const r=sessionStorage.getItem(t);if(r!=null)return r==="true"}}catch{}return!1}function Qk(t,r){const s=r?"true":"false";try{localStorage.setItem(t,s)}catch{}try{typeof sessionStorage<"u"&&sessionStorage.setItem(t,s)}catch{}}function wg({origin:t,count:r,filteredCount:s,updateCount:o,children:c}){const u=Kk[t],[d,h]=m.useState(()=>Xk(u)),g=m.useCallback(()=>{h(b=>{const k=!b;return Qk(u,k),k})},[u]),p=uy[t],y=`sidebar-section-${t}-header`,v=`sidebar-section-${t}-group`;return a.jsxs("section",{"aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:[a.jsxs("button",{id:y,type:"button","data-testid":"sidebar-section-header","aria-expanded":!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:[a.jsx(Jk,{collapsed:d}),a.jsx("h2",{"aria-level":2,style:{fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)",margin:0},children:p}),a.jsx("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:s!=null&&s!==r?`(${s} of ${r})`:`(${r})`}),o!=null&&o>0&&a.jsx(Zk,{origin:t,updateCount:o})]}),!d&&a.jsx("div",{id:v,role:"group","aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:c})]})}function Zk({origin:t,updateCount:r}){const[s,o]=m.useState(!1),c=uy[t].toLowerCase(),u=`${r} updates available in ${c} section, view all`;return a.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:[r," updates",a.jsx("span",{"aria-hidden":"true",style:{fontSize:9,marginLeft:2},children:"▾"})]})}function Jk({collapsed:t}){return a.jsx("svg",{"aria-hidden":"true",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:t?"rotate(0deg)":"rotate(90deg)",transition:"transform var(--duration-fast, 120ms) var(--ease-standard, ease)",flexShrink:0},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Nf(t,r){const s=r.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:r,placeholder:s="Filter skills…",validationPattern:o,validationMessage:c="Invalid filter expression"}){const u=m.useRef(null),d=m.useId(),h=!!o&&t.trim()!==""&&!o.test(t);return m.useEffect(()=>{function g(p){var b;if(p.key!=="/")return;const y=p.target;if(!y)return;const v=y.tagName;v==="INPUT"||v==="TEXTAREA"||y.isContentEditable||(p.preventDefault(),(b=u.current)==null||b.focus())}return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[]),a.jsxs("div",{role:"search",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",borderBottom:"1px solid var(--border-default)"},children:[a.jsxs("svg",{"aria-hidden":"true",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[a.jsx("circle",{cx:"11",cy:"11",r:"8"}),a.jsx("path",{d:"M21 21l-4.35-4.35"})]}),a.jsx("input",{ref: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=>r(g.currentTarget.value),onKeyDown:g=>{g.key==="Escape"&&(r(""),g.currentTarget.blur())},style:{flex:1,minWidth:0,border:"none",outline:"none",background:"transparent",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:12,padding:"2px 0"}}),h&&a.jsx("span",{id:d,role:"alert","aria-live":"polite",style:{fontFamily:"var(--font-sans)",fontSize:10,color:"var(--text-error, #B42318)",marginLeft:4,whiteSpace:"nowrap"},children:c}),a.jsx("kbd",{"aria-hidden":"true",style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",border:"1px solid var(--border-default)",padding:"1px 5px",borderRadius:3,display:t?"none":"inline-block"},children:"/"})]})}function tw({target:t}){const r=typeof t=="string"&&t.length>0,s=r?`symlinked → ${t}`:"symlinked — cycle detected or target unresolved",o=r?`symlinked from ${t}`:"symlinked, target unresolved";return a.jsx("span",{"data-testid":"symlink-chip",role:"img","aria-label":o,title:s,tabIndex:0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:14,height:14,borderRadius:3,color:"var(--text-secondary)",flexShrink:0},children:a.jsxs("svg",{"data-testid":"symlink-glyph",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),a.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})})}function nw({skill:t}){if(!t.updateAvailable)return null;const r=t.currentVersion??"",s=t.latestVersion,o=s?`Update available: ${r} → ${s}`.trim():"Update available";return a.jsx("span",{"data-testid":"skill-row-update-glyph",title:o,"aria-label":"Update available",style:{color:"var(--color-own)",display:"inline-flex",flexShrink:0},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 19V5"}),a.jsx("path",{d:"M5 12l7-7 7 7"})]})})}function aw({skillId:t,trackedForUpdates:r}){let s=null;try{s=m.useContext(kv)}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 a.jsx("span",{"data-testid":"update-chip-update-dot","aria-label":`Update available: ${o.version}`,title:c,style:{display:"inline-block",width:8,height:8,borderRadius:999,background:"var(--color-accent, #2563eb)",flexShrink:0}})}return r?null:a.jsx("span",{"data-testid":"update-chip-untracked-dot","aria-label":"Not tracked for updates",title:"Not tracked — run `vskill outdated` manually",style:{display:"inline-block",width:6,height:6,borderRadius:999,background:"var(--text-muted, var(--text-secondary))",opacity:.55,flexShrink:0}})}function Ks(t){const{version:r,showPrefix:s=!0,size:o="md"}=t;if(!r||typeof r!="string"||r.trim()==="")return null;const c=s&&!r.startsWith("v")?`v${r}`:r,u=o==="sm"?10:12,d=o==="sm"?1:2,h=o==="sm"?5:8;return a.jsx("span",{"data-testid":t["data-testid"]??"version-badge","data-version":r,title:t.title,style:{display:"inline-flex",alignItems:"center",padding:`${d}px ${h}px`,border:"1px solid var(--border, var(--border-default))",borderRadius:4,background:"var(--bg-subtle, var(--surface-1, transparent))",color:"var(--text-secondary)",fontFamily:"var(--font-mono, var(--font-geist-mono))",fontSize:u,fontVariantNumeric:"tabular-nums",lineHeight:1.2,whiteSpace:"nowrap",flexShrink:0},children:c})}function rw({skill:t,isSelected:r,onSelect:s,onContextMenu:o}){const c=t.origin==="installed"?"var(--status-installed)":"var(--status-own)";return a.jsxs("button",{type:"button",onClick:s,onContextMenu:o?u=>{u.preventDefault(),o(u,t)}:void 0,"aria-current":r?"true":void 0,"aria-selected":!!r,"data-testid":"skill-row","data-selected":r,"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:r?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",boxShadow:r?"inset 2px 0 0 var(--color-accent, var(--accent-surface))":"none",border:"none",borderRadius:0,color:"var(--text-primary)",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:13,textAlign:"left",transition:"background-color var(--duration-fast, 120ms) var(--ease-standard, ease), box-shadow var(--duration-base, 180ms) var(--ease-standard, ease)"},children:[a.jsx("span",{"aria-hidden":"true","aria-label":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"}}),a.jsx("span",{title:t.skill,style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.skill}),t.version&&a.jsx(Ks,{version:t.version,size:"sm",showPrefix:!1,"data-testid":"skill-row-version"}),t.isSymlink&&a.jsx(tw,{target:t.symlinkTarget??null}),a.jsx(nw,{skill:t}),a.jsx(aw,{skillId:`${t.plugin}/${t.skill}`,trackedForUpdates:t.trackedForUpdates??!0})]})}const Mo=m.memo(rw);function lw({plugin:t,skills:r,selectedKey:s,onSelect:o,onContextMenu:c}){const u=[...r].sort((d,h)=>d.skill.localeCompare(h.skill));return a.jsxs("div",{role:"group","aria-label":`${t} (${r.length})`,children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:t,children:t}),a.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",r.length,")"]})]}),a.jsx("div",{role:"list",children:u.map(d=>{const h=!!s&&s.plugin===d.plugin&&s.skill===d.skill;return a.jsx("div",{role:"listitem",children:a.jsx(Mo,{skill:d,isSelected:h,onSelect:()=>o(d),onContextMenu:c})},`${d.plugin}/${d.skill}`)})})]})}function sw(t,r){if(!t||typeof window>"u")return r;try{const s=window.localStorage.getItem(t);return s===null?r:s==="true"}catch{return r}}function Cg({skills:t,pluginName:r,initialCollapsed:s=!1,persistKey:o,renderSkill:c,headerActionSlot:u,forceOpen:d=!1}){var k;const h=r??((k=t[0])==null?void 0:k.pluginName)??"unknown-plugin",[g,p]=m.useState(()=>sw(o,s)),y=d?!1:g,v=m.useCallback(()=>{p(S=>{const w=!S;if(o&&typeof window<"u")try{window.localStorage.setItem(o,String(w))}catch{}return w})},[o]),b=y?"▸":"▾";return a.jsxs("div",{"data-vskill-plugin-tree":h,role:"group","aria-label":`${h} (${t.length})`,children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",paddingRight:6},children:[a.jsxs("button",{type:"button",onClick:v,"aria-expanded":!y,style:{display:"flex",alignItems:"center",gap:6,flex:1,padding:"4px 4px 4px 18px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",color:"var(--text-primary)",fontSize:12,fontWeight:500},children:[a.jsx("span",{"aria-hidden":!0,className:"vskill-chevron tabular-nums",style:{width:16,display:"inline-block",textAlign:"center",fontSize:14,fontWeight:700,color:"var(--color-ink, var(--text-primary))"},children:b}),a.jsx("span",{className:"vskill-plugin-name",style:{fontFamily:"var(--font-mono)"},children:h}),a.jsxs("span",{className:"vskill-plugin-count tabular-nums",style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:["(",t.length,")"]})]}),u&&a.jsx("div",{style:{display:"inline-flex",alignItems:"center",flexShrink:0},children:u})]}),!y&&a.jsx("div",{className:"vskill-plugin-tree-children",style:{paddingLeft:36,borderLeft:"1px solid var(--border-subtle, rgba(128,128,128,0.2))",marginLeft:24},children:t.map(S=>a.jsx("div",{"data-vskill-plugin-skill":S.pluginNamespace??S.skill,children:c(S)},`${S.pluginNamespace??S.skill}`))})]})}function iw({pluginName:t,enabled:r,onAfterAction:s}){const[o,c]=m.useState(!1),[u,d]=m.useState(null),[h,g]=m.useState(null),p=m.useRef(null);m.useEffect(()=>{if(!o)return;function v(b){p.current&&!p.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({})}),k=await b.json().catch(()=>({}));if(!b.ok||!k.ok){g(k.error??`${v} failed (${b.status})`);return}on("skills"),on("plugins"),s==null||s(),c(!1)}catch(b){g(b instanceof Error?b.message:String(b))}finally{d(null)}}return a.jsxs("div",{ref:p,style:{position:"relative",display:"inline-flex"},children:[a.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&&a.jsxs("div",{role:"menu",style:{position:"absolute",top:"calc(100% + 2px)",right:0,minWidth:160,background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,boxShadow:"0 4px 6px -1px rgba(0,0,0,0.08), 0 8px 14px -4px rgba(0,0,0,0.12)",padding:4,zIndex:30,fontFamily:"var(--font-sans)"},children:[r?a.jsx(Cd,{onClick:()=>void y("disable"),disabled:u!==null,busy:u==="disable",label:"Disable",hint:"Keep installed, turn off"}):a.jsx(Cd,{onClick:()=>void y("enable"),disabled:u!==null,busy:u==="enable",label:"Enable",hint:"Activate plugin"}),a.jsx(Cd,{onClick:()=>void y("uninstall"),disabled:u!==null,busy:u==="uninstall",label:"Uninstall",hint:"Remove plugin + skills",danger:!0}),h&&a.jsx("div",{style:{padding:"6px 8px",fontSize:11,color:"var(--color-error, #b91c1c)",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4,marginTop:4,lineHeight:1.4,maxWidth:240,wordBreak:"break-word"},children:h})]})]})}function Cd({onClick:t,disabled:r,busy:s,label:o,hint:c,danger:u}){return a.jsxs("button",{type:"button",onClick:d=>{d.stopPropagation(),t()},disabled:r,role:"menuitem",style:{display:"block",width:"100%",padding:"6px 10px",textAlign:"left",border:"none",background:"transparent",borderRadius:4,cursor:r?"not-allowed":"pointer",color:u?"var(--color-error, #b91c1c)":"var(--text-primary)",opacity:r&&!s?.5:1,fontFamily:"inherit"},onMouseEnter:d=>{r||(d.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.05))")},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:500},children:s?`${o}…`:o}),a.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)"},children:c})]})}function Eg({name:t,count:r,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))",p=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:p?"pointer":"default",border:"none",textAlign:"left"},v=c?"▸":"▾",b=a.jsxs(a.Fragment,{children:[p&&a.jsx("span",{"aria-hidden":!0,style:{fontSize:15,fontWeight:700,color:h,width:16,display:"inline-block",textAlign:"center",letterSpacing:0,textTransform:"none"},children:v}),a.jsx("span",{className:"vskill-group-header-name",children:t}),a.jsxs("span",{className:"vskill-group-header-count tabular-nums",style:{fontFamily:"var(--font-mono)",fontSize:11,fontWeight:500,color:"var(--text-secondary)",letterSpacing:0,textTransform:"none"},children:["(",r,")"]}),d&&a.jsx("span",{style:{marginLeft:"auto"},children:a.jsx(ow,{label:d.label,title:d.title,icon:d.icon,onClick:d.onClick,accent:h})})]});return p?a.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}):a.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:r,icon:s,onClick:o,accent:c}){return a.jsxs("button",{type:"button","aria-label":t,title:r??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 cw(){return a.jsxs("div",{"aria-hidden":"true",role:"presentation",style:{display:"flex",alignItems:"center",gap:8,height:36,padding:"0 12px 0 14px"},children:[a.jsx("span",{className:"placeholder",style:{width:6,height:6,borderRadius:"50%",flexShrink:0}}),a.jsx("span",{className:"placeholder",style:{height:10,flex:1,borderRadius:3,maxWidth:180}})]})}function uw(t){const r=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(r.length>1){for(const h of r.slice(0,-1)){const g=h.toLowerCase();g==="cmd"||g==="meta"||g==="⌘"?s=!0:g==="ctrl"||g==="control"?o=!0:g==="shift"?c=!0:(g==="alt"||g==="option")&&(u=!0)}d=r[r.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 dw(t){if(!t||!(t instanceof HTMLElement))return!1;const r=t.tagName;if(r==="INPUT"||r==="TEXTAREA"||t.isContentEditable)return!0;const s=t.getAttribute("contenteditable");return s!=null&&s!=="false"||t.getAttribute("role")==="textbox"}function fw(t,r){const s=!!t.metaKey,o=!!t.ctrlKey,c=!!t.shiftKey,u=!!t.altKey;return s!==r.meta||o!==r.ctrl||c!==r.shift||u!==r.alt?!1:(t.key.length===1?t.key.toLowerCase():t.key)===r.key}function ef(t,r={}){const{enabled:s=!0,target:o}=r,c=m.useRef([]),u=Array.isArray(t)?t:[t];c.current=u.map(uw),m.useEffect(()=>{if(!s)return;const d=o??(typeof window<"u"?window:void 0);if(!d)return;function h(g){const p=g,y=dw(p.target);for(const v of c.current){if(!fw(p,v))continue;const b=v.meta||v.ctrl||v.alt;if(!(y&&!v.allowInInputs&&!b)){v.handler(p);return}}}return d.addEventListener("keydown",h),()=>{d.removeEventListener("keydown",h)}},[s,o])}const pw=200;function mw(t){return t.scope==="own"||t.scope==="installed"||t.scope==="global"?t.scope:t.origin==="installed"?"installed":"own"}function hw(t,r){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=>Nf(g,r)),d={};for(const g of u){const p=g.pluginName??g.plugin;(d[p]||(d[p]=[])).push(g)}const h=Object.entries(d).sort((g,p)=>g[0].localeCompare(p[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 xw(t,r){const s=[],o=[],c=[];for(const d of t){const h=mw(d);h==="global"?c.push(d):h==="installed"?o.push(d):s.push(d)}function u(d){var y;const h=d.filter(v=>Nf(v,r)),g={};for(const v of h)(g[y=v.plugin]||(g[y]=[])).push(v);const p=Object.entries(g).sort((v,b)=>v[0].localeCompare(b[0]));return{total:d.length,filtered:h.length,byPlugin:p}}return{own:u(s),installed:u(o),global:u(c)}}function gw(t,r){const s=[],o=[];for(const u of t)(u.origin==="installed"?o:s).push(u);function c(u){var p;const d=u.filter(y=>Nf(y,r)),h={};for(const y of d)(h[p=y.plugin]||(h[p]=[])).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 vw({skills:t,selectedKey:r,onSelect:s,isLoading:o,error:c,onRetry:u,onContextMenu:d,outdatedByOrigin:h,activeAgentId:g,outdatedByScope:p,topSlot:y,revealSkillId:v,onRevealComplete:b}){const k=!!g||t.some(P=>P.scope!==void 0&&P.scope!==null),S=g??"claude-cli",[w,C]=m.useState(""),T=m.useDeferredValue(w),R=m.useMemo(()=>xw(t,T),[t,T]),L=m.useMemo(()=>hw(t,T),[t,T]),B=S==="claude-code",{data:z}=Ml("plugins",()=>fetch("/api/plugins").then(P=>P.json()),{enabled:B,ttl:6e4}),F=m.useMemo(()=>{const P=new Map;for(const ee of(z==null?void 0:z.plugins)??[]){const re=P.get(ee.name);P.set(ee.name,!!re||!!ee.enabled)}return P},[z==null?void 0:z.plugins]),[E,I]=m.useState(()=>tf(`vskill-sidebar-${S}-group-available-collapsed`)),[N,_]=m.useState(()=>tf(`vskill-sidebar-${S}-group-authoring-collapsed`)),V=m.useCallback(P=>{I(P);try{window.localStorage.setItem(`vskill-sidebar-${S}-group-available-collapsed`,String(P))}catch{}},[S]),W=m.useCallback(P=>{_(P);try{window.localStorage.setItem(`vskill-sidebar-${S}-group-authoring-collapsed`,String(P))}catch{}},[S]),{own:Y,installed:X}=m.useMemo(()=>gw(t,T),[t,T]),M=R.own.filtered+R.installed.filtered+R.global.filtered>=pw,O=m.useMemo(()=>{const P=ee=>{const re=[];for(const[,xe]of ee){const ce=[...xe].sort((ye,de)=>ye.skill.localeCompare(de.skill));re.push(...ce)}return re};return k?[...P(R.own.byPlugin),...P(R.installed.byPlugin),...P(R.global.byPlugin)]:[...P(Y.byPlugin),...P(X.byPlugin)]},[k,R.own.byPlugin,R.installed.byPlugin,R.global.byPlugin,Y.byPlugin,X.byPlugin]),U=m.useMemo(()=>r?O.findIndex(P=>P.plugin===r.plugin&&P.skill===r.skill):-1,[O,r]),G=m.useCallback(P=>{if(O.length===0)return;const ee=U<0?P>0?0:O.length-1:Math.min(Math.max(U+P,0),O.length-1);s(O[ee])},[O,U,s]),ue=m.useMemo(()=>{if(!v)return null;const[P,ee]=v.split("/");if(!P||!ee)return null;const re=t.find(ye=>ye.plugin===P&&ye.skill===ee);if(!re)return{plugin:P,skill:ee,bucket:null,pluginName:null};const xe=re.source==="plugin"?"plugin":"project",ce=xe==="plugin"?re.pluginName??P:null;return{plugin:P,skill:ee,bucket:xe,pluginName:ce}},[v,t]),D=m.useRef(null);return m.useEffect(()=>{if(!v){D.current=null;return}if(D.current===v)return;const P=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(v):v.replace(/["\\]/g,"\\$&"),ee=document.querySelector(`[data-skill-id="${P}"]`);ee&&(D.current=v,ee.scrollIntoView({behavior:"smooth",block:"nearest"}),b==null||b())},[v,b,t]),ef([{key:"j",handler:()=>G(1)},{key:"k",handler:()=>G(-1)},{key:"Enter",handler:()=>{U>=0&&s(O[U])}}],{enabled:!o&&!c}),a.jsxs("div",{"data-testid":"sidebar",style:{display:"flex",flexDirection:"column",minHeight:0,height:"100%",fontFamily:"var(--font-sans)"},children:[y,a.jsx(ew,{value:w,onChange:C}),o&&a.jsx(kw,{}),!o&&c&&a.jsx(ww,{error:c,onRetry:u}),!o&&!c&&k&&a.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[a.jsx(Eg,{name:te.scopeLabels.groupAvailable.toUpperCase(),variant:"available",collapsed:E,onToggle:V,count:L.availableProject.total+L.availablePersonal.total+L.availablePlugin.total}),!E&&a.jsxs(a.Fragment,{children:[a.jsx(Ns,{label:te.scopeLabels.sourceProject,storageKey:`vskill-sidebar-${S}-available-project-collapsed`,count:L.availableProject.total,filteredCount:w?L.availableProject.filtered:null,updateCount:(p==null?void 0:p.installed)??(h==null?void 0:h.installed),children:L.availableProject.filtered===0?a.jsx(Tg,{queryActive:!!w,agentId:S}):a.jsx(Ts,{items:L.availableProject.byPlugin,selectedKey:r,onSelect:s,onContextMenu:d,useVirtual:M})}),a.jsx(Ns,{label:te.scopeLabels.sourcePersonal,storageKey:`vskill-sidebar-${S}-available-personal-collapsed`,count:L.availablePersonal.total,filteredCount:w?L.availablePersonal.filtered:null,updateCount:p==null?void 0:p.global,children:L.availablePersonal.filtered===0?a.jsx(bw,{queryActive:!!w,agentId:S}):a.jsx(Ts,{items:L.availablePersonal.byPlugin,selectedKey:r,onSelect:s,onContextMenu:d,useVirtual:M})}),B&&a.jsxs(Ns,{label:te.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${S}-available-plugin-collapsed`,count:L.availablePlugin.total,filteredCount:w?L.availablePlugin.filtered:null,children:[a.jsxs("button",{type:"button",onClick:()=>window.dispatchEvent(new CustomEvent("studio:open-marketplace")),style:{display:"flex",alignItems:"center",gap:6,margin:"4px 14px 6px",padding:"4px 8px",fontSize:11,fontWeight:500,border:"1px dashed var(--color-accent, #2f6f8f)",borderRadius:4,background:"transparent",color:"var(--color-accent, #2f6f8f)",cursor:"pointer"},children:[a.jsx("span",{"aria-hidden":!0,children:"🛒"})," Browse marketplaces…"]}),L.availablePlugin.filtered===0?a.jsx("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:"No plugin skills installed yet."}):L.availablePlugin.byPlugin.map(([P,ee])=>a.jsx(Cg,{pluginName:P,skills:ee,persistKey:`vskill-plugin-available-${P}-collapsed`,headerActionSlot:B?a.jsx(iw,{pluginName:P,enabled:F.get(P)??!0}):void 0,renderSkill:re=>a.jsx(Mo,{skill:re,isSelected:(r==null?void 0:r.plugin)===re.plugin&&(r==null?void 0:r.skill)===re.skill,onSelect:()=>s(re),onContextMenu:d})},`available-${P}`))]})]}),a.jsx(Sw,{}),a.jsx(Eg,{name:te.scopeLabels.groupAuthoring.toUpperCase(),variant:"authoring",collapsed:ue?!1:N,onToggle:W,count:L.authoringProject.total+L.authoringPlugin.total,action:{label:"New",title:"Create a new skill (standalone or plugin)",icon:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),onClick:()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:request-create-skill",{detail:{mode:"standalone"}}))}}}),(!N||ue)&&a.jsxs(a.Fragment,{children:[a.jsx(Ns,{label:te.scopeLabels.authoringSkills,storageKey:`vskill-sidebar-${S}-authoring-project-collapsed`,count:L.authoringProject.total,filteredCount:w?L.authoringProject.filtered:null,updateCount:(p==null?void 0:p.own)??(h==null?void 0:h.source),forceOpen:(ue==null?void 0:ue.bucket)==="project",children:L.authoringProject.filtered===0?a.jsx(Ng,{queryActive:!!w}):a.jsx(Ts,{items:L.authoringProject.byPlugin,selectedKey:r,onSelect:s,onContextMenu:d,useVirtual:M})}),B&&a.jsx(Ns,{label:te.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${S}-authoring-plugin-collapsed`,count:L.authoringPlugin.total,filteredCount:w?L.authoringPlugin.filtered:null,forceOpen:(ue==null?void 0:ue.bucket)==="plugin",children:L.authoringPlugin.filtered===0?a.jsxs("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:["No plugin sources in this project. Add ",a.jsx("code",{children:"<plugin>/.claude-plugin/plugin.json"}),"."]}):L.authoringPlugin.byPlugin.map(([P,ee])=>a.jsx(Cg,{pluginName:P,skills:ee,persistKey:`vskill-plugin-authoring-${P}-collapsed`,forceOpen:(ue==null?void 0:ue.bucket)==="plugin"&&ue.pluginName===P,renderSkill:re=>a.jsx(Mo,{skill:re,isSelected:(r==null?void 0:r.plugin)===re.plugin&&(r==null?void 0:r.skill)===re.skill,onSelect:()=>s(re),onContextMenu:d})},`authoring-${P}`))})]})]}),!o&&!c&&!k&&a.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[a.jsx(wg,{origin:"source",count:Y.total,filteredCount:w?Y.filtered:null,updateCount:h==null?void 0:h.source,children:Y.filtered===0?a.jsx(Ng,{queryActive:!!w}):a.jsx(Ts,{items:Y.byPlugin,selectedKey:r,onSelect:s,onContextMenu:d,useVirtual:M})}),a.jsx(jw,{}),a.jsx(wg,{origin:"installed",count:X.total,filteredCount:w?X.filtered:null,updateCount:h==null?void 0:h.installed,children:X.filtered===0?a.jsx(Tg,{queryActive:!!w}):a.jsx(Ts,{items:X.byPlugin,selectedKey:r,onSelect:s,onContextMenu:d,useVirtual:M})})]})]})}function tf(t){if(typeof window>"u")return!1;try{return window.localStorage.getItem(t)==="true"}catch{return!1}}function Ns({label:t,storageKey:r,count:s,filteredCount:o,updateCount:c,children:u,forceOpen:d=!1}){const[h,g]=m.useState(()=>tf(r)),p=d?!1:h,y=m.useCallback(()=>{g(b=>{const k=!b;if(typeof window<"u")try{window.localStorage.setItem(r,String(k))}catch{}return k})},[r]),v=o!=null&&o!==s?`${o} of ${s}`:String(s);return a.jsxs("section",{"data-vskill-named-scope":t,children:[a.jsxs("button",{type:"button",onClick:y,"aria-expanded":!p,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 12px",background:"transparent",border:"none",cursor:"pointer",fontFamily:"var(--font-sans)",textAlign:"left"},children:[a.jsx("span",{"aria-hidden":!0,style:{fontSize:14,fontWeight:700,color:"var(--color-ink, var(--text-primary))",width:16,display:"inline-block",textAlign:"center"},children:p?"▸":"▾"}),a.jsx("span",{style:{fontSize:12,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)"},children:t}),a.jsxs("span",{style:{fontSize:11,color:"var(--text-tertiary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",v,")"]}),c!=null&&c>0&&a.jsxs("span",{style:{marginLeft:"auto",fontSize:10,color:"var(--color-own, #f59e0b)"},children:[c," update",c!==1?"s":""]})]}),!p&&a.jsx("div",{style:{paddingLeft:18},children:u})]})}function yw(t){const r=[];for(const[s,o]of t){const c=[...o].sort((u,d)=>u.skill.localeCompare(d.skill));r.push({kind:"header",plugin:s,count:c.length});for(const u of c)r.push({kind:"row",skill:u})}return r}function Ts({items:t,selectedKey:r,onSelect:s,onContextMenu:o,useVirtual:c}){if(c){const u=yw(t);return a.jsx("div",{"data-virtualized":"true",style:{height:420,minHeight:200},children:a.jsx(zk,{overscan:4,totalCount:u.length,itemContent:d=>{const h=u[d];if(!h)return null;if(h.kind==="header")return a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)"},children:h.plugin}),a.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",h.count,")"]})]});const g=h.skill,p=!!r&&r.plugin===g.plugin&&r.skill===g.skill;return a.jsx(Mo,{skill:g,isSelected:p,onSelect:()=>s(g),onContextMenu:o})}})})}return a.jsx("div",{"data-virtualized":"false",children:t.map(([u,d])=>a.jsx(lw,{plugin:u,skills:d,selectedKey:r,onSelect:s,onContextMenu:o},u))})}function Ng({queryActive:t}){return t?a.jsx(Nl,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):a.jsx(Nl,{headline:"No skills yet.",body:a.jsxs(a.Fragment,{children:["Create one with ",a.jsx(Tf,{children:"vskill new"})," or the"," ",a.jsx("strong",{style:{color:"var(--text-primary)"},children:"New skill"})," action in the top rail."]})})}function Tg({queryActive:t,agentId:r}){return t?a.jsx(Nl,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):a.jsx(Nl,{headline:r?`No skills installed for ${r} in this project.`:"No installed skills.",body:a.jsxs(a.Fragment,{children:["Run ",a.jsx(Tf,{children:"vskill install <plugin>"})," to add one."]})})}function bw({queryActive:t,agentId:r}){return t?a.jsx(Nl,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):a.jsx(Nl,{headline:`No global skills for ${r}.`,body:a.jsxs(a.Fragment,{children:["Run ",a.jsx(Tf,{children:"vskill install --global <plugin>"})," to add one."]})})}function Nl({headline:t,body:r}){return a.jsxs("div",{style:{padding:"12px 14px 16px",fontSize:12,color:"var(--text-secondary)",lineHeight:1.5},children:[a.jsx("div",{style:{fontWeight:500,color:"var(--text-primary)",marginBottom:4},children:t}),a.jsx("div",{children:r})]})}function Tf({children:t}){return a.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-primary)",background:"color-mix(in srgb, var(--border-default) 45%, transparent)",padding:"1px 4px",borderRadius:3},children:t})}function jw(){return a.jsx("div",{"aria-hidden":"true",style:{height:1,background:"var(--border-default)",margin:"4px 14px"}})}function Sw(){return a.jsx("div",{"aria-hidden":"true","data-testid":"scope-bold-divider",style:{height:3,background:"var(--color-rule)",boxShadow:"inset 0 1px 0 color-mix(in srgb, var(--color-rule) 50%, transparent)",margin:"12px 0"}})}function kw(){return a.jsx("div",{style:{padding:"8px 0"},children:[0,1,2,3,4,5].map(t=>a.jsx(cw,{},t))})}function ww({error:t,onRetry:r}){return a.jsxs("div",{role:"alert",style:{margin:"12px 14px",padding:12,border:"1px solid var(--border-default)",borderRadius:6,background:"var(--bg-canvas)",color:"var(--text-primary)",fontSize:12},children:[a.jsx("div",{style:{fontWeight:600,marginBottom:4},children:"Couldn't load skills."}),a.jsxs("details",{children:[a.jsx("summary",{style:{cursor:"pointer",color:"var(--text-secondary)",fontSize:11,marginBottom:4},children:Cw(t)}),a.jsx("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",margin:"6px 0 0"},children:t})]}),r&&a.jsx("button",{type:"button",onClick:r,style:{marginTop:8,background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"4px 10px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:"Retry"})]})}function Cw(t){const r=t.split(`
|
|
66
|
-
`)[0]??t;return r.length>80?r.slice(0,77)+"…":r}const dy=240,fy=480,py="vskill-sidebar-width",_s=320;function Rf(t){return Number.isFinite(t)?Math.round(Math.max(dy,Math.min(fy,t))):_s}function Ew(){try{const t=localStorage.getItem(py);if(!t)return _s;const r=Number(t);return Number.isFinite(r)?Rf(r):_s}catch{return _s}}function Nw(t){try{localStorage.setItem(py,String(Rf(t)))}catch{}}function Tw({initialWidth:t,onChange:r}){const s=m.useRef({startX:0,startWidth:t,pointerId:null}),o=m.useRef(t);return m.useEffect(()=>{o.current=t},[t]),m.useEffect(()=>{function c(d){if(s.current.pointerId==null||d.pointerId!==s.current.pointerId)return;const h=d.clientX-s.current.startX,g=Rf(s.current.startWidth+h);o.current=g,r(g)}function u(d){s.current.pointerId==null||d.pointerId!==s.current.pointerId||(s.current.pointerId=null,Nw(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)}},[r]),a.jsx("div",{role:"separator","aria-orientation":"vertical","aria-valuemin":dy,"aria-valuemax":fy,"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 Rw({connected:t,hint:r,onRetry:s}){return t?null:a.jsxs("aside",{"aria-live":"assertive",role:"alert",style:{display:"flex",alignItems:"center",gap:10,padding:"6px 12px",background:"color-mix(in srgb, var(--status-own) 15%, transparent)",borderBottom:"1px solid var(--border-default)",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:12},children:[a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--status-own)",display:"inline-block",flexShrink:0}}),a.jsx("span",{style:{fontWeight:500},children:"Disconnected — reconnecting…"}),r&&a.jsx("span",{style:{color:"var(--text-secondary)",fontSize:11},children:r}),a.jsx("div",{style:{flex:1}}),s&&a.jsx("button",{type:"button",onClick:s,style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"2px 8px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:"Retry now"})]})}function my(t,r){if(t!==401||typeof window>"u"||!r||typeof r!="object")return;const s=r;s.error==="invalid_api_key"&&(s.provider!=="anthropic"&&s.provider!=="openai"&&s.provider!=="openrouter"||window.dispatchEvent(new CustomEvent("studio:api-key-error",{detail:{provider:s.provider}})))}function hy(t){if(t!==void 0)try{return JSON.stringify(t)}catch(r){console.error("Failed to serialize request body:",r);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 Ed(){const[t,r]=m.useState([]),[s,o]=m.useState(!1),[c,u]=m.useState(!1),[d,h]=m.useState(null),g=m.useRef(null),p=m.useCallback(async(v,b)=>{r([]),o(!0),u(!1),h(null);const k=new AbortController;g.current=k;try{const S=hy(b),w=await fetch(v,{method:"POST",headers:{"Content-Type":"application/json"},body:S,signal:k.signal});if(!w.ok||!w.body){let B=`HTTP ${w.status}`,z;try{z=await w.json(),z&&typeof z=="object"&&"error"in z&&typeof z.error=="string"&&(B=z.error)}catch{}throw my(w.status,z),new Error(B)}const C=w.body.getReader(),T=new TextDecoder;let R="",L="";for(;;){const{done:B,value:z}=await C.read();if(B)break;R+=T.decode(z,{stream:!0});const F=R.split(`
|
|
67
|
-
`);R=F.pop()||"";for(const E of F)if(E.startsWith("event: "))L=E.slice(7).trim();else if(E.startsWith("data: ")){try{const I=JSON.parse(E.slice(6)),N={event:L,data:I};L==="done"?(u(!0),r(_=>[..._,N])):r(_=>[..._,N])}catch{}L=""}}}catch(S){S.name!=="AbortError"&&h(S.message)}finally{o(!1),g.current=null}},[]),y=m.useCallback(()=>{var v;(v=g.current)==null||v.abort()},[]);return{events:t,running:s,done:c,error:d,start:p,stop:y}}function Aw(t){const r=m.useRef(t);r.current=t;const[s,o]=m.useState(new Set),c=m.useRef(new Map),u=m.useCallback(async(p,y,v)=>{var k;(k=c.current.get(p))==null||k.abort();const b=new AbortController;c.current.set(p,b),o(S=>{const w=new Set(S);return w.add(p),w});try{const S=hy(v),w=await fetch(y,{method:"POST",headers:{"Content-Type":"application/json"},body:S,signal:b.signal});if(!w.ok||!w.body){let B=`HTTP ${w.status}`,z;try{z=await w.json(),z&&typeof z=="object"&&"error"in z&&typeof z.error=="string"&&(B=z.error)}catch{}throw my(w.status,z),new Error(B)}const C=w.body.getReader(),T=new TextDecoder;let R="",L="";for(;;){const{done:B,value:z}=await C.read();if(B)break;R+=T.decode(z,{stream:!0});const F=R.split(`
|
|
68
|
-
`);R=F.pop()||"";for(const E of F)if(E.startsWith("event: "))L=E.slice(7).trim();else if(E.startsWith("data: ")){try{const I=JSON.parse(E.slice(6)),N={event:L,data:I};r.current.onEvent(p,N)}catch{}L=""}}r.current.onDone(p)}catch(S){S.name!=="AbortError"&&r.current.onError(p,S.message)}finally{o(S=>{const w=new Set(S);return w.delete(p),w}),c.current.delete(p)}},[]),d=m.useCallback(p=>{var y;(y=c.current.get(p))==null||y.abort()},[]),h=m.useCallback(()=>{for(const p of c.current.values())p.abort()},[]),g=s.size>0;return{runningSet:s,startCase:u,stopCase:d,stopAll:h,isAnyCaseRunning:g}}const Mw={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 Lw(t,r){var s,o;switch(r.type){case"SET_LOADING":return{...t,loading:r.loading};case"SET_ERROR":return{...t,error:r.error};case"INIT_DATA":{const c=new Map;if(r.benchmark)for(const d of r.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=r.evals)==null?void 0:s.evals[0])==null?void 0:o.id)??null;return{...t,skillContent:r.skillContent,savedContent:r.skillContent,isDirty:!1,evals:r.evals,evalsError:r.evalsError??null,latestBenchmark:r.benchmark,inlineResults:c,selectedCaseId:u,loading:!1,error:null}}case"SET_PANEL":return{...t,activePanel:r.panel};case"SET_CONTENT":return{...t,skillContent:r.content,isDirty:r.content!==t.savedContent};case"CONTENT_SAVED":return{...t,savedContent:t.skillContent,isDirty:!1};case"SET_EVALS":return{...t,evals:r.evals};case"SELECT_CASE":return{...t,selectedCaseId:r.caseId};case"CASE_RUN_START":{const c=new Map(t.caseRunStates);return c.set(r.caseId,{status:"running",startedAt:Date.now(),mode:r.mode}),{...t,caseRunStates:c,runMode:r.mode,activePanel:"run"}}case"CASE_RUN_COMPLETE":{const c=new Map(t.caseRunStates),u=c.get(r.caseId);c.set(r.caseId,{status:"complete",mode:u==null?void 0:u.mode});const d=new Map(t.inlineResults);return d.set(r.caseId,r.result),{...t,caseRunStates:c,inlineResults:d}}case"CASE_RUN_ERROR":{const c=new Map(t.caseRunStates),u=c.get(r.caseId);c.set(r.caseId,{status:"error",mode:u==null?void 0:u.mode});const d=new Map(t.inlineResults);return d.set(r.caseId,{status:"error",errorMessage:r.error,assertions:[]}),{...t,caseRunStates:c,inlineResults:d}}case"CASE_RUN_CANCEL":{const c=new Map(t.caseRunStates),u=c.get(r.caseId);return c.set(r.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 r.caseIds)c.set(u,{status:"queued",mode:r.mode});return{...t,caseRunStates:c,bulkRunActive:!0,runMode:r.mode,activePanel:"run"}}case"BULK_RUN_COMPLETE":return{...t,bulkRunActive:!1,latestBenchmark:r.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(r.evalId,r.result),{...t,inlineResults:c}}case"OPEN_IMPROVE":return{...t,improveTarget:r.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,r.entry]};case"AI_EDIT_RESULT":{const c=r.evalChanges??[],u=new Map;for(let d=0;d<c.length;d++)u.set(d,!0);return{...t,aiEditLoading:!1,aiEditResult:{improved:r.improved,reasoning:r.reasoning,evalChanges:c},aiEditEvalChanges:c,aiEditEvalSelections:u}}case"AI_EDIT_ERROR":return{...t,aiEditLoading:!1,aiEditError:r.message,aiEditClassifiedError:r.classified??null};case"GENERATE_EVALS_START":return{...t,generateEvalsLoading:!0,generateEvalsProgress:[],generateEvalsError:null};case"GENERATE_EVALS_PROGRESS":return{...t,generateEvalsProgress:[...t.generateEvalsProgress,r.entry]};case"GENERATE_EVALS_DONE":return{...t,generateEvalsLoading:!1,evals:r.evals};case"GENERATE_EVALS_ERROR":return{...t,generateEvalsLoading:!1,generateEvalsError:r.classified};case"TOGGLE_EVAL_CHANGE":{const c=new Map(t.aiEditEvalSelections);return c.set(r.index,!c.get(r.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:r.evalsFile};case"SET_REGRESSIONS":return{...t,regressions:r.regressions};case"INCREMENT_ITERATION":return{...t,iterationCount:t.iterationCount+1};case"SET_ACTIVATION_PROMPTS":return{...t,activationPrompts:r.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,r.result]};case"ACTIVATION_DONE":return{...t,activationRunning:!1,activationSummary:r.summary,activationClassifyingStatus:null};case"ACTIVATION_CLASSIFYING":return{...t,activationClassifyingStatus:`Classifying prompt ${r.index}/${r.total}...`};case"ACTIVATION_ERROR":return{...t,activationRunning:!1,activationError:r.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:r.error};case"ACTIVATION_HISTORY_LOADED":return{...t,activationHistory:r.runs,activationHistoryLoading:!1};default:return t}}function zw(t){if(t==="unit"||t==="integration")return t}function Dw(t,r){const s=r.data;if(r.event==="output_ready"&&(t.output=s.output,s.durationMs!=null&&(t.durationMs=s.durationMs),s.tokens!=null&&(t.tokens=s.tokens)),r.event==="outputs_ready"&&(t.output=s.skillOutput,s.skillDurationMs!=null&&(t.durationMs=s.skillDurationMs),s.skillTokens!=null&&(t.tokens=s.skillTokens)),r.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)}r.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 xy=m.createContext(null);function Tn(){const t=m.useContext(xy);if(!t)throw new Error("useWorkspace must be used within WorkspaceProvider");return t}function _w({plugin:t,skill:r,origin:s,children:o}){const c=s==="installed",[u,d]=m.useReducer(Lw,{...Mw,plugin:t,skill:r}),h=m.useRef(new Set),g=m.useRef(new Set),p=m.useRef(new Map),y=m.useCallback((ae,fe)=>{let me=p.current.get(ae);me||(me={assertions:[]},p.current.set(ae,me)),Dw(me,fe),d({type:"UPDATE_INLINE_RESULT",evalId:ae,result:{...me,assertions:[...me.assertions]}})},[]),v=m.useCallback(ae=>{if(g.current.has(ae))return;g.current.add(ae);const fe=p.current.get(ae)??{assertions:[]};d({type:"CASE_RUN_COMPLETE",caseId:ae,result:{...fe,assertions:[...fe.assertions]}}),h.current.has(ae)&&(h.current.delete(ae),h.current.size===0&&Ee.getLatestBenchmark(t,r).then(me=>d({type:"BULK_RUN_COMPLETE",benchmark:me})).catch(()=>d({type:"BULK_RUN_COMPLETE",benchmark:null})))},[t,r]),b=m.useCallback((ae,fe)=>{g.current.has(ae)||(g.current.add(ae),d({type:"CASE_RUN_ERROR",caseId:ae,error:fe}),h.current.has(ae)&&(h.current.delete(ae),h.current.size===0&&Ee.getLatestBenchmark(t,r).then(me=>d({type:"BULK_RUN_COMPLETE",benchmark:me})).catch(()=>d({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[t,r]),{startCase:k,stopCase:S,stopAll:w}=Aw({onEvent:y,onDone:v,onError:b});m.useEffect(()=>()=>{w()},[w]);const C=m.useCallback(async()=>{try{const ae=await fetch(`/api/skills/${t}/${r}/activation-history`);if(!ae.ok){if(ae.status===404){d({type:"ACTIVATION_HISTORY_LOADED",runs:[]});return}return}const fe=await ae.json();d({type:"ACTIVATION_HISTORY_LOADED",runs:fe.runs||[]})}catch{}},[t,r]);m.useEffect(()=>{let ae=!1;async function fe(){try{const[me,he,be]=await Promise.allSettled([Ee.getSkillDetail(t,r),Ee.getEvals(t,r),Ee.getLatestBenchmark(t,r)]);if(ae)return;let Be=null,Oe=null;if(he.status==="fulfilled")Be=he.value;else{const st=he.reason;Oe=(st==null?void 0:st.message)??"Failed to load test cases"}d({type:"INIT_DATA",skillContent:me.status==="fulfilled"?me.value.skillContent:"",evals:Be,evalsError:Oe,benchmark:be.status==="fulfilled"?be.value:null})}catch(me){ae||d({type:"SET_ERROR",error:me.message})}}return fe(),C(),()=>{ae=!0}},[t,r,C]);const T=m.useCallback(async()=>{if(!c)try{await Ee.applyImprovement(t,r,u.skillContent),d({type:"CONTENT_SAVED"})}catch(ae){d({type:"SET_ERROR",error:ae.message})}},[c,t,r,u.skillContent]),R=m.useCallback(async ae=>{if(!c)try{const fe=await Ee.saveEvals(t,r,ae);d({type:"SET_EVALS",evals:fe})}catch(fe){d({type:"SET_ERROR",error:fe.message})}},[c,t,r]),L=m.useCallback((ae,fe="benchmark")=>{if(c)return;const me=u.caseRunStates.get(ae);if((me==null?void 0:me.status)!=="running")if(p.current.delete(ae),g.current.delete(ae),d({type:"CASE_RUN_START",caseId:ae,mode:fe}),fe==="comparison"){const he=`/api/skills/${t}/${r}/compare`;k(ae,he,{eval_ids:[ae]})}else{const he=`/api/skills/${t}/${r}/benchmark/case/${ae}`;k(ae,he,fe==="baseline"?{baseline_only:!0}:void 0)}},[c,t,r,u.caseRunStates,k]),B=m.useCallback((ae="benchmark")=>{var he;if(c)return;const fe=((he=u.evals)==null?void 0:he.evals)??[];if(fe.length===0)return;const me=fe.map(be=>be.id);for(const be of me)p.current.delete(be),g.current.delete(be);d({type:"BULK_RUN_START",caseIds:me,mode:ae}),h.current=new Set(me);for(const be of me)if(ae==="comparison")k(be,`/api/skills/${t}/${r}/compare`,{eval_ids:[be]});else{const Be=`/api/skills/${t}/${r}/benchmark/case/${be}`;k(be,Be,ae==="baseline"?{baseline_only:!0}:void 0)}},[c,t,r,u.evals,k]),z=m.useCallback(ae=>{S(ae),d({type:"CASE_RUN_CANCEL",caseId:ae}),h.current.delete(ae),g.current.add(ae)},[S]),F=m.useCallback(()=>{w(),d({type:"CANCEL_ALL"}),h.current.clear()},[w]),E=m.useCallback(async(ae,fe)=>{d({type:"OPEN_IMPROVE",evalId:ae})},[]),I=m.useCallback(async(ae,fe)=>{try{await Ee.applyImprovement(t,r,fe),d({type:"SET_CONTENT",content:fe}),d({type:"CONTENT_SAVED"}),d({type:"CLOSE_IMPROVE"}),L(ae,"benchmark")}catch(me){d({type:"SET_ERROR",error:me.message})}},[t,r,L]),N=Ed(),_=m.useRef(null),V=m.useRef(0);m.useEffect(()=>{const ae=N.events;for(let fe=V.current;fe<ae.length;fe++){const me=ae[fe],he=me.data;if(me.event==="progress"&&d({type:"AI_EDIT_PROGRESS",entry:{timestamp:Date.now(),phase:he.phase,message:he.message}}),me.event==="done"){const be=he.improved,Be=he.reasoning,Oe=he.evalChanges??[];d({type:"AI_EDIT_RESULT",improved:be,reasoning:Be,evalChanges:Oe})}if(me.event==="error"){const be=he;d({type:"AI_EDIT_ERROR",message:be.description||"Unknown error",classified:be})}}V.current=ae.length},[N.events]),m.useEffect(()=>{N.error&&d({type:"AI_EDIT_ERROR",message:N.error})},[N.error]),m.useEffect(()=>()=>{N.stop()},[N.stop]);const W=m.useCallback(async(ae,fe,me)=>{c||(V.current=0,d({type:"AI_EDIT_LOADING"}),_.current=N.stop,N.start(`/api/skills/${t}/${r}/improve?sse`,{mode:"instruct",instruction:ae,content:u.skillContent,evals:u.evals??{skill_name:r,evals:[]},provider:fe,model:me}))},[c,t,r,u.skillContent,u.evals,N]),Y=m.useCallback(()=>{N.stop(),d({type:"AI_EDIT_ERROR",message:"Cancelled"})},[N]),X=m.useCallback(async()=>{const ae=u.aiEditResult;if(ae!=null&&ae.improved)try{if(await Ee.applyImprovement(t,r,ae.improved),d({type:"SET_CONTENT",content:ae.improved}),d({type:"CONTENT_SAVED"}),u.aiEditEvalChanges.length>0&&Array.from(u.aiEditEvalSelections.values()).some(Boolean)){const{mergeEvalChanges:me}=await Io(async()=>{const{mergeEvalChanges:Be}=await import("./mergeEvalChanges-Dpbbs4d4.js");return{mergeEvalChanges:Be}},[]),he=u.evals??{skill_name:r,evals:[]},be=me(he,u.aiEditEvalChanges,u.aiEditEvalSelections);try{const Be=await Ee.saveEvals(t,r,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(fe){d({type:"SET_ERROR",error:fe.message})}},[t,r,u.aiEditResult,u.evals,u.aiEditEvalChanges,u.aiEditEvalSelections]),H=m.useCallback(()=>{d({type:"CLOSE_AI_EDIT"})},[]),M=m.useCallback(ae=>{d({type:"TOGGLE_EVAL_CHANGE",index:ae})},[]),O=m.useCallback(()=>{d({type:"SELECT_ALL_EVAL_CHANGES"})},[]),U=m.useCallback(()=>{d({type:"DESELECT_ALL_EVAL_CHANGES"})},[]),G=m.useCallback(async()=>{const ae=u.aiEditEvalsRetry;if(ae)try{const fe=await Ee.saveEvals(t,r,ae);d({type:"SET_EVALS",evals:fe}),d({type:"SET_ERROR",error:null}),d({type:"CLOSE_AI_EDIT"})}catch(fe){d({type:"SET_ERROR",error:`Retry failed: ${fe.message}`})}},[t,r,u.aiEditEvalsRetry]),ue=m.useCallback(async()=>{try{const ae=await Ee.getSkillDetail(t,r);d({type:"SET_CONTENT",content:ae.skillContent}),d({type:"CONTENT_SAVED"})}catch{}},[t,r]),{config:D}=_r(),P=Ed(),ee=m.useRef(0);m.useEffect(()=>{const ae=P.events;for(let fe=ee.current;fe<ae.length;fe++){const me=ae[fe],he=me.data;if(me.event==="progress"&&d({type:"GENERATE_EVALS_PROGRESS",entry:{timestamp:Date.now(),phase:he.phase,message:he.message}}),me.event==="done"){const be=he;Ee.saveEvals(t,r,be).then(Be=>d({type:"GENERATE_EVALS_DONE",evals:Be})).catch(Be=>d({type:"SET_ERROR",error:Be.message}))}me.event==="error"&&d({type:"GENERATE_EVALS_ERROR",classified:he})}ee.current=ae.length},[P.events,t,r]),m.useEffect(()=>{P.error&&d({type:"SET_ERROR",error:P.error})},[P.error]),m.useEffect(()=>()=>{P.stop()},[P.stop]);const re=m.useCallback(async ae=>{if(c)return;ee.current=0,d({type:"GENERATE_EVALS_START"});const fe={};D!=null&&D.provider&&(fe.provider=D.provider),D!=null&&D.model&&(fe.model=D.model);const me=zw(ae==null?void 0:ae.testType);me&&(fe.testType=me),P.start(`/api/skills/${t}/${r}/generate-evals?sse`,Object.keys(fe).length>0?fe:void 0)},[c,t,r,P,D]),xe=Ed(),ce=m.useRef(0);m.useEffect(()=>()=>{xe.stop()},[xe.stop]),m.useEffect(()=>{const ae=xe.events;for(let fe=ce.current;fe<ae.length;fe++){const me=ae[fe];if(me.event==="classifying"){const he=me.data;d({type:"ACTIVATION_CLASSIFYING",index:he.index,total:he.total})}if(me.event==="prompt_result"&&d({type:"ACTIVATION_RESULT",result:me.data}),me.event==="done"){ye.current&&(clearTimeout(ye.current),ye.current=null);const he=me.data;if(he.error)d({type:"ACTIVATION_ERROR",error:he.error});else{d({type:"ACTIVATION_DONE",summary:he});const be={id:`run-${Date.now()}`,timestamp:new Date().toISOString(),model:(D==null?void 0:D.model)||"unknown",provider:(D==null?void 0:D.provider)||"unknown",promptCount:he.total,summary:{precision:he.precision,recall:he.recall,reliability:he.reliability,tp:he.tp,tn:he.tn,fp:he.fp,fn:he.fn}};d({type:"ACTIVATION_HISTORY_LOADED",runs:[be,...u.activationHistory??[]]})}}}ce.current=ae.length},[xe.events,D,u.activationHistory]),m.useEffect(()=>{xe.error&&(ye.current&&(clearTimeout(ye.current),ye.current=null),d({type:"ACTIVATION_ERROR",error:xe.error}))},[xe.error]);const ye=m.useRef(null),de=m.useCallback(()=>{ye.current&&(clearTimeout(ye.current),ye.current=null),xe.stop(),d({type:"ACTIVATION_CANCEL",totalPrompts:0})},[xe]),je=m.useCallback(ae=>{const me=ae.trim().split(`
|
|
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"});ce.current=0,d({type:"ACTIVATION_START"}),d({type:"SET_ACTIVATION_PROMPTS",prompts:ae});const he={prompts:me};D!=null&&D.provider&&(he.provider=D.provider),D!=null&&D.model&&(he.model=D.model),xe.start(`/api/skills/${t}/${r}/activation-test`,he),ye.current&&clearTimeout(ye.current),ye.current=setTimeout(()=>{xe.stop(),d({type:"ACTIVATION_TIMEOUT"}),ye.current=null},12e4)},[t,r,xe,D]),Re=m.useCallback(async(ae=8)=>{d({type:"GENERATE_PROMPTS_START"});try{const fe={count:ae};D!=null&&D.provider&&(fe.provider=D.provider),D!=null&&D.model&&(fe.model=D.model);const me=await fetch(`/api/skills/${t}/${r}/activation-prompts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(fe)});if(!me.ok){let gt=`HTTP ${me.status}`;try{const Gt=await me.json();Gt.error&&(gt=Gt.error)}catch{}throw new Error(gt)}const he=me.body.getReader(),be=new TextDecoder;let Be="",Oe="",st=[];for(;;){const{done:gt,value:Gt}=await he.read();if(gt)break;Be+=be.decode(Gt,{stream:!0});const vt=Be.split(`
|
|
70
|
-
`);Be=vt.pop()||"";for(const Ze of vt)if(Ze.startsWith("event: "))Oe=Ze.slice(7).trim();else if(Ze.startsWith("data: ")){try{const at=JSON.parse(Ze.slice(6));if(Oe==="done"){if(at.error)throw new Error(at.error);st=at.prompts||[]}if(Oe==="error")throw new Error(at.message||at.description||"Generation failed")}catch(at){if(!(at instanceof SyntaxError))throw at}Oe=""}}const At=st.map(gt=>`${gt.expected==="should_activate"?"+":"!"}${gt.prompt}`).join(`
|
|
71
|
-
`);d({type:"SET_ACTIVATION_PROMPTS",prompts:At}),d({type:"GENERATE_PROMPTS_DONE"})}catch(fe){d({type:"GENERATE_PROMPTS_ERROR",error:fe.message})}},[t,r,D]),Le=m.useMemo(()=>({state:u,dispatch:d,isReadOnly:c,saveContent:T,saveEvals:R,runCase:L,runAll:B,cancelCase:z,cancelAll:F,improveForCase:E,applyImproveAndRerun:I,refreshSkillContent:ue,generateEvals:re,runActivationTest:je,cancelActivation:de,generateActivationPrompts:Re,fetchActivationHistory:C,submitAiEdit:W,cancelAiEdit:Y,applyAiEdit:X,discardAiEdit:H,toggleEvalChange:M,selectAllEvalChanges:O,deselectAllEvalChanges:U,retryEvalsSave:G}),[u,c,T,R,L,B,z,F,E,I,ue,re,je,de,Re,C,W,Y,X,H,M,O,U,G]);return a.jsx(xy.Provider,{value:Le,children:o})}function Ow(t){if(!t)return[];const r=t.split(`
|
|
72
|
-
`),s=[];for(const o of r)if(!(o.startsWith("--- ")||o.startsWith("+++ "))){if(o.startsWith("@@")){s.push({type:"header",content:o});continue}if(o.startsWith("+")){s.push({type:"add",content:o.slice(1)});continue}if(o.startsWith("-")){s.push({type:"remove",content:o.slice(1)});continue}(o.startsWith(" ")||o===""&&s.length>0)&&s.push({type:"context",content:o.startsWith(" ")?o.slice(1):""})}return s}function Af({contentDiff:t,fromLabel:r,toLabel:s,diffSummary:o,maxHeight:c=480,collapsible:u=!1,renderContext:d="inline",onRetry:h}){const[g,p]=m.useState(u),[y,v]=m.useState("unified"),b=m.useRef(null),k=m.useRef(null),S=m.useMemo(()=>Ow(t),[t]),w=m.useMemo(()=>{const z=S.filter(E=>E.type==="add").length,F=S.filter(E=>E.type==="remove").length;return{added:z,removed:F}},[S]),C=m.useMemo(()=>{let z=0,F=0;return S.filter(E=>E.type!=="header").map(E=>E.type==="remove"?(z++,{...E,origNum:z,newNum:null}):E.type==="add"?(F++,{...E,origNum:null,newNum:F}):(z++,F++,{...E,origNum:z,newNum:F}))},[S]),T=m.useMemo(()=>{const z=[],F=[];for(const E of C)if(E.type==="remove")z.push(E);else if(E.type==="add")F.push(E);else{for(;z.length<F.length;)z.push({type:"context",content:"",origNum:null,newNum:null});for(;F.length<z.length;)F.push({type:"context",content:"",origNum:null,newNum:null});z.push(E),F.push(E)}for(;z.length<F.length;)z.push({type:"context",content:"",origNum:null,newNum:null});for(;F.length<z.length;)F.push({type:"context",content:"",origNum:null,newNum:null});return{left:z,right:F}},[C]),R=m.useCallback(z=>{const F=z==="left"?b.current:k.current,E=z==="left"?k.current:b.current;F&&E&&(E.scrollTop=F.scrollTop)},[]);if(!t||S.length===0)return a.jsxs("div",{className:"rounded-lg p-6 text-center",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"Unable to load diff. Try again."}),h&&a.jsx("button",{onClick:h,className:"btn btn-secondary text-[12px]",children:"Retry"})]});const L=d==="modal"?"fixed inset-0 z-50 flex items-center justify-center bg-black/50":"",B=a.jsxs("div",{className:"rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:[r," → ",s]}),a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsxs("span",{style:{color:"var(--green)"},children:["+",w.added]}),a.jsxs("span",{style:{color:"var(--red)"},children:["-",w.removed]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>v(y==="unified"?"side-by-side":"unified"),className:"btn btn-ghost text-[11px]",children:y==="unified"?"Side-by-side":"Unified"}),u&&a.jsx("button",{onClick:()=>p(!g),className:"btn btn-ghost text-[11px]",children:g?"Expand":"Collapse"})]})]}),o&&a.jsx("div",{className:"mx-4 mt-3 px-4 py-2 rounded-lg text-[12px]",style:{background:"var(--accent-muted)",color:"var(--text-secondary)"},children:o}),!g&&(y==="unified"?a.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:c,overflowY:"auto"},children:a.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:a.jsx("tbody",{children:C.map((z,F)=>a.jsxs("tr",{style:{background:z.type==="add"?"rgba(34,197,94,0.08)":z.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[a.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:z.type==="remove"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:z.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:z.origNum??""}),a.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:z.type==="add"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:z.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:z.newNum??""}),a.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:z.type==="add"?"var(--green)":z.type==="remove"?"var(--red)":"transparent",borderRight:z.type==="add"?"2px solid var(--green)":z.type==="remove"?"2px solid var(--red)":"2px solid transparent"},children:z.type==="add"?"+":z.type==="remove"?"-":" "}),a.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:z.type==="add"?"var(--green)":z.type==="remove"?"var(--red)":"var(--text-secondary)"},children:z.content||""})]},F))})})}):a.jsxs("div",{className:"mx-4 my-4 grid grid-cols-2 gap-0 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:[a.jsx("div",{ref:b,style:{maxHeight:c,overflowY:"auto",borderRight:"1px solid var(--border-subtle)"},onScroll:()=>R("left"),children:a.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:a.jsx("tbody",{children:T.left.map((z,F)=>a.jsxs("tr",{style:{background:z.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[a.jsx("td",{className:"text-right select-none px-2",style:{width:35,fontSize:10,color:"var(--text-tertiary)",opacity:.6,borderRight:"1px solid var(--border-subtle)"},children:z.origNum??""}),a.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:z.type==="remove"?"var(--red)":"var(--text-secondary)"},children:z.content||""})]},F))})})}),a.jsx("div",{ref:k,style:{maxHeight:c,overflowY:"auto"},onScroll:()=>R("right"),children:a.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:a.jsx("tbody",{children:T.right.map((z,F)=>a.jsxs("tr",{style:{background:z.type==="add"?"rgba(34,197,94,0.08)":"transparent"},children:[a.jsx("td",{className:"text-right select-none px-2",style:{width:35,fontSize:10,color:"var(--text-tertiary)",opacity:.6,borderRight:"1px solid var(--border-subtle)"},children:z.newNum??""}),a.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:z.type==="add"?"var(--green)":"var(--text-secondary)"},children:z.content||""})]},F))})})})]}))]});return d==="modal"?a.jsx("div",{className:L,children:a.jsx("div",{style:{width:"80%",maxWidth:900},children:B})}):B}const Nd="https://verified-skill.com/submit",Bw=/^https:\/\/github\.com\/[^/?#@:]+\/[^/?#@:]+(?:[/?#].*)?$/;function Iw(t){if(!t)return Nd;const r=t.trim();return!r||!Bw.test(r)?Nd:`${Nd}?repo=${encodeURIComponent(r)}`}const Rg={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 Hw(t,r){return t?t.length>r?t.slice(0,r)+"…":t:""}function Uw(){const{state:t}=Tn(),{plugin:r,skill:s}=t,o=Zn(),{refreshSkills:c,updateCount:u}=o,d=m.useMemo(()=>o.state.skills.find(M=>M.plugin===r&&M.skill===s)??null,[o.state.skills,r,s]),h=`versions/${r}/${s}`,g=m.useCallback(()=>Ee.getSkillVersions(r,s),[r,s]),{data:p,loading:y}=Ml(h,g),[v,b]=m.useState(null),[k,S]=m.useState(null),[w,C]=m.useState(null),[T,R]=m.useState(!1),[L,B]=m.useState("idle"),[z,F]=m.useState(null),E=m.useRef(null),I=m.useRef(null),N=m.useMemo(()=>(p==null?void 0:p.find(M=>M.isInstalled))??null,[p]),_=m.useMemo(()=>(p==null?void 0:p[0])??null,[p]),V=N&&_&&N.version!==_.version,W=m.useCallback(M=>{v?!k&&M!==v?S(M):(b(M),S(null),C(null)):(b(M),C(null))},[v,k]),Y=m.useCallback(async(M,O)=>{R(!0);try{const U=await Ee.getVersionDiff(r,s,M,O);C(U)}catch{C(null)}finally{R(!1)}},[r,s]);m.useEffect(()=>{if(v&&k){const M=p||[],O=M.findIndex(D=>D.version===v),U=M.findIndex(D=>D.version===k),[G,ue]=O>U?[v,k]:[k,v];Y(G,ue)}},[v,k,p,Y]);const X=m.useCallback(()=>{!N||!_||(b(N.version),S(_.version))},[N,_]),H=m.useCallback(()=>{B("updating"),F(null);const M=Ee.startSkillUpdate(r,s);E.current=M,M.addEventListener("progress",O=>{try{switch(JSON.parse(O.data).status){case"scanning":B("scanning");break;case"installing":B("installing");break;case"done":B("done");break}}catch{B("error"),F("Unexpected response from server")}}),M.addEventListener("done",()=>{M.close(),E.current=null,c(),on(h),B("done")}),M.addEventListener("error",O=>{const U=O;let G="Connection lost";if(U.data)try{G=JSON.parse(U.data).error||"Update failed"}catch{}B("error"),F(G),M.close(),E.current=null})},[r,s,h,c]);if(m.useEffect(()=>()=>{E.current&&(E.current.close(),E.current=null)},[]),y)return a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"skeleton h-5 w-40 mb-4"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"skeleton h-14 rounded-lg"}),a.jsx("div",{className:"skeleton h-14 rounded-lg"}),a.jsx("div",{className:"skeleton h-14 rounded-lg"})]})]});if(!p||p.length===0){if((d==null?void 0:d.origin)==="source"){const O=Iw((d==null?void 0:d.homepage)??null);return a.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-16 px-8","data-testid":"versions-empty-state-local",children:[a.jsx("div",{className:"text-[14px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"No published versions yet"}),a.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."}),a.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 a.jsx("div",{className:"flex flex-col items-center justify-center h-full py-16","data-testid":"versions-empty-state-installed",children:a.jsx("div",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No version history available"})})}return a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Version History"}),a.jsxs("div",{className:"flex items-center gap-2",children:[V&&a.jsx("button",{onClick:X,className:"btn btn-secondary text-[11px]",children:"View changes since installed"}),V&&L!=="done"&&(L==="error"?a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--red)"},children:z||"Update failed"}),a.jsx("button",{onClick:H,className:"btn btn-secondary text-[11px]",children:"Retry"})]}):a.jsx("button",{onClick:H,disabled:L!=="idle",className:"btn btn-primary text-[11px]",children:L==="idle"?`Update to ${_==null?void 0:_.version}`:L==="updating"?"Starting update...":L==="scanning"?"Scanning...":"Installing..."})),u>1&&a.jsxs("button",{onClick:()=>{window.location.hash="#/updates"},className:"text-[11px] hover:underline",style:{color:"var(--text-tertiary)",background:"transparent",border:"none",cursor:"pointer"},children:["Manage all updates (",u,")"]})]})]}),v&&!k&&a.jsxs("div",{className:"text-[11px] mb-3 px-3 py-2 rounded-lg",style:{background:"var(--accent-muted)",color:"var(--accent)"},children:["Click another version to compare with ",v]}),a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute left-3 top-0 bottom-0",style:{width:2,background:"var(--border-subtle)"}}),a.jsx("div",{className:"space-y-1",children:p.map(M=>{const O=Rg[M.certTier]||Rg.COMMUNITY,U=M.version===v||M.version===k,G=M.isInstalled;return a.jsxs("button",{onClick:()=>W(M.version),className:"w-full text-left pl-8 pr-4 py-3 relative rounded-lg transition-all duration-150",style:{background:U?"var(--accent-muted)":"transparent",border:U?"1px solid var(--accent)":"1px solid transparent",cursor:"pointer"},onMouseEnter:ue=>{U||(ue.currentTarget.style.background="var(--surface-1)")},onMouseLeave:ue=>{U||(ue.currentTarget.style.background="transparent")},children:[a.jsx("span",{className:"absolute left-1.5 top-4 rounded-full",style:{width:G?10:8,height:G?10:8,background:G?"var(--accent)":"var(--surface-3)",border:G?"2px solid var(--accent)":"2px solid var(--border-default)"}}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:M.version}),a.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:O.bg,color:O.text},children:M.certTier}),G&&a.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:"var(--accent-muted)",color:"var(--accent)"},children:"installed"})]}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:new Date(M.createdAt).toLocaleDateString()})]}),M.diffSummary&&a.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:Hw(M.diffSummary,80)})]},M.version)})}),a.jsx("div",{ref:I,style:{height:1}})]}),T&&a.jsx("div",{className:"mt-4",children:a.jsx("div",{className:"skeleton h-48 rounded-xl"})}),w&&!T&&a.jsx("div",{className:"mt-4",children:a.jsx(Af,{contentDiff:w.contentDiff,fromLabel:w.from,toLabel:w.to,diffSummary:w.diffSummary,renderContext:"inline",onRetry:()=>v&&k&&Y(w.from,w.to)})})]})}function $w(t){const r=t.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!r)return{metadata:{},body:t};const s=r[1],o=r[2].trim(),c={},u=s.split(`
|
|
73
|
-
`);let d="",h=!1;for(const g of u){const p=g.match(/^[ \t]+([\w-]+):\s*(.*)$/);if(p&&d&&h){const b=p[1],k=p[2].trim();let S=c[d];if((typeof S!="object"||Array.isArray(S))&&(S={},c[d]=S),!k)S[b]=[];else{const w=k.match(/^\[(.+)\]$/);w?S[b]=w[1].split(",").map(C=>C.trim().replace(/^["']|["']$/g,"")).filter(Boolean):S[b]=k.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 k=b.match(/^\[(.+)\]$/);if(k){c[d]=k[1].split(",").map(S=>S.trim().replace(/^["']|["']$/g,"")).filter(Boolean);continue}c[d]=b.replace(/^["']|["']$/g,"")}}return{metadata:c,body:o}}function Fo(t){if(!t)return"";try{let r=t.replace(/^---\n[\s\S]*?\n---\n?/,""),s=Vw(r);return s=s.replace(/```(\w*)\n([\s\S]*?)```/g,'<pre style="background:var(--surface-2);padding:0.75rem;border-radius:6px;overflow-x:auto;font-size:12px;line-height:1.5;margin:0.5rem 0;border:1px solid var(--border-subtle)"><code>$2</code></pre>'),s=s.replace(/^### (.+)$/gm,'<div style="font-weight:600;font-size:14px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),s=s.replace(/^## (.+)$/gm,'<div style="font-weight:700;font-size:15px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),s=s.replace(/^# (.+)$/gm,'<div style="font-weight:700;font-size:1rem;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),s=s.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer" style="color:var(--accent);text-decoration:underline">$1</a>'),s=s.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),s=s.replace(/\*([^*]+)\*/g,"<em>$1</em>"),s=s.replace(/`([^`]+)`/g,'<code style="background:var(--surface-3);padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em">$1</code>'),s=s.replace(/^- (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">• $1</div>'),s=s.replace(/^(\d+)\. (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">$1. $2</div>'),s=s.replace(/\n\n/g,'<div style="height:0.5rem"></div>'),s=s.replace(/\n/g,"<br/>"),s}catch{return`<pre style="white-space:pre-wrap;font-size:12px;line-height:1.5">${t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}</pre>`}}function Vw(t){const r=t.split(`
|
|
74
|
-
`),s=[];let o=0;for(;o<r.length;)if(r[o].trim().startsWith("|")&&o+1<r.length&&r[o+1].trim().startsWith("|")&&/\|[\s-:]+\|/.test(r[o+1])){const c=Ag(r[o]);o+=2;const u=[];for(;o<r.length&&r[o].trim().startsWith("|");)u.push(Ag(r[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 p of c)g+=`<th ${d}>${p}</th>`;g+="</tr></thead><tbody>";for(const p of u){g+="<tr>";for(const y of p)g+=`<td ${h}>${y}</td>`;g+="</tr>"}g+="</tbody></table>",s.push(g)}else s.push(r[o]),o++;return s.join(`
|
|
75
|
-
`)}function Ag(t){return t.split("|").map(r=>r.trim()).filter(r=>r.length>0)}function Go(t,r){const s=t.split(`
|
|
76
|
-
`),o=r.split(`
|
|
77
|
-
`);if(s.length>1e3||o.length>1e3)return[...s.map(y=>({type:"unchanged",content:y}))];const c=s.length,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,p=u;for(;g>0||p>0;)g>0&&p>0&&s[g-1]===o[p-1]?(h.push({type:"unchanged",content:s[g-1]}),g--,p--):p>0&&(g===0||d[g][p-1]>=d[g-1][p])?(h.push({type:"added",content:o[p-1]}),p--):(h.push({type:"removed",content:s[g-1]}),g--);return h.reverse()}function Pw(t,r){if(r&&new Set(["generating","comparing","judging","judging_assertion","preparing","parsing","generating_skill","generating_baseline","scoring","action_items"]).has(t))return a.jsx("div",{className:"spinner",style:{width:10,height:10,flexShrink:0}});const o=new Set(["generating","comparing","preparing","generating_skill","generating_baseline","scoring","action_items"]);return a.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{background:o.has(t)?"var(--accent)":"var(--green)"}})}function Xs({entries:t,isRunning:r}){const[s,o]=m.useState(!1),c=m.useRef(null);return m.useEffect(()=>{c.current&&!s&&(c.current.scrollTop=c.current.scrollHeight)},[t,s]),t.length===0&&!r?null:a.jsxs("div",{className:"mt-2 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsxs("button",{onClick:()=>o(!s),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:u=>{u.currentTarget.style.color="var(--text-primary)"},onMouseLeave:u=>{u.currentTarget.style.color="var(--text-tertiary)"},children:[a.jsxs("span",{className:"flex items-center gap-2",children:[r&&a.jsx("div",{className:"spinner",style:{width:10,height:10}}),"Progress Log (",t.length,")"]}),a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{transform:s?"rotate(0)":"rotate(180deg)",transition:"transform 0.2s ease"},children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),!s&&a.jsx("div",{ref:c,className:"px-3 pb-3 space-y-1 max-h-48 overflow-y-auto",children:t.map((u,d)=>{const h=d===t.length-1&&r,g=d===0?"0s":`+${((u.timestamp-t[0].timestamp)/1e3).toFixed(1)}s`;return a.jsxs("div",{className:"flex items-center gap-2 text-[11px] animate-fade-in",style:{opacity:h?1:.7},children:[Pw(u.phase,h),a.jsx("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)",width:40},children:g}),a.jsx("span",{style:{color:h?"var(--text-primary)":"var(--text-secondary)"},children:u.message}),u.current!=null&&u.total!=null&&a.jsxs("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)"},children:["[",u.current,"/",u.total,"]"]})]},d)})})]})}const Mg={rate_limit:{icon:"⏱",color:"var(--amber, #f59e0b)"},context_window:{icon:"⚠",color:"var(--amber, #f59e0b)"},auth:{icon:"🔒",color:"var(--red, #ef4444)"},timeout:{icon:"⌛",color:"var(--amber, #f59e0b)"},model_not_found:{icon:"🔍",color:"var(--red, #ef4444)"},provider_unavailable:{icon:"⚡",color:"var(--red, #ef4444)"},parse_error:{icon:"❓",color:"var(--amber, #f59e0b)"},unknown:{icon:"❌",color:"var(--red, #ef4444)"}};function Wo({error:t,onRetry:r,onDismiss:s}){const[o,c]=m.useState(null),u=m.useRef(null);m.useEffect(()=>(t.category==="rate_limit"&&t.retryAfterMs?c(Math.ceil(t.retryAfterMs/1e3)):c(null),()=>{u.current&&clearInterval(u.current)}),[t]),m.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=Mg[t.category]||Mg.unknown,h=o!=null&&o>0;return a.jsxs("div",{className:"rounded-lg overflow-hidden animate-fade-in",style:{border:`1px solid color-mix(in srgb, ${d.color} 30%, transparent)`,background:`color-mix(in srgb, ${d.color} 6%, var(--surface-1))`},children:[a.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{style:{fontSize:14},children:d.icon}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:d.color},children:t.title})]}),s&&a.jsx("button",{onClick:s,className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)"},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"px-3.5 pb-3",children:[a.jsx("p",{className:"text-[11.5px] mb-1.5",style:{color:"var(--text-secondary)"},children:t.description}),a.jsx("p",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:t.hint}),(r||o!=null)&&a.jsx("div",{className:"flex items-center gap-2 mt-2.5",children:r&&a.jsx("button",{onClick:r,disabled:h,className:"btn btn-secondary text-[11px]",style:{padding:"4px 10px",opacity:h?.5:1},children:h?`Retry in ${o}s`:"Retry"})})]})]})}function Fw({plugin:t,skill:r,skillContent:s,onApplied:o}){const[c,u]=m.useState("closed"),{config:d}=_r(),[h,g]=m.useState("claude-cli"),[p,y]=m.useState("opus"),[v,b]=m.useState([]),[k,S]=m.useState(""),[w,C]=m.useState(""),[T,R]=m.useState(null),[L,B]=m.useState(null),[z,F]=m.useState([]),[E,I]=m.useState(!1),N=m.useRef(null);m.useEffect(()=>{if(!d)return;d.providers.find(O=>O.id==="claude-cli"&&O.available)&&(g("claude-cli"),y("opus"))},[d]),m.useEffect(()=>()=>{var M;(M=N.current)==null||M.abort()},[]);function _(){return d==null?void 0:d.providers.find(M=>M.id===h&&M.available)}const V=m.useCallback(()=>{var M;(M=N.current)==null||M.abort(),u("open")},[]);async function W(){u("loading"),R(null),B(null),F([]);const M=new AbortController;N.current=M;try{const O=await fetch(`/api/skills/${encodeURIComponent(t)}/${encodeURIComponent(r)}/improve?sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:h,model:p}),signal:M.signal});if(!O.ok||!O.body){let P=`HTTP ${O.status}`;try{const ee=await O.json();ee.error&&(P=ee.error)}catch{}throw new Error(P)}const U=O.body.getReader(),G=new TextDecoder;let ue="",D="";for(;;){const{done:P,value:ee}=await U.read();if(P)break;ue+=G.decode(ee,{stream:!0});const re=ue.split(`
|
|
78
|
-
`);ue=re.pop()||"";for(const xe of re)if(xe.startsWith("event: "))D=xe.slice(7).trim();else if(xe.startsWith("data: ")){try{const ce=JSON.parse(xe.slice(6));D==="progress"?F(ye=>[...ye,{phase:ce.phase,message:ce.message,timestamp:Date.now()}]):D==="done"||D==="complete"?(S(ce.improved),C(ce.reasoning||""),b(Go(ce.original||s,ce.improved)),u("diff_shown")):D==="error"&&(R(ce.message||ce.description||"Unknown error"),ce.category&&B(ce),u("open"))}catch{}D=""}}}catch(O){O.name!=="AbortError"&&(R(O.message),u("open"))}finally{N.current=null}}async function Y(){I(!0);try{await Ee.applyImprovement(t,r,k),o(k),u("closed")}catch(M){R(M.message)}finally{I(!1)}}function X(){u("closed"),b([]),S(""),C(""),R(null)}if(c==="closed")return a.jsxs("button",{onClick:()=>u("open"),className:"btn btn-secondary mb-5",disabled:!s,children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),a.jsx("path",{d:"M2 17l10 5 10-5"}),a.jsx("path",{d:"M2 12l10 5 10-5"})]}),"Improve Skill"]});const H=_();return a.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden animate-fade-in",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),a.jsx("path",{d:"M2 17l10 5 10-5"}),a.jsx("path",{d:"M2 12l10 5 10-5"})]})}),a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Skill Improvement"})]}),a.jsx("button",{onClick:X,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:M=>{M.currentTarget.style.background="var(--surface-3)"},onMouseLeave:M=>{M.currentTarget.style.background="transparent"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"px-5 py-4",children:[(c==="open"||c==="loading")&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-end gap-3 mb-4",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),a.jsx("select",{className:"input-field text-[12px] py-1.5",value:h,onChange:M=>{g(M.target.value);const O=d==null?void 0:d.providers.find(U=>U.id===M.target.value);O!=null&&O.models[0]&&y(O.models[0].id)},disabled:c==="loading",children:d==null?void 0:d.providers.filter(M=>M.available).map(M=>a.jsx("option",{value:M.id,children:M.label},M.id))})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),a.jsx("select",{className:"input-field text-[12px] py-1.5",value:p,onChange:M=>y(M.target.value),disabled:c==="loading",children:H==null?void 0:H.models.map(M=>a.jsx("option",{value:M.id,children:M.label},M.id))})]}),c==="loading"?a.jsx("button",{onClick:V,className:"btn btn-secondary flex-shrink-0",children:"Cancel"}):a.jsx("button",{onClick:W,className:"btn btn-primary flex-shrink-0",children:"Improve"})]}),c==="loading"&&z.length>0&&a.jsx("div",{className:"mt-3",children:a.jsx(Xs,{entries:z,isRunning:!0})})]}),T&&a.jsx("div",{className:"mb-4",children:L?a.jsx(Wo,{error:L,onRetry:W,onDismiss:()=>{R(null),B(null)}}):a.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:T})}),c==="diff_shown"&&a.jsxs(a.Fragment,{children:[w&&a.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"rgba(168,85,247,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(168,85,247,0.2)"},children:[a.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),w]}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-4",style:{border:"1px solid var(--border-subtle)",maxHeight:"400px",overflowY:"auto"},children:v.map((M,O)=>a.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:M.type==="added"?"rgba(34,197,94,0.1)":M.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:M.type==="added"?"var(--green)":M.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:M.type==="added"?"3px solid var(--green)":M.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:M.type==="added"?"+":M.type==="removed"?"-":" "}),M.content]},O))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:Y,disabled:E,className:"btn btn-primary",children:E?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"spinner",style:{width:12,height:12}})," Applying..."]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})," Apply"]})}),a.jsx("button",{onClick:X,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}const Lg={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"}},Gw={remove:"var(--red)",modify:"#fbbf24",add:"var(--green)"};function Ww({change:t,index:r,selected:s,onToggle:o,originalEval:c}){var v;const[u,d]=m.useState(!1),h=Lg[t.action]??Lg.add,g=Gw[t.action]??"var(--border-subtle)",p=t.action==="remove"?(c==null?void 0:c.name)??`Eval #${t.evalId}`:((v=t.eval)==null?void 0:v.name)??"Unnamed",y=m.useCallback(()=>o(r),[o,r]);return a.jsxs("div",{className:"rounded-lg transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderLeft:`3px solid ${g}`,opacity:s?1:.5},children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[a.jsx("input",{type:"checkbox",checked:s,onChange:y,className:"flex-shrink-0",style:{accentColor:"var(--accent)"}}),a.jsx("span",{className:"pill text-[9px] font-bold flex-shrink-0",style:{background:h.bg,color:h.color,padding:"1px 6px"},children:h.label}),a.jsx("span",{className:"text-[12px] font-medium truncate",style:{color:"var(--text-primary)"},children:p}),a.jsx("span",{className:"text-[11px] truncate flex-1",style:{color:"var(--text-tertiary)"},children:t.reason}),a.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:a.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:a.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),u&&a.jsxs("div",{className:"px-4 pb-3 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[t.action==="add"&&t.eval&&a.jsx(qw,{evalCase:t.eval}),t.action==="modify"&&t.eval&&c&&a.jsx(Yw,{original:c,proposed:t.eval}),t.action==="remove"&&c&&a.jsx(Kw,{evalCase:c})]})]})}function qw({evalCase:t}){var r;return a.jsxs("div",{className:"pt-2.5 space-y-2",children:[a.jsx(nf,{label:"Prompt",value:t.prompt}),a.jsx(nf,{label:"Expected",value:t.expected_output}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((r=t.assertions)==null?void 0:r.length)??0,")"]}),a.jsx("div",{className:"mt-1 space-y-1",children:(t.assertions??[]).map(s=>a.jsxs("div",{className:"text-[11px] flex items-start gap-1.5",style:{color:"var(--text-secondary)"},children:[a.jsx("span",{style:{color:"var(--green)"},children:"+"})," ",s.text]},s.id))})]})]})}function Yw({original:t,proposed:r}){const s=[];t.name!==r.name&&s.push({label:"Name",old:t.name,new:r.name}),t.prompt!==r.prompt&&s.push({label:"Prompt",old:t.prompt,new:r.prompt}),t.expected_output!==r.expected_output&&s.push({label:"Expected",old:t.expected_output,new:r.expected_output});const o=t.assertions??[],c=r.assertions??[],u=new Set(o.map(p=>p.text)),d=new Set(c.map(p=>p.text)),h=c.filter(p=>!u.has(p.text)),g=o.filter(p=>!d.has(p.text));return a.jsxs("div",{className:"pt-2.5 space-y-2",children:[s.map(p=>a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:p.label}),a.jsxs("div",{className:"mt-1 text-[11px] font-mono rounded p-2",style:{background:"var(--surface-1)"},children:[a.jsxs("div",{style:{color:"var(--red)",textDecoration:"line-through"},children:["- ",af(p.old,120)]}),a.jsxs("div",{style:{color:"var(--green)"},children:["+ ",af(p.new,120)]})]})]},p.label)),(h.length>0||g.length>0)&&a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Assertions"}),a.jsxs("div",{className:"mt-1 space-y-0.5",children:[g.map(p=>a.jsxs("div",{className:"text-[11px]",style:{color:"var(--red)"},children:["- ",p.text]},p.id)),h.map(p=>a.jsxs("div",{className:"text-[11px]",style:{color:"var(--green)"},children:["+ ",p.text]},p.id))]})]}),s.length===0&&h.length===0&&g.length===0&&a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"No visible field changes"})]})}function Kw({evalCase:t}){var r;return a.jsxs("div",{className:"pt-2.5 space-y-2",style:{opacity:.7},children:[a.jsx(nf,{label:"Prompt",value:t.prompt}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((r=t.assertions)==null?void 0:r.length)??0,")"]}),a.jsx("div",{className:"mt-1 space-y-0.5",children:(t.assertions??[]).map(s=>a.jsx("div",{className:"text-[11px]",style:{color:"var(--red)",textDecoration:"line-through"},children:s.text},s.id))})]})]})}function nf({label:t,value:r}){return a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:t}),a.jsx("div",{className:"mt-0.5 text-[11px] p-2 rounded font-mono",style:{background:"var(--surface-1)",color:"var(--text-secondary)",whiteSpace:"pre-wrap"},children:af(r,300)})]})}function af(t,r){return t.length>r?t.slice(0,r)+"...":t}const zg={remove:0,modify:1,add:2};function Xw({changes:t,selections:r,currentEvals:s,onToggle:o,onSelectAll:c,onDeselectAll:u}){if(t.length===0)return null;const d=t.map((g,p)=>({change:g,originalIndex:p}));d.sort((g,p)=>(zg[g.change.action]??2)-(zg[p.change.action]??2));const h=Array.from(r.values()).filter(Boolean).length;return a.jsxs("div",{className:"mt-3 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"Test Case Changes"}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",h,"/",t.length," selected)"]})]}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("button",{onClick:c,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--accent)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--accent-muted)"},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:"Select All"}),a.jsx("button",{onClick: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"})]})]}),a.jsx("div",{className:"space-y-1.5 overflow-auto",style:{maxHeight:240},children:d.map(({change:g,originalIndex:p})=>a.jsx(Ww,{change:g,index:p,selected:r.get(p)??!1,onToggle:o,originalEval:g.evalId!=null?s.find(y=>y.id===g.evalId):void 0},p))})]})}function Qw(){var M;const{state:t,dispatch:r,submitAiEdit:s,applyAiEdit:o,discardAiEdit:c,cancelAiEdit:u,toggleEvalChange:d,selectAllEvalChanges:h,deselectAllEvalChanges:g,retryEvalsSave:p}=Tn(),{aiEditLoading:y,aiEditResult:v,aiEditError:b,aiEditClassifiedError:k,aiEditProgress:S,aiEditEvalChanges:w,aiEditEvalSelections:C,aiEditEvalsRetry:T}=t,[R,L]=m.useState(""),{config:B}=_r(),[z,F]=m.useState("claude-cli"),[E,I]=m.useState("opus"),N=m.useRef(null);m.useEffect(()=>{var O;(O=N.current)==null||O.focus()},[]),m.useEffect(()=>{if(!B)return;B.providers.find(U=>U.id==="claude-cli"&&U.available)&&(F("claude-cli"),I("opus"))},[B]);const _=B==null?void 0:B.providers.find(O=>O.id===z&&O.available),V=m.useCallback(()=>{const O=R.trim();!O||y||s(O,z,E)},[R,y,s,z,E]),W=m.useCallback(O=>{O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),V()),O.key==="Escape"&&(O.preventDefault(),y?u():c())},[V,y,u,c]),Y=m.useCallback(()=>{r({type:"CLOSE_AI_EDIT"}),r({type:"OPEN_AI_EDIT"})},[r]),X=v?Go(t.skillContent,v.improved):[],H=((M=t.evals)==null?void 0:M.evals)??[];return a.jsxs("div",{className:"animate-fade-in",style:{background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-2)"},children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M15 4V2"}),a.jsx("path",{d:"M15 16v-2"}),a.jsx("path",{d:"M8 9h2"}),a.jsx("path",{d:"M20 9h2"}),a.jsx("path",{d:"M17.8 11.8L19 13"}),a.jsx("path",{d:"M15 9h.01"}),a.jsx("path",{d:"M17.8 6.2L19 5"}),a.jsx("path",{d:"M11 6.2L9.7 5"}),a.jsx("path",{d:"M3 21l9-9"})]})}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Edit"}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:"Describe what to change — Enter to submit, Esc to dismiss"})]}),a.jsx("button",{onClick:c,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:O=>{O.currentTarget.style.background="var(--surface-3)"},onMouseLeave:O=>{O.currentTarget.style.background="transparent"},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"px-4 py-3",children:[!v&&a.jsxs(a.Fragment,{children:[a.jsx("textarea",{ref:N,value:R,onChange:O=>L(O.target.value),onKeyDown:W,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}}),a.jsxs("div",{className:"flex items-end gap-2.5 mt-2",children:[a.jsxs("div",{style:{minWidth:200},children:[a.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),a.jsx("select",{className:"input-field text-[11px] py-1",value:z,onChange:O=>{F(O.target.value);const U=B==null?void 0:B.providers.find(G=>G.id===O.target.value);U!=null&&U.models[0]&&I(U.models[0].id)},disabled:y,style:{width:"100%"},children:B==null?void 0:B.providers.filter(O=>O.available).map(O=>a.jsx("option",{value:O.id,children:O.label},O.id))})]}),a.jsxs("div",{style:{minWidth:200},children:[a.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Model"}),a.jsx("select",{className:"input-field text-[11px] py-1",value:E,onChange:O=>I(O.target.value),disabled:y,style:{width:"100%"},children:_==null?void 0:_.models.map(O=>a.jsx("option",{value:O.id,children:O.label},O.id))})]}),a.jsx("div",{className:"flex-1"}),y?a.jsx("button",{onClick:u,className:"btn btn-secondary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Cancel"}):a.jsx("button",{onClick:V,disabled:!R.trim(),className:"btn btn-primary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Submit"})]}),y&&S.length>0&&a.jsx("div",{className:"mt-2.5",children:a.jsx(Xs,{entries:S,isRunning:!0})})]}),b&&a.jsx("div",{className:"mt-3",children:k?a.jsx(Wo,{error:k,onRetry:Y,onDismiss:c}):a.jsx("div",{className:"px-3 py-2.5 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:b})}),v&&a.jsxs("div",{className:"animate-fade-in",children:[v.reasoning&&a.jsxs("div",{className:"mb-3 px-3 py-2.5 rounded-lg text-[11.5px]",style:{background:"rgba(168,85,247,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(168,85,247,0.2)"},children:[a.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),v.reasoning]}),a.jsx("div",{className:"mb-1",children:a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"})}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:300,overflowY:"auto"},children:X.map((O,U)=>a.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:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:O.type==="added"?"+":O.type==="removed"?"-":" "}),O.content]},U))}),a.jsx(Xw,{changes:w,selections:C,currentEvals:H,onToggle:d,onSelectAll:h,onDeselectAll:g}),T&&a.jsxs("div",{className:"mt-3 px-3 py-2.5 rounded-lg text-[12px] flex items-center justify-between",style:{background:"rgba(251,191,36,0.12)",border:"1px solid rgba(251,191,36,0.3)",color:"#fbbf24"},children:[a.jsx("span",{children:"Test case save failed. SKILL.md was saved successfully."}),a.jsx("button",{onClick:p,className:"btn text-[11px]",style:{background:"rgba(251,191,36,0.2)",color:"#fbbf24",padding:"3px 10px"},children:"Retry Save"})]}),a.jsxs("div",{className:"flex gap-2 mt-3",children:[a.jsxs("button",{onClick:o,className:"btn btn-primary text-[11px]",style:{padding:"5px 12px"},children:[a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),a.jsx("button",{onClick:c,className:"btn btn-secondary text-[11px]",style:{padding:"5px 12px"},children:"Discard"}),a.jsx("button",{onClick:Y,className:"btn btn-ghost text-[11px]",style:{padding:"5px 12px"},children:"Try Again"})]})]})]})]})}function Zw(t,r){const[s,o]=m.useState([]),[c,u]=m.useState("SKILL.md"),[d,h]=m.useState(null),[g,p]=m.useState(!1),[y,v]=m.useState(null),b=m.useCallback(async()=>{try{const w=await Ee.getSkillFiles(t,r);o(w.files)}catch{o([])}},[t,r]);m.useEffect(()=>{u("SKILL.md"),h(null),v(null),b()},[t,r,b]);const k=m.useCallback(async w=>{if(u(w),w==="SKILL.md"){h(null),v(null);return}p(!0),v(null);try{const C=await Ee.getSkillFile(t,r,w);h(C)}catch(C){v(`Unable to open file: ${C.message}`),h(null)}finally{p(!1)}},[t,r]),S=m.useCallback(()=>{b()},[b]);return{files:s,activeFile:c,secondaryContent:d,loading:g,error:y,selectFile:k,refresh:S,isSkillMd:c==="SKILL.md"}}function Jw(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function eC(t){const r=[],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&&r.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 r}function gy({expanded:t}){return a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:t?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})}function vy(){return a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function tC(){return a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function nC(){return a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"23 4 23 10 17 10"}),a.jsx("polyline",{points:"1 20 1 14 7 14"}),a.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]})}function yy({node:t,depth:r,activeFile:s,onSelect:o}){const[c,u]=m.useState(!0),d=t.path===s;return t.type==="dir"?a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>u(!c),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+r*14}px`,paddingTop:2,paddingBottom:2,background:"none",border:"none",cursor:"pointer",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left"},children:[a.jsx(gy,{expanded:c}),a.jsx(vy,{}),a.jsxs("span",{children:[t.name,"/"]})]}),c&&t.children.map(h=>a.jsx(yy,{node:h,depth:r+1,activeFile:s,onSelect:o},h.path))]}):a.jsxs("button",{onClick:()=>o(t.path),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+r*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:[a.jsx("span",{style:{width:10}}),a.jsx(tC,{}),a.jsx("span",{style:{flex:1},children:t.name}),a.jsx("span",{style:{fontSize:9,color:"var(--text-tertiary)",marginRight:4,whiteSpace:"nowrap"},children:Jw(t.size)})]})}function aC({files:t,activeFile:r,onSelect:s,onRefresh:o}){const[c,u]=m.useState(!1),d=m.useMemo(()=>eC(t),[t]);return a.jsxs("div",{style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 8px",cursor:"pointer",userSelect:"none"},onClick:()=>u(!c),children:[a.jsx(gy,{expanded:c}),a.jsx(vy,{}),a.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r}),a.jsx("button",{onClick:h=>{h.stopPropagation(),o()},style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",padding:"2px 4px",display:"flex",alignItems:"center",borderRadius:3},title:"Refresh file list",children:a.jsx(nC,{})})]}),c&&a.jsx("div",{style:{maxHeight:240,overflowY:"auto",padding:"2px 4px 4px"},children:d.length===0?a.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 8px"},children:"No files found"}):d.map(h=>a.jsx(yy,{node:h,depth:0,activeFile:r,onSelect:s},h.path))})]})}function po(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function rC(t){try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}function lC(t){const r=t.toLowerCase();return r.endsWith(".json")?"json":r.endsWith(".md")?"md":"other"}function Dg({content:t}){return a.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 _g({content:t,fileType:r}){if(r==="json"){const s=rC(t);return a.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:s})}return r==="md"?a.jsx("div",{style:{flex:1,overflow:"auto",padding:"16px 20px",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:13,lineHeight:1.6},dangerouslySetInnerHTML:{__html:Fo(t)}}):a.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:t})}function Og(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 sC({file:t,loading:r,error:s,viewMode:o,plugin:c,skill:u,onSaved:d,onDirtyChange:h}){const[g,p]=m.useState(o),[y,v]=m.useState(!1),[b,k]=m.useState(""),[S,w]=m.useState(!1),[C,T]=m.useState(null),R=o!==g?o:g;m.useEffect(()=>{h==null||h(y)},[y,h]);const L=m.useCallback(()=>{(t==null?void 0:t.content)!=null&&(k(t.content),v(!0))},[t]),B=m.useCallback(()=>{v(!1)},[]),z=m.useCallback(async()=>{if(!(!c||!u||!t)){w(!0);try{await Ee.saveSkillFile(c,u,t.path,b),T("Saved"),v(!1),d==null||d(),setTimeout(()=>T(null),2e3)}catch(I){T(`Save failed: ${I.message}`),setTimeout(()=>T(null),3e3)}finally{w(!1)}}},[c,u,t,b,d]);if(m.useEffect(()=>{if(!y)return;const I=N=>{(N.ctrlKey||N.metaKey)&&N.key==="s"&&(N.preventDefault(),z())};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[y,z]),r)return a.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:"Loading…"});if(s)return a.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:a.jsxs("div",{style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"16px 20px",maxWidth:400,textAlign:"center"},children:[a.jsx("div",{style:{fontSize:13,color:"var(--text-primary)",fontWeight:600,marginBottom:6},children:"Unable to open file"}),a.jsx("div",{style:{fontSize:12,color:"var(--text-tertiary)"},children:s})]})});if(!t)return null;if(t.binary)return a.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:["Binary file (",po(t.size),") — cannot be displayed"]});const F=t.content??"",E=lC(t.path);return a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[t.truncated&&a.jsxs("div",{style:{padding:"4px 12px",background:"var(--warning-muted, #fef3c7)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:"var(--warning-text, #92400e)"},children:["File truncated at ",po(512*1024)," — ",po(t.size)," total"]}),a.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(I=>a.jsx("button",{onClick:()=>p(I),style:{padding:"2px 8px",fontSize:11,background:R===I?"var(--accent-muted)":"none",color:R===I?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer",textTransform:"capitalize"},children:I},I)),a.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",display:"flex",alignItems:"center",gap:6},children:[po(t.size),c&&u&&!t.binary&&!y&&a.jsx("button",{onClick:L,style:{padding:"1px 6px",fontSize:10,background:"var(--accent-muted)",color:"var(--accent)",border:"none",borderRadius:3,cursor:"pointer"},children:"Edit"}),y&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:z,disabled:S,style:{padding:"1px 6px",fontSize:10,background:"var(--accent)",color:"#fff",border:"none",borderRadius:3,cursor:"pointer",opacity:S?.6:1},children:S?"Saving...":"Save"}),a.jsx("button",{onClick:B,style:{padding:"1px 6px",fontSize:10,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer"},children:"Cancel"})]})]})]}),C&&a.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}),a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:y?a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:[a.jsx("textarea",{value:b,onChange:I=>k(I.target.value),style:{flex:1,width:"100%",resize:"none",background:"var(--surface-0)",color:"var(--text-primary)",border:"none",outline:"none",padding:"12px 16px",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6}}),a.jsxs("div",{style:{position:"sticky",bottom:0,display:"flex",alignItems:"center",gap:8,padding:"6px 12px",background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[a.jsx("span",{style:{flex:1,fontSize:11,color:"var(--text-tertiary)"},children:"Unsaved changes"}),a.jsx("button",{onClick:z,disabled:S,style:{padding:"3px 12px",fontSize:11,background:"var(--accent)",color:"#fff",border:"none",borderRadius:4,cursor:"pointer",opacity:S?.6:1},children:S?"Saving...":"Save"}),a.jsx("button",{onClick:B,style:{padding:"3px 12px",fontSize:11,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer"},children:"Cancel"})]})]}):R==="split"&&E!=="other"?a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",borderRight:"1px solid var(--border-subtle)"},children:a.jsx(Dg,{content:F})}),a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:E==="json"?a.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Og(F)}}):a.jsx(_g,{content:F,fileType:E})})]}):R==="preview"&&E!=="other"?E==="json"?a.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Og(F)}}):a.jsx(_g,{content:F,fileType:E}):a.jsx(Dg,{content:F})})]})}function iC({size:t=15}){return a.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"16 18 22 12 16 6"}),a.jsx("polyline",{points:"8 6 2 12 8 18"})]})}function oC({size:t=15}){return a.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),a.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})}function cC({size:t=15}){return a.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function uC({size:t=15}){return a.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M15 4V2"}),a.jsx("path",{d:"M15 16v-2"}),a.jsx("path",{d:"M8 9h2"}),a.jsx("path",{d:"M20 9h2"}),a.jsx("path",{d:"M17.8 11.8L19 13"}),a.jsx("path",{d:"M15 9h.01"}),a.jsx("path",{d:"M17.8 6.2L19 5"}),a.jsx("path",{d:"M11 6.2L9.7 5"}),a.jsx("path",{d:"M3 21l9-9"})]})}function Td({size:t=15}){return a.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 3l1.5 5.5L19 10l-5.5 1.5L12 17l-1.5-5.5L5 10l5.5-1.5L12 3z"})})}function dC(){const{state:t,dispatch:r,saveContent:s,isReadOnly:o}=Tn(),{plugin:c,skill:u,skillContent:d,isDirty:h,improveTarget:g,aiEditOpen:p}=t,[y,v]=m.useState("split"),[b,k]=m.useState(!1),S=m.useRef(null),[w,C]=m.useState(!1),[T,R]=m.useState(""),[L,B]=m.useState(!1),[z,F]=m.useState(null),[E,I]=m.useState([]),[N,_]=m.useState([]),[V,W]=m.useState(null),Y=m.useRef(null),{config:X}=_r(),{files:H,activeFile:M,secondaryContent:O,loading:U,error:G,selectFile:ue,refresh:D,isSkillMd:P}=Zw(c??"",u??""),[ee,re]=m.useState(!1),xe=m.useCallback(ve=>{ee&&!window.confirm("You have unsaved changes. Discard?")||ue(ve)},[ee,ue]);m.useEffect(()=>()=>{var ve;(ve=Y.current)==null||ve.abort()},[]);const{metadata:ce,body:ye}=$w(d),de=ce["allowed-tools"],je=Array.isArray(de)?de:typeof de=="string"?[de]:[],Re=ce.name,Le=ce.description,ae=ce.metadata,fe=typeof ae=="object"&&!Array.isArray(ae)?ae:null,me=ce.version||(fe==null?void 0:fe.version),he=ce.tags||(fe==null?void 0:fe.tags),be=Array.isArray(he)?he:typeof he=="string"?he.split(",").map(ve=>ve.trim()).filter(Boolean):[],Be=new Set(["name","description","metadata","allowed-tools","version","tags"]),Oe=Object.entries(ce).filter(([ve])=>!Be.has(ve)),st=m.useCallback(async()=>{k(!0),await s(),k(!1)},[s]),At=m.useCallback(ve=>{(ve.ctrlKey||ve.metaKey)&&ve.key==="s"&&(ve.preventDefault(),ve.stopPropagation(),h&&st()),(ve.ctrlKey||ve.metaKey)&&ve.key==="k"&&(ve.preventDefault(),ve.stopPropagation(),r({type:p?"CLOSE_AI_EDIT":"OPEN_AI_EDIT"}))},[h,st,p,r]),gt=m.useCallback(async()=>{var ct,Nt;if(!T.trim())return;(ct=Y.current)==null||ct.abort();const ve=new AbortController;Y.current=ve,B(!0),W(null),_([]),F(null),I([]);try{const nn=(X==null?void 0:X.provider)||"claude-cli",Rn=(X==null?void 0:X.model)||"sonnet",Vt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:T,provider:nn,model:Rn}),signal:ve.signal});if(!Vt.ok||!Vt.body){let ut=`HTTP ${Vt.status}`;try{const Fn=await Vt.json();Fn.error&&(ut=Fn.error)}catch{}throw new Error(ut)}const oa=Vt.body.getReader(),$e=new TextDecoder;let Je="",yt="";for(;;){const{done:ut,value:Fn}=await oa.read();if(ut)break;Je+=$e.decode(Fn,{stream:!0});const Qt=Je.split(`
|
|
79
|
-
`);Je=Qt.pop()||"";for(const Gn of Qt)if(Gn.startsWith("event: "))yt=Gn.slice(7).trim();else if(Gn.startsWith("data: ")){try{const se=JSON.parse(Gn.slice(6));if(yt==="progress")_(we=>[...we,{phase:se.phase,message:se.message,timestamp:Date.now()}]);else if(yt==="done"||yt==="complete"){const we=["---"];se.name&&we.push(`name: ${se.name}`),se.description&&we.push(`description: "${se.description.replace(/"/g,'\\"')}"`),se.model&&we.push(`model: ${se.model}`),(Nt=se.allowedTools)!=null&&Nt.trim()&&we.push(`allowed-tools: ${se.allowedTools.trim()}`),we.push("---","",se.body||"");const ze=we.join(`
|
|
80
|
-
`);F(ze),I(Go(d,ze)),B(!1)}else yt==="error"&&(W(se.message||se.description||"Generation failed"),B(!1))}catch{}yt=""}}}catch(nn){nn.name!=="AbortError"&&W(nn.message)}finally{B(!1),Y.current=null}},[T,X,d]),Gt=m.useCallback(()=>{z&&r({type:"SET_CONTENT",content:z}),C(!1),F(null),I([]),R(""),_([])},[z,r]),vt=m.useCallback(()=>{C(!1),F(null),I([]),R(""),_([]),W(null)},[]),Ze=m.useCallback(()=>{var ve;w?((ve=Y.current)==null||ve.abort(),vt()):(p&&r({type:"CLOSE_AI_EDIT"}),C(!0))},[w,p,r,vt]),at=[{mode:"raw",icon:a.jsx(iC,{}),label:"Editor"},{mode:"split",icon:a.jsx(oC,{}),label:"Split"},{mode:"preview",icon:a.jsx(cC,{}),label:"Preview"}];return a.jsxs("div",{className:"flex flex-col h-full",onKeyDown:At,tabIndex:-1,children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:at.map(({mode:ve,icon:ct,label:Nt})=>a.jsxs("button",{onClick:()=>v(ve),title:Nt,className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"5px 10px",background:y===ve?"var(--surface-4)":"transparent",color:y===ve?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:y===ve?600:400,border:"none",cursor:"pointer"},children:[ct,a.jsx("span",{style:{letterSpacing:"0.01em"},children:Nt})]},ve))}),P?o?a.jsx("div",{className:"flex items-center gap-2",children:a.jsxs("span",{className:"flex items-center gap-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Read-only"]})}):a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>{p?r({type:"CLOSE_AI_EDIT"}):(w&&vt(),r({type:"OPEN_AI_EDIT"}))},title:"Edit with AI (Ctrl+K)",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:p?600:400,border:"none",cursor:"pointer",color:p?"var(--purple)":"var(--text-tertiary)",background:p?"var(--purple-muted)":"transparent"},children:[a.jsx(uC,{size:13}),a.jsx("span",{children:"AI Edit"})]}),a.jsxs("button",{onClick:Ze,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:[a.jsx(Td,{size:13}),a.jsx("span",{children:"Regenerate"})]}),a.jsx("div",{style:{width:1,height:16,background:"var(--border-subtle)"}}),h&&a.jsx("button",{onClick:()=>r({type:"SET_CONTENT",content:t.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),a.jsx("button",{onClick:st,disabled:!h||b,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:b?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Saving..."]}):"Save"})]}):null]}),c&&u&&a.jsx(aC,{files:H,activeFile:M,onSelect:xe,onRefresh:D}),!P&&a.jsx(sC,{file:O,loading:U,error:G,viewMode:y,plugin:c??void 0,skill:u??void 0,onSaved:()=>{ue(M),D()},onDirtyChange:re}),P&&a.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:y==="raw"||y==="preview"?"1fr":"1fr 1fr"},children:[y!=="preview"&&a.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:y==="split"?"1px solid var(--border-subtle)":"none"},children:a.jsx("textarea",{ref:S,value:d,onChange:ve=>{o||r({type:"SET_CONTENT",content:ve.target.value})},onKeyDown:At,spellCheck:!1,readOnly:o,className:"flex-1 w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",fontSize:12.5,lineHeight:1.7,tabSize:2,border:"none",padding:"16px 20px",opacity:o?.7:1}})}),y!=="raw"&&a.jsx("div",{className:"overflow-auto",style:{background:"var(--surface-0)"},children:a.jsxs("div",{className:"animate-fade-in",style:{padding:"20px 24px",maxWidth:720},children:[(Re||me||Le)&&a.jsxs("div",{style:{marginBottom:20},children:[a.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[Re&&a.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:Re}),me&&a.jsxs("span",{style:{fontSize:10,fontWeight:600,color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4,letterSpacing:"0.03em",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:["v",me]})]}),Le&&a.jsx("p",{style:{fontSize:12.5,lineHeight:1.65,color:"var(--text-secondary)",margin:0,paddingLeft:12,borderLeft:"2px solid var(--accent)",maxWidth:600},children:Le})]}),be.length>0&&a.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:be.map(ve=>a.jsx("span",{style:{fontSize:10,fontWeight:500,color:"var(--text-tertiary)",background:"var(--surface-2)",padding:"3px 8px",borderRadius:4,letterSpacing:"0.02em"},children:ve},ve))}),je.length>0&&a.jsx("div",{style:{marginBottom:16},children:a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",marginRight:4},children:"Tools"}),je.map(ve=>a.jsx("span",{style:{fontSize:10.5,fontFamily:"var(--font-mono, ui-monospace, monospace)",color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4},children:ve},ve))]})}),Oe.length>0&&a.jsx("div",{style:{marginBottom:16,padding:"8px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:Oe.map(([ve,ct],Nt)=>{const nn=Array.isArray(ct)?ct.join(", "):typeof ct=="object"?Object.entries(ct).map(([Rn,Vt])=>`${Rn}: ${Array.isArray(Vt)?Vt.join(", "):Vt}`).join(" | "):ct;return a.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:Nt>0?"1px solid var(--border-subtle)":"none"},children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",minWidth:80,flexShrink:0},children:ve}),a.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:nn})]},ve)})}),(Re||Le||be.length>0||je.length>0||Oe.length>0)&&ye&&a.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),ye&&a.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Fo(ye)}})]})})]}),P&&p&&a.jsx(Qw,{}),P&&w&&a.jsx("div",{className:"animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:a.jsxs("div",{className:"px-4 py-3",children:[!z&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Td,{size:14}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerate Skill"})]}),a.jsx("div",{className:"flex gap-2 mb-2",children:a.jsx("textarea",{value:T,onChange:ve=>R(ve.target.value),placeholder:"Describe what this skill should do...",rows:2,disabled:L,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:L?.5:1},onKeyDown:ve=>{ve.key==="Enter"&&(ve.ctrlKey||ve.metaKey)&&T.trim()&&!L&&(ve.preventDefault(),gt())}})}),a.jsxs("div",{className:"flex items-center gap-2",children:[L?a.jsx("button",{onClick:()=>{var ve;(ve=Y.current)==null||ve.abort(),B(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):a.jsx("button",{onClick:gt,disabled:!T.trim(),className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:"Generate"}),a.jsx("button",{onClick:vt,className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Close"})]}),L&&N.length>0&&a.jsx("div",{className:"mt-2",children:a.jsx(Xs,{entries:N,isRunning:!0})}),V&&a.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:[V,a.jsx("button",{onClick:gt,className:"ml-2 underline",style:{color:"var(--red)"},children:"Retry"})]})]}),z&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Td,{size:14}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerated — Review Changes"})]}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:"300px",overflowY:"auto"},children:E.map((ve,ct)=>a.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:ve.type==="added"?"var(--green-muted)":ve.type==="removed"?"var(--red-muted)":"transparent",color:ve.type==="added"?"var(--green)":ve.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:ve.type==="added"?"3px solid var(--green)":ve.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:ve.type==="added"?"+":ve.type==="removed"?"-":" "}),ve.content]},ct))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:Gt,className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),a.jsx("button",{onClick:vt,className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Discard"})]})]})]})}),P&&g!==null&&c&&u&&a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(Fw,{plugin:c,skill:u,skillContent:d,onApplied:ve=>{r({type:"SET_CONTENT",content:ve}),r({type:"CONTENT_SAVED"}),r({type:"CLOSE_IMPROVE"})}})})]})}function kl(t){return t.testType==="integration"?"integration":"unit"}function Tl(t){return t>=.8?"var(--green)":t>=.5?"var(--yellow)":"var(--red)"}function by(t){const r=new Date(t);return r.toLocaleDateString(void 0,{month:"short",day:"numeric"})+", "+r.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function jy(t){return t==null?"--":t>=1e3?`${(t/1e3).toFixed(1)}s`:`${t}ms`}const fC=new Set(["benchmark","comparison","baseline"]);function Bg(t,r,s,o){return t.map(({rate:c,idx:u,total:d})=>{const h=o+u/(d-1)*(r-o*2),g=o+(s-o*2)-c*(s-o*2);return`${h},${g}`})}function Sy({entries:t}){const r=t.filter(v=>fC.has(v.type)).slice().reverse(),s=r.map((v,b,k)=>({rate:v.pass_rate,idx:b,total:k.length})).filter((v,b)=>{const k=r[b].type;return k==="benchmark"||k==="comparison"}),o=r.flatMap((v,b)=>v.type==="baseline"?[{rate:v.pass_rate,idx:b,total:r.length}]:v.type==="comparison"&&v.baselinePassRate!=null?[{rate:v.baselinePassRate,idx:b,total:r.length}]:[]);if(s.length<2&&o.length<2)return null;const c=80,u=24,d=2,h=s.length>=2?Bg(s,c,u,d):[],g=o.length>=2?Bg(o,c,u,d):[],p=h[h.length-1],y=g[g.length-1];return a.jsxs("svg",{width:c,height:u,style:{display:"block",flexShrink:0},children:[g.length>0&&a.jsx("polyline",{points:g.join(" "),fill:"none",stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:"3 2"}),h.length>0&&a.jsx("polyline",{points:h.join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),y&&a.jsx("circle",{cx:parseFloat(y.split(",")[0]),cy:parseFloat(y.split(",")[1]),r:2.5,fill:"var(--text-tertiary)"}),p&&a.jsx("circle",{cx:parseFloat(p.split(",")[0]),cy:parseFloat(p.split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function ky(t,r,s){const o=isNaN(r)?0:r,c=[],u=[],d=[];if((t==="PASS"||t==="EFFECTIVE")&&o>=.7){const p=c.length>0?` Met criteria: ${c.map(y=>y.criterion).join(", ")}.`:"";return{explanation:`${t} (score ${o.toFixed(2)}): evaluation met expectations.${p}`}}if(t==="FAIL"||t==="DEGRADING"){const p=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.${p}`,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 p=[...u.map(y=>`Rework "${y.criterion}" — currently at ${y.score.toFixed(2)}`),...d.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return p.length===0&&p.push("Consider restructuring your prompt approach"),{explanation:`${t} (score ${o.toFixed(2)}): below expectations but showing some capability.`,recommendations:p}}if(t==="MARGINAL"){const p=[...d.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`),...u.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return p.length===0&&p.push(c.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Review prompt instructions for areas of improvement"),{explanation:`${t} (score ${o.toFixed(2)}): moderate improvement detected.`,recommendations:p}}if(t==="EMERGING"){const p=[...u.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`),...d.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return p.length===0&&p.push(c.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Add more specific guidance to your prompt instructions"),{explanation:`${t} (score ${o.toFixed(2)}): early promise — focus on weak areas to improve.`,recommendations:p}}const h=c.length>0?` Passing: ${c.map(p=>p.criterion).join(", ")}.`:"",g=d.length>0?` Needs improvement: ${d.map(p=>p.criterion).join(", ")}.`:"";return{explanation:`${t} (score ${o.toFixed(2)}): mixed results.${h}${g}`}}const wy={EFFECTIVE:"Strong Improvement",MARGINAL:"Moderate Improvement",EMERGING:"Early Promise",INEFFECTIVE:"Needs Work",DEGRADING:"Regression"};function pC(t){return Object.hasOwn(wy,t)}function mC(t){return pC(t)?wy[t]:t}function hC(){const{state:t}=Tn(),{plugin:r,skill:s}=t,[o,c]=m.useState([]),[u,d]=m.useState([]),[h,g]=m.useState(!0),[p,y]=m.useState(null),[v,b]=m.useState(new Set),[k,S]=m.useState({}),[w,C]=m.useState(null),[T,R]=m.useState(""),[L,B]=m.useState(!1),[z,F]=m.useState(""),[E,I]=m.useState(""),N=m.useCallback(async()=>{g(!0),y(null);try{const[H,M]=await Promise.all([Ee.getCredentials(r,s),Ee.getParams(r,s)]);c(H.credentials),d(M.params)}catch(H){y(H instanceof Error?H.message:"Failed to load parameters"),c([]),d([])}finally{g(!1)}},[r,s]);m.useEffect(()=>{N()},[N]);const _=m.useCallback(async(H,M)=>{B(!0),y(null);try{await Ee.setCredential(r,s,H,M),C(null),R(""),await N()}catch(O){y(O instanceof Error?O.message:`Failed to save ${H}`)}finally{B(!1)}},[r,s,N]),V=m.useCallback(async()=>{const H=z.trim().toUpperCase(),M=E.trim();if(!(!H||!M)){B(!0),y(null);try{await Ee.setCredential(r,s,H,M),F(""),I(""),await N()}catch(O){y(O instanceof Error?O.message:`Failed to add ${H}`)}finally{B(!1)}}},[r,s,z,E,N]),W=m.useCallback(async H=>{if(v.has(H)){b(M=>{const O=new Set(M);return O.delete(H),O}),S(M=>{const O={...M};return delete O[H],O});return}try{const O=(await Ee.getParamsRevealed(r,s,H)).params.find(U=>U.name===H);O!=null&&O.value&&(S(U=>({...U,[H]:O.value})),b(U=>new Set(U).add(H)))}catch{}},[r,s,v]),Y=new Set(o.map(H=>H.name)),X=[...o.map(H=>{const M=u.find(O=>O.name===H.name);return{name:H.name,status:H.status,maskedValue:(M==null?void 0:M.maskedValue)??""}}),...u.filter(H=>!Y.has(H.name)).map(H=>({name:H.name,status:H.status,maskedValue:H.maskedValue}))];return a.jsxs("div",{className:"py-2 px-3",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters"}),p&&a.jsx("div",{className:"text-[10px] px-2 py-1.5 rounded mb-2",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},role:"alert",children:p}),h&&X.length===0&&a.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!h&&X.length===0&&!p&&a.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),X.map(H=>a.jsxs("div",{className:"flex items-center gap-2 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("span",{className:"text-[10px] font-mono flex-1 truncate",style:{color:"var(--text-primary)"},children:H.name}),a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:H.status==="ready"?"var(--green-muted)":"var(--red-muted)",color:H.status==="ready"?"var(--green)":"var(--red)"},children:H.status}),(H.maskedValue||H.status==="ready")&&a.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[v.has(H.name)?k[H.name]??H.maskedValue:H.maskedValue||"***",a.jsx("button",{onClick:()=>W(H.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${v.has(H.name)?"Hide":"Reveal"} value for ${H.name}`,children:v.has(H.name)?"hide":"show"})]}),w===H.name?a.jsxs("div",{className:"flex gap-1",children:[a.jsx("input",{value:T,onChange:M=>R(M.target.value),onKeyDown:M=>{M.key==="Enter"&&T.trim()&&_(H.name,T)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${H.name}`,autoFocus:!0}),a.jsx("button",{onClick:()=>_(H.name,T),disabled:L||!T.trim(),className:"text-[10px] font-medium",style:{color:"var(--green)",background:"none",border:"none",cursor:"pointer"},children:"Save"}),a.jsx("button",{onClick:()=>{C(null),R("")},className:"text-[10px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]}):a.jsx("button",{onClick:()=>{C(H.name),R("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},H.name)),a.jsxs("div",{className:"mt-3 pt-2",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[10px] font-medium mb-1.5",style:{color:"var(--text-secondary)"},children:"Add New Parameter"}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:z,onChange:H=>F(H.target.value),className:"input-field text-[10px] font-mono flex-1",placeholder:"KEY_NAME","aria-label":"Parameter key name"}),a.jsx("input",{value:E,onChange:H=>I(H.target.value),onKeyDown:H=>{H.key==="Enter"&&z.trim()&&E.trim()&&V()},className:"input-field text-[10px] font-mono flex-1",placeholder:"value",type:"password","aria-label":"Parameter value"}),a.jsx("button",{onClick:V,disabled:L||!z.trim()||!E.trim(),className:"text-[10px] font-medium px-2 py-1 rounded",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"none",cursor:L?"not-allowed":"pointer"},children:"Add"})]})]})]})}function xC(t,r,s){const[o,c]=m.useState(null),[u,d]=m.useState(!1),h=m.useRef("");m.useEffect(()=>{const p=`${t}/${r}/${s}`;h.current!==p&&(h.current=p,d(!0),Ee.getCaseHistory(t,r,s).then(y=>c(y)).catch(()=>c([])).finally(()=>d(!1)))},[t,r,s]);const g=m.useCallback(()=>{d(!0),h.current="",Ee.getCaseHistory(t,r,s).then(p=>c(p)).catch(()=>c([])).finally(()=>d(!1))},[t,r,s]);return{entries:o,loading:u,refetch:g}}function gC(t,r,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(p=>p.id===t)).filter(Boolean);if(u.length>=2){const p=u.filter(y=>y.pass).length/u.length;p>=.3&&p<=.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),p=h.assertions.find(y=>y.id===t);g!=null&&g.pass&&(p!=null&&p.pass)&&(o.nonDiscriminating=!0)}if(r&&!r.pass&&s.length>=1){const p=s[0].assertions.find(y=>y.id===t);p!=null&&p.pass&&(o.regression=!0)}return o}function vC(){var U;const{state:t,dispatch:r,saveEvals:s,runCase:o,runAll:c,cancelCase:u,cancelAll:d,generateEvals:h,isReadOnly:g}=Tn(),{evals:p,evalsError:y,selectedCaseId:v,inlineResults:b,caseRunStates:k,generateEvalsLoading:S,generateEvalsProgress:w,generateEvalsError:C}=t,T=m.useMemo(()=>{for(const G of k.values())if(G.status==="running"||G.status==="queued")return!0;return!1},[k]),[R,L]=m.useState(!1),[B,z]=m.useState("all"),F={skill_name:t.skill,evals:[]},E=p??F,I=E.evals,N=m.useMemo(()=>B==="all"?I:I.filter(G=>kl(G)===B),[B,I]),_=N.find(G=>G.id===v)??null;m.useEffect(()=>{v!==null&&!N.find(G=>G.id===v)&&r({type:"SELECT_CASE",caseId:N.length>0?N[0].id:null})},[N,v,r]);const[V,W]=m.useState([]),Y=m.useMemo(()=>I.some(G=>kl(G)==="integration"),[I]);m.useEffect(()=>{Y&&Ee.getCredentials(t.plugin,t.skill).then(G=>W(G.credentials)).catch(()=>W([]))},[t.plugin,t.skill,Y]);const X=m.useMemo(()=>new Set(V.filter(G=>G.status==="missing").map(G=>G.name)),[V]),[H,M]=m.useState(!1),O=m.useCallback(G=>{M(!1),h(G?{testType:G}:void 0)},[h]);return!p||I.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:y?"var(--red-muted)":"var(--accent-muted)"},children:y?a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),a.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}):a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M9 11l3 3L22 4"}),a.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),a.jsx("div",{className:"text-center",children:y?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--red)"},children:"Invalid evals.json"}),a.jsx("div",{className:"text-[11px] font-mono px-3 py-2 rounded mt-1 max-w-sm text-left break-words",style:{color:"var(--text-secondary)",background:"var(--surface-2)"},children:y}),a.jsx("div",{className:"text-[12px] mt-2",style:{color:"var(--text-tertiary)"},children:"Fix the evals.json file and reload, or regenerate test cases with AI"})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No test cases yet"}),a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Create test cases to start evaluating your skill"})]})}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>L(!0),disabled:g,className:"btn btn-primary text-[12px]",children:"Create Test Case"}),a.jsxs("div",{style:{position:"relative"},children:[a.jsxs("div",{className:"flex",children:[a.jsx("button",{onClick:()=>O("unit"),disabled:S||g,className:"btn btn-secondary text-[12px]",style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:S?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}})," Generating..."]}):"Generate Unit Tests"}),a.jsx("button",{onClick:()=>M(!H),disabled:S||g,className:"btn btn-secondary text-[12px]",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid var(--border-default)",padding:"4px 6px"},children:a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),H&&a.jsx("div",{className:"absolute right-0 mt-1 rounded-lg py-1 z-50",style:{background:"var(--surface-1)",border:"1px solid var(--border-default)",minWidth:180,boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:a.jsx("button",{onClick:()=>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:G=>{G.currentTarget.style.background="var(--surface-2)"},onMouseLeave:G=>{G.currentTarget.style.background="transparent"},children:"Generate Integration Tests"})})]})]}),S&&w.length>0&&a.jsx("div",{className:"w-full max-w-md mt-3",children:a.jsx(Xs,{entries:w,isRunning:!0})}),C&&a.jsx("div",{className:"w-full max-w-md mt-3",children:a.jsx(Wo,{error:C,onRetry:()=>O()})}),R&&a.jsx(Ig,{evals:E,onSave:G=>{s(G),L(!1)},onCancel:()=>L(!1)})]}):a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"280px 1fr",height:"100%",overflow:"hidden"},children:[a.jsxs("div",{className:"overflow-auto",style:{borderRight:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.jsxs("div",{className:"px-3 py-2",style:{borderBottom:"1px solid var(--border-subtle)",display:"flex",flexWrap:"wrap",alignItems:"center",rowGap:6,columnGap:8},children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",flex:"1 1 auto",minWidth:0},children:["Test Cases (",N.length,")"]}),a.jsx("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6,marginLeft:"auto",flexShrink:0},children:T?a.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"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>c("benchmark"),disabled:N.length===0||g,className:"btn btn-primary text-[10px] px-2 py-0.5",style:{whiteSpace:"nowrap"},children:"Run All"}),a.jsx("button",{onClick:()=>c("comparison"),disabled:N.length===0||g,className:"btn btn-secondary text-[10px] px-2 py-0.5",style:{whiteSpace:"nowrap"},children:"Compare All"})]})})]}),a.jsx("div",{className:"flex px-3 py-1.5 gap-1",style:{borderBottom:"1px solid var(--border-subtle)"},children:["all","unit","integration"].map(G=>a.jsx("button",{onClick:()=>z(G),style:{padding:"2px 8px",fontSize:10,fontWeight:B===G?600:400,background:B===G?"var(--accent-muted)":"transparent",color:B===G?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:G==="all"?`All (${I.length})`:G==="unit"?`Unit (${I.filter(ue=>kl(ue)==="unit").length})`:`Integration (${I.filter(ue=>kl(ue)==="integration").length})`},G))}),a.jsxs("div",{className:"py-1",children:[N.length===0&&I.length>0&&a.jsxs("div",{className:"flex items-center justify-center py-8 px-3 text-[12px]",style:{color:"var(--text-tertiary)"},children:["No ",B==="all"?"":B+" ","tests yet"]}),N.map(G=>{var ee;const ue=b.get(G.id),D=v===G.id,P=kl(G);return a.jsxs("button",{onClick:()=>r({type:"SELECT_CASE",caseId:G.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:D?"var(--accent-muted)":"transparent",borderLeft:D?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:re=>{D||(re.currentTarget.style.background="var(--surface-2)")},onMouseLeave:re=>{D||(re.currentTarget.style.background="transparent")},children:[a.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[a.jsxs("span",{className:"text-[12px] font-medium truncate flex items-center gap-1.5",style:{color:D?"var(--text-primary)":"var(--text-secondary)"},children:["#",G.id," ",G.name,a.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:9999,background:P==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:P==="unit"?"var(--accent)":"var(--orange)",whiteSpace:"nowrap"},children:P==="unit"?"U":"I"}),P==="integration"&&((ee=G.requiredCredentials)==null?void 0:ee.some(re=>X.has(re)))&&a.jsx("span",{title:"Configure credentials to run",children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})})]}),a.jsx(Cy,{result:ue})]}),a.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[G.assertions.length," assertion",G.assertions.length!==1?"s":"",(ue==null?void 0:ue.passRate)!=null&&a.jsx(jC,{passRate:ue.passRate})]})]},G.id)})]}),a.jsx("div",{className:"px-3 py-2",children:!g&&a.jsx("button",{onClick:()=>L(!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:G=>{G.currentTarget.style.borderColor="var(--accent)",G.currentTarget.style.color="var(--accent)"},onMouseLeave:G=>{G.currentTarget.style.borderColor="var(--border-default)",G.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})}),a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(hC,{})})]}),a.jsx("div",{className:"overflow-auto",children:_?a.jsx(yC,{evalCase:_,result:b.get(_.id),evals:p,caseStatus:((U=k.get(_.id))==null?void 0:U.status)??"idle",onSaveEvals:s,onRun:G=>o(G,"benchmark"),onCompare:G=>o(G,"comparison"),onCancel:G=>u(G),onImprove:G=>r({type:"OPEN_IMPROVE",evalId:G})}):a.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"Select a test case"})}),R&&a.jsx(Ig,{evals:E,onSave:G=>{s(G),L(!1)},onCancel:()=>L(!1)})]})}function yC({evalCase:t,result:r,evals:s,caseStatus:o,onSaveEvals:c,onRun:u,onCompare:d,onCancel:h,onImprove:g}){const{state:p,isReadOnly:y}=Tn(),{plugin:v,skill:b}=p,{entries:k,loading:S}=xC(v,b,t.id),[w,C]=m.useState(!1),[T,R]=m.useState(t.prompt),[L,B]=m.useState(!1),[z,F]=m.useState(t.expected_output);m.useState(()=>{R(t.prompt),F(t.expected_output)});const E=m.useCallback(G=>{c({...s,evals:s.evals.map(ue=>ue.id===G.id?G:ue)})},[s,c]),I=m.useCallback(()=>{E({...t,prompt:T}),C(!1)},[t,T,E]),N=m.useCallback(()=>{E({...t,expected_output:z}),B(!1)},[t,z,E]),_=m.useCallback(()=>{E({...t,assertions:[...t.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[t,E]),V=m.useCallback((G,ue)=>{E({...t,assertions:t.assertions.map(D=>D.id===G?{...D,text:ue}:D)})},[t,E]),W=m.useCallback(G=>{E({...t,assertions:t.assertions.filter(ue=>ue.id!==G)})},[t,E]),Y=m.useCallback(()=>{confirm("Delete this test case?")&&c({...s,evals:s.evals.filter(G=>G.id!==t.id)})},[s,t.id,c]),X=r&&r.assertions.length>0&&r.assertions.every(G=>G.pass),H=r&&r.assertions.some(G=>!G.pass),M=kl(t),O=t.requiredCredentials??[],U=M==="integration"&&O.length>0;return a.jsxs("div",{className:"p-5 animate-fade-in",children:[a.jsxs("div",{className:"mb-4",style:{display:"flex",flexWrap:"wrap",alignItems:"center",rowGap:8,columnGap:12},children:[a.jsxs("div",{className:"flex items-center gap-2",style:{flex:"1 1 240px",minWidth:0},children:[a.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?a.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:M==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:M==="unit"?"var(--accent)":"var(--orange)"},children:M==="unit"?"Unit":"Integration"}):a.jsx("button",{onClick:()=>{if((M==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:ue,requirements:D,cleanup:P,...ee}=t;E({...ee,testType:"unit"})}else E({...t,testType:"integration"})},title:`Click to switch to ${M==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:M==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:M==="unit"?"var(--accent)":"var(--orange)",border:"none",cursor:"pointer"},children:M==="unit"?"Unit":"Integration"}),a.jsx(Cy,{result:r})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:8,marginLeft:"auto",flexShrink:0},children:[o==="running"||o==="queued"?a.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:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel"]}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>u(t.id),disabled:y,className:"btn btn-primary text-[12px]",style:{whiteSpace:"nowrap"},children:"Run"}),a.jsx("button",{onClick:()=>d(t.id),disabled:y,className:"btn btn-secondary text-[12px]",style:{whiteSpace:"nowrap"},children:"A/B Compare"})]}),H&&!y&&o!=="running"&&o!=="queued"&&a.jsx("button",{onClick:()=>g(t.id),className:"btn btn-secondary text-[12px]",style:{whiteSpace:"nowrap"},children:"Fix with AI"}),!y&&o!=="running"&&o!=="queued"&&a.jsx("button",{onClick:Y,className:"btn btn-ghost text-[12px]","aria-label":"Delete test case",title:"Delete test case",style:{color:"var(--red)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("polyline",{points:"3 6 5 6 21 6"}),a.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})]}),y&&M==="integration"&&a.jsxs("div",{"data-testid":"platform-integration-note",className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--accent-muted)",border:"1px solid var(--accent-muted)"},children:[a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),a.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),a.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--accent)"},children:"Run locally in vSkill Studio"})]}),X&&a.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--green-muted)",border:"1px solid var(--green-muted)"},children:[a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",children:[a.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),a.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--green)"},children:"All assertions passing"})]}),U&&a.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--orange)"},children:"Required Credentials"})]}),a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:"This integration test requires the following environment variables:"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:O.map(G=>a.jsx("span",{style:{fontSize:10,fontFamily:"var(--font-mono, monospace)",padding:"2px 6px",borderRadius:4,background:"var(--orange-muted)",color:"var(--orange)"},children:G},G))})]}),!y&&M==="integration"&&a.jsx(wC,{evalCase:t,onUpdate:E}),a.jsx(mo,{title:"Prompt",children:w?a.jsxs("div",{children:[a.jsx("textarea",{value:T,onChange:G=>R(G.target.value),className:"input-field w-full",rows:4,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),a.jsxs("div",{className:"flex gap-2 mt-2",children:[a.jsx("button",{onClick:I,className:"btn btn-primary text-[12px]",children:"Save"}),a.jsx("button",{onClick:()=>{R(t.prompt),C(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):a.jsx("div",{className:"p-3 rounded-lg text-[12px] transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-secondary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)",maxHeight:200,overflowY:"auto",cursor:y?"default":"pointer"},onClick:()=>{y||C(!0)},onMouseEnter:G=>{y||(G.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:G=>{G.currentTarget.style.borderColor="var(--border-subtle)"},children:t.prompt||a.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:y?"No prompt":"Click to edit prompt..."})})}),a.jsx(mo,{title:"Expected Output",children:L?a.jsxs("div",{children:[a.jsx("textarea",{value:z,onChange:G=>F(G.target.value),className:"input-field w-full",rows:3,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),a.jsxs("div",{className:"flex gap-2 mt-2",children:[a.jsx("button",{onClick:N,className:"btn btn-primary text-[12px]",children:"Save"}),a.jsx("button",{onClick:()=>{F(t.expected_output),B(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):a.jsx("div",{className:"p-3 rounded-lg text-[12px] transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)",maxHeight:200,overflowY:"auto",cursor:y?"default":"pointer"},onClick:()=>{y||B(!0)},onMouseEnter:G=>{y||(G.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:G=>{G.currentTarget.style.borderColor="var(--border-subtle)"},children:t.expected_output||a.jsx("span",{style:{fontStyle:"italic"},children:y?"No expected output":"Click to edit expected output..."})})}),a.jsx(mo,{title:`Assertions (${t.assertions.length})`,action:y?void 0:a.jsx("button",{onClick:_,className:"btn btn-ghost text-[11px]",children:"+ Add"}),children:t.assertions.length===0?a.jsx("div",{className:"text-[12px] text-center py-4",style:{color:"var(--text-tertiary)"},children:'No assertions. Click "+ Add" to create one.'}):a.jsx("div",{className:"space-y-2",children:t.assertions.map(G=>{const ue=r==null?void 0:r.assertions.find(P=>P.assertion_id===G.id),D=gC(G.id,ue,k);return a.jsx(bC,{assertion:G,result:ue,badges:D,isReadOnly:y,onUpdate:P=>V(G.id,P),onDelete:()=>W(G.id)},G.id)})})}),(r==null?void 0:r.output)&&a.jsx(SC,{output:r.output,durationMs:r.durationMs,tokens:r.tokens}),r&&r.passRate!=null&&r.passRate<.2&&(()=>{const G=ky("INEFFECTIVE",r.passRate);return G.recommendations&&G.recommendations.length>0?a.jsx(mo,{title:"Recommendations",children:a.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),a.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--orange)"},children:"This eval is significantly below expectations"})]}),a.jsx("ul",{className:"space-y-1.5 ml-1",children:G.recommendations.map((ue,D)=>a.jsxs("li",{className:"flex items-start gap-2 text-[12px]",style:{color:"var(--text-secondary)"},children:[a.jsx("span",{style:{color:"var(--orange)",fontWeight:600,flexShrink:0},children:"•"}),ue]},D))})]})}):null})(),a.jsx(kC,{evalId:t.id,sharedEntries:k,sharedLoading:S})]},t.id)}function bC({assertion:t,result:r,badges:s,isReadOnly:o,onUpdate:c,onDelete:u}){const[d,h]=m.useState(!1),[g,p]=m.useState(t.text),[y,v]=m.useState(!1),b=()=>{c(g),h(!1)};return a.jsx("div",{className:"rounded-lg px-3 py-2.5 transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:a.jsxs("div",{className:"flex items-start gap-2",children:[r?a.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",background:r.pass?"var(--green-muted)":"var(--red-muted)"},children:r.pass?a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):a.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,border:"1.5px dashed var(--text-tertiary)",background:"transparent"},title:"Not run yet"}),(s==null?void 0:s.regression)&&a.jsx("span",{className:"mt-0.5 flex-shrink-0",title:"Regression: was passing, now failing",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:16,height:18,color:"var(--red)",fontSize:14,fontWeight:700,lineHeight:1},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("polyline",{points:"19 12 12 19 5 12"})]})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:"text-[10px] font-mono font-semibold",style:{color:"var(--text-tertiary)"},children:t.id}),(s==null?void 0:s.flaky)&&a.jsx("span",{title:"Flaky: 30-70% pass rate across recent runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"var(--yellow-muted)",color:"var(--yellow)",whiteSpace:"nowrap"},children:"Flaky"}),(s==null?void 0:s.nonDiscriminating)&&a.jsx("span",{title:"Non-discriminating: passes on both skill and baseline runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"var(--surface-3)",color:"var(--text-tertiary)",whiteSpace:"nowrap"},children:"Non-Discrim."})]}),d?a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{value:g,onChange:k=>p(k.target.value),onKeyDown:k=>{k.key==="Enter"&&b(),k.key==="Escape"&&h(!1)},className:"input-field flex-1 text-[12px]",autoFocus:!0}),a.jsx("button",{onClick:b,className:"btn btn-primary text-[11px]",children:"Save"})]}):a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-secondary)",cursor:o?"default":"pointer"},onClick:()=>{o||(p(t.text),h(!0))},children:t.text}),(r==null?void 0:r.reasoning)&&a.jsx("button",{onClick:()=>v(!y),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:y?"Hide reasoning":"Show reasoning"}),y&&(r==null?void 0:r.reasoning)&&a.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:r.reasoning})]}),!o&&a.jsx("button",{onClick:u,className:"btn btn-ghost p-1 opacity-0 group-hover:opacity-100",style:{color:"var(--text-tertiary)"},onMouseEnter:k=>{k.currentTarget.style.color="var(--red)",k.currentTarget.style.opacity="1"},onMouseLeave:k=>{k.currentTarget.style.color="var(--text-tertiary)",k.currentTarget.style.opacity=""},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})}function mo({title:t,action:r,children:s}){return a.jsxs("div",{className:"mb-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:t}),r]}),s]})}function Cy({result:t}){const[r,s]=m.useState(!1);if(!t||t.status==null)return a.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=ky(o?"PASS":"FAIL",c);return a.jsxs("span",{className:"pill text-[10px]",style:{background:o?"var(--green-muted)":"var(--red-muted)",color:o?"var(--green)":"var(--red)",position:"relative",cursor:"default"},onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),"aria-describedby":r?"verdict-tooltip":void 0,children:[t.passRate!=null?`${Math.round(t.passRate*100)}%`:t.status,r&&a.jsx("div",{id:"verdict-tooltip",role:"tooltip",style:{position:"absolute",bottom:"calc(100% + 6px)",right:0,padding:"6px 10px",background:"var(--surface-4)",border:"1px solid var(--border-subtle)",borderRadius:6,fontSize:11,color:"var(--text-secondary)",whiteSpace:"nowrap",zIndex:50,maxWidth:300,width:"max-content",boxShadow:"0 4px 12px rgba(0,0,0,0.15)"},children:d.explanation})]})}function jC({passRate:t}){const r=Math.round(t*100);return a.jsx("div",{className:"flex items-center gap-1",children:a.jsx("div",{className:"rounded-full overflow-hidden",style:{width:32,height:4,background:"var(--surface-4)"},children:a.jsx("div",{className:"h-full rounded-full",style:{width:`${r}%`,background:r>=80?"var(--green)":r>=50?"var(--yellow)":"var(--red)"}})})})}function SC({output:t,durationMs:r,tokens:s}){const[o,c]=m.useState(!1);return a.jsxs("div",{className:"mb-5",children:[a.jsxs("button",{onClick:()=>c(!o),className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:o?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),"LLM Output",r!=null&&a.jsxs("span",{style:{fontWeight:400},children:["(",(r/1e3).toFixed(1),"s)"]}),s!=null&&a.jsxs("span",{style:{fontWeight:400},children:["(",s," tokens)"]})]}),o&&a.jsx("pre",{className:"text-[12px] p-4 rounded-lg overflow-auto animate-fade-in",style:{background:"var(--surface-1)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:400,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:t})]})}function Rd(t){return t==="baseline"?"right":t==="comparison"?"full":"left"}function Ad({entry:t}){return a.jsxs("div",{className:"rounded-lg px-3 py-2.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:by(t.timestamp)}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:t.model}),a.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}),a.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:Tl(t.pass_rate)},children:[Math.round(t.pass_rate*100),"%"]})]}),a.jsxs("div",{className:"flex items-center gap-4 mb-1.5 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[t.durationMs!=null&&a.jsx("span",{children:jy(t.durationMs)}),t.tokens!=null&&a.jsxs("span",{children:[t.tokens>=1e3?`${(t.tokens/1e3).toFixed(1)}k`:t.tokens," tok"]})]}),t.type==="comparison"&&t.baselinePassRate!=null&&(()=>{const r=t.pass_rate-t.baselinePassRate,s=r>.001?"skill":r<-.001?"baseline":"tie",o=r>0?"+":"",c=s==="skill"?"var(--green)":s==="baseline"?"var(--red)":"var(--text-tertiary)";return a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"vs baseline:"}),a.jsxs("span",{className:"text-[11px] font-semibold",style:{color:r>=0?"var(--green)":"var(--red)"},children:[o,(r*100).toFixed(1),"%"]}),a.jsx("span",{className:"pill text-[9px]",style:{padding:"1px 5px",background:"var(--surface-3)",color:c},children:s})]})})(),a.jsx("div",{className:"space-y-0.5",children:t.assertions.map(r=>a.jsxs("div",{className:"flex items-start gap-1.5",children:[a.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:14,height:14,display:"flex",alignItems:"center",justifyContent:"center",background:r.pass?"var(--green-muted)":"var(--red-muted)"},children:r.pass?a.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:r.text})]},r.id))})]})}function kC({evalId:t,sharedEntries:r,sharedLoading:s}){const{state:o,dispatch:c}=Tn(),{plugin:u,skill:d}=o,[h,g]=m.useState(!0),p=r??null,y=s??!1,v=m.useCallback(()=>{g(w=>!w)},[]),b=p?p.slice(0,10):[],k=b.some(w=>{const C=Rd(w.type);return C==="left"||C==="full"}),S=b.some(w=>{const C=Rd(w.type);return C==="right"||C==="full"});return a.jsxs("div",{className:"mb-5",children:[a.jsxs("button",{onClick:v,className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:h?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Execution History",p&&p.length>0&&a.jsxs("span",{style:{fontWeight:400},children:["(",p.length," run",p.length!==1?"s":"",")"]})]}),h&&a.jsx("div",{className:"animate-fade-in",children:y?a.jsxs("div",{className:"flex items-center gap-2 py-3",children:[a.jsx("div",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),a.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):!p||p.length===0?a.jsx("div",{className:"text-[12px] py-3",style:{color:"var(--text-tertiary)"},children:"No history for this case"}):a.jsxs("div",{children:[b.length>=2&&a.jsx("div",{className:"mb-2",children:a.jsx(Sy,{entries:b})}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"1"},children:"Skill"}),a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"2"},children:"Baseline"}),!k&&a.jsx("div",{style:{gridColumn:"1",fontSize:12,color:"var(--text-tertiary)"},children:"No skill runs"}),!S&&a.jsx("div",{style:{gridColumn:"2",fontSize:12,color:"var(--text-tertiary)"},children:"No baseline runs"}),b.map((w,C)=>{const T=Rd(w.type);return T==="full"?a.jsx("div",{style:{gridColumn:"1 / -1"},children:a.jsx(Ad,{entry:w})},C):T==="left"?a.jsxs(m.Fragment,{children:[a.jsx("div",{style:{gridColumn:"1"},children:a.jsx(Ad,{entry:w})}),a.jsx("div",{style:{gridColumn:"2"}})]},C):a.jsxs(m.Fragment,{children:[a.jsx("div",{style:{gridColumn:"1"}}),a.jsx("div",{style:{gridColumn:"2"},children:a.jsx(Ad,{entry:w})})]},C)})]}),a.jsx("button",{onClick:()=>c({type:"SET_PANEL",panel:"history"}),className:"mt-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--accent)"},onMouseEnter:w=>{w.currentTarget.style.textDecoration="underline"},onMouseLeave:w=>{w.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function Ig({evals:t,onSave:r,onCancel:s}){const[o,c]=m.useState(""),[u,d]=m.useState(""),[h,g]=m.useState(""),[p,y]=m.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[v,b]=m.useState("unit"),[k,S]=m.useState(""),[w,C]=m.useState([]),[T,R]=m.useState(""),[L,B]=m.useState(""),z=Math.max(0,...t.evals.map(N=>N.id))+1,F=N=>{b(N),N==="unit"&&(C([]),S(""),R(""),B(""))},E=()=>{const N=k.trim().toUpperCase();N&&!w.includes(N)&&C([...w,N]),S("")},I=()=>{if(!o.trim()||!u.trim())return;const N={id:z,name:o.trim(),prompt:u.trim(),expected_output:h.trim(),files:[],assertions:p.filter(_=>_.text.trim()),...v==="integration"?{testType:"integration",...w.length>0?{requiredCredentials:w}:{},...T||L?{requirements:{...T?{platform:T}:{},...L?{chromeProfile:L}:{}}}:{}}:{}};r({...t,evals:[...t.evals,N]})};return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center animate-overlay-in",style:{background:"rgba(0,0,0,0.6)"},children:a.jsxs("div",{className:"w-full max-w-lg rounded-xl p-6 animate-modal-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",maxHeight:"85vh",overflowY:"auto"},children:[a.jsx("div",{className:"text-[15px] font-semibold mb-4",style:{color:"var(--text-primary)"},children:"New Test Case"}),a.jsxs("div",{className:"mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1.5 block",style:{color:"var(--text-tertiary)"},children:"Type"}),a.jsx("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)",display:"inline-flex"},children:["unit","integration"].map(N=>a.jsx("button",{onClick:()=>F(N),className:"px-3 py-1 rounded-md text-[12px] font-medium transition-all duration-150",style:{background:v===N?N==="unit"?"var(--accent-muted)":"var(--orange-muted)":"transparent",color:v===N?N==="unit"?"var(--accent)":"var(--orange)":"var(--text-tertiary)",border:"none",cursor:"pointer",textTransform:"capitalize"},children:N},N))})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Name"}),a.jsx("input",{value:o,onChange:N=>c(N.target.value),className:"input-field",placeholder:"e.g., auth-check",autoFocus:!0})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Prompt"}),a.jsx("textarea",{value:u,onChange:N=>d(N.target.value),className:"input-field",rows:3,placeholder:"User prompt to test..."})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Expected Output"}),a.jsx("textarea",{value:h,onChange:N=>g(N.target.value),className:"input-field",rows:2,placeholder:"Description of expected behavior..."})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Assertions"}),p.map((N,_)=>a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx("input",{value:N.text,onChange:V=>y(p.map((W,Y)=>Y===_?{...W,text:V.target.value}:W)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),p.length>1&&a.jsx("button",{onClick:()=>y(p.filter((V,W)=>W!==_)),className:"btn btn-ghost p-1",style:{color:"var(--text-tertiary)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},N.id)),a.jsx("button",{onClick:()=>y([...p,{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--accent)"},children:"+ Add Assertion"})]}),v==="integration"&&a.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},children:"Integration Settings"}),a.jsxs("div",{className:"mb-3",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:w.map(N=>a.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"var(--orange-muted)",color:"var(--orange)"},children:[N,a.jsx("button",{onClick:()=>C(w.filter(_=>_!==N)),style:{color:"var(--orange)",lineHeight:1},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},N))}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:k,onChange:N=>S(N.target.value),onKeyDown:N=>{N.key==="Enter"&&(N.preventDefault(),E())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., SLACK_BOT_TOKEN"}),a.jsx("button",{onClick:E,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),a.jsx("input",{value:T,onChange:N=>R(N.target.value),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),a.jsx("input",{value:L,onChange:N=>B(N.target.value),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{onClick:s,className:"btn btn-secondary text-[12px]",children:"Cancel"}),a.jsx("button",{onClick:I,disabled:!o.trim()||!u.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function wC({evalCase:t,onUpdate:r}){var d,h;const[s,o]=m.useState(""),c=()=>{const g=s.trim().toUpperCase();g&&!(t.requiredCredentials??[]).includes(g)&&r({...t,requiredCredentials:[...t.requiredCredentials??[],g]}),o("")},u=g=>{const p=(t.requiredCredentials??[]).filter(y=>y!==g);r({...t,requiredCredentials:p.length>0?p:void 0})};return a.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},children:"Integration Settings"}),a.jsxs("div",{className:"mb-2.5",children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:(t.requiredCredentials??[]).map(g=>a.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"var(--orange-muted)",color:"var(--orange)"},children:[g,a.jsx("button",{onClick:()=>u(g),style:{color:"var(--orange)",lineHeight:1},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g))}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:s,onChange:g=>o(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),c())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., GITHUB_TOKEN"}),a.jsx("button",{onClick:c,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),a.jsxs("div",{className:"mb-2.5",children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),a.jsx("input",{value:((d=t.requirements)==null?void 0:d.platform)??"",onChange:g=>r({...t,requirements:{...t.requirements,platform:g.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),a.jsx("input",{value:((h=t.requirements)==null?void 0:h.chromeProfile)??"",onChange:g=>r({...t,requirements:{...t.requirements,chromeProfile:g.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]})}function Nn(t,r){return r==="free"?"Free":r==="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 Ey(t,r){return t==null||r==null?"N/A":`${t.toLocaleString("en-US")} in / ${r.toLocaleString("en-US")} out`}function CC(t){return t==="baseline"?"Baseline Pass Rate":"Skill Pass Rate"}function EC(t,r){let s="";if(r){const c=new Date(r);isNaN(c.getTime())||(s=c.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}))}return[t,s].filter(Boolean).join(" · ")}function NC(t,r,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)*r);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 Hg(t,r){const s=o=>{const c=o/5*100;return isFinite(c)?Math.round(Math.min(100,Math.max(0,c))):0};return{skill:s(t),baseline:s(r)}}function TC(t){return t==="skill"?{text:"Skill wins",isSkill:!0}:t==="baseline"?{text:"Baseline wins",isSkill:!1}:{text:"Tie",isSkill:!1}}function RC(t,r){const s=t+r,o=s*10,c=s*25,u=d=>d>=60?`${Math.round(d/60)}m`:`${d}s`;return`${u(o)}–${u(c)}`}const AC={anthropic:.01,openrouter:.01,ollama:0,"lm-studio":0,"claude-cli":0,"codex-cli":0,"gemini-cli":0};function MC(t,r){if(!t)return null;const s=AC[t];if(s==null||s===0)return null;const o=s*r*.5,c=s*r*2;return`${Nn(o)}–${Nn(c)}`}function LC(){const{state:t,runCase:r,runAll:s,cancelCase:o,cancelAll:c,isReadOnly:u}=Tn(),{evals:d,caseRunStates:h,bulkRunActive:g,latestBenchmark:p,inlineResults:y}=t,{config:v}=_r(),b=(d==null?void 0:d.evals)??[],k=m.useMemo(()=>{for(const E of h.values())if(E.status==="running"||E.status==="queued")return!0;return!1},[h]),S=b.filter(E=>{const I=h.get(E.id);return I&&(I.status==="complete"||I.status==="error"||I.status==="cancelled")}).length,w=b.filter(E=>{const I=h.get(E.id);return I&&(I.status==="running"||I.status==="queued")}).length,C=m.useRef(null),[T,R]=m.useState(0);m.useEffect(()=>{if(k&&!C.current&&(C.current=Date.now()),!k){C.current=null,R(0);return}const E=setInterval(()=>{C.current&&R(Math.round((Date.now()-C.current)/1e3))},1e3);return()=>clearInterval(E)},[k]);const L=b.reduce((E,I)=>E+I.assertions.length,0),B=b.length+L,z=m.useMemo(()=>RC(b.length,L),[b.length,L]),F=m.useMemo(()=>MC((v==null?void 0:v.provider)??null,B),[v==null?void 0:v.provider,B]);return a.jsxs("div",{className:"p-5",children:[u&&a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-4 text-[11px]",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Installed skill — benchmarking is disabled. Edit the source skill to run benchmarks."]}),a.jsxs("div",{className:"rounded-xl p-4 mb-5",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Benchmark"}),k&&a.jsxs("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:[w," running"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[k&&a.jsxs("button",{onClick:c,className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel All"]}),a.jsx("button",{onClick:()=>s("comparison"),disabled:b.length===0||k||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"}),a.jsx("button",{onClick:()=>s("benchmark"),disabled:b.length===0||k||u,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using your skill only",children:"Test Skill"}),a.jsx("button",{onClick:()=>s("baseline"),disabled:b.length===0||k||u,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using the baseline (no skill) for reference",children:"Test Baseline"})]}),!k&&b.length>0&&a.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[10px]",style:{color:"var(--text-tertiary)"},children:[a.jsxs("span",{children:["Est. duration: ",z]}),F&&a.jsxs("span",{children:["Est. cost: ",F]}),!F&&(v==null?void 0:v.provider)&&(v.provider==="claude-cli"||v.provider==="codex-cli")&&a.jsx("span",{children:"Cost: Included"}),!F&&(v==null?void 0:v.provider)&&(v.provider==="ollama"||v.provider==="lm-studio"||v.provider==="gemini-cli")&&a.jsx("span",{children:"Cost: Free"})]})]}),k&&b.length>0&&a.jsxs("div",{className:"mb-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("span",{className:"text-[12px] font-medium",style:{color:"var(--text-secondary)"},children:["Progress: ",S,"/",b.length," cases"]}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(S/b.length*100),"%"]})]}),a.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${S/b.length*100}%`,background:"var(--accent)"}})}),a.jsxs("div",{className:"flex items-center justify-between mt-1.5",children:[a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Elapsed: ",T>=60?`${Math.floor(T/60)}m ${T%60}s`:`${T}s`]}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Est. total: ",z]})]})]}),a.jsx("div",{className:"space-y-3 stagger-children",children:b.map(E=>{const I=y.get(E.id),N=h.get(E.id),_=(N==null?void 0:N.status)??"idle",V=p==null?void 0:p.cases.find(W=>W.eval_id===E.id);return a.jsx(DC,{name:E.name,evalId:E.id,result:I,caseCost:V==null?void 0:V.cost,caseBillingMode:V==null?void 0:V.billingMode,caseInputTokens:V==null?void 0:V.inputTokens,caseOutputTokens:V==null?void 0:V.outputTokens,caseStatus:_,runMode:(N==null?void 0:N.mode)??null,comparisonDetail:V==null?void 0:V.comparisonDetail,isReadOnly:u,onRun:W=>r(W,"benchmark"),onBaseline:W=>r(W,"baseline"),onCompare:W=>r(W,"comparison"),onCancel:W=>o(W)},E.id)})}),!k&&p&&p.cases.length>0&&a.jsxs("div",{className:"mt-5",children:[a.jsxs("div",{className:"rounded-xl p-4 mb-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:CC(p.type)}),a.jsx("span",{className:"text-[20px] font-bold",style:{color:(p.overall_pass_rate??0)>=.8?"var(--green)":(p.overall_pass_rate??0)>=.5?"var(--yellow)":"var(--red)"},children:p.overall_pass_rate!=null?`${Math.round(p.overall_pass_rate*100)}%`:"--"})]}),p.totalDurationMs!=null&&a.jsxs("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:["Total: ",(p.totalDurationMs/1e3).toFixed(1),"s",p.model&&` | Model: ${p.model}`,p.totalInputTokens!=null&&p.totalOutputTokens!=null&&` | Tokens: ${Ey(p.totalInputTokens,p.totalOutputTokens)}`,p.totalCost!=null&&` | Cost: ${Nn(p.totalCost)}`]}),p.overall_pass_rate>=.9999&&!p.comparison&&a.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"})]}),p.comparison&&a.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Skill vs Baseline"}),(()=>{const E=EC(p.model,p.timestamp);return E?a.jsx("div",{className:"text-[10px] mt-0.5 mb-3",style:{color:"var(--text-tertiary)"},children:E}):a.jsx("div",{className:"mb-3"})})(),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Ug,{label:"Skill",value:p.comparison.skillPassRate,color:"var(--accent)"}),a.jsx(Ug,{label:"Baseline",value:p.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),a.jsxs("div",{className:"mt-3 text-[12px] font-medium",style:{color:p.comparison.delta>0?"var(--green)":p.comparison.delta<0?"var(--red)":"var(--text-tertiary)"},children:["Delta: ",p.comparison.delta>0?"+":"",(p.comparison.delta*100).toFixed(1),"%",p.verdict&&` | ${mC(p.verdict)}`]}),(()=>{const E=p.cases.reduce((N,_)=>N+_.assertions.length,0),I=NC(p.comparison.delta,E,p.cases.length);return a.jsx("div",{className:"mt-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:I})})()]})]})]})}const zC={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 DC({name:t,evalId:r,result:s,caseCost:o,caseBillingMode:c,caseInputTokens:u,caseOutputTokens:d,caseStatus:h,runMode:g,comparisonDetail:p,isReadOnly:y,onRun:v,onBaseline:b,onCompare:k,onCancel:S}){const[w,C]=m.useState(!1),T=h==="running"||h==="queued",R=h==="complete"||h==="error";return a.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:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[h==="running"&&a.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),h==="queued"&&a.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--text-tertiary)"},children:"queued"}),a.jsxs("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:["#",r," ",t]}),g&&(T||R)&&(()=>{const L=zC[g];return L?a.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:L.bg,color:L.color,padding:"1px 6px"},children:L.label}):null})()]}),a.jsxs("div",{className:"flex items-center gap-2",children:[T?a.jsx("button",{onClick:()=>S(r),className:"btn text-[10px] px-2 py-1",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:"Cancel"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>k(r),disabled:y,className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),a.jsx("button",{onClick:()=>v(r),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),a.jsx("button",{onClick:()=>b(r),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Base"})]}),s&&s.status!=null&&a.jsx("span",{className:"pill text-[10px]",style:{background:s.status==="pass"?"var(--green-muted)":"var(--red-muted)",color:s.status==="pass"?"var(--green)":"var(--red)"},children:s.passRate!=null?`${Math.round(s.passRate*100)}%`:s.status}),u!=null&&d!=null&&a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:Ey(u,d)}),o!=null&&a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:Nn(o,c)}),h==="cancelled"&&a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"cancelled"})]})]}),s&&s.assertions.length>0&&a.jsxs("div",{className:"px-4 pb-3",children:[a.jsx("div",{className:"space-y-1",children:s.assertions.map(L=>a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsx("span",{style:{color:L.pass?"var(--green)":"var(--red)"},children:L.pass?"PASS":"FAIL"}),a.jsx("span",{style:{color:"var(--text-secondary)"},children:L.text})]},L.assertion_id))}),s.output&&a.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&&a.jsx("pre",{className:"text-[11px] mt-2 p-3 rounded-lg overflow-auto",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:200,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap"},children:s.output})]}),p&&a.jsx("div",{className:"px-4 pb-3",children:a.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:a.jsx("div",{className:"flex items-center gap-4 text-[11px] flex-wrap",children:(()=>{const L=Hg(p.skillContentScore,p.baselineContentScore),B=Hg(p.skillStructureScore,p.baselineStructureScore),z=TC(p.winner);return a.jsxs(a.Fragment,{children:[a.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Content: Skill ",L.skill,"% / Baseline ",L.baseline,"%"]}),a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),a.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Structure: Skill ",B.skill,"% / Baseline ",B.baseline,"%"]}),a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),a.jsx("span",{style:{color:z.isSkill?"var(--accent)":"var(--text-tertiary)",fontWeight:500},children:z.text})]})})()})})}),s&&s.errorMessage&&a.jsx(_C,{errorMessage:s.errorMessage,classifiedError:s.classifiedError})]})}const Md={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function _C({errorMessage:t,classifiedError:r}){const[s,o]=m.useState(!1),c=(r==null?void 0:r.title)??"Error",u=r==null?void 0:r.hint,d=r?Md[r.category]??Md.unknown:Md.unknown;return a.jsx("div",{className:"px-4 pb-3",children:a.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:"var(--red-muted)",border:"1px solid var(--red-muted)"},children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[a.jsx("span",{style:{fontSize:12},children:d}),a.jsx("span",{className:"text-[11.5px] font-semibold flex-1",style:{color:"var(--red)"},children:c}),a.jsx("button",{onClick:()=>o(!s),className:"text-[10px] px-1.5 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},children:s?"Hide details":"Details"})]}),u&&a.jsx("div",{className:"px-3 pb-2 text-[10.5px]",style:{color:"var(--text-secondary)"},children:u}),s&&a.jsx("pre",{className:"text-[10px] px-3 pb-2.5 overflow-auto",style:{color:"var(--text-tertiary)",maxHeight:120,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0},children:t})]})})}function Ug({label:t,value:r,color:s}){return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:t}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:s},children:[Math.round(r*100),"%"]})]}),a.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${r*100}%`,background:s}})})]})}const $g={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 OC(){var O;const{state:t,dispatch:r,runActivationTest:s,cancelActivation:o,generateActivationPrompts:c}=Tn(),{plugin:u,skill:d,activationPrompts:h,activationResults:g,activationSummary:p,activationRunning:y,activationError:v,activationStartedAt:b,activationClassifyingStatus:k,generatingPrompts:S,generatingPromptsError:w,activationHistory:C}=t,{state:T}=Zn(),R=((O=T.skills.find(U=>U.plugin===u&&U.skill===d))==null?void 0:O.version)??null,[L,B]=m.useState(h),[z,F]=m.useState(null),[E,I]=m.useState(!1);m.useEffect(()=>{h&&h!==L&&B(h)},[h]),m.useEffect(()=>{r({type:"SET_ACTIVATION_PROMPTS",prompts:L})},[L,r]),m.useEffect(()=>{fetch(`/api/skills/${u}/${d}/description`).then(U=>U.json()).then(U=>F(U.rawContent||U.description||null)).catch(()=>F(null))},[u,d]);function N(){s(L)}function _(){c(8)}const V=L.trim().split(`
|
|
81
|
-
`).filter(Boolean).length,W=g.filter(U=>U.classification==="TP"||U.classification==="TN"),Y=g.filter(U=>U.classification==="FP"||U.classification==="FN"),X=(z==null?void 0:z.replace(/^---[\s\S]*?---\s*/,"").trim())??null,H=L.trim().length>0,M=X?Fo(X):"";return a.jsxs("div",{className:"p-5 space-y-5",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Activation Test"}),a.jsx("div",{className:"text-[12px] mt-0.5",style:{color:"var(--text-tertiary)"},children:"Test whether this skill's description activates for relevant prompts and stays silent for irrelevant ones."})]}),a.jsxs("div",{className:"grid grid-cols-[3fr_2fr] gap-4 items-stretch",children:[a.jsxs("div",{className:"glass-card p-4 flex flex-col gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Test Prompts"}),a.jsx("div",{className:"flex gap-1.5",children:a.jsx("button",{onClick:_,disabled:S||!X||y,className:"text-[10px] px-2.5 py-1 rounded-md transition-colors duration-150 flex items-center gap-1.5",style:{background:S?"var(--surface-3)":"var(--surface-2)",color:X?"var(--accent)":"var(--text-tertiary)",border:"1px solid var(--border-subtle)",opacity:X?1:.5,cursor:X?"pointer":"not-allowed"},title:X?void 0:"No skill description available",onMouseEnter:U=>{X&&!S&&(U.currentTarget.style.background="var(--surface-3)")},onMouseLeave:U=>{S||(U.currentTarget.style.background="var(--surface-2)")},children:S?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"spinner",style:{borderTopColor:"var(--accent)",borderColor:"var(--border-subtle)",width:10,height:10}}),"Generating..."]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 3v3m6.36.64l-2.12 2.12M21 12h-3m-.64 6.36l-2.12-2.12M12 21v-3m-4.24.64l2.12-2.12M3 12h3m.64-6.36l2.12 2.12"})}),H?"Regenerate":"Generate"," Test Prompts"]})})})]}),!X&&!y&&a.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},"aria-live":"polite",children:"Add a description to your skill's frontmatter to enable prompt generation."}),w&&a.jsx("div",{className:"text-[11px] px-2 py-1 rounded",style:{color:"var(--red)",background:"var(--red-muted)"},children:w}),a.jsx("textarea",{className:"input-field resize-y font-mono text-[12px]",style:{minHeight:140,height:140},value:L,onChange:U=>B(U.target.value),placeholder:`How do I write a unit test?
|
|
82
|
-
What edge cases should I test?
|
|
83
|
-
+Deploy this to production
|
|
84
|
-
!What's the weather like today?
|
|
85
|
-
!Write me a poem about flowers`}),a.jsxs("div",{className:"flex items-center flex-wrap gap-x-3 gap-y-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsx("span",{children:"One prompt per line"}),a.jsx(ho,{}),a.jsx("span",{children:"No prefix = auto-classify"}),a.jsx(ho,{}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"+"}),"= must activate"]}),a.jsx(ho,{}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"!"}),"= must NOT activate"]}),a.jsx(ho,{}),a.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[V," prompt",V!==1?"s":""]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:N,disabled:y||!L.trim(),className:"btn btn-primary",children:y?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"spinner",style:{borderTopColor:"var(--color-paper)",borderColor:"var(--border-default)",width:14,height:14}}),"Testing..."]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("circle",{cx:"12",cy:"12",r:"6"}),a.jsx("circle",{cx:"12",cy:"12",r:"2"})]}),"Run Activation Test"]})}),y&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:o,className:"btn btn-secondary text-[12px]",children:"Cancel"}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[k||`${g.length} / ${V} prompts tested`,b&&a.jsx(UC,{startedAt:b})]})]})]})]}),a.jsxs("div",{className:"glass-card flex flex-col overflow-hidden",children:[a.jsx("div",{className:"px-4 pt-3.5 pb-2.5 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Skill Description"})}),a.jsx("div",{className:"flex-1 overflow-auto px-4 py-3",style:{minHeight:0},children:X?a.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:M}}):a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No description available"})})]})]}),v&&a.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:v}),y&&g.length===0&&a.jsxs("div",{className:"text-center py-12 animate-fade-in",children:[a.jsx("div",{className:"spinner-lg mx-auto mb-4"}),a.jsx("p",{className:"text-[14px]",style:{color:"var(--text-secondary)"},children:"Testing activation against skill description..."})]}),g.length>0&&a.jsxs("div",{className:"space-y-5",children:[Y.length>0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),a.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--red)"},children:["Incorrect (",Y.length,")"]}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"— These need attention"})]}),a.jsx("div",{className:"space-y-1.5 stagger-children",children:Y.map((U,G)=>a.jsx(Vg,{result:U},`incorrect-${G}`))})]}),W.length>0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("polyline",{points:"16 10 11 15 8 12"})]}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--green)"},children:["Correct (",W.length,")"]})]}),a.jsx("div",{className:"space-y-1.5 stagger-children",children:W.map((U,G)=>a.jsx(Vg,{result:U},`correct-${G}`))})]})]}),p&&a.jsxs("div",{className:"glass-card p-6 animate-fade-in-scale",style:{borderColor:"var(--border-active)",borderWidth:2},children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-2",style:{color:"var(--text-tertiary)"},children:"Summary"}),p.autoClassifiedCount!=null&&p.autoClassifiedCount>0&&a.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:[p.autoClassifiedCount," of ",p.total," prompts auto-classified from skill name and tags"]}),a.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[a.jsx(Ld,{label:"Precision",value:p.precision,description:"Of all activations, how many were correct?",detail:`${p.tp} true / ${p.tp+p.fp} total activations`}),a.jsx(Ld,{label:"Recall",value:p.recall,description:"Of expected activations, how many fired?",detail:`${p.tp} activated / ${p.tp+p.fn} expected`}),a.jsx(Ld,{label:"Reliability",value:p.reliability,description:"Overall correct classification rate",detail:`${p.tp+p.tn} correct / ${p.total} total`})]}),a.jsxs("div",{className:"pt-4",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-3 text-center",style:{color:"var(--text-tertiary)"},children:"Confusion Matrix"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 max-w-xs mx-auto",children:[a.jsx(xo,{label:"True Positive",abbr:"TP",count:p.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),a.jsx(xo,{label:"False Positive",abbr:"FP",count:p.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),a.jsx(xo,{label:"False Negative",abbr:"FN",count:p.fn,bg:"var(--red-muted)",color:"var(--red)",description:"Missed activation"}),a.jsx(xo,{label:"True Negative",abbr:"TN",count:p.tn,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly silent"})]})]})]}),a.jsx(BC,{history:C,expanded:E,onToggle:()=>I(!E),skillVersion:R})]})}function BC({history:t,expanded:r,onToggle:s,skillVersion:o}){return t===null?null:a.jsxs("div",{className:"glass-card overflow-hidden",children:[a.jsxs("button",{className:"w-full px-4 py-3 flex items-center justify-between text-left",style:{borderBottom:r?"1px solid var(--border-subtle)":"none"},onClick:s,children:[a.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:["Test History",t.length>0&&a.jsxs("span",{className:"ml-2 font-normal",style:{color:"var(--text-tertiary)"},children:["(",t.length," run",t.length!==1?"s":"",")"]})]}),a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:r?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),r&&a.jsx("div",{className:"px-4 py-3",children:t.length===0?a.jsx("div",{className:"text-[12px] py-4 text-center",style:{color:"var(--text-tertiary)"},children:"No test runs yet"}):a.jsx("div",{className:"space-y-2",children:t.map(c=>a.jsx(IC,{run:c,skillVersion:o},c.id))})})]})}function IC({run:t,skillVersion:r}){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 a.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{background:"var(--surface-1)"},children:[a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:HC(t.timestamp)}),a.jsx(Ks,{version:r??null,size:"sm","data-testid":"activation-row-version"}),a.jsx("span",{className:"pill text-[9px] px-1.5",style:{background:"var(--surface-2)",color:"var(--text-tertiary)"},children:t.model||t.provider}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[t.promptCount," prompts"]})]})}),a.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:o,fontVariantNumeric:"tabular-nums"},children:[s,"%"]}),a.jsx("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded",style:{color:u,background:`color-mix(in srgb, ${u} 10%, transparent)`},children:c})]})]})}function HC(t){const r=Date.now(),s=new Date(t).getTime(),o=Math.floor((r-s)/1e3);if(o<60)return"just now";const c=Math.floor(o/60);if(c<60)return`${c}m ago`;const 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 ho(){return a.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function Vg({result:t}){const r=$g[t.classification]||$g.FN,s=t.classification==="TP"||t.classification==="TN";return a.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl transition-all duration-200",style:{background:r.bg,border:"1px solid transparent"},children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:`color-mix(in srgb, ${r.text} 20%, transparent)`},children:s?a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:r.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:r.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center gap-2 mb-1",children:a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:t.prompt})}),a.jsxs("div",{className:"flex items-center gap-3 text-[12px]",children:[a.jsx("span",{className:"pill",style:{background:"var(--surface-3)",color:r.text,fontWeight:700,fontSize:"10px",padding:"1px 6px"},children:t.classification}),a.jsx("span",{style:{color:t.activate?"var(--green)":"var(--text-tertiary)"},children:t.activate?"Activated":"Silent"}),a.jsxs("span",{style:{color:"var(--text-tertiary)"},children:["Expected: ",t.expected==="should_activate"?"activate":"stay silent"]}),a.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[t.confidence," confidence"]}),t.autoClassified&&a.jsx("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)",fontSize:"9px",padding:"1px 5px"},children:"auto"})]}),t.reasoning&&a.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--text-tertiary)"},children:t.reasoning})]})]})}function Ld({label:t,value:r,description:s,detail:o}){const c=Math.round(r*100),u=c>=80?"var(--green)":c>=60?"var(--yellow)":"var(--red)";return a.jsxs("div",{className:"text-center",children:[a.jsxs("div",{className:"text-[28px] font-bold tracking-tight",style:{color:u},children:[c,"%"]}),a.jsx("div",{className:"text-[12px] font-medium mt-0.5",style:{color:"var(--text-secondary)"},children:t}),a.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--text-tertiary)"},children:s}),a.jsx("div",{className:"text-[10px] mt-0.5 font-mono",style:{color:"var(--text-tertiary)"},children:o})]})}function xo({abbr:t,count:r,bg:s,color:o,description:c}){return a.jsxs("div",{className:"text-center p-3 rounded-lg",style:{background:s},children:[a.jsx("div",{className:"text-[20px] font-bold",style:{color:o},children:r}),a.jsx("div",{className:"text-[11px] font-semibold",style:{color:o},children:t}),a.jsx("div",{className:"text-[9px] mt-0.5",style:{color:"var(--text-tertiary)"},children:c})]})}function UC({startedAt:t}){const[r,s]=m.useState(0);return m.useEffect(()=>{const o=setInterval(()=>s(Math.floor((Date.now()-t)/1e3)),1e3);return()=>clearInterval(o)},[t]),a.jsxs("span",{className:"ml-2",children:["(",r,"s)"]})}const zd={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},Pg={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},rf=600,lf=180,ln=40,Dd=rf-ln*2,rr=lf-ln*2,$C=[25,50,75,100];function Fg(t){return new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function VC(t){return t==null?"--":`${(t/1e3).toFixed(1)}s`}function PC({entries:t,onPointClick:r}){const[s,o]=m.useState(null),c=m.useMemo(()=>[...t].reverse(),[t]);if(c.length<2)return null;const u=c.length,d=c.map((p,y)=>{const v=ln+y/(u-1)*Dd,b=p.passRate*100,k=ln+rr-b/100*rr;return{x:v,y:k,pct:b,entry:p}}),h=d.map(p=>`${p.x},${p.y}`).join(" "),g=Array.from(new Set(c.map(p=>p.type)));return a.jsxs("div",{className:"glass-card p-5 animate-fade-in",style:{position:"relative",overflowX:u>=20?"auto":void 0},children:[a.jsx("div",{className:"text-[13px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"Pass Rate Trend"}),a.jsx("div",{className:"flex items-center gap-5 mb-3",children:g.map(p=>a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:zd[p]??"var(--text-tertiary)"}}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:Pg[p]??p})]},p))}),a.jsxs("svg",{width:rf,height:lf,viewBox:`0 0 ${rf} ${lf}`,style:{display:"block",overflow:"visible"},children:[$C.map(p=>{const y=ln+rr-p/100*rr;return a.jsxs("g",{children:[a.jsx("line",{x1:ln,y1:y,x2:ln+Dd,y2:y,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),a.jsxs("text",{x:ln-8,y:y+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[p,"%"]})]},p)}),a.jsx("line",{x1:ln,y1:ln+rr,x2:ln+Dd,y2:ln+rr,stroke:"var(--border-subtle)",strokeWidth:1}),a.jsx("text",{x:ln-8,y:ln+rr+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:"0%"}),a.jsx("polyline",{points:h,fill:"none",stroke:"var(--border-subtle)",strokeWidth:1.5,strokeLinejoin:"round"}),d.map((p,y)=>a.jsx("circle",{cx:p.x,cy:p.y,r:5,fill:zd[p.entry.type]??"var(--text-tertiary)",stroke:"var(--surface-2)",strokeWidth:2,style:{cursor:"pointer",transition:"r 0.15s ease"},onMouseEnter:v=>{v.currentTarget.setAttribute("r","7"),o({x:p.x,y:p.y,entry:p.entry})},onMouseLeave:v=>{v.currentTarget.setAttribute("r","5"),o(null)},onClick:()=>r==null?void 0:r(p.entry)},y)),FC(u).map(p=>a.jsx("text",{x:d[p].x,y:ln+rr+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:Fg(c[p].timestamp)},p))]}),s&&a.jsxs("div",{style:{position:"absolute",left:s.x,top:s.y-12,transform:"translate(-50%, -100%)",background:"var(--surface-3)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"8px 12px",pointerEvents:"none",zIndex:10,whiteSpace:"nowrap"},children:[a.jsx("div",{className:"text-[11px] font-medium",style:{color:"var(--text-primary)"},children:Fg(s.entry.timestamp)}),a.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-tertiary)"},children:s.entry.model}),a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:zd[s.entry.type]??"var(--text-tertiary)",color:"#fff"},children:Pg[s.entry.type]??s.entry.type}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:[Math.round(s.entry.passRate*100),"%"]})]}),a.jsxs("div",{className:"text-[10px] mt-1.5 flex items-center gap-3",style:{color:"var(--text-tertiary)"},children:[a.jsx("span",{children:VC(s.entry.totalDurationMs)}),a.jsx("span",{children:s.entry.totalTokens!=null?`${s.entry.totalTokens} tokens`:"--"})]})]})]})}function FC(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 r=Math.ceil(t/10),s=[0];for(let o=r;o<t-1;o+=r)s.push(o);return s.push(t-1),s}const Ms=new Map;let sn=null,Eo=null,go=1e3,wl=0;function Ny(){if(sn)return;sn=new EventSource("/api/events");const t=r=>s=>{let o={};try{o=s.data?JSON.parse(s.data):{}}catch{}const c=Ms.get(r);if(c)for(const u of c)u(o)};sn.addEventListener("benchmark:complete",t("benchmark:complete")),sn.addEventListener("history:written",t("history:written")),sn.addEventListener("leaderboard:updated",t("leaderboard:updated")),sn.onerror=()=>{sn==null||sn.close(),sn=null,wl>0&&(Eo=setTimeout(()=>{go=Math.min(go*2,3e4),Ny()},go))},sn.onopen=()=>{go=1e3}}function GC(){Eo!=null&&(clearTimeout(Eo),Eo=null),sn==null||sn.close(),sn=null}function WC(t,r){return Ms.has(t)||Ms.set(t,new Set),Ms.get(t).add(r),wl++,Ny(),()=>{var s;(s=Ms.get(t))==null||s.delete(r),wl--,wl<=0&&(wl=0,queueMicrotask(()=>{wl<=0&&GC()}))}}function Lo(t,r){const s=m.useRef(r);s.current=r,m.useEffect(()=>WC(t,c=>s.current(c)),[t])}function zo(t){return t>=.8?"var(--green)":t>=.5?"var(--yellow)":"var(--red)"}function qC(t){return t>=1e3?`${(t/1e3).toFixed(1)}s`:`${Math.round(t)}ms`}function YC({rate:t,label:r}){const s=Math.round(t*100);return a.jsx("div",{className:"flex items-center gap-3",children:a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-primary)",maxWidth:"70%"},children:r}),a.jsxs("span",{className:"text-[11px] font-semibold",style:{color:zo(t)},children:[s,"%"]})]}),a.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${s}%`,background:zo(t)}})})]})})}function KC({points:t}){if(t.length<2)return null;const r=200,s=48,o=4,c=t.length,u=t.map((g,p)=>{const y=o+p/(c-1)*(r-o*2),v=o+(s-o*2)-g.passRate*(s-o*2);return{x:y,y:v}}),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,p)=>`${p===0?"M":"L"} ${g.x},${g.y}`).join(" ");return a.jsxs("svg",{width:r,height:s,style:{display:"block"},children:[a.jsx("path",{d,fill:"var(--accent-muted)"}),a.jsx("path",{d:h,fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),a.jsx("circle",{cx:u[u.length-1].x,cy:u[u.length-1].y,r:3,fill:"var(--accent)"})]})}function XC({plugin:t,skill:r}){const s=`stats/${t}/${r}`,o=m.useCallback(()=>Ee.getStats(t,r),[t,r]),{data:c,loading:u}=Ml(s,o),d=m.useCallback(()=>on(s),[s]);if(Lo("benchmark:complete",d),Lo("history:written",d),u)return a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"skeleton h-24 rounded-xl"}),a.jsx("div",{className:"skeleton h-48 rounded-xl"}),a.jsx("div",{className:"skeleton h-36 rounded-xl"})]});if(!c||c.totalRuns===0)return a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center mx-auto mb-3",style:{background:"var(--surface-2)"},children:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",children:[a.jsx("path",{d:"M18 20V10"}),a.jsx("path",{d:"M12 20V4"}),a.jsx("path",{d:"M6 20v-6"})]})}),a.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark data yet"}),a.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"Run some benchmarks to see statistics"})]});const h=c.trendPoints.length>0?c.trendPoints[c.trendPoints.length-1].passRate:0,g=c.trendPoints.length>0?c.trendPoints[0].passRate:0,p=h-g,y=c.assertionStats.slice(0,10);return a.jsxs("div",{className:"space-y-4 stagger-children",children:[a.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Runs"}),a.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:c.totalRuns})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Latest Pass Rate"}),a.jsxs("div",{className:"text-[24px] font-bold",style:{color:zo(h)},children:[Math.round(h*100),"%"]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Trend"}),a.jsxs("div",{className:"text-[24px] font-bold",style:{color:p>=0?"var(--green)":"var(--red)"},children:[p>=0?"+":"",Math.round(p*100),"%"]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Models Tested"}),a.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:c.modelStats.length})]}),c.totalCost!=null&&a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Cost"}),a.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:Nn(c.totalCost)})]}),c.costPerRun!=null&&a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Avg Cost/Run"}),a.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:Nn(c.costPerRun)})]})]}),c.trendPoints.length>=2&&a.jsxs("div",{className:"glass-card p-5",children:[a.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Pass Rate Over Time"}),a.jsx(KC,{points:c.trendPoints})]}),c.modelStats.length>0&&a.jsxs("div",{className:"glass-card p-5",children:[a.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Model Performance"}),a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[a.jsx("thead",{children:a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("th",{style:{textAlign:"left",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Model"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Runs"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Pass Rate"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Duration"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Cost"})]})}),a.jsx("tbody",{children:c.modelStats.map(v=>a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("td",{style:{padding:"8px",color:"var(--text-primary)",fontWeight:500},children:v.model}),a.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:v.runs}),a.jsx("td",{style:{padding:"8px",textAlign:"center"},children:a.jsxs("span",{className:"font-semibold",style:{color:zo(v.avgPassRate)},children:[Math.round(v.avgPassRate*100),"%"]})}),a.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:qC(v.avgDurationMs)}),a.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:v.avgCost!=null?Nn(v.avgCost):"N/A"})]},v.model))})]})]}),y.length>0&&a.jsxs("div",{className:"glass-card p-5",children:[a.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Weakest Assertions"}),a.jsx("div",{className:"space-y-3",children:y.map(v=>a.jsxs("button",{className:"block w-full text-left rounded-lg p-2 -mx-2 transition-colors duration-150",style:{background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--surface-2)"},onMouseLeave:b=>{b.currentTarget.style.background="transparent"},onClick:()=>{},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsxs("span",{className:"text-[10px] font-mono px-1 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",v.evalId]}),a.jsx("span",{className:"text-[10px] truncate",style:{color:"var(--text-tertiary)"},children:v.evalName}),a.jsxs("span",{className:"text-[10px] ml-auto flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[v.totalRuns," runs"]})]}),a.jsx(YC,{rate:v.passRate,label:v.text})]},`${v.evalId}:${v.id}`))})]})]})}function QC({plugin:t,skill:r}){const[s,o]=m.useState(null),[c,u]=m.useState(null),[d,h]=m.useState({}),[g,p]=m.useState({});m.useEffect(()=>{Ee.getEvals(t,r).then(o).catch(()=>o(null))},[t,r]);async function y(v){if(c===v){u(null);return}if(u(v),!d[v]){p(b=>({...b,[v]:!0}));try{const b=await Ee.getCaseHistory(t,r,v);h(k=>({...k,[v]:b}))}catch{h(b=>({...b,[v]:[]}))}finally{p(b=>({...b,[v]:!1}))}}}return s?a.jsx("div",{className:"space-y-2 stagger-children",children:s.evals.map(v=>{const b=d[v.id]||[],k=c===v.id,S=g[v.id],w=b.length>0?b[0].pass_rate:null;return a.jsxs("div",{className:"glass-card overflow-hidden",children:[a.jsxs("button",{onClick:()=>y(v.id),className:"w-full text-left p-4 flex items-center gap-3 transition-colors duration-150",style:{background:k?"var(--surface-2)":"transparent"},onMouseEnter:C=>{k||(C.currentTarget.style.background="var(--surface-2)")},onMouseLeave:C=>{k||(C.currentTarget.style.background="transparent")},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",style:{transform:k?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease",flexShrink:0},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),a.jsxs("span",{className:"text-[11px] font-mono px-1.5 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",v.id]}),a.jsx("span",{className:"text-[13px] font-medium flex-1 truncate",style:{color:"var(--text-primary)"},children:v.name}),b.length>=2&&a.jsx(Sy,{entries:b}),w!=null&&a.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:Tl(w)},children:[Math.round(w*100),"%"]}),b.length>0&&a.jsxs("span",{className:"text-[10px] flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[b.length," runs"]})]}),k&&a.jsx("div",{className:"border-t animate-fade-in",style:{borderColor:"var(--border-subtle)"},children:S?a.jsxs("div",{className:"p-4 flex items-center gap-2",children:[a.jsx("div",{className:"spinner",style:{width:14,height:14}}),a.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):b.length===0?a.jsx("div",{className:"p-4",children:a.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No history for this eval case"})}):a.jsx("div",{className:"divide-y",style:{borderColor:"var(--border-subtle)"},children:b.map((C,T)=>a.jsxs("div",{className:"p-4",style:{background:T===0?"var(--surface-2)":"transparent"},children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:by(C.timestamp)}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:C.model}),a.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}),a.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:Tl(C.pass_rate)},children:[Math.round(C.pass_rate*100),"%"]})]}),a.jsxs("div",{className:"flex items-center gap-4 mb-2 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[C.durationMs!=null&&a.jsx("span",{children:jy(C.durationMs)}),C.tokens!=null&&a.jsxs("span",{children:[C.tokens>=1e3?`${(C.tokens/1e3).toFixed(1)}k`:C.tokens," tok"]})]}),a.jsx("div",{className:"space-y-1",children:C.assertions.map(R=>a.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[a.jsx("div",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:R.pass?"var(--green)":"var(--red)"},children:a.jsx("svg",{width:"7",height:"7",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",children:R.pass?a.jsx("polyline",{points:"20 6 9 17 4 12"}):a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-primary)"},children:R.text}),R.reasoning&&a.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:R.reasoning})]})]},R.id))})]},T))})})]},v.id)})}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No eval cases found"})})}function ZC(){const{state:t,dispatch:r}=Tn(),{plugin:s,skill:o}=t,{state:c}=Zn(),u=c.skills.find(U=>U.plugin===s&&U.skill===o),d=(u==null?void 0:u.version)??null,[h,g]=m.useState("timeline"),[p,y]=m.useState(""),[v,b]=m.useState(""),[k,S]=m.useState(!1),[w,C]=m.useState([]),[T,R]=m.useState(null),[L,B]=m.useState(!1),[z,F]=m.useState(null),[E,I]=m.useState(!1),N=`history/${s}/${o}?model=${p}&type=${v}`,_=m.useCallback(()=>Ee.getHistory(s,o,{model:p||void 0,type:v||void 0}),[s,o,p,v]),{data:V,loading:W}=Ml(N,_),Y=V??[];m.useEffect(()=>{!V||V.length<2||Ee.compareRuns(s,o,V[0].timestamp,V[1].timestamp).then(U=>{const G=U.regressions.filter(ue=>ue.change==="regression");r({type:"SET_REGRESSIONS",regressions:G})}).catch(()=>{})},[V,s,o,r]);const X=m.useCallback(()=>on(N),[N]);Lo("history:written",X);const H=m.useCallback(async U=>{if(k){C(G=>G.includes(U)?G.filter(ue=>ue!==U):G.length>=2?[G[1],U]:[...G,U]);return}I(!0);try{const G=await Ee.getHistoryEntry(s,o,U);F(G)}catch{}finally{I(!1)}},[s,o,k]),M=m.useCallback(async()=>{if(w.length===2){B(!0);try{const U=await Ee.compareRuns(s,o,w[0],w[1]);R(U)}catch{}finally{B(!1)}}},[s,o,w]),O=[...new Set(Y.map(U=>U.model))];return W?a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),a.jsx("div",{className:"skeleton h-48 rounded-xl mb-4"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"skeleton h-12 rounded-lg"}),a.jsx("div",{className:"skeleton h-12 rounded-lg"})]})]}):a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"flex items-center gap-1 mb-4",children:["timeline","per-eval","statistics"].map(U=>a.jsx("button",{onClick:()=>g(U),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:h===U?"var(--accent-muted)":"transparent",color:h===U?"var(--accent)":"var(--text-tertiary)"},children:U==="timeline"?"Timeline":U==="per-eval"?"Per Eval":"Statistics"},U))}),h==="timeline"&&a.jsxs("div",{children:[Y.length>0&&a.jsx("div",{className:"mb-5 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:a.jsx(PC,{entries:Y,onPointClick:U=>H(U.timestamp)})}),a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("select",{value:p,onChange:U=>y(U.target.value),className:"input-field text-[12px]",style:{width:150},children:[a.jsx("option",{value:"",children:"All Models"}),O.map(U=>a.jsx("option",{value:U,children:U},U))]}),a.jsxs("select",{value:v,onChange:U=>b(U.target.value),className:"input-field text-[12px]",style:{width:150},children:[a.jsx("option",{value:"",children:"All Types"}),a.jsx("option",{value:"benchmark",children:"Benchmark"}),a.jsx("option",{value:"comparison",children:"Comparison"}),a.jsx("option",{value:"baseline",children:"Baseline"}),a.jsx("option",{value:"model-compare",children:"Model Compare"}),a.jsx("option",{value:"improve",children:"AI Improve"}),a.jsx("option",{value:"instruct",children:"AI Edit"}),a.jsx("option",{value:"ai-generate",children:"AI Generate"}),a.jsx("option",{value:"eval-generate",children:"Eval Generate"})]}),a.jsx("div",{className:"flex-1"}),a.jsx("button",{onClick:()=>{S(!k),C([]),R(null)},className:`btn text-[12px] ${k?"btn-primary":"btn-secondary"}`,children:k?"Exit Compare":"Compare Runs"}),k&&w.length===2&&a.jsx("button",{onClick:M,disabled:L,className:"btn btn-primary text-[12px]",children:L?"Comparing...":"Compare"})]}),a.jsx("div",{className:"space-y-2",children:Y.length===0?a.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):Y.map(U=>{const G=w.includes(U.timestamp);return a.jsx("button",{onClick:()=>H(U.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:G?"var(--accent-muted)":"var(--surface-1)",border:G?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:ue=>{G||(ue.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:ue=>{G||(ue.currentTarget.style.borderColor="var(--border-subtle)")},children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[k&&a.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:G?"var(--accent)":"var(--border-default)",background:G?"var(--accent)":"transparent"},children:G&&a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})}),a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:new Date(U.timestamp).toLocaleString()}),a.jsx("span",{className:"pill text-[9px]",style:{background:U.type==="comparison"?"var(--purple-muted)":U.type==="baseline"?"var(--surface-3)":U.type==="model-compare"?"var(--accent-muted)":U.type==="improve"||U.type==="instruct"?"var(--purple-muted)":U.type==="ai-generate"?"var(--green-muted)":U.type==="eval-generate"?"var(--orange-muted)":"var(--accent-muted)",color:U.type==="comparison"?"var(--purple)":U.type==="baseline"?"var(--text-tertiary)":U.type==="model-compare"?"var(--accent)":U.type==="improve"||U.type==="instruct"?"var(--purple)":U.type==="ai-generate"?"var(--green)":U.type==="eval-generate"?"var(--orange)":"var(--accent)"},children:U.type==="model-compare"?"model compare":U.type==="improve"?"ai improve":U.type==="instruct"?"ai edit":U.type==="ai-generate"?"ai generate":U.type==="eval-generate"?"eval generate":U.type})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Ks,{version:d,size:"sm","data-testid":"history-row-version"}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:U.model}),U.totalCost!=null&&U.totalCost>0&&a.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--text-tertiary)"},children:Nn(U.totalCost)}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:U.passRate>=.8?"var(--green)":U.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(U.passRate*100),"%"]})]})]})},U.timestamp)})}),T&&a.jsx(JC,{result:T}),z&&!k&&a.jsx(eE,{run:z,onClose:()=>F(null)})]}),h==="per-eval"&&a.jsx(QC,{plugin:s,skill:o}),h==="statistics"&&a.jsx(XC,{plugin:s,skill:o})]})}function JC({result:t}){const r=t.regressions.filter(o=>o.change==="regression"),s=t.regressions.filter(o=>o.change==="improvement");return a.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Comparison: ",new Date(t.runA.timestamp).toLocaleDateString()," vs ",new Date(t.runB.timestamp).toLocaleDateString()]}),(t.runA.totalCost!=null||t.runB.totalCost!=null)&&a.jsxs("div",{className:"flex items-center gap-4 mb-3 text-[11px]",style:{color:"var(--text-secondary)"},children:[a.jsxs("span",{children:["Run A cost: ",Nn(t.runA.totalCost??null)]}),a.jsxs("span",{children:["Run B cost: ",Nn(t.runB.totalCost??null)]}),t.runA.totalCost!=null&&t.runB.totalCost!=null&&a.jsxs("span",{style:{color:t.runB.totalCost<=t.runA.totalCost?"var(--green)":"var(--red)"},children:["Delta: ",Nn(t.runB.totalCost-t.runA.totalCost)]})]}),r.length>0&&a.jsxs("div",{className:"mb-3",children:[a.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--red)"},children:["Regressions (",r.length,")"]}),r.map(o=>a.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",a.jsx("span",{style:{color:"var(--red)"},children:o.assertionId})," (was passing, now failing)"]},`${o.evalId}-${o.assertionId}`))]}),s.length>0&&a.jsxs("div",{className:"mb-3",children:[a.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--green)"},children:["Improvements (",s.length,")"]}),s.map(o=>a.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",a.jsx("span",{style:{color:"var(--green)"},children:o.assertionId})," (was failing, now passing)"]},`${o.evalId}-${o.assertionId}`))]}),a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 mt-3",style:{color:"var(--text-tertiary)"},children:"Case Diffs"}),a.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:a.jsxs("table",{className:"w-full text-[12px]",children:[a.jsx("thead",{children:a.jsxs("tr",{style:{background:"var(--surface-2)"},children:[a.jsx("th",{className:"text-left px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Case"}),a.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run A"}),a.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run B"})]})}),a.jsx("tbody",{children:t.caseDiffs.map(o=>a.jsxs("tr",{style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsxs("td",{className:"px-3 py-2",style:{color:"var(--text-secondary)"},children:["#",o.eval_id," ",o.eval_name]}),a.jsx("td",{className:"text-right px-3 py-2",style:{color:o.passRateA!=null?o.passRateA>=.8?"var(--green)":o.passRateA>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:o.passRateA!=null?`${Math.round(o.passRateA*100)}%`:o.statusA}),a.jsx("td",{className:"text-right px-3 py-2",style:{color:o.passRateB!=null?o.passRateB>=.8?"var(--green)":o.passRateB>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:o.passRateB!=null?`${Math.round(o.passRateB*100)}%`:o.statusB})]},o.eval_id))})]})})]})}function eE({run:t,onClose:r}){return(t.type==="improve"||t.type==="instruct")&&t.improve?a.jsx(tE,{run:t,onClose:r}):a.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:["Run: ",new Date(t.timestamp).toLocaleString()]}),a.jsx("button",{onClick:r,className:"btn btn-ghost text-[11px]",children:"Close"})]}),a.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:["Model: ",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: ${Nn(t.totalCost)}`]}),a.jsx("div",{className:"space-y-2",children:t.cases.map(s=>a.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)"},children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-[12px]",style:{color:"var(--text-secondary)"},children:["#",s.eval_id," ",s.eval_name]}),a.jsxs("div",{className:"flex items-center gap-2",children:[s.cost!=null&&s.cost>0&&a.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--text-tertiary)"},children:Nn(s.cost)}),a.jsx("span",{className:"text-[11px] font-semibold",style:{color:s.status==="pass"?"var(--green)":"var(--red)"},children:s.pass_rate!=null?`${Math.round(s.pass_rate*100)}%`:s.status})]})]})},s.eval_id))})]})}function tE({run:t,onClose:r}){var u;const s=m.useMemo(()=>t.improve?Go(t.improve.original,t.improve.improved):[],[t.improve]),o=m.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=m.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 a.jsxs("div",{className:"mt-4 rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{background:"var(--purple-muted)"},children:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--purple)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),a.jsx("path",{d:"M2 17l10 5 10-5"}),a.jsx("path",{d:"M2 12l10 5 10-5"})]})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"}),a.jsxs("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[new Date(t.timestamp).toLocaleString()," · ",t.model]})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsxs("span",{style:{color:"var(--green)"},children:["+",o.added]}),a.jsxs("span",{style:{color:"var(--red)"},children:["-",o.removed]})]}),a.jsx("button",{onClick:r,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:d=>{d.currentTarget.style.background="var(--surface-3)"},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),((u=t.improve)==null?void 0:u.reasoning)&&a.jsxs("div",{className:"mx-4 mt-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"var(--purple-muted)",border:"1px solid var(--purple-muted)",color:"var(--text-secondary)"},children:[a.jsx("span",{className:"font-semibold",style:{color:"var(--purple)"},children:"AI Reasoning: "}),t.improve.reasoning]}),a.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:480,overflowY:"auto"},children:a.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:a.jsx("tbody",{children:c.map((d,h)=>a.jsxs("tr",{style:{background:d.type==="added"?"var(--green-muted)":d.type==="removed"?"var(--red-muted)":"transparent"},children:[a.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??""}),a.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??""}),a.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"?"-":" "}),a.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 Ty({data:t}){if(t.length<2)return a.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:"--"});const r=t.slice(-10),s=80,o=24,c=2,u=s-c*2,d=o-c*2,h=r.length,g=Math.min(...r),y=Math.max(...r)-g||1,v=r.map((S,w)=>{const C=c+w/(h-1)*u,T=c+d-(S-g)/y*d;return`${C.toFixed(1)},${T.toFixed(1)}`}),b=r[r.length-1],k=Tl(b);return a.jsxs("svg",{width:s,height:o,viewBox:`0 0 ${s} ${o}`,style:{display:"block"},children:[a.jsx("polyline",{points:v.join(" "),fill:"none",stroke:k,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),(()=>{const[S,w]=v[v.length-1].split(",");return a.jsx("circle",{cx:S,cy:w,r:2.5,fill:k})})()]})}function nE(){return a.jsxs("span",{className:"pill",style:{background:"var(--yellow-muted)",color:"var(--yellow)",fontSize:9,fontWeight:700,gap:3},children:[a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"var(--yellow)",stroke:"none",children:a.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),"Best Model"]})}function aE({pct:t}){const r=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 a.jsxs("span",{className:"pill",style:{background:s,color:r,fontSize:10,fontWeight:600},children:[o,t.toFixed(1),"%"]})}function rE({score:t,rating:r}){const s={excellent:{bg:"var(--green-muted)",fg:"var(--green)"},good:{bg:"var(--green-muted)",fg:"var(--green)"},marginal:{bg:"var(--yellow-muted)",fg:"var(--yellow)"},minimal:{bg:"var(--yellow-muted)",fg:"var(--yellow)"},harmful:{bg:"var(--red-muted)",fg:"var(--red)"}},o=s[r]??s.minimal,c=t>=0?"+":"";return a.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"Skill Quality:"}),a.jsxs("span",{className:"pill",style:{background:o.bg,color:o.fg,fontSize:11,fontWeight:600},children:[c,t.toFixed(1),"% (",r.toUpperCase(),")"]})]})}function lE({warning:t}){return a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-3",style:{background:"var(--yellow-muted)",border:"1px solid var(--yellow-muted)"},children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--yellow)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),a.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),a.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--yellow)"},children:t})]})}function sE({active:t,onChange:r,hasBaseline:s}){return a.jsxs("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)"},children:[a.jsx("button",{onClick:()=>r("rankings"),className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:t==="rankings"?"var(--surface-3)":"transparent",color:t==="rankings"?"var(--text-primary)":"var(--text-tertiary)"},children:"Rankings"}),a.jsx("button",{onClick:()=>r("amplification"),disabled:!s,className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background: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 iE(t){var o,c,u;if(t.length===0)return[];const r=new Map;for(const d of t)for(const h of d.models){if(h.status==="error")continue;const g=`${h.provider}/${h.model}`;r.has(g)||r.set(g,{provider:h.provider,passRates:[],lastRubric:null,lastDuration:0,lastCost:null,lastBaselinePassRate:void 0,lastSkillDelta:void 0,lastAmplificationPct:void 0,lastCompositeScore:void 0,hasBaseline:!1});const p=r.get(g);p.passRates.push(h.passRate.mean),p.lastRubric=((o=h.rubricScore)==null?void 0:o.mean)??null,p.lastDuration=h.duration.mean,p.lastCost=((c=h.cost)==null?void 0:c.total)??null,p.lastCompositeScore=h.compositeScore,h.baselinePassRate!=null&&(p.lastBaselinePassRate=h.baselinePassRate.mean,p.lastSkillDelta=(u=h.skillDelta)==null?void 0:u.mean,p.lastAmplificationPct=h.amplificationPct,p.hasBaseline=!0)}const s=[];for(const[d,h]of r){const[g,...p]=d.split("/");s.push({rank:0,model:p.join("/"),provider:g,passRate:h.passRates[h.passRates.length-1],rubricScore:h.lastRubric,duration:h.lastDuration,cost:h.lastCost,sparklineData:h.passRates,isBest:!1,baselinePassRate:h.lastBaselinePassRate,skillDelta:h.lastSkillDelta,amplificationPct:h.lastAmplificationPct,compositeScore:h.lastCompositeScore,hasBaseline:h.hasBaseline})}return s.sort((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 Ry=(t="left")=>({padding:"10px 12px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary)",textAlign:t,whiteSpace:"nowrap"});function oE({entries:t}){return a.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","Pass Rate","Rubric","Duration","Cost","Trend"].map(r=>a.jsx("th",{style:Ry(r==="#"?"center":"left"),children:r},r))})}),a.jsx("tbody",{children:t.map(r=>a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:s=>{s.currentTarget.style.background="var(--surface-2)"},onMouseLeave:s=>{s.currentTarget.style.background="transparent"},children:[a.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:r.rank}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:r.model}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:r.provider}),r.isBest&&a.jsx(nE,{})]})}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("span",{className:"pill",style:{background:r.passRate>=.7?"var(--green-muted)":r.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:Tl(r.passRate),fontSize:11,fontWeight:600},children:[Math.round(r.passRate*100),"%"]})}),a.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.rubricScore!=null?r.rubricScore.toFixed(1):"--"}),a.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.duration<1e3?`${Math.round(r.duration)}ms`:`${(r.duration/1e3).toFixed(1)}s`}),a.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.cost!=null?`$${r.cost.toFixed(4)}`:"N/A"}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsx(Ty,{data:r.sparklineData})})]},`${r.provider}/${r.model}`))})]})})}function cE({entries:t}){const r=[...t].filter(s=>s.hasBaseline).sort((s,o)=>(o.amplificationPct??0)-(s.amplificationPct??0));return r.length===0?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("div",{className:"text-center",children:a.jsxs("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:["No baseline data available. Run sweep with ",a.jsx("code",{children:"--baseline"})," flag."]})})}):a.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","With Skill","Without Skill","Delta","Amplification","Trend"].map(s=>a.jsx("th",{style:Ry(s==="#"?"center":"left"),children:s},s))})}),a.jsx("tbody",{children:r.map((s,o)=>a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:c=>{c.currentTarget.style.background="var(--surface-2)"},onMouseLeave:c=>{c.currentTarget.style.background="transparent"},children:[a.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:o+1}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:s.model}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:s.provider})]})}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("span",{className:"pill",style:{background:s.passRate>=.7?"var(--green-muted)":s.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:Tl(s.passRate),fontSize:11,fontWeight:600},children:[Math.round(s.passRate*100),"%"]})}),a.jsx("td",{style:{padding:"10px 12px"},children:s.baselinePassRate!=null?a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:[Math.round(s.baselinePassRate*100),"%"]}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:s.skillDelta!=null?a.jsxs("span",{className:"text-[11px] font-medium",style:{color:s.skillDelta>=0?"var(--green)":"var(--red)"},children:[s.skillDelta>=0?"+":"",(s.skillDelta*100).toFixed(1),"pp"]}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:s.amplificationPct!=null&&isFinite(s.amplificationPct)?a.jsx(aE,{pct:s.amplificationPct}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsx(Ty,{data:s.sparklineData})})]},`${s.provider}/${s.model}`))})]})})}function uE(){const{state:t}=Tn(),{plugin:r,skill:s}=t,[o,c]=m.useState("rankings"),u=`leaderboard/${r}/${s}`,d=m.useCallback(()=>Ee.getLeaderboard(r,s),[r,s]),{data:h,loading:g}=Ml(u,d),p=(h==null?void 0:h.entries)??[];m.useEffect(()=>{c("rankings")},[r,s]);const y=m.useCallback(()=>on(u),[u]);Lo("leaderboard:updated",y);const v=m.useMemo(()=>iE(p),[p]),b=v.some(w=>w.hasBaseline),k=p[0],S=k==null?void 0:k.judgeBiasWarning;return g?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"spinner spinner-lg"})}):v.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:"var(--accent-muted)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M18 20V10"}),a.jsx("path",{d:"M12 20V4"}),a.jsx("path",{d:"M6 20v-6"})]})}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No sweep results yet"}),a.jsx("div",{className:"text-[12px] mb-3",style:{color:"var(--text-tertiary)"},children:"Run your first model sweep to compare performance across models:"}),a.jsx("div",{className:"text-[11px] font-mono px-4 py-3 rounded-lg text-left",style:{background:"var(--surface-2)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)"},children:'vskill eval sweep --models "anthropic/claude-sonnet-4,openrouter/meta-llama/llama-3.1-70b" --judge "anthropic/claude-sonnet-4"'}),a.jsxs("div",{className:"text-[11px] mt-2",style:{color:"var(--text-tertiary)"},children:["Add ",a.jsx("code",{children:"--baseline"})," to measure skill amplification per model."]})]})]}):a.jsxs("div",{className:"p-5 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"text-[15px] font-semibold",style:{color:"var(--text-primary)"},children:"Model Leaderboard"}),a.jsx(sE,{active:o,onChange:c,hasBaseline:b})]}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[p.length," sweep",p.length!==1?"s":""," · ",v.length," model",v.length!==1?"s":""]})]}),S&&a.jsx(lE,{warning:S}),o==="rankings"?a.jsx(oE,{entries:v}):a.jsx(cE,{entries:v}),o==="amplification"&&(k==null?void 0:k.skillQualityScore)!=null&&(k==null?void 0:k.skillQualityRating)&&a.jsx(rE,{score:k.skillQualityScore,rating:k.skillQualityRating})]})}function dE({plugin:t,skill:r}){const[s,o]=m.useState([]),[c,u]=m.useState([]),[d,h]=m.useState(!0),[g,p]=m.useState(null);m.useEffect(()=>{Ee.getDependencies(t,r).then(v=>{o(v.mcpDependencies),u(v.skillDependencies)}).catch(()=>{}).finally(()=>h(!1))},[t,r]);async function y(v,b){try{await navigator.clipboard.writeText(b),p(v),setTimeout(()=>p(null),2e3)}catch{}}return d?null:s.length===0&&c.length===0?a.jsx("div",{className:"mb-5 px-4 py-3 rounded-lg text-[12px]",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:"No dependencies detected"}):a.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.jsxs("div",{className:"flex items-center gap-2.5 px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(234,179,8,0.15)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#eab308",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),a.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Dependencies"}),a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:s.length+c.length})]}),a.jsxs("div",{className:"px-5 py-4",children:[s.length>0&&a.jsxs("div",{className:"space-y-3 mb-4",children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"MCP Servers"}),s.map(v=>a.jsxs("div",{className:"p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:v.server}),a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:v.transport})]}),a.jsx("button",{onClick:()=>y(v.server,v.configSnippet),className:"btn btn-ghost text-[11px] py-1 px-2",style:{color:g===v.server?"var(--green)":"var(--accent)"},children:g===v.server?a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})," Copied!"]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),a.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})," Copy Config"]})})]}),a.jsx("div",{className:"text-[11px] mb-2 font-mono",style:{color:"var(--text-tertiary)"},children:v.url}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:v.matchedTools.map(b=>a.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&&a.jsxs("div",{children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Skill Dependencies"}),a.jsx("div",{className:"space-y-1.5",children:c.map(v=>a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})}),a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:v.name}),a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:v.source==="frontmatter"?"frontmatter":"referenced"})]},v.name))})]})]})]})}function Gg({plugin:t,skill:r}){const[s,o]=m.useState([]),[c,u]=m.useState(!0),[d,h]=m.useState(null),[g,p]=m.useState(""),[y,v]=m.useState(!1),[b,k]=m.useState(null),[S,w]=m.useState(""),[C,T]=m.useState(""),[R,L]=m.useState(!1),[B,z]=m.useState(new Set),F=m.useCallback(async()=>{u(!0);try{const[_,V]=await Promise.all([Ee.getCredentials(t,r).catch(()=>({credentials:[]})),Ee.getParams(t,r).catch(()=>({params:[]}))]),W=new Map(V.params.map(H=>[H.name,H])),Y=new Set,X=[];for(const H of _.credentials){Y.add(H.name);const M=W.get(H.name);X.push({name:H.name,status:H.status==="ready"||H.status==="resolved"?"ready":"missing",source:H.source,maskedValue:M==null?void 0:M.maskedValue})}for(const H of V.params)Y.has(H.name)||X.push({name:H.name,status:H.status,maskedValue:H.maskedValue});o(X)}finally{u(!1)}},[t,r]);m.useEffect(()=>{F()},[F]);const E=m.useCallback(async _=>{if(B.has(_)){z(V=>{const W=new Set(V);return W.delete(_),W}),o(V=>V.map(W=>W.name===_?{...W,revealedValue:void 0}:W));return}try{const W=(await Ee.getParamsRevealed(t,r,_)).params.find(Y=>Y.name===_);W&&(o(Y=>Y.map(X=>X.name===_?{...X,revealedValue:W.value}:X)),z(Y=>new Set(Y).add(_)))}catch{}},[t,r,B]),I=async(_,V)=>{if(!(!_.trim()||!V.trim())){v(!0),k(null);try{await Ee.setCredential(t,r,_,V),h(null),p(""),z(new Set),F()}catch(W){k(W.message)}finally{v(!1)}}},N=async()=>{if(!(!S.trim()||!C.trim())){v(!0),k(null);try{await Ee.setCredential(t,r,S.trim().toUpperCase(),C),w(""),T(""),L(!1),F()}catch(_){k(_.message)}finally{v(!1)}}};return c?a.jsxs("div",{className:"mt-6",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),a.jsx("div",{className:"skeleton h-20 rounded-xl"})]}):a.jsxs("div",{className:"mt-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),a.jsx("button",{onClick:()=>L(!R),className:"text-[11px] transition-colors duration-150",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"+ Add Parameter"})]}),b&&a.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&&!R?a.jsx("div",{className:"text-[12px] text-center py-6 rounded-xl",style:{color:"var(--text-tertiary)",background:"var(--surface-2)"},children:"No credentials configured for this skill"}):a.jsx("div",{className:"rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:s.map(_=>a.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.jsx("span",{className:"text-[11px] font-mono font-medium truncate",style:{color:"var(--text-primary)",minWidth:80},children:_.name}),_.maskedValue&&a.jsx("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)",maxWidth:120},children:B.has(_.name)&&_.revealedValue!=null?_.revealedValue:_.maskedValue}),_.maskedValue&&a.jsx("button",{onClick:()=>E(_.name),className:"btn btn-ghost px-1",title:B.has(_.name)?"Hide value":"Reveal value",style:{color:"var(--text-tertiary)",lineHeight:1},children:B.has(_.name)?a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94"}),a.jsx("path",{d:"M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19"}),a.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),a.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:_.status==="ready"?"var(--green-muted)":"var(--orange-muted)",color:_.status==="ready"?"var(--green)":"var(--orange)"},children:_.status==="ready"?"ready":"missing"}),_.source&&a.jsx("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:_.source}),d===_.name?a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("input",{value:g,onChange:V=>p(V.target.value),onKeyDown:V=>{V.key==="Enter"&&I(_.name,g)},className:"input-field text-[11px] font-mono",style:{width:160},placeholder:"Value...",autoFocus:!0}),a.jsx("button",{onClick:()=>I(_.name,g),disabled:y||!g.trim(),className:"btn btn-primary text-[10px] px-2 py-0.5",children:y?"...":"Save"}),a.jsx("button",{onClick:()=>{h(null),p("")},className:"btn btn-ghost text-[10px] px-1",children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}):a.jsx("button",{onClick:()=>{h(_.name),p("")},className:"btn btn-ghost text-[10px] px-2 py-0.5",style:{color:"var(--accent)"},children:"Edit"})]},_.name))}),R&&a.jsxs("div",{className:"mt-2 p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx("input",{value:S,onChange:_=>w(_.target.value),className:"input-field flex-1 text-[11px] font-mono",placeholder:"KEY_NAME",autoFocus:!0}),a.jsx("input",{value:C,onChange:_=>T(_.target.value),onKeyDown:_=>{_.key==="Enter"&&N()},className:"input-field flex-1 text-[11px] font-mono",placeholder:"Value",type:"password"})]}),a.jsxs("div",{className:"flex justify-end gap-1.5",children:[a.jsx("button",{onClick:()=>{L(!1),w(""),T("")},className:"btn btn-ghost text-[10px]",children:"Cancel"}),a.jsx("button",{onClick:N,disabled:y||!S.trim()||!C.trim(),className:"btn btn-primary text-[10px]",children:y?"Saving...":"Save"})]})]})]})}function fE(){const{state:t}=Tn(),{plugin:r,skill:s}=t,[o,c]=m.useState(null),[u,d]=m.useState(!0);return m.useEffect(()=>{Ee.getDependencies(r,s).then(c).catch(()=>{}).finally(()=>d(!1))},[r,s]),u?a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),a.jsx("div",{className:"skeleton h-32 rounded-xl"})]}):o?a.jsxs("div",{className:"p-5 max-w-3xl",children:[a.jsx(dE,{plugin:r,skill:s}),a.jsx(Gg,{plugin:r,skill:s})]}):a.jsxs("div",{className:"p-5 max-w-3xl",children:[a.jsx("div",{className:"text-[13px] mb-4",style:{color:"var(--text-tertiary)"},children:"No MCP dependency information available"}),a.jsx(Gg,{plugin:r,skill:s})]})}function pE(t){const r={prompt:t.prompt,provider:t.provider,model:t.model};return t.targetAgents&&t.targetAgents.length>0&&(r.targetAgents=t.targetAgents),r}function mE(t){var c;const r=t.userName.trim().length>0,s=t.userPlugin.trim().length>0||t.userNewPlugin.trim().length>0,o=t.forceLayout===3;return{applyName:r?null:t.aiName??null,applySuggestedPlugin:!o&&!s&&!!((c=t.aiSuggestedPlugin)!=null&&c.plugin),suggestedPluginValue:o||s?null:t.aiSuggestedPlugin??null}}function sf(t,r=!0){let s=t.toLowerCase().replace(/[^a-z0-9]+/g,"-");return r&&(s=s.replace(/^-+|-+$/g,"")),s}function hE(t,r,s,o){const u=`.../${t.split("/").slice(-2).join("/")}`;switch(r){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 xE({onCreated:t,resolveAiConfigOverride:r,forceLayout:s}){const[o,c]=m.useState("ai"),[u,d]=m.useState(null),[h,g]=m.useState(!0),{config:p}=_r(),[y,v]=m.useState(""),[b,k]=m.useState(s??3),[S,w]=m.useState(""),[C,T]=m.useState(""),[R,L]=m.useState(""),[B,z]=m.useState(""),[F,E]=m.useState(""),[I,N]=m.useState(""),[_,V]=m.useState("write"),[W,Y]=m.useState([]),[X,H]=m.useState(!1),[M,O]=m.useState(null),[U,G]=m.useState(""),[ue,D]=m.useState(!1),[P,ee]=m.useState(!1),[re,xe]=m.useState(null),[ce,ye]=m.useState(null),[de,je]=m.useState([]),Re=m.useRef(null),Le=m.useRef(null),ae=m.useRef(null),fe=m.useRef(null),me=m.useRef(null),[he,be]=m.useState(!1),[Be,Oe]=m.useState(!1),st=m.useRef(y),At=m.useRef(S),gt=m.useRef(C);m.useEffect(()=>{st.current=y},[y]),m.useEffect(()=>{At.current=S},[S]),m.useEffect(()=>{gt.current=C},[C]),m.useEffect(()=>{Ee.getProjectLayout().then($e=>{if(d($e),s)return;k($e.suggestedLayout);const Je=$e.detectedLayouts.find(yt=>yt.layout===$e.suggestedLayout);Je!=null&&Je.existingPlugins.length&&w(Je.existingPlugins[0])}).catch(()=>{}).finally(()=>g(!1))},[s]),m.useEffect(()=>{var $e;o==="ai"&&(($e=Re.current)==null||$e.focus())},[o]),m.useEffect(()=>()=>{var $e;($e=Le.current)==null||$e.abort()},[]);const Gt=m.useMemo(()=>{var $e;return u?(($e=u.detectedLayouts.find(Je=>Je.layout===b))==null?void 0:$e.existingPlugins)||[]:[]},[u,b]),vt=S==="__new__"?C:S,Ze=u?hE(u.root,b,vt||"{plugin}",y||"{skill}"):"",at=m.useMemo(()=>u?u.detectedLayouts.filter($e=>$e.layout!==4):[],[u]),ve=m.useMemo(()=>{if(!u)return null;const $e=u.detectedLayouts.find(ut=>ut.layout===2&&ut.existingPlugins.length>0),Je=u.detectedLayouts.find(ut=>ut.layout===1&&ut.existingPlugins.length>0),yt=$e||Je;return yt?{layout:yt.layout,plugins:yt.existingPlugins}:null},[u]),ct=m.useCallback(()=>{if(r)return r();if(!p)return{provider:"claude-cli",model:"sonnet"};const $e=p.provider||"claude-cli",Je=p.model||"sonnet";return{provider:$e,model:Je}},[p,r]),Nt=m.useCallback(()=>{var $e;($e=Le.current)==null||$e.abort(),D(!1)},[]),nn=m.useCallback(()=>{xe(null),ye(null)},[]),Rn=m.useCallback(async()=>{var ut,Fn;if(xe(null),ye(null),je([]),ae.current=null,fe.current=null,!U.trim()){xe("Describe what your skill should do");return}D(!0);const $e=new AbortController;Le.current=$e;const{provider:Je,model:yt}=ct();try{const Qt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(pE({prompt:U.trim(),provider:Je,model:yt,targetAgents:W})),signal:$e.signal});if(!Qt.ok||!Qt.body){let un=`HTTP ${Qt.status}`;try{const ca=await Qt.json();ca.error&&(un=ca.error)}catch{}throw new Error(un)}const Gn=Qt.body.getReader(),se=new TextDecoder;let we="",ze="";for(;;){const{done:un,value:ca}=await Gn.read();if(un)break;we+=se.decode(ca,{stream:!0});const La=we.split(`
|
|
86
|
-
`);we=La.pop()||"";for(const Ir of La)if(Ir.startsWith("event: "))ze=Ir.slice(7).trim();else if(Ir.startsWith("data: ")){try{const dt=JSON.parse(Ir.slice(6));if(ze==="progress")je(za=>[...za,{phase:dt.phase,message:dt.message,timestamp:Date.now()}]);else if(ze==="provenance")fe.current={resolvedModelId:typeof dt.resolvedModelId=="string"?dt.resolvedModelId:null,snapshotDate:typeof dt.snapshotDate=="string"?dt.snapshotDate:null};else if(ze==="done"||ze==="complete"){const za={prompt:U.trim(),provider:ct().provider,model:ct().model,resolvedModelId:((ut=fe.current)==null?void 0:ut.resolvedModelId)??null,snapshotDate:((Fn=fe.current)==null?void 0:Fn.snapshotDate)??null,reasoning:dt.reasoning||""},An=mE({userName:st.current,userPlugin:At.current,userNewPlugin:gt.current,aiName:dt.name,aiSuggestedPlugin:dt.suggestedPlugin&&dt.suggestedPlugin.plugin?{plugin:dt.suggestedPlugin.plugin,layout:dt.suggestedPlugin.layout}:null,forceLayout:s});if(An.applyName!==null&&v(An.applyName),L(dt.description),z(dt.model||""),E(dt.allowedTools||""),N(dt.body),ee(!0),ae.current=za,c("manual"),s===3)k(3),w(""),T("");else if(An.applySuggestedPlugin&&An.suggestedPluginValue){const Zt=An.suggestedPluginValue;if(((u==null?void 0:u.detectedLayouts.flatMap(ua=>ua.existingPlugins))??[]).includes(Zt.plugin))if(w(Zt.plugin),Zt.layout&&(Zt.layout===1||Zt.layout===2))k(Zt.layout);else{const ua=u==null?void 0:u.detectedLayouts.find(Dl=>Dl.existingPlugins.includes(Zt.plugin));ua&&(ua.layout===1||ua.layout===2)&&k(ua.layout)}else w("__new__"),T(Zt.plugin)}else!An.applySuggestedPlugin&&At.current.trim().length===0&>.current.trim().length===0&&b===3&&ve&&Oe(!0);const Yo={name:dt.name,plugin:vt||"",layout:b,description:dt.description,model:dt.model||void 0,allowedTools:dt.allowedTools||void 0,body:dt.body,aiMeta:za};Ee.saveDraft(Yo).then(Zt=>{be(!0),Zt!=null&&Zt.dir&&(me.current=Zt.dir)}).catch(()=>{})}else ze==="error"&&(xe(dt.message||dt.description||"Unknown error"),dt.category&&ye(dt))}catch{}ze=""}}}catch(Qt){Qt.name!=="AbortError"&&xe(Qt.message)}finally{D(!1),Le.current=null}},[U,ct,b,ve,vt,u,W,s]),Vt=m.useCallback(async()=>{if(O(null),!y.trim()){O("Skill name is required");return}if(!R.trim()){O("Description is required");return}if(b!==3&&!vt.trim()){O("Plugin name is required");return}H(!0);try{const $e=await Ee.createSkill({name:sf(y),plugin:vt||"",layout:b,description:R,model:B||void 0,allowedTools:F||void 0,body:I,aiMeta:ae.current||void 0,draftDir:me.current||void 0});me.current=null,t($e.plugin,$e.skill)}catch($e){O($e.message)}finally{H(!1)}},[y,R,b,vt,B,F,I,t]),oa=m.useCallback(()=>{ve&&(k(ve.layout),w(ve.plugins[0]),Oe(!1))},[ve]);return{mode:o,setMode:c,layout:u,layoutLoading:h,selectedLayout:b,setSelectedLayout:k,creatableLayouts:at,availablePlugins:Gt,pathPreview:Ze,plugin:S,setPlugin:w,newPlugin:C,setNewPlugin:T,effectivePlugin:vt,name:y,setName:v,description:R,setDescription:L,model:B,setModel:z,allowedTools:F,setAllowedTools:E,body:I,setBody:N,bodyViewMode:_,setBodyViewMode:V,aiPrompt:U,setAiPrompt:G,generating:ue,aiGenerated:P,aiError:re,aiClassifiedError:ce,aiProgress:de,promptRef:Re,handleGenerate:Rn,handleCancelGenerate:Nt,clearAiError:nn,targetAgents:W,setTargetAgents:Y,draftSaved:he,showPluginRecommendation:Be,setShowPluginRecommendation:Oe,pluginLayoutInfo:ve,applyPluginRecommendation:oa,creating:X,error:M,handleCreate:Vt,standaloneLocked:s===3}}function Ay(){return a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function gE(){return a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function My({node:t,depth:r=0}){var s;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",style:{paddingLeft:`${r*16}px`,color:t.type==="dir"?"var(--text-secondary)":"var(--text-tertiary)",fontSize:12,fontFamily:"var(--font-mono, monospace)"},children:[t.type==="dir"?a.jsx(Ay,{}):a.jsx(gE,{}),a.jsxs("span",{children:[t.name,t.type==="dir"?"/":""]})]}),(s=t.children)==null?void 0:s.map(o=>a.jsx(My,{node:o,depth:r+1},o.name))]})}function vE(t,r,s){const o=[];r&&o.push({name:"evals.json",type:"file"}),o.push({name:"history",type:"dir"});const c=[{name:"SKILL.md",type:"file"},{name:"evals",type:"dir",children:o}];return s&&c.push({name:"draft.json",type:"file"}),{name:t||"{skill}",type:"dir",children:c}}function yE({skillName:t,hasEvals:r,isDraft:s}){const o=vE(t,r,s);return a.jsxs("div",{className:"glass-card p-4",children:[a.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[a.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"var(--accent-muted)"},children:a.jsx(Ay,{})}),"Skill Structure"]}),a.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-0)",border:"1px solid var(--border-subtle)"},children:a.jsx(My,{node:o})})]})}const lr={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function _d({size:t=14,color:r="currentColor"}){return a.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 3l1.912 5.813a2 2 0 001.275 1.275L21 12l-5.813 1.912a2 2 0 00-1.275 1.275L12 21l-1.912-5.813a2 2 0 00-1.275-1.275L3 12l5.813-1.912a2 2 0 001.275-1.275L12 3z"})})}function bE({onCreated:t,onCancel:r}){const s=xE({onCreated:t});return a.jsxs("div",{className:"px-8 py-6 max-w-4xl animate-fade-in overflow-auto h-full",children:[a.jsxs("div",{className:"mb-5",children:[a.jsx("h2",{className:"text-[20px] font-semibold tracking-tight",style:{color:"var(--text-primary)"},children:"Create a New Skill"}),a.jsx("div",{className:"flex items-center justify-between mt-2",children:a.jsxs("div",{className:"inline-flex rounded-lg p-0.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsx("button",{onClick:()=>s.setMode("ai"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:s.mode==="ai"?"rgba(168,85,247,0.15)":"transparent",color:s.mode==="ai"?"#a855f7":"var(--text-tertiary)",boxShadow:s.mode==="ai"?"0 1px 3px rgba(168,85,247,0.15)":"none",cursor:"pointer",border:"none"},children:a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(_d,{size:12}),"AI-Assisted"]})}),a.jsx("button",{onClick:()=>s.setMode("manual"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:s.mode==="manual"?"var(--surface-4, var(--surface-3))":"transparent",color:s.mode==="manual"?"var(--text-primary)":"var(--text-tertiary)",boxShadow:s.mode==="manual"?"0 1px 3px rgba(0,0,0,0.1)":"none",cursor:"pointer",border:"none"},children:"Manual"})]})})]}),s.layoutLoading&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"skeleton h-10 w-full rounded-lg"}),a.jsx("div",{className:"skeleton h-10 w-full rounded-lg"})]}),!s.layoutLoading&&s.layout&&s.mode==="ai"&&a.jsxs("div",{className:"space-y-4 animate-fade-in",children:[a.jsxs("div",{className:"glass-card p-4",children:[a.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[a.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsx(_d,{size:11,color:"#a855f7"})}),"Describe Your Skill"]}),a.jsx("textarea",{ref:s.promptRef,value:s.aiPrompt,onChange:o=>s.setAiPrompt(o.target.value),placeholder:`e.g., A skill that helps format SQL queries, optimize them for performance, and explain query execution plans.
|
|
87
|
-
|
|
88
|
-
Include any specific behaviors, constraints, or output formats you want.`,rows:5,disabled:s.generating,className:"w-full px-3 py-2.5 rounded-lg text-[13px] resize-y",style:{...lr,minHeight:"120px"},onKeyDown:o=>{o.key==="Enter"&&(o.metaKey||o.ctrlKey)&&(o.preventDefault(),s.handleGenerate())}}),a.jsx("p",{className:"text-[11px] mt-2",style:{color:"var(--text-quaternary, var(--text-tertiary))"},children:"Cmd+Enter to generate"})]}),s.generating&&s.aiProgress.length>0&&a.jsx(Xs,{entries:s.aiProgress,isRunning:!0}),s.aiError&&a.jsx("div",{children:s.aiClassifiedError?a.jsx(Wo,{error:s.aiClassifiedError,onRetry:s.handleGenerate,onDismiss:s.clearAiError}):a.jsxs("div",{children:[a.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:s.aiError}),a.jsx("button",{onClick:s.handleGenerate,className:"mt-2 text-[12px] font-medium",style:{color:"#a855f7",background:"none",border:"none",cursor:"pointer"},children:"Retry"})]})}),a.jsxs("div",{className:"flex items-center gap-3",children:[s.generating?a.jsx("button",{onClick:s.handleCancelGenerate,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:"var(--surface-3)",color:"var(--text-secondary)",border:"none",cursor:"pointer"},children:"Cancel Generation"}):a.jsxs("button",{onClick:s.handleGenerate,disabled:!s.aiPrompt.trim(),className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:s.aiPrompt.trim()?"#a855f7":"var(--surface-3)",color:s.aiPrompt.trim()?"#fff":"var(--text-tertiary)",cursor:s.aiPrompt.trim()?"pointer":"not-allowed",border:"none"},children:[a.jsx(_d,{size:14}),"Generate"]}),a.jsx("button",{onClick:r,className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"}),!s.generating&&a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:["or fill in the form manually",a.jsx("button",{onClick:()=>s.setMode("manual"),className:"ml-1 font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"below"})]})]})]}),!s.layoutLoading&&s.layout&&s.mode==="manual"&&a.jsxs("div",{className:"space-y-4 animate-fade-in",children:[a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Location"}),s.creatableLayouts.length>1&&a.jsxs("div",{className:"mb-3",children:[a.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Layout"}),a.jsx("div",{className:"flex gap-2",children:s.creatableLayouts.map(o=>a.jsx("button",{onClick:()=>{s.setSelectedLayout(o.layout),s.setPlugin(o.existingPlugins[0]||""),s.setNewPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:s.selectedLayout===o.layout?"var(--accent)":"var(--surface-3)",color:s.selectedLayout===o.layout?"#fff":"var(--text-secondary)",border:`1px solid ${s.selectedLayout===o.layout?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},children:o.label},o.layout))})]}),s.selectedLayout!==3&&a.jsxs("div",{className:"mb-3",children:[a.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Plugin"}),a.jsxs("select",{value:s.plugin,onChange:o=>{s.setPlugin(o.target.value),s.setNewPlugin("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:lr,children:[s.availablePlugins.map(o=>a.jsx("option",{value:o,children:o},o)),a.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),s.plugin==="__new__"&&a.jsx("input",{type:"text",value:s.newPlugin,onChange:o=>s.setNewPlugin(sf(o.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:lr})]}),a.jsx("div",{className:"px-3 py-2 rounded-lg text-[11px] font-mono",style:{background:"var(--surface-0)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:s.pathPreview})]}),s.showPluginRecommendation&&s.pluginLayoutInfo&&s.selectedLayout===3&&a.jsxs("div",{className:"px-4 py-3 rounded-lg text-[12px] animate-fade-in flex items-center justify-between gap-3",style:{background:"rgba(59,130,246,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(59,130,246,0.2)"},children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#3b82f6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),a.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),a.jsxs("span",{children:["Plugins detected (",a.jsx("strong",{children:s.pluginLayoutInfo.plugins.slice(0,3).join(", ")}),"). Add this skill to a plugin for better organization."]})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[a.jsx("button",{onClick:s.applyPluginRecommendation,className:"px-3 py-1 rounded-md text-[11px] font-medium",style:{background:"#3b82f6",color:"#fff",border:"none",cursor:"pointer"},children:"Use plugin"}),a.jsx("button",{onClick:()=>s.setShowPluginRecommendation(!1),className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Skill Details"}),a.jsxs("div",{className:"mb-3",children:[a.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Name ",a.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),a.jsx("input",{type:"text",value:s.name,onChange:o=>s.setName(sf(o.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:lr})]}),a.jsxs("div",{className:"mb-3",children:[a.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Description ",a.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),a.jsx("textarea",{value:s.description,onChange:o=>s.setDescription(o.target.value),placeholder:"Brief description",rows:3,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-y",style:{...lr,minHeight:"72px"}})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),a.jsxs("select",{value:s.model,onChange:o=>s.setModel(o.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:lr,children:[a.jsx("option",{value:"",children:"Any"}),a.jsx("option",{value:"opus",children:"Opus"}),a.jsx("option",{value:"sonnet",children:"Sonnet"}),a.jsx("option",{value:"haiku",children:"Haiku"})]})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Allowed Tools"}),a.jsx("input",{type:"text",value:s.allowedTools,onChange:o=>s.setAllowedTools(o.target.value),placeholder:"Read, Write, Edit...",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:lr})]})]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--accent-muted)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"}),a.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),a.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md"}),a.jsx("span",{className:"text-[11px] ml-2",style:{color:"var(--text-tertiary)"},children:"Skill Definition"})]})]}),a.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:["write","preview"].map(o=>a.jsxs("button",{onClick:()=>s.setBodyViewMode(o),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:s.bodyViewMode===o?"var(--surface-4)":"transparent",color:s.bodyViewMode===o?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:s.bodyViewMode===o?600:400,border:"none",cursor:"pointer"},children:[o==="write"?a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"16 18 22 12 16 6"}),a.jsx("polyline",{points:"8 6 2 12 8 18"})]}):a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),a.jsx("span",{children:o==="write"?"Write":"Preview"})]},o))})]}),s.bodyViewMode==="write"?a.jsx("textarea",{value:s.body,onChange:o=>s.setBody(o.target.value),placeholder:`# /my-skill
|
|
89
|
-
|
|
90
|
-
You are an expert at...
|
|
91
|
-
`,rows:8,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{...lr,minHeight:"150px"}}):s.body.trim()?a.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"150px",maxHeight:"400px",overflowY:"auto"},dangerouslySetInnerHTML:{__html:Fo(s.body)}}):a.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"150px",maxHeight:"400px",overflowY:"auto"},children:a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Start writing to see preview"})})]}),a.jsx(yE,{skillName:s.name||"{skill}",hasEvals:!1,isDraft:s.draftSaved}),s.error&&a.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:s.error}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:s.handleCreate,disabled:s.creating||!s.name||!s.description,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:s.creating||!s.name||!s.description?"var(--surface-3)":"var(--accent)",color:s.creating||!s.name||!s.description?"var(--text-tertiary)":"#fff",cursor:s.creating||!s.name||!s.description?"not-allowed":"pointer",border:"none"},children:s.creating?"Creating...":"Create Skill"}),a.jsx("button",{onClick:r,className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]})]})]})}function jE(){return a.jsx("div",{className:"w-16 h-16 rounded-2xl flex items-center justify-center",style:{background:"var(--surface-2)"},children:a.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),a.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),a.jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]})})}function No({variant:t,message:r,onRetry:s}){const{setMode:o,setSearch:c}=Zn(),[u,d]=m.useState(!1);return t==="no-selection"?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:[a.jsx("div",{className:"mb-5",children:u?a.jsx(jE,{}):a.jsx("img",{src:"/images/empty-studio.webp",width:128,height:128,alt:"",onError:()=>d(!0),style:{objectFit:"contain"}})}),a.jsx("p",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Select a skill to view details"}),a.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Choose a skill from the list to edit, test, and evaluate"})]}):t==="no-skills"?a.jsxs("div",{className:"text-center py-12 px-4 animate-fade-in-scale",children:[a.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mx-auto mb-4",style:{background:"var(--surface-2)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})})}),a.jsx("p",{className:"text-[14px] font-medium",style:{color:"var(--text-secondary)"},children:"No skills found"}),a.jsxs("p",{className:"text-[12px] mt-1 mb-4",style:{color:"var(--text-tertiary)"},children:["Check your ",a.jsx("code",{className:"px-1.5 py-0.5 rounded text-[11px]",style:{background:"var(--surface-2)"},children:"--root"})," directory, or create your first skill"]}),a.jsxs("button",{onClick:()=>o("create"),className:"inline-flex items-center gap-2 px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:"var(--accent)",color:"#fff",border:"none",cursor:"pointer"},onMouseEnter:h=>{h.currentTarget.style.opacity="0.9"},onMouseLeave:h=>{h.currentTarget.style.opacity="1"},children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Create Your First Skill"]})]}):t==="error"?a.jsx("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:a.jsxs("div",{className:"px-5 py-4 rounded-lg text-center max-w-sm",style:{background:"var(--red-muted)",border:"1px solid rgba(248,113,113,0.2)"},children:[a.jsx("p",{className:"text-[13px] mb-3",style:{color:"var(--red)"},children:r||"Failed to load skill data"}),s&&a.jsx("button",{onClick:s,className:"px-4 py-2 rounded-lg text-[12px] font-medium",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"none",cursor:"pointer"},children:"Retry"})]})}):a.jsxs("div",{className:"px-4 py-8 text-center animate-fade-in",children:[a.jsx("p",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"No skills match your search"}),a.jsx("button",{onClick:()=>c(""),className:"text-[12px] font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer",textDecoration:"underline"},children:"Clear search"})]})}function SE(t,r){const[s,o]=t.split(".").map(Number),[c,u]=r.split(".").map(Number);return c>s?"major":u>o?"minor":"patch"}const kE={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 wE(){const[t,r]=m.useState([]),[s,o]=m.useState(!0),[c,u]=m.useState(new Set),[d,h]=m.useState(new Map),[g,p]=m.useState(!1),[y,v]=m.useState(new Set),[b,k]=m.useState(null),[S,w]=m.useState(null),[C,T]=m.useState(!1),R=m.useCallback(async()=>{o(!0);try{const N=await Ee.getSkillUpdates();r(N.filter(_=>_.updateAvailable))}catch{r([])}finally{o(!1)}},[]);m.useEffect(()=>{R()},[R]);const L=m.useMemo(()=>t.filter(N=>!N.pinned),[t]),B=m.useCallback(N=>{u(_=>{const V=new Set(_);return V.has(N)?V.delete(N):V.add(N),V})},[]),z=m.useCallback(()=>{c.size===L.length?u(new Set):u(new Set(L.map(N=>N.name)))},[c,L]),F=m.useCallback(()=>{const N=[...c];if(!N.length)return;p(!0),h(new Map(N.map(V=>[V,{skill:V,status:"pending"}])));const _=Ee.startBatchUpdate(N);_.addEventListener("progress",V=>{try{const W=JSON.parse(V.data);h(Y=>new Map(Y).set(W.skill,W))}catch{}}),_.addEventListener("done",V=>{_.close(),p(!1);try{const W=JSON.parse(V.data);k(`Updated ${W.updated??0} skills, ${W.failed??0} failed`),setTimeout(()=>k(null),5e3)}catch{}R()}),_.addEventListener("error",()=>{_.close(),p(!1),k("Batch update failed"),setTimeout(()=>k(null),5e3)})},[c,R]),E=m.useCallback(N=>{N.name.split("/").pop()||N.name;const _=N.name.split("/"),V=_.length>=3?_[_.length-2]:_[0],W=_[_.length-1];v(X=>new Set(X).add(N.name));const Y=Ee.startSkillUpdate(V,W);Y.addEventListener("done",()=>{Y.close(),v(X=>{const H=new Set(X);return H.delete(N.name),H}),R()}),Y.addEventListener("error",()=>{Y.close(),v(X=>{const H=new Set(X);return H.delete(N.name),H})})},[R]),I=m.useCallback(async N=>{if(!N.latest)return;const _=N.name.split("/"),V=_.length>=3?_[_.length-2]:_[0],W=_[_.length-1];T(!0);try{const Y=await Ee.getVersionDiff(V,W,N.installed,N.latest);w({skill:N,diff:Y})}catch{w(null)}finally{T(!1)}},[]);return s?a.jsxs("div",{className:"p-6",children:[a.jsx("div",{className:"skeleton h-6 w-48 mb-4"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"skeleton h-16 rounded-lg"}),a.jsx("div",{className:"skeleton h-16 rounded-lg"})]})]}):t.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-16",children:[a.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"mb-4",children:[a.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),a.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),a.jsx("div",{className:"text-[15px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"All skills are up to date"}),a.jsx("div",{className:"text-[12px] mb-4",style:{color:"var(--text-tertiary)"},children:"No updates available for installed skills."}),a.jsx("button",{onClick:R,className:"btn btn-secondary text-[12px]",children:"Refresh"})]}):a.jsxs("div",{className:"p-6",children:[b&&a.jsx("div",{className:"fixed top-4 right-4 z-50 px-4 py-3 rounded-lg text-[13px] font-medium animate-fade-in",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"},children:b}),a.jsxs("div",{className:"flex items-center justify-between mb-5",children:[a.jsxs("div",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["Available Updates (",L.length,")"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:R,className:"btn btn-ghost text-[12px]",disabled:g,children:"Refresh"}),a.jsx("button",{onClick:F,disabled:c.size===0||g,className:"btn btn-primary text-[12px]",children:g?"Updating...":`Update Selected (${c.size})`})]})]}),a.jsx("div",{className:"flex items-center gap-2 mb-3",children:a.jsxs("button",{onClick:z,className:"flex items-center gap-2 text-[12px] font-medium",style:{color:"var(--text-secondary)",background:"transparent",border:"none",cursor:"pointer"},children:[a.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:c.size===L.length&&L.length>0?"var(--accent)":"var(--border-default)",background:c.size===L.length&&L.length>0?"var(--accent)":"transparent"},children:c.size===L.length&&L.length>0&&a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})}),"Select All"]})}),a.jsx("div",{className:"space-y-2",children:t.map(N=>{const _=N.name.split("/").pop()||N.name,V=N.latest?SE(N.installed,N.latest):"patch",W=kE[V],Y=!!N.pinned,X=y.has(N.name),H=d.get(N.name),M=c.has(N.name);return a.jsx("div",{className:"rounded-lg px-4 py-3 transition-all duration-150",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",opacity:Y?.7:1},children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:()=>!Y&&B(N.name),disabled:Y,className:"flex-shrink-0",style:{background:"transparent",border:"none",cursor:Y?"not-allowed":"pointer"},children:a.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:M?"var(--accent)":"var(--border-default)",background:M?"var(--accent)":"transparent",opacity:Y?.4:1},children:M&&a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:_}),Y&&a.jsx("span",{className:"text-[10px]",title:"Pinned — unpin from CLI to update",children:"📌"}),a.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:W.bg,color:W.text},children:V})]}),a.jsxs("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[N.installed," → ",N.latest||"?",Y&&` (pinned at ${N.pinnedVersion||N.installed})`]})]}),H&&a.jsxs("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:H.status==="done"?"var(--green-muted)":H.status==="error"?"var(--red-muted)":"var(--yellow-muted)",color:H.status==="done"?"var(--green)":H.status==="error"?"var(--red)":"var(--yellow)"},children:[H.status,H.error&&`: ${H.error}`]}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[a.jsx("button",{onClick:()=>I(N),className:"btn btn-ghost text-[11px]",disabled:C,children:"View Changes"}),a.jsx("button",{onClick:()=>E(N),disabled:Y||X||g,title:Y?"Pinned — unpin from CLI to update":"",className:`btn ${Y?"btn-ghost":"btn-primary"} text-[11px]`,children:X?a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"spinner spinner-sm"})," Updating"]}):(H==null?void 0:H.status)==="done"?a.jsx("span",{style:{color:"var(--green)"},children:"✓"}):"Update"})]})]})},N.name)})}),S&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>w(null),children:a.jsxs("div",{style:{width:"80%",maxWidth:900},onClick:N=>N.stopPropagation(),children:[a.jsx("div",{className:"mb-2 flex justify-end",children:a.jsx("button",{onClick:()=>w(null),className:"btn btn-ghost text-[12px]",children:"Close"})}),a.jsx(Af,{contentDiff:S.diff.contentDiff,fromLabel:S.diff.from,toLabel:S.diff.to,diffSummary:S.diff.diffSummary,renderContext:"inline"})]})})]})}function CE(t){return t==null?"var(--text-tertiary)":t>=.7?"var(--green)":t>=.4?"var(--yellow)":"var(--red)"}function EE(t){return t==null?"var(--surface-3)":t>=.7?"var(--green-muted)":t>=.4?"var(--yellow-muted)":"var(--red-muted)"}function NE(t){if(!t||typeof t!="string")return null;const r=t.trim();if(!r)return null;if(!r.includes("://")){const[s]=r.split("/");return s&&/^[A-Za-z0-9][A-Za-z0-9-]{0,38}$/.test(s)?s:null}try{const s=new URL(r),o=s.hostname.toLowerCase();if(o!=="github.com"&&o!=="www.github.com"&&o!=="raw.githubusercontent.com")return null;const 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 Ly(t){const{author:r,repoUrl:s}=t,o=NE(s??null),c=r&&r.trim()!==""?r:o??"—",[u,d]=m.useState(!1),h=m.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?a.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}):!r||r.trim()===""?a.jsx("span",{"data-testid":t["data-testid"]??"author-link-empty",style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)"},children:"—"}):a.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,a.jsx("span",{"aria-hidden":"true",style:{fontSize:10,opacity:.7},children:u?"✓":"⧉"})]})}function TE(t){let r=t.split("#")[0].split("?")[0].replace(/\/+$/,"");return r=r.replace(/\/(?:tree|blob)\/[^/]+(?:\/.*)?$/,""),r}function RE(t,r){const s=TE(t),o=(r??"").replace(/^\/+/,"").replace(/\/+$/,"");return o?`${s}/blob/HEAD/${o}`:`${s}/blob/HEAD/`}function Wg(t){if(!t)return"source";const r=t.replace(/\/+$/,""),s=r.lastIndexOf("/");return s===-1?r:r.slice(s+1)}function zy(t){const{repoUrl:r,skillPath:s,absolutePath:o}=t,[c,u]=m.useState(!1),d=typeof r=="string"&&r.trim()!==""&&/^https?:\/\//.test(r.trim()),h=s?Wg(s):o?Wg(o):"source",g=m.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=RE(r,s);return a.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:[a.jsx("span",{children:h}),a.jsx("span",{"aria-hidden":"true",children:"↗"})]})}if(!o&&!s)return a.jsx("span",{"data-testid":t["data-testid"]??"source-file-empty",style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)"},children:"—"});const p=o??s??"";return a.jsxs("button",{type:"button","data-testid":t["data-testid"]??"source-file-copy",title:`Copy ${p}`,onClick:g,style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 6px",border:"1px solid var(--border-default, var(--border))",borderRadius:4,background:"transparent",fontFamily:"var(--font-mono, var(--font-geist-mono))",fontSize:12,color:"var(--text-secondary)",cursor:"pointer",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[a.jsx("span",{children:h}),a.jsx("span",{"aria-hidden":"true",style:{fontSize:10,opacity:.7},children:c?"✓":"⧉"})]})}function qg(t,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:t,severity:r}}))}function Dy(t){return t.skill?ME({skill:t.skill}):zE({state:t.state,isReadOnly:t.isReadOnly,onDelete:t.onDelete})}function AE(t,r=48){if(t.length<=r)return t;const s=t.slice(0,12),o=t.slice(t.length-(r-12-1));return`${s}…${o}`}function ME({skill:t}){const[r,s]=m.useState(!1),o=m.useCallback(async()=>{var d;try{await((d=navigator.clipboard)==null?void 0:d.writeText(t.dir)),s(!0),setTimeout(()=>s(!1),1500),qg(te.toasts.pathCopied,"info")}catch{qg(te.toasts.permissionDenied,"error")}},[t.dir]),c=t.origin==="installed"?"Project":"Skills",u=t.origin==="installed"?"var(--status-installed)":"var(--status-own)";return a.jsxs("div",{"data-testid":"detail-header",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px",boxShadow:"none"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",marginBottom:4},children:[a.jsx("span",{"data-testid":"detail-header-plugin",children:t.plugin}),a.jsx("span",{"aria-hidden":"true",style:{color:"var(--text-secondary)"},children:"›"}),a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--text-secondary)",fontSize:11,letterSpacing:.3,textTransform:"uppercase"},children:[a.jsx("span",{"data-origin-dot":t.origin,"aria-label":`Origin: ${c}`,style:{display:"inline-block",width:7,height:7,borderRadius:999,background:u}}),c]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,marginBottom:8},children:[a.jsx("h2",{"data-testid":"detail-header-name",style:{fontFamily:"var(--font-serif)",fontSize:20,fontWeight:500,lineHeight:1.25,color:"var(--text-primary)",margin:0},children:t.skill}),a.jsx("span",{"data-testid":"detail-header-version",children:a.jsx(Ks,{version:t.version??null})})]}),a.jsxs("div",{"data-testid":"detail-header-byline",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:10,margin:"0 0 8px",fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)"},children:[a.jsx(Ly,{author:t.author??null,repoUrl:t.homepage??null}),a.jsx(zy,{repoUrl:t.homepage??null,skillPath:null,absolutePath:t.dir})]}),a.jsx(LE,{skill:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.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:AE(t.dir||"—")}),a.jsxs("button",{"data-testid":"detail-header-copy-path",type:"button",onClick:o,"aria-label":"Copy skill path to clipboard",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:11,cursor:"pointer"},children:[a.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),a.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),r?"Copied":"Copy"]})]})]})}function LE({skill:t}){const r=t.installMethod,s=t.symlinkTarget;if(!r)return null;let o="";switch(r){case"symlinked":o=s?`Symlinked from ${s}`:"Symlinked (target unresolved)";break;case"copied":o="Copied (independent)";break;case"authored":o="Authored";break;default:return null}return a.jsxs("div",{"data-testid":"detail-header-install-method",style:{display:"flex",alignItems:"center",gap:6,fontSize:11,color:"var(--text-secondary)",fontFamily:"var(--font-sans)",margin:"6px 0 8px"},children:[a.jsx("span",{style:{fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",fontSize:10,color:"var(--text-tertiary)"},children:"Install method"}),a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:o})]})}function zE({state:t,isReadOnly:r,onDelete:s}){const{plugin:o,skill:c,evals:u,latestBenchmark:d,isDirty:h,caseRunStates:g,regressions:p,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,k=(u==null?void 0:u.evals.reduce((T,R)=>T+R.assertions.length,0))??0,S=(u==null?void 0:u.evals.length)??0,w=CE(b),C=EE(b);return a.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)",flexShrink:0},children:[a.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[a.jsx("span",{style:{color:"var(--text-tertiary)"},children:o}),a.jsx(DE,{}),a.jsx("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:c}),r&&a.jsxs("span",{className:"ml-2 flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:[a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"installed"]}),h&&a.jsx("span",{className:"ml-2 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded",style:{background:"var(--yellow-muted)",color:"var(--yellow)"},children:"unsaved"}),v&&a.jsxs("span",{className:"ml-2 flex items-center gap-1.5 text-[11px]",style:{color:"var(--accent)"},children:[a.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}}),"Running..."]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[!r&&s&&a.jsx("button",{disabled:v,onClick:()=>{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:a.jsx(_E,{})}),p.length>0&&a.jsxs("span",{className:"pill",style:{background:"var(--red-muted)",color:"var(--red)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[a.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),a.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),a.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),p.length," regression",p.length>1?"s":""]}),y>0&&a.jsxs("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)"},children:["Iter ",y]}),a.jsx("span",{className:"pill",style:{background:C,color:w},children:b!=null?`${Math.round(b*100)}%`:"--"}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[S," case",S!==1?"s":""," / ",k," assert",k!==1?"s":""]})]})]})}function DE(){return a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})}function _E(){return a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"3 6 5 6 21 6"}),a.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),a.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),a.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}function sr(t){const{title:r,label:s,value:o,subtitle:c,description:u,linkLabel:d,children:h,onClick:g}=t,p=r??s??"",y=typeof g=="function",v=b=>{y&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),g==null||g())};return a.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:[p?a.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:p}):null,a.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?a.jsx("div",{style:{fontFamily:"var(--font-geist-mono, var(--font-mono))",fontSize:"0.625rem",color:"var(--card-text-muted, var(--text-secondary))"},children:c}):null,u?a.jsx("div",{style:{fontFamily:"var(--font-geist-mono, var(--font-mono))",fontSize:"0.5625rem",color:"var(--card-text-muted, var(--text-secondary))",lineHeight:1.4,opacity:.7},children:u}):null,h?a.jsx("div",{style:{flex:1,marginTop:"0.25rem"},children:h}):null,d?a.jsx("div",{style:{marginTop:"auto",paddingTop:"0.375rem",borderTop:"1px solid var(--border, var(--border-default))",fontFamily:"var(--font-geist-mono, var(--font-mono))",fontSize:"0.625rem",color:"var(--card-text-muted, var(--text-secondary))"},children:d}):null]})}const OE="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 BE(t){const{onNavigate:r}=t,[s,o]=m.useState(t.open??!1),c=m.useCallback(()=>o(!1),[]);m.useEffect(()=>{if(!s)return;const d=h=>{h.key==="Escape"&&c()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[s,c]);const u=m.useCallback(d=>{r==null||r(d),o(!1)},[r]);return a.jsxs("span",{"data-testid":t["data-testid"]??"benchmark-info",style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[a.jsx("button",{type:"button","data-testid":"benchmark-info-trigger","aria-label":"About benchmarks","aria-expanded":!!s,onClick:()=>o(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&&a.jsxs("div",{role:"dialog","data-testid":"benchmark-info-popover",style:{position:"absolute",top:"100%",right:0,marginTop:6,zIndex:20,width:280,padding:"10px 12px",background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border))",borderRadius:6,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-primary)",boxShadow:"0 4px 16px rgba(0,0,0,0.08)"},children:[a.jsx("p",{style:{margin:"0 0 8px",lineHeight:1.45},children:OE}),a.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[a.jsx("button",{type:"button","data-testid":"benchmark-info-link-tests",onClick:()=>u("tests"),style:Od,children:"Tests →"}),a.jsx("button",{type:"button","data-testid":"benchmark-info-link-run",onClick:()=>u("run"),style:Od,children:"Run →"}),a.jsx("button",{type:"button","data-testid":"benchmark-info-close",onClick:c,style:{...Od,marginLeft:"auto",color:"var(--text-secondary)"},children:"Close"})]})]})]})}const Od={background:"transparent",border:"none",padding:0,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-accent, var(--text-primary))",cursor:"pointer",textDecoration:"underline"};function IE(t){if(t==null||!Number.isFinite(t))return"—";if(t<1024)return`${t} B`;const r=t/1024;if(r<1024)return r>=10?`${Math.round(r)} KB`:`${r.toFixed(1).replace(/\.0$/,"")} KB`;const s=r/1024;return s>=10?`${Math.round(s)} MB`:`${s.toFixed(1).replace(/\.0$/,"")} MB`}function Rs(t){if(!t)return"—";const r=new Date(t);if(Number.isNaN(r.getTime()))return t;const s=Date.now()-r.getTime(),o=Math.floor(s/1e3);if(o<60)return"just now";const c=Math.floor(o/60);if(c<60)return`${c} min ago`;const 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 HE(t){switch(t.benchmarkStatus){case"pass":case"fail":case"stale":return t.benchmarkStatus==="pass"?"100%":t.benchmarkStatus==="fail"?"0%":"—";default:return"—"}}function UE(t){const r=t.installMethod;if(!r)return null;const s=r==="authored"?"Authored":r==="copied"?"Copied":"Symlinked";return a.jsx("span",{"data-testid":"overview-install-method",style:{display:"inline-flex",alignItems:"center",padding:"1px 6px",border:"1px solid var(--border-default, var(--border))",borderRadius:4,fontFamily:"var(--font-mono, var(--font-geist-mono))",fontSize:10,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:.4},children:s})}function $E(t){var y,v;const{skill:r,onNavigate:s,activationsCount:o=0,lastRunIso:c=null,repoUrl:u,skillPathInRepo:d}=t,h=u??(VE(r.homepage)?r.homepage??null:null),g=((y=r.mcpDeps)==null?void 0:y.length)??0,p=((v=r.deps)==null?void 0:v.length)??0;return a.jsxs("div",{"data-testid":"skill-overview",className:"skill-overview",style:{display:"flex",flexDirection:"column",gap:12,padding:16},children:[a.jsxs("header",{"data-testid":"skill-overview-header",style:{position:"sticky",top:0,zIndex:5,display:"flex",flexDirection:"column",gap:6,padding:"10px 12px",background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border))",borderRadius:8},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap"},children:[a.jsx("h2",{"data-testid":"skill-overview-name",style:{fontFamily:"var(--font-serif, var(--font-sans))",fontSize:18,fontWeight:500,color:"var(--text-primary)",margin:0,lineHeight:1.2},children:r.skill}),a.jsx(Ks,{version:r.version??null}),UE(r)]}),a.jsxs("div",{"data-testid":"skill-overview-byline",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:10,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)"},children:[a.jsx(Ly,{author:r.author??null,repoUrl:h}),r.category?a.jsxs("span",{children:["· ",r.category]}):null,a.jsx(zy,{repoUrl:h,skillPath:d??null,absolutePath:r.dir}),r.lastModified?a.jsxs("span",{title:r.lastModified,children:["· Updated ",Rs(r.lastModified)]}):null]})]}),a.jsxs("div",{"data-testid":"skill-overview-grid",className:"skill-overview-grid",style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:"0.75rem",alignItems:"stretch"},children:[a.jsx(sr,{title:"Benchmark",value:HE(r),subtitle:r.lastBenchmark?Rs(r.lastBenchmark):"Never run","data-testid":"metric-benchmark",onClick:s?()=>s("run"):void 0,children:a.jsx("div",{style:{marginTop:4,display:"inline-flex",alignItems:"center"},children:a.jsx(BE,{onNavigate:s})})}),a.jsx(sr,{title:"Tests",value:r.evalCount??0,subtitle:`${r.assertionCount??0} assertions`,"data-testid":"metric-tests",onClick:s?()=>s("tests"):void 0}),a.jsx(sr,{title:"Activations",value:o,subtitle:c?`Last: ${Rs(c)}`:"Never","data-testid":"metric-activations",onClick:s?()=>s("activation"):void 0}),a.jsx(sr,{title:"Last run",value:Rs(c??r.lastBenchmark??null),"data-testid":"metric-last-run",onClick:s?()=>s("history"):void 0}),a.jsx(sr,{title:"MCP deps",value:g,subtitle:g>0&&r.mcpDeps?r.mcpDeps.slice(0,3).join(", "):"None","data-testid":"metric-mcp-deps",onClick:s?()=>s("deps"):void 0}),a.jsx(sr,{title:"Skill deps",value:p,subtitle:p>0&&r.deps?r.deps.slice(0,3).join(", "):"None","data-testid":"metric-skill-deps",onClick:s?()=>s("deps"):void 0}),a.jsx(sr,{title:"Size",value:IE(r.sizeBytes),"data-testid":"metric-size"}),a.jsx(sr,{title:"Last modified",value:Rs(r.lastModified),subtitle:r.lastModified??void 0,"data-testid":"metric-last-modified"})]})]})}function VE(t){return t?/^https?:\/\/(?:www\.)?(?:github\.com|raw\.githubusercontent\.com)\//.test(t):!1}const Yg=m.memo(function({message:r,politeness:s="polite",role:o}){const c=o??(s==="assertive"?"alert":"status");return a.jsx("div",{"aria-live":s,"aria-atomic":"true",role:c,"data-testid":"aria-live","data-politeness":s,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0,padding:0,margin:-1},children:r})});function PE({toast:t,onDismiss:r}){const[s,o]=m.useState(!0),c=m.useRef(null);m.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 a.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:[a.jsx("span",{style:{flex:1,minWidth:0},children:t.message}),t.action&&a.jsx("button",{type:"button",onClick:()=>{t.action.onInvoke(),r(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}),a.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>r(t.id),style:{background:"transparent",border:"none",padding:2,color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1},children:"×"})]})}function FE({toasts:t,onDismiss:r,liveMessage:s,liveAssertiveMessage:o}){return a.jsxs(a.Fragment,{children:[a.jsx(Yg,{politeness:"polite",message:s}),a.jsx(Yg,{politeness:"assertive",message:o}),t.length>0&&a.jsx("div",{"data-testid":"toast-stack",style:{position:"fixed",right:16,bottom:16,display:"flex",flexDirection:"column-reverse",gap:8,zIndex:50,pointerEvents:"none"},children:t.map(c=>a.jsx("div",{style:{pointerEvents:"auto"},children:a.jsx(PE,{toast:c,onDismiss:r})},c.id))})]})}const _y=m.createContext(null);function qo(){const t=m.useContext(_y);if(!t)throw new Error("useToast must be used inside <ToastProvider>.");return t}function GE({children:t,maxVisible:r=4,defaultDurationMs:s=4e3}){const[o,c]=m.useState([]),[u,d]=m.useState(""),[h,g]=m.useState(""),p=m.useRef(new Map),y=m.useCallback(C=>{const T=p.current.get(C);T&&(clearTimeout(T),p.current.delete(C)),c(R=>R.filter(L=>L.id!==C))},[]),v=m.useCallback((C,T)=>{if(T<=0)return;const R=setTimeout(()=>{y(C)},T);p.current.set(C,R)},[y]),b=m.useCallback(C=>{const T=C.id??`toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,R={id:T,message:C.message,severity:C.severity??"info",durationMs:C.durationMs??s,action:C.action};return c(L=>[...L,R]),R.severity==="error"?g(R.message):d(R.message),v(T,R.durationMs),T},[s,v]),k=m.useCallback(()=>{for(const C of p.current.values())clearTimeout(C);p.current.clear(),c([])},[]);m.useEffect(()=>{function C(T){T.key==="Escape"&&c(R=>{if(R.length===0)return R;const L=R.slice(0,r),B=L[L.length-1],z=p.current.get(B.id);return z&&(clearTimeout(z),p.current.delete(B.id)),R.filter(F=>F.id!==B.id)})}return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[r]),m.useEffect(()=>()=>{for(const C of p.current.values())clearTimeout(C);p.current.clear()},[]);const S=o.slice(0,r),w=m.useMemo(()=>({toast:b,dismiss:y,clear:k}),[b,y,k]);return a.jsxs(_y.Provider,{value:w,children:[t,a.jsx(FE,{toasts:S,onDismiss:y,liveMessage:u,liveAssertiveMessage:h})]})}function WE(t){const{toast:r}=qo(),s=m.useRef(t);s.current=t;const o=m.useCallback(async(...c)=>{const u=s.current,d=u.snapshot();u.apply(...c),u.confirmGraceMs;const h=u.timeoutMs??5e3;let g=!1,p,y=!1;const v=u.commit(...c).then(()=>{g=!0,y=!0},S=>{g=!0,p=S??new Error("Commit failed")}),b=new Promise(S=>{setTimeout(S,h)});if(await Promise.race([v,b]),!g)p=new Error("TIMEOUT");else if(y)return;u.rollback(d);const k=typeof u.failureMessage=="function"?u.failureMessage(p):u.failureMessage??"Couldn't complete that action.";r({message:k,severity:"error",durationMs:0,action:{label:"Retry",onInvoke:()=>{o(...c)}}})},[r]);return{run:o}}const Kg=6e4;function qE({skill:t}){const{refreshUpdates:r,dismissPushUpdate:s}=Zn(),{toast:o}=qo(),[c,u]=m.useState("idle"),[d,h]=m.useState(null),[g,p]=m.useState(!1),[y,v]=m.useState(null),[b,k]=m.useState(!1),S=m.useRef(null),w=m.useRef(null),C=m.useCallback(()=>new Promise((z,F)=>{if(!t){F(new Error("No skill selected"));return}const E=Ee.startSkillUpdate(t.plugin,t.skill);S.current=E;const I=()=>{w.current&&(clearTimeout(w.current),w.current=null);try{E.close()}catch{}S.current=null};w.current=setTimeout(()=>{I(),F(new Error("TIMEOUT"))},Kg),E.addEventListener("progress",N=>{try{const _=JSON.parse(N.data);typeof(_==null?void 0:_.status)=="string"&&h(_.status)}catch{}}),E.addEventListener("done",()=>{I(),u("done"),h(null),r(),s(`${t.plugin}/${t.skill}`),o({message:`Updated ${t.skill}.`,severity:"success",durationMs:4e3}),z()}),E.addEventListener("error",N=>{I();let _="Stream error";try{const V=typeof N.data=="string"?JSON.parse(N.data):null;V!=null&&V.error&&(_=String(V.error))}catch{}F(new Error(_))})}),[t,r,s,o]),T=WE({snapshot:()=>({status:c}),apply:()=>{u("updating"),h("updating")},commit:()=>C(),rollback:z=>{u(z.status==="updating"?"idle":z.status),h(null)},failureMessage:z=>`Couldn't update ${(t==null?void 0:t.skill)??"skill"} — ${z.message}`,timeoutMs:Kg+1e3});if(m.useEffect(()=>{if(!g||y!=null||!t||!t.latestVersion)return;let z=!1;return k(!0),Ee.getVersionDiff(t.plugin,t.skill,t.currentVersion??"",t.latestVersion).then(F=>{z||v(F)}).catch(()=>{z||v(null)}).finally(()=>{z||k(!1)}),()=>{z=!0}},[g,y,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]),m.useEffect(()=>()=>{if(w.current&&clearTimeout(w.current),S.current)try{S.current.close()}catch{}},[]),!t||t.updateAvailable!==!0)return null;const R=t.latestVersion,L=c==="updating"?"Updating…":R?`Update to ${R}`:"Update",B=c==="updating";return a.jsxs("div",{"data-testid":"update-action",style:{display:"flex",flexDirection:"column",gap:6,padding:"12px 16px",borderTop:"1px solid var(--border-default)",borderBottom:"1px solid var(--border-default)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("button",{type:"button","data-testid":"update-action-button",onClick:()=>{T.run()},disabled:B,style:{height:36,padding:"0 14px",background:"var(--color-ink)",color:"var(--color-paper)",border:"none",borderRadius:4,cursor:B?"not-allowed":"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500},children:L}),a.jsx("button",{type:"button","data-testid":"update-action-toggle-changelog",onClick:()=>p(z=>!z),disabled:B||!R,style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:12,fontFamily:"var(--font-sans)",cursor:"pointer",textDecoration:"underline"},children:g?"Hide changelog":"Preview changelog"})]}),d&&a.jsx("div",{"data-testid":"update-action-progress",role:"status",style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-muted, var(--text-secondary))"},children:d}),g&&R&&a.jsxs("div",{"data-testid":"update-action-changelog",style:{paddingTop:8},children:[b&&a.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Loading changelog…"}),!b&&y&&a.jsx(Af,{contentDiff:y.contentDiff,fromLabel:y.from,toLabel:y.to,diffSummary:y.diffSummary??void 0,renderContext:"inline"}),!b&&!y&&a.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Couldn't load changelog."})]})]})}const YE=3e4;function KE({plugin:t,skill:r,trackedForUpdates:s=!0,discoveryBackedOff:o=!1}){const c=Zn(),[u,d]=m.useState(!1),[h,g]=m.useState(!1),[,p]=m.useState(0),y=m.useRef(null),v=m.useRef(null),b=`${t}/${r}`,k=c.updatesById.get(b);if(m.useEffect(()=>{if(!u)return;const w=setInterval(()=>p(C=>(C+1)%1e6),250);return()=>clearInterval(w)},[u]),m.useEffect(()=>{if(!u||!k)return;const w=v.current??0;k.receivedAt<w||(y.current&&(clearTimeout(y.current),y.current=null),d(!1),g(!1),v.current=null)},[u,k]),m.useEffect(()=>()=>{y.current&&clearTimeout(y.current)},[]),s===!1||o)return null;const S=async()=>{if(!u){g(!1),d(!0),v.current=Date.now(),y.current=setTimeout(()=>{d(!1),g(!0),y.current=null,v.current=null},YE);try{await Ee.rescanSkill(t,r)}catch{y.current&&(clearTimeout(y.current),y.current=null),d(!1),v.current=null}}};return a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[a.jsx("button",{type:"button","data-testid":"check-now-button",onClick:S,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&&a.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&&a.jsx("span",{"data-testid":"check-now-no-changes",style:{fontSize:11,color:"var(--text-secondary)",fontFamily:"var(--font-sans)"},children:"No changes detected"})]})}const Oy=["overview","editor","tests","run","activation","history","leaderboard","deps","versions"],XE={overview:"Overview",editor:"Editor",tests:"Tests",run:"Run",activation:"Activation",history:"History",leaderboard:"Leaderboard",deps:"Deps",versions:"Versions"};function QE(t){return typeof t=="string"&&Oy.includes(t)}function ZE(){if(typeof window>"u")return"overview";const r=new URLSearchParams(window.location.search).get("panel");return QE(r)?r:"overview"}function Bd(){const{state:t,setMobileView:r}=Zn();return t.isMobile?a.jsxs("button",{onClick:()=>r("list"),className:"flex items-center gap-1.5 px-3 py-2 text-[12px] font-medium",style:{background:"var(--surface-1)",color:"var(--text-secondary)",border:"none",borderBottom:"1px solid var(--border-subtle)",cursor:"pointer",width:"100%"},children:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back to skills"]}):null}function JE(t={}){if(t.selectedSkillInfo!==void 0||t.loadError!==void 0)return eN(t);const{state:r,selectSkill:s,setMode:o,refreshSkills:c}=Zn(),[u,d]=m.useState(typeof window<"u"?window.location.hash:"");if(m.useEffect(()=>{const p=()=>d(window.location.hash);return window.addEventListener("hashchange",p),()=>window.removeEventListener("hashchange",p)},[]),u==="#/updates")return a.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[a.jsx(Bd,{}),a.jsx(wE,{})]});if(r.mode==="create")return a.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[a.jsx(Bd,{}),a.jsx(bE,{onCreated:(p,y)=>{o("browse"),c(),s({plugin:p,skill:y,origin:"source"})},onCancel:()=>o("browse")})]});if(!r.selectedSkill)return r.skillsError?a.jsx(No,{variant:"error",message:r.skillsError,onRetry:c}):!r.skillsLoading&&r.skills.length===0?a.jsx(No,{variant:"no-skills"}):a.jsx(No,{variant:"no-selection"});const h=r.selectedSkill,g=r.skills.find(p=>p.plugin===h.plugin&&p.skill===h.skill)??null;return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsx(Bd,{}),a.jsx(tN,{skillInfo:g,allSkills:r.skills,onSelectSkill:p=>s(p)})]})}function eN(t){const r=t.selectedSkillInfo??null,s=t.activeDetailTab??"overview";if(r==null)return aN();if(t.loadError)return rN(r,t.loadError);const o=t.allSkills&&t.onSelectSkill?{allSkills:t.allSkills,onSelectSkill:t.onSelectSkill}:void 0;return By(r,s,t.onDetailTabChange,o)}function tN({skillInfo:t,allSkills:r,onSelectSkill:s}){const[o,c]=m.useState(ZE());m.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=m.useMemo(()=>t?By(t,o,c,{}):a.jsx(No,{variant:"no-selection"}),[t,o,r,s]);return a.jsx("div",{className:"flex flex-col h-full",style:{background:"var(--bg-canvas)"},children:u})}function nN(t,r){return a.jsx("div",{role:"tablist","aria-label":"Detail sections","data-testid":"detail-tab-bar",style:{display:"flex",alignItems:"stretch",gap:4,borderBottom:"1px solid var(--border-default)",padding:"0 16px",background:"var(--bg-canvas)",overflowX:"auto"},children:Oy.map(s=>{const o=s===t;return a.jsx("button",{type:"button",role:"tab","aria-selected":o,tabIndex:o?0:-1,id:`detail-tab-${s}`,"aria-controls":`detail-panel-${s}`,"data-testid":`detail-tab-${s}`,onClick:()=>r==null?void 0:r(s),style:{background:"transparent",border:"none",borderBottom:o?"2px solid var(--text-primary)":"2px solid transparent",padding:"10px 8px",marginBottom:-1,fontFamily:"var(--font-sans)",fontSize:13,fontWeight:o?500:400,color:o?"var(--text-primary)":"var(--text-secondary)",cursor:"pointer",whiteSpace:"nowrap"},children:XE[s]},s)})})}function aN(){return a.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:32,background:"var(--bg-canvas)"},children:[a.jsx("h2",{style:{fontFamily:"var(--font-serif)",fontSize:20,fontWeight:500,color:"var(--text-primary)",margin:0,marginBottom:8},children:"Select a skill to view details"}),a.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-secondary)",margin:0,maxWidth:420,textAlign:"center"},children:"Choose a skill from the sidebar — its frontmatter, filesystem info, and benchmark status will appear here."})]})}function rN(t,r){return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:24,background:"var(--bg-canvas)",height:"100%"},children:[Dy({skill:t}),a.jsxs("section",{role:"alert",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px"},children:[a.jsxs("h3",{style:{fontFamily:"var(--font-serif)",fontSize:15,fontWeight:500,color:"var(--text-primary)",margin:"0 0 8px"},children:["Couldn't load SKILL.md for ",t.skill]}),a.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:"0 0 12px",wordBreak:"break-word"},children:r})]})]})}function lN({active:t}){return t==="editor"?a.jsx(dC,{}):t==="tests"?a.jsx(vC,{}):t==="run"?a.jsx(LC,{}):t==="activation"?a.jsx(OC,{}):t==="history"?a.jsx(ZC,{}):t==="leaderboard"?a.jsx(uE,{}):t==="deps"?a.jsx(fE,{}):t==="versions"?a.jsx(Uw,{}):null}function sN({active:t}){const{state:r,dispatch:s}=Tn();return m.useEffect(()=>{t!=="overview"&&r.activePanel!==t&&s({type:"SET_PANEL",panel:t})},[t,r.activePanel,s]),null}function By(t,r,s,o){const c=h=>{s==null||s(h)},u=a.jsx($E,{skill:t,onNavigate:c,repoUrl:t.homepage??null}),d=o!=null?a.jsxs(_w,{plugin:t.plugin,skill:t.skill,origin:t.origin,children:[a.jsx(sN,{active:r}),a.jsx(lN,{active:r})]},`${t.plugin}/${t.skill}`):a.jsxs("div",{style:{padding:16,fontFamily:"var(--font-sans)",color:"var(--text-secondary)",fontSize:13},children:["Select a skill from the sidebar to load its ",r," view."]});return a.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--bg-canvas)"},children:[a.jsx("div",{style:{padding:16,paddingBottom:12},children:Dy({skill:t})}),a.jsx(qE,{skill:t}),t.origin==="installed"&&a.jsx("div",{style:{padding:"8px 16px",borderBottom:"1px solid var(--border-default)"},children:a.jsx(KE,{plugin:t.plugin,skill:t.skill,trackedForUpdates:t.trackedForUpdates})}),nN(r,s),a.jsx("div",{role:"tabpanel",id:`detail-panel-${r}`,"aria-labelledby":`detail-tab-${r}`,"data-testid":`detail-panel-${r}`,style:{flex:1,minHeight:0,overflow:"auto"},children:r==="overview"?u:d})]})}function iN(){const{updateCount:t,state:r,dismissUpdateNotification:s}=Zn(),o=t>0&&!r.updateNotificationDismissed;return m.useEffect(()=>{if(!o)return;const c=setTimeout(()=>s(),1e4);return()=>clearTimeout(c)},[o,s]),o?a.jsxs("div",{className:"fixed bottom-4 right-4 z-50 flex items-center gap-3 px-4 py-3 rounded-lg text-[13px] font-medium animate-fade-in",style:{background:"var(--yellow-muted)",border:"1px solid var(--yellow)",color:"var(--text-primary)"},children:[a.jsxs("span",{children:[t," update",t===1?"":"s"," available"]}),a.jsx("button",{onClick:()=>{window.location.hash="#/updates"},className:"px-2 py-0.5 rounded text-[12px] font-semibold",style:{background:"var(--yellow)",color:"var(--surface-0)",border:"none",cursor:"pointer"},children:"View Updates"}),a.jsx("button",{onClick:s,className:"text-[14px] leading-none",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",padding:"0 2px"},"aria-label":"Dismiss",children:"✕"})]}):null}const oN=[{name:te.shortcuts.groupNavigation,items:[{keys:"/",label:te.shortcuts.search},{keys:"j",label:te.shortcuts.moveDown},{keys:"k",label:te.shortcuts.moveUp},{keys:"Enter",label:te.shortcuts.openSelected},{keys:"Esc",label:"Close / clear"}]},{name:te.shortcuts.groupActions,items:[{keys:"⌘K",label:te.shortcuts.openPalette},{keys:"?",label:te.shortcuts.openShortcuts},{keys:"⌘B",label:te.shortcuts.toggleSidebar},{keys:"E",label:te.actions.edit}]},{name:te.shortcuts.groupTheme,items:[{keys:"⌘⇧D",label:te.shortcuts.toggleTheme}]}];function cN({open:t,onClose:r,groups:s=oN,title:o=te.shortcuts.title}){const c=m.useRef(null),u=m.useRef(null);return m.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]),m.useEffect(()=>{if(!t)return;function d(h){var g;if(h.key==="Escape"){h.preventDefault(),r();return}h.key==="Tab"&&(h.preventDefault(),(g=u.current)==null||g.focus())}return window.addEventListener("keydown",d,!0),()=>window.removeEventListener("keydown",d,!0)},[t,r]),t?a.jsx("div",{role:"presentation","data-testid":"shortcut-modal",style:{position:"fixed",inset:0,background:"color-mix(in srgb, var(--bg-canvas) 70%, transparent)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:60},onClick:d=>{d.target===d.currentTarget&&r()},children:a.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"shortcut-modal-title",style:{width:"min(480px, 92vw)",maxHeight:"80vh",overflow:"auto",background:"var(--bg-canvas)",border:"1px solid var(--border-default)",borderRadius:8,boxShadow:"0 16px 48px rgba(0,0,0,0.18)",padding:"16px 20px",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[a.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[a.jsx("h2",{id:"shortcut-modal-title",style:{margin:0,fontFamily:"var(--font-serif)",fontWeight:500,fontSize:18},children:o}),a.jsx("button",{ref:u,type:"button","aria-label":"Close",onClick:r,style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"2px 8px",color:"var(--text-secondary)",cursor:"pointer",fontSize:13},children:"Esc"})]}),s.map(d=>a.jsxs("section",{style:{marginBottom:12},children:[a.jsx("h3",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--text-secondary)",margin:"0 0 6px"},children:d.name}),a.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:d.items.map(h=>a.jsxs("li",{style:{display:"flex",justifyContent:"space-between",padding:"4px 0",borderTop:"1px solid var(--border-default)",fontSize:13},children:[a.jsx("span",{children:h.label}),a.jsx("kbd",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-secondary)",border:"1px solid var(--border-default)",borderRadius:3,padding:"1px 6px"},children:h.keys})]},`${d.name}:${h.keys}`))})]},d.name))]})}):null}function uN(t){const r=te.actions,s=[{action:"open",label:r.open},{action:"copy-path",label:r.copyPath},{action:"reveal",label:r.revealInEditor},{action:"run-benchmark",label:r.runBenchmark}];if(t.origin==="source")return[...s,{action:"edit",label:r.edit},{action:"duplicate",label:r.duplicate},{action:"delete",label:r.delete}];const o=[...s];return t.updateAvailable&&o.push({action:"update",label:r.update}),o.push({action:"uninstall",label:r.uninstall}),o.push({action:"delete",label:r.delete,disabled:!0,title:r.deletePluginTooltip}),o}function dN({state:t,onClose:r,onAction:s,itemsOverride:o}){const c=m.useRef(null),u=m.useRef(null),[d,h]=m.useState(0),g=m.useMemo(()=>t.skill?o??uN(t.skill):[],[t.skill,o]),p=m.useMemo(()=>{if(typeof window>"u")return{left:t.x,top:t.y};const v=8,b=220,k=44+g.length*28;let S=t.x,w=t.y;return S+b+v>window.innerWidth&&(S=Math.max(v,t.x-b)),w+k+v>window.innerHeight&&(w=Math.max(v,t.y-k)),{left:S,top:w}},[t.x,t.y,g.length]);m.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=m.useCallback(()=>{if(!t.skill)return;const v=g[d];!v||v.disabled||(s(v.action,t.skill),r())},[g,d,t.skill,s,r]);return m.useEffect(()=>{if(!t.open)return;function v(k){if(k.key==="Escape"){k.preventDefault(),r();return}if(k.key==="ArrowDown"){k.preventDefault(),h(S=>Math.min(S+1,Math.max(g.length-1,0)));return}if(k.key==="ArrowUp"){k.preventDefault(),h(S=>Math.max(S-1,0));return}if(k.key==="Enter"||k.key===" "){k.preventDefault(),y();return}}function b(k){c.current&&k.target instanceof Node&&(c.current.contains(k.target)||r())}return window.addEventListener("keydown",v,!0),window.addEventListener("mousedown",b,!0),()=>{window.removeEventListener("keydown",v,!0),window.removeEventListener("mousedown",b,!0)}},[t.open,r,g.length,y]),!t.open||!t.skill?null:a.jsx("div",{ref:c,role:"menu",tabIndex:-1,"data-testid":"context-menu",style:{position:"fixed",left:p.left,top:p.top,zIndex:70,minWidth:200,padding:4,background:"var(--bg-canvas)",border:"1px solid var(--border-default)",borderRadius:6,boxShadow:"0 12px 32px rgba(0,0,0,0.16)",fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)",outline:"none"},children:g.map((v,b)=>a.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),r())},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 fN({open:t,title:r,body:s,confirmLabel:o="Confirm",cancelLabel:c="Cancel",variant:u="default",onConfirm:d,onCancel:h}){const g=m.useRef(null),p=m.useRef(null),y=m.useRef(null);if(m.useEffect(()=>{if(t)return y.current=document.activeElement??null,requestAnimationFrame(()=>{var S;(S=p.current)==null||S.focus()}),()=>{var S,w;(w=(S=y.current)==null?void 0:S.focus)==null||w.call(S),y.current=null}},[t]),m.useEffect(()=>{if(!t)return;function S(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],R=C[C.length-1];w.shiftKey&&document.activeElement===T?(w.preventDefault(),R.focus()):!w.shiftKey&&document.activeElement===R&&(w.preventDefault(),T.focus())}}return window.addEventListener("keydown",S,!0),()=>window.removeEventListener("keydown",S,!0)},[t,h]),!t)return null;const v="confirm-dialog-title",b="confirm-dialog-body",k=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 a.jsx("div",{"data-testid":"confirm-dialog-overlay",onMouseDown:S=>{S.target===S.currentTarget&&h()},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},children:a.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:[a.jsx("h2",{id:v,style:{margin:0,fontSize:16,fontWeight:600,marginBottom:8},children:r}),a.jsx("p",{id:b,style:{margin:0,fontSize:13,color:"var(--text-secondary)",marginBottom:16,lineHeight:1.5},children:s}),a.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:[a.jsx("button",{ref:p,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}),a.jsx("button",{type:"button","data-testid":"confirm-dialog-confirm",onClick:d,style:{padding:"6px 14px",borderRadius:6,cursor:"pointer",fontSize:13,...k},children:o})]})]})})}function pN(t){const r=(typeof navigator<"u"?navigator.platform:"").toLowerCase();return r.includes("mac")?"system Trash":r.includes("win")?"Recycle Bin":"Trash"}const Xg=t=>`${t.plugin}/${t.skill}`;function mN(t){const r=t==null?void 0:t.delayMs,s=t==null?void 0:t.onCommit,o=t==null?void 0:t.onFailure,c=m.useRef(s),u=m.useRef(o);c.current=s,u.current=o;const d=m.useRef(new Map),[,h]=m.useState(0),g=m.useCallback(()=>h(S=>S+1),[]),p=m.useCallback(async S=>{var w,C;try{await Ee.deleteSkill(S.skill.plugin,S.skill.skill),(w=c.current)==null||w.call(c,S.skill)}catch(T){(C=u.current)==null||C.call(u,S.skill,T)}finally{d.current.delete(Xg(S.skill)),g()}},[g]),y=m.useCallback(S=>{const w=Xg(S),C=d.current.get(w);C!=null&&C.timeoutId&&clearTimeout(C.timeoutId);const T={skill:S,timeoutId:null};T.timeoutId=setTimeout(()=>{T.timeoutId=null,p(T)},r),d.current.set(w,T),g()},[r,p,g]),v=m.useCallback(S=>{const w=d.current.get(S);w&&(w.timeoutId&&clearTimeout(w.timeoutId),d.current.delete(S),g())},[g]),b=m.useCallback(async()=>{const S=Array.from(d.current.values());for(const w of S)w.timeoutId&&(clearTimeout(w.timeoutId),w.timeoutId=null);await Promise.all(S.map(w=>p(w)))},[p]),k=m.useCallback(S=>d.current.has(S),[]);return m.useEffect(()=>{const S=()=>{b()};return window.addEventListener("beforeunload",S),()=>{window.removeEventListener("beforeunload",S)}},[b]),m.useEffect(()=>{const S=d.current;return()=>{for(const w of S.values())w.timeoutId&&clearTimeout(w.timeoutId);S.clear()}},[]),{enqueueDelete:y,cancelDelete:v,flushPending:b,isPending:k}}const hN={"anthropic-api":{name:te.setupProviders.anthropic.name,description:te.setupProviders.anthropic.description,envVars:te.setupProviders.anthropic.envVars,keyUrl:te.setupProviders.anthropic.keyUrl,learnMoreUrl:te.setupProviders.anthropic.learnMoreUrl},openai:{name:te.setupProviders.openai.name,description:te.setupProviders.openai.description,envVars:te.setupProviders.openai.envVars,keyUrl:te.setupProviders.openai.keyUrl,learnMoreUrl:te.setupProviders.openai.learnMoreUrl},openrouter:{name:te.setupProviders.openrouter.name,description:te.setupProviders.openrouter.description,envVars:te.setupProviders.openrouter.envVars,keyUrl:te.setupProviders.openrouter.keyUrl,learnMoreUrl:te.setupProviders.openrouter.learnMoreUrl},gemini:{name:te.setupProviders.gemini.name,description:te.setupProviders.gemini.description,envVars:te.setupProviders.gemini.envVars,keyUrl:te.setupProviders.gemini.keyUrl,learnMoreUrl:te.setupProviders.gemini.learnMoreUrl},ollama:{name:te.setupProviders.ollama.name,description:te.setupProviders.ollama.description,envVars:te.setupProviders.ollama.envVars,install:[te.setupProviders.ollama.installCmd],start:[te.setupProviders.ollama.startCmd],pullExample:te.setupProviders.ollama.pullExample,learnMoreUrl:te.setupProviders.ollama.learnMoreUrl},"lm-studio":{name:te.setupProviders.lmStudio.name,description:te.setupProviders.lmStudio.description,envVars:te.setupProviders.lmStudio.envVars,install:[te.setupProviders.lmStudio.installCmd],start:[te.setupProviders.lmStudio.startCmd],pullExample:te.setupProviders.lmStudio.pullExample,learnMoreUrl:te.setupProviders.lmStudio.learnMoreUrl},"claude-code":{name:te.setupProviders.claudeCode.name,description:te.setupProviders.claudeCode.description,envVars:[],notes:[te.setupProviders.claudeCode.loginHint,te.claudeCodeLabel.compactLabel],learnMoreUrl:te.setupProviders.claudeCode.learnMoreUrl}};function xN(t){return t?hN[t]??null:null}function gN({open:t,providerKey:r,onClose:s}){const o=m.useRef(null);if(m.useEffect(()=>{if(!t)return;const d=h=>{h.key==="Escape"&&(h.preventDefault(),s())};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,s]),m.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(r),u=(c==null?void 0:c.name)??te.setupDrawer.fallbackTitle;return Bo.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("div",{"data-testid":"setup-drawer-backdrop","aria-hidden":"true",onClick:s,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:99,animation:"vskillDrawerBackdropIn 120ms ease"}}),a.jsxs("div",{"data-testid":"setup-drawer",ref:o,role:"dialog","aria-modal":"true","aria-label":te.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:[a.jsx(vN,{title:u,onClose:s}),a.jsx("div",{"data-testid":"setup-drawer-body",style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:c?a.jsx(yN,{content:c}):a.jsx(bN,{})}),a.jsx("style",{children:`@keyframes vskillDrawerIn {
|
|
92
|
-
from { transform: translateX(100%); }
|
|
93
|
-
to { transform: translateX(0); }
|
|
94
|
-
}
|
|
95
|
-
@keyframes vskillDrawerBackdropIn {
|
|
96
|
-
from { opacity: 0; }
|
|
97
|
-
to { opacity: 1; }
|
|
98
|
-
}`})]})]}),document.body)}function vN({title:t,onClose:r}){return a.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 20px",borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:[a.jsx("h2",{style:{fontFamily:"var(--font-serif)",fontSize:18,fontWeight:500,margin:0,color:"var(--text-primary)"},children:te.setupDrawer.title(t)}),a.jsx("button",{type:"button","data-testid":"setup-drawer-close",onClick:r,"aria-label":te.setupDrawer.close,style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:18,padding:4,lineHeight:1},children:"×"})]})}function yN({content:t}){var r,s;return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[a.jsx("p",{style:{fontSize:14,lineHeight:1.5,color:"var(--text-primary)",margin:0},children:t.description}),t.notes&&t.notes.length>0&&a.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:6},children:t.notes.map(o=>a.jsx("li",{style:{fontSize:13,color:"var(--text-secondary)",padding:"8px 10px",background:"color-mix(in srgb, var(--accent-surface) 8%, transparent)",borderRadius:4},children:o},o))}),t.envVars.length>0&&a.jsxs("section",{children:[a.jsx("h3",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",margin:"0 0 8px"},children:te.setupDrawer.requiredEnv}),a.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:6},children:t.envVars.map(o=>a.jsx("li",{children:a.jsx(jN,{name:o})},o))})]}),t.keyUrl&&a.jsx(SN,{href:t.keyUrl,label:te.setupDrawer.getKey,testId:"setup-drawer-get-key"}),(t.install||t.start||t.pullExample)&&a.jsxs("section",{children:[a.jsx("h3",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",margin:"0 0 8px"},children:te.setupDrawer.installRun}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(r=t.install)==null?void 0:r.map((o,c)=>a.jsx(Id,{code:o},`install-${c}`)),(s=t.start)==null?void 0:s.map((o,c)=>a.jsx(Id,{code:o},`start-${c}`)),t.pullExample&&a.jsx(Id,{code:t.pullExample})]})]}),a.jsx("footer",{style:{marginTop:8},children:a.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:[te.setupDrawer.learnMore," →"]})})]})}function bN(){return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[a.jsx("h3",{style:{margin:0,fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:te.setupDrawer.fallbackTitle}),a.jsx("p",{style:{margin:0,fontSize:13,color:"var(--text-secondary)",lineHeight:1.5},children:te.setupDrawer.fallbackBody})]})}function jN({name:t}){const r=async()=>{var s;try{await((s=navigator.clipboard)==null?void 0:s.writeText(t))}catch{}};return a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",background:"color-mix(in srgb, var(--border-default) 30%, transparent)",borderRadius:4},children:[a.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",flex:1},children:t}),a.jsx("button",{type:"button",onClick:r,"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:te.setupDrawer.copy})]})}function Id({code:t}){return a.jsx("pre",{style:{margin:0,padding:"8px 10px",background:"var(--bg-canvas, #111)",color:"var(--text-primary)",fontFamily:"var(--font-mono)",fontSize:11.5,lineHeight:1.5,borderRadius:4,border:"1px solid var(--border-default, var(--border-subtle))",overflowX:"auto",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:t})}function SN({href:t,label:r,testId:s}){return a.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:[r," →"]})}function kN(){const[t,r]=m.useState(!1),[s,o]=m.useState(null),c=m.useRef(null),u=m.useCallback((h,g)=>{var p;c.current=typeof document<"u"?document.activeElement:null,(p=g==null?void 0:g.beforeOpen)==null||p.call(g),o(h),r(!0)},[]),d=m.useCallback(()=>{r(!1);const h=c.current;h&&"focus"in h&&typeof h.focus=="function"&&queueMicrotask(()=>h.focus())},[]);return m.useMemo(()=>({open:u,close:d,isOpen:t,providerKey:s}),[u,d,t,s])}function wN(t){const r=[],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));r.push({kind:"aggregate",key:`shared:${u}`,consumers:d,sharedFolderPath:c.sharedFolderPath??"~/.config/agents/skills",combinedCount:d.reduce((h,g)=>h+g.globalCount,0)});continue}r.push({kind:"individual",key:c.id,agent:c})}return{detected:r,notDetected:s}}function CN({agents:t,activeAgentId:r,focusedAgentId:s,onFocusAgent:o,onSwitch:c,onOpenSetup:u,onClose:d}){const h=m.useRef(null);m.useEffect(()=>{const y=v=>{v.key==="Escape"&&(v.preventDefault(),d())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[d]),m.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=m.useMemo(()=>wN(t),[t]),p=t.find(y=>y.id===s)??t.find(y=>y.id===r)??t[0];return typeof document>"u"?null:Bo.createPortal(a.jsxs("div",{ref:h,"data-testid":"agent-scope-picker-popover",role:"dialog","aria-label":te.scopePicker.popoverTitle,style:{position:"fixed",top:96,left:"50%",transform:"translateX(-50%)",width:600,maxWidth:"calc(100vw - 32px)",background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,boxShadow:"0 18px 40px rgba(0,0,0,0.25)",overflow:"hidden",zIndex:90,animation:"scopePickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[a.jsxs("div",{style:{display:"flex",height:360,maxHeight:"60vh"},children:[a.jsxs("section",{"data-testid":"agent-scope-picker-agents",style:{width:260,borderRight:"1px solid var(--border-default, var(--border-subtle))",overflowY:"auto",padding:"6px 0"},children:[g.detected.length===0&&g.notDetected.length===0&&a.jsx(Qg,{}),g.detected.map(y=>y.kind==="aggregate"?a.jsx(NN,{row:y,onFocus:()=>{var v;return o(((v=y.consumers[0])==null?void 0:v.id)??r??"")}},y.key):a.jsx(EN,{agent:y.agent,focused:y.agent.id===s,active:y.agent.id===r,onClick:()=>o(y.agent.id)},y.key)),g.notDetected.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{"data-testid":"agent-scope-not-detected-subheading",title:"These agents were not found on this machine. Hover a row to see which folder detection looked for.",style:{padding:"10px 14px 4px",fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-tertiary)"},children:te.scopePicker.notDetectedSubheading}),g.notDetected.map(y=>a.jsx(TN,{agent:y.agent},y.key))]})]}),a.jsx("section",{"data-testid":"agent-scope-picker-stats",style:{flex:1,overflowY:"auto",padding:"14px 16px"},children:p?a.jsx(RN,{agent:p,activeAgentId:r,onSwitch:()=>c(p.id)}):a.jsx(Qg,{})})]}),a.jsx("style",{children:`@keyframes scopePickerFadeIn {
|
|
99
|
-
from { opacity: 0; transform: translateX(-50%) translateY(2px); }
|
|
100
|
-
to { opacity: 1; transform: translateX(-50%) translateY(0); }
|
|
101
|
-
}`})]}),document.body)}function EN({agent:t,focused:r,active:s,onClick:o}){const c=t.health==="ok"?"var(--color-ok, #22c55e)":t.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)";return a.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:r?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",border:"none",cursor:"pointer",textAlign:"left",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:c,flexShrink:0}}),a.jsx("span",{style:{flex:1,fontSize:13},children:t.displayName}),a.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[t.installedCount,"·",t.globalCount]})]})}function NN({row:t,onFocus:r}){return a.jsxs("button",{type:"button","data-testid":"agent-scope-shared-folder-row",onClick:r,style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4,width:"100%",padding:"8px 14px",background:"transparent",border:"none",borderTop:"1px dashed var(--border-subtle)",borderBottom:"1px dashed var(--border-subtle)",cursor:"pointer",textAlign:"left",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)"},children:t.sharedFolderPath}),a.jsxs("span",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[t.consumers.map(s=>a.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:10,background:"color-mix(in srgb, var(--color-global) 20%, transparent)",color:"var(--text-primary)"},children:s.id},s.id)),a.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontFamily:"var(--font-mono)"},children:["· ",t.combinedCount," skills"]})]})]})}function TN({agent:t}){const r=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 a.jsxs("div",{"data-testid":`agent-scope-not-detected-row-${t.id}`,title:r,style:{display:"flex",alignItems:"center",gap:10,padding:"6px 14px",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:12},children:[a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--text-tertiary)",flexShrink:0}}),a.jsx("span",{style:{flex:1},children:t.displayName}),t.isRemoteOnly&&a.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 RN({agent:t,activeAgentId:r,onSwitch:s}){const o=t.id===r,c=t.isRemoteOnly===!0,u=o||c,d=o?"Active":c?"Remote-only":te.scopePicker.switchCta;return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:t.displayName}),a.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:2},children:c?"Remote service — no local install":MN(t.health)})]}),a.jsxs("dl",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"4px 12px",margin:0,fontSize:12},children:[a.jsx(Hd,{label:te.scopePicker.statsInstalled,value:String(t.installedCount)}),a.jsx(Hd,{label:te.scopePicker.statsGlobal,value:String(t.globalCount)}),a.jsx(Hd,{label:te.scopePicker.statsLastSync,value:t.lastSync?AN(t.lastSync):"—"})]}),a.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 Hd({label:t,value:r}){return a.jsxs(a.Fragment,{children:[a.jsx("dt",{style:{color:"var(--text-secondary)",margin:0},children:t}),a.jsx("dd",{style:{color:"var(--text-primary)",margin:0,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums"},children:r})]})}function Qg(){return a.jsx("div",{style:{padding:"16px 18px",fontSize:12,color:"var(--text-secondary)"},children:"No agents detected yet."})}function AN(t){try{const r=new Date(t).getTime(),s=Date.now()-r;if(Number.isNaN(r))return"—";const o=Math.round(s/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const c=Math.round(o/60);return c<24?`${c}h ago`:`${Math.round(c/24)}d ago`}catch{return"—"}}function MN(t){switch(t){case"ok":return te.scopePicker.statsHealthOk;case"stale":return te.scopePicker.statsHealthStale;case"missing":return te.scopePicker.statsHealthMissing}}function LN(t){const r=new Map;for(const s of t.sharedFolders??[])for(const o of s.consumers)r.set(o,s);return t.agents.map(s=>{const o=r.get(s.id);return{id:s.id,displayName:s.displayName,presence:s.detected?"detected":"absent",installedCount:s.localSkillCount,globalCount:s.globalSkillCount,lastSync:s.lastSync,health:s.health,sharedFolderGroup:o?o.consumers:void 0,sharedFolderPath:o?o.path:void 0,isRemoteOnly:s.isRemoteOnly,resolvedGlobalDir:s.resolvedGlobalDir}})}function zN({agents:t,activeAgentId:r,onActiveAgentChange:s,onOpenSetup:o}){const[c,u]=m.useState(!1),[d,h]=m.useState(null),g=m.useRef(null),p=m.useMemo(()=>t.find(k=>k.id===r)??t[0]??null,[t,r]),y=m.useMemo(()=>p?p.health==="ok"?"var(--color-ok, #22c55e)":p.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)":"var(--text-tertiary)",[p]),v=m.useCallback(()=>{var k;u(!1),(k=g.current)==null||k.focus()},[]),b=m.useCallback(k=>{s(k),u(!1)},[s]);return a.jsxs(a.Fragment,{children:[a.jsxs("button",{ref:g,type:"button","data-testid":"agent-scope-picker-trigger","aria-haspopup":"dialog","aria-expanded":c,onClick:()=>u(k=>!k),onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.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:[a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:y,flexShrink:0}}),a.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(p==null?void 0:p.displayName)??"Select agent"}),a.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:["(",(p==null?void 0:p.installedCount)??0," · ",(p==null?void 0:p.globalCount)??0,")"]}),a.jsx("span",{"aria-hidden":"true",style:{fontSize:10,color:"var(--text-secondary)"},children:"▾"})]}),c&&a.jsx(CN,{agents:t,activeAgentId:r,focusedAgentId:d??r,onFocusAgent:h,onSwitch:b,onOpenSetup:k=>{o(k),v()},onClose:v})]})}const Iy="vskill-ccode-banner-dismissed",DN=new Set(["claude-cli","claude-code"]);function _N(){try{return sessionStorage.getItem(Iy)==="true"}catch{return!1}}function ON(){try{sessionStorage.setItem(Iy,"true")}catch{}}function BN({activeAgentId:t}){const[r,s]=m.useState(()=>_N()),o=m.useCallback(()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:open-setup-drawer",{detail:{provider:"claude-code"}}))},[]),c=m.useCallback(()=>{ON(),s(!0)},[]);return!t||!DN.has(t)||r?null:a.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:[a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--color-ok, #22c55e)",marginTop:6,flexShrink:0}}),a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsxs("span",{children:[te.claudeCodeLabel.firstUseBanner," "]}),a.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-learn-more",onClick:o,style:{background:"transparent",border:"none",padding:0,color:"var(--color-accent, var(--accent-surface))",cursor:"pointer",textDecoration:"underline",fontFamily:"inherit",fontSize:"inherit"},children:te.claudeCodeLabel.learnMore})]}),a.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-dismiss",onClick:c,"aria-label":"Dismiss Claude Code info banner",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1,padding:2,flexShrink:0},children:"×"})]})}function IN(){const[t,r]=m.useState(null),[s,o]=m.useState("loading"),[c,u]=m.useState(null),d=m.useCallback(async()=>{try{const h=await Ee.getAgents();r(h),o("ready"),u(null)}catch(h){o("error"),u(h.message)}},[]);return m.useEffect(()=>{d()},[d]),m.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 vo="workspace",HN=["skills","agents"];async function UN(){const t=await fetch("/api/workspace");if(!t.ok)throw new Error(`GET /api/workspace failed: ${t.status}`);return await t.json()}async function $N(t){const r=await fetch("/api/workspace/active",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:t})});if(!r.ok){const s=await r.json().catch(()=>({}));throw new Error(s.error??`POST /api/workspace/active failed: ${r.status}`)}return await r.json()}async function VN(t){const r=await fetch("/api/workspace/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok){const s=await r.json().catch(()=>({}));throw new Error(s.error??`POST /api/workspace/projects failed: ${r.status}`)}return await r.json()}async function PN(t){const r=await fetch(`/api/workspace/projects/${encodeURIComponent(t)}`,{method:"DELETE"});if(!r.ok){const s=await r.json().catch(()=>({}));throw new Error(s.error??`DELETE /api/workspace/projects/${t} failed: ${r.status}`)}return await r.json()}function Ud(){for(const t of HN)on(t)}function FN(){const{data:t,loading:r,error:s,revalidate:o}=Ml(vo,UN),c=t,u=c==null?void 0:c.projects.find(p=>p.id===c.activeProjectId),d=m.useCallback(async p=>{await $N(p),on(vo),Ud()},[]),h=m.useCallback(async p=>{await VN(p),on(vo),Ud()},[]),g=m.useCallback(async p=>{await PN(p),on(vo),Ud()},[]);return{workspace:c,activeProject:u,loading:r,error:s,switchProject:d,addProject:h,removeProject:g,revalidate:o}}function GN({workspace:t,onSwitch:r,onAdd:s,onRemove:o,isPathStale:c}){const[u,d]=m.useState(!1),[h,g]=m.useState(!1),[p,y]=m.useState(""),[v,b]=m.useState(null),[k,S]=m.useState(null),[w,C]=m.useState(null),[T,R]=m.useState(!1),L=m.useRef(null),B=(t==null?void 0:t.projects)??[],z=B.find(N=>N.id===(t==null?void 0:t.activeProjectId));m.useEffect(()=>{if(!u)return;function N(_){L.current&&!L.current.contains(_.target)&&(d(!1),g(!1),b(null))}return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[u]);async function F(){b(null);const N=p.trim();if(!N){b("Paste an absolute path (e.g. /Users/you/projects/my-skill)");return}if(!N.startsWith("/")&&!/^[A-Za-z]:[\\/]/.test(N)){b("Path must be absolute. In Terminal, cd to the folder and run: pwd — then paste the result here.");return}try{await s({path:N}),y(""),g(!1)}catch(_){const V=_ instanceof Error?_.message:String(_);/does not exist/i.test(V)?b(`Path not found on disk: ${N}`):/Duplicate/i.test(V)?b("That project is already registered."):b(V)}}async function E(){if(b(null),typeof window<"u"&&"showDirectoryPicker"in window)try{const N=await window.showDirectoryPicker();y(N.name),g(!0)}catch{}else g(!0)}function I(N){if(N.length<=50)return N;const _=N.split("/");return _.length<=4?N:`${_.slice(0,3).join("/")}/…/${_.slice(-2).join("/")}`}return a.jsxs("div",{ref:L,"data-vskill-project-picker":!0,style:{position:"relative",display:"inline-block"},children:[a.jsxs("button",{type:"button",onClick:()=>d(N=>!N),"aria-expanded":u,"aria-haspopup":"menu",title:(z==null?void 0:z.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:[a.jsx("span",{"aria-hidden":!0,style:{width:8,height:8,borderRadius:"50%",flexShrink:0,backgroundColor:(z==null?void 0:z.colorDot)??"var(--text-tertiary, #999)"}}),a.jsx("span",{style:{maxWidth:180,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:z?z.name:"No project"}),a.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-tertiary, #999)",marginLeft:2},children:u?"▴":"▾"})]}),u&&a.jsxs("div",{role:"menu","aria-label":"Switch project",style:{position:"absolute",top:"calc(100% + 4px)",left:0,minWidth:280,maxWidth:420,width:"max-content",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:8,boxShadow:"0 4px 6px -1px rgba(0,0,0,0.08), 0 10px 20px -5px rgba(0,0,0,0.12)",overflow:"hidden",zIndex:50,fontFamily:"var(--font-sans)"},children:[B.length===0&&a.jsx("div",{style:{padding:"16px 16px 12px",fontSize:12,color:"var(--text-tertiary)",lineHeight:1.5},children:"No projects registered. Add one to get started."}),B.length>0&&a.jsx("ul",{role:"none",style:{listStyle:"none",margin:0,padding:4,maxHeight:320,overflowY:"auto"},children:B.map(N=>{const _=c?c(N.path):!1,V=N.id===(t==null?void 0:t.activeProjectId),W=k===N.id;return a.jsxs("li",{role:"menuitem","data-stale":_?"true":"false",onMouseEnter:()=>S(N.id),onMouseLeave:()=>S(Y=>Y===N.id?null:Y),onClick:()=>{if(!_){if(V){d(!1);return}C(N)}},style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:6,cursor:_?"not-allowed":"pointer",background:W&&!_?"var(--surface-2, rgba(0,0,0,0.04))":V?"var(--surface-1, rgba(0,0,0,0.02))":"transparent",opacity:_?.5:1,transition:"background-color 120ms ease"},children:[a.jsx("span",{"aria-hidden":!0,style:{width:10,height:10,borderRadius:"50%",flexShrink:0,backgroundColor:N.colorDot,boxShadow:V?"0 0 0 2px color-mix(in oklch, currentColor 20%, transparent)":"none"}}),a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13,fontWeight:V?600:500,color:"var(--text-primary)",lineHeight:1.3},children:[a.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:N.name}),V&&a.jsx("span",{"aria-label":"Active",style:{fontSize:10,color:"var(--color-action, #2F5B8E)",letterSpacing:"0.05em",textTransform:"uppercase",fontWeight:600},children:"Active"})]}),a.jsx("div",{title:N.path,style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-tertiary)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:I(N.path)}),_&&a.jsx("div",{style:{fontSize:10,color:"var(--color-own, #b45309)",marginTop:2},children:"Path no longer exists"})]}),a.jsx("button",{type:"button","aria-label":`Remove ${N.name}`,onClick:Y=>{Y.stopPropagation(),o(N.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:W?1:0,transition:"opacity 120ms ease, color 120ms ease, background-color 120ms ease",flexShrink:0},onMouseEnter:Y=>{Y.currentTarget.style.color="var(--color-error, #b91c1c)",Y.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-error, #b91c1c) 10%, transparent)"},onMouseLeave:Y=>{Y.currentTarget.style.color="var(--text-tertiary)",Y.currentTarget.style.backgroundColor="transparent"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[a.jsx("polyline",{points:"3 6 5 6 21 6"}),a.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),a.jsx("path",{d:"M10 11v6"}),a.jsx("path",{d:"M14 11v6"}),a.jsx("path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]})})]},N.id)})}),a.jsxs("div",{style:{borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",padding:h?8:6},children:[!h&&a.jsxs("button",{type:"button",onClick:()=>void 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:N=>{N.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-action, #2F5B8E) 10%, transparent)"},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent"},children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add project"]}),h&&a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx("input",{type:"text",value:p,onChange:N=>y(N.target.value),onKeyDown:N=>{N.key==="Enter"&&F(),N.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"}}),a.jsxs("div",{style:{display:"flex",gap:6,justifyContent:"flex-end"},children:[a.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"}),a.jsx("button",{type:"button",onClick:()=>void F(),style:{padding:"4px 10px",fontSize:12,border:"none",borderRadius:4,background:"var(--color-action, #2F5B8E)",color:"var(--color-paper, #fff)",cursor:"pointer",fontWeight:500},children:"Add"})]}),v&&a.jsx("div",{style:{fontSize:11,color:"var(--color-error, #b91c1c)"},children:v})]})]})]}),w&&a.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Switch project instructions",style:{position:"fixed",inset:0,zIndex:80,display:"flex",alignItems:"center",justifyContent:"center"},onClick:()=>C(null),children:[a.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.40)"}}),a.jsxs("div",{onClick:N=>N.stopPropagation(),style:{position:"relative",width:"min(520px, 92vw)",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:10,boxShadow:"0 10px 15px -3px rgba(0,0,0,0.12), 0 20px 40px -8px rgba(0,0,0,0.18)",padding:18,fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[a.jsxs("h2",{style:{margin:0,fontSize:16,fontWeight:600,fontFamily:"var(--font-serif, ui-serif)",marginBottom:8},children:["Switch to ",w.name]}),a.jsx("p",{style:{fontSize:13,color:"var(--text-secondary)",lineHeight:1.5,margin:0,marginBottom:12},children:"Skill Studio's skill scanner reads from the folder it was launched in, so switching projects from the browser isn't possible. Quit this server and relaunch from the target folder:"}),a.jsx("div",{style:{background:"var(--surface-1, #0f0f10)",color:"var(--text-primary)",padding:"10px 12px",borderRadius:6,fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.55,whiteSpace:"pre-wrap",wordBreak:"break-all",border:"1px solid var(--border-subtle, rgba(255,255,255,0.08))"},children:`cd "${w.path}" && npx vskill@latest studio`}),a.jsxs("div",{style:{display:"flex",gap:8,marginTop:14,justifyContent:"flex-end"},children:[a.jsx("button",{type:"button",onClick:async()=>{try{await navigator.clipboard.writeText(`cd "${w.path}" && npx vskill@latest studio`),R(!0),setTimeout(()=>R(!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"}),a.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 WN(t,r){const s=r.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 qN({open:t,projects:r,onSwitch:s,onClose:o}){const[c,u]=m.useState(""),[d,h]=m.useState(0),g=m.useMemo(()=>WN(r,c),[r,c]);m.useEffect(()=>{t||(u(""),h(0))},[t]),m.useEffect(()=>{d>=g.length&&h(0)},[g.length,d]);const p=y=>{if(y.key==="Escape"){y.preventDefault(),o();return}if(y.key==="ArrowDown"){y.preventDefault(),h(v=>Math.min(v+1,Math.max(g.length-1,0)));return}if(y.key==="ArrowUp"){y.preventDefault(),h(v=>Math.max(v-1,0));return}if(y.key==="Enter"){y.preventDefault();const v=g[d];v&&(s(v.id),o())}};return t?a.jsxs("div",{role:"dialog","aria-modal":"true","data-vskill-project-palette":!0,className:"vskill-project-palette fixed inset-0 z-50 flex items-start justify-center pt-24",children:[a.jsx("div",{className:"absolute inset-0 bg-black/30",onClick:o}),a.jsxs("div",{className:"relative w-[520px] max-w-[92vw] bg-background border rounded shadow-lg",children:[a.jsx("input",{type:"text",autoFocus:!0,value:c,onChange:y=>u(y.target.value),onKeyDown:p,placeholder:"Switch project…",className:"w-full px-3 py-2 text-sm border-b outline-none"}),a.jsxs("ul",{role:"listbox",className:"max-h-80 overflow-auto",children:[g.length===0&&a.jsx("li",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No matches."}),g.map((y,v)=>a.jsxs("li",{role:"option","aria-selected":v===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:[a.jsx("span",{"aria-hidden":!0,className:"inline-block w-2 h-2 rounded-full",style:{backgroundColor:y.colorDot}}),a.jsxs("span",{className:"flex-1",children:[a.jsx("span",{className:"vskill-palette-name",children:y.name}),a.jsx("span",{className:"ml-2 vskill-palette-path text-xs font-mono text-muted-foreground",children:y.path})]})]},y.id))]})]})]}):null}const Zg=/^[a-z][a-z0-9-]{0,62}[a-z0-9]$/;function YN({open:t,onClose:r,initialMode:s="standalone",isClaudeCode:o,projectRoot:c,onCreated:u}){const[d,h]=m.useState("destination"),[g,p]=m.useState(s),[y,v]=m.useState(""),[b,k]=m.useState(""),[S,w]=m.useState(""),[C,T]=m.useState([]),[R,L]=m.useState(!1),[B,z]=m.useState(null);if(m.useEffect(()=>{t&&(h("destination"),p(s),v(""),k(""),w(""),z(null))},[t,s]),m.useEffect(()=>{if(!t)return;let H=!0;return fetch("/api/authoring/plugins").then(M=>M.json()).then(M=>{H&&T(M.plugins??[])}).catch(()=>{}),()=>{H=!1}},[t]),m.useEffect(()=>{if(!t)return;function H(M){M.key==="Escape"&&(M.preventDefault(),r())}return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[t,r]),!t)return null;const F=C.length>0,E=o&&F,I=o,N=Zg.test(y),_=g==="existing-plugin"?b.length>0:Zg.test(b),V=!R&&N&&(g==="standalone"||_),W=KN(c,g,b,y);async function Y(){z(null),L(!0);try{const O=new URLSearchParams;O.set("mode",g),O.set("skillName",y),b&&O.set("pluginName",b);const U=await fetch(`/api/authoring/skill-exists?${O.toString()}`),G=await U.json();if(!U.ok){z(G.error??`Check failed: ${U.status}`);return}if(G.exists){z(`Skill '${y}' already exists${G.path?` at ${G.path}`:""}`);return}}catch(O){z(O instanceof Error?O.message:String(O));return}finally{L(!1)}const H=new URLSearchParams;H.set("mode",g),H.set("skillName",y),S.trim()&&H.set("description",S.trim()),b&&H.set("pluginName",b);const M=`#/create?${H.toString()}`;typeof window<"u"&&(window.location.hash=M),r()}async function X(){z(null),L(!0);try{const H=await fetch("/api/authoring/create-skill",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:g,skillName:y,description:S.trim()||void 0,pluginName:g==="standalone"?void 0:b})}),M=await H.json();if(!H.ok||!M.ok){z(M.error??`Create failed: ${H.status}`);return}on("skills"),u==null||u({mode:g,skillName:y,pluginName:M.pluginName??null,skillMdPath:M.skillMdPath}),r()}catch(H){z(H instanceof Error?H.message:String(H))}finally{L(!1)}}return a.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Create skill","data-vskill-create-skill-modal":!0,style:{position:"fixed",inset:0,zIndex:100,display:"flex",alignItems:"center",justifyContent:"center"},children:[a.jsx("div",{onClick:r,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.45)"}}),a.jsxs("div",{style:{position:"relative",width:"min(560px, 92vw)",maxHeight:"86vh",overflow:"auto",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:10,boxShadow:"0 10px 15px -3px rgba(0,0,0,0.12), 0 20px 40px -8px rgba(0,0,0,0.18)",fontFamily:"var(--font-sans)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.08))"},children:[a.jsx("h2",{style:{margin:0,fontSize:16,fontWeight:600,color:"var(--text-primary)",fontFamily:"var(--font-serif, ui-serif)",letterSpacing:"0.01em"},children:d==="destination"?"Create a skill":"Name and describe"}),a.jsxs("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginLeft:"auto",fontVariantNumeric:"tabular-nums"},children:["Step ",d==="destination"?"1":"2"," of 2"]})]}),d==="destination"&&a.jsxs("div",{style:{padding:14,display:"flex",flexDirection:"column",gap:10},children:[a.jsx($d,{title:"Standalone skill",subtitle:"A single skill in this project",description:"Lives at <project>/skills/<name>/SKILL.md. Works with every agent.",icon:"📄",selected:g==="standalone",onClick:()=>p("standalone")}),a.jsx($d,{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&&p("existing-plugin")}),a.jsx($d,{title:"New plugin",subtitle:I?"Bundles one or more skills for distribution":"Claude Code only",description:"Scaffolds <plugin>/.claude-plugin/plugin.json and its first skill.",icon:"📦",disabled:!I,selected:g==="new-plugin",onClick:()=>I&&p("new-plugin")})]}),d==="details"&&a.jsxs("div",{style:{padding:16,display:"flex",flexDirection:"column",gap:12},children:[g==="new-plugin"&&a.jsx(yo,{label:"Plugin name",hint:"kebab-case",children:a.jsx("input",{type:"text",value:b,onChange:H=>k(H.target.value.trim()),placeholder:"my-first-plugin",autoFocus:!0,style:bo(!b||_)})}),g==="existing-plugin"&&a.jsx(yo,{label:"Plugin",children:a.jsxs("select",{value:b,onChange:H=>k(H.target.value),style:{...bo(!0),fontFamily:"var(--font-mono)"},children:[a.jsx("option",{value:"",children:"Select a plugin…"}),C.map(H=>a.jsx("option",{value:H.name,children:H.name},H.path))]})}),a.jsx(yo,{label:"Skill name",hint:"kebab-case",children:a.jsx("input",{type:"text",value:y,onChange:H=>v(H.target.value.trim()),placeholder:"my-new-skill",autoFocus:g!=="new-plugin",style:bo(!y||N)})}),a.jsx(yo,{label:"Description",hint:"One short sentence — shown in frontmatter",children:a.jsx("textarea",{value:S,onChange:H=>w(H.target.value),rows:2,placeholder:"Does a thing when Claude needs X",style:{...bo(!0),resize:"vertical",minHeight:52,fontFamily:"var(--font-sans)"}})}),W&&a.jsxs("div",{style:{padding:"8px 10px",fontSize:11,fontFamily:"var(--font-mono)",color:"var(--text-secondary)",background:"var(--surface-1, rgba(0,0,0,0.03))",border:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",borderRadius:4,wordBreak:"break-all"},children:[a.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginBottom:2,fontFamily:"var(--font-sans)"},children:"Will create:"}),W.map((H,M)=>a.jsx("div",{children:H},M))]}),B&&a.jsx("div",{style:{fontSize:12,color:"var(--color-error, #b91c1c)",padding:"6px 10px",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4},children:B})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,padding:"12px 16px",borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",background:"var(--surface-1, rgba(0,0,0,0.02))"},children:[a.jsx("button",{type:"button",onClick:r,style:Vd,children:"Cancel"}),d==="destination"&&a.jsx("button",{type:"button",onClick:()=>h("details"),style:Jg,children:"Continue →"}),d==="details"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>h("destination"),style:Vd,children:"← Back"}),a.jsx("button",{type:"button",onClick:()=>void Y(),disabled:!V,style:{...Vd,opacity:V?1:.5,cursor:V?"pointer":"not-allowed"},title:"Opens the AI generation flow with this destination pre-selected (choose Claude Code, Anthropic API, OpenRouter, or local models)",children:"Generate with AI"}),a.jsx("button",{type:"button",onClick:()=>void X(),disabled:!V,style:{...Jg,opacity:V?1:.5,cursor:V?"pointer":"not-allowed"},title:"Creates an empty SKILL.md scaffold you can fill in by hand",children:R?"Creating…":"Create empty scaffold"})]})]})]})]})}function $d({title:t,subtitle:r,description:s,icon:o,selected:c,disabled:u,onClick:d}){return a.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:[a.jsx("span",{"aria-hidden":!0,style:{fontSize:22,lineHeight:1,marginTop:2},children:o}),a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsx("div",{style:{fontSize:14,fontWeight:600,lineHeight:1.3},children:t}),a.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginTop:2,textTransform:"uppercase",letterSpacing:"0.04em"},children:r}),a.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",marginTop:6,lineHeight:1.5},children:s})]})]})}function yo({label:t,hint:r,children:s}){return a.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4},children:[a.jsxs("span",{style:{display:"flex",alignItems:"baseline",gap:8},children:[a.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-primary)"},children:t}),r&&a.jsx("span",{style:{fontSize:11,color:"var(--text-tertiary)"},children:r})]}),s]})}function bo(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 Jg={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"},Vd={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 KN(t,r,s,o){const c=o||"<skill-name>",u=s||"<plugin-name>",d=t||"<project>";return r==="standalone"?[`${d}/skills/${c}/SKILL.md`]:r==="existing-plugin"?[`${d}/${u}/skills/${c}/SKILL.md`]:r==="new-plugin"?[`${d}/${u}/.claude-plugin/plugin.json`,`${d}/${u}/skills/${c}/SKILL.md`]:null}function XN({open:t,onClose:r,onInstall:s,installedNames:o}){const[c,u]=m.useState([]),[d,h]=m.useState(null),[g,p]=m.useState(null),[y,v]=m.useState(!1),[b,k]=m.useState(null);return m.useEffect(()=>{t&&(v(!0),k(null),fetch("/api/plugins/marketplaces").then(S=>S.json()).then(S=>{if(S.error)throw new Error(S.error);u(S.marketplaces??[])}).catch(S=>k(S instanceof Error?S.message:String(S))).finally(()=>v(!1)))},[t]),m.useEffect(()=>{if(!d){p(null);return}v(!0),k(null),fetch(`/api/plugins/marketplaces/${encodeURIComponent(d)}`).then(S=>S.json()).then(S=>{if(S.error)throw new Error(S.error);p(S)}).catch(S=>k(S instanceof Error?S.message:String(S))).finally(()=>v(!1))},[d]),m.useEffect(()=>{if(!t)return;function S(w){w.key==="Escape"&&r()}return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[t,r]),t?a.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Plugin marketplace","data-vskill-marketplace-drawer":!0,style:{position:"fixed",inset:0,zIndex:80},children:[a.jsx("div",{onClick:r,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.38)"}}),a.jsxs("aside",{style:{position:"absolute",top:0,right:0,bottom:0,width:"min(480px, 94vw)",background:"var(--color-paper, #fff)",borderLeft:"1px solid var(--border-default, rgba(0,0,0,0.12))",boxShadow:"-10px 0 30px -8px rgba(0,0,0,0.18)",display:"flex",flexDirection:"column",fontFamily:"var(--font-sans)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.08))"},children:[d&&a.jsx("button",{type:"button",onClick:()=>h(null),"aria-label":"Back to marketplaces",style:{border:"none",background:"transparent",fontSize:14,color:"var(--text-secondary)",cursor:"pointer",padding:0},children:"← Back"}),a.jsx("h2",{style:{margin:0,fontSize:15,fontWeight:600,color:"var(--text-primary)",fontFamily:"var(--font-serif, ui-serif)",flex:1},children:d?(g==null?void 0:g.name)??d:"Browse plugins"}),a.jsx("button",{type:"button",onClick:r,"aria-label":"Close",style:{border:"none",background:"transparent",fontSize:16,color:"var(--text-secondary)",cursor:"pointer",padding:"4px 6px"},children:"✕"})]}),a.jsxs("div",{style:{flex:1,overflowY:"auto",padding:12},children:[y&&a.jsx("div",{style:{padding:12,fontSize:12,color:"var(--text-tertiary)"},children:"Loading…"}),b&&a.jsx("div",{style:{padding:10,fontSize:12,color:"var(--color-error, #b91c1c)",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4},children:b}),!d&&!y&&c.length===0&&!b&&a.jsx(QN,{}),!d&&c.map(S=>a.jsxs("button",{type:"button",onClick:()=>h(S.name),style:JN,onMouseEnter:w=>{w.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.04))"},onMouseLeave:w=>{w.currentTarget.style.background="transparent"},children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)"},children:S.name}),a.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S.source})]},S.name)),d&&g&&a.jsxs(a.Fragment,{children:[g.description&&a.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",padding:"0 6px 12px",lineHeight:1.5},children:g.description}),g.plugins.length===0&&a.jsx("div",{style:{padding:12,fontSize:12,color:"var(--text-tertiary)"},children:"This marketplace has no plugins catalogued yet."}),g.plugins.map(S=>{const w=o.has(S.name);return a.jsx("div",{style:{padding:"10px 8px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.05))"},children:a.jsxs("div",{style:{display:"flex",alignItems:"start",gap:8},children:[a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsxs("div",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)",display:"flex",alignItems:"baseline",gap:8},children:[S.name,S.version&&a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)"},children:S.version}),S.category&&a.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:10,background:"var(--surface-2, rgba(0,0,0,0.05))",color:"var(--text-secondary)"},children:S.category})]}),S.description&&a.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:4,lineHeight:1.5},children:S.description})]}),a.jsx("button",{type:"button",disabled:w,onClick:()=>s(S.name,d),style:{flexShrink:0,padding:"5px 12px",fontSize:12,fontWeight:600,border:w?"none":"1px solid var(--color-action, #2F5B8E)",borderRadius:4,background:w?"var(--surface-2, rgba(0,0,0,0.05))":"var(--color-action, #2F5B8E)",color:w?"var(--text-tertiary)":"var(--color-action-ink, #FFFFFF)",cursor:w?"default":"pointer",fontFamily:"inherit",boxShadow:w?"none":"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)"},children:w?"Installed":"Install"})]})},S.name)})]})]}),!d&&a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",padding:12},children:a.jsx(ZN,{onAdded:()=>{on("marketplaces"),fetch("/api/plugins/marketplaces").then(S=>S.json()).then(S=>u(S.marketplaces??[]))}})})]})]}):null}function QN(){return a.jsxs("div",{style:{padding:20,fontSize:12,color:"var(--text-tertiary)",lineHeight:1.6},children:["No marketplaces configured yet. Add one below — examples:",a.jsxs("ul",{style:{marginTop:8,paddingLeft:16},children:[a.jsx("li",{children:a.jsx("code",{children:"anthropics/claude-plugins-official"})}),a.jsx("li",{children:a.jsx("code",{children:"openai/codex-plugin-cc"})})]})]})}function ZN({onAdded:t}){const[r,s]=m.useState(""),[o,c]=m.useState(!1),[u,d]=m.useState(null);async function h(){const g=r.trim();if(g){c(!0),d(null);try{const p=await fetch("/api/plugins/marketplaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:g})}),y=await p.json().catch(()=>({}));if(!p.ok||!y.ok){d(y.error??`Add failed (${p.status})`);return}s(""),t()}catch(p){d(p instanceof Error?p.message:String(p))}finally{c(!1)}}}return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx("label",{style:{fontSize:11,color:"var(--text-tertiary)",fontWeight:500},children:"Add marketplace (GitHub owner/repo, URL, or path)"}),a.jsxs("div",{style:{display:"flex",gap:6},children:[a.jsx("input",{type:"text",value:r,onChange:g=>s(g.target.value),onKeyDown:g=>{g.key==="Enter"&&h()},placeholder:"anthropics/claude-plugins-official",disabled:o,style:{flex:1,padding:"6px 8px",fontSize:12,fontFamily:"var(--font-mono)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none"}}),a.jsx("button",{type:"button",onClick:()=>void h(),disabled:o||!r.trim(),style:{padding:"6px 14px",fontSize:12,fontWeight:600,border:"1px solid var(--color-action, #2F5B8E)",borderRadius:4,background:"var(--color-action, #2F5B8E)",color:"var(--color-action-ink, #FFFFFF)",cursor:o||!r.trim()?"not-allowed":"pointer",opacity:o||!r.trim()?.5:1,boxShadow:"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)",fontFamily:"inherit"},children:o?"Adding…":"Add"})]}),u&&a.jsx("div",{style:{fontSize:11,color:"var(--color-error, #b91c1c)"},children:u})]})}const JN={display:"block",width:"100%",textAlign:"left",padding:"10px 12px",border:"none",borderRadius:6,background:"transparent",cursor:"pointer",fontFamily:"inherit",marginBottom:2},Pd=12;function eT({job:t,onDone:r}){const[s,o]=m.useState([]),[c,u]=m.useState("running"),[d,h]=m.useState(!1);if(m.useEffect(()=>{if(!t)return;o([]),u("running"),h(!1);const v=new AbortController;let b=[],k="running";return(async()=>{try{const S=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(!S.ok||!S.body){u("failed"),r({ok:!1,code:S.status,lines:[`HTTP ${S.status}`]});return}const w=S.body.getReader(),C=new TextDecoder;let T="";for(;;){const{value:R,done:L}=await w.read();if(L)break;T+=C.decode(R,{stream:!0});const B=T.split(/\n\n/);T=B.pop()??"";for(const z of B){const F=z.match(/^data:\s*(.*)$/m);if(F)try{const E=JSON.parse(F[1]);E.type==="stdout"&&E.line?(b=[...b,E.line].slice(-Pd),o(b)):E.type==="stderr"&&E.line?(b=[...b,`⚠ ${E.line}`].slice(-Pd),o(b)):E.type==="done"?(k=E.ok?"ok":"failed",u(k),on("plugins"),on("skills"),r({ok:E.ok??!1,code:E.code??null,lines:b})):E.type==="error"&&E.error&&(b=[...b,`✘ ${E.error}`].slice(-Pd),o(b))}catch{}}}k==="running"&&r({ok:!0,code:0,lines:b})}catch(S){if(S.name==="AbortError")return;u("failed"),r({ok:!1,code:null,lines:[...b,S instanceof Error?S.message:String(S)]})}})(),()=>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)",p=c==="ok"?"✔":c==="failed"?"✘":"…",y=c==="ok"?"Installed":c==="failed"?"Install failed":"Installing";return a.jsxs("div",{role:"status","aria-live":"polite","data-vskill-install-toast":!0,style:{position:"fixed",bottom:16,right:16,width:"min(420px, 92vw)",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderLeft:`3px solid ${g}`,borderRadius:6,boxShadow:"0 10px 20px -6px rgba(0,0,0,0.18)",zIndex:90,fontFamily:"var(--font-sans)",overflow:"hidden"},children:[a.jsxs("button",{type:"button",onClick:()=>h(v=>!v),style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"10px 12px",border:"none",background:"transparent",cursor:"pointer",textAlign:"left",fontFamily:"inherit"},children:[a.jsx("span",{"aria-hidden":!0,style:{fontSize:16,color:g,width:16,textAlign:"center"},children:c==="running"?a.jsx(tT,{}):p}),a.jsxs("span",{style:{flex:1,minWidth:0},children:[a.jsxs("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-primary)"},children:[y,": ",t.plugin,a.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)",marginLeft:4},children:["@",t.marketplace]})]}),!d&&s.length>0&&a.jsx("span",{style:{display:"block",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s[s.length-1]})]}),a.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-tertiary)"},children:d?"▾":"▸"})]}),d&&a.jsx("pre",{style:{margin:0,padding:"0 12px 12px",maxHeight:180,overflowY:"auto",fontFamily:"var(--font-mono)",fontSize:10,lineHeight:1.5,color:"var(--text-secondary)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:s.length===0?"Waiting for output…":s.join(`
|
|
102
|
-
`)})]})}function tT(){return a.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:10,height:10,borderRadius:"50%",border:"2px solid var(--color-accent, #2f6f8f)",borderTopColor:"transparent",animation:"vskill-spin 800ms linear infinite"},children:a.jsx("style",{children:"@keyframes vskill-spin { to { transform: rotate(360deg); } }"})})}const nT=3e3,aT={anthropic:"Anthropic",openai:"OpenAI",openrouter:"OpenRouter"};function ev(t){return t==="anthropic"||t==="openai"||t==="openrouter"}function rT(){const{toast:t}=qo(),r=m.useRef(new Map),s=m.useCallback(o=>{if(!ev(o.provider))return;const c=Date.now(),u=r.current.get(o.provider)??0;if(c-u<nT)return;r.current.set(o.provider,c);const d=aT[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 m.useEffect(()=>{function o(c){const u=c.detail;!u||!ev(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 Hy="vskill.studio.prefs";function Uy(){try{return typeof window>"u"?null:window.localStorage??null}catch{return null}}function $y(){const t=Uy();if(!t)return{};try{const r=t.getItem(Hy);if(!r)return{};const s=JSON.parse(r);return s&&typeof s=="object"&&!Array.isArray(s)?s:{}}catch{return{}}}function lT(t,r){const s=Uy();if(s)try{const c={...$y(),[t]:r};s.setItem(Hy,JSON.stringify(c))}catch{}}function sT(t,r){const o=$y()[t];return o===void 0?r:o}const tv={open:!1,x:0,y:0,skill:null};function iT(t,r){return{open:!0,x:t.clientX,y:t.clientY,skill:r}}function Ar(t,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:t,severity:r}}))}function oT(t){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:request-delete",{detail:{skill:t}}))}function cT(t,r){var s;switch(t){case"copy-path":try{(s=navigator.clipboard)==null||s.writeText(r.dir)}catch{Ar(te.toasts.permissionDenied,"error");return}Ar(te.toasts.pathCopied,"info");return;case"open":case"reveal":case"edit":Ar(te.actions.editPlaceholder,"info");return;case"run-benchmark":Ar(te.toasts.benchmarkQueued,"info");return;case"duplicate":Ar(te.toasts.skillDuplicated,"info");return;case"update":Ar(te.toasts.skillUpdated,"info");return;case"uninstall":Ar(te.actions.editPlaceholder,"info");return;case"delete":oT(r);return;default:return}}const uT=m.lazy(()=>Io(()=>import("./CommandPalette-BmPDARqF.js"),__vite__mapDeps([2,1]))),dT=m.lazy(()=>Io(()=>import("./CreateSkillPage-C9oCWsMA.js"),__vite__mapDeps([3,1])).then(t=>({default:t.CreateSkillPage})));function fT(){const[t,r]=m.useState(()=>typeof window<"u"&&window.location.hash.startsWith("#/create"));return m.useEffect(()=>{function s(){r(window.location.hash.startsWith("#/create"))}return window.addEventListener("hashchange",s),s(),()=>window.removeEventListener("hashchange",s)},[]),t}function pT(){return a.jsx(uS,{children:a.jsx(iS,{children:a.jsxs(GE,{children:[a.jsx(mT,{}),a.jsx(iN,{})]})})})}function mT(){var Qt,Gn;const{state:t,selectSkill:r,clearSelection:s,refreshSkills:o,outdatedByOrigin:c,revealSkill:u,clearReveal:d}=Zn(),{config:h}=_r(),{mode:g,resolvedTheme:p,setTheme:y}=Av(),{toast:v}=qo(),[b,k]=m.useState(()=>Ew()),[S]=m.useState(!0),[w,C]=m.useState(!1),[T,R]=m.useState(!1),[L,B]=m.useState(!1),[z,F]=m.useState("overview"),[E,I]=m.useState(tv),N=m.useCallback((se,we)=>{I(iT(se,we))},[]),_=IN(),[V,W]=m.useState(()=>sT("activeAgent",null)),Y=m.useCallback(se=>{W(se),lT("activeAgent",se),typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:agent-changed",{detail:{agentId:se}}))},[]);m.useEffect(()=>{var se;!V&&((se=_.response)!=null&&se.suggested)&&Y(_.response.suggested)},[V,(Qt=_.response)==null?void 0:Qt.suggested,Y]);const X=m.useMemo(()=>_.response?LN(_.response):[],[_.response]),{workspace:H,switchProject:M,addProject:O,removeProject:U,activeProject:G}=FN(),[ue,D]=m.useState(!1),[P,ee]=m.useState(!1),[re,xe]=m.useState("standalone"),ce=m.useCallback((se="standalone")=>{xe(se),ee(!0)},[]);m.useEffect(()=>{function se(we){if(!(we instanceof CustomEvent))return;const ze=we.detail;ce((ze==null?void 0:ze.mode)??"standalone")}return window.addEventListener("studio:request-create-skill",se),()=>window.removeEventListener("studio:request-create-skill",se)},[ce]);const[ye,de]=m.useState(!1),[je,Re]=m.useState(null);m.useEffect(()=>{function se(){de(!0)}return window.addEventListener("studio:open-marketplace",se),()=>window.removeEventListener("studio:open-marketplace",se)},[]);const Le=m.useMemo(()=>{const se=new Set;for(const we of t.skills)we.source==="plugin"&&we.pluginName&&se.add(we.pluginName);return se},[t.skills]);ef([{key:"p",meta:!0,handler:se=>{var ze;const we=typeof document<"u"?document.activeElement:null;we&&we.tagName==="INPUT"||((ze=se==null?void 0:se.preventDefault)==null||ze.call(se),D(un=>!un))}}],{enabled:!0});const ae=kN(),fe=ae.open;m.useEffect(()=>{function se(we){if(!(we instanceof CustomEvent))return;const ze=we.detail;ze!=null&&ze.provider&&fe(ze.provider)}return window.addEventListener("studio:open-setup-drawer",se),()=>window.removeEventListener("studio:open-setup-drawer",se)},[fe]);const me=m.useCallback(()=>{I(tv)},[]);m.useEffect(()=>{function se(we){if(!(we instanceof CustomEvent))return;const ze=we.detail;ze!=null&&ze.message&&v({message:ze.message,severity:ze.severity??"info"})}return window.addEventListener("studio:toast",se),()=>window.removeEventListener("studio:toast",se)},[v]),rT();const[he,be]=m.useState(!1),[Be,Oe]=m.useState(void 0);m.useEffect(()=>{function se(we){if(!(we instanceof CustomEvent))return;const ze=we.detail;Oe(ze==null?void 0:ze.provider),be(!0)}return window.addEventListener("studio:open-settings",se),()=>window.removeEventListener("studio:open-settings",se)},[]),m.useEffect(()=>{document.documentElement.style.setProperty("--sidebar-width",`${b}px`)},[b]);const[st,At]=m.useState(null),[gt,Gt]=m.useState(()=>new Set),vt=m.useRef(!1),Ze=m.useMemo(()=>pN(),[]),at=m.useCallback(se=>`${se.plugin}/${se.skill}`,[]),ve=m.useCallback(se=>{Gt(we=>{const ze=new Set(we);return ze.add(at(se)),ze})},[at]),ct=m.useCallback(se=>{Gt(we=>{const ze=new Set(we);return ze.delete(at(se)),ze})},[at]),Nt=mN({delayMs:1e4,onCommit:se=>{o(),ct(se)},onFailure:(se,we)=>{ct(se),v({message:`Couldn't delete ${se.skill}: ${we.message}`,severity:"error",durationMs:0,action:{label:te.actions.retry,onInvoke:()=>{ve(se),Nt.enqueueDelete(se)}}})}});m.useEffect(()=>{function se(we){if(!(we instanceof CustomEvent))return;const ze=we.detail;ze!=null&&ze.skill&&At(ze.skill)}return window.addEventListener("studio:request-delete",se),()=>window.removeEventListener("studio:request-delete",se)},[]);const nn=m.useCallback(()=>{const se=st;if(At(null),!se)return;const we={plugin:se.plugin,skill:se.skill};ve(we),Nt.enqueueDelete(we);const ze=vt.current?"":`Sent to your ${Ze}. Open Trash to restore. `;vt.current=!0,v({message:`${ze}Deleted ${se.skill}`,severity:"info",durationMs:1e4,action:{label:te.actions.undo,onInvoke:()=>{Nt.cancelDelete(at(we)),ct(we)}}})},[st,ve,ct,Nt,v,Ze,at]),Rn=m.useCallback(()=>{At(null)},[]),Vt=m.useMemo(()=>t.skills.filter(se=>!gt.has(at(se))),[t.skills,gt,at]),oa=m.useMemo(()=>t.selectedSkill?t.skills.find(se=>se.plugin===t.selectedSkill.plugin&&se.skill===t.selectedSkill.skill)??null:null,[t.skills,t.selectedSkill]),$e=m.useCallback(se=>{r({plugin:se.plugin,skill:se.skill,origin:se.origin})},[r]),Je=m.useMemo(()=>{if(!t.selectedSkill)return"";const se=t.selectedSkill.origin==="installed"?"Installed":"Own";return`Viewing ${t.selectedSkill.skill} (${se})`},[t.selectedSkill]),yt=m.useMemo(()=>[{id:"switch-theme",label:te.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:()=>B(se=>!se)},{id:"show-shortcuts",label:"Show keyboard shortcuts",description:"Open the cheatsheet",keywords:["help","keys"],onInvoke:()=>R(!0)},{id:"refresh-skills",label:"Refresh skills",description:"Re-scan local + installed",keywords:["reload","scan"],onInvoke:()=>o()}],[g,y,o]);ef([{key:"cmd+k",handler:()=>C(se=>!se)},{key:"ctrl+k",handler:()=>C(se=>!se)},{key:"?",handler:()=>R(se=>!se)},{key:"cmd+shift+d",handler:()=>y(p==="light"?"dark":"light")},{key:"ctrl+shift+d",handler:()=>y(p==="light"?"dark":"light")},{key:"cmd+b",handler:()=>B(se=>!se)},{key:"ctrl+b",handler:()=>B(se=>!se)},{key:"e",handler:()=>v({message:te.actions.editPlaceholder,severity:"info"})}]);const Fn=fT()?a.jsx(m.Suspense,{fallback:a.jsx("div",{style:{padding:40},children:"Loading…"}),children:a.jsx(dT,{})}):a.jsx(JE,{selectedSkillInfo:oa,activeDetailTab:z,onDetailTabChange:F,allSkills:t.skills,onSelectSkill:$e});return a.jsxs(a.Fragment,{children:[a.jsx(dS,{sidebarWidth:b,sidebarHidden:L||t.isMobile&&t.mobileView==="detail",banner:a.jsx(Rw,{connected:S}),liveMessage:Je,topRail:a.jsx(c2,{projectName:(h==null?void 0:h.projectName)??null,selected:t.selectedSkill,onOpenPalette:()=>C(!0),onHome:s,onRequestCreateSkill:()=>ce("standalone"),projectPickerSlot:H&&H.projects.length>0?a.jsx(GN,{workspace:H,onSwitch:M,onAdd:O,onRemove:U}):void 0}),sidebar:a.jsx(vw,{skills:Vt,selectedKey:t.selectedSkill?{plugin:t.selectedSkill.plugin,skill:t.selectedSkill.skill}:null,onSelect:$e,isLoading:t.skillsLoading,error:t.skillsError??null,onRetry:o,onContextMenu:N,outdatedByOrigin:c,activeAgentId:V,revealSkillId:t.revealSkillId,onRevealComplete:d,topSlot:_.status==="ready"&&X.length>0?a.jsxs(a.Fragment,{children:[a.jsx(zN,{agents:X,activeAgentId:V,onActiveAgentChange:Y,onOpenSetup:se=>ae.open(se)}),a.jsx(BN,{activeAgentId:V})]}):null}),resizeHandle:a.jsx(Tw,{initialWidth:b??_s,onChange:k}),main:Fn,statusBar:a.jsx(b2,{projectPath:(h==null?void 0:h.root)??null,modelName:(h==null?void 0:h.model)??null,health:h!=null&&h.error?"degraded":"ok",providers:(Gn=h==null?void 0:h.providers)==null?void 0:Gn.map(se=>{const we=se.id;return{id:we,label:se.label,available:se.available,kind:we==="ollama"||we==="lm-studio"?"start-service":we==="anthropic"||we==="openrouter"?"api-key":"cli-install"}})})}),a.jsx(cN,{open:T,onClose:()=>R(!1)}),a.jsx(gN,{open:ae.isOpen,providerKey:ae.providerKey,onClose:ae.close}),a.jsx(dN,{state:E,onClose:me,onAction:(se,we)=>cT(se,we)}),w&&a.jsx(m.Suspense,{fallback:null,children:a.jsx(uT,{open:w,onClose:()=>C(!1),commands:yt})}),a.jsx(qN,{open:ue,projects:(H==null?void 0:H.projects)??[],onSwitch:se=>{M(se)},onClose:()=>D(!1)}),a.jsx(YN,{open:P,onClose:()=>ee(!1),initialMode:re,isClaudeCode:V==="claude-code",projectRoot:(G==null?void 0:G.path)??(h==null?void 0:h.projectName)??"",onCreated:se=>{o(),setTimeout(()=>{u(se.pluginName??"",se.skillName)},500)}}),a.jsx(XN,{open:ye,onClose:()=>de(!1),installedNames:Le,onInstall:(se,we)=>{Re({plugin:se,marketplace:we,ref:`${se}@${we}`}),de(!1)}}),a.jsx(Nv,{open:he,onClose:()=>be(!1),initialProvider:Be,onToast:se=>v({message:se,severity:"info"})}),a.jsx(eT,{job:je,onDone:se=>{se.ok&&setTimeout(()=>Re(null),3e3)}}),a.jsx(fN,{open:st!==null,title:st?`Delete "${st.skill}"?`:"",body:`It will be sent to your ${Ze}. You can recover it from there.`,confirmLabel:"Delete",cancelLabel:"Cancel",variant:"destructive",onConfirm:nn,onCancel:Rn})]})}const nv="vskill.migrations.scope-rename.v1",hT={own:"authoring-project",installed:"available-project",global:"available-personal"},xT=/^vskill-sidebar-(.+)-(own|installed|global)-collapsed$/;function gT(t){if(t.getItem(nv)==="done")return;const r=[];for(let s=0;s<t.length;s++){const o=t.key(s);if(!o)continue;const c=o.match(xT);if(!c)continue;const[,u,d]=c,h=hT[d];if(!h)continue;const g=t.getItem(o);g!==null&&r.push({oldKey:o,newKey:`vskill-sidebar-${u}-${h}-collapsed`,value:g})}for(const{oldKey:s,newKey:o,value:c}of r)t.getItem(o)===null&&t.setItem(o,c),t.removeItem(s);t.setItem(nv,"done")}if(typeof PerformanceObserver<"u")try{const t=new PerformanceObserver(r=>{for(const s of r.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{gT(window.localStorage)}catch{}i0.createRoot(document.getElementById("root")).render(a.jsx(m.StrictMode,{children:a.jsx(Tj,{children:a.jsx(h2,{children:a.jsx(pT,{})})})}));export{Wo as E,jv as L,Xs as P,Ne as R,yE as S,_r as a,$y as b,xE as c,Fo as d,sT as g,a as j,m as r,te as s,sf as t,P0 as u,lT as w};
|