@xopcai/xopc 0.0.44 → 0.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +138 -102
- package/README.zh-CN.md +155 -67
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agents-DPpa_rdl.js → agents-Bk2uuFvC.js} +2 -2
- package/dist/gateway/static/root/assets/{agents-DPpa_rdl.js.map → agents-Bk2uuFvC.js.map} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DyD3FTHu.js → apps-page-CbSr8cvX.js} +2 -2
- package/dist/gateway/static/root/assets/{apps-page-DyD3FTHu.js.map → apps-page-CbSr8cvX.js.map} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-SMYa0dg9.js → channels-settings-Dn-hIRl1.js} +2 -2
- package/dist/gateway/static/root/assets/{channels-settings-SMYa0dg9.js.map → channels-settings-Dn-hIRl1.js.map} +1 -1
- package/dist/gateway/static/root/assets/{cron-dreaming-jobs-CwHDRLBz.js → cron-dreaming-jobs-D460WnXB.js} +2 -2
- package/dist/gateway/static/root/assets/{cron-dreaming-jobs-CwHDRLBz.js.map → cron-dreaming-jobs-D460WnXB.js.map} +1 -1
- package/dist/gateway/static/root/assets/{cron-page-CFlueTZj.js → cron-page-Df6AyXfn.js} +2 -2
- package/dist/gateway/static/root/assets/{cron-page-CFlueTZj.js.map → cron-page-Df6AyXfn.js.map} +1 -1
- package/dist/gateway/static/root/assets/{dist-CSVG5vdr.js → dist-DN37Fw0E.js} +2 -2
- package/dist/gateway/static/root/assets/{dist-CSVG5vdr.js.map → dist-DN37Fw0E.js.map} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-aOoL_ju3.js → extension-debug-page-CqdKfBv_.js} +2 -2
- package/dist/gateway/static/root/assets/{extension-debug-page-aOoL_ju3.js.map → extension-debug-page-CqdKfBv_.js.map} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BxTM48B9.js → extension-page-DhxjnfDf.js} +2 -2
- package/dist/gateway/static/root/assets/{extension-page-BxTM48B9.js.map → extension-page-DhxjnfDf.js.map} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-OuCiHlNV.js → extension-settings-page-B3uhrA_f.js} +2 -2
- package/dist/gateway/static/root/assets/{extension-settings-page-OuCiHlNV.js.map → extension-settings-page-B3uhrA_f.js.map} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-config-api-BLvyaYuj.js → heartbeat-config-api-z1kl5_rE.js} +2 -2
- package/dist/gateway/static/root/assets/{heartbeat-config-api-BLvyaYuj.js.map → heartbeat-config-api-z1kl5_rE.js.map} +1 -1
- package/dist/gateway/static/root/assets/{index-K0ZDwzeJ.css → index-B8G4Y9YY.css} +1 -1
- package/dist/gateway/static/root/assets/{index-AWwayu4P.js → index-BUYGk2UT.js} +93 -93
- package/dist/gateway/static/root/assets/{index-AWwayu4P.js.map → index-BUYGk2UT.js.map} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-DlOmjXKS.js → logs-page-Z9KRHWeO.js} +2 -2
- package/dist/gateway/static/root/assets/{logs-page-DlOmjXKS.js.map → logs-page-Z9KRHWeO.js.map} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-BYobQq7F.js → sessions-page-TlMYZxuv.js} +2 -2
- package/dist/gateway/static/root/assets/{sessions-page-BYobQq7F.js.map → sessions-page-TlMYZxuv.js.map} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-CEp0JJcg.js → settings-page-X8vVcB8e.js} +2 -2
- package/dist/gateway/static/root/assets/{settings-page-CEp0JJcg.js.map → settings-page-X8vVcB8e.js.map} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-D9e20h42.js → skills-page-B-tO9-I7.js} +2 -2
- package/dist/gateway/static/root/assets/{skills-page-D9e20h42.js.map → skills-page-B-tO9-I7.js.map} +1 -1
- package/dist/gateway/static/root/assets/{use-image-provider-credentials-BmC6x4fR.js → use-image-provider-credentials-DsYECmye.js} +2 -2
- package/dist/gateway/static/root/assets/{use-image-provider-credentials-BmC6x4fR.js.map → use-image-provider-credentials-DsYECmye.js.map} +1 -1
- package/dist/gateway/static/root/index.html +2 -2
- package/dist/package.js +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jszip.min-DVUfmhpE.js","assets/rolldown-runtime-DWdDZTNf.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{i as t,t as n}from"./vendor-react-DbimaAId.js";import{Cn as r}from"./vendor-codemirror-CXAvob9m.js";import{At as i,B as a,Cn as o,Di as s,Dt as c,Ei as ee,G as te,Gn as l,H as ne,Hr as re,In as u,K as d,L as ie,Mn as f,Mt as ae,Nt as p,Ot as oe,Qr as se,R as ce,Rn as le,Rr as ue,U as de,V as fe,W as pe,X as me,Xr as he,Y as m,Yn as h,_n as ge,dr as _e,fi as g,jn as ve,jt as _,ki as ye,mi as v,or as y,pi as be,pr as b,q as xe,qr as Se,vn as Ce,z as we}from"./index-AWwayu4P.js";import{a as Te,i as Ee,n as x,r as S,t as De}from"./dist-CSVG5vdr.js";var C=e(t(),1),w=n(),T=[{light:`bg-sky-100 text-sky-800`,dark:`dark:bg-sky-950/55 dark:text-sky-200`},{light:`bg-violet-100 text-violet-800`,dark:`dark:bg-violet-950/55 dark:text-violet-200`},{light:`bg-emerald-100 text-emerald-800`,dark:`dark:bg-emerald-950/55 dark:text-emerald-200`},{light:`bg-orange-100 text-orange-800`,dark:`dark:bg-orange-950/55 dark:text-orange-200`},{light:`bg-rose-100 text-rose-800`,dark:`dark:bg-rose-950/55 dark:text-rose-200`},{light:`bg-amber-100 text-amber-900`,dark:`dark:bg-amber-950/55 dark:text-amber-200`},{light:`bg-cyan-100 text-cyan-800`,dark:`dark:bg-cyan-950/55 dark:text-cyan-200`},{light:`bg-indigo-100 text-indigo-800`,dark:`dark:bg-indigo-950/55 dark:text-indigo-200`},{light:`bg-fuchsia-100 text-fuchsia-800`,dark:`dark:bg-fuchsia-950/55 dark:text-fuchsia-200`},{light:`bg-teal-100 text-teal-800`,dark:`dark:bg-teal-950/55 dark:text-teal-200`}];function E(e){let t=0;for(let n=0;n<e.length;n+=1)t=Math.imul(31,t)+e.charCodeAt(n)|0;return Math.abs(t)}function Oe(e){let t=e.trim();if(!t)return`?`;let n=t.match(/[\p{L}\p{N}]/u);return n?n[0].toLocaleUpperCase(`en-US`):t[0]}function ke({name:e,className:t}){let n=Oe(e),r=T[E(e)%T.length];return(0,w.jsx)(`div`,{className:u(`flex size-11 shrink-0 items-center justify-center rounded-xl font-semibold tracking-tight shadow-surface`,`text-[1.05rem] ring-1 ring-inset ring-black/[0.06] dark:ring-white/[0.1]`,`transition-[transform,box-shadow] duration-200 ease-out group-hover:ring-black/[0.1] dark:group-hover:ring-white/[0.14]`,`group-hover:-translate-y-px`,r.light,r.dark,t),"aria-hidden":!0,children:n})}var Ae=`https://skillhub.cn`;function je(e){let t=e.trim();return t?`${Ae}/skills/${encodeURIComponent(t)}`:null}function D(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function O(e){let t=[e.kind];return e.label?.trim()&&t.push(e.label.trim()),e.package?.trim()&&t.push(e.package.trim()),e.formula?.trim()&&t.push(e.formula.trim()),e.module?.trim()&&t.push(e.module.trim()),e.url?.trim()&&t.push(e.url.trim()),t.join(` · `)}function k(e){return{...e,enabled:e.enabled??!0,disableModelInvocation:e.disableModelInvocation??!1}}function A({label:e,children:t}){return t==null||t===!1?null:(0,w.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3 dark:border-edge/60`,children:[(0,w.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:e}),(0,w.jsx)(`div`,{className:`mt-1.5 min-w-0 text-sm text-fg`,children:t})]})}function j({preview:e,sk:t}){let n=e.metadata,r=e.toolConditions,i=!!r&&(r.requiresTools.length>0||r.requiresToolsets.length>0||r.fallbackForTools.length>0||r.fallbackForToolsets.length>0),a=n.requires,o=a&&((a.bins?.length??0)>0||(a.env?.length??0)>0||(a.anyBins?.length??0)>0),s=n.install?.filter(e=>e&&typeof e.kind==`string`)??[],c=e.requiredEnvVarNames?.filter(e=>e.trim())??[];return(0,w.jsxs)(`div`,{className:`space-y-6`,children:[(0,w.jsxs)(`section`,{"aria-labelledby":`skill-detail-summary-heading`,children:[(0,w.jsx)(`h3`,{id:`skill-detail-summary-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:t.detailSummaryHeading}),(0,w.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-base px-4 py-3 dark:bg-surface-hover/25`,children:[n.emoji?.trim()?(0,w.jsx)(`p`,{className:`text-2xl leading-none`,"aria-hidden":!0,children:n.emoji.trim()}):null,(0,w.jsx)(`p`,{className:u(`text-sm leading-relaxed text-fg`,n.emoji?.trim()?`mt-2`:``),children:e.description}),e.disableModelInvocation?(0,w.jsx)(`p`,{className:`mt-3 rounded-lg border border-amber-200/80 bg-amber-50/90 px-3 py-2 text-xs leading-snug text-amber-950 dark:border-amber-900/50 dark:bg-amber-950/40 dark:text-amber-100`,children:t.detailNotInjectedNote}):null,(0,w.jsx)(A,{label:t.detailHomepageLabel,children:n.homepage?.trim()?(0,w.jsx)(`a`,{href:n.homepage.trim(),target:`_blank`,rel:`noopener noreferrer`,className:`break-all text-accent underline-offset-2 hover:underline`,children:n.homepage.trim()}):null}),(0,w.jsx)(A,{label:t.detailPlatformsLabel,children:n.os&&n.os.length>0?(0,w.jsx)(`span`,{className:`font-mono text-xs text-fg-muted`,children:n.os.join(`, `)}):null}),(0,w.jsx)(A,{label:t.detailRequiresLabel,children:o&&a?(0,w.jsxs)(`ul`,{className:`list-inside list-disc space-y-1 text-sm text-fg-muted`,children:[a.bins&&a.bins.length>0?(0,w.jsxs)(`li`,{children:[(0,w.jsxs)(`span`,{className:`text-fg`,children:[t.detailRequiresBins,`: `]}),a.bins.join(`, `)]}):null,a.env&&a.env.length>0?(0,w.jsxs)(`li`,{children:[(0,w.jsxs)(`span`,{className:`text-fg`,children:[t.detailRequiresEnv,`: `]}),(0,w.jsx)(`span`,{className:`font-mono text-xs`,children:a.env.join(`, `)})]}):null,a.anyBins&&a.anyBins.length>0?(0,w.jsxs)(`li`,{children:[(0,w.jsxs)(`span`,{className:`text-fg`,children:[t.detailRequiresAnyBins,`: `]}),a.anyBins.join(`, `)]}):null]}):null}),(0,w.jsx)(A,{label:t.detailInstallLabel,children:s.length>0?(0,w.jsx)(`ul`,{className:`list-inside list-decimal space-y-1.5 text-sm text-fg-muted`,children:s.map((e,t)=>(0,w.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:(0,w.jsx)(`span`,{className:`text-fg`,children:O(e)})},e.id||`${e.kind}-${t}`))}):null}),(0,w.jsx)(A,{label:t.detailToolGatingLabel,children:i&&r?(0,w.jsxs)(`ul`,{className:`mt-1 space-y-2 text-sm text-fg-muted`,children:[r.requiresTools.length>0?(0,w.jsxs)(`li`,{children:[(0,w.jsxs)(`span`,{className:`font-medium text-fg`,children:[t.detailToolsRequiresList,`: `]}),r.requiresTools.join(`, `)]}):null,r.requiresToolsets.length>0?(0,w.jsxs)(`li`,{children:[(0,w.jsxs)(`span`,{className:`font-medium text-fg`,children:[t.detailToolsetsRequiresList,`: `]}),r.requiresToolsets.join(`, `)]}):null,r.fallbackForTools.length>0?(0,w.jsxs)(`li`,{children:[(0,w.jsxs)(`span`,{className:`font-medium text-fg`,children:[t.detailToolsFallbackList,`: `]}),r.fallbackForTools.join(`, `)]}):null,r.fallbackForToolsets.length>0?(0,w.jsxs)(`li`,{children:[(0,w.jsxs)(`span`,{className:`font-medium text-fg`,children:[t.detailToolsetsFallbackList,`: `]}),r.fallbackForToolsets.join(`, `)]}):null]}):null}),(0,w.jsx)(A,{label:t.detailEnvVarsLabel,children:c.length>0?(0,w.jsx)(`span`,{className:`font-mono text-xs text-fg-muted`,children:c.join(`, `)}):null})]})]}),(0,w.jsxs)(`section`,{"aria-labelledby":`skill-detail-instructions-heading`,children:[(0,w.jsx)(`h3`,{id:`skill-detail-instructions-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:t.detailInstructionsHeading}),e.bodyMarkdown.trim()?(0,w.jsx)(`div`,{className:`markdown-content min-w-0 break-words`,children:(0,w.jsx)(me,{content:e.bodyMarkdown})}):(0,w.jsx)(`p`,{className:`text-sm italic text-fg-muted`,children:t.detailNoInstructionsBody})]})]})}var Me=(0,C.memo)(function({loading:e,onReloadClick:t,searchQuery:n,setSearchQuery:r,mainTab:i,sk:a,setPendingFile:o,setInstallOpen:s}){return(0,w.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[(0,w.jsx)(f,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,disabled:e,title:a.reloadRuntime,"aria-label":a.reloadDiskAria,onClick:()=>void t(),children:(0,w.jsx)(_e,{className:u(`size-4`,e&&`animate-spin`),strokeWidth:1.75})}),(0,w.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill border border-edge bg-surface-base py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[(0,w.jsx)(y,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,w.jsx)(`input`,{type:`text`,role:`searchbox`,enterKeyHint:`search`,value:n,onChange:e=>r(e.target.value),placeholder:i===`marketplace`?a.marketplaceSearchPackages:a.searchPlaceholder,autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`})]}),(0,w.jsxs)(f,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,onClick:()=>{o(null),s(!0)},children:[(0,w.jsx)(b,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),a.installCta]})]})});function Ne({checked:e,onChange:t}){return(0,w.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,className:u(`relative h-6 w-10 shrink-0 overflow-hidden rounded-full border border-edge p-0.5`,`transition-[border-color,background-color] duration-200 ease-out`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,`active:scale-[0.97] motion-reduce:transition-none motion-reduce:active:scale-100`,e?`bg-accent`:`bg-surface-hover`),onClick:()=>t(!e),children:(0,w.jsx)(`span`,{className:u(`pointer-events-none absolute left-0.5 top-1/2 block size-4 -translate-y-1/2 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`,`transition-transform duration-200 ease-out motion-reduce:transition-none`,e?`translate-x-5`:`translate-x-0`),"aria-hidden":!0})})}function M(){let e=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;return(0,w.jsxs)(`div`,{className:`flex items-center gap-4 px-4 py-3.5`,"aria-hidden":!0,children:[(0,w.jsx)(`div`,{className:u(`size-11 shrink-0 rounded-xl`,e)}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,w.jsx)(`div`,{className:u(`h-4 max-w-[10rem]`,e)}),(0,w.jsx)(`div`,{className:u(`h-3 w-full max-w-xl rounded`,e)})]}),(0,w.jsx)(`div`,{className:u(`h-6 w-10 shrink-0 rounded-full`,e)})]})}function N(){let e=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;return(0,w.jsxs)(`div`,{className:`flex items-center gap-4 px-4 py-3.5`,"aria-hidden":!0,children:[(0,w.jsx)(`div`,{className:u(`size-11 shrink-0 rounded-xl`,e)}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2 pr-2`,children:[(0,w.jsx)(`div`,{className:u(`h-4 max-w-[12rem]`,e)}),(0,w.jsx)(`div`,{className:u(`h-3 w-full max-w-xl rounded`,e)}),(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 pt-0.5`,children:[(0,w.jsx)(`div`,{className:u(`h-5 w-[5.5rem] rounded-md`,e)}),(0,w.jsx)(`div`,{className:u(`h-5 w-16 rounded-md`,e)}),(0,w.jsx)(`div`,{className:u(`h-5 w-14 rounded-md`,e)})]})]}),(0,w.jsx)(`div`,{className:u(`h-9 min-w-[6.5rem] shrink-0 rounded-lg`,e)})]})}var P=new Set([`builtin`,`user`,`marketplace`]),Pe=new Set([`all`,`global`,`workspace`,`extra`]),Fe=[`business`,`creative`,`documents`,`engineering`,`tools`];function Ie({vm:e}){let{sk:t,hasToken:n,catalog:r,loading:a,error:o,uploading:s,searchQuery:ee,setSearchQuery:te,actionFeedback:ne,mainTab:d,setMainTab:ie,setSourceFilter:ce,builtinCategoryFilter:de,setBuiltinCategoryFilter:fe,installOpen:pe,setInstallOpen:_e,pendingFile:ve,setPendingFile:ye,dropActive:y,setDropActive:b,confirmOpen:xe,setConfirmOpen:Ce,confirmId:we,setConfirmId:T,togglingSkillName:E,enabledOverride:Oe,detailOpen:Ae,setDetailOpen:O,detailSource:k,setDetailSource:A,detailTitle:P,setDetailTitle:Pe,detailMarkdown:Fe,setDetailMarkdown:Ie,detailCatalogPreview:Le,setDetailCatalogPreview:F,detailMarketplacePreview:I,setDetailMarketplacePreview:L,detailLoading:Re,detailError:R,setDetailError:ze,marketSort:Be,setMarketSort:Ve,marketPage:z,setMarketPage:B,mpLoading:V,mpError:H,mpPayload:U,installingMarketName:W,marketCategoryId:G,setMarketCategoryId:He,mpCategories:K,mpCategoriesError:Ue,mpCategoriesLoading:q,marketplaceProviderId:We,builtinTabStats:Ge,userTabStats:Ke,detailEnabled:qe,filteredCatalog:J,builtinCategories:Y,categoryFilteredCatalog:X,filterLabel:Je,inSettingsShell:Ye,categoryLabel:Xe,onReloadClick:Ze,openSkillDetail:Qe,openMarketplaceDetail:$e,onSkillToggle:et,onInstallSubmit:Z,onFileInputChange:Q,onModalDragOver:tt,onModalDragLeave:nt,onModalDrop:rt,sourceLabel:it,runDelete:at,onMarketInstall:ot,isSkillInstalledByName:st,usingSkillInChatName:ct,onUseSkillInChat:$}=e,lt=ge(e=>e.setPageHeader),ut=ge(e=>e.clearPageHeader),dt=(0,C.useMemo)(()=>(0,w.jsx)(Me,{loading:a,onReloadClick:Ze,searchQuery:ee,setSearchQuery:te,mainTab:d,sk:t,setPendingFile:ye,setInstallOpen:_e}),[a,Ze,ee,te,d,t,ye,_e]);return(0,C.useLayoutEffect)(()=>!n||Ye?(ut(),()=>ut()):(lt({startExtra:null,main:null,end:dt}),()=>ut()),[ut,n,Ye,lt,dt]),n?(0,w.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto bg-surface-panel`,children:[(0,w.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-6 sm:px-8`,children:[ne?(0,w.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:u(`rounded-xl border px-3 py-2 text-sm`,ne.kind===`success`?`border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900/40 dark:bg-emerald-950/40 dark:text-emerald-200`:`border-red-200 bg-red-50 text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`),children:ne.message}):o?(0,w.jsx)(`div`,{className:`rounded-xl border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:o}):null,(0,w.jsx)(`header`,{className:`flex flex-col gap-4`,children:(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight text-fg`,children:t.title}),(0,w.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:t.tagline})]})}),Ye?(0,w.jsx)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-4 dark:border-edge-subtle sm:flex-row sm:flex-wrap sm:items-center sm:justify-end`,children:dt}):null,(0,w.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,w.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge-subtle`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-x-1 gap-y-1`,role:`tablist`,"aria-label":t.skillsNavAria,children:[(0,w.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":d===`marketplace`,className:u(`relative max-w-full rounded-md px-3 py-2 text-left text-sm font-medium transition-colors sm:text-center`,d===`marketplace`?`text-fg`:`text-fg-muted hover:text-fg`,d===`marketplace`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>ie(`marketplace`),children:[t.tabMarketplace,We?(0,w.jsxs)(`span`,{className:`font-normal text-fg-muted`,children:[`(`,We,`)`]}):null]}),(0,w.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":d===`builtin`,className:u(`relative rounded-md px-3 py-2 text-sm font-medium transition-colors`,d===`builtin`?`text-fg`:`text-fg-muted hover:text-fg`,d===`builtin`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>ie(`builtin`),children:[t.tabBuiltin,(0,w.jsxs)(`span`,{className:`ml-1 tabular-nums text-fg-muted`,children:[`(`,Ge.enabled,`/`,Ge.total,`)`]})]}),(0,w.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":d===`user`,className:u(`relative rounded-md px-3 py-2 text-sm font-medium transition-colors`,d===`user`?`text-fg`:`text-fg-muted hover:text-fg`,d===`user`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>ie(`user`),children:[t.tabUser,(0,w.jsxs)(`span`,{className:`ml-1 tabular-nums text-fg-muted`,children:[`(`,Ke.enabled,`/`,Ke.total,`)`]})]})]}),(0,w.jsxs)(`div`,{className:u(`flex min-h-9 min-w-0 items-center gap-2`,d===`user`?`flex-nowrap overflow-x-auto pb-0.5 sm:justify-end`:`flex-wrap sm:justify-end`),children:[d===`user`?(0,w.jsxs)(Ee,{children:[(0,w.jsx)(Te,{asChild:!0,children:(0,w.jsxs)(`button`,{type:`button`,className:u(`inline-flex h-9 min-h-9 min-w-[9rem] shrink-0 items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,m.transition,m.focusRingPanel),children:[(0,w.jsx)(re,{className:`size-3.5 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,w.jsx)(`span`,{children:Je}),(0,w.jsx)(v,{className:`size-3.5 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0})]})}),(0,w.jsx)(S,{children:(0,w.jsx)(De,{className:`z-50 min-w-[10rem] rounded-xl border border-edge bg-surface-panel p-1 shadow-popover dark:border-edge`,sideOffset:6,align:`end`,children:[`all`,`global`,`workspace`,`extra`].map(e=>(0,w.jsx)(x,{className:u(`cursor-pointer rounded-lg px-3 py-2 text-sm text-fg outline-none`,`hover:bg-surface-hover data-[highlighted]:bg-surface-hover`),onSelect:()=>ce(e),children:e===`all`?t.filterAll:e===`global`?t.filterGlobal:e===`workspace`?t.filterWorkspace:t.filterExtra},e))})})]}):null,d===`marketplace`?(0,w.jsxs)(Ee,{children:[(0,w.jsx)(Te,{asChild:!0,children:(0,w.jsxs)(`button`,{type:`button`,className:u(`inline-flex h-9 min-h-9 min-w-[9rem] shrink-0 items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,m.transition,m.focusRingPanel),children:[(0,w.jsx)(re,{className:`size-3.5 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,w.jsx)(`span`,{children:Be===`newest`?t.marketplaceSortNewest:t.marketplaceSortDownloads}),(0,w.jsx)(v,{className:`size-3.5 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0})]})}),(0,w.jsx)(S,{children:(0,w.jsxs)(De,{className:`z-50 min-w-[10rem] rounded-xl border border-edge bg-surface-panel p-1 shadow-popover dark:border-edge`,sideOffset:6,align:`end`,children:[(0,w.jsx)(x,{className:u(`cursor-pointer rounded-lg px-3 py-2 text-sm text-fg outline-none`,`hover:bg-surface-hover data-[highlighted]:bg-surface-hover`),onSelect:()=>Ve(`downloads`),children:t.marketplaceSortDownloads}),(0,w.jsx)(x,{className:u(`cursor-pointer rounded-lg px-3 py-2 text-sm text-fg outline-none`,`hover:bg-surface-hover data-[highlighted]:bg-surface-hover`),onSelect:()=>Ve(`newest`),children:t.marketplaceSortNewest})]})})]}):null,d===`builtin`?(0,w.jsx)(`div`,{className:`h-9 min-w-[9rem] shrink-0`,"aria-hidden":!0}):null]})]}),d===`marketplace`?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:u(`-mx-1 flex min-h-[2.75rem] items-center gap-2 overflow-x-auto px-1 pb-1 pt-0.5 [scrollbar-width:thin]`,!q&&K.length===0&&`min-h-0 pb-0 pt-0`),role:K.length>0||q?`tablist`:void 0,"aria-label":K.length>0||q?t.marketplaceCategoriesAria:void 0,children:K.length>0?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":G===``,className:u(`shrink-0 rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,m.focusRingPanel,G===``?`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`),onClick:()=>He(``),children:t.marketplaceCategoryAll}),K.map(e=>{let t=G===e.id;return(0,w.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t,className:u(`max-w-[14rem] shrink-0 truncate rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,m.focusRingPanel,t?`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`),title:e.label,onClick:()=>He(e.id),children:e.label},e.id)})]}):q?(0,w.jsx)(`div`,{className:`flex gap-2 px-1`,"aria-hidden":!0,children:Array.from({length:5},(e,t)=>(0,w.jsx)(`div`,{className:`h-8 w-[4.5rem] shrink-0 animate-pulse rounded-full bg-surface-hover motion-reduce:animate-none dark:bg-surface-active/50`},t))}):null}),Ue?(0,w.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,role:`alert`,children:Ue}):null,V?(0,w.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base dark:border-edge-subtle`,"aria-busy":`true`,"aria-label":t.loading,children:Array.from({length:6},(e,t)=>(0,w.jsx)(N,{},t))}):H?(0,w.jsx)(`div`,{className:`rounded-xl border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:H}):!U||U.items.length===0?(0,w.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base dark:border-edge-subtle`,children:U.items.map(e=>{let n=st(e.id),r=W===e.id,i=We===`skillhub`?je(e.id):null;return(0,w.jsxs)(`article`,{className:u(`group relative flex items-center gap-4 border-b border-edge-subtle px-4 py-3.5 last:border-b-0`,`transition-colors hover:bg-surface-hover/50 dark:hover:bg-surface-hover/25`),children:[(0,w.jsxs)(`div`,{role:`button`,tabIndex:0,className:u(`flex min-w-0 flex-1 cursor-pointer items-start gap-4 rounded-lg text-left outline-none`,m.focusRingPanel),"aria-labelledby":`mp-skill-title-${e.id}`,onClick:t=>{t.target.closest(`a[href]`)||$e(e.id,e.name)},onKeyDown:t=>{t.target.closest(`a[href]`)||(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),$e(e.id,e.name))},children:[(0,w.jsx)(ke,{name:e.id}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1 pr-2`,children:[(0,w.jsx)(`h3`,{id:`mp-skill-title-${e.id}`,className:`text-[15px] font-semibold leading-snug tracking-tight text-fg`,children:e.name}),(0,w.jsx)(`p`,{className:`mt-0.5 truncate text-sm leading-relaxed text-fg-muted`,title:e.description?e.description:void 0,children:e.description||`—`}),(0,w.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,w.jsxs)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:[t.marketplaceAuthor,`: `,e.author.username]}),(0,w.jsxs)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:[t.marketplaceDownloads,`: `,e.downloads]}),e.stars!=null&&e.stars>0?(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:[(0,w.jsx)(h,{className:`size-3 shrink-0 text-amber-600 dark:text-amber-400`,strokeWidth:2,"aria-hidden":!0}),e.stars]}):null,e.sourceLabel?(0,w.jsxs)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:[t.marketplaceSource,`: `,e.sourceLabel]}):null,e.latestVersion?(0,w.jsxs)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 font-mono text-[10px] dark:bg-surface-active/50`,children:[t.marketplaceVersion,`: `,e.latestVersion]}):null,n?(0,w.jsx)(`span`,{className:`rounded-md bg-emerald-500/15 px-2 py-0.5 text-emerald-800 dark:text-emerald-200`,children:t.marketplaceInstalled}):null,i?(0,w.jsxs)(`a`,{href:i,target:`_blank`,rel:`noopener noreferrer`,className:u(`inline-flex items-center gap-0.5 rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,`hover:bg-surface-hover/80 hover:text-fg-muted dark:hover:bg-surface-active/70`,m.focusRingPanel),"aria-label":t.marketplaceOpenOnSkillhubAria,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:[(0,w.jsx)(he,{className:`size-3 shrink-0`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceOpenOnSkillhub]}):null]})]})]}),(0,w.jsx)(`div`,{className:`flex shrink-0 justify-end sm:pl-2`,children:(0,w.jsx)(f,{type:`button`,variant:n?`secondary`:`primary`,className:`min-w-[6.5rem]`,disabled:r||V,onClick:()=>void ot(e.id),children:r?t.uploading:n?t.marketplaceReinstall:t.marketplaceInstall})})]},e.id)})}),(0,w.jsxs)(`div`,{className:`flex flex-col items-center justify-between gap-3 sm:flex-row`,children:[(0,w.jsx)(`p`,{className:`text-center text-xs text-fg-muted sm:text-left`,children:D(t.marketplacePageStatus,{page:U.meta.page,totalPages:U.meta.totalPages,total:U.meta.total})}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsxs)(f,{type:`button`,variant:`ghost`,className:`h-9 gap-1 px-2`,disabled:V||z<=1,"aria-label":t.marketplacePagePrev,onClick:()=>B(e=>Math.max(1,e-1)),children:[(0,w.jsx)(be,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:t.marketplacePagePrev})]}),(0,w.jsxs)(f,{type:`button`,variant:`ghost`,className:`h-9 gap-1 px-2`,disabled:V||z>=U.meta.totalPages,"aria-label":t.marketplacePageNext,onClick:()=>B(e=>Math.min(U.meta.totalPages,e+1)),children:[(0,w.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:t.marketplacePageNext}),(0,w.jsx)(g,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})]})]})]})]})]}):(0,w.jsx)(w.Fragment,{children:a?(0,w.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base dark:border-edge-subtle`,"aria-busy":`true`,"aria-label":t.loading,children:Array.from({length:6},(e,t)=>(0,w.jsx)(M,{},t))}):r.length===0?(0,w.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:t.empty}):J.length===0?(0,w.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:t.noSearchResults}):(0,w.jsxs)(w.Fragment,{children:[Y.length>1?(0,w.jsxs)(`div`,{role:`tablist`,"aria-label":t.marketplaceCategoriesAria,className:`-mx-1 flex gap-2 overflow-x-auto px-1 pb-1 pt-0.5 [scrollbar-width:thin]`,children:[(0,w.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":de===``,className:u(`shrink-0 rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,m.focusRingPanel,de===``?`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`),onClick:()=>fe(``),children:t.marketplaceCategoryAll}),Y.map(e=>{let t=de===e;return(0,w.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t,className:u(`max-w-[14rem] shrink-0 truncate rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,m.focusRingPanel,t?`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`),title:Xe(e),onClick:()=>fe(e),children:Xe(e)},e)})]}):null,X.length===0?(0,w.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:t.noSearchResults}):(0,w.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base dark:border-edge-subtle`,children:X.map((e,n,r)=>(0,w.jsxs)(`article`,{className:u(`group relative flex items-center gap-4 border-b border-edge-subtle px-4 py-3.5`,n===r.length-1&&`border-b-0`,`transition-colors hover:bg-surface-hover/50 dark:hover:bg-surface-hover/25`),children:[(0,w.jsxs)(`button`,{type:`button`,className:u(`flex min-w-0 flex-1 cursor-pointer items-center gap-4 rounded-lg text-left outline-none`,m.focusRingPanel),onClick:()=>void Qe(e),children:[(0,w.jsx)(ke,{name:e.name}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1 pr-2`,children:[(0,w.jsx)(`h3`,{className:`text-[15px] font-semibold leading-snug tracking-tight text-fg`,children:e.name}),(0,w.jsx)(`p`,{className:`mt-0.5 truncate text-sm leading-relaxed text-fg-muted`,title:e.description?e.description:void 0,children:e.description||`—`}),d!==`builtin`||e.managed?(0,w.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[d===`builtin`?null:(0,w.jsx)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:it(e.source)}),e.managed?(0,w.jsxs)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:[t.col.managed,`: `,t.yes]}):null,e.hub?(0,w.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-hover/60 px-2 py-0.5 font-mono text-[10px] dark:bg-surface-active/50`,title:`${e.hub.source}${e.hub.ref?`\nref: ${e.hub.ref}`:``}\nupdated: ${e.hub.updatedAt}`,children:[t.hubRemote,` ·`,` `,e.hub.kind===`git`?t.hubKindGit:t.hubKindArchive,` ·`,` `,e.hub.source.length>48?`${e.hub.source.slice(0,48)}…`:e.hub.source]}):null]}):null]})]}),(0,w.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,onClick:e=>e.stopPropagation(),role:`presentation`,children:[e.managed?(0,w.jsxs)(Ee,{children:[(0,w.jsx)(Te,{asChild:!0,children:(0,w.jsx)(`button`,{type:`button`,className:u(`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,m.focusRingPanel),"aria-label":t.col.actions,children:(0,w.jsx)(se,{className:`size-4`,strokeWidth:1.75})})}),(0,w.jsx)(S,{children:(0,w.jsx)(De,{className:`z-50 min-w-[8rem] rounded-xl border border-edge bg-surface-panel p-1 shadow-popover dark:border-edge`,sideOffset:4,align:`end`,children:(0,w.jsxs)(x,{className:u(`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-600 outline-none`,`hover:bg-red-50 data-[highlighted]:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),onSelect:()=>{T(e.directoryId),Ce(!0)},children:[(0,w.jsx)(l,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t.delete]})})})]}):null,(0,w.jsx)(Ne,{checked:Oe[e.name]??e.enabled,onChange:t=>void et(e.name,t)})]})]},`${e.directoryId}-${e.path}`))})]})})]})]}),(0,w.jsx)(ae,{open:Ae,onOpenChange:e=>{O(e),e||(A(`catalog`),Ie(``),F(null),L(null),ze(null),Pe(``))},children:(0,w.jsxs)(_,{children:[(0,w.jsx)(i,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,w.jsxs)(oe,{className:u(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(88vh,44rem)] max-h-[min(92vh,56rem)] w-[min(100%-2rem,min(92vw,56rem))]`,`-translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),children:[(0,w.jsxs)(`div`,{className:`group flex min-h-[3.25rem] shrink-0 items-center gap-3 border-b border-edge px-4 py-3`,children:[(0,w.jsx)(ke,{name:P||`?`}),(0,w.jsx)(p,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:P||`—`}),(0,w.jsx)(c,{asChild:!0,children:(0,w.jsx)(`button`,{type:`button`,className:u(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,m.focusRingPanel),"aria-label":t.detailCloseAria,children:(0,w.jsx)(le,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})})})]}),(0,w.jsxs)(`div`,{className:`flex min-h-[3.25rem] shrink-0 items-start gap-2 border-b border-blue-200/80 bg-blue-50/95 px-4 py-2.5 text-sm text-fg dark:border-blue-900/50 dark:bg-blue-950/45`,children:[(0,w.jsx)(ue,{className:`mt-0.5 size-4 shrink-0 text-blue-600 dark:text-blue-400`,strokeWidth:1.75,"aria-hidden":!0}),(0,w.jsx)(`p`,{className:`min-w-0 leading-relaxed`,children:k===`store`&&I?t.detailModalBanner:k===`store`?t.detailModalBannerStore:t.detailModalBanner})]}),(0,w.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-auto px-4 py-4`,children:Re?(0,w.jsx)(`div`,{className:`flex h-full min-h-[14rem] flex-col gap-2.5 py-1`,"aria-busy":`true`,"aria-label":t.loading,children:Array.from({length:10},(e,t)=>(0,w.jsx)(`div`,{className:u(`h-4 animate-pulse rounded-md bg-surface-hover dark:bg-surface-active/50`,t%3==0?`w-[92%]`:t%3==1?`w-full`:`w-4/5`)},t))}):R?(0,w.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:R}):k===`catalog`&&Le?(0,w.jsx)(j,{preview:Le,sk:t}):k===`store`&&I?(0,w.jsx)(j,{preview:I,sk:t}):(0,w.jsx)(`div`,{className:`markdown-content min-w-0 break-words`,children:(0,w.jsx)(me,{content:Fe})})}),(0,w.jsx)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:k===`store`?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(f,{type:`button`,variant:`ghost`,onClick:()=>O(!1),children:t.cancel}),(0,w.jsx)(f,{type:`button`,variant:`secondary`,disabled:!P||Re||ct===P||W===P,onClick:()=>void $(),children:ct===P?t.previewUseInChatBusy:t.previewUseInChat}),(0,w.jsx)(f,{type:`button`,variant:st(P)?`secondary`:`primary`,disabled:!P||W===P,onClick:()=>{P&&ot(P)},children:W===P?t.uploading:st(P)?t.marketplaceReinstall:t.marketplaceInstall})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(f,{type:`button`,variant:`secondary`,disabled:!P||Re||ct===P||E===P,onClick:()=>void $(),children:ct===P?t.previewUseInChatBusy:t.previewUseInChat}),(0,w.jsx)(f,{type:`button`,variant:`primary`,disabled:!P||E===P,onClick:async()=>{P&&await et(P,!qe)&&O(!1)},children:qe?t.detailModalDisable:t.detailModalEnable})]})})]})]})}),(0,w.jsx)(ae,{open:pe,onOpenChange:e=>{_e(e),e||(ye(null),b(!1))},children:(0,w.jsxs)(_,{children:[(0,w.jsx)(i,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,w.jsxs)(oe,{className:u(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] max-h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,48rem))] -translate-x-1/2 -translate-y-1/2 overflow-y-auto`,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-float dark:border-edge`),children:[(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,w.jsx)(p,{className:`text-base font-semibold text-fg`,children:t.installModalTitle}),(0,w.jsx)(c,{asChild:!0,children:(0,w.jsxs)(`button`,{type:`button`,className:u(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,m.focusRingPanel),"aria-label":t.installClose,children:[(0,w.jsx)(le,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`sr-only`,children:t.installClose})]})})]}),(0,w.jsxs)(`label`,{className:u(`mt-4 flex min-h-[11rem] cursor-pointer flex-col items-center justify-center gap-3 rounded-xl border-2 border-dashed px-6 py-12 text-center transition-colors`,y?`border-accent bg-accent-soft/60 dark:bg-blue-950/40`:`border-edge bg-surface-base dark:bg-surface-hover/30`),onDragLeave:nt,onDragOver:tt,onDrop:rt,children:[(0,w.jsx)(`input`,{type:`file`,accept:`.zip,.md,application/zip,text/markdown`,className:`sr-only`,"aria-label":t.installModalDropHint,disabled:s,onChange:Q}),(0,w.jsx)(Se,{className:`size-12 text-fg-subtle`,strokeWidth:1.25,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`text-sm text-fg-muted`,children:t.installModalDropHint}),ve?(0,w.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:ve.name}):null]}),(0,w.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,w.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.installModalReqTitle}),(0,w.jsxs)(`ul`,{className:`list-inside list-disc space-y-1 text-sm text-fg-muted`,children:[(0,w.jsx)(`li`,{children:t.installModalReq1}),(0,w.jsx)(`li`,{children:t.installModalReq2})]})]}),(0,w.jsx)(`button`,{type:`button`,disabled:!ve||s,className:u(`mt-6 flex w-full items-center justify-center rounded-xl py-3 text-sm font-semibold`,`transition-colors`,!ve||s?`cursor-not-allowed bg-surface-active text-fg-disabled`:`bg-accent text-white hover:bg-accent-hover`,m.focusRingPanel),onClick:()=>void Z(),children:s?t.uploading:t.installAction})]})]})}),(0,w.jsx)(ae,{open:xe,onOpenChange:e=>{Ce(e),e||T(null)},children:(0,w.jsxs)(_,{children:[(0,w.jsx)(i,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,w.jsxs)(oe,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,children:[(0,w.jsx)(p,{className:`text-base font-semibold text-fg`,children:t.deleteTitle}),(0,w.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:we?D(t.deleteMessage,{id:we}):``}),(0,w.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,w.jsx)(f,{type:`button`,variant:`secondary`,onClick:()=>Ce(!1),children:t.cancel}),(0,w.jsx)(f,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>void at(),children:t.deleteConfirm})]})]})]})})]}):(0,w.jsx)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-16 text-center text-sm text-fg-muted sm:px-8`,children:t.needToken})}async function Le(t){let n=t.name.toLowerCase();if(n.endsWith(`.zip`))return t;if(n.endsWith(`skill.md`)){let n=(await r(async()=>{let{default:t}=await import(`./jszip.min-DVUfmhpE.js`).then(t=>e(t.default,1));return{default:t}},__vite__mapDeps([0,1]))).default,i=new n;i.file(`SKILL.md`,await t.arrayBuffer());let a=await i.generateAsync({type:`blob`,compression:`DEFLATE`}),o=t.name.replace(/\.md$/i,``).replace(/\s+/g,`-`)||`skill`;return new File([a],`${o}.zip`,{type:`application/zip`})}throw Error(`invalid`)}function F(){let e=o(e=>e.language),t=ve(e).skills,n=!!Ce(e=>e.token),r=s(),[i,c]=ye(),[l,re]=(0,C.useState)([]),[u,f]=(0,C.useState)(!1),[ae,p]=(0,C.useState)(null),[oe,se]=(0,C.useState)(!1),le=i.get(`q`)??``,ue=i.get(`tab`),me=i.get(`source`),he=P.has(ue)?ue:`marketplace`,m=Pe.has(me)?me:`all`,[h,ge]=(0,C.useState)(le),[_e,g]=(0,C.useState)(null),[_,v]=(0,C.useState)(he),[y,be]=(0,C.useState)(m),[b,Se]=(0,C.useState)(``),[Te,Ee]=(0,C.useState)(!1),[x,S]=(0,C.useState)(null),[De,w]=(0,C.useState)(!1),[T,E]=(0,C.useState)(!1),[Oe,ke]=(0,C.useState)(null),[Ae,je]=(0,C.useState)(null),[D,O]=(0,C.useState)({}),[A,j]=(0,C.useState)(!1),[Me,Ne]=(0,C.useState)(`catalog`),[M,N]=(0,C.useState)(``),[Ie,F]=(0,C.useState)(``),[I,L]=(0,C.useState)(null),[Re,R]=(0,C.useState)(null),[ze,Be]=(0,C.useState)(!1),[Ve,z]=(0,C.useState)(null),[B,V]=(0,C.useState)(`downloads`),[H,U]=(0,C.useState)(1),[W,G]=(0,C.useState)(!1),[He,K]=(0,C.useState)(null),[Ue,q]=(0,C.useState)(null),[We,Ge]=(0,C.useState)(null),[Ke,qe]=(0,C.useState)(null),[J,Y]=(0,C.useState)(``),[X,Je]=(0,C.useState)([]),[Ye,Xe]=(0,C.useState)(null),[Ze,Qe]=(0,C.useState)(!1),[$e,et]=(0,C.useState)(null),Z=(0,C.useCallback)(async n=>{let r=n?.silent===!0;r||f(!0),p(null);try{return re((await de(e===`en`?void 0:e)).catalog.map(k)),{ok:!0}}catch(e){let n=e instanceof Error?e.message:t.loadFailed;return p(n),{ok:!1,message:n}}finally{r||f(!1)}},[e,t.loadFailed]);(0,C.useEffect)(()=>{n&&Z()},[n,Z]),(0,C.useEffect)(()=>{if(!n){et(null);return}let e=!1;return a().then(t=>{e||et(t.provider)}).catch(()=>{e||et(null)}),()=>{e=!0}},[n]),(0,C.useEffect)(()=>{let e=i.get(`q`)??``,t=i.get(`tab`),n=i.get(`source`),r=P.has(t)?t:`marketplace`,a=Pe.has(n)?n:`all`;ge(t=>t===e?t:e),v(e=>e===r?e:r),be(e=>e===a?e:a);let o=i.get(`mcat`)??``;Y(r===`marketplace`?e=>e===o?e:o:``)},[i]),(0,C.useEffect)(()=>{_===`marketplace`&&U(1)},[h,B,_,J]),(0,C.useLayoutEffect)(()=>{!n||_!==`marketplace`||G(!0)},[n,_,J,H,B,h]),(0,C.useLayoutEffect)(()=>{!n||_!==`marketplace`||Qe(!0)},[n,_]),(0,C.useEffect)(()=>{_!==`marketplace`&&(Je([]),Xe(null),Qe(!1))},[_]),(0,C.useEffect)(()=>{if(!n||_!==`marketplace`)return;let e=!1;return K(null),fe({q:h.trim()||void 0,page:H,pageSize:20,sort:B,category:J.trim()||void 0}).then(t=>{e||q(t)}).catch(n=>{e||(K(n instanceof Error?n.message:t.marketplaceLoadFailed),q(null))}).finally(()=>{e||G(!1)}),()=>{e=!0}},[n,_,J,H,B,h,t.marketplaceLoadFailed]),(0,C.useEffect)(()=>{if(!n||_!==`marketplace`)return;let e=!1;return Xe(null),ce().then(t=>{e||Je(t.items)}).catch(n=>{e||(Je([]),Xe(n instanceof Error?n.message:t.marketplaceCategoriesFailed))}).finally(()=>{e||Qe(!1)}),()=>{e=!0,Qe(!1)}},[n,_,t.marketplaceCategoriesFailed]),(0,C.useEffect)(()=>{!J.trim()||X.length===0||X.some(e=>e.id===J)||Y(``)},[X,J]),(0,C.useEffect)(()=>{c(e=>{let t=new URLSearchParams(e),n=h.trim();return n?t.set(`q`,n):t.delete(`q`),_===`marketplace`?t.delete(`tab`):t.set(`tab`,_),y===`all`?t.delete(`source`):t.set(`source`,y),_===`marketplace`&&J.trim()?t.set(`mcat`,J.trim()):t.delete(`mcat`),t.toString()===e.toString()?e:t},{replace:!0})},[_,J,h,c,y]);let Q=(0,C.useCallback)((e,t,n=5e3)=>{g({kind:e,message:t}),window.setTimeout(()=>g(null),n)},[]),tt=(0,C.useCallback)(async n=>{Ne(`catalog`),j(!0),N(n.name),F(``),L(null),R(null),z(null),Be(!0);try{let t=await ne(n.name,e===`en`?void 0:e);L(t),N(t.name)}catch(e){L(null),z(e instanceof Error?e.message:t.detailLoadFailed)}finally{Be(!1)}},[e,t.detailLoadFailed]),nt=(0,C.useCallback)(async(e,n)=>{Ne(`store`),j(!0),N(n?.trim()||e),F(``),L(null),R(null),z(null),Be(!0);try{let n=await we(e);if(N(n.name),n.skillDocPreview)R(n.skillDocPreview),F(``);else{R(null);let e=n.readme?.trim();e?F(e):n.description?.trim()?F(`## ${n.name}\n\n${n.description.trim()}`):F(`*${t.marketplaceNoReadme}*`)}}catch(e){R(null),z(e instanceof Error?e.message:t.detailLoadFailed)}finally{Be(!1)}},[t.detailLoadFailed,t.marketplaceNoReadme]),rt=(0,C.useCallback)(async(e,n)=>{je(e),O(t=>({...t,[e]:n})),g(null);try{return await te(e,n),await Z({silent:!0}),!0}catch(n){return O(t=>{let{[e]:n,...r}=t;return r}),Q(`error`,n instanceof Error?n.message:t.skillToggleFailed),!1}finally{je(null),O(t=>{let{[e]:n,...r}=t;return r})}},[Z,Q,t.skillToggleFailed]),it=(0,C.useCallback)(async()=>{g(null),f(!0),p(null);try{await d()}catch(e){p(e instanceof Error?e.message:t.reloadFailed),f(!1);return}await Z()},[Z,t.reloadFailed]),at=(0,C.useMemo)(()=>{let e=l.filter(e=>e.source===`builtin`);return{total:e.length,enabled:e.filter(e=>D[e.name]??e.enabled).length}},[l,D]),ot=(0,C.useMemo)(()=>{let e=l.filter(e=>e.source!==`builtin`);return{total:e.length,enabled:e.filter(e=>D[e.name]??e.enabled).length}},[l,D]),st=(0,C.useMemo)(()=>M?l.find(e=>e.name===M):void 0,[l,M]),ct=st==null?!0:D[M]??st.enabled,$=(0,C.useMemo)(()=>{let e=h.trim().toLowerCase(),t=l;return _===`builtin`?t=t.filter(e=>e.source===`builtin`):(t=t.filter(e=>e.source!==`builtin`),y!==`all`&&(t=t.filter(e=>e.source===y))),e?t.filter(t=>[t.name,t.description,t.directoryId,t.path,t.source,t.hub?.source,t.hub?.ref].filter(Boolean).join(` `).toLowerCase().includes(e)):t},[l,h,_,y]),lt=(0,C.useMemo)(()=>{let e=new Set,t=[];for(let n of $){let r=n.category;!r||e.has(r)||(e.add(r),t.push(r))}return t.sort((e,t)=>{let n=Fe.indexOf(e),r=Fe.indexOf(t);return n>=0&&r>=0?n-r:n>=0?-1:r>=0?1:e.localeCompare(t)})},[$]),ut=(0,C.useCallback)(e=>t.categoryLabel?.[e]||e,[t.categoryLabel]),dt=(0,C.useMemo)(()=>b?$.filter(e=>e.category===b):$,[$,b]),ft=async e=>{g(null),se(!0),p(null);try{let n;try{n=await Le(e)}catch{p(t.invalidFile),Q(`error`,t.invalidFile);return}await xe(n,{overwrite:!0}),await Z(),Q(`success`,t.installSuccess),Ee(!1),S(null),v(`user`)}catch(e){p(e instanceof Error?e.message:t.uploadFailed),Q(`error`,e instanceof Error?e.message:t.uploadFailed)}finally{se(!1)}},pt=()=>{x&&ft(x)},mt=e=>{let t=e.target.files?.[0];e.target.value=``,t&&S(t)},ht=e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.types.includes(`Files`)&&(w(!0),e.dataTransfer.dropEffect=`copy`)},gt=e=>{let t=e.currentTarget,n=e.relatedTarget;n&&t.contains(n)||w(!1)},_t=e=>{e.preventDefault(),e.stopPropagation(),w(!1);let t=e.dataTransfer?.files?.[0];t&&S(t)},vt=e=>{switch(e){case`builtin`:return t.source.builtin;case`workspace`:return t.source.workspace;case`global`:return t.source.global;case`extra`:return t.source.extra;default:return e}},yt=async()=>{let e=Oe;if(E(!1),ke(null),e){g(null);try{await ie(e),await Z()}catch(e){p(e instanceof Error?e.message:t.deleteFailed)}}},bt=(0,C.useCallback)(e=>l.some(t=>t.name===e),[l]),xt=(0,C.useCallback)(async()=>{let e=M.trim();if(!e)return;g(null);let n=Me===`store`&&!bt(e);n&&qe(e);try{n&&(await pe({name:e,overwrite:!1}),await Z({silent:!0})),j(!1),r(`/chat/new?skill=${encodeURIComponent(e)}`)}catch(e){Q(`error`,e instanceof Error?e.message:t.uploadFailed)}finally{qe(null)}},[M,Me,bt,Z,r,Q,t.uploadFailed]),St=(0,C.useCallback)(async e=>{let n=bt(e);if(!(n&&!window.confirm(t.marketplaceReinstallConfirm))){g(null),Ge(e);try{await pe({name:e,overwrite:n}),await Z({silent:!0}),Q(`success`,t.installSuccess),j(!1),v(`user`)}catch(e){Q(`error`,e instanceof Error?e.message:t.uploadFailed)}finally{Ge(null)}}},[bt,Z,Q,t.installSuccess,t.marketplaceReinstallConfirm,t.uploadFailed]),Ct=y===`all`?t.filterAll:y===`global`?t.filterGlobal:y===`workspace`?t.filterWorkspace:t.filterExtra,{pathname:wt}=ee();return{sk:t,hasToken:n,catalog:l,loading:u,error:ae,uploading:oe,searchQuery:h,setSearchQuery:ge,actionFeedback:_e,mainTab:_,setMainTab:v,sourceFilter:y,setSourceFilter:be,builtinCategoryFilter:b,setBuiltinCategoryFilter:Se,installOpen:Te,setInstallOpen:Ee,pendingFile:x,setPendingFile:S,dropActive:De,setDropActive:w,confirmOpen:T,setConfirmOpen:E,confirmId:Oe,setConfirmId:ke,togglingSkillName:Ae,enabledOverride:D,detailOpen:A,setDetailOpen:j,detailSource:Me,setDetailSource:Ne,detailTitle:M,setDetailTitle:N,detailMarkdown:Ie,setDetailMarkdown:F,detailCatalogPreview:I,setDetailCatalogPreview:L,detailMarketplacePreview:Re,setDetailMarketplacePreview:R,detailLoading:ze,detailError:Ve,setDetailError:z,marketSort:B,setMarketSort:V,marketPage:H,setMarketPage:U,mpLoading:W,mpError:He,mpPayload:Ue,installingMarketName:We,usingSkillInChatName:Ke,onUseSkillInChat:xt,marketCategoryId:J,setMarketCategoryId:Y,mpCategories:X,mpCategoriesError:Ye,mpCategoriesLoading:Ze,marketplaceProviderId:$e,builtinTabStats:at,userTabStats:ot,detailEnabled:ct,filteredCatalog:$,builtinCategories:lt,categoryFilteredCatalog:dt,filterLabel:Ct,inSettingsShell:wt.startsWith(`/settings/`),categoryLabel:ut,onReloadClick:it,openSkillDetail:tt,openMarketplaceDetail:nt,onSkillToggle:rt,onInstallSubmit:pt,onFileInputChange:mt,onModalDragOver:ht,onModalDragLeave:gt,onModalDrop:_t,sourceLabel:vt,runDelete:yt,onMarketInstall:St,isSkillInstalledByName:bt}}function I(){return(0,w.jsx)(Ie,{vm:F()})}export{I as SkillsPage};
|
|
3
|
-
//# sourceMappingURL=skills-page-
|
|
2
|
+
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{i as t,t as n}from"./vendor-react-DbimaAId.js";import{Cn as r}from"./vendor-codemirror-CXAvob9m.js";import{At as i,B as a,Cn as o,Di as s,Dt as c,Ei as ee,G as te,Gn as l,H as ne,Hr as re,In as u,K as d,L as ie,Mn as f,Mt as ae,Nt as p,Ot as oe,Qr as se,R as ce,Rn as le,Rr as ue,U as de,V as fe,W as pe,X as me,Xr as he,Y as m,Yn as h,_n as ge,dr as _e,fi as g,jn as ve,jt as _,ki as ye,mi as v,or as y,pi as be,pr as b,q as xe,qr as Se,vn as Ce,z as we}from"./index-BUYGk2UT.js";import{a as Te,i as Ee,n as x,r as S,t as De}from"./dist-DN37Fw0E.js";var C=e(t(),1),w=n(),T=[{light:`bg-sky-100 text-sky-800`,dark:`dark:bg-sky-950/55 dark:text-sky-200`},{light:`bg-violet-100 text-violet-800`,dark:`dark:bg-violet-950/55 dark:text-violet-200`},{light:`bg-emerald-100 text-emerald-800`,dark:`dark:bg-emerald-950/55 dark:text-emerald-200`},{light:`bg-orange-100 text-orange-800`,dark:`dark:bg-orange-950/55 dark:text-orange-200`},{light:`bg-rose-100 text-rose-800`,dark:`dark:bg-rose-950/55 dark:text-rose-200`},{light:`bg-amber-100 text-amber-900`,dark:`dark:bg-amber-950/55 dark:text-amber-200`},{light:`bg-cyan-100 text-cyan-800`,dark:`dark:bg-cyan-950/55 dark:text-cyan-200`},{light:`bg-indigo-100 text-indigo-800`,dark:`dark:bg-indigo-950/55 dark:text-indigo-200`},{light:`bg-fuchsia-100 text-fuchsia-800`,dark:`dark:bg-fuchsia-950/55 dark:text-fuchsia-200`},{light:`bg-teal-100 text-teal-800`,dark:`dark:bg-teal-950/55 dark:text-teal-200`}];function E(e){let t=0;for(let n=0;n<e.length;n+=1)t=Math.imul(31,t)+e.charCodeAt(n)|0;return Math.abs(t)}function Oe(e){let t=e.trim();if(!t)return`?`;let n=t.match(/[\p{L}\p{N}]/u);return n?n[0].toLocaleUpperCase(`en-US`):t[0]}function ke({name:e,className:t}){let n=Oe(e),r=T[E(e)%T.length];return(0,w.jsx)(`div`,{className:u(`flex size-11 shrink-0 items-center justify-center rounded-xl font-semibold tracking-tight shadow-surface`,`text-[1.05rem] ring-1 ring-inset ring-black/[0.06] dark:ring-white/[0.1]`,`transition-[transform,box-shadow] duration-200 ease-out group-hover:ring-black/[0.1] dark:group-hover:ring-white/[0.14]`,`group-hover:-translate-y-px`,r.light,r.dark,t),"aria-hidden":!0,children:n})}var Ae=`https://skillhub.cn`;function je(e){let t=e.trim();return t?`${Ae}/skills/${encodeURIComponent(t)}`:null}function D(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function O(e){let t=[e.kind];return e.label?.trim()&&t.push(e.label.trim()),e.package?.trim()&&t.push(e.package.trim()),e.formula?.trim()&&t.push(e.formula.trim()),e.module?.trim()&&t.push(e.module.trim()),e.url?.trim()&&t.push(e.url.trim()),t.join(` · `)}function k(e){return{...e,enabled:e.enabled??!0,disableModelInvocation:e.disableModelInvocation??!1}}function A({label:e,children:t}){return t==null||t===!1?null:(0,w.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3 dark:border-edge/60`,children:[(0,w.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:e}),(0,w.jsx)(`div`,{className:`mt-1.5 min-w-0 text-sm text-fg`,children:t})]})}function j({preview:e,sk:t}){let n=e.metadata,r=e.toolConditions,i=!!r&&(r.requiresTools.length>0||r.requiresToolsets.length>0||r.fallbackForTools.length>0||r.fallbackForToolsets.length>0),a=n.requires,o=a&&((a.bins?.length??0)>0||(a.env?.length??0)>0||(a.anyBins?.length??0)>0),s=n.install?.filter(e=>e&&typeof e.kind==`string`)??[],c=e.requiredEnvVarNames?.filter(e=>e.trim())??[];return(0,w.jsxs)(`div`,{className:`space-y-6`,children:[(0,w.jsxs)(`section`,{"aria-labelledby":`skill-detail-summary-heading`,children:[(0,w.jsx)(`h3`,{id:`skill-detail-summary-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:t.detailSummaryHeading}),(0,w.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-base px-4 py-3 dark:bg-surface-hover/25`,children:[n.emoji?.trim()?(0,w.jsx)(`p`,{className:`text-2xl leading-none`,"aria-hidden":!0,children:n.emoji.trim()}):null,(0,w.jsx)(`p`,{className:u(`text-sm leading-relaxed text-fg`,n.emoji?.trim()?`mt-2`:``),children:e.description}),e.disableModelInvocation?(0,w.jsx)(`p`,{className:`mt-3 rounded-lg border border-amber-200/80 bg-amber-50/90 px-3 py-2 text-xs leading-snug text-amber-950 dark:border-amber-900/50 dark:bg-amber-950/40 dark:text-amber-100`,children:t.detailNotInjectedNote}):null,(0,w.jsx)(A,{label:t.detailHomepageLabel,children:n.homepage?.trim()?(0,w.jsx)(`a`,{href:n.homepage.trim(),target:`_blank`,rel:`noopener noreferrer`,className:`break-all text-accent underline-offset-2 hover:underline`,children:n.homepage.trim()}):null}),(0,w.jsx)(A,{label:t.detailPlatformsLabel,children:n.os&&n.os.length>0?(0,w.jsx)(`span`,{className:`font-mono text-xs text-fg-muted`,children:n.os.join(`, `)}):null}),(0,w.jsx)(A,{label:t.detailRequiresLabel,children:o&&a?(0,w.jsxs)(`ul`,{className:`list-inside list-disc space-y-1 text-sm text-fg-muted`,children:[a.bins&&a.bins.length>0?(0,w.jsxs)(`li`,{children:[(0,w.jsxs)(`span`,{className:`text-fg`,children:[t.detailRequiresBins,`: `]}),a.bins.join(`, `)]}):null,a.env&&a.env.length>0?(0,w.jsxs)(`li`,{children:[(0,w.jsxs)(`span`,{className:`text-fg`,children:[t.detailRequiresEnv,`: `]}),(0,w.jsx)(`span`,{className:`font-mono text-xs`,children:a.env.join(`, `)})]}):null,a.anyBins&&a.anyBins.length>0?(0,w.jsxs)(`li`,{children:[(0,w.jsxs)(`span`,{className:`text-fg`,children:[t.detailRequiresAnyBins,`: `]}),a.anyBins.join(`, `)]}):null]}):null}),(0,w.jsx)(A,{label:t.detailInstallLabel,children:s.length>0?(0,w.jsx)(`ul`,{className:`list-inside list-decimal space-y-1.5 text-sm text-fg-muted`,children:s.map((e,t)=>(0,w.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:(0,w.jsx)(`span`,{className:`text-fg`,children:O(e)})},e.id||`${e.kind}-${t}`))}):null}),(0,w.jsx)(A,{label:t.detailToolGatingLabel,children:i&&r?(0,w.jsxs)(`ul`,{className:`mt-1 space-y-2 text-sm text-fg-muted`,children:[r.requiresTools.length>0?(0,w.jsxs)(`li`,{children:[(0,w.jsxs)(`span`,{className:`font-medium text-fg`,children:[t.detailToolsRequiresList,`: `]}),r.requiresTools.join(`, `)]}):null,r.requiresToolsets.length>0?(0,w.jsxs)(`li`,{children:[(0,w.jsxs)(`span`,{className:`font-medium text-fg`,children:[t.detailToolsetsRequiresList,`: `]}),r.requiresToolsets.join(`, `)]}):null,r.fallbackForTools.length>0?(0,w.jsxs)(`li`,{children:[(0,w.jsxs)(`span`,{className:`font-medium text-fg`,children:[t.detailToolsFallbackList,`: `]}),r.fallbackForTools.join(`, `)]}):null,r.fallbackForToolsets.length>0?(0,w.jsxs)(`li`,{children:[(0,w.jsxs)(`span`,{className:`font-medium text-fg`,children:[t.detailToolsetsFallbackList,`: `]}),r.fallbackForToolsets.join(`, `)]}):null]}):null}),(0,w.jsx)(A,{label:t.detailEnvVarsLabel,children:c.length>0?(0,w.jsx)(`span`,{className:`font-mono text-xs text-fg-muted`,children:c.join(`, `)}):null})]})]}),(0,w.jsxs)(`section`,{"aria-labelledby":`skill-detail-instructions-heading`,children:[(0,w.jsx)(`h3`,{id:`skill-detail-instructions-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:t.detailInstructionsHeading}),e.bodyMarkdown.trim()?(0,w.jsx)(`div`,{className:`markdown-content min-w-0 break-words`,children:(0,w.jsx)(me,{content:e.bodyMarkdown})}):(0,w.jsx)(`p`,{className:`text-sm italic text-fg-muted`,children:t.detailNoInstructionsBody})]})]})}var Me=(0,C.memo)(function({loading:e,onReloadClick:t,searchQuery:n,setSearchQuery:r,mainTab:i,sk:a,setPendingFile:o,setInstallOpen:s}){return(0,w.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[(0,w.jsx)(f,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,disabled:e,title:a.reloadRuntime,"aria-label":a.reloadDiskAria,onClick:()=>void t(),children:(0,w.jsx)(_e,{className:u(`size-4`,e&&`animate-spin`),strokeWidth:1.75})}),(0,w.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill border border-edge bg-surface-base py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[(0,w.jsx)(y,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,w.jsx)(`input`,{type:`text`,role:`searchbox`,enterKeyHint:`search`,value:n,onChange:e=>r(e.target.value),placeholder:i===`marketplace`?a.marketplaceSearchPackages:a.searchPlaceholder,autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`})]}),(0,w.jsxs)(f,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,onClick:()=>{o(null),s(!0)},children:[(0,w.jsx)(b,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),a.installCta]})]})});function Ne({checked:e,onChange:t}){return(0,w.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,className:u(`relative h-6 w-10 shrink-0 overflow-hidden rounded-full border border-edge p-0.5`,`transition-[border-color,background-color] duration-200 ease-out`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,`active:scale-[0.97] motion-reduce:transition-none motion-reduce:active:scale-100`,e?`bg-accent`:`bg-surface-hover`),onClick:()=>t(!e),children:(0,w.jsx)(`span`,{className:u(`pointer-events-none absolute left-0.5 top-1/2 block size-4 -translate-y-1/2 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`,`transition-transform duration-200 ease-out motion-reduce:transition-none`,e?`translate-x-5`:`translate-x-0`),"aria-hidden":!0})})}function M(){let e=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;return(0,w.jsxs)(`div`,{className:`flex items-center gap-4 px-4 py-3.5`,"aria-hidden":!0,children:[(0,w.jsx)(`div`,{className:u(`size-11 shrink-0 rounded-xl`,e)}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,w.jsx)(`div`,{className:u(`h-4 max-w-[10rem]`,e)}),(0,w.jsx)(`div`,{className:u(`h-3 w-full max-w-xl rounded`,e)})]}),(0,w.jsx)(`div`,{className:u(`h-6 w-10 shrink-0 rounded-full`,e)})]})}function N(){let e=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;return(0,w.jsxs)(`div`,{className:`flex items-center gap-4 px-4 py-3.5`,"aria-hidden":!0,children:[(0,w.jsx)(`div`,{className:u(`size-11 shrink-0 rounded-xl`,e)}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2 pr-2`,children:[(0,w.jsx)(`div`,{className:u(`h-4 max-w-[12rem]`,e)}),(0,w.jsx)(`div`,{className:u(`h-3 w-full max-w-xl rounded`,e)}),(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 pt-0.5`,children:[(0,w.jsx)(`div`,{className:u(`h-5 w-[5.5rem] rounded-md`,e)}),(0,w.jsx)(`div`,{className:u(`h-5 w-16 rounded-md`,e)}),(0,w.jsx)(`div`,{className:u(`h-5 w-14 rounded-md`,e)})]})]}),(0,w.jsx)(`div`,{className:u(`h-9 min-w-[6.5rem] shrink-0 rounded-lg`,e)})]})}var P=new Set([`builtin`,`user`,`marketplace`]),Pe=new Set([`all`,`global`,`workspace`,`extra`]),Fe=[`business`,`creative`,`documents`,`engineering`,`tools`];function Ie({vm:e}){let{sk:t,hasToken:n,catalog:r,loading:a,error:o,uploading:s,searchQuery:ee,setSearchQuery:te,actionFeedback:ne,mainTab:d,setMainTab:ie,setSourceFilter:ce,builtinCategoryFilter:de,setBuiltinCategoryFilter:fe,installOpen:pe,setInstallOpen:_e,pendingFile:ve,setPendingFile:ye,dropActive:y,setDropActive:b,confirmOpen:xe,setConfirmOpen:Ce,confirmId:we,setConfirmId:T,togglingSkillName:E,enabledOverride:Oe,detailOpen:Ae,setDetailOpen:O,detailSource:k,setDetailSource:A,detailTitle:P,setDetailTitle:Pe,detailMarkdown:Fe,setDetailMarkdown:Ie,detailCatalogPreview:Le,setDetailCatalogPreview:F,detailMarketplacePreview:I,setDetailMarketplacePreview:L,detailLoading:Re,detailError:R,setDetailError:ze,marketSort:Be,setMarketSort:Ve,marketPage:z,setMarketPage:B,mpLoading:V,mpError:H,mpPayload:U,installingMarketName:W,marketCategoryId:G,setMarketCategoryId:He,mpCategories:K,mpCategoriesError:Ue,mpCategoriesLoading:q,marketplaceProviderId:We,builtinTabStats:Ge,userTabStats:Ke,detailEnabled:qe,filteredCatalog:J,builtinCategories:Y,categoryFilteredCatalog:X,filterLabel:Je,inSettingsShell:Ye,categoryLabel:Xe,onReloadClick:Ze,openSkillDetail:Qe,openMarketplaceDetail:$e,onSkillToggle:et,onInstallSubmit:Z,onFileInputChange:Q,onModalDragOver:tt,onModalDragLeave:nt,onModalDrop:rt,sourceLabel:it,runDelete:at,onMarketInstall:ot,isSkillInstalledByName:st,usingSkillInChatName:ct,onUseSkillInChat:$}=e,lt=ge(e=>e.setPageHeader),ut=ge(e=>e.clearPageHeader),dt=(0,C.useMemo)(()=>(0,w.jsx)(Me,{loading:a,onReloadClick:Ze,searchQuery:ee,setSearchQuery:te,mainTab:d,sk:t,setPendingFile:ye,setInstallOpen:_e}),[a,Ze,ee,te,d,t,ye,_e]);return(0,C.useLayoutEffect)(()=>!n||Ye?(ut(),()=>ut()):(lt({startExtra:null,main:null,end:dt}),()=>ut()),[ut,n,Ye,lt,dt]),n?(0,w.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto bg-surface-panel`,children:[(0,w.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-6 sm:px-8`,children:[ne?(0,w.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:u(`rounded-xl border px-3 py-2 text-sm`,ne.kind===`success`?`border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900/40 dark:bg-emerald-950/40 dark:text-emerald-200`:`border-red-200 bg-red-50 text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`),children:ne.message}):o?(0,w.jsx)(`div`,{className:`rounded-xl border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:o}):null,(0,w.jsx)(`header`,{className:`flex flex-col gap-4`,children:(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight text-fg`,children:t.title}),(0,w.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:t.tagline})]})}),Ye?(0,w.jsx)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-4 dark:border-edge-subtle sm:flex-row sm:flex-wrap sm:items-center sm:justify-end`,children:dt}):null,(0,w.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,w.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge-subtle`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-x-1 gap-y-1`,role:`tablist`,"aria-label":t.skillsNavAria,children:[(0,w.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":d===`marketplace`,className:u(`relative max-w-full rounded-md px-3 py-2 text-left text-sm font-medium transition-colors sm:text-center`,d===`marketplace`?`text-fg`:`text-fg-muted hover:text-fg`,d===`marketplace`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>ie(`marketplace`),children:[t.tabMarketplace,We?(0,w.jsxs)(`span`,{className:`font-normal text-fg-muted`,children:[`(`,We,`)`]}):null]}),(0,w.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":d===`builtin`,className:u(`relative rounded-md px-3 py-2 text-sm font-medium transition-colors`,d===`builtin`?`text-fg`:`text-fg-muted hover:text-fg`,d===`builtin`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>ie(`builtin`),children:[t.tabBuiltin,(0,w.jsxs)(`span`,{className:`ml-1 tabular-nums text-fg-muted`,children:[`(`,Ge.enabled,`/`,Ge.total,`)`]})]}),(0,w.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":d===`user`,className:u(`relative rounded-md px-3 py-2 text-sm font-medium transition-colors`,d===`user`?`text-fg`:`text-fg-muted hover:text-fg`,d===`user`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>ie(`user`),children:[t.tabUser,(0,w.jsxs)(`span`,{className:`ml-1 tabular-nums text-fg-muted`,children:[`(`,Ke.enabled,`/`,Ke.total,`)`]})]})]}),(0,w.jsxs)(`div`,{className:u(`flex min-h-9 min-w-0 items-center gap-2`,d===`user`?`flex-nowrap overflow-x-auto pb-0.5 sm:justify-end`:`flex-wrap sm:justify-end`),children:[d===`user`?(0,w.jsxs)(Ee,{children:[(0,w.jsx)(Te,{asChild:!0,children:(0,w.jsxs)(`button`,{type:`button`,className:u(`inline-flex h-9 min-h-9 min-w-[9rem] shrink-0 items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,m.transition,m.focusRingPanel),children:[(0,w.jsx)(re,{className:`size-3.5 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,w.jsx)(`span`,{children:Je}),(0,w.jsx)(v,{className:`size-3.5 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0})]})}),(0,w.jsx)(S,{children:(0,w.jsx)(De,{className:`z-50 min-w-[10rem] rounded-xl border border-edge bg-surface-panel p-1 shadow-popover dark:border-edge`,sideOffset:6,align:`end`,children:[`all`,`global`,`workspace`,`extra`].map(e=>(0,w.jsx)(x,{className:u(`cursor-pointer rounded-lg px-3 py-2 text-sm text-fg outline-none`,`hover:bg-surface-hover data-[highlighted]:bg-surface-hover`),onSelect:()=>ce(e),children:e===`all`?t.filterAll:e===`global`?t.filterGlobal:e===`workspace`?t.filterWorkspace:t.filterExtra},e))})})]}):null,d===`marketplace`?(0,w.jsxs)(Ee,{children:[(0,w.jsx)(Te,{asChild:!0,children:(0,w.jsxs)(`button`,{type:`button`,className:u(`inline-flex h-9 min-h-9 min-w-[9rem] shrink-0 items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,m.transition,m.focusRingPanel),children:[(0,w.jsx)(re,{className:`size-3.5 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,w.jsx)(`span`,{children:Be===`newest`?t.marketplaceSortNewest:t.marketplaceSortDownloads}),(0,w.jsx)(v,{className:`size-3.5 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0})]})}),(0,w.jsx)(S,{children:(0,w.jsxs)(De,{className:`z-50 min-w-[10rem] rounded-xl border border-edge bg-surface-panel p-1 shadow-popover dark:border-edge`,sideOffset:6,align:`end`,children:[(0,w.jsx)(x,{className:u(`cursor-pointer rounded-lg px-3 py-2 text-sm text-fg outline-none`,`hover:bg-surface-hover data-[highlighted]:bg-surface-hover`),onSelect:()=>Ve(`downloads`),children:t.marketplaceSortDownloads}),(0,w.jsx)(x,{className:u(`cursor-pointer rounded-lg px-3 py-2 text-sm text-fg outline-none`,`hover:bg-surface-hover data-[highlighted]:bg-surface-hover`),onSelect:()=>Ve(`newest`),children:t.marketplaceSortNewest})]})})]}):null,d===`builtin`?(0,w.jsx)(`div`,{className:`h-9 min-w-[9rem] shrink-0`,"aria-hidden":!0}):null]})]}),d===`marketplace`?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:u(`-mx-1 flex min-h-[2.75rem] items-center gap-2 overflow-x-auto px-1 pb-1 pt-0.5 [scrollbar-width:thin]`,!q&&K.length===0&&`min-h-0 pb-0 pt-0`),role:K.length>0||q?`tablist`:void 0,"aria-label":K.length>0||q?t.marketplaceCategoriesAria:void 0,children:K.length>0?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":G===``,className:u(`shrink-0 rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,m.focusRingPanel,G===``?`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`),onClick:()=>He(``),children:t.marketplaceCategoryAll}),K.map(e=>{let t=G===e.id;return(0,w.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t,className:u(`max-w-[14rem] shrink-0 truncate rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,m.focusRingPanel,t?`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`),title:e.label,onClick:()=>He(e.id),children:e.label},e.id)})]}):q?(0,w.jsx)(`div`,{className:`flex gap-2 px-1`,"aria-hidden":!0,children:Array.from({length:5},(e,t)=>(0,w.jsx)(`div`,{className:`h-8 w-[4.5rem] shrink-0 animate-pulse rounded-full bg-surface-hover motion-reduce:animate-none dark:bg-surface-active/50`},t))}):null}),Ue?(0,w.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,role:`alert`,children:Ue}):null,V?(0,w.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base dark:border-edge-subtle`,"aria-busy":`true`,"aria-label":t.loading,children:Array.from({length:6},(e,t)=>(0,w.jsx)(N,{},t))}):H?(0,w.jsx)(`div`,{className:`rounded-xl border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:H}):!U||U.items.length===0?(0,w.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base dark:border-edge-subtle`,children:U.items.map(e=>{let n=st(e.id),r=W===e.id,i=We===`skillhub`?je(e.id):null;return(0,w.jsxs)(`article`,{className:u(`group relative flex items-center gap-4 border-b border-edge-subtle px-4 py-3.5 last:border-b-0`,`transition-colors hover:bg-surface-hover/50 dark:hover:bg-surface-hover/25`),children:[(0,w.jsxs)(`div`,{role:`button`,tabIndex:0,className:u(`flex min-w-0 flex-1 cursor-pointer items-start gap-4 rounded-lg text-left outline-none`,m.focusRingPanel),"aria-labelledby":`mp-skill-title-${e.id}`,onClick:t=>{t.target.closest(`a[href]`)||$e(e.id,e.name)},onKeyDown:t=>{t.target.closest(`a[href]`)||(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),$e(e.id,e.name))},children:[(0,w.jsx)(ke,{name:e.id}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1 pr-2`,children:[(0,w.jsx)(`h3`,{id:`mp-skill-title-${e.id}`,className:`text-[15px] font-semibold leading-snug tracking-tight text-fg`,children:e.name}),(0,w.jsx)(`p`,{className:`mt-0.5 truncate text-sm leading-relaxed text-fg-muted`,title:e.description?e.description:void 0,children:e.description||`—`}),(0,w.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,w.jsxs)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:[t.marketplaceAuthor,`: `,e.author.username]}),(0,w.jsxs)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:[t.marketplaceDownloads,`: `,e.downloads]}),e.stars!=null&&e.stars>0?(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:[(0,w.jsx)(h,{className:`size-3 shrink-0 text-amber-600 dark:text-amber-400`,strokeWidth:2,"aria-hidden":!0}),e.stars]}):null,e.sourceLabel?(0,w.jsxs)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:[t.marketplaceSource,`: `,e.sourceLabel]}):null,e.latestVersion?(0,w.jsxs)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 font-mono text-[10px] dark:bg-surface-active/50`,children:[t.marketplaceVersion,`: `,e.latestVersion]}):null,n?(0,w.jsx)(`span`,{className:`rounded-md bg-emerald-500/15 px-2 py-0.5 text-emerald-800 dark:text-emerald-200`,children:t.marketplaceInstalled}):null,i?(0,w.jsxs)(`a`,{href:i,target:`_blank`,rel:`noopener noreferrer`,className:u(`inline-flex items-center gap-0.5 rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,`hover:bg-surface-hover/80 hover:text-fg-muted dark:hover:bg-surface-active/70`,m.focusRingPanel),"aria-label":t.marketplaceOpenOnSkillhubAria,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:[(0,w.jsx)(he,{className:`size-3 shrink-0`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceOpenOnSkillhub]}):null]})]})]}),(0,w.jsx)(`div`,{className:`flex shrink-0 justify-end sm:pl-2`,children:(0,w.jsx)(f,{type:`button`,variant:n?`secondary`:`primary`,className:`min-w-[6.5rem]`,disabled:r||V,onClick:()=>void ot(e.id),children:r?t.uploading:n?t.marketplaceReinstall:t.marketplaceInstall})})]},e.id)})}),(0,w.jsxs)(`div`,{className:`flex flex-col items-center justify-between gap-3 sm:flex-row`,children:[(0,w.jsx)(`p`,{className:`text-center text-xs text-fg-muted sm:text-left`,children:D(t.marketplacePageStatus,{page:U.meta.page,totalPages:U.meta.totalPages,total:U.meta.total})}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsxs)(f,{type:`button`,variant:`ghost`,className:`h-9 gap-1 px-2`,disabled:V||z<=1,"aria-label":t.marketplacePagePrev,onClick:()=>B(e=>Math.max(1,e-1)),children:[(0,w.jsx)(be,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:t.marketplacePagePrev})]}),(0,w.jsxs)(f,{type:`button`,variant:`ghost`,className:`h-9 gap-1 px-2`,disabled:V||z>=U.meta.totalPages,"aria-label":t.marketplacePageNext,onClick:()=>B(e=>Math.min(U.meta.totalPages,e+1)),children:[(0,w.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:t.marketplacePageNext}),(0,w.jsx)(g,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})]})]})]})]})]}):(0,w.jsx)(w.Fragment,{children:a?(0,w.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base dark:border-edge-subtle`,"aria-busy":`true`,"aria-label":t.loading,children:Array.from({length:6},(e,t)=>(0,w.jsx)(M,{},t))}):r.length===0?(0,w.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:t.empty}):J.length===0?(0,w.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:t.noSearchResults}):(0,w.jsxs)(w.Fragment,{children:[Y.length>1?(0,w.jsxs)(`div`,{role:`tablist`,"aria-label":t.marketplaceCategoriesAria,className:`-mx-1 flex gap-2 overflow-x-auto px-1 pb-1 pt-0.5 [scrollbar-width:thin]`,children:[(0,w.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":de===``,className:u(`shrink-0 rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,m.focusRingPanel,de===``?`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`),onClick:()=>fe(``),children:t.marketplaceCategoryAll}),Y.map(e=>{let t=de===e;return(0,w.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t,className:u(`max-w-[14rem] shrink-0 truncate rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,m.focusRingPanel,t?`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`),title:Xe(e),onClick:()=>fe(e),children:Xe(e)},e)})]}):null,X.length===0?(0,w.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:t.noSearchResults}):(0,w.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base dark:border-edge-subtle`,children:X.map((e,n,r)=>(0,w.jsxs)(`article`,{className:u(`group relative flex items-center gap-4 border-b border-edge-subtle px-4 py-3.5`,n===r.length-1&&`border-b-0`,`transition-colors hover:bg-surface-hover/50 dark:hover:bg-surface-hover/25`),children:[(0,w.jsxs)(`button`,{type:`button`,className:u(`flex min-w-0 flex-1 cursor-pointer items-center gap-4 rounded-lg text-left outline-none`,m.focusRingPanel),onClick:()=>void Qe(e),children:[(0,w.jsx)(ke,{name:e.name}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1 pr-2`,children:[(0,w.jsx)(`h3`,{className:`text-[15px] font-semibold leading-snug tracking-tight text-fg`,children:e.name}),(0,w.jsx)(`p`,{className:`mt-0.5 truncate text-sm leading-relaxed text-fg-muted`,title:e.description?e.description:void 0,children:e.description||`—`}),d!==`builtin`||e.managed?(0,w.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[d===`builtin`?null:(0,w.jsx)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:it(e.source)}),e.managed?(0,w.jsxs)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:[t.col.managed,`: `,t.yes]}):null,e.hub?(0,w.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-hover/60 px-2 py-0.5 font-mono text-[10px] dark:bg-surface-active/50`,title:`${e.hub.source}${e.hub.ref?`\nref: ${e.hub.ref}`:``}\nupdated: ${e.hub.updatedAt}`,children:[t.hubRemote,` ·`,` `,e.hub.kind===`git`?t.hubKindGit:t.hubKindArchive,` ·`,` `,e.hub.source.length>48?`${e.hub.source.slice(0,48)}…`:e.hub.source]}):null]}):null]})]}),(0,w.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,onClick:e=>e.stopPropagation(),role:`presentation`,children:[e.managed?(0,w.jsxs)(Ee,{children:[(0,w.jsx)(Te,{asChild:!0,children:(0,w.jsx)(`button`,{type:`button`,className:u(`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,m.focusRingPanel),"aria-label":t.col.actions,children:(0,w.jsx)(se,{className:`size-4`,strokeWidth:1.75})})}),(0,w.jsx)(S,{children:(0,w.jsx)(De,{className:`z-50 min-w-[8rem] rounded-xl border border-edge bg-surface-panel p-1 shadow-popover dark:border-edge`,sideOffset:4,align:`end`,children:(0,w.jsxs)(x,{className:u(`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-600 outline-none`,`hover:bg-red-50 data-[highlighted]:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),onSelect:()=>{T(e.directoryId),Ce(!0)},children:[(0,w.jsx)(l,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t.delete]})})})]}):null,(0,w.jsx)(Ne,{checked:Oe[e.name]??e.enabled,onChange:t=>void et(e.name,t)})]})]},`${e.directoryId}-${e.path}`))})]})})]})]}),(0,w.jsx)(ae,{open:Ae,onOpenChange:e=>{O(e),e||(A(`catalog`),Ie(``),F(null),L(null),ze(null),Pe(``))},children:(0,w.jsxs)(_,{children:[(0,w.jsx)(i,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,w.jsxs)(oe,{className:u(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(88vh,44rem)] max-h-[min(92vh,56rem)] w-[min(100%-2rem,min(92vw,56rem))]`,`-translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),children:[(0,w.jsxs)(`div`,{className:`group flex min-h-[3.25rem] shrink-0 items-center gap-3 border-b border-edge px-4 py-3`,children:[(0,w.jsx)(ke,{name:P||`?`}),(0,w.jsx)(p,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:P||`—`}),(0,w.jsx)(c,{asChild:!0,children:(0,w.jsx)(`button`,{type:`button`,className:u(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,m.focusRingPanel),"aria-label":t.detailCloseAria,children:(0,w.jsx)(le,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})})})]}),(0,w.jsxs)(`div`,{className:`flex min-h-[3.25rem] shrink-0 items-start gap-2 border-b border-blue-200/80 bg-blue-50/95 px-4 py-2.5 text-sm text-fg dark:border-blue-900/50 dark:bg-blue-950/45`,children:[(0,w.jsx)(ue,{className:`mt-0.5 size-4 shrink-0 text-blue-600 dark:text-blue-400`,strokeWidth:1.75,"aria-hidden":!0}),(0,w.jsx)(`p`,{className:`min-w-0 leading-relaxed`,children:k===`store`&&I?t.detailModalBanner:k===`store`?t.detailModalBannerStore:t.detailModalBanner})]}),(0,w.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-auto px-4 py-4`,children:Re?(0,w.jsx)(`div`,{className:`flex h-full min-h-[14rem] flex-col gap-2.5 py-1`,"aria-busy":`true`,"aria-label":t.loading,children:Array.from({length:10},(e,t)=>(0,w.jsx)(`div`,{className:u(`h-4 animate-pulse rounded-md bg-surface-hover dark:bg-surface-active/50`,t%3==0?`w-[92%]`:t%3==1?`w-full`:`w-4/5`)},t))}):R?(0,w.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:R}):k===`catalog`&&Le?(0,w.jsx)(j,{preview:Le,sk:t}):k===`store`&&I?(0,w.jsx)(j,{preview:I,sk:t}):(0,w.jsx)(`div`,{className:`markdown-content min-w-0 break-words`,children:(0,w.jsx)(me,{content:Fe})})}),(0,w.jsx)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:k===`store`?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(f,{type:`button`,variant:`ghost`,onClick:()=>O(!1),children:t.cancel}),(0,w.jsx)(f,{type:`button`,variant:`secondary`,disabled:!P||Re||ct===P||W===P,onClick:()=>void $(),children:ct===P?t.previewUseInChatBusy:t.previewUseInChat}),(0,w.jsx)(f,{type:`button`,variant:st(P)?`secondary`:`primary`,disabled:!P||W===P,onClick:()=>{P&&ot(P)},children:W===P?t.uploading:st(P)?t.marketplaceReinstall:t.marketplaceInstall})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(f,{type:`button`,variant:`secondary`,disabled:!P||Re||ct===P||E===P,onClick:()=>void $(),children:ct===P?t.previewUseInChatBusy:t.previewUseInChat}),(0,w.jsx)(f,{type:`button`,variant:`primary`,disabled:!P||E===P,onClick:async()=>{P&&await et(P,!qe)&&O(!1)},children:qe?t.detailModalDisable:t.detailModalEnable})]})})]})]})}),(0,w.jsx)(ae,{open:pe,onOpenChange:e=>{_e(e),e||(ye(null),b(!1))},children:(0,w.jsxs)(_,{children:[(0,w.jsx)(i,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,w.jsxs)(oe,{className:u(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] max-h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,48rem))] -translate-x-1/2 -translate-y-1/2 overflow-y-auto`,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-float dark:border-edge`),children:[(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,w.jsx)(p,{className:`text-base font-semibold text-fg`,children:t.installModalTitle}),(0,w.jsx)(c,{asChild:!0,children:(0,w.jsxs)(`button`,{type:`button`,className:u(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,m.focusRingPanel),"aria-label":t.installClose,children:[(0,w.jsx)(le,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`sr-only`,children:t.installClose})]})})]}),(0,w.jsxs)(`label`,{className:u(`mt-4 flex min-h-[11rem] cursor-pointer flex-col items-center justify-center gap-3 rounded-xl border-2 border-dashed px-6 py-12 text-center transition-colors`,y?`border-accent bg-accent-soft/60 dark:bg-blue-950/40`:`border-edge bg-surface-base dark:bg-surface-hover/30`),onDragLeave:nt,onDragOver:tt,onDrop:rt,children:[(0,w.jsx)(`input`,{type:`file`,accept:`.zip,.md,application/zip,text/markdown`,className:`sr-only`,"aria-label":t.installModalDropHint,disabled:s,onChange:Q}),(0,w.jsx)(Se,{className:`size-12 text-fg-subtle`,strokeWidth:1.25,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`text-sm text-fg-muted`,children:t.installModalDropHint}),ve?(0,w.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:ve.name}):null]}),(0,w.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,w.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.installModalReqTitle}),(0,w.jsxs)(`ul`,{className:`list-inside list-disc space-y-1 text-sm text-fg-muted`,children:[(0,w.jsx)(`li`,{children:t.installModalReq1}),(0,w.jsx)(`li`,{children:t.installModalReq2})]})]}),(0,w.jsx)(`button`,{type:`button`,disabled:!ve||s,className:u(`mt-6 flex w-full items-center justify-center rounded-xl py-3 text-sm font-semibold`,`transition-colors`,!ve||s?`cursor-not-allowed bg-surface-active text-fg-disabled`:`bg-accent text-white hover:bg-accent-hover`,m.focusRingPanel),onClick:()=>void Z(),children:s?t.uploading:t.installAction})]})]})}),(0,w.jsx)(ae,{open:xe,onOpenChange:e=>{Ce(e),e||T(null)},children:(0,w.jsxs)(_,{children:[(0,w.jsx)(i,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,w.jsxs)(oe,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,children:[(0,w.jsx)(p,{className:`text-base font-semibold text-fg`,children:t.deleteTitle}),(0,w.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:we?D(t.deleteMessage,{id:we}):``}),(0,w.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,w.jsx)(f,{type:`button`,variant:`secondary`,onClick:()=>Ce(!1),children:t.cancel}),(0,w.jsx)(f,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>void at(),children:t.deleteConfirm})]})]})]})})]}):(0,w.jsx)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-16 text-center text-sm text-fg-muted sm:px-8`,children:t.needToken})}async function Le(t){let n=t.name.toLowerCase();if(n.endsWith(`.zip`))return t;if(n.endsWith(`skill.md`)){let n=(await r(async()=>{let{default:t}=await import(`./jszip.min-DVUfmhpE.js`).then(t=>e(t.default,1));return{default:t}},__vite__mapDeps([0,1]))).default,i=new n;i.file(`SKILL.md`,await t.arrayBuffer());let a=await i.generateAsync({type:`blob`,compression:`DEFLATE`}),o=t.name.replace(/\.md$/i,``).replace(/\s+/g,`-`)||`skill`;return new File([a],`${o}.zip`,{type:`application/zip`})}throw Error(`invalid`)}function F(){let e=o(e=>e.language),t=ve(e).skills,n=!!Ce(e=>e.token),r=s(),[i,c]=ye(),[l,re]=(0,C.useState)([]),[u,f]=(0,C.useState)(!1),[ae,p]=(0,C.useState)(null),[oe,se]=(0,C.useState)(!1),le=i.get(`q`)??``,ue=i.get(`tab`),me=i.get(`source`),he=P.has(ue)?ue:`marketplace`,m=Pe.has(me)?me:`all`,[h,ge]=(0,C.useState)(le),[_e,g]=(0,C.useState)(null),[_,v]=(0,C.useState)(he),[y,be]=(0,C.useState)(m),[b,Se]=(0,C.useState)(``),[Te,Ee]=(0,C.useState)(!1),[x,S]=(0,C.useState)(null),[De,w]=(0,C.useState)(!1),[T,E]=(0,C.useState)(!1),[Oe,ke]=(0,C.useState)(null),[Ae,je]=(0,C.useState)(null),[D,O]=(0,C.useState)({}),[A,j]=(0,C.useState)(!1),[Me,Ne]=(0,C.useState)(`catalog`),[M,N]=(0,C.useState)(``),[Ie,F]=(0,C.useState)(``),[I,L]=(0,C.useState)(null),[Re,R]=(0,C.useState)(null),[ze,Be]=(0,C.useState)(!1),[Ve,z]=(0,C.useState)(null),[B,V]=(0,C.useState)(`downloads`),[H,U]=(0,C.useState)(1),[W,G]=(0,C.useState)(!1),[He,K]=(0,C.useState)(null),[Ue,q]=(0,C.useState)(null),[We,Ge]=(0,C.useState)(null),[Ke,qe]=(0,C.useState)(null),[J,Y]=(0,C.useState)(``),[X,Je]=(0,C.useState)([]),[Ye,Xe]=(0,C.useState)(null),[Ze,Qe]=(0,C.useState)(!1),[$e,et]=(0,C.useState)(null),Z=(0,C.useCallback)(async n=>{let r=n?.silent===!0;r||f(!0),p(null);try{return re((await de(e===`en`?void 0:e)).catalog.map(k)),{ok:!0}}catch(e){let n=e instanceof Error?e.message:t.loadFailed;return p(n),{ok:!1,message:n}}finally{r||f(!1)}},[e,t.loadFailed]);(0,C.useEffect)(()=>{n&&Z()},[n,Z]),(0,C.useEffect)(()=>{if(!n){et(null);return}let e=!1;return a().then(t=>{e||et(t.provider)}).catch(()=>{e||et(null)}),()=>{e=!0}},[n]),(0,C.useEffect)(()=>{let e=i.get(`q`)??``,t=i.get(`tab`),n=i.get(`source`),r=P.has(t)?t:`marketplace`,a=Pe.has(n)?n:`all`;ge(t=>t===e?t:e),v(e=>e===r?e:r),be(e=>e===a?e:a);let o=i.get(`mcat`)??``;Y(r===`marketplace`?e=>e===o?e:o:``)},[i]),(0,C.useEffect)(()=>{_===`marketplace`&&U(1)},[h,B,_,J]),(0,C.useLayoutEffect)(()=>{!n||_!==`marketplace`||G(!0)},[n,_,J,H,B,h]),(0,C.useLayoutEffect)(()=>{!n||_!==`marketplace`||Qe(!0)},[n,_]),(0,C.useEffect)(()=>{_!==`marketplace`&&(Je([]),Xe(null),Qe(!1))},[_]),(0,C.useEffect)(()=>{if(!n||_!==`marketplace`)return;let e=!1;return K(null),fe({q:h.trim()||void 0,page:H,pageSize:20,sort:B,category:J.trim()||void 0}).then(t=>{e||q(t)}).catch(n=>{e||(K(n instanceof Error?n.message:t.marketplaceLoadFailed),q(null))}).finally(()=>{e||G(!1)}),()=>{e=!0}},[n,_,J,H,B,h,t.marketplaceLoadFailed]),(0,C.useEffect)(()=>{if(!n||_!==`marketplace`)return;let e=!1;return Xe(null),ce().then(t=>{e||Je(t.items)}).catch(n=>{e||(Je([]),Xe(n instanceof Error?n.message:t.marketplaceCategoriesFailed))}).finally(()=>{e||Qe(!1)}),()=>{e=!0,Qe(!1)}},[n,_,t.marketplaceCategoriesFailed]),(0,C.useEffect)(()=>{!J.trim()||X.length===0||X.some(e=>e.id===J)||Y(``)},[X,J]),(0,C.useEffect)(()=>{c(e=>{let t=new URLSearchParams(e),n=h.trim();return n?t.set(`q`,n):t.delete(`q`),_===`marketplace`?t.delete(`tab`):t.set(`tab`,_),y===`all`?t.delete(`source`):t.set(`source`,y),_===`marketplace`&&J.trim()?t.set(`mcat`,J.trim()):t.delete(`mcat`),t.toString()===e.toString()?e:t},{replace:!0})},[_,J,h,c,y]);let Q=(0,C.useCallback)((e,t,n=5e3)=>{g({kind:e,message:t}),window.setTimeout(()=>g(null),n)},[]),tt=(0,C.useCallback)(async n=>{Ne(`catalog`),j(!0),N(n.name),F(``),L(null),R(null),z(null),Be(!0);try{let t=await ne(n.name,e===`en`?void 0:e);L(t),N(t.name)}catch(e){L(null),z(e instanceof Error?e.message:t.detailLoadFailed)}finally{Be(!1)}},[e,t.detailLoadFailed]),nt=(0,C.useCallback)(async(e,n)=>{Ne(`store`),j(!0),N(n?.trim()||e),F(``),L(null),R(null),z(null),Be(!0);try{let n=await we(e);if(N(n.name),n.skillDocPreview)R(n.skillDocPreview),F(``);else{R(null);let e=n.readme?.trim();e?F(e):n.description?.trim()?F(`## ${n.name}\n\n${n.description.trim()}`):F(`*${t.marketplaceNoReadme}*`)}}catch(e){R(null),z(e instanceof Error?e.message:t.detailLoadFailed)}finally{Be(!1)}},[t.detailLoadFailed,t.marketplaceNoReadme]),rt=(0,C.useCallback)(async(e,n)=>{je(e),O(t=>({...t,[e]:n})),g(null);try{return await te(e,n),await Z({silent:!0}),!0}catch(n){return O(t=>{let{[e]:n,...r}=t;return r}),Q(`error`,n instanceof Error?n.message:t.skillToggleFailed),!1}finally{je(null),O(t=>{let{[e]:n,...r}=t;return r})}},[Z,Q,t.skillToggleFailed]),it=(0,C.useCallback)(async()=>{g(null),f(!0),p(null);try{await d()}catch(e){p(e instanceof Error?e.message:t.reloadFailed),f(!1);return}await Z()},[Z,t.reloadFailed]),at=(0,C.useMemo)(()=>{let e=l.filter(e=>e.source===`builtin`);return{total:e.length,enabled:e.filter(e=>D[e.name]??e.enabled).length}},[l,D]),ot=(0,C.useMemo)(()=>{let e=l.filter(e=>e.source!==`builtin`);return{total:e.length,enabled:e.filter(e=>D[e.name]??e.enabled).length}},[l,D]),st=(0,C.useMemo)(()=>M?l.find(e=>e.name===M):void 0,[l,M]),ct=st==null?!0:D[M]??st.enabled,$=(0,C.useMemo)(()=>{let e=h.trim().toLowerCase(),t=l;return _===`builtin`?t=t.filter(e=>e.source===`builtin`):(t=t.filter(e=>e.source!==`builtin`),y!==`all`&&(t=t.filter(e=>e.source===y))),e?t.filter(t=>[t.name,t.description,t.directoryId,t.path,t.source,t.hub?.source,t.hub?.ref].filter(Boolean).join(` `).toLowerCase().includes(e)):t},[l,h,_,y]),lt=(0,C.useMemo)(()=>{let e=new Set,t=[];for(let n of $){let r=n.category;!r||e.has(r)||(e.add(r),t.push(r))}return t.sort((e,t)=>{let n=Fe.indexOf(e),r=Fe.indexOf(t);return n>=0&&r>=0?n-r:n>=0?-1:r>=0?1:e.localeCompare(t)})},[$]),ut=(0,C.useCallback)(e=>t.categoryLabel?.[e]||e,[t.categoryLabel]),dt=(0,C.useMemo)(()=>b?$.filter(e=>e.category===b):$,[$,b]),ft=async e=>{g(null),se(!0),p(null);try{let n;try{n=await Le(e)}catch{p(t.invalidFile),Q(`error`,t.invalidFile);return}await xe(n,{overwrite:!0}),await Z(),Q(`success`,t.installSuccess),Ee(!1),S(null),v(`user`)}catch(e){p(e instanceof Error?e.message:t.uploadFailed),Q(`error`,e instanceof Error?e.message:t.uploadFailed)}finally{se(!1)}},pt=()=>{x&&ft(x)},mt=e=>{let t=e.target.files?.[0];e.target.value=``,t&&S(t)},ht=e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.types.includes(`Files`)&&(w(!0),e.dataTransfer.dropEffect=`copy`)},gt=e=>{let t=e.currentTarget,n=e.relatedTarget;n&&t.contains(n)||w(!1)},_t=e=>{e.preventDefault(),e.stopPropagation(),w(!1);let t=e.dataTransfer?.files?.[0];t&&S(t)},vt=e=>{switch(e){case`builtin`:return t.source.builtin;case`workspace`:return t.source.workspace;case`global`:return t.source.global;case`extra`:return t.source.extra;default:return e}},yt=async()=>{let e=Oe;if(E(!1),ke(null),e){g(null);try{await ie(e),await Z()}catch(e){p(e instanceof Error?e.message:t.deleteFailed)}}},bt=(0,C.useCallback)(e=>l.some(t=>t.name===e),[l]),xt=(0,C.useCallback)(async()=>{let e=M.trim();if(!e)return;g(null);let n=Me===`store`&&!bt(e);n&&qe(e);try{n&&(await pe({name:e,overwrite:!1}),await Z({silent:!0})),j(!1),r(`/chat/new?skill=${encodeURIComponent(e)}`)}catch(e){Q(`error`,e instanceof Error?e.message:t.uploadFailed)}finally{qe(null)}},[M,Me,bt,Z,r,Q,t.uploadFailed]),St=(0,C.useCallback)(async e=>{let n=bt(e);if(!(n&&!window.confirm(t.marketplaceReinstallConfirm))){g(null),Ge(e);try{await pe({name:e,overwrite:n}),await Z({silent:!0}),Q(`success`,t.installSuccess),j(!1),v(`user`)}catch(e){Q(`error`,e instanceof Error?e.message:t.uploadFailed)}finally{Ge(null)}}},[bt,Z,Q,t.installSuccess,t.marketplaceReinstallConfirm,t.uploadFailed]),Ct=y===`all`?t.filterAll:y===`global`?t.filterGlobal:y===`workspace`?t.filterWorkspace:t.filterExtra,{pathname:wt}=ee();return{sk:t,hasToken:n,catalog:l,loading:u,error:ae,uploading:oe,searchQuery:h,setSearchQuery:ge,actionFeedback:_e,mainTab:_,setMainTab:v,sourceFilter:y,setSourceFilter:be,builtinCategoryFilter:b,setBuiltinCategoryFilter:Se,installOpen:Te,setInstallOpen:Ee,pendingFile:x,setPendingFile:S,dropActive:De,setDropActive:w,confirmOpen:T,setConfirmOpen:E,confirmId:Oe,setConfirmId:ke,togglingSkillName:Ae,enabledOverride:D,detailOpen:A,setDetailOpen:j,detailSource:Me,setDetailSource:Ne,detailTitle:M,setDetailTitle:N,detailMarkdown:Ie,setDetailMarkdown:F,detailCatalogPreview:I,setDetailCatalogPreview:L,detailMarketplacePreview:Re,setDetailMarketplacePreview:R,detailLoading:ze,detailError:Ve,setDetailError:z,marketSort:B,setMarketSort:V,marketPage:H,setMarketPage:U,mpLoading:W,mpError:He,mpPayload:Ue,installingMarketName:We,usingSkillInChatName:Ke,onUseSkillInChat:xt,marketCategoryId:J,setMarketCategoryId:Y,mpCategories:X,mpCategoriesError:Ye,mpCategoriesLoading:Ze,marketplaceProviderId:$e,builtinTabStats:at,userTabStats:ot,detailEnabled:ct,filteredCatalog:$,builtinCategories:lt,categoryFilteredCatalog:dt,filterLabel:Ct,inSettingsShell:wt.startsWith(`/settings/`),categoryLabel:ut,onReloadClick:it,openSkillDetail:tt,openMarketplaceDetail:nt,onSkillToggle:rt,onInstallSubmit:pt,onFileInputChange:mt,onModalDragOver:ht,onModalDragLeave:gt,onModalDrop:_t,sourceLabel:vt,runDelete:yt,onMarketInstall:St,isSkillInstalledByName:bt}}function I(){return(0,w.jsx)(Ie,{vm:F()})}export{I as SkillsPage};
|
|
3
|
+
//# sourceMappingURL=skills-page-B-tO9-I7.js.map
|