nextclaw 0.27.0 → 0.27.2

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.
Files changed (62) hide show
  1. package/dist/cli/app/index.js.map +1 -1
  2. package/package.json +16 -16
  3. package/ui-dist/assets/{api-DGG69ZcJ.js → api-D5UCLVE_.js} +3 -3
  4. package/ui-dist/assets/app-presenter-provider-DcpcRgLn.js +106 -0
  5. package/ui-dist/assets/{appearance-settings-page-BZSd1SrH.js → appearance-settings-page-yJR6Kt9c.js} +1 -1
  6. package/ui-dist/assets/{book-open-BhaS5BJv.js → book-open-WsEnuW9P.js} +1 -1
  7. package/ui-dist/assets/{card-Bcr5YM8F.js → card-xVrS1b1T.js} +1 -1
  8. package/ui-dist/assets/{channels-list-page-C_x83ZCT.js → channels-list-page-CAWuTHSM.js} +1 -1
  9. package/ui-dist/assets/{chat-page-D2xfR6TK.js → chat-page-CXYXMIQQ.js} +1 -1
  10. package/ui-dist/assets/{config-split-page-RXAoLeNv.js → config-split-page-xj0UtMow.js} +1 -1
  11. package/ui-dist/assets/{confirm-dialog-o_VPKvVD.js → confirm-dialog-e2YCUzt1.js} +1 -1
  12. package/ui-dist/assets/{desktop-update-config-DEOMOsDN.js → desktop-update-config-D5NIaimo.js} +1 -1
  13. package/ui-dist/assets/{dist-C87P4QWA.js → dist-Ca-jiFrK.js} +1 -1
  14. package/ui-dist/assets/doc-browser-B2tNEKrJ.js +1 -0
  15. package/ui-dist/assets/{doc-browser-DQ75iUkA.js → doc-browser-CZX6I6CU.js} +1 -1
  16. package/ui-dist/assets/{doc-browser-context-tE0--wSa.js → doc-browser-context-CGz0LULR.js} +1 -1
  17. package/ui-dist/assets/{eye-DL9QkrKg.js → eye-B30J471A.js} +1 -1
  18. package/ui-dist/assets/{form-actions-J0tIaUdK.js → form-actions-CnSzu3WD.js} +1 -1
  19. package/ui-dist/assets/{index-B9QEjnoY.js → index-6Esxu-Pp.js} +2 -2
  20. package/ui-dist/assets/index-BzSgA8tR.css +1 -0
  21. package/ui-dist/assets/loader-circle-DjwSRQHW.js +1 -0
  22. package/ui-dist/assets/{logo-badge-BYTbZbOF.js → logo-badge-CISsltAo.js} +1 -1
  23. package/ui-dist/assets/mcp-marketplace-page-BZa7p7Qf.js +1 -0
  24. package/ui-dist/assets/{mcp-marketplace-page-COWlzeP1.js → mcp-marketplace-page-CPcPzMUQ.js} +1 -1
  25. package/ui-dist/assets/{model-config-page-oNqnMXNY.js → model-config-page-D6ex3_NM.js} +1 -1
  26. package/ui-dist/assets/{navigation-link-Dk6VdDkc.js → navigation-link-qPPUiLt0.js} +1 -1
  27. package/ui-dist/assets/plus-C45awBb1.js +1 -0
  28. package/ui-dist/assets/{popover-Txwrum65.js → popover-DHx55dbc.js} +1 -1
  29. package/ui-dist/assets/{provider-scoped-model-input-B7rQM4b6.js → provider-scoped-model-input-1TJxAhx6.js} +1 -1
  30. package/ui-dist/assets/{providers-config-page-CP-OnvLK.js → providers-config-page-BwHtHIPe.js} +1 -1
  31. package/ui-dist/assets/{react-B0LbRnAE.js → react-DerwD2EA.js} +1 -1
  32. package/ui-dist/assets/{refresh-cw-C84mMku5.js → refresh-cw-C7bynrWX.js} +1 -1
  33. package/ui-dist/assets/remote-CPpTKDgX.js +1 -0
  34. package/ui-dist/assets/rotate-cw-Bhx0XkQP.js +1 -0
  35. package/ui-dist/assets/{runtime-config-page-u_fuHxc8.js → runtime-config-page-CMLVC5UV.js} +1 -1
  36. package/ui-dist/assets/{save-R_qyrHpa.js → save-CsRsFtHS.js} +1 -1
  37. package/ui-dist/assets/{search-UKxiouNi.js → search-D0HtJIL-.js} +1 -1
  38. package/ui-dist/assets/{search-config-page-DzkpSGFH.js → search-config-page-n1GElgij.js} +1 -1
  39. package/ui-dist/assets/{secrets-config-page-DhoLYm7Z.js → secrets-config-page-DbUc3Ggi.js} +1 -1
  40. package/ui-dist/assets/security-config-n2WHhHXV.js +1 -0
  41. package/ui-dist/assets/{select-CYHT8P5S.js → select-C1zfp9zM.js} +1 -1
  42. package/ui-dist/assets/{settings-2-DGh4bGSi.js → settings-2-Ba3cLSN2.js} +1 -1
  43. package/ui-dist/assets/skeleton-DL5npsVL.js +1 -0
  44. package/ui-dist/assets/{tabs-BCihm1zK.js → tabs-DmKgMKzb.js} +1 -1
  45. package/ui-dist/assets/{tag-chip-De0iz4o2.js → tag-chip-2vwlVUwM.js} +1 -1
  46. package/ui-dist/assets/{trash-2-Bo3DWiju.js → trash-2-CUpWjNHu.js} +1 -1
  47. package/ui-dist/assets/{use-config-DCzwgChy.js → use-config-BvxDWV-M.js} +1 -1
  48. package/ui-dist/assets/{use-confirm-dialog-WZ94CehU.js → use-confirm-dialog-CeUEE4p5.js} +1 -1
  49. package/ui-dist/assets/{use-viewport-layout-CZ-3pMne.js → use-viewport-layout-DaKJ-kap.js} +1 -1
  50. package/ui-dist/assets/x-DGdYT7rH.js +1 -0
  51. package/ui-dist/index.html +28 -28
  52. package/ui-dist/assets/app-presenter-provider-B1RgR5ug.js +0 -106
  53. package/ui-dist/assets/doc-browser-BuGh646I.js +0 -1
  54. package/ui-dist/assets/index-B2YF-7Yw.css +0 -1
  55. package/ui-dist/assets/loader-circle-CAnHHSrY.js +0 -1
  56. package/ui-dist/assets/mcp-marketplace-page-CaUFv37E.js +0 -1
  57. package/ui-dist/assets/plus-DjdTWPjQ.js +0 -1
  58. package/ui-dist/assets/remote-2gZkJSX4.js +0 -1
  59. package/ui-dist/assets/rotate-cw-DQJhDnjg.js +0 -1
  60. package/ui-dist/assets/security-config-yraYoy9s.js +0 -1
  61. package/ui-dist/assets/skeleton-BQuylYFO.js +0 -1
  62. package/ui-dist/assets/x-NZxXyqW1.js +0 -1
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DseTPa7n.js";import{a as t,h as n,p as r,r as i,t as a}from"./react-B0LbRnAE.js";import{n as o,t as s}from"./middleware-Df-a4x-q.js";var c=`docs.nextclaw.io`,l=`docs.nextclaw.net`,u=`nextclaw-docs.pages.dev`,d=new Set([c,`www.${c}`,l,`www.${l}`,u,`www.${u}`]),f=`https://${c}`,p=`https://${l}`,m=`home`,h=`nextclaw://new-tab`,g=`/guide/getting-started`;function _(e){return e===`zh`?`zh`:`en`}function v(e,t){let n=e.startsWith(`/`)?e:`/${e}`;return n===`/`||n===``?`/${t}/`:/^\/(en|zh)(\/|$)/.test(n)?n:`/${t}${n}`}function y(e){let t=e?.trim();if(t)try{return new URL(t).origin}catch{return}}function b(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??``}catch{return``}}function x(e){return/^[a-z][a-z\d+.-]*:/i.test(e.trim())}function S(){return t()===`zh`||b()===`Asia/Shanghai`}function C(){return y(void 0)||(S()?y(void 0)??p:f)}function w(e){let n=_(t()),r=C();try{let t=new URL(e,r),i=new URL(r);return!x(e)||d.has(t.hostname)||t.origin===i.origin?(t.protocol=i.protocol,t.host=i.host,t.pathname=v(t.pathname,n),t.toString()):t.toString()}catch{return new URL(`/${n}${g}`,r).toString()}}function T(){return w(g)}function E(e){return w(e)}function D(e){try{return new URL(e).pathname.replace(/\.html$/,``).replace(/\/$/,``)}catch{return e}}function O(e,t,n=`Docs`){try{let r=new URL(e,f);if(r.protocol===`data:`)return t===`docs`?n:`Detail`;let i=r.pathname.split(`/`).filter(Boolean),a=i[i.length-1]??n;return decodeURIComponent(a).replace(/[-_]/g,` `).slice(0,40)||n}catch{return n}}function k(e){try{let t=typeof window<`u`?window.location.origin:f,n=new URL(e,t);return d.has(n.hostname)}catch{return!1}}function A(e,t){return t===`docs`?w(e):e}var j=0;function M(e){return typeof e==`number`&&Number.isFinite(e)?Math.min(860,Math.max(320,e)):420}function N(){return j+=1,`doc-tab-${Date.now()}-${j}`}function P(e,t,n,r,a,o){let s=n?.trim()||O(e,t,t===`docs`?i(`docBrowserHelp`):`Detail`),c=a?.trim();return{id:N(),kind:t,title:s,currentUrl:e,resourceUri:c||void 0,dockIcon:o,dedupeKey:r,history:[e],historyIndex:0,navVersion:0}}function F(e){return{kind:e.kind,resourceUri:e.resourceUri,tabId:e.id,url:e.currentUrl}}function I(){let e=P(h,m,i(`docBrowserHomeTitle`));return{isOpen:!1,mode:`docked`,dockedWidth:420,tabs:[e],activeTabId:e.id,activeHistory:[F(e)],activeHistoryIndex:0}}var L=`nextclaw.doc-browser.state`,R=1,z=8;function B(e){return!!e&&typeof e==`object`}function V(e){return e===`floating`||e===`docked`}function H(e,t){if(!Array.isArray(e))return[t];let n=e.filter(e=>typeof e==`string`&&e.trim().length>0);return n.length>0?n:[t]}function U(e,t,n,r){return typeof e==`number`&&Number.isFinite(e)?Math.min(n,Math.max(t,e)):r}function W(e){if(!(!B(e)||typeof e.type!=`string`)){if(e.type===`builtin`&&typeof e.name==`string`&&e.name.trim().length>0)return{type:`builtin`,name:e.name.trim()};if(e.type===`url`&&typeof e.url==`string`&&e.url.trim().length>0)return{type:`url`,url:e.url.trim()};if(e.type===`text`&&typeof e.value==`string`&&e.value.trim().length>0)return{type:`text`,value:e.value.trim()}}}function G(e){if(!B(e)||typeof e.id!=`string`||typeof e.kind!=`string`||typeof e.title!=`string`||typeof e.currentUrl!=`string`||e.currentUrl.trim().length===0)return null;let t=H(e.history,e.currentUrl),n=U(e.historyIndex,0,t.length-1,t.length-1),r=U(e.navVersion,0,2**53-1,0),i=typeof e.dedupeKey==`string`&&e.dedupeKey.trim().length>0?e.dedupeKey:void 0,a=typeof e.resourceUri==`string`&&e.resourceUri.trim().length>0?e.resourceUri.trim():void 0,o=W(e.dockIcon);return{id:e.id,kind:e.kind,title:e.title,currentUrl:t[n]??e.currentUrl,resourceUri:a,dockIcon:o,dedupeKey:i,history:t,historyIndex:n,navVersion:r}}function K(e){return{kind:e.kind,resourceUri:e.resourceUri,tabId:e.id,url:e.currentUrl}}function q(e,t){if(!B(e)||typeof e.tabId!=`string`||typeof e.kind!=`string`||typeof e.url!=`string`||e.url.trim().length===0||!t.has(e.tabId))return null;let n=typeof e.resourceUri==`string`&&e.resourceUri.trim().length>0?e.resourceUri.trim():void 0;return{kind:e.kind,resourceUri:n,tabId:e.tabId,url:e.url}}function J(e){if(!B(e))return null;let t=Array.isArray(e.tabs)?e.tabs.map(G).filter(e=>e!==null).slice(-z):[];if(t.length===0)return null;let n=typeof e.activeTabId==`string`?e.activeTabId:null,r=t.some(e=>e.id===n)?n??t[0].id:t[0].id,i=new Map(t.map(e=>[e.id,e])),a=Array.isArray(e.activeHistory)?e.activeHistory.map(e=>q(e,i)).filter(e=>e!==null):[],o=[K(i.get(r)??t[0])],s=a.length>0?a:o,c=U(e.activeHistoryIndex,0,s.length-1,s.length-1),l=s[c],u=i.has(l.tabId)?l.tabId:r;return{isOpen:e.isOpen===!0,mode:V(e.mode)?e.mode:`docked`,dockedWidth:M(e.dockedWidth),tabs:t,activeTabId:u,activeHistory:s,activeHistoryIndex:c}}function Y(e,t){return typeof t==`function`?t(e):t}var X=a()(o(e=>({snapshot:I(),setSnapshot:t=>e(e=>({snapshot:Y(e.snapshot,t)}))}),{name:L,version:R,storage:s(()=>window.localStorage),partialize:e=>({snapshot:{isOpen:e.snapshot.isOpen,mode:e.snapshot.mode,dockedWidth:e.snapshot.dockedWidth,tabs:e.snapshot.tabs.slice(-z),activeTabId:e.snapshot.activeTabId,activeHistory:e.snapshot.activeHistory,activeHistoryIndex:e.snapshot.activeHistoryIndex}}),merge:(e,t)=>{let n=J(B(e)?e.snapshot:null);return n?{...t,snapshot:n}:t}})),Z=e(n(),1),Q=r(),$=(0,Z.createContext)(null);function ee(){let e=(0,Z.useContext)($);if(!e)throw Error(`useDocBrowser must be used within DocBrowserProvider`);return e}function te({children:e,manager:t}){let n=X(e=>e.snapshot),r=(0,Z.useMemo)(()=>n.tabs.find(e=>e.id===n.activeTabId)??n.tabs[0],[n.activeTabId,n.tabs]),i=(0,Z.useMemo)(()=>({...n,currentTab:r,open:t.open,openTarget:t.openTarget,openNewTab:t.openNewTab,close:t.close,toggleMode:t.toggleMode,setDockedWidth:t.setDockedWidth,navigate:t.navigate,syncUrl:t.syncUrl,goBack:t.goBack,goForward:t.goForward,closeTab:t.closeTab,setActiveTab:t.setActiveTab}),[r,t,n]);return(0,Q.jsx)($.Provider,{value:i,children:e})}export{F as a,f as c,T as d,E as f,A as g,D as h,I as i,m as l,k as m,ee as n,P as o,O as p,X as r,M as s,te as t,h as u};
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{a as t,h as n,p as r,r as i,t as a}from"./react-DerwD2EA.js";import{n as o,t as s}from"./middleware-Df-a4x-q.js";var c=`docs.nextclaw.io`,l=`docs.nextclaw.net`,u=`nextclaw-docs.pages.dev`,d=new Set([c,`www.${c}`,l,`www.${l}`,u,`www.${u}`]),f=`https://${c}`,p=`https://${l}`,m=`home`,h=`nextclaw://new-tab`,g=`/guide/getting-started`;function _(e){return e===`zh`?`zh`:`en`}function v(e,t){let n=e.startsWith(`/`)?e:`/${e}`;return n===`/`||n===``?`/${t}/`:/^\/(en|zh)(\/|$)/.test(n)?n:`/${t}${n}`}function y(e){let t=e?.trim();if(t)try{return new URL(t).origin}catch{return}}function b(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??``}catch{return``}}function x(e){return/^[a-z][a-z\d+.-]*:/i.test(e.trim())}function S(){return t()===`zh`||b()===`Asia/Shanghai`}function C(){return y(void 0)||(S()?y(void 0)??p:f)}function w(e){let n=_(t()),r=C();try{let t=new URL(e,r),i=new URL(r);return!x(e)||d.has(t.hostname)||t.origin===i.origin?(t.protocol=i.protocol,t.host=i.host,t.pathname=v(t.pathname,n),t.toString()):t.toString()}catch{return new URL(`/${n}${g}`,r).toString()}}function T(){return w(g)}function E(e){return w(e)}function D(e){try{return new URL(e).pathname.replace(/\.html$/,``).replace(/\/$/,``)}catch{return e}}function O(e,t,n=`Docs`){try{let r=new URL(e,f);if(r.protocol===`data:`)return t===`docs`?n:`Detail`;let i=r.pathname.split(`/`).filter(Boolean),a=i[i.length-1]??n;return decodeURIComponent(a).replace(/[-_]/g,` `).slice(0,40)||n}catch{return n}}function k(e){try{let t=typeof window<`u`?window.location.origin:f,n=new URL(e,t);return d.has(n.hostname)}catch{return!1}}function A(e,t){return t===`docs`?w(e):e}var j=0;function M(e){return typeof e==`number`&&Number.isFinite(e)?Math.min(860,Math.max(320,e)):420}function N(){return j+=1,`doc-tab-${Date.now()}-${j}`}function P(e,t,n,r,a,o){let s=n?.trim()||O(e,t,t===`docs`?i(`docBrowserHelp`):`Detail`),c=a?.trim();return{id:N(),kind:t,title:s,currentUrl:e,resourceUri:c||void 0,dockIcon:o,dedupeKey:r,history:[e],historyIndex:0,navVersion:0}}function F(e){return{kind:e.kind,resourceUri:e.resourceUri,tabId:e.id,url:e.currentUrl}}function I(){let e=P(h,m,i(`docBrowserHomeTitle`));return{isOpen:!1,mode:`docked`,dockedWidth:420,tabs:[e],activeTabId:e.id,activeHistory:[F(e)],activeHistoryIndex:0}}var L=`nextclaw.doc-browser.state`,R=1,z=8;function B(e){return!!e&&typeof e==`object`}function V(e){return e===`floating`||e===`docked`}function H(e,t){if(!Array.isArray(e))return[t];let n=e.filter(e=>typeof e==`string`&&e.trim().length>0);return n.length>0?n:[t]}function U(e,t,n,r){return typeof e==`number`&&Number.isFinite(e)?Math.min(n,Math.max(t,e)):r}function W(e){if(!(!B(e)||typeof e.type!=`string`)){if(e.type===`builtin`&&typeof e.name==`string`&&e.name.trim().length>0)return{type:`builtin`,name:e.name.trim()};if(e.type===`url`&&typeof e.url==`string`&&e.url.trim().length>0)return{type:`url`,url:e.url.trim()};if(e.type===`text`&&typeof e.value==`string`&&e.value.trim().length>0)return{type:`text`,value:e.value.trim()}}}function G(e){if(!B(e)||typeof e.id!=`string`||typeof e.kind!=`string`||typeof e.title!=`string`||typeof e.currentUrl!=`string`||e.currentUrl.trim().length===0)return null;let t=H(e.history,e.currentUrl),n=U(e.historyIndex,0,t.length-1,t.length-1),r=U(e.navVersion,0,2**53-1,0),i=typeof e.dedupeKey==`string`&&e.dedupeKey.trim().length>0?e.dedupeKey:void 0,a=typeof e.resourceUri==`string`&&e.resourceUri.trim().length>0?e.resourceUri.trim():void 0,o=W(e.dockIcon);return{id:e.id,kind:e.kind,title:e.title,currentUrl:t[n]??e.currentUrl,resourceUri:a,dockIcon:o,dedupeKey:i,history:t,historyIndex:n,navVersion:r}}function K(e){return{kind:e.kind,resourceUri:e.resourceUri,tabId:e.id,url:e.currentUrl}}function q(e,t){if(!B(e)||typeof e.tabId!=`string`||typeof e.kind!=`string`||typeof e.url!=`string`||e.url.trim().length===0||!t.has(e.tabId))return null;let n=typeof e.resourceUri==`string`&&e.resourceUri.trim().length>0?e.resourceUri.trim():void 0;return{kind:e.kind,resourceUri:n,tabId:e.tabId,url:e.url}}function J(e){if(!B(e))return null;let t=Array.isArray(e.tabs)?e.tabs.map(G).filter(e=>e!==null).slice(-z):[];if(t.length===0)return null;let n=typeof e.activeTabId==`string`?e.activeTabId:null,r=t.some(e=>e.id===n)?n??t[0].id:t[0].id,i=new Map(t.map(e=>[e.id,e])),a=Array.isArray(e.activeHistory)?e.activeHistory.map(e=>q(e,i)).filter(e=>e!==null):[],o=[K(i.get(r)??t[0])],s=a.length>0?a:o,c=U(e.activeHistoryIndex,0,s.length-1,s.length-1),l=s[c],u=i.has(l.tabId)?l.tabId:r;return{isOpen:e.isOpen===!0,mode:V(e.mode)?e.mode:`docked`,dockedWidth:M(e.dockedWidth),tabs:t,activeTabId:u,activeHistory:s,activeHistoryIndex:c}}function Y(e,t){return typeof t==`function`?t(e):t}var X=a()(o(e=>({snapshot:I(),setSnapshot:t=>e(e=>({snapshot:Y(e.snapshot,t)}))}),{name:L,version:R,storage:s(()=>window.localStorage),partialize:e=>({snapshot:{isOpen:e.snapshot.isOpen,mode:e.snapshot.mode,dockedWidth:e.snapshot.dockedWidth,tabs:e.snapshot.tabs.slice(-z),activeTabId:e.snapshot.activeTabId,activeHistory:e.snapshot.activeHistory,activeHistoryIndex:e.snapshot.activeHistoryIndex}}),merge:(e,t)=>{let n=J(B(e)?e.snapshot:null);return n?{...t,snapshot:n}:t}})),Z=e(n(),1),Q=r(),$=(0,Z.createContext)(null);function ee(){let e=(0,Z.useContext)($);if(!e)throw Error(`useDocBrowser must be used within DocBrowserProvider`);return e}function te({children:e,manager:t}){let n=X(e=>e.snapshot),r=(0,Z.useMemo)(()=>n.tabs.find(e=>e.id===n.activeTabId)??n.tabs[0],[n.activeTabId,n.tabs]),i=(0,Z.useMemo)(()=>({...n,currentTab:r,open:t.open,openTarget:t.openTarget,openNewTab:t.openNewTab,close:t.close,toggleMode:t.toggleMode,setDockedWidth:t.setDockedWidth,navigate:t.navigate,syncUrl:t.syncUrl,goBack:t.goBack,goForward:t.goForward,closeTab:t.closeTab,setActiveTab:t.setActiveTab}),[r,t,n]);return(0,Q.jsx)($.Provider,{value:i,children:e})}export{F as a,f as c,T as d,E as f,A as g,D as h,I as i,m as l,k as m,ee as n,P as o,O as p,X as r,M as s,te as t,h as u};
@@ -1 +1 @@
1
- import{c as e}from"./dist-C87P4QWA.js";var t=e(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),n=e(`Eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]);export{t as n,n as t};
1
+ import{c as e}from"./dist-Ca-jiFrK.js";var t=e(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),n=e(`Eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]);export{t as n,n as t};
@@ -1 +1 @@
1
- import{p as e,u as t}from"./react-B0LbRnAE.js";var n=e();function r({align:e=`end`,className:r,...i}){return(0,n.jsx)(`div`,{className:t(`flex flex-wrap items-center gap-2`,e===`start`&&`justify-start`,e===`end`&&`justify-end`,e===`between`&&`justify-between`,r),...i})}export{r as t};
1
+ import{p as e,u as t}from"./react-DerwD2EA.js";var n=e();function r({align:e=`end`,className:r,...i}){return(0,n.jsx)(`div`,{className:t(`flex flex-wrap items-center gap-2`,e===`start`&&`justify-start`,e===`end`&&`justify-end`,e===`between`&&`justify-between`,r),...i})}export{r as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/model-config-page-oNqnMXNY.js","assets/chunk-DseTPa7n.js","assets/api-DGG69ZcJ.js","assets/react-B0LbRnAE.js","assets/book-open-BhaS5BJv.js","assets/dist-C87P4QWA.js","assets/provider-scoped-model-input-B7rQM4b6.js","assets/select-CYHT8P5S.js","assets/popover-Txwrum65.js","assets/provider-models-CXUgDxGR.js","assets/navigation-link-Dk6VdDkc.js","assets/host-capabilities-B-TtABsP.js","assets/loader-circle-CAnHHSrY.js","assets/doc-browser-context-tE0--wSa.js","assets/middleware-Df-a4x-q.js","assets/form-actions-J0tIaUdK.js","assets/skeleton-BQuylYFO.js","assets/use-config-DCzwgChy.js","assets/config-hints-S3g-UVZb.js","assets/appearance-settings-page-BZSd1SrH.js","assets/app-presenter-provider-B1RgR5ug.js","assets/preload-helper-D4M6sveU.js","assets/confirm-dialog-o_VPKvVD.js","assets/x-NZxXyqW1.js","assets/doc-browser-DQ75iUkA.js","assets/search-UKxiouNi.js","assets/plus-DjdTWPjQ.js","assets/refresh-cw-C84mMku5.js","assets/use-confirm-dialog-WZ94CehU.js","assets/card-Bcr5YM8F.js","assets/eye-DL9QkrKg.js","assets/tabs-BCihm1zK.js","assets/use-viewport-layout-CZ-3pMne.js","assets/trash-2-Bo3DWiju.js","assets/logo-badge-BYTbZbOF.js","assets/app-presenter-provider-D3BuuOyZ.css","assets/chat-page-D2xfR6TK.js","assets/settings-2-DGh4bGSi.js","assets/tag-chip-De0iz4o2.js","assets/search-config-page-DzkpSGFH.js","assets/config-split-page-RXAoLeNv.js","assets/providers-config-page-CP-OnvLK.js","assets/channels-list-page-C_x83ZCT.js","assets/runtime-config-page-u_fuHxc8.js","assets/rotate-cw-DQJhDnjg.js","assets/save-R_qyrHpa.js","assets/desktop-update-config-DEOMOsDN.js","assets/security-config-yraYoy9s.js","assets/secrets-config-page-DhoLYm7Z.js","assets/remote-2gZkJSX4.js","assets/mcp-marketplace-page-CaUFv37E.js","assets/mcp-marketplace-page-COWlzeP1.js"])))=>i.map(i=>d[i]);
2
- import{i as e,t}from"./chunk-DseTPa7n.js";import{h as n,m as r,p as i,r as a,u as o}from"./react-B0LbRnAE.js";import{t as s}from"./preload-helper-D4M6sveU.js";import{B as c,D as l,E as u,V as d,_ as f,_t as p,a as m,at as h,b as g,dt as _,f as v,ft as y,gt as b,ht as x,i as S,m as C,mt as w,ot as T,p as ee,pt as E,r as te,st as D,t as O,u as ne,ut as re,y as ie}from"./app-presenter-provider-B1RgR5ug.js";import{$t as ae,At as k,B as oe,Cn as se,Dn as ce,En as le,Ft as ue,I as de,It as A,Jt as j,L as M,On as fe,R as pe,St as me,Tn as he,V as ge,_n as _e,an as ve,cn as ye,dn as be,fn as xe,gn as Se,hn as Ce,in as we,m as N,mn as Te,on as P,pn as Ee,sn as De,un as Oe,vn as ke,vt as F,wn as I,xt as Ae,yn as L,z as je}from"./api-DGG69ZcJ.js";import{a as R,c as Me,d as Ne,f as Pe,i as Fe,l as Ie,n as Le,o as z,r as Re,s as B,u as V}from"./mcp-marketplace-page-COWlzeP1.js";import{c as H}from"./dist-C87P4QWA.js";import{n as ze}from"./search-UKxiouNi.js";import{a as U,c as W,o as G,s as Be}from"./doc-browser-DQ75iUkA.js";import{i as Ve,n as He,o as Ue,r as K,t as We}from"./use-confirm-dialog-WZ94CehU.js";import{o as Ge}from"./card-Bcr5YM8F.js";import{t as Ke}from"./navigation-link-Dk6VdDkc.js";import{i as qe,r as Je,t as Ye}from"./tabs-BCihm1zK.js";import{t as Xe}from"./use-viewport-layout-CZ-3pMne.js";import{t as Ze}from"./refresh-cw-C84mMku5.js";import{t as Qe}from"./trash-2-Bo3DWiju.js";import{n as $e,t as et}from"./doc-browser-context-tE0--wSa.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var tt=t((e=>{var t=r();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}));function nt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function rt(e,t,n){let r=e.slice(0);return r[t]=n,r}var it=class extends fe{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,I.batch(()=>{let e=this.#i,t=this.#f(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!ce(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(nt(e,n).forEach(e=>{e.destroy()}),nt(n,e).forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})),this.#m()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#f(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=le(this.#a,t(e))),this.#a}return e}#f(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new se(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=rt(this.#t,n,t),this.#m())}#m(){if(this.hasListeners()){let e=this.#a,t=this.#u(this.#t,this.#l);e!==this.#d(t,this.#r?.combine)&&I.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},q=e(n(),1);function at({queries:e,...t},n){let r=L(n),i=_e(),a=Se(),o=q.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{Oe(e),Ee(e,a,r.getQueryCache().get(e.queryHash))}),Ce(a);let[s]=q.useState(()=>new it(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;q.useSyncExternalStore(q.useCallback(e=>d?s.subscribe(I.batchCalls(e)):he,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),q.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>xe(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&xe(n,e)?be(n,new se(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&Te({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}var ot=H(`BriefcaseBusiness`,[[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2`,key:`1ksdt3`}],[`path`,{d:`M22 13a18.15 18.15 0 0 1-20 0`,key:`12hx5q`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]),st=H(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),ct=H(`Compass`,[[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),lt=H(`MessagesSquare`,[[`path`,{d:`M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z`,key:`p1xzt8`}],[`path`,{d:`M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1`,key:`1cx29u`}]]),ut=H(`PenLine`,[[`path`,{d:`M12 20h9`,key:`t2du7b`}],[`path`,{d:`M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z`,key:`1ykcvy`}]]),dt=H(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),ft=tt();function J(e){return Array.from(new Set(e.map(e=>e.spec).filter(Boolean)))}function pt(e){let{request:t,result:n}=e,r=new Date().toISOString();return n.type===`skill`?{type:`skill`,spec:n.spec,id:t.skill??n.spec,label:t.skill??n.name??n.spec,source:`workspace`,installPath:t.installPath,installedAt:r}:{type:n.type,spec:n.spec,id:n.name??n.spec,label:n.name??n.spec,source:`marketplace`,origin:`marketplace`,enabled:t.enabled??!0,runtimeStatus:t.enabled===!1?`disabled`:`ready`,installedAt:r}}function mt(e,t){let{id:n,spec:r}=t;return!!(r&&e.spec===r||n&&e.id===n)}function ht(e,t){return t??{type:e,total:0,specs:[],records:[]}}function gt(e){let{result:t,view:n}=e,r=ht(t.type,n),i=pt(e),a=r.records.findIndex(e=>mt(e,{id:i.id,spec:i.spec})),o=[...r.records];return a>=0?o[a]={...o[a],...i}:o.unshift(i),{...r,type:t.type,records:o,specs:J(o),total:o.length}}function _t(e){let{request:t,result:n,view:r}=e,i=ht(n.type,r);if(n.action===`uninstall`||n.action===`remove`){let e=i.records.filter(e=>!mt(e,{id:n.id,spec:t.spec}));return{...i,records:e,specs:J(e),total:e.length}}let a=i.records.map(e=>mt(e,{id:n.id,spec:t.spec})?n.action===`disable`?{...e,enabled:!1,runtimeStatus:`disabled`}:n.action===`update`?{...e,installedAt:new Date().toISOString(),origin:e.origin??`marketplace`}:{...e,enabled:!0,runtimeStatus:`ready`}:e);return{...i,records:a,specs:J(a),total:a.length}}var vt=3e4;function yt(e){let t=Pe({queryKey:[`marketplace-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>M({...e,page:t}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0,placeholderData:(t,n)=>{let r=n?.queryKey?.[1];if(!(!r||typeof r!=`object`||!r))return(`type`in r?r.type:void 0)===e.type&&xt(r,e)?t:void 0},staleTime:15e3,refetchInterval:e.q?!1:vt,refetchOnMount:`always`,refetchOnReconnect:`always`,refetchOnWindowFocus:`always`}),n=(0,q.useMemo)(()=>Ne(t.data),[t.data]);return{...t,data:n}}function bt(e,t=!0){return ye({queryKey:[`marketplace-recent-items`,e],queryFn:()=>M({type:e,sort:`updated`,page:1,pageSize:6}),enabled:t,staleTime:15e3,refetchInterval:vt,refetchOnMount:`always`,refetchOnReconnect:`always`,refetchOnWindowFocus:`always`})}function xt(e,t){return e.tag===t.tag&&e.scene===t.scene&&e.pageSize===t.pageSize}function St(e=!0){return ye({queryKey:[`marketplace-skill-scenes`],queryFn:je,enabled:e,staleTime:6e4})}function Ct(e,t=!0){let n=at({queries:e.map(e=>({queryKey:[`marketplace-skill-scene-count`,e.scene],queryFn:()=>M({type:`skill`,scene:e.scene,pageSize:1}),enabled:t&&typeof e.count!=`number`,staleTime:6e4}))});return(0,q.useMemo)(()=>{let t=new Map;return e.forEach((e,r)=>{let i=typeof e.count==`number`?e.count:n[r]?.data?.total;typeof i==`number`&&t.set(e.scene,i)}),t},[n,e])}function wt(e){return ye({queryKey:[`marketplace-installed`,e],queryFn:()=>de(e),staleTime:1e4})}function Tt(){let e=L();return De({mutationFn:e=>oe(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>gt({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`}),P.success(t.message||a(`marketplaceInstallSuccessSkill`))},onError:e=>{P.error(e.message||a(`marketplaceInstallFailed`))}})}function Et(){let e=L();return De({mutationFn:e=>ge(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>_t({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`});let r=t.action===`enable`?a(`marketplaceEnableSuccess`):t.action===`disable`?a(`marketplaceDisableSuccess`):t.action===`update`?a(`marketplaceUpdateSuccess`):a(`marketplaceUninstallSuccess`);P.success(t.message||r)},onError:e=>{P.error(e.message||a(`marketplaceOperationFailed`))}})}var Y=i(),Dt=[`bg-amber-600`,`bg-orange-500`,`bg-yellow-600`,`bg-emerald-600`,`bg-teal-600`,`bg-cyan-600`,`bg-stone-600`,`bg-rose-500`,`bg-violet-500`];function Ot(e){let{name:t,fallback:n,className:r}=e,i=t||n,a=i.substring(0,2).toUpperCase();return(0,Y.jsx)(`div`,{className:o(`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-sm font-semibold text-white`,kt(i),r),children:a})}function kt(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return Dt[Math.abs(t)%Dt.length]}function At({title:e,spec:t}){return(0,Y.jsxs)(Be,{delayDuration:400,children:[(0,Y.jsxs)(U,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsx)(`div`,{className:`truncate text-[14px] font-semibold leading-tight text-gray-950`,children:e})}),(0,Y.jsx)(G,{className:`max-w-[300px] text-xs`,children:e})]}),(0,Y.jsx)(`div`,{className:`mb-2 mt-1 flex min-w-0 items-center gap-1.5`,children:t?(0,Y.jsxs)(U,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsx)(`span`,{className:`max-w-full truncate text-[11px] font-mono leading-tight text-gray-400`,children:t})}),(0,Y.jsx)(G,{className:`max-w-[300px] break-all font-mono text-xs`,children:t})]}):null})]})}function jt(e){let{item:t,record:n,state:r,onInstall:i,onManage:s}=e,{isInstalling:c,canUpdate:l,canUninstall:u,busyAction:d}=r,f=!!d;return t&&!n||n&&(l||u)?(0,Y.jsxs)(`div`,{className:o(`flex shrink-0 items-center justify-end gap-1.5 opacity-100 transition-opacity duration-150`,`md:pointer-events-none md:opacity-0`,`md:group-hover:pointer-events-auto md:group-hover:opacity-100`,`md:group-focus-within:pointer-events-auto md:group-focus-within:opacity-100`),children:[t&&!n&&(0,Y.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),i(t)},disabled:c,className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md bg-primary px-2 text-[11px] font-medium text-white transition-colors hover:bg-primary-600 disabled:opacity-50`,children:[(0,Y.jsx)(Ge,{className:`h-3 w-3`}),a(c?`marketplaceInstalling`:`marketplaceInstall`)]}),n&&l&&(0,Y.jsxs)(`button`,{disabled:f,onClick:e=>{e.stopPropagation(),s(`update`,n)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-blue-200/80 bg-white px-2 text-[11px] font-medium text-blue-600 transition-colors hover:border-blue-300 hover:bg-blue-50 disabled:opacity-50`,children:[(0,Y.jsx)(Ze,{className:`h-3 w-3`}),a(d===`update`?`marketplaceUpdating`:`marketplaceUpdate`)]}),n&&u&&(0,Y.jsxs)(`button`,{disabled:f,onClick:e=>{e.stopPropagation(),s(`uninstall`,n)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-gray-200/80 bg-white px-2 text-[11px] font-medium text-gray-500 transition-colors hover:border-rose-200 hover:bg-rose-50 hover:text-rose-600 disabled:opacity-50`,children:[(0,Y.jsx)(Qe,{className:`h-3 w-3`}),a(d===`uninstall`?`marketplaceRemoving`:`marketplaceUninstall`)]})]}):null}function Mt(e){let{record:t,disabled:n}=e;return t?(0,Y.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-end`,children:(0,Y.jsx)(Nt,{disabled:n})}):null}function Nt(e){let{disabled:t}=e,n=a(t?`marketplaceDisabledStatus`:`marketplaceInstalledStatus`);return(0,Y.jsx)(Be,{delayDuration:300,children:(0,Y.jsxs)(U,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsx)(`span`,{"aria-label":n,className:o(`inline-flex h-5 w-5 items-center justify-center`,t?`text-gray-400`:`text-emerald-700`),children:t?(0,Y.jsx)(D,{className:`h-4 w-4 opacity-40`}):(0,Y.jsx)(D,{className:`h-4 w-4`})})}),(0,Y.jsx)(G,{className:`text-xs`,children:n})]})})}function Pt(e){let{item:t,record:n,installState:r,manageState:i,onOpen:o,onInstall:s,onManage:c}=e,{language:l}=K(),u=z(l),d=t?.name??n?.label??n?.id??n?.spec??a(`marketplaceUnknownItem`),f=B(t?.summaryI18n,t?.summary,u)||(n?a(`marketplaceInstalledLocalSummary`):``),p=t?.install.spec??n?.spec??``,m=t?.tags??[],h=n?.id||n?.spec,g=h?i.actionsByTarget.get(h):void 0,_=n?.type===`skill`&&n.source===`workspace`,v=n?.type===`skill`&&n.origin===`marketplace`,y=n?n.enabled===!1||n.runtimeStatus===`disabled`:!1,b=t?.install.spec,x=typeof b==`string`&&r.installingSpecs.has(b);return(0,Y.jsxs)(`article`,{onClick:o,className:`group flex h-full min-h-[156px] cursor-pointer flex-col rounded-xl border border-gray-200/60 bg-white p-3.5 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,Y.jsx)(Ot,{name:d,fallback:p||a(`marketplaceTypeSkill`),className:`h-9 w-9 rounded-lg text-xs`}),(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,Y.jsx)(At,{title:d,spec:p})}),(0,Y.jsx)(Mt,{record:n,disabled:y})]}),(0,Y.jsxs)(`div`,{className:`mt-2 flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`p`,{className:`line-clamp-2 text-left text-[12px] leading-relaxed text-gray-500`,children:f}),(0,Y.jsxs)(`div`,{className:`mt-auto flex min-w-0 items-end justify-between gap-2 pt-2`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsx)(Ft,{tags:m})}),(0,Y.jsx)(jt,{item:t,record:n,state:{isInstalling:x,canUpdate:v,canUninstall:_,busyAction:g},onInstall:s,onManage:c})]})]})]})}function Ft({tags:e}){let t=e.filter(It).slice(0,3);return t.length===0?null:(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-1.5 overflow-hidden`,children:t.map(e=>(0,Y.jsx)(`span`,{className:`max-w-[104px] truncate rounded-md bg-gray-100 px-2 py-0.5 text-[11px] font-medium leading-5 text-gray-500`,children:e},e))})}function It(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function Lt({model:e,showTitle:t,operationState:n,scroll:r,actions:i}){let{scope:a,entries:s,header:c,status:l,emptyLabel:u,errorLabel:d}=e,{showSkeleton:f,isRefreshing:p,error:m}=l,{hasMore:h,loadingMore:g,sentinelRef:_}=r,{installState:v,manageState:y}=n,{onOpen:b,onInstall:x,onManage:S}=i;return(0,Y.jsxs)(`section`,{className:o(`flex min-h-full flex-col`,t&&`gap-3`),children:[t&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-950`,children:c.title}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] text-gray-500`,children:[p&&(0,Y.jsx)(`span`,{className:`font-medium text-primary`,children:c.refreshingLabel}),(0,Y.jsx)(`span`,{children:c.summary})]})]}),m&&(0,Y.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[d,`: `,m.message]}),p&&(0,Y.jsx)(`div`,{"data-testid":`marketplace-list-refreshing`,className:`h-0.5 overflow-hidden rounded-full bg-primary/10`,children:(0,Y.jsx)(`div`,{className:`h-full w-1/3 animate-pulse rounded-full bg-primary`})}),(0,Y.jsxs)(`div`,{"data-testid":f?`marketplace-list-skeleton`:void 0,className:o(`grid grid-cols-1 gap-2.5 md:grid-cols-2 xl:grid-cols-3`,f&&`min-h-0 flex-1 auto-rows-[156px] content-start`),children:[f&&(0,Y.jsx)(V,{count:36}),!f&&!m&&s.map(e=>(0,Y.jsx)(Pt,{item:e.item,record:e.record,installState:v,manageState:y,onOpen:()=>b(e.item,e.record),onInstall:x,onManage:S},e.key))]}),!f&&!m&&s.length===0&&(0,Y.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:u}),a===`all`&&!f&&!m&&(0,Y.jsx)(Ie,{hasMore:h,loading:g,sentinelRef:_})]})}function Rt(e){let{entry:t,language:n,localeFallbacks:r,installState:i,layout:s=`rail`,onOpen:c,onInstall:l}=e,{item:u,record:d}=t,f=B(u.summaryI18n,u.summary,r),p=u.install.spec,m=i.installingSpecs.has(p),h=!!d;return(0,Y.jsxs)(`article`,{onClick:()=>c(t),className:o(`group flex min-h-[166px] cursor-pointer flex-col justify-between rounded-xl border border-gray-200/70 bg-white p-3 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,s===`rail`?`w-[260px] shrink-0`:`w-full min-w-0`),children:[(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-start gap-2.5`,children:[(0,Y.jsx)(Ot,{name:u.name,fallback:u.install.spec}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,Y.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-gray-950`,children:u.name}),(0,Y.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] font-mono leading-tight text-gray-400`,children:zt(u)})]})]}),(0,Y.jsx)(`p`,{className:`line-clamp-2 text-[12px] leading-relaxed text-gray-500`,children:f}),(0,Y.jsx)(Bt,{tags:u.tags})]}),(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-gray-100 pt-2.5`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-gray-400`,children:Ht(u.updatedAt)}),h?(0,Y.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 text-[11px] font-semibold text-emerald-700`,children:[(0,Y.jsx)(D,{className:`h-3.5 w-3.5`}),Ut({zh:`已安装`,en:`Installed`},n)]}):(0,Y.jsxs)(`button`,{type:`button`,disabled:m,onClick:e=>{e.stopPropagation(),l(u)},className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-gray-200 bg-white px-2 text-[11px] font-semibold text-gray-700 transition-colors hover:border-gray-300 hover:bg-gray-50 disabled:opacity-50`,children:[(0,Y.jsx)(Ge,{className:`h-3.5 w-3.5`}),a(m?`marketplaceInstalling`:`marketplaceInstall`)]})]})]})}function zt(e){return e.slug||e.install.spec}function Bt({tags:e}){let t=e.filter(Vt).slice(0,2);return t.length===0?null:(0,Y.jsx)(`div`,{className:`mt-auto truncate pt-2 text-[11px] font-medium text-gray-400`,children:t.join(` / `)})}function Vt(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function Ht(e){return e.slice(0,10)||e}function Ut(e,t){return t.startsWith(`zh`)?e.zh:e.en}var Wt=[{scene:`development-debugging`,title:{zh:`开发与调试`,en:`Development`},summary:{zh:`代码审查、错误定位、架构分析与交付验证。`,en:`Review, debug, analyze, and verify delivery work.`},icon:dt,tone:`dark`,span:`md:col-span-2`},{scene:`office-collaboration`,title:{zh:`办公协作`,en:`Office Work`},summary:{zh:`连接文档、日历、会议、邮件和团队通信。`,en:`Connect docs, calendars, meetings, mail, and teams.`},icon:ot,tone:`green`,span:`md:col-span-2`},{scene:`writing-content`,title:{zh:`写作与内容`,en:`Writing`},summary:{zh:`把调研、写作、润色和发布组织成连续工作流。`,en:`Turn research, writing, polishing, and publishing into one flow.`},icon:ut,tone:`amber`,span:`md:col-span-2`},{scene:`browser-automation`,title:{zh:`浏览器自动化`,en:`Browser`},summary:{zh:`操作网页、捕获动态内容并验证真实用户路径。`,en:`Operate pages, capture dynamic content, and verify user paths.`},icon:h,tone:`blue`,span:`md:col-span-2`},{scene:`local-environment`,title:{zh:`本地环境`,en:`Local`},summary:{zh:`管理终端、文件、运行时和本地服务。`,en:`Manage shells, files, runtimes, and local services.`},icon:T,tone:`violet`,span:`md:col-span-1`},{scene:`social-platforms`,title:{zh:`社交平台`,en:`Social`},summary:{zh:`处理发布、互动、检索和内容分发。`,en:`Handle posting, interaction, search, and distribution.`},icon:lt,tone:`sky`,span:`md:col-span-1`},{scene:`nextclaw-official`,title:{zh:`NextClaw 官方`,en:`NextClaw Official`},summary:{zh:`优先查看由 NextClaw 维护的原生能力。`,en:`Browse native capabilities maintained by NextClaw.`},icon:Ue,tone:`teal`,span:`md:col-span-2`}],Gt={icon:Ue,tone:`dark`,span:`md:col-span-2`},Kt={dark:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-stone-600 bg-stone-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},blue:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-cyan-600 bg-cyan-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},green:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-emerald-600 bg-emerald-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},amber:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-amber-600 bg-amber-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},violet:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-violet-500 bg-violet-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},sky:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-sky-500 bg-sky-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},teal:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-teal-600 bg-teal-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`}},qt=`grid grid-cols-[repeat(auto-fill,minmax(240px,320px))] justify-start gap-3`;function Jt(e){let{recentEntries:t,scenes:n,isScenesLoading:r,isItemsLoading:i,language:a,installState:o,onOpen:s,onInstall:c,onOpenScene:l}=e,u=z(a);return(0,Y.jsxs)(`div`,{className:`mb-4 space-y-5`,children:[(0,Y.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,Y.jsx)(Qt,{icon:ct,title:X({zh:`场景`,en:`Scenes`},a),description:X({zh:`按使用场景浏览适合的技能组合。`,en:`Browse skills by how you plan to use them.`},a)}),r?(0,Y.jsx)(`div`,{"data-testid":`marketplace-scenes-skeleton`,className:`grid auto-rows-[104px] grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:(0,Y.jsx)(V,{count:Wt.length})}):(0,Y.jsx)(`div`,{className:`grid grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:n.map(e=>(0,Y.jsx)(Yt,{scene:e,language:a,onSelect:l},e.scene))})]}),(i||t.length>0)&&(0,Y.jsx)(Zt,{icon:st,title:X({zh:`最近更新`,en:`Recently updated`},a),description:X({zh:`看看生态最近在补齐哪些能力。`,en:`See what the ecosystem has been improving lately.`},a),entries:t,language:a,localeFallbacks:u,isLoading:i,installState:o,onOpen:s,onInstall:c})]})}function Yt(e){let{scene:t,language:n,onSelect:r}=e,i=$t(t.scene),a=i.icon,s=Kt[i.tone];return(0,Y.jsx)(`button`,{type:`button`,onClick:()=>r(t.scene),className:o(`group flex min-h-[74px] flex-col justify-center rounded-lg border px-3 py-2.5 text-left shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/70`,s.card),children:(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:o(`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border`,s.icon),children:(0,Y.jsx)(a,{className:`h-3.5 w-3.5`})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-gray-950`,children:en(t,i,n)}),typeof t.count==`number`&&(0,Y.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:nn(t.count,n)})]}),(0,Y.jsx)(`p`,{className:o(`mt-1 line-clamp-1 text-[11px] leading-relaxed`,s.text),children:tn(t,i,n)})]})})}function Xt(e){let{scene:t,entries:n,isLoading:r,language:i,localeFallbacks:a,installState:s,onBack:c,onOpen:l,onInstall:u}=e,d=$t(t.scene),f=d.icon,p=Kt[d.tone];return(0,Y.jsxs)(`section`,{className:`flex min-h-full flex-col`,children:[(0,Y.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-start gap-2.5`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:c,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900`,"aria-label":X({zh:`返回`,en:`Back`},i),children:(0,Y.jsx)(ze,{className:`h-4 w-4`})}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:o(`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border`,p.icon),children:(0,Y.jsx)(f,{className:`h-4 w-4`})}),(0,Y.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[15px] font-semibold text-gray-950`,children:en(t,d,i)}),(0,Y.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:X(r?{zh:`加载中`,en:`Loading`}:{zh:`${n.length} 个技能`,en:`${n.length} skills`},i)})]}),(0,Y.jsx)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-2`,children:(0,Y.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[12px] leading-relaxed text-gray-500`,children:tn(t,d,i)})})]})]}),r?(0,Y.jsx)(`div`,{"data-testid":`marketplace-scene-skeleton`,className:o(qt,`min-h-0 flex-1 auto-rows-[166px] content-start`),children:(0,Y.jsx)(V,{count:24})}):n.length>0?(0,Y.jsx)(`div`,{className:qt,children:n.map(e=>(0,Y.jsx)(Rt,{entry:e,language:i,localeFallbacks:a,installState:s,layout:`grid`,onOpen:l,onInstall:u},e.item.id))}):(0,Y.jsx)(`div`,{className:`rounded-lg border border-dashed border-gray-200 py-8 text-center text-[12px] text-gray-500`,children:X({zh:`这个模块暂无技能。`,en:`No skills in this module yet.`},i)})]})}function Zt(e){let{icon:t,title:n,description:r,entries:i,language:a,localeFallbacks:o,isLoading:s,installState:c,onOpen:l,onInstall:u}=e;return(0,Y.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,Y.jsx)(Qt,{icon:t,title:n,description:r}),s?(0,Y.jsx)(`div`,{"data-testid":`marketplace-recent-skeleton`,className:`-mx-1 grid auto-rows-[166px] grid-cols-[repeat(4,260px)] gap-2.5 overflow-hidden px-1 pb-1.5`,children:(0,Y.jsx)(V,{count:4})}):(0,Y.jsx)(`div`,{className:`-mx-1 flex gap-2.5 overflow-x-auto px-1 pb-1.5 custom-scrollbar`,children:i.map(e=>(0,Y.jsx)(Rt,{entry:e,language:a,localeFallbacks:o,installState:c,onOpen:l,onInstall:u},e.item.id))})]})}function Qt({icon:e,title:t,description:n}){return(0,Y.jsx)(`div`,{className:`flex items-end justify-between gap-4`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`h3`,{className:`flex items-center gap-2 text-[14px] font-semibold text-gray-950`,children:[(0,Y.jsx)(e,{className:`h-4 w-4 text-primary`}),t]}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-[12px] leading-relaxed text-gray-500`,children:n})]})})}function X(e,t){return t.startsWith(`zh`)?e.zh:e.en}function $t(e){return Wt.find(t=>t.scene===e)??{scene:e,...Gt}}function en(e,t,n){return t.title?X(t.title,n):e.title}function tn(e,t,n){return t.summary?X(t.summary,n):e.description??e.scene}function nn(e,t){return t.startsWith(`zh`)?`${e} 个技能`:`${e} skills`}var rn=`https://skillhub.cn/`;function an(){return(0,Y.jsx)(Ke,{href:rn,external:!0,className:`h-7 shrink-0 px-1.5 text-[13px]`,children:a(`marketplaceExternalSkillSourceTitle`)})}function on(e){return(e??``).trim().toLowerCase()}function Z(e,t){let n=on(t);return n.length>0?`${e}:${n}`:``}function sn(e){let t=new Map;for(let n of e){let e=[n.install.spec,n.slug,n.id];for(let r of e){let e=Z(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function cn(e){let t=new Map;for(let n of e){let e=[n.spec,n.id,n.label];for(let r of e){let e=Z(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function ln(e,t){let n=[e.install.spec,e.slug,e.id];for(let r of n){let n=Z(e.type,r);if(!n)continue;let i=t.get(n);if(i)return i}}function un(e,t){return t.get(Z(e.type,e.spec))||t.get(Z(e.type,e.id))||t.get(Z(e.type,e.label))}function dn(e,t,n,r){let i=on(n);if(!i)return!0;let a=B(t?.summaryI18n,t?.summary,r);return[e.id,e.spec,e.label,t?.name,t?.slug,t?.summary,a,...t?.tags??[]].map(e=>on(e)).filter(Boolean).some(e=>e.includes(i))}function fn(e){let{items:t,recentItems:n,installedRecordLookup:r,scene:i,forcedType:a,typeFilter:o,scope:s,searchText:c,query:l,showListSkeleton:u,hasCatalogError:d}=e,f=St(o===`skill`),p=(0,q.useMemo)(()=>f.data?.scenes??[],[f.data?.scenes]),m=Ct(p,o===`skill`),h=(0,q.useMemo)(()=>p.map(e=>({...e,count:typeof e.count==`number`?e.count:m.get(e.scene)})),[m,p]),g=(0,q.useMemo)(()=>t.map(e=>({item:e,record:ln(e,r)})),[t,r]),_=(0,q.useMemo)(()=>n.map(e=>({item:e,record:ln(e,r)})),[r,n]),v=(0,q.useMemo)(()=>{let e=i?.trim();if(e)return h.find(t=>t.scene===e)??{scene:e,title:e}},[i,h]),y=o===`skill`&&!!i?.trim(),b=o===`skill`&&s===`all`&&!c.trim()&&!l&&!y,x=u||t.length>=4,S=b&&!d&&x&&h.length===0&&f.isLoading;return{entries:g,recentEntries:_,scenes:h,selectedScene:v,sceneEntries:g,isSceneRoute:y,isScenesLoading:S,showShelves:b&&!d&&x&&(u||h.length>0||S),backPath:a?`/skills`:`/marketplace/skills`,pathPrefix:a?`/skills/scenes`:`/marketplace/skills/scenes`}}function pn(){let e=Tt(),t=Et(),{confirm:n,ConfirmDialog:r}=We(),[i,o]=(0,q.useState)(new Set),[s,c]=(0,q.useState)(new Map);return{installState:{installingSpecs:i},manageState:{actionsByTarget:s},handleInstall:async t=>{let n=t.install.spec;if(!i.has(n)){o(e=>new Set(e).add(n));try{await e.mutateAsync({type:t.type,spec:n,kind:t.install.kind,skill:t.slug,installPath:`skills/${t.slug}`})}catch{}finally{o(e=>{let t=new Set(e);return t.delete(n),t})}}},handleManage:async(e,r)=>{let i=e===`update`?r.catalogSlug||r.id||r.spec:r.id||r.spec;if(!(!i||s.has(i))&&!(e===`uninstall`&&!await n({title:`${a(`marketplaceUninstallTitle`)} ${i}?`,description:a(`marketplaceUninstallDescription`),confirmLabel:a(`marketplaceUninstall`),variant:`destructive`}))){c(t=>new Map(t).set(i,e));try{await t.mutateAsync({type:r.type,action:e,id:i,spec:r.spec})}finally{c(e=>{let t=new Map(e);return t.delete(i),t})}}},ConfirmDialog:r}}function mn(e){let t=$e(),n=(0,q.useRef)({byKey:new Map,seq:0});return{openItemDetail:async(r,i)=>{let o=r?.name??i?.label??i?.id??i?.spec??a(`marketplaceUnknownItem`),s=Fe(r?`skill`:`skill-local`,r?.slug??i?.id??i?.spec??o),c=r?`marketplace:${r.type}:${r.slug}`:`marketplace:${i?.type??`unknown`}:${i?.id??i?.spec??o}`,l=a(`marketplaceTypeSkill`);if(!r){R(t,{id:s,title:o,typeLabel:l,spec:i?.spec??`-`,status:`ready`,summary:a(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify(i??{},null,2),contentRaw:`-`});return}let u=n.current.seq+1;n.current.seq=u,n.current.byKey.set(c,u);let d=B(r.summaryI18n,r.summary,e);R(t,{id:s,title:o,typeLabel:l,spec:r.install.spec,status:`loading`,summary:d,tags:r.tags,author:r.author});try{let e=await pe(r.slug);if(n.current.byKey.get(c)!==u)return;R(t,{id:s,title:o,typeLabel:l,spec:r.install.spec,status:`ready`,summary:d,metadataRaw:e.metadataRaw,contentRaw:e.bodyRaw||e.raw,sourceUrl:e.sourceUrl,sourceLabel:`Source (${e.source})`,tags:r.tags,author:r.author},{activate:!1})}catch(e){if(n.current.byKey.get(c)!==u)return;R(t,{id:s,title:o,typeLabel:l,spec:r.install.spec,status:`error`,summary:d,metadataRaw:JSON.stringify({error:e instanceof Error?e.message:String(e)},null,2),contentRaw:a(`marketplaceOperationFailed`)},{activate:!1})}}}}function hn(e){let{scope:t,typeFilter:n,query:r,localeFallbacks:i,catalogView:o,installedView:s,isCatalogLoading:c,isCatalogFetching:l,isCatalogFetchingNextPage:u,catalogError:d,isInstalledLoading:f,installedError:p}=e,m=(0,q.useMemo)(()=>s?.records??[],[s?.records]),h=(0,q.useMemo)(()=>o?.items??[],[o?.items]),g=(0,q.useMemo)(()=>sn(h),[h]),_=(0,q.useMemo)(()=>cn(m),[m]),v=(0,q.useMemo)(()=>m.filter(e=>e.type===n).map(e=>({key:`${e.type}:${e.spec}:${e.id??``}`,record:e,item:un(e,g)})).filter(e=>dn(e.record,e.item,r,i)).sort((e,t)=>gn(e.record,t.record)),[m,n,g,r,i]),y=(0,q.useMemo)(()=>t===`installed`?v:h.map(e=>({key:e.id,item:e,record:ln(e,_)})),[h,v,_,t]),b=t===`all`&&c&&!o||t===`installed`&&f&&!s,x=t===`all`&&!b&&!!o&&l&&!u,S=t===`installed`?f&&!s?a(`loading`):`${v.length} ${a(`marketplaceInstalledSkillsCountSuffix`)}`:o?`${o.total} ${a(`marketplaceSkillsCountSuffix`)}`:a(`loading`),C=t===`all`&&d?d:t===`installed`&&p?p:void 0,w={scope:t,entries:y,header:{title:a(t===`installed`?`marketplaceSectionInstalledSkills`:`marketplaceAllSkills`),summary:S,refreshingLabel:a(`marketplaceRefreshingResults`)},status:{showSkeleton:b,isRefreshing:x,error:C},emptyLabel:a(t===`installed`?`marketplaceNoInstalledSkills`:`marketplaceNoSkills`),errorLabel:a(t===`installed`?`marketplaceErrorLoadingInstalledSkills`:`marketplaceErrorLoadingSkillsData`)};return{allItems:h,installedRecordLookup:_,installedTotal:s?.total??0,itemListView:w,showListSkeleton:b,isRefreshingList:x}}function gn(e,t){let n=Date.parse(e.installedAt??``),r=Date.parse(t.installedAt??``);return Number.isNaN(n)||Number.isNaN(r)||n===r?e.spec.localeCompare(t.spec):r-n}var _n=20;function vn({forcedType:e}={}){let t=b(),n=p(),{language:r}=K(),i=`skill`,o=(0,q.useMemo)(()=>z(r),[r]),[s,c]=(0,q.useState)(``),[l,u]=(0,q.useState)(``),[d,f]=(0,q.useState)(`all`),[m,h]=(0,q.useState)(`relevance`),{installState:g,manageState:_,handleInstall:v,handleManage:y,ConfirmDialog:x}=pn(),{openItemDetail:S}=mn(o);(0,q.useEffect)(()=>{let e=setTimeout(()=>{u(s.trim())},250);return()=>clearTimeout(e)},[s]);let C=wt(i),w=i===`skill`?n.scene?.trim():void 0,T=yt({q:w?void 0:l||void 0,scene:w,type:i,sort:m,pageSize:_n}),ee=bt(i,d===`all`&&!s.trim()&&!l&&!w),{containerRef:E,sentinelRef:te}=Le({disabled:d!==`all`||T.isError||!T.hasNextPage||T.isFetchingNextPage,onLoadMore:()=>T.fetchNextPage(),watchValue:`${i}:${d}:${l}:${w??``}:${m}:${T.data?.loadedItems??0}:${T.data?.loadedPages??0}`});(0,q.useEffect)(()=>{let e=E.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[E,l,w,d,m,i]);let D=hn({scope:d,typeFilter:i,query:l,localeFallbacks:o,catalogView:T.data,installedView:C.data,isCatalogLoading:T.isLoading,isCatalogFetching:T.isFetching,isCatalogFetchingNextPage:T.isFetchingNextPage,catalogError:T.isError?T.error:void 0,isInstalledLoading:C.isLoading,installedError:C.isError?C.error:void 0}),O=fn({items:D.allItems,recentItems:ee.data?.items??[],installedRecordLookup:D.installedRecordLookup,scene:w,forcedType:e,typeFilter:i,scope:d,searchText:s,query:l,showListSkeleton:D.showListSkeleton,hasCatalogError:T.isError});return(0,Y.jsxs)(ae,{className:`flex h-full min-h-0 flex-col pb-0`,children:[!O.isSceneRoute&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3 border-b border-gray-200/60`,children:[(0,Y.jsx)(Ye,{value:d,onValueChange:e=>f(e),children:(0,Y.jsxs)(Je,{className:`mb-0 h-auto flex-1 justify-start gap-6 rounded-none border-b-0 bg-transparent p-0 text-gray-500`,children:[(0,Y.jsx)(qe,{value:`all`,className:`rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:a(`marketplaceTabMarketplaceSkills`)}),(0,Y.jsxs)(qe,{value:`installed`,className:`gap-1.5 rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:[a(`marketplaceTabInstalledSkills`),(0,Y.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:D.installedTotal})]})]})}),(0,Y.jsx)(an,{})]}),(0,Y.jsx)(Me,{scope:d,searchText:s,isRefreshing:D.isRefreshingList,searchPlaceholder:a(`marketplaceSearchPlaceholderSkills`),sort:m,onSearchTextChange:c,onSortChange:h})]}),(0,Y.jsx)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,Y.jsxs)(`div`,{ref:E,className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar pr-1`,"aria-busy":D.showListSkeleton||T.isFetchingNextPage,children:[O.isSceneRoute&&O.selectedScene&&(0,Y.jsx)(Xt,{scene:O.selectedScene,entries:O.sceneEntries,isLoading:D.showListSkeleton,language:r,localeFallbacks:o,installState:g,onBack:()=>t(O.backPath),onOpen:e=>void S(e.item,e.record),onInstall:v}),O.isSceneRoute&&!D.showListSkeleton&&(0,Y.jsx)(Ie,{hasMore:!!T.hasNextPage,loading:T.isFetchingNextPage,sentinelRef:te}),O.showShelves&&(0,Y.jsx)(Jt,{recentEntries:O.recentEntries,scenes:O.scenes,isScenesLoading:O.isScenesLoading,isItemsLoading:D.showListSkeleton||ee.isLoading,language:r,installState:g,onOpen:e=>void S(e.item,e.record),onInstall:v,onOpenScene:e=>t(`${O.pathPrefix}/${e}`)}),!O.isSceneRoute&&(0,Y.jsx)(Lt,{model:D.itemListView,showTitle:O.showShelves||!D.showListSkeleton,operationState:{installState:g,manageState:_},scroll:{hasMore:!!T.hasNextPage,loadingMore:T.isFetchingNextPage,sentinelRef:te},actions:{onOpen:(e,t)=>void S(e,t),onInstall:v,onManage:y}})]})}),(0,Y.jsx)(x,{})]})}var yn=`NextClaw`,bn=[{prefix:`/marketplace/mcp`,key:`marketplaceMcpPageTitle`},{prefix:`/marketplace/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/marketplace`,key:`marketplace`},{prefix:`/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/cron`,key:`cronPageTitle`},{prefix:`/agents`,key:`agentsPageTitle`},{prefix:`/chat`,key:`chat`},{prefix:`/model`,key:`modelPageTitle`},{prefix:`/search`,key:`searchPageTitle`},{prefix:`/providers`,key:`providersPageTitle`},{prefix:`/channels`,key:`channelsPageTitle`},{prefix:`/runtime`,key:`runtimePageTitle`},{prefix:`/updates`,key:`runtimeUpdatesPageTitle`},{prefix:`/remote`,key:`remotePageTitle`},{prefix:`/security`,key:`authSecurityTitle`},{prefix:`/secrets`,key:`secretsPageTitle`}];function xn(e,t){return e===t||e.startsWith(`${t}/`)}function Sn(e){let t=e.toLowerCase();for(let{prefix:e,key:n}of bn)if(xn(t,e))return a(n);return a(`settings`)}function Cn(e){let t=e.toLowerCase();return t===`localhost`||t.endsWith(`.localhost`)||t===`::1`||t===`[::1]`||t.startsWith(`127.`)}function wn(e){let t=e?.host.trim(),n=e?.hostname.trim(),r=e?.port.trim();return!t||!n?null:Cn(n)?r||null:t}function Tn(e,t){let n=wn(t);return`${yn}${n?` ${n}`:``} - ${Sn(e)}`}var En={...u,...Re};function Dn({children:e,sideDockManager:t}){let{isOpen:n,mode:r}=$e();Ve();let{pathname:i}=x(),{language:a}=K(),{isMobile:o}=Xe(),s=C(),c=m(e=>e.isVisible);m(e=>e.pinnedItems);let l={getDockState:t.getDockState,pinTab:t.pinTab,unpinTab:t.unpinTab};return(0,q.useEffect)(()=>{document.title=Tn(i,window.location)},[i,a]),o&&s!==`win32`?(0,Y.jsx)(ee,{pathname:i,isDocBrowserOpen:n,docBrowserDockControls:l,docBrowserRenderers:En,topbarLeadingInset:s===`darwin`?`4.75rem`:void 0,children:e}):(0,Y.jsx)(ne,{pathname:i,isMobileLayout:o,isDocBrowserOpen:n,docBrowserMode:r,docBrowserDockControls:l,docBrowserRenderers:En,sideDock:c?(0,Y.jsx)(S,{manager:t}):null,children:e})}function On({children:e}){let t=te();return(0,Y.jsx)(et,{manager:t.docBrowserManager,children:(0,Y.jsx)(Dn,{sideDockManager:t.sideDockManager,children:e})})}function kn(){let{isMobile:e}=Xe();return e?(0,Y.jsx)(v,{}):(0,Y.jsx)(y,{to:`/model`,replace:!0})}function An(e){let t=e.trim().toLowerCase();return t?!t.startsWith(`skills`):!0}function jn(e,t){t.startsWith(`mcp`)&&(e?.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}))}function Mn(e,t){e&&An(t)&&e.invalidateQueries({queryKey:[`config`]}),jn(e,t)}function Nn(e){let t=(0,q.useRef)(!1);(0,q.useEffect)(()=>{let n=F.eventBus.on(j.connectionOpen,()=>{A.handleConnectionRestored(),k.refreshAfterRealtimeReconnect(),t.current&&(t.current=!1,e?.invalidateQueries({queryKey:[`ncp-sessions`]}))}),r=F.eventBus.on(j.connectionClose,()=>{A.handleConnectionInterrupted(null),t.current=!0}),i=F.eventBus.on(j.connectionError,e=>{A.handleConnectionInterrupted(e?.message??null),t.current=!0}),a=F.eventBus.on(j.configUpdated,({path:t})=>{Mn(e,t)}),o=F.eventBus.on(j.runtimeUpdateSnapshot,e=>{k.reportSnapshot(e)}),s=F.eventBus.on(j.sessionRunStatus,t=>{N(e,{type:`session.run-status`,payload:t})}),c=F.eventBus.on(j.sessionSummaryUpsert,t=>{N(e,{type:`session.summary.upsert`,payload:t})}),l=F.eventBus.on(j.sessionSummaryDelete,t=>{N(e,{type:`session.summary.delete`,payload:t})}),u=F.eventBus.on(j.error,e=>{console.error(`Realtime transport error:`,e.message)});return()=>{n(),r(),i(),a(),o(),s(),c(),l(),u()}},[e])}var Pn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{ModelConfigPage:e}=await import(`./model-config-page-oNqnMXNY.js`);return{ModelConfigPage:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]))).ModelConfigPage})),Fn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{AppearanceSettingsPage:e}=await import(`./appearance-settings-page-BZSd1SrH.js`);return{AppearanceSettingsPage:e}},__vite__mapDeps([19,1,20,21,5,3,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35]))).AppearanceSettingsPage})),Q=(0,q.lazy)(async()=>({default:(await s(async()=>{let{ChatPage:e}=await import(`./chat-page-D2xfR6TK.js`);return{ChatPage:e}},__vite__mapDeps([36,1,5,3,20,21,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35,6,37,38,17]))).ChatPage})),In=(0,q.lazy)(async()=>({default:(await s(async()=>{let{SearchConfigPage:e}=await import(`./search-config-page-DzkpSGFH.js`);return{SearchConfigPage:e}},__vite__mapDeps([39,1,7,5,3,2,25,10,11,32,14,40,15,17]))).SearchConfigPage})),Ln=(0,q.lazy)(async()=>({default:(await s(async()=>{let{ProvidersConfigPage:e}=await import(`./providers-config-page-CP-OnvLK.js`);return{ProvidersConfigPage:e}},__vite__mapDeps([41,1,5,3,7,22,8,2,23,25,30,32,14,26,37,33,34,40,15,17,18,11,9]))).ProvidersConfigPage})),Rn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{ChannelsList:e}=await import(`./channels-list-page-C_x83ZCT.js`);return{ChannelsList:e}},__vite__mapDeps([42,1,5,3,7,2,25,4,10,11,31,32,14,12,23,34,40,38,15,17,18]))).ChannelsList})),zn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{RuntimeConfig:e}=await import(`./runtime-config-page-u_fuHxc8.js`);return{RuntimeConfig:e}},__vite__mapDeps([43,1,20,21,5,3,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35,44,45,15,17]))).RuntimeConfig})),Bn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{DesktopUpdateConfig:e}=await import(`./desktop-update-config-DEOMOsDN.js`);return{DesktopUpdateConfig:e}},__vite__mapDeps([46,7,1,5,3,2,29,10,11,27,44]))).DesktopUpdateConfig})),Vn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{SecurityConfig:e}=await import(`./security-config-yraYoy9s.js`);return{SecurityConfig:e}},__vite__mapDeps([47,2,1,3]))).SecurityConfig})),Hn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{SecretsConfigPage:e}=await import(`./secrets-config-page-DhoLYm7Z.js`);return{SecretsConfigPage:e}},__vite__mapDeps([48,1,7,5,3,2,26,45,33,15,17]))).SecretsConfigPage})),Un=(0,q.lazy)(async()=>({default:(await s(async()=>{let{RemoteAccessPage:e}=await import(`./remote-2gZkJSX4.js`);return{RemoteAccessPage:e}},__vite__mapDeps([49,20,1,21,5,3,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35]))).RemoteAccessPage})),Wn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{McpMarketplacePage:e}=await import(`./mcp-marketplace-page-CaUFv37E.js`);return{McpMarketplacePage:e}},__vite__mapDeps([50,51,1,5,3,7,22,8,2,23,28,24,25,10,11,26,27,13,14,12,38,16]))).McpMarketplacePage}));function Gn(){return(0,Y.jsx)(`div`,{className:`h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40`})}function Kn({children:e}){return(0,Y.jsx)(q.Suspense,{fallback:(0,Y.jsx)(Gn,{}),children:e})}function $(e){return(0,Y.jsx)(Kn,{children:e})}var qn=[{path:`/chat/skills`,redirectTo:`/skills`},{path:`/chat/cron`,redirectTo:`/cron`},{path:`/chat/agents`,redirectTo:`/agents`},{path:`/chat/:sessionId?`,element:$((0,Y.jsx)(Q,{view:`chat`}))},{path:`/agents`,element:$((0,Y.jsx)(Q,{view:`agents`}))},{path:`/skills`,element:$((0,Y.jsx)(Q,{view:`skills`}))},{path:`/skills/scenes/:scene`,element:$((0,Y.jsx)(Q,{view:`skills`}))},{path:`/cron`,element:$((0,Y.jsx)(Q,{view:`cron`}))},{path:`/appearance`,element:$((0,Y.jsx)(Fn,{}))},{path:`/model`,element:$((0,Y.jsx)(Pn,{}))},{path:`/search`,element:$((0,Y.jsx)(In,{}))},{path:`/providers`,element:$((0,Y.jsx)(Ln,{}))},{path:`/channels`,element:$((0,Y.jsx)(Rn,{}))},{path:`/runtime`,element:$((0,Y.jsx)(zn,{}))},{path:`/updates`,element:$((0,Y.jsx)(Bn,{}))},{path:`/remote`,element:$((0,Y.jsx)(Un,{}))},{path:`/security`,element:$((0,Y.jsx)(Vn,{}))},{path:`/secrets`,element:$((0,Y.jsx)(Hn,{}))},{path:`/settings`,element:(0,Y.jsx)(kn,{})},{path:`/marketplace/skills`,redirectTo:`/skills`},{path:`/marketplace`,redirectTo:`/skills`},{path:`/marketplace/mcp`,element:$((0,Y.jsx)(Wn,{}))},{path:`/`,redirectTo:`/chat`},{path:`*`,redirectTo:`/chat`}];function Jn(e){return`redirectTo`in e?(0,Y.jsx)(E,{path:e.path,element:(0,Y.jsx)(y,{to:e.redirectTo,replace:!0})},e.path):(0,Y.jsx)(E,{path:e.path,element:e.element},e.path)}function Yn(){return(0,Y.jsx)(w,{children:qn.map(Jn)})}function Xn(){return Nn(we),ue(),(0,q.useEffect)(()=>(k.start(),()=>{k.stop()}),[]),(0,Y.jsxs)(O,{children:[(0,Y.jsx)(On,{children:(0,Y.jsx)(Yn,{})}),(0,Y.jsx)(d,{}),(0,Y.jsx)(l,{})]})}function Zn(){let e=me(),t=e.isError&&Ae(e.error);return e.isLoading&&!e.isError||t||e.isError?(0,Y.jsx)(Xn,{}):e.data?.enabled&&!e.data.authenticated?(0,Y.jsx)(c,{username:e.data.username}):(0,Y.jsx)(Xn,{})}function Qn(){return(0,q.useEffect)(()=>{ie()},[]),(0,Y.jsxs)(ke,{client:we,children:[(0,Y.jsx)(Zn,{}),(0,Y.jsx)(g,{}),(0,Y.jsx)(ve,{position:`top-right`,richColors:!0,offset:window.nextclawDesktop?.platform===`win32`?56:void 0,mobileOffset:window.nextclawDesktop?.platform===`win32`?56:void 0})]})}var $n=window.nextclawDesktop?.platform===`win32`?_:re;(0,ft.createRoot)(document.getElementById(`root`)).render((0,Y.jsx)(q.StrictMode,{children:(0,Y.jsx)(f,{children:(0,Y.jsx)(He,{children:(0,Y.jsx)($n,{children:(0,Y.jsx)(Qn,{})})})})}));export{vn as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/model-config-page-D6ex3_NM.js","assets/chunk-DseTPa7n.js","assets/api-D5UCLVE_.js","assets/react-DerwD2EA.js","assets/book-open-WsEnuW9P.js","assets/dist-Ca-jiFrK.js","assets/provider-scoped-model-input-1TJxAhx6.js","assets/select-C1zfp9zM.js","assets/popover-DHx55dbc.js","assets/provider-models-CXUgDxGR.js","assets/navigation-link-qPPUiLt0.js","assets/host-capabilities-B-TtABsP.js","assets/loader-circle-DjwSRQHW.js","assets/doc-browser-context-CGz0LULR.js","assets/middleware-Df-a4x-q.js","assets/form-actions-CnSzu3WD.js","assets/skeleton-DL5npsVL.js","assets/use-config-BvxDWV-M.js","assets/config-hints-S3g-UVZb.js","assets/appearance-settings-page-yJR6Kt9c.js","assets/app-presenter-provider-DcpcRgLn.js","assets/preload-helper-D4M6sveU.js","assets/confirm-dialog-e2YCUzt1.js","assets/x-DGdYT7rH.js","assets/doc-browser-CZX6I6CU.js","assets/search-D0HtJIL-.js","assets/plus-C45awBb1.js","assets/refresh-cw-C7bynrWX.js","assets/use-confirm-dialog-CeUEE4p5.js","assets/card-xVrS1b1T.js","assets/eye-B30J471A.js","assets/tabs-DmKgMKzb.js","assets/use-viewport-layout-DaKJ-kap.js","assets/trash-2-CUpWjNHu.js","assets/logo-badge-CISsltAo.js","assets/app-presenter-provider-D3BuuOyZ.css","assets/chat-page-CXYXMIQQ.js","assets/settings-2-Ba3cLSN2.js","assets/tag-chip-2vwlVUwM.js","assets/search-config-page-n1GElgij.js","assets/config-split-page-xj0UtMow.js","assets/providers-config-page-BwHtHIPe.js","assets/channels-list-page-CAWuTHSM.js","assets/runtime-config-page-CMLVC5UV.js","assets/rotate-cw-Bhx0XkQP.js","assets/save-CsRsFtHS.js","assets/desktop-update-config-D5NIaimo.js","assets/security-config-n2WHhHXV.js","assets/secrets-config-page-DbUc3Ggi.js","assets/remote-CPpTKDgX.js","assets/mcp-marketplace-page-BZa7p7Qf.js","assets/mcp-marketplace-page-CPcPzMUQ.js"])))=>i.map(i=>d[i]);
2
+ import{i as e,t}from"./chunk-DseTPa7n.js";import{h as n,m as r,p as i,r as a,u as o}from"./react-DerwD2EA.js";import{t as s}from"./preload-helper-D4M6sveU.js";import{B as c,D as l,E as u,V as d,_ as f,_t as p,a as m,at as h,b as g,dt as _,f as v,ft as y,gt as b,ht as x,i as S,m as C,mt as w,ot as T,p as ee,pt as E,r as te,st as D,t as O,u as ne,ut as re,y as ie}from"./app-presenter-provider-DcpcRgLn.js";import{$t as ae,At as k,B as oe,Cn as se,Dn as ce,En as le,Ft as ue,I as de,It as A,Jt as j,L as M,On as fe,R as pe,St as me,Tn as he,V as ge,_n as _e,an as ve,cn as ye,dn as be,fn as xe,gn as Se,hn as Ce,in as we,m as N,mn as Te,on as P,pn as Ee,sn as De,un as Oe,vn as ke,vt as F,wn as I,xt as Ae,yn as L,z as je}from"./api-D5UCLVE_.js";import{a as R,c as Me,d as Ne,f as Pe,i as Fe,l as Ie,n as Le,o as z,r as Re,s as B,u as V}from"./mcp-marketplace-page-CPcPzMUQ.js";import{c as H}from"./dist-Ca-jiFrK.js";import{n as ze}from"./search-D0HtJIL-.js";import{a as U,c as W,o as G,s as Be}from"./doc-browser-CZX6I6CU.js";import{i as Ve,n as He,o as Ue,r as K,t as We}from"./use-confirm-dialog-CeUEE4p5.js";import{o as Ge}from"./card-xVrS1b1T.js";import{t as Ke}from"./navigation-link-qPPUiLt0.js";import{i as qe,r as Je,t as Ye}from"./tabs-DmKgMKzb.js";import{t as Xe}from"./use-viewport-layout-DaKJ-kap.js";import{t as Ze}from"./refresh-cw-C7bynrWX.js";import{t as Qe}from"./trash-2-CUpWjNHu.js";import{n as $e,t as et}from"./doc-browser-context-CGz0LULR.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var tt=t((e=>{var t=r();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}));function nt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function rt(e,t,n){let r=e.slice(0);return r[t]=n,r}var it=class extends fe{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,I.batch(()=>{let e=this.#i,t=this.#f(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!ce(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(nt(e,n).forEach(e=>{e.destroy()}),nt(n,e).forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})),this.#m()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#f(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=le(this.#a,t(e))),this.#a}return e}#f(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new se(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=rt(this.#t,n,t),this.#m())}#m(){if(this.hasListeners()){let e=this.#a,t=this.#u(this.#t,this.#l);e!==this.#d(t,this.#r?.combine)&&I.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},q=e(n(),1);function at({queries:e,...t},n){let r=L(n),i=_e(),a=Se(),o=q.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{Oe(e),Ee(e,a,r.getQueryCache().get(e.queryHash))}),Ce(a);let[s]=q.useState(()=>new it(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;q.useSyncExternalStore(q.useCallback(e=>d?s.subscribe(I.batchCalls(e)):he,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),q.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>xe(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&xe(n,e)?be(n,new se(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&Te({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}var ot=H(`BriefcaseBusiness`,[[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2`,key:`1ksdt3`}],[`path`,{d:`M22 13a18.15 18.15 0 0 1-20 0`,key:`12hx5q`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]),st=H(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),ct=H(`Compass`,[[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),lt=H(`MessagesSquare`,[[`path`,{d:`M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z`,key:`p1xzt8`}],[`path`,{d:`M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1`,key:`1cx29u`}]]),ut=H(`PenLine`,[[`path`,{d:`M12 20h9`,key:`t2du7b`}],[`path`,{d:`M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z`,key:`1ykcvy`}]]),dt=H(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),ft=tt();function J(e){return Array.from(new Set(e.map(e=>e.spec).filter(Boolean)))}function pt(e){let{request:t,result:n}=e,r=new Date().toISOString();return n.type===`skill`?{type:`skill`,spec:n.spec,id:t.skill??n.spec,label:t.skill??n.name??n.spec,source:`workspace`,installPath:t.installPath,installedAt:r}:{type:n.type,spec:n.spec,id:n.name??n.spec,label:n.name??n.spec,source:`marketplace`,origin:`marketplace`,enabled:t.enabled??!0,runtimeStatus:t.enabled===!1?`disabled`:`ready`,installedAt:r}}function mt(e,t){let{id:n,spec:r}=t;return!!(r&&e.spec===r||n&&e.id===n)}function ht(e,t){return t??{type:e,total:0,specs:[],records:[]}}function gt(e){let{result:t,view:n}=e,r=ht(t.type,n),i=pt(e),a=r.records.findIndex(e=>mt(e,{id:i.id,spec:i.spec})),o=[...r.records];return a>=0?o[a]={...o[a],...i}:o.unshift(i),{...r,type:t.type,records:o,specs:J(o),total:o.length}}function _t(e){let{request:t,result:n,view:r}=e,i=ht(n.type,r);if(n.action===`uninstall`||n.action===`remove`){let e=i.records.filter(e=>!mt(e,{id:n.id,spec:t.spec}));return{...i,records:e,specs:J(e),total:e.length}}let a=i.records.map(e=>mt(e,{id:n.id,spec:t.spec})?n.action===`disable`?{...e,enabled:!1,runtimeStatus:`disabled`}:n.action===`update`?{...e,installedAt:new Date().toISOString(),origin:e.origin??`marketplace`}:{...e,enabled:!0,runtimeStatus:`ready`}:e);return{...i,records:a,specs:J(a),total:a.length}}var vt=3e4;function yt(e){let t=Pe({queryKey:[`marketplace-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>M({...e,page:t}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0,placeholderData:(t,n)=>{let r=n?.queryKey?.[1];if(!(!r||typeof r!=`object`||!r))return(`type`in r?r.type:void 0)===e.type&&xt(r,e)?t:void 0},staleTime:15e3,refetchInterval:e.q?!1:vt,refetchOnMount:`always`,refetchOnReconnect:`always`,refetchOnWindowFocus:`always`}),n=(0,q.useMemo)(()=>Ne(t.data),[t.data]);return{...t,data:n}}function bt(e,t=!0){return ye({queryKey:[`marketplace-recent-items`,e],queryFn:()=>M({type:e,sort:`updated`,page:1,pageSize:6}),enabled:t,staleTime:15e3,refetchInterval:vt,refetchOnMount:`always`,refetchOnReconnect:`always`,refetchOnWindowFocus:`always`})}function xt(e,t){return e.tag===t.tag&&e.scene===t.scene&&e.pageSize===t.pageSize}function St(e=!0){return ye({queryKey:[`marketplace-skill-scenes`],queryFn:je,enabled:e,staleTime:6e4})}function Ct(e,t=!0){let n=at({queries:e.map(e=>({queryKey:[`marketplace-skill-scene-count`,e.scene],queryFn:()=>M({type:`skill`,scene:e.scene,pageSize:1}),enabled:t&&typeof e.count!=`number`,staleTime:6e4}))});return(0,q.useMemo)(()=>{let t=new Map;return e.forEach((e,r)=>{let i=typeof e.count==`number`?e.count:n[r]?.data?.total;typeof i==`number`&&t.set(e.scene,i)}),t},[n,e])}function wt(e){return ye({queryKey:[`marketplace-installed`,e],queryFn:()=>de(e),staleTime:1e4})}function Tt(){let e=L();return De({mutationFn:e=>oe(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>gt({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`}),P.success(t.message||a(`marketplaceInstallSuccessSkill`))},onError:e=>{P.error(e.message||a(`marketplaceInstallFailed`))}})}function Et(){let e=L();return De({mutationFn:e=>ge(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>_t({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`});let r=t.action===`enable`?a(`marketplaceEnableSuccess`):t.action===`disable`?a(`marketplaceDisableSuccess`):t.action===`update`?a(`marketplaceUpdateSuccess`):a(`marketplaceUninstallSuccess`);P.success(t.message||r)},onError:e=>{P.error(e.message||a(`marketplaceOperationFailed`))}})}var Y=i(),Dt=[`bg-amber-600`,`bg-orange-500`,`bg-yellow-600`,`bg-emerald-600`,`bg-teal-600`,`bg-cyan-600`,`bg-stone-600`,`bg-rose-500`,`bg-violet-500`];function Ot(e){let{name:t,fallback:n,className:r}=e,i=t||n,a=i.substring(0,2).toUpperCase();return(0,Y.jsx)(`div`,{className:o(`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-sm font-semibold text-white`,kt(i),r),children:a})}function kt(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return Dt[Math.abs(t)%Dt.length]}function At({title:e,spec:t}){return(0,Y.jsxs)(Be,{delayDuration:400,children:[(0,Y.jsxs)(U,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsx)(`div`,{className:`truncate text-[14px] font-semibold leading-tight text-gray-950`,children:e})}),(0,Y.jsx)(G,{className:`max-w-[300px] text-xs`,children:e})]}),(0,Y.jsx)(`div`,{className:`mb-2 mt-1 flex min-w-0 items-center gap-1.5`,children:t?(0,Y.jsxs)(U,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsx)(`span`,{className:`max-w-full truncate text-[11px] font-mono leading-tight text-gray-400`,children:t})}),(0,Y.jsx)(G,{className:`max-w-[300px] break-all font-mono text-xs`,children:t})]}):null})]})}function jt(e){let{item:t,record:n,state:r,onInstall:i,onManage:s}=e,{isInstalling:c,canUpdate:l,canUninstall:u,busyAction:d}=r,f=!!d;return t&&!n||n&&(l||u)?(0,Y.jsxs)(`div`,{className:o(`flex shrink-0 items-center justify-end gap-1.5 opacity-100 transition-opacity duration-150`,`md:pointer-events-none md:opacity-0`,`md:group-hover:pointer-events-auto md:group-hover:opacity-100`,`md:group-focus-within:pointer-events-auto md:group-focus-within:opacity-100`),children:[t&&!n&&(0,Y.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),i(t)},disabled:c,className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md bg-primary px-2 text-[11px] font-medium text-white transition-colors hover:bg-primary-600 disabled:opacity-50`,children:[(0,Y.jsx)(Ge,{className:`h-3 w-3`}),a(c?`marketplaceInstalling`:`marketplaceInstall`)]}),n&&l&&(0,Y.jsxs)(`button`,{disabled:f,onClick:e=>{e.stopPropagation(),s(`update`,n)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-blue-200/80 bg-white px-2 text-[11px] font-medium text-blue-600 transition-colors hover:border-blue-300 hover:bg-blue-50 disabled:opacity-50`,children:[(0,Y.jsx)(Ze,{className:`h-3 w-3`}),a(d===`update`?`marketplaceUpdating`:`marketplaceUpdate`)]}),n&&u&&(0,Y.jsxs)(`button`,{disabled:f,onClick:e=>{e.stopPropagation(),s(`uninstall`,n)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-gray-200/80 bg-white px-2 text-[11px] font-medium text-gray-500 transition-colors hover:border-rose-200 hover:bg-rose-50 hover:text-rose-600 disabled:opacity-50`,children:[(0,Y.jsx)(Qe,{className:`h-3 w-3`}),a(d===`uninstall`?`marketplaceRemoving`:`marketplaceUninstall`)]})]}):null}function Mt(e){let{record:t,disabled:n}=e;return t?(0,Y.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-end`,children:(0,Y.jsx)(Nt,{disabled:n})}):null}function Nt(e){let{disabled:t}=e,n=a(t?`marketplaceDisabledStatus`:`marketplaceInstalledStatus`);return(0,Y.jsx)(Be,{delayDuration:300,children:(0,Y.jsxs)(U,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsx)(`span`,{"aria-label":n,className:o(`inline-flex h-5 w-5 items-center justify-center`,t?`text-gray-400`:`text-emerald-700`),children:t?(0,Y.jsx)(D,{className:`h-4 w-4 opacity-40`}):(0,Y.jsx)(D,{className:`h-4 w-4`})})}),(0,Y.jsx)(G,{className:`text-xs`,children:n})]})})}function Pt(e){let{item:t,record:n,installState:r,manageState:i,onOpen:o,onInstall:s,onManage:c}=e,{language:l}=K(),u=z(l),d=t?.name??n?.label??n?.id??n?.spec??a(`marketplaceUnknownItem`),f=B(t?.summaryI18n,t?.summary,u)||(n?a(`marketplaceInstalledLocalSummary`):``),p=t?.install.spec??n?.spec??``,m=t?.tags??[],h=n?.id||n?.spec,g=h?i.actionsByTarget.get(h):void 0,_=n?.type===`skill`&&n.source===`workspace`,v=n?.type===`skill`&&n.origin===`marketplace`,y=n?n.enabled===!1||n.runtimeStatus===`disabled`:!1,b=t?.install.spec,x=typeof b==`string`&&r.installingSpecs.has(b);return(0,Y.jsxs)(`article`,{onClick:o,className:`group flex h-full min-h-[156px] cursor-pointer flex-col rounded-xl border border-gray-200/60 bg-white p-3.5 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,Y.jsx)(Ot,{name:d,fallback:p||a(`marketplaceTypeSkill`),className:`h-9 w-9 rounded-lg text-xs`}),(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,Y.jsx)(At,{title:d,spec:p})}),(0,Y.jsx)(Mt,{record:n,disabled:y})]}),(0,Y.jsxs)(`div`,{className:`mt-2 flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`p`,{className:`line-clamp-2 text-left text-[12px] leading-relaxed text-gray-500`,children:f}),(0,Y.jsxs)(`div`,{className:`mt-auto flex min-w-0 items-end justify-between gap-2 pt-2`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsx)(Ft,{tags:m})}),(0,Y.jsx)(jt,{item:t,record:n,state:{isInstalling:x,canUpdate:v,canUninstall:_,busyAction:g},onInstall:s,onManage:c})]})]})]})}function Ft({tags:e}){let t=e.filter(It).slice(0,3);return t.length===0?null:(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-1.5 overflow-hidden`,children:t.map(e=>(0,Y.jsx)(`span`,{className:`max-w-[104px] truncate rounded-md bg-gray-100 px-2 py-0.5 text-[11px] font-medium leading-5 text-gray-500`,children:e},e))})}function It(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function Lt({model:e,showTitle:t,operationState:n,scroll:r,actions:i}){let{scope:a,entries:s,header:c,status:l,emptyLabel:u,errorLabel:d}=e,{showSkeleton:f,isRefreshing:p,error:m}=l,{hasMore:h,loadingMore:g,sentinelRef:_}=r,{installState:v,manageState:y}=n,{onOpen:b,onInstall:x,onManage:S}=i;return(0,Y.jsxs)(`section`,{className:o(`flex min-h-full flex-col`,t&&`gap-3`),children:[t&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-950`,children:c.title}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] text-gray-500`,children:[p&&(0,Y.jsx)(`span`,{className:`font-medium text-primary`,children:c.refreshingLabel}),(0,Y.jsx)(`span`,{children:c.summary})]})]}),m&&(0,Y.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[d,`: `,m.message]}),p&&(0,Y.jsx)(`div`,{"data-testid":`marketplace-list-refreshing`,className:`h-0.5 overflow-hidden rounded-full bg-primary/10`,children:(0,Y.jsx)(`div`,{className:`h-full w-1/3 animate-pulse rounded-full bg-primary`})}),(0,Y.jsxs)(`div`,{"data-testid":f?`marketplace-list-skeleton`:void 0,className:o(`grid grid-cols-1 gap-2.5 md:grid-cols-2 xl:grid-cols-3`,f&&`min-h-0 flex-1 auto-rows-[156px] content-start`),children:[f&&(0,Y.jsx)(V,{count:36}),!f&&!m&&s.map(e=>(0,Y.jsx)(Pt,{item:e.item,record:e.record,installState:v,manageState:y,onOpen:()=>b(e.item,e.record),onInstall:x,onManage:S},e.key))]}),!f&&!m&&s.length===0&&(0,Y.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:u}),a===`all`&&!f&&!m&&(0,Y.jsx)(Ie,{hasMore:h,loading:g,sentinelRef:_})]})}function Rt(e){let{entry:t,language:n,localeFallbacks:r,installState:i,layout:s=`rail`,onOpen:c,onInstall:l}=e,{item:u,record:d}=t,f=B(u.summaryI18n,u.summary,r),p=u.install.spec,m=i.installingSpecs.has(p),h=!!d;return(0,Y.jsxs)(`article`,{onClick:()=>c(t),className:o(`group flex min-h-[166px] cursor-pointer flex-col justify-between rounded-xl border border-gray-200/70 bg-white p-3 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,s===`rail`?`w-[260px] shrink-0`:`w-full min-w-0`),children:[(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-start gap-2.5`,children:[(0,Y.jsx)(Ot,{name:u.name,fallback:u.install.spec}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,Y.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-gray-950`,children:u.name}),(0,Y.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] font-mono leading-tight text-gray-400`,children:zt(u)})]})]}),(0,Y.jsx)(`p`,{className:`line-clamp-2 text-[12px] leading-relaxed text-gray-500`,children:f}),(0,Y.jsx)(Bt,{tags:u.tags})]}),(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-gray-100 pt-2.5`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-gray-400`,children:Ht(u.updatedAt)}),h?(0,Y.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 text-[11px] font-semibold text-emerald-700`,children:[(0,Y.jsx)(D,{className:`h-3.5 w-3.5`}),Ut({zh:`已安装`,en:`Installed`},n)]}):(0,Y.jsxs)(`button`,{type:`button`,disabled:m,onClick:e=>{e.stopPropagation(),l(u)},className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-gray-200 bg-white px-2 text-[11px] font-semibold text-gray-700 transition-colors hover:border-gray-300 hover:bg-gray-50 disabled:opacity-50`,children:[(0,Y.jsx)(Ge,{className:`h-3.5 w-3.5`}),a(m?`marketplaceInstalling`:`marketplaceInstall`)]})]})]})}function zt(e){return e.slug||e.install.spec}function Bt({tags:e}){let t=e.filter(Vt).slice(0,2);return t.length===0?null:(0,Y.jsx)(`div`,{className:`mt-auto truncate pt-2 text-[11px] font-medium text-gray-400`,children:t.join(` / `)})}function Vt(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function Ht(e){return e.slice(0,10)||e}function Ut(e,t){return t.startsWith(`zh`)?e.zh:e.en}var Wt=[{scene:`development-debugging`,title:{zh:`开发与调试`,en:`Development`},summary:{zh:`代码审查、错误定位、架构分析与交付验证。`,en:`Review, debug, analyze, and verify delivery work.`},icon:dt,tone:`dark`,span:`md:col-span-2`},{scene:`office-collaboration`,title:{zh:`办公协作`,en:`Office Work`},summary:{zh:`连接文档、日历、会议、邮件和团队通信。`,en:`Connect docs, calendars, meetings, mail, and teams.`},icon:ot,tone:`green`,span:`md:col-span-2`},{scene:`writing-content`,title:{zh:`写作与内容`,en:`Writing`},summary:{zh:`把调研、写作、润色和发布组织成连续工作流。`,en:`Turn research, writing, polishing, and publishing into one flow.`},icon:ut,tone:`amber`,span:`md:col-span-2`},{scene:`browser-automation`,title:{zh:`浏览器自动化`,en:`Browser`},summary:{zh:`操作网页、捕获动态内容并验证真实用户路径。`,en:`Operate pages, capture dynamic content, and verify user paths.`},icon:h,tone:`blue`,span:`md:col-span-2`},{scene:`local-environment`,title:{zh:`本地环境`,en:`Local`},summary:{zh:`管理终端、文件、运行时和本地服务。`,en:`Manage shells, files, runtimes, and local services.`},icon:T,tone:`violet`,span:`md:col-span-1`},{scene:`social-platforms`,title:{zh:`社交平台`,en:`Social`},summary:{zh:`处理发布、互动、检索和内容分发。`,en:`Handle posting, interaction, search, and distribution.`},icon:lt,tone:`sky`,span:`md:col-span-1`},{scene:`nextclaw-official`,title:{zh:`NextClaw 官方`,en:`NextClaw Official`},summary:{zh:`优先查看由 NextClaw 维护的原生能力。`,en:`Browse native capabilities maintained by NextClaw.`},icon:Ue,tone:`teal`,span:`md:col-span-2`}],Gt={icon:Ue,tone:`dark`,span:`md:col-span-2`},Kt={dark:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-stone-600 bg-stone-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},blue:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-cyan-600 bg-cyan-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},green:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-emerald-600 bg-emerald-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},amber:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-amber-600 bg-amber-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},violet:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-violet-500 bg-violet-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},sky:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-sky-500 bg-sky-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},teal:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-teal-600 bg-teal-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`}},qt=`grid grid-cols-[repeat(auto-fill,minmax(240px,320px))] justify-start gap-3`;function Jt(e){let{recentEntries:t,scenes:n,isScenesLoading:r,isItemsLoading:i,language:a,installState:o,onOpen:s,onInstall:c,onOpenScene:l}=e,u=z(a);return(0,Y.jsxs)(`div`,{className:`mb-4 space-y-5`,children:[(0,Y.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,Y.jsx)(Qt,{icon:ct,title:X({zh:`场景`,en:`Scenes`},a),description:X({zh:`按使用场景浏览适合的技能组合。`,en:`Browse skills by how you plan to use them.`},a)}),r?(0,Y.jsx)(`div`,{"data-testid":`marketplace-scenes-skeleton`,className:`grid auto-rows-[104px] grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:(0,Y.jsx)(V,{count:Wt.length})}):(0,Y.jsx)(`div`,{className:`grid grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:n.map(e=>(0,Y.jsx)(Yt,{scene:e,language:a,onSelect:l},e.scene))})]}),(i||t.length>0)&&(0,Y.jsx)(Zt,{icon:st,title:X({zh:`最近更新`,en:`Recently updated`},a),description:X({zh:`看看生态最近在补齐哪些能力。`,en:`See what the ecosystem has been improving lately.`},a),entries:t,language:a,localeFallbacks:u,isLoading:i,installState:o,onOpen:s,onInstall:c})]})}function Yt(e){let{scene:t,language:n,onSelect:r}=e,i=$t(t.scene),a=i.icon,s=Kt[i.tone];return(0,Y.jsx)(`button`,{type:`button`,onClick:()=>r(t.scene),className:o(`group flex min-h-[74px] flex-col justify-center rounded-lg border px-3 py-2.5 text-left shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/70`,s.card),children:(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:o(`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border`,s.icon),children:(0,Y.jsx)(a,{className:`h-3.5 w-3.5`})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-gray-950`,children:en(t,i,n)}),typeof t.count==`number`&&(0,Y.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:nn(t.count,n)})]}),(0,Y.jsx)(`p`,{className:o(`mt-1 line-clamp-1 text-[11px] leading-relaxed`,s.text),children:tn(t,i,n)})]})})}function Xt(e){let{scene:t,entries:n,isLoading:r,language:i,localeFallbacks:a,installState:s,onBack:c,onOpen:l,onInstall:u}=e,d=$t(t.scene),f=d.icon,p=Kt[d.tone];return(0,Y.jsxs)(`section`,{className:`flex min-h-full flex-col`,children:[(0,Y.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-start gap-2.5`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:c,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900`,"aria-label":X({zh:`返回`,en:`Back`},i),children:(0,Y.jsx)(ze,{className:`h-4 w-4`})}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:o(`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border`,p.icon),children:(0,Y.jsx)(f,{className:`h-4 w-4`})}),(0,Y.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[15px] font-semibold text-gray-950`,children:en(t,d,i)}),(0,Y.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:X(r?{zh:`加载中`,en:`Loading`}:{zh:`${n.length} 个技能`,en:`${n.length} skills`},i)})]}),(0,Y.jsx)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-2`,children:(0,Y.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[12px] leading-relaxed text-gray-500`,children:tn(t,d,i)})})]})]}),r?(0,Y.jsx)(`div`,{"data-testid":`marketplace-scene-skeleton`,className:o(qt,`min-h-0 flex-1 auto-rows-[166px] content-start`),children:(0,Y.jsx)(V,{count:24})}):n.length>0?(0,Y.jsx)(`div`,{className:qt,children:n.map(e=>(0,Y.jsx)(Rt,{entry:e,language:i,localeFallbacks:a,installState:s,layout:`grid`,onOpen:l,onInstall:u},e.item.id))}):(0,Y.jsx)(`div`,{className:`rounded-lg border border-dashed border-gray-200 py-8 text-center text-[12px] text-gray-500`,children:X({zh:`这个模块暂无技能。`,en:`No skills in this module yet.`},i)})]})}function Zt(e){let{icon:t,title:n,description:r,entries:i,language:a,localeFallbacks:o,isLoading:s,installState:c,onOpen:l,onInstall:u}=e;return(0,Y.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,Y.jsx)(Qt,{icon:t,title:n,description:r}),s?(0,Y.jsx)(`div`,{"data-testid":`marketplace-recent-skeleton`,className:`-mx-1 grid auto-rows-[166px] grid-cols-[repeat(4,260px)] gap-2.5 overflow-hidden px-1 pb-1.5`,children:(0,Y.jsx)(V,{count:4})}):(0,Y.jsx)(`div`,{className:`-mx-1 flex gap-2.5 overflow-x-auto px-1 pb-1.5 custom-scrollbar`,children:i.map(e=>(0,Y.jsx)(Rt,{entry:e,language:a,localeFallbacks:o,installState:c,onOpen:l,onInstall:u},e.item.id))})]})}function Qt({icon:e,title:t,description:n}){return(0,Y.jsx)(`div`,{className:`flex items-end justify-between gap-4`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`h3`,{className:`flex items-center gap-2 text-[14px] font-semibold text-gray-950`,children:[(0,Y.jsx)(e,{className:`h-4 w-4 text-primary`}),t]}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-[12px] leading-relaxed text-gray-500`,children:n})]})})}function X(e,t){return t.startsWith(`zh`)?e.zh:e.en}function $t(e){return Wt.find(t=>t.scene===e)??{scene:e,...Gt}}function en(e,t,n){return t.title?X(t.title,n):e.title}function tn(e,t,n){return t.summary?X(t.summary,n):e.description??e.scene}function nn(e,t){return t.startsWith(`zh`)?`${e} 个技能`:`${e} skills`}var rn=`https://skillhub.cn/`;function an(){return(0,Y.jsx)(Ke,{href:rn,external:!0,className:`h-7 shrink-0 px-1.5 text-[13px]`,children:a(`marketplaceExternalSkillSourceTitle`)})}function on(e){return(e??``).trim().toLowerCase()}function Z(e,t){let n=on(t);return n.length>0?`${e}:${n}`:``}function sn(e){let t=new Map;for(let n of e){let e=[n.install.spec,n.slug,n.id];for(let r of e){let e=Z(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function cn(e){let t=new Map;for(let n of e){let e=[n.spec,n.id,n.label];for(let r of e){let e=Z(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function ln(e,t){let n=[e.install.spec,e.slug,e.id];for(let r of n){let n=Z(e.type,r);if(!n)continue;let i=t.get(n);if(i)return i}}function un(e,t){return t.get(Z(e.type,e.spec))||t.get(Z(e.type,e.id))||t.get(Z(e.type,e.label))}function dn(e,t,n,r){let i=on(n);if(!i)return!0;let a=B(t?.summaryI18n,t?.summary,r);return[e.id,e.spec,e.label,t?.name,t?.slug,t?.summary,a,...t?.tags??[]].map(e=>on(e)).filter(Boolean).some(e=>e.includes(i))}function fn(e){let{items:t,recentItems:n,installedRecordLookup:r,scene:i,forcedType:a,typeFilter:o,scope:s,searchText:c,query:l,showListSkeleton:u,hasCatalogError:d}=e,f=St(o===`skill`),p=(0,q.useMemo)(()=>f.data?.scenes??[],[f.data?.scenes]),m=Ct(p,o===`skill`),h=(0,q.useMemo)(()=>p.map(e=>({...e,count:typeof e.count==`number`?e.count:m.get(e.scene)})),[m,p]),g=(0,q.useMemo)(()=>t.map(e=>({item:e,record:ln(e,r)})),[t,r]),_=(0,q.useMemo)(()=>n.map(e=>({item:e,record:ln(e,r)})),[r,n]),v=(0,q.useMemo)(()=>{let e=i?.trim();if(e)return h.find(t=>t.scene===e)??{scene:e,title:e}},[i,h]),y=o===`skill`&&!!i?.trim(),b=o===`skill`&&s===`all`&&!c.trim()&&!l&&!y,x=u||t.length>=4,S=b&&!d&&x&&h.length===0&&f.isLoading;return{entries:g,recentEntries:_,scenes:h,selectedScene:v,sceneEntries:g,isSceneRoute:y,isScenesLoading:S,showShelves:b&&!d&&x&&(u||h.length>0||S),backPath:a?`/skills`:`/marketplace/skills`,pathPrefix:a?`/skills/scenes`:`/marketplace/skills/scenes`}}function pn(){let e=Tt(),t=Et(),{confirm:n,ConfirmDialog:r}=We(),[i,o]=(0,q.useState)(new Set),[s,c]=(0,q.useState)(new Map);return{installState:{installingSpecs:i},manageState:{actionsByTarget:s},handleInstall:async t=>{let n=t.install.spec;if(!i.has(n)){o(e=>new Set(e).add(n));try{await e.mutateAsync({type:t.type,spec:n,kind:t.install.kind,skill:t.slug,installPath:`skills/${t.slug}`})}catch{}finally{o(e=>{let t=new Set(e);return t.delete(n),t})}}},handleManage:async(e,r)=>{let i=e===`update`?r.catalogSlug||r.id||r.spec:r.id||r.spec;if(!(!i||s.has(i))&&!(e===`uninstall`&&!await n({title:`${a(`marketplaceUninstallTitle`)} ${i}?`,description:a(`marketplaceUninstallDescription`),confirmLabel:a(`marketplaceUninstall`),variant:`destructive`}))){c(t=>new Map(t).set(i,e));try{await t.mutateAsync({type:r.type,action:e,id:i,spec:r.spec})}finally{c(e=>{let t=new Map(e);return t.delete(i),t})}}},ConfirmDialog:r}}function mn(e){let t=$e(),n=(0,q.useRef)({byKey:new Map,seq:0});return{openItemDetail:async(r,i)=>{let o=r?.name??i?.label??i?.id??i?.spec??a(`marketplaceUnknownItem`),s=Fe(r?`skill`:`skill-local`,r?.slug??i?.id??i?.spec??o),c=r?`marketplace:${r.type}:${r.slug}`:`marketplace:${i?.type??`unknown`}:${i?.id??i?.spec??o}`,l=a(`marketplaceTypeSkill`);if(!r){R(t,{id:s,title:o,typeLabel:l,spec:i?.spec??`-`,status:`ready`,summary:a(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify(i??{},null,2),contentRaw:`-`});return}let u=n.current.seq+1;n.current.seq=u,n.current.byKey.set(c,u);let d=B(r.summaryI18n,r.summary,e);R(t,{id:s,title:o,typeLabel:l,spec:r.install.spec,status:`loading`,summary:d,tags:r.tags,author:r.author});try{let e=await pe(r.slug);if(n.current.byKey.get(c)!==u)return;R(t,{id:s,title:o,typeLabel:l,spec:r.install.spec,status:`ready`,summary:d,metadataRaw:e.metadataRaw,contentRaw:e.bodyRaw||e.raw,sourceUrl:e.sourceUrl,sourceLabel:`Source (${e.source})`,tags:r.tags,author:r.author},{activate:!1})}catch(e){if(n.current.byKey.get(c)!==u)return;R(t,{id:s,title:o,typeLabel:l,spec:r.install.spec,status:`error`,summary:d,metadataRaw:JSON.stringify({error:e instanceof Error?e.message:String(e)},null,2),contentRaw:a(`marketplaceOperationFailed`)},{activate:!1})}}}}function hn(e){let{scope:t,typeFilter:n,query:r,localeFallbacks:i,catalogView:o,installedView:s,isCatalogLoading:c,isCatalogFetching:l,isCatalogFetchingNextPage:u,catalogError:d,isInstalledLoading:f,installedError:p}=e,m=(0,q.useMemo)(()=>s?.records??[],[s?.records]),h=(0,q.useMemo)(()=>o?.items??[],[o?.items]),g=(0,q.useMemo)(()=>sn(h),[h]),_=(0,q.useMemo)(()=>cn(m),[m]),v=(0,q.useMemo)(()=>m.filter(e=>e.type===n).map(e=>({key:`${e.type}:${e.spec}:${e.id??``}`,record:e,item:un(e,g)})).filter(e=>dn(e.record,e.item,r,i)).sort((e,t)=>gn(e.record,t.record)),[m,n,g,r,i]),y=(0,q.useMemo)(()=>t===`installed`?v:h.map(e=>({key:e.id,item:e,record:ln(e,_)})),[h,v,_,t]),b=t===`all`&&c&&!o||t===`installed`&&f&&!s,x=t===`all`&&!b&&!!o&&l&&!u,S=t===`installed`?f&&!s?a(`loading`):`${v.length} ${a(`marketplaceInstalledSkillsCountSuffix`)}`:o?`${o.total} ${a(`marketplaceSkillsCountSuffix`)}`:a(`loading`),C=t===`all`&&d?d:t===`installed`&&p?p:void 0,w={scope:t,entries:y,header:{title:a(t===`installed`?`marketplaceSectionInstalledSkills`:`marketplaceAllSkills`),summary:S,refreshingLabel:a(`marketplaceRefreshingResults`)},status:{showSkeleton:b,isRefreshing:x,error:C},emptyLabel:a(t===`installed`?`marketplaceNoInstalledSkills`:`marketplaceNoSkills`),errorLabel:a(t===`installed`?`marketplaceErrorLoadingInstalledSkills`:`marketplaceErrorLoadingSkillsData`)};return{allItems:h,installedRecordLookup:_,installedTotal:s?.total??0,itemListView:w,showListSkeleton:b,isRefreshingList:x}}function gn(e,t){let n=Date.parse(e.installedAt??``),r=Date.parse(t.installedAt??``);return Number.isNaN(n)||Number.isNaN(r)||n===r?e.spec.localeCompare(t.spec):r-n}var _n=20;function vn({forcedType:e}={}){let t=b(),n=p(),{language:r}=K(),i=`skill`,o=(0,q.useMemo)(()=>z(r),[r]),[s,c]=(0,q.useState)(``),[l,u]=(0,q.useState)(``),[d,f]=(0,q.useState)(`all`),[m,h]=(0,q.useState)(`relevance`),{installState:g,manageState:_,handleInstall:v,handleManage:y,ConfirmDialog:x}=pn(),{openItemDetail:S}=mn(o);(0,q.useEffect)(()=>{let e=setTimeout(()=>{u(s.trim())},250);return()=>clearTimeout(e)},[s]);let C=wt(i),w=i===`skill`?n.scene?.trim():void 0,T=yt({q:w?void 0:l||void 0,scene:w,type:i,sort:m,pageSize:_n}),ee=bt(i,d===`all`&&!s.trim()&&!l&&!w),{containerRef:E,sentinelRef:te}=Le({disabled:d!==`all`||T.isError||!T.hasNextPage||T.isFetchingNextPage,onLoadMore:()=>T.fetchNextPage(),watchValue:`${i}:${d}:${l}:${w??``}:${m}:${T.data?.loadedItems??0}:${T.data?.loadedPages??0}`});(0,q.useEffect)(()=>{let e=E.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[E,l,w,d,m,i]);let D=hn({scope:d,typeFilter:i,query:l,localeFallbacks:o,catalogView:T.data,installedView:C.data,isCatalogLoading:T.isLoading,isCatalogFetching:T.isFetching,isCatalogFetchingNextPage:T.isFetchingNextPage,catalogError:T.isError?T.error:void 0,isInstalledLoading:C.isLoading,installedError:C.isError?C.error:void 0}),O=fn({items:D.allItems,recentItems:ee.data?.items??[],installedRecordLookup:D.installedRecordLookup,scene:w,forcedType:e,typeFilter:i,scope:d,searchText:s,query:l,showListSkeleton:D.showListSkeleton,hasCatalogError:T.isError});return(0,Y.jsxs)(ae,{className:`flex h-full min-h-0 flex-col pb-0`,children:[!O.isSceneRoute&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3 border-b border-gray-200/60`,children:[(0,Y.jsx)(Ye,{value:d,onValueChange:e=>f(e),children:(0,Y.jsxs)(Je,{className:`mb-0 h-auto flex-1 justify-start gap-6 rounded-none border-b-0 bg-transparent p-0 text-gray-500`,children:[(0,Y.jsx)(qe,{value:`all`,className:`rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:a(`marketplaceTabMarketplaceSkills`)}),(0,Y.jsxs)(qe,{value:`installed`,className:`gap-1.5 rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:[a(`marketplaceTabInstalledSkills`),(0,Y.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:D.installedTotal})]})]})}),(0,Y.jsx)(an,{})]}),(0,Y.jsx)(Me,{scope:d,searchText:s,isRefreshing:D.isRefreshingList,searchPlaceholder:a(`marketplaceSearchPlaceholderSkills`),sort:m,onSearchTextChange:c,onSortChange:h})]}),(0,Y.jsx)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,Y.jsxs)(`div`,{ref:E,className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar pr-1`,"aria-busy":D.showListSkeleton||T.isFetchingNextPage,children:[O.isSceneRoute&&O.selectedScene&&(0,Y.jsx)(Xt,{scene:O.selectedScene,entries:O.sceneEntries,isLoading:D.showListSkeleton,language:r,localeFallbacks:o,installState:g,onBack:()=>t(O.backPath),onOpen:e=>void S(e.item,e.record),onInstall:v}),O.isSceneRoute&&!D.showListSkeleton&&(0,Y.jsx)(Ie,{hasMore:!!T.hasNextPage,loading:T.isFetchingNextPage,sentinelRef:te}),O.showShelves&&(0,Y.jsx)(Jt,{recentEntries:O.recentEntries,scenes:O.scenes,isScenesLoading:O.isScenesLoading,isItemsLoading:D.showListSkeleton||ee.isLoading,language:r,installState:g,onOpen:e=>void S(e.item,e.record),onInstall:v,onOpenScene:e=>t(`${O.pathPrefix}/${e}`)}),!O.isSceneRoute&&(0,Y.jsx)(Lt,{model:D.itemListView,showTitle:O.showShelves||!D.showListSkeleton,operationState:{installState:g,manageState:_},scroll:{hasMore:!!T.hasNextPage,loadingMore:T.isFetchingNextPage,sentinelRef:te},actions:{onOpen:(e,t)=>void S(e,t),onInstall:v,onManage:y}})]})}),(0,Y.jsx)(x,{})]})}var yn=`NextClaw`,bn=[{prefix:`/marketplace/mcp`,key:`marketplaceMcpPageTitle`},{prefix:`/marketplace/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/marketplace`,key:`marketplace`},{prefix:`/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/cron`,key:`cronPageTitle`},{prefix:`/agents`,key:`agentsPageTitle`},{prefix:`/chat`,key:`chat`},{prefix:`/model`,key:`modelPageTitle`},{prefix:`/search`,key:`searchPageTitle`},{prefix:`/providers`,key:`providersPageTitle`},{prefix:`/channels`,key:`channelsPageTitle`},{prefix:`/runtime`,key:`runtimePageTitle`},{prefix:`/updates`,key:`runtimeUpdatesPageTitle`},{prefix:`/remote`,key:`remotePageTitle`},{prefix:`/security`,key:`authSecurityTitle`},{prefix:`/secrets`,key:`secretsPageTitle`}];function xn(e,t){return e===t||e.startsWith(`${t}/`)}function Sn(e){let t=e.toLowerCase();for(let{prefix:e,key:n}of bn)if(xn(t,e))return a(n);return a(`settings`)}function Cn(e){let t=e.toLowerCase();return t===`localhost`||t.endsWith(`.localhost`)||t===`::1`||t===`[::1]`||t.startsWith(`127.`)}function wn(e){let t=e?.host.trim(),n=e?.hostname.trim(),r=e?.port.trim();return!t||!n?null:Cn(n)?r||null:t}function Tn(e,t){let n=wn(t);return`${yn}${n?` ${n}`:``} - ${Sn(e)}`}var En={...u,...Re};function Dn({children:e,sideDockManager:t}){let{isOpen:n,mode:r}=$e();Ve();let{pathname:i}=x(),{language:a}=K(),{isMobile:o}=Xe(),s=C(),c=m(e=>e.isVisible);m(e=>e.pinnedItems);let l={getDockState:t.getDockState,pinTab:t.pinTab,unpinTab:t.unpinTab};return(0,q.useEffect)(()=>{document.title=Tn(i,window.location)},[i,a]),o&&s!==`win32`?(0,Y.jsx)(ee,{pathname:i,isDocBrowserOpen:n,docBrowserDockControls:l,docBrowserRenderers:En,topbarLeadingInset:s===`darwin`?`4.75rem`:void 0,children:e}):(0,Y.jsx)(ne,{pathname:i,isMobileLayout:o,isDocBrowserOpen:n,docBrowserMode:r,docBrowserDockControls:l,docBrowserRenderers:En,sideDock:c?(0,Y.jsx)(S,{manager:t}):null,children:e})}function On({children:e}){let t=te();return(0,Y.jsx)(et,{manager:t.docBrowserManager,children:(0,Y.jsx)(Dn,{sideDockManager:t.sideDockManager,children:e})})}function kn(){let{isMobile:e}=Xe();return e?(0,Y.jsx)(v,{}):(0,Y.jsx)(y,{to:`/model`,replace:!0})}function An(e){let t=e.trim().toLowerCase();return t?!t.startsWith(`skills`):!0}function jn(e,t){t.startsWith(`mcp`)&&(e?.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}))}function Mn(e,t){e&&An(t)&&e.invalidateQueries({queryKey:[`config`]}),jn(e,t)}function Nn(e){let t=(0,q.useRef)(!1);(0,q.useEffect)(()=>{let n=F.eventBus.on(j.connectionOpen,()=>{A.handleConnectionRestored(),k.refreshAfterRealtimeReconnect(),t.current&&(t.current=!1,e?.invalidateQueries({queryKey:[`ncp-sessions`]}))}),r=F.eventBus.on(j.connectionClose,()=>{A.handleConnectionInterrupted(null),t.current=!0}),i=F.eventBus.on(j.connectionError,e=>{A.handleConnectionInterrupted(e?.message??null),t.current=!0}),a=F.eventBus.on(j.configUpdated,({path:t})=>{Mn(e,t)}),o=F.eventBus.on(j.runtimeUpdateSnapshot,e=>{k.reportSnapshot(e)}),s=F.eventBus.on(j.sessionRunStatus,t=>{N(e,{type:`session.run-status`,payload:t})}),c=F.eventBus.on(j.sessionSummaryUpsert,t=>{N(e,{type:`session.summary.upsert`,payload:t})}),l=F.eventBus.on(j.sessionSummaryDelete,t=>{N(e,{type:`session.summary.delete`,payload:t})}),u=F.eventBus.on(j.error,e=>{console.error(`Realtime transport error:`,e.message)});return()=>{n(),r(),i(),a(),o(),s(),c(),l(),u()}},[e])}var Pn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{ModelConfigPage:e}=await import(`./model-config-page-D6ex3_NM.js`);return{ModelConfigPage:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]))).ModelConfigPage})),Fn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{AppearanceSettingsPage:e}=await import(`./appearance-settings-page-yJR6Kt9c.js`);return{AppearanceSettingsPage:e}},__vite__mapDeps([19,1,20,21,5,3,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35]))).AppearanceSettingsPage})),Q=(0,q.lazy)(async()=>({default:(await s(async()=>{let{ChatPage:e}=await import(`./chat-page-CXYXMIQQ.js`);return{ChatPage:e}},__vite__mapDeps([36,1,5,3,20,21,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35,6,37,38,17]))).ChatPage})),In=(0,q.lazy)(async()=>({default:(await s(async()=>{let{SearchConfigPage:e}=await import(`./search-config-page-n1GElgij.js`);return{SearchConfigPage:e}},__vite__mapDeps([39,1,7,5,3,2,25,10,11,32,14,40,15,17]))).SearchConfigPage})),Ln=(0,q.lazy)(async()=>({default:(await s(async()=>{let{ProvidersConfigPage:e}=await import(`./providers-config-page-BwHtHIPe.js`);return{ProvidersConfigPage:e}},__vite__mapDeps([41,1,5,3,7,22,8,2,23,25,30,32,14,26,37,33,34,40,15,17,18,11,9]))).ProvidersConfigPage})),Rn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{ChannelsList:e}=await import(`./channels-list-page-CAWuTHSM.js`);return{ChannelsList:e}},__vite__mapDeps([42,1,5,3,7,2,25,4,10,11,31,32,14,12,23,34,40,38,15,17,18]))).ChannelsList})),zn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{RuntimeConfig:e}=await import(`./runtime-config-page-CMLVC5UV.js`);return{RuntimeConfig:e}},__vite__mapDeps([43,1,20,21,5,3,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35,44,45,15,17]))).RuntimeConfig})),Bn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{DesktopUpdateConfig:e}=await import(`./desktop-update-config-D5NIaimo.js`);return{DesktopUpdateConfig:e}},__vite__mapDeps([46,7,1,5,3,2,29,10,11,27,44]))).DesktopUpdateConfig})),Vn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{SecurityConfig:e}=await import(`./security-config-n2WHhHXV.js`);return{SecurityConfig:e}},__vite__mapDeps([47,2,1,3]))).SecurityConfig})),Hn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{SecretsConfigPage:e}=await import(`./secrets-config-page-DbUc3Ggi.js`);return{SecretsConfigPage:e}},__vite__mapDeps([48,1,7,5,3,2,26,45,33,15,17]))).SecretsConfigPage})),Un=(0,q.lazy)(async()=>({default:(await s(async()=>{let{RemoteAccessPage:e}=await import(`./remote-CPpTKDgX.js`);return{RemoteAccessPage:e}},__vite__mapDeps([49,20,1,21,5,3,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35]))).RemoteAccessPage})),Wn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{McpMarketplacePage:e}=await import(`./mcp-marketplace-page-BZa7p7Qf.js`);return{McpMarketplacePage:e}},__vite__mapDeps([50,51,1,5,3,7,22,8,2,23,28,24,25,10,11,26,27,13,14,12,38,16]))).McpMarketplacePage}));function Gn(){return(0,Y.jsx)(`div`,{className:`h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40`})}function Kn({children:e}){return(0,Y.jsx)(q.Suspense,{fallback:(0,Y.jsx)(Gn,{}),children:e})}function $(e){return(0,Y.jsx)(Kn,{children:e})}var qn=[{path:`/chat/skills`,redirectTo:`/skills`},{path:`/chat/cron`,redirectTo:`/cron`},{path:`/chat/agents`,redirectTo:`/agents`},{path:`/chat/:sessionId?`,element:$((0,Y.jsx)(Q,{view:`chat`}))},{path:`/agents`,element:$((0,Y.jsx)(Q,{view:`agents`}))},{path:`/skills`,element:$((0,Y.jsx)(Q,{view:`skills`}))},{path:`/skills/scenes/:scene`,element:$((0,Y.jsx)(Q,{view:`skills`}))},{path:`/cron`,element:$((0,Y.jsx)(Q,{view:`cron`}))},{path:`/appearance`,element:$((0,Y.jsx)(Fn,{}))},{path:`/model`,element:$((0,Y.jsx)(Pn,{}))},{path:`/search`,element:$((0,Y.jsx)(In,{}))},{path:`/providers`,element:$((0,Y.jsx)(Ln,{}))},{path:`/channels`,element:$((0,Y.jsx)(Rn,{}))},{path:`/runtime`,element:$((0,Y.jsx)(zn,{}))},{path:`/updates`,element:$((0,Y.jsx)(Bn,{}))},{path:`/remote`,element:$((0,Y.jsx)(Un,{}))},{path:`/security`,element:$((0,Y.jsx)(Vn,{}))},{path:`/secrets`,element:$((0,Y.jsx)(Hn,{}))},{path:`/settings`,element:(0,Y.jsx)(kn,{})},{path:`/marketplace/skills`,redirectTo:`/skills`},{path:`/marketplace`,redirectTo:`/skills`},{path:`/marketplace/mcp`,element:$((0,Y.jsx)(Wn,{}))},{path:`/`,redirectTo:`/chat`},{path:`*`,redirectTo:`/chat`}];function Jn(e){return`redirectTo`in e?(0,Y.jsx)(E,{path:e.path,element:(0,Y.jsx)(y,{to:e.redirectTo,replace:!0})},e.path):(0,Y.jsx)(E,{path:e.path,element:e.element},e.path)}function Yn(){return(0,Y.jsx)(w,{children:qn.map(Jn)})}function Xn(){return Nn(we),ue(),(0,q.useEffect)(()=>(k.start(),()=>{k.stop()}),[]),(0,Y.jsxs)(O,{children:[(0,Y.jsx)(On,{children:(0,Y.jsx)(Yn,{})}),(0,Y.jsx)(d,{}),(0,Y.jsx)(l,{})]})}function Zn(){let e=me(),t=e.isError&&Ae(e.error);return e.isLoading&&!e.isError||t||e.isError?(0,Y.jsx)(Xn,{}):e.data?.enabled&&!e.data.authenticated?(0,Y.jsx)(c,{username:e.data.username}):(0,Y.jsx)(Xn,{})}function Qn(){return(0,q.useEffect)(()=>{ie()},[]),(0,Y.jsxs)(ke,{client:we,children:[(0,Y.jsx)(Zn,{}),(0,Y.jsx)(g,{}),(0,Y.jsx)(ve,{position:`top-right`,richColors:!0,offset:window.nextclawDesktop?.platform===`win32`?56:void 0,mobileOffset:window.nextclawDesktop?.platform===`win32`?56:void 0})]})}var $n=window.nextclawDesktop?.platform===`win32`?_:re;(0,ft.createRoot)(document.getElementById(`root`)).render((0,Y.jsx)(q.StrictMode,{children:(0,Y.jsx)(f,{children:(0,Y.jsx)(He,{children:(0,Y.jsx)($n,{children:(0,Y.jsx)(Qn,{})})})})}));export{vn as t};