vskill 0.5.101 → 0.5.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agents.json +1 -1
- package/dist/eval-ui/assets/{CommandPalette-BsIqE6hu.js → CommandPalette-BSGTaiI4.js} +1 -1
- package/dist/eval-ui/assets/{UpdateDropdown-Cx3XWMAn.js → UpdateDropdown-stNmCWki.js} +1 -1
- package/dist/eval-ui/assets/{index-BOb5IGB8.js → index-BoCK_s7q.js} +3 -3
- package/dist/eval-ui/index.html +1 -1
- package/package.json +1 -1
package/agents.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,j as o,s as g}from"./index-
|
|
1
|
+
import{r as a,j as o,s as g}from"./index-BoCK_s7q.js";/* empty css */function h(r,i){if(!i)return 1;const n=i.toLowerCase(),c=[r.label,r.description??"",...r.keywords??[]].join(" ").toLowerCase();if(c.startsWith(n))return 100;const s=r.label.toLowerCase();if(s.startsWith(n))return 90;if(s.includes(n))return 80;if(c.includes(n))return 60;let l=0;for(const u of c)if(u===n[l]&&l++,l===n.length)return 40;return 0}function j({open:r,onClose:i,commands:n,placeholder:c=g.palette.inputPlaceholder}){const[s,l]=a.useState(""),[u,f]=a.useState(0),m=a.useRef(null),v=a.useRef(null),b=a.useRef(null),p=a.useMemo(()=>n.map(e=>({c:e,s:h(e,s)})).filter(e=>e.s>0).sort((e,x)=>x.s-e.s).map(e=>e.c),[n,s]);if(a.useEffect(()=>{if(r)return m.current=document.activeElement??null,l(""),f(0),requestAnimationFrame(()=>{var t;return(t=v.current)==null?void 0:t.focus()}),()=>{var t,e;(e=(t=m.current)==null?void 0:t.focus)==null||e.call(t),m.current=null}},[r]),a.useEffect(()=>{f(0)},[s]),a.useEffect(()=>{if(!r)return;function t(e){var x;if(e.key==="Escape"){e.preventDefault(),i();return}if(e.key==="ArrowDown"){e.preventDefault(),f(d=>Math.min(d+1,Math.max(p.length-1,0)));return}if(e.key==="ArrowUp"){e.preventDefault(),f(d=>Math.max(d-1,0));return}if(e.key==="Enter"){const d=p[u];d&&(e.preventDefault(),d.onInvoke(),i());return}e.key==="Tab"&&(e.preventDefault(),(x=v.current)==null||x.focus())}return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[r,i,p,u]),!r)return null;const y="command-palette-listbox";return o.jsx("div",{"data-testid":"command-palette",role:"presentation",onClick:t=>{t.target===t.currentTarget&&i()},style:{position:"fixed",inset:0,background:"color-mix(in srgb, var(--bg-canvas) 70%, transparent)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"12vh",zIndex:60},children:o.jsxs("div",{ref:b,role:"dialog","aria-modal":"true","aria-label":"Command palette",style:{width:"min(560px, 92vw)",background:"var(--bg-canvas)",border:"1px solid var(--border-default)",borderRadius:8,boxShadow:"0 24px 64px rgba(0,0,0,0.2)",overflow:"hidden",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[o.jsx("div",{role:"combobox","aria-expanded":"true","aria-controls":y,"aria-haspopup":"listbox",style:{padding:"8px 12px",borderBottom:"1px solid var(--border-default)"},children:o.jsx("input",{ref:v,type:"text",value:s,onChange:t=>l(t.currentTarget.value),"aria-label":"Command","aria-autocomplete":"list","aria-controls":y,placeholder:c,style:{width:"100%",border:"none",outline:"none",background:"transparent",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:14,padding:"6px 0"}})}),o.jsxs("ul",{id:y,role:"listbox",style:{listStyle:"none",margin:0,padding:"4px 0",maxHeight:320,overflow:"auto"},children:[p.length===0&&o.jsx("li",{role:"option","aria-selected":"false",style:{padding:"10px 12px",color:"var(--text-secondary)",fontSize:12},children:g.palette.emptyResults}),p.map((t,e)=>o.jsxs("li",{role:"option","aria-selected":e===u,onMouseEnter:()=>f(e),onClick:()=>{t.onInvoke(),i()},style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",background:e===u?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",cursor:"pointer",fontSize:13},children:[o.jsx("span",{children:t.label}),t.description&&o.jsx("span",{style:{fontSize:11,color:"var(--text-secondary)",marginLeft:12},children:t.description})]},t.id))]})]})})}export{j as CommandPalette,j as default,h as scoreCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as u,j as t}from"./index-
|
|
1
|
+
import{r as u,j as t}from"./index-BoCK_s7q.js";/* empty css */function b(l,n){const[c,m]=l.split("."),[f,o]=n.split("."),r=Number(c),d=Number(m),s=Number(f),a=Number(o);return!Number.isFinite(r)||!Number.isFinite(s)?(console.warn(`[semverBump] unparseable version: installed=${l} latest=${n}`),"patch"):s>r?"major":!Number.isFinite(d)||!Number.isFinite(a)?(console.warn(`[semverBump] unparseable minor: installed=${l} latest=${n}`),"patch"):a>d?"minor":"patch"}const y={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 w({updates:l,isRefreshing:n,onRefresh:c,onSelectSkill:m,onViewAll:f,onClose:o,anchorRef:r}){const d=u.useRef(null),s=u.useRef(null);u.useEffect(()=>{var e;(e=s.current)==null||e.focus()},[]),u.useEffect(()=>{function e(i){d.current&&(d.current.contains(i.target)||r!=null&&r.current&&r.current.contains(i.target)||o())}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[o,r]),u.useEffect(()=>{function e(i){var p;i.key==="Escape"&&(i.preventDefault(),o(),(p=r==null?void 0:r.current)==null||p.focus())}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[o,r]);const a=l.filter(e=>e.updateAvailable);return t.jsxs("div",{ref:d,role:"dialog","aria-modal":"false","aria-label":"Skill update summary","data-testid":"update-dropdown",style:{position:"absolute",top:"calc(100% + 6px)",right:0,width:320,maxHeight:400,overflow:"auto",background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:10,zIndex:1e3,fontFamily:"var(--font-sans)",display:"flex",flexDirection:"column",gap:6},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"2px 4px 6px",borderBottom:"1px solid var(--border-default)"},children:[t.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-primary)"},children:a.length===0?"No updates available":`${a.length} updates available`}),t.jsx("button",{type:"button","data-testid":"update-dropdown-refresh",onClick:c,disabled:n,style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono)",cursor:n?"not-allowed":"pointer",padding:"2px 6px"},children:n?"Refreshing…":"Refresh"})]}),a.length>0?t.jsx("ul",{role:"list",style:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:2},children:a.map((e,i)=>{const p=e.latest?b(e.installed,e.latest):"patch",x=y[p];return t.jsx("li",{style:{margin:0},children:t.jsxs("button",{ref:i===0?s:void 0,type:"button","data-testid":"update-dropdown-row","data-skill-name":e.name,onClick:()=>m(e),style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 8px",background:"transparent",border:"none",borderRadius:4,cursor:"pointer",color:"var(--text-primary)",fontFamily:"inherit",fontSize:12,textAlign:"left"},children:[t.jsx("span",{"aria-hidden":"true","data-testid":"update-dropdown-bump-dot","data-bump":p,style:{width:8,height:8,borderRadius:"50%",background:x.text,flexShrink:0}}),t.jsx("span",{style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),t.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[e.installed," → ",e.latest??"?"]})]})},e.name)})}):t.jsx("div",{style:{padding:"12px 4px",fontSize:12,color:"var(--text-secondary)"},children:"All installed skills are up to date."}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end",padding:"4px 4px 0",borderTop:"1px solid var(--border-default)",marginTop:2},children:t.jsx("button",{type:"button","data-testid":"update-dropdown-view-all",onClick:f,style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-sans)",cursor:"pointer",padding:"4px 6px"},children:"View all"})})]})}export{w as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-stNmCWki.js","assets/fonts-i7Lkz2zN.css","assets/CommandPalette-BSGTaiI4.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
/* empty css */(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))o(d);new MutationObserver(d=>{for(const p of d)if(p.type==="childList")for(const f of p.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&o(f)}).observe(document,{childList:!0,subtree:!0});function i(d){const p={};return d.integrity&&(p.integrity=d.integrity),d.referrerPolicy&&(p.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?p.credentials="include":d.crossOrigin==="anonymous"?p.credentials="omit":p.credentials="same-origin",p}function o(d){if(d.ep)return;d.ep=!0;const p=i(d);fetch(d.href,p)}})();function ug(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var _d={exports:{}},fs={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -51,7 +51,7 @@ Error generating stack: `+s.message+`
|
|
|
51
51
|
`);f=j.pop()??"";for(const S of j)if(S.startsWith("event: "))h=S.slice(7).trim();else if(S.startsWith("data: ")){let k={};try{k=JSON.parse(S.slice(6))}catch{h="";continue}if(h==="started"||h==="copied"||h==="deleted"||h==="indexed"||h==="done"||h==="error"){const A={type:h,...k};r==null||r(A),A.type==="done"&&(x=A),A.type==="error"&&(m=A)}h=""}}if(m){const y=new ys(m.message,500);throw y.code=m.code,y}if(!x)throw new ys("Transfer stream ended without 'done' event",500);return x}function ab(a,r){if(!r.length)return a;const i=new Map;for(const o of r){const d=o.name.split("/").pop()||o.name;i.set(d,o)}return a.map(o=>{const d=i.get(o.skill);return d?{...o,updateAvailable:d.updateAvailable,currentVersion:d.installed,latestVersion:d.latest??void 0}:o})}function lb(a){const[r,i]=g.useState(()=>typeof window>"u"?!1:window.matchMedia(a).matches);return g.useEffect(()=>{const o=window.matchMedia(a);i(o.matches);const d=p=>i(p.matches);return o.addEventListener("change",d),()=>o.removeEventListener("change",d)},[a]),r}const rb=3e5,sb=500,ib=15e3,ob=6e4;function cb(a){const r=new Map;for(const i of a){const o=i.name.split("/").pop()||i.name;r.set(o,i)}return r}function db(a){let r=0;for(const i of a)i.updateAvailable&&r++;return r}function ub(a){a()}function fb(a){const r=rb,i=sb,o=ib,d=ob,[p,f]=g.useState([]),[h,x]=g.useState(()=>new Map),[m,y]=g.useState(0),[v,j]=g.useState(!1),[S,k]=g.useState(null),[A,T]=g.useState(null),C=g.useRef(null),M=g.useRef(null),O=g.useRef(null),U=g.useRef(null),L=g.useRef(!0),V=g.useCallback(async()=>{j(!0);const B=new AbortController,P=setTimeout(()=>B.abort(),o);try{const F=await Promise.race([Ee.getSkillUpdates(),new Promise((te,Q)=>{B.signal.addEventListener("abort",()=>{Q(new Error("TIMEOUT"))})})]);if(F==="TIMEOUT")throw new Error("TIMEOUT");if(!L.current)return;f(F),x(cb(F)),y(db(F)),M.current=Date.now(),k(M.current),T(null)}catch(F){if(!L.current)return;T(F instanceof Error?F:new Error(String(F)))}finally{clearTimeout(P),L.current&&j(!1)}},[o]),w=g.useCallback(()=>{if(C.current)return C.current;const B=V().finally(()=>{C.current=null});return C.current=B,B},[V]),D=g.useCallback(()=>{O.current==null&&(O.current=setInterval(()=>{w()},r))},[r,w]),E=g.useCallback(()=>{O.current!=null&&(clearInterval(O.current),O.current=null)},[]);return g.useEffect(()=>{L.current=!0,(M.current==null||Date.now()-M.current>d)&&ub(()=>void w()),(typeof document>"u"||document.visibilityState!=="hidden")&&D();const F=()=>{if(U.current&&(clearTimeout(U.current),U.current=null),document.visibilityState==="hidden"){E();return}U.current=setTimeout(()=>{U.current=null,(M.current==null||Date.now()-M.current>d)&&w(),D()},i)};return typeof document<"u"&&document.addEventListener("visibilitychange",F),()=>{L.current=!1,typeof document<"u"&&document.removeEventListener("visibilitychange",F),U.current&&clearTimeout(U.current),E()}},[]),{updates:p,updatesMap:h,updateCount:m,isRefreshing:v,lastFetchAt:S,error:A,refresh:w}}const pb={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list",updateNotificationDismissed:!1};function mb(a,r){switch(r.type){case"SELECT_SKILL":return{...a,selectedSkill:r.skill,mode:"browse",mobileView:a.isMobile?"detail":a.mobileView};case"CLEAR_SELECTION":return{...a,selectedSkill:null};case"SET_MODE":return{...a,mode:r.mode,selectedSkill:r.mode==="create"?null:a.selectedSkill};case"SET_SEARCH":return{...a,searchQuery:r.query};case"SET_SKILLS":return{...a,skills:r.skills,skillsLoading:!1,skillsError:null};case"SET_SKILLS_ERROR":return{...a,skillsError:r.error,skillsLoading:!1};case"SET_SKILLS_LOADING":return{...a,skillsLoading:r.loading};case"SET_MOBILE":return{...a,isMobile:r.isMobile};case"SET_MOBILE_VIEW":return{...a,mobileView:r.view};case"DISMISS_UPDATE_NOTIFICATION":return{...a,updateNotificationDismissed:!0};default:return a}}const pg=g.createContext(null);function ya(){const a=g.useContext(pg);if(!a)throw new Error("useStudio must be used within StudioProvider");return a}function hb({children:a}){const[r,i]=g.useReducer(mb,pb),o=lb("(max-width: 767px)");g.useEffect(()=>{i({type:"SET_MOBILE",isMobile:o})},[o]);const[d,p]=g.useState(()=>{try{const L=window.localStorage.getItem("vskill.studio.prefs");if(!L)return null;const V=JSON.parse(L);return typeof V.activeAgent=="string"?V.activeAgent:null}catch{return null}});g.useEffect(()=>{function L(V){if(!(V instanceof CustomEvent))return;const w=V.detail;w!=null&&w.agentId&&p(w.agentId)}return window.addEventListener("studio:agent-changed",L),()=>window.removeEventListener("studio:agent-changed",L)},[]);const f=g.useCallback(()=>{i({type:"SET_SKILLS_LOADING",loading:!0});const L=d?{agent:d}:void 0;Ee.getSkills(L).then(V=>{i({type:"SET_SKILLS",skills:V});const D=window.location.hash.match(/^#\/skills\/([^/]+)\/([^/?]+)/);if(D){const[,E,B]=D,P=V.find(F=>F.plugin===E&&F.skill===B);P&&i({type:"SELECT_SKILL",skill:{plugin:E,skill:B,origin:P.origin}})}}).catch(V=>i({type:"SET_SKILLS_ERROR",error:V.message}))},[d]);g.useEffect(()=>{f()},[f]);const h=g.useCallback(L=>{i({type:"SELECT_SKILL",skill:L}),window.location.hash=`/skills/${L.plugin}/${L.skill}`},[]),x=g.useCallback(()=>{i({type:"CLEAR_SELECTION"}),window.location.hash.startsWith("#/skills/")&&history.replaceState(null,"",window.location.pathname+window.location.search)},[]),m=g.useCallback(L=>{i({type:"SET_MODE",mode:L})},[]),y=g.useCallback(L=>{i({type:"SET_SEARCH",query:L})},[]),v=g.useCallback(L=>{i({type:"SET_MOBILE_VIEW",view:L})},[]),j=g.useCallback(()=>{i({type:"DISMISS_UPDATE_NOTIFICATION"})},[]),S=fb(),k=g.useMemo(()=>{const L=r.skills.map(V=>{if(!V.updateAvailable&&V.latestVersion===void 0)return V;const w={...V};return delete w.updateAvailable,delete w.currentVersion,delete w.latestVersion,w});return ab(L,S.updates)},[r.skills,S.updates]),A=g.useMemo(()=>{const L={source:0,installed:0};for(const V of k)V.updateAvailable&&(L[V.origin]+=1);return L},[k]),T=g.useMemo(()=>({...r,skills:k}),[r,k]),C=S.updateCount,M=S.refresh,O=S.isRefreshing,U=g.useMemo(()=>({state:T,selectSkill:h,clearSelection:x,setMode:m,setSearch:y,setMobileView:v,refreshSkills:f,updateCount:C,dismissUpdateNotification:j,updates:S.updates,outdatedByOrigin:A,isRefreshingUpdates:O,refreshUpdates:M}),[T,h,x,m,y,v,f,C,j,S.updates,A,O,M]);return n.jsx(pg.Provider,{value:U,children:a})}const xb={config:null,loading:!0};function gb(a,r){switch(r.type){case"SET_CONFIG":return{config:r.config,loading:!1};case"SET_LOADING":return{...a,loading:!0};default:return a}}const mg=g.createContext(null);function bl(){const a=g.useContext(mg);if(!a)throw new Error("useConfig must be used within ConfigProvider");return a}function vb({children:a}){const[r,i]=g.useReducer(gb,xb),o=g.useCallback(()=>{Ee.getConfig().then(f=>i({type:"SET_CONFIG",config:f})).catch(()=>{})},[]);g.useEffect(()=>{o()},[o]);const d=g.useCallback(async(f,h)=>{const x=await Ee.setConfig(f,h);return i({type:"SET_CONFIG",config:x}),x},[]),p=g.useMemo(()=>({config:r.config,loading:r.loading,updateConfig:d,refreshConfig:o}),[r,d,o]);return n.jsx(mg.Provider,{value:p,children:a})}function yb({topRail:a,sidebar:r,main:i,statusBar:o,resizeHandle:d,banner:p,liveMessage:f,sidebarWidth:h=320,sidebarHidden:x=!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:x?"1fr":"var(--sidebar-width) auto 1fr",minHeight:0,overflow:"hidden"};return n.jsxs("div",{className:"studio-shell",style:m,children:[p,n.jsx("header",{style:{borderBottom:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:a}),n.jsxs("div",{style:y,children:[!x&&n.jsx("aside",{"aria-label":"Skills sidebar",style:{minHeight:0,overflow:"hidden",borderRight:d?"none":"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",flexDirection:"column"},children:r}),!x&&d,n.jsx("main",{style:{minHeight:0,overflow:"auto",background:"var(--bg-canvas)"},children:i})]}),n.jsx("footer",{role:"contentinfo",style:{borderTop:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:o}),n.jsx("div",{"aria-live":"polite",role:"status",style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0},children:f??""})]})}var mo=fg();const bb=ug(mo),nx=["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed","ollama","lm-studio"],jb={"claude-cli":".claude",cursor:".cursor","codex-cli":".codex","gemini-cli":".gemini",copilot:".github",zed:".zed"},Sb={"claude-cli":"claude",cursor:"cursor","codex-cli":"codex","gemini-cli":"gemini"},kb={"claude-cli":"cli-install",anthropic:"api-key",openrouter:"api-key",cursor:"cli-install","codex-cli":"cli-install","gemini-cli":"cli-install",copilot:"cli-install",zed:"cli-install",ollama:"start-service","lm-studio":"start-service"},wb={"claude-cli":"subscription",anthropic:"per-token",openrouter:"per-token",cursor:"subscription","codex-cli":"subscription","gemini-cli":"subscription",copilot:"subscription",zed:"subscription",ollama:"free","lm-studio":"free"};function Cb(a,r){var h,x;const i=jb[a.id]??null,o=Sb[a.id]??null,d=i?!!((h=r==null?void 0:r.wrapperFolders)!=null&&h[i]):!1,p=o?!!((x=r==null?void 0:r.binaries)!=null&&x[o]):!0,f=a.models.map(m=>({id:m.id,displayName:m.label,billingMode:wb[a.id]??"per-token",...m.pricing?{pricing:m.pricing}:{}}));return{id:a.id,displayName:Nb(a.id,a.label),wrapperFolder:i,wrapperFolderPresent:d,binaryAvailable:p,endpointReachable:a.id==="ollama"||a.id==="lm-studio"?a.available:null,available:a.available,ctaType:a.available?null:kb[a.id]??null,models:f,resolvedModel:a.resolvedModel??null}}function Nb(a,r){return{"claude-cli":"Claude Code",anthropic:"Anthropic API",openrouter:"OpenRouter",cursor:"Cursor","codex-cli":"Codex CLI","gemini-cli":"Gemini CLI",copilot:"GitHub Copilot",zed:"Zed",ollama:"Ollama","lm-studio":"LM Studio"}[a]??r}function Eb(a){const r=new Map(a.map(o=>[o.id,o])),i=[];for(const o of nx){const d=r.get(o);d&&i.push(d)}for(const o of a)nx.includes(o.id)||i.push(o);return i}function Tb(a){const[r,i]=g.useState(null),[o,d]=g.useState("loading"),[p,f]=g.useState(null),h=g.useRef(null),x=g.useRef(0),m=g.useCallback(async()=>{try{const k=await fetch("/api/config");if(!k.ok)throw new Error(`/api/config returned ${k.status}`);const A=await k.json(),T=Eb((A.providers||[]).map(C=>Cb(C,A.detection)));i({agents:T,activeAgent:A.provider??null,activeModel:A.model??null}),d("ready"),f(null)}catch(k){d("error"),f(k.message)}},[]);g.useEffect(()=>{m()},[m]);const y=g.useCallback(async()=>{const k=Date.now();if(!(k-x.current<5*6e4))try{const A=await fetch("/api/openrouter/models");if(!A.ok)return;const T=await A.json();x.current=k,i(C=>{if(!C)return C;const M=C.agents.map(O=>{if(O.id!=="openrouter")return O;const U=T.models.map(V=>({id:V.id,displayName:V.name,contextWindow:V.contextWindow,pricing:V.pricing,billingMode:"per-token"}));return{...O,models:U,catalogAgeMs:T.ageSec?T.ageSec*1e3:0,cacheStale:!!T.stale}});return{...C,agents:M}}),T.stale&&(a!=null&&a.onStaleCatalog)&&a.onStaleCatalog("openrouter",(T.ageSec??0)*1e3)}catch{}},[a]),v=g.useCallback(k=>{h.current=k,k==="openrouter"&&y()},[y]),j=g.useCallback(()=>{x.current=0,m()},[m]),S=g.useCallback(async(k,A)=>{(await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:k,model:A})})).ok&&i(C=>C&&{...C,activeAgent:k,activeModel:A})},[]);return{status:o,catalog:r,error:p,focusAgent:v,refresh:j,activeAgentId:(r==null?void 0:r.activeAgent)??null,activeModelId:(r==null?void 0:r.activeModel)??null,setActive:S}}function Pd({variant:a,label:r,onActivate:i,installUrl:o,tooltip:d}){function p(h){if(h.stopPropagation(),a==="cli-install"&&o){window.open(o,"_blank","noopener,noreferrer");return}i()}function f(h){(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),p(h))}return n.jsx("button",{type:"button","data-testid":`locked-cta-${a}`,onClick:p,onKeyDown:f,className:"inline-flex items-center gap-1.5 px-0 py-0 text-[11px] font-medium",style:{color:"var(--accent, var(--text-primary))",background:"transparent",border:"none",cursor:"pointer"},"aria-label":r,...d?{title:d}:{},children:r})}function pu({unlocked:a=!1,size:r=10}){return a?n.jsxs("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[n.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),n.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 3.5"})]}):n.jsxs("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[n.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),n.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 4.5V7"})]})}const Rb={sectionOwn:"Own",sectionInstalled:"Installed",searchPlaceholder:"Search skills",searchShortcutHint:"Press / to search",emptyOwnHeadline:"No skills yet.",emptyOwnBody:"Run vskill new <name> to create one.",emptyInstalledHeadline:"No installed skills.",emptyInstalledBody:"Run vskill install <plugin> to add one.",emptyFilteredHeadline:"No matches in this section.",emptyFilteredBody:"Clear the search or try another query.",loadErrorHeadline:"Couldn't load skills.",loadErrorRetry:"Retry",duplicateBadge:"synced from Own",updateAvailableBadge:"Update available",countBadgeFiltered:(a,r)=>`${a} of ${r}`},Ab={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"},Mb={tabOverview:"Overview",tabVersions:"Versions",tabBenchmark:"Benchmark",emptyHeadline:"Select a skill to see details.",emptyBody:"Pick one from the sidebar.",loadErrorHeadline:a=>`Couldn't load SKILL.md for ${a}.`,loadErrorBody:"Check the file path and your workspace permissions.",openInEditor:"Open in editor",copyPath:"Copy path",copyConfigSnippet:"Copy config snippet",depNotInstalledTooltip:"Not installed",missingValue:"—",announceViewingOwn:a=>`Viewing ${a} (Own)`,announceViewingInstalled:a=>`Viewing ${a} (Installed)`,moreFields:"More fields",sourceAgent:"Source agent",noMcpDependencies:"No MCP dependencies.",filesystemGroup:"Filesystem",benchmarkGroup:"Benchmark",metadataGroup:"Frontmatter"},zb={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."},Lb={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"},Db={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"},_b={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."},Ob={disconnected:"Disconnected — reconnecting…",reconnected:"Reconnected.",loading:"Loading skills…",loadingPlaceholderCount:"—"},Bb={fieldRequired:"This field is required.",nameInvalid:"Use letters, numbers, and hyphens.",descriptionRequired:"Description is required.",saveFailed:"Save failed. Check the form for errors."},Ib={boundaryHeadline:"Something broke in this view.",boundaryBody:"Reload the page to recover.",boundaryAction:"Reload"},Hb={triggerLabel:"Agent and model",popoverTitle:"Select agent and model",footerHint:"↑↓ navigate · Enter select · Esc close",settingsButton:"Settings",keyboardShortcut:"⌘K",noModelsYet:"No models yet.",searchPlaceholder:"Search 300+ models…",noMatches:a=>`No models match "${a}"`,clearSearch:"Clear",currentlyActive:"Currently active"},Ub={claudeCli:{name:"Claude Code",caption:"Delegates to the `claude` CLI — your existing Claude Code session handles quota.",missingBinary:"Claude Code not found. Install it: `npm install -g @anthropic-ai/claude-code`. Or choose a provider with an API key.",installCta:"Install Claude Code →",installUrl:"https://docs.claude.com/en/docs/claude-code"},anthropic:{name:"Anthropic API",caption:"Direct access via your Anthropic API key.",addKeyCta:"Add API key →",keyIssuanceUrl:"https://platform.claude.com/settings/keys",keyPrefix:"sk-ant-"},openrouter:{name:"OpenRouter",caption:"300+ models from every major vendor.",addKeyCta:"Add API key →",emptyCardBody:"Add your OpenRouter API key to browse 300+ models",keyIssuanceUrl:"https://openrouter.ai/settings/keys",keyPrefix:"sk-or-"},cursor:{name:"Cursor",caption:"Cursor IDE composer.",installCta:"Install Cursor →"},codexCli:{name:"Codex CLI",caption:"OpenAI Codex CLI.",installCta:"Install Codex CLI →"},geminiCli:{name:"Gemini CLI",caption:"Google Gemini CLI.",installCta:"Install Gemini CLI →"},copilot:{name:"GitHub Copilot",caption:"GitHub Copilot CLI.",installCta:"Install Copilot →"},zed:{name:"Zed",caption:"Zed editor.",installCta:"Install Zed →"},ollama:{name:"Ollama",caption:"Local models, free.",startServiceCta:"Start service →"},lmStudio:{name:"LM Studio",caption:"Local models, free.",startServiceCta:"Start LM Studio server →",startServiceTooltip:"Open LM Studio → Developer tab → Start Server (default port 1234)."}},Vb={subscriptionBilling:"· subscription",free:"· free"},$b={title:"Settings",sectionApiKeys:"API Keys",sectionStorage:"Storage",banner:"Keys are stored locally on this device only. Never synced, never committed to git, never transmitted off-device except to the provider's own API.",storageBrowser:"Browser storage (default)",storageKeychain:"macOS Keychain (recommended)",storageDarwinOnly:"macOS Keychain is only available on macOS",show:"Show",hide:"Hide",paste:"Paste",save:"Save",remove:"Remove",removeConfirm:a=>`Remove ${a} API key?`,keyStoredAt:a=>`Key stored locally — updated ${a}`,noKey:"No key stored",enterNonEmpty:"Enter a non-empty key",prefixWarn:a=>`This doesn't look like a typical ${a} key. Save anyway?`,keySaved:a=>`${a} API key saved (local only, never synced)`,keyRemoved:a=>`${a} API key removed`},Pb={providersLabel:"Providers",providerSummary:(a,r)=>`${a}/${r} providers`,locked:a=>`${a} — locked. Click to add a key.`,lockedCli:a=>`${a} — locked. Click for install instructions.`,unlocked:a=>`${a} — unlocked.`},Gb={triggerAriaLabel:"Choose active agent for the sidebar",popoverTitle:"Choose active agent",statsInstalled:"Installed",statsGlobal:"Global",statsLastSync:"Last sync",statsHealthOk:"Fresh",statsHealthStale:"Updates available",statsHealthMissing:"Not detected",switchCta:"Switch for this studio session",notDetectedSubheading:"Not detected",setUpCta:a=>`Set up ${a}`,sharedFolderBanner:a=>`Shared folder — consumed by ${a}`},Fb={ownLabel:"Own",installedLabel:"Installed",globalLabel:"Global",emptyOwn:"No authored skills — run vskill new.",emptyInstalled:a=>`No skills installed for ${a} in this project — run vskill install.`,emptyGlobal:a=>`No global skills for ${a} — run vskill install --global.`},qb={compactLabel:"Covered by Max/Pro · overflow billed at API rates",tooltip:"Your Claude Code CLI usage runs under your Pro/Max subscription quota. If you've enabled extra usage in your account settings, excess usage continues at standard API rates. Run /usage in Claude Code or visit claude.com Settings → Usage to see remaining quota — vskill can't display it directly.",firstUseBanner:"Claude Code uses your Pro/Max subscription. No API key needed — vskill just runs the official claude binary on your behalf.",learnMore:"Learn more"},Yb={title:a=>`Set up ${a}`,close:"Close",copy:"Copy",copied:"Copied",requiredEnv:"Required env vars",getKey:"Get a key",installRun:"Install & run",learnMore:"Learn more",fallbackTitle:"No setup guide available",fallbackBody:"We don't ship a setup guide for this provider yet."},Wb={groupAvailable:"Available",groupAuthoring:"Authoring",sourceProject:"Project",sourcePersonal:"Personal",sourcePlugin:"Plugins",authoringSkills:"Skills"},Kb={anthropic:{name:"Anthropic API",description:"Direct API access to Claude via your Anthropic API key. Pay-per-token billing.",envVars:["ANTHROPIC_API_KEY"],keyUrl:"https://platform.claude.com/settings/keys",learnMoreUrl:"https://docs.claude.com/en/docs/get-started"},openai:{name:"OpenAI",description:"Access to GPT-4, GPT-5 and the o-series reasoning models via your OpenAI API key.",envVars:["OPENAI_API_KEY"],keyUrl:"https://platform.openai.com/api-keys",learnMoreUrl:"https://platform.openai.com/docs"},openrouter:{name:"OpenRouter",description:"One API key, 300+ models from Anthropic, OpenAI, Google, Meta, and more.",envVars:["OPENROUTER_API_KEY"],keyUrl:"https://openrouter.ai/keys",learnMoreUrl:"https://openrouter.ai/docs"},gemini:{name:"Gemini",description:"Google Gemini models (2.5 Pro, Flash) via Google AI Studio. Free tier available.",envVars:["GEMINI_API_KEY"],keyUrl:"https://aistudio.google.com/apikey",learnMoreUrl:"https://ai.google.dev/gemini-api/docs"},ollama:{name:"Ollama",description:"Local models on your own machine. Zero external calls, zero cost after download.",envVars:["OLLAMA_HOST"],installCmd:"curl -fsSL https://ollama.com/install.sh | sh",startCmd:"ollama serve",pullExample:"ollama pull llama3.2",learnMoreUrl:"https://ollama.com/download"},lmStudio:{name:"LM Studio",description:"Desktop app + local server for running open models with a GUI. Compatible with the OpenAI API.",envVars:["LM_STUDIO_BASE_URL"],installCmd:"Download from https://lmstudio.ai and launch the app, then start the local server.",startCmd:"# In LM Studio: Developer → Start Server (default port 1234)",pullExample:"# In LM Studio: Discover → download any GGUF model",learnMoreUrl:"https://lmstudio.ai/docs"},claudeCode:{name:"Claude Code",description:"No API key needed if you're logged into Claude Code. vskill just runs the official claude binary on your behalf under your Pro/Max subscription.",loginHint:"If you're not logged in, run claude in your terminal and authenticate with your Pro/Max account.",learnMoreUrl:"https://docs.claude.com/en/docs/claude-code"}},J={sidebar:Rb,shell:Ab,detail:Mb,actions:zb,palette:Lb,shortcuts:Db,toasts:_b,connection:Ob,forms:Bb,errors:Ib,picker:Hb,providers:Ub,models:Vb,settings:$b,statusBar:Pb,scopePicker:Gb,scopeSection:Fb,claudeCodeLabel:qb,setupDrawer:Yb,setupProviders:Kb,scopeLabels:Wb},ax=new Set(["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed"]);function Xb({agents:a,activeAgentId:r,focusedAgentId:i,onFocus:o,onSelect:d,onOpenSettings:p}){const f=a.filter(x=>ax.has(x.id)),h=a.filter(x=>!ax.has(x.id));return n.jsxs("div",{role:"listbox","aria-label":"Agent","data-testid":"agent-list",style:{width:240,borderRight:"1px solid var(--border-default, var(--border-subtle))",display:"flex",flexDirection:"column",overflowY:"auto"},children:[f.map(x=>n.jsx(lx,{agent:x,isActive:x.id===r,isFocused:x.id===i,onFocus:o,onSelect:d,onOpenSettings:p},x.id)),h.length>0&&n.jsx("div",{style:{borderTop:"1px solid var(--border-default, var(--border-subtle))",margin:"4px 0"},"aria-hidden":"true"}),h.map(x=>n.jsx(lx,{agent:x,isActive:x.id===r,isFocused:x.id===i,onFocus:o,onSelect:d,onOpenSettings:p},x.id))]})}function lx({agent:a,isActive:r,isFocused:i,onFocus:o,onSelect:d,onOpenSettings:p}){const{providers:f}=J,h={"claude-cli":f.claudeCli.caption,anthropic:f.anthropic.caption,openrouter:f.openrouter.caption},x={"claude-cli":{label:f.claudeCli.installCta,url:f.claudeCli.installUrl},cursor:{label:f.cursor.installCta},"codex-cli":{label:f.codexCli.installCta},"gemini-cli":{label:f.geminiCli.installCta},copilot:{label:f.copilot.installCta},zed:{label:f.zed.installCta}},m=a.id==="claude-cli"||a.id==="claude-code",y={minHeight:36,height:m?"auto":36,padding:m?"6px 12px":"0 12px",display:"flex",alignItems:"center",gap:8,cursor:"pointer",position:"relative",background:i?"var(--surface-muted, var(--surface-3))":"transparent",borderLeft:r?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",fontSize:13,fontWeight:r?500:400,color:"var(--text-primary)"};return r&&(y.background="color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)"),n.jsxs("div",{role:"option","aria-selected":r,"data-testid":`agent-row-${a.id}`,"data-focused":i||void 0,tabIndex:i?0:-1,onMouseEnter:()=>o(a.id),onFocus:()=>o(a.id),onClick:()=>d(a.id),style:y,children:[a.wrapperFolder&&n.jsx("span",{"data-testid":`wrapper-dot-${a.id}`,"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",flexShrink:0,background:a.wrapperFolderPresent?"var(--accent, var(--color-accent))":"transparent",border:a.wrapperFolderPresent?"none":"1px solid var(--border-default, var(--border-subtle))"}}),!a.wrapperFolder&&n.jsx("span",{style:{width:6,height:6,flexShrink:0},"aria-hidden":"true"}),n.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[n.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.displayName}),(a.id==="claude-cli"||a.id==="claude-code")&&n.jsx("span",{"data-testid":"claude-code-billing-label",title:J.claudeCodeLabel.tooltip,style:{fontSize:10,color:"var(--text-secondary, var(--text-tertiary))",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:1},children:J.claudeCodeLabel.compactLabel})]}),n.jsx("span",{"aria-label":a.available?"available":"locked",style:{color:a.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0},children:a.available?n.jsx(pu,{unlocked:!0,size:10}):n.jsx(pu,{size:10})}),r&&n.jsx("span",{style:{fontSize:10,textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600,color:"var(--accent-ink, var(--accent))",flexShrink:0},"data-testid":`active-badge-${a.id}`,children:J.picker.currentlyActive}),!a.available&&a.ctaType==="api-key"&&n.jsx(Pd,{variant:"api-key",label:a.id==="anthropic"?f.anthropic.addKeyCta:f.openrouter.addKeyCta,onActivate:()=>p(a.id)}),!a.available&&a.ctaType==="cli-install"&&x[a.id]&&n.jsx(Pd,{variant:"cli-install",label:x[a.id].label,installUrl:x[a.id].url,onActivate:()=>{}}),!a.available&&a.ctaType==="start-service"&&n.jsx(Pd,{variant:"start-service",label:a.id==="ollama"?f.ollama.startServiceCta:f.lmStudio.startServiceCta,tooltip:a.id==="lm-studio"?f.lmStudio.startServiceTooltip:void 0,onActivate:()=>p(a.id)}),h[a.id]&&n.jsx("span",{className:"sr-only","data-testid":`caption-${a.id}`,children:h[a.id]})]})}function Qb(a,r,i,o){const f=a>=80,h=g.useRef(null),[x,m]=g.useState(0),y=g.useCallback(S=>{m(S.currentTarget.scrollTop)},[]),{visibleStart:v,visibleEnd:j}=g.useMemo(()=>{if(!f)return{visibleStart:0,visibleEnd:a};const S=Math.max(0,Math.floor(x/r)-4),k=Math.ceil(i/r)+8,A=Math.min(a,S+k);return{visibleStart:S,visibleEnd:A}},[f,x,r,i,a,4]);return{visibleStart:v,visibleEnd:j,totalHeight:a*r,offsetTop:v*r,virtualised:f,containerProps:{onScroll:y,ref:h,style:{overflowY:"auto",maxHeight:i,willChange:f?"transform":void 0}}}}const hg=44,Zb=352,Jb=60;function e0(a){var p,f;const r=a.contextWindow?a.contextWindow>=1e6?`${Math.round(a.contextWindow/1e6)}M`:a.contextWindow>=1e3?`${Math.round(a.contextWindow/1e3)}k`:String(a.contextWindow):null;if(a.billingMode==="subscription")return r?`${r} ctx ${J.models.subscriptionBilling}`:J.models.subscriptionBilling.trim();if(a.billingMode==="free")return r?`local · ${r} ctx · free`:"local · free";const i=((p=a.pricing)==null?void 0:p.prompt)??0,o=((f=a.pricing)==null?void 0:f.completion)??0,d=`$${i.toFixed(2)} / $${o.toFixed(2)} per 1M tokens`;return r?`${r} ctx · ${d}`:d}function t0(a,r){if(!r)return a;const i=r.toLowerCase();return a.filter(d=>d.displayName.toLowerCase().includes(i)).sort((d,p)=>{const f=d.displayName.toLowerCase().indexOf(i),h=p.displayName.toLowerCase().indexOf(i);return f!==h?f-h:d.displayName.length-p.displayName.length})}function n0({agent:a,activeModelId:r,onSelect:i,onOpenSettings:o}){const[d,p]=g.useState(""),[f,h]=g.useState(""),x=g.useRef(null);if(g.useEffect(()=>{const v=setTimeout(()=>h(d),Jb);return()=>clearTimeout(v)},[d]),g.useEffect(()=>{a.id==="openrouter"&&a.available&&x.current&&x.current.focus()},[a.id,a.available]),a.id==="openrouter"&&!a.available)return n.jsxs("div",{"data-testid":"openrouter-empty-card",style:{width:360,padding:20,display:"flex",flexDirection:"column",gap:12},children:[n.jsx("p",{style:{margin:0,color:"var(--text-primary)",fontSize:13,lineHeight:1.5},children:J.providers.openrouter.emptyCardBody}),n.jsx("button",{type:"button",onClick:()=>o("openrouter"),style:{alignSelf:"flex-start",padding:"6px 10px",borderRadius:6,background:"var(--accent, var(--color-accent))",color:"var(--bg-surface, white)",border:"none",fontSize:12,fontWeight:500,cursor:"pointer"},children:J.providers.openrouter.addKeyCta})]});const m=g.useMemo(()=>t0(a.models,f),[a.models,f]),y=Qb(m.length,hg,Zb);return n.jsxs("div",{role:"listbox","aria-label":"Model","data-testid":"model-list",style:{width:360,display:"flex",flexDirection:"column"},children:[a.id==="openrouter"&&n.jsx("div",{style:{padding:8,borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:n.jsx("input",{ref:x,type:"text",placeholder:J.picker.searchPlaceholder,value:d,onChange:v=>p(v.target.value),"data-testid":"model-search-input","aria-label":J.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"}})}),m.length===0&&f?n.jsxs("div",{style:{padding:16},"data-testid":"no-matches",children:[n.jsx("div",{style:{color:"var(--text-muted, var(--text-tertiary))",fontSize:12,marginBottom:8},children:J.picker.noMatches(f)}),n.jsx("button",{type:"button",onClick:()=>p(""),style:{padding:"4px 8px",background:"transparent",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:J.picker.clearSearch})]}):m.length===0?n.jsx("div",{style:{padding:16,color:"var(--text-muted, var(--text-tertiary))",fontSize:12},children:J.picker.noModelsYet}):n.jsx("div",{...y.containerProps,children:n.jsx("div",{style:{height:y.virtualised?y.totalHeight:"auto",position:"relative"},children:n.jsx("div",{style:{transform:y.virtualised?`translateY(${y.offsetTop}px)`:void 0},children:m.slice(y.visibleStart,y.visibleEnd).map(v=>n.jsx(a0,{model:v,isActive:v.id===r,onSelect:()=>i(v.id),resolvedModel:a.id==="claude-cli"?a.resolvedModel??null:null},v.id))})})})]})}function a0({model:a,isActive:r,onSelect:i,resolvedModel:o}){const d=e0(a);return n.jsxs("button",{type:"button",role:"option","aria-selected":r,"data-testid":`model-row-${a.id}`,onClick:i,title:a.id,style:{width:"100%",height:hg,padding:"4px 12px",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:2,background:r?"color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)":"transparent",borderLeft:r?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",cursor:"pointer",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",textAlign:"left"},children:[n.jsx("span",{style:{fontSize:14,fontWeight:500,color:"var(--text-primary)"},children:a.displayName}),n.jsx("span",{style:{fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace",fontVariantNumeric:"tabular-nums",color:"var(--text-muted, var(--text-tertiary))"},children:d}),o&&n.jsxs("span",{"data-testid":`model-row-${a.id}-resolved`,style:{fontSize:11,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace",color:"var(--text-muted, var(--text-tertiary))"},children:["routing to ",o]})]})}const rx={anthropic:{stored:!1,updatedAt:null,tier:"browser"},openrouter:{stored:!1,updatedAt:null,tier:"browser"}};function l0(){const[a,r]=g.useState(null),[i,o]=g.useState(!0),[d,p]=g.useState(null),f=g.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({...rx,...y}),p(null)}catch(m){p(m.message),r(rx)}finally{o(!1)}},[]);g.useEffect(()=>{f()},[f]);const h=g.useCallback(async(m,y,v="browser")=>{const j=await fetch("/api/settings/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:m,key:y,tier:v})});if(!j.ok){const k=await j.json().catch(()=>({error:j.statusText}));throw new Error(k.error||`POST /api/settings/keys returned ${j.status}`)}const S=await j.json();return await f(),S},[f]),x=g.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 f()},[f]);return{state:a,loading:i,error:d,save:h,remove:x,refresh:f}}const r0=[{id:"anthropic",name:J.providers.anthropic.name,keyIssuanceUrl:J.providers.anthropic.keyIssuanceUrl,prefix:J.providers.anthropic.keyPrefix},{id:"openrouter",name:J.providers.openrouter.name,keyIssuanceUrl:J.providers.openrouter.keyIssuanceUrl,prefix:J.providers.openrouter.keyPrefix}];function s0(){return typeof navigator>"u"?!1:/Mac|iPhone|iPad/.test(navigator.platform)}function i0(a){const r=Date.now()-new Date(a).getTime();return r<6e4?"just now":r<36e5?`${Math.round(r/6e4)}m ago`:r<864e5?`${Math.round(r/36e5)}h ago`:new Date(a).toLocaleString()}function o0({open:a,onClose:r,initialProvider:i,onToast:o}){const{state:d,save:p,remove:f}=l0(),[h,x]=g.useState("browser"),m=g.useRef(null),y=g.useRef(null),[v,j]=g.useState(i??"anthropic");if(g.useEffect(()=>{if(!a)return;const k=document.activeElement,A=setTimeout(()=>{var M;const T=i?`input[data-provider="${i}"]`:"input[data-provider]",C=(M=m.current)==null?void 0:M.querySelector(T);C==null||C.focus()},0);return()=>{var T;clearTimeout(A),(T=k==null?void 0:k.focus)==null||T.call(k)}},[a,i]),g.useEffect(()=>{if(!a)return;const k=A=>{if(A.key==="Escape"){A.preventDefault(),r();return}if(A.key==="Tab"&&m.current){const T=m.current.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(T.length===0)return;const C=T[0],M=T[T.length-1];A.shiftKey&&document.activeElement===C?(A.preventDefault(),M.focus()):!A.shiftKey&&document.activeElement===M&&(A.preventDefault(),C.focus())}};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[a,r]),!a)return null;const S=s0();return n.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"settings-modal-title","data-testid":"settings-modal",style:{position:"fixed",inset:0,background:"color-mix(in srgb, black 40%, transparent)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},onClick:k=>{k.target===k.currentTarget&&r()},children:n.jsxs("div",{ref:m,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:[n.jsx("h2",{id:"settings-modal-title",style:{margin:"0 0 16px 0",fontSize:16,fontWeight:600},children:J.settings.title}),n.jsx("div",{role:"note","data-testid":"settings-banner",style:{padding:"8px 12px",borderRadius:6,background:"color-mix(in srgb, var(--info, var(--accent-muted)) 20%, transparent)",color:"var(--text-primary)",fontSize:12,marginBottom:16},children:J.settings.banner}),n.jsxs("section",{"aria-labelledby":"settings-api-keys-title",style:{marginBottom:20},children:[n.jsx("h3",{id:"settings-api-keys-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:J.settings.sectionApiKeys}),r0.map(k=>n.jsx(c0,{providerId:k.id,providerName:k.name,keyIssuanceUrl:k.keyIssuanceUrl,prefix:k.prefix,metadata:d==null?void 0:d[k.id],tier:h,onSave:async A=>{const T=await p(k.id,A,h);return o==null||o(J.settings.keySaved(k.name)),T},onRemove:async()=>{await f(k.id),o==null||o(J.settings.keyRemoved(k.name))},inputRef:k.id===(i??"anthropic")?y:void 0},k.id))]}),n.jsxs("section",{"aria-labelledby":"settings-storage-title",children:[n.jsx("h3",{id:"settings-storage-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:J.settings.sectionStorage}),S?n.jsxs("fieldset",{style:{border:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:6},children:[n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[n.jsx("input",{type:"radio",name:"storage-tier",value:"browser",checked:h==="browser",onChange:()=>x("browser")}),J.settings.storageBrowser]}),n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[n.jsx("input",{type:"radio",name:"storage-tier",value:"keychain",checked:h==="keychain",onChange:()=>x("keychain")}),J.settings.storageKeychain]})]}):n.jsxs("div",{style:{fontSize:12,color:"var(--text-muted, var(--text-tertiary))"},children:[J.settings.storageBrowser,n.jsxs("span",{title:J.settings.storageDarwinOnly,style:{marginLeft:8},children:["(",J.settings.storageDarwinOnly,")"]})]})]}),n.jsx("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end"},children:n.jsx("button",{type:"button",onClick:r,style:{padding:"6px 12px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:"Close"})})]})})}function c0({providerId:a,providerName:r,keyIssuanceUrl:i,prefix:o,metadata:d,onSave:p,onRemove:f,inputRef:h}){const[x,m]=g.useState(""),[y,v]=g.useState(!1),[j,S]=g.useState(!1),[k,A]=g.useState(!1),[T,C]=g.useState(null),M=x.trim(),O=M.length===0,U=M.length>0&&!M.startsWith(o),L=g.useCallback(async()=>{if(!O){S(!0);try{const D=await p(M);D.warning?C(D.warning):C(null),m("")}finally{S(!1)}}},[O,p,M]),V=g.useCallback(async()=>{var D;try{if(!((D=navigator.clipboard)!=null&&D.readText))return;const E=await navigator.clipboard.readText();m(E)}catch{}},[]),w=g.useCallback(async()=>{A(!1),await f()},[f]);return n.jsxs("div",{"data-testid":`provider-row-${a}`,style:{padding:12,border:"1px solid var(--border-subtle)",borderRadius:6,marginBottom:8,display:"flex",flexDirection:"column",gap:8},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[n.jsx("strong",{style:{fontSize:13},children:r}),n.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",style:{fontSize:12,color:"var(--accent, var(--color-accent))"},children:"Get a key →"})]}),n.jsxs("div",{style:{display:"flex",gap:6},children:[n.jsx("input",{ref:h,type:y?"text":"password",value:x,onChange:D=>{m(D.target.value),C(null)},"data-provider":a,placeholder:`Paste ${r} key`,style:{flex:1,padding:"6px 8px",border:"1px solid var(--border-subtle)",borderRadius:4,background:"var(--surface-2, var(--bg-surface))",color:"var(--text-primary)",fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"}}),n.jsx("button",{type:"button",onClick:()=>v(!y),style:ir,children:y?J.settings.hide:J.settings.show}),n.jsx("button",{type:"button",onClick:V,style:ir,children:J.settings.paste})]}),O&&x.length>0&&n.jsx("div",{role:"status",style:d0,children:J.settings.enterNonEmpty}),U&&n.jsx("div",{role:"status","data-testid":`prefix-warn-${a}`,style:sx,children:J.settings.prefixWarn(r)}),T&&n.jsx("div",{role:"status",style:sx,children:T}),n.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[n.jsx("button",{type:"button",onClick:L,disabled:O||j,"data-testid":`save-${a}`,style:{...ir,background:O?"var(--surface-2)":"var(--accent, var(--color-accent))",color:O?"var(--text-muted)":"white",cursor:O?"not-allowed":"pointer"},children:J.settings.save}),(d==null?void 0:d.stored)&&n.jsx(n.Fragment,{children:k?n.jsxs(n.Fragment,{children:[n.jsx("span",{style:{fontSize:12},children:J.settings.removeConfirm(r)}),n.jsx("button",{type:"button",onClick:w,"data-testid":`remove-confirm-${a}`,style:{...ir,background:"var(--danger, #b33)",color:"white"},children:"Confirm"}),n.jsx("button",{type:"button",onClick:()=>A(!1),style:ir,children:"Cancel"})]}):n.jsx("button",{type:"button",onClick:()=>A(!0),"data-testid":`remove-${a}`,style:{...ir,color:"var(--text-muted)"},children:J.settings.remove})}),n.jsx("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},"data-testid":`status-${a}`,children:d!=null&&d.stored&&d.updatedAt?J.settings.keyStoredAt(i0(d.updatedAt)):J.settings.noKey})]})]})}const ir={padding:"4px 8px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},d0={fontSize:11,color:"var(--danger, #b33)"},sx={fontSize:11,color:"var(--warning, var(--text-muted))"};function u0(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function f0({onToast:a}){const{status:r,catalog:i,focusAgent:o,setActive:d}=Tb({onStaleCatalog:(D,E)=>{const B=Math.round(E/6e4);a==null||a(`Using cached ${D} catalog (${B} min old)`)}}),[p,f]=g.useState(!1),[h,x]=g.useState(!1),[m,y]=g.useState(),[v,j]=g.useState(null),[S,k]=g.useState("agents"),A=g.useRef(null);g.useRef(null),g.useEffect(()=>{var D;i&&!v&&j(i.activeAgent??((D=i.agents[0])==null?void 0:D.id)??null)},[i,v]);const T=(i==null?void 0:i.agents)??[],C=g.useMemo(()=>T.find(D=>D.id===v)??T[0],[T,v]),M=g.useCallback(()=>{var D;f(!0),k("agents"),j((i==null?void 0:i.activeAgent)??((D=T[0])==null?void 0:D.id)??null)},[i,T]),O=g.useCallback(()=>{var D;f(!1),(D=A.current)==null||D.focus()},[]);g.useEffect(()=>{const D=E=>{var P;if(!(E.metaKey||E.ctrlKey)||E.key.toLowerCase()!=="k")return;const B=(P=document.activeElement)==null?void 0:P.tagName;B==="INPUT"||B==="TEXTAREA"||(E.preventDefault(),f(F=>!F))};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[]),g.useEffect(()=>{if(!p)return;const D=B=>{if(B.key==="Escape"){B.preventDefault(),O();return}if(B.key==="ArrowDown"){B.preventDefault(),E(1);return}if(B.key==="ArrowUp"){B.preventDefault(),E(-1);return}if(B.key==="ArrowRight"&&S==="agents"){B.preventDefault(),k("models");return}if(B.key==="ArrowLeft"&&S==="models"){B.preventDefault(),k("agents");return}if(B.key==="Enter"){B.preventDefault(),S==="agents"&&C?k("models"):S==="models"&&C&&C.models[0]&&(d(C.id,C.models[0].id),O());return}};function E(B){if(S==="agents"){const P=T.findIndex(te=>te.id===v),F=T[Math.max(0,Math.min(T.length-1,P+B))];F&&(j(F.id),o(F.id))}}return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[p,S,T,v,C,O,o,d]);const U=g.useCallback(D=>{y(D==="anthropic"||D==="openrouter"?D:void 0),x(!0),f(!1)},[]),L=T.find(D=>D.id===(i==null?void 0:i.activeAgent)),V=L==null?void 0:L.models.find(D=>D.id===(i==null?void 0:i.activeModel)),w=g.useMemo(()=>{if(r!=="ready"||!i)return"Loading…";const D=(L==null?void 0:L.displayName)??"Agent",E=(V==null?void 0:V.displayName)??i.activeModel??"Model";return`${D} · ${E}`},[r,i,L,V]);return n.jsxs(n.Fragment,{children:[n.jsxs("button",{ref:A,type:"button","data-testid":"agent-model-picker-trigger",onClick:()=>p?O():M(),"aria-haspopup":"listbox","aria-expanded":p,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 10px",background:"var(--surface-2, var(--bg-surface))",border:"1px solid var(--border-subtle)",borderRadius:6,color:"var(--text-primary)",fontSize:12,cursor:"pointer",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:L!=null&&L.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0}}),n.jsx("span",{children:w})]}),p&&typeof document<"u"&&mo.createPortal(n.jsxs(p0,{reducedMotion:u0(),onClickOutside:O,children:[n.jsxs("div",{style:{display:"flex",height:440,maxHeight:"60vh"},children:[n.jsx(Xb,{agents:T,activeAgentId:(i==null?void 0:i.activeAgent)??null,focusedAgentId:v,onFocus:D=>{j(D),o(D)},onSelect:D=>{j(D),o(D),k("models")},onOpenSettings:U}),C&&n.jsx(n0,{agent:C,activeModelId:(i==null?void 0:i.activeModel)??null,onSelect:D=>{d(C.id,D),O()},onOpenSettings:U})]}),n.jsxs("div",{style:{height:32,borderTop:"1px solid var(--border-default, var(--border-subtle))",padding:"0 12px",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},children:[n.jsx("button",{type:"button",onClick:()=>U(),"data-testid":"picker-footer-settings",style:{background:"transparent",border:"none",color:"var(--text-primary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:J.picker.settingsButton}),n.jsx("span",{style:{fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"},children:J.picker.footerHint})]})]}),document.body),n.jsx(o0,{open:h,onClose:()=>x(!1),initialProvider:m,onToast:a})]})}function p0({children:a,reducedMotion:r,onClickOutside:i}){const o=g.useRef(null);return g.useEffect(()=>{const d=p=>{o.current&&!o.current.contains(p.target)&&i()};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[i]),n.jsxs("div",{ref:o,"data-testid":"agent-model-picker-popover",role:"dialog","aria-label":"Select agent and model",style:{position:"fixed",top:56,left:"50%",transform:"translateX(-50%)",width:600,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,overflow:"hidden",zIndex:90,animation:r?void 0:"agentPickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[a,n.jsx("style",{children:`@keyframes agentPickerFadeIn {
|
|
52
52
|
from { opacity: 0; transform: translateX(-50%) translateY(2px); }
|
|
53
53
|
to { opacity: 1; transform: translateX(-50%) translateY(0); }
|
|
54
|
-
}`})]})}function ix(){typeof window>"u"||(window.location.hash="#/")}function m0({onHome:a}){const[r,i]=g.useState(!1),[o,d]=g.useState(!1),p=h=>{h.metaKey||h.ctrlKey||h.shiftKey||h.button!==0||(h.preventDefault(),ix(),a==null||a())},f=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),ix(),a==null||a())};return n.jsxs("a",{href:"#/",role:"link","data-testid":"studio-logo","aria-label":"Skill Studio — home",onClick:p,onKeyDown:f,onFocus:()=>i(!0),onBlur:()=>i(!1),onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{display:"inline-flex",alignItems:"center",gap:10,flexShrink:0,padding:"4px 6px",margin:"-4px -6px",borderRadius:6,textDecoration:"none",color:"inherit",cursor:"pointer",outline:r?"2px solid var(--border-focus)":"none",outlineOffset:2,background:o?"color-mix(in srgb, var(--text-primary) 4%, transparent)":"transparent",transition:"background-color var(--duration-fast, 120ms) var(--ease-standard, ease)"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:6,background:"color-mix(in srgb, var(--accent-surface) 20%, transparent)"},children:n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent-surface)",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}),n.jsx("span",{style:{fontSize:13,fontWeight:600,letterSpacing:"-0.01em",color:"var(--text-primary)"},children:"Skill Studio"})]})}const h0="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",x0=g.lazy(()=>Tu(()=>import("./UpdateDropdown-Cx3XWMAn.js"),__vite__mapDeps([0,1])));function g0(){const{updateCount:a,updates:r,isRefreshingUpdates:i,refreshUpdates:o,selectSkill:d}=ya(),[p,f]=g.useState(!1),h=g.useRef(null),x=g.useCallback(()=>f(!1),[]),m=a>0?"var(--text-primary)":"var(--text-secondary)",y=a>9?"9+":String(a),v=a===0?"No updates available":`${a} updates available, open summary`;return n.jsxs("span",{"data-testid":"update-bell-anchor",style:{position:"relative",display:"inline-flex"},children:[n.jsxs("button",{ref:h,type:"button","data-testid":"update-bell","aria-label":v,"aria-haspopup":"dialog","aria-expanded":p,onClick:()=>f(j=>!j),style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",height:26,width:26,padding:0,borderRadius:4,border:"1px solid transparent",background:"transparent",color:m,cursor:"pointer"},children:[n.jsx("img",{src:h0,alt:"",width:18,height:18,style:{display:"block",opacity:a>0?1:.75}}),a>0&&n.jsx("span",{"data-testid":"update-bell-badge","aria-hidden":"true",style:{position:"absolute",top:-2,right:-2,minWidth:14,height:14,padding:"0 3px",borderRadius:999,background:"var(--color-own)",color:"var(--color-paper)",fontSize:9,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:600,lineHeight:1},children:y})]}),p&&n.jsx(g.Suspense,{fallback:n.jsx("span",{"data-testid":"update-bell-fallback",children:"Loading…"}),children:n.jsx(x0,{updates:r,isRefreshing:i,onRefresh:()=>o(),onSelectSkill:j=>{const S=j.name.split("/"),k=S.length>=2?S[S.length-2]:S[0],A=S[S.length-1];d({plugin:k,skill:A,origin:"installed"}),x()},onViewAll:()=>{window.location.hash="#/updates",x()},onClose:x,anchorRef:h})})]})}function ox(a){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:navigate-scope",{detail:a}))}function v0({projectName:a,selected:r,onOpenPalette:i,onHome:o,projectPickerSlot:d,onRequestCreateSkill:p}){const f=r?r.origin==="installed"?"Project":"Skills":null;return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,height:"100%",width:"100%",padding:"0 16px",fontFamily:"var(--font-sans)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexShrink:0},children:[n.jsx(m0,{onHome:o}),d?n.jsx("div",{style:{borderLeft:"1px solid var(--border-default)",paddingLeft:10,display:"flex",alignItems:"center"},children:d}):a&&n.jsx("span",{title:a,style:{fontSize:12,color:"var(--text-secondary)",borderLeft:"1px solid var(--border-default)",paddingLeft:10,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a})]}),n.jsx("nav",{"aria-label":"Breadcrumb",style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:6,fontSize:12,color:"var(--text-secondary)"},children:r&&f&&n.jsxs(n.Fragment,{children:[n.jsx(cx,{segment:"origin",onClick:()=>ox({scope:"origin",origin:r.origin}),style:{textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:r.origin==="installed"?"var(--status-installed)":"var(--status-own)"},children:f}),n.jsx(dx,{}),n.jsx(cx,{segment:"plugin",onClick:()=>ox({scope:"plugin",plugin:r.plugin}),style:{fontFamily:"var(--font-mono)",fontSize:11},children:r.plugin}),n.jsx(dx,{}),n.jsx("span",{"data-breadcrumb-segment":"skill","aria-current":"page",style:{color:"var(--text-primary)",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.skill})]})}),n.jsxs("div",{"data-toprail-right":"true",style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[p&&n.jsxs("button",{type:"button","data-slot":"create-skill-button",onClick:p,"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:[n.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:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"New Skill"]}),n.jsx("span",{"data-slot":"agent-model-picker",style:{minWidth:200},children:n.jsx(f0,{})}),n.jsx("span",{"data-slot":"update-bell",style:{display:"inline-flex"},children:n.jsx(g0,{})}),n.jsx("button",{type:"button",onClick:i,"aria-label":"Open command palette",title:"Command palette (⌘K)",style:{display:"inline-flex",alignItems:"center",gap:6,height:26,padding:"0 10px",borderRadius:4,border:"1px solid var(--border-default)",background:"transparent",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono)",cursor:"pointer"},children:n.jsx("span",{children:"⌘K"})})]})]})}function cx({segment:a,onClick:r,style:i,children:o}){return n.jsx("button",{type:"button","data-breadcrumb-segment":a,onClick:r,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",color:"var(--text-secondary)",fontFamily:"inherit",...i},onMouseEnter:d=>{d.currentTarget.style.color="var(--color-accent-ink)"},onMouseLeave:d=>{const p=(i==null?void 0:i.color)??"var(--text-secondary)";d.currentTarget.style.color=p},children:o})}function dx(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)",fontSize:10},children:"›"})}const ho="vskill-theme";function xg(a){return a==="light"||a==="dark"||a==="auto"?a:"auto"}function y0(a,r){return a==="light"||a==="dark"?a:r?"dark":"light"}function b0(a){try{const r=a.getItem(ho);return xg(r)}catch{return"auto"}}function j0(a,r){try{a.setItem(ho,r)}catch{}}function S0(a,r,i){a.dataset.theme=i,a.dataset.themeMode=r}function k0(a){if(!a)return!1;try{return a("(prefers-color-scheme: dark)").matches}catch{return!1}}const gg=g.createContext(null);function w0({storage:a,matchMedia:r,target:i,children:o}){const d=a??(typeof window<"u"?window.localStorage:void 0),p=r??(typeof window<"u"?window.matchMedia.bind(window):void 0),f=i??(typeof document<"u"?document.documentElement:void 0),[h,x]=g.useState(()=>d?b0(d):"auto"),[m,y]=g.useState(()=>k0(p)),v=g.useMemo(()=>y0(h,m),[h,m]);g.useEffect(()=>{f&&S0(f,h,v)},[f,h,v]),g.useEffect(()=>{if(!p)return;const k=p("(prefers-color-scheme: dark)"),A=C=>y(C.matches);if(typeof k.addEventListener=="function")return k.addEventListener("change",A),()=>k.removeEventListener("change",A);const T=k;return T.addListener(A),()=>T.removeListener(A)},[p]),g.useEffect(()=>{if(typeof window>"u")return;const k=A=>{A.key===ho&&x(xg(A.newValue))};return window.addEventListener("storage",k),()=>window.removeEventListener("storage",k)},[]),g.useEffect(()=>{if(!p||!f)return;let k;try{k=p("(prefers-contrast: more)")}catch{return}const A=M=>{M?f.dataset.contrast="more":f.dataset.contrast==="more"&&delete f.dataset.contrast};A(k.matches);const T=M=>A(M.matches);if(typeof k.addEventListener=="function")return k.addEventListener("change",T),()=>k.removeEventListener("change",T);const C=k;return C.addListener(T),()=>C.removeListener(T)},[p,f]);const j=g.useCallback(k=>{x(k),d&&j0(d,k)},[d]),S=g.useMemo(()=>({mode:h,resolvedTheme:v,setTheme:j}),[h,v,j]);return n.jsx(gg.Provider,{value:S,children:o})}function vg(){const a=g.useContext(gg);if(!a)throw new Error("useTheme must be used inside <ThemeProvider>. Wrap the app root in main.tsx.");return a}const ux=["claude-cli","anthropic","openrouter","ollama","lm-studio"];function C0(a){const r=new Map(a.map(o=>[o.id,o])),i=[];for(const o of ux){const d=r.get(o);d&&i.push(d)}for(const o of a)ux.includes(o.id)||i.push(o);return i}function N0(a){const[r,i]=g.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(`(max-width: ${a}px)`).matches);return g.useEffect(()=>{var p;if(typeof window>"u"||!window.matchMedia)return;const o=window.matchMedia(`(max-width: ${a}px)`),d=()=>i(o.matches);return(p=o.addEventListener)==null||p.call(o,"change",d),()=>{var f;return(f=o.removeEventListener)==null?void 0:f.call(o,"change",d)}},[a]),r}function E0({providers:a,onOpenSettings:r,onOpenInstallHelp:i}){const o=C0(a),d=N0(640),[p,f]=g.useState(!1),h=g.useCallback(x=>{x.available||x.kind==="api-key"?r==null||r(x.id):i==null||i(x.id)},[r,i]);if(d){const x=o.filter(m=>m.available).length;return n.jsxs("div",{"data-testid":"providers-segment",style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[n.jsx("button",{type:"button","data-testid":"providers-summary",onClick:()=>f(!p),"aria-label":J.statusBar.providerSummary(x,o.length),style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:J.statusBar.providerSummary(x,o.length)}),p&&n.jsx("div",{role:"menu",style:{position:"absolute",bottom:"120%",right:0,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,padding:6,minWidth:180,display:"flex",flexDirection:"column",gap:2,zIndex:80},children:o.map(m=>n.jsx(fx,{p:m,onClick:h},m.id))})]})}return n.jsx("div",{"data-testid":"providers-segment",style:{display:"inline-flex",alignItems:"center",gap:4},children:o.map(x=>n.jsx(fx,{p:x,onClick:h,compact:!0},x.id))})}function fx({p:a,onClick:r,compact:i}){const o=a.available?J.statusBar.unlocked(a.label):a.kind==="cli-install"?J.statusBar.lockedCli(a.label):J.statusBar.locked(a.label);return n.jsxs("button",{type:"button","data-testid":`provider-glyph-${a.id}`,"data-available":a.available,"aria-label":o,title:o,onClick:()=>r(a),style:{display:"inline-flex",alignItems:"center",gap:4,background:"transparent",border:"none",color:a.available?"var(--status-installed)":"var(--text-muted, var(--text-tertiary))",cursor:"pointer",padding:i?"2px":"4px 6px",fontSize:11},children:[n.jsx(pu,{unlocked:a.available,size:10}),!i&&n.jsx("span",{children:a.label})]})}function T0(){try{return typeof localStorage>"u"?null:localStorage.getItem(ho)}catch{return null}}function R0({projectPath:a,modelName:r,health:i="ok",onPathClick:o,providers:d,onOpenProviderSettings:p,onOpenProviderInstallHelp:f}){const{mode:h,resolvedTheme:x,setTheme:m}=vg(),v=T0()==="auto",j=A0(h,x,v),S=i==="down"||i==="degraded"?"var(--status-own)":"var(--status-installed)";return n.jsxs("div",{role:"contentinfo",style:{display:"flex",alignItems:"center",gap:12,height:"100%",width:"100%",padding:"0 12px",fontSize:11,fontFamily:"var(--font-sans)",color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[n.jsx("span",{title:r??"",style:{fontFamily:"var(--font-mono)"},children:r??"—"}),n.jsx(px,{}),n.jsxs("span",{"aria-label":`Health: ${i}`,style:{display:"inline-flex",alignItems:"center",gap:6},children:[n.jsx(M0,{color:S}),n.jsx("span",{style:{textTransform:"capitalize"},children:i})]}),d&&d.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(px,{}),n.jsx(E0,{providers:d,onOpenSettings:p,onOpenInstallHelp:f})]}),n.jsx("div",{style:{flex:1}}),n.jsxs("button",{type:"button","data-testid":"theme-toggle",onClick:()=>m(j),"aria-label":`Switch to ${j} theme`,title:`Theme: ${h} — click for ${j}`,style:{display:"inline-flex",alignItems:"center",gap:6,background:"transparent",border:"1px solid var(--border-default)",padding:"2px 8px",borderRadius:4,color:"var(--text-secondary)",cursor:"pointer",fontSize:11,height:20},children:[n.jsx(z0,{mode:h}),n.jsx("span",{style:{textTransform:"capitalize"},children:h})]})]})}function A0(a,r,i){return a==="light"?"dark":a==="dark"?"auto":i?"light":r==="light"?"dark":"light"}function M0({color:a}){return n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:a,display:"inline-block",flexShrink:0}})}function px(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)"},children:"|"})}function z0({mode:a}){return a==="dark"?n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}):a==="light"?n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"4"}),n.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}):n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"9"}),n.jsx("path",{d:"M12 3a9 9 0 0 0 0 18z",fill:"currentColor"})]})}const ao=new Map,gl=new Map,xs=new Map;function an(a){ao.delete(a),gl.delete(a);const r=xs.get(a);if(r)for(const i of r)i()}function xr(a,r,i={}){const{ttl:o=3e4,enabled:d=!0}=i,[,p]=g.useState(0),f=g.useRef(!0),h=g.useRef(a);h.current=a;const x=()=>an(a);g.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]),g.useEffect(()=>{if(!d)return;const j=()=>{f.current&&p(S=>S+1)};return xs.has(a)||xs.set(a,new Set),xs.get(a).add(j),()=>{var S;(S=xs.get(a))==null||S.delete(j)}},[a,d]),g.useEffect(()=>{if(!d)return;const j=ao.get(a);if(!(!j||Date.now()-j.fetchedAt>o))return;if(gl.has(a)){const T=gl.get(a),C=()=>{f.current&&h.current===a&&p(M=>M+1)};T.subscribers.push(C);return}const k={promise:Promise.resolve(),subscribers:[]},A=r().then(T=>{ao.set(a,{data:T,fetchedAt:Date.now()}),gl.delete(a),f.current&&h.current===a&&p(C=>C+1);for(const C of k.subscribers)C()},T=>{gl.delete(a),f.current&&h.current===a&&p(C=>C+1);for(const C of k.subscribers)C();throw T});k.promise=A,gl.set(a,k)},[a,r,o,d]);const m=ao.get(a),y=d&&!m&&gl.has(a);return{data:m==null?void 0:m.data,loading:y||d&&!m,error:void 0,revalidate:x}}const xo=0,Wa=1,gr=2,yg=4;function mx(a){return()=>a}function L0(a){a()}function bg(a,r){return i=>a(r(i))}function hx(a,r){return()=>a(r)}function D0(a,r){return i=>a(r,i)}function Ru(a){return a!==void 0}function _0(...a){return()=>{a.map(L0)}}function vr(){}function go(a,r){return r(a),a}function O0(a,r){return r(a)}function xt(...a){return a}function nt(a,r){return a(Wa,r)}function Ve(a,r){a(xo,r)}function Au(a){a(gr)}function bt(a){return a(yg)}function Ne(a,r){return nt(a,D0(r,xo))}function Pn(a,r){const i=a(Wa,o=>{i(),r(o)});return i}function xx(a){let r,i;return o=>d=>{r=d,i&&clearTimeout(i),i=setTimeout(()=>{o(r)},a)}}function jg(a,r){return a===r}function ht(a=jg){let r;return i=>o=>{a(r,o)||(r=o,i(o))}}function ze(a){return r=>i=>{a(i)&&r(i)}}function be(a){return r=>bg(r,a)}function Kn(a){return r=>()=>{r(a)}}function ce(a,...r){const i=B0(...r);return((o,d)=>{switch(o){case gr:Au(a);return;case Wa:return nt(a,i(d))}})}function Xn(a,r){return i=>o=>{i(r=a(r,o))}}function yl(a){return r=>i=>{a>0?a--:r(i)}}function va(a){let r=null,i;return o=>d=>{r=d,!i&&(i=setTimeout(()=>{i=void 0,o(r)},a))}}function Pe(...a){const r=new Array(a.length);let i=0,o=null;const d=2**a.length-1;return a.forEach((p,f)=>{const h=2**f;nt(p,x=>{const m=i;i|=h,r[f]=x,m!==d&&i===d&&o&&(o(),o=null)})}),p=>f=>{const h=()=>{p([f].concat(r))};i===d?h():o=h}}function B0(...a){return r=>a.reduceRight(O0,r)}function I0(a){let r,i;const o=()=>r==null?void 0:r();return function(d,p){switch(d){case Wa:return p?i===p?void 0:(o(),i=p,r=nt(a,p),r):(o(),vr);case gr:o(),i=null;return}}}function me(a){let r=a;const i=Xe();return((o,d)=>{switch(o){case xo:r=d;break;case Wa:{d(r);break}case yg:return r}return i(o,d)})}function Zt(a,r){return go(me(r),i=>Ne(a,i))}function Xe(){const a=[];return((r,i)=>{switch(r){case xo:a.slice().forEach(o=>{o(i)});return;case gr:a.splice(0,a.length);return;case Wa:return a.push(i),()=>{const o=a.indexOf(i);o>-1&&a.splice(o,1)}}})}function Sn(a){return go(Xe(),r=>Ne(a,r))}function et(a,r=[],{singleton:i}={singleton:!0}){return{constructor:a,dependencies:r,id:H0(),singleton:i}}const H0=()=>Symbol();function U0(a){const r=new Map,i=({constructor:o,dependencies:d,id:p,singleton:f})=>{if(f&&r.has(p))return r.get(p);const h=o(d.map(x=>i(x)));return f&&r.set(p,h),h};return i(a)}function _t(...a){const r=Xe(),i=new Array(a.length);let o=0;const d=2**a.length-1;return a.forEach((p,f)=>{const h=2**f;nt(p,x=>{i[f]=x,o|=h,o===d&&Ve(r,i)})}),function(p,f){switch(p){case gr:{Au(r);return}case Wa:return o===d&&f(i),nt(r,f)}}}function Me(a,r=jg){return ce(a,ht(r))}function mu(...a){return function(r,i){switch(r){case gr:return;case Wa:return _0(...a.map(o=>nt(o,i)))}}}const It={DEBUG:0,INFO:1,WARN:2,ERROR:3},V0={[It.DEBUG]:"debug",[It.ERROR]:"error",[It.INFO]:"log",[It.WARN]:"warn"},$0=()=>typeof globalThis>"u"?window:globalThis,Ka=et(()=>{const a=me(It.ERROR);return{log:me((r,i,o=It.INFO)=>{const d=$0().VIRTUOSO_LOG_LEVEL??bt(a);o>=d&&console[V0[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",r,i)}),logLevel:a}},[],{singleton:!0});function jl(a,r,i){return Mu(a,r,i).callbackRef}function Mu(a,r,i){const o=Ce.useRef(null);let d=f=>{};const p=Ce.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(f=>{const h=()=>{const x=f[0].target;x.offsetParent!==null&&a(x)};i?h():requestAnimationFrame(h)}):null,[a,i]);return d=f=>{f&&r?(p==null||p.observe(f),o.current=f):(o.current&&(p==null||p.unobserve(o.current)),o.current=null)},{callbackRef:d,ref:o}}function P0(a,r,i,o,d,p,f,h,x){const m=Ce.useCallback(y=>{const v=G0(y.children,r,h?"offsetWidth":"offsetHeight",d);let j=y.parentElement;for(;j.dataset.virtuosoScroller===void 0;)j=j.parentElement;const S=j.lastElementChild.dataset.viewportType==="window";let k;S&&(k=j.ownerDocument.defaultView);const A=f?h?f.scrollLeft:f.scrollTop:S?h?k.scrollX||k.document.documentElement.scrollLeft:k.scrollY||k.document.documentElement.scrollTop:h?j.scrollLeft:j.scrollTop,T=f?h?f.scrollWidth:f.scrollHeight:S?h?k.document.documentElement.scrollWidth:k.document.documentElement.scrollHeight:h?j.scrollWidth:j.scrollHeight,C=f?h?f.offsetWidth:f.offsetHeight:S?h?k.innerWidth:k.innerHeight:h?j.offsetWidth:j.offsetHeight;o({scrollHeight:T,scrollTop:Math.max(A,0),viewportHeight:C}),p==null||p(h?gx("column-gap",getComputedStyle(y).columnGap,d):gx("row-gap",getComputedStyle(y).rowGap,d)),v!==null&&a(v)},[a,r,d,p,f,o,h]);return Mu(m,i,x)}function G0(a,r,i,o){const d=a.length;if(d===0)return null;const p=[];for(let f=0;f<d;f++){const h=a.item(f);if(h.dataset.index===void 0)continue;const x=parseInt(h.dataset.index),m=parseFloat(h.dataset.knownSize),y=r(h,i);if(y===0&&o("Zero-sized element, this should not happen",{child:h},It.ERROR),y===m)continue;const v=p[p.length-1];p.length===0||v.size!==y||v.endIndex!==x-1?p.push({endIndex:x,size:y,startIndex:x}):p[p.length-1].endIndex++}return p}function gx(a,r,i){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&i(`${a} was not resolved to pixel value correctly`,r,It.WARN),r==="normal"?0:parseInt(r??"0",10)}function Sg(a,r,i){const o=Ce.useRef(null),d=Ce.useCallback(x=>{if(!(x!=null&&x.offsetParent))return;const m=x.getBoundingClientRect(),y=m.width;let v,j;if(r){const S=r.getBoundingClientRect(),k=m.top-S.top;j=S.height-Math.max(0,k),v=k+r.scrollTop}else{const S=f.current.ownerDocument.defaultView;j=S.innerHeight-Math.max(0,m.top),v=m.top+S.scrollY}o.current={listHeight:m.height,offsetTop:v,visibleHeight:j,visibleWidth:y},a(o.current)},[a,r]),{callbackRef:p,ref:f}=Mu(d,!0,i),h=Ce.useCallback(()=>{d(f.current)},[d,f]);return Ce.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 x=(m=f.current)==null?void 0:m.ownerDocument.defaultView;return x==null||x.addEventListener("scroll",h),x==null||x.addEventListener("resize",h),()=>{x==null||x.removeEventListener("scroll",h),x==null||x.removeEventListener("resize",h)}},[h,r,f]),p}const ln=et(()=>{const a=Xe(),r=Xe(),i=me(0),o=Xe(),d=me(0),p=Xe(),f=Xe(),h=me(0),x=me(0),m=me(0),y=me(0),v=Xe(),j=Xe(),S=me(!1),k=me(!1),A=me(!1);return Ne(ce(a,be(({scrollTop:T})=>T)),r),Ne(ce(a,be(({scrollHeight:T})=>T)),f),Ne(r,d),{deviation:i,fixedFooterHeight:m,fixedHeaderHeight:x,footerHeight:y,headerHeight:h,horizontalDirection:k,scrollBy:j,scrollContainerState:a,scrollHeight:f,scrollingInProgress:S,scrollTo:v,scrollTop:r,skipAnimationFrameInResizeObserver:A,smoothScrollTargetReached:o,statefulScrollTop:d,viewportHeight:p}},[],{singleton:!0}),ks={lvl:0};function kg(a,r){const i=a.length;if(i===0)return[];let{index:o,value:d}=r(a[0]);const p=[];for(let f=1;f<i;f++){const{index:h,value:x}=r(a[f]);p.push({end:h-1,start:o,value:d}),o=h,d=x}return p.push({end:1/0,start:o,value:d}),p}function ut(a){return a===ks}function ws(a,r){if(!ut(a))return r===a.k?a.v:r<a.k?ws(a.l,r):ws(a.r,r)}function Gn(a,r,i="k"){if(ut(a))return[-1/0,void 0];if(Number(a[i])===r)return[a.k,a.v];if(Number(a[i])<r){const o=Gn(a.r,r,i);return o[0]===-1/0?[a.k,a.v]:o}return Gn(a.l,r,i)}function bn(a,r,i){return ut(a)?Ng(r,i,1):r===a.k?Bt(a,{k:r,v:i}):r<a.k?vx(Bt(a,{l:bn(a.l,r,i)})):vx(Bt(a,{r:bn(a.r,r,i)}))}function dr(){return ks}function ur(a,r,i){if(ut(a))return[];const o=Gn(a,r)[0];return F0(xu(a,o,i))}function hu(a,r){if(ut(a))return ks;const{k:i,l:o,r:d}=a;if(r===i){if(ut(o))return d;if(ut(d))return o;const[p,f]=Cg(o);return lo(Bt(a,{k:p,l:wg(o),v:f}))}return r<i?lo(Bt(a,{l:hu(o,r)})):lo(Bt(a,{r:hu(d,r)}))}function vl(a){return ut(a)?[]:[...vl(a.l),{k:a.k,v:a.v},...vl(a.r)]}function xu(a,r,i){if(ut(a))return[];const{k:o,l:d,r:p,v:f}=a;let h=[];return o>r&&(h=h.concat(xu(d,r,i))),o>=r&&o<=i&&h.push({k:o,v:f}),o<=i&&(h=h.concat(xu(p,r,i))),h}function lo(a){const{l:r,lvl:i,r:o}=a;if(o.lvl>=i-1&&r.lvl>=i-1)return a;if(i>o.lvl+1){if(Gd(r))return Eg(Bt(a,{lvl:i-1}));if(!ut(r)&&!ut(r.r))return Bt(r.r,{l:Bt(r,{r:r.r.l}),lvl:i,r:Bt(a,{l:r.r.r,lvl:i-1})});throw new Error("Unexpected empty nodes")}if(Gd(a))return gu(Bt(a,{lvl:i-1}));if(!ut(o)&&!ut(o.l)){const d=o.l,p=Gd(d)?o.lvl-1:o.lvl;return Bt(d,{l:Bt(a,{lvl:i-1,r:d.l}),lvl:d.lvl+1,r:gu(Bt(o,{l:d.r,lvl:p}))})}throw new Error("Unexpected empty nodes")}function Bt(a,r){return Ng(r.k!==void 0?r.k:a.k,r.v!==void 0?r.v:a.v,r.lvl!==void 0?r.lvl:a.lvl,r.l!==void 0?r.l:a.l,r.r!==void 0?r.r:a.r)}function wg(a){return ut(a.r)?a.l:lo(Bt(a,{r:wg(a.r)}))}function Gd(a){return ut(a)||a.lvl>a.r.lvl}function Cg(a){return ut(a.r)?[a.k,a.v]:Cg(a.r)}function Ng(a,r,i,o=ks,d=ks){return{k:a,l:o,lvl:i,r:d,v:r}}function vx(a){return gu(Eg(a))}function Eg(a){const{l:r}=a;return!ut(r)&&r.lvl===a.lvl?Bt(r,{r:Bt(a,{l:r.r})}):a}function gu(a){const{lvl:r,r:i}=a;return!ut(i)&&!ut(i.r)&&i.lvl===r&&i.r.lvl===r?Bt(i,{l:Bt(a,{r:i.l}),lvl:r+1}):a}function F0(a){return kg(a,({k:r,v:i})=>({index:r,value:i}))}function Tg(a,r){return!!(a&&a.startIndex===r.startIndex&&a.endIndex===r.endIndex)}function Cs(a,r){return!!(a&&a[0]===r[0]&&a[1]===r[1])}const zu=et(()=>({recalcInProgress:me(!1)}),[],{singleton:!0});function Rg(a,r,i){return a[oo(a,r,i)]}function oo(a,r,i,o=0){let d=a.length-1;for(;o<=d;){const p=Math.floor((o+d)/2),f=a[p],h=i(f,r);if(h===0)return p;if(h===-1){if(d-o<2)return p-1;d=p-1}else{if(d===o)return p;o=p+1}}throw new Error(`Failed binary finding record in array - ${a.join(",")}, searched for ${r}`)}function q0(a,r,i,o){const d=oo(a,r,o),p=oo(a,i,o,d);return a.slice(d,p+1)}function Ya(a,r){return Math.round(a.getBoundingClientRect()[r])}function vo(a){return!ut(a.groupOffsetTree)}function Lu({index:a},r){return r===a?0:r<a?-1:1}function Y0(){return{groupIndices:[],groupOffsetTree:dr(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:dr()}}function W0(a,r){let i=ut(a)?0:1/0;for(const o of r){const{endIndex:d,size:p,startIndex:f}=o;if(i=Math.min(i,f),ut(a)){a=bn(a,0,p);continue}const h=ur(a,f-1,d+1);if(h.some(tj(o)))continue;let x=!1,m=!1;for(const{end:y,start:v,value:j}of h)x?(d>=v||p===j)&&(a=hu(a,v)):(m=j!==p,x=!0),y>d&&d>=v&&j!==p&&(a=bn(a,d+1,j));m&&(a=bn(a,f,p))}return[a,i]}function K0(a){return typeof a.groupIndex<"u"}function X0({offset:a},r){return r===a?0:r<a?-1:1}function Ns(a,r,i){if(r.length===0)return 0;const{index:o,offset:d,size:p}=Rg(r,a,Lu),f=a-o,h=p*f+(f-1)*i+d;return h>0?h+i:h}function Ag(a,r){if(!vo(r))return a;let i=0;for(;r.groupIndices[i]<=a+i;)i++;return a+i}function Mg(a,r,i){if(K0(a))return r.groupIndices[a.groupIndex]+1;const o=a.index==="LAST"?i:a.index;let d=Ag(o,r);return d=Math.max(0,d,Math.min(i,d)),d}function Q0(a,r,i,o=0){return o>0&&(r=Math.max(r,Rg(a,o,Lu).offset)),kg(q0(a,r,i,X0),ej)}function Z0(a,[r,i,o,d]){r.length>0&&o("received item sizes",r,It.DEBUG);const p=a.sizeTree;let f=p,h=0;if(i.length>0&&ut(p)&&r.length===2){const j=r[0].size,S=r[1].size;f=i.reduce((k,A)=>bn(bn(k,A,j),A+1,S),f)}else[f,h]=W0(f,r);if(f===p)return a;const{lastIndex:x,lastOffset:m,lastSize:y,offsetTree:v}=vu(a.offsetTree,h,f,d);return{groupIndices:i,groupOffsetTree:i.reduce((j,S)=>bn(j,S,Ns(S,v,d)),dr()),lastIndex:x,lastOffset:m,lastSize:y,offsetTree:v,sizeTree:f}}function J0(a){return vl(a).map(({k:r,v:i},o,d)=>{const p=d[o+1];return{endIndex:p!==void 0?p.k-1:1/0,size:i,startIndex:r}})}function yx(a,r){let i=0,o=0;for(;i<a;)i+=r[o+1]-r[o]-1,o++;return o-(i===a?0:1)}function vu(a,r,i,o){let d=a,p=0,f=0,h=0,x=0;if(r!==0){x=oo(d,r-1,Lu),h=d[x].offset;const m=Gn(i,r-1);p=m[0],f=m[1],d.length&&d[x].size===Gn(i,r)[1]&&(x-=1),d=d.slice(0,x+1)}else d=[];for(const{start:m,value:y}of ur(i,r,1/0)){const v=m-p,j=v*f+h+v*o;d.push({index:m,offset:j,size:y}),p=m,h=j,f=y}return{lastIndex:p,lastOffset:h,lastSize:f,offsetTree:d}}function ej(a){return{index:a.index,value:a}}function tj(a){const{endIndex:r,size:i,startIndex:o}=a;return d=>d.start===o&&(d.end===r||d.end===1/0)&&d.value===i}const nj={offsetHeight:"height",offsetWidth:"width"},Qn=et(([{log:a},{recalcInProgress:r}])=>{const i=Xe(),o=Xe(),d=Zt(o,0),p=Xe(),f=Xe(),h=me(0),x=me([]),m=me(void 0),y=me(void 0),v=me(void 0),j=me(void 0),S=me((w,D)=>Ya(w,nj[D])),k=me(void 0),A=me(0),T=Y0(),C=Zt(ce(i,Pe(x,a,A),Xn(Z0,T),ht()),T),M=Zt(ce(x,ht(),Xn((w,D)=>({current:D,prev:w.current}),{current:[],prev:[]}),be(({prev:w})=>w)),[]);Ne(ce(x,ze(w=>w.length>0),Pe(C,A),be(([w,D,E])=>{const B=w.reduce((P,F,te)=>bn(P,F,Ns(F,D.offsetTree,E)||te),dr());return{...D,groupIndices:w,groupOffsetTree:B}})),C),Ne(ce(o,Pe(C),ze(([w,{lastIndex:D}])=>w<D),be(([w,{lastIndex:D,lastSize:E}])=>[{endIndex:D,size:E,startIndex:w}])),i),Ne(m,y);const O=Zt(ce(m,be(w=>w===void 0)),!0);Ne(ce(y,ze(w=>w!==void 0&&ut(bt(C).sizeTree)),be(w=>{const D=bt(v),E=bt(x).length>0;return D!==void 0&&D!==0?E?[{endIndex:0,size:D,startIndex:0},{endIndex:1,size:w,startIndex:1}]:[]:[{endIndex:0,size:w,startIndex:0}]})),i),Ne(ce(j,ze(w=>w!==void 0&&w.length>0&&ut(bt(C).sizeTree)),be(w=>{const D=[];let E=w[0],B=0;for(let P=1;P<w.length;P++){const F=w[P];F!==E&&(D.push({endIndex:P-1,size:E,startIndex:B}),E=F,B=P)}return D.push({endIndex:w.length-1,size:E,startIndex:B}),D})),i),Ne(ce(x,Pe(v,y),ze(([,w,D])=>w!==void 0&&D!==void 0),be(([w,D,E])=>{const B=[];for(let P=0;P<w.length;P++){const F=w[P],te=w[P+1];B.push({startIndex:F,endIndex:F,size:D}),te!==void 0&&B.push({startIndex:F+1,endIndex:te-1,size:E})}return B})),i);const U=Sn(ce(i,Pe(C),Xn(({sizes:w},[D,E])=>({changed:E!==w,sizes:E}),{changed:!1,sizes:T}),be(w=>w.changed)));nt(ce(h,Xn((w,D)=>({diff:w.prev-D,prev:D}),{diff:0,prev:0}),be(w=>w.diff)),w=>{const{groupIndices:D}=bt(C);if(w>0)Ve(r,!0),Ve(p,w+yx(w,D));else if(w<0){const E=bt(M);E.length>0&&(w-=yx(-w,E)),Ve(f,w)}}),nt(ce(h,Pe(a)),([w,D])=>{w<0&&D("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:h},It.ERROR)});const L=Sn(p);Ne(ce(p,Pe(C),be(([w,D])=>{const E=D.groupIndices.length>0,B=[],P=D.lastSize;if(E){const F=ws(D.sizeTree,0);let te=0,Q=0;for(;te<w;){const R=D.groupIndices[Q],I=D.groupIndices.length===Q+1?1/0:D.groupIndices[Q+1]-R-1;B.push({endIndex:R,size:F,startIndex:R}),B.push({endIndex:R+1+I-1,size:P,startIndex:R+1}),Q++,te+=I+1}const z=vl(D.sizeTree);return te!==w&&z.shift(),z.reduce((R,{k:I,v:Z})=>{let q=R.ranges;return R.prevSize!==0&&(q=[...R.ranges,{endIndex:I+w-1,size:R.prevSize,startIndex:R.prevIndex}]),{prevIndex:I+w,prevSize:Z,ranges:q}},{prevIndex:w,prevSize:0,ranges:B}).ranges}return vl(D.sizeTree).reduce((F,{k:te,v:Q})=>({prevIndex:te+w,prevSize:Q,ranges:[...F.ranges,{endIndex:te+w-1,size:F.prevSize,startIndex:F.prevIndex}]}),{prevIndex:0,prevSize:P,ranges:[]}).ranges})),i);const V=Sn(ce(f,Pe(C,A),be(([w,{offsetTree:D},E])=>{const B=-w;return Ns(B,D,E)})));return Ne(ce(f,Pe(C,A),be(([w,D,E])=>{if(D.groupIndices.length>0){if(ut(D.sizeTree))return D;let P=dr();const F=bt(M);let te=0,Q=0,z=0;for(;te<-w;){z=F[Q];const R=F[Q+1]-z-1;Q++,te+=R+1}if(P=vl(D.sizeTree).reduce((R,{k:I,v:Z})=>bn(R,Math.max(0,I+w),Z),P),te!==-w){const R=ws(D.sizeTree,z);P=bn(P,0,R);const I=Gn(D.sizeTree,-w+1)[1];P=bn(P,1,I)}return{...D,sizeTree:P,...vu(D.offsetTree,0,P,E)}}const B=vl(D.sizeTree).reduce((P,{k:F,v:te})=>bn(P,Math.max(0,F+w),te),dr());return{...D,sizeTree:B,...vu(D.offsetTree,0,B,E)}})),C),{beforeUnshiftWith:L,data:k,defaultItemSize:y,firstItemIndex:h,fixedItemSize:m,fixedGroupSize:v,gap:A,groupIndices:x,heightEstimates:j,itemSize:S,listRefresh:U,shiftWith:f,shiftWithOffset:V,sizeRanges:i,sizes:C,statefulTotalCount:d,totalCount:o,trackItemSizes:O,unshiftWith:p}},xt(Ka,zu),{singleton:!0});function aj(a){return a.reduce((r,i)=>(r.groupIndices.push(r.totalCount),r.totalCount+=i+1,r),{groupIndices:[],totalCount:0})}const zg=et(([{groupIndices:a,sizes:r,totalCount:i},{headerHeight:o,scrollTop:d}])=>{const p=Xe(),f=Xe(),h=Sn(ce(p,be(aj)));return Ne(ce(h,be(x=>x.totalCount)),i),Ne(ce(h,be(x=>x.groupIndices)),a),Ne(ce(_t(d,r,o),ze(([x,m])=>vo(m)),be(([x,m,y])=>Gn(m.groupOffsetTree,Math.max(x-y,0),"v")[0]),ht(),be(x=>[x])),f),{groupCounts:p,topItemsIndexes:f}},xt(Qn,ln)),Xa=et(([{log:a}])=>{const r=me(!1),i=Sn(ce(r,ze(o=>o),ht()));return nt(r,o=>{o&&bt(a)("props updated",{},It.DEBUG)}),{didMount:i,propsReady:r}},xt(Ka),{singleton:!0}),lj=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Lg(a){const r=typeof a=="number"?{index:a}:a;return r.align||(r.align="start"),(!r.behavior||!lj)&&(r.behavior="auto"),r.offset===void 0&&(r.offset=0),r}const As=et(([{gap:a,listRefresh:r,sizes:i,totalCount:o},{fixedFooterHeight:d,fixedHeaderHeight:p,footerHeight:f,headerHeight:h,scrollingInProgress:x,scrollTo:m,smoothScrollTargetReached:y,viewportHeight:v},{log:j}])=>{const S=Xe(),k=Xe(),A=me(0);let T=null,C=null,M=null;function O(){T!==null&&(T(),T=null),M!==null&&(M(),M=null),C&&(clearTimeout(C),C=null),Ve(x,!1)}return Ne(ce(S,Pe(i,v,o,A,h,f,j),Pe(a,p,d),be(([[U,L,V,w,D,E,B,P],F,te,Q])=>{const z=Lg(U),{align:R,behavior:I,offset:Z}=z,q=w-1,de=Mg(z,L,q);let _=Ns(de,L.offsetTree,F)+E;R==="end"?(_+=te+Gn(L.sizeTree,de)[1]-V+Q,de===q&&(_+=B)):R==="center"?_+=(te+Gn(L.sizeTree,de)[1]-V+Q)/2:_-=D,Z!==void 0&&Z!==0&&(_+=Z);const W=ie=>{O(),ie?(P("retrying to scroll to",{location:U},It.DEBUG),Ve(S,U)):(Ve(k,!0),P("list did not change, scroll successful",{},It.DEBUG))};if(O(),I==="smooth"){let ie=!1;M=nt(r,ue=>{ie=ie||ue}),T=Pn(y,()=>{W(ie)})}else T=Pn(ce(r,rj(150)),W);return C=setTimeout(()=>{O()},1200),Ve(x,!0),P("scrolling from index to",{behavior:I,index:de,top:_},It.DEBUG),{behavior:I,top:_}})),m),{scrollTargetReached:k,scrollToIndex:S,topListHeight:A}},xt(Qn,ln,Ka),{singleton:!0});function rj(a){return r=>{const i=setTimeout(()=>{r(!1)},a);return o=>{o&&(r(!0),clearTimeout(i))}}}function Du(a,r){a===0?r():requestAnimationFrame(()=>{Du(a-1,r)})}function _u(a,r){const i=r-1;return typeof a=="number"?a:a.index==="LAST"?i:a.index}const Ms=et(([{defaultItemSize:a,listRefresh:r,sizes:i},{scrollTop:o},{scrollTargetReached:d,scrollToIndex:p},{didMount:f}])=>{const h=me(!0),x=me(0),m=me(!0);return Ne(ce(f,Pe(x),ze(([y,v])=>v!==0),Kn(!1)),h),Ne(ce(f,Pe(x),ze(([y,v])=>v!==0),Kn(!1)),m),nt(ce(_t(r,f),Pe(h,i,a,m),ze(([[,y],v,{sizeTree:j},S,k])=>y&&(!ut(j)||Ru(S))&&!v&&!k),Pe(x)),([,y])=>{Pn(d,()=>{Ve(m,!0)}),Du(4,()=>{Pn(o,()=>{Ve(h,!0)}),Ve(p,y)})}),{initialItemFinalLocationReached:m,initialTopMostItemIndex:x,scrolledToInitialItem:h}},xt(Qn,ln,As,Xa),{singleton:!0});function Dg(a,r){return Math.abs(a-r)<1.01}const Es="up",bs="down",sj="none",ij={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},oj=0,zs=et(([{footerHeight:a,headerHeight:r,scrollBy:i,scrollContainerState:o,scrollTop:d,viewportHeight:p}])=>{const f=me(!1),h=me(!0),x=Xe(),m=Xe(),y=me(4),v=me(oj),j=Zt(ce(mu(ce(Me(d),yl(1),Kn(!0)),ce(Me(d),yl(1),Kn(!1),xx(100))),ht()),!1),S=Zt(ce(mu(ce(i,Kn(!0)),ce(i,Kn(!1),xx(200))),ht()),!1);Ne(ce(_t(Me(d),Me(v)),be(([M,O])=>M<=O),ht()),h),Ne(ce(h,va(50)),m);const k=Sn(ce(_t(o,Me(p),Me(r),Me(a),Me(y)),Xn((M,[{scrollHeight:O,scrollTop:U},L,V,w,D])=>{const E=U+L-O>-D,B={scrollHeight:O,scrollTop:U,viewportHeight:L};if(E){let F,te;return U>M.state.scrollTop?(F="SCROLLED_DOWN",te=M.state.scrollTop-U):(F="SIZE_DECREASED",te=M.state.scrollTop-U||M.scrollTopDelta),{atBottom:!0,atBottomBecause:F,scrollTopDelta:te,state:B}}let P;return B.scrollHeight>M.state.scrollHeight?P="SIZE_INCREASED":L<M.state.viewportHeight?P="VIEWPORT_HEIGHT_DECREASING":U<M.state.scrollTop?P="SCROLLING_UPWARDS":P="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:P,state:B}},ij),ht((M,O)=>M!==void 0&&M.atBottom===O.atBottom))),A=Zt(ce(o,Xn((M,{scrollHeight:O,scrollTop:U,viewportHeight:L})=>{if(!Dg(M.scrollHeight,O)){const V=O-(U+L)<1;return M.scrollTop!==U&&V?{changed:!0,jump:M.scrollTop-U,scrollHeight:O,scrollTop:U}:{changed:!0,jump:0,scrollHeight:O,scrollTop:U}}return{changed:!1,jump:0,scrollHeight:O,scrollTop:U}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),ze(M=>M.changed),be(M=>M.jump)),0);Ne(ce(k,be(M=>M.atBottom)),f),Ne(ce(f,va(50)),x);const T=me(bs);Ne(ce(o,be(({scrollTop:M})=>M),ht(),Xn((M,O)=>bt(S)?{direction:M.direction,prevScrollTop:O}:{direction:O<M.prevScrollTop?Es:bs,prevScrollTop:O},{direction:bs,prevScrollTop:0}),be(M=>M.direction)),T),Ne(ce(o,va(50),Kn(sj)),T);const C=me(0);return Ne(ce(j,ze(M=>!M),Kn(0)),C),Ne(ce(d,va(100),Pe(j),ze(([M,O])=>O),Xn(([M,O],[U])=>[O,U],[0,0]),be(([M,O])=>O-M)),C),{atBottomState:k,atBottomStateChange:x,atBottomThreshold:y,atTopStateChange:m,atTopThreshold:v,isAtBottom:f,isAtTop:h,isScrolling:j,lastJumpDueToItemResize:A,scrollDirection:T,scrollVelocity:C}},xt(ln)),Ts="top",Rs="bottom",bx="none";function jx(a,r,i){return typeof a=="number"?i===Es&&r===Ts||i===bs&&r===Rs?a:0:i===Es?r===Ts?a.main:a.reverse:r===Rs?a.main:a.reverse}function Sx(a,r){return typeof a=="number"?a:a[r]??0}const Ou=et(([{deviation:a,fixedHeaderHeight:r,headerHeight:i,scrollTop:o,viewportHeight:d}])=>{const p=Xe(),f=me(0),h=me(0),x=me(0),m=Zt(ce(_t(Me(o),Me(d),Me(i),Me(p,Cs),Me(x),Me(f),Me(r),Me(a),Me(h)),be(([y,v,j,[S,k],A,T,C,M,O])=>{const U=y-M,L=T+C,V=Math.max(j-U,0);let w=bx;const D=Sx(O,Ts),E=Sx(O,Rs);return S-=M,S+=j+C,k+=j+C,k-=M,S>y+L-D&&(w=Es),k<y-V+v+E&&(w=bs),w!==bx?[Math.max(U-j-jx(A,Ts,w)-D,0),U-V-C+v+jx(A,Rs,w)+E]:null}),ze(y=>y!==null),ht(Cs)),[0,0]);return{increaseViewportBy:h,listBoundary:p,overscan:x,topListHeight:f,visibleRange:m}},xt(ln),{singleton:!0});function cj(a,r,i){if(vo(r)){const o=Ag(a,r);return[{index:Gn(r.groupOffsetTree,o)[0],offset:0,size:0},{data:i==null?void 0:i[0],index:o,offset:0,size:0}]}return[{data:i==null?void 0:i[0],index:a,offset:0,size:0}]}const Fd={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function ro(a,r,i,o,d,p){const{lastIndex:f,lastOffset:h,lastSize:x}=d;let m=0,y=0;if(a.length>0){m=a[0].offset;const A=a[a.length-1];y=A.offset+A.size}const v=i-f,j=h+v*x+(v-1)*o,S=m,k=j-y;return{bottom:y,firstItemIndex:p,items:kx(a,d,p),offsetBottom:k,offsetTop:m,top:S,topItems:kx(r,d,p),topListHeight:r.reduce((A,T)=>T.size+A,0),totalCount:i}}function _g(a,r,i,o,d,p){let f=0;if(i.groupIndices.length>0)for(const y of i.groupIndices){if(y-f>=a)break;f++}const h=a+f,x=_u(r,h),m=Array.from({length:h}).map((y,v)=>({data:p[v+x],index:v+x,offset:0,size:0}));return ro(m,[],h,d,i,o)}function kx(a,r,i){if(a.length===0)return[];if(!vo(r))return a.map(m=>({...m,index:m.index+i,originalIndex:m.index}));const o=a[0].index,d=a[a.length-1].index,p=[],f=ur(r.groupOffsetTree,o,d);let h,x=0;for(const m of a){(!h||h.end<m.index)&&(h=f.shift(),x=r.groupIndices.indexOf(h.start));let y;m.index===h.start?y={index:x,type:"group"}:y={groupIndex:x,index:m.index-(x+1)+i},p.push({...y,data:m.data,offset:m.offset,originalIndex:m.index,size:m.size})}return p}function wx(a,r){return a===void 0?0:typeof a=="number"?a:a[r]??0}const Sl=et(([{data:a,firstItemIndex:r,gap:i,sizes:o,totalCount:d},p,{listBoundary:f,topListHeight:h,visibleRange:x},{initialTopMostItemIndex:m,scrolledToInitialItem:y},{topListHeight:v},j,{didMount:S},{recalcInProgress:k}])=>{const A=me([]),T=me(0),C=Xe(),M=me(0);Ne(p.topItemsIndexes,A);const O=Zt(ce(_t(S,k,Me(x,Cs),Me(d),Me(o),Me(m),y,Me(A),Me(r),Me(i),Me(M),a),ze(([w,D,,E,,,,,,,,B])=>{const P=B!==void 0&&B.length!==E;return w&&!D&&!P}),be(([,,[w,D],E,B,P,F,te,Q,z,R,I])=>{var Se,De;const Z=B,{offsetTree:q,sizeTree:de}=Z,_=bt(T);if(E===0)return{...Fd,totalCount:E};if(w===0&&D===0)return _===0?{...Fd,totalCount:E}:_g(_,P,B,Q,z,I||[]);if(ut(de))return _>0?null:ro(cj(_u(P,E),Z,I),[],E,z,Z,Q);const W=[];if(te.length>0){const Ie=te[0],ae=te[te.length-1];let pe=0;for(const fe of ur(de,Ie,ae)){const he=fe.value,ve=Math.max(fe.start,Ie),_e=Math.min(fe.end,ae);for(let re=ve;re<=_e;re++)W.push({data:I==null?void 0:I[re],index:re,offset:pe,size:he}),pe+=he}}if(!F)return ro([],W,E,z,Z,Q);const ie=te.length>0?te[te.length-1]+1:0,ue=Q0(q,w,D,ie);if(ue.length===0)return null;const ge=E-1,xe=go([],Ie=>{for(const ae of ue){const pe=ae.value;let fe=pe.offset,he=ae.start;const ve=pe.size;if(pe.offset<w){he+=Math.floor((w-pe.offset+z)/(ve+z));const re=he-ae.start;fe+=re*ve+re*z}he<ie&&(fe+=(ie-he)*ve,he=ie);const _e=Math.min(ae.end,ge);for(let re=he;re<=_e&&!(fe>=D);re++)Ie.push({data:I==null?void 0:I[re],index:re,offset:fe,size:ve}),fe+=ve+z}}),we=wx(R,Ts),oe=wx(R,Rs);if(xe.length>0&&(we>0||oe>0)){const Ie=xe[0],ae=xe[xe.length-1];if(we>0&&Ie.index>ie){const pe=Math.min(we,Ie.index-ie),fe=[];let he=Ie.offset;for(let ve=Ie.index-1;ve>=Ie.index-pe;ve--){const _e=((Se=ur(de,ve,ve)[0])==null?void 0:Se.value)??Ie.size;he-=_e+z,fe.unshift({data:I==null?void 0:I[ve],index:ve,offset:he,size:_e})}xe.unshift(...fe)}if(oe>0&&ae.index<ge){const pe=Math.min(oe,ge-ae.index);let fe=ae.offset+ae.size+z;for(let he=ae.index+1;he<=ae.index+pe;he++){const ve=((De=ur(de,he,he)[0])==null?void 0:De.value)??ae.size;xe.push({data:I==null?void 0:I[he],index:he,offset:fe,size:ve}),fe+=ve+z}}}return ro(xe,W,E,z,Z,Q)}),ze(w=>w!==null),ht()),Fd);Ne(ce(a,ze(Ru),be(w=>w==null?void 0:w.length)),d),Ne(ce(O,be(w=>w.topListHeight)),v),Ne(v,h),Ne(ce(O,be(w=>[w.top,w.bottom])),f),Ne(ce(O,be(w=>w.items)),C);const U=Sn(ce(O,ze(({items:w})=>w.length>0),Pe(d,a),ze(([{items:w},D])=>w[w.length-1].originalIndex===D-1),be(([,w,D])=>[w-1,D]),ht(Cs),be(([w])=>w))),L=Sn(ce(O,va(200),ze(({items:w,topItems:D})=>w.length>0&&w[0].originalIndex===D.length),be(({items:w})=>w[0].index),ht())),V=Sn(ce(O,ze(({items:w})=>w.length>0),be(({items:w})=>{let D=0,E=w.length-1;for(;w[D].type==="group"&&D<E;)D++;for(;w[E].type==="group"&&E>D;)E--;return{endIndex:w[E].index,startIndex:w[D].index}}),ht(Tg)));return{endReached:U,initialItemCount:T,itemsRendered:C,listState:O,minOverscanItemCount:M,rangeChanged:V,startReached:L,topItemsIndexes:A,...j}},xt(Qn,zg,Ou,Ms,As,zs,Xa,zu),{singleton:!0}),Og=et(([{fixedFooterHeight:a,fixedHeaderHeight:r,footerHeight:i,headerHeight:o},{listState:d}])=>{const p=Xe(),f=Zt(ce(_t(i,a,o,r,d),be(([h,x,m,y,v])=>h+x+m+y+v.offsetBottom+v.bottom)),0);return Ne(Me(f),p),{totalListHeight:f,totalListHeightChanged:p}},xt(ln,Sl),{singleton:!0}),dj=et(([{viewportHeight:a},{totalListHeight:r}])=>{const i=me(!1),o=Zt(ce(_t(i,a,r),ze(([d])=>d),be(([,d,p])=>Math.max(0,d-p)),va(0),ht()),0);return{alignToBottom:i,paddingTopAddition:o}},xt(ln,Og),{singleton:!0}),Bg=et(()=>({context:me(null)})),uj=({itemBottom:a,itemTop:r,locationParams:{align:i,behavior:o,...d},viewportBottom:p,viewportTop:f})=>r<f?{...d,align:i??"start",...o!==void 0?{behavior:o}:{}}:a>p?{...d,align:i??"end",...o!==void 0?{behavior:o}:{}}:null,Ig=et(([{gap:a,sizes:r,totalCount:i},{fixedFooterHeight:o,fixedHeaderHeight:d,headerHeight:p,scrollingInProgress:f,scrollTop:h,viewportHeight:x},{scrollToIndex:m}])=>{const y=Xe();return Ne(ce(y,Pe(r,x,i,p,d,o,h),Pe(a),be(([[v,j,S,k,A,T,C,M],O])=>{const{calculateViewLocation:U=uj,done:L,...V}=v,w=Mg(v,j,k-1),D=Ns(w,j.offsetTree,O)+A+T,E=D+Gn(j.sizeTree,w)[1],B=M+T,P=M+S-C,F=U({itemBottom:E,itemTop:D,locationParams:V,viewportBottom:P,viewportTop:B});return F!==null?L&&Pn(ce(f,ze(te=>!te),yl(bt(f)?1:2)),L):L==null||L(),F}),ze(v=>v!==null)),m),{scrollIntoView:y}},xt(Qn,ln,As,Sl,Ka),{singleton:!0});function Cx(a){return a===!1?!1:a==="smooth"?"smooth":"auto"}const fj=(a,r)=>typeof a=="function"?Cx(a(r)):r&&Cx(a),pj=et(([{listRefresh:a,totalCount:r,fixedItemSize:i,data:o},{atBottomState:d,isAtBottom:p},{scrollToIndex:f},{scrolledToInitialItem:h},{didMount:x,propsReady:m},{log:y},{scrollingInProgress:v},{context:j},{scrollIntoView:S}])=>{const k=me(!1),A=Xe();let T=null;function C(L){Ve(f,{align:"end",behavior:L,index:"LAST"})}nt(ce(_t(ce(Me(r),yl(1)),x),Pe(Me(k),p,h,v),be(([[L,V],w,D,E,B])=>{let P=V&&E,F="auto";return P&&(F=fj(w,D||B),P=P&&F!==!1),{followOutputBehavior:F,shouldFollow:P,totalCount:L}}),ze(({shouldFollow:L})=>L)),({followOutputBehavior:L,totalCount:V})=>{T!==null&&(T(),T=null),bt(i)!==void 0?requestAnimationFrame(()=>{bt(y)("following output to ",{totalCount:V},It.DEBUG),C(L)}):T=Pn(a,()=>{bt(y)("following output to ",{totalCount:V},It.DEBUG),C(L),T=null})});function M(L){const V=Pn(d,w=>{L&&!w.atBottom&&w.notAtBottomBecause==="SIZE_INCREASED"&&T===null&&(bt(y)("scrolling to bottom due to increased size",{},It.DEBUG),C("auto"))});setTimeout(V,100)}nt(ce(_t(Me(k),r,m),ze(([L,,V])=>L!==!1&&V),Xn(({value:L},[,V])=>({refreshed:L===V,value:V}),{refreshed:!1,value:0}),ze(({refreshed:L})=>L),Pe(k,r)),([,L])=>{bt(h)&&M(L!==!1)}),nt(A,()=>{M(bt(k)!==!1)}),nt(_t(Me(k),d),([L,V])=>{L!==!1&&!V.atBottom&&V.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&C("auto")});const O=me(null),U=Xe();return Ne(mu(ce(Me(o),be(L=>(L==null?void 0:L.length)??0)),ce(Me(r))),U),nt(ce(_t(ce(U,yl(1)),x),Pe(Me(O),h,v,j),be(([[L,V],w,D,E,B])=>V&&D&&(w==null?void 0:w({context:B,totalCount:L,scrollingInProgress:E}))),ze(L=>!!L),va(0)),L=>{T!==null&&(T(),T=null),bt(i)!==void 0?requestAnimationFrame(()=>{bt(y)("scrolling into view",{}),Ve(S,L)}):T=Pn(a,()=>{bt(y)("scrolling into view",{}),Ve(S,L),T=null})}),{autoscrollToBottom:A,followOutput:k,scrollIntoViewOnChange:O}},xt(Qn,zs,As,Ms,Xa,Ka,ln,Bg,Ig)),mj=et(([{data:a,firstItemIndex:r,gap:i,sizes:o},{initialTopMostItemIndex:d},{initialItemCount:p,listState:f},{didMount:h}])=>(Ne(ce(h,Pe(p),ze(([,x])=>x!==0),Pe(d,o,r,i,a),be(([[,x],m,y,v,j,S=[]])=>_g(x,m,y,v,j,S))),f),{}),xt(Qn,Ms,Sl,Xa),{singleton:!0}),hj=et(([{didMount:a},{scrollTo:r},{listState:i}])=>{const o=me(0);return nt(ce(a,Pe(o),ze(([,d])=>d!==0),be(([,d])=>({top:d}))),d=>{Pn(ce(i,yl(1),ze(p=>p.items.length>1)),()=>{requestAnimationFrame(()=>{Ve(r,d)})})}),{initialScrollTop:o}},xt(Xa,ln,Sl),{singleton:!0}),Hg=et(([{scrollVelocity:a}])=>{const r=me(!1),i=Xe(),o=me(!1);return Ne(ce(a,Pe(o,r,i),ze(([d,p])=>p!==!1&&p!==void 0),be(([d,p,f,h])=>{const{enter:x,exit:m}=p;if(f){if(m(d,h))return!1}else if(x(d,h))return!0;return f}),ht()),r),nt(ce(_t(r,a,i),Pe(o)),([[d,p,f],h])=>{d&&h!==!1&&h!==void 0&&h.change&&h.change(p,f)}),{isSeeking:r,scrollSeekConfiguration:o,scrollSeekRangeChanged:i,scrollVelocity:a}},xt(zs),{singleton:!0}),Bu=et(([{scrollContainerState:a,scrollTo:r}])=>{const i=Xe(),o=Xe(),d=Xe(),p=me(!1),f=me(void 0);return Ne(ce(_t(i,o),be(([{scrollTop:h,viewportHeight:x},{offsetTop:m,listHeight:y}])=>({scrollHeight:y,scrollTop:Math.max(0,h-m),viewportHeight:x}))),a),Ne(ce(r,Pe(o),be(([h,{offsetTop:x}])=>({...h,top:h.top+x}))),d),{customScrollParent:f,useWindowScroll:p,windowScrollContainerState:i,windowScrollTo:d,windowViewportRect:o}},xt(ln)),xj=et(([{sizeRanges:a,sizes:r},{headerHeight:i,scrollTop:o},{initialTopMostItemIndex:d},{didMount:p},{useWindowScroll:f,windowScrollContainerState:h,windowViewportRect:x}])=>{const m=Xe(),y=me(void 0),v=me(null),j=me(null);return Ne(h,v),Ne(x,j),nt(ce(m,Pe(r,o,f,v,j,i)),([S,k,A,T,C,M,O])=>{const U=J0(k.sizeTree);T&&C!==null&&M!==null&&(A=C.scrollTop-M.offsetTop),A-=O,S({ranges:U,scrollTop:A})}),Ne(ce(y,ze(Ru),be(gj)),d),Ne(ce(p,Pe(y),ze(([,S])=>S!==void 0),ht(),be(([,S])=>S.ranges)),a),{getState:m,restoreStateFrom:y}},xt(Qn,ln,Ms,Xa,Bu));function gj(a){return{align:"start",index:0,offset:a.scrollTop}}const vj=et(([{topItemsIndexes:a}])=>{const r=me(0);return Ne(ce(r,ze(i=>i>=0),be(i=>Array.from({length:i}).map((o,d)=>d))),a),{topItemCount:r}},xt(Sl));function Ug(a){let r=!1,i;return(()=>(r||(r=!0,i=a()),i))}const yj=Ug(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),bj=et(([{deviation:a,scrollBy:r,scrollingInProgress:i,scrollTop:o},{isAtBottom:d,isScrolling:p,lastJumpDueToItemResize:f,scrollDirection:h},{listState:x},{beforeUnshiftWith:m,gap:y,shiftWithOffset:v,sizes:j},{log:S},{recalcInProgress:k}])=>{const A=Sn(ce(x,Pe(f),Xn(([,C,M,O],[{bottom:U,items:L,offsetBottom:V,totalCount:w},D])=>{const E=U+V;let B=0;return M===w&&C.length>0&&L.length>0&&(L[0].originalIndex===0&&C[0].originalIndex===0||(B=E-O,B!==0&&(B+=D))),[B,L,w,E]},[0,[],0,0]),ze(([C])=>C!==0),Pe(o,h,i,d,S,k),ze(([,C,M,O,,,U])=>!U&&!O&&C!==0&&M===Es),be(([[C],,,,,M])=>(M("Upward scrolling compensation",{amount:C},It.DEBUG),C))));function T(C){C>0?(Ve(r,{behavior:"auto",top:-C}),Ve(a,0)):(Ve(a,0),Ve(r,{behavior:"auto",top:-C}))}return nt(ce(A,Pe(a,p)),([C,M,O])=>{O&&yj()?Ve(a,M-C):T(-C)}),nt(ce(_t(Zt(p,!1),a,k),ze(([C,M,O])=>!C&&!O&&M!==0),be(([C,M])=>M),va(1)),T),Ne(ce(v,be(C=>({top:-C}))),r),nt(ce(m,Pe(j,y),be(([C,{groupIndices:M,lastSize:O,sizeTree:U},L])=>{function V(P){return P*(O+L)}if(M.length===0)return V(C);let w=0;const D=ws(U,0);let E=0,B=0;for(;E<C;){E++,w+=D;let P=M.length===B+1?1/0:M[B+1]-M[B]-1;E+P>C&&(w-=D,P=C-E+1),E+=P,w+=V(P),B++}return w})),C=>{Ve(a,C),requestAnimationFrame(()=>{Ve(r,{top:C}),requestAnimationFrame(()=>{Ve(a,0),Ve(k,!1)})})}),{deviation:a}},xt(ln,zs,Sl,Qn,Ka,zu)),jj=et(([a,r,i,o,d,p,f,h,x,m,y])=>({...a,...r,...i,...o,...d,...p,...f,...h,...x,...m,...y}),xt(Ou,mj,Xa,Hg,Og,hj,dj,Bu,Ig,Ka,Bg)),Vg=et(([{data:a,defaultItemSize:r,firstItemIndex:i,fixedItemSize:o,fixedGroupSize:d,gap:p,groupIndices:f,heightEstimates:h,itemSize:x,sizeRanges:m,sizes:y,statefulTotalCount:v,totalCount:j,trackItemSizes:S},{initialItemFinalLocationReached:k,initialTopMostItemIndex:A,scrolledToInitialItem:T},C,M,O,U,{scrollToIndex:L},V,{topItemCount:w},{groupCounts:D},E])=>{const{listState:B,minOverscanItemCount:P,topItemsIndexes:F,rangeChanged:te,...Q}=U;return Ne(te,E.scrollSeekRangeChanged),Ne(ce(E.windowViewportRect,be(z=>z.visibleHeight)),C.viewportHeight),{data:a,defaultItemHeight:r,firstItemIndex:i,fixedItemHeight:o,fixedGroupHeight:d,gap:p,groupCounts:D,heightEstimates:h,initialItemFinalLocationReached:k,initialTopMostItemIndex:A,scrolledToInitialItem:T,sizeRanges:m,topItemCount:w,topItemsIndexes:F,totalCount:j,...O,groupIndices:f,itemSize:x,listState:B,minOverscanItemCount:P,scrollToIndex:L,statefulTotalCount:v,trackItemSizes:S,rangeChanged:te,...Q,...E,...C,sizes:y,...M}},xt(Qn,Ms,ln,xj,pj,Sl,As,bj,vj,zg,jj));function Sj(a,r){const i={},o={};let d=0;const p=a.length;for(;d<p;)o[a[d]]=1,d+=1;for(const f in r)Object.hasOwn(o,f)||(i[f]=r[f]);return i}const Yi=typeof document<"u"?Ce.useLayoutEffect:Ce.useEffect;function $g(a,r,i){const o=Object.keys(r.required||{}),d=Object.keys(r.optional||{}),p=Object.keys(r.methods||{}),f=Object.keys(r.events||{}),h=Ce.createContext({});function x(T,C){T.propsReady!==void 0&&Ve(T.propsReady,!1);for(const M of o){const O=T[r.required[M]];Ve(O,C[M])}for(const M of d)if(M in C){const O=T[r.optional[M]];Ve(O,C[M])}T.propsReady!==void 0&&Ve(T.propsReady,!0)}function m(T){return p.reduce((C,M)=>(C[M]=O=>{const U=T[r.methods[M]];Ve(U,O)},C),{})}function y(T){return f.reduce((C,M)=>(C[M]=I0(T[r.events[M]]),C),{})}const v=Ce.forwardRef(function(T,C){const{children:M,...O}=T,[U]=Ce.useState(()=>go(U0(a),w=>{x(w,O)})),[L]=Ce.useState(hx(y,U));Yi(()=>{for(const w of f)w in O&&nt(L[w],O[w]);return()=>{Object.values(L).map(Au)}},[O,L,U]),Yi(()=>{x(U,O)}),Ce.useImperativeHandle(C,mx(m(U)));const V=i;return n.jsx(h.Provider,{value:U,children:i!==void 0?n.jsx(V,{...Sj([...o,...d,...f],O),children:M}):M})}),j=T=>{const C=Ce.useContext(h);return Ce.useCallback(M=>{Ve(C[T],M)},[C,T])},S=T=>{const C=Ce.useContext(h)[T],M=Ce.useCallback(O=>nt(C,O),[C]);return Ce.useSyncExternalStore(M,()=>bt(C),()=>bt(C))},k=T=>{const C=Ce.useContext(h)[T],[M,O]=Ce.useState(hx(bt,C));return Yi(()=>nt(C,U=>{U!==M&&O(mx(U))}),[C,M]),M},A=parseInt(Ce.version)>=18?S:k;return{Component:v,useEmitter:(T,C)=>{const M=Ce.useContext(h)[T];Yi(()=>nt(M,C),[C,M])},useEmitterValue:A,usePublisher:j}}const Pg=Ce.createContext(void 0),Gg=Ce.createContext(void 0),qd="-webkit-sticky",Nx="sticky",Iu=Ug(()=>{if(typeof document>"u")return Nx;const a=document.createElement("div");return a.style.position=qd,a.style.position===qd?qd:Nx}),Fg=typeof document<"u"?Ce.useLayoutEffect:Ce.useEffect;function Yd(a){return"self"in a}function kj(a){return"body"in a}function qg(a,r,i,o=vr,d,p){const f=Ce.useRef(null),h=Ce.useRef(null),x=Ce.useRef(null),m=Ce.useCallback(j=>{let S,k,A;const T=j.target;if(kj(T)||Yd(T)){const M=Yd(T)?T:T.defaultView;A=p===!0?M.scrollX:M.scrollY,S=p===!0?M.document.documentElement.scrollWidth:M.document.documentElement.scrollHeight,k=p===!0?M.innerWidth:M.innerHeight}else A=p===!0?T.scrollLeft:T.scrollTop,S=p===!0?T.scrollWidth:T.scrollHeight,k=p===!0?T.offsetWidth:T.offsetHeight;const C=()=>{a({scrollHeight:S,scrollTop:Math.max(A,0),viewportHeight:k})};j.suppressFlushSync===!0?C():bb.flushSync(C),h.current!==null&&(A===h.current||A<=0||A===S-k)&&(h.current=null,r(!0),x.current&&(clearTimeout(x.current),x.current=null))},[a,r,p]);Ce.useEffect(()=>{const j=d||f.current;return o(d||f.current),m({suppressFlushSync:!0,target:j}),j.addEventListener("scroll",m,{passive:!0}),()=>{o(null),j.removeEventListener("scroll",m)}},[f,m,i,o,d]);function y(j){const S=f.current;if(!S||(p===!0?"offsetWidth"in S&&S.offsetWidth===0:"offsetHeight"in S&&S.offsetHeight===0))return;const k=j.behavior==="smooth";let A,T,C;Yd(S)?(T=Math.max(Ya(S.document.documentElement,p===!0?"width":"height"),p===!0?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight),A=p===!0?S.innerWidth:S.innerHeight,C=p===!0?window.scrollX:window.scrollY):(T=S[p===!0?"scrollWidth":"scrollHeight"],A=Ya(S,p===!0?"width":"height"),C=S[p===!0?"scrollLeft":"scrollTop"]);const M=T-A;if(j.top=Math.ceil(Math.max(Math.min(M,j.top),0)),Dg(A,T)||j.top===C){a({scrollHeight:T,scrollTop:C,viewportHeight:A}),k&&r(!0);return}k?(h.current=j.top,x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{x.current=null,h.current=null,r(!0)},1e3)):h.current=null,p===!0&&(j={...j.behavior!==void 0?{behavior:j.behavior}:{},left:j.top}),S.scrollTo(j)}function v(j){p===!0&&(j={...j.behavior!==void 0?{behavior:j.behavior}:{},...j.top!==void 0?{left:j.top}:{}}),f.current.scrollBy(j)}return{scrollByCallback:v,scrollerRef:f,scrollToCallback:y}}function Hu(a){return a}const wj=et(()=>{const a=me(h=>`Item ${h}`),r=me(h=>`Group ${h}`),i=me({}),o=me(Hu),d=me("div"),p=me(vr),f=(h,x=null)=>Zt(ce(i,be(m=>m[h]),ht()),x);return{components:i,computeItemKey:o,EmptyPlaceholder:f("EmptyPlaceholder"),FooterComponent:f("Footer"),GroupComponent:f("Group","div"),groupContent:r,HeaderComponent:f("Header"),HeaderFooterTag:d,ItemComponent:f("Item","div"),itemContent:a,ListComponent:f("List","div"),ScrollerComponent:f("Scroller","div"),scrollerRef:p,ScrollSeekPlaceholder:f("ScrollSeekPlaceholder"),TopItemListComponent:f("TopItemList")}}),Cj=et(([a,r])=>({...a,...r}),xt(Vg,wj)),Nj=({height:a})=>n.jsx("div",{style:{height:a}}),Ej={overflowAnchor:"none",position:Iu(),zIndex:1},Yg={overflowAnchor:"none"},Tj={...Yg,display:"inline-block",height:"100%"},Ex=Ce.memo(function({showTopList:a=!1}){const r=Be("listState"),i=On("sizeRanges"),o=Be("useWindowScroll"),d=Be("customScrollParent"),p=On("windowScrollContainerState"),f=On("scrollContainerState"),h=d||o?p:f,x=Be("itemContent"),m=Be("context"),y=Be("groupContent"),v=Be("trackItemSizes"),j=Be("itemSize"),S=Be("log"),k=On("gap"),A=Be("horizontalDirection"),{callbackRef:T}=P0(i,j,v,a?vr:h,S,k,d,A,Be("skipAnimationFrameInResizeObserver")),[C,M]=Ce.useState(0);Uu("deviation",Q=>{C!==Q&&M(Q)});const O=Be("EmptyPlaceholder"),U=Be("ScrollSeekPlaceholder")??Nj,L=Be("ListComponent"),V=Be("ItemComponent"),w=Be("GroupComponent"),D=Be("computeItemKey"),E=Be("isSeeking"),B=Be("groupIndices").length>0,P=Be("alignToBottom"),F=Be("initialItemFinalLocationReached"),te=a?{}:{boxSizing:"border-box",...A?{display:"inline-block",height:"100%",marginLeft:C!==0?C:P?"auto":0,paddingLeft:r.offsetTop,paddingRight:r.offsetBottom,whiteSpace:"nowrap"}:{marginTop:C!==0?C:P?"auto":0,paddingBottom:r.offsetBottom,paddingTop:r.offsetTop},...F?{}:{visibility:"hidden"}};return!a&&r.totalCount===0&&O!==null&&O!==void 0?n.jsx(O,{...Qt(O,m)}):n.jsx(L,{...Qt(L,m),"data-testid":a?"virtuoso-top-item-list":"virtuoso-item-list",ref:T,style:te,children:(a?r.topItems:r.items).map(Q=>{const z=Q.originalIndex,R=D(z+r.firstItemIndex,Q.data,m);return E?g.createElement(U,{...Qt(U,m),height:Q.size,index:Q.index,key:R,type:Q.type||"item",...Q.type==="group"?{}:{groupIndex:Q.groupIndex}}):Q.type==="group"?g.createElement(w,{...Qt(w,m),"data-index":z,"data-item-index":Q.index,"data-known-size":Q.size,key:R,style:Ej},y(Q.index,m)):g.createElement(V,{...Qt(V,m),...zj(V,Q.data),"data-index":z,"data-item-group-index":Q.groupIndex,"data-item-index":Q.index,"data-known-size":Q.size,key:R,style:A?Tj:Yg},B?x(Q.index,Q.groupIndex,Q.data,m):x(Q.index,Q.data,m))})})}),Rj={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Aj={outline:"none",overflowX:"auto",position:"relative"},yo=a=>({height:"100%",position:"absolute",top:0,width:"100%",...a?{display:"flex",flexDirection:"column"}:void 0}),Mj={position:Iu(),top:0,width:"100%",zIndex:1};function Qt(a,r){if(typeof a!="string")return{context:r}}function zj(a,r){return{item:typeof a=="string"?void 0:r}}const Lj=Ce.memo(function(){const a=Be("HeaderComponent"),r=On("headerHeight"),i=Be("HeaderFooterTag"),o=jl(Ce.useMemo(()=>p=>{r(Ya(p,"height"))},[r]),!0,Be("skipAnimationFrameInResizeObserver")),d=Be("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,d)})}):null}),Dj=Ce.memo(function(){const a=Be("FooterComponent"),r=On("footerHeight"),i=Be("HeaderFooterTag"),o=jl(Ce.useMemo(()=>p=>{r(Ya(p,"height"))},[r]),!0,Be("skipAnimationFrameInResizeObserver")),d=Be("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,d)})}):null});function Wg({useEmitter:a,useEmitterValue:r,usePublisher:i}){return Ce.memo(function({children:o,style:d,context:p,...f}){const h=i("scrollContainerState"),x=r("ScrollerComponent"),m=i("smoothScrollTargetReached"),y=r("scrollerRef"),v=r("horizontalDirection")||!1,{scrollByCallback:j,scrollerRef:S,scrollToCallback:k}=qg(h,m,x,y,void 0,v);return a("scrollTo",k),a("scrollBy",j),n.jsx(x,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:S,style:{...v?Aj:Rj,...d},tabIndex:0,...f,...Qt(x,p),children:o})})}function Kg({useEmitter:a,useEmitterValue:r,usePublisher:i}){return Ce.memo(function({children:o,style:d,context:p,...f}){const h=i("windowScrollContainerState"),x=r("ScrollerComponent"),m=i("smoothScrollTargetReached"),y=r("totalListHeight"),v=r("deviation"),j=r("customScrollParent"),S=Ce.useRef(null),k=r("scrollerRef"),{scrollByCallback:A,scrollerRef:T,scrollToCallback:C}=qg(h,m,x,k,j);return Fg(()=>{var M;return T.current=j||((M=S.current)==null?void 0:M.ownerDocument.defaultView),()=>{T.current=null}},[T,j]),a("windowScrollTo",C),a("scrollBy",A),n.jsx(x,{ref:S,"data-virtuoso-scroller":!0,style:{position:"relative",...d,...y!==0?{height:y+v}:void 0},...f,...Qt(x,p),children:o})})}const _j=({children:a})=>{const r=Ce.useContext(Pg),i=On("viewportHeight"),o=On("fixedItemHeight"),d=Be("alignToBottom"),p=Be("horizontalDirection"),f=Ce.useMemo(()=>bg(i,x=>Ya(x,p?"width":"height")),[i,p]),h=jl(f,!0,Be("skipAnimationFrameInResizeObserver"));return Ce.useEffect(()=>{r&&(i(r.viewportHeight),o(r.itemHeight))},[r,i,o]),n.jsx("div",{"data-viewport-type":"element",ref:h,style:yo(d),children:a})},Oj=({children:a})=>{const r=Ce.useContext(Pg),i=On("windowViewportRect"),o=On("fixedItemHeight"),d=Be("customScrollParent"),p=Sg(i,d,Be("skipAnimationFrameInResizeObserver")),f=Be("alignToBottom");return Ce.useEffect(()=>{r&&(o(r.itemHeight),i({listHeight:0,offsetTop:0,visibleHeight:r.viewportHeight,visibleWidth:100}))},[r,i,o]),n.jsx("div",{"data-viewport-type":"window",ref:p,style:yo(f),children:a})},Bj=({children:a})=>{const r=Be("TopItemListComponent")??"div",i=Be("headerHeight"),o={...Mj,marginTop:`${i}px`},d=Be("context");return n.jsx(r,{style:o,...Qt(r,d),children:a})},Ij=Ce.memo(function(a){const r=Be("useWindowScroll"),i=Be("topItemsIndexes").length>0,o=Be("customScrollParent"),d=Be("context");return n.jsxs(o||r?Vj:Uj,{...a,context:d,children:[i&&n.jsx(Bj,{children:n.jsx(Ex,{showTopList:!0})}),n.jsxs(o||r?Oj:_j,{children:[n.jsx(Lj,{}),n.jsx(Ex,{}),n.jsx(Dj,{})]})]})}),{Component:Hj,useEmitter:Uu,useEmitterValue:Be,usePublisher:On}=$g(Cj,{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"}},Ij),Uj=Wg({useEmitter:Uu,useEmitterValue:Be,usePublisher:On}),Vj=Kg({useEmitter:Uu,useEmitterValue:Be,usePublisher:On}),$j=Hj,Pj=et(()=>{const a=me(m=>n.jsxs("td",{children:["Item $",m]})),r=me(null),i=me(m=>n.jsxs("td",{colSpan:1e3,children:["Group ",m]})),o=me(null),d=me(null),p=me({}),f=me(Hu),h=me(vr),x=(m,y=null)=>Zt(ce(p,be(v=>v[m]),ht()),y);return{components:p,computeItemKey:f,context:r,EmptyPlaceholder:x("EmptyPlaceholder"),FillerRow:x("FillerRow"),fixedFooterContent:d,fixedHeaderContent:o,itemContent:a,groupContent:i,ScrollerComponent:x("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:x("ScrollSeekPlaceholder"),TableBodyComponent:x("TableBody","tbody"),TableComponent:x("Table","table"),TableFooterComponent:x("TableFoot","tfoot"),TableHeadComponent:x("TableHead","thead"),TableRowComponent:x("TableRow","tr"),GroupComponent:x("Group","tr")}});xt(Vg,Pj);Iu();const Tx={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},Gj={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Rx,floor:co,max:js,min:Wd,round:Ax}=Math;function Mx(a,r,i){return Array.from({length:r-a+1}).map((o,d)=>({data:i===null?null:i[d+a],index:d+a}))}function Fj(a){return{...Gj,items:a}}function Wi(a,r){return a!==void 0&&a.width===r.width&&a.height===r.height}function qj(a,r){return a!==void 0&&a.column===r.column&&a.row===r.row}const Yj=et(([{increaseViewportBy:a,listBoundary:r,overscan:i,visibleRange:o},{footerHeight:d,headerHeight:p,scrollBy:f,scrollContainerState:h,scrollTo:x,scrollTop:m,smoothScrollTargetReached:y,viewportHeight:v},j,S,{didMount:k,propsReady:A},{customScrollParent:T,useWindowScroll:C,windowScrollContainerState:M,windowScrollTo:O,windowViewportRect:U},L])=>{const V=me(0),w=me(0),D=me(Tx),E=me({height:0,width:0}),B=me({height:0,width:0}),P=Xe(),F=Xe(),te=me(0),Q=me(null),z=me({column:0,row:0}),R=Xe(),I=Xe(),Z=me(!1),q=me(0),de=me(!0),_=me(!1),W=me(!1);nt(ce(k,Pe(q),ze(([oe,Se])=>Se!==0)),()=>{Ve(de,!1)}),nt(ce(_t(k,de,B,E,q,_),ze(([oe,Se,De,Ie,,ae])=>oe&&!Se&&De.height!==0&&Ie.height!==0&&!ae)),([,,,,oe])=>{Ve(_,!0),Du(1,()=>{Ve(P,oe)}),Pn(ce(m),()=>{Ve(r,[0,0]),Ve(de,!0)})}),Ne(ce(I,ze(oe=>oe!=null&&oe.scrollTop>0),Kn(0)),w),nt(ce(k,Pe(I),ze(([,oe])=>oe!=null)),([,oe])=>{oe&&(Ve(E,oe.viewport),Ve(B,oe.item),Ve(z,oe.gap),oe.scrollTop>0&&(Ve(Z,!0),Pn(ce(m,yl(1)),Se=>{Ve(Z,!1)}),Ve(x,{top:oe.scrollTop})))}),Ne(ce(E,be(({height:oe})=>oe)),v),Ne(ce(_t(Me(E,Wi),Me(B,Wi),Me(z,(oe,Se)=>oe!==void 0&&oe.column===Se.column&&oe.row===Se.row),Me(m)),be(([oe,Se,De,Ie])=>({gap:De,item:Se,scrollTop:Ie,viewport:oe}))),R),Ne(ce(_t(Me(V),o,Me(z,qj),Me(B,Wi),Me(E,Wi),Me(Q),Me(w),Me(Z),Me(de),Me(q)),ze(([,,,,,,,oe])=>!oe),be(([oe,[Se,De],Ie,ae,pe,fe,he,,ve,_e])=>{const{column:re,row:Te}=Ie,{height:Qe,width:at}=ae,{width:$t}=pe;if(he===0&&(oe===0||$t===0))return Tx;if(at===0){const rt=_u(_e,oe),Qa=rt+Math.max(he-1,0);return Fj(Mx(rt,Qa,fe))}const Pt=Xg($t,at,re);let lt,St;ve?Se===0&&De===0&&he>0?(lt=0,St=he-1):(lt=Pt*co((Se+Te)/(Qe+Te)),St=Pt*Rx((De+Te)/(Qe+Te))-1,St=Wd(oe-1,js(St,Pt-1)),lt=Wd(St,js(0,lt))):(lt=0,St=-1);const ye=Mx(lt,St,fe),{bottom:At,top:Le}=zx(pe,Ie,ae,ye),gt=Rx(oe/Pt),Kt=gt*Qe+(gt-1)*Te-At;return{bottom:At,itemHeight:Qe,items:ye,itemWidth:at,offsetBottom:Kt,offsetTop:Le,top:Le}})),D),Ne(ce(Q,ze(oe=>oe!==null),be(oe=>oe.length)),V),Ne(ce(_t(E,B,D,z),ze(([oe,Se,{items:De}])=>De.length>0&&Se.height!==0&&oe.height!==0),be(([oe,Se,{items:De},Ie])=>{const{bottom:ae,top:pe}=zx(oe,Ie,Se,De);return[pe,ae]}),ht(Cs)),r);const ie=me(!1);Ne(ce(m,Pe(ie),be(([oe,Se])=>Se||oe!==0)),ie);const ue=Sn(ce(_t(D,V),ze(([{items:oe}])=>oe.length>0),Pe(ie),ze(([[oe,Se],De])=>{const Ie=oe.items[oe.items.length-1].index===Se-1;return(De||oe.bottom>0&&oe.itemHeight>0&&oe.offsetBottom===0&&oe.items.length===Se)&&Ie}),be(([[,oe]])=>oe-1),ht())),ge=Sn(ce(Me(D),ze(({items:oe})=>oe.length>0&&oe[0].index===0),Kn(0),ht())),xe=Sn(ce(Me(D),Pe(Z),ze(([{items:oe},Se])=>oe.length>0&&!Se),be(([{items:oe}])=>({endIndex:oe[oe.length-1].index,startIndex:oe[0].index})),ht(Tg),va(0)));Ne(xe,S.scrollSeekRangeChanged),Ne(ce(P,Pe(E,B,V,z),be(([oe,Se,De,Ie,ae])=>{const pe=Lg(oe),{align:fe,behavior:he,offset:ve}=pe;let _e=pe.index;_e==="LAST"&&(_e=Ie-1),_e=js(0,_e,Wd(Ie-1,_e));let re=yu(Se,ae,De,_e);return fe==="end"?re=Ax(re-Se.height+De.height):fe==="center"&&(re=Ax(re-Se.height/2+De.height/2)),ve!==void 0&&ve!==0&&(re+=ve),{behavior:he,top:re}})),x);const we=Zt(ce(D,be(oe=>oe.offsetBottom+oe.bottom)),0);return Ne(ce(U,be(oe=>({height:oe.visibleHeight,width:oe.visibleWidth}))),E),{customScrollParent:T,data:Q,deviation:te,footerHeight:d,gap:z,headerHeight:p,increaseViewportBy:a,initialItemCount:w,itemDimensions:B,overscan:i,restoreStateFrom:I,scrollBy:f,scrollContainerState:h,scrollHeight:F,scrollTo:x,scrollToIndex:P,scrollTop:m,smoothScrollTargetReached:y,totalCount:V,useWindowScroll:C,viewportDimensions:E,windowScrollContainerState:M,windowScrollTo:O,windowViewportRect:U,...S,gridState:D,horizontalDirection:W,initialTopMostItemIndex:q,totalListHeight:we,...j,endReached:ue,propsReady:A,rangeChanged:xe,startReached:ge,stateChanged:R,stateRestoreInProgress:Z,...L}},xt(Ou,ln,zs,Hg,Xa,Bu,Ka));function Xg(a,r,i){return js(1,co((a+i)/(co(r)+i)))}function zx(a,r,i,o){const{height:d}=i;if(d===void 0||o.length===0)return{bottom:0,top:0};const p=yu(a,r,i,o[0].index);return{bottom:yu(a,r,i,o[o.length-1].index)+d,top:p}}function yu(a,r,i,o){const d=Xg(a.width,i.width,r.column),p=co(o/d),f=p*i.height+js(0,p-1)*r.row;return f>0?f+r.row:f}const Wj=et(()=>{const a=me(v=>`Item ${v}`),r=me({}),i=me(null),o=me("virtuoso-grid-item"),d=me("virtuoso-grid-list"),p=me(Hu),f=me("div"),h=me(vr),x=(v,j=null)=>Zt(ce(r,be(S=>S[v]),ht()),j),m=me(!1),y=me(!1);return Ne(Me(y),m),{components:r,computeItemKey:p,context:i,FooterComponent:x("Footer"),HeaderComponent:x("Header"),headerFooterTag:f,itemClassName:o,ItemComponent:x("Item","div"),itemContent:a,listClassName:d,ListComponent:x("List","div"),readyStateChanged:m,reportReadyState:y,ScrollerComponent:x("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:x("ScrollSeekPlaceholder","div")}}),Kj=et(([a,r])=>({...a,...r}),xt(Yj,Wj)),Xj=Ce.memo(function(){const a=yt("gridState"),r=yt("listClassName"),i=yt("itemClassName"),o=yt("itemContent"),d=yt("computeItemKey"),p=yt("isSeeking"),f=Bn("scrollHeight"),h=yt("ItemComponent"),x=yt("ListComponent"),m=yt("ScrollSeekPlaceholder"),y=yt("context"),v=Bn("itemDimensions"),j=Bn("gap"),S=yt("log"),k=yt("stateRestoreInProgress"),A=Bn("reportReadyState"),T=jl(Ce.useMemo(()=>C=>{const M=C.parentElement.parentElement.scrollHeight;f(M);const O=C.firstChild;if(O!==null){const{height:U,width:L}=O.getBoundingClientRect();v({height:U,width:L})}j({column:Lx("column-gap",getComputedStyle(C).columnGap,S),row:Lx("row-gap",getComputedStyle(C).rowGap,S)})},[f,v,j,S]),!0,!1);return Fg(()=>{a.itemHeight>0&&a.itemWidth>0&&A(!0)},[a]),k?null:n.jsx(x,{className:r,ref:T,...Qt(x,y),"data-testid":"virtuoso-item-list",style:{paddingBottom:a.offsetBottom,paddingTop:a.offsetTop},children:a.items.map(C=>{const M=d(C.index,C.data,y);return p?n.jsx(m,{...Qt(m,y),height:a.itemHeight,index:C.index,width:a.itemWidth},M):g.createElement(h,{...Qt(h,y),className:i,"data-index":C.index,key:M},o(C.index,C.data,y))})})}),Qj=Ce.memo(function(){const a=yt("HeaderComponent"),r=Bn("headerHeight"),i=yt("headerFooterTag"),o=jl(Ce.useMemo(()=>p=>{r(Ya(p,"height"))},[r]),!0,!1),d=yt("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,d)})}):null}),Zj=Ce.memo(function(){const a=yt("FooterComponent"),r=Bn("footerHeight"),i=yt("headerFooterTag"),o=jl(Ce.useMemo(()=>p=>{r(Ya(p,"height"))},[r]),!0,!1),d=yt("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,d)})}):null}),Jj=({children:a})=>{const r=Ce.useContext(Gg),i=Bn("itemDimensions"),o=Bn("viewportDimensions"),d=jl(Ce.useMemo(()=>p=>{o(p.getBoundingClientRect())},[o]),!0,!1);return Ce.useEffect(()=>{r&&(o({height:r.viewportHeight,width:r.viewportWidth}),i({height:r.itemHeight,width:r.itemWidth}))},[r,o,i]),n.jsx("div",{ref:d,style:yo(!1),children:a})},e2=({children:a})=>{const r=Ce.useContext(Gg),i=Bn("windowViewportRect"),o=Bn("itemDimensions"),d=yt("customScrollParent"),p=Sg(i,d,!1);return Ce.useEffect(()=>{r&&(o({height:r.itemHeight,width:r.itemWidth}),i({listHeight:0,offsetTop:0,visibleHeight:r.viewportHeight,visibleWidth:r.viewportWidth}))},[r,i,o]),n.jsx("div",{ref:p,style:yo(!1),children:a})},t2=Ce.memo(function({...a}){const r=yt("useWindowScroll"),i=yt("customScrollParent"),o=i||r?a2:n2,d=i||r?e2:Jj,p=yt("context");return n.jsx(o,{...a,...Qt(o,p),children:n.jsxs(d,{children:[n.jsx(Qj,{}),n.jsx(Xj,{}),n.jsx(Zj,{})]})})}),{useEmitter:Qg,useEmitterValue:yt,usePublisher:Bn}=$g(Kj,{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"}},t2),n2=Wg({useEmitter:Qg,useEmitterValue:yt,usePublisher:Bn}),a2=Kg({useEmitter:Qg,useEmitterValue:yt,usePublisher:Bn});function Lx(a,r,i){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&i(`${a} was not resolved to pixel value correctly`,r,It.WARN),r==="normal"?0:parseInt(r??"0",10)}const l2={source:"vskill-sidebar-own-collapsed",installed:"vskill-sidebar-installed-collapsed"},Zg={source:"Own",installed:"Installed"};function r2(a){try{const r=localStorage.getItem(a);if(r!=null)return r==="true"}catch{}try{if(typeof sessionStorage<"u"){const r=sessionStorage.getItem(a);if(r!=null)return r==="true"}}catch{}return!1}function s2(a,r){const i=r?"true":"false";try{localStorage.setItem(a,i)}catch{}try{typeof sessionStorage<"u"&&sessionStorage.setItem(a,i)}catch{}}function Dx({origin:a,count:r,filteredCount:i,updateCount:o,children:d}){const p=l2[a],[f,h]=g.useState(()=>r2(p)),x=g.useCallback(()=>{h(j=>{const S=!j;return s2(p,S),S})},[p]),m=Zg[a],y=`sidebar-section-${a}-header`,v=`sidebar-section-${a}-group`;return n.jsxs("section",{"aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:[n.jsxs("button",{id:y,type:"button","data-testid":"sidebar-section-header","aria-expanded":!f,"aria-controls":v,onClick:x,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 12px 6px 14px",background:"transparent",border:"none",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",textAlign:"left"},children:[n.jsx(o2,{collapsed:f}),n.jsx("h2",{"aria-level":2,style:{fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)",margin:0},children:m}),n.jsx("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:i!=null&&i!==r?`(${i} of ${r})`:`(${r})`}),o!=null&&o>0&&n.jsx(i2,{origin:a,updateCount:o})]}),!f&&n.jsx("div",{id:v,role:"group","aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:d})]})}function i2({origin:a,updateCount:r}){const[i,o]=g.useState(!1),d=Zg[a].toLowerCase(),p=`${r} updates available in ${d} section, view all`;return n.jsxs("span",{role:"link",tabIndex:0,"data-testid":"sidebar-section-update-chip","aria-label":p,onClick:f=>{f.stopPropagation(),window.location.hash="#/updates"},onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),f.stopPropagation(),window.location.hash="#/updates")},onFocus:()=>o(!0),onBlur:()=>o(!1),style:{display:"inline-flex",alignItems:"center",gap:2,fontSize:10,color:"var(--color-own)",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",cursor:"pointer",padding:"0 4px",borderRadius:3,outline:i?"2px solid var(--border-focus)":"none",outlineOffset:2},children:[r," updates",n.jsx("span",{"aria-hidden":"true",style:{fontSize:9,marginLeft:2},children:"▾"})]})}function o2({collapsed:a}){return n.jsx("svg",{"aria-hidden":"true",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:a?"rotate(0deg)":"rotate(90deg)",transition:"transform var(--duration-fast, 120ms) var(--ease-standard, ease)",flexShrink:0},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Vu(a,r){const i=r.trim().toLowerCase();return i?a.skill.toLowerCase().includes(i)||a.plugin.toLowerCase().includes(i)||a.dir.toLowerCase().includes(i):!0}function c2({value:a,onChange:r,placeholder:i="Filter skills…",validationPattern:o,validationMessage:d="Invalid filter expression"}){const p=g.useRef(null),f=g.useId(),h=!!o&&a.trim()!==""&&!o.test(a);return g.useEffect(()=>{function x(m){var j;if(m.key!=="/")return;const y=m.target;if(!y)return;const v=y.tagName;v==="INPUT"||v==="TEXTAREA"||y.isContentEditable||(m.preventDefault(),(j=p.current)==null||j.focus())}return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[]),n.jsxs("div",{role:"search",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",borderBottom:"1px solid var(--border-default)"},children:[n.jsxs("svg",{"aria-hidden":"true",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[n.jsx("circle",{cx:"11",cy:"11",r:"8"}),n.jsx("path",{d:"M21 21l-4.35-4.35"})]}),n.jsx("input",{ref:p,type:"search","aria-label":"Filter skills","aria-invalid":h?!0:void 0,"aria-describedby":h?f:void 0,value:a,placeholder:i,onChange:x=>r(x.currentTarget.value),onKeyDown:x=>{x.key==="Escape"&&(r(""),x.currentTarget.blur())},style:{flex:1,minWidth:0,border:"none",outline:"none",background:"transparent",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:12,padding:"2px 0"}}),h&&n.jsx("span",{id:f,role:"alert","aria-live":"polite",style:{fontFamily:"var(--font-sans)",fontSize:10,color:"var(--text-error, #B42318)",marginLeft:4,whiteSpace:"nowrap"},children:d}),n.jsx("kbd",{"aria-hidden":"true",style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",border:"1px solid var(--border-default)",padding:"1px 5px",borderRadius:3,display:a?"none":"inline-block"},children:"/"})]})}function d2({target:a}){const r=typeof a=="string"&&a.length>0,i=r?`symlinked → ${a}`:"symlinked — cycle detected or target unresolved",o=r?`symlinked from ${a}`:"symlinked, target unresolved";return n.jsx("span",{"data-testid":"symlink-chip",role:"img","aria-label":o,title:i,tabIndex:0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:14,height:14,borderRadius:3,color:"var(--text-secondary)",flexShrink:0},children:n.jsxs("svg",{"data-testid":"symlink-glyph",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),n.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})})}function u2({skill:a}){if(!a.updateAvailable)return null;const r=a.currentVersion??"",i=a.latestVersion,o=i?`Update available: ${r} → ${i}`.trim():"Update available";return n.jsx("span",{"data-testid":"skill-row-update-glyph",title:o,"aria-label":"Update available",style:{color:"var(--color-own)",display:"inline-flex",flexShrink:0},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 19V5"}),n.jsx("path",{d:"M5 12l7-7 7 7"})]})})}function f2({skill:a,isSelected:r,onSelect:i,onContextMenu:o}){const d=a.origin==="installed"?"var(--status-installed)":"var(--status-own)";return n.jsxs("button",{type:"button",onClick:i,onContextMenu:o?p=>{p.preventDefault(),o(p,a)}:void 0,"aria-current":r?"true":void 0,"aria-selected":!!r,"data-testid":"skill-row","data-selected":r,"data-origin":a.origin,style:{display:"flex",alignItems:"center",gap:8,width:"100%",height:36,padding:"0 12px 0 14px",background:r?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",boxShadow:r?"inset 2px 0 0 var(--color-accent, var(--accent-surface))":"none",border:"none",borderRadius:0,color:"var(--text-primary)",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:13,textAlign:"left",transition:"background-color var(--duration-fast, 120ms) var(--ease-standard, ease), box-shadow var(--duration-base, 180ms) var(--ease-standard, ease)"},children:[n.jsx("span",{"aria-hidden":"true","aria-label":a.updateAvailable?"Update available":void 0,title:a.updateAvailable?`Update available${a.latestVersion?` → ${a.latestVersion}`:""}`:void 0,style:{width:a.updateAvailable?10:6,height:a.updateAvailable?10:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0,boxShadow:a.updateAvailable?"0 0 0 2px var(--color-own, #d97706)":"none",transition:"box-shadow 180ms ease, width 180ms ease, height 180ms ease"}}),n.jsx("span",{title:a.skill,style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.skill}),a.version&&n.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",flexShrink:0},children:a.version}),a.isSymlink&&n.jsx(d2,{target:a.symlinkTarget??null}),n.jsx(u2,{skill:a})]})}const uo=g.memo(f2);function p2({plugin:a,skills:r,selectedKey:i,onSelect:o,onContextMenu:d}){const p=[...r].sort((f,h)=>f.skill.localeCompare(h.skill));return n.jsxs("div",{role:"group","aria-label":`${a} (${r.length})`,children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:a,children:a}),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",r.length,")"]})]}),n.jsx("div",{role:"list",children:p.map(f=>{const h=!!i&&i.plugin===f.plugin&&i.skill===f.skill;return n.jsx("div",{role:"listitem",children:n.jsx(uo,{skill:f,isSelected:h,onSelect:()=>o(f),onContextMenu:d})},`${f.plugin}/${f.skill}`)})})]})}function m2(a,r){if(!a||typeof window>"u")return r;try{const i=window.localStorage.getItem(a);return i===null?r:i==="true"}catch{return r}}function _x({skills:a,pluginName:r,initialCollapsed:i=!1,persistKey:o,renderSkill:d,headerActionSlot:p}){var v;const f=r??((v=a[0])==null?void 0:v.pluginName)??"unknown-plugin",[h,x]=g.useState(()=>m2(o,i)),m=g.useCallback(()=>{x(j=>{const S=!j;if(o&&typeof window<"u")try{window.localStorage.setItem(o,String(S))}catch{}return S})},[o]),y=h?"▸":"▾";return n.jsxs("div",{"data-vskill-plugin-tree":f,role:"group","aria-label":`${f} (${a.length})`,children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",paddingRight:6},children:[n.jsxs("button",{type:"button",onClick:m,"aria-expanded":!h,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:[n.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:y}),n.jsx("span",{className:"vskill-plugin-name",style:{fontFamily:"var(--font-mono)"},children:f}),n.jsxs("span",{className:"vskill-plugin-count tabular-nums",style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:["(",a.length,")"]})]}),p&&n.jsx("div",{style:{display:"inline-flex",alignItems:"center",flexShrink:0},children:p})]}),!h&&n.jsx("div",{className:"vskill-plugin-tree-children",style:{paddingLeft:36,borderLeft:"1px solid var(--border-subtle, rgba(128,128,128,0.2))",marginLeft:24},children:a.map(j=>n.jsx("div",{"data-vskill-plugin-skill":j.pluginNamespace??j.skill,children:d(j)},`${j.pluginNamespace??j.skill}`))})]})}function h2({pluginName:a,enabled:r,onAfterAction:i}){const[o,d]=g.useState(!1),[p,f]=g.useState(null),[h,x]=g.useState(null),m=g.useRef(null);g.useEffect(()=>{if(!o)return;function v(j){m.current&&!m.current.contains(j.target)&&d(!1)}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]);async function y(v){f(v),x(null);try{if(v==="uninstall"&&!window.confirm(`Uninstall ${a}? This removes the plugin and its skills.`)){f(null);return}const j=await fetch(`/api/plugins/${encodeURIComponent(a)}/${v}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),S=await j.json().catch(()=>({}));if(!j.ok||!S.ok){x(S.error??`${v} failed (${j.status})`);return}an("skills"),an("plugins"),i==null||i(),d(!1)}catch(j){x(j instanceof Error?j.message:String(j))}finally{f(null)}}return n.jsxs("div",{ref:m,style:{position:"relative",display:"inline-flex"},children:[n.jsx("button",{type:"button","aria-label":`Manage ${a}`,title:`Manage ${a}`,onClick:v=>{v.stopPropagation(),d(j=>!j)},"data-vskill-plugin-action-trigger":a,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&&n.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?n.jsx(Kd,{onClick:()=>void y("disable"),disabled:p!==null,busy:p==="disable",label:"Disable",hint:"Keep installed, turn off"}):n.jsx(Kd,{onClick:()=>void y("enable"),disabled:p!==null,busy:p==="enable",label:"Enable",hint:"Activate plugin"}),n.jsx(Kd,{onClick:()=>void y("uninstall"),disabled:p!==null,busy:p==="uninstall",label:"Uninstall",hint:"Remove plugin + skills",danger:!0}),h&&n.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 Kd({onClick:a,disabled:r,busy:i,label:o,hint:d,danger:p}){return n.jsxs("button",{type:"button",onClick:f=>{f.stopPropagation(),a()},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:p?"var(--color-error, #b91c1c)":"var(--text-primary)",opacity:r&&!i?.5:1,fontFamily:"inherit"},onMouseEnter:f=>{r||(f.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.05))")},onMouseLeave:f=>{f.currentTarget.style.background="transparent"},children:[n.jsx("div",{style:{fontSize:12,fontWeight:500},children:i?`${o}…`:o}),n.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)"},children:d})]})}function Ox({name:a,count:r,className:i,variant:o,collapsed:d,onToggle:p,action:f}){const h=o==="authoring"?"var(--color-own, #f59e0b)":"var(--color-accent, #2f6f8f)",x=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 p=="function",y={position:"sticky",top:0,zIndex:4,backdropFilter:"saturate(1.4) blur(10px)",WebkitBackdropFilter:"saturate(1.4) blur(10px)",background:x,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=d?"▸":"▾",j=n.jsxs(n.Fragment,{children:[m&&n.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}),n.jsx("span",{className:"vskill-group-header-name",children:a}),n.jsxs("span",{className:"vskill-group-header-count tabular-nums",style:{fontFamily:"var(--font-mono)",fontSize:11,fontWeight:500,color:"var(--text-secondary)",letterSpacing:0,textTransform:"none"},children:["(",r,")"]}),f&&n.jsx("span",{style:{marginLeft:"auto"},children:n.jsx(x2,{label:f.label,title:f.title,icon:f.icon,onClick:f.onClick,accent:h})})]});return m?n.jsx("button",{type:"button","data-vskill-group-header":a,className:["vskill-group-header select-none",i??""].join(" ").trim(),style:y,onClick:()=>p(!d),"aria-expanded":!d,children:j}):n.jsx("div",{"data-vskill-group-header":a,role:"heading","aria-level":3,className:["vskill-group-header select-none",i??""].join(" ").trim(),style:y,children:j})}function x2({label:a,title:r,icon:i,onClick:o,accent:d}){return n.jsxs("button",{type:"button","aria-label":a,title:r??a,onClick:p=>{p.stopPropagation(),o()},style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4,height:22,padding:"0 7px",border:`1px solid ${d}`,background:"transparent",color:d,borderRadius:4,fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",cursor:"pointer",fontFamily:"inherit"},onMouseEnter:p=>{p.currentTarget.style.background=`color-mix(in oklch, ${d} 15%, transparent)`},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:[i,a]})}function g2(){return n.jsxs("div",{"aria-hidden":"true",role:"presentation",style:{display:"flex",alignItems:"center",gap:8,height:36,padding:"0 12px 0 14px"},children:[n.jsx("span",{className:"placeholder",style:{width:6,height:6,borderRadius:"50%",flexShrink:0}}),n.jsx("span",{className:"placeholder",style:{height:10,flex:1,borderRadius:3,maxWidth:180}})]})}function v2(a){const r=a.key.split("+").map(h=>h.trim()).filter(Boolean);let i=!!a.meta,o=!!a.ctrl,d=!!a.shift,p=!!a.alt,f=a.key;if(r.length>1){for(const h of r.slice(0,-1)){const x=h.toLowerCase();x==="cmd"||x==="meta"||x==="⌘"?i=!0:x==="ctrl"||x==="control"?o=!0:x==="shift"?d=!0:(x==="alt"||x==="option")&&(p=!0)}f=r[r.length-1]}return{key:f.length===1?f.toLowerCase():f,meta:i,ctrl:o,shift:d,alt:p,allowInInputs:!!a.allowInInputs,handler:a.handler}}function y2(a){if(!a||!(a instanceof HTMLElement))return!1;const r=a.tagName;if(r==="INPUT"||r==="TEXTAREA"||a.isContentEditable)return!0;const i=a.getAttribute("contenteditable");return i!=null&&i!=="false"||a.getAttribute("role")==="textbox"}function b2(a,r){const i=!!a.metaKey,o=!!a.ctrlKey,d=!!a.shiftKey,p=!!a.altKey;return i!==r.meta||o!==r.ctrl||d!==r.shift||p!==r.alt?!1:(a.key.length===1?a.key.toLowerCase():a.key)===r.key}function bu(a,r={}){const{enabled:i=!0,target:o}=r,d=g.useRef([]),p=Array.isArray(a)?a:[a];d.current=p.map(v2),g.useEffect(()=>{if(!i)return;const f=o??(typeof window<"u"?window:void 0);if(!f)return;function h(x){const m=x,y=y2(m.target);for(const v of d.current){if(!b2(m,v))continue;const j=v.meta||v.ctrl||v.alt;if(!(y&&!v.allowInInputs&&!j)){v.handler(m);return}}}return f.addEventListener("keydown",h),()=>{f.removeEventListener("keydown",h)}},[i,o])}const j2=200;function S2(a){return a.scope==="own"||a.scope==="installed"||a.scope==="global"?a.scope:a.origin==="installed"?"installed":"own"}function k2(a,r){const i={availableProject:[],availablePersonal:[],availablePlugin:[],authoringProject:[],authoringPlugin:[]};for(const d of a){const p=d.scopeV2??(d.scope==="installed"?"available-project":d.scope==="global"?"available-personal":"authoring-project");p==="available-project"?i.availableProject.push(d):p==="available-personal"?i.availablePersonal.push(d):p==="available-plugin"?i.availablePlugin.push(d):p==="authoring-plugin"?i.authoringPlugin.push(d):i.authoringProject.push(d)}function o(d){const p=d.filter(x=>Vu(x,r)),f={};for(const x of p){const m=x.pluginName??x.plugin;(f[m]||(f[m]=[])).push(x)}const h=Object.entries(f).sort((x,m)=>x[0].localeCompare(m[0]));return{total:d.length,filtered:p.length,byPlugin:h}}return{availableProject:o(i.availableProject),availablePersonal:o(i.availablePersonal),availablePlugin:o(i.availablePlugin),authoringProject:o(i.authoringProject),authoringPlugin:o(i.authoringPlugin)}}function w2(a,r){const i=[],o=[],d=[];for(const f of a){const h=S2(f);h==="global"?d.push(f):h==="installed"?o.push(f):i.push(f)}function p(f){var y;const h=f.filter(v=>Vu(v,r)),x={};for(const v of h)(x[y=v.plugin]||(x[y]=[])).push(v);const m=Object.entries(x).sort((v,j)=>v[0].localeCompare(j[0]));return{total:f.length,filtered:h.length,byPlugin:m}}return{own:p(i),installed:p(o),global:p(d)}}function C2(a,r){const i=[],o=[];for(const p of a)(p.origin==="installed"?o:i).push(p);function d(p){var m;const f=p.filter(y=>Vu(y,r)),h={};for(const y of f)(h[m=y.plugin]||(h[m]=[])).push(y);const x=Object.entries(h).sort((y,v)=>y[0].localeCompare(v[0]));return{total:p.length,filtered:f.length,byPlugin:x}}return{own:d(i),installed:d(o)}}function N2({skills:a,selectedKey:r,onSelect:i,isLoading:o,error:d,onRetry:p,onContextMenu:f,outdatedByOrigin:h,activeAgentId:x,outdatedByScope:m,topSlot:y}){const v=!!x||a.some(Z=>Z.scope!==void 0&&Z.scope!==null),j=x??"claude-cli",[S,k]=g.useState(""),A=g.useDeferredValue(S),T=g.useMemo(()=>w2(a,A),[a,A]),C=g.useMemo(()=>k2(a,A),[a,A]),M=j==="claude-code",{data:O}=xr("plugins",()=>fetch("/api/plugins").then(Z=>Z.json()),{enabled:M,ttl:6e4}),U=g.useMemo(()=>{const Z=new Map;for(const q of(O==null?void 0:O.plugins)??[]){const de=Z.get(q.name);Z.set(q.name,!!de||!!q.enabled)}return Z},[O==null?void 0:O.plugins]),[L,V]=g.useState(()=>ju(`vskill-sidebar-${j}-group-available-collapsed`)),[w,D]=g.useState(()=>ju(`vskill-sidebar-${j}-group-authoring-collapsed`)),E=g.useCallback(Z=>{V(Z);try{window.localStorage.setItem(`vskill-sidebar-${j}-group-available-collapsed`,String(Z))}catch{}},[j]),B=g.useCallback(Z=>{D(Z);try{window.localStorage.setItem(`vskill-sidebar-${j}-group-authoring-collapsed`,String(Z))}catch{}},[j]),{own:P,installed:F}=g.useMemo(()=>C2(a,A),[a,A]),Q=T.own.filtered+T.installed.filtered+T.global.filtered>=j2,z=g.useMemo(()=>{const Z=q=>{const de=[];for(const[,_]of q){const W=[..._].sort((ie,ue)=>ie.skill.localeCompare(ue.skill));de.push(...W)}return de};return v?[...Z(T.own.byPlugin),...Z(T.installed.byPlugin),...Z(T.global.byPlugin)]:[...Z(P.byPlugin),...Z(F.byPlugin)]},[v,T.own.byPlugin,T.installed.byPlugin,T.global.byPlugin,P.byPlugin,F.byPlugin]),R=g.useMemo(()=>r?z.findIndex(Z=>Z.plugin===r.plugin&&Z.skill===r.skill):-1,[z,r]),I=g.useCallback(Z=>{if(z.length===0)return;const q=R<0?Z>0?0:z.length-1:Math.min(Math.max(R+Z,0),z.length-1);i(z[q])},[z,R,i]);return bu([{key:"j",handler:()=>I(1)},{key:"k",handler:()=>I(-1)},{key:"Enter",handler:()=>{R>=0&&i(z[R])}}],{enabled:!o&&!d}),n.jsxs("div",{"data-testid":"sidebar",style:{display:"flex",flexDirection:"column",minHeight:0,height:"100%",fontFamily:"var(--font-sans)"},children:[y,n.jsx(c2,{value:S,onChange:k}),o&&n.jsx(M2,{}),!o&&d&&n.jsx(z2,{error:d,onRetry:p}),!o&&!d&&v&&n.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[n.jsx(Ox,{name:J.scopeLabels.groupAvailable.toUpperCase(),variant:"available",collapsed:L,onToggle:E,count:C.availableProject.total+C.availablePersonal.total+C.availablePlugin.total}),!L&&n.jsxs(n.Fragment,{children:[n.jsx(ms,{label:J.scopeLabels.sourceProject,storageKey:`vskill-sidebar-${j}-available-project-collapsed`,count:C.availableProject.total,filteredCount:S?C.availableProject.filtered:null,updateCount:(m==null?void 0:m.installed)??(h==null?void 0:h.installed),children:C.availableProject.filtered===0?n.jsx(Ix,{queryActive:!!S,agentId:j}):n.jsx(hs,{items:C.availableProject.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Q})}),n.jsx(ms,{label:J.scopeLabels.sourcePersonal,storageKey:`vskill-sidebar-${j}-available-personal-collapsed`,count:C.availablePersonal.total,filteredCount:S?C.availablePersonal.filtered:null,updateCount:m==null?void 0:m.global,children:C.availablePersonal.filtered===0?n.jsx(T2,{queryActive:!!S,agentId:j}):n.jsx(hs,{items:C.availablePersonal.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Q})}),M&&n.jsxs(ms,{label:J.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${j}-available-plugin-collapsed`,count:C.availablePlugin.total,filteredCount:S?C.availablePlugin.filtered:null,children:[n.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:[n.jsx("span",{"aria-hidden":!0,children:"🛒"})," Browse marketplaces…"]}),C.availablePlugin.filtered===0?n.jsx("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:"No plugin skills installed yet."}):C.availablePlugin.byPlugin.map(([Z,q])=>n.jsx(_x,{pluginName:Z,skills:q,persistKey:`vskill-plugin-available-${Z}-collapsed`,headerActionSlot:M?n.jsx(h2,{pluginName:Z,enabled:U.get(Z)??!0}):void 0,renderSkill:de=>n.jsx(uo,{skill:de,isSelected:(r==null?void 0:r.plugin)===de.plugin&&(r==null?void 0:r.skill)===de.skill,onSelect:()=>i(de),onContextMenu:f})},`available-${Z}`))]})]}),n.jsx(A2,{}),n.jsx(Ox,{name:J.scopeLabels.groupAuthoring.toUpperCase(),variant:"authoring",collapsed:w,onToggle:B,count:C.authoringProject.total+C.authoringPlugin.total,action:{label:"New",title:"Create a new skill (standalone or plugin)",icon:n.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:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.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"}}))}}}),!w&&n.jsxs(n.Fragment,{children:[n.jsx(ms,{label:J.scopeLabels.authoringSkills,storageKey:`vskill-sidebar-${j}-authoring-project-collapsed`,count:C.authoringProject.total,filteredCount:S?C.authoringProject.filtered:null,updateCount:(m==null?void 0:m.own)??(h==null?void 0:h.source),children:C.authoringProject.filtered===0?n.jsx(Bx,{queryActive:!!S}):n.jsx(hs,{items:C.authoringProject.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Q})}),M&&n.jsx(ms,{label:J.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${j}-authoring-plugin-collapsed`,count:C.authoringPlugin.total,filteredCount:S?C.authoringPlugin.filtered:null,children:C.authoringPlugin.filtered===0?n.jsxs("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:["No plugin sources in this project. Add ",n.jsx("code",{children:"<plugin>/.claude-plugin/plugin.json"}),"."]}):C.authoringPlugin.byPlugin.map(([Z,q])=>n.jsx(_x,{pluginName:Z,skills:q,persistKey:`vskill-plugin-authoring-${Z}-collapsed`,renderSkill:de=>n.jsx(uo,{skill:de,isSelected:(r==null?void 0:r.plugin)===de.plugin&&(r==null?void 0:r.skill)===de.skill,onSelect:()=>i(de),onContextMenu:f})},`authoring-${Z}`))})]})]}),!o&&!d&&!v&&n.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[n.jsx(Dx,{origin:"source",count:P.total,filteredCount:S?P.filtered:null,updateCount:h==null?void 0:h.source,children:P.filtered===0?n.jsx(Bx,{queryActive:!!S}):n.jsx(hs,{items:P.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Q})}),n.jsx(R2,{}),n.jsx(Dx,{origin:"installed",count:F.total,filteredCount:S?F.filtered:null,updateCount:h==null?void 0:h.installed,children:F.filtered===0?n.jsx(Ix,{queryActive:!!S}):n.jsx(hs,{items:F.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Q})})]})]})}function ju(a){if(typeof window>"u")return!1;try{return window.localStorage.getItem(a)==="true"}catch{return!1}}function ms({label:a,storageKey:r,count:i,filteredCount:o,updateCount:d,children:p}){const[f,h]=g.useState(()=>ju(r)),x=g.useCallback(()=>{h(y=>{const v=!y;if(typeof window<"u")try{window.localStorage.setItem(r,String(v))}catch{}return v})},[r]),m=o!=null&&o!==i?`${o} of ${i}`:String(i);return n.jsxs("section",{"data-vskill-named-scope":a,children:[n.jsxs("button",{type:"button",onClick:x,"aria-expanded":!f,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 12px",background:"transparent",border:"none",cursor:"pointer",fontFamily:"var(--font-sans)",textAlign:"left"},children:[n.jsx("span",{"aria-hidden":!0,style:{fontSize:14,fontWeight:700,color:"var(--color-ink, var(--text-primary))",width:16,display:"inline-block",textAlign:"center"},children:f?"▸":"▾"}),n.jsx("span",{style:{fontSize:12,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)"},children:a}),n.jsxs("span",{style:{fontSize:11,color:"var(--text-tertiary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",m,")"]}),d!=null&&d>0&&n.jsxs("span",{style:{marginLeft:"auto",fontSize:10,color:"var(--color-own, #f59e0b)"},children:[d," update",d!==1?"s":""]})]}),!f&&n.jsx("div",{children:p})]})}function E2(a){const r=[];for(const[i,o]of a){const d=[...o].sort((p,f)=>p.skill.localeCompare(f.skill));r.push({kind:"header",plugin:i,count:d.length});for(const p of d)r.push({kind:"row",skill:p})}return r}function hs({items:a,selectedKey:r,onSelect:i,onContextMenu:o,useVirtual:d}){if(d){const p=E2(a);return n.jsx("div",{"data-virtualized":"true",style:{height:420,minHeight:200},children:n.jsx($j,{overscan:4,totalCount:p.length,itemContent:f=>{const h=p[f];if(!h)return null;if(h.kind==="header")return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)"},children:h.plugin}),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",h.count,")"]})]});const x=h.skill,m=!!r&&r.plugin===x.plugin&&r.skill===x.skill;return n.jsx(uo,{skill:x,isSelected:m,onSelect:()=>i(x),onContextMenu:o})}})})}return n.jsx("div",{"data-virtualized":"false",children:a.map(([p,f])=>n.jsx(p2,{plugin:p,skills:f,selectedKey:r,onSelect:i,onContextMenu:o},p))})}function Bx({queryActive:a}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:"No skills yet.",body:n.jsxs(n.Fragment,{children:["Create one with ",n.jsx($u,{children:"vskill new"})," or the"," ",n.jsx("strong",{style:{color:"var(--text-primary)"},children:"New skill"})," action in the top rail."]})})}function Ix({queryActive:a,agentId:r}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:r?`No skills installed for ${r} in this project.`:"No installed skills.",body:n.jsxs(n.Fragment,{children:["Run ",n.jsx($u,{children:"vskill install <plugin>"})," to add one."]})})}function T2({queryActive:a,agentId:r}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:`No global skills for ${r}.`,body:n.jsxs(n.Fragment,{children:["Run ",n.jsx($u,{children:"vskill install --global <plugin>"})," to add one."]})})}function pr({headline:a,body:r}){return n.jsxs("div",{style:{padding:"12px 14px 16px",fontSize:12,color:"var(--text-secondary)",lineHeight:1.5},children:[n.jsx("div",{style:{fontWeight:500,color:"var(--text-primary)",marginBottom:4},children:a}),n.jsx("div",{children:r})]})}function $u({children:a}){return n.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-primary)",background:"color-mix(in srgb, var(--border-default) 45%, transparent)",padding:"1px 4px",borderRadius:3},children:a})}function R2(){return n.jsx("div",{"aria-hidden":"true",style:{height:1,background:"var(--border-default)",margin:"4px 14px"}})}function A2(){return n.jsx("div",{"aria-hidden":"true","data-testid":"scope-bold-divider",style:{height:3,background:"var(--color-rule)",boxShadow:"inset 0 1px 0 color-mix(in srgb, var(--color-rule) 50%, transparent)",margin:"12px 0"}})}function M2(){return n.jsx("div",{style:{padding:"8px 0"},children:[0,1,2,3,4,5].map(a=>n.jsx(g2,{},a))})}function z2({error:a,onRetry:r}){return n.jsxs("div",{role:"alert",style:{margin:"12px 14px",padding:12,border:"1px solid var(--border-default)",borderRadius:6,background:"var(--bg-canvas)",color:"var(--text-primary)",fontSize:12},children:[n.jsx("div",{style:{fontWeight:600,marginBottom:4},children:"Couldn't load skills."}),n.jsxs("details",{children:[n.jsx("summary",{style:{cursor:"pointer",color:"var(--text-secondary)",fontSize:11,marginBottom:4},children:L2(a)}),n.jsx("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",margin:"6px 0 0"},children:a})]}),r&&n.jsx("button",{type:"button",onClick:r,style:{marginTop:8,background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"4px 10px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:"Retry"})]})}function L2(a){const r=a.split(`
|
|
54
|
+
}`})]})}function ix(){typeof window>"u"||(window.location.hash="#/")}function m0({onHome:a}){const[r,i]=g.useState(!1),[o,d]=g.useState(!1),p=h=>{h.metaKey||h.ctrlKey||h.shiftKey||h.button!==0||(h.preventDefault(),ix(),a==null||a())},f=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),ix(),a==null||a())};return n.jsxs("a",{href:"#/",role:"link","data-testid":"studio-logo","aria-label":"Skill Studio — home",onClick:p,onKeyDown:f,onFocus:()=>i(!0),onBlur:()=>i(!1),onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{display:"inline-flex",alignItems:"center",gap:10,flexShrink:0,padding:"4px 6px",margin:"-4px -6px",borderRadius:6,textDecoration:"none",color:"inherit",cursor:"pointer",outline:r?"2px solid var(--border-focus)":"none",outlineOffset:2,background:o?"color-mix(in srgb, var(--text-primary) 4%, transparent)":"transparent",transition:"background-color var(--duration-fast, 120ms) var(--ease-standard, ease)"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:6,background:"color-mix(in srgb, var(--accent-surface) 20%, transparent)"},children:n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent-surface)",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}),n.jsx("span",{style:{fontSize:13,fontWeight:600,letterSpacing:"-0.01em",color:"var(--text-primary)"},children:"Skill Studio"})]})}const h0="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",x0=g.lazy(()=>Tu(()=>import("./UpdateDropdown-stNmCWki.js"),__vite__mapDeps([0,1])));function g0(){const{updateCount:a,updates:r,isRefreshingUpdates:i,refreshUpdates:o,selectSkill:d}=ya(),[p,f]=g.useState(!1),h=g.useRef(null),x=g.useCallback(()=>f(!1),[]),m=a>0?"var(--text-primary)":"var(--text-secondary)",y=a>9?"9+":String(a),v=a===0?"No updates available":`${a} updates available, open summary`;return n.jsxs("span",{"data-testid":"update-bell-anchor",style:{position:"relative",display:"inline-flex"},children:[n.jsxs("button",{ref:h,type:"button","data-testid":"update-bell","aria-label":v,"aria-haspopup":"dialog","aria-expanded":p,onClick:()=>f(j=>!j),style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",height:26,width:26,padding:0,borderRadius:4,border:"1px solid transparent",background:"transparent",color:m,cursor:"pointer"},children:[n.jsx("img",{src:h0,alt:"",width:18,height:18,style:{display:"block",opacity:a>0?1:.75}}),a>0&&n.jsx("span",{"data-testid":"update-bell-badge","aria-hidden":"true",style:{position:"absolute",top:-2,right:-2,minWidth:14,height:14,padding:"0 3px",borderRadius:999,background:"var(--color-own)",color:"var(--color-paper)",fontSize:9,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:600,lineHeight:1},children:y})]}),p&&n.jsx(g.Suspense,{fallback:n.jsx("span",{"data-testid":"update-bell-fallback",children:"Loading…"}),children:n.jsx(x0,{updates:r,isRefreshing:i,onRefresh:()=>o(),onSelectSkill:j=>{const S=j.name.split("/"),k=S.length>=2?S[S.length-2]:S[0],A=S[S.length-1];d({plugin:k,skill:A,origin:"installed"}),x()},onViewAll:()=>{window.location.hash="#/updates",x()},onClose:x,anchorRef:h})})]})}function ox(a){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:navigate-scope",{detail:a}))}function v0({projectName:a,selected:r,onOpenPalette:i,onHome:o,projectPickerSlot:d,onRequestCreateSkill:p}){const f=r?r.origin==="installed"?"Project":"Skills":null;return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,height:"100%",width:"100%",padding:"0 16px",fontFamily:"var(--font-sans)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexShrink:0},children:[n.jsx(m0,{onHome:o}),d?n.jsx("div",{style:{borderLeft:"1px solid var(--border-default)",paddingLeft:10,display:"flex",alignItems:"center"},children:d}):a&&n.jsx("span",{title:a,style:{fontSize:12,color:"var(--text-secondary)",borderLeft:"1px solid var(--border-default)",paddingLeft:10,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a})]}),n.jsx("nav",{"aria-label":"Breadcrumb",style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:6,fontSize:12,color:"var(--text-secondary)"},children:r&&f&&n.jsxs(n.Fragment,{children:[n.jsx(cx,{segment:"origin",onClick:()=>ox({scope:"origin",origin:r.origin}),style:{textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:r.origin==="installed"?"var(--status-installed)":"var(--status-own)"},children:f}),n.jsx(dx,{}),n.jsx(cx,{segment:"plugin",onClick:()=>ox({scope:"plugin",plugin:r.plugin}),style:{fontFamily:"var(--font-mono)",fontSize:11},children:r.plugin}),n.jsx(dx,{}),n.jsx("span",{"data-breadcrumb-segment":"skill","aria-current":"page",style:{color:"var(--text-primary)",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.skill})]})}),n.jsxs("div",{"data-toprail-right":"true",style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[p&&n.jsxs("button",{type:"button","data-slot":"create-skill-button",onClick:p,"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:[n.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:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"New Skill"]}),n.jsx("span",{"data-slot":"agent-model-picker",style:{minWidth:200},children:n.jsx(f0,{})}),n.jsx("span",{"data-slot":"update-bell",style:{display:"inline-flex"},children:n.jsx(g0,{})}),n.jsx("button",{type:"button",onClick:i,"aria-label":"Open command palette",title:"Command palette (⌘K)",style:{display:"inline-flex",alignItems:"center",gap:6,height:26,padding:"0 10px",borderRadius:4,border:"1px solid var(--border-default)",background:"transparent",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono)",cursor:"pointer"},children:n.jsx("span",{children:"⌘K"})})]})]})}function cx({segment:a,onClick:r,style:i,children:o}){return n.jsx("button",{type:"button","data-breadcrumb-segment":a,onClick:r,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",color:"var(--text-secondary)",fontFamily:"inherit",...i},onMouseEnter:d=>{d.currentTarget.style.color="var(--color-accent-ink)"},onMouseLeave:d=>{const p=(i==null?void 0:i.color)??"var(--text-secondary)";d.currentTarget.style.color=p},children:o})}function dx(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)",fontSize:10},children:"›"})}const ho="vskill-theme";function xg(a){return a==="light"||a==="dark"||a==="auto"?a:"auto"}function y0(a,r){return a==="light"||a==="dark"?a:r?"dark":"light"}function b0(a){try{const r=a.getItem(ho);return xg(r)}catch{return"auto"}}function j0(a,r){try{a.setItem(ho,r)}catch{}}function S0(a,r,i){a.dataset.theme=i,a.dataset.themeMode=r}function k0(a){if(!a)return!1;try{return a("(prefers-color-scheme: dark)").matches}catch{return!1}}const gg=g.createContext(null);function w0({storage:a,matchMedia:r,target:i,children:o}){const d=a??(typeof window<"u"?window.localStorage:void 0),p=r??(typeof window<"u"?window.matchMedia.bind(window):void 0),f=i??(typeof document<"u"?document.documentElement:void 0),[h,x]=g.useState(()=>d?b0(d):"auto"),[m,y]=g.useState(()=>k0(p)),v=g.useMemo(()=>y0(h,m),[h,m]);g.useEffect(()=>{f&&S0(f,h,v)},[f,h,v]),g.useEffect(()=>{if(!p)return;const k=p("(prefers-color-scheme: dark)"),A=C=>y(C.matches);if(typeof k.addEventListener=="function")return k.addEventListener("change",A),()=>k.removeEventListener("change",A);const T=k;return T.addListener(A),()=>T.removeListener(A)},[p]),g.useEffect(()=>{if(typeof window>"u")return;const k=A=>{A.key===ho&&x(xg(A.newValue))};return window.addEventListener("storage",k),()=>window.removeEventListener("storage",k)},[]),g.useEffect(()=>{if(!p||!f)return;let k;try{k=p("(prefers-contrast: more)")}catch{return}const A=M=>{M?f.dataset.contrast="more":f.dataset.contrast==="more"&&delete f.dataset.contrast};A(k.matches);const T=M=>A(M.matches);if(typeof k.addEventListener=="function")return k.addEventListener("change",T),()=>k.removeEventListener("change",T);const C=k;return C.addListener(T),()=>C.removeListener(T)},[p,f]);const j=g.useCallback(k=>{x(k),d&&j0(d,k)},[d]),S=g.useMemo(()=>({mode:h,resolvedTheme:v,setTheme:j}),[h,v,j]);return n.jsx(gg.Provider,{value:S,children:o})}function vg(){const a=g.useContext(gg);if(!a)throw new Error("useTheme must be used inside <ThemeProvider>. Wrap the app root in main.tsx.");return a}const ux=["claude-cli","anthropic","openrouter","ollama","lm-studio"];function C0(a){const r=new Map(a.map(o=>[o.id,o])),i=[];for(const o of ux){const d=r.get(o);d&&i.push(d)}for(const o of a)ux.includes(o.id)||i.push(o);return i}function N0(a){const[r,i]=g.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(`(max-width: ${a}px)`).matches);return g.useEffect(()=>{var p;if(typeof window>"u"||!window.matchMedia)return;const o=window.matchMedia(`(max-width: ${a}px)`),d=()=>i(o.matches);return(p=o.addEventListener)==null||p.call(o,"change",d),()=>{var f;return(f=o.removeEventListener)==null?void 0:f.call(o,"change",d)}},[a]),r}function E0({providers:a,onOpenSettings:r,onOpenInstallHelp:i}){const o=C0(a),d=N0(640),[p,f]=g.useState(!1),h=g.useCallback(x=>{x.available||x.kind==="api-key"?r==null||r(x.id):i==null||i(x.id)},[r,i]);if(d){const x=o.filter(m=>m.available).length;return n.jsxs("div",{"data-testid":"providers-segment",style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[n.jsx("button",{type:"button","data-testid":"providers-summary",onClick:()=>f(!p),"aria-label":J.statusBar.providerSummary(x,o.length),style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:J.statusBar.providerSummary(x,o.length)}),p&&n.jsx("div",{role:"menu",style:{position:"absolute",bottom:"120%",right:0,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,padding:6,minWidth:180,display:"flex",flexDirection:"column",gap:2,zIndex:80},children:o.map(m=>n.jsx(fx,{p:m,onClick:h},m.id))})]})}return n.jsx("div",{"data-testid":"providers-segment",style:{display:"inline-flex",alignItems:"center",gap:4},children:o.map(x=>n.jsx(fx,{p:x,onClick:h,compact:!0},x.id))})}function fx({p:a,onClick:r,compact:i}){const o=a.available?J.statusBar.unlocked(a.label):a.kind==="cli-install"?J.statusBar.lockedCli(a.label):J.statusBar.locked(a.label);return n.jsxs("button",{type:"button","data-testid":`provider-glyph-${a.id}`,"data-available":a.available,"aria-label":o,title:o,onClick:()=>r(a),style:{display:"inline-flex",alignItems:"center",gap:4,background:"transparent",border:"none",color:a.available?"var(--status-installed)":"var(--text-muted, var(--text-tertiary))",cursor:"pointer",padding:i?"2px":"4px 6px",fontSize:11},children:[n.jsx(pu,{unlocked:a.available,size:10}),!i&&n.jsx("span",{children:a.label})]})}function T0(){try{return typeof localStorage>"u"?null:localStorage.getItem(ho)}catch{return null}}function R0({projectPath:a,modelName:r,health:i="ok",onPathClick:o,providers:d,onOpenProviderSettings:p,onOpenProviderInstallHelp:f}){const{mode:h,resolvedTheme:x,setTheme:m}=vg(),v=T0()==="auto",j=A0(h,x,v),S=i==="down"||i==="degraded"?"var(--status-own)":"var(--status-installed)";return n.jsxs("div",{role:"contentinfo",style:{display:"flex",alignItems:"center",gap:12,height:"100%",width:"100%",padding:"0 12px",fontSize:11,fontFamily:"var(--font-sans)",color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[n.jsx("span",{title:r??"",style:{fontFamily:"var(--font-mono)"},children:r??"—"}),n.jsx(px,{}),n.jsxs("span",{"aria-label":`Health: ${i}`,style:{display:"inline-flex",alignItems:"center",gap:6},children:[n.jsx(M0,{color:S}),n.jsx("span",{style:{textTransform:"capitalize"},children:i})]}),d&&d.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(px,{}),n.jsx(E0,{providers:d,onOpenSettings:p,onOpenInstallHelp:f})]}),n.jsx("div",{style:{flex:1}}),n.jsxs("button",{type:"button","data-testid":"theme-toggle",onClick:()=>m(j),"aria-label":`Switch to ${j} theme`,title:`Theme: ${h} — click for ${j}`,style:{display:"inline-flex",alignItems:"center",gap:6,background:"transparent",border:"1px solid var(--border-default)",padding:"2px 8px",borderRadius:4,color:"var(--text-secondary)",cursor:"pointer",fontSize:11,height:20},children:[n.jsx(z0,{mode:h}),n.jsx("span",{style:{textTransform:"capitalize"},children:h})]})]})}function A0(a,r,i){return a==="light"?"dark":a==="dark"?"auto":i?"light":r==="light"?"dark":"light"}function M0({color:a}){return n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:a,display:"inline-block",flexShrink:0}})}function px(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)"},children:"|"})}function z0({mode:a}){return a==="dark"?n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}):a==="light"?n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"4"}),n.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}):n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"9"}),n.jsx("path",{d:"M12 3a9 9 0 0 0 0 18z",fill:"currentColor"})]})}const ao=new Map,gl=new Map,xs=new Map;function an(a){ao.delete(a),gl.delete(a);const r=xs.get(a);if(r)for(const i of r)i()}function xr(a,r,i={}){const{ttl:o=3e4,enabled:d=!0}=i,[,p]=g.useState(0),f=g.useRef(!0),h=g.useRef(a);h.current=a;const x=()=>an(a);g.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]),g.useEffect(()=>{if(!d)return;const j=()=>{f.current&&p(S=>S+1)};return xs.has(a)||xs.set(a,new Set),xs.get(a).add(j),()=>{var S;(S=xs.get(a))==null||S.delete(j)}},[a,d]),g.useEffect(()=>{if(!d)return;const j=ao.get(a);if(!(!j||Date.now()-j.fetchedAt>o))return;if(gl.has(a)){const T=gl.get(a),C=()=>{f.current&&h.current===a&&p(M=>M+1)};T.subscribers.push(C);return}const k={promise:Promise.resolve(),subscribers:[]},A=r().then(T=>{ao.set(a,{data:T,fetchedAt:Date.now()}),gl.delete(a),f.current&&h.current===a&&p(C=>C+1);for(const C of k.subscribers)C()},T=>{gl.delete(a),f.current&&h.current===a&&p(C=>C+1);for(const C of k.subscribers)C();throw T});k.promise=A,gl.set(a,k)},[a,r,o,d]);const m=ao.get(a),y=d&&!m&&gl.has(a);return{data:m==null?void 0:m.data,loading:y||d&&!m,error:void 0,revalidate:x}}const xo=0,Wa=1,gr=2,yg=4;function mx(a){return()=>a}function L0(a){a()}function bg(a,r){return i=>a(r(i))}function hx(a,r){return()=>a(r)}function D0(a,r){return i=>a(r,i)}function Ru(a){return a!==void 0}function _0(...a){return()=>{a.map(L0)}}function vr(){}function go(a,r){return r(a),a}function O0(a,r){return r(a)}function xt(...a){return a}function nt(a,r){return a(Wa,r)}function Ve(a,r){a(xo,r)}function Au(a){a(gr)}function bt(a){return a(yg)}function Ne(a,r){return nt(a,D0(r,xo))}function Pn(a,r){const i=a(Wa,o=>{i(),r(o)});return i}function xx(a){let r,i;return o=>d=>{r=d,i&&clearTimeout(i),i=setTimeout(()=>{o(r)},a)}}function jg(a,r){return a===r}function ht(a=jg){let r;return i=>o=>{a(r,o)||(r=o,i(o))}}function ze(a){return r=>i=>{a(i)&&r(i)}}function be(a){return r=>bg(r,a)}function Kn(a){return r=>()=>{r(a)}}function ce(a,...r){const i=B0(...r);return((o,d)=>{switch(o){case gr:Au(a);return;case Wa:return nt(a,i(d))}})}function Xn(a,r){return i=>o=>{i(r=a(r,o))}}function yl(a){return r=>i=>{a>0?a--:r(i)}}function va(a){let r=null,i;return o=>d=>{r=d,!i&&(i=setTimeout(()=>{i=void 0,o(r)},a))}}function Pe(...a){const r=new Array(a.length);let i=0,o=null;const d=2**a.length-1;return a.forEach((p,f)=>{const h=2**f;nt(p,x=>{const m=i;i|=h,r[f]=x,m!==d&&i===d&&o&&(o(),o=null)})}),p=>f=>{const h=()=>{p([f].concat(r))};i===d?h():o=h}}function B0(...a){return r=>a.reduceRight(O0,r)}function I0(a){let r,i;const o=()=>r==null?void 0:r();return function(d,p){switch(d){case Wa:return p?i===p?void 0:(o(),i=p,r=nt(a,p),r):(o(),vr);case gr:o(),i=null;return}}}function me(a){let r=a;const i=Xe();return((o,d)=>{switch(o){case xo:r=d;break;case Wa:{d(r);break}case yg:return r}return i(o,d)})}function Zt(a,r){return go(me(r),i=>Ne(a,i))}function Xe(){const a=[];return((r,i)=>{switch(r){case xo:a.slice().forEach(o=>{o(i)});return;case gr:a.splice(0,a.length);return;case Wa:return a.push(i),()=>{const o=a.indexOf(i);o>-1&&a.splice(o,1)}}})}function Sn(a){return go(Xe(),r=>Ne(a,r))}function et(a,r=[],{singleton:i}={singleton:!0}){return{constructor:a,dependencies:r,id:H0(),singleton:i}}const H0=()=>Symbol();function U0(a){const r=new Map,i=({constructor:o,dependencies:d,id:p,singleton:f})=>{if(f&&r.has(p))return r.get(p);const h=o(d.map(x=>i(x)));return f&&r.set(p,h),h};return i(a)}function _t(...a){const r=Xe(),i=new Array(a.length);let o=0;const d=2**a.length-1;return a.forEach((p,f)=>{const h=2**f;nt(p,x=>{i[f]=x,o|=h,o===d&&Ve(r,i)})}),function(p,f){switch(p){case gr:{Au(r);return}case Wa:return o===d&&f(i),nt(r,f)}}}function Me(a,r=jg){return ce(a,ht(r))}function mu(...a){return function(r,i){switch(r){case gr:return;case Wa:return _0(...a.map(o=>nt(o,i)))}}}const It={DEBUG:0,INFO:1,WARN:2,ERROR:3},V0={[It.DEBUG]:"debug",[It.ERROR]:"error",[It.INFO]:"log",[It.WARN]:"warn"},$0=()=>typeof globalThis>"u"?window:globalThis,Ka=et(()=>{const a=me(It.ERROR);return{log:me((r,i,o=It.INFO)=>{const d=$0().VIRTUOSO_LOG_LEVEL??bt(a);o>=d&&console[V0[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",r,i)}),logLevel:a}},[],{singleton:!0});function jl(a,r,i){return Mu(a,r,i).callbackRef}function Mu(a,r,i){const o=Ce.useRef(null);let d=f=>{};const p=Ce.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(f=>{const h=()=>{const x=f[0].target;x.offsetParent!==null&&a(x)};i?h():requestAnimationFrame(h)}):null,[a,i]);return d=f=>{f&&r?(p==null||p.observe(f),o.current=f):(o.current&&(p==null||p.unobserve(o.current)),o.current=null)},{callbackRef:d,ref:o}}function P0(a,r,i,o,d,p,f,h,x){const m=Ce.useCallback(y=>{const v=G0(y.children,r,h?"offsetWidth":"offsetHeight",d);let j=y.parentElement;for(;j.dataset.virtuosoScroller===void 0;)j=j.parentElement;const S=j.lastElementChild.dataset.viewportType==="window";let k;S&&(k=j.ownerDocument.defaultView);const A=f?h?f.scrollLeft:f.scrollTop:S?h?k.scrollX||k.document.documentElement.scrollLeft:k.scrollY||k.document.documentElement.scrollTop:h?j.scrollLeft:j.scrollTop,T=f?h?f.scrollWidth:f.scrollHeight:S?h?k.document.documentElement.scrollWidth:k.document.documentElement.scrollHeight:h?j.scrollWidth:j.scrollHeight,C=f?h?f.offsetWidth:f.offsetHeight:S?h?k.innerWidth:k.innerHeight:h?j.offsetWidth:j.offsetHeight;o({scrollHeight:T,scrollTop:Math.max(A,0),viewportHeight:C}),p==null||p(h?gx("column-gap",getComputedStyle(y).columnGap,d):gx("row-gap",getComputedStyle(y).rowGap,d)),v!==null&&a(v)},[a,r,d,p,f,o,h]);return Mu(m,i,x)}function G0(a,r,i,o){const d=a.length;if(d===0)return null;const p=[];for(let f=0;f<d;f++){const h=a.item(f);if(h.dataset.index===void 0)continue;const x=parseInt(h.dataset.index),m=parseFloat(h.dataset.knownSize),y=r(h,i);if(y===0&&o("Zero-sized element, this should not happen",{child:h},It.ERROR),y===m)continue;const v=p[p.length-1];p.length===0||v.size!==y||v.endIndex!==x-1?p.push({endIndex:x,size:y,startIndex:x}):p[p.length-1].endIndex++}return p}function gx(a,r,i){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&i(`${a} was not resolved to pixel value correctly`,r,It.WARN),r==="normal"?0:parseInt(r??"0",10)}function Sg(a,r,i){const o=Ce.useRef(null),d=Ce.useCallback(x=>{if(!(x!=null&&x.offsetParent))return;const m=x.getBoundingClientRect(),y=m.width;let v,j;if(r){const S=r.getBoundingClientRect(),k=m.top-S.top;j=S.height-Math.max(0,k),v=k+r.scrollTop}else{const S=f.current.ownerDocument.defaultView;j=S.innerHeight-Math.max(0,m.top),v=m.top+S.scrollY}o.current={listHeight:m.height,offsetTop:v,visibleHeight:j,visibleWidth:y},a(o.current)},[a,r]),{callbackRef:p,ref:f}=Mu(d,!0,i),h=Ce.useCallback(()=>{d(f.current)},[d,f]);return Ce.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 x=(m=f.current)==null?void 0:m.ownerDocument.defaultView;return x==null||x.addEventListener("scroll",h),x==null||x.addEventListener("resize",h),()=>{x==null||x.removeEventListener("scroll",h),x==null||x.removeEventListener("resize",h)}},[h,r,f]),p}const ln=et(()=>{const a=Xe(),r=Xe(),i=me(0),o=Xe(),d=me(0),p=Xe(),f=Xe(),h=me(0),x=me(0),m=me(0),y=me(0),v=Xe(),j=Xe(),S=me(!1),k=me(!1),A=me(!1);return Ne(ce(a,be(({scrollTop:T})=>T)),r),Ne(ce(a,be(({scrollHeight:T})=>T)),f),Ne(r,d),{deviation:i,fixedFooterHeight:m,fixedHeaderHeight:x,footerHeight:y,headerHeight:h,horizontalDirection:k,scrollBy:j,scrollContainerState:a,scrollHeight:f,scrollingInProgress:S,scrollTo:v,scrollTop:r,skipAnimationFrameInResizeObserver:A,smoothScrollTargetReached:o,statefulScrollTop:d,viewportHeight:p}},[],{singleton:!0}),ks={lvl:0};function kg(a,r){const i=a.length;if(i===0)return[];let{index:o,value:d}=r(a[0]);const p=[];for(let f=1;f<i;f++){const{index:h,value:x}=r(a[f]);p.push({end:h-1,start:o,value:d}),o=h,d=x}return p.push({end:1/0,start:o,value:d}),p}function ut(a){return a===ks}function ws(a,r){if(!ut(a))return r===a.k?a.v:r<a.k?ws(a.l,r):ws(a.r,r)}function Gn(a,r,i="k"){if(ut(a))return[-1/0,void 0];if(Number(a[i])===r)return[a.k,a.v];if(Number(a[i])<r){const o=Gn(a.r,r,i);return o[0]===-1/0?[a.k,a.v]:o}return Gn(a.l,r,i)}function bn(a,r,i){return ut(a)?Ng(r,i,1):r===a.k?Bt(a,{k:r,v:i}):r<a.k?vx(Bt(a,{l:bn(a.l,r,i)})):vx(Bt(a,{r:bn(a.r,r,i)}))}function dr(){return ks}function ur(a,r,i){if(ut(a))return[];const o=Gn(a,r)[0];return F0(xu(a,o,i))}function hu(a,r){if(ut(a))return ks;const{k:i,l:o,r:d}=a;if(r===i){if(ut(o))return d;if(ut(d))return o;const[p,f]=Cg(o);return lo(Bt(a,{k:p,l:wg(o),v:f}))}return r<i?lo(Bt(a,{l:hu(o,r)})):lo(Bt(a,{r:hu(d,r)}))}function vl(a){return ut(a)?[]:[...vl(a.l),{k:a.k,v:a.v},...vl(a.r)]}function xu(a,r,i){if(ut(a))return[];const{k:o,l:d,r:p,v:f}=a;let h=[];return o>r&&(h=h.concat(xu(d,r,i))),o>=r&&o<=i&&h.push({k:o,v:f}),o<=i&&(h=h.concat(xu(p,r,i))),h}function lo(a){const{l:r,lvl:i,r:o}=a;if(o.lvl>=i-1&&r.lvl>=i-1)return a;if(i>o.lvl+1){if(Gd(r))return Eg(Bt(a,{lvl:i-1}));if(!ut(r)&&!ut(r.r))return Bt(r.r,{l:Bt(r,{r:r.r.l}),lvl:i,r:Bt(a,{l:r.r.r,lvl:i-1})});throw new Error("Unexpected empty nodes")}if(Gd(a))return gu(Bt(a,{lvl:i-1}));if(!ut(o)&&!ut(o.l)){const d=o.l,p=Gd(d)?o.lvl-1:o.lvl;return Bt(d,{l:Bt(a,{lvl:i-1,r:d.l}),lvl:d.lvl+1,r:gu(Bt(o,{l:d.r,lvl:p}))})}throw new Error("Unexpected empty nodes")}function Bt(a,r){return Ng(r.k!==void 0?r.k:a.k,r.v!==void 0?r.v:a.v,r.lvl!==void 0?r.lvl:a.lvl,r.l!==void 0?r.l:a.l,r.r!==void 0?r.r:a.r)}function wg(a){return ut(a.r)?a.l:lo(Bt(a,{r:wg(a.r)}))}function Gd(a){return ut(a)||a.lvl>a.r.lvl}function Cg(a){return ut(a.r)?[a.k,a.v]:Cg(a.r)}function Ng(a,r,i,o=ks,d=ks){return{k:a,l:o,lvl:i,r:d,v:r}}function vx(a){return gu(Eg(a))}function Eg(a){const{l:r}=a;return!ut(r)&&r.lvl===a.lvl?Bt(r,{r:Bt(a,{l:r.r})}):a}function gu(a){const{lvl:r,r:i}=a;return!ut(i)&&!ut(i.r)&&i.lvl===r&&i.r.lvl===r?Bt(i,{l:Bt(a,{r:i.l}),lvl:r+1}):a}function F0(a){return kg(a,({k:r,v:i})=>({index:r,value:i}))}function Tg(a,r){return!!(a&&a.startIndex===r.startIndex&&a.endIndex===r.endIndex)}function Cs(a,r){return!!(a&&a[0]===r[0]&&a[1]===r[1])}const zu=et(()=>({recalcInProgress:me(!1)}),[],{singleton:!0});function Rg(a,r,i){return a[oo(a,r,i)]}function oo(a,r,i,o=0){let d=a.length-1;for(;o<=d;){const p=Math.floor((o+d)/2),f=a[p],h=i(f,r);if(h===0)return p;if(h===-1){if(d-o<2)return p-1;d=p-1}else{if(d===o)return p;o=p+1}}throw new Error(`Failed binary finding record in array - ${a.join(",")}, searched for ${r}`)}function q0(a,r,i,o){const d=oo(a,r,o),p=oo(a,i,o,d);return a.slice(d,p+1)}function Ya(a,r){return Math.round(a.getBoundingClientRect()[r])}function vo(a){return!ut(a.groupOffsetTree)}function Lu({index:a},r){return r===a?0:r<a?-1:1}function Y0(){return{groupIndices:[],groupOffsetTree:dr(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:dr()}}function W0(a,r){let i=ut(a)?0:1/0;for(const o of r){const{endIndex:d,size:p,startIndex:f}=o;if(i=Math.min(i,f),ut(a)){a=bn(a,0,p);continue}const h=ur(a,f-1,d+1);if(h.some(tj(o)))continue;let x=!1,m=!1;for(const{end:y,start:v,value:j}of h)x?(d>=v||p===j)&&(a=hu(a,v)):(m=j!==p,x=!0),y>d&&d>=v&&j!==p&&(a=bn(a,d+1,j));m&&(a=bn(a,f,p))}return[a,i]}function K0(a){return typeof a.groupIndex<"u"}function X0({offset:a},r){return r===a?0:r<a?-1:1}function Ns(a,r,i){if(r.length===0)return 0;const{index:o,offset:d,size:p}=Rg(r,a,Lu),f=a-o,h=p*f+(f-1)*i+d;return h>0?h+i:h}function Ag(a,r){if(!vo(r))return a;let i=0;for(;r.groupIndices[i]<=a+i;)i++;return a+i}function Mg(a,r,i){if(K0(a))return r.groupIndices[a.groupIndex]+1;const o=a.index==="LAST"?i:a.index;let d=Ag(o,r);return d=Math.max(0,d,Math.min(i,d)),d}function Q0(a,r,i,o=0){return o>0&&(r=Math.max(r,Rg(a,o,Lu).offset)),kg(q0(a,r,i,X0),ej)}function Z0(a,[r,i,o,d]){r.length>0&&o("received item sizes",r,It.DEBUG);const p=a.sizeTree;let f=p,h=0;if(i.length>0&&ut(p)&&r.length===2){const j=r[0].size,S=r[1].size;f=i.reduce((k,A)=>bn(bn(k,A,j),A+1,S),f)}else[f,h]=W0(f,r);if(f===p)return a;const{lastIndex:x,lastOffset:m,lastSize:y,offsetTree:v}=vu(a.offsetTree,h,f,d);return{groupIndices:i,groupOffsetTree:i.reduce((j,S)=>bn(j,S,Ns(S,v,d)),dr()),lastIndex:x,lastOffset:m,lastSize:y,offsetTree:v,sizeTree:f}}function J0(a){return vl(a).map(({k:r,v:i},o,d)=>{const p=d[o+1];return{endIndex:p!==void 0?p.k-1:1/0,size:i,startIndex:r}})}function yx(a,r){let i=0,o=0;for(;i<a;)i+=r[o+1]-r[o]-1,o++;return o-(i===a?0:1)}function vu(a,r,i,o){let d=a,p=0,f=0,h=0,x=0;if(r!==0){x=oo(d,r-1,Lu),h=d[x].offset;const m=Gn(i,r-1);p=m[0],f=m[1],d.length&&d[x].size===Gn(i,r)[1]&&(x-=1),d=d.slice(0,x+1)}else d=[];for(const{start:m,value:y}of ur(i,r,1/0)){const v=m-p,j=v*f+h+v*o;d.push({index:m,offset:j,size:y}),p=m,h=j,f=y}return{lastIndex:p,lastOffset:h,lastSize:f,offsetTree:d}}function ej(a){return{index:a.index,value:a}}function tj(a){const{endIndex:r,size:i,startIndex:o}=a;return d=>d.start===o&&(d.end===r||d.end===1/0)&&d.value===i}const nj={offsetHeight:"height",offsetWidth:"width"},Qn=et(([{log:a},{recalcInProgress:r}])=>{const i=Xe(),o=Xe(),d=Zt(o,0),p=Xe(),f=Xe(),h=me(0),x=me([]),m=me(void 0),y=me(void 0),v=me(void 0),j=me(void 0),S=me((w,D)=>Ya(w,nj[D])),k=me(void 0),A=me(0),T=Y0(),C=Zt(ce(i,Pe(x,a,A),Xn(Z0,T),ht()),T),M=Zt(ce(x,ht(),Xn((w,D)=>({current:D,prev:w.current}),{current:[],prev:[]}),be(({prev:w})=>w)),[]);Ne(ce(x,ze(w=>w.length>0),Pe(C,A),be(([w,D,E])=>{const B=w.reduce((P,F,te)=>bn(P,F,Ns(F,D.offsetTree,E)||te),dr());return{...D,groupIndices:w,groupOffsetTree:B}})),C),Ne(ce(o,Pe(C),ze(([w,{lastIndex:D}])=>w<D),be(([w,{lastIndex:D,lastSize:E}])=>[{endIndex:D,size:E,startIndex:w}])),i),Ne(m,y);const O=Zt(ce(m,be(w=>w===void 0)),!0);Ne(ce(y,ze(w=>w!==void 0&&ut(bt(C).sizeTree)),be(w=>{const D=bt(v),E=bt(x).length>0;return D!==void 0&&D!==0?E?[{endIndex:0,size:D,startIndex:0},{endIndex:1,size:w,startIndex:1}]:[]:[{endIndex:0,size:w,startIndex:0}]})),i),Ne(ce(j,ze(w=>w!==void 0&&w.length>0&&ut(bt(C).sizeTree)),be(w=>{const D=[];let E=w[0],B=0;for(let P=1;P<w.length;P++){const F=w[P];F!==E&&(D.push({endIndex:P-1,size:E,startIndex:B}),E=F,B=P)}return D.push({endIndex:w.length-1,size:E,startIndex:B}),D})),i),Ne(ce(x,Pe(v,y),ze(([,w,D])=>w!==void 0&&D!==void 0),be(([w,D,E])=>{const B=[];for(let P=0;P<w.length;P++){const F=w[P],te=w[P+1];B.push({startIndex:F,endIndex:F,size:D}),te!==void 0&&B.push({startIndex:F+1,endIndex:te-1,size:E})}return B})),i);const U=Sn(ce(i,Pe(C),Xn(({sizes:w},[D,E])=>({changed:E!==w,sizes:E}),{changed:!1,sizes:T}),be(w=>w.changed)));nt(ce(h,Xn((w,D)=>({diff:w.prev-D,prev:D}),{diff:0,prev:0}),be(w=>w.diff)),w=>{const{groupIndices:D}=bt(C);if(w>0)Ve(r,!0),Ve(p,w+yx(w,D));else if(w<0){const E=bt(M);E.length>0&&(w-=yx(-w,E)),Ve(f,w)}}),nt(ce(h,Pe(a)),([w,D])=>{w<0&&D("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:h},It.ERROR)});const L=Sn(p);Ne(ce(p,Pe(C),be(([w,D])=>{const E=D.groupIndices.length>0,B=[],P=D.lastSize;if(E){const F=ws(D.sizeTree,0);let te=0,Q=0;for(;te<w;){const R=D.groupIndices[Q],I=D.groupIndices.length===Q+1?1/0:D.groupIndices[Q+1]-R-1;B.push({endIndex:R,size:F,startIndex:R}),B.push({endIndex:R+1+I-1,size:P,startIndex:R+1}),Q++,te+=I+1}const z=vl(D.sizeTree);return te!==w&&z.shift(),z.reduce((R,{k:I,v:Z})=>{let q=R.ranges;return R.prevSize!==0&&(q=[...R.ranges,{endIndex:I+w-1,size:R.prevSize,startIndex:R.prevIndex}]),{prevIndex:I+w,prevSize:Z,ranges:q}},{prevIndex:w,prevSize:0,ranges:B}).ranges}return vl(D.sizeTree).reduce((F,{k:te,v:Q})=>({prevIndex:te+w,prevSize:Q,ranges:[...F.ranges,{endIndex:te+w-1,size:F.prevSize,startIndex:F.prevIndex}]}),{prevIndex:0,prevSize:P,ranges:[]}).ranges})),i);const V=Sn(ce(f,Pe(C,A),be(([w,{offsetTree:D},E])=>{const B=-w;return Ns(B,D,E)})));return Ne(ce(f,Pe(C,A),be(([w,D,E])=>{if(D.groupIndices.length>0){if(ut(D.sizeTree))return D;let P=dr();const F=bt(M);let te=0,Q=0,z=0;for(;te<-w;){z=F[Q];const R=F[Q+1]-z-1;Q++,te+=R+1}if(P=vl(D.sizeTree).reduce((R,{k:I,v:Z})=>bn(R,Math.max(0,I+w),Z),P),te!==-w){const R=ws(D.sizeTree,z);P=bn(P,0,R);const I=Gn(D.sizeTree,-w+1)[1];P=bn(P,1,I)}return{...D,sizeTree:P,...vu(D.offsetTree,0,P,E)}}const B=vl(D.sizeTree).reduce((P,{k:F,v:te})=>bn(P,Math.max(0,F+w),te),dr());return{...D,sizeTree:B,...vu(D.offsetTree,0,B,E)}})),C),{beforeUnshiftWith:L,data:k,defaultItemSize:y,firstItemIndex:h,fixedItemSize:m,fixedGroupSize:v,gap:A,groupIndices:x,heightEstimates:j,itemSize:S,listRefresh:U,shiftWith:f,shiftWithOffset:V,sizeRanges:i,sizes:C,statefulTotalCount:d,totalCount:o,trackItemSizes:O,unshiftWith:p}},xt(Ka,zu),{singleton:!0});function aj(a){return a.reduce((r,i)=>(r.groupIndices.push(r.totalCount),r.totalCount+=i+1,r),{groupIndices:[],totalCount:0})}const zg=et(([{groupIndices:a,sizes:r,totalCount:i},{headerHeight:o,scrollTop:d}])=>{const p=Xe(),f=Xe(),h=Sn(ce(p,be(aj)));return Ne(ce(h,be(x=>x.totalCount)),i),Ne(ce(h,be(x=>x.groupIndices)),a),Ne(ce(_t(d,r,o),ze(([x,m])=>vo(m)),be(([x,m,y])=>Gn(m.groupOffsetTree,Math.max(x-y,0),"v")[0]),ht(),be(x=>[x])),f),{groupCounts:p,topItemsIndexes:f}},xt(Qn,ln)),Xa=et(([{log:a}])=>{const r=me(!1),i=Sn(ce(r,ze(o=>o),ht()));return nt(r,o=>{o&&bt(a)("props updated",{},It.DEBUG)}),{didMount:i,propsReady:r}},xt(Ka),{singleton:!0}),lj=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Lg(a){const r=typeof a=="number"?{index:a}:a;return r.align||(r.align="start"),(!r.behavior||!lj)&&(r.behavior="auto"),r.offset===void 0&&(r.offset=0),r}const As=et(([{gap:a,listRefresh:r,sizes:i,totalCount:o},{fixedFooterHeight:d,fixedHeaderHeight:p,footerHeight:f,headerHeight:h,scrollingInProgress:x,scrollTo:m,smoothScrollTargetReached:y,viewportHeight:v},{log:j}])=>{const S=Xe(),k=Xe(),A=me(0);let T=null,C=null,M=null;function O(){T!==null&&(T(),T=null),M!==null&&(M(),M=null),C&&(clearTimeout(C),C=null),Ve(x,!1)}return Ne(ce(S,Pe(i,v,o,A,h,f,j),Pe(a,p,d),be(([[U,L,V,w,D,E,B,P],F,te,Q])=>{const z=Lg(U),{align:R,behavior:I,offset:Z}=z,q=w-1,de=Mg(z,L,q);let _=Ns(de,L.offsetTree,F)+E;R==="end"?(_+=te+Gn(L.sizeTree,de)[1]-V+Q,de===q&&(_+=B)):R==="center"?_+=(te+Gn(L.sizeTree,de)[1]-V+Q)/2:_-=D,Z!==void 0&&Z!==0&&(_+=Z);const W=ie=>{O(),ie?(P("retrying to scroll to",{location:U},It.DEBUG),Ve(S,U)):(Ve(k,!0),P("list did not change, scroll successful",{},It.DEBUG))};if(O(),I==="smooth"){let ie=!1;M=nt(r,ue=>{ie=ie||ue}),T=Pn(y,()=>{W(ie)})}else T=Pn(ce(r,rj(150)),W);return C=setTimeout(()=>{O()},1200),Ve(x,!0),P("scrolling from index to",{behavior:I,index:de,top:_},It.DEBUG),{behavior:I,top:_}})),m),{scrollTargetReached:k,scrollToIndex:S,topListHeight:A}},xt(Qn,ln,Ka),{singleton:!0});function rj(a){return r=>{const i=setTimeout(()=>{r(!1)},a);return o=>{o&&(r(!0),clearTimeout(i))}}}function Du(a,r){a===0?r():requestAnimationFrame(()=>{Du(a-1,r)})}function _u(a,r){const i=r-1;return typeof a=="number"?a:a.index==="LAST"?i:a.index}const Ms=et(([{defaultItemSize:a,listRefresh:r,sizes:i},{scrollTop:o},{scrollTargetReached:d,scrollToIndex:p},{didMount:f}])=>{const h=me(!0),x=me(0),m=me(!0);return Ne(ce(f,Pe(x),ze(([y,v])=>v!==0),Kn(!1)),h),Ne(ce(f,Pe(x),ze(([y,v])=>v!==0),Kn(!1)),m),nt(ce(_t(r,f),Pe(h,i,a,m),ze(([[,y],v,{sizeTree:j},S,k])=>y&&(!ut(j)||Ru(S))&&!v&&!k),Pe(x)),([,y])=>{Pn(d,()=>{Ve(m,!0)}),Du(4,()=>{Pn(o,()=>{Ve(h,!0)}),Ve(p,y)})}),{initialItemFinalLocationReached:m,initialTopMostItemIndex:x,scrolledToInitialItem:h}},xt(Qn,ln,As,Xa),{singleton:!0});function Dg(a,r){return Math.abs(a-r)<1.01}const Es="up",bs="down",sj="none",ij={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},oj=0,zs=et(([{footerHeight:a,headerHeight:r,scrollBy:i,scrollContainerState:o,scrollTop:d,viewportHeight:p}])=>{const f=me(!1),h=me(!0),x=Xe(),m=Xe(),y=me(4),v=me(oj),j=Zt(ce(mu(ce(Me(d),yl(1),Kn(!0)),ce(Me(d),yl(1),Kn(!1),xx(100))),ht()),!1),S=Zt(ce(mu(ce(i,Kn(!0)),ce(i,Kn(!1),xx(200))),ht()),!1);Ne(ce(_t(Me(d),Me(v)),be(([M,O])=>M<=O),ht()),h),Ne(ce(h,va(50)),m);const k=Sn(ce(_t(o,Me(p),Me(r),Me(a),Me(y)),Xn((M,[{scrollHeight:O,scrollTop:U},L,V,w,D])=>{const E=U+L-O>-D,B={scrollHeight:O,scrollTop:U,viewportHeight:L};if(E){let F,te;return U>M.state.scrollTop?(F="SCROLLED_DOWN",te=M.state.scrollTop-U):(F="SIZE_DECREASED",te=M.state.scrollTop-U||M.scrollTopDelta),{atBottom:!0,atBottomBecause:F,scrollTopDelta:te,state:B}}let P;return B.scrollHeight>M.state.scrollHeight?P="SIZE_INCREASED":L<M.state.viewportHeight?P="VIEWPORT_HEIGHT_DECREASING":U<M.state.scrollTop?P="SCROLLING_UPWARDS":P="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:P,state:B}},ij),ht((M,O)=>M!==void 0&&M.atBottom===O.atBottom))),A=Zt(ce(o,Xn((M,{scrollHeight:O,scrollTop:U,viewportHeight:L})=>{if(!Dg(M.scrollHeight,O)){const V=O-(U+L)<1;return M.scrollTop!==U&&V?{changed:!0,jump:M.scrollTop-U,scrollHeight:O,scrollTop:U}:{changed:!0,jump:0,scrollHeight:O,scrollTop:U}}return{changed:!1,jump:0,scrollHeight:O,scrollTop:U}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),ze(M=>M.changed),be(M=>M.jump)),0);Ne(ce(k,be(M=>M.atBottom)),f),Ne(ce(f,va(50)),x);const T=me(bs);Ne(ce(o,be(({scrollTop:M})=>M),ht(),Xn((M,O)=>bt(S)?{direction:M.direction,prevScrollTop:O}:{direction:O<M.prevScrollTop?Es:bs,prevScrollTop:O},{direction:bs,prevScrollTop:0}),be(M=>M.direction)),T),Ne(ce(o,va(50),Kn(sj)),T);const C=me(0);return Ne(ce(j,ze(M=>!M),Kn(0)),C),Ne(ce(d,va(100),Pe(j),ze(([M,O])=>O),Xn(([M,O],[U])=>[O,U],[0,0]),be(([M,O])=>O-M)),C),{atBottomState:k,atBottomStateChange:x,atBottomThreshold:y,atTopStateChange:m,atTopThreshold:v,isAtBottom:f,isAtTop:h,isScrolling:j,lastJumpDueToItemResize:A,scrollDirection:T,scrollVelocity:C}},xt(ln)),Ts="top",Rs="bottom",bx="none";function jx(a,r,i){return typeof a=="number"?i===Es&&r===Ts||i===bs&&r===Rs?a:0:i===Es?r===Ts?a.main:a.reverse:r===Rs?a.main:a.reverse}function Sx(a,r){return typeof a=="number"?a:a[r]??0}const Ou=et(([{deviation:a,fixedHeaderHeight:r,headerHeight:i,scrollTop:o,viewportHeight:d}])=>{const p=Xe(),f=me(0),h=me(0),x=me(0),m=Zt(ce(_t(Me(o),Me(d),Me(i),Me(p,Cs),Me(x),Me(f),Me(r),Me(a),Me(h)),be(([y,v,j,[S,k],A,T,C,M,O])=>{const U=y-M,L=T+C,V=Math.max(j-U,0);let w=bx;const D=Sx(O,Ts),E=Sx(O,Rs);return S-=M,S+=j+C,k+=j+C,k-=M,S>y+L-D&&(w=Es),k<y-V+v+E&&(w=bs),w!==bx?[Math.max(U-j-jx(A,Ts,w)-D,0),U-V-C+v+jx(A,Rs,w)+E]:null}),ze(y=>y!==null),ht(Cs)),[0,0]);return{increaseViewportBy:h,listBoundary:p,overscan:x,topListHeight:f,visibleRange:m}},xt(ln),{singleton:!0});function cj(a,r,i){if(vo(r)){const o=Ag(a,r);return[{index:Gn(r.groupOffsetTree,o)[0],offset:0,size:0},{data:i==null?void 0:i[0],index:o,offset:0,size:0}]}return[{data:i==null?void 0:i[0],index:a,offset:0,size:0}]}const Fd={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function ro(a,r,i,o,d,p){const{lastIndex:f,lastOffset:h,lastSize:x}=d;let m=0,y=0;if(a.length>0){m=a[0].offset;const A=a[a.length-1];y=A.offset+A.size}const v=i-f,j=h+v*x+(v-1)*o,S=m,k=j-y;return{bottom:y,firstItemIndex:p,items:kx(a,d,p),offsetBottom:k,offsetTop:m,top:S,topItems:kx(r,d,p),topListHeight:r.reduce((A,T)=>T.size+A,0),totalCount:i}}function _g(a,r,i,o,d,p){let f=0;if(i.groupIndices.length>0)for(const y of i.groupIndices){if(y-f>=a)break;f++}const h=a+f,x=_u(r,h),m=Array.from({length:h}).map((y,v)=>({data:p[v+x],index:v+x,offset:0,size:0}));return ro(m,[],h,d,i,o)}function kx(a,r,i){if(a.length===0)return[];if(!vo(r))return a.map(m=>({...m,index:m.index+i,originalIndex:m.index}));const o=a[0].index,d=a[a.length-1].index,p=[],f=ur(r.groupOffsetTree,o,d);let h,x=0;for(const m of a){(!h||h.end<m.index)&&(h=f.shift(),x=r.groupIndices.indexOf(h.start));let y;m.index===h.start?y={index:x,type:"group"}:y={groupIndex:x,index:m.index-(x+1)+i},p.push({...y,data:m.data,offset:m.offset,originalIndex:m.index,size:m.size})}return p}function wx(a,r){return a===void 0?0:typeof a=="number"?a:a[r]??0}const Sl=et(([{data:a,firstItemIndex:r,gap:i,sizes:o,totalCount:d},p,{listBoundary:f,topListHeight:h,visibleRange:x},{initialTopMostItemIndex:m,scrolledToInitialItem:y},{topListHeight:v},j,{didMount:S},{recalcInProgress:k}])=>{const A=me([]),T=me(0),C=Xe(),M=me(0);Ne(p.topItemsIndexes,A);const O=Zt(ce(_t(S,k,Me(x,Cs),Me(d),Me(o),Me(m),y,Me(A),Me(r),Me(i),Me(M),a),ze(([w,D,,E,,,,,,,,B])=>{const P=B!==void 0&&B.length!==E;return w&&!D&&!P}),be(([,,[w,D],E,B,P,F,te,Q,z,R,I])=>{var Se,De;const Z=B,{offsetTree:q,sizeTree:de}=Z,_=bt(T);if(E===0)return{...Fd,totalCount:E};if(w===0&&D===0)return _===0?{...Fd,totalCount:E}:_g(_,P,B,Q,z,I||[]);if(ut(de))return _>0?null:ro(cj(_u(P,E),Z,I),[],E,z,Z,Q);const W=[];if(te.length>0){const Ie=te[0],ae=te[te.length-1];let pe=0;for(const fe of ur(de,Ie,ae)){const he=fe.value,ve=Math.max(fe.start,Ie),_e=Math.min(fe.end,ae);for(let re=ve;re<=_e;re++)W.push({data:I==null?void 0:I[re],index:re,offset:pe,size:he}),pe+=he}}if(!F)return ro([],W,E,z,Z,Q);const ie=te.length>0?te[te.length-1]+1:0,ue=Q0(q,w,D,ie);if(ue.length===0)return null;const ge=E-1,xe=go([],Ie=>{for(const ae of ue){const pe=ae.value;let fe=pe.offset,he=ae.start;const ve=pe.size;if(pe.offset<w){he+=Math.floor((w-pe.offset+z)/(ve+z));const re=he-ae.start;fe+=re*ve+re*z}he<ie&&(fe+=(ie-he)*ve,he=ie);const _e=Math.min(ae.end,ge);for(let re=he;re<=_e&&!(fe>=D);re++)Ie.push({data:I==null?void 0:I[re],index:re,offset:fe,size:ve}),fe+=ve+z}}),we=wx(R,Ts),oe=wx(R,Rs);if(xe.length>0&&(we>0||oe>0)){const Ie=xe[0],ae=xe[xe.length-1];if(we>0&&Ie.index>ie){const pe=Math.min(we,Ie.index-ie),fe=[];let he=Ie.offset;for(let ve=Ie.index-1;ve>=Ie.index-pe;ve--){const _e=((Se=ur(de,ve,ve)[0])==null?void 0:Se.value)??Ie.size;he-=_e+z,fe.unshift({data:I==null?void 0:I[ve],index:ve,offset:he,size:_e})}xe.unshift(...fe)}if(oe>0&&ae.index<ge){const pe=Math.min(oe,ge-ae.index);let fe=ae.offset+ae.size+z;for(let he=ae.index+1;he<=ae.index+pe;he++){const ve=((De=ur(de,he,he)[0])==null?void 0:De.value)??ae.size;xe.push({data:I==null?void 0:I[he],index:he,offset:fe,size:ve}),fe+=ve+z}}}return ro(xe,W,E,z,Z,Q)}),ze(w=>w!==null),ht()),Fd);Ne(ce(a,ze(Ru),be(w=>w==null?void 0:w.length)),d),Ne(ce(O,be(w=>w.topListHeight)),v),Ne(v,h),Ne(ce(O,be(w=>[w.top,w.bottom])),f),Ne(ce(O,be(w=>w.items)),C);const U=Sn(ce(O,ze(({items:w})=>w.length>0),Pe(d,a),ze(([{items:w},D])=>w[w.length-1].originalIndex===D-1),be(([,w,D])=>[w-1,D]),ht(Cs),be(([w])=>w))),L=Sn(ce(O,va(200),ze(({items:w,topItems:D})=>w.length>0&&w[0].originalIndex===D.length),be(({items:w})=>w[0].index),ht())),V=Sn(ce(O,ze(({items:w})=>w.length>0),be(({items:w})=>{let D=0,E=w.length-1;for(;w[D].type==="group"&&D<E;)D++;for(;w[E].type==="group"&&E>D;)E--;return{endIndex:w[E].index,startIndex:w[D].index}}),ht(Tg)));return{endReached:U,initialItemCount:T,itemsRendered:C,listState:O,minOverscanItemCount:M,rangeChanged:V,startReached:L,topItemsIndexes:A,...j}},xt(Qn,zg,Ou,Ms,As,zs,Xa,zu),{singleton:!0}),Og=et(([{fixedFooterHeight:a,fixedHeaderHeight:r,footerHeight:i,headerHeight:o},{listState:d}])=>{const p=Xe(),f=Zt(ce(_t(i,a,o,r,d),be(([h,x,m,y,v])=>h+x+m+y+v.offsetBottom+v.bottom)),0);return Ne(Me(f),p),{totalListHeight:f,totalListHeightChanged:p}},xt(ln,Sl),{singleton:!0}),dj=et(([{viewportHeight:a},{totalListHeight:r}])=>{const i=me(!1),o=Zt(ce(_t(i,a,r),ze(([d])=>d),be(([,d,p])=>Math.max(0,d-p)),va(0),ht()),0);return{alignToBottom:i,paddingTopAddition:o}},xt(ln,Og),{singleton:!0}),Bg=et(()=>({context:me(null)})),uj=({itemBottom:a,itemTop:r,locationParams:{align:i,behavior:o,...d},viewportBottom:p,viewportTop:f})=>r<f?{...d,align:i??"start",...o!==void 0?{behavior:o}:{}}:a>p?{...d,align:i??"end",...o!==void 0?{behavior:o}:{}}:null,Ig=et(([{gap:a,sizes:r,totalCount:i},{fixedFooterHeight:o,fixedHeaderHeight:d,headerHeight:p,scrollingInProgress:f,scrollTop:h,viewportHeight:x},{scrollToIndex:m}])=>{const y=Xe();return Ne(ce(y,Pe(r,x,i,p,d,o,h),Pe(a),be(([[v,j,S,k,A,T,C,M],O])=>{const{calculateViewLocation:U=uj,done:L,...V}=v,w=Mg(v,j,k-1),D=Ns(w,j.offsetTree,O)+A+T,E=D+Gn(j.sizeTree,w)[1],B=M+T,P=M+S-C,F=U({itemBottom:E,itemTop:D,locationParams:V,viewportBottom:P,viewportTop:B});return F!==null?L&&Pn(ce(f,ze(te=>!te),yl(bt(f)?1:2)),L):L==null||L(),F}),ze(v=>v!==null)),m),{scrollIntoView:y}},xt(Qn,ln,As,Sl,Ka),{singleton:!0});function Cx(a){return a===!1?!1:a==="smooth"?"smooth":"auto"}const fj=(a,r)=>typeof a=="function"?Cx(a(r)):r&&Cx(a),pj=et(([{listRefresh:a,totalCount:r,fixedItemSize:i,data:o},{atBottomState:d,isAtBottom:p},{scrollToIndex:f},{scrolledToInitialItem:h},{didMount:x,propsReady:m},{log:y},{scrollingInProgress:v},{context:j},{scrollIntoView:S}])=>{const k=me(!1),A=Xe();let T=null;function C(L){Ve(f,{align:"end",behavior:L,index:"LAST"})}nt(ce(_t(ce(Me(r),yl(1)),x),Pe(Me(k),p,h,v),be(([[L,V],w,D,E,B])=>{let P=V&&E,F="auto";return P&&(F=fj(w,D||B),P=P&&F!==!1),{followOutputBehavior:F,shouldFollow:P,totalCount:L}}),ze(({shouldFollow:L})=>L)),({followOutputBehavior:L,totalCount:V})=>{T!==null&&(T(),T=null),bt(i)!==void 0?requestAnimationFrame(()=>{bt(y)("following output to ",{totalCount:V},It.DEBUG),C(L)}):T=Pn(a,()=>{bt(y)("following output to ",{totalCount:V},It.DEBUG),C(L),T=null})});function M(L){const V=Pn(d,w=>{L&&!w.atBottom&&w.notAtBottomBecause==="SIZE_INCREASED"&&T===null&&(bt(y)("scrolling to bottom due to increased size",{},It.DEBUG),C("auto"))});setTimeout(V,100)}nt(ce(_t(Me(k),r,m),ze(([L,,V])=>L!==!1&&V),Xn(({value:L},[,V])=>({refreshed:L===V,value:V}),{refreshed:!1,value:0}),ze(({refreshed:L})=>L),Pe(k,r)),([,L])=>{bt(h)&&M(L!==!1)}),nt(A,()=>{M(bt(k)!==!1)}),nt(_t(Me(k),d),([L,V])=>{L!==!1&&!V.atBottom&&V.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&C("auto")});const O=me(null),U=Xe();return Ne(mu(ce(Me(o),be(L=>(L==null?void 0:L.length)??0)),ce(Me(r))),U),nt(ce(_t(ce(U,yl(1)),x),Pe(Me(O),h,v,j),be(([[L,V],w,D,E,B])=>V&&D&&(w==null?void 0:w({context:B,totalCount:L,scrollingInProgress:E}))),ze(L=>!!L),va(0)),L=>{T!==null&&(T(),T=null),bt(i)!==void 0?requestAnimationFrame(()=>{bt(y)("scrolling into view",{}),Ve(S,L)}):T=Pn(a,()=>{bt(y)("scrolling into view",{}),Ve(S,L),T=null})}),{autoscrollToBottom:A,followOutput:k,scrollIntoViewOnChange:O}},xt(Qn,zs,As,Ms,Xa,Ka,ln,Bg,Ig)),mj=et(([{data:a,firstItemIndex:r,gap:i,sizes:o},{initialTopMostItemIndex:d},{initialItemCount:p,listState:f},{didMount:h}])=>(Ne(ce(h,Pe(p),ze(([,x])=>x!==0),Pe(d,o,r,i,a),be(([[,x],m,y,v,j,S=[]])=>_g(x,m,y,v,j,S))),f),{}),xt(Qn,Ms,Sl,Xa),{singleton:!0}),hj=et(([{didMount:a},{scrollTo:r},{listState:i}])=>{const o=me(0);return nt(ce(a,Pe(o),ze(([,d])=>d!==0),be(([,d])=>({top:d}))),d=>{Pn(ce(i,yl(1),ze(p=>p.items.length>1)),()=>{requestAnimationFrame(()=>{Ve(r,d)})})}),{initialScrollTop:o}},xt(Xa,ln,Sl),{singleton:!0}),Hg=et(([{scrollVelocity:a}])=>{const r=me(!1),i=Xe(),o=me(!1);return Ne(ce(a,Pe(o,r,i),ze(([d,p])=>p!==!1&&p!==void 0),be(([d,p,f,h])=>{const{enter:x,exit:m}=p;if(f){if(m(d,h))return!1}else if(x(d,h))return!0;return f}),ht()),r),nt(ce(_t(r,a,i),Pe(o)),([[d,p,f],h])=>{d&&h!==!1&&h!==void 0&&h.change&&h.change(p,f)}),{isSeeking:r,scrollSeekConfiguration:o,scrollSeekRangeChanged:i,scrollVelocity:a}},xt(zs),{singleton:!0}),Bu=et(([{scrollContainerState:a,scrollTo:r}])=>{const i=Xe(),o=Xe(),d=Xe(),p=me(!1),f=me(void 0);return Ne(ce(_t(i,o),be(([{scrollTop:h,viewportHeight:x},{offsetTop:m,listHeight:y}])=>({scrollHeight:y,scrollTop:Math.max(0,h-m),viewportHeight:x}))),a),Ne(ce(r,Pe(o),be(([h,{offsetTop:x}])=>({...h,top:h.top+x}))),d),{customScrollParent:f,useWindowScroll:p,windowScrollContainerState:i,windowScrollTo:d,windowViewportRect:o}},xt(ln)),xj=et(([{sizeRanges:a,sizes:r},{headerHeight:i,scrollTop:o},{initialTopMostItemIndex:d},{didMount:p},{useWindowScroll:f,windowScrollContainerState:h,windowViewportRect:x}])=>{const m=Xe(),y=me(void 0),v=me(null),j=me(null);return Ne(h,v),Ne(x,j),nt(ce(m,Pe(r,o,f,v,j,i)),([S,k,A,T,C,M,O])=>{const U=J0(k.sizeTree);T&&C!==null&&M!==null&&(A=C.scrollTop-M.offsetTop),A-=O,S({ranges:U,scrollTop:A})}),Ne(ce(y,ze(Ru),be(gj)),d),Ne(ce(p,Pe(y),ze(([,S])=>S!==void 0),ht(),be(([,S])=>S.ranges)),a),{getState:m,restoreStateFrom:y}},xt(Qn,ln,Ms,Xa,Bu));function gj(a){return{align:"start",index:0,offset:a.scrollTop}}const vj=et(([{topItemsIndexes:a}])=>{const r=me(0);return Ne(ce(r,ze(i=>i>=0),be(i=>Array.from({length:i}).map((o,d)=>d))),a),{topItemCount:r}},xt(Sl));function Ug(a){let r=!1,i;return(()=>(r||(r=!0,i=a()),i))}const yj=Ug(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),bj=et(([{deviation:a,scrollBy:r,scrollingInProgress:i,scrollTop:o},{isAtBottom:d,isScrolling:p,lastJumpDueToItemResize:f,scrollDirection:h},{listState:x},{beforeUnshiftWith:m,gap:y,shiftWithOffset:v,sizes:j},{log:S},{recalcInProgress:k}])=>{const A=Sn(ce(x,Pe(f),Xn(([,C,M,O],[{bottom:U,items:L,offsetBottom:V,totalCount:w},D])=>{const E=U+V;let B=0;return M===w&&C.length>0&&L.length>0&&(L[0].originalIndex===0&&C[0].originalIndex===0||(B=E-O,B!==0&&(B+=D))),[B,L,w,E]},[0,[],0,0]),ze(([C])=>C!==0),Pe(o,h,i,d,S,k),ze(([,C,M,O,,,U])=>!U&&!O&&C!==0&&M===Es),be(([[C],,,,,M])=>(M("Upward scrolling compensation",{amount:C},It.DEBUG),C))));function T(C){C>0?(Ve(r,{behavior:"auto",top:-C}),Ve(a,0)):(Ve(a,0),Ve(r,{behavior:"auto",top:-C}))}return nt(ce(A,Pe(a,p)),([C,M,O])=>{O&&yj()?Ve(a,M-C):T(-C)}),nt(ce(_t(Zt(p,!1),a,k),ze(([C,M,O])=>!C&&!O&&M!==0),be(([C,M])=>M),va(1)),T),Ne(ce(v,be(C=>({top:-C}))),r),nt(ce(m,Pe(j,y),be(([C,{groupIndices:M,lastSize:O,sizeTree:U},L])=>{function V(P){return P*(O+L)}if(M.length===0)return V(C);let w=0;const D=ws(U,0);let E=0,B=0;for(;E<C;){E++,w+=D;let P=M.length===B+1?1/0:M[B+1]-M[B]-1;E+P>C&&(w-=D,P=C-E+1),E+=P,w+=V(P),B++}return w})),C=>{Ve(a,C),requestAnimationFrame(()=>{Ve(r,{top:C}),requestAnimationFrame(()=>{Ve(a,0),Ve(k,!1)})})}),{deviation:a}},xt(ln,zs,Sl,Qn,Ka,zu)),jj=et(([a,r,i,o,d,p,f,h,x,m,y])=>({...a,...r,...i,...o,...d,...p,...f,...h,...x,...m,...y}),xt(Ou,mj,Xa,Hg,Og,hj,dj,Bu,Ig,Ka,Bg)),Vg=et(([{data:a,defaultItemSize:r,firstItemIndex:i,fixedItemSize:o,fixedGroupSize:d,gap:p,groupIndices:f,heightEstimates:h,itemSize:x,sizeRanges:m,sizes:y,statefulTotalCount:v,totalCount:j,trackItemSizes:S},{initialItemFinalLocationReached:k,initialTopMostItemIndex:A,scrolledToInitialItem:T},C,M,O,U,{scrollToIndex:L},V,{topItemCount:w},{groupCounts:D},E])=>{const{listState:B,minOverscanItemCount:P,topItemsIndexes:F,rangeChanged:te,...Q}=U;return Ne(te,E.scrollSeekRangeChanged),Ne(ce(E.windowViewportRect,be(z=>z.visibleHeight)),C.viewportHeight),{data:a,defaultItemHeight:r,firstItemIndex:i,fixedItemHeight:o,fixedGroupHeight:d,gap:p,groupCounts:D,heightEstimates:h,initialItemFinalLocationReached:k,initialTopMostItemIndex:A,scrolledToInitialItem:T,sizeRanges:m,topItemCount:w,topItemsIndexes:F,totalCount:j,...O,groupIndices:f,itemSize:x,listState:B,minOverscanItemCount:P,scrollToIndex:L,statefulTotalCount:v,trackItemSizes:S,rangeChanged:te,...Q,...E,...C,sizes:y,...M}},xt(Qn,Ms,ln,xj,pj,Sl,As,bj,vj,zg,jj));function Sj(a,r){const i={},o={};let d=0;const p=a.length;for(;d<p;)o[a[d]]=1,d+=1;for(const f in r)Object.hasOwn(o,f)||(i[f]=r[f]);return i}const Yi=typeof document<"u"?Ce.useLayoutEffect:Ce.useEffect;function $g(a,r,i){const o=Object.keys(r.required||{}),d=Object.keys(r.optional||{}),p=Object.keys(r.methods||{}),f=Object.keys(r.events||{}),h=Ce.createContext({});function x(T,C){T.propsReady!==void 0&&Ve(T.propsReady,!1);for(const M of o){const O=T[r.required[M]];Ve(O,C[M])}for(const M of d)if(M in C){const O=T[r.optional[M]];Ve(O,C[M])}T.propsReady!==void 0&&Ve(T.propsReady,!0)}function m(T){return p.reduce((C,M)=>(C[M]=O=>{const U=T[r.methods[M]];Ve(U,O)},C),{})}function y(T){return f.reduce((C,M)=>(C[M]=I0(T[r.events[M]]),C),{})}const v=Ce.forwardRef(function(T,C){const{children:M,...O}=T,[U]=Ce.useState(()=>go(U0(a),w=>{x(w,O)})),[L]=Ce.useState(hx(y,U));Yi(()=>{for(const w of f)w in O&&nt(L[w],O[w]);return()=>{Object.values(L).map(Au)}},[O,L,U]),Yi(()=>{x(U,O)}),Ce.useImperativeHandle(C,mx(m(U)));const V=i;return n.jsx(h.Provider,{value:U,children:i!==void 0?n.jsx(V,{...Sj([...o,...d,...f],O),children:M}):M})}),j=T=>{const C=Ce.useContext(h);return Ce.useCallback(M=>{Ve(C[T],M)},[C,T])},S=T=>{const C=Ce.useContext(h)[T],M=Ce.useCallback(O=>nt(C,O),[C]);return Ce.useSyncExternalStore(M,()=>bt(C),()=>bt(C))},k=T=>{const C=Ce.useContext(h)[T],[M,O]=Ce.useState(hx(bt,C));return Yi(()=>nt(C,U=>{U!==M&&O(mx(U))}),[C,M]),M},A=parseInt(Ce.version)>=18?S:k;return{Component:v,useEmitter:(T,C)=>{const M=Ce.useContext(h)[T];Yi(()=>nt(M,C),[C,M])},useEmitterValue:A,usePublisher:j}}const Pg=Ce.createContext(void 0),Gg=Ce.createContext(void 0),qd="-webkit-sticky",Nx="sticky",Iu=Ug(()=>{if(typeof document>"u")return Nx;const a=document.createElement("div");return a.style.position=qd,a.style.position===qd?qd:Nx}),Fg=typeof document<"u"?Ce.useLayoutEffect:Ce.useEffect;function Yd(a){return"self"in a}function kj(a){return"body"in a}function qg(a,r,i,o=vr,d,p){const f=Ce.useRef(null),h=Ce.useRef(null),x=Ce.useRef(null),m=Ce.useCallback(j=>{let S,k,A;const T=j.target;if(kj(T)||Yd(T)){const M=Yd(T)?T:T.defaultView;A=p===!0?M.scrollX:M.scrollY,S=p===!0?M.document.documentElement.scrollWidth:M.document.documentElement.scrollHeight,k=p===!0?M.innerWidth:M.innerHeight}else A=p===!0?T.scrollLeft:T.scrollTop,S=p===!0?T.scrollWidth:T.scrollHeight,k=p===!0?T.offsetWidth:T.offsetHeight;const C=()=>{a({scrollHeight:S,scrollTop:Math.max(A,0),viewportHeight:k})};j.suppressFlushSync===!0?C():bb.flushSync(C),h.current!==null&&(A===h.current||A<=0||A===S-k)&&(h.current=null,r(!0),x.current&&(clearTimeout(x.current),x.current=null))},[a,r,p]);Ce.useEffect(()=>{const j=d||f.current;return o(d||f.current),m({suppressFlushSync:!0,target:j}),j.addEventListener("scroll",m,{passive:!0}),()=>{o(null),j.removeEventListener("scroll",m)}},[f,m,i,o,d]);function y(j){const S=f.current;if(!S||(p===!0?"offsetWidth"in S&&S.offsetWidth===0:"offsetHeight"in S&&S.offsetHeight===0))return;const k=j.behavior==="smooth";let A,T,C;Yd(S)?(T=Math.max(Ya(S.document.documentElement,p===!0?"width":"height"),p===!0?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight),A=p===!0?S.innerWidth:S.innerHeight,C=p===!0?window.scrollX:window.scrollY):(T=S[p===!0?"scrollWidth":"scrollHeight"],A=Ya(S,p===!0?"width":"height"),C=S[p===!0?"scrollLeft":"scrollTop"]);const M=T-A;if(j.top=Math.ceil(Math.max(Math.min(M,j.top),0)),Dg(A,T)||j.top===C){a({scrollHeight:T,scrollTop:C,viewportHeight:A}),k&&r(!0);return}k?(h.current=j.top,x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{x.current=null,h.current=null,r(!0)},1e3)):h.current=null,p===!0&&(j={...j.behavior!==void 0?{behavior:j.behavior}:{},left:j.top}),S.scrollTo(j)}function v(j){p===!0&&(j={...j.behavior!==void 0?{behavior:j.behavior}:{},...j.top!==void 0?{left:j.top}:{}}),f.current.scrollBy(j)}return{scrollByCallback:v,scrollerRef:f,scrollToCallback:y}}function Hu(a){return a}const wj=et(()=>{const a=me(h=>`Item ${h}`),r=me(h=>`Group ${h}`),i=me({}),o=me(Hu),d=me("div"),p=me(vr),f=(h,x=null)=>Zt(ce(i,be(m=>m[h]),ht()),x);return{components:i,computeItemKey:o,EmptyPlaceholder:f("EmptyPlaceholder"),FooterComponent:f("Footer"),GroupComponent:f("Group","div"),groupContent:r,HeaderComponent:f("Header"),HeaderFooterTag:d,ItemComponent:f("Item","div"),itemContent:a,ListComponent:f("List","div"),ScrollerComponent:f("Scroller","div"),scrollerRef:p,ScrollSeekPlaceholder:f("ScrollSeekPlaceholder"),TopItemListComponent:f("TopItemList")}}),Cj=et(([a,r])=>({...a,...r}),xt(Vg,wj)),Nj=({height:a})=>n.jsx("div",{style:{height:a}}),Ej={overflowAnchor:"none",position:Iu(),zIndex:1},Yg={overflowAnchor:"none"},Tj={...Yg,display:"inline-block",height:"100%"},Ex=Ce.memo(function({showTopList:a=!1}){const r=Be("listState"),i=On("sizeRanges"),o=Be("useWindowScroll"),d=Be("customScrollParent"),p=On("windowScrollContainerState"),f=On("scrollContainerState"),h=d||o?p:f,x=Be("itemContent"),m=Be("context"),y=Be("groupContent"),v=Be("trackItemSizes"),j=Be("itemSize"),S=Be("log"),k=On("gap"),A=Be("horizontalDirection"),{callbackRef:T}=P0(i,j,v,a?vr:h,S,k,d,A,Be("skipAnimationFrameInResizeObserver")),[C,M]=Ce.useState(0);Uu("deviation",Q=>{C!==Q&&M(Q)});const O=Be("EmptyPlaceholder"),U=Be("ScrollSeekPlaceholder")??Nj,L=Be("ListComponent"),V=Be("ItemComponent"),w=Be("GroupComponent"),D=Be("computeItemKey"),E=Be("isSeeking"),B=Be("groupIndices").length>0,P=Be("alignToBottom"),F=Be("initialItemFinalLocationReached"),te=a?{}:{boxSizing:"border-box",...A?{display:"inline-block",height:"100%",marginLeft:C!==0?C:P?"auto":0,paddingLeft:r.offsetTop,paddingRight:r.offsetBottom,whiteSpace:"nowrap"}:{marginTop:C!==0?C:P?"auto":0,paddingBottom:r.offsetBottom,paddingTop:r.offsetTop},...F?{}:{visibility:"hidden"}};return!a&&r.totalCount===0&&O!==null&&O!==void 0?n.jsx(O,{...Qt(O,m)}):n.jsx(L,{...Qt(L,m),"data-testid":a?"virtuoso-top-item-list":"virtuoso-item-list",ref:T,style:te,children:(a?r.topItems:r.items).map(Q=>{const z=Q.originalIndex,R=D(z+r.firstItemIndex,Q.data,m);return E?g.createElement(U,{...Qt(U,m),height:Q.size,index:Q.index,key:R,type:Q.type||"item",...Q.type==="group"?{}:{groupIndex:Q.groupIndex}}):Q.type==="group"?g.createElement(w,{...Qt(w,m),"data-index":z,"data-item-index":Q.index,"data-known-size":Q.size,key:R,style:Ej},y(Q.index,m)):g.createElement(V,{...Qt(V,m),...zj(V,Q.data),"data-index":z,"data-item-group-index":Q.groupIndex,"data-item-index":Q.index,"data-known-size":Q.size,key:R,style:A?Tj:Yg},B?x(Q.index,Q.groupIndex,Q.data,m):x(Q.index,Q.data,m))})})}),Rj={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Aj={outline:"none",overflowX:"auto",position:"relative"},yo=a=>({height:"100%",position:"absolute",top:0,width:"100%",...a?{display:"flex",flexDirection:"column"}:void 0}),Mj={position:Iu(),top:0,width:"100%",zIndex:1};function Qt(a,r){if(typeof a!="string")return{context:r}}function zj(a,r){return{item:typeof a=="string"?void 0:r}}const Lj=Ce.memo(function(){const a=Be("HeaderComponent"),r=On("headerHeight"),i=Be("HeaderFooterTag"),o=jl(Ce.useMemo(()=>p=>{r(Ya(p,"height"))},[r]),!0,Be("skipAnimationFrameInResizeObserver")),d=Be("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,d)})}):null}),Dj=Ce.memo(function(){const a=Be("FooterComponent"),r=On("footerHeight"),i=Be("HeaderFooterTag"),o=jl(Ce.useMemo(()=>p=>{r(Ya(p,"height"))},[r]),!0,Be("skipAnimationFrameInResizeObserver")),d=Be("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,d)})}):null});function Wg({useEmitter:a,useEmitterValue:r,usePublisher:i}){return Ce.memo(function({children:o,style:d,context:p,...f}){const h=i("scrollContainerState"),x=r("ScrollerComponent"),m=i("smoothScrollTargetReached"),y=r("scrollerRef"),v=r("horizontalDirection")||!1,{scrollByCallback:j,scrollerRef:S,scrollToCallback:k}=qg(h,m,x,y,void 0,v);return a("scrollTo",k),a("scrollBy",j),n.jsx(x,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:S,style:{...v?Aj:Rj,...d},tabIndex:0,...f,...Qt(x,p),children:o})})}function Kg({useEmitter:a,useEmitterValue:r,usePublisher:i}){return Ce.memo(function({children:o,style:d,context:p,...f}){const h=i("windowScrollContainerState"),x=r("ScrollerComponent"),m=i("smoothScrollTargetReached"),y=r("totalListHeight"),v=r("deviation"),j=r("customScrollParent"),S=Ce.useRef(null),k=r("scrollerRef"),{scrollByCallback:A,scrollerRef:T,scrollToCallback:C}=qg(h,m,x,k,j);return Fg(()=>{var M;return T.current=j||((M=S.current)==null?void 0:M.ownerDocument.defaultView),()=>{T.current=null}},[T,j]),a("windowScrollTo",C),a("scrollBy",A),n.jsx(x,{ref:S,"data-virtuoso-scroller":!0,style:{position:"relative",...d,...y!==0?{height:y+v}:void 0},...f,...Qt(x,p),children:o})})}const _j=({children:a})=>{const r=Ce.useContext(Pg),i=On("viewportHeight"),o=On("fixedItemHeight"),d=Be("alignToBottom"),p=Be("horizontalDirection"),f=Ce.useMemo(()=>bg(i,x=>Ya(x,p?"width":"height")),[i,p]),h=jl(f,!0,Be("skipAnimationFrameInResizeObserver"));return Ce.useEffect(()=>{r&&(i(r.viewportHeight),o(r.itemHeight))},[r,i,o]),n.jsx("div",{"data-viewport-type":"element",ref:h,style:yo(d),children:a})},Oj=({children:a})=>{const r=Ce.useContext(Pg),i=On("windowViewportRect"),o=On("fixedItemHeight"),d=Be("customScrollParent"),p=Sg(i,d,Be("skipAnimationFrameInResizeObserver")),f=Be("alignToBottom");return Ce.useEffect(()=>{r&&(o(r.itemHeight),i({listHeight:0,offsetTop:0,visibleHeight:r.viewportHeight,visibleWidth:100}))},[r,i,o]),n.jsx("div",{"data-viewport-type":"window",ref:p,style:yo(f),children:a})},Bj=({children:a})=>{const r=Be("TopItemListComponent")??"div",i=Be("headerHeight"),o={...Mj,marginTop:`${i}px`},d=Be("context");return n.jsx(r,{style:o,...Qt(r,d),children:a})},Ij=Ce.memo(function(a){const r=Be("useWindowScroll"),i=Be("topItemsIndexes").length>0,o=Be("customScrollParent"),d=Be("context");return n.jsxs(o||r?Vj:Uj,{...a,context:d,children:[i&&n.jsx(Bj,{children:n.jsx(Ex,{showTopList:!0})}),n.jsxs(o||r?Oj:_j,{children:[n.jsx(Lj,{}),n.jsx(Ex,{}),n.jsx(Dj,{})]})]})}),{Component:Hj,useEmitter:Uu,useEmitterValue:Be,usePublisher:On}=$g(Cj,{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"}},Ij),Uj=Wg({useEmitter:Uu,useEmitterValue:Be,usePublisher:On}),Vj=Kg({useEmitter:Uu,useEmitterValue:Be,usePublisher:On}),$j=Hj,Pj=et(()=>{const a=me(m=>n.jsxs("td",{children:["Item $",m]})),r=me(null),i=me(m=>n.jsxs("td",{colSpan:1e3,children:["Group ",m]})),o=me(null),d=me(null),p=me({}),f=me(Hu),h=me(vr),x=(m,y=null)=>Zt(ce(p,be(v=>v[m]),ht()),y);return{components:p,computeItemKey:f,context:r,EmptyPlaceholder:x("EmptyPlaceholder"),FillerRow:x("FillerRow"),fixedFooterContent:d,fixedHeaderContent:o,itemContent:a,groupContent:i,ScrollerComponent:x("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:x("ScrollSeekPlaceholder"),TableBodyComponent:x("TableBody","tbody"),TableComponent:x("Table","table"),TableFooterComponent:x("TableFoot","tfoot"),TableHeadComponent:x("TableHead","thead"),TableRowComponent:x("TableRow","tr"),GroupComponent:x("Group","tr")}});xt(Vg,Pj);Iu();const Tx={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},Gj={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Rx,floor:co,max:js,min:Wd,round:Ax}=Math;function Mx(a,r,i){return Array.from({length:r-a+1}).map((o,d)=>({data:i===null?null:i[d+a],index:d+a}))}function Fj(a){return{...Gj,items:a}}function Wi(a,r){return a!==void 0&&a.width===r.width&&a.height===r.height}function qj(a,r){return a!==void 0&&a.column===r.column&&a.row===r.row}const Yj=et(([{increaseViewportBy:a,listBoundary:r,overscan:i,visibleRange:o},{footerHeight:d,headerHeight:p,scrollBy:f,scrollContainerState:h,scrollTo:x,scrollTop:m,smoothScrollTargetReached:y,viewportHeight:v},j,S,{didMount:k,propsReady:A},{customScrollParent:T,useWindowScroll:C,windowScrollContainerState:M,windowScrollTo:O,windowViewportRect:U},L])=>{const V=me(0),w=me(0),D=me(Tx),E=me({height:0,width:0}),B=me({height:0,width:0}),P=Xe(),F=Xe(),te=me(0),Q=me(null),z=me({column:0,row:0}),R=Xe(),I=Xe(),Z=me(!1),q=me(0),de=me(!0),_=me(!1),W=me(!1);nt(ce(k,Pe(q),ze(([oe,Se])=>Se!==0)),()=>{Ve(de,!1)}),nt(ce(_t(k,de,B,E,q,_),ze(([oe,Se,De,Ie,,ae])=>oe&&!Se&&De.height!==0&&Ie.height!==0&&!ae)),([,,,,oe])=>{Ve(_,!0),Du(1,()=>{Ve(P,oe)}),Pn(ce(m),()=>{Ve(r,[0,0]),Ve(de,!0)})}),Ne(ce(I,ze(oe=>oe!=null&&oe.scrollTop>0),Kn(0)),w),nt(ce(k,Pe(I),ze(([,oe])=>oe!=null)),([,oe])=>{oe&&(Ve(E,oe.viewport),Ve(B,oe.item),Ve(z,oe.gap),oe.scrollTop>0&&(Ve(Z,!0),Pn(ce(m,yl(1)),Se=>{Ve(Z,!1)}),Ve(x,{top:oe.scrollTop})))}),Ne(ce(E,be(({height:oe})=>oe)),v),Ne(ce(_t(Me(E,Wi),Me(B,Wi),Me(z,(oe,Se)=>oe!==void 0&&oe.column===Se.column&&oe.row===Se.row),Me(m)),be(([oe,Se,De,Ie])=>({gap:De,item:Se,scrollTop:Ie,viewport:oe}))),R),Ne(ce(_t(Me(V),o,Me(z,qj),Me(B,Wi),Me(E,Wi),Me(Q),Me(w),Me(Z),Me(de),Me(q)),ze(([,,,,,,,oe])=>!oe),be(([oe,[Se,De],Ie,ae,pe,fe,he,,ve,_e])=>{const{column:re,row:Te}=Ie,{height:Qe,width:at}=ae,{width:$t}=pe;if(he===0&&(oe===0||$t===0))return Tx;if(at===0){const rt=_u(_e,oe),Qa=rt+Math.max(he-1,0);return Fj(Mx(rt,Qa,fe))}const Pt=Xg($t,at,re);let lt,St;ve?Se===0&&De===0&&he>0?(lt=0,St=he-1):(lt=Pt*co((Se+Te)/(Qe+Te)),St=Pt*Rx((De+Te)/(Qe+Te))-1,St=Wd(oe-1,js(St,Pt-1)),lt=Wd(St,js(0,lt))):(lt=0,St=-1);const ye=Mx(lt,St,fe),{bottom:At,top:Le}=zx(pe,Ie,ae,ye),gt=Rx(oe/Pt),Kt=gt*Qe+(gt-1)*Te-At;return{bottom:At,itemHeight:Qe,items:ye,itemWidth:at,offsetBottom:Kt,offsetTop:Le,top:Le}})),D),Ne(ce(Q,ze(oe=>oe!==null),be(oe=>oe.length)),V),Ne(ce(_t(E,B,D,z),ze(([oe,Se,{items:De}])=>De.length>0&&Se.height!==0&&oe.height!==0),be(([oe,Se,{items:De},Ie])=>{const{bottom:ae,top:pe}=zx(oe,Ie,Se,De);return[pe,ae]}),ht(Cs)),r);const ie=me(!1);Ne(ce(m,Pe(ie),be(([oe,Se])=>Se||oe!==0)),ie);const ue=Sn(ce(_t(D,V),ze(([{items:oe}])=>oe.length>0),Pe(ie),ze(([[oe,Se],De])=>{const Ie=oe.items[oe.items.length-1].index===Se-1;return(De||oe.bottom>0&&oe.itemHeight>0&&oe.offsetBottom===0&&oe.items.length===Se)&&Ie}),be(([[,oe]])=>oe-1),ht())),ge=Sn(ce(Me(D),ze(({items:oe})=>oe.length>0&&oe[0].index===0),Kn(0),ht())),xe=Sn(ce(Me(D),Pe(Z),ze(([{items:oe},Se])=>oe.length>0&&!Se),be(([{items:oe}])=>({endIndex:oe[oe.length-1].index,startIndex:oe[0].index})),ht(Tg),va(0)));Ne(xe,S.scrollSeekRangeChanged),Ne(ce(P,Pe(E,B,V,z),be(([oe,Se,De,Ie,ae])=>{const pe=Lg(oe),{align:fe,behavior:he,offset:ve}=pe;let _e=pe.index;_e==="LAST"&&(_e=Ie-1),_e=js(0,_e,Wd(Ie-1,_e));let re=yu(Se,ae,De,_e);return fe==="end"?re=Ax(re-Se.height+De.height):fe==="center"&&(re=Ax(re-Se.height/2+De.height/2)),ve!==void 0&&ve!==0&&(re+=ve),{behavior:he,top:re}})),x);const we=Zt(ce(D,be(oe=>oe.offsetBottom+oe.bottom)),0);return Ne(ce(U,be(oe=>({height:oe.visibleHeight,width:oe.visibleWidth}))),E),{customScrollParent:T,data:Q,deviation:te,footerHeight:d,gap:z,headerHeight:p,increaseViewportBy:a,initialItemCount:w,itemDimensions:B,overscan:i,restoreStateFrom:I,scrollBy:f,scrollContainerState:h,scrollHeight:F,scrollTo:x,scrollToIndex:P,scrollTop:m,smoothScrollTargetReached:y,totalCount:V,useWindowScroll:C,viewportDimensions:E,windowScrollContainerState:M,windowScrollTo:O,windowViewportRect:U,...S,gridState:D,horizontalDirection:W,initialTopMostItemIndex:q,totalListHeight:we,...j,endReached:ue,propsReady:A,rangeChanged:xe,startReached:ge,stateChanged:R,stateRestoreInProgress:Z,...L}},xt(Ou,ln,zs,Hg,Xa,Bu,Ka));function Xg(a,r,i){return js(1,co((a+i)/(co(r)+i)))}function zx(a,r,i,o){const{height:d}=i;if(d===void 0||o.length===0)return{bottom:0,top:0};const p=yu(a,r,i,o[0].index);return{bottom:yu(a,r,i,o[o.length-1].index)+d,top:p}}function yu(a,r,i,o){const d=Xg(a.width,i.width,r.column),p=co(o/d),f=p*i.height+js(0,p-1)*r.row;return f>0?f+r.row:f}const Wj=et(()=>{const a=me(v=>`Item ${v}`),r=me({}),i=me(null),o=me("virtuoso-grid-item"),d=me("virtuoso-grid-list"),p=me(Hu),f=me("div"),h=me(vr),x=(v,j=null)=>Zt(ce(r,be(S=>S[v]),ht()),j),m=me(!1),y=me(!1);return Ne(Me(y),m),{components:r,computeItemKey:p,context:i,FooterComponent:x("Footer"),HeaderComponent:x("Header"),headerFooterTag:f,itemClassName:o,ItemComponent:x("Item","div"),itemContent:a,listClassName:d,ListComponent:x("List","div"),readyStateChanged:m,reportReadyState:y,ScrollerComponent:x("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:x("ScrollSeekPlaceholder","div")}}),Kj=et(([a,r])=>({...a,...r}),xt(Yj,Wj)),Xj=Ce.memo(function(){const a=yt("gridState"),r=yt("listClassName"),i=yt("itemClassName"),o=yt("itemContent"),d=yt("computeItemKey"),p=yt("isSeeking"),f=Bn("scrollHeight"),h=yt("ItemComponent"),x=yt("ListComponent"),m=yt("ScrollSeekPlaceholder"),y=yt("context"),v=Bn("itemDimensions"),j=Bn("gap"),S=yt("log"),k=yt("stateRestoreInProgress"),A=Bn("reportReadyState"),T=jl(Ce.useMemo(()=>C=>{const M=C.parentElement.parentElement.scrollHeight;f(M);const O=C.firstChild;if(O!==null){const{height:U,width:L}=O.getBoundingClientRect();v({height:U,width:L})}j({column:Lx("column-gap",getComputedStyle(C).columnGap,S),row:Lx("row-gap",getComputedStyle(C).rowGap,S)})},[f,v,j,S]),!0,!1);return Fg(()=>{a.itemHeight>0&&a.itemWidth>0&&A(!0)},[a]),k?null:n.jsx(x,{className:r,ref:T,...Qt(x,y),"data-testid":"virtuoso-item-list",style:{paddingBottom:a.offsetBottom,paddingTop:a.offsetTop},children:a.items.map(C=>{const M=d(C.index,C.data,y);return p?n.jsx(m,{...Qt(m,y),height:a.itemHeight,index:C.index,width:a.itemWidth},M):g.createElement(h,{...Qt(h,y),className:i,"data-index":C.index,key:M},o(C.index,C.data,y))})})}),Qj=Ce.memo(function(){const a=yt("HeaderComponent"),r=Bn("headerHeight"),i=yt("headerFooterTag"),o=jl(Ce.useMemo(()=>p=>{r(Ya(p,"height"))},[r]),!0,!1),d=yt("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,d)})}):null}),Zj=Ce.memo(function(){const a=yt("FooterComponent"),r=Bn("footerHeight"),i=yt("headerFooterTag"),o=jl(Ce.useMemo(()=>p=>{r(Ya(p,"height"))},[r]),!0,!1),d=yt("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,d)})}):null}),Jj=({children:a})=>{const r=Ce.useContext(Gg),i=Bn("itemDimensions"),o=Bn("viewportDimensions"),d=jl(Ce.useMemo(()=>p=>{o(p.getBoundingClientRect())},[o]),!0,!1);return Ce.useEffect(()=>{r&&(o({height:r.viewportHeight,width:r.viewportWidth}),i({height:r.itemHeight,width:r.itemWidth}))},[r,o,i]),n.jsx("div",{ref:d,style:yo(!1),children:a})},e2=({children:a})=>{const r=Ce.useContext(Gg),i=Bn("windowViewportRect"),o=Bn("itemDimensions"),d=yt("customScrollParent"),p=Sg(i,d,!1);return Ce.useEffect(()=>{r&&(o({height:r.itemHeight,width:r.itemWidth}),i({listHeight:0,offsetTop:0,visibleHeight:r.viewportHeight,visibleWidth:r.viewportWidth}))},[r,i,o]),n.jsx("div",{ref:p,style:yo(!1),children:a})},t2=Ce.memo(function({...a}){const r=yt("useWindowScroll"),i=yt("customScrollParent"),o=i||r?a2:n2,d=i||r?e2:Jj,p=yt("context");return n.jsx(o,{...a,...Qt(o,p),children:n.jsxs(d,{children:[n.jsx(Qj,{}),n.jsx(Xj,{}),n.jsx(Zj,{})]})})}),{useEmitter:Qg,useEmitterValue:yt,usePublisher:Bn}=$g(Kj,{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"}},t2),n2=Wg({useEmitter:Qg,useEmitterValue:yt,usePublisher:Bn}),a2=Kg({useEmitter:Qg,useEmitterValue:yt,usePublisher:Bn});function Lx(a,r,i){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&i(`${a} was not resolved to pixel value correctly`,r,It.WARN),r==="normal"?0:parseInt(r??"0",10)}const l2={source:"vskill-sidebar-own-collapsed",installed:"vskill-sidebar-installed-collapsed"},Zg={source:"Own",installed:"Installed"};function r2(a){try{const r=localStorage.getItem(a);if(r!=null)return r==="true"}catch{}try{if(typeof sessionStorage<"u"){const r=sessionStorage.getItem(a);if(r!=null)return r==="true"}}catch{}return!1}function s2(a,r){const i=r?"true":"false";try{localStorage.setItem(a,i)}catch{}try{typeof sessionStorage<"u"&&sessionStorage.setItem(a,i)}catch{}}function Dx({origin:a,count:r,filteredCount:i,updateCount:o,children:d}){const p=l2[a],[f,h]=g.useState(()=>r2(p)),x=g.useCallback(()=>{h(j=>{const S=!j;return s2(p,S),S})},[p]),m=Zg[a],y=`sidebar-section-${a}-header`,v=`sidebar-section-${a}-group`;return n.jsxs("section",{"aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:[n.jsxs("button",{id:y,type:"button","data-testid":"sidebar-section-header","aria-expanded":!f,"aria-controls":v,onClick:x,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 12px 6px 14px",background:"transparent",border:"none",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",textAlign:"left"},children:[n.jsx(o2,{collapsed:f}),n.jsx("h2",{"aria-level":2,style:{fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)",margin:0},children:m}),n.jsx("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:i!=null&&i!==r?`(${i} of ${r})`:`(${r})`}),o!=null&&o>0&&n.jsx(i2,{origin:a,updateCount:o})]}),!f&&n.jsx("div",{id:v,role:"group","aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:d})]})}function i2({origin:a,updateCount:r}){const[i,o]=g.useState(!1),d=Zg[a].toLowerCase(),p=`${r} updates available in ${d} section, view all`;return n.jsxs("span",{role:"link",tabIndex:0,"data-testid":"sidebar-section-update-chip","aria-label":p,onClick:f=>{f.stopPropagation(),window.location.hash="#/updates"},onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),f.stopPropagation(),window.location.hash="#/updates")},onFocus:()=>o(!0),onBlur:()=>o(!1),style:{display:"inline-flex",alignItems:"center",gap:2,fontSize:10,color:"var(--color-own)",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",cursor:"pointer",padding:"0 4px",borderRadius:3,outline:i?"2px solid var(--border-focus)":"none",outlineOffset:2},children:[r," updates",n.jsx("span",{"aria-hidden":"true",style:{fontSize:9,marginLeft:2},children:"▾"})]})}function o2({collapsed:a}){return n.jsx("svg",{"aria-hidden":"true",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:a?"rotate(0deg)":"rotate(90deg)",transition:"transform var(--duration-fast, 120ms) var(--ease-standard, ease)",flexShrink:0},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Vu(a,r){const i=r.trim().toLowerCase();return i?a.skill.toLowerCase().includes(i)||a.plugin.toLowerCase().includes(i)||a.dir.toLowerCase().includes(i):!0}function c2({value:a,onChange:r,placeholder:i="Filter skills…",validationPattern:o,validationMessage:d="Invalid filter expression"}){const p=g.useRef(null),f=g.useId(),h=!!o&&a.trim()!==""&&!o.test(a);return g.useEffect(()=>{function x(m){var j;if(m.key!=="/")return;const y=m.target;if(!y)return;const v=y.tagName;v==="INPUT"||v==="TEXTAREA"||y.isContentEditable||(m.preventDefault(),(j=p.current)==null||j.focus())}return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[]),n.jsxs("div",{role:"search",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",borderBottom:"1px solid var(--border-default)"},children:[n.jsxs("svg",{"aria-hidden":"true",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[n.jsx("circle",{cx:"11",cy:"11",r:"8"}),n.jsx("path",{d:"M21 21l-4.35-4.35"})]}),n.jsx("input",{ref:p,type:"search","aria-label":"Filter skills","aria-invalid":h?!0:void 0,"aria-describedby":h?f:void 0,value:a,placeholder:i,onChange:x=>r(x.currentTarget.value),onKeyDown:x=>{x.key==="Escape"&&(r(""),x.currentTarget.blur())},style:{flex:1,minWidth:0,border:"none",outline:"none",background:"transparent",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:12,padding:"2px 0"}}),h&&n.jsx("span",{id:f,role:"alert","aria-live":"polite",style:{fontFamily:"var(--font-sans)",fontSize:10,color:"var(--text-error, #B42318)",marginLeft:4,whiteSpace:"nowrap"},children:d}),n.jsx("kbd",{"aria-hidden":"true",style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",border:"1px solid var(--border-default)",padding:"1px 5px",borderRadius:3,display:a?"none":"inline-block"},children:"/"})]})}function d2({target:a}){const r=typeof a=="string"&&a.length>0,i=r?`symlinked → ${a}`:"symlinked — cycle detected or target unresolved",o=r?`symlinked from ${a}`:"symlinked, target unresolved";return n.jsx("span",{"data-testid":"symlink-chip",role:"img","aria-label":o,title:i,tabIndex:0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:14,height:14,borderRadius:3,color:"var(--text-secondary)",flexShrink:0},children:n.jsxs("svg",{"data-testid":"symlink-glyph",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),n.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})})}function u2({skill:a}){if(!a.updateAvailable)return null;const r=a.currentVersion??"",i=a.latestVersion,o=i?`Update available: ${r} → ${i}`.trim():"Update available";return n.jsx("span",{"data-testid":"skill-row-update-glyph",title:o,"aria-label":"Update available",style:{color:"var(--color-own)",display:"inline-flex",flexShrink:0},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 19V5"}),n.jsx("path",{d:"M5 12l7-7 7 7"})]})})}function f2({skill:a,isSelected:r,onSelect:i,onContextMenu:o}){const d=a.origin==="installed"?"var(--status-installed)":"var(--status-own)";return n.jsxs("button",{type:"button",onClick:i,onContextMenu:o?p=>{p.preventDefault(),o(p,a)}:void 0,"aria-current":r?"true":void 0,"aria-selected":!!r,"data-testid":"skill-row","data-selected":r,"data-origin":a.origin,style:{display:"flex",alignItems:"center",gap:8,width:"100%",height:36,padding:"0 12px 0 14px",background:r?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",boxShadow:r?"inset 2px 0 0 var(--color-accent, var(--accent-surface))":"none",border:"none",borderRadius:0,color:"var(--text-primary)",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:13,textAlign:"left",transition:"background-color var(--duration-fast, 120ms) var(--ease-standard, ease), box-shadow var(--duration-base, 180ms) var(--ease-standard, ease)"},children:[n.jsx("span",{"aria-hidden":"true","aria-label":a.updateAvailable?"Update available":void 0,title:a.updateAvailable?`Update available${a.latestVersion?` → ${a.latestVersion}`:""}`:void 0,style:{width:a.updateAvailable?10:6,height:a.updateAvailable?10:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0,boxShadow:a.updateAvailable?"0 0 0 2px var(--color-own, #d97706)":"none",transition:"box-shadow 180ms ease, width 180ms ease, height 180ms ease"}}),n.jsx("span",{title:a.skill,style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.skill}),a.version&&n.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",flexShrink:0},children:a.version}),a.isSymlink&&n.jsx(d2,{target:a.symlinkTarget??null}),n.jsx(u2,{skill:a})]})}const uo=g.memo(f2);function p2({plugin:a,skills:r,selectedKey:i,onSelect:o,onContextMenu:d}){const p=[...r].sort((f,h)=>f.skill.localeCompare(h.skill));return n.jsxs("div",{role:"group","aria-label":`${a} (${r.length})`,children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:a,children:a}),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",r.length,")"]})]}),n.jsx("div",{role:"list",children:p.map(f=>{const h=!!i&&i.plugin===f.plugin&&i.skill===f.skill;return n.jsx("div",{role:"listitem",children:n.jsx(uo,{skill:f,isSelected:h,onSelect:()=>o(f),onContextMenu:d})},`${f.plugin}/${f.skill}`)})})]})}function m2(a,r){if(!a||typeof window>"u")return r;try{const i=window.localStorage.getItem(a);return i===null?r:i==="true"}catch{return r}}function _x({skills:a,pluginName:r,initialCollapsed:i=!1,persistKey:o,renderSkill:d,headerActionSlot:p}){var v;const f=r??((v=a[0])==null?void 0:v.pluginName)??"unknown-plugin",[h,x]=g.useState(()=>m2(o,i)),m=g.useCallback(()=>{x(j=>{const S=!j;if(o&&typeof window<"u")try{window.localStorage.setItem(o,String(S))}catch{}return S})},[o]),y=h?"▸":"▾";return n.jsxs("div",{"data-vskill-plugin-tree":f,role:"group","aria-label":`${f} (${a.length})`,children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",paddingRight:6},children:[n.jsxs("button",{type:"button",onClick:m,"aria-expanded":!h,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:[n.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:y}),n.jsx("span",{className:"vskill-plugin-name",style:{fontFamily:"var(--font-mono)"},children:f}),n.jsxs("span",{className:"vskill-plugin-count tabular-nums",style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:["(",a.length,")"]})]}),p&&n.jsx("div",{style:{display:"inline-flex",alignItems:"center",flexShrink:0},children:p})]}),!h&&n.jsx("div",{className:"vskill-plugin-tree-children",style:{paddingLeft:36,borderLeft:"1px solid var(--border-subtle, rgba(128,128,128,0.2))",marginLeft:24},children:a.map(j=>n.jsx("div",{"data-vskill-plugin-skill":j.pluginNamespace??j.skill,children:d(j)},`${j.pluginNamespace??j.skill}`))})]})}function h2({pluginName:a,enabled:r,onAfterAction:i}){const[o,d]=g.useState(!1),[p,f]=g.useState(null),[h,x]=g.useState(null),m=g.useRef(null);g.useEffect(()=>{if(!o)return;function v(j){m.current&&!m.current.contains(j.target)&&d(!1)}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]);async function y(v){f(v),x(null);try{if(v==="uninstall"&&!window.confirm(`Uninstall ${a}? This removes the plugin and its skills.`)){f(null);return}const j=await fetch(`/api/plugins/${encodeURIComponent(a)}/${v}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),S=await j.json().catch(()=>({}));if(!j.ok||!S.ok){x(S.error??`${v} failed (${j.status})`);return}an("skills"),an("plugins"),i==null||i(),d(!1)}catch(j){x(j instanceof Error?j.message:String(j))}finally{f(null)}}return n.jsxs("div",{ref:m,style:{position:"relative",display:"inline-flex"},children:[n.jsx("button",{type:"button","aria-label":`Manage ${a}`,title:`Manage ${a}`,onClick:v=>{v.stopPropagation(),d(j=>!j)},"data-vskill-plugin-action-trigger":a,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&&n.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?n.jsx(Kd,{onClick:()=>void y("disable"),disabled:p!==null,busy:p==="disable",label:"Disable",hint:"Keep installed, turn off"}):n.jsx(Kd,{onClick:()=>void y("enable"),disabled:p!==null,busy:p==="enable",label:"Enable",hint:"Activate plugin"}),n.jsx(Kd,{onClick:()=>void y("uninstall"),disabled:p!==null,busy:p==="uninstall",label:"Uninstall",hint:"Remove plugin + skills",danger:!0}),h&&n.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 Kd({onClick:a,disabled:r,busy:i,label:o,hint:d,danger:p}){return n.jsxs("button",{type:"button",onClick:f=>{f.stopPropagation(),a()},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:p?"var(--color-error, #b91c1c)":"var(--text-primary)",opacity:r&&!i?.5:1,fontFamily:"inherit"},onMouseEnter:f=>{r||(f.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.05))")},onMouseLeave:f=>{f.currentTarget.style.background="transparent"},children:[n.jsx("div",{style:{fontSize:12,fontWeight:500},children:i?`${o}…`:o}),n.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)"},children:d})]})}function Ox({name:a,count:r,className:i,variant:o,collapsed:d,onToggle:p,action:f}){const h=o==="authoring"?"var(--color-own, #f59e0b)":"var(--color-accent, #2f6f8f)",x=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 p=="function",y={position:"sticky",top:0,zIndex:4,backdropFilter:"saturate(1.4) blur(10px)",WebkitBackdropFilter:"saturate(1.4) blur(10px)",background:x,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=d?"▸":"▾",j=n.jsxs(n.Fragment,{children:[m&&n.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}),n.jsx("span",{className:"vskill-group-header-name",children:a}),n.jsxs("span",{className:"vskill-group-header-count tabular-nums",style:{fontFamily:"var(--font-mono)",fontSize:11,fontWeight:500,color:"var(--text-secondary)",letterSpacing:0,textTransform:"none"},children:["(",r,")"]}),f&&n.jsx("span",{style:{marginLeft:"auto"},children:n.jsx(x2,{label:f.label,title:f.title,icon:f.icon,onClick:f.onClick,accent:h})})]});return m?n.jsx("button",{type:"button","data-vskill-group-header":a,className:["vskill-group-header select-none",i??""].join(" ").trim(),style:y,onClick:()=>p(!d),"aria-expanded":!d,children:j}):n.jsx("div",{"data-vskill-group-header":a,role:"heading","aria-level":3,className:["vskill-group-header select-none",i??""].join(" ").trim(),style:y,children:j})}function x2({label:a,title:r,icon:i,onClick:o,accent:d}){return n.jsxs("button",{type:"button","aria-label":a,title:r??a,onClick:p=>{p.stopPropagation(),o()},style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4,height:22,padding:"0 7px",border:`1px solid ${d}`,background:"transparent",color:d,borderRadius:4,fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",cursor:"pointer",fontFamily:"inherit"},onMouseEnter:p=>{p.currentTarget.style.background=`color-mix(in oklch, ${d} 15%, transparent)`},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:[i,a]})}function g2(){return n.jsxs("div",{"aria-hidden":"true",role:"presentation",style:{display:"flex",alignItems:"center",gap:8,height:36,padding:"0 12px 0 14px"},children:[n.jsx("span",{className:"placeholder",style:{width:6,height:6,borderRadius:"50%",flexShrink:0}}),n.jsx("span",{className:"placeholder",style:{height:10,flex:1,borderRadius:3,maxWidth:180}})]})}function v2(a){const r=a.key.split("+").map(h=>h.trim()).filter(Boolean);let i=!!a.meta,o=!!a.ctrl,d=!!a.shift,p=!!a.alt,f=a.key;if(r.length>1){for(const h of r.slice(0,-1)){const x=h.toLowerCase();x==="cmd"||x==="meta"||x==="⌘"?i=!0:x==="ctrl"||x==="control"?o=!0:x==="shift"?d=!0:(x==="alt"||x==="option")&&(p=!0)}f=r[r.length-1]}return{key:f.length===1?f.toLowerCase():f,meta:i,ctrl:o,shift:d,alt:p,allowInInputs:!!a.allowInInputs,handler:a.handler}}function y2(a){if(!a||!(a instanceof HTMLElement))return!1;const r=a.tagName;if(r==="INPUT"||r==="TEXTAREA"||a.isContentEditable)return!0;const i=a.getAttribute("contenteditable");return i!=null&&i!=="false"||a.getAttribute("role")==="textbox"}function b2(a,r){const i=!!a.metaKey,o=!!a.ctrlKey,d=!!a.shiftKey,p=!!a.altKey;return i!==r.meta||o!==r.ctrl||d!==r.shift||p!==r.alt?!1:(a.key.length===1?a.key.toLowerCase():a.key)===r.key}function bu(a,r={}){const{enabled:i=!0,target:o}=r,d=g.useRef([]),p=Array.isArray(a)?a:[a];d.current=p.map(v2),g.useEffect(()=>{if(!i)return;const f=o??(typeof window<"u"?window:void 0);if(!f)return;function h(x){const m=x,y=y2(m.target);for(const v of d.current){if(!b2(m,v))continue;const j=v.meta||v.ctrl||v.alt;if(!(y&&!v.allowInInputs&&!j)){v.handler(m);return}}}return f.addEventListener("keydown",h),()=>{f.removeEventListener("keydown",h)}},[i,o])}const j2=200;function S2(a){return a.scope==="own"||a.scope==="installed"||a.scope==="global"?a.scope:a.origin==="installed"?"installed":"own"}function k2(a,r){const i={availableProject:[],availablePersonal:[],availablePlugin:[],authoringProject:[],authoringPlugin:[]};for(const d of a){const p=d.scopeV2??(d.scope==="installed"?"available-project":d.scope==="global"?"available-personal":"authoring-project");p==="available-project"?i.availableProject.push(d):p==="available-personal"?i.availablePersonal.push(d):p==="available-plugin"?i.availablePlugin.push(d):p==="authoring-plugin"?i.authoringPlugin.push(d):i.authoringProject.push(d)}function o(d){const p=d.filter(x=>Vu(x,r)),f={};for(const x of p){const m=x.pluginName??x.plugin;(f[m]||(f[m]=[])).push(x)}const h=Object.entries(f).sort((x,m)=>x[0].localeCompare(m[0]));return{total:d.length,filtered:p.length,byPlugin:h}}return{availableProject:o(i.availableProject),availablePersonal:o(i.availablePersonal),availablePlugin:o(i.availablePlugin),authoringProject:o(i.authoringProject),authoringPlugin:o(i.authoringPlugin)}}function w2(a,r){const i=[],o=[],d=[];for(const f of a){const h=S2(f);h==="global"?d.push(f):h==="installed"?o.push(f):i.push(f)}function p(f){var y;const h=f.filter(v=>Vu(v,r)),x={};for(const v of h)(x[y=v.plugin]||(x[y]=[])).push(v);const m=Object.entries(x).sort((v,j)=>v[0].localeCompare(j[0]));return{total:f.length,filtered:h.length,byPlugin:m}}return{own:p(i),installed:p(o),global:p(d)}}function C2(a,r){const i=[],o=[];for(const p of a)(p.origin==="installed"?o:i).push(p);function d(p){var m;const f=p.filter(y=>Vu(y,r)),h={};for(const y of f)(h[m=y.plugin]||(h[m]=[])).push(y);const x=Object.entries(h).sort((y,v)=>y[0].localeCompare(v[0]));return{total:p.length,filtered:f.length,byPlugin:x}}return{own:d(i),installed:d(o)}}function N2({skills:a,selectedKey:r,onSelect:i,isLoading:o,error:d,onRetry:p,onContextMenu:f,outdatedByOrigin:h,activeAgentId:x,outdatedByScope:m,topSlot:y}){const v=!!x||a.some(Z=>Z.scope!==void 0&&Z.scope!==null),j=x??"claude-cli",[S,k]=g.useState(""),A=g.useDeferredValue(S),T=g.useMemo(()=>w2(a,A),[a,A]),C=g.useMemo(()=>k2(a,A),[a,A]),M=j==="claude-code",{data:O}=xr("plugins",()=>fetch("/api/plugins").then(Z=>Z.json()),{enabled:M,ttl:6e4}),U=g.useMemo(()=>{const Z=new Map;for(const q of(O==null?void 0:O.plugins)??[]){const de=Z.get(q.name);Z.set(q.name,!!de||!!q.enabled)}return Z},[O==null?void 0:O.plugins]),[L,V]=g.useState(()=>ju(`vskill-sidebar-${j}-group-available-collapsed`)),[w,D]=g.useState(()=>ju(`vskill-sidebar-${j}-group-authoring-collapsed`)),E=g.useCallback(Z=>{V(Z);try{window.localStorage.setItem(`vskill-sidebar-${j}-group-available-collapsed`,String(Z))}catch{}},[j]),B=g.useCallback(Z=>{D(Z);try{window.localStorage.setItem(`vskill-sidebar-${j}-group-authoring-collapsed`,String(Z))}catch{}},[j]),{own:P,installed:F}=g.useMemo(()=>C2(a,A),[a,A]),Q=T.own.filtered+T.installed.filtered+T.global.filtered>=j2,z=g.useMemo(()=>{const Z=q=>{const de=[];for(const[,_]of q){const W=[..._].sort((ie,ue)=>ie.skill.localeCompare(ue.skill));de.push(...W)}return de};return v?[...Z(T.own.byPlugin),...Z(T.installed.byPlugin),...Z(T.global.byPlugin)]:[...Z(P.byPlugin),...Z(F.byPlugin)]},[v,T.own.byPlugin,T.installed.byPlugin,T.global.byPlugin,P.byPlugin,F.byPlugin]),R=g.useMemo(()=>r?z.findIndex(Z=>Z.plugin===r.plugin&&Z.skill===r.skill):-1,[z,r]),I=g.useCallback(Z=>{if(z.length===0)return;const q=R<0?Z>0?0:z.length-1:Math.min(Math.max(R+Z,0),z.length-1);i(z[q])},[z,R,i]);return bu([{key:"j",handler:()=>I(1)},{key:"k",handler:()=>I(-1)},{key:"Enter",handler:()=>{R>=0&&i(z[R])}}],{enabled:!o&&!d}),n.jsxs("div",{"data-testid":"sidebar",style:{display:"flex",flexDirection:"column",minHeight:0,height:"100%",fontFamily:"var(--font-sans)"},children:[y,n.jsx(c2,{value:S,onChange:k}),o&&n.jsx(M2,{}),!o&&d&&n.jsx(z2,{error:d,onRetry:p}),!o&&!d&&v&&n.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[n.jsx(Ox,{name:J.scopeLabels.groupAvailable.toUpperCase(),variant:"available",collapsed:L,onToggle:E,count:C.availableProject.total+C.availablePersonal.total+C.availablePlugin.total}),!L&&n.jsxs(n.Fragment,{children:[n.jsx(ms,{label:J.scopeLabels.sourceProject,storageKey:`vskill-sidebar-${j}-available-project-collapsed`,count:C.availableProject.total,filteredCount:S?C.availableProject.filtered:null,updateCount:(m==null?void 0:m.installed)??(h==null?void 0:h.installed),children:C.availableProject.filtered===0?n.jsx(Ix,{queryActive:!!S,agentId:j}):n.jsx(hs,{items:C.availableProject.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Q})}),n.jsx(ms,{label:J.scopeLabels.sourcePersonal,storageKey:`vskill-sidebar-${j}-available-personal-collapsed`,count:C.availablePersonal.total,filteredCount:S?C.availablePersonal.filtered:null,updateCount:m==null?void 0:m.global,children:C.availablePersonal.filtered===0?n.jsx(T2,{queryActive:!!S,agentId:j}):n.jsx(hs,{items:C.availablePersonal.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Q})}),M&&n.jsxs(ms,{label:J.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${j}-available-plugin-collapsed`,count:C.availablePlugin.total,filteredCount:S?C.availablePlugin.filtered:null,children:[n.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:[n.jsx("span",{"aria-hidden":!0,children:"🛒"})," Browse marketplaces…"]}),C.availablePlugin.filtered===0?n.jsx("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:"No plugin skills installed yet."}):C.availablePlugin.byPlugin.map(([Z,q])=>n.jsx(_x,{pluginName:Z,skills:q,persistKey:`vskill-plugin-available-${Z}-collapsed`,headerActionSlot:M?n.jsx(h2,{pluginName:Z,enabled:U.get(Z)??!0}):void 0,renderSkill:de=>n.jsx(uo,{skill:de,isSelected:(r==null?void 0:r.plugin)===de.plugin&&(r==null?void 0:r.skill)===de.skill,onSelect:()=>i(de),onContextMenu:f})},`available-${Z}`))]})]}),n.jsx(A2,{}),n.jsx(Ox,{name:J.scopeLabels.groupAuthoring.toUpperCase(),variant:"authoring",collapsed:w,onToggle:B,count:C.authoringProject.total+C.authoringPlugin.total,action:{label:"New",title:"Create a new skill (standalone or plugin)",icon:n.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:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.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"}}))}}}),!w&&n.jsxs(n.Fragment,{children:[n.jsx(ms,{label:J.scopeLabels.authoringSkills,storageKey:`vskill-sidebar-${j}-authoring-project-collapsed`,count:C.authoringProject.total,filteredCount:S?C.authoringProject.filtered:null,updateCount:(m==null?void 0:m.own)??(h==null?void 0:h.source),children:C.authoringProject.filtered===0?n.jsx(Bx,{queryActive:!!S}):n.jsx(hs,{items:C.authoringProject.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Q})}),M&&n.jsx(ms,{label:J.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${j}-authoring-plugin-collapsed`,count:C.authoringPlugin.total,filteredCount:S?C.authoringPlugin.filtered:null,children:C.authoringPlugin.filtered===0?n.jsxs("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:["No plugin sources in this project. Add ",n.jsx("code",{children:"<plugin>/.claude-plugin/plugin.json"}),"."]}):C.authoringPlugin.byPlugin.map(([Z,q])=>n.jsx(_x,{pluginName:Z,skills:q,persistKey:`vskill-plugin-authoring-${Z}-collapsed`,renderSkill:de=>n.jsx(uo,{skill:de,isSelected:(r==null?void 0:r.plugin)===de.plugin&&(r==null?void 0:r.skill)===de.skill,onSelect:()=>i(de),onContextMenu:f})},`authoring-${Z}`))})]})]}),!o&&!d&&!v&&n.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[n.jsx(Dx,{origin:"source",count:P.total,filteredCount:S?P.filtered:null,updateCount:h==null?void 0:h.source,children:P.filtered===0?n.jsx(Bx,{queryActive:!!S}):n.jsx(hs,{items:P.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Q})}),n.jsx(R2,{}),n.jsx(Dx,{origin:"installed",count:F.total,filteredCount:S?F.filtered:null,updateCount:h==null?void 0:h.installed,children:F.filtered===0?n.jsx(Ix,{queryActive:!!S}):n.jsx(hs,{items:F.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Q})})]})]})}function ju(a){if(typeof window>"u")return!1;try{return window.localStorage.getItem(a)==="true"}catch{return!1}}function ms({label:a,storageKey:r,count:i,filteredCount:o,updateCount:d,children:p}){const[f,h]=g.useState(()=>ju(r)),x=g.useCallback(()=>{h(y=>{const v=!y;if(typeof window<"u")try{window.localStorage.setItem(r,String(v))}catch{}return v})},[r]),m=o!=null&&o!==i?`${o} of ${i}`:String(i);return n.jsxs("section",{"data-vskill-named-scope":a,children:[n.jsxs("button",{type:"button",onClick:x,"aria-expanded":!f,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 12px",background:"transparent",border:"none",cursor:"pointer",fontFamily:"var(--font-sans)",textAlign:"left"},children:[n.jsx("span",{"aria-hidden":!0,style:{fontSize:14,fontWeight:700,color:"var(--color-ink, var(--text-primary))",width:16,display:"inline-block",textAlign:"center"},children:f?"▸":"▾"}),n.jsx("span",{style:{fontSize:12,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)"},children:a}),n.jsxs("span",{style:{fontSize:11,color:"var(--text-tertiary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",m,")"]}),d!=null&&d>0&&n.jsxs("span",{style:{marginLeft:"auto",fontSize:10,color:"var(--color-own, #f59e0b)"},children:[d," update",d!==1?"s":""]})]}),!f&&n.jsx("div",{style:{paddingLeft:18},children:p})]})}function E2(a){const r=[];for(const[i,o]of a){const d=[...o].sort((p,f)=>p.skill.localeCompare(f.skill));r.push({kind:"header",plugin:i,count:d.length});for(const p of d)r.push({kind:"row",skill:p})}return r}function hs({items:a,selectedKey:r,onSelect:i,onContextMenu:o,useVirtual:d}){if(d){const p=E2(a);return n.jsx("div",{"data-virtualized":"true",style:{height:420,minHeight:200},children:n.jsx($j,{overscan:4,totalCount:p.length,itemContent:f=>{const h=p[f];if(!h)return null;if(h.kind==="header")return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)"},children:h.plugin}),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",h.count,")"]})]});const x=h.skill,m=!!r&&r.plugin===x.plugin&&r.skill===x.skill;return n.jsx(uo,{skill:x,isSelected:m,onSelect:()=>i(x),onContextMenu:o})}})})}return n.jsx("div",{"data-virtualized":"false",children:a.map(([p,f])=>n.jsx(p2,{plugin:p,skills:f,selectedKey:r,onSelect:i,onContextMenu:o},p))})}function Bx({queryActive:a}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:"No skills yet.",body:n.jsxs(n.Fragment,{children:["Create one with ",n.jsx($u,{children:"vskill new"})," or the"," ",n.jsx("strong",{style:{color:"var(--text-primary)"},children:"New skill"})," action in the top rail."]})})}function Ix({queryActive:a,agentId:r}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:r?`No skills installed for ${r} in this project.`:"No installed skills.",body:n.jsxs(n.Fragment,{children:["Run ",n.jsx($u,{children:"vskill install <plugin>"})," to add one."]})})}function T2({queryActive:a,agentId:r}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:`No global skills for ${r}.`,body:n.jsxs(n.Fragment,{children:["Run ",n.jsx($u,{children:"vskill install --global <plugin>"})," to add one."]})})}function pr({headline:a,body:r}){return n.jsxs("div",{style:{padding:"12px 14px 16px",fontSize:12,color:"var(--text-secondary)",lineHeight:1.5},children:[n.jsx("div",{style:{fontWeight:500,color:"var(--text-primary)",marginBottom:4},children:a}),n.jsx("div",{children:r})]})}function $u({children:a}){return n.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-primary)",background:"color-mix(in srgb, var(--border-default) 45%, transparent)",padding:"1px 4px",borderRadius:3},children:a})}function R2(){return n.jsx("div",{"aria-hidden":"true",style:{height:1,background:"var(--border-default)",margin:"4px 14px"}})}function A2(){return n.jsx("div",{"aria-hidden":"true","data-testid":"scope-bold-divider",style:{height:3,background:"var(--color-rule)",boxShadow:"inset 0 1px 0 color-mix(in srgb, var(--color-rule) 50%, transparent)",margin:"12px 0"}})}function M2(){return n.jsx("div",{style:{padding:"8px 0"},children:[0,1,2,3,4,5].map(a=>n.jsx(g2,{},a))})}function z2({error:a,onRetry:r}){return n.jsxs("div",{role:"alert",style:{margin:"12px 14px",padding:12,border:"1px solid var(--border-default)",borderRadius:6,background:"var(--bg-canvas)",color:"var(--text-primary)",fontSize:12},children:[n.jsx("div",{style:{fontWeight:600,marginBottom:4},children:"Couldn't load skills."}),n.jsxs("details",{children:[n.jsx("summary",{style:{cursor:"pointer",color:"var(--text-secondary)",fontSize:11,marginBottom:4},children:L2(a)}),n.jsx("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",margin:"6px 0 0"},children:a})]}),r&&n.jsx("button",{type:"button",onClick:r,style:{marginTop:8,background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"4px 10px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:"Retry"})]})}function L2(a){const r=a.split(`
|
|
55
55
|
`)[0]??a;return r.length>80?r.slice(0,77)+"…":r}const Jg=240,ev=480,tv="vskill-sidebar-width",Ss=320;function Pu(a){return Number.isFinite(a)?Math.round(Math.max(Jg,Math.min(ev,a))):Ss}function D2(){try{const a=localStorage.getItem(tv);if(!a)return Ss;const r=Number(a);return Number.isFinite(r)?Pu(r):Ss}catch{return Ss}}function _2(a){try{localStorage.setItem(tv,String(Pu(a)))}catch{}}function O2({initialWidth:a,onChange:r}){const i=g.useRef({startX:0,startWidth:a,pointerId:null}),o=g.useRef(a);return g.useEffect(()=>{o.current=a},[a]),g.useEffect(()=>{function d(f){if(i.current.pointerId==null||f.pointerId!==i.current.pointerId)return;const h=f.clientX-i.current.startX,x=Pu(i.current.startWidth+h);o.current=x,r(x)}function p(f){i.current.pointerId==null||f.pointerId!==i.current.pointerId||(i.current.pointerId=null,_2(o.current))}return window.addEventListener("pointermove",d),window.addEventListener("pointerup",p),window.addEventListener("pointercancel",p),()=>{window.removeEventListener("pointermove",d),window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",p)}},[r]),n.jsx("div",{role:"separator","aria-orientation":"vertical","aria-valuemin":Jg,"aria-valuemax":ev,"aria-valuenow":a,"aria-label":"Resize sidebar",title:"Drag to resize sidebar",onPointerDown:d=>{const p=d.currentTarget;i.current.startX=d.clientX,i.current.startWidth=o.current,i.current.pointerId=d.pointerId;try{p.setPointerCapture(d.pointerId)}catch{}},style:{width:4,alignSelf:"stretch",cursor:"col-resize",background:"var(--border-default)",userSelect:"none",touchAction:"none"}})}function B2({connected:a,hint:r,onRetry:i}){return a?null:n.jsxs("aside",{"aria-live":"assertive",role:"alert",style:{display:"flex",alignItems:"center",gap:10,padding:"6px 12px",background:"color-mix(in srgb, var(--status-own) 15%, transparent)",borderBottom:"1px solid var(--border-default)",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:12},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--status-own)",display:"inline-block",flexShrink:0}}),n.jsx("span",{style:{fontWeight:500},children:"Disconnected — reconnecting…"}),r&&n.jsx("span",{style:{color:"var(--text-secondary)",fontSize:11},children:r}),n.jsx("div",{style:{flex:1}}),i&&n.jsx("button",{type:"button",onClick:i,style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"2px 8px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:"Retry now"})]})}function nv(a){if(a!==void 0)try{return JSON.stringify(a)}catch(r){console.error("Failed to serialize request body:",r);try{const i=new WeakSet;return JSON.stringify(a,(o,d)=>{if(typeof d=="object"&&d!==null){if(i.has(d))return"[Circular]";i.add(d)}return d})}catch{return JSON.stringify({error:"Request body could not be serialized"})}}}function Xd(){const[a,r]=g.useState([]),[i,o]=g.useState(!1),[d,p]=g.useState(!1),[f,h]=g.useState(null),x=g.useRef(null),m=g.useCallback(async(v,j)=>{r([]),o(!0),p(!1),h(null);const S=new AbortController;x.current=S;try{const k=nv(j),A=await fetch(v,{method:"POST",headers:{"Content-Type":"application/json"},body:k,signal:S.signal});if(!A.ok||!A.body){let U=`HTTP ${A.status}`;try{const L=await A.json();L.error&&(U=L.error)}catch{}throw new Error(U)}const T=A.body.getReader(),C=new TextDecoder;let M="",O="";for(;;){const{done:U,value:L}=await T.read();if(U)break;M+=C.decode(L,{stream:!0});const V=M.split(`
|
|
56
56
|
`);M=V.pop()||"";for(const w of V)if(w.startsWith("event: "))O=w.slice(7).trim();else if(w.startsWith("data: ")){try{const D=JSON.parse(w.slice(6)),E={event:O,data:D};O==="done"?(p(!0),r(B=>[...B,E])):r(B=>[...B,E])}catch{}O=""}}}catch(k){k.name!=="AbortError"&&h(k.message)}finally{o(!1),x.current=null}},[]),y=g.useCallback(()=>{var v;(v=x.current)==null||v.abort()},[]);return{events:a,running:i,done:d,error:f,start:m,stop:y}}function I2(a){const r=g.useRef(a);r.current=a;const[i,o]=g.useState(new Set),d=g.useRef(new Map),p=g.useCallback(async(m,y,v)=>{var S;(S=d.current.get(m))==null||S.abort();const j=new AbortController;d.current.set(m,j),o(k=>{const A=new Set(k);return A.add(m),A});try{const k=nv(v),A=await fetch(y,{method:"POST",headers:{"Content-Type":"application/json"},body:k,signal:j.signal});if(!A.ok||!A.body){let U=`HTTP ${A.status}`;try{const L=await A.json();L.error&&(U=L.error)}catch{}throw new Error(U)}const T=A.body.getReader(),C=new TextDecoder;let M="",O="";for(;;){const{done:U,value:L}=await T.read();if(U)break;M+=C.decode(L,{stream:!0});const V=M.split(`
|
|
57
57
|
`);M=V.pop()||"";for(const w of V)if(w.startsWith("event: "))O=w.slice(7).trim();else if(w.startsWith("data: ")){try{const D=JSON.parse(w.slice(6)),E={event:O,data:D};r.current.onEvent(m,E)}catch{}O=""}}r.current.onDone(m)}catch(k){k.name!=="AbortError"&&r.current.onError(m,k.message)}finally{o(k=>{const A=new Set(k);return A.delete(m),A}),d.current.delete(m)}},[]),f=g.useCallback(m=>{var y;(y=d.current.get(m))==null||y.abort()},[]),h=g.useCallback(()=>{for(const m of d.current.values())m.abort()},[]),x=i.size>0;return{runningSet:i,startCase:p,stopCase:f,stopAll:h,isAnyCaseRunning:x}}const H2={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 U2(a,r){var i,o;switch(r.type){case"SET_LOADING":return{...a,loading:r.loading};case"SET_ERROR":return{...a,error:r.error};case"INIT_DATA":{const d=new Map;if(r.benchmark)for(const f of r.benchmark.cases)d.set(f.eval_id,{status:f.status,passRate:f.pass_rate,errorMessage:f.error_message||void 0,durationMs:f.durationMs,tokens:f.tokens,output:f.output,assertions:f.assertions.map(h=>({assertion_id:h.id,text:h.text,pass:h.pass,reasoning:h.reasoning}))});const p=((o=(i=r.evals)==null?void 0:i.evals[0])==null?void 0:o.id)??null;return{...a,skillContent:r.skillContent,savedContent:r.skillContent,isDirty:!1,evals:r.evals,evalsError:r.evalsError??null,latestBenchmark:r.benchmark,inlineResults:d,selectedCaseId:p,loading:!1,error:null}}case"SET_PANEL":return{...a,activePanel:r.panel};case"SET_CONTENT":return{...a,skillContent:r.content,isDirty:r.content!==a.savedContent};case"CONTENT_SAVED":return{...a,savedContent:a.skillContent,isDirty:!1};case"SET_EVALS":return{...a,evals:r.evals};case"SELECT_CASE":return{...a,selectedCaseId:r.caseId};case"CASE_RUN_START":{const d=new Map(a.caseRunStates);return d.set(r.caseId,{status:"running",startedAt:Date.now(),mode:r.mode}),{...a,caseRunStates:d,runMode:r.mode,activePanel:"run"}}case"CASE_RUN_COMPLETE":{const d=new Map(a.caseRunStates),p=d.get(r.caseId);d.set(r.caseId,{status:"complete",mode:p==null?void 0:p.mode});const f=new Map(a.inlineResults);return f.set(r.caseId,r.result),{...a,caseRunStates:d,inlineResults:f}}case"CASE_RUN_ERROR":{const d=new Map(a.caseRunStates),p=d.get(r.caseId);d.set(r.caseId,{status:"error",mode:p==null?void 0:p.mode});const f=new Map(a.inlineResults);return f.set(r.caseId,{status:"error",errorMessage:r.error,assertions:[]}),{...a,caseRunStates:d,inlineResults:f}}case"CASE_RUN_CANCEL":{const d=new Map(a.caseRunStates),p=d.get(r.caseId);return d.set(r.caseId,{status:"cancelled",mode:p==null?void 0:p.mode}),{...a,caseRunStates:d}}case"BULK_RUN_START":{const d=new Map(a.caseRunStates);for(const p of r.caseIds)d.set(p,{status:"queued",mode:r.mode});return{...a,caseRunStates:d,bulkRunActive:!0,runMode:r.mode,activePanel:"run"}}case"BULK_RUN_COMPLETE":return{...a,bulkRunActive:!1,latestBenchmark:r.benchmark??a.latestBenchmark,iterationCount:a.iterationCount+1};case"CANCEL_ALL":{const d=new Map(a.caseRunStates);for(const[p,f]of d)(f.status==="running"||f.status==="queued")&&d.set(p,{status:"cancelled"});return{...a,caseRunStates:d,bulkRunActive:!1}}case"UPDATE_INLINE_RESULT":{const d=new Map(a.inlineResults);return d.set(r.evalId,r.result),{...a,inlineResults:d}}case"OPEN_IMPROVE":return{...a,improveTarget:r.evalId,activePanel:"editor"};case"CLOSE_IMPROVE":return{...a,improveTarget:null};case"OPEN_AI_EDIT":return{...a,aiEditOpen:!0,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"CLOSE_AI_EDIT":return{...a,aiEditOpen:!1,aiEditLoading:!1,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"AI_EDIT_LOADING":return{...a,aiEditLoading:!0,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[]};case"AI_EDIT_PROGRESS":return{...a,aiEditProgress:[...a.aiEditProgress,r.entry]};case"AI_EDIT_RESULT":{const d=r.evalChanges??[],p=new Map;for(let f=0;f<d.length;f++)p.set(f,!0);return{...a,aiEditLoading:!1,aiEditResult:{improved:r.improved,reasoning:r.reasoning,evalChanges:d},aiEditEvalChanges:d,aiEditEvalSelections:p}}case"AI_EDIT_ERROR":return{...a,aiEditLoading:!1,aiEditError:r.message,aiEditClassifiedError:r.classified??null};case"GENERATE_EVALS_START":return{...a,generateEvalsLoading:!0,generateEvalsProgress:[],generateEvalsError:null};case"GENERATE_EVALS_PROGRESS":return{...a,generateEvalsProgress:[...a.generateEvalsProgress,r.entry]};case"GENERATE_EVALS_DONE":return{...a,generateEvalsLoading:!1,evals:r.evals};case"GENERATE_EVALS_ERROR":return{...a,generateEvalsLoading:!1,generateEvalsError:r.classified};case"TOGGLE_EVAL_CHANGE":{const d=new Map(a.aiEditEvalSelections);return d.set(r.index,!d.get(r.index)),{...a,aiEditEvalSelections:d}}case"SELECT_ALL_EVAL_CHANGES":{const d=new Map(a.aiEditEvalSelections);for(const p of d.keys())d.set(p,!0);return{...a,aiEditEvalSelections:d}}case"DESELECT_ALL_EVAL_CHANGES":{const d=new Map(a.aiEditEvalSelections);for(const p of d.keys())d.set(p,!1);return{...a,aiEditEvalSelections:d}}case"SET_EVALS_RETRY":return{...a,aiEditEvalsRetry:r.evalsFile};case"SET_REGRESSIONS":return{...a,regressions:r.regressions};case"INCREMENT_ITERATION":return{...a,iterationCount:a.iterationCount+1};case"SET_ACTIVATION_PROMPTS":return{...a,activationPrompts:r.prompts};case"ACTIVATION_START":return{...a,activationRunning:!0,activationResults:[],activationSummary:null,activationError:null,activationClassifyingStatus:null,activationStartedAt:Date.now()};case"ACTIVATION_RESULT":return{...a,activationResults:[...a.activationResults,r.result]};case"ACTIVATION_DONE":return{...a,activationRunning:!1,activationSummary:r.summary,activationClassifyingStatus:null};case"ACTIVATION_CLASSIFYING":return{...a,activationClassifyingStatus:`Classifying prompt ${r.index}/${r.total}...`};case"ACTIVATION_ERROR":return{...a,activationRunning:!1,activationError:r.error,activationClassifyingStatus:null};case"ACTIVATION_RESET":return{...a,activationResults:[],activationSummary:null,activationError:null};case"ACTIVATION_TIMEOUT":return{...a,activationRunning:!1,activationError:"Activation test timed out after 120 seconds"};case"ACTIVATION_CANCEL":return{...a,activationRunning:!1};case"GENERATE_PROMPTS_START":return{...a,generatingPrompts:!0,generatingPromptsError:null};case"GENERATE_PROMPTS_DONE":return{...a,generatingPrompts:!1};case"GENERATE_PROMPTS_ERROR":return{...a,generatingPrompts:!1,generatingPromptsError:r.error};case"ACTIVATION_HISTORY_LOADED":return{...a,activationHistory:r.runs,activationHistoryLoading:!1};default:return a}}function V2(a){if(a==="unit"||a==="integration")return a}function $2(a,r){const i=r.data;if(r.event==="output_ready"&&(a.output=i.output,i.durationMs!=null&&(a.durationMs=i.durationMs),i.tokens!=null&&(a.tokens=i.tokens)),r.event==="outputs_ready"&&(a.output=i.skillOutput,i.skillDurationMs!=null&&(a.durationMs=i.skillDurationMs),i.skillTokens!=null&&(a.tokens=i.skillTokens)),r.event==="assertion_result"){const o={assertion_id:i.assertion_id,text:i.text,pass:i.pass,reasoning:i.reasoning};a.assertions.find(d=>d.assertion_id===o.assertion_id)||a.assertions.push(o)}r.event==="case_complete"&&(a.status=i.status,a.passRate=i.pass_rate,a.errorMessage=i.error_message||void 0,a.classifiedError=i.classified_error||void 0)}const av=g.createContext(null);function wn(){const a=g.useContext(av);if(!a)throw new Error("useWorkspace must be used within WorkspaceProvider");return a}function Hx({plugin:a,skill:r,origin:i,children:o}){const d=i==="installed",[p,f]=g.useReducer(U2,{...H2,plugin:a,skill:r}),h=g.useRef(new Set),x=g.useRef(new Set),m=g.useRef(new Map),y=g.useCallback((ae,pe)=>{let fe=m.current.get(ae);fe||(fe={assertions:[]},m.current.set(ae,fe)),$2(fe,pe),f({type:"UPDATE_INLINE_RESULT",evalId:ae,result:{...fe,assertions:[...fe.assertions]}})},[]),v=g.useCallback(ae=>{if(x.current.has(ae))return;x.current.add(ae);const pe=m.current.get(ae)??{assertions:[]};f({type:"CASE_RUN_COMPLETE",caseId:ae,result:{...pe,assertions:[...pe.assertions]}}),h.current.has(ae)&&(h.current.delete(ae),h.current.size===0&&Ee.getLatestBenchmark(a,r).then(fe=>f({type:"BULK_RUN_COMPLETE",benchmark:fe})).catch(()=>f({type:"BULK_RUN_COMPLETE",benchmark:null})))},[a,r]),j=g.useCallback((ae,pe)=>{x.current.has(ae)||(x.current.add(ae),f({type:"CASE_RUN_ERROR",caseId:ae,error:pe}),h.current.has(ae)&&(h.current.delete(ae),h.current.size===0&&Ee.getLatestBenchmark(a,r).then(fe=>f({type:"BULK_RUN_COMPLETE",benchmark:fe})).catch(()=>f({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[a,r]),{startCase:S,stopCase:k,stopAll:A}=I2({onEvent:y,onDone:v,onError:j});g.useEffect(()=>()=>{A()},[A]);const T=g.useCallback(async()=>{try{const ae=await fetch(`/api/skills/${a}/${r}/activation-history`);if(!ae.ok){if(ae.status===404){f({type:"ACTIVATION_HISTORY_LOADED",runs:[]});return}return}const pe=await ae.json();f({type:"ACTIVATION_HISTORY_LOADED",runs:pe.runs||[]})}catch{}},[a,r]);g.useEffect(()=>{let ae=!1;async function pe(){try{const[fe,he,ve]=await Promise.allSettled([Ee.getSkillDetail(a,r),Ee.getEvals(a,r),Ee.getLatestBenchmark(a,r)]);if(ae)return;let _e=null,re=null;if(he.status==="fulfilled")_e=he.value;else{const Te=he.reason;(Te==null?void 0:Te.status)!==404&&(re=(Te==null?void 0:Te.message)??"Failed to load test cases")}f({type:"INIT_DATA",skillContent:fe.status==="fulfilled"?fe.value.skillContent:"",evals:_e,evalsError:re,benchmark:ve.status==="fulfilled"?ve.value:null})}catch(fe){ae||f({type:"SET_ERROR",error:fe.message})}}return pe(),T(),()=>{ae=!0}},[a,r,T]);const C=g.useCallback(async()=>{if(!d)try{await Ee.applyImprovement(a,r,p.skillContent),f({type:"CONTENT_SAVED"})}catch(ae){f({type:"SET_ERROR",error:ae.message})}},[d,a,r,p.skillContent]),M=g.useCallback(async ae=>{if(!d)try{const pe=await Ee.saveEvals(a,r,ae);f({type:"SET_EVALS",evals:pe})}catch(pe){f({type:"SET_ERROR",error:pe.message})}},[d,a,r]),O=g.useCallback((ae,pe="benchmark")=>{if(d)return;const fe=p.caseRunStates.get(ae);if((fe==null?void 0:fe.status)!=="running")if(m.current.delete(ae),x.current.delete(ae),f({type:"CASE_RUN_START",caseId:ae,mode:pe}),pe==="comparison"){const he=`/api/skills/${a}/${r}/compare`;S(ae,he,{eval_ids:[ae]})}else{const he=`/api/skills/${a}/${r}/benchmark/case/${ae}`;S(ae,he,pe==="baseline"?{baseline_only:!0}:void 0)}},[d,a,r,p.caseRunStates,S]),U=g.useCallback((ae="benchmark")=>{var he;if(d)return;const pe=((he=p.evals)==null?void 0:he.evals)??[];if(pe.length===0)return;const fe=pe.map(ve=>ve.id);for(const ve of fe)m.current.delete(ve),x.current.delete(ve);f({type:"BULK_RUN_START",caseIds:fe,mode:ae}),h.current=new Set(fe);for(const ve of fe)if(ae==="comparison")S(ve,`/api/skills/${a}/${r}/compare`,{eval_ids:[ve]});else{const _e=`/api/skills/${a}/${r}/benchmark/case/${ve}`;S(ve,_e,ae==="baseline"?{baseline_only:!0}:void 0)}},[d,a,r,p.evals,S]),L=g.useCallback(ae=>{k(ae),f({type:"CASE_RUN_CANCEL",caseId:ae}),h.current.delete(ae),x.current.add(ae)},[k]),V=g.useCallback(()=>{A(),f({type:"CANCEL_ALL"}),h.current.clear()},[A]),w=g.useCallback(async(ae,pe)=>{f({type:"OPEN_IMPROVE",evalId:ae})},[]),D=g.useCallback(async(ae,pe)=>{try{await Ee.applyImprovement(a,r,pe),f({type:"SET_CONTENT",content:pe}),f({type:"CONTENT_SAVED"}),f({type:"CLOSE_IMPROVE"}),O(ae,"benchmark")}catch(fe){f({type:"SET_ERROR",error:fe.message})}},[a,r,O]),E=Xd(),B=g.useRef(null),P=g.useRef(0);g.useEffect(()=>{const ae=E.events;for(let pe=P.current;pe<ae.length;pe++){const fe=ae[pe],he=fe.data;if(fe.event==="progress"&&f({type:"AI_EDIT_PROGRESS",entry:{timestamp:Date.now(),phase:he.phase,message:he.message}}),fe.event==="done"){const ve=he.improved,_e=he.reasoning,re=he.evalChanges??[];f({type:"AI_EDIT_RESULT",improved:ve,reasoning:_e,evalChanges:re})}if(fe.event==="error"){const ve=he;f({type:"AI_EDIT_ERROR",message:ve.description||"Unknown error",classified:ve})}}P.current=ae.length},[E.events]),g.useEffect(()=>{E.error&&f({type:"AI_EDIT_ERROR",message:E.error})},[E.error]),g.useEffect(()=>()=>{E.stop()},[E.stop]);const F=g.useCallback(async(ae,pe,fe)=>{d||(P.current=0,f({type:"AI_EDIT_LOADING"}),B.current=E.stop,E.start(`/api/skills/${a}/${r}/improve?sse`,{mode:"instruct",instruction:ae,content:p.skillContent,evals:p.evals??{skill_name:r,evals:[]},provider:pe,model:fe}))},[d,a,r,p.skillContent,p.evals,E]),te=g.useCallback(()=>{E.stop(),f({type:"AI_EDIT_ERROR",message:"Cancelled"})},[E]),Q=g.useCallback(async()=>{const ae=p.aiEditResult;if(ae!=null&&ae.improved)try{if(await Ee.applyImprovement(a,r,ae.improved),f({type:"SET_CONTENT",content:ae.improved}),f({type:"CONTENT_SAVED"}),p.aiEditEvalChanges.length>0&&Array.from(p.aiEditEvalSelections.values()).some(Boolean)){const{mergeEvalChanges:fe}=await Tu(async()=>{const{mergeEvalChanges:_e}=await import("./mergeEvalChanges-Dpbbs4d4.js");return{mergeEvalChanges:_e}},[]),he=p.evals??{skill_name:r,evals:[]},ve=fe(he,p.aiEditEvalChanges,p.aiEditEvalSelections);try{const _e=await Ee.saveEvals(a,r,ve);f({type:"SET_EVALS",evals:_e})}catch(_e){f({type:"SET_EVALS_RETRY",evalsFile:ve}),f({type:"SET_ERROR",error:`SKILL.md saved, but test cases failed to save: ${_e.message}. You can retry from the AI Edit panel.`});return}}f({type:"CLOSE_AI_EDIT"})}catch(pe){f({type:"SET_ERROR",error:pe.message})}},[a,r,p.aiEditResult,p.evals,p.aiEditEvalChanges,p.aiEditEvalSelections]),z=g.useCallback(()=>{f({type:"CLOSE_AI_EDIT"})},[]),R=g.useCallback(ae=>{f({type:"TOGGLE_EVAL_CHANGE",index:ae})},[]),I=g.useCallback(()=>{f({type:"SELECT_ALL_EVAL_CHANGES"})},[]),Z=g.useCallback(()=>{f({type:"DESELECT_ALL_EVAL_CHANGES"})},[]),q=g.useCallback(async()=>{const ae=p.aiEditEvalsRetry;if(ae)try{const pe=await Ee.saveEvals(a,r,ae);f({type:"SET_EVALS",evals:pe}),f({type:"SET_ERROR",error:null}),f({type:"CLOSE_AI_EDIT"})}catch(pe){f({type:"SET_ERROR",error:`Retry failed: ${pe.message}`})}},[a,r,p.aiEditEvalsRetry]),de=g.useCallback(async()=>{try{const ae=await Ee.getSkillDetail(a,r);f({type:"SET_CONTENT",content:ae.skillContent}),f({type:"CONTENT_SAVED"})}catch{}},[a,r]),{config:_}=bl(),W=Xd(),ie=g.useRef(0);g.useEffect(()=>{const ae=W.events;for(let pe=ie.current;pe<ae.length;pe++){const fe=ae[pe],he=fe.data;if(fe.event==="progress"&&f({type:"GENERATE_EVALS_PROGRESS",entry:{timestamp:Date.now(),phase:he.phase,message:he.message}}),fe.event==="done"){const ve=he;Ee.saveEvals(a,r,ve).then(_e=>f({type:"GENERATE_EVALS_DONE",evals:_e})).catch(_e=>f({type:"SET_ERROR",error:_e.message}))}fe.event==="error"&&f({type:"GENERATE_EVALS_ERROR",classified:he})}ie.current=ae.length},[W.events,a,r]),g.useEffect(()=>{W.error&&f({type:"SET_ERROR",error:W.error})},[W.error]),g.useEffect(()=>()=>{W.stop()},[W.stop]);const ue=g.useCallback(async ae=>{if(d)return;ie.current=0,f({type:"GENERATE_EVALS_START"});const pe={};_!=null&&_.provider&&(pe.provider=_.provider),_!=null&&_.model&&(pe.model=_.model);const fe=V2(ae==null?void 0:ae.testType);fe&&(pe.testType=fe),W.start(`/api/skills/${a}/${r}/generate-evals?sse`,Object.keys(pe).length>0?pe:void 0)},[d,a,r,W,_]),ge=Xd(),xe=g.useRef(0);g.useEffect(()=>()=>{ge.stop()},[ge.stop]),g.useEffect(()=>{const ae=ge.events;for(let pe=xe.current;pe<ae.length;pe++){const fe=ae[pe];if(fe.event==="classifying"){const he=fe.data;f({type:"ACTIVATION_CLASSIFYING",index:he.index,total:he.total})}if(fe.event==="prompt_result"&&f({type:"ACTIVATION_RESULT",result:fe.data}),fe.event==="done"){we.current&&(clearTimeout(we.current),we.current=null);const he=fe.data;if(he.error)f({type:"ACTIVATION_ERROR",error:he.error});else{f({type:"ACTIVATION_DONE",summary:he});const ve={id:`run-${Date.now()}`,timestamp:new Date().toISOString(),model:(_==null?void 0:_.model)||"unknown",provider:(_==null?void 0:_.provider)||"unknown",promptCount:he.total,summary:{precision:he.precision,recall:he.recall,reliability:he.reliability,tp:he.tp,tn:he.tn,fp:he.fp,fn:he.fn}};f({type:"ACTIVATION_HISTORY_LOADED",runs:[ve,...p.activationHistory??[]]})}}}xe.current=ae.length},[ge.events,_,p.activationHistory]),g.useEffect(()=>{ge.error&&(we.current&&(clearTimeout(we.current),we.current=null),f({type:"ACTIVATION_ERROR",error:ge.error}))},[ge.error]);const we=g.useRef(null),oe=g.useCallback(()=>{we.current&&(clearTimeout(we.current),we.current=null),ge.stop(),f({type:"ACTIVATION_CANCEL",totalPrompts:0})},[ge]),Se=g.useCallback(ae=>{const fe=ae.trim().split(`
|
|
@@ -88,4 +88,4 @@ You are an expert at...
|
|
|
88
88
|
from { opacity: 0; transform: translateX(-50%) translateY(2px); }
|
|
89
89
|
to { opacity: 1; transform: translateX(-50%) translateY(0); }
|
|
90
90
|
}`})]}),document.body)}function _w({agent:a,focused:r,active:i,onClick:o}){const d=a.health==="ok"?"var(--color-ok, #22c55e)":a.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)";return n.jsxs("button",{type:"button","data-testid":"agent-scope-row","data-agent-id":a.id,"data-active":i?"true":"false",onClick:o,style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 14px",background:r?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",border:"none",cursor:"pointer",textAlign:"left",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:d,flexShrink:0}}),n.jsx("span",{style:{flex:1,fontSize:13},children:a.displayName}),n.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[a.installedCount,"·",a.globalCount]})]})}function Ow({row:a,onFocus:r}){return n.jsxs("button",{type:"button","data-testid":"agent-scope-shared-folder-row",onClick:r,style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4,width:"100%",padding:"8px 14px",background:"transparent",border:"none",borderTop:"1px dashed var(--border-subtle)",borderBottom:"1px dashed var(--border-subtle)",cursor:"pointer",textAlign:"left",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)"},children:a.sharedFolderPath}),n.jsxs("span",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[a.consumers.map(i=>n.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:10,background:"color-mix(in srgb, var(--color-global) 20%, transparent)",color:"var(--text-primary)"},children:i.id},i.id)),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontFamily:"var(--font-mono)"},children:["· ",a.combinedCount," skills"]})]})]})}function Bw({agent:a,onSetUp:r}){return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"6px 14px",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:12},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--text-tertiary)",flexShrink:0}}),n.jsx("span",{style:{flex:1},children:a.displayName}),a.isRemoteOnly?n.jsx("span",{"data-testid":`agent-scope-remote-badge-${a.id}`,"aria-label":"Remote-only agent",style:{background:"color-mix(in srgb, var(--text-tertiary) 18%, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:10,padding:"1px 8px",color:"var(--text-secondary)",fontSize:10,letterSpacing:"0.04em",textTransform:"uppercase"},children:"Remote"}):n.jsx("button",{type:"button","data-testid":`agent-scope-set-up-${a.id}`,onClick:r,style:{background:"transparent",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:4,padding:"2px 8px",color:"var(--text-primary)",fontSize:11,cursor:"pointer"},children:J.scopePicker.setUpCta(a.displayName)})]})}function Iw({agent:a,activeAgentId:r,onSwitch:i}){const o=a.id===r,d=a.isRemoteOnly===!0,p=o||d,f=o?"Active":d?"Remote-only":J.scopePicker.switchCta;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[n.jsxs("div",{children:[n.jsx("div",{style:{fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:a.displayName}),n.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:2},children:d?"Remote service — no local install":Uw(a.health)})]}),n.jsxs("dl",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"4px 12px",margin:0,fontSize:12},children:[n.jsx(iu,{label:J.scopePicker.statsInstalled,value:String(a.installedCount)}),n.jsx(iu,{label:J.scopePicker.statsGlobal,value:String(a.globalCount)}),n.jsx(iu,{label:J.scopePicker.statsLastSync,value:a.lastSync?Hw(a.lastSync):"—"})]}),n.jsx("button",{type:"button","data-testid":"agent-scope-switch",onClick:i,disabled:p,title:d?"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:p?"transparent":"color-mix(in srgb, var(--accent-surface) 20%, transparent)",color:"var(--text-primary)",fontSize:12,fontWeight:500,fontFamily:"var(--font-sans)",cursor:p?"default":"pointer",opacity:p?.5:1},children:f})]})}function iu({label:a,value:r}){return n.jsxs(n.Fragment,{children:[n.jsx("dt",{style:{color:"var(--text-secondary)",margin:0},children:a}),n.jsx("dd",{style:{color:"var(--text-primary)",margin:0,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums"},children:r})]})}function sg(){return n.jsx("div",{style:{padding:"16px 18px",fontSize:12,color:"var(--text-secondary)"},children:"No agents detected yet."})}function Hw(a){try{const r=new Date(a).getTime(),i=Date.now()-r;if(Number.isNaN(r))return"—";const o=Math.round(i/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const d=Math.round(o/60);return d<24?`${d}h ago`:`${Math.round(d/24)}d ago`}catch{return"—"}}function Uw(a){switch(a){case"ok":return J.scopePicker.statsHealthOk;case"stale":return J.scopePicker.statsHealthStale;case"missing":return J.scopePicker.statsHealthMissing}}function Vw(a){const r=new Map;for(const i of a.sharedFolders??[])for(const o of i.consumers)r.set(o,i);return a.agents.map(i=>{const o=r.get(i.id);return{id:i.id,displayName:i.displayName,presence:i.detected?"detected":"absent",installedCount:i.localSkillCount,globalCount:i.globalSkillCount,lastSync:i.lastSync,health:i.health,sharedFolderGroup:o?o.consumers:void 0,sharedFolderPath:o?o.path:void 0,isRemoteOnly:i.isRemoteOnly}})}function $w({agents:a,activeAgentId:r,onActiveAgentChange:i,onOpenSetup:o}){const[d,p]=g.useState(!1),[f,h]=g.useState(null),x=g.useRef(null),m=g.useMemo(()=>a.find(S=>S.id===r)??a[0]??null,[a,r]),y=g.useMemo(()=>m?m.health==="ok"?"var(--color-ok, #22c55e)":m.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)":"var(--text-tertiary)",[m]),v=g.useCallback(()=>{var S;p(!1),(S=x.current)==null||S.focus()},[]),j=g.useCallback(S=>{i(S),p(!1)},[i]);return n.jsxs(n.Fragment,{children:[n.jsxs("button",{ref:x,type:"button","data-testid":"agent-scope-picker-trigger","aria-haspopup":"dialog","aria-expanded":d,onClick:()=>p(S=>!S),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),p(!0))},style:{display:"flex",alignItems:"center",gap:10,height:"40px",width:"100%",padding:"0 14px",background:"var(--bg-surface, var(--surface-1))",border:"none",borderBottom:"1px solid var(--border-default, var(--border-subtle))",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500,textAlign:"left",position:"sticky",top:0,zIndex:2},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:y,flexShrink:0}}),n.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(m==null?void 0:m.displayName)??"Select agent"}),n.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,")"]}),n.jsx("span",{"aria-hidden":"true",style:{fontSize:10,color:"var(--text-secondary)"},children:"▾"})]}),d&&n.jsx(Dw,{agents:a,activeAgentId:r,focusedAgentId:f??r,onFocusAgent:h,onSwitch:j,onOpenSetup:S=>{o(S),v()},onClose:v})]})}const Cv="vskill-ccode-banner-dismissed",Pw=new Set(["claude-cli","claude-code"]);function Gw(){try{return sessionStorage.getItem(Cv)==="true"}catch{return!1}}function Fw(){try{sessionStorage.setItem(Cv,"true")}catch{}}function qw({activeAgentId:a}){const[r,i]=g.useState(()=>Gw()),o=g.useCallback(()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:open-setup-drawer",{detail:{provider:"claude-code"}}))},[]),d=g.useCallback(()=>{Fw(),i(!0)},[]);return!a||!Pw.has(a)||r?null:n.jsxs("div",{"data-testid":"claude-code-first-use-banner",role:"note","aria-label":"Claude Code subscription info",style:{display:"flex",alignItems:"flex-start",gap:10,padding:"8px 12px",borderBottom:"1px solid var(--border-default, var(--border-subtle))",background:"color-mix(in srgb, var(--accent-surface) 8%, transparent)",fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-primary)",lineHeight:1.45},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--color-ok, #22c55e)",marginTop:6,flexShrink:0}}),n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsxs("span",{children:[J.claudeCodeLabel.firstUseBanner," "]}),n.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-learn-more",onClick:o,style:{background:"transparent",border:"none",padding:0,color:"var(--color-accent, var(--accent-surface))",cursor:"pointer",textDecoration:"underline",fontFamily:"inherit",fontSize:"inherit"},children:J.claudeCodeLabel.learnMore})]}),n.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-dismiss",onClick:d,"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 Yw(){const[a,r]=g.useState(null),[i,o]=g.useState("loading"),[d,p]=g.useState(null),f=g.useCallback(async()=>{try{const h=await Ee.getAgents();r(h),o("ready"),p(null)}catch(h){o("error"),p(h.message)}},[]);return g.useEffect(()=>{f()},[f]),g.useEffect(()=>{const h=()=>void f();return window.addEventListener("studio:agent-changed",h),()=>window.removeEventListener("studio:agent-changed",h)},[f]),{status:i,response:a,error:d,refresh:()=>void f()}}const eo="workspace",Ww=["skills","agents"];async function Kw(){const a=await fetch("/api/workspace");if(!a.ok)throw new Error(`GET /api/workspace failed: ${a.status}`);return await a.json()}async function Xw(a){const r=await fetch("/api/workspace/active",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a})});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`POST /api/workspace/active failed: ${r.status}`)}return await r.json()}async function Qw(a){const r=await fetch("/api/workspace/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`POST /api/workspace/projects failed: ${r.status}`)}return await r.json()}async function Zw(a){const r=await fetch(`/api/workspace/projects/${encodeURIComponent(a)}`,{method:"DELETE"});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`DELETE /api/workspace/projects/${a} failed: ${r.status}`)}return await r.json()}function ou(){for(const a of Ww)an(a)}function Jw(){const{data:a,loading:r,error:i,revalidate:o}=xr(eo,Kw),d=a,p=d==null?void 0:d.projects.find(m=>m.id===d.activeProjectId),f=g.useCallback(async m=>{await Xw(m),an(eo),ou()},[]),h=g.useCallback(async m=>{await Qw(m),an(eo),ou()},[]),x=g.useCallback(async m=>{await Zw(m),an(eo),ou()},[]);return{workspace:d,activeProject:p,loading:r,error:i,switchProject:f,addProject:h,removeProject:x,revalidate:o}}function eC({workspace:a,onSwitch:r,onAdd:i,onRemove:o,isPathStale:d}){const[p,f]=g.useState(!1),[h,x]=g.useState(!1),[m,y]=g.useState(""),[v,j]=g.useState(null),[S,k]=g.useState(null),[A,T]=g.useState(null),[C,M]=g.useState(!1),O=g.useRef(null),U=(a==null?void 0:a.projects)??[],L=U.find(E=>E.id===(a==null?void 0:a.activeProjectId));g.useEffect(()=>{if(!p)return;function E(B){O.current&&!O.current.contains(B.target)&&(f(!1),x(!1),j(null))}return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[p]);async function V(){j(null);const E=m.trim();if(!E){j("Paste an absolute path (e.g. /Users/you/projects/my-skill)");return}if(!E.startsWith("/")&&!/^[A-Za-z]:[\\/]/.test(E)){j("Path must be absolute. In Terminal, cd to the folder and run: pwd — then paste the result here.");return}try{await i({path:E}),y(""),x(!1)}catch(B){const P=B instanceof Error?B.message:String(B);/does not exist/i.test(P)?j(`Path not found on disk: ${E}`):/Duplicate/i.test(P)?j("That project is already registered."):j(P)}}async function w(){if(j(null),typeof window<"u"&&"showDirectoryPicker"in window)try{const E=await window.showDirectoryPicker();y(E.name),x(!0)}catch{}else x(!0)}function D(E){if(E.length<=50)return E;const B=E.split("/");return B.length<=4?E:`${B.slice(0,3).join("/")}/…/${B.slice(-2).join("/")}`}return n.jsxs("div",{ref:O,"data-vskill-project-picker":!0,style:{position:"relative",display:"inline-block"},children:[n.jsxs("button",{type:"button",onClick:()=>f(E=>!E),"aria-expanded":p,"aria-haspopup":"menu",title:(L==null?void 0:L.path)??"No project selected",style:{display:"flex",alignItems:"center",gap:8,padding:"4px 10px",border:"1px solid transparent",borderRadius:6,background:p?"var(--surface-2, rgba(0,0,0,0.05))":"transparent",cursor:"pointer",fontFamily:"var(--font-mono)",fontSize:13,color:"var(--text-primary)",transition:"background-color 120ms ease"},children:[n.jsx("span",{"aria-hidden":!0,style:{width:8,height:8,borderRadius:"50%",flexShrink:0,backgroundColor:(L==null?void 0:L.colorDot)??"var(--text-tertiary, #999)"}}),n.jsx("span",{style:{maxWidth:180,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:L?L.name:"No project"}),n.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-tertiary, #999)",marginLeft:2},children:p?"▴":"▾"})]}),p&&n.jsxs("div",{role:"menu","aria-label":"Switch project",style:{position:"absolute",top:"calc(100% + 4px)",left:0,minWidth:280,maxWidth:420,width:"max-content",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:8,boxShadow:"0 4px 6px -1px rgba(0,0,0,0.08), 0 10px 20px -5px rgba(0,0,0,0.12)",overflow:"hidden",zIndex:50,fontFamily:"var(--font-sans)"},children:[U.length===0&&n.jsx("div",{style:{padding:"16px 16px 12px",fontSize:12,color:"var(--text-tertiary)",lineHeight:1.5},children:"No projects registered. Add one to get started."}),U.length>0&&n.jsx("ul",{role:"none",style:{listStyle:"none",margin:0,padding:4,maxHeight:320,overflowY:"auto"},children:U.map(E=>{const B=d?d(E.path):!1,P=E.id===(a==null?void 0:a.activeProjectId),F=S===E.id;return n.jsxs("li",{role:"menuitem","data-stale":B?"true":"false",onMouseEnter:()=>k(E.id),onMouseLeave:()=>k(te=>te===E.id?null:te),onClick:()=>{if(!B){if(P){f(!1);return}T(E)}},style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:6,cursor:B?"not-allowed":"pointer",background:F&&!B?"var(--surface-2, rgba(0,0,0,0.04))":P?"var(--surface-1, rgba(0,0,0,0.02))":"transparent",opacity:B?.5:1,transition:"background-color 120ms ease"},children:[n.jsx("span",{"aria-hidden":!0,style:{width:10,height:10,borderRadius:"50%",flexShrink:0,backgroundColor:E.colorDot,boxShadow:P?"0 0 0 2px color-mix(in oklch, currentColor 20%, transparent)":"none"}}),n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13,fontWeight:P?600:500,color:"var(--text-primary)",lineHeight:1.3},children:[n.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:E.name}),P&&n.jsx("span",{"aria-label":"Active",style:{fontSize:10,color:"var(--color-action, #2F5B8E)",letterSpacing:"0.05em",textTransform:"uppercase",fontWeight:600},children:"Active"})]}),n.jsx("div",{title:E.path,style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-tertiary)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D(E.path)}),B&&n.jsx("div",{style:{fontSize:10,color:"var(--color-own, #b45309)",marginTop:2},children:"Path no longer exists"})]}),n.jsx("button",{type:"button","aria-label":`Remove ${E.name}`,onClick:te=>{te.stopPropagation(),o(E.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:F?1:0,transition:"opacity 120ms ease, color 120ms ease, background-color 120ms ease",flexShrink:0},onMouseEnter:te=>{te.currentTarget.style.color="var(--color-error, #b91c1c)",te.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-error, #b91c1c) 10%, transparent)"},onMouseLeave:te=>{te.currentTarget.style.color="var(--text-tertiary)",te.currentTarget.style.backgroundColor="transparent"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[n.jsx("polyline",{points:"3 6 5 6 21 6"}),n.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),n.jsx("path",{d:"M10 11v6"}),n.jsx("path",{d:"M14 11v6"}),n.jsx("path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]})})]},E.id)})}),n.jsxs("div",{style:{borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",padding:h?8:6},children:[!h&&n.jsxs("button",{type:"button",onClick:()=>void w(),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:E=>{E.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-action, #2F5B8E) 10%, transparent)"},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent"},children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add project"]}),h&&n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[n.jsx("input",{type:"text",value:m,onChange:E=>y(E.target.value),onKeyDown:E=>{E.key==="Enter"&&V(),E.key==="Escape"&&(x(!1),j(null))},placeholder:"/absolute/path/to/project",autoFocus:!0,style:{width:"100%",padding:"6px 8px",fontFamily:"var(--font-mono)",fontSize:12,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none"}}),n.jsxs("div",{style:{display:"flex",gap:6,justifyContent:"flex-end"},children:[n.jsx("button",{type:"button",onClick:()=>{x(!1),j(null),y("")},style:{padding:"4px 10px",fontSize:12,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Cancel"}),n.jsx("button",{type:"button",onClick:()=>void V(),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&&n.jsx("div",{style:{fontSize:11,color:"var(--color-error, #b91c1c)"},children:v})]})]})]}),A&&n.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:()=>T(null),children:[n.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.40)"}}),n.jsxs("div",{onClick:E=>E.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:[n.jsxs("h2",{style:{margin:0,fontSize:16,fontWeight:600,fontFamily:"var(--font-serif, ui-serif)",marginBottom:8},children:["Switch to ",A.name]}),n.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:"}),n.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 "${A.path}" && npx vskill@latest studio`}),n.jsxs("div",{style:{display:"flex",gap:8,marginTop:14,justifyContent:"flex-end"},children:[n.jsx("button",{type:"button",onClick:async()=>{try{await navigator.clipboard.writeText(`cd "${A.path}" && npx vskill@latest studio`),M(!0),setTimeout(()=>M(!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:C?"Copied!":"Copy command"}),n.jsx("button",{type:"button",onClick:()=>T(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 tC(a,r){const i=r.trim().toLowerCase().split(/\s+/).filter(Boolean);return i.length===0?a:a.filter(o=>{const d=`${o.name} ${o.path}`.toLowerCase();return i.every(p=>d.includes(p))})}function nC({open:a,projects:r,onSwitch:i,onClose:o}){const[d,p]=g.useState(""),[f,h]=g.useState(0),x=g.useMemo(()=>tC(r,d),[r,d]);g.useEffect(()=>{a||(p(""),h(0))},[a]),g.useEffect(()=>{f>=x.length&&h(0)},[x.length,f]);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(x.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=x[f];v&&(i(v.id),o())}};return a?n.jsxs("div",{role:"dialog","aria-modal":"true","data-vskill-project-palette":!0,className:"vskill-project-palette fixed inset-0 z-50 flex items-start justify-center pt-24",children:[n.jsx("div",{className:"absolute inset-0 bg-black/30",onClick:o}),n.jsxs("div",{className:"relative w-[520px] max-w-[92vw] bg-background border rounded shadow-lg",children:[n.jsx("input",{type:"text",autoFocus:!0,value:d,onChange:y=>p(y.target.value),onKeyDown:m,placeholder:"Switch project…",className:"w-full px-3 py-2 text-sm border-b outline-none"}),n.jsxs("ul",{role:"listbox",className:"max-h-80 overflow-auto",children:[x.length===0&&n.jsx("li",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No matches."}),x.map((y,v)=>n.jsxs("li",{role:"option","aria-selected":v===f,"data-highlighted":v===f,className:["flex items-center gap-2 px-3 py-2 text-sm cursor-pointer",v===f?"bg-muted":""].join(" "),onMouseEnter:()=>h(v),onClick:()=>{i(y.id),o()},children:[n.jsx("span",{"aria-hidden":!0,className:"inline-block w-2 h-2 rounded-full",style:{backgroundColor:y.colorDot}}),n.jsxs("span",{className:"flex-1",children:[n.jsx("span",{className:"vskill-palette-name",children:y.name}),n.jsx("span",{className:"ml-2 vskill-palette-path text-xs font-mono text-muted-foreground",children:y.path})]})]},y.id))]})]})]}):null}const ig=/^[a-z][a-z0-9-]{0,62}[a-z0-9]$/;function aC({open:a,onClose:r,initialMode:i="standalone",isClaudeCode:o,projectRoot:d,onCreated:p}){const[f,h]=g.useState("destination"),[x,m]=g.useState(i),[y,v]=g.useState(""),[j,S]=g.useState(""),[k,A]=g.useState(""),[T,C]=g.useState([]),[M,O]=g.useState(!1),[U,L]=g.useState(null);if(g.useEffect(()=>{a&&(h("destination"),m(i),v(""),S(""),A(""),L(null))},[a,i]),g.useEffect(()=>{if(!a)return;let z=!0;return fetch("/api/authoring/plugins").then(R=>R.json()).then(R=>{z&&C(R.plugins??[])}).catch(()=>{}),()=>{z=!1}},[a]),g.useEffect(()=>{if(!a)return;function z(R){R.key==="Escape"&&(R.preventDefault(),r())}return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[a,r]),!a)return null;const V=T.length>0,w=o&&V,D=o,E=ig.test(y),B=x==="existing-plugin"?j.length>0:ig.test(j),P=!M&&E&&(x==="standalone"||B),F=lC(d,x,j,y);function te(){const z=new URLSearchParams;z.set("mode",x),z.set("skillName",y),k.trim()&&z.set("description",k.trim()),j&&z.set("pluginName",j);const R=`/#/create?${z.toString()}`;typeof window<"u"&&window.location.assign(R),r()}async function Q(){L(null),O(!0);try{const z=await fetch("/api/authoring/create-skill",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:x,skillName:y,description:k.trim()||void 0,pluginName:x==="standalone"?void 0:j})}),R=await z.json();if(!z.ok||!R.ok){L(R.error??`Create failed: ${z.status}`);return}an("skills"),p==null||p({mode:x,skillName:y,pluginName:R.pluginName??null,skillMdPath:R.skillMdPath}),r()}catch(z){L(z instanceof Error?z.message:String(z))}finally{O(!1)}}return n.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:[n.jsx("div",{onClick:r,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.45)"}}),n.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:[n.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:[n.jsx("h2",{style:{margin:0,fontSize:16,fontWeight:600,color:"var(--text-primary)",fontFamily:"var(--font-serif, ui-serif)",letterSpacing:"0.01em"},children:f==="destination"?"Create a skill":"Name and describe"}),n.jsxs("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginLeft:"auto",fontVariantNumeric:"tabular-nums"},children:["Step ",f==="destination"?"1":"2"," of 2"]})]}),f==="destination"&&n.jsxs("div",{style:{padding:14,display:"flex",flexDirection:"column",gap:10},children:[n.jsx(cu,{title:"Standalone skill",subtitle:"A single skill in this project",description:"Lives at <project>/skills/<name>/SKILL.md. Works with every agent.",icon:"📄",selected:x==="standalone",onClick:()=>m("standalone")}),n.jsx(cu,{title:"Add to existing plugin",subtitle:w?`${T.length} plugin source${T.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:!w,selected:x==="existing-plugin",onClick:()=>w&&m("existing-plugin")}),n.jsx(cu,{title:"New plugin",subtitle:D?"Bundles one or more skills for distribution":"Claude Code only",description:"Scaffolds <plugin>/.claude-plugin/plugin.json and its first skill.",icon:"📦",disabled:!D,selected:x==="new-plugin",onClick:()=>D&&m("new-plugin")})]}),f==="details"&&n.jsxs("div",{style:{padding:16,display:"flex",flexDirection:"column",gap:12},children:[x==="new-plugin"&&n.jsx(to,{label:"Plugin name",hint:"kebab-case",children:n.jsx("input",{type:"text",value:j,onChange:z=>S(z.target.value.trim()),placeholder:"my-first-plugin",autoFocus:!0,style:no(!j||B)})}),x==="existing-plugin"&&n.jsx(to,{label:"Plugin",children:n.jsxs("select",{value:j,onChange:z=>S(z.target.value),style:{...no(!0),fontFamily:"var(--font-mono)"},children:[n.jsx("option",{value:"",children:"Select a plugin…"}),T.map(z=>n.jsx("option",{value:z.name,children:z.name},z.path))]})}),n.jsx(to,{label:"Skill name",hint:"kebab-case",children:n.jsx("input",{type:"text",value:y,onChange:z=>v(z.target.value.trim()),placeholder:"my-new-skill",autoFocus:x!=="new-plugin",style:no(!y||E)})}),n.jsx(to,{label:"Description",hint:"One short sentence — shown in frontmatter",children:n.jsx("textarea",{value:k,onChange:z=>A(z.target.value),rows:2,placeholder:"Does a thing when Claude needs X",style:{...no(!0),resize:"vertical",minHeight:52,fontFamily:"var(--font-sans)"}})}),F&&n.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:[n.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginBottom:2,fontFamily:"var(--font-sans)"},children:"Will create:"}),F.map((z,R)=>n.jsx("div",{children:z},R))]}),U&&n.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:U})]}),n.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:[n.jsx("button",{type:"button",onClick:r,style:du,children:"Cancel"}),f==="destination"&&n.jsx("button",{type:"button",onClick:()=>h("details"),style:og,children:"Continue →"}),f==="details"&&n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:()=>h("destination"),style:du,children:"← Back"}),n.jsx("button",{type:"button",onClick:te,disabled:!P,style:{...du,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"}),n.jsx("button",{type:"button",onClick:()=>void Q(),disabled:!P,style:{...og,opacity:P?1:.5,cursor:P?"pointer":"not-allowed"},title:"Creates an empty SKILL.md scaffold you can fill in by hand",children:M?"Creating…":"Create empty scaffold"})]})]})]})]})}function cu({title:a,subtitle:r,description:i,icon:o,selected:d,disabled:p,onClick:f}){return n.jsxs("button",{type:"button",onClick:f,disabled:p,"aria-pressed":d,style:{display:"flex",gap:12,padding:"12px 14px",textAlign:"left",borderRadius:8,border:d?"2px solid var(--color-accent, #2f6f8f)":"1px solid var(--border-default, rgba(0,0,0,0.12))",background:d?"color-mix(in oklch, var(--color-accent, #2f6f8f) 8%, var(--color-paper, #fff))":p?"var(--surface-1, rgba(0,0,0,0.02))":"var(--color-paper, #fff)",color:p?"var(--text-tertiary)":"var(--text-primary)",cursor:p?"not-allowed":"pointer",opacity:p?.6:1,fontFamily:"inherit",width:"100%",transition:"border-color 120ms ease, background-color 120ms ease"},children:[n.jsx("span",{"aria-hidden":!0,style:{fontSize:22,lineHeight:1,marginTop:2},children:o}),n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsx("div",{style:{fontSize:14,fontWeight:600,lineHeight:1.3},children:a}),n.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginTop:2,textTransform:"uppercase",letterSpacing:"0.04em"},children:r}),n.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",marginTop:6,lineHeight:1.5},children:i})]})]})}function to({label:a,hint:r,children:i}){return n.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4},children:[n.jsxs("span",{style:{display:"flex",alignItems:"baseline",gap:8},children:[n.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-primary)"},children:a}),r&&n.jsx("span",{style:{fontSize:11,color:"var(--text-tertiary)"},children:r})]}),i]})}function no(a){return{width:"100%",padding:"7px 10px",fontSize:13,fontFamily:"var(--font-mono)",border:`1px solid ${a?"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 og={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"},du={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 lC(a,r,i,o){const d=o||"<skill-name>",p=i||"<plugin-name>",f=a||"<project>";return r==="standalone"?[`${f}/skills/${d}/SKILL.md`]:r==="existing-plugin"?[`${f}/${p}/skills/${d}/SKILL.md`]:r==="new-plugin"?[`${f}/${p}/.claude-plugin/plugin.json`,`${f}/${p}/skills/${d}/SKILL.md`]:null}function rC({open:a,onClose:r,onInstall:i,installedNames:o}){const[d,p]=g.useState([]),[f,h]=g.useState(null),[x,m]=g.useState(null),[y,v]=g.useState(!1),[j,S]=g.useState(null);return g.useEffect(()=>{a&&(v(!0),S(null),fetch("/api/plugins/marketplaces").then(k=>k.json()).then(k=>{if(k.error)throw new Error(k.error);p(k.marketplaces??[])}).catch(k=>S(k instanceof Error?k.message:String(k))).finally(()=>v(!1)))},[a]),g.useEffect(()=>{if(!f){m(null);return}v(!0),S(null),fetch(`/api/plugins/marketplaces/${encodeURIComponent(f)}`).then(k=>k.json()).then(k=>{if(k.error)throw new Error(k.error);m(k)}).catch(k=>S(k instanceof Error?k.message:String(k))).finally(()=>v(!1))},[f]),g.useEffect(()=>{if(!a)return;function k(A){A.key==="Escape"&&r()}return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[a,r]),a?n.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Plugin marketplace","data-vskill-marketplace-drawer":!0,style:{position:"fixed",inset:0,zIndex:80},children:[n.jsx("div",{onClick:r,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.38)"}}),n.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:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.08))"},children:[f&&n.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"}),n.jsx("h2",{style:{margin:0,fontSize:15,fontWeight:600,color:"var(--text-primary)",fontFamily:"var(--font-serif, ui-serif)",flex:1},children:f?(x==null?void 0:x.name)??f:"Browse plugins"}),n.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:"✕"})]}),n.jsxs("div",{style:{flex:1,overflowY:"auto",padding:12},children:[y&&n.jsx("div",{style:{padding:12,fontSize:12,color:"var(--text-tertiary)"},children:"Loading…"}),j&&n.jsx("div",{style:{padding:10,fontSize:12,color:"var(--color-error, #b91c1c)",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4},children:j}),!f&&!y&&d.length===0&&!j&&n.jsx(sC,{}),!f&&d.map(k=>n.jsxs("button",{type:"button",onClick:()=>h(k.name),style:oC,onMouseEnter:A=>{A.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.04))"},onMouseLeave:A=>{A.currentTarget.style.background="transparent"},children:[n.jsx("div",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)"},children:k.name}),n.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.source})]},k.name)),f&&x&&n.jsxs(n.Fragment,{children:[x.description&&n.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",padding:"0 6px 12px",lineHeight:1.5},children:x.description}),x.plugins.length===0&&n.jsx("div",{style:{padding:12,fontSize:12,color:"var(--text-tertiary)"},children:"This marketplace has no plugins catalogued yet."}),x.plugins.map(k=>{const A=o.has(k.name);return n.jsx("div",{style:{padding:"10px 8px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.05))"},children:n.jsxs("div",{style:{display:"flex",alignItems:"start",gap:8},children:[n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsxs("div",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)",display:"flex",alignItems:"baseline",gap:8},children:[k.name,k.version&&n.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)"},children:k.version}),k.category&&n.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:10,background:"var(--surface-2, rgba(0,0,0,0.05))",color:"var(--text-secondary)"},children:k.category})]}),k.description&&n.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:4,lineHeight:1.5},children:k.description})]}),n.jsx("button",{type:"button",disabled:A,onClick:()=>i(k.name,f),style:{flexShrink:0,padding:"5px 12px",fontSize:12,fontWeight:600,border:A?"none":"1px solid var(--color-action, #2F5B8E)",borderRadius:4,background:A?"var(--surface-2, rgba(0,0,0,0.05))":"var(--color-action, #2F5B8E)",color:A?"var(--text-tertiary)":"var(--color-action-ink, #FFFFFF)",cursor:A?"default":"pointer",fontFamily:"inherit",boxShadow:A?"none":"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)"},children:A?"Installed":"Install"})]})},k.name)})]})]}),!f&&n.jsx("div",{style:{borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",padding:12},children:n.jsx(iC,{onAdded:()=>{an("marketplaces"),fetch("/api/plugins/marketplaces").then(k=>k.json()).then(k=>p(k.marketplaces??[]))}})})]})]}):null}function sC(){return n.jsxs("div",{style:{padding:20,fontSize:12,color:"var(--text-tertiary)",lineHeight:1.6},children:["No marketplaces configured yet. Add one below — examples:",n.jsxs("ul",{style:{marginTop:8,paddingLeft:16},children:[n.jsx("li",{children:n.jsx("code",{children:"anthropics/claude-plugins-official"})}),n.jsx("li",{children:n.jsx("code",{children:"openai/codex-plugin-cc"})})]})]})}function iC({onAdded:a}){const[r,i]=g.useState(""),[o,d]=g.useState(!1),[p,f]=g.useState(null);async function h(){const x=r.trim();if(x){d(!0),f(null);try{const m=await fetch("/api/plugins/marketplaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:x})}),y=await m.json().catch(()=>({}));if(!m.ok||!y.ok){f(y.error??`Add failed (${m.status})`);return}i(""),a()}catch(m){f(m instanceof Error?m.message:String(m))}finally{d(!1)}}}return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[n.jsx("label",{style:{fontSize:11,color:"var(--text-tertiary)",fontWeight:500},children:"Add marketplace (GitHub owner/repo, URL, or path)"}),n.jsxs("div",{style:{display:"flex",gap:6},children:[n.jsx("input",{type:"text",value:r,onChange:x=>i(x.target.value),onKeyDown:x=>{x.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"}}),n.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"})]}),p&&n.jsx("div",{style:{fontSize:11,color:"var(--color-error, #b91c1c)"},children:p})]})}const oC={display:"block",width:"100%",textAlign:"left",padding:"10px 12px",border:"none",borderRadius:6,background:"transparent",cursor:"pointer",fontFamily:"inherit",marginBottom:2},uu=12;function cC({job:a,onDone:r}){const[i,o]=g.useState([]),[d,p]=g.useState("running"),[f,h]=g.useState(!1);if(g.useEffect(()=>{if(!a)return;o([]),p("running"),h(!1);const v=new AbortController;let j=[],S="running";return(async()=>{try{const k=await fetch("/api/plugins/install/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({plugin:a.ref}),signal:v.signal});if(!k.ok||!k.body){p("failed"),r({ok:!1,code:k.status,lines:[`HTTP ${k.status}`]});return}const A=k.body.getReader(),T=new TextDecoder;let C="";for(;;){const{value:M,done:O}=await A.read();if(O)break;C+=T.decode(M,{stream:!0});const U=C.split(/\n\n/);C=U.pop()??"";for(const L of U){const V=L.match(/^data:\s*(.*)$/m);if(V)try{const w=JSON.parse(V[1]);w.type==="stdout"&&w.line?(j=[...j,w.line].slice(-uu),o(j)):w.type==="stderr"&&w.line?(j=[...j,`⚠ ${w.line}`].slice(-uu),o(j)):w.type==="done"?(S=w.ok?"ok":"failed",p(S),an("plugins"),an("skills"),r({ok:w.ok??!1,code:w.code??null,lines:j})):w.type==="error"&&w.error&&(j=[...j,`✘ ${w.error}`].slice(-uu),o(j))}catch{}}}S==="running"&&r({ok:!0,code:0,lines:j})}catch(k){if(k.name==="AbortError")return;p("failed"),r({ok:!1,code:null,lines:[...j,k instanceof Error?k.message:String(k)]})}})(),()=>v.abort()},[a==null?void 0:a.ref]),!a)return null;const x=d==="ok"?"var(--color-installed, #2F6A4A)":d==="failed"?"var(--color-error, #b91c1c)":"var(--color-accent, #2f6f8f)",m=d==="ok"?"✔":d==="failed"?"✘":"…",y=d==="ok"?"Installed":d==="failed"?"Install failed":"Installing";return n.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 ${x}`,borderRadius:6,boxShadow:"0 10px 20px -6px rgba(0,0,0,0.18)",zIndex:90,fontFamily:"var(--font-sans)",overflow:"hidden"},children:[n.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:[n.jsx("span",{"aria-hidden":!0,style:{fontSize:16,color:x,width:16,textAlign:"center"},children:d==="running"?n.jsx(dC,{}):m}),n.jsxs("span",{style:{flex:1,minWidth:0},children:[n.jsxs("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-primary)"},children:[y,": ",a.plugin,n.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)",marginLeft:4},children:["@",a.marketplace]})]}),!f&&i.length>0&&n.jsx("span",{style:{display:"block",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i[i.length-1]})]}),n.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-tertiary)"},children:f?"▾":"▸"})]}),f&&n.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:i.length===0?"Waiting for output…":i.join(`
|
|
91
|
-
`)})]})}function dC(){return n.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:n.jsx("style",{children:"@keyframes vskill-spin { to { transform: rotate(360deg); } }"})})}const Nv="vskill.studio.prefs";function Ev(){try{return typeof window>"u"?null:window.localStorage??null}catch{return null}}function Tv(){const a=Ev();if(!a)return{};try{const r=a.getItem(Nv);if(!r)return{};const i=JSON.parse(r);return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}catch{return{}}}function uC(a,r){const i=Ev();if(i)try{const d={...Tv(),[a]:r};i.setItem(Nv,JSON.stringify(d))}catch{}}function fC(a,r){const o=Tv()[a];return o===void 0?r:o}const cg={open:!1,x:0,y:0,skill:null};function pC(a,r){return{open:!0,x:a.clientX,y:a.clientY,skill:r}}function xl(a,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:a,severity:r}}))}function mC(a,r){var i;switch(a){case"copy-path":try{(i=navigator.clipboard)==null||i.writeText(r.dir)}catch{xl(J.toasts.permissionDenied,"error");return}xl(J.toasts.pathCopied,"info");return;case"open":case"reveal":case"edit":xl(J.actions.editPlaceholder,"info");return;case"run-benchmark":xl(J.toasts.benchmarkQueued,"info");return;case"duplicate":xl(J.toasts.skillDuplicated,"info");return;case"update":xl(J.toasts.skillUpdated,"info");return;case"uninstall":xl(J.actions.editPlaceholder,"info");return;default:return}}const hC=g.lazy(()=>Tu(()=>import("./CommandPalette-
|
|
91
|
+
`)})]})}function dC(){return n.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:n.jsx("style",{children:"@keyframes vskill-spin { to { transform: rotate(360deg); } }"})})}const Nv="vskill.studio.prefs";function Ev(){try{return typeof window>"u"?null:window.localStorage??null}catch{return null}}function Tv(){const a=Ev();if(!a)return{};try{const r=a.getItem(Nv);if(!r)return{};const i=JSON.parse(r);return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}catch{return{}}}function uC(a,r){const i=Ev();if(i)try{const d={...Tv(),[a]:r};i.setItem(Nv,JSON.stringify(d))}catch{}}function fC(a,r){const o=Tv()[a];return o===void 0?r:o}const cg={open:!1,x:0,y:0,skill:null};function pC(a,r){return{open:!0,x:a.clientX,y:a.clientY,skill:r}}function xl(a,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:a,severity:r}}))}function mC(a,r){var i;switch(a){case"copy-path":try{(i=navigator.clipboard)==null||i.writeText(r.dir)}catch{xl(J.toasts.permissionDenied,"error");return}xl(J.toasts.pathCopied,"info");return;case"open":case"reveal":case"edit":xl(J.actions.editPlaceholder,"info");return;case"run-benchmark":xl(J.toasts.benchmarkQueued,"info");return;case"duplicate":xl(J.toasts.skillDuplicated,"info");return;case"update":xl(J.toasts.skillUpdated,"info");return;case"uninstall":xl(J.actions.editPlaceholder,"info");return;default:return}}const hC=g.lazy(()=>Tu(()=>import("./CommandPalette-BSGTaiI4.js"),__vite__mapDeps([2,1])));function xC(){return n.jsx(vb,{children:n.jsx(hb,{children:n.jsxs(cw,{children:[n.jsx(gC,{}),n.jsx(yw,{})]})})})}function gC(){var ve,_e;const{state:a,selectSkill:r,clearSelection:i,refreshSkills:o,outdatedByOrigin:d}=ya(),{config:p}=bl(),{mode:f,resolvedTheme:h,setTheme:x}=vg(),{toast:m}=qu(),[y,v]=g.useState(()=>D2()),[j]=g.useState(!0),[S,k]=g.useState(!1),[A,T]=g.useState(!1),[C,M]=g.useState(!1),[O,U]=g.useState("overview"),[L,V]=g.useState(cg),w=g.useCallback((re,Te)=>{V(pC(re,Te))},[]),D=Yw(),[E,B]=g.useState(()=>fC("activeAgent",null));g.useEffect(()=>{var re;!E&&((re=D.response)!=null&&re.suggested)&&B(D.response.suggested)},[E,(ve=D.response)==null?void 0:ve.suggested]);const P=g.useCallback(re=>{B(re),uC("activeAgent",re),typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:agent-changed",{detail:{agentId:re}}))},[]),F=g.useMemo(()=>D.response?Vw(D.response):[],[D.response]),{workspace:te,switchProject:Q,addProject:z,removeProject:R,activeProject:I}=Jw(),[Z,q]=g.useState(!1),[de,_]=g.useState(!1),[W,ie]=g.useState("standalone"),ue=g.useCallback((re="standalone")=>{ie(re),_(!0)},[]);g.useEffect(()=>{function re(Te){if(!(Te instanceof CustomEvent))return;const Qe=Te.detail;ue((Qe==null?void 0:Qe.mode)??"standalone")}return window.addEventListener("studio:request-create-skill",re),()=>window.removeEventListener("studio:request-create-skill",re)},[ue]);const[ge,xe]=g.useState(!1),[we,oe]=g.useState(null);g.useEffect(()=>{function re(){xe(!0)}return window.addEventListener("studio:open-marketplace",re),()=>window.removeEventListener("studio:open-marketplace",re)},[]);const Se=g.useMemo(()=>{const re=new Set;for(const Te of a.skills)Te.source==="plugin"&&Te.pluginName&&re.add(Te.pluginName);return re},[a.skills]);bu([{key:"p",meta:!0,handler:re=>{var Qe;const Te=typeof document<"u"?document.activeElement:null;Te&&Te.tagName==="INPUT"||((Qe=re==null?void 0:re.preventDefault)==null||Qe.call(re),q(at=>!at))}}],{enabled:!0});const De=zw();g.useEffect(()=>{function re(Te){if(!(Te instanceof CustomEvent))return;const Qe=Te.detail;Qe!=null&&Qe.provider&&De.open(Qe.provider)}return window.addEventListener("studio:open-setup-drawer",re),()=>window.removeEventListener("studio:open-setup-drawer",re)},[De]);const Ie=g.useCallback(()=>{V(cg)},[]);g.useEffect(()=>{function re(Te){if(!(Te instanceof CustomEvent))return;const Qe=Te.detail;Qe!=null&&Qe.message&&m({message:Qe.message,severity:Qe.severity??"info"})}return window.addEventListener("studio:toast",re),()=>window.removeEventListener("studio:toast",re)},[m]),g.useEffect(()=>{document.documentElement.style.setProperty("--sidebar-width",`${y}px`)},[y]);const ae=g.useMemo(()=>a.selectedSkill?a.skills.find(re=>re.plugin===a.selectedSkill.plugin&&re.skill===a.selectedSkill.skill)??null:null,[a.skills,a.selectedSkill]),pe=g.useCallback(re=>{r({plugin:re.plugin,skill:re.skill,origin:re.origin})},[r]),fe=g.useMemo(()=>{if(!a.selectedSkill)return"";const re=a.selectedSkill.origin==="installed"?"Installed":"Own";return`Viewing ${a.selectedSkill.skill} (${re})`},[a.selectedSkill]),he=g.useMemo(()=>[{id:"switch-theme",label:J.palette.actionSwitchTheme,description:"Cycle light / dark / auto",keywords:["theme","dark","light","mode"],onInvoke:()=>x(f==="light"?"dark":f==="dark"?"auto":"light")},{id:"toggle-sidebar",label:"Toggle sidebar",description:"Show or hide the skills sidebar",keywords:["sidebar","panel","hide","show","cmd+b"],onInvoke:()=>M(re=>!re)},{id:"show-shortcuts",label:"Show keyboard shortcuts",description:"Open the cheatsheet",keywords:["help","keys"],onInvoke:()=>T(!0)},{id:"refresh-skills",label:"Refresh skills",description:"Re-scan local + installed",keywords:["reload","scan"],onInvoke:()=>o()}],[f,x,o]);return bu([{key:"cmd+k",handler:()=>k(re=>!re)},{key:"ctrl+k",handler:()=>k(re=>!re)},{key:"?",handler:()=>T(re=>!re)},{key:"cmd+shift+d",handler:()=>x(h==="light"?"dark":"light")},{key:"ctrl+shift+d",handler:()=>x(h==="light"?"dark":"light")},{key:"cmd+b",handler:()=>M(re=>!re)},{key:"ctrl+b",handler:()=>M(re=>!re)},{key:"e",handler:()=>m({message:J.actions.editPlaceholder,severity:"info"})}]),n.jsxs(n.Fragment,{children:[n.jsx(yb,{sidebarWidth:y,sidebarHidden:C||a.isMobile&&a.mobileView==="detail",banner:n.jsx(B2,{connected:j}),liveMessage:fe,topRail:n.jsx(v0,{projectName:(p==null?void 0:p.projectName)??null,selected:a.selectedSkill,onOpenPalette:()=>k(!0),onHome:i,onRequestCreateSkill:()=>ue("standalone"),projectPickerSlot:te&&te.projects.length>0?n.jsx(eC,{workspace:te,onSwitch:Q,onAdd:z,onRemove:R}):void 0}),sidebar:n.jsx(N2,{skills:a.skills,selectedKey:a.selectedSkill?{plugin:a.selectedSkill.plugin,skill:a.selectedSkill.skill}:null,onSelect:pe,isLoading:a.skillsLoading,error:a.skillsError??null,onRetry:o,onContextMenu:w,outdatedByOrigin:d,activeAgentId:E,topSlot:D.status==="ready"&&F.length>0?n.jsxs(n.Fragment,{children:[n.jsx($w,{agents:F,activeAgentId:E,onActiveAgentChange:P,onOpenSetup:re=>De.open(re)}),n.jsx(qw,{activeAgentId:E})]}):null}),resizeHandle:n.jsx(O2,{initialWidth:y??Ss,onChange:v}),main:n.jsx(fw,{selectedSkillInfo:ae,activeDetailTab:O,onDetailTabChange:U,allSkills:a.skills,onSelectSkill:pe}),statusBar:n.jsx(R0,{projectPath:(p==null?void 0:p.root)??null,modelName:(p==null?void 0:p.model)??null,health:p!=null&&p.error?"degraded":"ok",providers:(_e=p==null?void 0:p.providers)==null?void 0:_e.map(re=>{const Te=re.id;return{id:Te,label:re.label,available:re.available,kind:Te==="ollama"||Te==="lm-studio"?"start-service":Te==="anthropic"||Te==="openrouter"?"api-key":"cli-install"}})})}),n.jsx(jw,{open:A,onClose:()=>T(!1)}),n.jsx(Nw,{open:De.isOpen,providerKey:De.providerKey,onClose:De.close}),n.jsx(kw,{state:L,onClose:Ie,onAction:(re,Te)=>mC(re,Te)}),S&&n.jsx(g.Suspense,{fallback:null,children:n.jsx(hC,{open:S,onClose:()=>k(!1),commands:he})}),n.jsx(nC,{open:Z,projects:(te==null?void 0:te.projects)??[],onSwitch:re=>{Q(re)},onClose:()=>q(!1)}),n.jsx(aC,{open:de,onClose:()=>_(!1),initialMode:W,isClaudeCode:E==="claude-code",projectRoot:(I==null?void 0:I.path)??(p==null?void 0:p.projectName)??"",onCreated:re=>{const Te=re.pluginName??"";o(),setTimeout(()=>{r({plugin:Te,skill:re.skillName,origin:"source"})},500)}}),n.jsx(rC,{open:ge,onClose:()=>xe(!1),installedNames:Se,onInstall:(re,Te)=>{oe({plugin:re,marketplace:Te,ref:`${re}@${Te}`}),xe(!1)}}),n.jsx(cC,{job:we,onDone:re=>{re.ok&&setTimeout(()=>oe(null),3e3)}})]})}const dg="vskill.migrations.scope-rename.v1",vC={own:"authoring-project",installed:"available-project",global:"available-personal"},yC=/^vskill-sidebar-(.+)-(own|installed|global)-collapsed$/;function bC(a){if(a.getItem(dg)==="done")return;const r=[];for(let i=0;i<a.length;i++){const o=a.key(i);if(!o)continue;const d=o.match(yC);if(!d)continue;const[,p,f]=d,h=vC[f];if(!h)continue;const x=a.getItem(o);x!==null&&r.push({oldKey:o,newKey:`vskill-sidebar-${p}-${h}-collapsed`,value:x})}for(const{oldKey:i,newKey:o,value:d}of r)a.getItem(o)===null&&a.setItem(o,d),a.removeItem(i);a.setItem(dg,"done")}if(typeof PerformanceObserver<"u")try{const a=new PerformanceObserver(r=>{for(const i of r.getEntries())if(i.name==="first-contentful-paint"){window.__vskillPaint=i.startTime,a.disconnect();return}});a.observe({type:"paint",buffered:!0})}catch{}if(typeof window<"u"&&window.localStorage)try{bC(window.localStorage)}catch{}K1.createRoot(document.getElementById("root")).render(n.jsx(g.StrictMode,{children:n.jsx(w0,{children:n.jsx(xC,{})})}));export{n as j,g as r,J as s};
|
package/dist/eval-ui/index.html
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
}
|
|
47
47
|
})();
|
|
48
48
|
</script>
|
|
49
|
-
<script type="module" crossorigin src="/assets/index-
|
|
49
|
+
<script type="module" crossorigin src="/assets/index-BoCK_s7q.js"></script>
|
|
50
50
|
<link rel="stylesheet" crossorigin href="/assets/index-D5FxVeoM.css">
|
|
51
51
|
<link rel="stylesheet" crossorigin href="/assets/fonts-i7Lkz2zN.css">
|
|
52
52
|
</head>
|