@cline/cli-windows-x64 3.0.30 → 3.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-CPvDmBTC.js";import{E as r,T as i,c as a,w as ee,y as o}from"./vscode-DK7ayvks.js";import{a as s,i as c,n as l,r as u,t as d}from"./desktop-client-Cbu3aJ5_.js";import{i as f,r as p,t as m}from"./switch-O5JzNA9x.js";import{H as h,K as g,L as _,R as v,V as y,i as te,o as ne,s as re}from"./index-COgdQxvL.js";import{n as b,t as x}from"./badge-CCf0mJUQ.js";var S=i(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),C=i(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),w=e(t(),1),T=`/api/marketplace/catalog`,E={version:1,counts:{total:0,plugins:0,skills:0,mcps:0},tags:[],entries:[]};function D(e){return e===`mcp`||e===`skill`||e===`plugin`}function O(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function k(e){return typeof e==`number`&&Number.isFinite(e)?e:0}function A(e){if(!Array.isArray(e))return;let t=e.map(e=>{if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.name!=`string`)return null;let n={name:t.name};return typeof t.required==`boolean`&&(n.required=t.required),typeof t.description==`string`&&(n.description=t.description),typeof t.url==`string`&&(n.url=t.url),n}).filter(e=>e!==null);return t.length>0?t:void 0}async function ie(){let e=await fetch(T,{headers:{Accept:`application/json`}});if(!e.ok)throw Error(`Failed to fetch marketplace: ${e.status}`);let t=await e.json(),n=typeof t?.baseUrl==`string`?t.baseUrl:void 0,r=typeof t?.counts==`object`&&t.counts!==null?t.counts:{},i=Array.isArray(t?.tags)?t.tags.map(e=>{if(!e||typeof e!=`object`)return null;let t=e;return typeof t.id!=`string`||typeof t.label!=`string`?null:{id:t.id,label:t.label,count:k(t.count)}}).filter(e=>e!==null):[],a=Array.isArray(t?.entries)?t.entries.map(e=>{if(!e||typeof e!=`object`)return null;let t=e,n=typeof t.install==`object`&&t.install!==null?t.install:{};return typeof t.id!=`string`||!D(t.type)||typeof t.name!=`string`||typeof t.tagline!=`string`||typeof t.description!=`string`||typeof n.command!=`string`?null:{id:t.id,type:t.type,name:t.name,featured:typeof t.featured==`boolean`?t.featured:void 0,tagline:t.tagline,description:t.description,tags:O(t.tags),install:{args:O(n.args),command:n.command,env:A(n.env),notes:typeof n.notes==`string`?n.notes:void 0}}}).filter(e=>e!==null&&e.install.args.length>0):[];return{version:k(t?.version)||E.version,generatedAt:typeof t?.generatedAt==`string`?t.generatedAt:void 0,baseUrl:n,counts:{total:k(r.total)||a.length,plugins:k(r.plugins),skills:k(r.skills),mcps:k(r.mcps)},tags:i,entries:a}}var j=n(),M=3e5,N={fontFamily:`ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace`},P={mcp:{title:`MCP Servers`,description:`Install Model Context Protocol servers into this CLI environment.`,emptyInstalled:`No MCP servers installed.`,emptyCatalog:`No MCP servers match the current filters.`,icon:v},skill:{title:`Skills`,description:`Install skills globally for Cline.`,emptyInstalled:`No skills installed.`,emptyCatalog:`No skills match the current filters.`,icon:l},plugin:{title:`Plugins`,description:`Install plugins into this CLI environment.`,emptyInstalled:`No plugins installed.`,emptyCatalog:`No plugins match the current filters.`,icon:S}},F={mcp:`cline mcp install`,plugin:`cline plugin install`,skill:`cline skill add`};function I(e){return`${e.type}:${e.id}`}function ae(e,t){return Number(!!t.featured)-Number(!!e.featured)}function L(e){return e.trim().toLowerCase()}function R(e){return new Set([e.id,e.name,...e.install.args].map(L).filter(Boolean))}function oe(e,t){let n=R(e);return t.matchValues.map(L).filter(Boolean).some(e=>n.has(e))}function se(e,t){return[e.name,e.tagline,e.description,e.type,...e.tags.map(e=>t.get(e)??e)].join(` `).toLowerCase()}function z(e){if(e?.status===`installed`||e?.status===`uninstalled`||e?.status===`failed`)return e.message}function B({actionState:e,entry:t}){let n=t.install.env?.filter(e=>e.required!==!1)??[],r=t.install.env?.filter(e=>e.required===!1)??[];return n.length>0||r.length>0||t.install.notes||e?.status===`failed`?(0,j.jsxs)(`div`,{className:`grid gap-3 border-t pt-3`,"data-marketplace-entry-details":!0,children:[n.length>0||r.length>0?(0,j.jsxs)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 p-3`,children:[(0,j.jsx)(`p`,{className:`text-sm font-medium text-amber-800 dark:text-amber-200`,children:`Environment setup needed`}),(0,j.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-amber-800/80 dark:text-amber-100/80`,children:`Add these values to your Cline/plugin environment after install.`}),(0,j.jsx)(`div`,{className:`mt-3 grid gap-2`,children:[...n,...r].map(e=>(0,j.jsxs)(`div`,{className:`rounded-md border border-amber-500/20 bg-background/60 p-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`code`,{className:`font-mono text-xs font-semibold`,children:(0,j.jsx)(`span`,{style:N,children:e.name})}),(0,j.jsx)(x,{variant:`outline`,children:e.required===!1?`Optional`:`Required`})]}),e.description?(0,j.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e.description}):null,e.url?(0,j.jsxs)(`a`,{className:`mt-1 inline-flex items-center gap-1 text-xs text-primary hover:underline`,href:e.url,rel:`noreferrer`,target:`_blank`,children:[`Get value`,(0,j.jsx)(s,{className:`size-3`})]}):null]},e.name))})]}):null,t.install.notes?(0,j.jsx)(`p`,{className:`rounded-lg border bg-muted/30 p-3 text-xs leading-5 text-muted-foreground`,children:t.install.notes}):null,e?.status===`failed`?(0,j.jsx)(`div`,{className:`max-h-44 overflow-auto rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:e.message}):null]}):null}function ce({actionState:e,entry:t,expanded:n,installed:i,installedStatusReady:a,onInstall:s,onToggleExpanded:c,onUninstall:l,matchedLocalItems:d=[],showFeatured:f=!0,showTags:p=!0,sourceLabel:m,tagLabels:h}){let g=P[t.type].icon,_=e?.status===`installing`||e?.status===`uninstalling`,v=!!t.install.env?.length,y=v||!!t.install.notes||e?.status===`failed`,te=z(e),ne=e=>{if(e.stopPropagation(),i){l(t);return}s(t)},re=a?e?.status===`installing`?`Installing...`:e?.status===`uninstalling`?`Uninstalling...`:i?`Uninstall`:`Install`:`Checking...`,S=te?(0,j.jsx)(`output`,{className:r(`text-xs`,e?.status===`failed`?`text-destructive`:`text-muted-foreground`),children:te}):v?(0,j.jsx)(`span`,{className:`text-xs text-amber-700 dark:text-amber-300`,children:`Requires setup after install`}):null,C=(0,j.jsxs)(o,{disabled:!a||_,onClick:ne,size:`sm`,type:`button`,variant:i?`destructive`:`default`,children:[_||!a?(0,j.jsx)(b,{}):null,i&&!_?(0,j.jsx)(ee,{className:`size-4`}):null,re]}),w=(0,j.jsxs)(j.Fragment,{children:[i?null:(0,j.jsx)(`div`,{className:`absolute top-4 right-4`,"data-marketplace-entry-interactive":!0,children:C}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[(0,j.jsxs)(`div`,{className:r(`flex min-w-0 flex-1 items-center gap-2`,!i&&`pr-24`),children:[(0,j.jsx)(g,{className:`h-4 w-4 shrink-0 text-primary`}),(0,j.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-foreground`,children:t.name}),f&&t.featured?(0,j.jsxs)(x,{className:`border border-violet-500/20 bg-violet-500/10 text-violet-700 dark:text-violet-300`,children:[(0,j.jsx)(u,{className:`fill-current`}),`Featured`]}):null]}),(0,j.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2`,children:[m?(0,j.jsx)(x,{variant:`outline`,className:`shrink-0 text-muted-foreground`,children:m}):null,d.map(e=>e.renderMatchedBadges?(0,j.jsx)(`span`,{className:`contents`,children:e.renderMatchedBadges()},`${e.key}:badges`):null),d.map(e=>e.renderMatchedControls?(0,j.jsx)(`span`,{className:`contents`,"data-marketplace-entry-interactive":!0,children:e.renderMatchedControls()},`${e.key}:controls`):null)]})]}),d.some(e=>e.renderMatchedMeta)?(0,j.jsx)(`div`,{className:`mt-1 grid gap-1`,children:d.map(e=>e.renderMatchedMeta?(0,j.jsx)(`div`,{children:e.renderMatchedMeta()},`${e.key}:meta`):null)}):null]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-stretch sm:justify-between`,children:[(0,j.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-2`,children:[p&&t.tags.length>0?(0,j.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.tags.slice(0,5).map(e=>(0,j.jsx)(x,{variant:`outline`,className:`max-w-full text-muted-foreground`,children:(0,j.jsx)(`span`,{className:`truncate`,children:h.get(e)??e})},e))}):null,(0,j.jsx)(`p`,{className:`line-clamp-2 text-xs leading-5 text-muted-foreground`,children:t.description}),S]}),i?(0,j.jsx)(`div`,{className:`flex shrink-0 flex-col items-start gap-1 sm:items-end sm:justify-end`,children:C}):null]}),d.some(e=>e.renderMatchedDetails)?(0,j.jsx)(`div`,{className:`grid gap-2`,"data-marketplace-entry-details":!0,children:d.map(e=>e.renderMatchedDetails?(0,j.jsx)(`div`,{children:e.renderMatchedDetails()},e.key):null)}):null,n&&y?(0,j.jsx)(B,{actionState:e,entry:t}):null]});return y?(0,j.jsx)(`div`,{"aria-expanded":n,"aria-label":`${n?`Collapse`:`Expand`} ${t.name}`,className:`relative grid cursor-pointer gap-2 rounded-lg border bg-card p-4 text-left transition-colors hover:bg-accent/20 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none`,onClick:e=>{e.target instanceof HTMLElement&&e.target.closest(`[data-marketplace-entry-details], [data-marketplace-entry-interactive]`)||c(t)},onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c(t))},role:`button`,tabIndex:0,children:w}):(0,j.jsx)(`div`,{className:`relative grid gap-2 rounded-lg border bg-card p-4 text-left transition-colors hover:bg-accent/20`,children:w})}function V({active:e,count:t,onClick:n,tag:r}){return(0,j.jsxs)(o,{"aria-pressed":e,onClick:n,size:`sm`,type:`button`,variant:e?`default`:`outline`,children:[(0,j.jsx)(`span`,{className:`truncate`,children:r.label}),(0,j.jsx)(`span`,{className:`rounded bg-background/30 px-1.5 py-0.5 text-xs`,children:t})]})}function H({actionStates:e,emptyMessage:t,entries:n,expandedEntryKey:r,headerContent:i,installedEntryKeys:a,installedStatusReady:ee,localOnlyInstalledItems:o=[],matchedLocalItemsByEntryKey:s,onInstall:c,onToggleExpanded:l,onUninstall:u,showFeaturedBadges:d=!0,showEntryTags:f=!0,sourceLabel:p,tagLabels:m,title:h}){let g=n.length+o.length;return(0,j.jsxs)(`section`,{className:`grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:h}),(0,j.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:g})]}),i,g>0?(0,j.jsxs)(`div`,{className:`grid gap-3`,children:[o.map(e=>e.render()),n.map(t=>{let n=I(t);return(0,j.jsx)(ce,{actionState:e.get(n),entry:t,expanded:r===n,installed:a.has(n),installedStatusReady:ee,onInstall:c,onToggleExpanded:l,onUninstall:u,matchedLocalItems:s?.get(n)??[],showFeatured:d,showTags:f,sourceLabel:p,tagLabels:m},n)})]}):(0,j.jsx)(`div`,{className:`rounded-lg border border-dashed bg-card p-6 text-center text-sm text-muted-foreground`,children:t})]})}function le({chrome:e=`page`,installedItems:t,onInstalledItemsChanged:n,primitive:r}){let[i,ee]=(0,w.useState)(null),[s,c]=(0,w.useState)(null),[l,u]=(0,w.useState)(``),[f,m]=(0,w.useState)(null),[h,g]=(0,w.useState)(null),[_,v]=(0,w.useState)(()=>new Set),[y,x]=(0,w.useState)(()=>new Map),[S,C]=(0,w.useState)(`loading`);(0,w.useEffect)(()=>{let e=!1;return(async()=>{try{e||C(`loading`);let t=await ie();e||(ee(t),c(null));try{let n=await d.invoke(`list_marketplace_installed_entries`,{entries:t.entries});e||(v(new Set(n.installedKeys)),C(`ready`))}catch{e||C(`ready`)}}catch(t){e||(c(t instanceof Error?t.message:String(t)),C(`ready`))}})(),()=>{e=!0}},[]);let T=P[r],E=T.icon,D=(0,w.useMemo)(()=>new Map(i?.tags.map(e=>[e.id,e.label])??[]),[i?.tags]),O=(0,w.useMemo)(()=>(i?.entries.filter(e=>e.type===r)??[]).sort(ae),[i?.entries,r]),k=(0,w.useMemo)(()=>{let e=l.trim().toLowerCase();return O.filter(t=>e.length===0||se(t,D).includes(e))},[O,l,D]),A=(0,w.useMemo)(()=>k.filter(e=>_.has(I(e))),[k,_]),N=(0,w.useMemo)(()=>k.filter(e=>!_.has(I(e))),[k,_]),R=(0,w.useMemo)(()=>{let e=new Map;for(let t of N)for(let n of t.tags)e.set(n,(e.get(n)??0)+1);return e},[N]),z=(0,w.useMemo)(()=>(i?.tags??[]).filter(e=>(R.get(e.id)??0)>0),[i?.tags,R]),B=(0,w.useMemo)(()=>N.filter(e=>!f||e.tags.includes(f)),[N,f]),ce=(0,w.useMemo)(()=>{let e=new Map;for(let n of t??[])for(let t of A){let r=I(t);if(!oe(t,n))continue;let i=e.get(r)??[];i.push(n),e.set(r,i)}return e},[A,t]),le=(0,w.useMemo)(()=>{let e=new Set,n=O.filter(e=>_.has(I(e)));for(let r of t??[])n.some(e=>oe(e,r))&&e.add(r.key);return e},[_,t,O]),ue=(0,w.useMemo)(()=>{let e=l.trim().toLowerCase();return(t??[]).filter(t=>le.has(t.key)?!1:e.length===0||t.matchValues.map(L).some(t=>t.includes(e)))},[t,le,l]),U=S===`ready`,de=z.length>0?(0,j.jsxs)(`div`,{className:`flex flex-col gap-2 md:flex-row md:items-center md:justify-between`,children:[(0,j.jsx)(`div`,{className:`flex gap-2 overflow-x-auto pb-1`,children:z.map(e=>(0,j.jsx)(V,{active:f===e.id,count:R.get(e.id)??0,onClick:()=>m(t=>t===e.id?null:e.id),tag:e},e.id))}),(0,j.jsxs)(`div`,{className:`flex min-h-8 shrink-0 items-center gap-2 text-sm text-muted-foreground`,children:[(0,j.jsx)(`span`,{className:`font-medium text-foreground`,children:B.length}),(0,j.jsx)(`span`,{children:B.length===1?`result`:`results`}),f?(0,j.jsx)(o,{onClick:()=>m(null),size:`sm`,type:`button`,variant:`ghost`,children:`Clear filters`}):null]})]}):null,W=(e,t)=>{let n=I(e);x(e=>{let r=new Map(e);return r.set(n,t),r})},fe=e=>{v(t=>new Set(t).add(I(e)))},G=e=>{v(t=>{let n=new Set(t);return n.delete(I(e)),n})},pe=e=>{let t=I(e);g(e=>e===t?null:t)},K=async e=>{let t=I(e),r=y.get(t);if(!(r?.status===`installing`||r?.status===`uninstalling`)){g(t),W(e,{status:`installing`});try{W(e,{status:`installed`,message:(await d.invoke(`install_marketplace_entry`,{entry:e},{timeoutMs:M})).message}),fe(e),await n?.()}catch(t){W(e,{status:`failed`,message:t instanceof Error?t.message:String(t)})}}},q=async e=>{let t=I(e),r=y.get(t);if(!(r?.status===`installing`||r?.status===`uninstalling`)){g(t),W(e,{status:`uninstalling`});try{W(e,{status:`uninstalled`,message:(await d.invoke(`uninstall_marketplace_entry`,{entry:e},{timeoutMs:M})).message}),G(e),await n?.()}catch(t){W(e,{status:`failed`,message:t instanceof Error?t.message:String(t)})}}},me=(0,j.jsxs)(`div`,{className:`grid gap-6`,children:[e===`page`?(0,j.jsx)(re,{description:T.description,icon:E,title:T.title,meta:(0,j.jsx)(te,{children:F[r]}),actions:i?.generatedAt?(0,j.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Updated`,` `,new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,year:`numeric`}).format(new Date(i.generatedAt))]}):null}):null,!i&&!s?(0,j.jsxs)(`div`,{className:`flex min-h-80 items-center justify-center rounded-lg border bg-card text-sm text-muted-foreground`,children:[(0,j.jsx)(b,{className:`mr-2`}),`Loading marketplace...`]}):null,i&&!U?(0,j.jsxs)(`div`,{className:`flex min-h-80 items-center justify-center rounded-lg border bg-card text-sm text-muted-foreground`,children:[(0,j.jsx)(b,{className:`mr-2`}),`Checking installed status...`]}):null,s?(0,j.jsx)(`div`,{className:`rounded-lg border border-destructive/40 bg-destructive/10 p-4 text-sm text-destructive`,children:s}):null,i&&U?(0,j.jsxs)(`div`,{className:`grid gap-6`,children:[(0,j.jsx)(`div`,{className:`grid gap-3`,children:(0,j.jsx)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-center`,children:(0,j.jsxs)(`div`,{className:`relative block flex-1`,children:[(0,j.jsx)(p,{className:`pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`}),(0,j.jsx)(a,{"aria-label":`Search ${T.title}`,className:`h-10 pl-8`,onChange:e=>u(e.target.value),placeholder:`Search ${T.title.toLowerCase()}`,value:l})]})})}),(0,j.jsx)(H,{actionStates:y,emptyMessage:T.emptyInstalled,entries:A,expandedEntryKey:h,installedEntryKeys:_,installedStatusReady:U,localOnlyInstalledItems:ue,matchedLocalItemsByEntryKey:ce,onInstall:K,onToggleExpanded:pe,onUninstall:q,showFeaturedBadges:!1,showEntryTags:!1,sourceLabel:`Marketplace`,tagLabels:D,title:`Installed`}),(0,j.jsx)(H,{actionStates:y,emptyMessage:T.emptyCatalog,entries:B,expandedEntryKey:h,headerContent:de,installedEntryKeys:_,installedStatusReady:U,onInstall:K,onToggleExpanded:pe,onUninstall:q,tagLabels:D,title:`Marketplace`})]}):null]});return e===`embedded`?me:(0,j.jsx)(ne,{children:me})}var ue={Rules:`Review project and global rule files that shape Cline behavior.`,Hooks:`Inspect hook configuration and recent execution status.`,MCP:`Manage installed MCP servers and add new servers from the marketplace.`,Skills:`Manage installed skills and add new skills from the marketplace.`,Agents:`Review configured agents discovered from local settings.`,Plugins:`Manage installed plugins and add new plugins from the marketplace.`,Tools:`Inspect built-in tools and tools contributed by plugins.`},U={Rules:`cline config rules`,Hooks:`cline config hooks`,MCP:`cline mcp install`,Skills:`cline skill`,Agents:`cline config agents`,Plugins:`cline plugin`,Tools:`cline config tools`},de={settingsPath:``,hasSettingsFile:!1,servers:[]};function W(e){return Array.isArray(e)?e:[]}function fe(e){return{workspaceRoot:typeof e?.workspaceRoot==`string`?e.workspaceRoot:``,rules:W(e?.rules),workflows:W(e?.workflows),skills:W(e?.skills),agents:W(e?.agents),plugins:W(e?.plugins),tools:W(e?.tools),hooks:W(e?.hooks),mcp:e?.mcp&&typeof e.mcp==`object`?{settingsPath:typeof e.mcp.settingsPath==`string`?e.mcp.settingsPath:``,hasSettingsFile:!!e.mcp.hasSettingsFile,servers:W(e.mcp.servers)}:{...de},warnings:W(e?.warnings)}}var G=6e4,pe=3e4,K=null,q=null;function me(e,t){return!!(e&&t-e.fetchedAt<G&&Array.isArray(e.tools)&&e.tools.length>0)}function he(e,t=150){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t).trimEnd()}...`}function J(e){return e.replaceAll(`\\`,`/`)}function ge(e,t){let n=J(t),r=J(e);return n&&r.startsWith(`${n}/`)?`Project`:`Global`}function Y({scope:e}){return(0,j.jsx)(x,{variant:`outline`,className:`shrink-0 text-muted-foreground`,children:e})}function _e(...e){let t=new Set;for(let n of e){let e=n?.trim().replaceAll(`\\`,`/`);if(!e)continue;t.add(e);let r=e.split(`/`).filter(Boolean);for(let e of r)t.add(e.replace(/\.[^.]+$/,``));for(let e=0;e<r.length-1;e+=1)t.add(`${r[e]}/${r[e+1]}`)}return[...t]}async function ve(){return fe(await d.invoke(`list_user_instruction_configs`))}function ye(e,t){return(e instanceof Error?e.message:String(e)).includes(`unsupported desktop command: ${t}`)}function be({catalogPrimitive:e,section:t=`Rules`,showTabs:n=!1}){let[i,a]=(0,w.useState)(t),[s,u]=(0,w.useState)(()=>!me(K,Date.now())),[p,T]=(0,w.useState)(null),[E,D]=(0,w.useState)(()=>K?.workspaceRoot??``),[O,k]=(0,w.useState)(()=>K?.rules??[]),[A,ie]=(0,w.useState)(()=>K?.workflows??[]),[M,N]=(0,w.useState)(()=>K?.skills??[]),[P,F]=(0,w.useState)(()=>K?.agents??[]),[I,ae]=(0,w.useState)(()=>K?.plugins??[]),[L,R]=(0,w.useState)(()=>K?.tools??[]),[oe,se]=(0,w.useState)(()=>K?.hooks??[]),[z,B]=(0,w.useState)(()=>K?.mcp??de),[ce,V]=(0,w.useState)(()=>K?.warnings??[]),[H,W]=(0,w.useState)(()=>q?.hookExecutionByEvent??{}),[G,be]=(0,w.useState)(()=>q?.hookExecutionSessionId??null),[xe,Se]=(0,w.useState)(!1),[X,Ce]=(0,w.useState)(()=>new Set),[we,Te]=(0,w.useState)(()=>new Set),[Ee,De]=(0,w.useState)(()=>new Set),[Oe,ke]=(0,w.useState)(()=>new Map);(0,w.useEffect)(()=>{a(t)},[t]);let Z=(0,w.useCallback)(async(e=!1)=>{if(!e&&me(K,Date.now())){D(K.workspaceRoot),k(K.rules),ie(K.workflows),N(K.skills),F(K.agents),ae(K.plugins),R(K.tools),se(K.hooks),B(K.mcp),V(K.warnings),T(null),u(!1);return}u(!0),T(null);try{let e=await ve();D(e.workspaceRoot),k(e.rules),ie(e.workflows),N(e.skills),F(e.agents),ae(e.plugins),R(e.tools),se(e.hooks),B(e.mcp),V(e.warnings),K={...e,fetchedAt:Date.now()}}catch(e){T(e instanceof Error?e.message:String(e))}finally{u(!1)}},[]),Ae=(0,w.useCallback)(async(e=!1)=>{if(!e&&q&&Date.now()-q.fetchedAt<pe){W(q.hookExecutionByEvent),be(q.hookExecutionSessionId);return}Se(!0);try{let e=(await d.invoke(`list_cli_sessions`,{limit:300})??[]).filter(e=>typeof e.sessionId==`string`&&e.sessionId.trim().length>0).sort((e,t)=>(t.startedAt??``).localeCompare(e.startedAt??``))[0];if(!e?.sessionId){W({}),be(null),q={hookExecutionByEvent:{},hookExecutionSessionId:null,fetchedAt:Date.now()};return}let t=await d.invoke(`read_session_hooks`,{sessionId:e.sessionId,limit:5e3}),n={};for(let e of t??[]){let t=e.hookEventName?.trim();if(!t)continue;let r=n[t]??{count:0,lastTs:null};r.count+=1,e.ts&&(!r.lastTs||e.ts>r.lastTs)&&(r.lastTs=e.ts),n[t]=r}W(n),be(e.sessionId),q={hookExecutionByEvent:n,hookExecutionSessionId:e.sessionId,fetchedAt:Date.now()}}catch{}finally{Se(!1)}},[]),je=(0,w.useCallback)(e=>{let t=fe(e);D(t.workspaceRoot),k(t.rules),ie(t.workflows),N(t.skills),F(t.agents),ae(t.plugins),R(t.tools),se(t.hooks),B(t.mcp),V(t.warnings),K={...t,fetchedAt:Date.now()}},[]),Q=(0,w.useCallback)(async e=>{Ce(t=>new Set(t).add(e.id)),T(null);try{let t=[e.name,...e.headlessToolNames??[]].filter(Boolean);if(t.length===0)throw Error(`tool name is required`);let n;try{n=await d.invoke(`set_tool_disabled`,{names:t,disabled:e.enabled})}catch(e){if(!ye(e,`set_tool_disabled`))throw e;for(let e of t)n=await d.invoke(`toggle_disabled_plugin_tool`,{name:e})}if(!n)throw Error(`tool toggle did not return an updated extension list`);je(n)}catch(e){T(e instanceof Error?e.message:String(e))}finally{Ce(t=>{let n=new Set(t);return n.delete(e.id),n})}},[je]),Me=(0,w.useCallback)(async e=>{Te(t=>new Set(t).add(e.path)),T(null);try{je(await d.invoke(`set_plugin_disabled`,{path:e.path,disabled:e.enabled}))}catch(e){T(e instanceof Error?e.message:String(e))}finally{Te(t=>{let n=new Set(t);return n.delete(e.path),n})}},[je]),Ne=(0,w.useCallback)(async e=>{if(!Ee.has(e.key)){De(t=>new Set(t).add(e.key)),ke(t=>{let n=new Map(t);return n.delete(e.key),n}),T(null);try{let t=await d.invoke(`uninstall_local_primitive`,{type:e.type,id:e.id,name:e.name,path:e.path});ke(n=>{let r=new Map(n);return r.set(e.key,{status:`success`,message:t.message??`Uninstalled ${e.name??e.id??e.path}.`}),r}),await Z(!0)}catch(t){let n=t instanceof Error?t.message:String(t);ke(t=>{let r=new Map(t);return r.set(e.key,{status:`failed`,message:n}),r}),T(n)}finally{De(t=>{let n=new Set(t);return n.delete(e.key),n})}}},[Ee,Z]),Pe=(0,w.useCallback)(e=>{if(!e)return`never`;let t=Number(e),n=Number.isFinite(t)?new Date(t):new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleString()},[]);(0,w.useEffect)(()=>{let e=window.setTimeout(()=>{Z(!1)},0);return()=>window.clearTimeout(e)},[Z]),(0,w.useEffect)(()=>{if(i!==`Hooks`)return;let e=window.setTimeout(()=>{Ae(!1)},0);return()=>window.clearTimeout(e)},[i,Ae]);let Fe=[`Rules`,`Hooks`,`Skills`,`Agents`,`Plugins`,`Tools`],Ie=(0,w.useMemo)(()=>{let e=A.map(e=>({id:e.id,type:`workflow`,name:e.name,instructions:e.instructions,path:e.path,scope:ge(e.path,E)})),t=M.map(e=>({id:J(e.path).toLowerCase(),type:`skill`,name:e.name,description:e.description,instructions:e.instructions,path:e.path,scope:ge(e.path,E)}));return[...e,...t].sort((e,t)=>e.name.localeCompare(t.name))},[M,A,E]),{projectRules:Le,globalRules:Re}=(0,w.useMemo)(()=>{let e=J(E),t=[],n=[];for(let r of O){let i=J(r.path);e&&i.startsWith(`${e}/`)&&i.includes(`/.clinerules/`)?t.push(r):n.push(r)}return{projectRules:t,globalRules:n}},[O,E]),{projectHooks:ze,globalHooks:Be}=(0,w.useMemo)(()=>{let e=J(E),t=[],n=[];for(let r of oe){let i=J(r.path);e&&i.startsWith(`${e}/`)&&i.includes(`/.clinerules/hooks`)?t.push(r):n.push(r)}return{projectHooks:t,globalHooks:n}},[oe,E]),{projectPlugins:Ve,globalPlugins:He}=(0,w.useMemo)(()=>{let e=J(E),t=[],n=[];for(let r of I){let i=J(r.path);e&&i.startsWith(`${e}/`)&&i.includes(`/.cline/plugins`)?t.push(r):n.push(r)}return{projectPlugins:t,globalPlugins:n}},[I,E]),Ue=(0,w.useMemo)(()=>L.filter(e=>e.source===`builtin`),[L]),We=(0,w.useMemo)(()=>L.filter(e=>e.source!==`builtin`),[L]),$=(0,w.useMemo)(()=>{let e=new Map;for(let t of We){let n=`${t.pluginName??``}:${t.path??``}`,r=e.get(n)??[];r.push(t),e.set(n,r)}for(let t of e.values())t.sort((e,t)=>e.name.localeCompare(t.name));return e},[We]),Ge=(0,w.useMemo)(()=>[...He.map(e=>({plugin:e,scope:`Global`})),...Ve.map(e=>({plugin:e,scope:`Project`}))],[He,Ve]),Ke=(0,w.useMemo)(()=>[...Re.map(e=>({rule:e,scope:`Global`})),...Le.map(e=>({rule:e,scope:`Project`}))],[Re,Le]),qe=(0,w.useMemo)(()=>[...Be.map(e=>({hook:e,scope:`Global`})),...ze.map(e=>({hook:e,scope:`Project`}))],[Be,ze]),Je=e=>{let t=Oe.get(e);return t?(0,j.jsx)(`output`,{className:r(`text-xs`,t.status===`failed`?`text-destructive`:`text-muted-foreground`),children:t.message}):null},Ye=e=>{let t=Ee.has(e.key);return(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,j.jsx)(`div`,{className:`min-h-5 text-xs text-muted-foreground`,children:Je(e.key)}),(0,j.jsxs)(o,{disabled:t,onClick:()=>{Ne(e)},type:`button`,variant:`destructive`,children:[t?(0,j.jsx)(b,{}):(0,j.jsx)(ee,{className:`size-4`}),t?`Uninstalling...`:`Uninstall`]})]})},Xe=e=>{let t=`${e.type}:${e.path}`;return(0,j.jsxs)(`div`,{className:`rounded-lg border border-border px-5 py-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.type===`workflow`?(0,j.jsx)(f,{className:`h-4 w-4 shrink-0 text-primary`}):(0,j.jsx)(l,{className:`h-4 w-4 shrink-0 text-primary`}),(0,j.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-semibold text-foreground`,children:e.name}),(0,j.jsx)(Y,{scope:e.scope}),(0,j.jsx)(x,{variant:`outline`,className:`shrink-0 text-muted-foreground`,children:e.type})]}),(0,j.jsx)(`p`,{className:`mt-2 ml-7 text-xs text-muted-foreground`,children:e.description?.trim()||he(e.instructions)}),(0,j.jsx)(`p`,{className:`mt-1 ml-7 text-xs font-mono text-muted-foreground`,children:e.path}),(0,j.jsx)(`div`,{className:`mt-3`,children:Ye({key:t,type:e.type,id:e.id,name:e.name,path:e.path})})]},t)},Ze=e=>(0,j.jsxs)(`div`,{className:`grid gap-1`,children:[(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.description?.trim()||he(e.instructions)}),(0,j.jsx)(`p`,{className:`text-xs font-mono text-muted-foreground`,children:e.path})]}),Qe=({plugin:e,scope:t})=>{let n=e.path;return(0,j.jsxs)(`div`,{className:`rounded-lg border border-border px-5 py-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(S,{className:`h-4 w-4 shrink-0 text-primary`}),(0,j.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-semibold text-foreground`,children:e.name}),(0,j.jsx)(Y,{scope:t}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.enabled?`Enabled`:`Disabled`}),(0,j.jsx)(m,{checked:e.enabled,onCheckedChange:()=>{Me(e)},disabled:we.has(e.path),"aria-label":`Toggle ${e.name}`})]}),(0,j.jsx)(`p`,{className:`mt-1 ml-7 text-xs font-mono text-muted-foreground`,children:e.path}),(0,j.jsxs)(`div`,{className:`mt-3 ml-7 flex flex-col gap-2`,children:[($.get(`${e.name}:${e.path}`)??[]).map(t=>{let n=X.has(t.id);return(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-md border border-border/70 px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:t.name}),(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.description?.trim()||`No description available.`})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.enabled?`Enabled`:`Disabled`}),(0,j.jsx)(m,{checked:t.enabled,onCheckedChange:()=>{Q(t)},disabled:n||!e.enabled,"aria-label":`Toggle ${t.name}`})]})]},t.id)}),($.get(`${e.name}:${e.path}`)?.length??0)===0&&(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No plugin tools found.`})]}),(0,j.jsx)(`div`,{className:`mt-3`,children:Ye({key:n,type:`plugin`,id:e.name,name:e.name,path:e.path})})]},e.path)},$e=e=>(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.enabled?`Enabled`:`Disabled`}),(0,j.jsx)(m,{checked:e.enabled,onCheckedChange:()=>{Me(e)},disabled:we.has(e.path),"aria-label":`Toggle ${e.name}`})]}),et=e=>(0,j.jsx)(`p`,{className:`min-w-0 truncate text-xs font-mono text-muted-foreground`,children:e.path}),tt=e=>{let t=$.get(`${e.name}:${e.path}`)??[];return t.length===0?null:(0,j.jsx)(`div`,{className:`grid gap-2`,children:t.map(t=>{let n=X.has(t.id);return(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-md border border-border/70 px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:t.name}),(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.description?.trim()||`No description available.`})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.enabled?`Enabled`:`Disabled`}),(0,j.jsx)(m,{checked:t.enabled,onCheckedChange:()=>{Q(t)},disabled:n||!e.enabled,"aria-label":`Toggle ${t.name}`})]})]},t.id)})})},nt=e=>{let t=e.name;return(0,j.jsxs)(`div`,{className:`rounded-lg border border-border px-5 py-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(v,{className:`h-4 w-4 shrink-0 text-primary`}),(0,j.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-semibold text-foreground`,children:e.name}),(0,j.jsx)(Y,{scope:`Global`}),(0,j.jsx)(x,{variant:`outline`,className:`shrink-0 text-muted-foreground`,children:e.transportType}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.disabled?`Disabled`:`Enabled`})]}),(0,j.jsx)(`p`,{className:`mt-2 ml-7 text-xs text-muted-foreground`,children:e.url??([e.command,...e.args??[]].filter(Boolean).join(` `)||`No launch command configured.`)}),z.settingsPath?(0,j.jsx)(`p`,{className:`mt-1 ml-7 text-xs font-mono text-muted-foreground`,children:z.settingsPath}):null,(0,j.jsx)(`div`,{className:`mt-3`,children:Ye({key:t,type:`mcp`,id:e.name,name:e.name})})]},e.name)},rt=e=>(0,j.jsxs)(`div`,{className:`grid gap-1`,children:[(0,j.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.disabled?`Disabled`:`Enabled`,` locally`,e.transportType?` via ${e.transportType}`:``]}),z.settingsPath?(0,j.jsx)(`p`,{className:`text-xs font-mono text-muted-foreground`,children:z.settingsPath}):null]}),it=e===`skill`?Ie.map(e=>({key:`${e.type}:${e.path}`,matchValues:_e(e.id,e.name,e.path),render:()=>Xe(e),renderMatchedBadges:()=>(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Y,{scope:e.scope}),(0,j.jsx)(x,{variant:`outline`,className:`shrink-0 text-muted-foreground`,children:e.type})]}),renderMatchedDetails:()=>Ze(e)})):e===`plugin`?Ge.map(e=>({key:e.plugin.path,matchValues:_e(e.plugin.name,e.plugin.path),render:()=>Qe(e),renderMatchedBadges:()=>(0,j.jsx)(Y,{scope:e.scope}),renderMatchedControls:()=>$e(e.plugin),renderMatchedDetails:($.get(`${e.plugin.name}:${e.plugin.path}`)??[]).length>0?()=>tt(e.plugin):void 0,renderMatchedMeta:()=>et(e.plugin)})):e===`mcp`?z.servers.map(e=>({key:e.name,matchValues:_e(e.name),render:()=>nt(e),renderMatchedBadges:()=>(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Y,{scope:`Global`}),(0,j.jsx)(x,{variant:`outline`,className:`shrink-0 text-muted-foreground`,children:e.transportType})]}),renderMatchedDetails:()=>rt(e)})):null;return(0,j.jsxs)(ne,{children:[(0,j.jsx)(re,{description:ue[i],title:i,meta:(0,j.jsx)(te,{children:U[i]}),actions:(0,j.jsx)(o,{variant:`outline`,size:`sm`,onClick:()=>{Z(!0),i===`Hooks`&&Ae(!0)},disabled:s,children:(0,j.jsx)(c,{className:r(`h-4 w-4`,s&&`animate-spin`)})})}),n?(0,j.jsx)(`div`,{className:`mb-6 flex items-center gap-0 border-b border-border`,children:Fe.map(e=>(0,j.jsxs)(o,{variant:`ghost`,onClick:()=>a(e),className:r(`relative px-4 py-2.5 text-sm font-medium transition-colors`,i===e?`text-foreground`:`text-muted-foreground hover:text-foreground`),children:[e,i===e&&(0,j.jsx)(`span`,{className:`absolute inset-x-0 -bottom-px h-0.5 bg-foreground`})]},e))}):null,p&&(0,j.jsxs)(`div`,{className:`mb-4 rounded-lg border border-destructive/40 bg-destructive/10 px-4 py-3 text-sm text-destructive`,children:[`Failed to load configuration lists: `,p]}),ce.length>0&&(0,j.jsxs)(`div`,{className:`mb-4 rounded-lg border border-yellow-500/40 bg-yellow-500/10 px-4 py-3 text-sm text-yellow-700 dark:text-yellow-300`,children:[(0,j.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 font-medium`,children:[(0,j.jsx)(C,{className:`h-4 w-4`}),`Partial results`]}),(0,j.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:ce.map(e=>(0,j.jsx)(`li`,{children:e},e))})]}),e?(0,j.jsx)(le,{chrome:`embedded`,installedItems:it??void 0,onInstalledItemsChanged:()=>Z(!0),primitive:e}):null,i===`Rules`&&(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`mb-6 text-sm leading-relaxed text-muted-foreground`,children:`Enabled rules discovered from configured workspace/global directories.`}),(0,j.jsxs)(`div`,{className:`grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:`Installed`}),(0,j.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:Ke.length})]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Ke.map(({rule:e,scope:t})=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-border px-4 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(y,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,j.jsx)(`span`,{className:`flex-1 text-sm font-medium text-foreground`,children:e.name}),(0,j.jsx)(Y,{scope:t})]}),(0,j.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:he(e.instructions)}),(0,j.jsx)(`p`,{className:`mt-1 text-xs font-mono text-muted-foreground`,children:e.path})]},e.path)),Ke.length===0&&(0,j.jsx)(`p`,{className:`rounded-lg border border-dashed border-border px-4 py-3 text-sm text-muted-foreground`,children:`No rules found.`})]})]})]}),i===`Hooks`&&(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`mb-6 text-sm leading-relaxed text-muted-foreground`,children:`Hook config files from workspace and global hook directories.`}),xe&&G&&(0,j.jsxs)(`p`,{className:`mb-4 text-xs text-muted-foreground`,children:[`Execution status is based on hook events in session`,` `,(0,j.jsx)(`span`,{className:`font-mono`,children:G}),`.`]}),(0,j.jsxs)(`div`,{className:`grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:`Installed`}),(0,j.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:qe.length})]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[qe.map(({hook:e,scope:t})=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-border px-4 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(h,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,j.jsx)(`span`,{className:`flex-1 text-sm font-mono text-foreground`,children:e.fileName}),(0,j.jsx)(Y,{scope:t}),e.hookEventName&&(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`rounded border border-border px-2 py-0.5 text-xs text-muted-foreground`,children:e.hookEventName}),(()=>{let t=H[e.hookEventName],n=(t?.count??0)>0;return(0,j.jsx)(`span`,{className:r(`rounded border px-2 py-0.5 text-xs`,n?`border-emerald-400/50 text-emerald-600 dark:text-emerald-400`:`border-border text-muted-foreground`),children:n?`${t?.count??0} executed`:`never executed`})})()]})]}),e.hookEventName?(0,j.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Last run:`,` `,Pe(H[e.hookEventName]?.lastTs??null)]}):null,(0,j.jsx)(`p`,{className:`mt-1 text-xs font-mono text-muted-foreground`,children:e.path})]},e.path)),qe.length===0&&(0,j.jsx)(`p`,{className:`rounded-lg border border-dashed border-border px-4 py-3 text-sm text-muted-foreground`,children:`No hooks found.`})]})]})]}),i===`Skills`&&!e&&(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`p`,{className:`mb-6 text-sm leading-relaxed text-muted-foreground`,children:[`Skills can be invoked in chat with`,` `,(0,j.jsx)(`code`,{className:`rounded bg-secondary px-1.5 py-0.5 text-xs font-mono text-foreground`,children:`/SKILL`}),`.`]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[Ie.map(e=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-border px-5 py-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.type===`workflow`?(0,j.jsx)(f,{className:`h-4 w-4 shrink-0 text-primary`}):(0,j.jsx)(l,{className:`h-4 w-4 shrink-0 text-primary`}),(0,j.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:e.name}),(0,j.jsx)(`span`,{className:`rounded border border-border px-2 py-0.5 text-xs text-muted-foreground`,children:e.type})]}),(0,j.jsx)(`p`,{className:`mt-2 ml-7 text-xs text-muted-foreground`,children:e.description?.trim()||he(e.instructions)}),(0,j.jsx)(`p`,{className:`mt-1 ml-7 text-xs font-mono text-muted-foreground`,children:e.path})]},`${e.type}:${e.path}`)),Ie.length===0&&(0,j.jsx)(`p`,{className:`rounded-lg border border-dashed border-border px-4 py-3 text-sm text-muted-foreground`,children:`No enabled skills or workflows found.`})]})]}),i===`Agents`&&(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`mb-6 text-sm leading-relaxed text-muted-foreground`,children:`Configured agents discovered from Documents and settings directories.`}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[P.map(e=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-border px-5 py-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(g,{className:`h-4 w-4 shrink-0 text-primary`}),(0,j.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:e.name})]}),(0,j.jsx)(`p`,{className:`mt-1 ml-7 text-xs font-mono text-muted-foreground`,children:e.path})]},e.path)),P.length===0&&(0,j.jsx)(`p`,{className:`rounded-lg border border-dashed border-border px-4 py-3 text-sm text-muted-foreground`,children:`No configured agents found.`})]})]}),i===`Plugins`&&!e&&(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`mb-6 text-sm leading-relaxed text-muted-foreground`,children:`Plugins discovered from workspace and global plugin directories.`}),(0,j.jsxs)(`div`,{className:`mb-6`,children:[(0,j.jsx)(`h3`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Global Plugins`}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[He.map(e=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-border px-5 py-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(S,{className:`h-4 w-4 shrink-0 text-primary`}),(0,j.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-semibold text-foreground`,children:e.name}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.enabled?`Enabled`:`Disabled`}),(0,j.jsx)(m,{checked:e.enabled,onCheckedChange:()=>{Me(e)},disabled:we.has(e.path),"aria-label":`Toggle ${e.name}`})]}),(0,j.jsx)(`p`,{className:`mt-1 ml-7 text-xs font-mono text-muted-foreground`,children:e.path}),(0,j.jsxs)(`div`,{className:`mt-3 ml-7 flex flex-col gap-2`,children:[($.get(`${e.name}:${e.path}`)??[]).map(t=>{let n=X.has(t.id);return(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-md border border-border/70 px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:t.name}),(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.description?.trim()||`No description available.`})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.enabled?`Enabled`:`Disabled`}),(0,j.jsx)(m,{checked:t.enabled,onCheckedChange:()=>{Q(t)},disabled:n||!e.enabled,"aria-label":`Toggle ${t.name}`})]})]},t.id)}),($.get(`${e.name}:${e.path}`)?.length??0)===0&&(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No plugin tools found.`})]})]},e.path)),He.length===0&&(0,j.jsx)(`p`,{className:`rounded-lg border border-dashed border-border px-4 py-3 text-sm text-muted-foreground`,children:`No global plugins found.`})]})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h3`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Project Plugins`}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[Ve.map(e=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-border px-5 py-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(S,{className:`h-4 w-4 shrink-0 text-primary`}),(0,j.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-semibold text-foreground`,children:e.name}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.enabled?`Enabled`:`Disabled`}),(0,j.jsx)(m,{checked:e.enabled,onCheckedChange:()=>{Me(e)},disabled:we.has(e.path),"aria-label":`Toggle ${e.name}`})]}),(0,j.jsx)(`p`,{className:`mt-1 ml-7 text-xs font-mono text-muted-foreground`,children:e.path}),(0,j.jsxs)(`div`,{className:`mt-3 ml-7 flex flex-col gap-2`,children:[($.get(`${e.name}:${e.path}`)??[]).map(t=>{let n=X.has(t.id);return(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-md border border-border/70 px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:t.name}),(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.description?.trim()||`No description available.`})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.enabled?`Enabled`:`Disabled`}),(0,j.jsx)(m,{checked:t.enabled,onCheckedChange:()=>{Q(t)},disabled:n||!e.enabled,"aria-label":`Toggle ${t.name}`})]})]},t.id)}),($.get(`${e.name}:${e.path}`)?.length??0)===0&&(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No plugin tools found.`})]})]},e.path)),Ve.length===0&&(0,j.jsx)(`p`,{className:`rounded-lg border border-dashed border-border px-4 py-3 text-sm text-muted-foreground`,children:`No project plugins found.`})]})]})]}),i===`Tools`&&(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`mb-6 text-sm leading-relaxed text-muted-foreground`,children:`Builtin tool groups and plugin-contributed tools available to the runtime.`}),(0,j.jsxs)(`div`,{className:`mb-6`,children:[(0,j.jsx)(`h3`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Builtin Tools`}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[Ue.map(e=>(()=>{let t=X.has(e.id);return(0,j.jsxs)(`div`,{className:`rounded-lg border border-border px-5 py-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(_,{className:`h-4 w-4 shrink-0 text-primary`}),(0,j.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-semibold text-foreground`,children:e.name}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.enabled?`Enabled`:`Disabled`}),(0,j.jsx)(m,{checked:e.enabled,onCheckedChange:()=>{Q(e)},disabled:t,"aria-label":`Toggle ${e.name}`})]}),(0,j.jsx)(`p`,{className:`mt-2 ml-7 text-xs text-muted-foreground`,children:e.description?.trim()||`No description available.`}),!!e.headlessToolNames?.length&&(0,j.jsx)(`p`,{className:`mt-1 ml-7 text-xs font-mono text-muted-foreground`,children:e.headlessToolNames.join(`, `)})]},e.id)})()),Ue.length===0&&(0,j.jsx)(`p`,{className:`rounded-lg border border-dashed border-border px-4 py-3 text-sm text-muted-foreground`,children:`No builtin tools found.`})]})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h3`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Plugin Tools`}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[We.map(e=>(()=>{let t=X.has(e.id);return(0,j.jsxs)(`div`,{className:`rounded-lg border border-border px-5 py-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(_,{className:`h-4 w-4 shrink-0 text-primary`}),(0,j.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-semibold text-foreground`,children:e.name}),e.pluginName&&(0,j.jsxs)(`span`,{className:`rounded border border-border px-2 py-0.5 text-xs text-muted-foreground`,children:[`plugin: `,e.pluginName]}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.enabled?`Enabled`:`Disabled`}),(0,j.jsx)(m,{checked:e.enabled,onCheckedChange:()=>{Q(e)},disabled:t,"aria-label":`Toggle ${e.name}`})]}),(0,j.jsx)(`p`,{className:`mt-2 ml-7 text-xs text-muted-foreground`,children:e.description?.trim()||`No description available.`}),e.path&&(0,j.jsx)(`p`,{className:`mt-1 ml-7 text-xs font-mono text-muted-foreground`,children:e.path})]},e.id)})()),We.length===0&&(0,j.jsx)(`p`,{className:`rounded-lg border border-dashed border-border px-4 py-3 text-sm text-muted-foreground`,children:`No plugin tools found.`})]})]})]})]})}export{be as CustomizationSectionView};
1
+ import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-CPvDmBTC.js";import{E as r,T as i,c as a,w as ee,y as o}from"./vscode-DK7ayvks.js";import{a as s,i as c,n as l,r as u,t as d}from"./desktop-client-Cbu3aJ5_.js";import{i as f,r as p,t as m}from"./switch-O5JzNA9x.js";import{H as h,K as g,L as _,R as v,V as y,i as te,o as ne,s as re}from"./index-BGdYnZ-k.js";import{n as b,t as x}from"./badge-CCf0mJUQ.js";var S=i(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),C=i(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),w=e(t(),1),T=`/api/marketplace/catalog`,E={version:1,counts:{total:0,plugins:0,skills:0,mcps:0},tags:[],entries:[]};function D(e){return e===`mcp`||e===`skill`||e===`plugin`}function O(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function k(e){return typeof e==`number`&&Number.isFinite(e)?e:0}function A(e){if(!Array.isArray(e))return;let t=e.map(e=>{if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.name!=`string`)return null;let n={name:t.name};return typeof t.required==`boolean`&&(n.required=t.required),typeof t.description==`string`&&(n.description=t.description),typeof t.url==`string`&&(n.url=t.url),n}).filter(e=>e!==null);return t.length>0?t:void 0}async function ie(){let e=await fetch(T,{headers:{Accept:`application/json`}});if(!e.ok)throw Error(`Failed to fetch marketplace: ${e.status}`);let t=await e.json(),n=typeof t?.baseUrl==`string`?t.baseUrl:void 0,r=typeof t?.counts==`object`&&t.counts!==null?t.counts:{},i=Array.isArray(t?.tags)?t.tags.map(e=>{if(!e||typeof e!=`object`)return null;let t=e;return typeof t.id!=`string`||typeof t.label!=`string`?null:{id:t.id,label:t.label,count:k(t.count)}}).filter(e=>e!==null):[],a=Array.isArray(t?.entries)?t.entries.map(e=>{if(!e||typeof e!=`object`)return null;let t=e,n=typeof t.install==`object`&&t.install!==null?t.install:{};return typeof t.id!=`string`||!D(t.type)||typeof t.name!=`string`||typeof t.tagline!=`string`||typeof t.description!=`string`||typeof n.command!=`string`?null:{id:t.id,type:t.type,name:t.name,featured:typeof t.featured==`boolean`?t.featured:void 0,tagline:t.tagline,description:t.description,tags:O(t.tags),install:{args:O(n.args),command:n.command,env:A(n.env),notes:typeof n.notes==`string`?n.notes:void 0}}}).filter(e=>e!==null&&e.install.args.length>0):[];return{version:k(t?.version)||E.version,generatedAt:typeof t?.generatedAt==`string`?t.generatedAt:void 0,baseUrl:n,counts:{total:k(r.total)||a.length,plugins:k(r.plugins),skills:k(r.skills),mcps:k(r.mcps)},tags:i,entries:a}}var j=n(),M=3e5,N={fontFamily:`ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace`},P={mcp:{title:`MCP Servers`,description:`Install Model Context Protocol servers into this CLI environment.`,emptyInstalled:`No MCP servers installed.`,emptyCatalog:`No MCP servers match the current filters.`,icon:v},skill:{title:`Skills`,description:`Install skills globally for Cline.`,emptyInstalled:`No skills installed.`,emptyCatalog:`No skills match the current filters.`,icon:l},plugin:{title:`Plugins`,description:`Install plugins into this CLI environment.`,emptyInstalled:`No plugins installed.`,emptyCatalog:`No plugins match the current filters.`,icon:S}},F={mcp:`cline mcp install`,plugin:`cline plugin install`,skill:`cline skill add`};function I(e){return`${e.type}:${e.id}`}function ae(e,t){return Number(!!t.featured)-Number(!!e.featured)}function L(e){return e.trim().toLowerCase()}function R(e){return new Set([e.id,e.name,...e.install.args].map(L).filter(Boolean))}function oe(e,t){let n=R(e);return t.matchValues.map(L).filter(Boolean).some(e=>n.has(e))}function se(e,t){return[e.name,e.tagline,e.description,e.type,...e.tags.map(e=>t.get(e)??e)].join(` `).toLowerCase()}function z(e){if(e?.status===`installed`||e?.status===`uninstalled`||e?.status===`failed`)return e.message}function B({actionState:e,entry:t}){let n=t.install.env?.filter(e=>e.required!==!1)??[],r=t.install.env?.filter(e=>e.required===!1)??[];return n.length>0||r.length>0||t.install.notes||e?.status===`failed`?(0,j.jsxs)(`div`,{className:`grid gap-3 border-t pt-3`,"data-marketplace-entry-details":!0,children:[n.length>0||r.length>0?(0,j.jsxs)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 p-3`,children:[(0,j.jsx)(`p`,{className:`text-sm font-medium text-amber-800 dark:text-amber-200`,children:`Environment setup needed`}),(0,j.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-amber-800/80 dark:text-amber-100/80`,children:`Add these values to your Cline/plugin environment after install.`}),(0,j.jsx)(`div`,{className:`mt-3 grid gap-2`,children:[...n,...r].map(e=>(0,j.jsxs)(`div`,{className:`rounded-md border border-amber-500/20 bg-background/60 p-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`code`,{className:`font-mono text-xs font-semibold`,children:(0,j.jsx)(`span`,{style:N,children:e.name})}),(0,j.jsx)(x,{variant:`outline`,children:e.required===!1?`Optional`:`Required`})]}),e.description?(0,j.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e.description}):null,e.url?(0,j.jsxs)(`a`,{className:`mt-1 inline-flex items-center gap-1 text-xs text-primary hover:underline`,href:e.url,rel:`noreferrer`,target:`_blank`,children:[`Get value`,(0,j.jsx)(s,{className:`size-3`})]}):null]},e.name))})]}):null,t.install.notes?(0,j.jsx)(`p`,{className:`rounded-lg border bg-muted/30 p-3 text-xs leading-5 text-muted-foreground`,children:t.install.notes}):null,e?.status===`failed`?(0,j.jsx)(`div`,{className:`max-h-44 overflow-auto rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:e.message}):null]}):null}function ce({actionState:e,entry:t,expanded:n,installed:i,installedStatusReady:a,onInstall:s,onToggleExpanded:c,onUninstall:l,matchedLocalItems:d=[],showFeatured:f=!0,showTags:p=!0,sourceLabel:m,tagLabels:h}){let g=P[t.type].icon,_=e?.status===`installing`||e?.status===`uninstalling`,v=!!t.install.env?.length,y=v||!!t.install.notes||e?.status===`failed`,te=z(e),ne=e=>{if(e.stopPropagation(),i){l(t);return}s(t)},re=a?e?.status===`installing`?`Installing...`:e?.status===`uninstalling`?`Uninstalling...`:i?`Uninstall`:`Install`:`Checking...`,S=te?(0,j.jsx)(`output`,{className:r(`text-xs`,e?.status===`failed`?`text-destructive`:`text-muted-foreground`),children:te}):v?(0,j.jsx)(`span`,{className:`text-xs text-amber-700 dark:text-amber-300`,children:`Requires setup after install`}):null,C=(0,j.jsxs)(o,{disabled:!a||_,onClick:ne,size:`sm`,type:`button`,variant:i?`destructive`:`default`,children:[_||!a?(0,j.jsx)(b,{}):null,i&&!_?(0,j.jsx)(ee,{className:`size-4`}):null,re]}),w=(0,j.jsxs)(j.Fragment,{children:[i?null:(0,j.jsx)(`div`,{className:`absolute top-4 right-4`,"data-marketplace-entry-interactive":!0,children:C}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[(0,j.jsxs)(`div`,{className:r(`flex min-w-0 flex-1 items-center gap-2`,!i&&`pr-24`),children:[(0,j.jsx)(g,{className:`h-4 w-4 shrink-0 text-primary`}),(0,j.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-foreground`,children:t.name}),f&&t.featured?(0,j.jsxs)(x,{className:`border border-violet-500/20 bg-violet-500/10 text-violet-700 dark:text-violet-300`,children:[(0,j.jsx)(u,{className:`fill-current`}),`Featured`]}):null]}),(0,j.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2`,children:[m?(0,j.jsx)(x,{variant:`outline`,className:`shrink-0 text-muted-foreground`,children:m}):null,d.map(e=>e.renderMatchedBadges?(0,j.jsx)(`span`,{className:`contents`,children:e.renderMatchedBadges()},`${e.key}:badges`):null),d.map(e=>e.renderMatchedControls?(0,j.jsx)(`span`,{className:`contents`,"data-marketplace-entry-interactive":!0,children:e.renderMatchedControls()},`${e.key}:controls`):null)]})]}),d.some(e=>e.renderMatchedMeta)?(0,j.jsx)(`div`,{className:`mt-1 grid gap-1`,children:d.map(e=>e.renderMatchedMeta?(0,j.jsx)(`div`,{children:e.renderMatchedMeta()},`${e.key}:meta`):null)}):null]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-stretch sm:justify-between`,children:[(0,j.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-2`,children:[p&&t.tags.length>0?(0,j.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.tags.slice(0,5).map(e=>(0,j.jsx)(x,{variant:`outline`,className:`max-w-full text-muted-foreground`,children:(0,j.jsx)(`span`,{className:`truncate`,children:h.get(e)??e})},e))}):null,(0,j.jsx)(`p`,{className:`line-clamp-2 text-xs leading-5 text-muted-foreground`,children:t.description}),S]}),i?(0,j.jsx)(`div`,{className:`flex shrink-0 flex-col items-start gap-1 sm:items-end sm:justify-end`,children:C}):null]}),d.some(e=>e.renderMatchedDetails)?(0,j.jsx)(`div`,{className:`grid gap-2`,"data-marketplace-entry-details":!0,children:d.map(e=>e.renderMatchedDetails?(0,j.jsx)(`div`,{children:e.renderMatchedDetails()},e.key):null)}):null,n&&y?(0,j.jsx)(B,{actionState:e,entry:t}):null]});return y?(0,j.jsx)(`div`,{"aria-expanded":n,"aria-label":`${n?`Collapse`:`Expand`} ${t.name}`,className:`relative grid cursor-pointer gap-2 rounded-lg border bg-card p-4 text-left transition-colors hover:bg-accent/20 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none`,onClick:e=>{e.target instanceof HTMLElement&&e.target.closest(`[data-marketplace-entry-details], [data-marketplace-entry-interactive]`)||c(t)},onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c(t))},role:`button`,tabIndex:0,children:w}):(0,j.jsx)(`div`,{className:`relative grid gap-2 rounded-lg border bg-card p-4 text-left transition-colors hover:bg-accent/20`,children:w})}function V({active:e,count:t,onClick:n,tag:r}){return(0,j.jsxs)(o,{"aria-pressed":e,onClick:n,size:`sm`,type:`button`,variant:e?`default`:`outline`,children:[(0,j.jsx)(`span`,{className:`truncate`,children:r.label}),(0,j.jsx)(`span`,{className:`rounded bg-background/30 px-1.5 py-0.5 text-xs`,children:t})]})}function H({actionStates:e,emptyMessage:t,entries:n,expandedEntryKey:r,headerContent:i,installedEntryKeys:a,installedStatusReady:ee,localOnlyInstalledItems:o=[],matchedLocalItemsByEntryKey:s,onInstall:c,onToggleExpanded:l,onUninstall:u,showFeaturedBadges:d=!0,showEntryTags:f=!0,sourceLabel:p,tagLabels:m,title:h}){let g=n.length+o.length;return(0,j.jsxs)(`section`,{className:`grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:h}),(0,j.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:g})]}),i,g>0?(0,j.jsxs)(`div`,{className:`grid gap-3`,children:[o.map(e=>e.render()),n.map(t=>{let n=I(t);return(0,j.jsx)(ce,{actionState:e.get(n),entry:t,expanded:r===n,installed:a.has(n),installedStatusReady:ee,onInstall:c,onToggleExpanded:l,onUninstall:u,matchedLocalItems:s?.get(n)??[],showFeatured:d,showTags:f,sourceLabel:p,tagLabels:m},n)})]}):(0,j.jsx)(`div`,{className:`rounded-lg border border-dashed bg-card p-6 text-center text-sm text-muted-foreground`,children:t})]})}function le({chrome:e=`page`,installedItems:t,onInstalledItemsChanged:n,primitive:r}){let[i,ee]=(0,w.useState)(null),[s,c]=(0,w.useState)(null),[l,u]=(0,w.useState)(``),[f,m]=(0,w.useState)(null),[h,g]=(0,w.useState)(null),[_,v]=(0,w.useState)(()=>new Set),[y,x]=(0,w.useState)(()=>new Map),[S,C]=(0,w.useState)(`loading`);(0,w.useEffect)(()=>{let e=!1;return(async()=>{try{e||C(`loading`);let t=await ie();e||(ee(t),c(null));try{let n=await d.invoke(`list_marketplace_installed_entries`,{entries:t.entries});e||(v(new Set(n.installedKeys)),C(`ready`))}catch{e||C(`ready`)}}catch(t){e||(c(t instanceof Error?t.message:String(t)),C(`ready`))}})(),()=>{e=!0}},[]);let T=P[r],E=T.icon,D=(0,w.useMemo)(()=>new Map(i?.tags.map(e=>[e.id,e.label])??[]),[i?.tags]),O=(0,w.useMemo)(()=>(i?.entries.filter(e=>e.type===r)??[]).sort(ae),[i?.entries,r]),k=(0,w.useMemo)(()=>{let e=l.trim().toLowerCase();return O.filter(t=>e.length===0||se(t,D).includes(e))},[O,l,D]),A=(0,w.useMemo)(()=>k.filter(e=>_.has(I(e))),[k,_]),N=(0,w.useMemo)(()=>k.filter(e=>!_.has(I(e))),[k,_]),R=(0,w.useMemo)(()=>{let e=new Map;for(let t of N)for(let n of t.tags)e.set(n,(e.get(n)??0)+1);return e},[N]),z=(0,w.useMemo)(()=>(i?.tags??[]).filter(e=>(R.get(e.id)??0)>0),[i?.tags,R]),B=(0,w.useMemo)(()=>N.filter(e=>!f||e.tags.includes(f)),[N,f]),ce=(0,w.useMemo)(()=>{let e=new Map;for(let n of t??[])for(let t of A){let r=I(t);if(!oe(t,n))continue;let i=e.get(r)??[];i.push(n),e.set(r,i)}return e},[A,t]),le=(0,w.useMemo)(()=>{let e=new Set,n=O.filter(e=>_.has(I(e)));for(let r of t??[])n.some(e=>oe(e,r))&&e.add(r.key);return e},[_,t,O]),ue=(0,w.useMemo)(()=>{let e=l.trim().toLowerCase();return(t??[]).filter(t=>le.has(t.key)?!1:e.length===0||t.matchValues.map(L).some(t=>t.includes(e)))},[t,le,l]),U=S===`ready`,de=z.length>0?(0,j.jsxs)(`div`,{className:`flex flex-col gap-2 md:flex-row md:items-center md:justify-between`,children:[(0,j.jsx)(`div`,{className:`flex gap-2 overflow-x-auto pb-1`,children:z.map(e=>(0,j.jsx)(V,{active:f===e.id,count:R.get(e.id)??0,onClick:()=>m(t=>t===e.id?null:e.id),tag:e},e.id))}),(0,j.jsxs)(`div`,{className:`flex min-h-8 shrink-0 items-center gap-2 text-sm text-muted-foreground`,children:[(0,j.jsx)(`span`,{className:`font-medium text-foreground`,children:B.length}),(0,j.jsx)(`span`,{children:B.length===1?`result`:`results`}),f?(0,j.jsx)(o,{onClick:()=>m(null),size:`sm`,type:`button`,variant:`ghost`,children:`Clear filters`}):null]})]}):null,W=(e,t)=>{let n=I(e);x(e=>{let r=new Map(e);return r.set(n,t),r})},fe=e=>{v(t=>new Set(t).add(I(e)))},G=e=>{v(t=>{let n=new Set(t);return n.delete(I(e)),n})},pe=e=>{let t=I(e);g(e=>e===t?null:t)},K=async e=>{let t=I(e),r=y.get(t);if(!(r?.status===`installing`||r?.status===`uninstalling`)){g(t),W(e,{status:`installing`});try{W(e,{status:`installed`,message:(await d.invoke(`install_marketplace_entry`,{entry:e},{timeoutMs:M})).message}),fe(e),await n?.()}catch(t){W(e,{status:`failed`,message:t instanceof Error?t.message:String(t)})}}},q=async e=>{let t=I(e),r=y.get(t);if(!(r?.status===`installing`||r?.status===`uninstalling`)){g(t),W(e,{status:`uninstalling`});try{W(e,{status:`uninstalled`,message:(await d.invoke(`uninstall_marketplace_entry`,{entry:e},{timeoutMs:M})).message}),G(e),await n?.()}catch(t){W(e,{status:`failed`,message:t instanceof Error?t.message:String(t)})}}},me=(0,j.jsxs)(`div`,{className:`grid gap-6`,children:[e===`page`?(0,j.jsx)(re,{description:T.description,icon:E,title:T.title,meta:(0,j.jsx)(te,{children:F[r]}),actions:i?.generatedAt?(0,j.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Updated`,` `,new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,year:`numeric`}).format(new Date(i.generatedAt))]}):null}):null,!i&&!s?(0,j.jsxs)(`div`,{className:`flex min-h-80 items-center justify-center rounded-lg border bg-card text-sm text-muted-foreground`,children:[(0,j.jsx)(b,{className:`mr-2`}),`Loading marketplace...`]}):null,i&&!U?(0,j.jsxs)(`div`,{className:`flex min-h-80 items-center justify-center rounded-lg border bg-card text-sm text-muted-foreground`,children:[(0,j.jsx)(b,{className:`mr-2`}),`Checking installed status...`]}):null,s?(0,j.jsx)(`div`,{className:`rounded-lg border border-destructive/40 bg-destructive/10 p-4 text-sm text-destructive`,children:s}):null,i&&U?(0,j.jsxs)(`div`,{className:`grid gap-6`,children:[(0,j.jsx)(`div`,{className:`grid gap-3`,children:(0,j.jsx)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-center`,children:(0,j.jsxs)(`div`,{className:`relative block flex-1`,children:[(0,j.jsx)(p,{className:`pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`}),(0,j.jsx)(a,{"aria-label":`Search ${T.title}`,className:`h-10 pl-8`,onChange:e=>u(e.target.value),placeholder:`Search ${T.title.toLowerCase()}`,value:l})]})})}),(0,j.jsx)(H,{actionStates:y,emptyMessage:T.emptyInstalled,entries:A,expandedEntryKey:h,installedEntryKeys:_,installedStatusReady:U,localOnlyInstalledItems:ue,matchedLocalItemsByEntryKey:ce,onInstall:K,onToggleExpanded:pe,onUninstall:q,showFeaturedBadges:!1,showEntryTags:!1,sourceLabel:`Marketplace`,tagLabels:D,title:`Installed`}),(0,j.jsx)(H,{actionStates:y,emptyMessage:T.emptyCatalog,entries:B,expandedEntryKey:h,headerContent:de,installedEntryKeys:_,installedStatusReady:U,onInstall:K,onToggleExpanded:pe,onUninstall:q,tagLabels:D,title:`Marketplace`})]}):null]});return e===`embedded`?me:(0,j.jsx)(ne,{children:me})}var ue={Rules:`Review project and global rule files that shape Cline behavior.`,Hooks:`Inspect hook configuration and recent execution status.`,MCP:`Manage installed MCP servers and add new servers from the marketplace.`,Skills:`Manage installed skills and add new skills from the marketplace.`,Agents:`Review configured agents discovered from local settings.`,Plugins:`Manage installed plugins and add new plugins from the marketplace.`,Tools:`Inspect built-in tools and tools contributed by plugins.`},U={Rules:`cline config rules`,Hooks:`cline config hooks`,MCP:`cline mcp install`,Skills:`cline skill`,Agents:`cline config agents`,Plugins:`cline plugin`,Tools:`cline config tools`},de={settingsPath:``,hasSettingsFile:!1,servers:[]};function W(e){return Array.isArray(e)?e:[]}function fe(e){return{workspaceRoot:typeof e?.workspaceRoot==`string`?e.workspaceRoot:``,rules:W(e?.rules),workflows:W(e?.workflows),skills:W(e?.skills),agents:W(e?.agents),plugins:W(e?.plugins),tools:W(e?.tools),hooks:W(e?.hooks),mcp:e?.mcp&&typeof e.mcp==`object`?{settingsPath:typeof e.mcp.settingsPath==`string`?e.mcp.settingsPath:``,hasSettingsFile:!!e.mcp.hasSettingsFile,servers:W(e.mcp.servers)}:{...de},warnings:W(e?.warnings)}}var G=6e4,pe=3e4,K=null,q=null;function me(e,t){return!!(e&&t-e.fetchedAt<G&&Array.isArray(e.tools)&&e.tools.length>0)}function he(e,t=150){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t).trimEnd()}...`}function J(e){return e.replaceAll(`\\`,`/`)}function ge(e,t){let n=J(t),r=J(e);return n&&r.startsWith(`${n}/`)?`Project`:`Global`}function Y({scope:e}){return(0,j.jsx)(x,{variant:`outline`,className:`shrink-0 text-muted-foreground`,children:e})}function _e(...e){let t=new Set;for(let n of e){let e=n?.trim().replaceAll(`\\`,`/`);if(!e)continue;t.add(e);let r=e.split(`/`).filter(Boolean);for(let e of r)t.add(e.replace(/\.[^.]+$/,``));for(let e=0;e<r.length-1;e+=1)t.add(`${r[e]}/${r[e+1]}`)}return[...t]}async function ve(){return fe(await d.invoke(`list_user_instruction_configs`))}function ye(e,t){return(e instanceof Error?e.message:String(e)).includes(`unsupported desktop command: ${t}`)}function be({catalogPrimitive:e,section:t=`Rules`,showTabs:n=!1}){let[i,a]=(0,w.useState)(t),[s,u]=(0,w.useState)(()=>!me(K,Date.now())),[p,T]=(0,w.useState)(null),[E,D]=(0,w.useState)(()=>K?.workspaceRoot??``),[O,k]=(0,w.useState)(()=>K?.rules??[]),[A,ie]=(0,w.useState)(()=>K?.workflows??[]),[M,N]=(0,w.useState)(()=>K?.skills??[]),[P,F]=(0,w.useState)(()=>K?.agents??[]),[I,ae]=(0,w.useState)(()=>K?.plugins??[]),[L,R]=(0,w.useState)(()=>K?.tools??[]),[oe,se]=(0,w.useState)(()=>K?.hooks??[]),[z,B]=(0,w.useState)(()=>K?.mcp??de),[ce,V]=(0,w.useState)(()=>K?.warnings??[]),[H,W]=(0,w.useState)(()=>q?.hookExecutionByEvent??{}),[G,be]=(0,w.useState)(()=>q?.hookExecutionSessionId??null),[xe,Se]=(0,w.useState)(!1),[X,Ce]=(0,w.useState)(()=>new Set),[we,Te]=(0,w.useState)(()=>new Set),[Ee,De]=(0,w.useState)(()=>new Set),[Oe,ke]=(0,w.useState)(()=>new Map);(0,w.useEffect)(()=>{a(t)},[t]);let Z=(0,w.useCallback)(async(e=!1)=>{if(!e&&me(K,Date.now())){D(K.workspaceRoot),k(K.rules),ie(K.workflows),N(K.skills),F(K.agents),ae(K.plugins),R(K.tools),se(K.hooks),B(K.mcp),V(K.warnings),T(null),u(!1);return}u(!0),T(null);try{let e=await ve();D(e.workspaceRoot),k(e.rules),ie(e.workflows),N(e.skills),F(e.agents),ae(e.plugins),R(e.tools),se(e.hooks),B(e.mcp),V(e.warnings),K={...e,fetchedAt:Date.now()}}catch(e){T(e instanceof Error?e.message:String(e))}finally{u(!1)}},[]),Ae=(0,w.useCallback)(async(e=!1)=>{if(!e&&q&&Date.now()-q.fetchedAt<pe){W(q.hookExecutionByEvent),be(q.hookExecutionSessionId);return}Se(!0);try{let e=(await d.invoke(`list_cli_sessions`,{limit:300})??[]).filter(e=>typeof e.sessionId==`string`&&e.sessionId.trim().length>0).sort((e,t)=>(t.startedAt??``).localeCompare(e.startedAt??``))[0];if(!e?.sessionId){W({}),be(null),q={hookExecutionByEvent:{},hookExecutionSessionId:null,fetchedAt:Date.now()};return}let t=await d.invoke(`read_session_hooks`,{sessionId:e.sessionId,limit:5e3}),n={};for(let e of t??[]){let t=e.hookEventName?.trim();if(!t)continue;let r=n[t]??{count:0,lastTs:null};r.count+=1,e.ts&&(!r.lastTs||e.ts>r.lastTs)&&(r.lastTs=e.ts),n[t]=r}W(n),be(e.sessionId),q={hookExecutionByEvent:n,hookExecutionSessionId:e.sessionId,fetchedAt:Date.now()}}catch{}finally{Se(!1)}},[]),je=(0,w.useCallback)(e=>{let t=fe(e);D(t.workspaceRoot),k(t.rules),ie(t.workflows),N(t.skills),F(t.agents),ae(t.plugins),R(t.tools),se(t.hooks),B(t.mcp),V(t.warnings),K={...t,fetchedAt:Date.now()}},[]),Q=(0,w.useCallback)(async e=>{Ce(t=>new Set(t).add(e.id)),T(null);try{let t=[e.name,...e.headlessToolNames??[]].filter(Boolean);if(t.length===0)throw Error(`tool name is required`);let n;try{n=await d.invoke(`set_tool_disabled`,{names:t,disabled:e.enabled})}catch(e){if(!ye(e,`set_tool_disabled`))throw e;for(let e of t)n=await d.invoke(`toggle_disabled_plugin_tool`,{name:e})}if(!n)throw Error(`tool toggle did not return an updated extension list`);je(n)}catch(e){T(e instanceof Error?e.message:String(e))}finally{Ce(t=>{let n=new Set(t);return n.delete(e.id),n})}},[je]),Me=(0,w.useCallback)(async e=>{Te(t=>new Set(t).add(e.path)),T(null);try{je(await d.invoke(`set_plugin_disabled`,{path:e.path,disabled:e.enabled}))}catch(e){T(e instanceof Error?e.message:String(e))}finally{Te(t=>{let n=new Set(t);return n.delete(e.path),n})}},[je]),Ne=(0,w.useCallback)(async e=>{if(!Ee.has(e.key)){De(t=>new Set(t).add(e.key)),ke(t=>{let n=new Map(t);return n.delete(e.key),n}),T(null);try{let t=await d.invoke(`uninstall_local_primitive`,{type:e.type,id:e.id,name:e.name,path:e.path});ke(n=>{let r=new Map(n);return r.set(e.key,{status:`success`,message:t.message??`Uninstalled ${e.name??e.id??e.path}.`}),r}),await Z(!0)}catch(t){let n=t instanceof Error?t.message:String(t);ke(t=>{let r=new Map(t);return r.set(e.key,{status:`failed`,message:n}),r}),T(n)}finally{De(t=>{let n=new Set(t);return n.delete(e.key),n})}}},[Ee,Z]),Pe=(0,w.useCallback)(e=>{if(!e)return`never`;let t=Number(e),n=Number.isFinite(t)?new Date(t):new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleString()},[]);(0,w.useEffect)(()=>{let e=window.setTimeout(()=>{Z(!1)},0);return()=>window.clearTimeout(e)},[Z]),(0,w.useEffect)(()=>{if(i!==`Hooks`)return;let e=window.setTimeout(()=>{Ae(!1)},0);return()=>window.clearTimeout(e)},[i,Ae]);let Fe=[`Rules`,`Hooks`,`Skills`,`Agents`,`Plugins`,`Tools`],Ie=(0,w.useMemo)(()=>{let e=A.map(e=>({id:e.id,type:`workflow`,name:e.name,instructions:e.instructions,path:e.path,scope:ge(e.path,E)})),t=M.map(e=>({id:J(e.path).toLowerCase(),type:`skill`,name:e.name,description:e.description,instructions:e.instructions,path:e.path,scope:ge(e.path,E)}));return[...e,...t].sort((e,t)=>e.name.localeCompare(t.name))},[M,A,E]),{projectRules:Le,globalRules:Re}=(0,w.useMemo)(()=>{let e=J(E),t=[],n=[];for(let r of O){let i=J(r.path);e&&i.startsWith(`${e}/`)&&i.includes(`/.clinerules/`)?t.push(r):n.push(r)}return{projectRules:t,globalRules:n}},[O,E]),{projectHooks:ze,globalHooks:Be}=(0,w.useMemo)(()=>{let e=J(E),t=[],n=[];for(let r of oe){let i=J(r.path);e&&i.startsWith(`${e}/`)&&i.includes(`/.clinerules/hooks`)?t.push(r):n.push(r)}return{projectHooks:t,globalHooks:n}},[oe,E]),{projectPlugins:Ve,globalPlugins:He}=(0,w.useMemo)(()=>{let e=J(E),t=[],n=[];for(let r of I){let i=J(r.path);e&&i.startsWith(`${e}/`)&&i.includes(`/.cline/plugins`)?t.push(r):n.push(r)}return{projectPlugins:t,globalPlugins:n}},[I,E]),Ue=(0,w.useMemo)(()=>L.filter(e=>e.source===`builtin`),[L]),We=(0,w.useMemo)(()=>L.filter(e=>e.source!==`builtin`),[L]),$=(0,w.useMemo)(()=>{let e=new Map;for(let t of We){let n=`${t.pluginName??``}:${t.path??``}`,r=e.get(n)??[];r.push(t),e.set(n,r)}for(let t of e.values())t.sort((e,t)=>e.name.localeCompare(t.name));return e},[We]),Ge=(0,w.useMemo)(()=>[...He.map(e=>({plugin:e,scope:`Global`})),...Ve.map(e=>({plugin:e,scope:`Project`}))],[He,Ve]),Ke=(0,w.useMemo)(()=>[...Re.map(e=>({rule:e,scope:`Global`})),...Le.map(e=>({rule:e,scope:`Project`}))],[Re,Le]),qe=(0,w.useMemo)(()=>[...Be.map(e=>({hook:e,scope:`Global`})),...ze.map(e=>({hook:e,scope:`Project`}))],[Be,ze]),Je=e=>{let t=Oe.get(e);return t?(0,j.jsx)(`output`,{className:r(`text-xs`,t.status===`failed`?`text-destructive`:`text-muted-foreground`),children:t.message}):null},Ye=e=>{let t=Ee.has(e.key);return(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,j.jsx)(`div`,{className:`min-h-5 text-xs text-muted-foreground`,children:Je(e.key)}),(0,j.jsxs)(o,{disabled:t,onClick:()=>{Ne(e)},type:`button`,variant:`destructive`,children:[t?(0,j.jsx)(b,{}):(0,j.jsx)(ee,{className:`size-4`}),t?`Uninstalling...`:`Uninstall`]})]})},Xe=e=>{let t=`${e.type}:${e.path}`;return(0,j.jsxs)(`div`,{className:`rounded-lg border border-border px-5 py-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.type===`workflow`?(0,j.jsx)(f,{className:`h-4 w-4 shrink-0 text-primary`}):(0,j.jsx)(l,{className:`h-4 w-4 shrink-0 text-primary`}),(0,j.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-semibold text-foreground`,children:e.name}),(0,j.jsx)(Y,{scope:e.scope}),(0,j.jsx)(x,{variant:`outline`,className:`shrink-0 text-muted-foreground`,children:e.type})]}),(0,j.jsx)(`p`,{className:`mt-2 ml-7 text-xs text-muted-foreground`,children:e.description?.trim()||he(e.instructions)}),(0,j.jsx)(`p`,{className:`mt-1 ml-7 text-xs font-mono text-muted-foreground`,children:e.path}),(0,j.jsx)(`div`,{className:`mt-3`,children:Ye({key:t,type:e.type,id:e.id,name:e.name,path:e.path})})]},t)},Ze=e=>(0,j.jsxs)(`div`,{className:`grid gap-1`,children:[(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.description?.trim()||he(e.instructions)}),(0,j.jsx)(`p`,{className:`text-xs font-mono text-muted-foreground`,children:e.path})]}),Qe=({plugin:e,scope:t})=>{let n=e.path;return(0,j.jsxs)(`div`,{className:`rounded-lg border border-border px-5 py-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(S,{className:`h-4 w-4 shrink-0 text-primary`}),(0,j.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-semibold text-foreground`,children:e.name}),(0,j.jsx)(Y,{scope:t}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.enabled?`Enabled`:`Disabled`}),(0,j.jsx)(m,{checked:e.enabled,onCheckedChange:()=>{Me(e)},disabled:we.has(e.path),"aria-label":`Toggle ${e.name}`})]}),(0,j.jsx)(`p`,{className:`mt-1 ml-7 text-xs font-mono text-muted-foreground`,children:e.path}),(0,j.jsxs)(`div`,{className:`mt-3 ml-7 flex flex-col gap-2`,children:[($.get(`${e.name}:${e.path}`)??[]).map(t=>{let n=X.has(t.id);return(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-md border border-border/70 px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:t.name}),(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.description?.trim()||`No description available.`})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.enabled?`Enabled`:`Disabled`}),(0,j.jsx)(m,{checked:t.enabled,onCheckedChange:()=>{Q(t)},disabled:n||!e.enabled,"aria-label":`Toggle ${t.name}`})]})]},t.id)}),($.get(`${e.name}:${e.path}`)?.length??0)===0&&(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No plugin tools found.`})]}),(0,j.jsx)(`div`,{className:`mt-3`,children:Ye({key:n,type:`plugin`,id:e.name,name:e.name,path:e.path})})]},e.path)},$e=e=>(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.enabled?`Enabled`:`Disabled`}),(0,j.jsx)(m,{checked:e.enabled,onCheckedChange:()=>{Me(e)},disabled:we.has(e.path),"aria-label":`Toggle ${e.name}`})]}),et=e=>(0,j.jsx)(`p`,{className:`min-w-0 truncate text-xs font-mono text-muted-foreground`,children:e.path}),tt=e=>{let t=$.get(`${e.name}:${e.path}`)??[];return t.length===0?null:(0,j.jsx)(`div`,{className:`grid gap-2`,children:t.map(t=>{let n=X.has(t.id);return(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-md border border-border/70 px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:t.name}),(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.description?.trim()||`No description available.`})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.enabled?`Enabled`:`Disabled`}),(0,j.jsx)(m,{checked:t.enabled,onCheckedChange:()=>{Q(t)},disabled:n||!e.enabled,"aria-label":`Toggle ${t.name}`})]})]},t.id)})})},nt=e=>{let t=e.name;return(0,j.jsxs)(`div`,{className:`rounded-lg border border-border px-5 py-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(v,{className:`h-4 w-4 shrink-0 text-primary`}),(0,j.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-semibold text-foreground`,children:e.name}),(0,j.jsx)(Y,{scope:`Global`}),(0,j.jsx)(x,{variant:`outline`,className:`shrink-0 text-muted-foreground`,children:e.transportType}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.disabled?`Disabled`:`Enabled`})]}),(0,j.jsx)(`p`,{className:`mt-2 ml-7 text-xs text-muted-foreground`,children:e.url??([e.command,...e.args??[]].filter(Boolean).join(` `)||`No launch command configured.`)}),z.settingsPath?(0,j.jsx)(`p`,{className:`mt-1 ml-7 text-xs font-mono text-muted-foreground`,children:z.settingsPath}):null,(0,j.jsx)(`div`,{className:`mt-3`,children:Ye({key:t,type:`mcp`,id:e.name,name:e.name})})]},e.name)},rt=e=>(0,j.jsxs)(`div`,{className:`grid gap-1`,children:[(0,j.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.disabled?`Disabled`:`Enabled`,` locally`,e.transportType?` via ${e.transportType}`:``]}),z.settingsPath?(0,j.jsx)(`p`,{className:`text-xs font-mono text-muted-foreground`,children:z.settingsPath}):null]}),it=e===`skill`?Ie.map(e=>({key:`${e.type}:${e.path}`,matchValues:_e(e.id,e.name,e.path),render:()=>Xe(e),renderMatchedBadges:()=>(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Y,{scope:e.scope}),(0,j.jsx)(x,{variant:`outline`,className:`shrink-0 text-muted-foreground`,children:e.type})]}),renderMatchedDetails:()=>Ze(e)})):e===`plugin`?Ge.map(e=>({key:e.plugin.path,matchValues:_e(e.plugin.name,e.plugin.path),render:()=>Qe(e),renderMatchedBadges:()=>(0,j.jsx)(Y,{scope:e.scope}),renderMatchedControls:()=>$e(e.plugin),renderMatchedDetails:($.get(`${e.plugin.name}:${e.plugin.path}`)??[]).length>0?()=>tt(e.plugin):void 0,renderMatchedMeta:()=>et(e.plugin)})):e===`mcp`?z.servers.map(e=>({key:e.name,matchValues:_e(e.name),render:()=>nt(e),renderMatchedBadges:()=>(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Y,{scope:`Global`}),(0,j.jsx)(x,{variant:`outline`,className:`shrink-0 text-muted-foreground`,children:e.transportType})]}),renderMatchedDetails:()=>rt(e)})):null;return(0,j.jsxs)(ne,{children:[(0,j.jsx)(re,{description:ue[i],title:i,meta:(0,j.jsx)(te,{children:U[i]}),actions:(0,j.jsx)(o,{variant:`outline`,size:`sm`,onClick:()=>{Z(!0),i===`Hooks`&&Ae(!0)},disabled:s,children:(0,j.jsx)(c,{className:r(`h-4 w-4`,s&&`animate-spin`)})})}),n?(0,j.jsx)(`div`,{className:`mb-6 flex items-center gap-0 border-b border-border`,children:Fe.map(e=>(0,j.jsxs)(o,{variant:`ghost`,onClick:()=>a(e),className:r(`relative px-4 py-2.5 text-sm font-medium transition-colors`,i===e?`text-foreground`:`text-muted-foreground hover:text-foreground`),children:[e,i===e&&(0,j.jsx)(`span`,{className:`absolute inset-x-0 -bottom-px h-0.5 bg-foreground`})]},e))}):null,p&&(0,j.jsxs)(`div`,{className:`mb-4 rounded-lg border border-destructive/40 bg-destructive/10 px-4 py-3 text-sm text-destructive`,children:[`Failed to load configuration lists: `,p]}),ce.length>0&&(0,j.jsxs)(`div`,{className:`mb-4 rounded-lg border border-yellow-500/40 bg-yellow-500/10 px-4 py-3 text-sm text-yellow-700 dark:text-yellow-300`,children:[(0,j.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 font-medium`,children:[(0,j.jsx)(C,{className:`h-4 w-4`}),`Partial results`]}),(0,j.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:ce.map(e=>(0,j.jsx)(`li`,{children:e},e))})]}),e?(0,j.jsx)(le,{chrome:`embedded`,installedItems:it??void 0,onInstalledItemsChanged:()=>Z(!0),primitive:e}):null,i===`Rules`&&(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`mb-6 text-sm leading-relaxed text-muted-foreground`,children:`Enabled rules discovered from configured workspace/global directories.`}),(0,j.jsxs)(`div`,{className:`grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:`Installed`}),(0,j.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:Ke.length})]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Ke.map(({rule:e,scope:t})=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-border px-4 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(y,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,j.jsx)(`span`,{className:`flex-1 text-sm font-medium text-foreground`,children:e.name}),(0,j.jsx)(Y,{scope:t})]}),(0,j.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:he(e.instructions)}),(0,j.jsx)(`p`,{className:`mt-1 text-xs font-mono text-muted-foreground`,children:e.path})]},e.path)),Ke.length===0&&(0,j.jsx)(`p`,{className:`rounded-lg border border-dashed border-border px-4 py-3 text-sm text-muted-foreground`,children:`No rules found.`})]})]})]}),i===`Hooks`&&(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`mb-6 text-sm leading-relaxed text-muted-foreground`,children:`Hook config files from workspace and global hook directories.`}),xe&&G&&(0,j.jsxs)(`p`,{className:`mb-4 text-xs text-muted-foreground`,children:[`Execution status is based on hook events in session`,` `,(0,j.jsx)(`span`,{className:`font-mono`,children:G}),`.`]}),(0,j.jsxs)(`div`,{className:`grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:`Installed`}),(0,j.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:qe.length})]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[qe.map(({hook:e,scope:t})=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-border px-4 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(h,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,j.jsx)(`span`,{className:`flex-1 text-sm font-mono text-foreground`,children:e.fileName}),(0,j.jsx)(Y,{scope:t}),e.hookEventName&&(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`rounded border border-border px-2 py-0.5 text-xs text-muted-foreground`,children:e.hookEventName}),(()=>{let t=H[e.hookEventName],n=(t?.count??0)>0;return(0,j.jsx)(`span`,{className:r(`rounded border px-2 py-0.5 text-xs`,n?`border-emerald-400/50 text-emerald-600 dark:text-emerald-400`:`border-border text-muted-foreground`),children:n?`${t?.count??0} executed`:`never executed`})})()]})]}),e.hookEventName?(0,j.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Last run:`,` `,Pe(H[e.hookEventName]?.lastTs??null)]}):null,(0,j.jsx)(`p`,{className:`mt-1 text-xs font-mono text-muted-foreground`,children:e.path})]},e.path)),qe.length===0&&(0,j.jsx)(`p`,{className:`rounded-lg border border-dashed border-border px-4 py-3 text-sm text-muted-foreground`,children:`No hooks found.`})]})]})]}),i===`Skills`&&!e&&(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`p`,{className:`mb-6 text-sm leading-relaxed text-muted-foreground`,children:[`Skills can be invoked in chat with`,` `,(0,j.jsx)(`code`,{className:`rounded bg-secondary px-1.5 py-0.5 text-xs font-mono text-foreground`,children:`/SKILL`}),`.`]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[Ie.map(e=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-border px-5 py-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.type===`workflow`?(0,j.jsx)(f,{className:`h-4 w-4 shrink-0 text-primary`}):(0,j.jsx)(l,{className:`h-4 w-4 shrink-0 text-primary`}),(0,j.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:e.name}),(0,j.jsx)(`span`,{className:`rounded border border-border px-2 py-0.5 text-xs text-muted-foreground`,children:e.type})]}),(0,j.jsx)(`p`,{className:`mt-2 ml-7 text-xs text-muted-foreground`,children:e.description?.trim()||he(e.instructions)}),(0,j.jsx)(`p`,{className:`mt-1 ml-7 text-xs font-mono text-muted-foreground`,children:e.path})]},`${e.type}:${e.path}`)),Ie.length===0&&(0,j.jsx)(`p`,{className:`rounded-lg border border-dashed border-border px-4 py-3 text-sm text-muted-foreground`,children:`No enabled skills or workflows found.`})]})]}),i===`Agents`&&(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`mb-6 text-sm leading-relaxed text-muted-foreground`,children:`Configured agents discovered from Documents and settings directories.`}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[P.map(e=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-border px-5 py-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(g,{className:`h-4 w-4 shrink-0 text-primary`}),(0,j.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:e.name})]}),(0,j.jsx)(`p`,{className:`mt-1 ml-7 text-xs font-mono text-muted-foreground`,children:e.path})]},e.path)),P.length===0&&(0,j.jsx)(`p`,{className:`rounded-lg border border-dashed border-border px-4 py-3 text-sm text-muted-foreground`,children:`No configured agents found.`})]})]}),i===`Plugins`&&!e&&(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`mb-6 text-sm leading-relaxed text-muted-foreground`,children:`Plugins discovered from workspace and global plugin directories.`}),(0,j.jsxs)(`div`,{className:`mb-6`,children:[(0,j.jsx)(`h3`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Global Plugins`}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[He.map(e=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-border px-5 py-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(S,{className:`h-4 w-4 shrink-0 text-primary`}),(0,j.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-semibold text-foreground`,children:e.name}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.enabled?`Enabled`:`Disabled`}),(0,j.jsx)(m,{checked:e.enabled,onCheckedChange:()=>{Me(e)},disabled:we.has(e.path),"aria-label":`Toggle ${e.name}`})]}),(0,j.jsx)(`p`,{className:`mt-1 ml-7 text-xs font-mono text-muted-foreground`,children:e.path}),(0,j.jsxs)(`div`,{className:`mt-3 ml-7 flex flex-col gap-2`,children:[($.get(`${e.name}:${e.path}`)??[]).map(t=>{let n=X.has(t.id);return(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-md border border-border/70 px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:t.name}),(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.description?.trim()||`No description available.`})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.enabled?`Enabled`:`Disabled`}),(0,j.jsx)(m,{checked:t.enabled,onCheckedChange:()=>{Q(t)},disabled:n||!e.enabled,"aria-label":`Toggle ${t.name}`})]})]},t.id)}),($.get(`${e.name}:${e.path}`)?.length??0)===0&&(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No plugin tools found.`})]})]},e.path)),He.length===0&&(0,j.jsx)(`p`,{className:`rounded-lg border border-dashed border-border px-4 py-3 text-sm text-muted-foreground`,children:`No global plugins found.`})]})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h3`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Project Plugins`}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[Ve.map(e=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-border px-5 py-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(S,{className:`h-4 w-4 shrink-0 text-primary`}),(0,j.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-semibold text-foreground`,children:e.name}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.enabled?`Enabled`:`Disabled`}),(0,j.jsx)(m,{checked:e.enabled,onCheckedChange:()=>{Me(e)},disabled:we.has(e.path),"aria-label":`Toggle ${e.name}`})]}),(0,j.jsx)(`p`,{className:`mt-1 ml-7 text-xs font-mono text-muted-foreground`,children:e.path}),(0,j.jsxs)(`div`,{className:`mt-3 ml-7 flex flex-col gap-2`,children:[($.get(`${e.name}:${e.path}`)??[]).map(t=>{let n=X.has(t.id);return(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-md border border-border/70 px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:t.name}),(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.description?.trim()||`No description available.`})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.enabled?`Enabled`:`Disabled`}),(0,j.jsx)(m,{checked:t.enabled,onCheckedChange:()=>{Q(t)},disabled:n||!e.enabled,"aria-label":`Toggle ${t.name}`})]})]},t.id)}),($.get(`${e.name}:${e.path}`)?.length??0)===0&&(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No plugin tools found.`})]})]},e.path)),Ve.length===0&&(0,j.jsx)(`p`,{className:`rounded-lg border border-dashed border-border px-4 py-3 text-sm text-muted-foreground`,children:`No project plugins found.`})]})]})]}),i===`Tools`&&(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`mb-6 text-sm leading-relaxed text-muted-foreground`,children:`Builtin tool groups and plugin-contributed tools available to the runtime.`}),(0,j.jsxs)(`div`,{className:`mb-6`,children:[(0,j.jsx)(`h3`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Builtin Tools`}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[Ue.map(e=>(()=>{let t=X.has(e.id);return(0,j.jsxs)(`div`,{className:`rounded-lg border border-border px-5 py-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(_,{className:`h-4 w-4 shrink-0 text-primary`}),(0,j.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-semibold text-foreground`,children:e.name}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.enabled?`Enabled`:`Disabled`}),(0,j.jsx)(m,{checked:e.enabled,onCheckedChange:()=>{Q(e)},disabled:t,"aria-label":`Toggle ${e.name}`})]}),(0,j.jsx)(`p`,{className:`mt-2 ml-7 text-xs text-muted-foreground`,children:e.description?.trim()||`No description available.`}),!!e.headlessToolNames?.length&&(0,j.jsx)(`p`,{className:`mt-1 ml-7 text-xs font-mono text-muted-foreground`,children:e.headlessToolNames.join(`, `)})]},e.id)})()),Ue.length===0&&(0,j.jsx)(`p`,{className:`rounded-lg border border-dashed border-border px-4 py-3 text-sm text-muted-foreground`,children:`No builtin tools found.`})]})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h3`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Plugin Tools`}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[We.map(e=>(()=>{let t=X.has(e.id);return(0,j.jsxs)(`div`,{className:`rounded-lg border border-border px-5 py-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(_,{className:`h-4 w-4 shrink-0 text-primary`}),(0,j.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-semibold text-foreground`,children:e.name}),e.pluginName&&(0,j.jsxs)(`span`,{className:`rounded border border-border px-2 py-0.5 text-xs text-muted-foreground`,children:[`plugin: `,e.pluginName]}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.enabled?`Enabled`:`Disabled`}),(0,j.jsx)(m,{checked:e.enabled,onCheckedChange:()=>{Q(e)},disabled:t,"aria-label":`Toggle ${e.name}`})]}),(0,j.jsx)(`p`,{className:`mt-2 ml-7 text-xs text-muted-foreground`,children:e.description?.trim()||`No description available.`}),e.path&&(0,j.jsx)(`p`,{className:`mt-1 ml-7 text-xs font-mono text-muted-foreground`,children:e.path})]},e.id)})()),We.length===0&&(0,j.jsx)(`p`,{className:`rounded-lg border border-dashed border-border px-4 py-3 text-sm text-muted-foreground`,children:`No plugin tools found.`})]})]})]})]})}export{be as CustomizationSectionView};