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
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-BKkSZEVM.js","assets/fonts-i7Lkz2zN.css","assets/CommandPalette-DyknO-U5.js","assets/CreateSkillPage-CIhAMdn-.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 rv(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var od={exports:{}},Ts={};/**
|
|
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 Cx;function e0(){if(Cx)return Ts;Cx=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 Ts.Fragment=r,Ts.jsx=s,Ts.jsxs=s,Ts}var Ex;function t0(){return Ex||(Ex=1,od.exports=e0()),od.exports}var a=t0(),cd={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 Nx;function n0(){if(Nx)return Ie;Nx=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"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),b=Symbol.iterator;function k(L){return L===null||typeof L!="object"?null:(L=b&&L[b]||L["@@iterator"],typeof L=="function"?L:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,C={};function T(L,q,W){this.props=L,this.context=q,this.refs=C,this.updater=W||S}T.prototype.isReactComponent={},T.prototype.setState=function(L,q){if(typeof L!="object"&&typeof L!="function"&&L!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,L,q,"setState")},T.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function R(){}R.prototype=T.prototype;function M(L,q,W){this.props=L,this.context=q,this.refs=C,this.updater=W||S}var B=M.prototype=new R;B.constructor=M,w(B,T.prototype),B.isPureReactComponent=!0;var D=Array.isArray;function F(){}var E={H:null,A:null,T:null,S:null},H=Object.prototype.hasOwnProperty;function N(L,q,W){var te=W.ref;return{$$typeof:t,type:L,key:q,ref:te!==void 0?te:null,props:W}}function _(L,q){return N(L.type,q,L.props)}function P(L){return typeof L=="object"&&L!==null&&L.$$typeof===t}function K(L){var q={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(W){return q[W]})}var X=/\/+/g;function ee(L,q){return typeof L=="object"&&L!==null&&L.key!=null?K(""+L.key):q.toString(36)}function $(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(F,F):(L.status="pending",L.then(function(q){L.status==="pending"&&(L.status="fulfilled",L.value=q)},function(q){L.status==="pending"&&(L.status="rejected",L.reason=q)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function z(L,q,W,te,fe){var ie=typeof L;(ie==="undefined"||ie==="boolean")&&(L=null);var ve=!1;if(L===null)ve=!0;else switch(ie){case"bigint":case"string":case"number":ve=!0;break;case"object":switch(L.$$typeof){case t:case r:ve=!0;break;case y:return ve=L._init,z(ve(L._payload),q,W,te,fe)}}if(ve)return fe=fe(L),ve=te===""?"."+ee(L,0):te,D(fe)?(W="",ve!=null&&(W=ve.replace(X,"$&/")+"/"),z(fe,q,W,"",function(Ae){return Ae})):fe!=null&&(P(fe)&&(fe=_(fe,W+(fe.key==null||L&&L.key===fe.key?"":(""+fe.key).replace(X,"$&/")+"/")+ve)),q.push(fe)),1;ve=0;var de=te===""?".":te+":";if(D(L))for(var Se=0;Se<L.length;Se++)te=L[Se],ie=de+ee(te,Se),ve+=z(te,q,W,ie,fe);else if(Se=k(L),typeof Se=="function")for(L=Se.call(L),Se=0;!(te=L.next()).done;)te=te.value,ie=de+ee(te,Se++),ve+=z(te,q,W,ie,fe);else if(ie==="object"){if(typeof L.then=="function")return z($(L),q,W,te,fe);throw q=String(L),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.")}return ve}function I(L,q,W){if(L==null)return L;var te=[],fe=0;return z(L,te,"","",function(ie){return q.call(W,ie,fe++)}),te}function O(L){if(L._status===-1){var q=L._result;q=q(),q.then(function(W){(L._status===0||L._status===-1)&&(L._status=1,L._result=W)},function(W){(L._status===0||L._status===-1)&&(L._status=2,L._result=W)}),L._status===-1&&(L._status=0,L._result=q)}if(L._status===1)return L._result.default;throw L._result}var U=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},se={map:I,forEach:function(L,q,W){I(L,function(){q.apply(this,arguments)},W)},count:function(L){var q=0;return I(L,function(){q++}),q},toArray:function(L){return I(L,function(q){return q})||[]},only:function(L){if(!P(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return Ie.Activity=v,Ie.Children=se,Ie.Component=T,Ie.Fragment=s,Ie.Profiler=c,Ie.PureComponent=M,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(L){return E.H.useMemoCache(L)}},Ie.cache=function(L){return function(){return L.apply(null,arguments)}},Ie.cacheSignal=function(){return null},Ie.cloneElement=function(L,q,W){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var te=w({},L.props),fe=L.key;if(q!=null)for(ie in q.key!==void 0&&(fe=""+q.key),q)!H.call(q,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&q.ref===void 0||(te[ie]=q[ie]);var ie=arguments.length-2;if(ie===1)te.children=W;else if(1<ie){for(var ve=Array(ie),de=0;de<ie;de++)ve[de]=arguments[de+2];te.children=ve}return N(L.type,fe,te)},Ie.createContext=function(L){return L={$$typeof:d,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:u,_context:L},L},Ie.createElement=function(L,q,W){var te,fe={},ie=null;if(q!=null)for(te in q.key!==void 0&&(ie=""+q.key),q)H.call(q,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(fe[te]=q[te]);var ve=arguments.length-2;if(ve===1)fe.children=W;else if(1<ve){for(var de=Array(ve),Se=0;Se<ve;Se++)de[Se]=arguments[Se+2];fe.children=de}if(L&&L.defaultProps)for(te in ve=L.defaultProps,ve)fe[te]===void 0&&(fe[te]=ve[te]);return N(L,ie,fe)},Ie.createRef=function(){return{current:null}},Ie.forwardRef=function(L){return{$$typeof:h,render:L}},Ie.isValidElement=P,Ie.lazy=function(L){return{$$typeof:y,_payload:{_status:-1,_result:L},_init:O}},Ie.memo=function(L,q){return{$$typeof:m,type:L,compare:q===void 0?null:q}},Ie.startTransition=function(L){var q=E.T,W={};E.T=W;try{var te=L(),fe=E.S;fe!==null&&fe(W,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(F,U)}catch(ie){U(ie)}finally{q!==null&&W.types!==null&&(q.types=W.types),E.T=q}},Ie.unstable_useCacheRefresh=function(){return E.H.useCacheRefresh()},Ie.use=function(L){return E.H.use(L)},Ie.useActionState=function(L,q,W){return E.H.useActionState(L,q,W)},Ie.useCallback=function(L,q){return E.H.useCallback(L,q)},Ie.useContext=function(L){return E.H.useContext(L)},Ie.useDebugValue=function(){},Ie.useDeferredValue=function(L,q){return E.H.useDeferredValue(L,q)},Ie.useEffect=function(L,q){return E.H.useEffect(L,q)},Ie.useEffectEvent=function(L){return E.H.useEffectEvent(L)},Ie.useId=function(){return E.H.useId()},Ie.useImperativeHandle=function(L,q,W){return E.H.useImperativeHandle(L,q,W)},Ie.useInsertionEffect=function(L,q){return E.H.useInsertionEffect(L,q)},Ie.useLayoutEffect=function(L,q){return E.H.useLayoutEffect(L,q)},Ie.useMemo=function(L,q){return E.H.useMemo(L,q)},Ie.useOptimistic=function(L,q){return E.H.useOptimistic(L,q)},Ie.useReducer=function(L,q,W){return E.H.useReducer(L,q,W)},Ie.useRef=function(L){return E.H.useRef(L)},Ie.useState=function(L){return E.H.useState(L)},Ie.useSyncExternalStore=function(L,q,W){return E.H.useSyncExternalStore(L,q,W)},Ie.useTransition=function(){return E.H.useTransition()},Ie.version="19.2.4",Ie}var Tx;function df(){return Tx||(Tx=1,cd.exports=n0()),cd.exports}var p=df();const Te=rv(p);var ud={exports:{}},Rs={},dd={exports:{}},fd={};/**
|
|
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 Rx;function a0(){return Rx||(Rx=1,(function(t){function r(z,I){var O=z.length;z.push(I);e:for(;0<O;){var U=O-1>>>1,se=z[U];if(0<c(se,I))z[U]=I,z[O]=se,O=U;else break e}}function s(z){return z.length===0?null:z[0]}function o(z){if(z.length===0)return null;var I=z[0],O=z.pop();if(O!==I){z[0]=O;e:for(var U=0,se=z.length,L=se>>>1;U<L;){var q=2*(U+1)-1,W=z[q],te=q+1,fe=z[te];if(0>c(W,O))te<se&&0>c(fe,W)?(z[U]=fe,z[te]=O,U=te):(z[U]=W,z[q]=O,U=q);else if(te<se&&0>c(fe,O))z[U]=fe,z[te]=O,U=te;else break e}}return I}function c(z,I){var O=z.sortIndex-I.sortIndex;return O!==0?O:z.id-I.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;t.unstable_now=function(){return u.now()}}else{var d=Date,h=d.now();t.unstable_now=function(){return d.now()-h}}var g=[],m=[],y=1,v=null,b=3,k=!1,S=!1,w=!1,C=!1,T=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function B(z){for(var I=s(m);I!==null;){if(I.callback===null)o(m);else if(I.startTime<=z)o(m),I.sortIndex=I.expirationTime,r(g,I);else break;I=s(m)}}function D(z){if(w=!1,B(z),!S)if(s(g)!==null)S=!0,F||(F=!0,K());else{var I=s(m);I!==null&&$(D,I.startTime-z)}}var F=!1,E=-1,H=5,N=-1;function _(){return C?!0:!(t.unstable_now()-N<H)}function P(){if(C=!1,F){var z=t.unstable_now();N=z;var I=!0;try{e:{S=!1,w&&(w=!1,R(E),E=-1),k=!0;var O=b;try{t:{for(B(z),v=s(g);v!==null&&!(v.expirationTime>z&&_());){var U=v.callback;if(typeof U=="function"){v.callback=null,b=v.priorityLevel;var se=U(v.expirationTime<=z);if(z=t.unstable_now(),typeof se=="function"){v.callback=se,B(z),I=!0;break t}v===s(g)&&o(g),B(z)}else o(g);v=s(g)}if(v!==null)I=!0;else{var L=s(m);L!==null&&$(D,L.startTime-z),I=!1}}break e}finally{v=null,b=O,k=!1}I=void 0}}finally{I?K():F=!1}}}var K;if(typeof M=="function")K=function(){M(P)};else if(typeof MessageChannel<"u"){var X=new MessageChannel,ee=X.port2;X.port1.onmessage=P,K=function(){ee.postMessage(null)}}else K=function(){T(P,0)};function $(z,I){E=T(function(){z(t.unstable_now())},I)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(z){z.callback=null},t.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):H=0<z?Math.floor(1e3/z):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_next=function(z){switch(b){case 1:case 2:case 3:var I=3;break;default:I=b}var O=b;b=I;try{return z()}finally{b=O}},t.unstable_requestPaint=function(){C=!0},t.unstable_runWithPriority=function(z,I){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var O=b;b=z;try{return I()}finally{b=O}},t.unstable_scheduleCallback=function(z,I,O){var U=t.unstable_now();switch(typeof O=="object"&&O!==null?(O=O.delay,O=typeof O=="number"&&0<O?U+O:U):O=U,z){case 1:var se=-1;break;case 2:se=250;break;case 5:se=1073741823;break;case 4:se=1e4;break;default:se=5e3}return se=O+se,z={id:y++,callback:I,priorityLevel:z,startTime:O,expirationTime:se,sortIndex:-1},O>U?(z.sortIndex=O,r(m,z),s(g)===null&&z===s(m)&&(w?(R(E),E=-1):w=!0,$(D,O-U))):(z.sortIndex=se,r(g,z),S||k||(S=!0,F||(F=!0,K()))),z},t.unstable_shouldYield=_,t.unstable_wrapCallback=function(z){var I=b;return function(){var O=b;b=I;try{return z.apply(this,arguments)}finally{b=O}}}})(fd)),fd}var Ax;function r0(){return Ax||(Ax=1,dd.exports=a0()),dd.exports}var pd={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 Mx;function l0(){if(Mx)return Jt;Mx=1;var t=df();function r(g){var m="https://react.dev/errors/"+g;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)m+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+g+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var o={d:{f:s,r:function(){throw Error(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,m,y){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:v==null?null:""+v,children:g,containerInfo:m,implementation:y}}var d=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(g,m){if(g==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Jt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Jt.createPortal=function(g,m){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(r(299));return u(g,m,null,y)},Jt.flushSync=function(g){var m=d.T,y=o.p;try{if(d.T=null,o.p=2,g)return g()}finally{d.T=m,o.p=y,o.d.f()}},Jt.preconnect=function(g,m){typeof g=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,o.d.C(g,m))},Jt.prefetchDNS=function(g){typeof g=="string"&&o.d.D(g)},Jt.preinit=function(g,m){if(typeof g=="string"&&m&&typeof m.as=="string"){var y=m.as,v=h(y,m.crossOrigin),b=typeof m.integrity=="string"?m.integrity:void 0,k=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;y==="style"?o.d.S(g,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:v,integrity:b,fetchPriority:k}):y==="script"&&o.d.X(g,{crossOrigin:v,integrity:b,fetchPriority:k,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Jt.preinitModule=function(g,m){if(typeof g=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var y=h(m.as,m.crossOrigin);o.d.M(g,{crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&o.d.M(g)},Jt.preload=function(g,m){if(typeof g=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var y=m.as,v=h(y,m.crossOrigin);o.d.L(g,y,{crossOrigin:v,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Jt.preloadModule=function(g,m){if(typeof g=="string")if(m){var y=h(m.as,m.crossOrigin);o.d.m(g,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else o.d.m(g)},Jt.requestFormReset=function(g){o.d.r(g)},Jt.unstable_batchedUpdates=function(g,m){return g(m)},Jt.useFormState=function(g,m,y){return d.H.useFormState(g,m,y)},Jt.useFormStatus=function(){return d.H.useHostTransitionStatus()},Jt.version="19.2.4",Jt}var Lx;function lv(){if(Lx)return pd.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(),pd.exports=l0(),pd.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 zx;function s0(){if(zx)return Rs;zx=1;var t=r0(),r=df(),s=lv();function o(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)n+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var n=e,l=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(l=n.return),e=n.return;while(e)}return n.tag===3?l:null}function d(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function h(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function g(e){if(u(e)!==e)throw Error(o(188))}function m(e){var n=e.alternate;if(!n){if(n=u(e),n===null)throw Error(o(188));return n!==e?null:e}for(var l=e,i=n;;){var f=l.return;if(f===null)break;var x=f.alternate;if(x===null){if(i=f.return,i!==null){l=i;continue}break}if(f.child===x.child){for(x=f.child;x;){if(x===l)return g(f),e;if(x===i)return g(f),n;x=x.sibling}throw Error(o(188))}if(l.return!==i.return)l=f,i=x;else{for(var j=!1,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"),M=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),F=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),N=Symbol.for("react.activity"),_=Symbol.for("react.memo_cache_sentinel"),P=Symbol.iterator;function K(e){return e===null||typeof e!="object"?null:(e=P&&e[P]||e["@@iterator"],typeof e=="function"?e:null)}var X=Symbol.for("react.client.reference");function ee(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===X?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case w:return"Fragment";case T:return"Profiler";case C:return"StrictMode";case D:return"Suspense";case F:return"SuspenseList";case N:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case S:return"Portal";case M: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:ee(e.type)||"Memo";case H:n=e._payload,e=e._init;try{return ee(e(n))}catch{}}return null}var $=Array.isArray,z=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O={pending:!1,data:null,method:null,action:null},U=[],se=-1;function L(e){return{current:e}}function q(e){0>se||(e.current=U[se],U[se]=null,se--)}function W(e,n){se++,U[se]=e.current,e.current=n}var te=L(null),fe=L(null),ie=L(null),ve=L(null);function de(e,n){switch(W(ie,n),W(fe,e),W(te,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?Yh(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=Yh(n),e=Kh(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}q(te),W(te,e)}function Se(){q(te),q(fe),q(ie)}function Ae(e){e.memoizedState!==null&&W(ve,e);var n=te.current,l=Kh(n,e.type);n!==l&&(W(fe,e),W(te,l))}function _e(e){fe.current===e&&(q(te),q(fe)),ve.current===e&&(q(ve),ws._currentValue=O)}var re,he;function pe(e){if(re===void 0)try{throw Error()}catch(l){var n=l.stack.trim().match(/\n( *(at )?)/);re=n&&n[1]||"",he=-1<l.stack.indexOf(`
|
|
43
|
+
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
+
`+re+e+he}var xe=!1;function je(e,n){if(!e||xe)return"";xe=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(n){var ue=function(){throw Error()};if(Object.defineProperty(ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ue,[])}catch(ae){var J=ae}Reflect.construct(e,[],ue)}else{try{ue.call()}catch(ae){J=ae}e.call(ue.prototype)}}else{try{throw Error()}catch(ae){J=ae}(ue=e())&&typeof ue.catch=="function"&&ue.catch(function(){})}}catch(ae){if(ae&&J&&typeof ae.stack=="string")return[ae.stack,J.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var 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 V=j.split(`
|
|
45
|
+
`),Z=A.split(`
|
|
46
|
+
`);for(f=i=0;i<V.length&&!V[i].includes("DetermineComponentFrameRoot");)i++;for(;f<Z.length&&!Z[f].includes("DetermineComponentFrameRoot");)f++;if(i===V.length||f===Z.length)for(i=V.length-1,f=Z.length-1;1<=i&&0<=f&&V[i]!==Z[f];)f--;for(;1<=i&&0<=f;i--,f--)if(V[i]!==Z[f]){if(i!==1||f!==1)do if(i--,f--,0>f||V[i]!==Z[f]){var le=`
|
|
47
|
+
`+V[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{xe=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?pe(l):""}function Be(e,n){switch(e.tag){case 26:case 27:case 5:return pe(e.type);case 16:return pe("Lazy");case 13:return e.child!==n&&n!==null?pe("Suspense Fallback"):pe("Suspense");case 19:return pe("SuspenseList");case 0:case 15:return je(e.type,!1);case 11:return je(e.type.render,!1);case 1:return je(e.type,!0);case 31:return pe("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 rt=Object.prototype.hasOwnProperty,Nt=t.unstable_scheduleCallback,ht=t.unstable_cancelCallback,Dt=t.unstable_shouldYield,Tt=t.unstable_requestPaint,Qe=t.unstable_now,tt=t.unstable_getCurrentPriorityLevel,be=t.unstable_ImmediatePriority,pt=t.unstable_UserBlockingPriority,Et=t.unstable_NormalPriority,Yt=t.unstable_LowPriority,un=t.unstable_IdlePriority,Gt=t.log,nn=t.unstable_setDisableYieldValue,An=null,Mt=null;function xt(e){if(typeof Gt=="function"&&nn(e),Mt&&typeof Mt.setStrictMode=="function")try{Mt.setStrictMode(An,e)}catch{}}var St=Math.clz32?Math.clz32:Wn,ta=Math.log,fa=Math.LN2;function Wn(e){return e>>>=0,e===0?32:31-(ta(e)/fa|0)|0}var oe=256,Ee=262144,ye=4194304;function gt(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 Mn(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=gt(i):(j&=A,j!==0?f=gt(j):l||(l=A&~e,l!==0&&(f=gt(l))))):(A=i&~x,A!==0?f=gt(A):j!==0?f=gt(j):l||(l=i&~e,l!==0&&(f=gt(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 dn(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function ni(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function qn(){var e=ye;return ye<<=1,(ye&62914560)===0&&(ye=4194304),e}function Bl(e){for(var n=[],l=0;31>l;l++)n.push(e);return n}function fr(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Il(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,V=e.expirationTimes,Z=e.hiddenUpdates;for(l=j&~l;0<l;){var le=31-St(l),ue=1<<le;A[le]=0,V[le]=-1;var J=Z[le];if(J!==null)for(Z[le]=null,le=0;le<J.length;le++){var ae=J[le];ae!==null&&(ae.lane&=-536870913)}l&=~ue}i!==0&&na(e,i,0),x!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=x&~(j&~n))}function na(e,n,l){e.pendingLanes|=n,e.suspendedLanes&=~n;var i=31-St(n);e.entangledLanes|=n,e.entanglements[i]=e.entanglements[i]|1073741824|l&261930}function pr(e,n){var l=e.entangledLanes|=n;for(e=e.entanglements;l;){var i=31-St(l),f=1<<i;f&n|e[i]&n&&(e[i]|=n),l&=~f}}function mr(e,n){var l=n&-n;return l=(l&42)!==0?1:Pr(l),(l&(e.suspendedLanes|n))!==0?0:l}function Pr(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 Da(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function it(){var e=I.p;return e!==0?e:(e=window.event,e===void 0?32:vx(e.type))}function hr(e,n){var l=I.p;try{return I.p=e,n()}finally{I.p=l}}var an=Math.random().toString(36).slice(2),Ut="__reactFiber$"+an,ot="__reactProps$"+an,xr="__reactContainer$"+an,aa="__reactEvents$"+an,Jo="__reactListeners$"+an,Fy="__reactHandles$"+an,_f="__reactResources$"+an,Hl="__reactMarker$"+an;function ec(e){delete e[Ut],delete e[ot],delete e[aa],delete e[Jo],delete e[Fy]}function Fr(e){var n=e[Ut];if(n)return n;for(var l=e.parentNode;l;){if(n=l[xr]||l[Ut]){if(l=n.alternate,n.child!==null||l!==null&&l.child!==null)for(e=nx(e);e!==null;){if(l=e[Ut])return l;e=nx(e)}return n}e=l,l=e.parentNode}return null}function Gr(e){if(e=e[Ut]||e[xr]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Ul(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(o(33))}function Wr(e){var n=e[_f];return n||(n=e[_f]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Wt(e){e[Hl]=!0}var Of=new Set,Bf={};function gr(e,n){qr(e,n),qr(e+"Capture",n)}function qr(e,n){for(Bf[e]=n,e=0;e<n.length;e++)Of.add(n[e])}var Gy=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]*$"),If={},Hf={};function Wy(e){return rt.call(Hf,e)?!0:rt.call(If,e)?!1:Gy.test(e)?Hf[e]=!0:(If[e]=!0,!1)}function ai(e,n,l){if(Wy(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 ri(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 pa(e,n,l,i){if(i===null)e.removeAttribute(l);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(n,l,""+i)}}function Ln(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Uf(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function qy(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 tc(e){if(!e._valueTracker){var n=Uf(e)?"checked":"value";e._valueTracker=qy(e,n,""+e[n])}}function $f(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var l=n.getValue(),i="";return e&&(i=Uf(e)?e.checked?"true":"false":e.value),e=i,e!==l?(n.setValue(e),!0):!1}function li(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 Yy=/[\n"\\]/g;function zn(e){return e.replace(Yy,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function nc(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=""+Ln(n)):e.value!==""+Ln(n)&&(e.value=""+Ln(n)):j!=="submit"&&j!=="reset"||e.removeAttribute("value"),n!=null?ac(e,j,Ln(n)):l!=null?ac(e,j,Ln(l)):i!=null&&e.removeAttribute("value"),f==null&&x!=null&&(e.defaultChecked=!!x),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?e.name=""+Ln(A):e.removeAttribute("name")}function Vf(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)){tc(e);return}l=l!=null?""+Ln(l):"",n=n!=null?""+Ln(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),tc(e)}function ac(e,n,l){n==="number"&&li(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Yr(e,n,l,i){if(e=e.options,n){n={};for(var f=0;f<l.length;f++)n["$"+l[f]]=!0;for(l=0;l<e.length;l++)f=n.hasOwnProperty("$"+e[l].value),e[l].selected!==f&&(e[l].selected=f),f&&i&&(e[l].defaultSelected=!0)}else{for(l=""+Ln(l),n=null,f=0;f<e.length;f++){if(e[f].value===l){e[f].selected=!0,i&&(e[f].defaultSelected=!0);return}n!==null||e[f].disabled||(n=e[f])}n!==null&&(n.selected=!0)}}function Pf(e,n,l){if(n!=null&&(n=""+Ln(n),n!==e.value&&(e.value=n),l==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=l!=null?""+Ln(l):""}function Ff(e,n,l,i){if(n==null){if(i!=null){if(l!=null)throw Error(o(92));if($(i)){if(1<i.length)throw Error(o(93));i=i[0]}l=i}l==null&&(l=""),n=l}l=Ln(n),e.defaultValue=l,i=e.textContent,i===l&&i!==""&&i!==null&&(e.value=i),tc(e)}function Kr(e,n){if(n){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=n;return}}e.textContent=n}var Ky=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 Gf(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||Ky.has(n)?n==="float"?e.cssFloat=l:e[n]=(""+l).trim():e[n]=l+"px"}function Wf(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&&Gf(e,f,i)}else for(var x in n)n.hasOwnProperty(x)&&Gf(e,x,n[x])}function rc(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 Xy=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"]]),Qy=/^[\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 si(e){return Qy.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ma(){}var lc=null;function sc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Xr=null,Qr=null;function qf(e){var n=Gr(e);if(n&&(e=n.stateNode)){var l=e[ot]||null;e:switch(e=n.stateNode,n.type){case"input":if(nc(e,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),n=l.name,l.type==="radio"&&n!=null){for(l=e;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+zn(""+n)+'"][type="radio"]'),n=0;n<l.length;n++){var i=l[n];if(i!==e&&i.form===e.form){var f=i[ot]||null;if(!f)throw Error(o(90));nc(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&&$f(i)}break e;case"textarea":Pf(e,l.value,l.defaultValue);break e;case"select":n=l.value,n!=null&&Yr(e,!!l.multiple,n,!1)}}}var ic=!1;function Yf(e,n,l){if(ic)return e(n,l);ic=!0;try{var i=e(n);return i}finally{if(ic=!1,(Xr!==null||Qr!==null)&&(qi(),Xr&&(n=Xr,e=Qr,Qr=Xr=null,qf(n),e)))for(n=0;n<e.length;n++)qf(e[n])}}function $l(e,n){var l=e.stateNode;if(l===null)return null;var i=l[ot]||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 ha=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),oc=!1;if(ha)try{var Vl={};Object.defineProperty(Vl,"passive",{get:function(){oc=!0}}),window.addEventListener("test",Vl,Vl),window.removeEventListener("test",Vl,Vl)}catch{oc=!1}var _a=null,cc=null,ii=null;function Kf(){if(ii)return ii;var e,n=cc,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 ii=f.slice(e,1<i?1-i:void 0)}function oi(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 ci(){return!0}function Xf(){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)?ci:Xf,this.isPropagationStopped=Xf,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=ci)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=ci)},persist:function(){},isPersistent:ci}),n}var vr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ui=fn(vr),Pl=v({},vr,{view:0,detail:0}),Zy=fn(Pl),uc,dc,Fl,di=v({},Pl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:pc,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!==Fl&&(Fl&&e.type==="mousemove"?(uc=e.screenX-Fl.screenX,dc=e.screenY-Fl.screenY):dc=uc=0,Fl=e),uc)},movementY:function(e){return"movementY"in e?e.movementY:dc}}),Qf=fn(di),Jy=v({},di,{dataTransfer:0}),eb=fn(Jy),tb=v({},Pl,{relatedTarget:0}),fc=fn(tb),nb=v({},vr,{animationName:0,elapsedTime:0,pseudoElement:0}),ab=fn(nb),rb=v({},vr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),lb=fn(rb),sb=v({},vr,{data:0}),Zf=fn(sb),ib={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ob={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"},cb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ub(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=cb[e])?!!n[e]:!1}function pc(){return ub}var db=v({},Pl,{key:function(e){if(e.key){var n=ib[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=oi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ob[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:pc,charCode:function(e){return e.type==="keypress"?oi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?oi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),fb=fn(db),pb=v({},di,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Jf=fn(pb),mb=v({},Pl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:pc}),hb=fn(mb),xb=v({},vr,{propertyName:0,elapsedTime:0,pseudoElement:0}),gb=fn(xb),vb=v({},di,{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}),yb=fn(vb),bb=v({},vr,{newState:0,oldState:0}),jb=fn(bb),Sb=[9,13,27,32],mc=ha&&"CompositionEvent"in window,Gl=null;ha&&"documentMode"in document&&(Gl=document.documentMode);var kb=ha&&"TextEvent"in window&&!Gl,ep=ha&&(!mc||Gl&&8<Gl&&11>=Gl),tp=" ",np=!1;function ap(e,n){switch(e){case"keyup":return Sb.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function rp(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Zr=!1;function wb(e,n){switch(e){case"compositionend":return rp(n);case"keypress":return n.which!==32?null:(np=!0,tp);case"textInput":return e=n.data,e===tp&&np?null:e;default:return null}}function Cb(e,n){if(Zr)return e==="compositionend"||!mc&&ap(e,n)?(e=Kf(),ii=cc=_a=null,Zr=!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 ep&&n.locale!=="ko"?null:n.data;default:return null}}var Eb={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 lp(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Eb[e.type]:n==="textarea"}function sp(e,n,l,i){Xr?Qr?Qr.push(i):Qr=[i]:Xr=i,n=eo(n,"onChange"),0<n.length&&(l=new ui("onChange","change",null,l,i),e.push({event:l,listeners:n}))}var Wl=null,ql=null;function Nb(e){Vh(e,0)}function fi(e){var n=Ul(e);if($f(n))return e}function ip(e,n){if(e==="change")return n}var op=!1;if(ha){var hc;if(ha){var xc="oninput"in document;if(!xc){var cp=document.createElement("div");cp.setAttribute("oninput","return;"),xc=typeof cp.oninput=="function"}hc=xc}else hc=!1;op=hc&&(!document.documentMode||9<document.documentMode)}function up(){Wl&&(Wl.detachEvent("onpropertychange",dp),ql=Wl=null)}function dp(e){if(e.propertyName==="value"&&fi(ql)){var n=[];sp(n,ql,e,sc(e)),Yf(Nb,n)}}function Tb(e,n,l){e==="focusin"?(up(),Wl=n,ql=l,Wl.attachEvent("onpropertychange",dp)):e==="focusout"&&up()}function Rb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return fi(ql)}function Ab(e,n){if(e==="click")return fi(n)}function Mb(e,n){if(e==="input"||e==="change")return fi(n)}function Lb(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var vn=typeof Object.is=="function"?Object.is:Lb;function Yl(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(!rt.call(n,f)||!vn(e[f],n[f]))return!1}return!0}function fp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function pp(e,n){var l=fp(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=fp(l)}}function mp(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?mp(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function hp(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=li(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=li(e.document)}return n}function gc(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 zb=ha&&"documentMode"in document&&11>=document.documentMode,Jr=null,vc=null,Kl=null,yc=!1;function xp(e,n,l){var i=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;yc||Jr==null||Jr!==li(i)||(i=Jr,"selectionStart"in i&&gc(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}),Kl&&Yl(Kl,i)||(Kl=i,i=eo(vc,"onSelect"),0<i.length&&(n=new ui("onSelect","select",null,n,l),e.push({event:n,listeners:i}),n.target=Jr)))}function yr(e,n){var l={};return l[e.toLowerCase()]=n.toLowerCase(),l["Webkit"+e]="webkit"+n,l["Moz"+e]="moz"+n,l}var el={animationend:yr("Animation","AnimationEnd"),animationiteration:yr("Animation","AnimationIteration"),animationstart:yr("Animation","AnimationStart"),transitionrun:yr("Transition","TransitionRun"),transitionstart:yr("Transition","TransitionStart"),transitioncancel:yr("Transition","TransitionCancel"),transitionend:yr("Transition","TransitionEnd")},bc={},gp={};ha&&(gp=document.createElement("div").style,"AnimationEvent"in window||(delete el.animationend.animation,delete el.animationiteration.animation,delete el.animationstart.animation),"TransitionEvent"in window||delete el.transitionend.transition);function br(e){if(bc[e])return bc[e];if(!el[e])return e;var n=el[e],l;for(l in n)if(n.hasOwnProperty(l)&&l in gp)return bc[e]=n[l];return e}var vp=br("animationend"),yp=br("animationiteration"),bp=br("animationstart"),Db=br("transitionrun"),_b=br("transitionstart"),Ob=br("transitioncancel"),jp=br("transitionend"),Sp=new Map,jc="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(" ");jc.push("scrollEnd");function Yn(e,n){Sp.set(e,n),gr(n,[e])}var pi=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Dn=[],tl=0,Sc=0;function mi(){for(var e=tl,n=Sc=tl=0;n<e;){var l=Dn[n];Dn[n++]=null;var i=Dn[n];Dn[n++]=null;var f=Dn[n];Dn[n++]=null;var x=Dn[n];if(Dn[n++]=null,i!==null&&f!==null){var j=i.pending;j===null?f.next=f:(f.next=j.next,j.next=f),i.pending=f}x!==0&&kp(l,f,x)}}function hi(e,n,l,i){Dn[tl++]=e,Dn[tl++]=n,Dn[tl++]=l,Dn[tl++]=i,Sc|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function kc(e,n,l,i){return hi(e,n,l,i),xi(e)}function jr(e,n){return hi(e,null,null,n),xi(e)}function kp(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-St(l),e=x.hiddenUpdates,i=e[f],i===null?e[f]=[n]:i.push(n),n.lane=l|536870912),x):null}function xi(e){if(50<gs)throw gs=0,Lu=null,Error(o(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var nl={};function Bb(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 Bb(e,n,l,i)}function wc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function xa(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 wp(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 gi(e,n,l,i,f,x){var j=0;if(i=e,typeof e=="function")wc(e)&&(j=1);else if(typeof e=="string")j=V1(e,l,te.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 Sr(l.children,f,x,n);case C:j=8,f|=24;break;case T:return e=yn(12,l,n,f|2),e.elementType=T,e.lanes=x,e;case D:return e=yn(13,l,n,f),e.elementType=D,e.lanes=x,e;case F:return e=yn(19,l,n,f),e.elementType=F,e.lanes=x,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case M:j=10;break e;case R:j=9;break e;case B:j=11;break e;case E:j=14;break e;case H: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 Sr(e,n,l,i){return e=yn(7,e,i,n),e.lanes=l,e}function Cc(e,n,l){return e=yn(6,e,null,n),e.lanes=l,e}function Cp(e){var n=yn(18,null,null,0);return n.stateNode=e,n}function Ec(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 Ep=new WeakMap;function _n(e,n){if(typeof e=="object"&&e!==null){var l=Ep.get(e);return l!==void 0?l:(n={value:e,source:n,stack:Oe(n)},Ep.set(e,n),n)}return{value:e,source:n,stack:Oe(n)}}var al=[],rl=0,vi=null,Xl=0,On=[],Bn=0,Oa=null,ra=1,la="";function ga(e,n){al[rl++]=Xl,al[rl++]=vi,vi=e,Xl=n}function Np(e,n,l){On[Bn++]=ra,On[Bn++]=la,On[Bn++]=Oa,Oa=e;var i=ra;e=la;var f=32-St(i)-1;i&=~(1<<f),l+=1;var x=32-St(n)+f;if(30<x){var j=f-f%5;x=(i&(1<<j)-1).toString(32),i>>=j,f-=j,ra=1<<32-St(n)+f|l<<f|i,la=x+e}else ra=1<<x|l<<f|i,la=e}function Nc(e){e.return!==null&&(ga(e,1),Np(e,1,0))}function Tc(e){for(;e===vi;)vi=al[--rl],al[rl]=null,Xl=al[--rl],al[rl]=null;for(;e===Oa;)Oa=On[--Bn],On[Bn]=null,la=On[--Bn],On[Bn]=null,ra=On[--Bn],On[Bn]=null}function Tp(e,n){On[Bn++]=ra,On[Bn++]=la,On[Bn++]=Oa,ra=n.id,la=n.overflow,Oa=e}var Kt=null,vt=null,Ke=!1,Ba=null,In=!1,Rc=Error(o(519));function Ia(e){var n=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ql(_n(n,e)),Rc}function Rp(e){var n=e.stateNode,l=e.type,i=e.memoizedProps;switch(n[Ut]=e,n[ot]=i,l){case"dialog":We("cancel",n),We("close",n);break;case"iframe":case"object":case"embed":We("load",n);break;case"video":case"audio":for(l=0;l<ys.length;l++)We(ys[l],n);break;case"source":We("error",n);break;case"img":case"image":case"link":We("error",n),We("load",n);break;case"details":We("toggle",n);break;case"input":We("invalid",n),Vf(n,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":We("invalid",n);break;case"textarea":We("invalid",n),Ff(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||Wh(n.textContent,l)?(i.popover!=null&&(We("beforetoggle",n),We("toggle",n)),i.onScroll!=null&&We("scroll",n),i.onScrollEnd!=null&&We("scrollend",n),i.onClick!=null&&(n.onclick=ma),n=!0):n=!1,n||Ia(e,!0)}function Ap(e){for(Kt=e.return;Kt;)switch(Kt.tag){case 5:case 31:case 13:In=!1;return;case 27:case 3:In=!0;return;default:Kt=Kt.return}}function ll(e){if(e!==Kt)return!1;if(!Ke)return Ap(e),Ke=!0,!1;var n=e.tag,l;if((l=n!==3&&n!==27)&&((l=n===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||qu(e.type,e.memoizedProps)),l=!l),l&&vt&&Ia(e),Ap(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));vt=tx(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));vt=tx(e)}else n===27?(n=vt,Za(e.type)?(e=Zu,Zu=null,vt=e):vt=n):vt=Kt?Un(e.stateNode.nextSibling):null;return!0}function kr(){vt=Kt=null,Ke=!1}function Ac(){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 Mc=L(null),wr=null,va=null;function Ha(e,n,l){W(Mc,n._currentValue),n._currentValue=l}function ya(e){e._currentValue=Mc.current,q(Mc)}function Lc(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 zc(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 V=0;V<n.length;V++)if(A.context===n[V]){x.lanes|=l,A=x.alternate,A!==null&&(A.lanes|=l),Lc(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),Lc(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 sl(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===ve.current){if(j=f.alternate,j===null)throw Error(o(387));j.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(ws):e=[ws])}f=f.return}e!==null&&zc(n,e,l,i),n.flags|=262144}function yi(e){for(e=e.firstContext;e!==null;){if(!vn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Cr(e){wr=e,va=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Xt(e){return Mp(wr,e)}function bi(e,n){return wr===null&&Cr(e),Mp(e,n)}function Mp(e,n){var l=n._currentValue;if(n={context:n,memoizedValue:l,next:null},va===null){if(e===null)throw Error(o(308));va=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else va=va.next=n;return l}var Ib=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()})}},Hb=t.unstable_scheduleCallback,Ub=t.unstable_NormalPriority,_t={$$typeof:M,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Dc(){return{controller:new Ib,data:new Map,refCount:0}}function Zl(e){e.refCount--,e.refCount===0&&Hb(Ub,function(){e.controller.abort()})}var Jl=null,_c=0,il=0,ol=null;function $b(e,n){if(Jl===null){var l=Jl=[];_c=0,il=Iu(),ol={status:"pending",value:void 0,then:function(i){l.push(i)}}}return _c++,n.then(Lp,Lp),n}function Lp(){if(--_c===0&&Jl!==null){ol!==null&&(ol.status="fulfilled");var e=Jl;Jl=null,il=0,ol=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function Vb(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 zp=z.S;z.S=function(e,n){xh=Qe(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&$b(e,n),zp!==null&&zp(e,n)};var Er=L(null);function Oc(){var e=Er.current;return e!==null?e:mt.pooledCache}function ji(e,n){n===null?W(Er,Er.current):W(Er,n.pool)}function Dp(){var e=Oc();return e===null?null:{parent:_t._currentValue,pool:e}}var cl=Error(o(460)),Bc=Error(o(474)),Si=Error(o(542)),ki={then:function(){}};function _p(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Op(e,n,l){switch(l=e[l],l===void 0?e.push(n):l!==n&&(n.then(ma,ma),n=l),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Ip(e),e;default:if(typeof n.status=="string")n.then(ma,ma);else{if(e=mt,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,Ip(e),e}throw Tr=n,cl}}function Nr(e){try{var n=e._init;return n(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Tr=l,cl):l}}var Tr=null;function Bp(){if(Tr===null)throw Error(o(459));var e=Tr;return Tr=null,e}function Ip(e){if(e===cl||e===Si)throw Error(o(483))}var ul=null,es=0;function wi(e){var n=es;return es+=1,ul===null&&(ul=[]),Op(ul,e,n)}function ts(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Ci(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 Hp(e){function n(Y,G){if(e){var Q=Y.deletions;Q===null?(Y.deletions=[G],Y.flags|=16):Q.push(G)}}function l(Y,G){if(!e)return null;for(;G!==null;)n(Y,G),G=G.sibling;return null}function i(Y){for(var G=new Map;Y!==null;)Y.key!==null?G.set(Y.key,Y):G.set(Y.index,Y),Y=Y.sibling;return G}function f(Y,G){return Y=xa(Y,G),Y.index=0,Y.sibling=null,Y}function x(Y,G,Q){return Y.index=Q,e?(Q=Y.alternate,Q!==null?(Q=Q.index,Q<G?(Y.flags|=67108866,G):Q):(Y.flags|=67108866,G)):(Y.flags|=1048576,G)}function j(Y){return e&&Y.alternate===null&&(Y.flags|=67108866),Y}function A(Y,G,Q,ce){return G===null||G.tag!==6?(G=Cc(Q,Y.mode,ce),G.return=Y,G):(G=f(G,Q),G.return=Y,G)}function V(Y,G,Q,ce){var Me=Q.type;return Me===w?le(Y,G,Q.props.children,ce,Q.key):G!==null&&(G.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===H&&Nr(Me)===G.type)?(G=f(G,Q.props),ts(G,Q),G.return=Y,G):(G=gi(Q.type,Q.key,Q.props,null,Y.mode,ce),ts(G,Q),G.return=Y,G)}function Z(Y,G,Q,ce){return G===null||G.tag!==4||G.stateNode.containerInfo!==Q.containerInfo||G.stateNode.implementation!==Q.implementation?(G=Ec(Q,Y.mode,ce),G.return=Y,G):(G=f(G,Q.children||[]),G.return=Y,G)}function le(Y,G,Q,ce,Me){return G===null||G.tag!==7?(G=Sr(Q,Y.mode,ce,Me),G.return=Y,G):(G=f(G,Q),G.return=Y,G)}function ue(Y,G,Q){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=Cc(""+G,Y.mode,Q),G.return=Y,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case k:return Q=gi(G.type,G.key,G.props,null,Y.mode,Q),ts(Q,G),Q.return=Y,Q;case S:return G=Ec(G,Y.mode,Q),G.return=Y,G;case H:return G=Nr(G),ue(Y,G,Q)}if($(G)||K(G))return G=Sr(G,Y.mode,Q,null),G.return=Y,G;if(typeof G.then=="function")return ue(Y,wi(G),Q);if(G.$$typeof===M)return ue(Y,bi(Y,G),Q);Ci(Y,G)}return null}function J(Y,G,Q,ce){var Me=G!==null?G.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Me!==null?null:A(Y,G,""+Q,ce);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case k:return Q.key===Me?V(Y,G,Q,ce):null;case S:return Q.key===Me?Z(Y,G,Q,ce):null;case H:return Q=Nr(Q),J(Y,G,Q,ce)}if($(Q)||K(Q))return Me!==null?null:le(Y,G,Q,ce,null);if(typeof Q.then=="function")return J(Y,G,wi(Q),ce);if(Q.$$typeof===M)return J(Y,G,bi(Y,Q),ce);Ci(Y,Q)}return null}function ae(Y,G,Q,ce,Me){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return Y=Y.get(Q)||null,A(G,Y,""+ce,Me);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case k:return Y=Y.get(ce.key===null?Q:ce.key)||null,V(G,Y,ce,Me);case S:return Y=Y.get(ce.key===null?Q:ce.key)||null,Z(G,Y,ce,Me);case H:return ce=Nr(ce),ae(Y,G,Q,ce,Me)}if($(ce)||K(ce))return Y=Y.get(Q)||null,le(G,Y,ce,Me,null);if(typeof ce.then=="function")return ae(Y,G,Q,wi(ce),Me);if(ce.$$typeof===M)return ae(Y,G,Q,bi(G,ce),Me);Ci(G,ce)}return null}function we(Y,G,Q,ce){for(var Me=null,Ze=null,Ne=G,Ve=G=0,Ye=null;Ne!==null&&Ve<Q.length;Ve++){Ne.index>Ve?(Ye=Ne,Ne=null):Ye=Ne.sibling;var Je=J(Y,Ne,Q[Ve],ce);if(Je===null){Ne===null&&(Ne=Ye);break}e&&Ne&&Je.alternate===null&&n(Y,Ne),G=x(Je,G,Ve),Ze===null?Me=Je:Ze.sibling=Je,Ze=Je,Ne=Ye}if(Ve===Q.length)return l(Y,Ne),Ke&&ga(Y,Ve),Me;if(Ne===null){for(;Ve<Q.length;Ve++)Ne=ue(Y,Q[Ve],ce),Ne!==null&&(G=x(Ne,G,Ve),Ze===null?Me=Ne:Ze.sibling=Ne,Ze=Ne);return Ke&&ga(Y,Ve),Me}for(Ne=i(Ne);Ve<Q.length;Ve++)Ye=ae(Ne,Y,Ve,Q[Ve],ce),Ye!==null&&(e&&Ye.alternate!==null&&Ne.delete(Ye.key===null?Ve:Ye.key),G=x(Ye,G,Ve),Ze===null?Me=Ye:Ze.sibling=Ye,Ze=Ye);return e&&Ne.forEach(function(ar){return n(Y,ar)}),Ke&&ga(Y,Ve),Me}function Le(Y,G,Q,ce){if(Q==null)throw Error(o(151));for(var Me=null,Ze=null,Ne=G,Ve=G=0,Ye=null,Je=Q.next();Ne!==null&&!Je.done;Ve++,Je=Q.next()){Ne.index>Ve?(Ye=Ne,Ne=null):Ye=Ne.sibling;var ar=J(Y,Ne,Je.value,ce);if(ar===null){Ne===null&&(Ne=Ye);break}e&&Ne&&ar.alternate===null&&n(Y,Ne),G=x(ar,G,Ve),Ze===null?Me=ar:Ze.sibling=ar,Ze=ar,Ne=Ye}if(Je.done)return l(Y,Ne),Ke&&ga(Y,Ve),Me;if(Ne===null){for(;!Je.done;Ve++,Je=Q.next())Je=ue(Y,Je.value,ce),Je!==null&&(G=x(Je,G,Ve),Ze===null?Me=Je:Ze.sibling=Je,Ze=Je);return Ke&&ga(Y,Ve),Me}for(Ne=i(Ne);!Je.done;Ve++,Je=Q.next())Je=ae(Ne,Y,Ve,Je.value,ce),Je!==null&&(e&&Je.alternate!==null&&Ne.delete(Je.key===null?Ve:Je.key),G=x(Je,G,Ve),Ze===null?Me=Je:Ze.sibling=Je,Ze=Je);return e&&Ne.forEach(function(J1){return n(Y,J1)}),Ke&&ga(Y,Ve),Me}function dt(Y,G,Q,ce){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 Me=Q.key;G!==null;){if(G.key===Me){if(Me=Q.type,Me===w){if(G.tag===7){l(Y,G.sibling),ce=f(G,Q.props.children),ce.return=Y,Y=ce;break e}}else if(G.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===H&&Nr(Me)===G.type){l(Y,G.sibling),ce=f(G,Q.props),ts(ce,Q),ce.return=Y,Y=ce;break e}l(Y,G);break}else n(Y,G);G=G.sibling}Q.type===w?(ce=Sr(Q.props.children,Y.mode,ce,Q.key),ce.return=Y,Y=ce):(ce=gi(Q.type,Q.key,Q.props,null,Y.mode,ce),ts(ce,Q),ce.return=Y,Y=ce)}return j(Y);case S:e:{for(Me=Q.key;G!==null;){if(G.key===Me)if(G.tag===4&&G.stateNode.containerInfo===Q.containerInfo&&G.stateNode.implementation===Q.implementation){l(Y,G.sibling),ce=f(G,Q.children||[]),ce.return=Y,Y=ce;break e}else{l(Y,G);break}else n(Y,G);G=G.sibling}ce=Ec(Q,Y.mode,ce),ce.return=Y,Y=ce}return j(Y);case H:return Q=Nr(Q),dt(Y,G,Q,ce)}if($(Q))return we(Y,G,Q,ce);if(K(Q)){if(Me=K(Q),typeof Me!="function")throw Error(o(150));return Q=Me.call(Q),Le(Y,G,Q,ce)}if(typeof Q.then=="function")return dt(Y,G,wi(Q),ce);if(Q.$$typeof===M)return dt(Y,G,bi(Y,Q),ce);Ci(Y,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,G!==null&&G.tag===6?(l(Y,G.sibling),ce=f(G,Q),ce.return=Y,Y=ce):(l(Y,G),ce=Cc(Q,Y.mode,ce),ce.return=Y,Y=ce),j(Y)):l(Y,G)}return function(Y,G,Q,ce){try{es=0;var Me=dt(Y,G,Q,ce);return ul=null,Me}catch(Ne){if(Ne===cl||Ne===Si)throw Ne;var Ze=yn(29,Ne,null,Y.mode);return Ze.lanes=ce,Ze.return=Y,Ze}finally{}}}var Rr=Hp(!0),Up=Hp(!1),Ua=!1;function Ic(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Hc(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,(nt&2)!==0){var f=i.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),i.pending=n,n=xi(e),kp(e,null,l),n}return hi(e,i,n,l),xi(e)}function ns(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,pr(e,l)}}function Uc(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 $c=!1;function as(){if($c){var e=ol;if(e!==null)throw e}}function rs(e,n,l,i){$c=!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 V=A,Z=V.next;V.next=null,j===null?x=Z:j.next=Z,j=V;var le=e.alternate;le!==null&&(le=le.updateQueue,A=le.lastBaseUpdate,A!==j&&(A===null?le.firstBaseUpdate=Z:A.next=Z,le.lastBaseUpdate=V))}if(x!==null){var ue=f.baseState;j=0,le=Z=V=null,A=x;do{var J=A.lane&-536870913,ae=J!==A.lane;if(ae?(qe&J)===J:(i&J)===J){J!==0&&J===il&&($c=!0),le!==null&&(le=le.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var we=e,Le=A;J=n;var dt=l;switch(Le.tag){case 1:if(we=Le.payload,typeof we=="function"){ue=we.call(dt,ue,J);break e}ue=we;break e;case 3:we.flags=we.flags&-65537|128;case 0:if(we=Le.payload,J=typeof we=="function"?we.call(dt,ue,J):we,J==null)break e;ue=v({},ue,J);break e;case 2:Ua=!0}}J=A.callback,J!==null&&(e.flags|=64,ae&&(e.flags|=8192),ae=f.callbacks,ae===null?f.callbacks=[J]:ae.push(J))}else ae={lane:J,tag:A.tag,payload:A.payload,callback:A.callback,next:null},le===null?(Z=le=ae,V=ue):le=le.next=ae,j|=J;if(A=A.next,A===null){if(A=f.shared.pending,A===null)break;ae=A,A=ae.next,ae.next=null,f.lastBaseUpdate=ae,f.shared.pending=null}}while(!0);le===null&&(V=ue),f.baseState=V,f.firstBaseUpdate=Z,f.lastBaseUpdate=le,x===null&&(f.shared.lanes=0),qa|=j,e.lanes=j,e.memoizedState=ue}}function $p(e,n){if(typeof e!="function")throw Error(o(191,e));e.call(n)}function Vp(e,n){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)$p(l[e],n)}var dl=L(null),Ei=L(0);function Pp(e,n){e=Ta,W(Ei,e),W(dl,n),Ta=e|n.baseLanes}function Vc(){W(Ei,Ta),W(dl,dl.current)}function Pc(){Ta=Ei.current,q(dl),q(Ei)}var bn=L(null),Hn=null;function Pa(e){var n=e.alternate;W(Lt,Lt.current&1),W(bn,e),Hn===null&&(n===null||dl.current!==null||n.memoizedState!==null)&&(Hn=e)}function Fc(e){W(Lt,Lt.current),W(bn,e),Hn===null&&(Hn=e)}function Fp(e){e.tag===22?(W(Lt,Lt.current),W(bn,e),Hn===null&&(Hn=e)):Fa()}function Fa(){W(Lt,Lt.current),W(bn,bn.current)}function jn(e){q(bn),Hn===e&&(Hn=null),q(Lt)}var Lt=L(0);function Ni(e){for(var n=e;n!==null;){if(n.tag===13){var l=n.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Xu(l)||Qu(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 ba=0,Ue=null,ct=null,Ot=null,Ti=!1,fl=!1,Ar=!1,Ri=0,ls=0,pl=null,Pb=0;function Rt(){throw Error(o(321))}function Gc(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 Wc(e,n,l,i,f,x){return ba=x,Ue=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,z.H=e===null||e.memoizedState===null?Nm:iu,Ar=!1,x=l(i,f),Ar=!1,fl&&(x=Wp(n,l,i,f)),Gp(e),x}function Gp(e){z.H=os;var n=ct!==null&&ct.next!==null;if(ba=0,Ot=ct=Ue=null,Ti=!1,ls=0,pl=null,n)throw Error(o(300));e===null||Bt||(e=e.dependencies,e!==null&&yi(e)&&(Bt=!0))}function Wp(e,n,l,i){Ue=e;var f=0;do{if(fl&&(pl=null),ls=0,fl=!1,25<=f)throw Error(o(301));if(f+=1,Ot=ct=null,e.updateQueue!=null){var x=e.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}z.H=Tm,x=n(l,i)}while(fl);return x}function Fb(){var e=z.H,n=e.useState()[0];return n=typeof n.then=="function"?ss(n):n,e=e.useState()[0],(ct!==null?ct.memoizedState:null)!==e&&(Ue.flags|=1024),n}function qc(){var e=Ri!==0;return Ri=0,e}function Yc(e,n,l){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~l}function Kc(e){if(Ti){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Ti=!1}ba=0,Ot=ct=Ue=null,fl=!1,ls=Ri=0,pl=null}function rn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ot===null?Ue.memoizedState=Ot=e:Ot=Ot.next=e,Ot}function zt(){if(ct===null){var e=Ue.alternate;e=e!==null?e.memoizedState:null}else e=ct.next;var n=Ot===null?Ue.memoizedState:Ot.next;if(n!==null)Ot=n,ct=e;else{if(e===null)throw Ue.alternate===null?Error(o(467)):Error(o(310));ct=e,e={memoizedState:ct.memoizedState,baseState:ct.baseState,baseQueue:ct.baseQueue,queue:ct.queue,next:null},Ot===null?Ue.memoizedState=Ot=e:Ot=Ot.next=e}return Ot}function Ai(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ss(e){var n=ls;return ls+=1,pl===null&&(pl=[]),e=Op(pl,e,n),n=Ue,(Ot===null?n.memoizedState:Ot.next)===null&&(n=n.alternate,z.H=n===null||n.memoizedState===null?Nm:iu),e}function Mi(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ss(e);if(e.$$typeof===M)return Xt(e)}throw Error(o(438,String(e)))}function Xc(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=Ai(),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 ja(e,n){return typeof n=="function"?n(e):n}function Li(e){var n=zt();return Qc(n,ct,e)}function Qc(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,V=null,Z=n,le=!1;do{var ue=Z.lane&-536870913;if(ue!==Z.lane?(qe&ue)===ue:(ba&ue)===ue){var J=Z.revertLane;if(J===0)V!==null&&(V=V.next={lane:0,revertLane:0,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null}),ue===il&&(le=!0);else if((ba&J)===J){Z=Z.next,J===il&&(le=!0);continue}else ue={lane:0,revertLane:Z.revertLane,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},V===null?(A=V=ue,j=x):V=V.next=ue,Ue.lanes|=J,qa|=J;ue=Z.action,Ar&&l(x,ue),x=Z.hasEagerState?Z.eagerState:l(x,ue)}else J={lane:ue,revertLane:Z.revertLane,gesture:Z.gesture,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},V===null?(A=V=J,j=x):V=V.next=J,Ue.lanes|=ue,qa|=ue;Z=Z.next}while(Z!==null&&Z!==n);if(V===null?j=x:V.next=A,!vn(x,e.memoizedState)&&(Bt=!0,le&&(l=ol,l!==null)))throw l;e.memoizedState=x,e.baseState=j,e.baseQueue=V,i.lastRenderedState=x}return f===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function Zc(e){var n=zt(),l=n.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=e;var i=l.dispatch,f=l.pending,x=n.memoizedState;if(f!==null){l.pending=null;var j=f=f.next;do x=e(x,j.action),j=j.next;while(j!==f);vn(x,n.memoizedState)||(Bt=!0),n.memoizedState=x,n.baseQueue===null&&(n.baseState=x),l.lastRenderedState=x}return[x,i]}function qp(e,n,l){var i=Ue,f=zt(),x=Ke;if(x){if(l===void 0)throw Error(o(407));l=l()}else l=n();var j=!vn((ct||f).memoizedState,l);if(j&&(f.memoizedState=l,Bt=!0),f=f.queue,tu(Xp.bind(null,i,f,e),[e]),f.getSnapshot!==n||j||Ot!==null&&Ot.memoizedState.tag&1){if(i.flags|=2048,ml(9,{destroy:void 0},Kp.bind(null,i,f,l,n),null),mt===null)throw Error(o(349));x||(ba&127)!==0||Yp(i,n,l)}return l}function Yp(e,n,l){e.flags|=16384,e={getSnapshot:n,value:l},n=Ue.updateQueue,n===null?(n=Ai(),Ue.updateQueue=n,n.stores=[e]):(l=n.stores,l===null?n.stores=[e]:l.push(e))}function Kp(e,n,l,i){n.value=l,n.getSnapshot=i,Qp(n)&&Zp(e)}function Xp(e,n,l){return l(function(){Qp(n)&&Zp(e)})}function Qp(e){var n=e.getSnapshot;e=e.value;try{var l=n();return!vn(e,l)}catch{return!0}}function Zp(e){var n=jr(e,2);n!==null&&gn(n,e,2)}function Jc(e){var n=rn();if(typeof e=="function"){var l=e;if(e=l(),Ar){xt(!0);try{l()}finally{xt(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ja,lastRenderedState:e},n}function Jp(e,n,l,i){return e.baseState=l,Qc(e,ct,typeof i=="function"?i:ja)}function Gb(e,n,l,i,f){if(_i(e))throw Error(o(485));if(e=n.action,e!==null){var x={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(j){x.listeners.push(j)}};z.T!==null?l(!0):x.isTransition=!1,i(x),l=n.pending,l===null?(x.next=n.pending=x,em(n,x)):(x.next=l.next,n.pending=l.next=x)}}function em(e,n){var l=n.action,i=n.payload,f=e.state;if(n.isTransition){var x=z.T,j={};z.T=j;try{var A=l(f,i),V=z.S;V!==null&&V(j,A),tm(e,n,A)}catch(Z){eu(e,n,Z)}finally{x!==null&&j.types!==null&&(x.types=j.types),z.T=x}}else try{x=l(f,i),tm(e,n,x)}catch(Z){eu(e,n,Z)}}function tm(e,n,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(i){nm(e,n,i)},function(i){return eu(e,n,i)}):nm(e,n,l)}function nm(e,n,l){n.status="fulfilled",n.value=l,am(n),e.state=l,n=e.pending,n!==null&&(l=n.next,l===n?e.pending=null:(l=l.next,n.next=l,em(e,l)))}function eu(e,n,l){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do n.status="rejected",n.reason=l,am(n),n=n.next;while(n!==i)}e.action=null}function am(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function rm(e,n){return n}function lm(e,n){if(Ke){var l=mt.formState;if(l!==null){e:{var i=Ue;if(Ke){if(vt){t:{for(var f=vt,x=In;f.nodeType!==8;){if(!x){f=null;break t}if(f=Un(f.nextSibling),f===null){f=null;break t}}x=f.data,f=x==="F!"||x==="F"?f:null}if(f){vt=Un(f.nextSibling),i=f.data==="F!";break e}}Ia(i)}i=!1}i&&(n=l[0])}}return l=rn(),l.memoizedState=l.baseState=n,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rm,lastRenderedState:n},l.queue=i,l=wm.bind(null,Ue,i),i.dispatch=l,i=Jc(!1),x=su.bind(null,Ue,!1,i.queue),i=rn(),f={state:n,dispatch:null,action:e,pending:null},i.queue=f,l=Gb.bind(null,Ue,f,x,l),f.dispatch=l,i.memoizedState=e,[n,l,!1]}function sm(e){var n=zt();return im(n,ct,e)}function im(e,n,l){if(n=Qc(e,n,rm)[0],e=Li(ja)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var i=ss(n)}catch(j){throw j===cl?Si:j}else i=n;n=zt();var f=n.queue,x=f.dispatch;return l!==n.memoizedState&&(Ue.flags|=2048,ml(9,{destroy:void 0},Wb.bind(null,f,l),null)),[i,x,e]}function Wb(e,n){e.action=n}function om(e){var n=zt(),l=ct;if(l!==null)return im(n,l,e);zt(),n=n.memoizedState,l=zt();var i=l.queue.dispatch;return l.memoizedState=e,[n,i,!1]}function ml(e,n,l,i){return e={tag:e,create:l,deps:i,inst:n,next:null},n=Ue.updateQueue,n===null&&(n=Ai(),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 cm(){return zt().memoizedState}function zi(e,n,l,i){var f=rn();Ue.flags|=e,f.memoizedState=ml(1|n,{destroy:void 0},l,i===void 0?null:i)}function Di(e,n,l,i){var f=zt();i=i===void 0?null:i;var x=f.memoizedState.inst;ct!==null&&i!==null&&Gc(i,ct.memoizedState.deps)?f.memoizedState=ml(n,x,l,i):(Ue.flags|=e,f.memoizedState=ml(1|n,x,l,i))}function um(e,n){zi(8390656,8,e,n)}function tu(e,n){Di(2048,8,e,n)}function qb(e){Ue.flags|=4;var n=Ue.updateQueue;if(n===null)n=Ai(),Ue.updateQueue=n,n.events=[e];else{var l=n.events;l===null?n.events=[e]:l.push(e)}}function dm(e){var n=zt().memoizedState;return qb({ref:n,nextImpl:e}),function(){if((nt&2)!==0)throw Error(o(440));return n.impl.apply(void 0,arguments)}}function fm(e,n){return Di(4,2,e,n)}function pm(e,n){return Di(4,4,e,n)}function mm(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 hm(e,n,l){l=l!=null?l.concat([e]):null,Di(4,4,mm.bind(null,n,e),l)}function nu(){}function xm(e,n){var l=zt();n=n===void 0?null:n;var i=l.memoizedState;return n!==null&&Gc(n,i[1])?i[0]:(l.memoizedState=[e,n],e)}function gm(e,n){var l=zt();n=n===void 0?null:n;var i=l.memoizedState;if(n!==null&&Gc(n,i[1]))return i[0];if(i=e(),Ar){xt(!0);try{e()}finally{xt(!1)}}return l.memoizedState=[i,n],i}function au(e,n,l){return l===void 0||(ba&1073741824)!==0&&(qe&261930)===0?e.memoizedState=n:(e.memoizedState=l,e=vh(),Ue.lanes|=e,qa|=e,l)}function vm(e,n,l,i){return vn(l,n)?l:dl.current!==null?(e=au(e,l,i),vn(e,n)||(Bt=!0),e):(ba&42)===0||(ba&1073741824)!==0&&(qe&261930)===0?(Bt=!0,e.memoizedState=l):(e=vh(),Ue.lanes|=e,qa|=e,n)}function ym(e,n,l,i,f){var x=I.p;I.p=x!==0&&8>x?x:8;var j=z.T,A={};z.T=A,su(e,!1,n,l);try{var V=f(),Z=z.S;if(Z!==null&&Z(A,V),V!==null&&typeof V=="object"&&typeof V.then=="function"){var le=Vb(V,i);is(e,n,le,wn(e))}else is(e,n,i,wn(e))}catch(ue){is(e,n,{then:function(){},status:"rejected",reason:ue},wn())}finally{I.p=x,j!==null&&A.types!==null&&(j.types=A.types),z.T=j}}function Yb(){}function ru(e,n,l,i){if(e.tag!==5)throw Error(o(476));var f=bm(e).queue;ym(e,f,n,O,l===null?Yb:function(){return jm(e),l(i)})}function bm(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:O,baseState:O,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ja,lastRenderedState:O},next:null};var l={};return n.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ja,lastRenderedState:l},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function jm(e){var n=bm(e);n.next===null&&(n=e.alternate.memoizedState),is(e,n.next.queue,{},wn())}function lu(){return Xt(ws)}function Sm(){return zt().memoizedState}function km(){return zt().memoizedState}function Kb(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),ns(i,n,l)),n={cache:Dc()},e.payload=n;return}n=n.return}}function Xb(e,n,l){var i=wn();l={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},_i(e)?Cm(n,l):(l=kc(e,n,l,i),l!==null&&(gn(l,e,i),Em(l,n,i)))}function wm(e,n,l){var i=wn();is(e,n,l,i)}function is(e,n,l,i){var f={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(_i(e))Cm(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 hi(e,n,f,0),mt===null&&mi(),!1}catch{}finally{}if(l=kc(e,n,f,i),l!==null)return gn(l,e,i),Em(l,n,i),!0}return!1}function su(e,n,l,i){if(i={lane:2,revertLane:Iu(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},_i(e)){if(n)throw Error(o(479))}else n=kc(e,l,i,2),n!==null&&gn(n,e,2)}function _i(e){var n=e.alternate;return e===Ue||n!==null&&n===Ue}function Cm(e,n){fl=Ti=!0;var l=e.pending;l===null?n.next=n:(n.next=l.next,l.next=n),e.pending=n}function Em(e,n,l){if((l&4194048)!==0){var i=n.lanes;i&=e.pendingLanes,l|=i,n.lanes=l,pr(e,l)}}var os={readContext:Xt,use:Mi,useCallback:Rt,useContext:Rt,useEffect:Rt,useImperativeHandle:Rt,useLayoutEffect:Rt,useInsertionEffect:Rt,useMemo:Rt,useReducer:Rt,useRef:Rt,useState:Rt,useDebugValue:Rt,useDeferredValue:Rt,useTransition:Rt,useSyncExternalStore:Rt,useId:Rt,useHostTransitionStatus:Rt,useFormState:Rt,useActionState:Rt,useOptimistic:Rt,useMemoCache:Rt,useCacheRefresh:Rt};os.useEffectEvent=Rt;var Nm={readContext:Xt,use:Mi,useCallback:function(e,n){return rn().memoizedState=[e,n===void 0?null:n],e},useContext:Xt,useEffect:um,useImperativeHandle:function(e,n,l){l=l!=null?l.concat([e]):null,zi(4194308,4,mm.bind(null,n,e),l)},useLayoutEffect:function(e,n){return zi(4194308,4,e,n)},useInsertionEffect:function(e,n){zi(4,2,e,n)},useMemo:function(e,n){var l=rn();n=n===void 0?null:n;var i=e();if(Ar){xt(!0);try{e()}finally{xt(!1)}}return l.memoizedState=[i,n],i},useReducer:function(e,n,l){var i=rn();if(l!==void 0){var f=l(n);if(Ar){xt(!0);try{l(n)}finally{xt(!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=Xb.bind(null,Ue,e),[i.memoizedState,e]},useRef:function(e){var n=rn();return e={current:e},n.memoizedState=e},useState:function(e){e=Jc(e);var n=e.queue,l=wm.bind(null,Ue,n);return n.dispatch=l,[e.memoizedState,l]},useDebugValue:nu,useDeferredValue:function(e,n){var l=rn();return au(l,e,n)},useTransition:function(){var e=Jc(!1);return e=ym.bind(null,Ue,e.queue,!0,!1),rn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,l){var i=Ue,f=rn();if(Ke){if(l===void 0)throw Error(o(407));l=l()}else{if(l=n(),mt===null)throw Error(o(349));(qe&127)!==0||Yp(i,n,l)}f.memoizedState=l;var x={value:l,getSnapshot:n};return f.queue=x,um(Xp.bind(null,i,x,e),[e]),i.flags|=2048,ml(9,{destroy:void 0},Kp.bind(null,i,x,l,n),null),l},useId:function(){var e=rn(),n=mt.identifierPrefix;if(Ke){var l=la,i=ra;l=(i&~(1<<32-St(i)-1)).toString(32)+l,n="_"+n+"R_"+l,l=Ri++,0<l&&(n+="H"+l.toString(32)),n+="_"}else l=Pb++,n="_"+n+"r_"+l.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:lu,useFormState:lm,useActionState:lm,useOptimistic:function(e){var n=rn();n.memoizedState=n.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=l,n=su.bind(null,Ue,!0,l),l.dispatch=n,[e,n]},useMemoCache:Xc,useCacheRefresh:function(){return rn().memoizedState=Kb.bind(null,Ue)},useEffectEvent:function(e){var n=rn(),l={impl:e};return n.memoizedState=l,function(){if((nt&2)!==0)throw Error(o(440));return l.impl.apply(void 0,arguments)}}},iu={readContext:Xt,use:Mi,useCallback:xm,useContext:Xt,useEffect:tu,useImperativeHandle:hm,useInsertionEffect:fm,useLayoutEffect:pm,useMemo:gm,useReducer:Li,useRef:cm,useState:function(){return Li(ja)},useDebugValue:nu,useDeferredValue:function(e,n){var l=zt();return vm(l,ct.memoizedState,e,n)},useTransition:function(){var e=Li(ja)[0],n=zt().memoizedState;return[typeof e=="boolean"?e:ss(e),n]},useSyncExternalStore:qp,useId:Sm,useHostTransitionStatus:lu,useFormState:sm,useActionState:sm,useOptimistic:function(e,n){var l=zt();return Jp(l,ct,e,n)},useMemoCache:Xc,useCacheRefresh:km};iu.useEffectEvent=dm;var Tm={readContext:Xt,use:Mi,useCallback:xm,useContext:Xt,useEffect:tu,useImperativeHandle:hm,useInsertionEffect:fm,useLayoutEffect:pm,useMemo:gm,useReducer:Zc,useRef:cm,useState:function(){return Zc(ja)},useDebugValue:nu,useDeferredValue:function(e,n){var l=zt();return ct===null?au(l,e,n):vm(l,ct.memoizedState,e,n)},useTransition:function(){var e=Zc(ja)[0],n=zt().memoizedState;return[typeof e=="boolean"?e:ss(e),n]},useSyncExternalStore:qp,useId:Sm,useHostTransitionStatus:lu,useFormState:om,useActionState:om,useOptimistic:function(e,n){var l=zt();return ct!==null?Jp(l,ct,e,n):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:Xc,useCacheRefresh:km};Tm.useEffectEvent=dm;function ou(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 cu={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),ns(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),ns(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),ns(n,e,l))}};function Rm(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?!Yl(l,i)||!Yl(f,x):!0}function Am(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&&cu.enqueueReplaceState(n,n.state,null)}function Mr(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 Mm(e){pi(e)}function Lm(e){console.error(e)}function zm(e){pi(e)}function Oi(e,n){try{var l=e.onUncaughtError;l(n.value,{componentStack:n.stack})}catch(i){setTimeout(function(){throw i})}}function Dm(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 uu(e,n,l){return l=$a(l),l.tag=3,l.payload={element:null},l.callback=function(){Oi(e,n)},l}function _m(e){return e=$a(e),e.tag=3,e}function Om(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(){Dm(n,l,i)}}var j=l.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(e.callback=function(){Dm(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 Qb(e,n,l,i,f){if(l.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(n=l.alternate,n!==null&&sl(n,l,f,!0),l=bn.current,l!==null){switch(l.tag){case 31:case 13:return Hn===null?Yi():l.alternate===null&&At===0&&(At=3),l.flags&=-257,l.flags|=65536,l.lanes=f,i===ki?l.flags|=16384:(n=l.updateQueue,n===null?l.updateQueue=new Set([i]):n.add(i),_u(e,i,f)),!1;case 22:return l.flags|=65536,i===ki?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)),_u(e,i,f)),!1}throw Error(o(435,l.tag))}return _u(e,i,f),Yi(),!1}if(Ke)return n=bn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,i!==Rc&&(e=Error(o(422),{cause:i}),Ql(_n(e,l)))):(i!==Rc&&(n=Error(o(423),{cause:i}),Ql(_n(n,l))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,i=_n(i,l),f=uu(e.stateNode,i,f),Uc(e,f),At!==4&&(At=2)),!1;var x=Error(o(520),{cause:i});if(x=_n(x,l),xs===null?xs=[x]:xs.push(x),At!==4&&(At=2),n===null)return!0;i=_n(i,l),l=n;do{switch(l.tag){case 3:return l.flags|=65536,e=f&-f,l.lanes|=e,e=uu(l.stateNode,i,e),Uc(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=_m(f),Om(f,e,l,i),Uc(l,f),!1}l=l.return}while(l!==null);return!1}var du=Error(o(461)),Bt=!1;function Qt(e,n,l,i){n.child=e===null?Up(n,null,l,i):Rr(n,e.child,l,i)}function Bm(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 Cr(n),i=Wc(e,n,l,j,x,f),A=qc(),e!==null&&!Bt?(Yc(e,n,f),Sa(e,n,f)):(Ke&&A&&Nc(n),n.flags|=1,Qt(e,n,i,f),n.child)}function Im(e,n,l,i,f){if(e===null){var x=l.type;return typeof x=="function"&&!wc(x)&&x.defaultProps===void 0&&l.compare===null?(n.tag=15,n.type=x,Hm(e,n,x,i,f)):(e=gi(l.type,null,i,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(x=e.child,!yu(e,f)){var j=x.memoizedProps;if(l=l.compare,l=l!==null?l:Yl,l(j,i)&&e.ref===n.ref)return Sa(e,n,f)}return n.flags|=1,e=xa(x,i),e.ref=n.ref,e.return=n,n.child=e}function Hm(e,n,l,i,f){if(e!==null){var x=e.memoizedProps;if(Yl(x,i)&&e.ref===n.ref)if(Bt=!1,n.pendingProps=i=x,yu(e,f))(e.flags&131072)!==0&&(Bt=!0);else return n.lanes=e.lanes,Sa(e,n,f)}return fu(e,n,l,i,f)}function Um(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 $m(e,n,x,l,i)}if((l&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&ji(n,x!==null?x.cachePool:null),x!==null?Pp(n,x):Vc(),Fp(n);else return i=n.lanes=536870912,$m(e,n,x!==null?x.baseLanes|l:l,l,i)}else x!==null?(ji(n,x.cachePool),Pp(n,x),Fa(),n.memoizedState=null):(e!==null&&ji(n,null),Vc(),Fa());return Qt(e,n,f,l),n.child}function cs(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function $m(e,n,l,i,f){var x=Oc();return x=x===null?null:{parent:_t._currentValue,pool:x},n.memoizedState={baseLanes:l,cachePool:x},e!==null&&ji(n,null),Vc(),Fp(n),e!==null&&sl(e,n,i,!0),n.childLanes=f,null}function Bi(e,n){return n=Hi({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function Vm(e,n,l){return Rr(n,e.child,null,l),e=Bi(n,n.pendingProps),e.flags|=2,jn(n),n.memoizedState=null,e}function Zb(e,n,l){var i=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Ke){if(i.mode==="hidden")return e=Bi(n,i),n.lanes=536870912,cs(null,e);if(Fc(n),(e=vt)?(e=ex(e,In),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Oa!==null?{id:ra,overflow:la}:null,retryLane:536870912,hydrationErrors:null},l=Cp(e),l.return=n,n.child=l,Kt=n,vt=null)):e=null,e===null)throw Ia(n);return n.lanes=536870912,null}return Bi(n,i)}var x=e.memoizedState;if(x!==null){var j=x.dehydrated;if(Fc(n),f)if(n.flags&256)n.flags&=-257,n=Vm(e,n,l);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(o(558));else if(Bt||sl(e,n,l,!1),f=(l&e.childLanes)!==0,Bt||f){if(i=mt,i!==null&&(j=mr(i,l),j!==0&&j!==x.retryLane))throw x.retryLane=j,jr(e,j),gn(i,e,j),du;Yi(),n=Vm(e,n,l)}else e=x.treeContext,vt=Un(j.nextSibling),Kt=n,Ke=!0,Ba=null,In=!1,e!==null&&Tp(n,e),n=Bi(n,i),n.flags|=4096;return n}return e=xa(e.child,{mode:i.mode,children:i.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Ii(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 fu(e,n,l,i,f){return Cr(n),l=Wc(e,n,l,i,void 0,f),i=qc(),e!==null&&!Bt?(Yc(e,n,f),Sa(e,n,f)):(Ke&&i&&Nc(n),n.flags|=1,Qt(e,n,l,f),n.child)}function Pm(e,n,l,i,f,x){return Cr(n),n.updateQueue=null,l=Wp(n,i,l,f),Gp(e),i=qc(),e!==null&&!Bt?(Yc(e,n,x),Sa(e,n,x)):(Ke&&i&&Nc(n),n.flags|=1,Qt(e,n,l,x),n.child)}function Fm(e,n,l,i,f){if(Cr(n),n.stateNode===null){var x=nl,j=l.contextType;typeof j=="object"&&j!==null&&(x=Xt(j)),x=new l(i,x),n.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=cu,n.stateNode=x,x._reactInternals=n,x=n.stateNode,x.props=i,x.state=n.memoizedState,x.refs={},Ic(n),j=l.contextType,x.context=typeof j=="object"&&j!==null?Xt(j):nl,x.state=n.memoizedState,j=l.getDerivedStateFromProps,typeof j=="function"&&(ou(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&&cu.enqueueReplaceState(x,x.state,null),rs(n,i,x,f),as(),x.state=n.memoizedState),typeof x.componentDidMount=="function"&&(n.flags|=4194308),i=!0}else if(e===null){x=n.stateNode;var A=n.memoizedProps,V=Mr(l,A);x.props=V;var Z=x.context,le=l.contextType;j=nl,typeof le=="object"&&le!==null&&(j=Xt(le));var ue=l.getDerivedStateFromProps;le=typeof ue=="function"||typeof x.getSnapshotBeforeUpdate=="function",A=n.pendingProps!==A,le||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(A||Z!==j)&&Am(n,x,i,j),Ua=!1;var J=n.memoizedState;x.state=J,rs(n,i,x,f),as(),Z=n.memoizedState,A||J!==Z||Ua?(typeof ue=="function"&&(ou(n,l,ue,i),Z=n.memoizedState),(V=Ua||Rm(n,l,V,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=V):(typeof x.componentDidMount=="function"&&(n.flags|=4194308),i=!1)}else{x=n.stateNode,Hc(e,n),j=n.memoizedProps,le=Mr(l,j),x.props=le,ue=n.pendingProps,J=x.context,Z=l.contextType,V=nl,typeof Z=="object"&&Z!==null&&(V=Xt(Z)),A=l.getDerivedStateFromProps,(Z=typeof A=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(j!==ue||J!==V)&&Am(n,x,i,V),Ua=!1,J=n.memoizedState,x.state=J,rs(n,i,x,f),as();var ae=n.memoizedState;j!==ue||J!==ae||Ua||e!==null&&e.dependencies!==null&&yi(e.dependencies)?(typeof A=="function"&&(ou(n,l,A,i),ae=n.memoizedState),(le=Ua||Rm(n,l,le,i,J,ae,V)||e!==null&&e.dependencies!==null&&yi(e.dependencies))?(Z||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(i,ae,V),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(i,ae,V)),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=ae),x.props=i,x.state=ae,x.context=V,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,Ii(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=Rr(n,e.child,null,f),n.child=Rr(n,null,l,f)):Qt(e,n,l,f),n.memoizedState=x.state,e=n.child):e=Sa(e,n,f),e}function Gm(e,n,l,i){return kr(),n.flags|=256,Qt(e,n,l,i),n.child}var pu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function mu(e){return{baseLanes:e,cachePool:Dp()}}function hu(e,n,l){return e=e!==null?e.childLanes&~l:0,n&&(e|=kn),e}function Wm(e,n,l){var i=n.pendingProps,f=!1,x=(n.flags&128)!==0,j;if((j=x)||(j=e!==null&&e.memoizedState===null?!1:(Lt.current&2)!==0),j&&(f=!0,n.flags&=-129),j=(n.flags&32)!==0,n.flags&=-33,e===null){if(Ke){if(f?Pa(n):Fa(),(e=vt)?(e=ex(e,In),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Oa!==null?{id:ra,overflow:la}:null,retryLane:536870912,hydrationErrors:null},l=Cp(e),l.return=n,n.child=l,Kt=n,vt=null)):e=null,e===null)throw Ia(n);return Qu(e)?n.lanes=32:n.lanes=536870912,null}var A=i.children;return i=i.fallback,f?(Fa(),f=n.mode,A=Hi({mode:"hidden",children:A},f),i=Sr(i,f,l,null),A.return=n,i.return=n,A.sibling=i,n.child=A,i=n.child,i.memoizedState=mu(l),i.childLanes=hu(e,j,l),n.memoizedState=pu,cs(null,i)):(Pa(n),xu(n,A))}var V=e.memoizedState;if(V!==null&&(A=V.dehydrated,A!==null)){if(x)n.flags&256?(Pa(n),n.flags&=-257,n=gu(e,n,l)):n.memoizedState!==null?(Fa(),n.child=e.child,n.flags|=128,n=null):(Fa(),A=i.fallback,f=n.mode,i=Hi({mode:"visible",children:i.children},f),A=Sr(A,f,l,null),A.flags|=2,i.return=n,A.return=n,i.sibling=A,n.child=i,Rr(n,e.child,null,l),i=n.child,i.memoizedState=mu(l),i.childLanes=hu(e,j,l),n.memoizedState=pu,n=cs(null,i));else if(Pa(n),Qu(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=gu(e,n,l)}else if(Bt||sl(e,n,l,!1),j=(l&e.childLanes)!==0,Bt||j){if(j=mt,j!==null&&(i=mr(j,l),i!==0&&i!==V.retryLane))throw V.retryLane=i,jr(e,i),gn(j,e,i),du;Xu(A)||Yi(),n=gu(e,n,l)}else Xu(A)?(n.flags|=192,n.child=e.child,n=null):(e=V.treeContext,vt=Un(A.nextSibling),Kt=n,Ke=!0,Ba=null,In=!1,e!==null&&Tp(n,e),n=xu(n,i.children),n.flags|=4096);return n}return f?(Fa(),A=i.fallback,f=n.mode,V=e.child,Z=V.sibling,i=xa(V,{mode:"hidden",children:i.children}),i.subtreeFlags=V.subtreeFlags&65011712,Z!==null?A=xa(Z,A):(A=Sr(A,f,l,null),A.flags|=2),A.return=n,i.return=n,i.sibling=A,n.child=i,cs(null,i),i=n.child,A=e.child.memoizedState,A===null?A=mu(l):(f=A.cachePool,f!==null?(V=_t._currentValue,f=f.parent!==V?{parent:V,pool:V}:f):f=Dp(),A={baseLanes:A.baseLanes|l,cachePool:f}),i.memoizedState=A,i.childLanes=hu(e,j,l),n.memoizedState=pu,cs(e.child,i)):(Pa(n),l=e.child,e=l.sibling,l=xa(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 xu(e,n){return n=Hi({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Hi(e,n){return e=yn(22,e,null,n),e.lanes=0,e}function gu(e,n,l){return Rr(n,e.child,null,l),e=xu(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function qm(e,n,l){e.lanes|=n;var i=e.alternate;i!==null&&(i.lanes|=n),Lc(e.return,n,l)}function vu(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 Ym(e,n,l){var i=n.pendingProps,f=i.revealOrder,x=i.tail;i=i.children;var j=Lt.current,A=(j&2)!==0;if(A?(j=j&1|2,n.flags|=128):j&=1,W(Lt,j),Qt(e,n,i,l),i=Ke?Xl:0,!A&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&qm(e,l,n);else if(e.tag===19)qm(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&&Ni(e)===null&&(f=l),l=l.sibling;l=f,l===null?(f=n.child,n.child=null):(f=l.sibling,l.sibling=null),vu(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&&Ni(e)===null){n.child=f;break}e=f.sibling,f.sibling=l,l=f,f=e}vu(n,!0,l,null,x,i);break;case"together":vu(n,!1,null,null,void 0,i);break;default:n.memoizedState=null}return n.child}function Sa(e,n,l){if(e!==null&&(n.dependencies=e.dependencies),qa|=n.lanes,(l&n.childLanes)===0)if(e!==null){if(sl(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=xa(e,e.pendingProps),n.child=l,l.return=n;e.sibling!==null;)e=e.sibling,l=l.sibling=xa(e,e.pendingProps),l.return=n;l.sibling=null}return n.child}function yu(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&yi(e)))}function Jb(e,n,l){switch(n.tag){case 3:de(n,n.stateNode.containerInfo),Ha(n,_t,e.memoizedState.cache),kr();break;case 27:case 5:Ae(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,Fc(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?Wm(e,n,l):(Pa(n),e=Sa(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||(sl(e,n,l,!1),i=(l&n.childLanes)!==0),f){if(i)return Ym(e,n,l);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),W(Lt,Lt.current),i)break;return null;case 22:return n.lanes=0,Um(e,n,l,n.pendingProps);case 24:Ha(n,_t,e.memoizedState.cache)}return Sa(e,n,l)}function Km(e,n,l){if(e!==null)if(e.memoizedProps!==n.pendingProps)Bt=!0;else{if(!yu(e,l)&&(n.flags&128)===0)return Bt=!1,Jb(e,n,l);Bt=(e.flags&131072)!==0}else Bt=!1,Ke&&(n.flags&1048576)!==0&&Np(n,Xl,n.index);switch(n.lanes=0,n.tag){case 16:e:{var i=n.pendingProps;if(e=Nr(n.elementType),n.type=e,typeof e=="function")wc(e)?(i=Mr(e,i),n.tag=1,n=Fm(null,n,e,i,l)):(n.tag=0,n=fu(null,n,e,i,l));else{if(e!=null){var f=e.$$typeof;if(f===B){n.tag=11,n=Bm(null,n,e,i,l);break e}else if(f===E){n.tag=14,n=Im(null,n,e,i,l);break e}}throw n=ee(e)||e,Error(o(306,n,""))}}return n;case 0:return fu(e,n,n.type,n.pendingProps,l);case 1:return i=n.type,f=Mr(i,n.pendingProps),Fm(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,Hc(e,n),rs(n,i,null,l);var j=n.memoizedState;if(i=j.cache,Ha(n,_t,i),i!==x.cache&&zc(n,[_t],l,!0),as(),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=Gm(e,n,i,l);break e}else if(i!==f){f=_n(Error(o(424)),n),Ql(f),n=Gm(e,n,i,l);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(vt=Un(e.firstChild),Kt=n,Ke=!0,Ba=null,In=!0,l=Up(n,null,i,l),n.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(kr(),i===f){n=Sa(e,n,l);break e}Qt(e,n,i,l)}n=n.child}return n;case 26:return Ii(e,n),e===null?(l=sx(n.type,null,n.pendingProps,null))?n.memoizedState=l:Ke||(l=n.type,e=n.pendingProps,i=to(ie.current).createElement(l),i[Ut]=n,i[ot]=e,Zt(i,l,e),Wt(i),n.stateNode=i):n.memoizedState=sx(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return Ae(n),e===null&&Ke&&(i=n.stateNode=ax(n.type,n.pendingProps,ie.current),Kt=n,In=!0,f=vt,Za(n.type)?(Zu=f,vt=Un(i.firstChild)):vt=f),Qt(e,n,n.pendingProps.children,l),Ii(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Ke&&((f=i=vt)&&(i=R1(i,n.type,n.pendingProps,In),i!==null?(n.stateNode=i,Kt=n,vt=Un(i.firstChild),In=!1,f=!0):f=!1),f||Ia(n)),Ae(n),f=n.type,x=n.pendingProps,j=e!==null?e.memoizedProps:null,i=x.children,qu(f,x)?i=null:j!==null&&qu(f,j)&&(n.flags|=32),n.memoizedState!==null&&(f=Wc(e,n,Fb,null,null,l),ws._currentValue=f),Ii(e,n),Qt(e,n,i,l),n.child;case 6:return e===null&&Ke&&((e=l=vt)&&(l=A1(l,n.pendingProps,In),l!==null?(n.stateNode=l,Kt=n,vt=null,e=!0):e=!1),e||Ia(n)),null;case 13:return Wm(e,n,l);case 4:return de(n,n.stateNode.containerInfo),i=n.pendingProps,e===null?n.child=Rr(n,null,i,l):Qt(e,n,i,l),n.child;case 11:return Bm(e,n,n.type,n.pendingProps,l);case 7:return Qt(e,n,n.pendingProps,l),n.child;case 8:return Qt(e,n,n.pendingProps.children,l),n.child;case 12:return Qt(e,n,n.pendingProps.children,l),n.child;case 10:return i=n.pendingProps,Ha(n,n.type,i.value),Qt(e,n,i.children,l),n.child;case 9:return f=n.type._context,i=n.pendingProps.children,Cr(n),f=Xt(f),i=i(f),n.flags|=1,Qt(e,n,i,l),n.child;case 14:return Im(e,n,n.type,n.pendingProps,l);case 15:return Hm(e,n,n.type,n.pendingProps,l);case 19:return Ym(e,n,l);case 31:return Zb(e,n,l);case 22:return Um(e,n,l,n.pendingProps);case 24:return Cr(n),i=Xt(_t),e===null?(f=Oc(),f===null&&(f=mt,x=Dc(),f.pooledCache=x,x.refCount++,x!==null&&(f.pooledCacheLanes|=l),f=x),n.memoizedState={parent:i,cache:f},Ic(n),Ha(n,_t,f)):((e.lanes&l)!==0&&(Hc(e,n),rs(n,null,null,l),as()),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,_t,i)):(i=x.cache,Ha(n,_t,i),i!==f.cache&&zc(n,[_t],l,!0))),Qt(e,n,n.pendingProps.children,l),n.child;case 29:throw n.pendingProps}throw Error(o(156,n.tag))}function ka(e){e.flags|=4}function bu(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(Sh())e.flags|=8192;else throw Tr=ki,Bc}else e.flags&=-16777217}function Xm(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!dx(n))if(Sh())e.flags|=8192;else throw Tr=ki,Bc}function Ui(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?qn():536870912,e.lanes|=n,vl|=n)}function us(e,n){if(!Ke)switch(e.tailMode){case"hidden":n=e.tail;for(var l=null;n!==null;)n.alternate!==null&&(l=n),n=n.sibling;l===null?e.tail=null:l.sibling=null;break;case"collapsed":l=e.tail;for(var i=null;l!==null;)l.alternate!==null&&(i=l),l=l.sibling;i===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function yt(e){var n=e.alternate!==null&&e.alternate.child===e.child,l=0,i=0;if(n)for(var f=e.child;f!==null;)l|=f.lanes|f.childLanes,i|=f.subtreeFlags&65011712,i|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)l|=f.lanes|f.childLanes,i|=f.subtreeFlags,i|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=i,e.childLanes=l,n}function e1(e,n,l){var i=n.pendingProps;switch(Tc(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return yt(n),null;case 1:return yt(n),null;case 3:return l=n.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),n.memoizedState.cache!==i&&(n.flags|=2048),ya(_t),Se(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(ll(n)?ka(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Ac())),yt(n),null;case 26:var f=n.type,x=n.memoizedState;return e===null?(ka(n),x!==null?(yt(n),Xm(n,x)):(yt(n),bu(n,f,null,i,l))):x?x!==e.memoizedState?(ka(n),yt(n),Xm(n,x)):(yt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==i&&ka(n),yt(n),bu(n,f,e,i,l)),null;case 27:if(_e(n),l=ie.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==i&&ka(n);else{if(!i){if(n.stateNode===null)throw Error(o(166));return yt(n),null}e=te.current,ll(n)?Rp(n):(e=ax(f,i,l),n.stateNode=e,ka(n))}return yt(n),null;case 5:if(_e(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==i&&ka(n);else{if(!i){if(n.stateNode===null)throw Error(o(166));return yt(n),null}if(x=te.current,ll(n))Rp(n);else{var j=to(ie.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[Ut]=n,x[ot]=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(Zt(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&&ka(n)}}return yt(n),bu(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,l),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==i&&ka(n);else{if(typeof i!="string"&&n.stateNode===null)throw Error(o(166));if(e=ie.current,ll(n)){if(e=n.stateNode,l=n.memoizedProps,i=null,f=Kt,f!==null)switch(f.tag){case 27:case 5:i=f.memoizedProps}e[Ut]=n,e=!!(e.nodeValue===l||i!==null&&i.suppressHydrationWarning===!0||Wh(e.nodeValue,l)),e||Ia(n,!0)}else e=to(e).createTextNode(i),e[Ut]=n,n.stateNode=e}return yt(n),null;case 31:if(l=n.memoizedState,e===null||e.memoizedState!==null){if(i=ll(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[Ut]=n}else kr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;yt(n),e=!1}else l=Ac(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return n.flags&256?(jn(n),n):(jn(n),null);if((n.flags&128)!==0)throw Error(o(558))}return yt(n),null;case 13:if(i=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=ll(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[Ut]=n}else kr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;yt(n),f=!1}else f=Ac(),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),Ui(n,n.updateQueue),yt(n),null);case 4:return Se(),e===null&&Vu(n.stateNode.containerInfo),yt(n),null;case 10:return ya(n.type),yt(n),null;case 19:if(q(Lt),i=n.memoizedState,i===null)return yt(n),null;if(f=(n.flags&128)!==0,x=i.rendering,x===null)if(f)us(i,!1);else{if(At!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(x=Ni(e),x!==null){for(n.flags|=128,us(i,!1),e=x.updateQueue,n.updateQueue=e,Ui(n,e),n.subtreeFlags=0,e=l,l=n.child;l!==null;)wp(l,e),l=l.sibling;return W(Lt,Lt.current&1|2),Ke&&ga(n,i.treeForkCount),n.child}e=e.sibling}i.tail!==null&&Qe()>Gi&&(n.flags|=128,f=!0,us(i,!1),n.lanes=4194304)}else{if(!f)if(e=Ni(x),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,Ui(n,e),us(i,!0),i.tail===null&&i.tailMode==="hidden"&&!x.alternate&&!Ke)return yt(n),null}else 2*Qe()-i.renderingStartTime>Gi&&l!==536870912&&(n.flags|=128,f=!0,us(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=Qe(),e.sibling=null,l=Lt.current,W(Lt,f?l&1|2:l&1),Ke&&ga(n,i.treeForkCount),e):(yt(n),null);case 22:case 23:return jn(n),Pc(),i=n.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(n.flags|=8192):i&&(n.flags|=8192),i?(l&536870912)!==0&&(n.flags&128)===0&&(yt(n),n.subtreeFlags&6&&(n.flags|=8192)):yt(n),l=n.updateQueue,l!==null&&Ui(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&&q(Er),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),ya(_t),yt(n),null;case 25:return null;case 30:return null}throw Error(o(156,n.tag))}function t1(e,n){switch(Tc(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return ya(_t),Se(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return _e(n),null;case 31:if(n.memoizedState!==null){if(jn(n),n.alternate===null)throw Error(o(340));kr()}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));kr()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return q(Lt),null;case 4:return Se(),null;case 10:return ya(n.type),null;case 22:case 23:return jn(n),Pc(),e!==null&&q(Er),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return ya(_t),null;case 25:return null;default:return null}}function Qm(e,n){switch(Tc(n),n.tag){case 3:ya(_t),Se();break;case 26:case 27:case 5:_e(n);break;case 4:Se();break;case 31:n.memoizedState!==null&&jn(n);break;case 13:jn(n);break;case 19:q(Lt);break;case 10:ya(n.type);break;case 22:case 23:jn(n),Pc(),e!==null&&q(Er);break;case 24:ya(_t)}}function ds(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){st(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 V=l,Z=A;try{Z()}catch(le){st(f,V,le)}}}i=i.next}while(i!==x)}}catch(le){st(n,n.return,le)}}function Zm(e){var n=e.updateQueue;if(n!==null){var l=e.stateNode;try{Vp(n,l)}catch(i){st(e,e.return,i)}}}function Jm(e,n,l){l.props=Mr(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(i){st(e,n,i)}}function fs(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){st(e,n,f)}}function sa(e,n){var l=e.ref,i=e.refCleanup;if(l!==null)if(typeof i=="function")try{i()}catch(f){st(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){st(e,n,f)}else l.current=null}function eh(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){st(e,e.return,f)}}function ju(e,n,l){try{var i=e.stateNode;k1(i,e.type,l,n),i[ot]=n}catch(f){st(e,e.return,f)}}function th(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Za(e.type)||e.tag===4}function Su(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||th(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 ku(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=ma));else if(i!==4&&(i===27&&Za(e.type)&&(l=e.stateNode,n=null),e=e.child,e!==null))for(ku(e,n,l),e=e.sibling;e!==null;)ku(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 nh(e){var n=e.stateNode,l=e.memoizedProps;try{for(var i=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);Zt(n,i,l),n[Ut]=e,n[ot]=l}catch(x){st(e,e.return,x)}}var wa=!1,It=!1,wu=!1,ah=typeof WeakSet=="function"?WeakSet:Set,qt=null;function n1(e,n){if(e=e.containerInfo,Gu=oo,e=hp(e),gc(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,V=-1,Z=0,le=0,ue=e,J=null;t:for(;;){for(var ae;ue!==l||f!==0&&ue.nodeType!==3||(A=j+f),ue!==x||i!==0&&ue.nodeType!==3||(V=j+i),ue.nodeType===3&&(j+=ue.nodeValue.length),(ae=ue.firstChild)!==null;)J=ue,ue=ae;for(;;){if(ue===e)break t;if(J===l&&++Z===f&&(A=j),J===x&&++le===i&&(V=j),(ae=ue.nextSibling)!==null)break;ue=J,J=ue.parentNode}ue=ae}l=A===-1||V===-1?null:{start:A,end:V}}else l=null}l=l||{start:0,end:0}}else l=null;for(Wu={focusedElem:e,selectionRange:l},oo=!1,qt=n;qt!==null;)if(n=qt,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,qt=e;else for(;qt!==null;){switch(n=qt,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 we=Mr(l.type,f);e=i.getSnapshotBeforeUpdate(we,x),i.__reactInternalSnapshotBeforeUpdate=e}catch(Le){st(l,l.return,Le)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,l=e.nodeType,l===9)Ku(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Ku(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,qt=e;break}qt=n.return}}function rh(e,n,l){var i=l.flags;switch(l.tag){case 0:case 11:case 15:Ea(e,l),i&4&&ds(5,l);break;case 1:if(Ea(e,l),i&4)if(e=l.stateNode,n===null)try{e.componentDidMount()}catch(j){st(l,l.return,j)}else{var f=Mr(l.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(j){st(l,l.return,j)}}i&64&&Zm(l),i&512&&fs(l,l.return);break;case 3:if(Ea(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{Vp(e,n)}catch(j){st(l,l.return,j)}}break;case 27:n===null&&i&4&&nh(l);case 26:case 5:Ea(e,l),n===null&&i&4&&eh(l),i&512&&fs(l,l.return);break;case 12:Ea(e,l);break;case 31:Ea(e,l),i&4&&ih(e,l);break;case 13:Ea(e,l),i&4&&oh(e,l),i&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=d1.bind(null,l),M1(e,l))));break;case 22:if(i=l.memoizedState!==null||wa,!i){n=n!==null&&n.memoizedState!==null||It,f=wa;var x=It;wa=i,(It=n)&&!x?Na(e,l,(l.subtreeFlags&8772)!==0):Ea(e,l),wa=f,It=x}break;case 30:break;default:Ea(e,l)}}function lh(e){var n=e.alternate;n!==null&&(e.alternate=null,lh(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&ec(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 kt=null,pn=!1;function Ca(e,n,l){for(l=l.child;l!==null;)sh(e,n,l),l=l.sibling}function sh(e,n,l){if(Mt&&typeof Mt.onCommitFiberUnmount=="function")try{Mt.onCommitFiberUnmount(An,l)}catch{}switch(l.tag){case 26:It||sa(l,n),Ca(e,n,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:It||sa(l,n);var i=kt,f=pn;Za(l.type)&&(kt=l.stateNode,pn=!1),Ca(e,n,l),js(l.stateNode),kt=i,pn=f;break;case 5:It||sa(l,n);case 6:if(i=kt,f=pn,kt=null,Ca(e,n,l),kt=i,pn=f,kt!==null)if(pn)try{(kt.nodeType===9?kt.body:kt.nodeName==="HTML"?kt.ownerDocument.body:kt).removeChild(l.stateNode)}catch(x){st(l,n,x)}else try{kt.removeChild(l.stateNode)}catch(x){st(l,n,x)}break;case 18:kt!==null&&(pn?(e=kt,Zh(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),El(e)):Zh(kt,l.stateNode));break;case 4:i=kt,f=pn,kt=l.stateNode.containerInfo,pn=!0,Ca(e,n,l),kt=i,pn=f;break;case 0:case 11:case 14:case 15:Ga(2,l,n),It||Ga(4,l,n),Ca(e,n,l);break;case 1:It||(sa(l,n),i=l.stateNode,typeof i.componentWillUnmount=="function"&&Jm(l,n,i)),Ca(e,n,l);break;case 21:Ca(e,n,l);break;case 22:It=(i=It)||l.memoizedState!==null,Ca(e,n,l),It=i;break;default:Ca(e,n,l)}}function ih(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{El(e)}catch(l){st(n,n.return,l)}}}function oh(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{El(e)}catch(l){st(n,n.return,l)}}function a1(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new ah),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new ah),n;default:throw Error(o(435,e.tag))}}function Vi(e,n){var l=a1(e);n.forEach(function(i){if(!l.has(i)){l.add(i);var f=f1.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)){kt=A.stateNode,pn=!1;break e}break;case 5:kt=A.stateNode,pn=!1;break e;case 3:case 4:kt=A.stateNode.containerInfo,pn=!0;break e}A=A.return}if(kt===null)throw Error(o(160));sh(x,j,f),kt=null,pn=!1,x=f.alternate,x!==null&&(x.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)ch(n,e),n=n.sibling}var Kn=null;function ch(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),ds(3,e),Ga(5,e,e.return));break;case 1:mn(n,e),hn(e),i&512&&(It||l===null||sa(l,l.return)),i&64&&wa&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?i:l.concat(i))));break;case 26:var f=Kn;if(mn(n,e),hn(e),i&512&&(It||l===null||sa(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[Hl]||x[Ut]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=f.createElement(i),f.head.insertBefore(x,f.querySelector("head > title"))),Zt(x,i,l),x[Ut]=e,Wt(x),i=x;break e;case"link":var j=cx("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),Zt(x,i,l),f.head.appendChild(x);break;case"meta":if(j=cx("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),Zt(x,i,l),f.head.appendChild(x);break;default:throw Error(o(468,i))}x[Ut]=e,Wt(x),i=x}e.stateNode=i}else ux(f,e.type,e.stateNode);else e.stateNode=ox(f,i,e.memoizedProps);else x!==i?(x===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):x.count--,i===null?ux(f,e.type,e.stateNode):ox(f,i,e.memoizedProps)):i===null&&e.stateNode!==null&&ju(e,e.memoizedProps,l.memoizedProps)}break;case 27:mn(n,e),hn(e),i&512&&(It||l===null||sa(l,l.return)),l!==null&&i&4&&ju(e,e.memoizedProps,l.memoizedProps);break;case 5:if(mn(n,e),hn(e),i&512&&(It||l===null||sa(l,l.return)),e.flags&32){f=e.stateNode;try{Kr(f,"")}catch(we){st(e,e.return,we)}}i&4&&e.stateNode!=null&&(f=e.memoizedProps,ju(e,f,l!==null?l.memoizedProps:f)),i&1024&&(wu=!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(we){st(e,e.return,we)}}break;case 3:if(ro=null,f=Kn,Kn=no(n.containerInfo),mn(n,e),Kn=f,hn(e),i&4&&l!==null&&l.memoizedState.isDehydrated)try{El(n.containerInfo)}catch(we){st(e,e.return,we)}wu&&(wu=!1,uh(e));break;case 4:i=Kn,Kn=no(e.stateNode.containerInfo),mn(n,e),hn(e),Kn=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,Vi(e,i)));break;case 13:mn(n,e),hn(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Fi=Qe()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Vi(e,i)));break;case 22:f=e.memoizedState!==null;var V=l!==null&&l.memoizedState!==null,Z=wa,le=It;if(wa=Z||f,It=le||V,mn(n,e),It=le,wa=Z,hn(e),i&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(l===null||V||wa||It||Lr(e)),l=null,n=e;;){if(n.tag===5||n.tag===26){if(l===null){V=l=n;try{if(x=V.stateNode,f)j=x.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{A=V.stateNode;var ue=V.memoizedProps.style,J=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;A.style.display=J==null||typeof J=="boolean"?"":(""+J).trim()}}catch(we){st(V,V.return,we)}}}else if(n.tag===6){if(l===null){V=n;try{V.stateNode.nodeValue=f?"":V.memoizedProps}catch(we){st(V,V.return,we)}}}else if(n.tag===18){if(l===null){V=n;try{var ae=V.stateNode;f?Jh(ae,!0):Jh(V.stateNode,!1)}catch(we){st(V,V.return,we)}}}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,Vi(e,l))));break;case 19:mn(n,e),hn(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Vi(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(th(i)){l=i;break}i=i.return}if(l==null)throw Error(o(160));switch(l.tag){case 27:var f=l.stateNode,x=Su(e);$i(e,x,f);break;case 5:var j=l.stateNode;l.flags&32&&(Kr(j,""),l.flags&=-33);var A=Su(e);$i(e,A,j);break;case 3:case 4:var V=l.stateNode.containerInfo,Z=Su(e);ku(e,Z,V);break;default:throw Error(o(161))}}catch(le){st(e,e.return,le)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function uh(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;uh(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Ea(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)rh(e,n.alternate,n),n=n.sibling}function Lr(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),Lr(n);break;case 1:sa(n,n.return);var l=n.stateNode;typeof l.componentWillUnmount=="function"&&Jm(n,n.return,l),Lr(n);break;case 27:js(n.stateNode);case 26:case 5:sa(n,n.return),Lr(n);break;case 22:n.memoizedState===null&&Lr(n);break;case 30:Lr(n);break;default:Lr(n)}e=e.sibling}}function Na(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:Na(f,x,l),ds(4,x);break;case 1:if(Na(f,x,l),i=x,f=i.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(Z){st(i,i.return,Z)}if(i=x,f=i.updateQueue,f!==null){var A=i.stateNode;try{var V=f.shared.hiddenCallbacks;if(V!==null)for(f.shared.hiddenCallbacks=null,f=0;f<V.length;f++)$p(V[f],A)}catch(Z){st(i,i.return,Z)}}l&&j&64&&Zm(x),fs(x,x.return);break;case 27:nh(x);case 26:case 5:Na(f,x,l),l&&i===null&&j&4&&eh(x),fs(x,x.return);break;case 12:Na(f,x,l);break;case 31:Na(f,x,l),l&&j&4&&ih(f,x);break;case 13:Na(f,x,l),l&&j&4&&oh(f,x);break;case 22:x.memoizedState===null&&Na(f,x,l),fs(x,x.return);break;case 30:break;default:Na(f,x,l)}n=n.sibling}}function Cu(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&&Zl(l))}function Eu(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Zl(e))}function Xn(e,n,l,i){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)dh(e,n,l,i),n=n.sibling}function dh(e,n,l,i){var f=n.flags;switch(n.tag){case 0:case 11:case 15:Xn(e,n,l,i),f&2048&&ds(9,n);break;case 1:Xn(e,n,l,i);break;case 3:Xn(e,n,l,i),f&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Zl(e)));break;case 12:if(f&2048){Xn(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(V){st(n,n.return,V)}}else Xn(e,n,l,i);break;case 31:Xn(e,n,l,i);break;case 13:Xn(e,n,l,i);break;case 23:break;case 22:x=n.stateNode,j=n.alternate,n.memoizedState!==null?x._visibility&2?Xn(e,n,l,i):ps(e,n):x._visibility&2?Xn(e,n,l,i):(x._visibility|=2,hl(e,n,l,i,(n.subtreeFlags&10256)!==0||!1)),f&2048&&Cu(j,n);break;case 24:Xn(e,n,l,i),f&2048&&Eu(n.alternate,n);break;default:Xn(e,n,l,i)}}function hl(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,V=i,Z=j.flags;switch(j.tag){case 0:case 11:case 15:hl(x,j,A,V,f),ds(8,j);break;case 23:break;case 22:var le=j.stateNode;j.memoizedState!==null?le._visibility&2?hl(x,j,A,V,f):ps(x,j):(le._visibility|=2,hl(x,j,A,V,f)),f&&Z&2048&&Cu(j.alternate,j);break;case 24:hl(x,j,A,V,f),f&&Z&2048&&Eu(j.alternate,j);break;default:hl(x,j,A,V,f)}n=n.sibling}}function ps(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:ps(l,i),f&2048&&Cu(i.alternate,i);break;case 24:ps(l,i),f&2048&&Eu(i.alternate,i);break;default:ps(l,i)}n=n.sibling}}var ms=8192;function xl(e,n,l){if(e.subtreeFlags&ms)for(e=e.child;e!==null;)fh(e,n,l),e=e.sibling}function fh(e,n,l){switch(e.tag){case 26:xl(e,n,l),e.flags&ms&&e.memoizedState!==null&&P1(l,Kn,e.memoizedState,e.memoizedProps);break;case 5:xl(e,n,l);break;case 3:case 4:var i=Kn;Kn=no(e.stateNode.containerInfo),xl(e,n,l),Kn=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=ms,ms=16777216,xl(e,n,l),ms=i):xl(e,n,l));break;default:xl(e,n,l)}}function ph(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 hs(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];qt=i,hh(i,e)}ph(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)mh(e),e=e.sibling}function mh(e){switch(e.tag){case 0:case 11:case 15:hs(e),e.flags&2048&&Ga(9,e,e.return);break;case 3:hs(e);break;case 12:hs(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Pi(e)):hs(e);break;default:hs(e)}}function Pi(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];qt=i,hh(i,e)}ph(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Ga(8,n,n.return),Pi(n);break;case 22:l=n.stateNode,l._visibility&2&&(l._visibility&=-3,Pi(n));break;default:Pi(n)}e=e.sibling}}function hh(e,n){for(;qt!==null;){var l=qt;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:Zl(l.memoizedState.cache)}if(i=l.child,i!==null)i.return=l,qt=i;else e:for(l=e;qt!==null;){i=qt;var f=i.sibling,x=i.return;if(lh(i),i===l){qt=null;break e}if(f!==null){f.return=x,qt=f;break e}qt=x}}}var r1={getCacheForType:function(e){var n=Xt(_t),l=n.data.get(e);return l===void 0&&(l=e(),n.data.set(e,l)),l},cacheSignal:function(){return Xt(_t).controller.signal}},l1=typeof WeakMap=="function"?WeakMap:Map,nt=0,mt=null,Ge=null,qe=0,lt=0,Sn=null,Wa=!1,gl=!1,Nu=!1,Ta=0,At=0,qa=0,zr=0,Tu=0,kn=0,vl=0,xs=null,xn=null,Ru=!1,Fi=0,xh=0,Gi=1/0,Wi=null,Ya=null,$t=0,Ka=null,yl=null,Ra=0,Au=0,Mu=null,gh=null,gs=0,Lu=null;function wn(){return(nt&2)!==0&&qe!==0?qe&-qe:z.T!==null?Iu():it()}function vh(){if(kn===0)if((qe&536870912)===0||Ke){var e=Ee;Ee<<=1,(Ee&3932160)===0&&(Ee=262144),kn=e}else kn=536870912;return e=bn.current,e!==null&&(e.flags|=32),kn}function gn(e,n,l){(e===mt&&(lt===2||lt===9)||e.cancelPendingCommit!==null)&&(bl(e,0),Xa(e,qe,kn,!1)),fr(e,l),((nt&2)===0||e!==mt)&&(e===mt&&((nt&2)===0&&(zr|=l),At===4&&Xa(e,qe,kn,!1)),ia(e))}function yh(e,n,l){if((nt&6)!==0)throw Error(o(327));var i=!l&&(n&127)===0&&(n&e.expiredLanes)===0||dn(e,n),f=i?o1(e,n):Du(e,n,!0),x=i;do{if(f===0){gl&&!i&&Xa(e,n,0,!1);break}else{if(l=e.current.alternate,x&&!s1(l)){f=Du(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=xs;var V=A.current.memoizedState.isDehydrated;if(V&&(bl(A,j).flags|=256),j=Du(A,j,!1),j!==2){if(Nu&&!V){A.errorRecoveryDisabledLanes|=x,zr|=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){bl(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=Fi+300-Qe(),10<f)){if(Xa(i,n,kn,!Wa),Mn(i,0,!0)!==0)break e;Ra=n,i.timeoutHandle=Xh(bh.bind(null,i,l,xn,Wi,Ru,n,kn,zr,vl,Wa,x,"Throttled",-0,0),f);break e}bh(i,l,xn,Wi,Ru,n,kn,zr,vl,Wa,x,null,-0,0)}}break}while(!0);ia(e)}function bh(e,n,l,i,f,x,j,A,V,Z,le,ue,J,ae){if(e.timeoutHandle=-1,ue=n.subtreeFlags,ue&8192||(ue&16785408)===16785408){ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ma},fh(n,x,ue);var we=(x&62914560)===x?Fi-Qe():(x&4194048)===x?xh-Qe():0;if(we=F1(ue,we),we!==null){Ra=x,e.cancelPendingCommit=we(Th.bind(null,e,n,x,l,i,f,j,A,V,le,ue,null,J,ae)),Xa(e,x,j,!Z);return}}Th(e,n,x,l,i,f,j,A,V)}function s1(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&=~Tu,n&=~zr,e.suspendedLanes|=n,e.pingedLanes&=~n,i&&(e.warmLanes|=n),i=e.expirationTimes;for(var f=n;0<f;){var x=31-St(f),j=1<<x;i[x]=-1,f&=~j}l!==0&&na(e,l,n)}function qi(){return(nt&6)===0?(vs(0),!1):!0}function zu(){if(Ge!==null){if(lt===0)var e=Ge.return;else e=Ge,va=wr=null,Kc(e),ul=null,es=0,e=Ge;for(;e!==null;)Qm(e.alternate,e),e=e.return;Ge=null}}function bl(e,n){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,E1(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),Ra=0,zu(),mt=e,Ge=l=xa(e.current,null),qe=n,lt=0,Sn=null,Wa=!1,gl=dn(e,n),Nu=!1,vl=kn=Tu=zr=qa=At=0,xn=xs=null,Ru=!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-St(i),x=1<<f;n|=e[f],i&=~x}return Ta=n,mi(),l}function jh(e,n){Ue=null,z.H=os,n===cl||n===Si?(n=Bp(),lt=3):n===Bc?(n=Bp(),lt=4):lt=n===du?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Sn=n,Ge===null&&(At=1,Oi(e,_n(n,e.current)))}function Sh(){var e=bn.current;return e===null?!0:(qe&4194048)===qe?Hn===null:(qe&62914560)===qe||(qe&536870912)!==0?e===Hn:!1}function kh(){var e=z.H;return z.H=os,e===null?os:e}function wh(){var e=z.A;return z.A=r1,e}function Yi(){At=4,Wa||(qe&4194048)!==qe&&bn.current!==null||(gl=!0),(qa&134217727)===0&&(zr&134217727)===0||mt===null||Xa(mt,qe,kn,!1)}function Du(e,n,l){var i=nt;nt|=2;var f=kh(),x=wh();(mt!==e||qe!==n)&&(Wi=null,bl(e,n)),n=!1;var j=At;e:do try{if(lt!==0&&Ge!==null){var A=Ge,V=Sn;switch(lt){case 8:zu(),j=6;break e;case 3:case 2:case 9:case 6:bn.current===null&&(n=!0);var Z=lt;if(lt=0,Sn=null,jl(e,A,V,Z),l&&gl){j=0;break e}break;default:Z=lt,lt=0,Sn=null,jl(e,A,V,Z)}}i1(),j=At;break}catch(le){jh(e,le)}while(!0);return n&&e.shellSuspendCounter++,va=wr=null,nt=i,z.H=f,z.A=x,Ge===null&&(mt=null,qe=0,mi()),j}function i1(){for(;Ge!==null;)Ch(Ge)}function o1(e,n){var l=nt;nt|=2;var i=kh(),f=wh();mt!==e||qe!==n?(Wi=null,Gi=Qe()+500,bl(e,n)):gl=dn(e,n);e:do try{if(lt!==0&&Ge!==null){n=Ge;var x=Sn;t:switch(lt){case 1:lt=0,Sn=null,jl(e,n,x,1);break;case 2:case 9:if(_p(x)){lt=0,Sn=null,Eh(n);break}n=function(){lt!==2&<!==9||mt!==e||(lt=7),ia(e)},x.then(n,n);break e;case 3:lt=7;break e;case 4:lt=5;break e;case 7:_p(x)?(lt=0,Sn=null,Eh(n)):(lt=0,Sn=null,jl(e,n,x,7));break;case 5:var j=null;switch(Ge.tag){case 26:j=Ge.memoizedState;case 5:case 27:var A=Ge;if(j?dx(j):A.stateNode.complete){lt=0,Sn=null;var V=A.sibling;if(V!==null)Ge=V;else{var Z=A.return;Z!==null?(Ge=Z,Ki(Z)):Ge=null}break t}}lt=0,Sn=null,jl(e,n,x,5);break;case 6:lt=0,Sn=null,jl(e,n,x,6);break;case 8:zu(),At=6;break e;default:throw Error(o(462))}}c1();break}catch(le){jh(e,le)}while(!0);return va=wr=null,z.H=i,z.A=f,nt=l,Ge!==null?0:(mt=null,qe=0,mi(),At)}function c1(){for(;Ge!==null&&!Dt();)Ch(Ge)}function Ch(e){var n=Km(e.alternate,e,Ta);e.memoizedProps=e.pendingProps,n===null?Ki(e):Ge=n}function Eh(e){var n=e,l=n.alternate;switch(n.tag){case 15:case 0:n=Pm(l,n,n.pendingProps,n.type,void 0,qe);break;case 11:n=Pm(l,n,n.pendingProps,n.type.render,n.ref,qe);break;case 5:Kc(n);default:Qm(l,n),n=Ge=wp(n,Ta),n=Km(l,n,Ta)}e.memoizedProps=e.pendingProps,n===null?Ki(e):Ge=n}function jl(e,n,l,i){va=wr=null,Kc(n),ul=null,es=0;var f=n.return;try{if(Qb(e,f,n,l,qe)){At=1,Oi(e,_n(l,e.current)),Ge=null;return}}catch(x){if(f!==null)throw Ge=f,x;At=1,Oi(e,_n(l,e.current)),Ge=null;return}n.flags&32768?(Ke||i===1?e=!0:gl||(qe&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))),Nh(n,e)):Ki(n)}function Ki(e){var n=e;do{if((n.flags&32768)!==0){Nh(n,Wa);return}e=n.return;var l=e1(n.alternate,n,Ta);if(l!==null){Ge=l;return}if(n=n.sibling,n!==null){Ge=n;return}Ge=n=e}while(n!==null);At===0&&(At=5)}function Nh(e,n){do{var l=t1(e.alternate,e);if(l!==null){l.flags&=32767,Ge=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!n&&(e=e.sibling,e!==null)){Ge=e;return}Ge=e=l}while(e!==null);At=6,Ge=null}function Th(e,n,l,i,f,x,j,A,V){e.cancelPendingCommit=null;do Xi();while($t!==0);if((nt&6)!==0)throw Error(o(327));if(n!==null){if(n===e.current)throw Error(o(177));if(x=n.lanes|n.childLanes,x|=Sc,Il(e,l,x,j,A,V),e===mt&&(Ge=mt=null,qe=0),yl=n,Ka=e,Ra=l,Au=x,Mu=f,gh=i,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,p1(Et,function(){return zh(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||i){i=z.T,z.T=null,f=I.p,I.p=2,j=nt,nt|=4;try{n1(e,n,l)}finally{nt=j,I.p=f,z.T=i}}$t=1,Rh(),Ah(),Mh()}}function Rh(){if($t===1){$t=0;var e=Ka,n=yl,l=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||l){l=z.T,z.T=null;var i=I.p;I.p=2;var f=nt;nt|=4;try{ch(n,e);var x=Wu,j=hp(e.containerInfo),A=x.focusedElem,V=x.selectionRange;if(j!==A&&A&&A.ownerDocument&&mp(A.ownerDocument.documentElement,A)){if(V!==null&&gc(A)){var Z=V.start,le=V.end;if(le===void 0&&(le=Z),"selectionStart"in A)A.selectionStart=Z,A.selectionEnd=Math.min(le,A.value.length);else{var ue=A.ownerDocument||document,J=ue&&ue.defaultView||window;if(J.getSelection){var ae=J.getSelection(),we=A.textContent.length,Le=Math.min(V.start,we),dt=V.end===void 0?Le:Math.min(V.end,we);!ae.extend&&Le>dt&&(j=dt,dt=Le,Le=j);var Y=pp(A,Le),G=pp(A,dt);if(Y&&G&&(ae.rangeCount!==1||ae.anchorNode!==Y.node||ae.anchorOffset!==Y.offset||ae.focusNode!==G.node||ae.focusOffset!==G.offset)){var Q=ue.createRange();Q.setStart(Y.node,Y.offset),ae.removeAllRanges(),Le>dt?(ae.addRange(Q),ae.extend(G.node,G.offset)):(Q.setEnd(G.node,G.offset),ae.addRange(Q))}}}}for(ue=[],ae=A;ae=ae.parentNode;)ae.nodeType===1&&ue.push({element:ae,left:ae.scrollLeft,top:ae.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<ue.length;A++){var ce=ue[A];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}oo=!!Gu,Wu=Gu=null}finally{nt=f,I.p=i,z.T=l}}e.current=n,$t=2}}function Ah(){if($t===2){$t=0;var e=Ka,n=yl,l=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||l){l=z.T,z.T=null;var i=I.p;I.p=2;var f=nt;nt|=4;try{rh(e,n.alternate,n)}finally{nt=f,I.p=i,z.T=l}}$t=3}}function Mh(){if($t===4||$t===3){$t=0,Tt();var e=Ka,n=yl,l=Ra,i=gh;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?$t=5:($t=0,yl=Ka=null,Lh(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(Ya=null),Da(l),n=n.stateNode,Mt&&typeof Mt.onCommitFiberRoot=="function")try{Mt.onCommitFiberRoot(An,n,void 0,(n.current.flags&128)===128)}catch{}if(i!==null){n=z.T,f=I.p,I.p=2,z.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{z.T=n,I.p=f}}(Ra&3)!==0&&Xi(),ia(e),f=e.pendingLanes,(l&261930)!==0&&(f&42)!==0?e===Lu?gs++:(gs=0,Lu=e):gs=0,vs(0)}}function Lh(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,Zl(n)))}function Xi(){return Rh(),Ah(),Mh(),zh()}function zh(){if($t!==5)return!1;var e=Ka,n=Au;Au=0;var l=Da(Ra),i=z.T,f=I.p;try{I.p=32>l?32:l,z.T=null,l=Mu,Mu=null;var x=Ka,j=Ra;if($t=0,yl=Ka=null,Ra=0,(nt&6)!==0)throw Error(o(331));var A=nt;if(nt|=4,mh(x.current),dh(x,x.current,j,l),nt=A,vs(0,!1),Mt&&typeof Mt.onPostCommitFiberRoot=="function")try{Mt.onPostCommitFiberRoot(An,x)}catch{}return!0}finally{I.p=f,z.T=i,Lh(e,n)}}function Dh(e,n,l){n=_n(l,n),n=uu(e.stateNode,n,2),e=Va(e,n,2),e!==null&&(fr(e,2),ia(e))}function st(e,n,l){if(e.tag===3)Dh(e,e,l);else for(;n!==null;){if(n.tag===3){Dh(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=_n(l,e),l=_m(2),i=Va(n,l,2),i!==null&&(Om(l,i,n,e),fr(i,2),ia(i));break}}n=n.return}}function _u(e,n,l){var i=e.pingCache;if(i===null){i=e.pingCache=new l1;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)||(Nu=!0,f.add(l),e=u1.bind(null,e,n,l),n.then(e,e))}function u1(e,n,l){var i=e.pingCache;i!==null&&i.delete(n),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,mt===e&&(qe&l)===l&&(At===4||At===3&&(qe&62914560)===qe&&300>Qe()-Fi?(nt&2)===0&&bl(e,0):Tu|=l,vl===qe&&(vl=0)),ia(e)}function _h(e,n){n===0&&(n=qn()),e=jr(e,n),e!==null&&(fr(e,n),ia(e))}function d1(e){var n=e.memoizedState,l=0;n!==null&&(l=n.retryLane),_h(e,l)}function f1(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),_h(e,l)}function p1(e,n){return Nt(e,n)}var Qi=null,Sl=null,Ou=!1,Zi=!1,Bu=!1,Qa=0;function ia(e){e!==Sl&&e.next===null&&(Sl===null?Qi=Sl=e:Sl=Sl.next=e),Zi=!0,Ou||(Ou=!0,h1())}function vs(e,n){if(!Bu&&Zi){Bu=!0;do for(var l=!1,i=Qi;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-St(42|e)+1)-1,x&=f&~(j&~A),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(l=!0,Hh(i,x))}else x=qe,x=Mn(i,i===mt?x:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(x&3)===0||dn(i,x)||(l=!0,Hh(i,x));i=i.next}while(l);Bu=!1}}function m1(){Oh()}function Oh(){Zi=Ou=!1;var e=0;Qa!==0&&C1()&&(e=Qa);for(var n=Qe(),l=null,i=Qi;i!==null;){var f=i.next,x=Bh(i,n);x===0?(i.next=null,l===null?Qi=f:l.next=f,f===null&&(Sl=l)):(l=i,(e!==0||(x&3)!==0)&&(Zi=!0)),i=f}$t!==0&&$t!==5||vs(e),Qa!==0&&(Qa=0)}function Bh(e,n){for(var l=e.suspendedLanes,i=e.pingedLanes,f=e.expirationTimes,x=e.pendingLanes&-62914561;0<x;){var j=31-St(x),A=1<<j,V=f[j];V===-1?((A&l)===0||(A&i)!==0)&&(f[j]=ni(A,n)):V<=n&&(e.expiredLanes|=A),x&=~A}if(n=mt,l=qe,l=Mn(e,e===n?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,l===0||e===n&&(lt===2||lt===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&ht(i),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||dn(e,l)){if(n=l&-l,n===e.callbackPriority)return n;switch(i!==null&&ht(i),Da(l)){case 2:case 8:l=pt;break;case 32:l=Et;break;case 268435456:l=un;break;default:l=Et}return i=Ih.bind(null,e),l=Nt(l,i),e.callbackPriority=n,e.callbackNode=l,n}return i!==null&&i!==null&&ht(i),e.callbackPriority=2,e.callbackNode=null,2}function Ih(e,n){if($t!==0&&$t!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(Xi()&&e.callbackNode!==l)return null;var i=qe;return i=Mn(e,e===mt?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(yh(e,i,n),Bh(e,Qe()),e.callbackNode!=null&&e.callbackNode===l?Ih.bind(null,e):null)}function Hh(e,n){if(Xi())return null;yh(e,n,!0)}function h1(){N1(function(){(nt&6)!==0?Nt(be,m1):Oh()})}function Iu(){if(Qa===0){var e=il;e===0&&(e=oe,oe<<=1,(oe&261888)===0&&(oe=256)),Qa=e}return Qa}function Uh(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:si(""+e)}function $h(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 x1(e,n,l,i,f){if(n==="submit"&&l&&l.stateNode===f){var x=Uh((f[ot]||null).action),j=i.submitter;j&&(n=(n=j[ot]||null)?Uh(n.formAction):j.getAttribute("formAction"),n!==null&&(x=n,j=null));var A=new ui("action","action",null,i,f);e.push({event:A,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Qa!==0){var V=j?$h(f,j):new FormData(f);ru(l,{pending:!0,data:V,method:f.method,action:x},null,V)}}else typeof x=="function"&&(A.preventDefault(),V=j?$h(f,j):new FormData(f),ru(l,{pending:!0,data:V,method:f.method,action:x},x,V))},currentTarget:f}]})}}for(var Hu=0;Hu<jc.length;Hu++){var Uu=jc[Hu],g1=Uu.toLowerCase(),v1=Uu[0].toUpperCase()+Uu.slice(1);Yn(g1,"on"+v1)}Yn(vp,"onAnimationEnd"),Yn(yp,"onAnimationIteration"),Yn(bp,"onAnimationStart"),Yn("dblclick","onDoubleClick"),Yn("focusin","onFocus"),Yn("focusout","onBlur"),Yn(Db,"onTransitionRun"),Yn(_b,"onTransitionStart"),Yn(Ob,"onTransitionCancel"),Yn(jp,"onTransitionEnd"),qr("onMouseEnter",["mouseout","mouseover"]),qr("onMouseLeave",["mouseout","mouseover"]),qr("onPointerEnter",["pointerout","pointerover"]),qr("onPointerLeave",["pointerout","pointerover"]),gr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),gr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),gr("onBeforeInput",["compositionend","keypress","textInput","paste"]),gr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),gr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),gr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ys="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(" "),y1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ys));function Vh(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],V=A.instance,Z=A.currentTarget;if(A=A.listener,V!==x&&f.isPropagationStopped())break e;x=A,f.currentTarget=Z;try{x(f)}catch(le){pi(le)}f.currentTarget=null,x=V}else for(j=0;j<i.length;j++){if(A=i[j],V=A.instance,Z=A.currentTarget,A=A.listener,V!==x&&f.isPropagationStopped())break e;x=A,f.currentTarget=Z;try{x(f)}catch(le){pi(le)}f.currentTarget=null,x=V}}}}function We(e,n){var l=n[aa];l===void 0&&(l=n[aa]=new Set);var i=e+"__bubble";l.has(i)||(Ph(n,e,2,!1),l.add(i))}function $u(e,n,l){var i=0;n&&(i|=4),Ph(l,e,i,n)}var Ji="_reactListening"+Math.random().toString(36).slice(2);function Vu(e){if(!e[Ji]){e[Ji]=!0,Of.forEach(function(l){l!=="selectionchange"&&(y1.has(l)||$u(l,!1,e),$u(l,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[Ji]||(n[Ji]=!0,$u("selectionchange",!1,n))}}function Ph(e,n,l,i){switch(vx(n)){case 2:var f=q1;break;case 8:f=Y1;break;default:f=ad}l=f.bind(null,n,l,e),f=void 0,!oc||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 Pu(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 V=j.tag;if((V===3||V===4)&&j.stateNode.containerInfo===f)return;j=j.return}for(;A!==null;){if(j=Fr(A),j===null)return;if(V=j.tag,V===5||V===6||V===26||V===27){i=x=j;continue e}A=A.parentNode}}i=i.return}Yf(function(){var Z=x,le=sc(l),ue=[];e:{var J=Sp.get(e);if(J!==void 0){var ae=ui,we=e;switch(e){case"keypress":if(oi(l)===0)break e;case"keydown":case"keyup":ae=fb;break;case"focusin":we="focus",ae=fc;break;case"focusout":we="blur",ae=fc;break;case"beforeblur":case"afterblur":ae=fc;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ae=Qf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ae=eb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ae=hb;break;case vp:case yp:case bp:ae=ab;break;case jp:ae=gb;break;case"scroll":case"scrollend":ae=Zy;break;case"wheel":ae=yb;break;case"copy":case"cut":case"paste":ae=lb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ae=Jf;break;case"toggle":case"beforetoggle":ae=jb}var Le=(n&4)!==0,dt=!Le&&(e==="scroll"||e==="scrollend"),Y=Le?J!==null?J+"Capture":null:J;Le=[];for(var G=Z,Q;G!==null;){var ce=G;if(Q=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||Q===null||Y===null||(ce=$l(G,Y),ce!=null&&Le.push(bs(G,ce,Q))),dt)break;G=G.return}0<Le.length&&(J=new ae(J,we,null,l,le),ue.push({event:J,listeners:Le}))}}if((n&7)===0){e:{if(J=e==="mouseover"||e==="pointerover",ae=e==="mouseout"||e==="pointerout",J&&l!==lc&&(we=l.relatedTarget||l.fromElement)&&(Fr(we)||we[xr]))break e;if((ae||J)&&(J=le.window===le?le:(J=le.ownerDocument)?J.defaultView||J.parentWindow:window,ae?(we=l.relatedTarget||l.toElement,ae=Z,we=we?Fr(we):null,we!==null&&(dt=u(we),Le=we.tag,we!==dt||Le!==5&&Le!==27&&Le!==6)&&(we=null)):(ae=null,we=Z),ae!==we)){if(Le=Qf,ce="onMouseLeave",Y="onMouseEnter",G="mouse",(e==="pointerout"||e==="pointerover")&&(Le=Jf,ce="onPointerLeave",Y="onPointerEnter",G="pointer"),dt=ae==null?J:Ul(ae),Q=we==null?J:Ul(we),J=new Le(ce,G+"leave",ae,l,le),J.target=dt,J.relatedTarget=Q,ce=null,Fr(le)===Z&&(Le=new Le(Y,G+"enter",we,l,le),Le.target=Q,Le.relatedTarget=dt,ce=Le),dt=ce,ae&&we)t:{for(Le=b1,Y=ae,G=we,Q=0,ce=Y;ce;ce=Le(ce))Q++;ce=0;for(var Me=G;Me;Me=Le(Me))ce++;for(;0<Q-ce;)Y=Le(Y),Q--;for(;0<ce-Q;)G=Le(G),ce--;for(;Q--;){if(Y===G||G!==null&&Y===G.alternate){Le=Y;break t}Y=Le(Y),G=Le(G)}Le=null}else Le=null;ae!==null&&Fh(ue,J,ae,Le,!1),we!==null&&dt!==null&&Fh(ue,dt,we,Le,!0)}}e:{if(J=Z?Ul(Z):window,ae=J.nodeName&&J.nodeName.toLowerCase(),ae==="select"||ae==="input"&&J.type==="file")var Ze=ip;else if(lp(J))if(op)Ze=Mb;else{Ze=Rb;var Ne=Tb}else ae=J.nodeName,!ae||ae.toLowerCase()!=="input"||J.type!=="checkbox"&&J.type!=="radio"?Z&&rc(Z.elementType)&&(Ze=ip):Ze=Ab;if(Ze&&(Ze=Ze(e,Z))){sp(ue,Ze,l,le);break e}Ne&&Ne(e,J,Z),e==="focusout"&&Z&&J.type==="number"&&Z.memoizedProps.value!=null&&ac(J,"number",J.value)}switch(Ne=Z?Ul(Z):window,e){case"focusin":(lp(Ne)||Ne.contentEditable==="true")&&(Jr=Ne,vc=Z,Kl=null);break;case"focusout":Kl=vc=Jr=null;break;case"mousedown":yc=!0;break;case"contextmenu":case"mouseup":case"dragend":yc=!1,xp(ue,l,le);break;case"selectionchange":if(zb)break;case"keydown":case"keyup":xp(ue,l,le)}var Ve;if(mc)e:{switch(e){case"compositionstart":var Ye="onCompositionStart";break e;case"compositionend":Ye="onCompositionEnd";break e;case"compositionupdate":Ye="onCompositionUpdate";break e}Ye=void 0}else Zr?ap(e,l)&&(Ye="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(Ye="onCompositionStart");Ye&&(ep&&l.locale!=="ko"&&(Zr||Ye!=="onCompositionStart"?Ye==="onCompositionEnd"&&Zr&&(Ve=Kf()):(_a=le,cc="value"in _a?_a.value:_a.textContent,Zr=!0)),Ne=eo(Z,Ye),0<Ne.length&&(Ye=new Zf(Ye,e,null,l,le),ue.push({event:Ye,listeners:Ne}),Ve?Ye.data=Ve:(Ve=rp(l),Ve!==null&&(Ye.data=Ve)))),(Ve=kb?wb(e,l):Cb(e,l))&&(Ye=eo(Z,"onBeforeInput"),0<Ye.length&&(Ne=new Zf("onBeforeInput","beforeinput",null,l,le),ue.push({event:Ne,listeners:Ye}),Ne.data=Ve)),x1(ue,e,Z,l,le)}Vh(ue,n)})}function bs(e,n,l){return{instance:e,listener:n,currentTarget:l}}function eo(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=$l(e,l),f!=null&&i.unshift(bs(e,f,x)),f=$l(e,n),f!=null&&i.push(bs(e,f,x))),e.tag===3)return i;e=e.return}return[]}function b1(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Fh(e,n,l,i,f){for(var x=n._reactName,j=[];l!==null&&l!==i;){var A=l,V=A.alternate,Z=A.stateNode;if(A=A.tag,V!==null&&V===i)break;A!==5&&A!==26&&A!==27||Z===null||(V=Z,f?(Z=$l(l,x),Z!=null&&j.unshift(bs(l,Z,V))):f||(Z=$l(l,x),Z!=null&&j.push(bs(l,Z,V)))),l=l.return}j.length!==0&&e.push({event:n,listeners:j})}var j1=/\r\n?/g,S1=/\u0000|\uFFFD/g;function Gh(e){return(typeof e=="string"?e:""+e).replace(j1,`
|
|
50
|
+
`).replace(S1,"")}function Wh(e,n){return n=Gh(n),Gh(e)===n}function ut(e,n,l,i,f,x){switch(l){case"children":typeof i=="string"?n==="body"||n==="textarea"&&i===""||Kr(e,i):(typeof i=="number"||typeof i=="bigint")&&n!=="body"&&Kr(e,""+i);break;case"className":ri(e,"class",i);break;case"tabIndex":ri(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":ri(e,l,i);break;case"style":Wf(e,i,x);break;case"data":if(n!=="object"){ri(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=si(""+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"&&ut(e,n,"name",f.name,f,null),ut(e,n,"formEncType",f.formEncType,f,null),ut(e,n,"formMethod",f.formMethod,f,null),ut(e,n,"formTarget",f.formTarget,f,null)):(ut(e,n,"encType",f.encType,f,null),ut(e,n,"method",f.method,f,null),ut(e,n,"target",f.target,f,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(l);break}i=si(""+i),e.setAttribute(l,i);break;case"onClick":i!=null&&(e.onclick=ma);break;case"onScroll":i!=null&&We("scroll",e);break;case"onScrollEnd":i!=null&&We("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=si(""+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":We("beforetoggle",e),We("toggle",e),ai(e,"popover",i);break;case"xlinkActuate":pa(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":pa(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":pa(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":pa(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":pa(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":pa(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":pa(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":pa(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":pa(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":ai(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=Xy.get(l)||l,ai(e,l,i))}}function Fu(e,n,l,i,f,x){switch(l){case"style":Wf(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"?Kr(e,i):(typeof i=="number"||typeof i=="bigint")&&Kr(e,""+i);break;case"onScroll":i!=null&&We("scroll",e);break;case"onScrollEnd":i!=null&&We("scrollend",e);break;case"onClick":i!=null&&(e.onclick=ma);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Bf.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[ot]||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,""):ai(e,l,i)}}}function Zt(e,n,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":We("error",e),We("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:ut(e,n,x,j,l,null)}}f&&ut(e,n,"srcSet",l.srcSet,l,null),i&&ut(e,n,"src",l.src,l,null);return;case"input":We("invalid",e);var A=x=j=f=null,V=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":V=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:ut(e,n,i,le,l,null)}}Vf(e,x,A,V,Z,j,f,!1);return;case"select":We("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:ut(e,n,f,A,l,null)}n=x,l=j,e.multiple=!!i,n!=null?Yr(e,!!i,n,!1):l!=null&&Yr(e,!!i,l,!0);return;case"textarea":We("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:ut(e,n,j,A,l,null)}Ff(e,i,f,x);return;case"option":for(V in l)if(l.hasOwnProperty(V)&&(i=l[V],i!=null))switch(V){case"selected":e.selected=i&&typeof i!="function"&&typeof i!="symbol";break;default:ut(e,n,V,i,l,null)}return;case"dialog":We("beforetoggle",e),We("toggle",e),We("cancel",e),We("close",e);break;case"iframe":case"object":We("load",e);break;case"video":case"audio":for(i=0;i<ys.length;i++)We(ys[i],e);break;case"image":We("error",e),We("load",e);break;case"details":We("toggle",e);break;case"embed":case"source":case"link":We("error",e),We("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:ut(e,n,Z,i,l,null)}return;default:if(rc(n)){for(le in l)l.hasOwnProperty(le)&&(i=l[le],i!==void 0&&Fu(e,n,le,i,l,void 0));return}}for(A in l)l.hasOwnProperty(A)&&(i=l[A],i!=null&&ut(e,n,A,i,l,null))}function k1(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,V=null,Z=null,le=null;for(ae in l){var ue=l[ae];if(l.hasOwnProperty(ae)&&ue!=null)switch(ae){case"checked":break;case"value":break;case"defaultValue":V=ue;default:i.hasOwnProperty(ae)||ut(e,n,ae,null,i,ue)}}for(var J in i){var ae=i[J];if(ue=l[J],i.hasOwnProperty(J)&&(ae!=null||ue!=null))switch(J){case"type":x=ae;break;case"name":f=ae;break;case"checked":Z=ae;break;case"defaultChecked":le=ae;break;case"value":j=ae;break;case"defaultValue":A=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(o(137,n));break;default:ae!==ue&&ut(e,n,J,ae,i,ue)}}nc(e,j,A,V,Z,le,x,f);return;case"select":ae=j=A=J=null;for(x in l)if(V=l[x],l.hasOwnProperty(x)&&V!=null)switch(x){case"value":break;case"multiple":ae=V;default:i.hasOwnProperty(x)||ut(e,n,x,null,i,V)}for(f in i)if(x=i[f],V=l[f],i.hasOwnProperty(f)&&(x!=null||V!=null))switch(f){case"value":J=x;break;case"defaultValue":A=x;break;case"multiple":j=x;default:x!==V&&ut(e,n,f,x,i,V)}n=A,l=j,i=ae,J!=null?Yr(e,!!l,J,!1):!!i!=!!l&&(n!=null?Yr(e,!!l,n,!0):Yr(e,!!l,l?[]:"",!1));return;case"textarea":ae=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:ut(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":ae=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(o(91));break;default:f!==x&&ut(e,n,j,f,i,x)}Pf(e,J,ae);return;case"option":for(var we in l)if(J=l[we],l.hasOwnProperty(we)&&J!=null&&!i.hasOwnProperty(we))switch(we){case"selected":e.selected=!1;break;default:ut(e,n,we,null,i,J)}for(V in i)if(J=i[V],ae=l[V],i.hasOwnProperty(V)&&J!==ae&&(J!=null||ae!=null))switch(V){case"selected":e.selected=J&&typeof J!="function"&&typeof J!="symbol";break;default:ut(e,n,V,J,i,ae)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Le in l)J=l[Le],l.hasOwnProperty(Le)&&J!=null&&!i.hasOwnProperty(Le)&&ut(e,n,Le,null,i,J);for(Z in i)if(J=i[Z],ae=l[Z],i.hasOwnProperty(Z)&&J!==ae&&(J!=null||ae!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(o(137,n));break;default:ut(e,n,Z,J,i,ae)}return;default:if(rc(n)){for(var dt in l)J=l[dt],l.hasOwnProperty(dt)&&J!==void 0&&!i.hasOwnProperty(dt)&&Fu(e,n,dt,void 0,i,J);for(le in i)J=i[le],ae=l[le],!i.hasOwnProperty(le)||J===ae||J===void 0&&ae===void 0||Fu(e,n,le,J,i,ae);return}}for(var Y in l)J=l[Y],l.hasOwnProperty(Y)&&J!=null&&!i.hasOwnProperty(Y)&&ut(e,n,Y,null,i,J);for(ue in i)J=i[ue],ae=l[ue],!i.hasOwnProperty(ue)||J===ae||J==null&&ae==null||ut(e,n,ue,J,i,ae)}function qh(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function w1(){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&&qh(j)){for(j=0,A=f.responseEnd,i+=1;i<l.length;i++){var V=l[i],Z=V.startTime;if(Z>A)break;var le=V.transferSize,ue=V.initiatorType;le&&qh(ue)&&(V=V.responseEnd,j+=le*(V<A?1:(A-Z)/(V-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 Gu=null,Wu=null;function to(e){return e.nodeType===9?e:e.ownerDocument}function Yh(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 Kh(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 qu(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 Yu=null;function C1(){var e=window.event;return e&&e.type==="popstate"?e===Yu?!1:(Yu=e,!0):(Yu=null,!1)}var Xh=typeof setTimeout=="function"?setTimeout:void 0,E1=typeof clearTimeout=="function"?clearTimeout:void 0,Qh=typeof Promise=="function"?Promise:void 0,N1=typeof queueMicrotask=="function"?queueMicrotask:typeof Qh<"u"?function(e){return Qh.resolve(null).then(e).catch(T1)}:Xh;function T1(e){setTimeout(function(){throw e})}function Za(e){return e==="head"}function Zh(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),El(n);return}i--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")i++;else if(l==="html")js(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,js(l);for(var x=l.firstChild;x;){var j=x.nextSibling,A=x.nodeName;x[Hl]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&x.rel.toLowerCase()==="stylesheet"||l.removeChild(x),x=j}}else l==="body"&&js(e.ownerDocument.body);l=f}while(l);El(n)}function Jh(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 Ku(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":Ku(l),ec(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function R1(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[Hl])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=Un(e.nextSibling),e===null)break}return null}function A1(e,n,l){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=Un(e.nextSibling),e===null))return null;return e}function ex(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Un(e.nextSibling),e===null))return null;return e}function Xu(e){return e.data==="$?"||e.data==="$~"}function Qu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function M1(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 Un(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 Zu=null;function tx(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(n===0)return Un(e.nextSibling);n--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||n++}e=e.nextSibling}return null}function nx(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 ax(e,n,l){switch(n=to(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 js(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);ec(e)}var $n=new Map,rx=new Set;function no(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Aa=I.d;I.d={f:L1,r:z1,D:D1,C:_1,L:O1,m:B1,X:H1,S:I1,M:U1};function L1(){var e=Aa.f(),n=qi();return e||n}function z1(e){var n=Gr(e);n!==null&&n.tag===5&&n.type==="form"?jm(n):Aa.r(e)}var kl=typeof document>"u"?null:document;function lx(e,n,l){var i=kl;if(i&&typeof n=="string"&&n){var f=zn(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof l=="string"&&(f+='[crossorigin="'+l+'"]'),rx.has(f)||(rx.add(f),e={rel:e,crossOrigin:l,href:n},i.querySelector(f)===null&&(n=i.createElement("link"),Zt(n,"link",e),Wt(n),i.head.appendChild(n)))}}function D1(e){Aa.D(e),lx("dns-prefetch",e,null)}function _1(e,n){Aa.C(e,n),lx("preconnect",e,n)}function O1(e,n,l){Aa.L(e,n,l);var i=kl;if(i&&e&&n){var f='link[rel="preload"][as="'+zn(n)+'"]';n==="image"&&l&&l.imageSrcSet?(f+='[imagesrcset="'+zn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(f+='[imagesizes="'+zn(l.imageSizes)+'"]')):f+='[href="'+zn(e)+'"]';var x=f;switch(n){case"style":x=wl(e);break;case"script":x=Cl(e)}$n.has(x)||(e=v({rel:"preload",href:n==="image"&&l&&l.imageSrcSet?void 0:e,as:n},l),$n.set(x,e),i.querySelector(f)!==null||n==="style"&&i.querySelector(Ss(x))||n==="script"&&i.querySelector(ks(x))||(n=i.createElement("link"),Zt(n,"link",e),Wt(n),i.head.appendChild(n)))}}function B1(e,n){Aa.m(e,n);var l=kl;if(l&&e){var i=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+zn(i)+'"][href="'+zn(e)+'"]',x=f;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Cl(e)}if(!$n.has(x)&&(e=v({rel:"modulepreload",href:e},n),$n.set(x,e),l.querySelector(f)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(ks(x)))return}i=l.createElement("link"),Zt(i,"link",e),Wt(i),l.head.appendChild(i)}}}function I1(e,n,l){Aa.S(e,n,l);var i=kl;if(i&&e){var f=Wr(i).hoistableStyles,x=wl(e);n=n||"default";var j=f.get(x);if(!j){var A={loading:0,preload:null};if(j=i.querySelector(Ss(x)))A.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":n},l),(l=$n.get(x))&&Ju(e,l);var V=j=i.createElement("link");Wt(V),Zt(V,"link",e),V._p=new Promise(function(Z,le){V.onload=Z,V.onerror=le}),V.addEventListener("load",function(){A.loading|=1}),V.addEventListener("error",function(){A.loading|=2}),A.loading|=4,ao(j,n,i)}j={type:"stylesheet",instance:j,count:1,state:A},f.set(x,j)}}}function H1(e,n){Aa.X(e,n);var l=kl;if(l&&e){var i=Wr(l).hoistableScripts,f=Cl(e),x=i.get(f);x||(x=l.querySelector(ks(f)),x||(e=v({src:e,async:!0},n),(n=$n.get(f))&&ed(e,n),x=l.createElement("script"),Wt(x),Zt(x,"link",e),l.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},i.set(f,x))}}function U1(e,n){Aa.M(e,n);var l=kl;if(l&&e){var i=Wr(l).hoistableScripts,f=Cl(e),x=i.get(f);x||(x=l.querySelector(ks(f)),x||(e=v({src:e,async:!0,type:"module"},n),(n=$n.get(f))&&ed(e,n),x=l.createElement("script"),Wt(x),Zt(x,"link",e),l.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},i.set(f,x))}}function sx(e,n,l,i){var f=(f=ie.current)?no(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=wl(l.href),l=Wr(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=wl(l.href);var x=Wr(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(Ss(e)))&&!x._p&&(j.instance=x,j.state.loading=5),$n.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},$n.set(e,l),x||$1(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=Cl(l),l=Wr(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 wl(e){return'href="'+zn(e)+'"'}function Ss(e){return'link[rel="stylesheet"]['+e+"]"}function ix(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function $1(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}),Zt(n,"link",l),Wt(n),e.head.appendChild(n))}function Cl(e){return'[src="'+zn(e)+'"]'}function ks(e){return"script[async]"+e}function ox(e,n,l){if(n.count++,n.instance===null)switch(n.type){case"style":var i=e.querySelector('style[data-href~="'+zn(l.href)+'"]');if(i)return n.instance=i,Wt(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"),Wt(i),Zt(i,"style",f),ao(i,l.precedence,e),n.instance=i;case"stylesheet":f=wl(l.href);var x=e.querySelector(Ss(f));if(x)return n.state.loading|=4,n.instance=x,Wt(x),x;i=ix(l),(f=$n.get(f))&&Ju(i,f),x=(e.ownerDocument||e).createElement("link"),Wt(x);var j=x;return j._p=new Promise(function(A,V){j.onload=A,j.onerror=V}),Zt(x,"link",i),n.state.loading|=4,ao(x,l.precedence,e),n.instance=x;case"script":return x=Cl(l.src),(f=e.querySelector(ks(x)))?(n.instance=f,Wt(f),f):(i=l,(f=$n.get(x))&&(i=v({},l),ed(i,f)),e=e.ownerDocument||e,f=e.createElement("script"),Wt(f),Zt(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,ao(i,l.precedence,e));return n.instance}function ao(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 Ju(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function ed(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var ro=null;function cx(e,n,l){if(ro===null){var i=new Map,f=ro=new Map;f.set(l,i)}else f=ro,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[Hl]||x[Ut]||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 ux(e,n,l){e=e.ownerDocument||e,e.head.insertBefore(l,n==="title"?e.querySelector("head > title"):null)}function V1(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 dx(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function P1(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=wl(i.href),x=n.querySelector(Ss(f));if(x){n=x._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=lo.bind(e),n.then(e,e)),l.state.loading|=4,l.instance=x,Wt(x);return}x=n.ownerDocument||n,i=ix(i),(f=$n.get(f))&&Ju(i,f),x=x.createElement("link"),Wt(x);var j=x;j._p=new Promise(function(A,V){j.onload=A,j.onerror=V}),Zt(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=lo.bind(e),n.addEventListener("load",l),n.addEventListener("error",l))}}var td=0;function F1(e,n){return e.stylesheets&&e.count===0&&io(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var i=setTimeout(function(){if(e.stylesheets&&io(e,e.stylesheets),e.unsuspend){var x=e.unsuspend;e.unsuspend=null,x()}},6e4+n);0<e.imgBytes&&td===0&&(td=62500*w1());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&io(e,e.stylesheets),e.unsuspend)){var x=e.unsuspend;e.unsuspend=null,x()}},(e.imgBytes>td?50:800)+n);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(f)}}:null}function lo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)io(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var so=null;function io(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,so=new Map,n.forEach(G1,e),so=null,lo.call(e))}function G1(e,n){if(!(n.state.loading&4)){var l=so.get(e);if(l)var i=l.get(null);else{l=new Map,so.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=lo.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 ws={$$typeof:M,Provider:null,Consumer:null,_currentValue:O,_currentValue2:O,_threadCount:0};function W1(e,n,l,i,f,x,j,A,V){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Bl(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bl(0),this.hiddenUpdates=Bl(null),this.identifierPrefix=i,this.onUncaughtError=f,this.onCaughtError=x,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=V,this.incompleteTransitions=new Map}function fx(e,n,l,i,f,x,j,A,V,Z,le,ue){return e=new W1(e,n,l,j,V,Z,le,ue,A),n=1,x===!0&&(n|=24),x=yn(3,null,null,n),e.current=x,x.stateNode=e,n=Dc(),n.refCount++,e.pooledCache=n,n.refCount++,x.memoizedState={element:i,isDehydrated:l,cache:n},Ic(x),e}function px(e){return e?(e=nl,e):nl}function mx(e,n,l,i,f,x){f=px(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),ns(l,e,n))}function hx(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<n?l:n}}function nd(e,n){hx(e,n),(e=e.alternate)&&hx(e,n)}function xx(e){if(e.tag===13||e.tag===31){var n=jr(e,67108864);n!==null&&gn(n,e,67108864),nd(e,67108864)}}function gx(e){if(e.tag===13||e.tag===31){var n=wn();n=Pr(n);var l=jr(e,n);l!==null&&gn(l,e,n),nd(e,n)}}var oo=!0;function q1(e,n,l,i){var f=z.T;z.T=null;var x=I.p;try{I.p=2,ad(e,n,l,i)}finally{I.p=x,z.T=f}}function Y1(e,n,l,i){var f=z.T;z.T=null;var x=I.p;try{I.p=8,ad(e,n,l,i)}finally{I.p=x,z.T=f}}function ad(e,n,l,i){if(oo){var f=rd(i);if(f===null)Pu(e,n,i,co,l),yx(e,i);else if(X1(f,e,n,l,i))i.stopPropagation();else if(yx(e,i),n&4&&-1<K1.indexOf(e)){for(;f!==null;){var x=Gr(f);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var j=gt(x.pendingLanes);if(j!==0){var A=x;for(A.pendingLanes|=2,A.entangledLanes|=2;j;){var V=1<<31-St(j);A.entanglements[1]|=V,j&=~V}ia(x),(nt&6)===0&&(Gi=Qe()+500,vs(0))}}break;case 31:case 13:A=jr(x,2),A!==null&&gn(A,x,2),qi(),nd(x,2)}if(x=rd(i),x===null&&Pu(e,n,i,co,l),x===f)break;f=x}f!==null&&i.stopPropagation()}else Pu(e,n,i,null,l)}}function rd(e){return e=sc(e),ld(e)}var co=null;function ld(e){if(co=null,e=Fr(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 co=e,null}function vx(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(tt()){case be:return 2;case pt:return 8;case Et:case Yt:return 32;case un:return 268435456;default:return 32}default:return 32}}var sd=!1,Ja=null,er=null,tr=null,Cs=new Map,Es=new Map,nr=[],K1="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 yx(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":Cs.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Es.delete(n.pointerId)}}function Ns(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=Gr(n),n!==null&&xx(n)),e):(e.eventSystemFlags|=i,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function X1(e,n,l,i,f){switch(n){case"focusin":return Ja=Ns(Ja,e,n,l,i,f),!0;case"dragenter":return er=Ns(er,e,n,l,i,f),!0;case"mouseover":return tr=Ns(tr,e,n,l,i,f),!0;case"pointerover":var x=f.pointerId;return Cs.set(x,Ns(Cs.get(x)||null,e,n,l,i,f)),!0;case"gotpointercapture":return x=f.pointerId,Es.set(x,Ns(Es.get(x)||null,e,n,l,i,f)),!0}return!1}function bx(e){var n=Fr(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,hr(e.priority,function(){gx(l)});return}}else if(n===31){if(n=h(l),n!==null){e.blockedOn=n,hr(e.priority,function(){gx(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 uo(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var l=rd(e.nativeEvent);if(l===null){l=e.nativeEvent;var i=new l.constructor(l.type,l);lc=i,l.target.dispatchEvent(i),lc=null}else return n=Gr(l),n!==null&&xx(n),e.blockedOn=l,!1;n.shift()}return!0}function jx(e,n,l){uo(e)&&l.delete(n)}function Q1(){sd=!1,Ja!==null&&uo(Ja)&&(Ja=null),er!==null&&uo(er)&&(er=null),tr!==null&&uo(tr)&&(tr=null),Cs.forEach(jx),Es.forEach(jx)}function fo(e,n){e.blockedOn===n&&(e.blockedOn=null,sd||(sd=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Q1)))}var po=null;function Sx(e){po!==e&&(po=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){po===e&&(po=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(ld(i||l)===null)continue;break}var x=Gr(l);x!==null&&(e.splice(n,3),n-=3,ru(x,{pending:!0,data:f,method:l.method,action:i},i,f))}}))}function El(e){function n(V){return fo(V,e)}Ja!==null&&fo(Ja,e),er!==null&&fo(er,e),tr!==null&&fo(tr,e),Cs.forEach(n),Es.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);)bx(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[ot]||null;if(typeof x=="function")j||Sx(l);else if(j){var A=null;if(x&&x.hasAttribute("formAction")){if(f=x,j=x[ot]||null)A=j.formAction;else if(ld(f)!==null)continue}else A=j.action;typeof A=="function"?l[i+1]=A:(l.splice(i,3),i-=3),Sx(l)}}}function kx(){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 id(e){this._internalRoot=e}mo.prototype.render=id.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(o(409));var l=n.current,i=wn();mx(l,i,e,n,null,null)},mo.prototype.unmount=id.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;mx(e.current,2,null,e,null,null),qi(),n[xr]=null}};function mo(e){this._internalRoot=e}mo.prototype.unstable_scheduleHydration=function(e){if(e){var n=it();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&&bx(e)}};var wx=r.version;if(wx!=="19.2.4")throw Error(o(527,wx,"19.2.4"));I.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=m(n),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var Z1={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ho=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ho.isDisabled&&ho.supportsFiber)try{An=ho.inject(Z1),Mt=ho}catch{}}return Rs.createRoot=function(e,n){if(!c(e))throw Error(o(299));var l=!1,i="",f=Mm,x=Lm,j=zm;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=fx(e,1,!1,null,null,l,i,null,f,x,j,kx),e[xr]=n.current,Vu(e),new id(n)},Rs.hydrateRoot=function(e,n,l){if(!c(e))throw Error(o(299));var i=!1,f="",x=Mm,j=Lm,A=zm,V=null;return l!=null&&(l.unstable_strictMode===!0&&(i=!0),l.identifierPrefix!==void 0&&(f=l.identifierPrefix),l.onUncaughtError!==void 0&&(x=l.onUncaughtError),l.onCaughtError!==void 0&&(j=l.onCaughtError),l.onRecoverableError!==void 0&&(A=l.onRecoverableError),l.formState!==void 0&&(V=l.formState)),n=fx(e,1,!0,n,l??null,i,f,V,x,j,A,kx),n.context=px(null),l=n.current,i=wn(),i=Pr(i),f=$a(i),f.callback=null,Va(l,f,i),l=i,n.current.lanes=l,fr(n,l),ia(n),e[xr]=n.current,Vu(e),new mo(n)},Rs.version="19.2.4",Rs}var Dx;function i0(){if(Dx)return ud.exports;Dx=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(),ud.exports=s0(),ud.exports}var o0=i0();/**
|
|
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 _x="popstate";function Ox(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function c0(t={}){function r(c,u){let{pathname:d="/",search:h="",hash:g=""}=zl(c.location.hash.substring(1));return!d.startsWith("/")&&!d.startsWith(".")&&(d="/"+d),Wd("",{pathname:d,search:h,hash:g},u.state&&u.state.usr||null,u.state&&u.state.key||"default")}function s(c,u){let d=c.document.querySelector("base"),h="";if(d&&d.getAttribute("href")){let g=c.location.href,m=g.indexOf("#");h=m===-1?g:g.slice(0,m)}return h+"#"+(typeof u=="string"?u:Us(u))}function o(c,u){Zn(c.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(u)})`)}return d0(r,s,o,t)}function Ft(t,r){if(t===!1||t===null||typeof t>"u")throw new Error(r)}function Zn(t,r){if(!t){typeof console<"u"&&console.warn(r);try{throw new Error(r)}catch{}}}function u0(){return Math.random().toString(36).substring(2,10)}function Bx(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 Wd(t,r,s=null,o,c){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof r=="string"?zl(r):r,state:s,key:r&&r.key||o||u0(),unstable_mask:c}}function Us({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 zl(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 d0(t,r,s,o={}){let{window:c=document.defaultView,v5Compat:u=!1}=o,d=c.history,h="POP",g=null,m=y();m==null&&(m=0,d.replaceState({...d.state,idx:m},""));function y(){return(d.state||{idx:null}).idx}function v(){h="POP";let C=y(),T=C==null?null:C-m;m=C,g&&g({action:h,location:w.location,delta:T})}function b(C,T){h="PUSH";let R=Ox(C)?C:Wd(w.location,C,T);s&&s(R,C),m=y()+1;let M=Bx(R,m),B=w.createHref(R.unstable_mask||R);try{d.pushState(M,"",B)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;c.location.assign(B)}u&&g&&g({action:h,location:w.location,delta:1})}function k(C,T){h="REPLACE";let R=Ox(C)?C:Wd(w.location,C,T);s&&s(R,C),m=y();let M=Bx(R,m),B=w.createHref(R.unstable_mask||R);d.replaceState(M,"",B),u&&g&&g({action:h,location:w.location,delta:0})}function S(C){return f0(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(_x,v),g=C,()=>{c.removeEventListener(_x,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 f0(t,r=!1){let s="http://localhost";typeof window<"u"&&(s=window.location.origin!=="null"?window.location.origin:window.location.href),Ft(s,"No window.location.(origin|href) available to create URL");let o=typeof t=="string"?t:Us(t);return o=o.replace(/ $/,"%20"),!r&&o.startsWith("//")&&(o=s+o),new URL(o,s)}function sv(t,r,s="/"){return p0(t,r,s,!1)}function p0(t,r,s,o){let c=typeof r=="string"?zl(r):r,u=La(c.pathname||"/",s);if(u==null)return null;let d=iv(t);m0(d);let h=null;for(let g=0;h==null&&g<d.length;++g){let m=C0(u);h=k0(d[g],m,o)}return h}function iv(t,r=[],s=[],o="",c=!1){let u=(d,h,g=c,m)=>{let y={relativePath:m===void 0?d.path||"":m,caseSensitive:d.caseSensitive===!0,childrenIndex:h,route:d};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(o)&&g)return;Ft(y.relativePath.startsWith(o),`Absolute route path "${y.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(o.length)}let v=ua([o,y.relativePath]),b=s.concat(y);d.children&&d.children.length>0&&(Ft(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),iv(d.children,r,b,v,g)),!(d.path==null&&!d.index)&&r.push({path:v,score:j0(v,d.index),routesMeta:b})};return t.forEach((d,h)=>{var g;if(d.path===""||!((g=d.path)!=null&&g.includes("?")))u(d,h);else for(let m of ov(d.path))u(d,h,!0,m)}),r}function ov(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=ov(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 m0(t){t.sort((r,s)=>r.score!==s.score?s.score-r.score:S0(r.routesMeta.map(o=>o.childrenIndex),s.routesMeta.map(o=>o.childrenIndex)))}var h0=/^:[\w-]+$/,x0=3,g0=2,v0=1,y0=10,b0=-2,Ix=t=>t==="*";function j0(t,r){let s=t.split("/"),o=s.length;return s.some(Ix)&&(o+=b0),r&&(o+=g0),s.filter(c=>!Ix(c)).reduce((c,u)=>c+(h0.test(u)?x0:u===""?v0:y0),o)}function S0(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 k0(t,r,s=!1){let{routesMeta:o}=t,c={},u="/",d=[];for(let h=0;h<o.length;++h){let g=o[h],m=h===o.length-1,y=u==="/"?r:r.slice(u.length)||"/",v=Do({path:g.relativePath,caseSensitive:g.caseSensitive,end:m},y),b=g.route;if(!v&&m&&s&&!o[o.length-1].route.index&&(v=Do({path:g.relativePath,caseSensitive:g.caseSensitive,end:!1},y)),!v)return null;Object.assign(c,v.params),d.push({params:c,pathname:ua([u,v.pathname]),pathnameBase:R0(ua([u,v.pathnameBase])),route:b}),v.pathnameBase!=="/"&&(u=ua([u,v.pathnameBase]))}return d}function Do(t,r){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[s,o]=w0(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((m,{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?m[y]=void 0:m[y]=(k||"").replace(/%2F/g,"/"),m},{}),pathname:u,pathnameBase:d,pattern:t}}function w0(t,r=!1,s=!0){Zn(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let o=[],c="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,h,g,m,y)=>{if(o.push({paramName:h,isOptional:g!=null}),g){let v=y.charAt(m+d.length);return v&&v!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(o.push({paramName:"*"}),c+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?c+="\\/*$":t!==""&&t!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,r?void 0:"i"),o]}function C0(t){try{return t.split("/").map(r=>decodeURIComponent(r).replace(/\//g,"%2F")).join("/")}catch(r){return Zn(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${r}).`),t}}function La(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 E0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function N0(t,r="/"){let{pathname:s,search:o="",hash:c=""}=typeof t=="string"?zl(t):t,u;return s?(s=s.replace(/\/\/+/g,"/"),s.startsWith("/")?u=Hx(s.substring(1),"/"):u=Hx(s,r)):u=r,{pathname:u,search:A0(o),hash:M0(c)}}function Hx(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 md(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 T0(t){return t.filter((r,s)=>s===0||r.route.path&&r.route.path.length>0)}function cv(t){let r=T0(t);return r.map((s,o)=>o===r.length-1?s.pathname:s.pathnameBase)}function ff(t,r,s,o=!1){let c;typeof t=="string"?c=zl(t):(c={...t},Ft(!c.pathname||!c.pathname.includes("?"),md("?","pathname","search",c)),Ft(!c.pathname||!c.pathname.includes("#"),md("#","pathname","hash",c)),Ft(!c.search||!c.search.includes("#"),md("#","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=N0(c,h),m=d&&d!=="/"&&d.endsWith("/"),y=(u||d===".")&&s.endsWith("/");return!g.pathname.endsWith("/")&&(m||y)&&(g.pathname+="/"),g}var ua=t=>t.join("/").replace(/\/\/+/g,"/"),R0=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),A0=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,M0=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,L0=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 z0(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function D0(t){return t.map(r=>r.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var uv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function dv(t,r){let s=t;if(typeof s!="string"||!E0.test(s))return{absoluteURL:void 0,isExternal:!1,to:s};let o=s,c=!1;if(uv)try{let u=new URL(window.location.href),d=s.startsWith("//")?new URL(u.protocol+s):new URL(s),h=La(d.pathname,r);d.origin===u.origin&&h!=null?s=h+d.search+d.hash:c=!0}catch{Zn(!1,`<Link to="${s}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:c,to:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var fv=["POST","PUT","PATCH","DELETE"];new Set(fv);var _0=["GET",...fv];new Set(_0);var Dl=p.createContext(null);Dl.displayName="DataRouter";var Uo=p.createContext(null);Uo.displayName="DataRouterState";var O0=p.createContext(!1),pv=p.createContext({isTransitioning:!1});pv.displayName="ViewTransition";var B0=p.createContext(new Map);B0.displayName="Fetchers";var I0=p.createContext(null);I0.displayName="Await";var Gn=p.createContext(null);Gn.displayName="Navigation";var $o=p.createContext(null);$o.displayName="Location";var za=p.createContext({outlet:null,matches:[],isDataRoute:!1});za.displayName="Route";var pf=p.createContext(null);pf.displayName="RouteError";var mv="REACT_ROUTER_ERROR",H0="REDIRECT",U0="ROUTE_ERROR_RESPONSE";function $0(t){if(t.startsWith(`${mv}:${H0}:{`))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 V0(t){if(t.startsWith(`${mv}:${U0}:{`))try{let r=JSON.parse(t.slice(40));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string")return new L0(r.status,r.statusText,r.data)}catch{}}function P0(t,{relative:r}={}){Ft(Ys(),"useHref() may be used only in the context of a <Router> component.");let{basename:s,navigator:o}=p.useContext(Gn),{hash:c,pathname:u,search:d}=Ks(t,{relative:r}),h=u;return s!=="/"&&(h=u==="/"?s:ua([s,u])),o.createHref({pathname:h,search:d,hash:c})}function Ys(){return p.useContext($o)!=null}function or(){return Ft(Ys(),"useLocation() may be used only in the context of a <Router> component."),p.useContext($o).location}var hv="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function xv(t){p.useContext(Gn).static||p.useLayoutEffect(t)}function F0(){let{isDataRoute:t}=p.useContext(za);return t?aj():G0()}function G0(){Ft(Ys(),"useNavigate() may be used only in the context of a <Router> component.");let t=p.useContext(Dl),{basename:r,navigator:s}=p.useContext(Gn),{matches:o}=p.useContext(za),{pathname:c}=or(),u=JSON.stringify(cv(o)),d=p.useRef(!1);return xv(()=>{d.current=!0}),p.useCallback((g,m={})=>{if(Zn(d.current,hv),!d.current)return;if(typeof g=="number"){s.go(g);return}let y=ff(g,JSON.parse(u),c,m.relative==="path");t==null&&r!=="/"&&(y.pathname=y.pathname==="/"?r:ua([r,y.pathname])),(m.replace?s.replace:s.push)(y,m.state,m)},[r,s,u,c,t])}p.createContext(null);function Ks(t,{relative:r}={}){let{matches:s}=p.useContext(za),{pathname:o}=or(),c=JSON.stringify(cv(s));return p.useMemo(()=>ff(t,JSON.parse(c),o,r==="path"),[t,c,o,r])}function W0(t,r,s){Ft(Ys(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=p.useContext(Gn),{matches:c}=p.useContext(za),u=c[c.length-1],d=u?u.params:{},h=u?u.pathname:"/",g=u?u.pathnameBase:"/",m=u&&u.route;{let C=m&&m.path||"";vv(h,!m||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${C}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
60
|
+
|
|
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=sv(t,{pathname:k});return Zn(m||S!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),Zn(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.`),Q0(S&&S.map(C=>Object.assign({},C,{params:Object.assign({},d,C.params),pathname:ua([g,o.encodeLocation?o.encodeLocation(C.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?g:ua([g,o.encodeLocation?o.encodeLocation(C.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),c,s)}function q0(){let t=nj(),r=z0(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),s=t instanceof Error?t.stack:null,o="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:o},u={padding:"2px 4px",backgroundColor:o},d=null;return console.error("Error handled by React Router default ErrorBoundary:",t),d=p.createElement(p.Fragment,null,p.createElement("p",null,"💿 Hey developer 👋"),p.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",p.createElement("code",{style:u},"ErrorBoundary")," or"," ",p.createElement("code",{style:u},"errorElement")," prop on your route.")),p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},r),s?p.createElement("pre",{style:c},s):null,d)}var Y0=p.createElement(q0,null),gv=class extends p.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,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=V0(t.digest);s&&(t=s)}let r=t!==void 0?p.createElement(za.Provider,{value:this.props.routeContext},p.createElement(pf.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?p.createElement(K0,{error:t},r):r}};gv.contextType=O0;var hd=new WeakMap;function K0({children:t,error:r}){let{basename:s}=p.useContext(Gn);if(typeof r=="object"&&r&&"digest"in r&&typeof r.digest=="string"){let o=$0(r.digest);if(o){let c=hd.get(r);if(c)throw c;let u=dv(o.location,s);if(uv&&!hd.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 hd.set(r,d),d}return p.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return t}function X0({routeContext:t,match:r,children:s}){let o=p.useContext(Dl);return o&&o.static&&o.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=r.route.id),p.createElement(za.Provider,{value:t},s)}function Q0(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);Ft(y>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),c=c.slice(0,Math.min(c.length,y+1))}let d=!1,h=-1;if(s&&o){d=o.renderFallback;for(let y=0;y<c.length;y++){let v=c[y];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(h=y),v.route.id){let{loaderData:b,errors: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,m=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:D0(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||Y0,d&&(h<0&&b===0?(vv("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 M;return k?M=w:S?M=C:v.route.Component?M=p.createElement(v.route.Component,null):v.route.element?M=v.route.element:M=y,p.createElement(X0,{match:v,routeContext:{outlet:y,matches:T,isDataRoute:o!=null},children:M})};return o&&(v.route.ErrorBoundary||v.route.errorElement||b===0)?p.createElement(gv,{location:o.location,revalidation:o.revalidation,component:w,error:k,children:R(),routeContext:{outlet:null,matches:T,isDataRoute:!0},onError:m}):R()},null)}function mf(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Z0(t){let r=p.useContext(Dl);return Ft(r,mf(t)),r}function J0(t){let r=p.useContext(Uo);return Ft(r,mf(t)),r}function ej(t){let r=p.useContext(za);return Ft(r,mf(t)),r}function hf(t){let r=ej(t),s=r.matches[r.matches.length-1];return Ft(s.route.id,`${t} can only be used on routes that contain a unique "id"`),s.route.id}function tj(){return hf("useRouteId")}function nj(){var o;let t=p.useContext(pf),r=J0("useRouteError"),s=hf("useRouteError");return t!==void 0?t:(o=r.errors)==null?void 0:o[s]}function aj(){let{router:t}=Z0("useNavigate"),r=hf("useNavigate"),s=p.useRef(!1);return xv(()=>{s.current=!0}),p.useCallback(async(c,u={})=>{Zn(s.current,hv),s.current&&(typeof c=="number"?await t.navigate(c):await t.navigate(c,{fromRouteId:r,...u}))},[t,r])}var Ux={};function vv(t,r,s){!r&&!Ux[t]&&(Ux[t]=!0,Zn(!1,s))}p.memo(rj);function rj({routes:t,future:r,state:s,isStatic:o,onError:c}){return W0(t,void 0,{state:s,isStatic:o,onError:c})}function lj({basename:t="/",children:r=null,location:s,navigationType:o="POP",navigator:c,static:u=!1,unstable_useTransitions:d}){Ft(!Ys(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=t.replace(/^\/*/,"/"),g=p.useMemo(()=>({basename:h,navigator:c,static:u,unstable_useTransitions:d,future:{}}),[h,c,u,d]);typeof s=="string"&&(s=zl(s));let{pathname:m="/",search:y="",hash:v="",state:b=null,key:k="default",unstable_mask:S}=s,w=p.useMemo(()=>{let C=La(m,h);return C==null?null:{location:{pathname:C,search:y,hash:v,state:b,key:k,unstable_mask:S},navigationType:o}},[h,m,y,v,b,k,o,S]);return Zn(w!=null,`<Router basename="${h}"> is not able to match the URL "${m}${y}${v}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:p.createElement(Gn.Provider,{value:g},p.createElement($o.Provider,{children:r,value:w}))}var No="get",To="application/x-www-form-urlencoded";function Vo(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function sj(t){return Vo(t)&&t.tagName.toLowerCase()==="button"}function ij(t){return Vo(t)&&t.tagName.toLowerCase()==="form"}function oj(t){return Vo(t)&&t.tagName.toLowerCase()==="input"}function cj(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function uj(t,r){return t.button===0&&(!r||r==="_self")&&!cj(t)}var xo=null;function dj(){if(xo===null)try{new FormData(document.createElement("form"),0),xo=!1}catch{xo=!0}return xo}var fj=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function xd(t){return t!=null&&!fj.has(t)?(Zn(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${To}"`),null):t}function pj(t,r){let s,o,c,u,d;if(ij(t)){let h=t.getAttribute("action");o=h?La(h,r):null,s=t.getAttribute("method")||No,c=xd(t.getAttribute("enctype"))||To,u=new FormData(t)}else if(sj(t)||oj(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?La(g,r):null,s=t.getAttribute("formmethod")||h.getAttribute("method")||No,c=xd(t.getAttribute("formenctype"))||xd(h.getAttribute("enctype"))||To,u=new FormData(h,t),!dj()){let{name:m,type:y,value:v}=t;if(y==="image"){let b=m?`${m}.`:"";u.append(`${b}x`,"0"),u.append(`${b}y`,"0")}else m&&u.append(m,v)}}else{if(Vo(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');s=No,o=null,c=To,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 xf(t,r){if(t===!1||t===null||typeof t>"u")throw new Error(r)}function mj(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&&La(c.pathname,r)==="/"?c.pathname=`${r.replace(/\/$/,"")}/_root.${o}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${o}`,c}async function hj(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 xj(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 gj(t,r,s){let o=await Promise.all(t.map(async c=>{let u=r.routes[c.route.id];if(u){let d=await hj(u,s);return d.links?d.links():[]}return[]}));return jj(o.flat(1).filter(xj).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function $x(t,r,s,o,c,u){let d=(g,m)=>s[m]?g.route.id!==s[m].route.id:!0,h=(g,m)=>{var y;return s[m].pathname!==g.pathname||((y=s[m].route.path)==null?void 0:y.endsWith("*"))&&s[m].params["*"]!==g.params["*"]};return u==="assets"?r.filter((g,m)=>d(g,m)||h(g,m)):u==="data"?r.filter((g,m)=>{var v;let y=o.routes[g.route.id];if(!y||!y.hasLoader)return!1;if(d(g,m)||h(g,m))return!0;if(g.route.shouldRevalidate){let b=g.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((v=s[0])==null?void 0:v.params)||{},nextUrl:new URL(t,window.origin),nextParams:g.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function vj(t,r,{includeHydrateFallback:s}={}){return yj(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 yj(t){return[...new Set(t)]}function bj(t){let r={},s=Object.keys(t).sort();for(let o of s)r[o]=t[o];return r}function jj(t,r){let s=new Set;return new Set(r),t.reduce((o,c)=>{let u=JSON.stringify(bj(c));return s.has(u)||(s.add(u),o.push({key:u,link:c})),o},[])}function yv(){let t=p.useContext(Dl);return xf(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function Sj(){let t=p.useContext(Uo);return xf(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var gf=p.createContext(void 0);gf.displayName="FrameworkContext";function bv(){let t=p.useContext(gf);return xf(t,"You must render this element inside a <HydratedRouter> element"),t}function kj(t,r){let s=p.useContext(gf),[o,c]=p.useState(!1),[u,d]=p.useState(!1),{onFocus:h,onBlur:g,onMouseEnter:m,onMouseLeave:y,onTouchStart:v}=r,b=p.useRef(null);p.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]),p.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:As(h,k),onBlur:As(g,S),onMouseEnter:As(m,k),onMouseLeave:As(y,S),onTouchStart:As(v,k)}]:[!1,b,{}]}function As(t,r){return s=>{t&&t(s),s.defaultPrevented||r(s)}}function wj({page:t,...r}){let{router:s}=yv(),o=p.useMemo(()=>sv(s.routes,t,s.basename),[s.routes,t,s.basename]);return o?p.createElement(Ej,{page:t,matches:o,...r}):null}function Cj(t){let{manifest:r,routeModules:s}=bv(),[o,c]=p.useState([]);return p.useEffect(()=>{let u=!1;return gj(t,r,s).then(d=>{u||c(d)}),()=>{u=!0}},[t,r,s]),o}function Ej({page:t,matches:r,...s}){let o=or(),{future:c,manifest:u,routeModules:d}=bv(),{basename:h}=yv(),{loaderData:g,matches:m}=Sj(),y=p.useMemo(()=>$x(t,r,m,u,o,"data"),[t,r,m,u,o]),v=p.useMemo(()=>$x(t,r,m,u,o,"assets"),[t,r,m,u,o]),b=p.useMemo(()=>{if(t===o.pathname+o.search+o.hash)return[];let w=new Set,C=!1;if(r.forEach(R=>{var B;let M=u.routes[R.route.id];!M||!M.hasLoader||(!y.some(D=>D.route.id===R.route.id)&&R.route.id in g&&((B=d[R.route.id])!=null&&B.shouldRevalidate)||M.hasClientLoader?C=!0:w.add(R.route.id))}),w.size===0)return[];let T=mj(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=p.useMemo(()=>vj(v,u),[v,u]),S=Cj(v);return p.createElement(p.Fragment,null,b.map(w=>p.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...s})),k.map(w=>p.createElement("link",{key:w,rel:"modulepreload",href:w,...s})),S.map(({key:w,link:C})=>p.createElement("link",{key:w,nonce:s.nonce,...C,crossOrigin:C.crossOrigin??s.crossOrigin})))}function Nj(...t){return r=>{t.forEach(s=>{typeof s=="function"?s(r):s!=null&&(s.current=r)})}}var Tj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Tj&&(window.__reactRouterVersion="7.13.1")}catch{}function Rj({basename:t,children:r,unstable_useTransitions:s,window:o}){let c=p.useRef();c.current==null&&(c.current=c0({window:o,v5Compat:!0}));let u=c.current,[d,h]=p.useState({action:u.action,location:u.location}),g=p.useCallback(m=>{s===!1?h(m):p.startTransition(()=>h(m))},[s]);return p.useLayoutEffect(()=>u.listen(g),[u,g]),p.createElement(lj,{basename:t,children:r,location:d.location,navigationType:d.action,navigator:u,unstable_useTransitions:s})}var jv=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Sv=p.forwardRef(function({onClick:r,discover:s="render",prefetch:o="none",relative:c,reloadDocument:u,replace:d,unstable_mask:h,state:g,target:m,to:y,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:k,...S},w){let{basename:C,navigator:T,unstable_useTransitions:R}=p.useContext(Gn),M=typeof y=="string"&&jv.test(y),B=dv(y,C);y=B.to;let D=P0(y,{relative:c}),F=or(),E=null;if(h){let $=ff(h,[],F.unstable_mask?F.unstable_mask.pathname:"/",!0);C!=="/"&&($.pathname=$.pathname==="/"?C:ua([C,$.pathname])),E=T.createHref($)}let[H,N,_]=kj(o,S),P=zj(y,{replace:d,unstable_mask:h,state:g,target:m,preventScrollReset:v,relative:c,viewTransition:b,unstable_defaultShouldRevalidate:k,unstable_useTransitions:R});function K($){r&&r($),$.defaultPrevented||P($)}let X=!(B.isExternal||u),ee=p.createElement("a",{...S,..._,href:(X?E:void 0)||B.absoluteURL||D,onClick:X?K:r,ref:Nj(w,N),target:m,"data-discover":!M&&s==="render"?"true":void 0});return H&&!M?p.createElement(p.Fragment,null,ee,p.createElement(wj,{page:D})):ee});Sv.displayName="Link";var Aj=p.forwardRef(function({"aria-current":r="page",caseSensitive:s=!1,className:o="",end:c=!1,style:u,to:d,viewTransition:h,children:g,...m},y){let v=Ks(d,{relative:m.relative}),b=or(),k=p.useContext(Uo),{navigator:S,basename:w}=p.useContext(Gn),C=k!=null&&Ij(v)&&h===!0,T=S.encodeLocation?S.encodeLocation(v).pathname:v.pathname,R=b.pathname,M=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;s||(R=R.toLowerCase(),M=M?M.toLowerCase():null,T=T.toLowerCase()),M&&w&&(M=La(M,w)||M);const B=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let D=R===T||!c&&R.startsWith(T)&&R.charAt(B)==="/",F=M!=null&&(M===T||!c&&M.startsWith(T)&&M.charAt(T.length)==="/"),E={isActive:D,isPending:F,isTransitioning:C},H=D?r:void 0,N;typeof o=="function"?N=o(E):N=[o,D?"active":null,F?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let _=typeof u=="function"?u(E):u;return p.createElement(Sv,{...m,"aria-current":H,className:N,ref:y,style:_,to:d,viewTransition:h},typeof g=="function"?g(E):g)});Aj.displayName="NavLink";var Mj=p.forwardRef(({discover:t="render",fetcherKey:r,navigate:s,reloadDocument:o,replace:c,state:u,method:d=No,action:h,onSubmit:g,relative:m,preventScrollReset:y,viewTransition:v,unstable_defaultShouldRevalidate:b,...k},S)=>{let{unstable_useTransitions:w}=p.useContext(Gn),C=Oj(),T=Bj(h,{relative:m}),R=d.toLowerCase()==="get"?"get":"post",M=typeof h=="string"&&jv.test(h),B=D=>{if(g&&g(D),D.defaultPrevented)return;D.preventDefault();let F=D.nativeEvent.submitter,E=(F==null?void 0:F.getAttribute("formmethod"))||d,H=()=>C(F||D.currentTarget,{fetcherKey:r,method:E,navigate:s,replace:c,state:u,relative:m,preventScrollReset:y,viewTransition:v,unstable_defaultShouldRevalidate:b});w&&s!==!1?p.startTransition(()=>H()):H()};return p.createElement("form",{ref:S,method:R,action:T,onSubmit:o?g:B,...k,"data-discover":!M&&t==="render"?"true":void 0})});Mj.displayName="Form";function Lj(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function kv(t){let r=p.useContext(Dl);return Ft(r,Lj(t)),r}function zj(t,{target:r,replace:s,unstable_mask:o,state:c,preventScrollReset:u,relative:d,viewTransition:h,unstable_defaultShouldRevalidate:g,unstable_useTransitions:m}={}){let y=F0(),v=or(),b=Ks(t,{relative:d});return p.useCallback(k=>{if(uj(k,r)){k.preventDefault();let S=s!==void 0?s:Us(v)===Us(b),w=()=>y(t,{replace:S,unstable_mask:o,state:c,preventScrollReset:u,relative:d,viewTransition:h,unstable_defaultShouldRevalidate:g});m?p.startTransition(()=>w()):w()}},[v,y,b,s,o,c,r,t,u,d,h,g,m])}var Dj=0,_j=()=>`__${String(++Dj)}__`;function Oj(){let{router:t}=kv("useSubmit"),{basename:r}=p.useContext(Gn),s=tj(),o=t.fetch,c=t.navigate;return p.useCallback(async(u,d={})=>{let{action:h,method:g,encType:m,formData:y,body:v}=pj(u,r);if(d.navigate===!1){let b=d.fetcherKey||_j();await o(b,s,d.action||h,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:y,body:v,formMethod:d.method||g,formEncType:d.encType||m,flushSync:d.flushSync})}else await c(d.action||h,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:y,body:v,formMethod:d.method||g,formEncType:d.encType||m,replace:d.replace,state:d.state,fromRouteId:s,flushSync:d.flushSync,viewTransition:d.viewTransition})},[o,c,r,s])}function Bj(t,{relative:r}={}){let{basename:s}=p.useContext(Gn),o=p.useContext(za);Ft(o,"useFormAction must be used inside a RouteContext");let[c]=o.matches.slice(-1),u={...Ks(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:ua([s,u.pathname])),Us(u)}function Ij(t,{relative:r}={}){let s=p.useContext(pv);Ft(s!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=kv("useViewTransitionState"),c=Ks(t,{relative:r});if(!s.isTransitioning)return!1;let u=La(s.currentLocation.pathname,o)||s.currentLocation.pathname,d=La(s.nextLocation.pathname,o)||s.nextLocation.pathname;return Do(c.pathname,d)!=null||Do(c.pathname,u)!=null}var Po=lv();const Hj=rv(Po),Uj="modulepreload",$j=function(t){return"/"+t},Vx={},Fo=function(r,s,o){let c=Promise.resolve();if(s&&s.length>0){let d=function(m){return Promise.all(m.map(y=>Promise.resolve(y).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),g=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));c=d(s.map(m=>{if(m=$j(m),m in Vx)return;Vx[m]=!0;const y=m.endsWith(".css"),v=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${v}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":Uj,y||(b.as="script"),b.crossOrigin="",b.href=m,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 ${m}`)))})}))}function u(d){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=d,window.dispatchEvent(h),!h.defaultPrevented)throw d}return c.then(d=>{for(const h of d||[])h.status==="rejected"&&u(h.reason);return r().catch(u)})},Px={own:"authoring-project",installed:"available-project",global:"available-personal"},qd=new Set(["available-project","available-personal","available-plugin","authoring-project","authoring-plugin"]);function Vj(t){if(typeof t=="string"){if(qd.has(t))return t;if(Object.prototype.hasOwnProperty.call(Px,t))return Px[t]}return"authoring-project"}function Pj(t){return t.startsWith("available-")?"available":"authoring"}function Fj(t){const r=t.indexOf("-");return t.slice(r+1)}const Vn="";class Os extends Error{constructor(r,s){super(r),this.name="ApiError",this.status=s}}async function $e(t,r){const s=await fetch(`${Vn}${t}`,r);if(!s.ok){const o=await s.json().catch(()=>({error:s.statusText}));throw new Os(o.error||`HTTP ${s.status}`,s.status)}return s.json()}function ln(t){return typeof t=="string"&&t.length>0?t:null}function Gj(t){return typeof t=="number"&&Number.isFinite(t)?t:null}function gd(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 Wj(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"&&qd.has(r.scopeV2)?r.scopeV2:Vj(r.scope),d=Pj(u),h=Fj(u),g=typeof r.precedenceRank=="number"?r.precedenceRank:void 0;let m;r.shadowedBy===null?m=null:typeof r.shadowedBy=="string"&&qd.has(r.shadowedBy)?m=r.shadowedBy:m=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:ln(r.symlinkTarget),installMethod:c,scopeV2:u,group:d,source:h,pluginName:ln(r.pluginName),pluginNamespace:ln(r.pluginNamespace),pluginMarketplace:ln(r.pluginMarketplace),pluginManifestPath:ln(r.pluginManifestPath),pluginVersion:ln(r.pluginVersion),precedenceRank:g,shadowedBy:m,description:ln(r.description),version:ln(r.version),category:ln(r.category),author:ln(r.author),license:ln(r.license),homepage:ln(r.homepage),tags:gd(r.tags),deps:gd(r.deps),mcpDeps:gd(r.mcpDeps),entryPoint:ln(r.entryPoint),lastModified:ln(r.lastModified),sizeBytes:Gj(r.sizeBytes),sourceAgent:ln(r.sourceAgent)};if(r.provenance&&typeof r.provenance=="object"){const v=r.provenance;(v.promotedFrom==="installed"||v.promotedFrom==="global")&&typeof v.sourcePath=="string"&&typeof v.promotedAt=="number"?y.provenance={promotedFrom:v.promotedFrom,sourcePath:v.sourcePath,promotedAt:v.promotedAt,sourceSkillVersion:typeof v.sourceSkillVersion=="string"?v.sourceSkillVersion:void 0}:y.provenance=null}else r.provenance===null&&(y.provenance=null);return typeof r.updateAvailable=="boolean"&&(y.updateAvailable=r.updateAvailable),typeof r.currentVersion=="string"&&(y.currentVersion=r.currentVersion),typeof r.latestVersion=="string"&&(y.latestVersion=r.latestVersion),typeof r.pinnedVersion=="string"&&(y.pinnedVersion=r.pinnedVersion),y}const Ce={getConfig(){return $e("/api/config")},setConfig(t,r){return $e("/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 $e(`/api/skills${s?"?"+s:""}`);return Array.isArray(o)?o.map(Wj):[]},getAgents(){return $e("/api/agents")},getSkillDetail(t,r){return $e(`/api/skills/${t}/${r}`)},async getEvals(t,r){const s=await $e(`/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 $e(`/api/skills/${t}/${r}/evals`)},getActivationHistoryEnvelope(t,r){return $e(`/api/skills/${t}/${r}/activation-history`)},saveEvals(t,r,s){return $e(`/api/skills/${t}/${r}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})},generateEvals(t,r){return $e(`/api/skills/${t}/${r}/generate-evals`,{method:"POST"})},async getLatestBenchmark(t,r){const s=await fetch(`${Vn}/api/skills/${t}/${r}/benchmark/latest`);if(!s.ok){const o=await s.json().catch(()=>({error:s.statusText}));throw new Os(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 $e(`/api/skills/${t}/${r}/history${c?"?"+c:""}`)},getHistoryEntry(t,r,s){return $e(`/api/skills/${t}/${r}/history/${encodeURIComponent(s)}`)},compareRuns(t,r,s,o){return $e(`/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 $e(`/api/skills/${t}/${r}/history/case/${s}${u?"?"+u:""}`)},deleteHistoryEntry(t,r,s){return $e(`/api/skills/${t}/${r}/history/${encodeURIComponent(s)}`,{method:"DELETE"})},deleteSkill(t,r){return $e(`/api/skills/${t}/${r}`,{method:"DELETE"})},improveSkill(t,r,s){return $e(`/api/skills/${t}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})},instructEdit(t,r,s){return $e(`/api/skills/${t}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"instruct",...s})})},applyImprovement(t,r,s){return $e(`/api/skills/${t}/${r}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:s})})},getStats(t,r){return $e(`/api/skills/${t}/${r}/stats`)},getDependencies(t,r){return $e(`/api/skills/${t}/${r}/dependencies`)},getProjectLayout(){return $e("/api/project-layout")},createSkill(t){return $e("/api/skills/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},detectEngines(){return $e("/api/studio/detect-engines")},saveDraft(t){return $e("/api/skills/save-draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},getSkillCreatorStatus(){return $e("/api/skill-creator-status")},generateSkill(t){return $e("/api/skills/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},getSkillFiles(t,r){return $e(`/api/skills/${t}/${r}/files`)},getSkillFile(t,r,s){return $e(`/api/skills/${t}/${r}/file?path=${encodeURIComponent(s)}`)},saveSkillFile(t,r,s,o){return $e(`/api/skills/${t}/${r}/file`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:s,content:o})})},getLeaderboard(t,r){return $e(`/api/skills/${t}/${r}/leaderboard`)},getLeaderboardEntry(t,r,s){return $e(`/api/skills/${t}/${r}/leaderboard/${encodeURIComponent(s)}`)},startSweep(t,r,s){const o=`${Vn}/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 $e(`/api/credentials/${t}/${r}`)},setCredential(t,r,s,o){return $e(`/api/credentials/${t}/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,value:o})})},getParams(t,r){return $e(`/api/credentials/${t}/${r}/params`)},getParamsRevealed(t,r,s){const o=s?`reveal=true&key=${encodeURIComponent(s)}`:"reveal=true";return $e(`/api/credentials/${t}/${r}/params?${o}`)},searchModels(){return $e("/api/openrouter/models")},async getSkillVersions(t,r){const s=await $e(`/api/skills/${t}/${r}/versions`);return Array.isArray(s)?s:Array.isArray(s.versions)?s.versions:[]},getSkillVersionsEnvelope(t,r){return $e(`/api/skills/${t}/${r}/versions`)},getVersionDiff(t,r,s,o){return $e(`/api/skills/${t}/${r}/versions/diff?from=${s}&to=${o}`)},startBatchUpdate(t){const r=`${Vn}/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=`${Vn}/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 postSkillUpdate(t,r,s){const o=`${Vn}/api/skills/${t}/${r}/update`,c=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},signal:s}),u=await c.text();let d;const h=u.match(/event:\s*done[\s\S]*?data:\s*(\{[^\n]+\})/);if(h)try{d=JSON.parse(h[1]).version}catch{}return{ok:c.ok,status:c.status,body:u.slice(0,200),version:d}},async rescanSkill(t,r){const s=`${t}/${r}`,o=await fetch(`${Vn}/api/v1/skills/${encodeURIComponent(s)}/rescan`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!o.ok)throw new Error(`rescan failed: HTTP ${o.status}`);return await o.json()},async getSkillUpdates(){try{const t=await fetch(`${Vn}/api/skills/updates`);return t.ok?await t.json():[]}catch{return[]}},async checkSkillUpdates(t){if(t.length===0)return[];try{const r=await fetch(`${Vn}/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[]}},async resolveInstalledSkillIds(t){if(t.length===0)return[];try{const r=await fetch(`${Vn}/api/v1/skills/check-updates`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({skills:t.map(u=>({name:u.name,currentVersion:u.currentVersion??"0.0.0"}))})});if(!r.ok)return t.map(u=>({plugin:u.plugin,skill:u.skill}));const s=await r.json().catch(()=>null),o=Array.isArray(s)?s:Array.isArray(s==null?void 0:s.results)?s.results:[],c=new Map(o.map(u=>[u.name,u]));return t.map(u=>{const d=c.get(u.name);return{plugin:u.plugin,skill:u.skill,uuid:typeof(d==null?void 0:d.id)=="string"&&d.id.length>0?d.id:void 0,slug:typeof(d==null?void 0:d.slug)=="string"&&d.slug.length>0?d.slug:void 0}})}catch{return t.map(r=>({plugin:r.plugin,skill:r.skill}))}},promoteSkill(t,r,s){const o=s!=null&&s.overwrite?"?overwrite=true":"";return vd(`/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 vd(`/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 vd(`/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 $e(`/api/studio/ops${s?"?"+s:""}`)},deleteStudioOp(t){return $e(`/api/studio/ops/${encodeURIComponent(t)}`,{method:"DELETE"})},studioOpsStream(){return new EventSource(`${Vn}/api/studio/ops/stream`)}};async function vd(t,r,s){const o=await fetch(`${Vn}${t}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},signal:s});if(!o.ok||!o.body){let y=`HTTP ${o.status}`,v;try{const k=await o.json();k.error&&(y=k.error),typeof k.code=="string"&&(v=k.code)}catch{}const b=new Os(y,o.status);throw v&&(b.code=v),b}const c=o.body.getReader(),u=new TextDecoder;let d="",h="",g=null,m=null;for(;;){const{done:y,value:v}=await c.read();if(y)break;d+=u.decode(v,{stream:!0});const b=d.split(`
|
|
62
|
+
`);d=b.pop()??"";for(const 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"&&(m=w)}h=""}}if(m){const y=new Os(m.message,500);throw y.code=m.code,y}if(!g)throw new Os("Transfer stream ended without 'done' event",500);return g}function qj(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 Yj(t){const[r,s]=p.useState(()=>typeof window>"u"?!1:window.matchMedia(t).matches);return p.useEffect(()=>{const o=window.matchMedia(t);s(o.matches);const c=u=>s(u.matches);return o.addEventListener("change",c),()=>o.removeEventListener("change",c)},[t]),r}const Kj=500,Yd="vskill.updates.seenLastId";function Xj(){if(typeof window>"u")return null;try{return window.localStorage.getItem(Yd)}catch{return null}}function yd(t){if(!(typeof window>"u"))try{t==null?window.localStorage.removeItem(Yd):window.localStorage.setItem(Yd,t)}catch{}}function Qj(){let t=new Map;const r=new Set,s=new Set,o=[];let c=Xj();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>Kj){const g=o.shift();g&&s.delete(g)}c=h,yd(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,yd(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,yd(null),u()}}}const Dr=Qj(),Zj=3e5,Jj=500,eS=15e3,tS=6e4,nS=6e4,aS="/api/v1/skills/stream";function Fx(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 Gx(t){let r=0;for(const s of t)s.updateAvailable&&r++;return r}function rS(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 lS(t){const r=(t==null?void 0:t.intervalMs)??Zj,s=(t==null?void 0:t.debounceMs)??Jj,o=(t==null?void 0:t.timeoutMs)??eS,c=(t==null?void 0:t.staleAfterMs)??tS,u=(t==null?void 0:t.disconnectFallbackMs)??nS,d=(t==null?void 0:t.streamUrlBase)??aS,h=p.useMemo(()=>!(t!=null&&t.skillIds)||t.skillIds.length===0?"":[...t.skillIds].sort().join(","),[t==null?void 0:t.skillIds]),g=p.useMemo(()=>{const L=(t==null?void 0:t.trackingSkillIds)??(t==null?void 0:t.skillIds)??[];return L.length===0?"":[...L].sort().join(",")},[t==null?void 0:t.trackingSkillIds,t==null?void 0:t.skillIds]),[m,y]=p.useState([]),[v,b]=p.useState(()=>new Map),[k,S]=p.useState(0),[w,C]=p.useState(!1),[T,R]=p.useState(null),[M,B]=p.useState(null),D=p.useRef(null),F=p.useRef(null),E=p.useRef(null),H=p.useRef(null),N=p.useRef(!0),[_,P]=p.useState(()=>h?"connecting":"fallback"),K=p.useRef(_);K.current=_;const X=p.useSyncExternalStore(L=>Dr.subscribe(L),()=>Dr.getSnapshot(),()=>Dr.getSnapshot()),ee=X.size,$=p.useCallback(async()=>{C(!0);const L=new AbortController,q=setTimeout(()=>L.abort(),o);try{const W=await Promise.race([Ce.getSkillUpdates(),new Promise((te,fe)=>{L.signal.addEventListener("abort",()=>{fe(new Error("TIMEOUT"))})})]);if(W==="TIMEOUT")throw new Error("TIMEOUT");if(!N.current)return;y(W),b(Fx(W)),S(Gx(W)),F.current=Date.now(),R(F.current),B(null)}catch(W){if(!N.current)return;B(W instanceof Error?W:new Error(String(W)))}finally{clearTimeout(q),N.current&&C(!1)}},[o]),z=p.useCallback(()=>{if(D.current)return D.current;const L=$().finally(()=>{D.current=null});return D.current=L,L},[$]),I=p.useCallback(()=>{E.current==null&&(E.current=setInterval(()=>{z()},r))},[r,z]),O=p.useCallback(()=>{E.current!=null&&(clearInterval(E.current),E.current=null)},[]);p.useEffect(()=>{N.current=!0,(F.current==null||Date.now()-F.current>c)&&z(),(typeof document>"u"||document.visibilityState!=="hidden")&&I();const W=()=>{if(H.current&&(clearTimeout(H.current),H.current=null),document.visibilityState==="hidden"){O();return}H.current=setTimeout(()=>{H.current=null,(F.current==null||Date.now()-F.current>c)&&z(),I()},s)};return typeof document<"u"&&document.addEventListener("visibilitychange",W),()=>{N.current=!1,typeof document<"u"&&document.removeEventListener("visibilitychange",W),H.current&&clearTimeout(H.current),O()}},[]);const U=p.useCallback(async L=>{if(L.length!==0)try{const q=await Ce.checkSkillUpdates(L);if(!N.current||q.length===0)return;const W=Date.now(),te=q.filter(ie=>ie.skillId&&ie.eventId&&ie.version).map(ie=>({skillId:ie.skillId,version:ie.version,eventId:ie.eventId,publishedAt:ie.publishedAt,diffSummary:ie.diffSummary,receivedAt:W}));te.length>0&&Dr.mergeBulk(te);const fe=q.filter(ie=>typeof ie.trackedForUpdates=="boolean"||typeof ie.updateAvailable=="boolean").map(ie=>({name:ie.name??ie.skillId,installed:ie.installed??"",latest:ie.latest??null,updateAvailable:ie.updateAvailable??!1,trackedForUpdates:typeof ie.trackedForUpdates=="boolean"?ie.trackedForUpdates:void 0}));fe.length>0&&y(ie=>{const ve=new Map;for(const Ae of ie)ve.set(Ae.name.split("/").pop()||Ae.name,Ae);let de=0;for(const Ae of fe){const _e=Ae.name.split("/").pop()||Ae.name,re=ve.get(_e);if(re){const he={...re};re.trackedForUpdates===void 0&&Ae.trackedForUpdates!==void 0&&(he.trackedForUpdates=Ae.trackedForUpdates),ve.set(_e,he)}else ve.set(_e,{name:Ae.name,installed:Ae.installed??"",latest:Ae.latest??null,updateAvailable:Ae.updateAvailable??!1,trackedForUpdates:Ae.trackedForUpdates}),de+=1}if(de===0&&ve.size===ie.length)return ie;const Se=[...ve.values()];return b(Fx(Se)),S(Gx(Se)),Se})}catch{}},[]);p.useEffect(()=>{const L=h||g;if(!L){P("fallback");return}if(typeof window>"u"||typeof EventSource>"u"){P("fallback");return}P("connecting");const q=L.split(","),W=`${d}?skills=${encodeURIComponent(L)}`;let te=null,fe=null,ie=null;const ve=()=>{fe==null&&(fe=setTimeout(()=>{fe=null,N.current&&K.current!=="connected"&&P("fallback")},u))},de=()=>{fe!=null&&(clearTimeout(fe),fe=null)};ve();const Se=1e3,Ae=()=>{N.current&&ie==null&&(ie=setTimeout(()=>{if(ie=null,!!N.current&&!(te&&te.readyState!==EventSource.CLOSED)){if(te)try{te.close()}catch{}he()}},Se))},_e=pe=>{if(!N.current)return;let xe;try{xe=JSON.parse(pe.data)}catch{return}if(!rS(xe)||Dr.ingest(xe)==="duplicate")return;if(typeof document>"u"||document.visibilityState!=="hidden"){const Oe=`${xe.skillId} updated to ${xe.version}`;window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:Oe,severity:"info",skillId:xe.skillId,version:xe.version,eventId:xe.eventId}}))}},re=()=>{N.current&&(Dr.clearSeen(),U(q))},he=()=>{N.current&&(te=new EventSource(W),te.onopen=()=>{N.current&&(de(),P("connected"))},te.onerror=()=>{N.current&&(ve(),te&&te.readyState===EventSource.CLOSED&&Ae())},te.onmessage=_e,te.addEventListener("gone",re))};return he(),()=>{if(de(),ie!=null&&(clearTimeout(ie),ie=null),te){try{te.removeEventListener("gone",re)}catch{}try{te.close()}catch{}}}},[h,g,d,u,U]),p.useEffect(()=>{if(!g)return;const L=g.split(",");U(L)},[g,U]);const se=p.useCallback(L=>{Dr.dismiss(L)},[]);return{updates:m,updatesMap:v,updateCount:k,isRefreshing:w,lastFetchAt:T,error:M,refresh:z,updatesById:X,pushUpdateCount:ee,status:_,dismiss:se}}function sS(t){const r=[];for(const s of t){const o=typeof s.uuid=="string"&&s.uuid.length>0,c=typeof s.slug=="string"&&s.slug.length>0;if(!o&&!c)continue;const u={};o&&(u.uuid=s.uuid),c&&(u.slug=s.slug),r.push(u)}return r}const iS={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list",updateNotificationDismissed:!1,revealSkillId:null};function oS(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 wv=p.createContext(null),Cv=wv;function ea(){const t=p.useContext(Cv);if(!t)throw new Error("useStudio must be used within StudioProvider");return t}function cS({children:t}){const[r,s]=p.useReducer(oS,iS),o=Yj("(max-width: 767px)");p.useEffect(()=>{s({type:"SET_MOBILE",isMobile:o})},[o]);const[c,u]=p.useState(()=>{try{const O=window.localStorage.getItem("vskill.studio.prefs");if(!O)return null;const U=JSON.parse(O);return typeof U.activeAgent=="string"?U.activeAgent:null}catch{return null}}),[d,h]=p.useState(c!==null);p.useEffect(()=>{function O(U){if(!(U instanceof CustomEvent))return;const se=U.detail;se!=null&&se.agentId&&(u(se.agentId),h(!0))}return window.addEventListener("studio:agent-changed",O),()=>window.removeEventListener("studio:agent-changed",O)},[]),p.useEffect(()=>{if(d)return;let O=!1;return Ce.getAgents().then(U=>{if(O)return;const se=(U==null?void 0:U.suggested)??"claude-code";u(L=>L??se),h(!0)}).catch(()=>{O||(u(U=>U??"claude-code"),h(!0))}),()=>{O=!0}},[d]);const g=p.useCallback(()=>{if(!d||!c)return;s({type:"SET_SKILLS_LOADING",loading:!0});const O={agent:c};Ce.getSkills(O).then(U=>{s({type:"SET_SKILLS",skills:U});const L=window.location.hash.match(/^#\/skills\/([^/]+)\/([^/?]+)/);if(L){const[,q,W]=L,te=U.find(fe=>fe.plugin===q&&fe.skill===W);te&&s({type:"SELECT_SKILL",skill:{plugin:q,skill:W,origin:te.origin}})}}).catch(U=>s({type:"SET_SKILLS_ERROR",error:U.message}))},[c,d]);p.useEffect(()=>{g()},[g]);const m=p.useCallback(O=>{s({type:"SELECT_SKILL",skill:O}),window.location.hash=`/skills/${O.plugin}/${O.skill}`},[]),y=p.useRef(r.skills);p.useEffect(()=>{y.current=r.skills},[r.skills]);const v=p.useCallback((O,U)=>{const se=y.current,L=O?se.find(te=>te.plugin===O&&te.skill===U):se.find(te=>te.skill===U&&te.source!=="plugin");if(!O&&!L){typeof console<"u"&&console.warn(`[StudioContext] revealSkill: no plugin provided and skill "${U}" not yet in state — skipping reveal`);return}const q=(L==null?void 0:L.plugin)??O,W=(L==null?void 0:L.origin)??"source";s({type:"REVEAL_SKILL",skill:{plugin:q,skill:U,origin:W}}),window.location.hash=`/skills/${q}/${U}`},[]),b=p.useCallback(()=>{s({type:"CLEAR_REVEAL"})},[]),k=p.useCallback(()=>{s({type:"CLEAR_SELECTION"}),window.location.hash.startsWith("#/skills/")&&history.replaceState(null,"",window.location.pathname+window.location.search)},[]),S=p.useCallback(O=>{s({type:"SET_MODE",mode:O})},[]),w=p.useCallback(O=>{s({type:"SET_SEARCH",query:O})},[]),C=p.useCallback(O=>{s({type:"SET_MOBILE_VIEW",view:O})},[]),T=p.useCallback(()=>{s({type:"DISMISS_UPDATE_NOTIFICATION"})},[]),R=p.useRef(new Map),M=p.useRef(""),B=p.useRef(!1),[D,F]=p.useState(""),E=p.useMemo(()=>r.skills.map(O=>`${O.plugin}/${O.skill}`),[r.skills]),H=p.useMemo(()=>D?D.split(",").filter(Boolean):[],[D]),N=lS({skillIds:H,trackingSkillIds:E}),_=p.useRef("");p.useEffect(()=>{const O=r.skills.filter(W=>W.origin==="installed");if(O.length===0){F(""),_.current="";return}const U=new Map;for(const W of N.updates)U.set(W.name.split("/").pop()||W.name,W);const se=O.map(W=>{const te=U.get(W.skill);return{plugin:W.plugin,skill:W.skill,name:(te==null?void 0:te.name)??W.skill,currentVersion:W.currentVersion??(te==null?void 0:te.installed)??"0.0.0"}}),L=se.map(W=>`${W.plugin}/${W.skill}@${W.currentVersion}#${W.name}`).sort().join("|");if(L===_.current)return;_.current=L;let q=!1;return Ce.resolveInstalledSkillIds(se).then(W=>{if(q)return;const ie=[...sS(W).flatMap(ve=>[ve.uuid,ve.slug].filter(Boolean))].sort().join(",");ie!==M.current&&(M.current=ie,R.current=new Map(W.map(ve=>[`${ve.plugin}/${ve.skill}`,{uuid:ve.uuid,slug:ve.slug}])),F(ie))}).catch(W=>{if(q||(_.current=""),!B.current){B.current=!0;const te=W instanceof Error?W.message:String(W);console.warn("[studio] resolveInstalledSkillIds failed (using polling fallback):",te)}}),()=>{q=!0}},[r.skills,N.updates]);const P=p.useMemo(()=>{const O=r.skills.map(U=>{if(!U.updateAvailable&&U.latestVersion===void 0&&U.trackedForUpdates===void 0)return U;const se={...U};return delete se.updateAvailable,delete se.currentVersion,delete se.latestVersion,delete se.trackedForUpdates,se});return qj(O,N.updates)},[r.skills,N.updates]),K=p.useMemo(()=>{const O={source:0,installed:0};for(const U of P)U.updateAvailable&&(O[U.origin]+=1);return O},[P]),X=p.useMemo(()=>({...r,skills:P}),[r,P]),ee=N.updateCount,$=N.refresh,z=N.isRefreshing,I=p.useMemo(()=>({state:X,selectSkill:m,clearSelection:k,setMode:S,setSearch:w,setMobileView:C,refreshSkills:g,updateCount:ee,dismissUpdateNotification:T,updates:N.updates,outdatedByOrigin:K,isRefreshingUpdates:z,refreshUpdates:$,revealSkill:v,clearReveal:b,updatesById:N.updatesById,pushUpdateCount:N.pushUpdateCount,updateStreamStatus:N.status,dismissPushUpdate:N.dismiss}),[X,m,k,S,w,C,g,ee,T,N.updates,K,z,$,v,b,N.updatesById,N.pushUpdateCount,N.status,N.dismiss]);return a.jsx(Cv.Provider,{value:I,children:t})}const uS={config:null,loading:!0};function dS(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 Ev=p.createContext(null);function Ur(){const t=p.useContext(Ev);if(!t)throw new Error("useConfig must be used within ConfigProvider");return t}function fS({children:t}){const[r,s]=p.useReducer(dS,uS),o=p.useCallback(()=>{Ce.getConfig().then(d=>s({type:"SET_CONFIG",config:d})).catch(()=>{})},[]);p.useEffect(()=>{o()},[o]);const c=p.useCallback(async(d,h)=>{const g=await Ce.setConfig(d,h);return s({type:"SET_CONFIG",config:g}),g},[]),u=p.useMemo(()=>({config:r.config,loading:r.loading,updateConfig:c,refreshConfig:o}),[r,c,o]);return a.jsx(Ev.Provider,{value:u,children:t})}function pS({topRail:t,sidebar:r,main:s,statusBar:o,resizeHandle:c,banner:u,liveMessage:d,sidebarWidth:h=320,sidebarHidden:g=!1}){const m={"--top-rail-height":"48px","--status-bar-height":"28px","--sidebar-width":`${h}px`,display:"grid",gridTemplateRows:"var(--top-rail-height) 1fr var(--status-bar-height)",height:"100vh",overflow:"hidden",background:"var(--bg-canvas)",color:"var(--text-primary)"},y={display:"grid",gridTemplateColumns:g?"1fr":"var(--sidebar-width) auto 1fr",minHeight:0,overflow:"hidden"};return a.jsxs("div",{className:"studio-shell",style:m,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 Wx=["claude-cli","anthropic","openai","openrouter","cursor","codex-cli","gemini-cli","copilot","zed","ollama","lm-studio"],mS={"claude-cli":".claude",cursor:".cursor","codex-cli":".codex","gemini-cli":".gemini",copilot:".github",zed:".zed"},hS={"claude-cli":"claude",cursor:"cursor","codex-cli":"codex","gemini-cli":"gemini"},xS={"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"},gS={"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 vS(t,r){var h,g;const s=mS[t.id]??null,o=hS[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(m=>({id:m.id,displayName:m.label,billingMode:gS[t.id]??"per-token",...m.pricing?{pricing:m.pricing}:{},...m.resolvedId?{resolvedId:m.resolvedId}:{}}));return{id:t.id,displayName:yS(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:xS[t.id]??null,models:d,resolvedModel:t.resolvedModel??null}}function yS(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 bS(t){const r=new Map(t.map(o=>[o.id,o])),s=[];for(const o of Wx){const c=r.get(o);c&&s.push(c)}for(const o of t)Wx.includes(o.id)||s.push(o);return s}function jS(t){const[r,s]=p.useState(null),[o,c]=p.useState("loading"),[u,d]=p.useState(null),[h,g]=p.useState(null),m=p.useRef(null),y=p.useRef(0),v=p.useRef(t==null?void 0:t.onStaleCatalog),b=p.useRef(t==null?void 0:t.onSetActiveError);p.useEffect(()=>{v.current=t==null?void 0:t.onStaleCatalog,b.current=t==null?void 0:t.onSetActiveError},[t==null?void 0:t.onStaleCatalog,t==null?void 0:t.onSetActiveError]);const k=p.useCallback(async()=>{try{const R=await fetch("/api/config");if(!R.ok)throw new Error(`/api/config returned ${R.status}`);const M=await R.json(),B=bS((M.providers||[]).map(D=>vS(D,M.detection)));s({agents:B,activeAgent:M.provider??null,activeModel:M.model??null}),c("ready"),d(null)}catch(R){c("error"),d(R.message)}},[]);p.useEffect(()=>{k()},[k]);const S=p.useCallback(async()=>{var M;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 D=await B.json();y.current=R,g(null),s(H=>{if(!H)return H;const N=H.agents.map(_=>{if(_.id!=="openrouter")return _;const P=D.models.map(X=>({id:X.id,displayName:X.name,contextWindow:X.contextWindow,pricing:X.pricing,billingMode:"per-token"}));return{..._,models:P,catalogAgeMs:D.ageSec?D.ageSec*1e3:0,cacheStale:!!D.stale}});return{...H,agents:N}});const F=D.ageSec??0;(D.stale===!0||F>600)&&((M=v.current)==null||M.call(v,"openrouter",F*1e3))}catch(B){g(`OpenRouter catalog unreachable: ${B.message}`)}},[]),w=p.useCallback(R=>{m.current=R,R==="openrouter"&&S()},[S]),C=p.useCallback(()=>{y.current=0,k()},[k]),T=p.useCallback(async(R,M)=>{var F,E;let B;try{B=await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:R,model:M})})}catch(H){(F=b.current)==null||F.call(b,`Network error while setting ${R}: ${H.message}`);return}if(B.ok){s(H=>H&&{...H,activeAgent:R,activeModel:M});return}let D=`Failed to set ${R} (${B.status})`;try{const H=await B.json();H&&typeof H.error=="string"&&(D=H.error)}catch{}(E=b.current)==null||E.call(b,D)},[]);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 bd({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 Kd({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 SS={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}`},kS={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"},wS={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"},CS={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"},ES={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"},NS={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"},TS={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."},RS={disconnected:"Disconnected — reconnecting…",reconnected:"Reconnected.",loading:"Loading skills…",loadingPlaceholderCount:"—"},AS={fieldRequired:"This field is required.",nameInvalid:"Use letters, numbers, and hyphens.",descriptionRequired:"Description is required.",saveFailed:"Save failed. Check the form for errors."},MS={boundaryHeadline:"Something broke in this view.",boundaryBody:"Reload the page to recover.",boundaryAction:"Reload"},LS={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"},zS={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)."}},DS={subscriptionBilling:"· subscription",free:"· free"},_S={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`},OS={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.`},BS={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}`},IS={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.`},HS={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"},US={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."},$S={groupAvailable:"Available",groupAuthoring:"Authoring",sourceProject:"Project",sourcePersonal:"Personal",sourcePlugin:"Plugins",authoringSkills:"Skills"},VS={anthropic:{name:"Anthropic API",description:"Direct API access to Claude via your Anthropic API key. Pay-per-token billing.",envVars:["ANTHROPIC_API_KEY"],keyUrl:"https://platform.claude.com/settings/keys",learnMoreUrl:"https://docs.claude.com/en/docs/get-started"},openai:{name:"OpenAI",description:"Access to GPT-4, GPT-5 and the o-series reasoning models via your OpenAI API key.",envVars:["OPENAI_API_KEY"],keyUrl:"https://platform.openai.com/api-keys",learnMoreUrl:"https://platform.openai.com/docs"},openrouter:{name:"OpenRouter",description:"One API key, 300+ models from Anthropic, OpenAI, Google, Meta, and more.",envVars:["OPENROUTER_API_KEY"],keyUrl:"https://openrouter.ai/keys",learnMoreUrl:"https://openrouter.ai/docs"},gemini:{name:"Gemini",description:"Google Gemini models (2.5 Pro, Flash) via Google AI Studio. Free tier available.",envVars:["GEMINI_API_KEY"],keyUrl:"https://aistudio.google.com/apikey",learnMoreUrl:"https://ai.google.dev/gemini-api/docs"},ollama:{name:"Ollama",description:"Local models on your own machine. Zero external calls, zero cost after download.",envVars:["OLLAMA_HOST"],installCmd:"curl -fsSL https://ollama.com/install.sh | sh",startCmd:"ollama serve",pullExample:"ollama pull llama3.2",learnMoreUrl:"https://ollama.com/download"},lmStudio:{name:"LM Studio",description:"Desktop app + local server for running open models with a GUI. Compatible with the OpenAI API.",envVars:["LM_STUDIO_BASE_URL"],installCmd:"Download from https://lmstudio.ai and launch the app, then start the local server.",startCmd:"# In LM Studio: Developer → Start Server (default port 1234)",pullExample:"# In LM Studio: Discover → download any GGUF model",learnMoreUrl:"https://lmstudio.ai/docs"},claudeCode:{name:"Claude Code",description:"No API key needed if you're logged into Claude Code. vskill just runs the official claude binary on your behalf — your existing Claude Code session handles quota.",loginHint:"If you're not logged in, run claude in your terminal and authenticate with your Anthropic account.",learnMoreUrl:"https://docs.claude.com/en/docs/claude-code"}},ne={sidebar:SS,shell:kS,detail:wS,actions:CS,palette:ES,shortcuts:NS,toasts:TS,connection:RS,forms:AS,errors:MS,picker:LS,providers:zS,models:DS,settings:_S,statusBar:OS,scopePicker:BS,scopeSection:IS,claudeCodeLabel:HS,setupDrawer:US,setupProviders:VS,scopeLabels:$S},PS=new Set(["claude-cli","claude-code"]);function qx(t){return PS.has(t)}const Yx=new Set(["claude-cli","claude-code","anthropic","openai","openrouter","cursor","codex-cli","gemini-cli","copilot","zed"]);function FS({agents:t,activeAgentId:r,focusedAgentId:s,onFocus:o,onSelect:c,onOpenSettings:u}){const d=t.filter(g=>Yx.has(g.id)),h=t.filter(g=>!Yx.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(Kx,{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(Kx,{agent:g,isActive:g.id===r,isFocused:g.id===s,onFocus:o,onSelect:c,onOpenSettings:u},g.id))]})}function Kx({agent:t,isActive:r,isFocused:s,onFocus:o,onSelect:c,onOpenSettings:u}){const{providers:d}=ne,h={"claude-cli":d.claudeCli.caption,anthropic:d.anthropic.caption,openrouter:d.openrouter.caption},g={"claude-cli":{label:d.claudeCli.installCta,url:d.claudeCli.installUrl},cursor:{label:d.cursor.installCta},"codex-cli":{label:d.codexCli.installCta},"gemini-cli":{label:d.geminiCli.installCta},copilot:{label:d.copilot.installCta},zed:{label:d.zed.installCta}},m=qx(t.id),y={minHeight:36,height:m?"auto":36,padding:m?"6px 12px":"0 12px",display:"flex",alignItems:"center",gap:8,cursor:"pointer",position:"relative",background:s?"var(--surface-muted, var(--surface-3))":"transparent",borderLeft: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}),qx(t.id)&&a.jsx("span",{"data-testid":"claude-code-billing-label",title:ne.claudeCodeLabel.tooltip,style:{fontSize:10,color:"var(--text-secondary, var(--text-tertiary))",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:1},children:ne.claudeCodeLabel.compactLabel})]}),a.jsx("span",{"aria-label":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(Kd,{unlocked:!0,size:10}):a.jsx(Kd,{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:ne.picker.currentlyActive}),!t.available&&t.ctaType==="api-key"&&a.jsx(bd,{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(bd,{variant:"cli-install",label:g[t.id].label,installUrl:g[t.id].url,onActivate:()=>{}}),!t.available&&t.ctaType==="start-service"&&a.jsx(bd,{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 GS(t,r,s,o){const d=t>=80,h=p.useRef(null),[g,m]=p.useState(0),y=p.useCallback(k=>{m(k.currentTarget.scrollTop)},[]),{visibleStart:v,visibleEnd:b}=p.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 Nv=44,WS=352,qS=60,Xx=480;function YS(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 ${ne.models.subscriptionBilling}`:ne.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 KS(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 XS({agent:t,activeModelId:r,focusedIndex:s=-1,onSelect:o,onOpenSettings:c}){const[u,d]=p.useState(""),[h,g]=p.useState(""),m=p.useRef(null);if(p.useEffect(()=>{const b=setTimeout(()=>g(u),qS);return()=>clearTimeout(b)},[u]),p.useEffect(()=>{t.id==="openrouter"&&t.available&&m.current&&m.current.focus()},[t.id,t.available]),t.id==="openrouter"&&!t.available)return a.jsxs("div",{"data-testid":"openrouter-empty-card",style:{width:Xx,padding:20,display:"flex",flexDirection:"column",gap:12},children:[a.jsx("p",{style:{margin:0,color:"var(--text-primary)",fontSize:13,lineHeight:1.5},children:ne.providers.openrouter.emptyCardBody}),a.jsx("button",{type:"button",onClick:()=>c("openrouter"),style:{alignSelf:"flex-start",padding:"6px 10px",borderRadius:6,background:"var(--accent, var(--color-accent))",color:"var(--bg-surface, white)",border:"none",fontSize:12,fontWeight:500,cursor:"pointer"},children:ne.providers.openrouter.addKeyCta})]});const y=p.useMemo(()=>KS(t.models,h),[t.models,h]),v=GS(y.length,Nv,WS);return a.jsxs("div",{role:"listbox","aria-label":"Model","data-testid":"model-list",style:{width:Xx,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:m,type:"text",placeholder:ne.picker.searchPlaceholder,value:u,onChange:b=>d(b.target.value),"data-testid":"model-search-input","aria-label":ne.picker.searchPlaceholder,style:{width:"100%",padding:"6px 8px",background:"var(--surface-2, var(--bg-surface))",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif"}})}),y.length===0&&h?a.jsxs("div",{style:{padding:16},"data-testid":"no-matches",children:[a.jsx("div",{style:{color:"var(--text-muted, var(--text-tertiary))",fontSize:12,marginBottom:8},children:ne.picker.noMatches(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:ne.picker.clearSearch})]}):y.length===0?a.jsx("div",{style:{padding:16,color:"var(--text-muted, var(--text-tertiary))",fontSize:12},children:ne.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(ZS,{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 QS(t,r,s){return r&&r.toLowerCase().includes(t.toLowerCase())?r:s??null}function ZS({model:t,isActive:r,isFocused:s,onSelect:o,resolvedModel:c}){const u=YS(t),d=QS(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",m=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:Nv,padding:"4px 12px",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:2,background:g,borderLeft:m,cursor:"pointer",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",textAlign:"left"},children:[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 Qx={anthropic:{stored:!1,updatedAt:null},openai:{stored:!1,updatedAt:null},openrouter:{stored:!1,updatedAt:null}};function JS(){const[t,r]=p.useState(null),[s,o]=p.useState(!0),[c,u]=p.useState(null),d=p.useCallback(async()=>{o(!0);try{const m=await fetch("/api/settings/keys");if(!m.ok)throw new Error(`GET /api/settings/keys returned ${m.status}`);const y=await m.json();r({...Qx,...y}),u(null)}catch(m){u(m.message),r(Qx)}finally{o(!1)}},[]);p.useEffect(()=>{d()},[d]);const h=p.useCallback(async(m,y)=>{const v=await fetch("/api/settings/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:m,key:y})});if(!v.ok){const 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=p.useCallback(async m=>{const y=await fetch(`/api/settings/keys/${m}`,{method:"DELETE"});if(!y.ok)throw new Error(`DELETE /api/settings/keys/${m} returned ${y.status}`);await d()},[d]);return{state:t,loading:s,error:c,save:h,remove:g,refresh:d}}function e2({onMigrated:t,fetchImpl:r}){const[s,o]=p.useState({kind:"loading"}),c=r??globalThis.fetch,u=p.useCallback(async()=>{var m;try{const y=await c("/api/settings/migration-status");if(!y.ok){o({kind:"hidden"});return}const v=await y.json();v.pending&&(((m=v.darwinKeys)==null?void 0:m.length)??0)>0?o({kind:"visible",darwinKeys:v.darwinKeys??[]}):o({kind:"hidden"})}catch{o({kind:"hidden"})}},[c]);p.useEffect(()=>{u()},[u]);const d=p.useCallback(async()=>{o({kind:"working"});try{const m=await c("/api/settings/migration-perform",{method:"POST",headers:{"Content-Type":"application/json"}});if(!m.ok){o({kind:"error",message:`Migration failed (${m.status})`});return}const y=await m.json().catch(()=>({migrated:[]}));t==null||t(y.migrated??[]),await u()}catch(m){o({kind:"error",message:m.message})}},[c,u,t]),h=p.useCallback(async()=>{o({kind:"hidden"});try{await c("/api/settings/migration-acknowledge",{method:"POST",headers:{"Content-Type":"application/json"}})}catch{}},[c]);if(s.kind==="loading"||s.kind==="hidden")return null;if(s.kind==="error")return 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:jd,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:{...jd,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:{...jd,background:"transparent",border:"none",color:"var(--text-muted, var(--text-tertiary))",textDecoration:"underline",padding:"4px 6px"},children:"Dismiss for 30 days"})]})}const jd={padding:"4px 10px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},t2=[{id:"anthropic",name:ne.providers.anthropic.name,keyIssuanceUrl:ne.providers.anthropic.keyIssuanceUrl,prefix:ne.providers.anthropic.keyPrefix,placeholder:`Paste ${ne.providers.anthropic.name} key`},{id:"openai",name:ne.providers.openai.name,keyIssuanceUrl:ne.providers.openai.keyIssuanceUrl,prefix:ne.providers.openai.keyPrefix,placeholder:ne.providers.openai.pastePlaceholder},{id:"openrouter",name:ne.providers.openrouter.name,keyIssuanceUrl:ne.providers.openrouter.keyIssuanceUrl,prefix:ne.providers.openrouter.keyPrefix,placeholder:`Paste ${ne.providers.openrouter.name} key`}];function n2(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 Tv({open:t,onClose:r,initialProvider:s,onToast:o}){const{state:c,save:u,remove:d,refresh:h}=JS(),g=p.useRef(null),m=p.useRef(null),[y,v]=p.useState(null);p.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]),p.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]),p.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=p.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(ne.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:ne.settings.title}),a.jsx(e2,{onMigrated:()=>{h()}}),a.jsx("div",{role:"note","data-testid":"settings-banner",style:{padding:"8px 12px",borderRadius:6,background:"color-mix(in srgb, var(--info, var(--accent-muted)) 20%, transparent)",color:"var(--text-primary)",fontSize:12,marginBottom:16},children:ne.settings.banner}),a.jsxs("section",{"aria-labelledby":"settings-api-keys-title",style:{marginBottom:20},children:[a.jsx("h3",{id:"settings-api-keys-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:ne.settings.sectionApiKeys}),t2.map(k=>a.jsx(a2,{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(ne.settings.keySaved(k.name)),w},onRemove:async()=>{await d(k.id),o==null||o(ne.settings.keyRemoved(k.name))},inputRef:k.id===(s??"anthropic")?m: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?ne.settings.storagePath(y):ne.settings.storagePathFallback}),a.jsx("button",{type:"button",onClick:b,disabled:!y,"data-testid":"settings-copy-path",style:{...Or,opacity:y?1:.5,cursor:y?"pointer":"not-allowed"},children:ne.settings.copyPath})]}),a.jsx("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end"},children:a.jsx("button",{type:"button",onClick:r,style:{padding:"6px 12px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:"Close"})})]})}):null}function a2({providerId:t,providerName:r,keyIssuanceUrl:s,prefix:o,placeholder:c,metadata:u,onSave:d,onRemove:h,inputRef:g}){const[m,y]=p.useState(""),[v,b]=p.useState(!1),[k,S]=p.useState(!1),[w,C]=p.useState(!1),[T,R]=p.useState(null),M=m.trim(),B=M.length===0,D=M.length>0&&!M.startsWith(o),F=p.useCallback(async()=>{if(B)return;S(!0);const N=M;y("");try{const _=await d(N);_.warning?R(_.warning):R(null)}finally{S(!1)}},[B,d,M]),E=p.useCallback(async()=>{var N;try{if(!((N=navigator.clipboard)!=null&&N.readText))return;const _=await navigator.clipboard.readText();y(_)}catch{}},[]),H=p.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:m,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:Or,children:v?ne.settings.hide:ne.settings.show}),a.jsx("button",{type:"button",onClick:E,style:Or,children:ne.settings.paste})]}),D&&a.jsx("div",{role:"status","data-testid":`prefix-warn-${t}`,style:Zx,children:ne.settings.prefixWarn(r)}),T&&a.jsx("div",{role:"status",style:Zx,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:{...Or,background:B?"var(--surface-2)":"var(--accent, var(--color-accent))",color:B?"var(--text-muted)":"white",cursor:B?"not-allowed":"pointer"},children:ne.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:ne.settings.removeConfirm(r)}),a.jsx("button",{type:"button",onClick:H,"data-testid":`remove-confirm-${t}`,style:{...Or,background:"var(--danger, #b33)",color:"white"},children:"Confirm"}),a.jsx("button",{type:"button",onClick:()=>C(!1),style:Or,children:"Cancel"})]}):a.jsx("button",{type:"button",onClick:()=>C(!0),"data-testid":`remove-${t}`,style:{...Or,color:"var(--text-muted)"},children:ne.settings.remove})}),a.jsx("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},"data-testid":`status-${t}`,children:u!=null&&u.stored&&u.updatedAt?ne.settings.keyStoredAt(n2(u.updatedAt)):ne.settings.noKey})]})]})}const Or={padding:"4px 8px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},Zx={fontSize:11,color:"var(--warning, var(--text-muted))"};function r2(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function l2({onToast:t}){const{status:r,catalog:s,focusAgent:o,setActive:c}=jS({onStaleCatalog:(_,P)=>{const K=Math.round(P/6e4);t==null||t(`Using cached ${_} catalog (${K} min old)`)},onSetActiveError:_=>t==null?void 0:t(_)}),[u,d]=p.useState(!1),[h,g]=p.useState(!1),[m,y]=p.useState(),[v,b]=p.useState(null),[k,S]=p.useState("agents"),[w,C]=p.useState(0),T=p.useRef(null);p.useRef(null),p.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)??[],M=p.useMemo(()=>R.find(_=>_.id===v)??R[0],[R,v]);p.useEffect(()=>{C(0)},[v]);const B=p.useCallback(()=>{var _;d(!0),S("agents"),b((s==null?void 0:s.activeAgent)??((_=R[0])==null?void 0:_.id)??null),C(0)},[s,R]),D=p.useCallback(()=>{var _;d(!1),(_=T.current)==null||_.focus()},[]);p.useEffect(()=>{const _=P=>{var X;if(!(P.metaKey||P.ctrlKey)||P.key.toLowerCase()!=="k")return;const K=(X=document.activeElement)==null?void 0:X.tagName;K==="INPUT"||K==="TEXTAREA"||(P.preventDefault(),d(ee=>!ee))};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[]),p.useEffect(()=>{if(!u)return;const _=K=>{if(K.key==="Escape"){K.preventDefault(),D();return}if(K.key==="ArrowDown"){K.preventDefault(),P(1);return}if(K.key==="ArrowUp"){K.preventDefault(),P(-1);return}if(K.key==="ArrowRight"&&k==="agents"){K.preventDefault(),S("models"),C(X=>{const ee=((M==null?void 0:M.models.length)??1)-1;return Math.max(0,Math.min(X,Math.max(0,ee)))});return}if(K.key==="ArrowLeft"&&k==="models"){K.preventDefault(),S("agents");return}if(K.key==="Enter"){if(K.preventDefault(),k==="agents"&&M)S("models"),C(0);else if(k==="models"&&M){const X=Math.max(0,Math.min(M.models.length-1,w)),ee=M.models[X];ee&&(c(M.id,ee.id),D())}return}};function P(K){if(k==="agents"){const X=R.findIndex($=>$.id===v),ee=R[Math.max(0,Math.min(R.length-1,X+K))];ee&&(b(ee.id),o(ee.id));return}if(k==="models"&&M){const X=M.models.length;if(X===0)return;C(ee=>{const $=ee+K;return Math.max(0,Math.min(X-1,$))})}}return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[u,k,R,v,M,w,D,o,c]);const F=p.useCallback(_=>{y(_==="anthropic"||_==="openrouter"?_:void 0),g(!0),d(!1)},[]),E=R.find(_=>_.id===(s==null?void 0:s.activeAgent)),H=E==null?void 0:E.models.find(_=>_.id===(s==null?void 0:s.activeModel)),N=p.useMemo(()=>{if(r!=="ready"||!s)return"Loading…";const _=(E==null?void 0:E.displayName)??"Agent",P=(H==null?void 0:H.displayName)??s.activeModel??"Model";return`${_} · ${P}`},[r,s,E,H]);return a.jsxs(a.Fragment,{children:[a.jsxs("button",{ref:T,type:"button","data-testid":"agent-model-picker-trigger",onClick:()=>u?D():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"&&Po.createPortal(a.jsxs(s2,{reducedMotion:r2(),onClickOutside:D,children:[a.jsxs("div",{style:{display:"flex",height:440,maxHeight:"60vh"},children:[a.jsx(FS,{agents:R,activeAgentId:(s==null?void 0:s.activeAgent)??null,focusedAgentId:v,onFocus:_=>{b(_),o(_)},onSelect:_=>{b(_),o(_),S("models")},onOpenSettings:F}),M&&a.jsx(XS,{agent:M,activeModelId:(s==null?void 0:s.activeModel)??null,focusedIndex:k==="models"?w:-1,onSelect:_=>{c(M.id,_),D()},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:ne.picker.settingsButton}),a.jsx("span",{style:{fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"},children:ne.picker.footerHint})]})]}),document.body),a.jsx(Tv,{open:h,onClose:()=>g(!1),initialProvider:m,onToast:t})]})}function s2({children:t,reducedMotion:r,onClickOutside:s}){const o=p.useRef(null);return p.useEffect(()=>{const c=u=>{o.current&&!o.current.contains(u.target)&&s()};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]),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 Jx(){typeof window>"u"||(window.location.hash="#/")}function i2({onHome:t}){const[r,s]=p.useState(!1),[o,c]=p.useState(!1),u=h=>{h.metaKey||h.ctrlKey||h.shiftKey||h.button!==0||(h.preventDefault(),Jx(),t==null||t())},d=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),Jx(),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 o2="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",c2=p.lazy(()=>Fo(()=>import("./UpdateDropdown-BKkSZEVM.js"),__vite__mapDeps([0,1])));function u2(){const{updateCount:t,updates:r,isRefreshingUpdates:s,refreshUpdates:o,selectSkill:c,updatesById:u}=ea(),d=p.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]=p.useState(!1),m=p.useRef(null),y=p.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:m,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:o2,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(p.Suspense,{fallback:a.jsx("span",{"data-testid":"update-bell-fallback",children:"Loading…"}),children:a.jsx(c2,{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:m})})]})}function eg(t){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:navigate-scope",{detail:t}))}function d2({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(i2,{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(tg,{segment:"origin",onClick:()=>eg({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(ng,{}),a.jsx(tg,{segment:"plugin",onClick:()=>eg({scope:"plugin",plugin:r.plugin}),style:{fontFamily:"var(--font-mono)",fontSize:11},children:r.plugin}),a.jsx(ng,{}),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(l2,{})}),a.jsx("span",{"data-slot":"update-bell",style:{display:"inline-flex"},children:a.jsx(u2,{})}),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 tg({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 ng(){return a.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)",fontSize:10},children:"›"})}const Go="vskill-theme";function Rv(t){return t==="light"||t==="dark"||t==="auto"?t:"auto"}function f2(t,r){return t==="light"||t==="dark"?t:r?"dark":"light"}function p2(t){try{const r=t.getItem(Go);return Rv(r)}catch{return"auto"}}function m2(t,r){try{t.setItem(Go,r)}catch{}}function h2(t,r,s){t.dataset.theme=s,t.dataset.themeMode=r}function x2(t){if(!t)return!1;try{return t("(prefers-color-scheme: dark)").matches}catch{return!1}}const Av=p.createContext(null);function g2({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]=p.useState(()=>c?p2(c):"auto"),[m,y]=p.useState(()=>x2(u)),v=p.useMemo(()=>f2(h,m),[h,m]);p.useEffect(()=>{d&&h2(d,h,v)},[d,h,v]),p.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]),p.useEffect(()=>{if(typeof window>"u")return;const S=w=>{w.key===Go&&g(Rv(w.newValue))};return window.addEventListener("storage",S),()=>window.removeEventListener("storage",S)},[]),p.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=p.useCallback(S=>{g(S),c&&m2(c,S)},[c]),k=p.useMemo(()=>({mode:h,resolvedTheme:v,setTheme:b}),[h,v,b]);return a.jsx(Av.Provider,{value:k,children:o})}function Mv(){const t=p.useContext(Av);if(!t)throw new Error("useTheme must be used inside <ThemeProvider>. Wrap the app root in main.tsx.");return t}const ag=["claude-cli","anthropic","openrouter","ollama","lm-studio"];function v2(t){const r=new Map(t.map(o=>[o.id,o])),s=[];for(const o of ag){const c=r.get(o);c&&s.push(c)}for(const o of t)ag.includes(o.id)||s.push(o);return s}function y2(t){const[r,s]=p.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(`(max-width: ${t}px)`).matches);return p.useEffect(()=>{var u;if(typeof window>"u"||!window.matchMedia)return;const o=window.matchMedia(`(max-width: ${t}px)`),c=()=>s(o.matches);return(u=o.addEventListener)==null||u.call(o,"change",c),()=>{var d;return(d=o.removeEventListener)==null?void 0:d.call(o,"change",c)}},[t]),r}function b2({providers:t,onOpenSettings:r,onOpenInstallHelp:s}){const o=v2(t),c=y2(640),[u,d]=p.useState(!1),h=p.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(m=>m.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":ne.statusBar.providerSummary(g,o.length),style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:ne.statusBar.providerSummary(g,o.length)}),u&&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(m=>a.jsx(rg,{p:m,onClick:h},m.id))})]})}return a.jsx("div",{"data-testid":"providers-segment",style:{display:"inline-flex",alignItems:"center",gap:4},children:o.map(g=>a.jsx(rg,{p:g,onClick:h,compact:!0},g.id))})}function rg({p:t,onClick:r,compact:s}){const o=t.available?ne.statusBar.unlocked(t.label):t.kind==="cli-install"?ne.statusBar.lockedCli(t.label):ne.statusBar.locked(t.label);return 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(Kd,{unlocked:t.available,size:10}),!s&&a.jsx("span",{children:t.label})]})}function j2(){try{return typeof localStorage>"u"?null:localStorage.getItem(Go)}catch{return null}}function S2({projectPath:t,modelName:r,health:s="ok",onPathClick:o,providers:c,onOpenProviderSettings:u,onOpenProviderInstallHelp:d}){const{mode:h,resolvedTheme:g,setTheme:m}=Mv(),v=j2()==="auto",b=k2(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(lg,{}),a.jsxs("span",{"aria-label":`Health: ${s}`,style:{display:"inline-flex",alignItems:"center",gap:6},children:[a.jsx(w2,{color:k}),a.jsx("span",{style:{textTransform:"capitalize"},children:s})]}),c&&c.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(lg,{}),a.jsx(b2,{providers:c,onOpenSettings:u,onOpenInstallHelp:d})]}),a.jsx("div",{style:{flex:1}}),a.jsxs("button",{type:"button","data-testid":"theme-toggle",onClick:()=>m(b),"aria-label":`Switch to ${b} theme`,title:`Theme: ${h} — click for ${b}`,style:{display:"inline-flex",alignItems:"center",gap:6,background:"transparent",border:"1px solid var(--border-default)",padding:"2px 8px",borderRadius:4,color:"var(--text-secondary)",cursor:"pointer",fontSize:11,height:20},children:[a.jsx(C2,{mode:h}),a.jsx("span",{style:{textTransform:"capitalize"},children:h})]})]})}function k2(t,r,s){return t==="light"?"dark":t==="dark"?"auto":s?"light":r==="light"?"dark":"light"}function w2({color:t}){return a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:t,display:"inline-block",flexShrink:0}})}function lg(){return a.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)"},children:"|"})}function C2({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 Xd=new Set;function Lv(){for(const t of Xd)t()}const E2=5,N2=1e3,T2=6e4;function R2(){const[t,r]=p.useState(void 0),[s,o]=p.useState(!1),[c,u]=p.useState(!0),d=p.useRef(0),h=p.useRef(null),g=p.useRef(null),m=p.useRef(!0),y=p.useRef(0),[v,b]=p.useState(0),k=()=>{g.current!==null&&(clearTimeout(g.current),g.current=null)},S=p.useCallback(()=>{h.current&&(h.current.abort(),h.current=null)},[]),w=p.useCallback(async()=>{if(!m.current||document.visibilityState==="hidden")return;S();const T=new AbortController;h.current=T;try{const R=await fetch("/api/plugins",{signal:T.signal});if(!m.current)return;const M=await R.json();if(!m.current)return;d.current=0,r(M.plugins??[]),u(!1),o(!1),g.current=setTimeout(()=>{m.current&&b(B=>B+1)},T2)}catch(R){if(!m.current||R instanceof DOMException&&R.name==="AbortError")return;if(d.current+=1,u(!1),d.current>E2){o(!0);return}const M=N2*Math.pow(2,d.current-1);g.current=setTimeout(()=>{m.current&&b(B=>B+1)},M)}},[S]);p.useEffect(()=>(m.current=!0,()=>{m.current=!1,k(),S()}),[S]),p.useEffect(()=>{document.visibilityState!=="hidden"&&(k(),w())},[v,w]),p.useEffect(()=>{const T=()=>{document.visibilityState==="hidden"?(k(),S()):(d.current=0,o(!1),b(R=>R+1))};return document.addEventListener("visibilitychange",T),()=>{document.removeEventListener("visibilitychange",T)}},[S]);const C=p.useCallback(()=>{d.current=0,o(!1),k(),y.current+=1,b(T=>T+1)},[]);return p.useEffect(()=>(Xd.add(C),()=>{Xd.delete(C)}),[C]),{plugins:t,paused:s,loading:c,retry:C}}const Wo=0,cr=1,_l=2,zv=4;function sg(t){return()=>t}function A2(t){t()}function Dv(t,r){return s=>t(r(s))}function ig(t,r){return()=>t(r)}function M2(t,r){return s=>t(r,s)}function vf(t){return t!==void 0}function L2(...t){return()=>{t.map(A2)}}function Ol(){}function qo(t,r){return r(t),t}function z2(t,r){return r(t)}function jt(...t){return t}function at(t,r){return t(cr,r)}function Pe(t,r){t(Wo,r)}function yf(t){t(_l)}function Ct(t){return t(zv)}function Re(t,r){return at(t,M2(r,Wo))}function Qn(t,r){const s=t(cr,o=>{s(),r(o)});return s}function og(t){let r,s;return o=>c=>{r=c,s&&clearTimeout(s),s=setTimeout(()=>{o(r)},t)}}function _v(t,r){return t===r}function bt(t=_v){let r;return s=>o=>{t(r,o)||(r=o,s(o))}}function De(t){return r=>s=>{t(s)&&r(s)}}function ke(t){return r=>Dv(r,t)}function oa(t){return r=>()=>{r(t)}}function me(t,...r){const s=D2(...r);return((o,c)=>{switch(o){case _l:yf(t);return;case cr:return at(t,s(c))}})}function ca(t,r){return s=>o=>{s(r=t(r,o))}}function Hr(t){return r=>s=>{t>0?t--:r(s)}}function Ma(t){let r=null,s;return o=>c=>{r=c,!s&&(s=setTimeout(()=>{s=void 0,o(r)},t))}}function Fe(...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;at(u,g=>{const m=s;s|=h,r[d]=g,m!==c&&s===c&&o&&(o(),o=null)})}),u=>d=>{const h=()=>{u([d].concat(r))};s===c?h():o=h}}function D2(...t){return r=>t.reduceRight(z2,r)}function _2(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=at(t,u),r):(o(),Ol);case _l:o(),s=null;return}}}function ge(t){let r=t;const s=Xe();return((o,c)=>{switch(o){case Wo:r=c;break;case cr:{c(r);break}case zv:return r}return s(o,c)})}function tn(t,r){return qo(ge(r),s=>Re(t,s))}function Xe(){const t=[];return((r,s)=>{switch(r){case Wo:t.slice().forEach(o=>{o(s)});return;case _l: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 qo(Xe(),r=>Re(t,r))}function et(t,r=[],{singleton:s}={singleton:!0}){return{constructor:t,dependencies:r,id:O2(),singleton:s}}const O2=()=>Symbol();function B2(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 Ht(...t){const r=Xe(),s=new Array(t.length);let o=0;const c=2**t.length-1;return t.forEach((u,d)=>{const h=2**d;at(u,g=>{s[d]=g,o|=h,o===c&&Pe(r,s)})}),function(u,d){switch(u){case _l:{yf(r);return}case cr:return o===c&&d(s),at(r,d)}}}function ze(t,r=_v){return me(t,bt(r))}function Qd(...t){return function(r,s){switch(r){case _l:return;case cr:return L2(...t.map(o=>at(o,s)))}}}const Pt={DEBUG:0,INFO:1,WARN:2,ERROR:3},I2={[Pt.DEBUG]:"debug",[Pt.ERROR]:"error",[Pt.INFO]:"log",[Pt.WARN]:"warn"},H2=()=>typeof globalThis>"u"?window:globalThis,ur=et(()=>{const t=ge(Pt.ERROR);return{log:ge((r,s,o=Pt.INFO)=>{const c=H2().VIRTUOSO_LOG_LEVEL??Ct(t);o>=c&&console[I2[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",r,s)}),logLevel:t}},[],{singleton:!0});function $r(t,r,s){return bf(t,r,s).callbackRef}function bf(t,r,s){const o=Te.useRef(null);let c=d=>{};const u=Te.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 U2(t,r,s,o,c,u,d,h,g){const m=Te.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?cg("column-gap",getComputedStyle(y).columnGap,c):cg("row-gap",getComputedStyle(y).rowGap,c)),v!==null&&t(v)},[t,r,c,u,d,o,h]);return bf(m,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),m=parseFloat(h.dataset.knownSize),y=r(h,s);if(y===0&&o("Zero-sized element, this should not happen",{child:h},Pt.ERROR),y===m)continue;const v=u[u.length-1];u.length===0||v.size!==y||v.endIndex!==g-1?u.push({endIndex:g,size:y,startIndex:g}):u[u.length-1].endIndex++}return u}function cg(t,r,s){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&s(`${t} was not resolved to pixel value correctly`,r,Pt.WARN),r==="normal"?0:parseInt(r??"0",10)}function Ov(t,r,s){const o=Te.useRef(null),c=Te.useCallback(g=>{if(!(g!=null&&g.offsetParent))return;const m=g.getBoundingClientRect(),y=m.width;let v,b;if(r){const k=r.getBoundingClientRect(),S=m.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,m.top),v=m.top+k.scrollY}o.current={listHeight:m.height,offsetTop:v,visibleHeight:b,visibleWidth:y},t(o.current)},[t,r]),{callbackRef:u,ref:d}=bf(c,!0,s),h=Te.useCallback(()=>{c(d.current)},[c,d]);return Te.useEffect(()=>{var m;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=(m=d.current)==null?void 0:m.ownerDocument.defaultView;return g==null||g.addEventListener("scroll",h),g==null||g.addEventListener("resize",h),()=>{g==null||g.removeEventListener("scroll",h),g==null||g.removeEventListener("resize",h)}},[h,r,d]),u}const cn=et(()=>{const t=Xe(),r=Xe(),s=ge(0),o=Xe(),c=ge(0),u=Xe(),d=Xe(),h=ge(0),g=ge(0),m=ge(0),y=ge(0),v=Xe(),b=Xe(),k=ge(!1),S=ge(!1),w=ge(!1);return Re(me(t,ke(({scrollTop:C})=>C)),r),Re(me(t,ke(({scrollHeight:C})=>C)),d),Re(r,c),{deviation:s,fixedFooterHeight:m,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}),$s={lvl:0};function Bv(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 ft(t){return t===$s}function Vs(t,r){if(!ft(t))return r===t.k?t.v:r<t.k?Vs(t.l,r):Vs(t.r,r)}function Jn(t,r,s="k"){if(ft(t))return[-1/0,void 0];if(Number(t[s])===r)return[t.k,t.v];if(Number(t[s])<r){const o=Jn(t.r,r,s);return o[0]===-1/0?[t.k,t.v]:o}return Jn(t.l,r,s)}function Cn(t,r,s){return ft(t)?Uv(r,s,1):r===t.k?Vt(t,{k:r,v:s}):r<t.k?ug(Vt(t,{l:Cn(t.l,r,s)})):ug(Vt(t,{r:Cn(t.r,r,s)}))}function Rl(){return $s}function Al(t,r,s){if(ft(t))return[];const o=Jn(t,r)[0];return V2(Jd(t,o,s))}function Zd(t,r){if(ft(t))return $s;const{k:s,l:o,r:c}=t;if(r===s){if(ft(o))return c;if(ft(c))return o;const[u,d]=Hv(o);return Ro(Vt(t,{k:u,l:Iv(o),v:d}))}return r<s?Ro(Vt(t,{l:Zd(o,r)})):Ro(Vt(t,{r:Zd(c,r)}))}function Ir(t){return ft(t)?[]:[...Ir(t.l),{k:t.k,v:t.v},...Ir(t.r)]}function Jd(t,r,s){if(ft(t))return[];const{k:o,l:c,r:u,v:d}=t;let h=[];return o>r&&(h=h.concat(Jd(c,r,s))),o>=r&&o<=s&&h.push({k:o,v:d}),o<=s&&(h=h.concat(Jd(u,r,s))),h}function Ro(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(Sd(r))return $v(Vt(t,{lvl:s-1}));if(!ft(r)&&!ft(r.r))return Vt(r.r,{l:Vt(r,{r:r.r.l}),lvl:s,r:Vt(t,{l:r.r.r,lvl:s-1})});throw new Error("Unexpected empty nodes")}if(Sd(t))return ef(Vt(t,{lvl:s-1}));if(!ft(o)&&!ft(o.l)){const c=o.l,u=Sd(c)?o.lvl-1:o.lvl;return Vt(c,{l:Vt(t,{lvl:s-1,r:c.l}),lvl:c.lvl+1,r:ef(Vt(o,{l:c.r,lvl:u}))})}throw new Error("Unexpected empty nodes")}function Vt(t,r){return Uv(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 Iv(t){return ft(t.r)?t.l:Ro(Vt(t,{r:Iv(t.r)}))}function Sd(t){return ft(t)||t.lvl>t.r.lvl}function Hv(t){return ft(t.r)?[t.k,t.v]:Hv(t.r)}function Uv(t,r,s,o=$s,c=$s){return{k:t,l:o,lvl:s,r:c,v:r}}function ug(t){return ef($v(t))}function $v(t){const{l:r}=t;return!ft(r)&&r.lvl===t.lvl?Vt(r,{r:Vt(t,{l:r.r})}):t}function ef(t){const{lvl:r,r:s}=t;return!ft(s)&&!ft(s.r)&&s.lvl===r&&s.r.lvl===r?Vt(s,{l:Vt(t,{r:s.l}),lvl:r+1}):t}function V2(t){return Bv(t,({k:r,v:s})=>({index:r,value:s}))}function Vv(t,r){return!!(t&&t.startIndex===r.startIndex&&t.endIndex===r.endIndex)}function Ps(t,r){return!!(t&&t[0]===r[0]&&t[1]===r[1])}const jf=et(()=>({recalcInProgress:ge(!1)}),[],{singleton:!0});function Pv(t,r,s){return t[_o(t,r,s)]}function _o(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 P2(t,r,s,o){const c=_o(t,r,o),u=_o(t,s,o,c);return t.slice(c,u+1)}function ir(t,r){return Math.round(t.getBoundingClientRect()[r])}function Yo(t){return!ft(t.groupOffsetTree)}function Sf({index:t},r){return r===t?0:r<t?-1:1}function F2(){return{groupIndices:[],groupOffsetTree:Rl(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Rl()}}function G2(t,r){let s=ft(t)?0:1/0;for(const o of r){const{endIndex:c,size:u,startIndex:d}=o;if(s=Math.min(s,d),ft(t)){t=Cn(t,0,u);continue}const h=Al(t,d-1,c+1);if(h.some(Z2(o)))continue;let g=!1,m=!1;for(const{end:y,start:v,value:b}of h)g?(c>=v||u===b)&&(t=Zd(t,v)):(m=b!==u,g=!0),y>c&&c>=v&&b!==u&&(t=Cn(t,c+1,b));m&&(t=Cn(t,d,u))}return[t,s]}function W2(t){return typeof t.groupIndex<"u"}function q2({offset:t},r){return r===t?0:r<t?-1:1}function Fs(t,r,s){if(r.length===0)return 0;const{index:o,offset:c,size:u}=Pv(r,t,Sf),d=t-o,h=u*d+(d-1)*s+c;return h>0?h+s:h}function Fv(t,r){if(!Yo(r))return t;let s=0;for(;r.groupIndices[s]<=t+s;)s++;return t+s}function Gv(t,r,s){if(W2(t))return r.groupIndices[t.groupIndex]+1;const o=t.index==="LAST"?s:t.index;let c=Fv(o,r);return c=Math.max(0,c,Math.min(s,c)),c}function Y2(t,r,s,o=0){return o>0&&(r=Math.max(r,Pv(t,o,Sf).offset)),Bv(P2(t,r,s,q2),Q2)}function K2(t,[r,s,o,c]){r.length>0&&o("received item sizes",r,Pt.DEBUG);const u=t.sizeTree;let d=u,h=0;if(s.length>0&&ft(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]=G2(d,r);if(d===u)return t;const{lastIndex:g,lastOffset:m,lastSize:y,offsetTree:v}=tf(t.offsetTree,h,d,c);return{groupIndices:s,groupOffsetTree:s.reduce((b,k)=>Cn(b,k,Fs(k,v,c)),Rl()),lastIndex:g,lastOffset:m,lastSize:y,offsetTree:v,sizeTree:d}}function X2(t){return Ir(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 dg(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 tf(t,r,s,o){let c=t,u=0,d=0,h=0,g=0;if(r!==0){g=_o(c,r-1,Sf),h=c[g].offset;const m=Jn(s,r-1);u=m[0],d=m[1],c.length&&c[g].size===Jn(s,r)[1]&&(g-=1),c=c.slice(0,g+1)}else c=[];for(const{start:m,value:y}of Al(s,r,1/0)){const v=m-u,b=v*d+h+v*o;c.push({index:m,offset:b,size:y}),u=m,h=b,d=y}return{lastIndex:u,lastOffset:h,lastSize:d,offsetTree:c}}function Q2(t){return{index:t.index,value:t}}function Z2(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 J2={offsetHeight:"height",offsetWidth:"width"},da=et(([{log:t},{recalcInProgress:r}])=>{const s=Xe(),o=Xe(),c=tn(o,0),u=Xe(),d=Xe(),h=ge(0),g=ge([]),m=ge(void 0),y=ge(void 0),v=ge(void 0),b=ge(void 0),k=ge((E,H)=>ir(E,J2[H])),S=ge(void 0),w=ge(0),C=F2(),T=tn(me(s,Fe(g,t,w),ca(K2,C),bt()),C),R=tn(me(g,bt(),ca((E,H)=>({current:H,prev:E.current}),{current:[],prev:[]}),ke(({prev:E})=>E)),[]);Re(me(g,De(E=>E.length>0),Fe(T,w),ke(([E,H,N])=>{const _=E.reduce((P,K,X)=>Cn(P,K,Fs(K,H.offsetTree,N)||X),Rl());return{...H,groupIndices:E,groupOffsetTree:_}})),T),Re(me(o,Fe(T),De(([E,{lastIndex:H}])=>E<H),ke(([E,{lastIndex:H,lastSize:N}])=>[{endIndex:H,size:N,startIndex:E}])),s),Re(m,y);const M=tn(me(m,ke(E=>E===void 0)),!0);Re(me(y,De(E=>E!==void 0&&ft(Ct(T).sizeTree)),ke(E=>{const H=Ct(v),N=Ct(g).length>0;return H!==void 0&&H!==0?N?[{endIndex:0,size:H,startIndex:0},{endIndex:1,size:E,startIndex:1}]:[]:[{endIndex:0,size:E,startIndex:0}]})),s),Re(me(b,De(E=>E!==void 0&&E.length>0&&ft(Ct(T).sizeTree)),ke(E=>{const H=[];let N=E[0],_=0;for(let P=1;P<E.length;P++){const K=E[P];K!==N&&(H.push({endIndex:P-1,size:N,startIndex:_}),N=K,_=P)}return H.push({endIndex:E.length-1,size:N,startIndex:_}),H})),s),Re(me(g,Fe(v,y),De(([,E,H])=>E!==void 0&&H!==void 0),ke(([E,H,N])=>{const _=[];for(let P=0;P<E.length;P++){const K=E[P],X=E[P+1];_.push({startIndex:K,endIndex:K,size:H}),X!==void 0&&_.push({startIndex:K+1,endIndex:X-1,size:N})}return _})),s);const B=En(me(s,Fe(T),ca(({sizes:E},[H,N])=>({changed:N!==E,sizes:N}),{changed:!1,sizes:C}),ke(E=>E.changed)));at(me(h,ca((E,H)=>({diff:E.prev-H,prev:H}),{diff:0,prev:0}),ke(E=>E.diff)),E=>{const{groupIndices:H}=Ct(T);if(E>0)Pe(r,!0),Pe(u,E+dg(E,H));else if(E<0){const N=Ct(R);N.length>0&&(E-=dg(-E,N)),Pe(d,E)}}),at(me(h,Fe(t)),([E,H])=>{E<0&&H("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:h},Pt.ERROR)});const D=En(u);Re(me(u,Fe(T),ke(([E,H])=>{const N=H.groupIndices.length>0,_=[],P=H.lastSize;if(N){const K=Vs(H.sizeTree,0);let X=0,ee=0;for(;X<E;){const z=H.groupIndices[ee],I=H.groupIndices.length===ee+1?1/0:H.groupIndices[ee+1]-z-1;_.push({endIndex:z,size:K,startIndex:z}),_.push({endIndex:z+1+I-1,size:P,startIndex:z+1}),ee++,X+=I+1}const $=Ir(H.sizeTree);return X!==E&&$.shift(),$.reduce((z,{k:I,v:O})=>{let U=z.ranges;return z.prevSize!==0&&(U=[...z.ranges,{endIndex:I+E-1,size:z.prevSize,startIndex:z.prevIndex}]),{prevIndex:I+E,prevSize:O,ranges:U}},{prevIndex:E,prevSize:0,ranges:_}).ranges}return Ir(H.sizeTree).reduce((K,{k:X,v:ee})=>({prevIndex:X+E,prevSize:ee,ranges:[...K.ranges,{endIndex:X+E-1,size:K.prevSize,startIndex:K.prevIndex}]}),{prevIndex:0,prevSize:P,ranges:[]}).ranges})),s);const F=En(me(d,Fe(T,w),ke(([E,{offsetTree:H},N])=>{const _=-E;return Fs(_,H,N)})));return Re(me(d,Fe(T,w),ke(([E,H,N])=>{if(H.groupIndices.length>0){if(ft(H.sizeTree))return H;let P=Rl();const K=Ct(R);let X=0,ee=0,$=0;for(;X<-E;){$=K[ee];const z=K[ee+1]-$-1;ee++,X+=z+1}if(P=Ir(H.sizeTree).reduce((z,{k:I,v:O})=>Cn(z,Math.max(0,I+E),O),P),X!==-E){const z=Vs(H.sizeTree,$);P=Cn(P,0,z);const I=Jn(H.sizeTree,-E+1)[1];P=Cn(P,1,I)}return{...H,sizeTree:P,...tf(H.offsetTree,0,P,N)}}const _=Ir(H.sizeTree).reduce((P,{k:K,v:X})=>Cn(P,Math.max(0,K+E),X),Rl());return{...H,sizeTree:_,...tf(H.offsetTree,0,_,N)}})),T),{beforeUnshiftWith:D,data:S,defaultItemSize:y,firstItemIndex:h,fixedItemSize:m,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:M,unshiftWith:u}},jt(ur,jf),{singleton:!0});function ek(t){return t.reduce((r,s)=>(r.groupIndices.push(r.totalCount),r.totalCount+=s+1,r),{groupIndices:[],totalCount:0})}const Wv=et(([{groupIndices:t,sizes:r,totalCount:s},{headerHeight:o,scrollTop:c}])=>{const u=Xe(),d=Xe(),h=En(me(u,ke(ek)));return Re(me(h,ke(g=>g.totalCount)),s),Re(me(h,ke(g=>g.groupIndices)),t),Re(me(Ht(c,r,o),De(([g,m])=>Yo(m)),ke(([g,m,y])=>Jn(m.groupOffsetTree,Math.max(g-y,0),"v")[0]),bt(),ke(g=>[g])),d),{groupCounts:u,topItemsIndexes:d}},jt(da,cn)),dr=et(([{log:t}])=>{const r=ge(!1),s=En(me(r,De(o=>o),bt()));return at(r,o=>{o&&Ct(t)("props updated",{},Pt.DEBUG)}),{didMount:s,propsReady:r}},jt(ur),{singleton:!0}),tk=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function qv(t){const r=typeof t=="number"?{index:t}:t;return r.align||(r.align="start"),(!r.behavior||!tk)&&(r.behavior="auto"),r.offset===void 0&&(r.offset=0),r}const Xs=et(([{gap:t,listRefresh:r,sizes:s,totalCount:o},{fixedFooterHeight:c,fixedHeaderHeight:u,footerHeight:d,headerHeight:h,scrollingInProgress:g,scrollTo:m,smoothScrollTargetReached:y,viewportHeight:v},{log:b}])=>{const k=Xe(),S=Xe(),w=ge(0);let C=null,T=null,R=null;function M(){C!==null&&(C(),C=null),R!==null&&(R(),R=null),T&&(clearTimeout(T),T=null),Pe(g,!1)}return Re(me(k,Fe(s,v,o,w,h,d,b),Fe(t,u,c),ke(([[B,D,F,E,H,N,_,P],K,X,ee])=>{const $=qv(B),{align:z,behavior:I,offset:O}=$,U=E-1,se=Gv($,D,U);let L=Fs(se,D.offsetTree,K)+N;z==="end"?(L+=X+Jn(D.sizeTree,se)[1]-F+ee,se===U&&(L+=_)):z==="center"?L+=(X+Jn(D.sizeTree,se)[1]-F+ee)/2:L-=H,O!==void 0&&O!==0&&(L+=O);const q=W=>{M(),W?(P("retrying to scroll to",{location:B},Pt.DEBUG),Pe(k,B)):(Pe(S,!0),P("list did not change, scroll successful",{},Pt.DEBUG))};if(M(),I==="smooth"){let W=!1;R=at(r,te=>{W=W||te}),C=Qn(y,()=>{q(W)})}else C=Qn(me(r,nk(150)),q);return T=setTimeout(()=>{M()},1200),Pe(g,!0),P("scrolling from index to",{behavior:I,index:se,top:L},Pt.DEBUG),{behavior:I,top:L}})),m),{scrollTargetReached:S,scrollToIndex:k,topListHeight:w}},jt(da,cn,ur),{singleton:!0});function nk(t){return r=>{const s=setTimeout(()=>{r(!1)},t);return o=>{o&&(r(!0),clearTimeout(s))}}}function kf(t,r){t===0?r():requestAnimationFrame(()=>{kf(t-1,r)})}function wf(t,r){const s=r-1;return typeof t=="number"?t:t.index==="LAST"?s:t.index}const Qs=et(([{defaultItemSize:t,listRefresh:r,sizes:s},{scrollTop:o},{scrollTargetReached:c,scrollToIndex:u},{didMount:d}])=>{const h=ge(!0),g=ge(0),m=ge(!0);return Re(me(d,Fe(g),De(([y,v])=>v!==0),oa(!1)),h),Re(me(d,Fe(g),De(([y,v])=>v!==0),oa(!1)),m),at(me(Ht(r,d),Fe(h,s,t,m),De(([[,y],v,{sizeTree:b},k,S])=>y&&(!ft(b)||vf(k))&&!v&&!S),Fe(g)),([,y])=>{Qn(c,()=>{Pe(m,!0)}),kf(4,()=>{Qn(o,()=>{Pe(h,!0)}),Pe(u,y)})}),{initialItemFinalLocationReached:m,initialTopMostItemIndex:g,scrolledToInitialItem:h}},jt(da,cn,Xs,dr),{singleton:!0});function Yv(t,r){return Math.abs(t-r)<1.01}const Gs="up",Bs="down",ak="none",rk={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},lk=0,Zs=et(([{footerHeight:t,headerHeight:r,scrollBy:s,scrollContainerState:o,scrollTop:c,viewportHeight:u}])=>{const d=ge(!1),h=ge(!0),g=Xe(),m=Xe(),y=ge(4),v=ge(lk),b=tn(me(Qd(me(ze(c),Hr(1),oa(!0)),me(ze(c),Hr(1),oa(!1),og(100))),bt()),!1),k=tn(me(Qd(me(s,oa(!0)),me(s,oa(!1),og(200))),bt()),!1);Re(me(Ht(ze(c),ze(v)),ke(([R,M])=>R<=M),bt()),h),Re(me(h,Ma(50)),m);const S=En(me(Ht(o,ze(u),ze(r),ze(t),ze(y)),ca((R,[{scrollHeight:M,scrollTop:B},D,F,E,H])=>{const N=B+D-M>-H,_={scrollHeight:M,scrollTop:B,viewportHeight:D};if(N){let K,X;return B>R.state.scrollTop?(K="SCROLLED_DOWN",X=R.state.scrollTop-B):(K="SIZE_DECREASED",X=R.state.scrollTop-B||R.scrollTopDelta),{atBottom:!0,atBottomBecause:K,scrollTopDelta:X,state:_}}let P;return _.scrollHeight>R.state.scrollHeight?P="SIZE_INCREASED":D<R.state.viewportHeight?P="VIEWPORT_HEIGHT_DECREASING":B<R.state.scrollTop?P="SCROLLING_UPWARDS":P="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:P,state:_}},rk),bt((R,M)=>R!==void 0&&R.atBottom===M.atBottom))),w=tn(me(o,ca((R,{scrollHeight:M,scrollTop:B,viewportHeight:D})=>{if(!Yv(R.scrollHeight,M)){const F=M-(B+D)<1;return R.scrollTop!==B&&F?{changed:!0,jump:R.scrollTop-B,scrollHeight:M,scrollTop:B}:{changed:!0,jump:0,scrollHeight:M,scrollTop:B}}return{changed:!1,jump:0,scrollHeight:M,scrollTop:B}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),De(R=>R.changed),ke(R=>R.jump)),0);Re(me(S,ke(R=>R.atBottom)),d),Re(me(d,Ma(50)),g);const C=ge(Bs);Re(me(o,ke(({scrollTop:R})=>R),bt(),ca((R,M)=>Ct(k)?{direction:R.direction,prevScrollTop:M}:{direction:M<R.prevScrollTop?Gs:Bs,prevScrollTop:M},{direction:Bs,prevScrollTop:0}),ke(R=>R.direction)),C),Re(me(o,Ma(50),oa(ak)),C);const T=ge(0);return Re(me(b,De(R=>!R),oa(0)),T),Re(me(c,Ma(100),Fe(b),De(([R,M])=>M),ca(([R,M],[B])=>[M,B],[0,0]),ke(([R,M])=>M-R)),T),{atBottomState:S,atBottomStateChange:g,atBottomThreshold:y,atTopStateChange:m,atTopThreshold:v,isAtBottom:d,isAtTop:h,isScrolling:b,lastJumpDueToItemResize:w,scrollDirection:C,scrollVelocity:T}},jt(cn)),Ws="top",qs="bottom",fg="none";function pg(t,r,s){return typeof t=="number"?s===Gs&&r===Ws||s===Bs&&r===qs?t:0:s===Gs?r===Ws?t.main:t.reverse:r===qs?t.main:t.reverse}function mg(t,r){return typeof t=="number"?t:t[r]??0}const Cf=et(([{deviation:t,fixedHeaderHeight:r,headerHeight:s,scrollTop:o,viewportHeight:c}])=>{const u=Xe(),d=ge(0),h=ge(0),g=ge(0),m=tn(me(Ht(ze(o),ze(c),ze(s),ze(u,Ps),ze(g),ze(d),ze(r),ze(t),ze(h)),ke(([y,v,b,[k,S],w,C,T,R,M])=>{const B=y-R,D=C+T,F=Math.max(b-B,0);let E=fg;const H=mg(M,Ws),N=mg(M,qs);return k-=R,k+=b+T,S+=b+T,S-=R,k>y+D-H&&(E=Gs),S<y-F+v+N&&(E=Bs),E!==fg?[Math.max(B-b-pg(w,Ws,E)-H,0),B-F-T+v+pg(w,qs,E)+N]:null}),De(y=>y!==null),bt(Ps)),[0,0]);return{increaseViewportBy:h,listBoundary:u,overscan:g,topListHeight:d,visibleRange:m}},jt(cn),{singleton:!0});function sk(t,r,s){if(Yo(r)){const o=Fv(t,r);return[{index:Jn(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 kd={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Ao(t,r,s,o,c,u){const{lastIndex:d,lastOffset:h,lastSize:g}=c;let m=0,y=0;if(t.length>0){m=t[0].offset;const w=t[t.length-1];y=w.offset+w.size}const v=s-d,b=h+v*g+(v-1)*o,k=m,S=b-y;return{bottom:y,firstItemIndex:u,items:hg(t,c,u),offsetBottom:S,offsetTop:m,top:k,topItems:hg(r,c,u),topListHeight:r.reduce((w,C)=>C.size+w,0),totalCount:s}}function Kv(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=wf(r,h),m=Array.from({length:h}).map((y,v)=>({data:u[v+g],index:v+g,offset:0,size:0}));return Ao(m,[],h,c,s,o)}function hg(t,r,s){if(t.length===0)return[];if(!Yo(r))return t.map(m=>({...m,index:m.index+s,originalIndex:m.index}));const o=t[0].index,c=t[t.length-1].index,u=[],d=Al(r.groupOffsetTree,o,c);let h,g=0;for(const m of t){(!h||h.end<m.index)&&(h=d.shift(),g=r.groupIndices.indexOf(h.start));let y;m.index===h.start?y={index:g,type:"group"}:y={groupIndex:g,index:m.index-(g+1)+s},u.push({...y,data:m.data,offset:m.offset,originalIndex:m.index,size:m.size})}return u}function xg(t,r){return t===void 0?0:typeof t=="number"?t:t[r]??0}const Vr=et(([{data:t,firstItemIndex:r,gap:s,sizes:o,totalCount:c},u,{listBoundary:d,topListHeight:h,visibleRange:g},{initialTopMostItemIndex:m,scrolledToInitialItem:y},{topListHeight:v},b,{didMount:k},{recalcInProgress:S}])=>{const w=ge([]),C=ge(0),T=Xe(),R=ge(0);Re(u.topItemsIndexes,w);const M=tn(me(Ht(k,S,ze(g,Ps),ze(c),ze(o),ze(m),y,ze(w),ze(r),ze(s),ze(R),t),De(([E,H,,N,,,,,,,,_])=>{const P=_!==void 0&&_.length!==N;return E&&!H&&!P}),ke(([,,[E,H],N,_,P,K,X,ee,$,z,I])=>{var Se,Ae;const O=_,{offsetTree:U,sizeTree:se}=O,L=Ct(C);if(N===0)return{...kd,totalCount:N};if(E===0&&H===0)return L===0?{...kd,totalCount:N}:Kv(L,P,_,ee,$,I||[]);if(ft(se))return L>0?null:Ao(sk(wf(P,N),O,I),[],N,$,O,ee);const q=[];if(X.length>0){const _e=X[0],re=X[X.length-1];let he=0;for(const pe of Al(se,_e,re)){const xe=pe.value,je=Math.max(pe.start,_e),Be=Math.min(pe.end,re);for(let Oe=je;Oe<=Be;Oe++)q.push({data:I==null?void 0:I[Oe],index:Oe,offset:he,size:xe}),he+=xe}}if(!K)return Ao([],q,N,$,O,ee);const W=X.length>0?X[X.length-1]+1:0,te=Y2(U,E,H,W);if(te.length===0)return null;const fe=N-1,ie=qo([],_e=>{for(const re of te){const he=re.value;let pe=he.offset,xe=re.start;const je=he.size;if(he.offset<E){xe+=Math.floor((E-he.offset+$)/(je+$));const Oe=xe-re.start;pe+=Oe*je+Oe*$}xe<W&&(pe+=(W-xe)*je,xe=W);const Be=Math.min(re.end,fe);for(let Oe=xe;Oe<=Be&&!(pe>=H);Oe++)_e.push({data:I==null?void 0:I[Oe],index:Oe,offset:pe,size:je}),pe+=je+$}}),ve=xg(z,Ws),de=xg(z,qs);if(ie.length>0&&(ve>0||de>0)){const _e=ie[0],re=ie[ie.length-1];if(ve>0&&_e.index>W){const he=Math.min(ve,_e.index-W),pe=[];let xe=_e.offset;for(let je=_e.index-1;je>=_e.index-he;je--){const Be=((Se=Al(se,je,je)[0])==null?void 0:Se.value)??_e.size;xe-=Be+$,pe.unshift({data:I==null?void 0:I[je],index:je,offset:xe,size:Be})}ie.unshift(...pe)}if(de>0&&re.index<fe){const he=Math.min(de,fe-re.index);let pe=re.offset+re.size+$;for(let xe=re.index+1;xe<=re.index+he;xe++){const je=((Ae=Al(se,xe,xe)[0])==null?void 0:Ae.value)??re.size;ie.push({data:I==null?void 0:I[xe],index:xe,offset:pe,size:je}),pe+=je+$}}}return Ao(ie,q,N,$,O,ee)}),De(E=>E!==null),bt()),kd);Re(me(t,De(vf),ke(E=>E==null?void 0:E.length)),c),Re(me(M,ke(E=>E.topListHeight)),v),Re(v,h),Re(me(M,ke(E=>[E.top,E.bottom])),d),Re(me(M,ke(E=>E.items)),T);const B=En(me(M,De(({items:E})=>E.length>0),Fe(c,t),De(([{items:E},H])=>E[E.length-1].originalIndex===H-1),ke(([,E,H])=>[E-1,H]),bt(Ps),ke(([E])=>E))),D=En(me(M,Ma(200),De(({items:E,topItems:H})=>E.length>0&&E[0].originalIndex===H.length),ke(({items:E})=>E[0].index),bt())),F=En(me(M,De(({items:E})=>E.length>0),ke(({items:E})=>{let H=0,N=E.length-1;for(;E[H].type==="group"&&H<N;)H++;for(;E[N].type==="group"&&N>H;)N--;return{endIndex:E[N].index,startIndex:E[H].index}}),bt(Vv)));return{endReached:B,initialItemCount:C,itemsRendered:T,listState:M,minOverscanItemCount:R,rangeChanged:F,startReached:D,topItemsIndexes:w,...b}},jt(da,Wv,Cf,Qs,Xs,Zs,dr,jf),{singleton:!0}),Xv=et(([{fixedFooterHeight:t,fixedHeaderHeight:r,footerHeight:s,headerHeight:o},{listState:c}])=>{const u=Xe(),d=tn(me(Ht(s,t,o,r,c),ke(([h,g,m,y,v])=>h+g+m+y+v.offsetBottom+v.bottom)),0);return Re(ze(d),u),{totalListHeight:d,totalListHeightChanged:u}},jt(cn,Vr),{singleton:!0}),ik=et(([{viewportHeight:t},{totalListHeight:r}])=>{const s=ge(!1),o=tn(me(Ht(s,t,r),De(([c])=>c),ke(([,c,u])=>Math.max(0,c-u)),Ma(0),bt()),0);return{alignToBottom:s,paddingTopAddition:o}},jt(cn,Xv),{singleton:!0}),Qv=et(()=>({context:ge(null)})),ok=({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,Zv=et(([{gap:t,sizes:r,totalCount:s},{fixedFooterHeight:o,fixedHeaderHeight:c,headerHeight:u,scrollingInProgress:d,scrollTop:h,viewportHeight:g},{scrollToIndex:m}])=>{const y=Xe();return Re(me(y,Fe(r,g,s,u,c,o,h),Fe(t),ke(([[v,b,k,S,w,C,T,R],M])=>{const{calculateViewLocation:B=ok,done:D,...F}=v,E=Gv(v,b,S-1),H=Fs(E,b.offsetTree,M)+w+C,N=H+Jn(b.sizeTree,E)[1],_=R+C,P=R+k-T,K=B({itemBottom:N,itemTop:H,locationParams:F,viewportBottom:P,viewportTop:_});return K!==null?D&&Qn(me(d,De(X=>!X),Hr(Ct(d)?1:2)),D):D==null||D(),K}),De(v=>v!==null)),m),{scrollIntoView:y}},jt(da,cn,Xs,Vr,ur),{singleton:!0});function gg(t){return t===!1?!1:t==="smooth"?"smooth":"auto"}const ck=(t,r)=>typeof t=="function"?gg(t(r)):r&&gg(t),uk=et(([{listRefresh:t,totalCount:r,fixedItemSize:s,data:o},{atBottomState:c,isAtBottom:u},{scrollToIndex:d},{scrolledToInitialItem:h},{didMount:g,propsReady:m},{log:y},{scrollingInProgress:v},{context:b},{scrollIntoView:k}])=>{const S=ge(!1),w=Xe();let C=null;function T(D){Pe(d,{align:"end",behavior:D,index:"LAST"})}at(me(Ht(me(ze(r),Hr(1)),g),Fe(ze(S),u,h,v),ke(([[D,F],E,H,N,_])=>{let P=F&&N,K="auto";return P&&(K=ck(E,H||_),P=P&&K!==!1),{followOutputBehavior:K,shouldFollow:P,totalCount:D}}),De(({shouldFollow:D})=>D)),({followOutputBehavior:D,totalCount:F})=>{C!==null&&(C(),C=null),Ct(s)!==void 0?requestAnimationFrame(()=>{Ct(y)("following output to ",{totalCount:F},Pt.DEBUG),T(D)}):C=Qn(t,()=>{Ct(y)("following output to ",{totalCount:F},Pt.DEBUG),T(D),C=null})});function R(D){const F=Qn(c,E=>{D&&!E.atBottom&&E.notAtBottomBecause==="SIZE_INCREASED"&&C===null&&(Ct(y)("scrolling to bottom due to increased size",{},Pt.DEBUG),T("auto"))});setTimeout(F,100)}at(me(Ht(ze(S),r,m),De(([D,,F])=>D!==!1&&F),ca(({value:D},[,F])=>({refreshed:D===F,value:F}),{refreshed:!1,value:0}),De(({refreshed:D})=>D),Fe(S,r)),([,D])=>{Ct(h)&&R(D!==!1)}),at(w,()=>{R(Ct(S)!==!1)}),at(Ht(ze(S),c),([D,F])=>{D!==!1&&!F.atBottom&&F.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&T("auto")});const M=ge(null),B=Xe();return Re(Qd(me(ze(o),ke(D=>(D==null?void 0:D.length)??0)),me(ze(r))),B),at(me(Ht(me(B,Hr(1)),g),Fe(ze(M),h,v,b),ke(([[D,F],E,H,N,_])=>F&&H&&(E==null?void 0:E({context:_,totalCount:D,scrollingInProgress:N}))),De(D=>!!D),Ma(0)),D=>{C!==null&&(C(),C=null),Ct(s)!==void 0?requestAnimationFrame(()=>{Ct(y)("scrolling into view",{}),Pe(k,D)}):C=Qn(t,()=>{Ct(y)("scrolling into view",{}),Pe(k,D),C=null})}),{autoscrollToBottom:w,followOutput:S,scrollIntoViewOnChange:M}},jt(da,Zs,Xs,Qs,dr,ur,cn,Qv,Zv)),dk=et(([{data:t,firstItemIndex:r,gap:s,sizes:o},{initialTopMostItemIndex:c},{initialItemCount:u,listState:d},{didMount:h}])=>(Re(me(h,Fe(u),De(([,g])=>g!==0),Fe(c,o,r,s,t),ke(([[,g],m,y,v,b,k=[]])=>Kv(g,m,y,v,b,k))),d),{}),jt(da,Qs,Vr,dr),{singleton:!0}),fk=et(([{didMount:t},{scrollTo:r},{listState:s}])=>{const o=ge(0);return at(me(t,Fe(o),De(([,c])=>c!==0),ke(([,c])=>({top:c}))),c=>{Qn(me(s,Hr(1),De(u=>u.items.length>1)),()=>{requestAnimationFrame(()=>{Pe(r,c)})})}),{initialScrollTop:o}},jt(dr,cn,Vr),{singleton:!0}),Jv=et(([{scrollVelocity:t}])=>{const r=ge(!1),s=Xe(),o=ge(!1);return Re(me(t,Fe(o,r,s),De(([c,u])=>u!==!1&&u!==void 0),ke(([c,u,d,h])=>{const{enter:g,exit:m}=u;if(d){if(m(c,h))return!1}else if(g(c,h))return!0;return d}),bt()),r),at(me(Ht(r,t,s),Fe(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}},jt(Zs),{singleton:!0}),Ef=et(([{scrollContainerState:t,scrollTo:r}])=>{const s=Xe(),o=Xe(),c=Xe(),u=ge(!1),d=ge(void 0);return Re(me(Ht(s,o),ke(([{scrollTop:h,viewportHeight:g},{offsetTop:m,listHeight:y}])=>({scrollHeight:y,scrollTop:Math.max(0,h-m),viewportHeight:g}))),t),Re(me(r,Fe(o),ke(([h,{offsetTop:g}])=>({...h,top:h.top+g}))),c),{customScrollParent:d,useWindowScroll:u,windowScrollContainerState:s,windowScrollTo:c,windowViewportRect:o}},jt(cn)),pk=et(([{sizeRanges:t,sizes:r},{headerHeight:s,scrollTop:o},{initialTopMostItemIndex:c},{didMount:u},{useWindowScroll:d,windowScrollContainerState:h,windowViewportRect:g}])=>{const m=Xe(),y=ge(void 0),v=ge(null),b=ge(null);return Re(h,v),Re(g,b),at(me(m,Fe(r,o,d,v,b,s)),([k,S,w,C,T,R,M])=>{const B=X2(S.sizeTree);C&&T!==null&&R!==null&&(w=T.scrollTop-R.offsetTop),w-=M,k({ranges:B,scrollTop:w})}),Re(me(y,De(vf),ke(mk)),c),Re(me(u,Fe(y),De(([,k])=>k!==void 0),bt(),ke(([,k])=>k.ranges)),t),{getState:m,restoreStateFrom:y}},jt(da,cn,Qs,dr,Ef));function mk(t){return{align:"start",index:0,offset:t.scrollTop}}const hk=et(([{topItemsIndexes:t}])=>{const r=ge(0);return Re(me(r,De(s=>s>=0),ke(s=>Array.from({length:s}).map((o,c)=>c))),t),{topItemCount:r}},jt(Vr));function ey(t){let r=!1,s;return(()=>(r||(r=!0,s=t()),s))}const xk=ey(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),gk=et(([{deviation:t,scrollBy:r,scrollingInProgress:s,scrollTop:o},{isAtBottom:c,isScrolling:u,lastJumpDueToItemResize:d,scrollDirection:h},{listState:g},{beforeUnshiftWith:m,gap:y,shiftWithOffset:v,sizes:b},{log:k},{recalcInProgress:S}])=>{const w=En(me(g,Fe(d),ca(([,T,R,M],[{bottom:B,items:D,offsetBottom:F,totalCount:E},H])=>{const N=B+F;let _=0;return R===E&&T.length>0&&D.length>0&&(D[0].originalIndex===0&&T[0].originalIndex===0||(_=N-M,_!==0&&(_+=H))),[_,D,E,N]},[0,[],0,0]),De(([T])=>T!==0),Fe(o,h,s,c,k,S),De(([,T,R,M,,,B])=>!B&&!M&&T!==0&&R===Gs),ke(([[T],,,,,R])=>(R("Upward scrolling compensation",{amount:T},Pt.DEBUG),T))));function C(T){T>0?(Pe(r,{behavior:"auto",top:-T}),Pe(t,0)):(Pe(t,0),Pe(r,{behavior:"auto",top:-T}))}return at(me(w,Fe(t,u)),([T,R,M])=>{M&&xk()?Pe(t,R-T):C(-T)}),at(me(Ht(tn(u,!1),t,S),De(([T,R,M])=>!T&&!M&&R!==0),ke(([T,R])=>R),Ma(1)),C),Re(me(v,ke(T=>({top:-T}))),r),at(me(m,Fe(b,y),ke(([T,{groupIndices:R,lastSize:M,sizeTree:B},D])=>{function F(P){return P*(M+D)}if(R.length===0)return F(T);let E=0;const H=Vs(B,0);let N=0,_=0;for(;N<T;){N++,E+=H;let P=R.length===_+1?1/0:R[_+1]-R[_]-1;N+P>T&&(E-=H,P=T-N+1),N+=P,E+=F(P),_++}return E})),T=>{Pe(t,T),requestAnimationFrame(()=>{Pe(r,{top:T}),requestAnimationFrame(()=>{Pe(t,0),Pe(S,!1)})})}),{deviation:t}},jt(cn,Zs,Vr,da,ur,jf)),vk=et(([t,r,s,o,c,u,d,h,g,m,y])=>({...t,...r,...s,...o,...c,...u,...d,...h,...g,...m,...y}),jt(Cf,dk,dr,Jv,Xv,fk,ik,Ef,Zv,ur,Qv)),ty=et(([{data:t,defaultItemSize:r,firstItemIndex:s,fixedItemSize:o,fixedGroupSize:c,gap:u,groupIndices:d,heightEstimates:h,itemSize:g,sizeRanges:m,sizes:y,statefulTotalCount:v,totalCount:b,trackItemSizes:k},{initialItemFinalLocationReached:S,initialTopMostItemIndex:w,scrolledToInitialItem:C},T,R,M,B,{scrollToIndex:D},F,{topItemCount:E},{groupCounts:H},N])=>{const{listState:_,minOverscanItemCount:P,topItemsIndexes:K,rangeChanged:X,...ee}=B;return Re(X,N.scrollSeekRangeChanged),Re(me(N.windowViewportRect,ke($=>$.visibleHeight)),T.viewportHeight),{data:t,defaultItemHeight:r,firstItemIndex:s,fixedItemHeight:o,fixedGroupHeight:c,gap:u,groupCounts:H,heightEstimates:h,initialItemFinalLocationReached:S,initialTopMostItemIndex:w,scrolledToInitialItem:C,sizeRanges:m,topItemCount:E,topItemsIndexes:K,totalCount:b,...M,groupIndices:d,itemSize:g,listState:_,minOverscanItemCount:P,scrollToIndex:D,statefulTotalCount:v,trackItemSizes:k,rangeChanged:X,...ee,...N,...T,sizes:y,...R}},jt(da,Qs,cn,pk,uk,Vr,Xs,gk,hk,Wv,vk));function yk(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 go=typeof document<"u"?Te.useLayoutEffect:Te.useEffect;function ny(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=Te.createContext({});function g(C,T){C.propsReady!==void 0&&Pe(C.propsReady,!1);for(const R of o){const M=C[r.required[R]];Pe(M,T[R])}for(const R of c)if(R in T){const M=C[r.optional[R]];Pe(M,T[R])}C.propsReady!==void 0&&Pe(C.propsReady,!0)}function m(C){return u.reduce((T,R)=>(T[R]=M=>{const B=C[r.methods[R]];Pe(B,M)},T),{})}function y(C){return d.reduce((T,R)=>(T[R]=_2(C[r.events[R]]),T),{})}const v=Te.forwardRef(function(C,T){const{children:R,...M}=C,[B]=Te.useState(()=>qo(B2(t),E=>{g(E,M)})),[D]=Te.useState(ig(y,B));go(()=>{for(const E of d)E in M&&at(D[E],M[E]);return()=>{Object.values(D).map(yf)}},[M,D,B]),go(()=>{g(B,M)}),Te.useImperativeHandle(T,sg(m(B)));const F=s;return a.jsx(h.Provider,{value:B,children:s!==void 0?a.jsx(F,{...yk([...o,...c,...d],M),children:R}):R})}),b=C=>{const T=Te.useContext(h);return Te.useCallback(R=>{Pe(T[C],R)},[T,C])},k=C=>{const T=Te.useContext(h)[C],R=Te.useCallback(M=>at(T,M),[T]);return Te.useSyncExternalStore(R,()=>Ct(T),()=>Ct(T))},S=C=>{const T=Te.useContext(h)[C],[R,M]=Te.useState(ig(Ct,T));return go(()=>at(T,B=>{B!==R&&M(sg(B))}),[T,R]),R},w=parseInt(Te.version)>=18?k:S;return{Component:v,useEmitter:(C,T)=>{const R=Te.useContext(h)[C];go(()=>at(R,T),[T,R])},useEmitterValue:w,usePublisher:b}}const ay=Te.createContext(void 0),ry=Te.createContext(void 0),wd="-webkit-sticky",vg="sticky",Nf=ey(()=>{if(typeof document>"u")return vg;const t=document.createElement("div");return t.style.position=wd,t.style.position===wd?wd:vg}),ly=typeof document<"u"?Te.useLayoutEffect:Te.useEffect;function Cd(t){return"self"in t}function bk(t){return"body"in t}function sy(t,r,s,o=Ol,c,u){const d=Te.useRef(null),h=Te.useRef(null),g=Te.useRef(null),m=Te.useCallback(b=>{let k,S,w;const C=b.target;if(bk(C)||Cd(C)){const R=Cd(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():Hj.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]);Te.useEffect(()=>{const b=c||d.current;return o(c||d.current),m({suppressFlushSync:!0,target:b}),b.addEventListener("scroll",m,{passive:!0}),()=>{o(null),b.removeEventListener("scroll",m)}},[d,m,s,o,c]);function y(b){const 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;Cd(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)),Yv(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 Tf(t){return t}const jk=et(()=>{const t=ge(h=>`Item ${h}`),r=ge(h=>`Group ${h}`),s=ge({}),o=ge(Tf),c=ge("div"),u=ge(Ol),d=(h,g=null)=>tn(me(s,ke(m=>m[h]),bt()),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")}}),Sk=et(([t,r])=>({...t,...r}),jt(ty,jk)),kk=({height:t})=>a.jsx("div",{style:{height:t}}),wk={overflowAnchor:"none",position:Nf(),zIndex:1},iy={overflowAnchor:"none"},Ck={...iy,display:"inline-block",height:"100%"},yg=Te.memo(function({showTopList:t=!1}){const r=He("listState"),s=Pn("sizeRanges"),o=He("useWindowScroll"),c=He("customScrollParent"),u=Pn("windowScrollContainerState"),d=Pn("scrollContainerState"),h=c||o?u:d,g=He("itemContent"),m=He("context"),y=He("groupContent"),v=He("trackItemSizes"),b=He("itemSize"),k=He("log"),S=Pn("gap"),w=He("horizontalDirection"),{callbackRef:C}=U2(s,b,v,t?Ol:h,k,S,c,w,He("skipAnimationFrameInResizeObserver")),[T,R]=Te.useState(0);Rf("deviation",ee=>{T!==ee&&R(ee)});const M=He("EmptyPlaceholder"),B=He("ScrollSeekPlaceholder")??kk,D=He("ListComponent"),F=He("ItemComponent"),E=He("GroupComponent"),H=He("computeItemKey"),N=He("isSeeking"),_=He("groupIndices").length>0,P=He("alignToBottom"),K=He("initialItemFinalLocationReached"),X=t?{}:{boxSizing:"border-box",...w?{display:"inline-block",height:"100%",marginLeft:T!==0?T:P?"auto":0,paddingLeft:r.offsetTop,paddingRight:r.offsetBottom,whiteSpace:"nowrap"}:{marginTop:T!==0?T:P?"auto":0,paddingBottom:r.offsetBottom,paddingTop:r.offsetTop},...K?{}:{visibility:"hidden"}};return!t&&r.totalCount===0&&M!==null&&M!==void 0?a.jsx(M,{...en(M,m)}):a.jsx(D,{...en(D,m),"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list",ref:C,style:X,children:(t?r.topItems:r.items).map(ee=>{const $=ee.originalIndex,z=H($+r.firstItemIndex,ee.data,m);return N?p.createElement(B,{...en(B,m),height:ee.size,index:ee.index,key:z,type:ee.type||"item",...ee.type==="group"?{}:{groupIndex:ee.groupIndex}}):ee.type==="group"?p.createElement(E,{...en(E,m),"data-index":$,"data-item-index":ee.index,"data-known-size":ee.size,key:z,style:wk},y(ee.index,m)):p.createElement(F,{...en(F,m),...Rk(F,ee.data),"data-index":$,"data-item-group-index":ee.groupIndex,"data-item-index":ee.index,"data-known-size":ee.size,key:z,style:w?Ck:iy},_?g(ee.index,ee.groupIndex,ee.data,m):g(ee.index,ee.data,m))})})}),Ek={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Nk={outline:"none",overflowX:"auto",position:"relative"},Ko=t=>({height:"100%",position:"absolute",top:0,width:"100%",...t?{display:"flex",flexDirection:"column"}:void 0}),Tk={position:Nf(),top:0,width:"100%",zIndex:1};function en(t,r){if(typeof t!="string")return{context:r}}function Rk(t,r){return{item:typeof t=="string"?void 0:r}}const Ak=Te.memo(function(){const t=He("HeaderComponent"),r=Pn("headerHeight"),s=He("HeaderFooterTag"),o=$r(Te.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}),Mk=Te.memo(function(){const t=He("FooterComponent"),r=Pn("footerHeight"),s=He("HeaderFooterTag"),o=$r(Te.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 oy({useEmitter:t,useEmitterValue:r,usePublisher:s}){return Te.memo(function({children:o,style:c,context:u,...d}){const h=s("scrollContainerState"),g=r("ScrollerComponent"),m=s("smoothScrollTargetReached"),y=r("scrollerRef"),v=r("horizontalDirection")||!1,{scrollByCallback:b,scrollerRef:k,scrollToCallback:S}=sy(h,m,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?Nk:Ek,...c},tabIndex:0,...d,...en(g,u),children:o})})}function cy({useEmitter:t,useEmitterValue:r,usePublisher:s}){return Te.memo(function({children:o,style:c,context:u,...d}){const h=s("windowScrollContainerState"),g=r("ScrollerComponent"),m=s("smoothScrollTargetReached"),y=r("totalListHeight"),v=r("deviation"),b=r("customScrollParent"),k=Te.useRef(null),S=r("scrollerRef"),{scrollByCallback:w,scrollerRef:C,scrollToCallback:T}=sy(h,m,g,S,b);return ly(()=>{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 Lk=({children:t})=>{const r=Te.useContext(ay),s=Pn("viewportHeight"),o=Pn("fixedItemHeight"),c=He("alignToBottom"),u=He("horizontalDirection"),d=Te.useMemo(()=>Dv(s,g=>ir(g,u?"width":"height")),[s,u]),h=$r(d,!0,He("skipAnimationFrameInResizeObserver"));return Te.useEffect(()=>{r&&(s(r.viewportHeight),o(r.itemHeight))},[r,s,o]),a.jsx("div",{"data-viewport-type":"element",ref:h,style:Ko(c),children:t})},zk=({children:t})=>{const r=Te.useContext(ay),s=Pn("windowViewportRect"),o=Pn("fixedItemHeight"),c=He("customScrollParent"),u=Ov(s,c,He("skipAnimationFrameInResizeObserver")),d=He("alignToBottom");return Te.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:Ko(d),children:t})},Dk=({children:t})=>{const r=He("TopItemListComponent")??"div",s=He("headerHeight"),o={...Tk,marginTop:`${s}px`},c=He("context");return a.jsx(r,{style:o,...en(r,c),children:t})},_k=Te.memo(function(t){const r=He("useWindowScroll"),s=He("topItemsIndexes").length>0,o=He("customScrollParent"),c=He("context");return a.jsxs(o||r?Ik:Bk,{...t,context:c,children:[s&&a.jsx(Dk,{children:a.jsx(yg,{showTopList:!0})}),a.jsxs(o||r?zk:Lk,{children:[a.jsx(Ak,{}),a.jsx(yg,{}),a.jsx(Mk,{})]})]})}),{Component:Ok,useEmitter:Rf,useEmitterValue:He,usePublisher:Pn}=ny(Sk,{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"}},_k),Bk=oy({useEmitter:Rf,useEmitterValue:He,usePublisher:Pn}),Ik=cy({useEmitter:Rf,useEmitterValue:He,usePublisher:Pn}),Hk=Ok,Uk=et(()=>{const t=ge(m=>a.jsxs("td",{children:["Item $",m]})),r=ge(null),s=ge(m=>a.jsxs("td",{colSpan:1e3,children:["Group ",m]})),o=ge(null),c=ge(null),u=ge({}),d=ge(Tf),h=ge(Ol),g=(m,y=null)=>tn(me(u,ke(v=>v[m]),bt()),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")}});jt(ty,Uk);Nf();const bg={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:jg,floor:Oo,max:Is,min:Ed,round:Sg}=Math;function kg(t,r,s){return Array.from({length:r-t+1}).map((o,c)=>({data:s===null?null:s[c+t],index:c+t}))}function Vk(t){return{...$k,items:t}}function vo(t,r){return t!==void 0&&t.width===r.width&&t.height===r.height}function Pk(t,r){return t!==void 0&&t.column===r.column&&t.row===r.row}const Fk=et(([{increaseViewportBy:t,listBoundary:r,overscan:s,visibleRange:o},{footerHeight:c,headerHeight:u,scrollBy:d,scrollContainerState:h,scrollTo:g,scrollTop:m,smoothScrollTargetReached:y,viewportHeight:v},b,k,{didMount:S,propsReady:w},{customScrollParent:C,useWindowScroll:T,windowScrollContainerState:R,windowScrollTo:M,windowViewportRect:B},D])=>{const F=ge(0),E=ge(0),H=ge(bg),N=ge({height:0,width:0}),_=ge({height:0,width:0}),P=Xe(),K=Xe(),X=ge(0),ee=ge(null),$=ge({column:0,row:0}),z=Xe(),I=Xe(),O=ge(!1),U=ge(0),se=ge(!0),L=ge(!1),q=ge(!1);at(me(S,Fe(U),De(([de,Se])=>Se!==0)),()=>{Pe(se,!1)}),at(me(Ht(S,se,_,N,U,L),De(([de,Se,Ae,_e,,re])=>de&&!Se&&Ae.height!==0&&_e.height!==0&&!re)),([,,,,de])=>{Pe(L,!0),kf(1,()=>{Pe(P,de)}),Qn(me(m),()=>{Pe(r,[0,0]),Pe(se,!0)})}),Re(me(I,De(de=>de!=null&&de.scrollTop>0),oa(0)),E),at(me(S,Fe(I),De(([,de])=>de!=null)),([,de])=>{de&&(Pe(N,de.viewport),Pe(_,de.item),Pe($,de.gap),de.scrollTop>0&&(Pe(O,!0),Qn(me(m,Hr(1)),Se=>{Pe(O,!1)}),Pe(g,{top:de.scrollTop})))}),Re(me(N,ke(({height:de})=>de)),v),Re(me(Ht(ze(N,vo),ze(_,vo),ze($,(de,Se)=>de!==void 0&&de.column===Se.column&&de.row===Se.row),ze(m)),ke(([de,Se,Ae,_e])=>({gap:Ae,item:Se,scrollTop:_e,viewport:de}))),z),Re(me(Ht(ze(F),o,ze($,Pk),ze(_,vo),ze(N,vo),ze(ee),ze(E),ze(O),ze(se),ze(U)),De(([,,,,,,,de])=>!de),ke(([de,[Se,Ae],_e,re,he,pe,xe,,je,Be])=>{const{column:Oe,row:rt}=_e,{height:Nt,width:ht}=re,{width:Dt}=he;if(xe===0&&(de===0||Dt===0))return bg;if(ht===0){const Gt=wf(Be,de),nn=Gt+Math.max(xe-1,0);return Vk(kg(Gt,nn,pe))}const Tt=uy(Dt,ht,Oe);let Qe,tt;je?Se===0&&Ae===0&&xe>0?(Qe=0,tt=xe-1):(Qe=Tt*Oo((Se+rt)/(Nt+rt)),tt=Tt*jg((Ae+rt)/(Nt+rt))-1,tt=Ed(de-1,Is(tt,Tt-1)),Qe=Ed(tt,Is(0,Qe))):(Qe=0,tt=-1);const be=kg(Qe,tt,pe),{bottom:pt,top:Et}=wg(he,_e,re,be),Yt=jg(de/Tt),un=Yt*Nt+(Yt-1)*rt-pt;return{bottom:pt,itemHeight:Nt,items:be,itemWidth:ht,offsetBottom:un,offsetTop:Et,top:Et}})),H),Re(me(ee,De(de=>de!==null),ke(de=>de.length)),F),Re(me(Ht(N,_,H,$),De(([de,Se,{items:Ae}])=>Ae.length>0&&Se.height!==0&&de.height!==0),ke(([de,Se,{items:Ae},_e])=>{const{bottom:re,top:he}=wg(de,_e,Se,Ae);return[he,re]}),bt(Ps)),r);const W=ge(!1);Re(me(m,Fe(W),ke(([de,Se])=>Se||de!==0)),W);const te=En(me(Ht(H,F),De(([{items:de}])=>de.length>0),Fe(W),De(([[de,Se],Ae])=>{const _e=de.items[de.items.length-1].index===Se-1;return(Ae||de.bottom>0&&de.itemHeight>0&&de.offsetBottom===0&&de.items.length===Se)&&_e}),ke(([[,de]])=>de-1),bt())),fe=En(me(ze(H),De(({items:de})=>de.length>0&&de[0].index===0),oa(0),bt())),ie=En(me(ze(H),Fe(O),De(([{items:de},Se])=>de.length>0&&!Se),ke(([{items:de}])=>({endIndex:de[de.length-1].index,startIndex:de[0].index})),bt(Vv),Ma(0)));Re(ie,k.scrollSeekRangeChanged),Re(me(P,Fe(N,_,F,$),ke(([de,Se,Ae,_e,re])=>{const he=qv(de),{align:pe,behavior:xe,offset:je}=he;let Be=he.index;Be==="LAST"&&(Be=_e-1),Be=Is(0,Be,Ed(_e-1,Be));let Oe=nf(Se,re,Ae,Be);return pe==="end"?Oe=Sg(Oe-Se.height+Ae.height):pe==="center"&&(Oe=Sg(Oe-Se.height/2+Ae.height/2)),je!==void 0&&je!==0&&(Oe+=je),{behavior:xe,top:Oe}})),g);const ve=tn(me(H,ke(de=>de.offsetBottom+de.bottom)),0);return Re(me(B,ke(de=>({height:de.visibleHeight,width:de.visibleWidth}))),N),{customScrollParent:C,data:ee,deviation:X,footerHeight:c,gap:$,headerHeight:u,increaseViewportBy:t,initialItemCount:E,itemDimensions:_,overscan:s,restoreStateFrom:I,scrollBy:d,scrollContainerState:h,scrollHeight:K,scrollTo:g,scrollToIndex:P,scrollTop:m,smoothScrollTargetReached:y,totalCount:F,useWindowScroll:T,viewportDimensions:N,windowScrollContainerState:R,windowScrollTo:M,windowViewportRect:B,...k,gridState:H,horizontalDirection:q,initialTopMostItemIndex:U,totalListHeight:ve,...b,endReached:te,propsReady:w,rangeChanged:ie,startReached:fe,stateChanged:z,stateRestoreInProgress:O,...D}},jt(Cf,cn,Zs,Jv,dr,Ef,ur));function uy(t,r,s){return Is(1,Oo((t+s)/(Oo(r)+s)))}function wg(t,r,s,o){const{height:c}=s;if(c===void 0||o.length===0)return{bottom:0,top:0};const u=nf(t,r,s,o[0].index);return{bottom:nf(t,r,s,o[o.length-1].index)+c,top:u}}function nf(t,r,s,o){const c=uy(t.width,s.width,r.column),u=Oo(o/c),d=u*s.height+Is(0,u-1)*r.row;return d>0?d+r.row:d}const Gk=et(()=>{const t=ge(v=>`Item ${v}`),r=ge({}),s=ge(null),o=ge("virtuoso-grid-item"),c=ge("virtuoso-grid-list"),u=ge(Tf),d=ge("div"),h=ge(Ol),g=(v,b=null)=>tn(me(r,ke(k=>k[v]),bt()),b),m=ge(!1),y=ge(!1);return Re(ze(y),m),{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:m,reportReadyState:y,ScrollerComponent:g("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:g("ScrollSeekPlaceholder","div")}}),Wk=et(([t,r])=>({...t,...r}),jt(Fk,Gk)),qk=Te.memo(function(){const t=wt("gridState"),r=wt("listClassName"),s=wt("itemClassName"),o=wt("itemContent"),c=wt("computeItemKey"),u=wt("isSeeking"),d=Fn("scrollHeight"),h=wt("ItemComponent"),g=wt("ListComponent"),m=wt("ScrollSeekPlaceholder"),y=wt("context"),v=Fn("itemDimensions"),b=Fn("gap"),k=wt("log"),S=wt("stateRestoreInProgress"),w=Fn("reportReadyState"),C=$r(Te.useMemo(()=>T=>{const R=T.parentElement.parentElement.scrollHeight;d(R);const M=T.firstChild;if(M!==null){const{height:B,width:D}=M.getBoundingClientRect();v({height:B,width:D})}b({column:Cg("column-gap",getComputedStyle(T).columnGap,k),row:Cg("row-gap",getComputedStyle(T).rowGap,k)})},[d,v,b,k]),!0,!1);return ly(()=>{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(m,{...en(m,y),height:t.itemHeight,index:T.index,width:t.itemWidth},R):p.createElement(h,{...en(h,y),className:s,"data-index":T.index,key:R},o(T.index,T.data,y))})})}),Yk=Te.memo(function(){const t=wt("HeaderComponent"),r=Fn("headerHeight"),s=wt("headerFooterTag"),o=$r(Te.useMemo(()=>u=>{r(ir(u,"height"))},[r]),!0,!1),c=wt("context");return t!=null?a.jsx(s,{ref:o,children:a.jsx(t,{...en(t,c)})}):null}),Kk=Te.memo(function(){const t=wt("FooterComponent"),r=Fn("footerHeight"),s=wt("headerFooterTag"),o=$r(Te.useMemo(()=>u=>{r(ir(u,"height"))},[r]),!0,!1),c=wt("context");return t!=null?a.jsx(s,{ref:o,children:a.jsx(t,{...en(t,c)})}):null}),Xk=({children:t})=>{const r=Te.useContext(ry),s=Fn("itemDimensions"),o=Fn("viewportDimensions"),c=$r(Te.useMemo(()=>u=>{o(u.getBoundingClientRect())},[o]),!0,!1);return Te.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:Ko(!1),children:t})},Qk=({children:t})=>{const r=Te.useContext(ry),s=Fn("windowViewportRect"),o=Fn("itemDimensions"),c=wt("customScrollParent"),u=Ov(s,c,!1);return Te.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:Ko(!1),children:t})},Zk=Te.memo(function({...t}){const r=wt("useWindowScroll"),s=wt("customScrollParent"),o=s||r?ew:Jk,c=s||r?Qk:Xk,u=wt("context");return a.jsx(o,{...t,...en(o,u),children:a.jsxs(c,{children:[a.jsx(Yk,{}),a.jsx(qk,{}),a.jsx(Kk,{})]})})}),{useEmitter:dy,useEmitterValue:wt,usePublisher:Fn}=ny(Wk,{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"}},Zk),Jk=oy({useEmitter:dy,useEmitterValue:wt,usePublisher:Fn}),ew=cy({useEmitter:dy,useEmitterValue:wt,usePublisher:Fn});function Cg(t,r,s){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&s(`${t} was not resolved to pixel value correctly`,r,Pt.WARN),r==="normal"?0:parseInt(r??"0",10)}const tw={source:"vskill-sidebar-own-collapsed",installed:"vskill-sidebar-installed-collapsed"},fy={source:"Own",installed:"Installed"};function nw(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 aw(t,r){const s=r?"true":"false";try{localStorage.setItem(t,s)}catch{}try{typeof sessionStorage<"u"&&sessionStorage.setItem(t,s)}catch{}}function Eg({origin:t,count:r,filteredCount:s,updateCount:o,children:c}){const u=tw[t],[d,h]=p.useState(()=>nw(u)),g=p.useCallback(()=>{h(b=>{const k=!b;return aw(u,k),k})},[u]),m=fy[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(lw,{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:m}),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(rw,{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 rw({origin:t,updateCount:r}){const[s,o]=p.useState(!1),c=fy[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 lw({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 Af(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 sw({value:t,onChange:r,placeholder:s="Filter skills…",validationPattern:o,validationMessage:c="Invalid filter expression"}){const u=p.useRef(null),d=p.useId(),h=!!o&&t.trim()!==""&&!o.test(t);return p.useEffect(()=>{function g(m){var b;if(m.key!=="/")return;const y=m.target;if(!y)return;const v=y.tagName;v==="INPUT"||v==="TEXTAREA"||y.isContentEditable||(m.preventDefault(),(b=u.current)==null||b.focus())}return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[]),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 iw({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 ow({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 cw({skillId:t,trackedForUpdates:r}){let s=null;try{s=p.useContext(wv)}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 Js(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 uw({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(Js,{version:t.version,size:"sm",showPrefix:!1,"data-testid":"skill-row-version"}),t.isSymlink&&a.jsx(iw,{target:t.symlinkTarget??null}),a.jsx(ow,{skill:t}),a.jsx(cw,{skillId:`${t.plugin}/${t.skill}`,trackedForUpdates:t.trackedForUpdates??!0})]})}const Bo=p.memo(uw);function dw({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(Bo,{skill:d,isSelected:h,onSelect:()=>o(d),onContextMenu:c})},`${d.plugin}/${d.skill}`)})})]})}function fw(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 Ng({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,m]=p.useState(()=>fw(o,s)),y=d?!1:g,v=p.useCallback(()=>{m(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}`))})]})}const Mo=new Map,Br=new Map,Ds=new Map;function Nn(t){Mo.delete(t),Br.delete(t);const r=Ds.get(t);if(r)for(const s of r)s()}function ei(t,r,s={}){const{ttl:o=3e4,enabled:c=!0}=s,[,u]=p.useState(0),d=p.useRef(!0),h=p.useRef(t);h.current=t;const g=()=>Nn(t);p.useEffect(()=>(d.current=!0,()=>{d.current=!1}),[]),p.useEffect(()=>{if(!c)return;const b=()=>{d.current&&u(k=>k+1)};return Ds.has(t)||Ds.set(t,new Set),Ds.get(t).add(b),()=>{var k;(k=Ds.get(t))==null||k.delete(b)}},[t,c]),p.useEffect(()=>{if(!c)return;const b=Mo.get(t);if(!(!b||Date.now()-b.fetchedAt>o))return;if(Br.has(t)){const C=Br.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=>{Mo.set(t,{data:C,fetchedAt:Date.now()}),Br.delete(t),d.current&&h.current===t&&u(T=>T+1);for(const T of S.subscribers)T()},C=>{Br.delete(t),d.current&&h.current===t&&u(T=>T+1);for(const T of S.subscribers)T();throw C});S.promise=w,Br.set(t,S)},[t,r,o,c]);const m=Mo.get(t),y=c&&!m&&Br.has(t);return{data:m==null?void 0:m.data,loading:y||c&&!m,error:void 0,revalidate:g}}function pw({pluginName:t,enabled:r,onAfterAction:s}){const[o,c]=p.useState(!1),[u,d]=p.useState(null),[h,g]=p.useState(null),m=p.useRef(null);p.useEffect(()=>{if(!o)return;function v(b){m.current&&!m.current.contains(b.target)&&c(!1)}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]);async function y(v){d(v),g(null);try{if(v==="uninstall"&&!window.confirm(`Uninstall ${t}? This removes the plugin and its skills.`)){d(null);return}const b=await fetch(`/api/plugins/${encodeURIComponent(t)}/${v}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),k=await b.json().catch(()=>({}));if(!b.ok||!k.ok){g(k.error??`${v} failed (${b.status})`);return}Nn("skills"),Lv(),s==null||s(),c(!1)}catch(b){g(b instanceof Error?b.message:String(b))}finally{d(null)}}return a.jsxs("div",{ref:m,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(Nd,{onClick:()=>void y("disable"),disabled:u!==null,busy:u==="disable",label:"Disable",hint:"Keep installed, turn off"}):a.jsx(Nd,{onClick:()=>void y("enable"),disabled:u!==null,busy:u==="enable",label:"Enable",hint:"Activate plugin"}),a.jsx(Nd,{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 Nd({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 Tg({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))",m=typeof u=="function",y={position:"sticky",top:0,zIndex:4,backdropFilter:"saturate(1.4) blur(10px)",WebkitBackdropFilter:"saturate(1.4) blur(10px)",background:g,borderLeft:`3px solid ${h}`,borderBottom:"1px solid var(--border-subtle, rgba(128,128,128,0.2))",padding:"7px 10px 7px 9px",fontFamily:"var(--font-serif, ui-serif)",fontSize:13,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-primary)",display:"flex",alignItems:"center",gap:8,width:"100%",cursor:m?"pointer":"default",border:"none",textAlign:"left"},v=c?"▸":"▾",b=a.jsxs(a.Fragment,{children:[m&&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(mw,{label:d.label,title:d.title,icon:d.icon,onClick:d.onClick,accent:h})})]});return m?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 mw({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 hw(){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 xw(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 gw(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 vw(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 af(t,r={}){const{enabled:s=!0,target:o}=r,c=p.useRef([]),u=Array.isArray(t)?t:[t];c.current=u.map(xw),p.useEffect(()=>{if(!s)return;const d=o??(typeof window<"u"?window:void 0);if(!d)return;function h(g){const m=g,y=gw(m.target);for(const v of c.current){if(!vw(m,v))continue;const b=v.meta||v.ctrl||v.alt;if(!(y&&!v.allowInInputs&&!b)){v.handler(m);return}}}return d.addEventListener("keydown",h),()=>{d.removeEventListener("keydown",h)}},[s,o])}const yw=200;function bw(t){return t.scope==="own"||t.scope==="installed"||t.scope==="global"?t.scope:t.origin==="installed"?"installed":"own"}function jw(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=>Af(g,r)),d={};for(const g of u){const m=g.pluginName??g.plugin;(d[m]||(d[m]=[])).push(g)}const h=Object.entries(d).sort((g,m)=>g[0].localeCompare(m[0]));return{total:c.length,filtered:u.length,byPlugin:h}}return{availableProject:o(s.availableProject),availablePersonal:o(s.availablePersonal),availablePlugin:o(s.availablePlugin),authoringProject:o(s.authoringProject),authoringPlugin:o(s.authoringPlugin)}}function Sw(t,r){const s=[],o=[],c=[];for(const d of t){const h=bw(d);h==="global"?c.push(d):h==="installed"?o.push(d):s.push(d)}function u(d){var y;const h=d.filter(v=>Af(v,r)),g={};for(const v of h)(g[y=v.plugin]||(g[y]=[])).push(v);const m=Object.entries(g).sort((v,b)=>v[0].localeCompare(b[0]));return{total:d.length,filtered:h.length,byPlugin:m}}return{own:u(s),installed:u(o),global:u(c)}}function kw(t,r){const s=[],o=[];for(const u of t)(u.origin==="installed"?o:s).push(u);function c(u){var m;const d=u.filter(y=>Af(y,r)),h={};for(const y of d)(h[m=y.plugin]||(h[m]=[])).push(y);const g=Object.entries(h).sort((y,v)=>y[0].localeCompare(v[0]));return{total:u.length,filtered:d.length,byPlugin:g}}return{own:c(s),installed:c(o)}}function ww({skills:t,selectedKey:r,onSelect:s,isLoading:o,error:c,onRetry:u,onContextMenu:d,outdatedByOrigin:h,activeAgentId:g,outdatedByScope:m,topSlot:y,revealSkillId:v,onRevealComplete:b}){const k=!!g||t.some(W=>W.scope!==void 0&&W.scope!==null),S=g??"claude-cli",[w,C]=p.useState(""),T=p.useDeferredValue(w),R=p.useMemo(()=>Sw(t,T),[t,T]),M=p.useMemo(()=>jw(t,T),[t,T]),B=S==="claude-code",{plugins:D}=R2(),F=B?{plugins:D??[]}:void 0,E=p.useMemo(()=>{const W=new Map;for(const te of(F==null?void 0:F.plugins)??[]){const fe=W.get(te.name);W.set(te.name,!!fe||!!te.enabled)}return W},[F==null?void 0:F.plugins]),[H,N]=p.useState(()=>rf(`vskill-sidebar-${S}-group-available-collapsed`)),[_,P]=p.useState(()=>rf(`vskill-sidebar-${S}-group-authoring-collapsed`)),K=p.useCallback(W=>{N(W);try{window.localStorage.setItem(`vskill-sidebar-${S}-group-available-collapsed`,String(W))}catch{}},[S]),X=p.useCallback(W=>{P(W);try{window.localStorage.setItem(`vskill-sidebar-${S}-group-authoring-collapsed`,String(W))}catch{}},[S]),{own:ee,installed:$}=p.useMemo(()=>kw(t,T),[t,T]),I=R.own.filtered+R.installed.filtered+R.global.filtered>=yw,O=p.useMemo(()=>{const W=te=>{const fe=[];for(const[,ie]of te){const ve=[...ie].sort((de,Se)=>de.skill.localeCompare(Se.skill));fe.push(...ve)}return fe};return k?[...W(R.own.byPlugin),...W(R.installed.byPlugin),...W(R.global.byPlugin)]:[...W(ee.byPlugin),...W($.byPlugin)]},[k,R.own.byPlugin,R.installed.byPlugin,R.global.byPlugin,ee.byPlugin,$.byPlugin]),U=p.useMemo(()=>r?O.findIndex(W=>W.plugin===r.plugin&&W.skill===r.skill):-1,[O,r]),se=p.useCallback(W=>{if(O.length===0)return;const te=U<0?W>0?0:O.length-1:Math.min(Math.max(U+W,0),O.length-1);s(O[te])},[O,U,s]),L=p.useMemo(()=>{if(!v)return null;const[W,te]=v.split("/");if(!W||!te)return null;const fe=t.find(de=>de.plugin===W&&de.skill===te);if(!fe)return{plugin:W,skill:te,bucket:null,pluginName:null};const ie=fe.source==="plugin"?"plugin":"project",ve=ie==="plugin"?fe.pluginName??W:null;return{plugin:W,skill:te,bucket:ie,pluginName:ve}},[v,t]),q=p.useRef(null);return p.useEffect(()=>{if(!v){q.current=null;return}if(q.current===v)return;const W=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(v):v.replace(/["\\]/g,"\\$&"),te=document.querySelector(`[data-skill-id="${W}"]`);te&&(q.current=v,te.scrollIntoView({behavior:"smooth",block:"nearest"}),b==null||b())},[v,b,t]),af([{key:"j",handler:()=>se(1)},{key:"k",handler:()=>se(-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(sw,{value:w,onChange:C}),o&&a.jsx(Rw,{}),!o&&c&&a.jsx(Aw,{error:c,onRetry:u}),!o&&!c&&k&&a.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[a.jsx(Tg,{name:ne.scopeLabels.groupAvailable.toUpperCase(),variant:"available",collapsed:H,onToggle:K,count:M.availableProject.total+M.availablePersonal.total+M.availablePlugin.total}),!H&&a.jsxs(a.Fragment,{children:[a.jsx(Ms,{label:ne.scopeLabels.sourceProject,storageKey:`vskill-sidebar-${S}-available-project-collapsed`,count:M.availableProject.total,filteredCount:w?M.availableProject.filtered:null,updateCount:(m==null?void 0:m.installed)??(h==null?void 0:h.installed),children:M.availableProject.filtered===0?a.jsx(Ag,{queryActive:!!w,agentId:S}):a.jsx(Ls,{items:M.availableProject.byPlugin,selectedKey:r,onSelect:s,onContextMenu:d,useVirtual:I})}),a.jsx(Ms,{label:ne.scopeLabels.sourcePersonal,storageKey:`vskill-sidebar-${S}-available-personal-collapsed`,count:M.availablePersonal.total,filteredCount:w?M.availablePersonal.filtered:null,updateCount:m==null?void 0:m.global,children:M.availablePersonal.filtered===0?a.jsx(Ew,{queryActive:!!w,agentId:S}):a.jsx(Ls,{items:M.availablePersonal.byPlugin,selectedKey:r,onSelect:s,onContextMenu:d,useVirtual:I})}),B&&a.jsxs(Ms,{label:ne.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${S}-available-plugin-collapsed`,count:M.availablePlugin.total,filteredCount:w?M.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…"]}),M.availablePlugin.filtered===0?a.jsx("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:"No plugin skills installed yet."}):M.availablePlugin.byPlugin.map(([W,te])=>a.jsx(Ng,{pluginName:W,skills:te,persistKey:`vskill-plugin-available-${W}-collapsed`,headerActionSlot:B?a.jsx(pw,{pluginName:W,enabled:E.get(W)??!0}):void 0,renderSkill:fe=>a.jsx(Bo,{skill:fe,isSelected:(r==null?void 0:r.plugin)===fe.plugin&&(r==null?void 0:r.skill)===fe.skill,onSelect:()=>s(fe),onContextMenu:d})},`available-${W}`))]})]}),a.jsx(Tw,{}),a.jsx(Tg,{name:ne.scopeLabels.groupAuthoring.toUpperCase(),variant:"authoring",collapsed:L?!1:_,onToggle:X,count:M.authoringProject.total+M.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"}}))}}}),(!_||L)&&a.jsxs(a.Fragment,{children:[a.jsx(Ms,{label:ne.scopeLabels.authoringSkills,storageKey:`vskill-sidebar-${S}-authoring-project-collapsed`,count:M.authoringProject.total,filteredCount:w?M.authoringProject.filtered:null,updateCount:(m==null?void 0:m.own)??(h==null?void 0:h.source),forceOpen:(L==null?void 0:L.bucket)==="project",children:M.authoringProject.filtered===0?a.jsx(Rg,{queryActive:!!w}):a.jsx(Ls,{items:M.authoringProject.byPlugin,selectedKey:r,onSelect:s,onContextMenu:d,useVirtual:I})}),B&&a.jsx(Ms,{label:ne.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${S}-authoring-plugin-collapsed`,count:M.authoringPlugin.total,filteredCount:w?M.authoringPlugin.filtered:null,forceOpen:(L==null?void 0:L.bucket)==="plugin",children:M.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"}),"."]}):M.authoringPlugin.byPlugin.map(([W,te])=>a.jsx(Ng,{pluginName:W,skills:te,persistKey:`vskill-plugin-authoring-${W}-collapsed`,forceOpen:(L==null?void 0:L.bucket)==="plugin"&&L.pluginName===W,renderSkill:fe=>a.jsx(Bo,{skill:fe,isSelected:(r==null?void 0:r.plugin)===fe.plugin&&(r==null?void 0:r.skill)===fe.skill,onSelect:()=>s(fe),onContextMenu:d})},`authoring-${W}`))})]})]}),!o&&!c&&!k&&a.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[a.jsx(Eg,{origin:"source",count:ee.total,filteredCount:w?ee.filtered:null,updateCount:h==null?void 0:h.source,children:ee.filtered===0?a.jsx(Rg,{queryActive:!!w}):a.jsx(Ls,{items:ee.byPlugin,selectedKey:r,onSelect:s,onContextMenu:d,useVirtual:I})}),a.jsx(Nw,{}),a.jsx(Eg,{origin:"installed",count:$.total,filteredCount:w?$.filtered:null,updateCount:h==null?void 0:h.installed,children:$.filtered===0?a.jsx(Ag,{queryActive:!!w}):a.jsx(Ls,{items:$.byPlugin,selectedKey:r,onSelect:s,onContextMenu:d,useVirtual:I})})]})]})}function rf(t){if(typeof window>"u")return!1;try{return window.localStorage.getItem(t)==="true"}catch{return!1}}function Ms({label:t,storageKey:r,count:s,filteredCount:o,updateCount:c,children:u,forceOpen:d=!1}){const[h,g]=p.useState(()=>rf(r)),m=d?!1:h,y=p.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":!m,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 12px",background:"transparent",border:"none",cursor:"pointer",fontFamily:"var(--font-sans)",textAlign:"left"},children:[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:m?"▸":"▾"}),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":""]})]}),!m&&a.jsx("div",{style:{paddingLeft:18},children:u})]})}function Cw(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 Ls({items:t,selectedKey:r,onSelect:s,onContextMenu:o,useVirtual:c}){if(c){const u=Cw(t);return a.jsx("div",{"data-virtualized":"true",style:{height:420,minHeight:200},children:a.jsx(Hk,{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,m=!!r&&r.plugin===g.plugin&&r.skill===g.skill;return a.jsx(Bo,{skill:g,isSelected:m,onSelect:()=>s(g),onContextMenu:o})}})})}return a.jsx("div",{"data-virtualized":"false",children:t.map(([u,d])=>a.jsx(dw,{plugin:u,skills:d,selectedKey:r,onSelect:s,onContextMenu:o},u))})}function Rg({queryActive:t}){return t?a.jsx(Ml,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):a.jsx(Ml,{headline:"No skills yet.",body:a.jsxs(a.Fragment,{children:["Create one with ",a.jsx(Mf,{children:"vskill new"})," or the"," ",a.jsx("strong",{style:{color:"var(--text-primary)"},children:"New skill"})," action in the top rail."]})})}function Ag({queryActive:t,agentId:r}){return t?a.jsx(Ml,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):a.jsx(Ml,{headline:r?`No skills installed for ${r} in this project.`:"No installed skills.",body:a.jsxs(a.Fragment,{children:["Run ",a.jsx(Mf,{children:"vskill install <plugin>"})," to add one."]})})}function Ew({queryActive:t,agentId:r}){return t?a.jsx(Ml,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):a.jsx(Ml,{headline:`No global skills for ${r}.`,body:a.jsxs(a.Fragment,{children:["Run ",a.jsx(Mf,{children:"vskill install --global <plugin>"})," to add one."]})})}function Ml({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 Mf({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 Nw(){return a.jsx("div",{"aria-hidden":"true",style:{height:1,background:"var(--border-default)",margin:"4px 14px"}})}function Tw(){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 Rw(){return a.jsx("div",{style:{padding:"8px 0"},children:[0,1,2,3,4,5].map(t=>a.jsx(hw,{},t))})}function Aw({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:Mw(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 Mw(t){const r=t.split(`
|
|
66
|
+
`)[0]??t;return r.length>80?r.slice(0,77)+"…":r}const py=240,my=480,hy="vskill-sidebar-width",Hs=320;function Lf(t){return Number.isFinite(t)?Math.round(Math.max(py,Math.min(my,t))):Hs}function Lw(){try{const t=localStorage.getItem(hy);if(!t)return Hs;const r=Number(t);return Number.isFinite(r)?Lf(r):Hs}catch{return Hs}}function zw(t){try{localStorage.setItem(hy,String(Lf(t)))}catch{}}function Dw({initialWidth:t,onChange:r}){const s=p.useRef({startX:0,startWidth:t,pointerId:null}),o=p.useRef(t);return p.useEffect(()=>{o.current=t},[t]),p.useEffect(()=>{function c(d){if(s.current.pointerId==null||d.pointerId!==s.current.pointerId)return;const h=d.clientX-s.current.startX,g=Lf(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,zw(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":py,"aria-valuemax":my,"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 _w({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 xy(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 gy(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 Td(){const[t,r]=p.useState([]),[s,o]=p.useState(!1),[c,u]=p.useState(!1),[d,h]=p.useState(null),g=p.useRef(null),m=p.useCallback(async(v,b)=>{r([]),o(!0),u(!1),h(null);const k=new AbortController;g.current=k;try{const S=gy(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}`,D;try{D=await w.json(),D&&typeof D=="object"&&"error"in D&&typeof D.error=="string"&&(B=D.error)}catch{}throw xy(w.status,D),new Error(B)}const C=w.body.getReader(),T=new TextDecoder;let R="",M="";for(;;){const{done:B,value:D}=await C.read();if(B)break;R+=T.decode(D,{stream:!0});const F=R.split(`
|
|
67
|
+
`);R=F.pop()||"";for(const E of F)if(E.startsWith("event: "))M=E.slice(7).trim();else if(E.startsWith("data: ")){try{const H=JSON.parse(E.slice(6)),N={event:M,data:H};M==="done"?(u(!0),r(_=>[..._,N])):r(_=>[..._,N])}catch{}M=""}}}catch(S){S.name!=="AbortError"&&h(S.message)}finally{o(!1),g.current=null}},[]),y=p.useCallback(()=>{var v;(v=g.current)==null||v.abort()},[]);return{events:t,running:s,done:c,error:d,start:m,stop:y}}function Ow(t){const r=p.useRef(t);r.current=t;const[s,o]=p.useState(new Set),c=p.useRef(new Map),u=p.useCallback(async(m,y,v)=>{var k;(k=c.current.get(m))==null||k.abort();const b=new AbortController;c.current.set(m,b),o(S=>{const w=new Set(S);return w.add(m),w});try{const S=gy(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}`,D;try{D=await w.json(),D&&typeof D=="object"&&"error"in D&&typeof D.error=="string"&&(B=D.error)}catch{}throw xy(w.status,D),new Error(B)}const C=w.body.getReader(),T=new TextDecoder;let R="",M="";for(;;){const{done:B,value:D}=await C.read();if(B)break;R+=T.decode(D,{stream:!0});const F=R.split(`
|
|
68
|
+
`);R=F.pop()||"";for(const E of F)if(E.startsWith("event: "))M=E.slice(7).trim();else if(E.startsWith("data: ")){try{const H=JSON.parse(E.slice(6)),N={event:M,data:H};r.current.onEvent(m,N)}catch{}M=""}}r.current.onDone(m)}catch(S){S.name!=="AbortError"&&r.current.onError(m,S.message)}finally{o(S=>{const w=new Set(S);return w.delete(m),w}),c.current.delete(m)}},[]),d=p.useCallback(m=>{var y;(y=c.current.get(m))==null||y.abort()},[]),h=p.useCallback(()=>{for(const m of c.current.values())m.abort()},[]),g=s.size>0;return{runningSet:s,startCase:u,stopCase:d,stopAll:h,isAnyCaseRunning:g}}const Bw={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 Iw(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 Hw(t){if(t==="unit"||t==="integration")return t}function Uw(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 vy=p.createContext(null);function Rn(){const t=p.useContext(vy);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]=p.useReducer(Iw,{...Bw,plugin:t,skill:r}),h=p.useRef(new Set),g=p.useRef(new Set),m=p.useRef(new Map),y=p.useCallback((re,he)=>{let pe=m.current.get(re);pe||(pe={assertions:[]},m.current.set(re,pe)),Uw(pe,he),d({type:"UPDATE_INLINE_RESULT",evalId:re,result:{...pe,assertions:[...pe.assertions]}})},[]),v=p.useCallback(re=>{if(g.current.has(re))return;g.current.add(re);const he=m.current.get(re)??{assertions:[]};d({type:"CASE_RUN_COMPLETE",caseId:re,result:{...he,assertions:[...he.assertions]}}),h.current.has(re)&&(h.current.delete(re),h.current.size===0&&Ce.getLatestBenchmark(t,r).then(pe=>d({type:"BULK_RUN_COMPLETE",benchmark:pe})).catch(()=>d({type:"BULK_RUN_COMPLETE",benchmark:null})))},[t,r]),b=p.useCallback((re,he)=>{g.current.has(re)||(g.current.add(re),d({type:"CASE_RUN_ERROR",caseId:re,error:he}),h.current.has(re)&&(h.current.delete(re),h.current.size===0&&Ce.getLatestBenchmark(t,r).then(pe=>d({type:"BULK_RUN_COMPLETE",benchmark:pe})).catch(()=>d({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[t,r]),{startCase:k,stopCase:S,stopAll:w}=Ow({onEvent:y,onDone:v,onError:b});p.useEffect(()=>()=>{w()},[w]);const C=p.useCallback(async()=>{try{const re=await fetch(`/api/skills/${t}/${r}/activation-history`);if(!re.ok){if(re.status===404){d({type:"ACTIVATION_HISTORY_LOADED",runs:[]});return}return}const he=await re.json();d({type:"ACTIVATION_HISTORY_LOADED",runs:he.runs||[]})}catch{}},[t,r]);p.useEffect(()=>{let re=!1;async function he(){try{const[pe,xe,je]=await Promise.allSettled([Ce.getSkillDetail(t,r),Ce.getEvals(t,r),Ce.getLatestBenchmark(t,r)]);if(re)return;let Be=null,Oe=null;if(xe.status==="fulfilled")Be=xe.value;else{const rt=xe.reason;Oe=(rt==null?void 0:rt.message)??"Failed to load test cases"}d({type:"INIT_DATA",skillContent:pe.status==="fulfilled"?pe.value.skillContent:"",evals:Be,evalsError:Oe,benchmark:je.status==="fulfilled"?je.value:null})}catch(pe){re||d({type:"SET_ERROR",error:pe.message})}}return he(),C(),()=>{re=!0}},[t,r,C]);const T=p.useCallback(async()=>{if(!c)try{await Ce.applyImprovement(t,r,u.skillContent),d({type:"CONTENT_SAVED"})}catch(re){d({type:"SET_ERROR",error:re.message})}},[c,t,r,u.skillContent]),R=p.useCallback(async re=>{if(!c)try{const he=await Ce.saveEvals(t,r,re);d({type:"SET_EVALS",evals:he})}catch(he){d({type:"SET_ERROR",error:he.message})}},[c,t,r]),M=p.useCallback((re,he="benchmark")=>{if(c)return;const pe=u.caseRunStates.get(re);if((pe==null?void 0:pe.status)!=="running")if(m.current.delete(re),g.current.delete(re),d({type:"CASE_RUN_START",caseId:re,mode:he}),he==="comparison"){const xe=`/api/skills/${t}/${r}/compare`;k(re,xe,{eval_ids:[re]})}else{const xe=`/api/skills/${t}/${r}/benchmark/case/${re}`;k(re,xe,he==="baseline"?{baseline_only:!0}:void 0)}},[c,t,r,u.caseRunStates,k]),B=p.useCallback((re="benchmark")=>{var xe;if(c)return;const he=((xe=u.evals)==null?void 0:xe.evals)??[];if(he.length===0)return;const pe=he.map(je=>je.id);for(const je of pe)m.current.delete(je),g.current.delete(je);d({type:"BULK_RUN_START",caseIds:pe,mode:re}),h.current=new Set(pe);for(const je of pe)if(re==="comparison")k(je,`/api/skills/${t}/${r}/compare`,{eval_ids:[je]});else{const Be=`/api/skills/${t}/${r}/benchmark/case/${je}`;k(je,Be,re==="baseline"?{baseline_only:!0}:void 0)}},[c,t,r,u.evals,k]),D=p.useCallback(re=>{S(re),d({type:"CASE_RUN_CANCEL",caseId:re}),h.current.delete(re),g.current.add(re)},[S]),F=p.useCallback(()=>{w(),d({type:"CANCEL_ALL"}),h.current.clear()},[w]),E=p.useCallback(async(re,he)=>{d({type:"OPEN_IMPROVE",evalId:re})},[]),H=p.useCallback(async(re,he)=>{try{await Ce.applyImprovement(t,r,he),d({type:"SET_CONTENT",content:he}),d({type:"CONTENT_SAVED"}),d({type:"CLOSE_IMPROVE"}),M(re,"benchmark")}catch(pe){d({type:"SET_ERROR",error:pe.message})}},[t,r,M]),N=Td(),_=p.useRef(null),P=p.useRef(0);p.useEffect(()=>{const re=N.events;for(let he=P.current;he<re.length;he++){const pe=re[he],xe=pe.data;if(pe.event==="progress"&&d({type:"AI_EDIT_PROGRESS",entry:{timestamp:Date.now(),phase:xe.phase,message:xe.message}}),pe.event==="done"){const je=xe.improved,Be=xe.reasoning,Oe=xe.evalChanges??[];d({type:"AI_EDIT_RESULT",improved:je,reasoning:Be,evalChanges:Oe})}if(pe.event==="error"){const je=xe;d({type:"AI_EDIT_ERROR",message:je.description||"Unknown error",classified:je})}}P.current=re.length},[N.events]),p.useEffect(()=>{N.error&&d({type:"AI_EDIT_ERROR",message:N.error})},[N.error]),p.useEffect(()=>()=>{N.stop()},[N.stop]);const K=p.useCallback(async(re,he,pe)=>{c||(P.current=0,d({type:"AI_EDIT_LOADING"}),_.current=N.stop,N.start(`/api/skills/${t}/${r}/improve?sse`,{mode:"instruct",instruction:re,content:u.skillContent,evals:u.evals??{skill_name:r,evals:[]},provider:he,model:pe}))},[c,t,r,u.skillContent,u.evals,N]),X=p.useCallback(()=>{N.stop(),d({type:"AI_EDIT_ERROR",message:"Cancelled"})},[N]),ee=p.useCallback(async()=>{const re=u.aiEditResult;if(re!=null&&re.improved)try{if(await Ce.applyImprovement(t,r,re.improved),d({type:"SET_CONTENT",content:re.improved}),d({type:"CONTENT_SAVED"}),u.aiEditEvalChanges.length>0&&Array.from(u.aiEditEvalSelections.values()).some(Boolean)){const{mergeEvalChanges:pe}=await Fo(async()=>{const{mergeEvalChanges:Be}=await import("./mergeEvalChanges-Dpbbs4d4.js");return{mergeEvalChanges:Be}},[]),xe=u.evals??{skill_name:r,evals:[]},je=pe(xe,u.aiEditEvalChanges,u.aiEditEvalSelections);try{const Be=await Ce.saveEvals(t,r,je);d({type:"SET_EVALS",evals:Be})}catch(Be){d({type:"SET_EVALS_RETRY",evalsFile:je}),d({type:"SET_ERROR",error:`SKILL.md saved, but test cases failed to save: ${Be.message}. You can retry from the AI Edit panel.`});return}}d({type:"CLOSE_AI_EDIT"})}catch(he){d({type:"SET_ERROR",error:he.message})}},[t,r,u.aiEditResult,u.evals,u.aiEditEvalChanges,u.aiEditEvalSelections]),$=p.useCallback(()=>{d({type:"CLOSE_AI_EDIT"})},[]),z=p.useCallback(re=>{d({type:"TOGGLE_EVAL_CHANGE",index:re})},[]),I=p.useCallback(()=>{d({type:"SELECT_ALL_EVAL_CHANGES"})},[]),O=p.useCallback(()=>{d({type:"DESELECT_ALL_EVAL_CHANGES"})},[]),U=p.useCallback(async()=>{const re=u.aiEditEvalsRetry;if(re)try{const he=await Ce.saveEvals(t,r,re);d({type:"SET_EVALS",evals:he}),d({type:"SET_ERROR",error:null}),d({type:"CLOSE_AI_EDIT"})}catch(he){d({type:"SET_ERROR",error:`Retry failed: ${he.message}`})}},[t,r,u.aiEditEvalsRetry]),se=p.useCallback(async()=>{try{const re=await Ce.getSkillDetail(t,r);d({type:"SET_CONTENT",content:re.skillContent}),d({type:"CONTENT_SAVED"})}catch{}},[t,r]),{config:L}=Ur(),q=Td(),W=p.useRef(0);p.useEffect(()=>{const re=q.events;for(let he=W.current;he<re.length;he++){const pe=re[he],xe=pe.data;if(pe.event==="progress"&&d({type:"GENERATE_EVALS_PROGRESS",entry:{timestamp:Date.now(),phase:xe.phase,message:xe.message}}),pe.event==="done"){const je=xe;Ce.saveEvals(t,r,je).then(Be=>d({type:"GENERATE_EVALS_DONE",evals:Be})).catch(Be=>d({type:"SET_ERROR",error:Be.message}))}pe.event==="error"&&d({type:"GENERATE_EVALS_ERROR",classified:xe})}W.current=re.length},[q.events,t,r]),p.useEffect(()=>{q.error&&d({type:"SET_ERROR",error:q.error})},[q.error]),p.useEffect(()=>()=>{q.stop()},[q.stop]);const te=p.useCallback(async re=>{if(c)return;W.current=0,d({type:"GENERATE_EVALS_START"});const he={};L!=null&&L.provider&&(he.provider=L.provider),L!=null&&L.model&&(he.model=L.model);const pe=Hw(re==null?void 0:re.testType);pe&&(he.testType=pe),q.start(`/api/skills/${t}/${r}/generate-evals?sse`,Object.keys(he).length>0?he:void 0)},[c,t,r,q,L]),fe=Td(),ie=p.useRef(0);p.useEffect(()=>()=>{fe.stop()},[fe.stop]),p.useEffect(()=>{const re=fe.events;for(let he=ie.current;he<re.length;he++){const pe=re[he];if(pe.event==="classifying"){const xe=pe.data;d({type:"ACTIVATION_CLASSIFYING",index:xe.index,total:xe.total})}if(pe.event==="prompt_result"&&d({type:"ACTIVATION_RESULT",result:pe.data}),pe.event==="done"){ve.current&&(clearTimeout(ve.current),ve.current=null);const xe=pe.data;if(xe.error)d({type:"ACTIVATION_ERROR",error:xe.error});else{d({type:"ACTIVATION_DONE",summary:xe});const je={id:`run-${Date.now()}`,timestamp:new Date().toISOString(),model:(L==null?void 0:L.model)||"unknown",provider:(L==null?void 0:L.provider)||"unknown",promptCount:xe.total,summary:{precision:xe.precision,recall:xe.recall,reliability:xe.reliability,tp:xe.tp,tn:xe.tn,fp:xe.fp,fn:xe.fn}};d({type:"ACTIVATION_HISTORY_LOADED",runs:[je,...u.activationHistory??[]]})}}}ie.current=re.length},[fe.events,L,u.activationHistory]),p.useEffect(()=>{fe.error&&(ve.current&&(clearTimeout(ve.current),ve.current=null),d({type:"ACTIVATION_ERROR",error:fe.error}))},[fe.error]);const ve=p.useRef(null),de=p.useCallback(()=>{ve.current&&(clearTimeout(ve.current),ve.current=null),fe.stop(),d({type:"ACTIVATION_CANCEL",totalPrompts:0})},[fe]),Se=p.useCallback(re=>{const pe=re.trim().split(`
|
|
69
|
+
`).filter(Boolean).map(je=>je.startsWith("!")?{prompt:je.slice(1).trim(),expected:"should_not_activate"}:je.startsWith("+")?{prompt:je.slice(1).trim(),expected:"should_activate"}:{prompt:je.trim(),expected:"auto"});ie.current=0,d({type:"ACTIVATION_START"}),d({type:"SET_ACTIVATION_PROMPTS",prompts:re});const xe={prompts:pe};L!=null&&L.provider&&(xe.provider=L.provider),L!=null&&L.model&&(xe.model=L.model),fe.start(`/api/skills/${t}/${r}/activation-test`,xe),ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>{fe.stop(),d({type:"ACTIVATION_TIMEOUT"}),ve.current=null},12e4)},[t,r,fe,L]),Ae=p.useCallback(async(re=8)=>{d({type:"GENERATE_PROMPTS_START"});try{const he={count:re};L!=null&&L.provider&&(he.provider=L.provider),L!=null&&L.model&&(he.model=L.model);const pe=await fetch(`/api/skills/${t}/${r}/activation-prompts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(he)});if(!pe.ok){let ht=`HTTP ${pe.status}`;try{const Dt=await pe.json();Dt.error&&(ht=Dt.error)}catch{}throw new Error(ht)}const xe=pe.body.getReader(),je=new TextDecoder;let Be="",Oe="",rt=[];for(;;){const{done:ht,value:Dt}=await xe.read();if(ht)break;Be+=je.decode(Dt,{stream:!0});const Tt=Be.split(`
|
|
70
|
+
`);Be=Tt.pop()||"";for(const Qe of Tt)if(Qe.startsWith("event: "))Oe=Qe.slice(7).trim();else if(Qe.startsWith("data: ")){try{const tt=JSON.parse(Qe.slice(6));if(Oe==="done"){if(tt.error)throw new Error(tt.error);rt=tt.prompts||[]}if(Oe==="error")throw new Error(tt.message||tt.description||"Generation failed")}catch(tt){if(!(tt instanceof SyntaxError))throw tt}Oe=""}}const Nt=rt.map(ht=>`${ht.expected==="should_activate"?"+":"!"}${ht.prompt}`).join(`
|
|
71
|
+
`);d({type:"SET_ACTIVATION_PROMPTS",prompts:Nt}),d({type:"GENERATE_PROMPTS_DONE"})}catch(he){d({type:"GENERATE_PROMPTS_ERROR",error:he.message})}},[t,r,L]),_e=p.useMemo(()=>({state:u,dispatch:d,isReadOnly:c,saveContent:T,saveEvals:R,runCase:M,runAll:B,cancelCase:D,cancelAll:F,improveForCase:E,applyImproveAndRerun:H,refreshSkillContent:se,generateEvals:te,runActivationTest:Se,cancelActivation:de,generateActivationPrompts:Ae,fetchActivationHistory:C,submitAiEdit:K,cancelAiEdit:X,applyAiEdit:ee,discardAiEdit:$,toggleEvalChange:z,selectAllEvalChanges:I,deselectAllEvalChanges:O,retryEvalsSave:U}),[u,c,T,R,M,B,D,F,E,H,se,te,Se,de,Ae,C,K,X,ee,$,z,I,O,U]);return a.jsx(vy.Provider,{value:_e,children:o})}function Vw(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 zf({contentDiff:t,fromLabel:r,toLabel:s,diffSummary:o,maxHeight:c=480,collapsible:u=!1,renderContext:d="inline",onRetry:h}){const[g,m]=p.useState(u),[y,v]=p.useState("unified"),b=p.useRef(null),k=p.useRef(null),S=p.useMemo(()=>Vw(t),[t]),w=p.useMemo(()=>{const D=S.filter(E=>E.type==="add").length,F=S.filter(E=>E.type==="remove").length;return{added:D,removed:F}},[S]),C=p.useMemo(()=>{let D=0,F=0;return S.filter(E=>E.type!=="header").map(E=>E.type==="remove"?(D++,{...E,origNum:D,newNum:null}):E.type==="add"?(F++,{...E,origNum:null,newNum:F}):(D++,F++,{...E,origNum:D,newNum:F}))},[S]),T=p.useMemo(()=>{const D=[],F=[];for(const E of C)if(E.type==="remove")D.push(E);else if(E.type==="add")F.push(E);else{for(;D.length<F.length;)D.push({type:"context",content:"",origNum:null,newNum:null});for(;F.length<D.length;)F.push({type:"context",content:"",origNum:null,newNum:null});D.push(E),F.push(E)}for(;D.length<F.length;)D.push({type:"context",content:"",origNum:null,newNum:null});for(;F.length<D.length;)F.push({type:"context",content:"",origNum:null,newNum:null});return{left:D,right:F}},[C]),R=p.useCallback(D=>{const F=D==="left"?b.current:k.current,E=D==="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 M=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:()=>m(!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((D,F)=>a.jsxs("tr",{style:{background:D.type==="add"?"rgba(34,197,94,0.08)":D.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:D.type==="remove"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:D.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:D.origNum??""}),a.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:D.type==="add"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:D.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:D.newNum??""}),a.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:D.type==="add"?"var(--green)":D.type==="remove"?"var(--red)":"transparent",borderRight:D.type==="add"?"2px solid var(--green)":D.type==="remove"?"2px solid var(--red)":"2px solid transparent"},children:D.type==="add"?"+":D.type==="remove"?"-":" "}),a.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:D.type==="add"?"var(--green)":D.type==="remove"?"var(--red)":"var(--text-secondary)"},children:D.content||""})]},F))})})}):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((D,F)=>a.jsxs("tr",{style:{background:D.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:D.origNum??""}),a.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:D.type==="remove"?"var(--red)":"var(--text-secondary)"},children:D.content||""})]},F))})})}),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((D,F)=>a.jsxs("tr",{style:{background:D.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:D.newNum??""}),a.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:D.type==="add"?"var(--green)":"var(--text-secondary)"},children:D.content||""})]},F))})})})]}))]});return d==="modal"?a.jsx("div",{className:M,children:a.jsx("div",{style:{width:"80%",maxWidth:900},children:B})}):B}const Rd="https://verified-skill.com/submit",Pw=/^https:\/\/github\.com\/[^/?#@:]+\/[^/?#@:]+(?:[/?#].*)?$/;function Fw(t){if(!t)return Rd;const r=t.trim();return!r||!Pw.test(r)?Rd:`${Rd}?repo=${encodeURIComponent(r)}`}const Mg={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 Gw(t,r){return t?t.length>r?t.slice(0,r)+"…":t:""}function Ww(){const{state:t}=Rn(),{plugin:r,skill:s}=t,o=ea(),{refreshSkills:c,updateCount:u}=o,d=p.useMemo(()=>o.state.skills.find(z=>z.plugin===r&&z.skill===s)??null,[o.state.skills,r,s]),h=`versions/${r}/${s}`,g=p.useCallback(()=>Ce.getSkillVersions(r,s),[r,s]),{data:m,loading:y}=ei(h,g),[v,b]=p.useState(null),[k,S]=p.useState(null),[w,C]=p.useState(null),[T,R]=p.useState(!1),[M,B]=p.useState("idle"),[D,F]=p.useState(null),E=p.useRef(null),H=p.useRef(null),N=p.useMemo(()=>(m==null?void 0:m.find(z=>z.isInstalled))??null,[m]),_=p.useMemo(()=>(m==null?void 0:m[0])??null,[m]),P=N&&_&&N.version!==_.version,K=p.useCallback(z=>{v?!k&&z!==v?S(z):(b(z),S(null),C(null)):(b(z),C(null))},[v,k]),X=p.useCallback(async(z,I)=>{R(!0);try{const O=await Ce.getVersionDiff(r,s,z,I);C(O)}catch{C(null)}finally{R(!1)}},[r,s]);p.useEffect(()=>{if(v&&k){const z=m||[],I=z.findIndex(L=>L.version===v),O=z.findIndex(L=>L.version===k),[U,se]=I>O?[v,k]:[k,v];X(U,se)}},[v,k,m,X]);const ee=p.useCallback(()=>{!N||!_||(b(N.version),S(_.version))},[N,_]),$=p.useCallback(()=>{B("updating"),F(null);const z=Ce.startSkillUpdate(r,s);E.current=z,z.addEventListener("progress",I=>{try{switch(JSON.parse(I.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")}}),z.addEventListener("done",()=>{z.close(),E.current=null,c(),Nn(h),B("done")}),z.addEventListener("error",I=>{const O=I;let U="Connection lost";if(O.data)try{U=JSON.parse(O.data).error||"Update failed"}catch{}B("error"),F(U),z.close(),E.current=null})},[r,s,h,c]);if(p.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(!m||m.length===0){if((d==null?void 0:d.origin)==="source"){const I=Fw((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:I,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:[P&&a.jsx("button",{onClick:ee,className:"btn btn-secondary text-[11px]",children:"View changes since installed"}),P&&M!=="done"&&(M==="error"?a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--red)"},children:D||"Update failed"}),a.jsx("button",{onClick:$,className:"btn btn-secondary text-[11px]",children:"Retry"})]}):a.jsx("button",{onClick:$,disabled:M!=="idle",className:"btn btn-primary text-[11px]",children:M==="idle"?`Update to ${_==null?void 0:_.version}`:M==="updating"?"Starting update...":M==="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:m.map(z=>{const I=Mg[z.certTier]||Mg.COMMUNITY,O=z.version===v||z.version===k,U=z.isInstalled;return a.jsxs("button",{onClick:()=>K(z.version),className:"w-full text-left pl-8 pr-4 py-3 relative rounded-lg transition-all duration-150",style:{background:O?"var(--accent-muted)":"transparent",border:O?"1px solid var(--accent)":"1px solid transparent",cursor:"pointer"},onMouseEnter:se=>{O||(se.currentTarget.style.background="var(--surface-1)")},onMouseLeave:se=>{O||(se.currentTarget.style.background="transparent")},children:[a.jsx("span",{className:"absolute left-1.5 top-4 rounded-full",style:{width:U?10:8,height:U?10:8,background:U?"var(--accent)":"var(--surface-3)",border:U?"2px solid var(--accent)":"2px solid var(--border-default)"}}),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:z.version}),a.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:I.bg,color:I.text},children:z.certTier}),U&&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(z.createdAt).toLocaleDateString()})]}),z.diffSummary&&a.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:Gw(z.diffSummary,80)})]},z.version)})}),a.jsx("div",{ref:H,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(zf,{contentDiff:w.contentDiff,fromLabel:w.from,toLabel:w.to,diffSummary:w.diffSummary,renderContext:"inline",onRetry:()=>v&&k&&X(w.from,w.to)})})]})}function qw(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 m=g.match(/^[ \t]+([\w-]+):\s*(.*)$/);if(m&&d&&h){const b=m[1],k=m[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 Xo(t){if(!t)return"";try{let r=t.replace(/^---\n[\s\S]*?\n---\n?/,""),s=Yw(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 Yw(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=Lg(r[o]);o+=2;const u=[];for(;o<r.length&&r[o].trim().startsWith("|");)u.push(Lg(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 m of c)g+=`<th ${d}>${m}</th>`;g+="</tr></thead><tbody>";for(const m of u){g+="<tr>";for(const y of m)g+=`<td ${h}>${y}</td>`;g+="</tr>"}g+="</tbody></table>",s.push(g)}else s.push(r[o]),o++;return s.join(`
|
|
75
|
+
`)}function Lg(t){return t.split("|").map(r=>r.trim()).filter(r=>r.length>0)}function Qo(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,m=u;for(;g>0||m>0;)g>0&&m>0&&s[g-1]===o[m-1]?(h.push({type:"unchanged",content:s[g-1]}),g--,m--):m>0&&(g===0||d[g][m-1]>=d[g-1][m])?(h.push({type:"added",content:o[m-1]}),m--):(h.push({type:"removed",content:s[g-1]}),g--);return h.reverse()}function Kw(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 ti({entries:t,isRunning:r}){const[s,o]=p.useState(!1),c=p.useRef(null);return p.useEffect(()=>{c.current&&!s&&(c.current.scrollTop=c.current.scrollHeight)},[t,s]),t.length===0&&!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:[Kw(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 zg={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 Zo({error:t,onRetry:r,onDismiss:s}){const[o,c]=p.useState(null),u=p.useRef(null);p.useEffect(()=>(t.category==="rate_limit"&&t.retryAfterMs?c(Math.ceil(t.retryAfterMs/1e3)):c(null),()=>{u.current&&clearInterval(u.current)}),[t]),p.useEffect(()=>{if(!(o==null||o<=0))return u.current=setInterval(()=>{c(g=>g==null||g<=1?(u.current&&clearInterval(u.current),0):g-1)},1e3),()=>{u.current&&clearInterval(u.current)}},[o!=null&&o>0]);const d=zg[t.category]||zg.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 Xw({plugin:t,skill:r,skillContent:s,onApplied:o}){const[c,u]=p.useState("closed"),{config:d}=Ur(),[h,g]=p.useState("claude-cli"),[m,y]=p.useState("opus"),[v,b]=p.useState([]),[k,S]=p.useState(""),[w,C]=p.useState(""),[T,R]=p.useState(null),[M,B]=p.useState(null),[D,F]=p.useState([]),[E,H]=p.useState(!1),N=p.useRef(null);p.useEffect(()=>{if(!d)return;d.providers.find(I=>I.id==="claude-cli"&&I.available)&&(g("claude-cli"),y("opus"))},[d]),p.useEffect(()=>()=>{var z;(z=N.current)==null||z.abort()},[]);function _(){return d==null?void 0:d.providers.find(z=>z.id===h&&z.available)}const P=p.useCallback(()=>{var z;(z=N.current)==null||z.abort(),u("open")},[]);async function K(){u("loading"),R(null),B(null),F([]);const z=new AbortController;N.current=z;try{const I=await fetch(`/api/skills/${encodeURIComponent(t)}/${encodeURIComponent(r)}/improve?sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:h,model:m}),signal:z.signal});if(!I.ok||!I.body){let q=`HTTP ${I.status}`;try{const W=await I.json();W.error&&(q=W.error)}catch{}throw new Error(q)}const O=I.body.getReader(),U=new TextDecoder;let se="",L="";for(;;){const{done:q,value:W}=await O.read();if(q)break;se+=U.decode(W,{stream:!0});const te=se.split(`
|
|
78
|
+
`);se=te.pop()||"";for(const fe of te)if(fe.startsWith("event: "))L=fe.slice(7).trim();else if(fe.startsWith("data: ")){try{const ie=JSON.parse(fe.slice(6));L==="progress"?F(ve=>[...ve,{phase:ie.phase,message:ie.message,timestamp:Date.now()}]):L==="done"||L==="complete"?(S(ie.improved),C(ie.reasoning||""),b(Qo(ie.original||s,ie.improved)),u("diff_shown")):L==="error"&&(R(ie.message||ie.description||"Unknown error"),ie.category&&B(ie),u("open"))}catch{}L=""}}}catch(I){I.name!=="AbortError"&&(R(I.message),u("open"))}finally{N.current=null}}async function X(){H(!0);try{await Ce.applyImprovement(t,r,k),o(k),u("closed")}catch(z){R(z.message)}finally{H(!1)}}function ee(){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 $=_();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:ee,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:z=>{z.currentTarget.style.background="var(--surface-3)"},onMouseLeave:z=>{z.currentTarget.style.background="transparent"},children: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:z=>{g(z.target.value);const I=d==null?void 0:d.providers.find(O=>O.id===z.target.value);I!=null&&I.models[0]&&y(I.models[0].id)},disabled:c==="loading",children:d==null?void 0:d.providers.filter(z=>z.available).map(z=>a.jsx("option",{value:z.id,children:z.label},z.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:m,onChange:z=>y(z.target.value),disabled:c==="loading",children:$==null?void 0:$.models.map(z=>a.jsx("option",{value:z.id,children:z.label},z.id))})]}),c==="loading"?a.jsx("button",{onClick:P,className:"btn btn-secondary flex-shrink-0",children:"Cancel"}):a.jsx("button",{onClick:K,className:"btn btn-primary flex-shrink-0",children:"Improve"})]}),c==="loading"&&D.length>0&&a.jsx("div",{className:"mt-3",children:a.jsx(ti,{entries:D,isRunning:!0})})]}),T&&a.jsx("div",{className:"mb-4",children:M?a.jsx(Zo,{error:M,onRetry:K,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((z,I)=>a.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:z.type==="added"?"rgba(34,197,94,0.1)":z.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:z.type==="added"?"var(--green)":z.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:z.type==="added"?"3px solid var(--green)":z.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:z.type==="added"?"+":z.type==="removed"?"-":" "}),z.content]},I))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:X,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:ee,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}const Dg={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"}},Qw={remove:"var(--red)",modify:"#fbbf24",add:"var(--green)"};function Zw({change:t,index:r,selected:s,onToggle:o,originalEval:c}){var v;const[u,d]=p.useState(!1),h=Dg[t.action]??Dg.add,g=Qw[t.action]??"var(--border-subtle)",m=t.action==="remove"?(c==null?void 0:c.name)??`Eval #${t.evalId}`:((v=t.eval)==null?void 0:v.name)??"Unnamed",y=p.useCallback(()=>o(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:m}),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(Jw,{evalCase:t.eval}),t.action==="modify"&&t.eval&&c&&a.jsx(eC,{original:c,proposed:t.eval}),t.action==="remove"&&c&&a.jsx(tC,{evalCase:c})]})]})}function Jw({evalCase:t}){var r;return a.jsxs("div",{className:"pt-2.5 space-y-2",children:[a.jsx(lf,{label:"Prompt",value:t.prompt}),a.jsx(lf,{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 eC({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(m=>m.text)),d=new Set(c.map(m=>m.text)),h=c.filter(m=>!u.has(m.text)),g=o.filter(m=>!d.has(m.text));return a.jsxs("div",{className:"pt-2.5 space-y-2",children:[s.map(m=>a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:m.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:["- ",sf(m.old,120)]}),a.jsxs("div",{style:{color:"var(--green)"},children:["+ ",sf(m.new,120)]})]})]},m.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(m=>a.jsxs("div",{className:"text-[11px]",style:{color:"var(--red)"},children:["- ",m.text]},m.id)),h.map(m=>a.jsxs("div",{className:"text-[11px]",style:{color:"var(--green)"},children:["+ ",m.text]},m.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 tC({evalCase:t}){var r;return a.jsxs("div",{className:"pt-2.5 space-y-2",style:{opacity:.7},children:[a.jsx(lf,{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 lf({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:sf(r,300)})]})}function sf(t,r){return t.length>r?t.slice(0,r)+"...":t}const _g={remove:0,modify:1,add:2};function nC({changes:t,selections:r,currentEvals:s,onToggle:o,onSelectAll:c,onDeselectAll:u}){if(t.length===0)return null;const d=t.map((g,m)=>({change:g,originalIndex:m}));d.sort((g,m)=>(_g[g.change.action]??2)-(_g[m.change.action]??2));const h=Array.from(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:m})=>a.jsx(Zw,{change:g,index:m,selected:r.get(m)??!1,onToggle:o,originalEval:g.evalId!=null?s.find(y=>y.id===g.evalId):void 0},m))})]})}function aC(){var z;const{state:t,dispatch:r,submitAiEdit:s,applyAiEdit:o,discardAiEdit:c,cancelAiEdit:u,toggleEvalChange:d,selectAllEvalChanges:h,deselectAllEvalChanges:g,retryEvalsSave:m}=Rn(),{aiEditLoading:y,aiEditResult:v,aiEditError:b,aiEditClassifiedError:k,aiEditProgress:S,aiEditEvalChanges:w,aiEditEvalSelections:C,aiEditEvalsRetry:T}=t,[R,M]=p.useState(""),{config:B}=Ur(),[D,F]=p.useState("claude-cli"),[E,H]=p.useState("opus"),N=p.useRef(null);p.useEffect(()=>{var I;(I=N.current)==null||I.focus()},[]),p.useEffect(()=>{if(!B)return;B.providers.find(O=>O.id==="claude-cli"&&O.available)&&(F("claude-cli"),H("opus"))},[B]);const _=B==null?void 0:B.providers.find(I=>I.id===D&&I.available),P=p.useCallback(()=>{const I=R.trim();!I||y||s(I,D,E)},[R,y,s,D,E]),K=p.useCallback(I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),P()),I.key==="Escape"&&(I.preventDefault(),y?u():c())},[P,y,u,c]),X=p.useCallback(()=>{r({type:"CLOSE_AI_EDIT"}),r({type:"OPEN_AI_EDIT"})},[r]),ee=v?Qo(t.skillContent,v.improved):[],$=((z=t.evals)==null?void 0:z.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:I=>{I.currentTarget.style.background="var(--surface-3)"},onMouseLeave:I=>{I.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:I=>M(I.target.value),onKeyDown:K,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:D,onChange:I=>{F(I.target.value);const O=B==null?void 0:B.providers.find(U=>U.id===I.target.value);O!=null&&O.models[0]&&H(O.models[0].id)},disabled:y,style:{width:"100%"},children:B==null?void 0:B.providers.filter(I=>I.available).map(I=>a.jsx("option",{value:I.id,children:I.label},I.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:I=>H(I.target.value),disabled:y,style:{width:"100%"},children:_==null?void 0:_.models.map(I=>a.jsx("option",{value:I.id,children:I.label},I.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:P,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(ti,{entries:S,isRunning:!0})})]}),b&&a.jsx("div",{className:"mt-3",children:k?a.jsx(Zo,{error:k,onRetry:X,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:ee.map((I,O)=>a.jsxs("div",{className:"px-3 py-0.5 text-[10.5px] font-mono",style:{background:I.type==="added"?"rgba(34,197,94,0.1)":I.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:I.type==="added"?"var(--green)":I.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:I.type==="added"?"3px solid var(--green)":I.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:I.type==="added"?"+":I.type==="removed"?"-":" "}),I.content]},O))}),a.jsx(nC,{changes:w,selections:C,currentEvals:$,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:m,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:X,className:"btn btn-ghost text-[11px]",style:{padding:"5px 12px"},children:"Try Again"})]})]})]})]})}function rC(t,r){const[s,o]=p.useState([]),[c,u]=p.useState("SKILL.md"),[d,h]=p.useState(null),[g,m]=p.useState(!1),[y,v]=p.useState(null),b=p.useCallback(async()=>{try{const w=await Ce.getSkillFiles(t,r);o(w.files)}catch{o([])}},[t,r]);p.useEffect(()=>{u("SKILL.md"),h(null),v(null),b()},[t,r,b]);const k=p.useCallback(async w=>{if(u(w),w==="SKILL.md"){h(null),v(null);return}m(!0),v(null);try{const C=await Ce.getSkillFile(t,r,w);h(C)}catch(C){v(`Unable to open file: ${C.message}`),h(null)}finally{m(!1)}},[t,r]),S=p.useCallback(()=>{b()},[b]);return{files:s,activeFile:c,secondaryContent:d,loading:g,error:y,selectFile:k,refresh:S,isSkillMd:c==="SKILL.md"}}function lC(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function sC(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 yy({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 by(){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 iC(){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 oC(){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 jy({node:t,depth:r,activeFile:s,onSelect:o}){const[c,u]=p.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(yy,{expanded:c}),a.jsx(by,{}),a.jsxs("span",{children:[t.name,"/"]})]}),c&&t.children.map(h=>a.jsx(jy,{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(iC,{}),a.jsx("span",{style:{flex:1},children:t.name}),a.jsx("span",{style:{fontSize:9,color:"var(--text-tertiary)",marginRight:4,whiteSpace:"nowrap"},children:lC(t.size)})]})}function cC({files:t,activeFile:r,onSelect:s,onRefresh:o}){const[c,u]=p.useState(!1),d=p.useMemo(()=>sC(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(yy,{expanded:c}),a.jsx(by,{}),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(oC,{})})]}),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(jy,{node:h,depth:0,activeFile:r,onSelect:s},h.path))})]})}function yo(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function uC(t){try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}function dC(t){const r=t.toLowerCase();return r.endsWith(".json")?"json":r.endsWith(".md")?"md":"other"}function Og({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 Bg({content:t,fileType:r}){if(r==="json"){const s=uC(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:Xo(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 Ig(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 fC({file:t,loading:r,error:s,viewMode:o,plugin:c,skill:u,onSaved:d,onDirtyChange:h}){const[g,m]=p.useState(o),[y,v]=p.useState(!1),[b,k]=p.useState(""),[S,w]=p.useState(!1),[C,T]=p.useState(null),R=o!==g?o:g;p.useEffect(()=>{h==null||h(y)},[y,h]);const M=p.useCallback(()=>{(t==null?void 0:t.content)!=null&&(k(t.content),v(!0))},[t]),B=p.useCallback(()=>{v(!1)},[]),D=p.useCallback(async()=>{if(!(!c||!u||!t)){w(!0);try{await Ce.saveSkillFile(c,u,t.path,b),T("Saved"),v(!1),d==null||d(),setTimeout(()=>T(null),2e3)}catch(H){T(`Save failed: ${H.message}`),setTimeout(()=>T(null),3e3)}finally{w(!1)}}},[c,u,t,b,d]);if(p.useEffect(()=>{if(!y)return;const H=N=>{(N.ctrlKey||N.metaKey)&&N.key==="s"&&(N.preventDefault(),D())};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[y,D]),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 (",yo(t.size),") — cannot be displayed"]});const F=t.content??"",E=dC(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 ",yo(512*1024)," — ",yo(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(H=>a.jsx("button",{onClick:()=>m(H),style:{padding:"2px 8px",fontSize:11,background:R===H?"var(--accent-muted)":"none",color:R===H?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer",textTransform:"capitalize"},children:H},H)),a.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",display:"flex",alignItems:"center",gap:6},children:[yo(t.size),c&&u&&!t.binary&&!y&&a.jsx("button",{onClick:M,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:D,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:H=>k(H.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:D,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(Og,{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:Ig(F)}}):a.jsx(Bg,{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:Ig(F)}}):a.jsx(Bg,{content:F,fileType:E}):a.jsx(Og,{content:F})})]})}function pC({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 mC({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 hC({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 xC({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 Ad({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 gC(){const{state:t,dispatch:r,saveContent:s,isReadOnly:o}=Rn(),{plugin:c,skill:u,skillContent:d,isDirty:h,improveTarget:g,aiEditOpen:m}=t,[y,v]=p.useState("split"),[b,k]=p.useState(!1),S=p.useRef(null),[w,C]=p.useState(!1),[T,R]=p.useState(""),[M,B]=p.useState(!1),[D,F]=p.useState(null),[E,H]=p.useState([]),[N,_]=p.useState([]),[P,K]=p.useState(null),X=p.useRef(null),{config:ee}=Ur(),{files:$,activeFile:z,secondaryContent:I,loading:O,error:U,selectFile:se,refresh:L,isSkillMd:q}=rC(c??"",u??""),[W,te]=p.useState(!1),fe=p.useCallback(be=>{W&&!window.confirm("You have unsaved changes. Discard?")||se(be)},[W,se]);p.useEffect(()=>()=>{var be;(be=X.current)==null||be.abort()},[]);const{metadata:ie,body:ve}=qw(d),de=ie["allowed-tools"],Se=Array.isArray(de)?de:typeof de=="string"?[de]:[],Ae=ie.name,_e=ie.description,re=ie.metadata,he=typeof re=="object"&&!Array.isArray(re)?re:null,pe=ie.version||(he==null?void 0:he.version),xe=ie.tags||(he==null?void 0:he.tags),je=Array.isArray(xe)?xe:typeof xe=="string"?xe.split(",").map(be=>be.trim()).filter(Boolean):[],Be=new Set(["name","description","metadata","allowed-tools","version","tags"]),Oe=Object.entries(ie).filter(([be])=>!Be.has(be)),rt=p.useCallback(async()=>{k(!0),await s(),k(!1)},[s]),Nt=p.useCallback(be=>{(be.ctrlKey||be.metaKey)&&be.key==="s"&&(be.preventDefault(),be.stopPropagation(),h&&rt()),(be.ctrlKey||be.metaKey)&&be.key==="k"&&(be.preventDefault(),be.stopPropagation(),r({type:m?"CLOSE_AI_EDIT":"OPEN_AI_EDIT"}))},[h,rt,m,r]),ht=p.useCallback(async()=>{var pt,Et;if(!T.trim())return;(pt=X.current)==null||pt.abort();const be=new AbortController;X.current=be,B(!0),K(null),_([]),F(null),H([]);try{const Yt=(ee==null?void 0:ee.provider)||"claude-cli",un=(ee==null?void 0:ee.model)||"sonnet",Gt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:T,provider:Yt,model:un}),signal:be.signal});if(!Gt.ok||!Gt.body){let St=`HTTP ${Gt.status}`;try{const ta=await Gt.json();ta.error&&(St=ta.error)}catch{}throw new Error(St)}const nn=Gt.body.getReader(),An=new TextDecoder;let Mt="",xt="";for(;;){const{done:St,value:ta}=await nn.read();if(St)break;Mt+=An.decode(ta,{stream:!0});const fa=Mt.split(`
|
|
79
|
+
`);Mt=fa.pop()||"";for(const Wn of fa)if(Wn.startsWith("event: "))xt=Wn.slice(7).trim();else if(Wn.startsWith("data: ")){try{const oe=JSON.parse(Wn.slice(6));if(xt==="progress")_(Ee=>[...Ee,{phase:oe.phase,message:oe.message,timestamp:Date.now()}]);else if(xt==="done"||xt==="complete"){const Ee=["---"];oe.name&&Ee.push(`name: ${oe.name}`),oe.description&&Ee.push(`description: "${oe.description.replace(/"/g,'\\"')}"`),oe.model&&Ee.push(`model: ${oe.model}`),(Et=oe.allowedTools)!=null&&Et.trim()&&Ee.push(`allowed-tools: ${oe.allowedTools.trim()}`),Ee.push("---","",oe.body||"");const ye=Ee.join(`
|
|
80
|
+
`);F(ye),H(Qo(d,ye)),B(!1)}else xt==="error"&&(K(oe.message||oe.description||"Generation failed"),B(!1))}catch{}xt=""}}}catch(Yt){Yt.name!=="AbortError"&&K(Yt.message)}finally{B(!1),X.current=null}},[T,ee,d]),Dt=p.useCallback(()=>{D&&r({type:"SET_CONTENT",content:D}),C(!1),F(null),H([]),R(""),_([])},[D,r]),Tt=p.useCallback(()=>{C(!1),F(null),H([]),R(""),_([]),K(null)},[]),Qe=p.useCallback(()=>{var be;w?((be=X.current)==null||be.abort(),Tt()):(m&&r({type:"CLOSE_AI_EDIT"}),C(!0))},[w,m,r,Tt]),tt=[{mode:"raw",icon:a.jsx(pC,{}),label:"Editor"},{mode:"split",icon:a.jsx(mC,{}),label:"Split"},{mode:"preview",icon:a.jsx(hC,{}),label:"Preview"}];return a.jsxs("div",{className:"flex flex-col h-full",onKeyDown:Nt,tabIndex:-1,children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:tt.map(({mode:be,icon:pt,label:Et})=>a.jsxs("button",{onClick:()=>v(be),title:Et,className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"5px 10px",background:y===be?"var(--surface-4)":"transparent",color:y===be?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:y===be?600:400,border:"none",cursor:"pointer"},children:[pt,a.jsx("span",{style:{letterSpacing:"0.01em"},children:Et})]},be))}),q?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:()=>{m?r({type:"CLOSE_AI_EDIT"}):(w&&Tt(),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:m?600:400,border:"none",cursor:"pointer",color:m?"var(--purple)":"var(--text-tertiary)",background:m?"var(--purple-muted)":"transparent"},children:[a.jsx(xC,{size:13}),a.jsx("span",{children:"AI Edit"})]}),a.jsxs("button",{onClick:Qe,title:"Regenerate skill from prompt",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:w?600:400,border:"none",cursor:"pointer",color:w?"var(--purple)":"var(--text-tertiary)",background:w?"var(--purple-muted)":"transparent"},children:[a.jsx(Ad,{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:rt,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(cC,{files:$,activeFile:z,onSelect:fe,onRefresh:L}),!q&&a.jsx(fC,{file:I,loading:O,error:U,viewMode:y,plugin:c??void 0,skill:u??void 0,onSaved:()=>{se(z),L()},onDirtyChange:te}),q&&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:be=>{o||r({type:"SET_CONTENT",content:be.target.value})},onKeyDown:Nt,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:[(Ae||pe||_e)&&a.jsxs("div",{style:{marginBottom:20},children:[a.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[Ae&&a.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:Ae}),pe&&a.jsxs("span",{style:{fontSize:10,fontWeight:600,color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4,letterSpacing:"0.03em",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:["v",pe]})]}),_e&&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:_e})]}),je.length>0&&a.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:je.map(be=>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:be},be))}),Se.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"}),Se.map(be=>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:be},be))]})}),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(([be,pt],Et)=>{const Yt=Array.isArray(pt)?pt.join(", "):typeof pt=="object"?Object.entries(pt).map(([un,Gt])=>`${un}: ${Array.isArray(Gt)?Gt.join(", "):Gt}`).join(" | "):pt;return a.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:Et>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:be}),a.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:Yt})]},be)})}),(Ae||_e||je.length>0||Se.length>0||Oe.length>0)&&ve&&a.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),ve&&a.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Xo(ve)}})]})})]}),q&&m&&a.jsx(aC,{}),q&&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:[!D&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ad,{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:be=>R(be.target.value),placeholder:"Describe what this skill should do...",rows:2,disabled:M,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:M?.5:1},onKeyDown:be=>{be.key==="Enter"&&(be.ctrlKey||be.metaKey)&&T.trim()&&!M&&(be.preventDefault(),ht())}})}),a.jsxs("div",{className:"flex items-center gap-2",children:[M?a.jsx("button",{onClick:()=>{var be;(be=X.current)==null||be.abort(),B(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):a.jsx("button",{onClick:ht,disabled:!T.trim(),className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:"Generate"}),a.jsx("button",{onClick:Tt,className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Close"})]}),M&&N.length>0&&a.jsx("div",{className:"mt-2",children:a.jsx(ti,{entries:N,isRunning:!0})}),P&&a.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:[P,a.jsx("button",{onClick:ht,className:"ml-2 underline",style:{color:"var(--red)"},children:"Retry"})]})]}),D&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ad,{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((be,pt)=>a.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:be.type==="added"?"var(--green-muted)":be.type==="removed"?"var(--red-muted)":"transparent",color:be.type==="added"?"var(--green)":be.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:be.type==="added"?"3px solid var(--green)":be.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:be.type==="added"?"+":be.type==="removed"?"-":" "}),be.content]},pt))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:Dt,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:Tt,className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Discard"})]})]})]})}),q&&g!==null&&c&&u&&a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(Xw,{plugin:c,skill:u,skillContent:d,onApplied:be=>{r({type:"SET_CONTENT",content:be}),r({type:"CONTENT_SAVED"}),r({type:"CLOSE_IMPROVE"})}})})]})}function Nl(t){return t.testType==="integration"?"integration":"unit"}function Ll(t){return t>=.8?"var(--green)":t>=.5?"var(--yellow)":"var(--red)"}function Sy(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 ky(t){return t==null?"--":t>=1e3?`${(t/1e3).toFixed(1)}s`:`${t}ms`}const vC=new Set(["benchmark","comparison","baseline"]);function Hg(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 wy({entries:t}){const r=t.filter(v=>vC.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?Hg(s,c,u,d):[],g=o.length>=2?Hg(o,c,u,d):[],m=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)"}),m&&a.jsx("circle",{cx:parseFloat(m.split(",")[0]),cy:parseFloat(m.split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function Cy(t,r,s){const o=isNaN(r)?0:r,c=[],u=[],d=[];if((t==="PASS"||t==="EFFECTIVE")&&o>=.7){const m=c.length>0?` Met criteria: ${c.map(y=>y.criterion).join(", ")}.`:"";return{explanation:`${t} (score ${o.toFixed(2)}): evaluation met expectations.${m}`}}if(t==="FAIL"||t==="DEGRADING"){const m=u.length>0?` Failed criteria: ${u.map(v=>v.criterion).join(", ")}.`:"",y=[...u.map(v=>`Improve "${v.criterion}" (score: ${v.score.toFixed(2)})`),...d.map(v=>`Strengthen "${v.criterion}" (score: ${v.score.toFixed(2)})`)];return y.length===0&&y.push("Review prompt instructions and add more specific guidance"),{explanation:`${t} (score ${o.toFixed(2)}): evaluation did not meet expectations.${m}`,recommendations:y}}if(t==="INEFFECTIVE"){if(o<.2){const y=[...u.map(v=>`Rework "${v.criterion}" — currently at ${v.score.toFixed(2)}`),"Consider adding examples to your system prompt","Review the rubric criteria for achievability"];return{explanation:`${t} (score ${o.toFixed(2)}): evaluation is significantly below expectations.`,recommendations:y}}const m=[...u.map(y=>`Rework "${y.criterion}" — currently at ${y.score.toFixed(2)}`),...d.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return m.length===0&&m.push("Consider restructuring your prompt approach"),{explanation:`${t} (score ${o.toFixed(2)}): below expectations but showing some capability.`,recommendations:m}}if(t==="MARGINAL"){const m=[...d.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`),...u.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return m.length===0&&m.push(c.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Review prompt instructions for areas of improvement"),{explanation:`${t} (score ${o.toFixed(2)}): moderate improvement detected.`,recommendations:m}}if(t==="EMERGING"){const m=[...u.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`),...d.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return m.length===0&&m.push(c.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Add more specific guidance to your prompt instructions"),{explanation:`${t} (score ${o.toFixed(2)}): early promise — focus on weak areas to improve.`,recommendations:m}}const h=c.length>0?` Passing: ${c.map(m=>m.criterion).join(", ")}.`:"",g=d.length>0?` Needs improvement: ${d.map(m=>m.criterion).join(", ")}.`:"";return{explanation:`${t} (score ${o.toFixed(2)}): mixed results.${h}${g}`}}const Ey={EFFECTIVE:"Strong Improvement",MARGINAL:"Moderate Improvement",EMERGING:"Early Promise",INEFFECTIVE:"Needs Work",DEGRADING:"Regression"};function yC(t){return Object.hasOwn(Ey,t)}function bC(t){return yC(t)?Ey[t]:t}function jC(){const{state:t}=Rn(),{plugin:r,skill:s}=t,[o,c]=p.useState([]),[u,d]=p.useState([]),[h,g]=p.useState(!0),[m,y]=p.useState(null),[v,b]=p.useState(new Set),[k,S]=p.useState({}),[w,C]=p.useState(null),[T,R]=p.useState(""),[M,B]=p.useState(!1),[D,F]=p.useState(""),[E,H]=p.useState(""),N=p.useCallback(async()=>{g(!0),y(null);try{const[$,z]=await Promise.all([Ce.getCredentials(r,s),Ce.getParams(r,s)]);c($.credentials),d(z.params)}catch($){y($ instanceof Error?$.message:"Failed to load parameters"),c([]),d([])}finally{g(!1)}},[r,s]);p.useEffect(()=>{N()},[N]);const _=p.useCallback(async($,z)=>{B(!0),y(null);try{await Ce.setCredential(r,s,$,z),C(null),R(""),await N()}catch(I){y(I instanceof Error?I.message:`Failed to save ${$}`)}finally{B(!1)}},[r,s,N]),P=p.useCallback(async()=>{const $=D.trim().toUpperCase(),z=E.trim();if(!(!$||!z)){B(!0),y(null);try{await Ce.setCredential(r,s,$,z),F(""),H(""),await N()}catch(I){y(I instanceof Error?I.message:`Failed to add ${$}`)}finally{B(!1)}}},[r,s,D,E,N]),K=p.useCallback(async $=>{if(v.has($)){b(z=>{const I=new Set(z);return I.delete($),I}),S(z=>{const I={...z};return delete I[$],I});return}try{const I=(await Ce.getParamsRevealed(r,s,$)).params.find(O=>O.name===$);I!=null&&I.value&&(S(O=>({...O,[$]:I.value})),b(O=>new Set(O).add($)))}catch{}},[r,s,v]),X=new Set(o.map($=>$.name)),ee=[...o.map($=>{const z=u.find(I=>I.name===$.name);return{name:$.name,status:$.status,maskedValue:(z==null?void 0:z.maskedValue)??""}}),...u.filter($=>!X.has($.name)).map($=>({name:$.name,status:$.status,maskedValue:$.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"}),m&&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:m}),h&&ee.length===0&&a.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!h&&ee.length===0&&!m&&a.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),ee.map($=>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:$.name}),a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:$.status==="ready"?"var(--green-muted)":"var(--red-muted)",color:$.status==="ready"?"var(--green)":"var(--red)"},children:$.status}),($.maskedValue||$.status==="ready")&&a.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[v.has($.name)?k[$.name]??$.maskedValue:$.maskedValue||"***",a.jsx("button",{onClick:()=>K($.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${v.has($.name)?"Hide":"Reveal"} value for ${$.name}`,children:v.has($.name)?"hide":"show"})]}),w===$.name?a.jsxs("div",{className:"flex gap-1",children:[a.jsx("input",{value:T,onChange:z=>R(z.target.value),onKeyDown:z=>{z.key==="Enter"&&T.trim()&&_($.name,T)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${$.name}`,autoFocus:!0}),a.jsx("button",{onClick:()=>_($.name,T),disabled:M||!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($.name),R("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},$.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:D,onChange:$=>F($.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($.target.value),onKeyDown:$=>{$.key==="Enter"&&D.trim()&&E.trim()&&P()},className:"input-field text-[10px] font-mono flex-1",placeholder:"value",type:"password","aria-label":"Parameter value"}),a.jsx("button",{onClick:P,disabled:M||!D.trim()||!E.trim(),className:"text-[10px] font-medium px-2 py-1 rounded",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"none",cursor:M?"not-allowed":"pointer"},children:"Add"})]})]})]})}function SC(t,r,s){const[o,c]=p.useState(null),[u,d]=p.useState(!1),h=p.useRef("");p.useEffect(()=>{const m=`${t}/${r}/${s}`;h.current!==m&&(h.current=m,d(!0),Ce.getCaseHistory(t,r,s).then(y=>c(y)).catch(()=>c([])).finally(()=>d(!1)))},[t,r,s]);const g=p.useCallback(()=>{d(!0),h.current="",Ce.getCaseHistory(t,r,s).then(m=>c(m)).catch(()=>c([])).finally(()=>d(!1))},[t,r,s]);return{entries:o,loading:u,refetch:g}}function kC(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(m=>m.id===t)).filter(Boolean);if(u.length>=2){const m=u.filter(y=>y.pass).length/u.length;m>=.3&&m<=.7&&(o.flaky=!0)}const d=s.find(g=>g.type==="benchmark"),h=s.find(g=>g.type==="baseline");if(d&&h){const g=d.assertions.find(y=>y.id===t),m=h.assertions.find(y=>y.id===t);g!=null&&g.pass&&(m!=null&&m.pass)&&(o.nonDiscriminating=!0)}if(r&&!r.pass&&s.length>=1){const m=s[0].assertions.find(y=>y.id===t);m!=null&&m.pass&&(o.regression=!0)}return o}function wC(){var O;const{state:t,dispatch:r,saveEvals:s,runCase:o,runAll:c,cancelCase:u,cancelAll:d,generateEvals:h,isReadOnly:g}=Rn(),{evals:m,evalsError:y,selectedCaseId:v,inlineResults:b,caseRunStates:k,generateEvalsLoading:S,generateEvalsProgress:w,generateEvalsError:C}=t,T=p.useMemo(()=>{for(const U of k.values())if(U.status==="running"||U.status==="queued")return!0;return!1},[k]),[R,M]=p.useState(!1),[B,D]=p.useState("all"),F={skill_name:t.skill,evals:[]},E=m??F,H=E.evals,N=p.useMemo(()=>B==="all"?H:H.filter(U=>Nl(U)===B),[B,H]),_=N.find(U=>U.id===v)??null;p.useEffect(()=>{v!==null&&!N.find(U=>U.id===v)&&r({type:"SELECT_CASE",caseId:N.length>0?N[0].id:null})},[N,v,r]);const[P,K]=p.useState([]),X=p.useMemo(()=>H.some(U=>Nl(U)==="integration"),[H]);p.useEffect(()=>{X&&Ce.getCredentials(t.plugin,t.skill).then(U=>K(U.credentials)).catch(()=>K([]))},[t.plugin,t.skill,X]);const ee=p.useMemo(()=>new Set(P.filter(U=>U.status==="missing").map(U=>U.name)),[P]),[$,z]=p.useState(!1),I=p.useCallback(U=>{z(!1),h(U?{testType:U}:void 0)},[h]);return!m||H.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:()=>M(!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:()=>I("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:()=>z(!$),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"})})})]}),$&&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:()=>I("integration"),className:"w-full text-left px-3 py-2 text-[12px] transition-colors duration-100",style:{color:"var(--text-secondary)",background:"transparent"},onMouseEnter:U=>{U.currentTarget.style.background="var(--surface-2)"},onMouseLeave:U=>{U.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(ti,{entries:w,isRunning:!0})}),C&&a.jsx("div",{className:"w-full max-w-md mt-3",children:a.jsx(Zo,{error:C,onRetry:()=>I()})}),R&&a.jsx(Ug,{evals:E,onSave:U=>{s(U),M(!1)},onCancel:()=>M(!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(U=>a.jsx("button",{onClick:()=>D(U),style:{padding:"2px 8px",fontSize:10,fontWeight:B===U?600:400,background:B===U?"var(--accent-muted)":"transparent",color:B===U?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:U==="all"?`All (${H.length})`:U==="unit"?`Unit (${H.filter(se=>Nl(se)==="unit").length})`:`Integration (${H.filter(se=>Nl(se)==="integration").length})`},U))}),a.jsxs("div",{className:"py-1",children:[N.length===0&&H.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(U=>{var W;const se=b.get(U.id),L=v===U.id,q=Nl(U);return a.jsxs("button",{onClick:()=>r({type:"SELECT_CASE",caseId:U.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:L?"var(--accent-muted)":"transparent",borderLeft:L?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:te=>{L||(te.currentTarget.style.background="var(--surface-2)")},onMouseLeave:te=>{L||(te.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:L?"var(--text-primary)":"var(--text-secondary)"},children:["#",U.id," ",U.name,a.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:9999,background:q==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:q==="unit"?"var(--accent)":"var(--orange)",whiteSpace:"nowrap"},children:q==="unit"?"U":"I"}),q==="integration"&&((W=U.requiredCredentials)==null?void 0:W.some(te=>ee.has(te)))&&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(Ny,{result:se})]}),a.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[U.assertions.length," assertion",U.assertions.length!==1?"s":"",(se==null?void 0:se.passRate)!=null&&a.jsx(NC,{passRate:se.passRate})]})]},U.id)})]}),a.jsx("div",{className:"px-3 py-2",children:!g&&a.jsx("button",{onClick:()=>M(!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:U=>{U.currentTarget.style.borderColor="var(--accent)",U.currentTarget.style.color="var(--accent)"},onMouseLeave:U=>{U.currentTarget.style.borderColor="var(--border-default)",U.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})}),a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(jC,{})})]}),a.jsx("div",{className:"overflow-auto",children:_?a.jsx(CC,{evalCase:_,result:b.get(_.id),evals:m,caseStatus:((O=k.get(_.id))==null?void 0:O.status)??"idle",onSaveEvals:s,onRun:U=>o(U,"benchmark"),onCompare:U=>o(U,"comparison"),onCancel:U=>u(U),onImprove:U=>r({type:"OPEN_IMPROVE",evalId:U})}):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(Ug,{evals:E,onSave:U=>{s(U),M(!1)},onCancel:()=>M(!1)})]})}function CC({evalCase:t,result:r,evals:s,caseStatus:o,onSaveEvals:c,onRun:u,onCompare:d,onCancel:h,onImprove:g}){const{state:m,isReadOnly:y}=Rn(),{plugin:v,skill:b}=m,{entries:k,loading:S}=SC(v,b,t.id),[w,C]=p.useState(!1),[T,R]=p.useState(t.prompt),[M,B]=p.useState(!1),[D,F]=p.useState(t.expected_output);p.useState(()=>{R(t.prompt),F(t.expected_output)});const E=p.useCallback(U=>{c({...s,evals:s.evals.map(se=>se.id===U.id?U:se)})},[s,c]),H=p.useCallback(()=>{E({...t,prompt:T}),C(!1)},[t,T,E]),N=p.useCallback(()=>{E({...t,expected_output:D}),B(!1)},[t,D,E]),_=p.useCallback(()=>{E({...t,assertions:[...t.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[t,E]),P=p.useCallback((U,se)=>{E({...t,assertions:t.assertions.map(L=>L.id===U?{...L,text:se}:L)})},[t,E]),K=p.useCallback(U=>{E({...t,assertions:t.assertions.filter(se=>se.id!==U)})},[t,E]),X=p.useCallback(()=>{confirm("Delete this test case?")&&c({...s,evals:s.evals.filter(U=>U.id!==t.id)})},[s,t.id,c]),ee=r&&r.assertions.length>0&&r.assertions.every(U=>U.pass),$=r&&r.assertions.some(U=>!U.pass),z=Nl(t),I=t.requiredCredentials??[],O=z==="integration"&&I.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:z==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:z==="unit"?"var(--accent)":"var(--orange)"},children:z==="unit"?"Unit":"Integration"}):a.jsx("button",{onClick:()=>{if((z==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:se,requirements:L,cleanup:q,...W}=t;E({...W,testType:"unit"})}else E({...t,testType:"integration"})},title:`Click to switch to ${z==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:z==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:z==="unit"?"var(--accent)":"var(--orange)",border:"none",cursor:"pointer"},children:z==="unit"?"Unit":"Integration"}),a.jsx(Ny,{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"})]}),$&&!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:X,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&&z==="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"})]}),ee&&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"})]}),O&&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:I.map(U=>a.jsx("span",{style:{fontSize:10,fontFamily:"var(--font-mono, monospace)",padding:"2px 6px",borderRadius:4,background:"var(--orange-muted)",color:"var(--orange)"},children:U},U))})]}),!y&&z==="integration"&&a.jsx(AC,{evalCase:t,onUpdate:E}),a.jsx(bo,{title:"Prompt",children:w?a.jsxs("div",{children:[a.jsx("textarea",{value:T,onChange:U=>R(U.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:H,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:U=>{y||(U.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:U=>{U.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(bo,{title:"Expected Output",children:M?a.jsxs("div",{children:[a.jsx("textarea",{value:D,onChange:U=>F(U.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:U=>{y||(U.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:U=>{U.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(bo,{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(U=>{const se=r==null?void 0:r.assertions.find(q=>q.assertion_id===U.id),L=kC(U.id,se,k);return a.jsx(EC,{assertion:U,result:se,badges:L,isReadOnly:y,onUpdate:q=>P(U.id,q),onDelete:()=>K(U.id)},U.id)})})}),(r==null?void 0:r.output)&&a.jsx(TC,{output:r.output,durationMs:r.durationMs,tokens:r.tokens}),r&&r.passRate!=null&&r.passRate<.2&&(()=>{const U=Cy("INEFFECTIVE",r.passRate);return U.recommendations&&U.recommendations.length>0?a.jsx(bo,{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:U.recommendations.map((se,L)=>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:"•"}),se]},L))})]})}):null})(),a.jsx(RC,{evalId:t.id,sharedEntries:k,sharedLoading:S})]},t.id)}function EC({assertion:t,result:r,badges:s,isReadOnly:o,onUpdate:c,onDelete:u}){const[d,h]=p.useState(!1),[g,m]=p.useState(t.text),[y,v]=p.useState(!1),b=()=>{c(g),h(!1)};return 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=>m(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||(m(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 bo({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 Ny({result:t}){const[r,s]=p.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=Cy(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 NC({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 TC({output:t,durationMs:r,tokens:s}){const[o,c]=p.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 Md(t){return t==="baseline"?"right":t==="comparison"?"full":"left"}function Ld({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:Sy(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:Ll(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:ky(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 RC({evalId:t,sharedEntries:r,sharedLoading:s}){const{state:o,dispatch:c}=Rn(),{plugin:u,skill:d}=o,[h,g]=p.useState(!0),m=r??null,y=s??!1,v=p.useCallback(()=>{g(w=>!w)},[]),b=m?m.slice(0,10):[],k=b.some(w=>{const C=Md(w.type);return C==="left"||C==="full"}),S=b.some(w=>{const C=Md(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",m&&m.length>0&&a.jsxs("span",{style:{fontWeight:400},children:["(",m.length," run",m.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..."})]}):!m||m.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(wy,{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=Md(w.type);return T==="full"?a.jsx("div",{style:{gridColumn:"1 / -1"},children:a.jsx(Ld,{entry:w})},C):T==="left"?a.jsxs(p.Fragment,{children:[a.jsx("div",{style:{gridColumn:"1"},children:a.jsx(Ld,{entry:w})}),a.jsx("div",{style:{gridColumn:"2"}})]},C):a.jsxs(p.Fragment,{children:[a.jsx("div",{style:{gridColumn:"1"}}),a.jsx("div",{style:{gridColumn:"2"},children:a.jsx(Ld,{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 Ug({evals:t,onSave:r,onCancel:s}){const[o,c]=p.useState(""),[u,d]=p.useState(""),[h,g]=p.useState(""),[m,y]=p.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[v,b]=p.useState("unit"),[k,S]=p.useState(""),[w,C]=p.useState([]),[T,R]=p.useState(""),[M,B]=p.useState(""),D=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("")},H=()=>{if(!o.trim()||!u.trim())return;const N={id:D,name:o.trim(),prompt:u.trim(),expected_output:h.trim(),files:[],assertions:m.filter(_=>_.text.trim()),...v==="integration"?{testType:"integration",...w.length>0?{requiredCredentials:w}:{},...T||M?{requirements:{...T?{platform:T}:{},...M?{chromeProfile:M}:{}}}:{}}:{}};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"}),m.map((N,_)=>a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx("input",{value:N.text,onChange:P=>y(m.map((K,X)=>X===_?{...K,text:P.target.value}:K)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),m.length>1&&a.jsx("button",{onClick:()=>y(m.filter((P,K)=>K!==_)),className:"btn btn-ghost p-1",style:{color:"var(--text-tertiary)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},N.id)),a.jsx("button",{onClick:()=>y([...m,{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--accent)"},children:"+ Add Assertion"})]}),v==="integration"&&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:M,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:H,disabled:!o.trim()||!u.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function AC({evalCase:t,onUpdate:r}){var d,h;const[s,o]=p.useState(""),c=()=>{const g=s.trim().toUpperCase();g&&!(t.requiredCredentials??[]).includes(g)&&r({...t,requiredCredentials:[...t.requiredCredentials??[],g]}),o("")},u=g=>{const m=(t.requiredCredentials??[]).filter(y=>y!==g);r({...t,requiredCredentials:m.length>0?m: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 Tn(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 Ty(t,r){return t==null||r==null?"N/A":`${t.toLocaleString("en-US")} in / ${r.toLocaleString("en-US")} out`}function MC(t){return t==="baseline"?"Baseline Pass Rate":"Skill Pass Rate"}function LC(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 zC(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 $g(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 DC(t){return t==="skill"?{text:"Skill wins",isSkill:!0}:t==="baseline"?{text:"Baseline wins",isSkill:!1}:{text:"Tie",isSkill:!1}}function _C(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 OC={anthropic:.01,openrouter:.01,ollama:0,"lm-studio":0,"claude-cli":0,"codex-cli":0,"gemini-cli":0};function BC(t,r){if(!t)return null;const s=OC[t];if(s==null||s===0)return null;const o=s*r*.5,c=s*r*2;return`${Tn(o)}–${Tn(c)}`}function IC(){const{state:t,runCase:r,runAll:s,cancelCase:o,cancelAll:c,isReadOnly:u}=Rn(),{evals:d,caseRunStates:h,bulkRunActive:g,latestBenchmark:m,inlineResults:y}=t,{config:v}=Ur(),b=(d==null?void 0:d.evals)??[],k=p.useMemo(()=>{for(const E of h.values())if(E.status==="running"||E.status==="queued")return!0;return!1},[h]),S=b.filter(E=>{const H=h.get(E.id);return H&&(H.status==="complete"||H.status==="error"||H.status==="cancelled")}).length,w=b.filter(E=>{const H=h.get(E.id);return H&&(H.status==="running"||H.status==="queued")}).length,C=p.useRef(null),[T,R]=p.useState(0);p.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 M=b.reduce((E,H)=>E+H.assertions.length,0),B=b.length+M,D=p.useMemo(()=>_C(b.length,M),[b.length,M]),F=p.useMemo(()=>BC((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: ",D]}),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: ",D]})]})]}),a.jsx("div",{className:"space-y-3 stagger-children",children:b.map(E=>{const H=y.get(E.id),N=h.get(E.id),_=(N==null?void 0:N.status)??"idle",P=m==null?void 0:m.cases.find(K=>K.eval_id===E.id);return a.jsx(UC,{name:E.name,evalId:E.id,result:H,caseCost:P==null?void 0:P.cost,caseBillingMode:P==null?void 0:P.billingMode,caseInputTokens:P==null?void 0:P.inputTokens,caseOutputTokens:P==null?void 0:P.outputTokens,caseStatus:_,runMode:(N==null?void 0:N.mode)??null,comparisonDetail:P==null?void 0:P.comparisonDetail,isReadOnly:u,onRun:K=>r(K,"benchmark"),onBaseline:K=>r(K,"baseline"),onCompare:K=>r(K,"comparison"),onCancel:K=>o(K)},E.id)})}),!k&&m&&m.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:MC(m.type)}),a.jsx("span",{className:"text-[20px] font-bold",style:{color:(m.overall_pass_rate??0)>=.8?"var(--green)":(m.overall_pass_rate??0)>=.5?"var(--yellow)":"var(--red)"},children:m.overall_pass_rate!=null?`${Math.round(m.overall_pass_rate*100)}%`:"--"})]}),m.totalDurationMs!=null&&a.jsxs("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:["Total: ",(m.totalDurationMs/1e3).toFixed(1),"s",m.model&&` | Model: ${m.model}`,m.totalInputTokens!=null&&m.totalOutputTokens!=null&&` | Tokens: ${Ty(m.totalInputTokens,m.totalOutputTokens)}`,m.totalCost!=null&&` | Cost: ${Tn(m.totalCost)}`]}),m.overall_pass_rate>=.9999&&!m.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"})]}),m.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=LC(m.model,m.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(Vg,{label:"Skill",value:m.comparison.skillPassRate,color:"var(--accent)"}),a.jsx(Vg,{label:"Baseline",value:m.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),a.jsxs("div",{className:"mt-3 text-[12px] font-medium",style:{color:m.comparison.delta>0?"var(--green)":m.comparison.delta<0?"var(--red)":"var(--text-tertiary)"},children:["Delta: ",m.comparison.delta>0?"+":"",(m.comparison.delta*100).toFixed(1),"%",m.verdict&&` | ${bC(m.verdict)}`]}),(()=>{const E=m.cases.reduce((N,_)=>N+_.assertions.length,0),H=zC(m.comparison.delta,E,m.cases.length);return a.jsx("div",{className:"mt-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:H})})()]})]})]})}const HC={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 UC({name:t,evalId:r,result:s,caseCost:o,caseBillingMode:c,caseInputTokens:u,caseOutputTokens:d,caseStatus:h,runMode:g,comparisonDetail:m,isReadOnly:y,onRun:v,onBaseline:b,onCompare:k,onCancel:S}){const[w,C]=p.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 M=HC[g];return M?a.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:M.bg,color:M.color,padding:"1px 6px"},children:M.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:Ty(u,d)}),o!=null&&a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:Tn(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(M=>a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsx("span",{style:{color:M.pass?"var(--green)":"var(--red)"},children:M.pass?"PASS":"FAIL"}),a.jsx("span",{style:{color:"var(--text-secondary)"},children:M.text})]},M.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})]}),m&&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 M=$g(m.skillContentScore,m.baselineContentScore),B=$g(m.skillStructureScore,m.baselineStructureScore),D=DC(m.winner);return a.jsxs(a.Fragment,{children:[a.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Content: Skill ",M.skill,"% / Baseline ",M.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:D.isSkill?"var(--accent)":"var(--text-tertiary)",fontWeight:500},children:D.text})]})})()})})}),s&&s.errorMessage&&a.jsx($C,{errorMessage:s.errorMessage,classifiedError:s.classifiedError})]})}const zd={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function $C({errorMessage:t,classifiedError:r}){const[s,o]=p.useState(!1),c=(r==null?void 0:r.title)??"Error",u=r==null?void 0:r.hint,d=r?zd[r.category]??zd.unknown:zd.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 Vg({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 Pg={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 VC(){var I;const{state:t,dispatch:r,runActivationTest:s,cancelActivation:o,generateActivationPrompts:c}=Rn(),{plugin:u,skill:d,activationPrompts:h,activationResults:g,activationSummary:m,activationRunning:y,activationError:v,activationStartedAt:b,activationClassifyingStatus:k,generatingPrompts:S,generatingPromptsError:w,activationHistory:C}=t,{state:T}=ea(),R=((I=T.skills.find(O=>O.plugin===u&&O.skill===d))==null?void 0:I.version)??null,[M,B]=p.useState(h),[D,F]=p.useState(null),[E,H]=p.useState(!1);p.useEffect(()=>{h&&h!==M&&B(h)},[h]),p.useEffect(()=>{r({type:"SET_ACTIVATION_PROMPTS",prompts:M})},[M,r]),p.useEffect(()=>{fetch(`/api/skills/${u}/${d}/description`).then(O=>O.json()).then(O=>F(O.rawContent||O.description||null)).catch(()=>F(null))},[u,d]);function N(){s(M)}function _(){c(8)}const P=M.trim().split(`
|
|
81
|
+
`).filter(Boolean).length,K=g.filter(O=>O.classification==="TP"||O.classification==="TN"),X=g.filter(O=>O.classification==="FP"||O.classification==="FN"),ee=(D==null?void 0:D.replace(/^---[\s\S]*?---\s*/,"").trim())??null,$=M.trim().length>0,z=ee?Xo(ee):"";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||!ee||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:ee?"var(--accent)":"var(--text-tertiary)",border:"1px solid var(--border-subtle)",opacity:ee?1:.5,cursor:ee?"pointer":"not-allowed"},title:ee?void 0:"No skill description available",onMouseEnter:O=>{ee&&!S&&(O.currentTarget.style.background="var(--surface-3)")},onMouseLeave:O=>{S||(O.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"})}),$?"Regenerate":"Generate"," Test Prompts"]})})})]}),!ee&&!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:M,onChange:O=>B(O.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(jo,{}),a.jsx("span",{children:"No prefix = auto-classify"}),a.jsx(jo,{}),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(jo,{}),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(jo,{}),a.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[P," prompt",P!==1?"s":""]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:N,disabled:y||!M.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} / ${P} prompts tested`,b&&a.jsx(WC,{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:ee?a.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:z}}):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:[X.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 (",X.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:X.map((O,U)=>a.jsx(Fg,{result:O},`incorrect-${U}`))})]}),K.length>0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("polyline",{points:"16 10 11 15 8 12"})]}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--green)"},children:["Correct (",K.length,")"]})]}),a.jsx("div",{className:"space-y-1.5 stagger-children",children:K.map((O,U)=>a.jsx(Fg,{result:O},`correct-${U}`))})]})]}),m&&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"}),m.autoClassifiedCount!=null&&m.autoClassifiedCount>0&&a.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:[m.autoClassifiedCount," of ",m.total," prompts auto-classified from skill name and tags"]}),a.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[a.jsx(Dd,{label:"Precision",value:m.precision,description:"Of all activations, how many were correct?",detail:`${m.tp} true / ${m.tp+m.fp} total activations`}),a.jsx(Dd,{label:"Recall",value:m.recall,description:"Of expected activations, how many fired?",detail:`${m.tp} activated / ${m.tp+m.fn} expected`}),a.jsx(Dd,{label:"Reliability",value:m.reliability,description:"Overall correct classification rate",detail:`${m.tp+m.tn} correct / ${m.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(So,{label:"True Positive",abbr:"TP",count:m.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),a.jsx(So,{label:"False Positive",abbr:"FP",count:m.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),a.jsx(So,{label:"False Negative",abbr:"FN",count:m.fn,bg:"var(--red-muted)",color:"var(--red)",description:"Missed activation"}),a.jsx(So,{label:"True Negative",abbr:"TN",count:m.tn,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly silent"})]})]})]}),a.jsx(PC,{history:C,expanded:E,onToggle:()=>H(!E),skillVersion:R})]})}function PC({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(FC,{run:c,skillVersion:o},c.id))})})]})}function FC({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:GC(t.timestamp)}),a.jsx(Js,{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 GC(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 jo(){return a.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function Fg({result:t}){const r=Pg[t.classification]||Pg.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 Dd({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 So({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 WC({startedAt:t}){const[r,s]=p.useState(0);return p.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 _d={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},Gg={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},of=600,cf=180,sn=40,Od=of-sn*2,rr=cf-sn*2,qC=[25,50,75,100];function Wg(t){return new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function YC(t){return t==null?"--":`${(t/1e3).toFixed(1)}s`}function KC({entries:t,onPointClick:r}){const[s,o]=p.useState(null),c=p.useMemo(()=>[...t].reverse(),[t]);if(c.length<2)return null;const u=c.length,d=c.map((m,y)=>{const v=sn+y/(u-1)*Od,b=m.passRate*100,k=sn+rr-b/100*rr;return{x:v,y:k,pct:b,entry:m}}),h=d.map(m=>`${m.x},${m.y}`).join(" "),g=Array.from(new Set(c.map(m=>m.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(m=>a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:_d[m]??"var(--text-tertiary)"}}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:Gg[m]??m})]},m))}),a.jsxs("svg",{width:of,height:cf,viewBox:`0 0 ${of} ${cf}`,style:{display:"block",overflow:"visible"},children:[qC.map(m=>{const y=sn+rr-m/100*rr;return a.jsxs("g",{children:[a.jsx("line",{x1:sn,y1:y,x2:sn+Od,y2:y,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),a.jsxs("text",{x:sn-8,y:y+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[m,"%"]})]},m)}),a.jsx("line",{x1:sn,y1:sn+rr,x2:sn+Od,y2:sn+rr,stroke:"var(--border-subtle)",strokeWidth:1}),a.jsx("text",{x:sn-8,y:sn+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((m,y)=>a.jsx("circle",{cx:m.x,cy:m.y,r:5,fill:_d[m.entry.type]??"var(--text-tertiary)",stroke:"var(--surface-2)",strokeWidth:2,style:{cursor:"pointer",transition:"r 0.15s ease"},onMouseEnter:v=>{v.currentTarget.setAttribute("r","7"),o({x:m.x,y:m.y,entry:m.entry})},onMouseLeave:v=>{v.currentTarget.setAttribute("r","5"),o(null)},onClick:()=>r==null?void 0:r(m.entry)},y)),XC(u).map(m=>a.jsx("text",{x:d[m].x,y:sn+rr+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:Wg(c[m].timestamp)},m))]}),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:Wg(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:_d[s.entry.type]??"var(--text-tertiary)",color:"#fff"},children:Gg[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:YC(s.entry.totalDurationMs)}),a.jsx("span",{children:s.entry.totalTokens!=null?`${s.entry.totalTokens} tokens`:"--"})]})]})]})}function XC(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 _s=new Map;let on=null,Lo=null,ko=1e3,Tl=0;function Ry(){if(on)return;on=new EventSource("/api/events");const t=r=>s=>{let o={};try{o=s.data?JSON.parse(s.data):{}}catch{}const c=_s.get(r);if(c)for(const u of c)u(o)};on.addEventListener("benchmark:complete",t("benchmark:complete")),on.addEventListener("history:written",t("history:written")),on.addEventListener("leaderboard:updated",t("leaderboard:updated")),on.onerror=()=>{on==null||on.close(),on=null,Tl>0&&(Lo=setTimeout(()=>{ko=Math.min(ko*2,3e4),Ry()},ko))},on.onopen=()=>{ko=1e3}}function QC(){Lo!=null&&(clearTimeout(Lo),Lo=null),on==null||on.close(),on=null}function ZC(t,r){return _s.has(t)||_s.set(t,new Set),_s.get(t).add(r),Tl++,Ry(),()=>{var s;(s=_s.get(t))==null||s.delete(r),Tl--,Tl<=0&&(Tl=0,queueMicrotask(()=>{Tl<=0&&QC()}))}}function Io(t,r){const s=p.useRef(r);s.current=r,p.useEffect(()=>ZC(t,c=>s.current(c)),[t])}function Ho(t){return t>=.8?"var(--green)":t>=.5?"var(--yellow)":"var(--red)"}function JC(t){return t>=1e3?`${(t/1e3).toFixed(1)}s`:`${Math.round(t)}ms`}function eE({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:Ho(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:Ho(t)}})})]})})}function tE({points:t}){if(t.length<2)return null;const r=200,s=48,o=4,c=t.length,u=t.map((g,m)=>{const y=o+m/(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,m)=>`${m===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 nE({plugin:t,skill:r}){const s=`stats/${t}/${r}`,o=p.useCallback(()=>Ce.getStats(t,r),[t,r]),{data:c,loading:u}=ei(s,o),d=p.useCallback(()=>Nn(s),[s]);if(Io("benchmark:complete",d),Io("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,m=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:Ho(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:m>=0?"var(--green)":"var(--red)"},children:[m>=0?"+":"",Math.round(m*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:Tn(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:Tn(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(tE,{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:Ho(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:JC(v.avgDurationMs)}),a.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:v.avgCost!=null?Tn(v.avgCost):"N/A"})]},v.model))})]})]}),y.length>0&&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(eE,{rate:v.passRate,label:v.text})]},`${v.evalId}:${v.id}`))})]})]})}function aE({plugin:t,skill:r}){const[s,o]=p.useState(null),[c,u]=p.useState(null),[d,h]=p.useState({}),[g,m]=p.useState({});p.useEffect(()=>{Ce.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]){m(b=>({...b,[v]:!0}));try{const b=await Ce.getCaseHistory(t,r,v);h(k=>({...k,[v]:b}))}catch{h(b=>({...b,[v]:[]}))}finally{m(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(wy,{entries:b}),w!=null&&a.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:Ll(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:Sy(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:Ll(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:ky(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 rE(){const{state:t,dispatch:r}=Rn(),{plugin:s,skill:o}=t,{state:c}=ea(),u=c.skills.find(O=>O.plugin===s&&O.skill===o),d=(u==null?void 0:u.version)??null,[h,g]=p.useState("timeline"),[m,y]=p.useState(""),[v,b]=p.useState(""),[k,S]=p.useState(!1),[w,C]=p.useState([]),[T,R]=p.useState(null),[M,B]=p.useState(!1),[D,F]=p.useState(null),[E,H]=p.useState(!1),N=`history/${s}/${o}?model=${m}&type=${v}`,_=p.useCallback(()=>Ce.getHistory(s,o,{model:m||void 0,type:v||void 0}),[s,o,m,v]),{data:P,loading:K}=ei(N,_),X=P??[];p.useEffect(()=>{!P||P.length<2||Ce.compareRuns(s,o,P[0].timestamp,P[1].timestamp).then(O=>{const U=O.regressions.filter(se=>se.change==="regression");r({type:"SET_REGRESSIONS",regressions:U})}).catch(()=>{})},[P,s,o,r]);const ee=p.useCallback(()=>Nn(N),[N]);Io("history:written",ee);const $=p.useCallback(async O=>{if(k){C(U=>U.includes(O)?U.filter(se=>se!==O):U.length>=2?[U[1],O]:[...U,O]);return}H(!0);try{const U=await Ce.getHistoryEntry(s,o,O);F(U)}catch{}finally{H(!1)}},[s,o,k]),z=p.useCallback(async()=>{if(w.length===2){B(!0);try{const O=await Ce.compareRuns(s,o,w[0],w[1]);R(O)}catch{}finally{B(!1)}}},[s,o,w]),I=[...new Set(X.map(O=>O.model))];return K?a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),a.jsx("div",{className:"skeleton h-48 rounded-xl mb-4"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"skeleton h-12 rounded-lg"}),a.jsx("div",{className:"skeleton h-12 rounded-lg"})]})]}):a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"flex items-center gap-1 mb-4",children:["timeline","per-eval","statistics"].map(O=>a.jsx("button",{onClick:()=>g(O),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:h===O?"var(--accent-muted)":"transparent",color:h===O?"var(--accent)":"var(--text-tertiary)"},children:O==="timeline"?"Timeline":O==="per-eval"?"Per Eval":"Statistics"},O))}),h==="timeline"&&a.jsxs("div",{children:[X.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(KC,{entries:X,onPointClick:O=>$(O.timestamp)})}),a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("select",{value:m,onChange:O=>y(O.target.value),className:"input-field text-[12px]",style:{width:150},children:[a.jsx("option",{value:"",children:"All Models"}),I.map(O=>a.jsx("option",{value:O,children:O},O))]}),a.jsxs("select",{value:v,onChange:O=>b(O.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:z,disabled:M,className:"btn btn-primary text-[12px]",children:M?"Comparing...":"Compare"})]}),a.jsx("div",{className:"space-y-2",children:X.length===0?a.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):X.map(O=>{const U=w.includes(O.timestamp);return a.jsx("button",{onClick:()=>$(O.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:U?"var(--accent-muted)":"var(--surface-1)",border:U?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:se=>{U||(se.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:se=>{U||(se.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:U?"var(--accent)":"var(--border-default)",background:U?"var(--accent)":"transparent"},children:U&&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(O.timestamp).toLocaleString()}),a.jsx("span",{className:"pill text-[9px]",style:{background:O.type==="comparison"?"var(--purple-muted)":O.type==="baseline"?"var(--surface-3)":O.type==="model-compare"?"var(--accent-muted)":O.type==="improve"||O.type==="instruct"?"var(--purple-muted)":O.type==="ai-generate"?"var(--green-muted)":O.type==="eval-generate"?"var(--orange-muted)":"var(--accent-muted)",color:O.type==="comparison"?"var(--purple)":O.type==="baseline"?"var(--text-tertiary)":O.type==="model-compare"?"var(--accent)":O.type==="improve"||O.type==="instruct"?"var(--purple)":O.type==="ai-generate"?"var(--green)":O.type==="eval-generate"?"var(--orange)":"var(--accent)"},children:O.type==="model-compare"?"model compare":O.type==="improve"?"ai improve":O.type==="instruct"?"ai edit":O.type==="ai-generate"?"ai generate":O.type==="eval-generate"?"eval generate":O.type})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Js,{version:d,size:"sm","data-testid":"history-row-version"}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:O.model}),O.totalCost!=null&&O.totalCost>0&&a.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--text-tertiary)"},children:Tn(O.totalCost)}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:O.passRate>=.8?"var(--green)":O.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(O.passRate*100),"%"]})]})]})},O.timestamp)})}),T&&a.jsx(lE,{result:T}),D&&!k&&a.jsx(sE,{run:D,onClose:()=>F(null)})]}),h==="per-eval"&&a.jsx(aE,{plugin:s,skill:o}),h==="statistics"&&a.jsx(nE,{plugin:s,skill:o})]})}function lE({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: ",Tn(t.runA.totalCost??null)]}),a.jsxs("span",{children:["Run B cost: ",Tn(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: ",Tn(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 sE({run:t,onClose:r}){return(t.type==="improve"||t.type==="instruct")&&t.improve?a.jsx(iE,{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: ${Tn(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:Tn(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 iE({run:t,onClose:r}){var u;const s=p.useMemo(()=>t.improve?Qo(t.improve.original,t.improve.improved):[],[t.improve]),o=p.useMemo(()=>{const d=s.filter(g=>g.type==="added").length,h=s.filter(g=>g.type==="removed").length;return{added:d,removed:h}},[s]),c=p.useMemo(()=>{let d=0,h=0;return s.map(g=>g.type==="removed"?(d++,{...g,origNum:d,newNum:null}):g.type==="added"?(h++,{...g,origNum:null,newNum:h}):(d++,h++,{...g,origNum:d,newNum:h}))},[s]);return 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 Ay({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=Ll(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 oE(){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 cE({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 uE({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 dE({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 fE({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 pE(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 m=r.get(g);m.passRates.push(h.passRate.mean),m.lastRubric=((o=h.rubricScore)==null?void 0:o.mean)??null,m.lastDuration=h.duration.mean,m.lastCost=((c=h.cost)==null?void 0:c.total)??null,m.lastCompositeScore=h.compositeScore,h.baselinePassRate!=null&&(m.lastBaselinePassRate=h.baselinePassRate.mean,m.lastSkillDelta=(u=h.skillDelta)==null?void 0:u.mean,m.lastAmplificationPct=h.amplificationPct,m.hasBaseline=!0)}const s=[];for(const[d,h]of r){const[g,...m]=d.split("/");s.push({rank:0,model:m.join("/"),provider:g,passRate:h.passRates[h.passRates.length-1],rubricScore:h.lastRubric,duration:h.lastDuration,cost:h.lastCost,sparklineData:h.passRates,isBest:!1,baselinePassRate:h.lastBaselinePassRate,skillDelta:h.lastSkillDelta,amplificationPct:h.lastAmplificationPct,compositeScore:h.lastCompositeScore,hasBaseline:h.hasBaseline})}return s.sort((d,h)=>{const g=d.compositeScore??d.passRate;return(h.compositeScore??h.passRate)-g}),s.forEach((d,h)=>{d.rank=h+1}),s.length>0&&(s[0].isBest=!0),s}const My=(t="left")=>({padding:"10px 12px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary)",textAlign:t,whiteSpace:"nowrap"});function mE({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:My(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(oE,{})]})}),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:Ll(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(Ay,{data:r.sparklineData})})]},`${r.provider}/${r.model}`))})]})})}function hE({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:My(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:Ll(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(cE,{pct:s.amplificationPct}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsx(Ay,{data:s.sparklineData})})]},`${s.provider}/${s.model}`))})]})})}function xE(){const{state:t}=Rn(),{plugin:r,skill:s}=t,[o,c]=p.useState("rankings"),u=`leaderboard/${r}/${s}`,d=p.useCallback(()=>Ce.getLeaderboard(r,s),[r,s]),{data:h,loading:g}=ei(u,d),m=(h==null?void 0:h.entries)??[];p.useEffect(()=>{c("rankings")},[r,s]);const y=p.useCallback(()=>Nn(u),[u]);Io("leaderboard:updated",y);const v=p.useMemo(()=>pE(m),[m]),b=v.some(w=>w.hasBaseline),k=m[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(fE,{active:o,onChange:c,hasBaseline:b})]}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[m.length," sweep",m.length!==1?"s":""," · ",v.length," model",v.length!==1?"s":""]})]}),S&&a.jsx(dE,{warning:S}),o==="rankings"?a.jsx(mE,{entries:v}):a.jsx(hE,{entries:v}),o==="amplification"&&(k==null?void 0:k.skillQualityScore)!=null&&(k==null?void 0:k.skillQualityRating)&&a.jsx(uE,{score:k.skillQualityScore,rating:k.skillQualityRating})]})}function gE({plugin:t,skill:r}){const[s,o]=p.useState([]),[c,u]=p.useState([]),[d,h]=p.useState(!0),[g,m]=p.useState(null);p.useEffect(()=>{Ce.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),m(v),setTimeout(()=>m(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 qg({plugin:t,skill:r}){const[s,o]=p.useState([]),[c,u]=p.useState(!0),[d,h]=p.useState(null),[g,m]=p.useState(""),[y,v]=p.useState(!1),[b,k]=p.useState(null),[S,w]=p.useState(""),[C,T]=p.useState(""),[R,M]=p.useState(!1),[B,D]=p.useState(new Set),F=p.useCallback(async()=>{u(!0);try{const[_,P]=await Promise.all([Ce.getCredentials(t,r).catch(()=>({credentials:[]})),Ce.getParams(t,r).catch(()=>({params:[]}))]),K=new Map(P.params.map($=>[$.name,$])),X=new Set,ee=[];for(const $ of _.credentials){X.add($.name);const z=K.get($.name);ee.push({name:$.name,status:$.status==="ready"||$.status==="resolved"?"ready":"missing",source:$.source,maskedValue:z==null?void 0:z.maskedValue})}for(const $ of P.params)X.has($.name)||ee.push({name:$.name,status:$.status,maskedValue:$.maskedValue});o(ee)}finally{u(!1)}},[t,r]);p.useEffect(()=>{F()},[F]);const E=p.useCallback(async _=>{if(B.has(_)){D(P=>{const K=new Set(P);return K.delete(_),K}),o(P=>P.map(K=>K.name===_?{...K,revealedValue:void 0}:K));return}try{const K=(await Ce.getParamsRevealed(t,r,_)).params.find(X=>X.name===_);K&&(o(X=>X.map(ee=>ee.name===_?{...ee,revealedValue:K.value}:ee)),D(X=>new Set(X).add(_)))}catch{}},[t,r,B]),H=async(_,P)=>{if(!(!_.trim()||!P.trim())){v(!0),k(null);try{await Ce.setCredential(t,r,_,P),h(null),m(""),D(new Set),F()}catch(K){k(K.message)}finally{v(!1)}}},N=async()=>{if(!(!S.trim()||!C.trim())){v(!0),k(null);try{await Ce.setCredential(t,r,S.trim().toUpperCase(),C),w(""),T(""),M(!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:()=>M(!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:P=>m(P.target.value),onKeyDown:P=>{P.key==="Enter"&&H(_.name,g)},className:"input-field text-[11px] font-mono",style:{width:160},placeholder:"Value...",autoFocus:!0}),a.jsx("button",{onClick:()=>H(_.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),m("")},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),m("")},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:()=>{M(!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 vE(){const{state:t}=Rn(),{plugin:r,skill:s}=t,[o,c]=p.useState(null),[u,d]=p.useState(!0);return p.useEffect(()=>{Ce.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(gE,{plugin:r,skill:s}),a.jsx(qg,{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(qg,{plugin:r,skill:s})]})}function yE(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 bE(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 uf(t,r=!0){let s=t.toLowerCase().replace(/[^a-z0-9]+/g,"-");return r&&(s=s.replace(/^-+|-+$/g,"")),s}function jE(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 SE({onCreated:t,resolveAiConfigOverride:r,forceLayout:s}){const[o,c]=p.useState("ai"),[u,d]=p.useState(null),[h,g]=p.useState(!0),{config:m}=Ur(),[y,v]=p.useState(""),[b,k]=p.useState(s??3),[S,w]=p.useState(""),[C,T]=p.useState(""),[R,M]=p.useState(""),[B,D]=p.useState(""),[F,E]=p.useState(""),[H,N]=p.useState(""),[_,P]=p.useState("write"),[K,X]=p.useState([]),[ee,$]=p.useState(!1),[z,I]=p.useState(null),[O,U]=p.useState(null),[se,L]=p.useState("vskill"),[q,W]=p.useState("1.0.0"),[te,fe]=p.useState(!0),ie=p.useCallback(async()=>{try{const ye=await Ce.detectEngines();U(ye),L(gt=>gt!=="vskill"?gt:ye.vskillSkillBuilder?"vskill":ye.anthropicSkillCreator?"anthropic-skill-creator":"none")}catch{U({vskillSkillBuilder:!1,anthropicSkillCreator:!1,vskillVersion:null,anthropicPath:null})}},[]);p.useEffect(()=>{ie()},[ie]);const[ve,de]=p.useState(""),[Se,Ae]=p.useState(!1),[_e,re]=p.useState(!1),[he,pe]=p.useState(null),[xe,je]=p.useState(null),[Be,Oe]=p.useState([]),rt=p.useRef(null),Nt=p.useRef(null),ht=p.useRef(null),Dt=p.useRef(null),Tt=p.useRef(null),[Qe,tt]=p.useState(!1),[be,pt]=p.useState(!1),Et=p.useRef(y),Yt=p.useRef(S),un=p.useRef(C);p.useEffect(()=>{Et.current=y},[y]),p.useEffect(()=>{Yt.current=S},[S]),p.useEffect(()=>{un.current=C},[C]),p.useEffect(()=>{Ce.getProjectLayout().then(ye=>{if(d(ye),s)return;k(ye.suggestedLayout);const gt=ye.detectedLayouts.find(Mn=>Mn.layout===ye.suggestedLayout);gt!=null&>.existingPlugins.length&&w(gt.existingPlugins[0])}).catch(()=>{}).finally(()=>g(!1))},[s]),p.useEffect(()=>{var ye;o==="ai"&&((ye=rt.current)==null||ye.focus())},[o]),p.useEffect(()=>()=>{var ye;(ye=Nt.current)==null||ye.abort()},[]);const Gt=p.useMemo(()=>{var ye;return u?((ye=u.detectedLayouts.find(gt=>gt.layout===b))==null?void 0:ye.existingPlugins)||[]:[]},[u,b]),nn=S==="__new__"?C:S,An=u?jE(u.root,b,nn||"{plugin}",y||"{skill}"):"",Mt=p.useMemo(()=>u?u.detectedLayouts.filter(ye=>ye.layout!==4):[],[u]),xt=p.useMemo(()=>{if(!u)return null;const ye=u.detectedLayouts.find(dn=>dn.layout===2&&dn.existingPlugins.length>0),gt=u.detectedLayouts.find(dn=>dn.layout===1&&dn.existingPlugins.length>0),Mn=ye||gt;return Mn?{layout:Mn.layout,plugins:Mn.existingPlugins}:null},[u]),St=p.useCallback(()=>{if(r)return r();if(!m)return{provider:"claude-cli",model:"sonnet"};const ye=m.provider||"claude-cli",gt=m.model||"sonnet";return{provider:ye,model:gt}},[m,r]),ta=p.useCallback(()=>{var ye;(ye=Nt.current)==null||ye.abort(),Ae(!1)},[]),fa=p.useCallback(()=>{pe(null),je(null)},[]),Wn=p.useCallback(async()=>{var dn,ni;if(pe(null),je(null),Oe([]),ht.current=null,Dt.current=null,!ve.trim()){pe("Describe what your skill should do");return}Ae(!0);const ye=new AbortController;Nt.current=ye;const{provider:gt,model:Mn}=St();try{const qn=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(yE({prompt:ve.trim(),provider:gt,model:Mn,targetAgents:K})),signal:ye.signal});if(!qn.ok||!qn.body){let pr=`HTTP ${qn.status}`;try{const mr=await qn.json();mr.error&&(pr=mr.error)}catch{}throw new Error(pr)}const Bl=qn.body.getReader(),fr=new TextDecoder;let Il="",na="";for(;;){const{done:pr,value:mr}=await Bl.read();if(pr)break;Il+=fr.decode(mr,{stream:!0});const Pr=Il.split(`
|
|
86
|
+
`);Il=Pr.pop()||"";for(const Da of Pr)if(Da.startsWith("event: "))na=Da.slice(7).trim();else if(Da.startsWith("data: ")){try{const it=JSON.parse(Da.slice(6));if(na==="progress")Oe(hr=>[...hr,{phase:it.phase,message:it.message,timestamp:Date.now()}]);else if(na==="provenance")Dt.current={resolvedModelId:typeof it.resolvedModelId=="string"?it.resolvedModelId:null,snapshotDate:typeof it.snapshotDate=="string"?it.snapshotDate:null};else if(na==="done"||na==="complete"){const hr={prompt:ve.trim(),provider:St().provider,model:St().model,resolvedModelId:((dn=Dt.current)==null?void 0:dn.resolvedModelId)??null,snapshotDate:((ni=Dt.current)==null?void 0:ni.snapshotDate)??null,reasoning:it.reasoning||""},an=bE({userName:Et.current,userPlugin:Yt.current,userNewPlugin:un.current,aiName:it.name,aiSuggestedPlugin:it.suggestedPlugin&&it.suggestedPlugin.plugin?{plugin:it.suggestedPlugin.plugin,layout:it.suggestedPlugin.layout}:null,forceLayout:s});if(an.applyName!==null&&v(an.applyName),M(it.description),D(it.model||""),E(it.allowedTools||""),N(it.body),re(!0),ht.current=hr,c("manual"),s===3)k(3),w(""),T("");else if(an.applySuggestedPlugin&&an.suggestedPluginValue){const ot=an.suggestedPluginValue;if(((u==null?void 0:u.detectedLayouts.flatMap(aa=>aa.existingPlugins))??[]).includes(ot.plugin))if(w(ot.plugin),ot.layout&&(ot.layout===1||ot.layout===2))k(ot.layout);else{const aa=u==null?void 0:u.detectedLayouts.find(Jo=>Jo.existingPlugins.includes(ot.plugin));aa&&(aa.layout===1||aa.layout===2)&&k(aa.layout)}else w("__new__"),T(ot.plugin)}else!an.applySuggestedPlugin&&Yt.current.trim().length===0&&un.current.trim().length===0&&b===3&&xt&&pt(!0);const Ut={name:it.name,plugin:nn||"",layout:b,description:it.description,model:it.model||void 0,allowedTools:it.allowedTools||void 0,body:it.body,aiMeta:hr};Ce.saveDraft(Ut).then(ot=>{tt(!0),ot!=null&&ot.dir&&(Tt.current=ot.dir)}).catch(()=>{})}else na==="error"&&(pe(it.message||it.description||"Unknown error"),it.category&&je(it))}catch{}na=""}}}catch(qn){qn.name!=="AbortError"&&pe(qn.message)}finally{Ae(!1),Nt.current=null}},[ve,St,b,xt,nn,u,K,s]),oe=p.useCallback(async()=>{if(I(null),!y.trim()){I("Skill name is required");return}if(!R.trim()){I("Description is required");return}if(b!==3&&!nn.trim()){I("Plugin name is required");return}if(!te){I("Version is not valid semver");return}$(!0);try{const ye=await Ce.createSkill({name:uf(y),plugin:nn||"",layout:b,description:R,model:B||void 0,allowedTools:F||void 0,body:H,aiMeta:ht.current||void 0,draftDir:Tt.current||void 0,version:q.trim()||void 0,engine:se});Tt.current=null,t(ye.plugin,ye.skill)}catch(ye){I(ye.message)}finally{$(!1)}},[y,R,b,nn,B,F,H,q,te,se,t]),Ee=p.useCallback(()=>{xt&&(k(xt.layout),w(xt.plugins[0]),pt(!1))},[xt]);return{mode:o,setMode:c,layout:u,layoutLoading:h,selectedLayout:b,setSelectedLayout:k,creatableLayouts:Mt,availablePlugins:Gt,pathPreview:An,plugin:S,setPlugin:w,newPlugin:C,setNewPlugin:T,effectivePlugin:nn,name:y,setName:v,description:R,setDescription:M,model:B,setModel:D,allowedTools:F,setAllowedTools:E,body:H,setBody:N,bodyViewMode:_,setBodyViewMode:P,aiPrompt:ve,setAiPrompt:de,generating:Se,aiGenerated:_e,aiError:he,aiClassifiedError:xe,aiProgress:Be,promptRef:rt,handleGenerate:Wn,handleCancelGenerate:ta,clearAiError:fa,targetAgents:K,setTargetAgents:X,draftSaved:Qe,showPluginRecommendation:be,setShowPluginRecommendation:pt,pluginLayoutInfo:xt,applyPluginRecommendation:Ee,creating:ee,error:z,handleCreate:oe,engineDetection:O,refreshEngineDetection:ie,engine:se,setEngine:L,version:q,setVersion:W,versionValid:te,setVersionValid:fe,standaloneLocked:s===3}}function Ly(){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 kE(){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 zy({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(Ly,{}):a.jsx(kE,{}),a.jsxs("span",{children:[t.name,t.type==="dir"?"/":""]})]}),(s=t.children)==null?void 0:s.map(o=>a.jsx(zy,{node:o,depth:r+1},o.name))]})}function wE(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 CE({skillName:t,hasEvals:r,isDraft:s}){const o=wE(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(Ly,{})}),"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(zy,{node:o})})]})}const lr={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function Bd({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 EE({onCreated:t,onCancel:r}){const s=SE({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(Bd,{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(Bd,{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(ti,{entries:s.aiProgress,isRunning:!0}),s.aiError&&a.jsx("div",{children:s.aiClassifiedError?a.jsx(Zo,{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(Bd,{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(uf(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(uf(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:Xo(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(CE,{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 NE(){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 zo({variant:t,message:r,onRetry:s}){const{setMode:o,setSearch:c}=ea(),[u,d]=p.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(NE,{}):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 TE(t,r){const[s,o]=t.split(".").map(Number),[c,u]=r.split(".").map(Number);return c>s?"major":u>o?"minor":"patch"}const RE={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 AE(){const[t,r]=p.useState([]),[s,o]=p.useState(!0),[c,u]=p.useState(new Set),[d,h]=p.useState(new Map),[g,m]=p.useState(!1),[y,v]=p.useState(new Set),[b,k]=p.useState(null),[S,w]=p.useState(null),[C,T]=p.useState(!1),R=p.useCallback(async()=>{o(!0);try{const N=await Ce.getSkillUpdates();r(N.filter(_=>_.updateAvailable))}catch{r([])}finally{o(!1)}},[]);p.useEffect(()=>{R()},[R]);const M=p.useMemo(()=>t.filter(N=>!N.pinned),[t]),B=p.useCallback(N=>{u(_=>{const P=new Set(_);return P.has(N)?P.delete(N):P.add(N),P})},[]),D=p.useCallback(()=>{c.size===M.length?u(new Set):u(new Set(M.map(N=>N.name)))},[c,M]),F=p.useCallback(()=>{const N=[...c];if(!N.length)return;m(!0),h(new Map(N.map(P=>[P,{skill:P,status:"pending"}])));const _=Ce.startBatchUpdate(N);_.addEventListener("progress",P=>{try{const K=JSON.parse(P.data);h(X=>new Map(X).set(K.skill,K))}catch{}}),_.addEventListener("done",P=>{_.close(),m(!1);try{const K=JSON.parse(P.data);k(`Updated ${K.updated??0} skills, ${K.failed??0} failed`),setTimeout(()=>k(null),5e3)}catch{}R()}),_.addEventListener("error",()=>{_.close(),m(!1),k("Batch update failed"),setTimeout(()=>k(null),5e3)})},[c,R]),E=p.useCallback(N=>{N.name.split("/").pop()||N.name;const _=N.name.split("/"),P=_.length>=3?_[_.length-2]:_[0],K=_[_.length-1];v(ee=>new Set(ee).add(N.name));const X=Ce.startSkillUpdate(P,K);X.addEventListener("done",()=>{X.close(),v(ee=>{const $=new Set(ee);return $.delete(N.name),$}),R()}),X.addEventListener("error",()=>{X.close(),v(ee=>{const $=new Set(ee);return $.delete(N.name),$})})},[R]),H=p.useCallback(async N=>{if(!N.latest)return;const _=N.name.split("/"),P=_.length>=3?_[_.length-2]:_[0],K=_[_.length-1];T(!0);try{const X=await Ce.getVersionDiff(P,K,N.installed,N.latest);w({skill:N,diff:X})}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 (",M.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:D,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===M.length&&M.length>0?"var(--accent)":"var(--border-default)",background:c.size===M.length&&M.length>0?"var(--accent)":"transparent"},children:c.size===M.length&&M.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,P=N.latest?TE(N.installed,N.latest):"patch",K=RE[P],X=!!N.pinned,ee=y.has(N.name),$=d.get(N.name),z=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:X?.7:1},children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:()=>!X&&B(N.name),disabled:X,className:"flex-shrink-0",style:{background:"transparent",border:"none",cursor:X?"not-allowed":"pointer"},children:a.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:z?"var(--accent)":"var(--border-default)",background:z?"var(--accent)":"transparent",opacity:X?.4:1},children:z&&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:_}),X&&a.jsx("span",{className:"text-[10px]",title:"Pinned — unpin from CLI to update",children:"📌"}),a.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:K.bg,color:K.text},children:P})]}),a.jsxs("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[N.installed," → ",N.latest||"?",X&&` (pinned at ${N.pinnedVersion||N.installed})`]})]}),$&&a.jsxs("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:$.status==="done"?"var(--green-muted)":$.status==="error"?"var(--red-muted)":"var(--yellow-muted)",color:$.status==="done"?"var(--green)":$.status==="error"?"var(--red)":"var(--yellow)"},children:[$.status,$.error&&`: ${$.error}`]}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[a.jsx("button",{onClick:()=>H(N),className:"btn btn-ghost text-[11px]",disabled:C,children:"View Changes"}),a.jsx("button",{onClick:()=>E(N),disabled:X||ee||g,title:X?"Pinned — unpin from CLI to update":"",className:`btn ${X?"btn-ghost":"btn-primary"} text-[11px]`,children:ee?a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"spinner spinner-sm"})," Updating"]}):($==null?void 0:$.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(zf,{contentDiff:S.diff.contentDiff,fromLabel:S.diff.from,toLabel:S.diff.to,diffSummary:S.diff.diffSummary,renderContext:"inline"})]})})]})}function ME(t){return t==null?"var(--text-tertiary)":t>=.7?"var(--green)":t>=.4?"var(--yellow)":"var(--red)"}function LE(t){return t==null?"var(--surface-3)":t>=.7?"var(--green-muted)":t>=.4?"var(--yellow-muted)":"var(--red-muted)"}function zE(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 Dy(t){const{author:r,repoUrl:s}=t,o=zE(s??null),c=r&&r.trim()!==""?r:o??"—",[u,d]=p.useState(!1),h=p.useCallback(async()=>{var g;try{await((g=navigator.clipboard)==null?void 0:g.writeText(c)),d(!0),setTimeout(()=>d(!1),1500)}catch{}},[c]);return o?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 DE(t){let r=t.split("#")[0].split("?")[0].replace(/\/+$/,"");return r=r.replace(/\/(?:tree|blob)\/[^/]+(?:\/.*)?$/,""),r}function _E(t,r){const s=DE(t),o=(r??"").replace(/^\/+/,"").replace(/\/+$/,"");return o?`${s}/blob/HEAD/${o}`:`${s}/blob/HEAD/`}function Yg(t){if(!t)return"source";const r=t.replace(/\/+$/,""),s=r.lastIndexOf("/");return s===-1?r:r.slice(s+1)}function _y(t){const{repoUrl:r,skillPath:s,absolutePath:o}=t,[c,u]=p.useState(!1),d=typeof r=="string"&&r.trim()!==""&&/^https?:\/\//.test(r.trim()),h=s?Yg(s):o?Yg(o):"source",g=p.useCallback(async()=>{var v;const y=o??s??"";if(y)try{await((v=navigator.clipboard)==null?void 0:v.writeText(y)),u(!0),setTimeout(()=>u(!1),1500)}catch{}},[o,s]);if(d){const y=_E(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 m=o??s??"";return a.jsxs("button",{type:"button","data-testid":t["data-testid"]??"source-file-copy",title:`Copy ${m}`,onClick:g,style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 6px",border:"1px solid var(--border-default, var(--border))",borderRadius:4,background:"transparent",fontFamily:"var(--font-mono, var(--font-geist-mono))",fontSize:12,color:"var(--text-secondary)",cursor:"pointer",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[a.jsx("span",{children:h}),a.jsx("span",{"aria-hidden":"true",style:{fontSize:10,opacity:.7},children:c?"✓":"⧉"})]})}function Kg(t,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:t,severity:r}}))}function Oy(t){return t.skill?BE({skill:t.skill}):HE({state:t.state,isReadOnly:t.isReadOnly,onDelete:t.onDelete})}function OE(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 BE({skill:t}){const[r,s]=p.useState(!1),o=p.useCallback(async()=>{var d;try{await((d=navigator.clipboard)==null?void 0:d.writeText(t.dir)),s(!0),setTimeout(()=>s(!1),1500),Kg(ne.toasts.pathCopied,"info")}catch{Kg(ne.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(Js,{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(Dy,{author:t.author??null,repoUrl:t.repoUrl??t.homepage??null}),a.jsx(_y,{repoUrl:t.repoUrl??t.homepage??null,skillPath:t.skillPath??null,absolutePath:t.dir})]}),a.jsx(IE,{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:OE(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 IE({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 HE({state:t,isReadOnly:r,onDelete:s}){const{plugin:o,skill:c,evals:u,latestBenchmark:d,isDirty:h,caseRunStates:g,regressions:m,iterationCount:y}=t,v=Array.from(g.values()).some(T=>T.status==="running"||T.status==="queued"),b=d==null?void 0:d.overall_pass_rate,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=ME(b),C=LE(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(UE,{}),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,{})}),m.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"})]}),m.length," regression",m.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 UE(){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,m=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:[m?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:m}):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 VE="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 PE(t){const{onNavigate:r}=t,[s,o]=p.useState(t.open??!1),c=p.useCallback(()=>o(!1),[]);p.useEffect(()=>{if(!s)return;const d=h=>{h.key==="Escape"&&c()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[s,c]);const u=p.useCallback(d=>{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:VE}),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:Id,children:"Tests →"}),a.jsx("button",{type:"button","data-testid":"benchmark-info-link-run",onClick:()=>u("run"),style:Id,children:"Run →"}),a.jsx("button",{type:"button","data-testid":"benchmark-info-close",onClick:c,style:{...Id,marginLeft:"auto",color:"var(--text-secondary)"},children:"Close"})]})]})]})}const Id={background:"transparent",border:"none",padding:0,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-accent, var(--text-primary))",cursor:"pointer",textDecoration:"underline"};function FE(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 zs(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 GE(t){switch(t.benchmarkStatus){case"pass":case"fail":case"stale":return t.benchmarkStatus==="pass"?"100%":t.benchmarkStatus==="fail"?"0%":"—";default:return"—"}}function WE(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 qE(t){var y,v;const{skill:r,onNavigate:s,activationsCount:o=0,lastRunIso:c=null,repoUrl:u,skillPathInRepo:d}=t,h=u??(YE(r.homepage)?r.homepage??null:null),g=((y=r.mcpDeps)==null?void 0:y.length)??0,m=((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(Js,{version:r.version??null}),WE(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(Dy,{author:r.author??null,repoUrl:h}),r.category?a.jsxs("span",{children:["· ",r.category]}):null,a.jsx(_y,{repoUrl:h,skillPath:d??null,absolutePath:r.dir}),r.lastModified?a.jsxs("span",{title:r.lastModified,children:["· Updated ",zs(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:GE(r),subtitle:r.lastBenchmark?zs(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(PE,{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: ${zs(c)}`:"Never","data-testid":"metric-activations",onClick:s?()=>s("activation"):void 0}),a.jsx(sr,{title:"Last run",value:zs(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:m,subtitle:m>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:FE(r.sizeBytes),"data-testid":"metric-size"}),a.jsx(sr,{title:"Last modified",value:zs(r.lastModified),subtitle:r.lastModified??void 0,"data-testid":"metric-last-modified"})]})]})}function YE(t){return t?/^https?:\/\/(?:www\.)?(?:github\.com|raw\.githubusercontent\.com)\//.test(t):!1}const Xg=p.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 KE({toast:t,onDismiss:r}){const[s,o]=p.useState(!0),c=p.useRef(null);p.useEffect(()=>(c.current=requestAnimationFrame(()=>{c.current=requestAnimationFrame(()=>o(!1))}),()=>{c.current!=null&&cancelAnimationFrame(c.current)}),[]);const u={success:"var(--status-installed)",info:"var(--text-secondary)",error:"var(--color-accent, var(--accent-surface))"};return 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 XE({toasts:t,onDismiss:r,liveMessage:s,liveAssertiveMessage:o}){return a.jsxs(a.Fragment,{children:[a.jsx(Xg,{politeness:"polite",message:s}),a.jsx(Xg,{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(KE,{toast:c,onDismiss:r})},c.id))})]})}const By=p.createContext(null);function Df(){const t=p.useContext(By);if(!t)throw new Error("useToast must be used inside <ToastProvider>.");return t}function QE({children:t,maxVisible:r=4,defaultDurationMs:s=4e3}){const[o,c]=p.useState([]),[u,d]=p.useState(""),[h,g]=p.useState(""),m=p.useRef(new Map),y=p.useCallback(C=>{const T=m.current.get(C);T&&(clearTimeout(T),m.current.delete(C)),c(R=>R.filter(M=>M.id!==C))},[]),v=p.useCallback((C,T)=>{if(T<=0)return;const R=setTimeout(()=>{y(C)},T);m.current.set(C,R)},[y]),b=p.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(M=>[...M,R]),R.severity==="error"?g(R.message):d(R.message),v(T,R.durationMs),T},[s,v]),k=p.useCallback(()=>{for(const C of m.current.values())clearTimeout(C);m.current.clear(),c([])},[]);p.useEffect(()=>{function C(T){T.key==="Escape"&&c(R=>{if(R.length===0)return R;const M=R.slice(0,r),B=M[M.length-1],D=m.current.get(B.id);return D&&(clearTimeout(D),m.current.delete(B.id)),R.filter(F=>F.id!==B.id)})}return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[r]),p.useEffect(()=>()=>{for(const C of m.current.values())clearTimeout(C);m.current.clear()},[]);const S=o.slice(0,r),w=p.useMemo(()=>({toast:b,dismiss:y,clear:k}),[b,y,k]);return a.jsxs(By.Provider,{value:w,children:[t,a.jsx(XE,{toasts:S,onDismiss:y,liveMessage:u,liveAssertiveMessage:h})]})}function ZE({skill:t}){const{refreshUpdates:r,dismissPushUpdate:s}=ea(),{toast:o}=Df(),[c,u]=p.useState("idle"),[d,h]=p.useState(null),[g,m]=p.useState(!1),[y,v]=p.useState(null),[b,k]=p.useState(!1),S=p.useRef(null),w=p.useCallback(async()=>{if(!t||c==="updating")return;const M=new AbortController;S.current=M,u("updating"),h(null);try{const B=await Ce.postSkillUpdate(t.plugin,t.skill,M.signal);if(B.ok)u("done"),r(),s(`${t.plugin}/${t.skill}`),o({message:`Updated ${t.skill}.`,severity:"success",durationMs:4e3});else{const D=`Update failed (HTTP ${B.status}): ${B.body}`;u("idle"),h(D),o({message:`Couldn't update ${t.skill} — HTTP ${B.status}`,severity:"error",durationMs:0,action:{label:"Retry",onInvoke:()=>{w()}}})}}catch(B){if(B instanceof DOMException&&B.name==="AbortError")return;const D=B instanceof Error?B.message:"Network error";u("idle"),h(D),o({message:`Couldn't update ${t.skill} — ${D}`,severity:"error",durationMs:0,action:{label:"Retry",onInvoke:()=>{w()}}})}finally{S.current===M&&(S.current=null)}},[t,c,r,s,o]);if(p.useEffect(()=>{if(!g||y!=null||!t||!t.latestVersion)return;let M=!1;return k(!0),Ce.getVersionDiff(t.plugin,t.skill,t.currentVersion??"",t.latestVersion).then(B=>{M||v(B)}).catch(()=>{M||v(null)}).finally(()=>{M||k(!1)}),()=>{M=!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]),p.useEffect(()=>()=>{var M;(M=S.current)==null||M.abort()},[]),!t||t.updateAvailable!==!0)return null;const C=t.latestVersion,T=c==="updating"?"Updating…":C?`Update to ${C}`:"Update",R=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:()=>{w()},disabled:R,style:{height:36,padding:"0 14px",background:"var(--color-ink)",color:"var(--color-paper)",border:"none",borderRadius:4,cursor:R?"not-allowed":"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500},children:T}),a.jsx("button",{type:"button","data-testid":"update-action-toggle-changelog",onClick:()=>m(M=>!M),disabled:R||!C,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"})]}),c==="updating"&&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:"Updating…"}),d&&c!=="updating"&&a.jsx("div",{"data-testid":"update-action-error",role:"alert",style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--color-error, #d32f2f)"},children:d}),g&&C&&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(zf,{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 JE=3e4;function eN({plugin:t,skill:r,trackedForUpdates:s=!0,discoveryBackedOff:o=!1}){const c=ea(),[u,d]=p.useState(!1),[h,g]=p.useState(!1),[,m]=p.useState(0),y=p.useRef(null),v=p.useRef(null),b=`${t}/${r}`,k=c.updatesById.get(b);if(p.useEffect(()=>{if(!u)return;const w=setInterval(()=>m(C=>(C+1)%1e6),250);return()=>clearInterval(w)},[u]),p.useEffect(()=>{if(!u||!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]),p.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},JE);try{await Ce.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 Iy=["overview","editor","tests","run","activation","history","leaderboard","deps","versions"],tN={overview:"Overview",editor:"Editor",tests:"Tests",run:"Run",activation:"Activation",history:"History",leaderboard:"Leaderboard",deps:"Deps",versions:"Versions"};function nN(t){return typeof t=="string"&&Iy.includes(t)}function aN(){if(typeof window>"u")return"overview";const r=new URLSearchParams(window.location.search).get("panel");return nN(r)?r:"overview"}function Hd(){const{state:t,setMobileView:r}=ea();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 rN(t={}){if(t.selectedSkillInfo!==void 0||t.loadError!==void 0)return lN(t);const{state:r,selectSkill:s,setMode:o,refreshSkills:c}=ea(),[u,d]=p.useState(typeof window<"u"?window.location.hash:"");if(p.useEffect(()=>{const m=()=>d(window.location.hash);return window.addEventListener("hashchange",m),()=>window.removeEventListener("hashchange",m)},[]),u==="#/updates")return a.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[a.jsx(Hd,{}),a.jsx(AE,{})]});if(r.mode==="create")return a.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[a.jsx(Hd,{}),a.jsx(EE,{onCreated:(m,y)=>{o("browse"),c(),s({plugin:m,skill:y,origin:"source"})},onCancel:()=>o("browse")})]});if(!r.selectedSkill)return r.skillsError?a.jsx(zo,{variant:"error",message:r.skillsError,onRetry:c}):!r.skillsLoading&&r.skills.length===0?a.jsx(zo,{variant:"no-skills"}):a.jsx(zo,{variant:"no-selection"});const h=r.selectedSkill,g=r.skills.find(m=>m.plugin===h.plugin&&m.skill===h.skill)??null;return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsx(Hd,{}),a.jsx(sN,{skillInfo:g,allSkills:r.skills,onSelectSkill:m=>s(m)})]})}function lN(t){const r=t.selectedSkillInfo??null,s=t.activeDetailTab??"overview";if(r==null)return oN();if(t.loadError)return cN(r,t.loadError);const o=t.allSkills&&t.onSelectSkill?{allSkills:t.allSkills,onSelectSkill:t.onSelectSkill}:void 0;return Hy(r,s,t.onDetailTabChange,o)}function sN({skillInfo:t,allSkills:r,onSelectSkill:s}){const[o,c]=p.useState(aN());p.useEffect(()=>{if(typeof window>"u")return;const d=new URLSearchParams(window.location.search);o==="overview"?d.delete("panel"):d.set("panel",o);const h=d.toString(),g=`${window.location.pathname}${h?"?"+h:""}${window.location.hash}`;window.history.replaceState(null,"",g)},[o]);const u=p.useMemo(()=>t?Hy(t,o,c,{}):a.jsx(zo,{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 iN(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:Iy.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:tN[s]},s)})})}function oN(){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 cN(t,r){return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:24,background:"var(--bg-canvas)",height:"100%"},children:[Oy({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 uN({active:t}){return t==="editor"?a.jsx(gC,{}):t==="tests"?a.jsx(wC,{}):t==="run"?a.jsx(IC,{}):t==="activation"?a.jsx(VC,{}):t==="history"?a.jsx(rE,{}):t==="leaderboard"?a.jsx(xE,{}):t==="deps"?a.jsx(vE,{}):t==="versions"?a.jsx(Ww,{}):null}function dN({active:t}){const{state:r,dispatch:s}=Rn();return p.useEffect(()=>{t!=="overview"&&r.activePanel!==t&&s({type:"SET_PANEL",panel:t})},[t,r.activePanel,s]),null}function Hy(t,r,s,o){const c=h=>{s==null||s(h)},u=a.jsx(qE,{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(dN,{active:r}),a.jsx(uN,{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:Oy({skill:t})}),a.jsx(ZE,{skill:t}),t.origin==="installed"&&a.jsx("div",{style:{padding:"8px 16px",borderBottom:"1px solid var(--border-default)"},children:a.jsx(eN,{plugin:t.plugin,skill:t.skill,trackedForUpdates:t.trackedForUpdates})}),iN(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 fN(){const{updateCount:t,state:r,dismissUpdateNotification:s}=ea(),o=t>0&&!r.updateNotificationDismissed;return p.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 pN=[{name:ne.shortcuts.groupNavigation,items:[{keys:"/",label:ne.shortcuts.search},{keys:"j",label:ne.shortcuts.moveDown},{keys:"k",label:ne.shortcuts.moveUp},{keys:"Enter",label:ne.shortcuts.openSelected},{keys:"Esc",label:"Close / clear"}]},{name:ne.shortcuts.groupActions,items:[{keys:"⌘K",label:ne.shortcuts.openPalette},{keys:"?",label:ne.shortcuts.openShortcuts},{keys:"⌘B",label:ne.shortcuts.toggleSidebar},{keys:"E",label:ne.actions.edit}]},{name:ne.shortcuts.groupTheme,items:[{keys:"⌘⇧D",label:ne.shortcuts.toggleTheme}]}];function mN({open:t,onClose:r,groups:s=pN,title:o=ne.shortcuts.title}){const c=p.useRef(null),u=p.useRef(null);return p.useEffect(()=>{var d;if(t)return c.current=document.activeElement??null,(d=u.current)==null||d.focus(),()=>{var h,g;(g=(h=c.current)==null?void 0:h.focus)==null||g.call(h),c.current=null}},[t]),p.useEffect(()=>{if(!t)return;function d(h){var g;if(h.key==="Escape"){h.preventDefault(),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 hN(t){const r=ne.actions,s=[{action:"open",label:r.open},{action:"copy-path",label:r.copyPath},{action:"reveal",label:r.revealInEditor},{action:"run-benchmark",label:r.runBenchmark}];if(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 xN({state:t,onClose:r,onAction:s,itemsOverride:o}){const c=p.useRef(null),u=p.useRef(null),[d,h]=p.useState(0),g=p.useMemo(()=>t.skill?o??hN(t.skill):[],[t.skill,o]),m=p.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]);p.useEffect(()=>{if(t.open)return u.current=document.activeElement??null,h(0),requestAnimationFrame(()=>{var v;(v=c.current)==null||v.focus()}),()=>{var v,b;(b=(v=u.current)==null?void 0:v.focus)==null||b.call(v),u.current=null}},[t.open]);const y=p.useCallback(()=>{if(!t.skill)return;const v=g[d];!v||v.disabled||(s(v.action,t.skill),r())},[g,d,t.skill,s,r]);return p.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:m.left,top:m.top,zIndex:70,minWidth:200,padding:4,background:"var(--bg-canvas)",border:"1px solid var(--border-default)",borderRadius:6,boxShadow:"0 12px 32px rgba(0,0,0,0.16)",fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)",outline:"none"},children:g.map((v,b)=>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 gN({open:t,title:r,body:s,confirmLabel:o="Confirm",cancelLabel:c="Cancel",variant:u="default",onConfirm:d,onCancel:h}){const g=p.useRef(null),m=p.useRef(null),y=p.useRef(null);if(p.useEffect(()=>{if(t)return y.current=document.activeElement??null,requestAnimationFrame(()=>{var S;(S=m.current)==null||S.focus()}),()=>{var S,w;(w=(S=y.current)==null?void 0:S.focus)==null||w.call(S),y.current=null}},[t]),p.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:m,type:"button","data-testid":"confirm-dialog-cancel",onClick:h,style:{padding:"6px 14px",borderRadius:6,cursor:"pointer",background:"transparent",color:"var(--text-primary)",border:"1px solid var(--border-default)",fontSize:13},children:c}),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 vN(t){const r=(typeof navigator<"u"?navigator.platform:"").toLowerCase();return r.includes("mac")?"system Trash":r.includes("win")?"Recycle Bin":"Trash"}const Qg=t=>`${t.plugin}/${t.skill}`;function yN(t){const r=t==null?void 0:t.delayMs,s=t==null?void 0:t.onCommit,o=t==null?void 0:t.onFailure,c=p.useRef(s),u=p.useRef(o);c.current=s,u.current=o;const d=p.useRef(new Map),[,h]=p.useState(0),g=p.useCallback(()=>h(S=>S+1),[]),m=p.useCallback(async S=>{var w,C;try{await Ce.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(Qg(S.skill)),g()}},[g]),y=p.useCallback(S=>{const w=Qg(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,m(T)},r),d.current.set(w,T),g()},[r,m,g]),v=p.useCallback(S=>{const w=d.current.get(S);w&&(w.timeoutId&&clearTimeout(w.timeoutId),d.current.delete(S),g())},[g]),b=p.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=>m(w)))},[m]),k=p.useCallback(S=>d.current.has(S),[]);return p.useEffect(()=>{const S=()=>{b()};return window.addEventListener("beforeunload",S),()=>{window.removeEventListener("beforeunload",S)}},[b]),p.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 bN={"anthropic-api":{name:ne.setupProviders.anthropic.name,description:ne.setupProviders.anthropic.description,envVars:ne.setupProviders.anthropic.envVars,keyUrl:ne.setupProviders.anthropic.keyUrl,learnMoreUrl:ne.setupProviders.anthropic.learnMoreUrl},openai:{name:ne.setupProviders.openai.name,description:ne.setupProviders.openai.description,envVars:ne.setupProviders.openai.envVars,keyUrl:ne.setupProviders.openai.keyUrl,learnMoreUrl:ne.setupProviders.openai.learnMoreUrl},openrouter:{name:ne.setupProviders.openrouter.name,description:ne.setupProviders.openrouter.description,envVars:ne.setupProviders.openrouter.envVars,keyUrl:ne.setupProviders.openrouter.keyUrl,learnMoreUrl:ne.setupProviders.openrouter.learnMoreUrl},gemini:{name:ne.setupProviders.gemini.name,description:ne.setupProviders.gemini.description,envVars:ne.setupProviders.gemini.envVars,keyUrl:ne.setupProviders.gemini.keyUrl,learnMoreUrl:ne.setupProviders.gemini.learnMoreUrl},ollama:{name:ne.setupProviders.ollama.name,description:ne.setupProviders.ollama.description,envVars:ne.setupProviders.ollama.envVars,install:[ne.setupProviders.ollama.installCmd],start:[ne.setupProviders.ollama.startCmd],pullExample:ne.setupProviders.ollama.pullExample,learnMoreUrl:ne.setupProviders.ollama.learnMoreUrl},"lm-studio":{name:ne.setupProviders.lmStudio.name,description:ne.setupProviders.lmStudio.description,envVars:ne.setupProviders.lmStudio.envVars,install:[ne.setupProviders.lmStudio.installCmd],start:[ne.setupProviders.lmStudio.startCmd],pullExample:ne.setupProviders.lmStudio.pullExample,learnMoreUrl:ne.setupProviders.lmStudio.learnMoreUrl},"claude-code":{name:ne.setupProviders.claudeCode.name,description:ne.setupProviders.claudeCode.description,envVars:[],notes:[ne.setupProviders.claudeCode.loginHint,ne.claudeCodeLabel.compactLabel],learnMoreUrl:ne.setupProviders.claudeCode.learnMoreUrl}};function jN(t){return t?bN[t]??null:null}function SN({open:t,providerKey:r,onClose:s}){const o=p.useRef(null);if(p.useEffect(()=>{if(!t)return;const d=h=>{h.key==="Escape"&&(h.preventDefault(),s())};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,s]),p.useEffect(()=>{if(!t)return;const d=o.current;if(!d)return;const h=d.querySelector("button, a[href], [tabindex]:not([tabindex='-1']), input, textarea, select");h==null||h.focus()},[t]),!t||typeof document>"u")return null;const c=jN(r),u=(c==null?void 0:c.name)??ne.setupDrawer.fallbackTitle;return Po.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("div",{"data-testid":"setup-drawer-backdrop","aria-hidden":"true",onClick:s,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:99,animation:"vskillDrawerBackdropIn 120ms ease"}}),a.jsxs("div",{"data-testid":"setup-drawer",ref:o,role:"dialog","aria-modal":"true","aria-label":ne.setupDrawer.title(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(kN,{title:u,onClose:s}),a.jsx("div",{"data-testid":"setup-drawer-body",style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:c?a.jsx(wN,{content:c}):a.jsx(CN,{})}),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 kN({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:ne.setupDrawer.title(t)}),a.jsx("button",{type:"button","data-testid":"setup-drawer-close",onClick:r,"aria-label":ne.setupDrawer.close,style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:18,padding:4,lineHeight:1},children:"×"})]})}function wN({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:ne.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(EN,{name:o})},o))})]}),t.keyUrl&&a.jsx(NN,{href:t.keyUrl,label:ne.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:ne.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(Ud,{code:o},`install-${c}`)),(s=t.start)==null?void 0:s.map((o,c)=>a.jsx(Ud,{code:o},`start-${c}`)),t.pullExample&&a.jsx(Ud,{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:[ne.setupDrawer.learnMore," →"]})})]})}function CN(){return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[a.jsx("h3",{style:{margin:0,fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:ne.setupDrawer.fallbackTitle}),a.jsx("p",{style:{margin:0,fontSize:13,color:"var(--text-secondary)",lineHeight:1.5},children:ne.setupDrawer.fallbackBody})]})}function EN({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:ne.setupDrawer.copy})]})}function Ud({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 NN({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 TN(){const[t,r]=p.useState(!1),[s,o]=p.useState(null),c=p.useRef(null),u=p.useCallback((h,g)=>{var m;c.current=typeof document<"u"?document.activeElement:null,(m=g==null?void 0:g.beforeOpen)==null||m.call(g),o(h),r(!0)},[]),d=p.useCallback(()=>{r(!1);const h=c.current;h&&"focus"in h&&typeof h.focus=="function"&&queueMicrotask(()=>h.focus())},[]);return p.useMemo(()=>({open:u,close:d,isOpen:t,providerKey:s}),[u,d,t,s])}function RN(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 AN({agents:t,activeAgentId:r,focusedAgentId:s,onFocusAgent:o,onSwitch:c,onOpenSetup:u,onClose:d}){const h=p.useRef(null);p.useEffect(()=>{const y=v=>{v.key==="Escape"&&(v.preventDefault(),d())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[d]),p.useEffect(()=>{const y=b=>{h.current&&!h.current.contains(b.target)&&d()},v=setTimeout(()=>{document.addEventListener("mousedown",y)},0);return()=>{clearTimeout(v),document.removeEventListener("mousedown",y)}},[d]);const g=p.useMemo(()=>RN(t),[t]),m=t.find(y=>y.id===s)??t.find(y=>y.id===r)??t[0];return typeof document>"u"?null:Po.createPortal(a.jsxs("div",{ref:h,"data-testid":"agent-scope-picker-popover",role:"dialog","aria-label":ne.scopePicker.popoverTitle,style:{position:"fixed",top:96,left:"50%",transform:"translateX(-50%)",width:600,maxWidth:"calc(100vw - 32px)",background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,boxShadow:"0 18px 40px rgba(0,0,0,0.25)",overflow:"hidden",zIndex:90,animation:"scopePickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[a.jsxs("div",{style:{display:"flex",height:360,maxHeight:"60vh"},children:[a.jsxs("section",{"data-testid":"agent-scope-picker-agents",style:{width:260,borderRight:"1px solid var(--border-default, var(--border-subtle))",overflowY:"auto",padding:"6px 0"},children:[g.detected.length===0&&g.notDetected.length===0&&a.jsx(Zg,{}),g.detected.map(y=>y.kind==="aggregate"?a.jsx(LN,{row:y,onFocus:()=>{var v;return o(((v=y.consumers[0])==null?void 0:v.id)??r??"")}},y.key):a.jsx(MN,{agent:y.agent,focused:y.agent.id===s,active:y.agent.id===r,onClick:()=>o(y.agent.id)},y.key)),g.notDetected.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{"data-testid":"agent-scope-not-detected-subheading",title:"These agents were not found on this machine. Hover a row to see which folder detection looked for.",style:{padding:"10px 14px 4px",fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-tertiary)"},children:ne.scopePicker.notDetectedSubheading}),g.notDetected.map(y=>a.jsx(zN,{agent:y.agent},y.key))]})]}),a.jsx("section",{"data-testid":"agent-scope-picker-stats",style:{flex:1,overflowY:"auto",padding:"14px 16px"},children:m?a.jsx(DN,{agent:m,activeAgentId:r,onSwitch:()=>c(m.id)}):a.jsx(Zg,{})})]}),a.jsx("style",{children:`@keyframes scopePickerFadeIn {
|
|
99
|
+
from { opacity: 0; transform: translateX(-50%) translateY(2px); }
|
|
100
|
+
to { opacity: 1; transform: translateX(-50%) translateY(0); }
|
|
101
|
+
}`})]}),document.body)}function MN({agent: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 LN({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 zN({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 DN({agent:t,activeAgentId:r,onSwitch:s}){const o=t.id===r,c=t.isRemoteOnly===!0,u=o||c,d=o?"Active":c?"Remote-only":ne.scopePicker.switchCta;return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:t.displayName}),a.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:2},children:c?"Remote service — no local install":ON(t.health)})]}),a.jsxs("dl",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"4px 12px",margin:0,fontSize:12},children:[a.jsx($d,{label:ne.scopePicker.statsInstalled,value:String(t.installedCount)}),a.jsx($d,{label:ne.scopePicker.statsGlobal,value:String(t.globalCount)}),a.jsx($d,{label:ne.scopePicker.statsLastSync,value:t.lastSync?_N(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 $d({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 Zg(){return a.jsx("div",{style:{padding:"16px 18px",fontSize:12,color:"var(--text-secondary)"},children:"No agents detected yet."})}function _N(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 ON(t){switch(t){case"ok":return ne.scopePicker.statsHealthOk;case"stale":return ne.scopePicker.statsHealthStale;case"missing":return ne.scopePicker.statsHealthMissing}}function BN(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 IN({agents:t,activeAgentId:r,onActiveAgentChange:s,onOpenSetup:o}){const[c,u]=p.useState(!1),[d,h]=p.useState(null),g=p.useRef(null),m=p.useMemo(()=>t.find(k=>k.id===r)??t[0]??null,[t,r]),y=p.useMemo(()=>m?m.health==="ok"?"var(--color-ok, #22c55e)":m.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)":"var(--text-tertiary)",[m]),v=p.useCallback(()=>{var k;u(!1),(k=g.current)==null||k.focus()},[]),b=p.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:(m==null?void 0:m.displayName)??"Select agent"}),a.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:["(",(m==null?void 0:m.installedCount)??0," · ",(m==null?void 0:m.globalCount)??0,")"]}),a.jsx("span",{"aria-hidden":"true",style:{fontSize:10,color:"var(--text-secondary)"},children:"▾"})]}),c&&a.jsx(AN,{agents:t,activeAgentId:r,focusedAgentId:d??r,onFocusAgent:h,onSwitch:b,onOpenSetup:k=>{o(k),v()},onClose:v})]})}const Uy="vskill-ccode-banner-dismissed",HN=new Set(["claude-cli","claude-code"]);function UN(){try{return sessionStorage.getItem(Uy)==="true"}catch{return!1}}function $N(){try{sessionStorage.setItem(Uy,"true")}catch{}}function VN({activeAgentId:t}){const[r,s]=p.useState(()=>UN()),o=p.useCallback(()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:open-setup-drawer",{detail:{provider:"claude-code"}}))},[]),c=p.useCallback(()=>{$N(),s(!0)},[]);return!t||!HN.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:[ne.claudeCodeLabel.firstUseBanner," "]}),a.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-learn-more",onClick:o,style:{background:"transparent",border:"none",padding:0,color:"var(--color-accent, var(--accent-surface))",cursor:"pointer",textDecoration:"underline",fontFamily:"inherit",fontSize:"inherit"},children:ne.claudeCodeLabel.learnMore})]}),a.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-dismiss",onClick:c,"aria-label":"Dismiss Claude Code info banner",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1,padding:2,flexShrink:0},children:"×"})]})}function PN(){const[t,r]=p.useState(null),[s,o]=p.useState("loading"),[c,u]=p.useState(null),d=p.useCallback(async()=>{try{const h=await Ce.getAgents();r(h),o("ready"),u(null)}catch(h){o("error"),u(h.message)}},[]);return p.useEffect(()=>{d()},[d]),p.useEffect(()=>{const h=()=>void d();return window.addEventListener("studio:agent-changed",h),()=>window.removeEventListener("studio:agent-changed",h)},[d]),{status:s,response:t,error:c,refresh:()=>void d()}}const wo="workspace",FN=["skills","agents"];async function GN(){const t=await fetch("/api/workspace");if(!t.ok)throw new Error(`GET /api/workspace failed: ${t.status}`);return await t.json()}async function WN(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 qN(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 YN(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 Vd(){for(const t of FN)Nn(t)}function KN(){const{data:t,loading:r,error:s,revalidate:o}=ei(wo,GN),c=t,u=c==null?void 0:c.projects.find(m=>m.id===c.activeProjectId),d=p.useCallback(async m=>{await WN(m),Nn(wo),Vd()},[]),h=p.useCallback(async m=>{await qN(m),Nn(wo),Vd()},[]),g=p.useCallback(async m=>{await YN(m),Nn(wo),Vd()},[]);return{workspace:c,activeProject:u,loading:r,error:s,switchProject:d,addProject:h,removeProject:g,revalidate:o}}function XN({workspace:t,onSwitch:r,onAdd:s,onRemove:o,isPathStale:c}){const[u,d]=p.useState(!1),[h,g]=p.useState(!1),[m,y]=p.useState(""),[v,b]=p.useState(null),[k,S]=p.useState(null),[w,C]=p.useState(null),[T,R]=p.useState(!1),M=p.useRef(null),B=(t==null?void 0:t.projects)??[],D=B.find(N=>N.id===(t==null?void 0:t.activeProjectId));p.useEffect(()=>{if(!u)return;function N(_){M.current&&!M.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=m.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 P=_ instanceof Error?_.message:String(_);/does not exist/i.test(P)?b(`Path not found on disk: ${N}`):/Duplicate/i.test(P)?b("That project is already registered."):b(P)}}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 H(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:M,"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:(D==null?void 0:D.path)??"No project selected",style:{display:"flex",alignItems:"center",gap:8,padding:"4px 10px",border:"1px solid transparent",borderRadius:6,background:u?"var(--surface-2, rgba(0,0,0,0.05))":"transparent",cursor:"pointer",fontFamily:"var(--font-mono)",fontSize:13,color:"var(--text-primary)",transition:"background-color 120ms ease"},children:[a.jsx("span",{"aria-hidden":!0,style:{width:8,height:8,borderRadius:"50%",flexShrink:0,backgroundColor:(D==null?void 0:D.colorDot)??"var(--text-tertiary, #999)"}}),a.jsx("span",{style:{maxWidth:180,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D?D.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,P=N.id===(t==null?void 0:t.activeProjectId),K=k===N.id;return a.jsxs("li",{role:"menuitem","data-stale":_?"true":"false",onMouseEnter:()=>S(N.id),onMouseLeave:()=>S(X=>X===N.id?null:X),onClick:()=>{if(!_){if(P){d(!1);return}C(N)}},style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:6,cursor:_?"not-allowed":"pointer",background:K&&!_?"var(--surface-2, rgba(0,0,0,0.04))":P?"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:P?"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:P?600:500,color:"var(--text-primary)",lineHeight:1.3},children:[a.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:N.name}),P&&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:H(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:X=>{X.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:K?1:0,transition:"opacity 120ms ease, color 120ms ease, background-color 120ms ease",flexShrink:0},onMouseEnter:X=>{X.currentTarget.style.color="var(--color-error, #b91c1c)",X.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-error, #b91c1c) 10%, transparent)"},onMouseLeave:X=>{X.currentTarget.style.color="var(--text-tertiary)",X.currentTarget.style.backgroundColor="transparent"},children: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:m,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 QN(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 ZN({open:t,projects:r,onSwitch:s,onClose:o}){const[c,u]=p.useState(""),[d,h]=p.useState(0),g=p.useMemo(()=>QN(r,c),[r,c]);p.useEffect(()=>{t||(u(""),h(0))},[t]),p.useEffect(()=>{d>=g.length&&h(0)},[g.length,d]);const m=y=>{if(y.key==="Escape"){y.preventDefault(),o();return}if(y.key==="ArrowDown"){y.preventDefault(),h(v=>Math.min(v+1,Math.max(g.length-1,0)));return}if(y.key==="ArrowUp"){y.preventDefault(),h(v=>Math.max(v-1,0));return}if(y.key==="Enter"){y.preventDefault();const v=g[d];v&&(s(v.id),o())}};return t?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:m,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 Jg=/^[a-z][a-z0-9-]{0,62}[a-z0-9]$/;function JN({open:t,onClose:r,initialMode:s="standalone",isClaudeCode:o,projectRoot:c,onCreated:u}){const[d,h]=p.useState("destination"),[g,m]=p.useState(s),[y,v]=p.useState(""),[b,k]=p.useState(""),[S,w]=p.useState(""),[C,T]=p.useState([]),[R,M]=p.useState(!1),[B,D]=p.useState(null);if(p.useEffect(()=>{t&&(h("destination"),m(s),v(""),k(""),w(""),D(null))},[t,s]),p.useEffect(()=>{if(!t)return;let $=!0;return fetch("/api/authoring/plugins").then(z=>z.json()).then(z=>{$&&T(z.plugins??[])}).catch(()=>{}),()=>{$=!1}},[t]),p.useEffect(()=>{if(!t)return;function $(z){z.key==="Escape"&&(z.preventDefault(),r())}return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[t,r]),!t)return null;const F=C.length>0,E=o&&F,H=o,N=Jg.test(y),_=g==="existing-plugin"?b.length>0:Jg.test(b),P=!R&&N&&(g==="standalone"||_),K=eT(c,g,b,y);async function X(){D(null),M(!0);try{const I=new URLSearchParams;I.set("mode",g),I.set("skillName",y),b&&I.set("pluginName",b);const O=await fetch(`/api/authoring/skill-exists?${I.toString()}`),U=await O.json();if(!O.ok){D(U.error??`Check failed: ${O.status}`);return}if(U.exists){D(`Skill '${y}' already exists${U.path?` at ${U.path}`:""}`);return}}catch(I){D(I instanceof Error?I.message:String(I));return}finally{M(!1)}const $=new URLSearchParams;$.set("mode",g),$.set("skillName",y),S.trim()&&$.set("description",S.trim()),b&&$.set("pluginName",b);const z=`#/create?${$.toString()}`;typeof window<"u"&&(window.location.hash=z),r()}async function ee(){D(null),M(!0);try{const $=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})}),z=await $.json();if(!$.ok||!z.ok){D(z.error??`Create failed: ${$.status}`);return}Nn("skills"),u==null||u({mode:g,skillName:y,pluginName:z.pluginName??null,skillMdPath:z.skillMdPath}),r()}catch($){D($ instanceof Error?$.message:String($))}finally{M(!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(Pd,{title:"Standalone skill",subtitle:"A single skill in this project",description:"Lives at <project>/skills/<name>/SKILL.md. Works with every agent.",icon:"📄",selected:g==="standalone",onClick:()=>m("standalone")}),a.jsx(Pd,{title:"Add to existing plugin",subtitle:E?`${C.length} plugin source${C.length===1?"":"s"} in this project`:o?"No plugin sources in this project yet":"Claude Code only",description:"Appends a skill to an existing <plugin>/.claude-plugin/plugin.json source.",icon:"🧩",disabled:!E,selected:g==="existing-plugin",onClick:()=>E&&m("existing-plugin")}),a.jsx(Pd,{title:"New plugin",subtitle:H?"Bundles one or more skills for distribution":"Claude Code only",description:"Scaffolds <plugin>/.claude-plugin/plugin.json and its first skill.",icon:"📦",disabled:!H,selected:g==="new-plugin",onClick:()=>H&&m("new-plugin")})]}),d==="details"&&a.jsxs("div",{style:{padding:16,display:"flex",flexDirection:"column",gap:12},children:[g==="new-plugin"&&a.jsx(Co,{label:"Plugin name",hint:"kebab-case",children:a.jsx("input",{type:"text",value:b,onChange:$=>k($.target.value.trim()),placeholder:"my-first-plugin",autoFocus:!0,style:Eo(!b||_)})}),g==="existing-plugin"&&a.jsx(Co,{label:"Plugin",children:a.jsxs("select",{value:b,onChange:$=>k($.target.value),style:{...Eo(!0),fontFamily:"var(--font-mono)"},children:[a.jsx("option",{value:"",children:"Select a plugin…"}),C.map($=>a.jsx("option",{value:$.name,children:$.name},$.path))]})}),a.jsx(Co,{label:"Skill name",hint:"kebab-case",children:a.jsx("input",{type:"text",value:y,onChange:$=>v($.target.value.trim()),placeholder:"my-new-skill",autoFocus:g!=="new-plugin",style:Eo(!y||N)})}),a.jsx(Co,{label:"Description",hint:"One short sentence — shown in frontmatter",children:a.jsx("textarea",{value:S,onChange:$=>w($.target.value),rows:2,placeholder:"Does a thing when Claude needs X",style:{...Eo(!0),resize:"vertical",minHeight:52,fontFamily:"var(--font-sans)"}})}),K&&a.jsxs("div",{style:{padding:"8px 10px",fontSize:11,fontFamily:"var(--font-mono)",color:"var(--text-secondary)",background:"var(--surface-1, rgba(0,0,0,0.03))",border:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",borderRadius:4,wordBreak:"break-all"},children:[a.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginBottom:2,fontFamily:"var(--font-sans)"},children:"Will create:"}),K.map(($,z)=>a.jsx("div",{children:$},z))]}),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:Fd,children:"Cancel"}),d==="destination"&&a.jsx("button",{type:"button",onClick:()=>h("details"),style:ev,children:"Continue →"}),d==="details"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>h("destination"),style:Fd,children:"← Back"}),a.jsx("button",{type:"button",onClick:()=>void X(),disabled:!P,style:{...Fd,opacity:P?1:.5,cursor:P?"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 ee(),disabled:!P,style:{...ev,opacity:P?1:.5,cursor:P?"pointer":"not-allowed"},title:"Creates an empty SKILL.md scaffold you can fill in by hand",children:R?"Creating…":"Create empty scaffold"})]})]})]})]})}function Pd({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 Co({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 Eo(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 ev={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"},Fd={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 eT(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 tT({open:t,onClose:r,onInstall:s,installedNames:o}){const[c,u]=p.useState([]),[d,h]=p.useState(null),[g,m]=p.useState(null),[y,v]=p.useState(!1),[b,k]=p.useState(null);return p.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]),p.useEffect(()=>{if(!d){m(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);m(S)}).catch(S=>k(S instanceof Error?S.message:String(S))).finally(()=>v(!1))},[d]),p.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(nT,{}),!d&&c.map(S=>a.jsxs("button",{type:"button",onClick:()=>h(S.name),style:rT,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(aT,{onAdded:()=>{Nn("marketplaces"),fetch("/api/plugins/marketplaces").then(S=>S.json()).then(S=>u(S.marketplaces??[]))}})})]})]}):null}function nT(){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 aT({onAdded:t}){const[r,s]=p.useState(""),[o,c]=p.useState(!1),[u,d]=p.useState(null);async function h(){const g=r.trim();if(g){c(!0),d(null);try{const m=await fetch("/api/plugins/marketplaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:g})}),y=await m.json().catch(()=>({}));if(!m.ok||!y.ok){d(y.error??`Add failed (${m.status})`);return}s(""),t()}catch(m){d(m instanceof Error?m.message:String(m))}finally{c(!1)}}}return 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 rT={display:"block",width:"100%",textAlign:"left",padding:"10px 12px",border:"none",borderRadius:6,background:"transparent",cursor:"pointer",fontFamily:"inherit",marginBottom:2},Gd=12;function lT({job:t,onDone:r}){const[s,o]=p.useState([]),[c,u]=p.useState("running"),[d,h]=p.useState(!1);if(p.useEffect(()=>{if(!t)return;o([]),u("running"),h(!1);const v=new AbortController;let b=[],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:M}=await w.read();if(M)break;T+=C.decode(R,{stream:!0});const B=T.split(/\n\n/);T=B.pop()??"";for(const D of B){const F=D.match(/^data:\s*(.*)$/m);if(F)try{const E=JSON.parse(F[1]);E.type==="stdout"&&E.line?(b=[...b,E.line].slice(-Gd),o(b)):E.type==="stderr"&&E.line?(b=[...b,`⚠ ${E.line}`].slice(-Gd),o(b)):E.type==="done"?(k=E.ok?"ok":"failed",u(k),Lv(),Nn("skills"),r({ok:E.ok??!1,code:E.code??null,lines:b})):E.type==="error"&&E.error&&(b=[...b,`✘ ${E.error}`].slice(-Gd),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)",m=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(sT,{}):m}),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 sT(){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 iT=3e3,oT={anthropic:"Anthropic",openai:"OpenAI",openrouter:"OpenRouter"};function tv(t){return t==="anthropic"||t==="openai"||t==="openrouter"}function cT(){const{toast:t}=Df(),r=p.useRef(new Map),s=p.useCallback(o=>{if(!tv(o.provider))return;const c=Date.now(),u=r.current.get(o.provider)??0;if(c-u<iT)return;r.current.set(o.provider,c);const d=oT[o.provider];t({message:`${d} API key invalid or missing. Open Settings →`,severity:"error",action:{label:"Open Settings",onInvoke:()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:open-settings",{detail:{provider:o.provider}}))}}})},[t]);return p.useEffect(()=>{function o(c){const u=c.detail;!u||!tv(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 $y="vskill.studio.prefs";function Vy(){try{return typeof window>"u"?null:window.localStorage??null}catch{return null}}function Py(){const t=Vy();if(!t)return{};try{const r=t.getItem($y);if(!r)return{};const s=JSON.parse(r);return s&&typeof s=="object"&&!Array.isArray(s)?s:{}}catch{return{}}}function uT(t,r){const s=Vy();if(s)try{const c={...Py(),[t]:r};s.setItem($y,JSON.stringify(c))}catch{}}function dT(t,r){const o=Py()[t];return o===void 0?r:o}const nv={open:!1,x:0,y:0,skill:null};function fT(t,r){return{open:!0,x:t.clientX,y:t.clientY,skill:r}}function _r(t,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:t,severity:r}}))}function pT(t){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:request-delete",{detail:{skill:t}}))}function mT(t,r){var s;switch(t){case"copy-path":try{(s=navigator.clipboard)==null||s.writeText(r.dir)}catch{_r(ne.toasts.permissionDenied,"error");return}_r(ne.toasts.pathCopied,"info");return;case"open":case"reveal":case"edit":_r(ne.actions.editPlaceholder,"info");return;case"run-benchmark":_r(ne.toasts.benchmarkQueued,"info");return;case"duplicate":_r(ne.toasts.skillDuplicated,"info");return;case"update":_r(ne.toasts.skillUpdated,"info");return;case"uninstall":_r(ne.actions.editPlaceholder,"info");return;case"delete":pT(r);return;default:return}}const hT=p.lazy(()=>Fo(()=>import("./CommandPalette-DyknO-U5.js"),__vite__mapDeps([2,1]))),xT=p.lazy(()=>Fo(()=>import("./CreateSkillPage-CIhAMdn-.js"),__vite__mapDeps([3,1])).then(t=>({default:t.CreateSkillPage})));function gT(){const[t,r]=p.useState(()=>typeof window<"u"&&window.location.hash.startsWith("#/create"));return p.useEffect(()=>{function s(){r(window.location.hash.startsWith("#/create"))}return window.addEventListener("hashchange",s),s(),()=>window.removeEventListener("hashchange",s)},[]),t}function vT(){return a.jsx(fS,{children:a.jsx(cS,{children:a.jsxs(QE,{children:[a.jsx(yT,{}),a.jsx(fN,{})]})})})}function yT(){var fa,Wn;const{state:t,selectSkill:r,clearSelection:s,refreshSkills:o,outdatedByOrigin:c,revealSkill:u,clearReveal:d}=ea(),{config:h}=Ur(),{mode:g,resolvedTheme:m,setTheme:y}=Mv(),{toast:v}=Df(),[b,k]=p.useState(()=>Lw()),[S]=p.useState(!0),[w,C]=p.useState(!1),[T,R]=p.useState(!1),[M,B]=p.useState(!1),[D,F]=p.useState("overview"),[E,H]=p.useState(nv),N=p.useCallback((oe,Ee)=>{H(fT(oe,Ee))},[]),_=PN(),[P,K]=p.useState(()=>dT("activeAgent",null)),X=p.useCallback(oe=>{K(oe),uT("activeAgent",oe),typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:agent-changed",{detail:{agentId:oe}}))},[]);p.useEffect(()=>{var oe;!P&&((oe=_.response)!=null&&oe.suggested)&&X(_.response.suggested)},[P,(fa=_.response)==null?void 0:fa.suggested,X]);const ee=p.useMemo(()=>_.response?BN(_.response):[],[_.response]),{workspace:$,switchProject:z,addProject:I,removeProject:O,activeProject:U}=KN(),[se,L]=p.useState(!1),[q,W]=p.useState(!1),[te,fe]=p.useState("standalone"),ie=p.useCallback((oe="standalone")=>{fe(oe),W(!0)},[]);p.useEffect(()=>{function oe(Ee){if(!(Ee instanceof CustomEvent))return;const ye=Ee.detail;ie((ye==null?void 0:ye.mode)??"standalone")}return window.addEventListener("studio:request-create-skill",oe),()=>window.removeEventListener("studio:request-create-skill",oe)},[ie]);const[ve,de]=p.useState(!1),[Se,Ae]=p.useState(null);p.useEffect(()=>{function oe(){de(!0)}return window.addEventListener("studio:open-marketplace",oe),()=>window.removeEventListener("studio:open-marketplace",oe)},[]);const _e=p.useMemo(()=>{const oe=new Set;for(const Ee of t.skills)Ee.source==="plugin"&&Ee.pluginName&&oe.add(Ee.pluginName);return oe},[t.skills]);af([{key:"p",meta:!0,handler:oe=>{var ye;const Ee=typeof document<"u"?document.activeElement:null;Ee&&Ee.tagName==="INPUT"||((ye=oe==null?void 0:oe.preventDefault)==null||ye.call(oe),L(gt=>!gt))}}],{enabled:!0});const re=TN(),he=re.open;p.useEffect(()=>{function oe(Ee){if(!(Ee instanceof CustomEvent))return;const ye=Ee.detail;ye!=null&&ye.provider&&he(ye.provider)}return window.addEventListener("studio:open-setup-drawer",oe),()=>window.removeEventListener("studio:open-setup-drawer",oe)},[he]);const pe=p.useCallback(()=>{H(nv)},[]);p.useEffect(()=>{function oe(Ee){if(!(Ee instanceof CustomEvent))return;const ye=Ee.detail;ye!=null&&ye.message&&v({message:ye.message,severity:ye.severity??"info"})}return window.addEventListener("studio:toast",oe),()=>window.removeEventListener("studio:toast",oe)},[v]),cT();const[xe,je]=p.useState(!1),[Be,Oe]=p.useState(void 0);p.useEffect(()=>{function oe(Ee){if(!(Ee instanceof CustomEvent))return;const ye=Ee.detail;Oe(ye==null?void 0:ye.provider),je(!0)}return window.addEventListener("studio:open-settings",oe),()=>window.removeEventListener("studio:open-settings",oe)},[]),p.useEffect(()=>{document.documentElement.style.setProperty("--sidebar-width",`${b}px`)},[b]);const[rt,Nt]=p.useState(null),[ht,Dt]=p.useState(()=>new Set),Tt=p.useRef(!1),Qe=p.useMemo(()=>vN(),[]),tt=p.useCallback(oe=>`${oe.plugin}/${oe.skill}`,[]),be=p.useCallback(oe=>{Dt(Ee=>{const ye=new Set(Ee);return ye.add(tt(oe)),ye})},[tt]),pt=p.useCallback(oe=>{Dt(Ee=>{const ye=new Set(Ee);return ye.delete(tt(oe)),ye})},[tt]),Et=yN({delayMs:1e4,onCommit:oe=>{o(),pt(oe)},onFailure:(oe,Ee)=>{pt(oe),v({message:`Couldn't delete ${oe.skill}: ${Ee.message}`,severity:"error",durationMs:0,action:{label:ne.actions.retry,onInvoke:()=>{be(oe),Et.enqueueDelete(oe)}}})}});p.useEffect(()=>{function oe(Ee){if(!(Ee instanceof CustomEvent))return;const ye=Ee.detail;ye!=null&&ye.skill&&Nt(ye.skill)}return window.addEventListener("studio:request-delete",oe),()=>window.removeEventListener("studio:request-delete",oe)},[]);const Yt=p.useCallback(()=>{const oe=rt;if(Nt(null),!oe)return;const Ee={plugin:oe.plugin,skill:oe.skill};be(Ee),Et.enqueueDelete(Ee);const ye=Tt.current?"":`Sent to your ${Qe}. Open Trash to restore. `;Tt.current=!0,v({message:`${ye}Deleted ${oe.skill}`,severity:"info",durationMs:1e4,action:{label:ne.actions.undo,onInvoke:()=>{Et.cancelDelete(tt(Ee)),pt(Ee)}}})},[rt,be,pt,Et,v,Qe,tt]),un=p.useCallback(()=>{Nt(null)},[]),Gt=p.useMemo(()=>t.skills.filter(oe=>!ht.has(tt(oe))),[t.skills,ht,tt]),nn=p.useMemo(()=>t.selectedSkill?t.skills.find(oe=>oe.plugin===t.selectedSkill.plugin&&oe.skill===t.selectedSkill.skill)??null:null,[t.skills,t.selectedSkill]),An=p.useCallback(oe=>{r({plugin:oe.plugin,skill:oe.skill,origin:oe.origin})},[r]),Mt=p.useMemo(()=>{if(!t.selectedSkill)return"";const oe=t.selectedSkill.origin==="installed"?"Installed":"Own";return`Viewing ${t.selectedSkill.skill} (${oe})`},[t.selectedSkill]),xt=p.useMemo(()=>[{id:"switch-theme",label:ne.palette.actionSwitchTheme,description:"Cycle light / dark / auto",keywords:["theme","dark","light","mode"],onInvoke:()=>y(g==="light"?"dark":g==="dark"?"auto":"light")},{id:"toggle-sidebar",label:"Toggle sidebar",description:"Show or hide the skills sidebar",keywords:["sidebar","panel","hide","show","cmd+b"],onInvoke:()=>B(oe=>!oe)},{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]);af([{key:"cmd+k",handler:()=>C(oe=>!oe)},{key:"ctrl+k",handler:()=>C(oe=>!oe)},{key:"?",handler:()=>R(oe=>!oe)},{key:"cmd+shift+d",handler:()=>y(m==="light"?"dark":"light")},{key:"ctrl+shift+d",handler:()=>y(m==="light"?"dark":"light")},{key:"cmd+b",handler:()=>B(oe=>!oe)},{key:"ctrl+b",handler:()=>B(oe=>!oe)},{key:"e",handler:()=>v({message:ne.actions.editPlaceholder,severity:"info"})}]);const ta=gT()?a.jsx(p.Suspense,{fallback:a.jsx("div",{style:{padding:40},children:"Loading…"}),children:a.jsx(xT,{})}):a.jsx(rN,{selectedSkillInfo:nn,activeDetailTab:D,onDetailTabChange:F,allSkills:t.skills,onSelectSkill:An});return a.jsxs(a.Fragment,{children:[a.jsx(pS,{sidebarWidth:b,sidebarHidden:M||t.isMobile&&t.mobileView==="detail",banner:a.jsx(_w,{connected:S}),liveMessage:Mt,topRail:a.jsx(d2,{projectName:(h==null?void 0:h.projectName)??null,selected:t.selectedSkill,onOpenPalette:()=>C(!0),onHome:s,onRequestCreateSkill:()=>ie("standalone"),projectPickerSlot:$&&$.projects.length>0?a.jsx(XN,{workspace:$,onSwitch:z,onAdd:I,onRemove:O}):void 0}),sidebar:a.jsx(ww,{skills:Gt,selectedKey:t.selectedSkill?{plugin:t.selectedSkill.plugin,skill:t.selectedSkill.skill}:null,onSelect:An,isLoading:t.skillsLoading,error:t.skillsError??null,onRetry:o,onContextMenu:N,outdatedByOrigin:c,activeAgentId:P,revealSkillId:t.revealSkillId,onRevealComplete:d,topSlot:_.status==="ready"&&ee.length>0?a.jsxs(a.Fragment,{children:[a.jsx(IN,{agents:ee,activeAgentId:P,onActiveAgentChange:X,onOpenSetup:oe=>re.open(oe)}),a.jsx(VN,{activeAgentId:P})]}):null}),resizeHandle:a.jsx(Dw,{initialWidth:b??Hs,onChange:k}),main:ta,statusBar:a.jsx(S2,{projectPath:(h==null?void 0:h.root)??null,modelName:(h==null?void 0:h.model)??null,health:h!=null&&h.error?"degraded":"ok",providers:(Wn=h==null?void 0:h.providers)==null?void 0:Wn.map(oe=>{const Ee=oe.id;return{id:Ee,label:oe.label,available:oe.available,kind:Ee==="ollama"||Ee==="lm-studio"?"start-service":Ee==="anthropic"||Ee==="openrouter"?"api-key":"cli-install"}})})}),a.jsx(mN,{open:T,onClose:()=>R(!1)}),a.jsx(SN,{open:re.isOpen,providerKey:re.providerKey,onClose:re.close}),a.jsx(xN,{state:E,onClose:pe,onAction:(oe,Ee)=>mT(oe,Ee)}),w&&a.jsx(p.Suspense,{fallback:null,children:a.jsx(hT,{open:w,onClose:()=>C(!1),commands:xt})}),a.jsx(ZN,{open:se,projects:($==null?void 0:$.projects)??[],onSwitch:oe=>{z(oe)},onClose:()=>L(!1)}),a.jsx(JN,{open:q,onClose:()=>W(!1),initialMode:te,isClaudeCode:P==="claude-code",projectRoot:(U==null?void 0:U.path)??(h==null?void 0:h.projectName)??"",onCreated:oe=>{o(),setTimeout(()=>{u(oe.pluginName??"",oe.skillName)},500)}}),a.jsx(tT,{open:ve,onClose:()=>de(!1),installedNames:_e,onInstall:(oe,Ee)=>{Ae({plugin:oe,marketplace:Ee,ref:`${oe}@${Ee}`}),de(!1)}}),a.jsx(Tv,{open:xe,onClose:()=>je(!1),initialProvider:Be,onToast:oe=>v({message:oe,severity:"info"})}),a.jsx(lT,{job:Se,onDone:oe=>{oe.ok&&setTimeout(()=>Ae(null),3e3)}}),a.jsx(gN,{open:rt!==null,title:rt?`Delete "${rt.skill}"?`:"",body:`It will be sent to your ${Qe}. You can recover it from there.`,confirmLabel:"Delete",cancelLabel:"Cancel",variant:"destructive",onConfirm:Yt,onCancel:un})]})}const av="vskill.migrations.scope-rename.v1",bT={own:"authoring-project",installed:"available-project",global:"available-personal"},jT=/^vskill-sidebar-(.+)-(own|installed|global)-collapsed$/;function ST(t){if(t.getItem(av)==="done")return;const r=[];for(let s=0;s<t.length;s++){const o=t.key(s);if(!o)continue;const c=o.match(jT);if(!c)continue;const[,u,d]=c,h=bT[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(av,"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{ST(window.localStorage)}catch{}o0.createRoot(document.getElementById("root")).render(a.jsx(p.StrictMode,{children:a.jsx(Rj,{children:a.jsx(g2,{children:a.jsx(vT,{})})})}));export{Zo as E,Sv as L,ti as P,Te as R,CE as S,Ur as a,Py as b,SE as c,Xo as d,dT as g,a as j,p as r,ne as s,uf as t,F0 as u,uT as w};
|