@nextclaw/ui 0.14.2 → 0.14.3

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 (129) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/assets/{api-a14tR_z1.js → api-BP_8IaxB.js} +3 -3
  3. package/dist/assets/{channels-list-page-CFGkm4DT.js → channels-list-page-DEh5Jjqx.js} +1 -1
  4. package/dist/assets/chat-page-BRB0N5WW.js +105 -0
  5. package/dist/assets/config-split-page-CRhlZ_pH.js +1 -0
  6. package/dist/assets/{confirm-dialog-ClH_Ec7n.js → confirm-dialog-DsivFJ4r.js} +2 -2
  7. package/dist/assets/{desktop-update-config-DPNDnVpk.js → desktop-update-config-B0w9p2ep.js} +1 -1
  8. package/dist/assets/{dist-BtCS2Ucq.js → dist-CikkhOlq.js} +1 -1
  9. package/dist/assets/{dist-CLGGLm8b.js → dist-PVA_xL1D.js} +1 -1
  10. package/dist/assets/doc-browser-BoNJ7-tE.js +1 -0
  11. package/dist/assets/doc-browser-CdJ_d4ik.js +1 -0
  12. package/dist/assets/{doc-browser-context-D4JwMMxK.js → doc-browser-context-MTw4EvKd.js} +1 -1
  13. package/dist/assets/{ellipsis-CtJXjIol.js → ellipsis-y6vDtq4M.js} +1 -1
  14. package/dist/assets/{external-link-CdJiG13p.js → external-link-DVJIQf_G.js} +1 -1
  15. package/dist/assets/index-BiE-K8-q.css +1 -0
  16. package/dist/assets/index-D9BAE_L_.js +105 -0
  17. package/dist/assets/{mcp-marketplace-page-BU0kIjhR.js → mcp-marketplace-page-B1SZNY5m.js} +1 -1
  18. package/dist/assets/mcp-marketplace-page-Cq_Tw42T.js +1 -0
  19. package/dist/assets/{model-config-page-D6hYXROd.js → model-config-page-DotaTUHb.js} +1 -1
  20. package/dist/assets/plus-BbZqquJe.js +1 -0
  21. package/dist/assets/{provider-scoped-model-input-DAX2HgmR.js → provider-scoped-model-input-DsFRuWJH.js} +1 -1
  22. package/dist/assets/providers-config-page-DW4tQSLN.js +1 -0
  23. package/dist/assets/{react-C6cZgP44.js → react-VNqT5Zp7.js} +1 -1
  24. package/dist/assets/remote-B8TiUfwW.js +1 -0
  25. package/dist/assets/rotate-cw-DjHDTkCv.js +1 -0
  26. package/dist/assets/{runtime-config-page-C5xKaV3i.js → runtime-config-page-S6ErRHR8.js} +1 -1
  27. package/dist/assets/{save-DKA0x4zk.js → save-BOJ477H-.js} +1 -1
  28. package/dist/assets/{search-BNlcoj5c.js → search-BEti5beA.js} +1 -1
  29. package/dist/assets/{search-config-page-Cq9uJ-N8.js → search-config-page-DGj5am03.js} +1 -1
  30. package/dist/assets/{secrets-config-page-CxSbZLBo.js → secrets-config-page--IzrIOid.js} +1 -1
  31. package/dist/assets/{select-CvTlDZTQ.js → select-hoj8dK4K.js} +2 -2
  32. package/dist/assets/{tag-chip-8ffF2y2C.js → tag-chip-T8-h-die.js} +1 -1
  33. package/dist/assets/{use-config-DmT0o1gv.js → use-config-CjRV2hwL.js} +1 -1
  34. package/dist/assets/x-D9PXs_xP.js +1 -0
  35. package/dist/index.html +69 -19
  36. package/index.html +55 -5
  37. package/package.json +7 -7
  38. package/src/app/components/layout/__tests__/sidebar.layout.test.tsx +3 -3
  39. package/src/app/components/layout/header.tsx +3 -3
  40. package/src/app/components/layout/page-layout.tsx +2 -2
  41. package/src/app/components/layout/runtime-status-entry.tsx +7 -7
  42. package/src/app/components/layout/sidebar-items.tsx +10 -10
  43. package/src/app/components/layout/sidebar-rail.styles.ts +2 -2
  44. package/src/app/components/layout/sidebar.tsx +6 -6
  45. package/src/app/styles/design-system.css +388 -26
  46. package/src/app/test/vitest-setup.ts +31 -0
  47. package/src/features/chat/components/chat-sidebar-list-mode-switch.tsx +3 -3
  48. package/src/features/chat/components/conversation/__tests__/chat-conversation-header.test.tsx +4 -2
  49. package/src/features/chat/components/conversation/chat-conversation-header-section.tsx +1 -1
  50. package/src/features/chat/components/conversation/chat-conversation-header.tsx +7 -6
  51. package/src/features/chat/components/conversation/chat-conversation-panel.tsx +1 -1
  52. package/src/features/chat/components/conversation/chat-conversation-skeleton.tsx +13 -13
  53. package/src/features/chat/components/layout/__tests__/chat-sidebar.test.tsx +2 -2
  54. package/src/features/chat/components/layout/chat-page-shell.tsx +1 -1
  55. package/src/features/chat/components/layout/chat-sidebar-desktop-layout.tsx +3 -3
  56. package/src/features/chat/components/layout/chat-sidebar-toolbar.tsx +14 -14
  57. package/src/features/chat/components/layout/chat-sidebar-utility-menu.tsx +15 -15
  58. package/src/features/chat/components/layout/chat-sidebar.tsx +3 -3
  59. package/src/features/chat/features/conversation/components/__tests__/session-conversation-area.test.tsx +225 -0
  60. package/src/features/chat/features/conversation/components/__tests__/session-conversation-input.streaming.test.tsx +199 -0
  61. package/src/features/chat/features/conversation/components/session-conversation-area.tsx +28 -9
  62. package/src/features/chat/features/conversation/components/session-conversation-input.tsx +18 -6
  63. package/src/features/chat/features/conversation/hooks/use-session-conversation-controller.ts +3 -13
  64. package/src/features/chat/features/conversation/hooks/use-session-conversation-input-query.ts +19 -3
  65. package/src/features/chat/features/message/components/chat-inline-panel-app-card.tsx +7 -7
  66. package/src/features/chat/features/message/components/chat-message-list.container.tsx +6 -6
  67. package/src/features/chat/features/session/components/chat-sidebar-project-groups.tsx +5 -5
  68. package/src/features/chat/features/session/components/chat-sidebar-session-list.tsx +4 -4
  69. package/src/features/chat/features/session/components/session-context-icon.tsx +2 -2
  70. package/src/features/chat/features/session/components/session-header/__tests__/chat-session-project-badge.test.tsx +2 -2
  71. package/src/features/chat/features/session/components/session-header/chat-session-header-actions.tsx +1 -1
  72. package/src/features/chat/features/session/components/session-header/chat-session-header-menu-item.tsx +1 -1
  73. package/src/features/chat/features/session/components/session-header/chat-session-metadata-dialog.tsx +1 -1
  74. package/src/features/chat/features/session/components/session-header/chat-session-project-badge.tsx +3 -3
  75. package/src/features/chat/features/session/components/session-run-badge.tsx +1 -1
  76. package/src/features/chat/features/session-type/hooks/use-chat-session-type-state.ts +10 -2
  77. package/src/features/chat/features/welcome/components/__tests__/chat-welcome.test.tsx +0 -7
  78. package/src/features/chat/features/welcome/components/chat-welcome-agent-picker.tsx +3 -3
  79. package/src/features/chat/features/welcome/components/chat-welcome-capability-grid.tsx +4 -4
  80. package/src/features/chat/features/welcome/components/chat-welcome-project-picker.tsx +14 -19
  81. package/src/features/chat/features/welcome/components/chat-welcome-session-type-picker.tsx +3 -3
  82. package/src/features/chat/features/welcome/components/chat-welcome.tsx +4 -4
  83. package/src/features/chat/features/welcome/utils/__tests__/chat-welcome-project-options.utils.test.ts +6 -8
  84. package/src/features/chat/features/welcome/utils/chat-welcome-project-options.utils.ts +1 -16
  85. package/src/features/panel-apps/components/panel-app-list-item.tsx +8 -8
  86. package/src/features/panel-apps/components/panel-app-toolbar.tsx +4 -4
  87. package/src/features/panel-apps/components/panel-apps-list.tsx +20 -20
  88. package/src/features/pwa/managers/__tests__/pwa-shell-theme.manager.test.ts +70 -6
  89. package/src/features/pwa/managers/pwa-shell-theme.manager.ts +10 -5
  90. package/src/features/service-apps/components/service-action-authorization-dialog.tsx +8 -8
  91. package/src/features/service-apps/components/service-apps-panel.tsx +24 -24
  92. package/src/features/settings/components/config/provider-advanced-settings-section.tsx +5 -5
  93. package/src/features/settings/components/config/provider-auth-section.tsx +7 -7
  94. package/src/features/settings/components/config/provider-form.tsx +10 -10
  95. package/src/features/settings/components/config/provider-models-section.tsx +16 -16
  96. package/src/features/settings/components/config/provider-pill-selector.tsx +1 -1
  97. package/src/features/settings/pages/providers-config-page.tsx +17 -17
  98. package/src/shared/components/config-split-page.tsx +11 -11
  99. package/src/shared/components/doc-browser/doc-browser-home-page.tsx +2 -2
  100. package/src/shared/components/doc-browser/doc-browser-panel-parts.tsx +4 -4
  101. package/src/shared/components/doc-browser/doc-browser-tab-strip.tsx +4 -4
  102. package/src/shared/components/doc-browser/doc-browser.tsx +3 -3
  103. package/src/shared/components/resizable-right-panel/resizable-right-panel.tsx +1 -1
  104. package/src/shared/components/ui/actions/icon-action-button.tsx +1 -1
  105. package/src/shared/components/ui/button.tsx +4 -4
  106. package/src/shared/components/ui/card.tsx +4 -4
  107. package/src/shared/components/ui/dialog.tsx +5 -5
  108. package/src/shared/components/ui/input.tsx +1 -1
  109. package/src/shared/components/ui/label.tsx +1 -1
  110. package/src/shared/components/ui/popover.tsx +1 -1
  111. package/src/shared/components/ui/select.tsx +3 -3
  112. package/src/shared/components/ui/switch.tsx +3 -3
  113. package/src/shared/components/ui/tabs.tsx +4 -4
  114. package/src/shared/components/ui/textarea.tsx +1 -1
  115. package/src/shared/lib/i18n/locales/en-US/core.json +7 -2
  116. package/src/shared/lib/i18n/locales/zh-CN/core.json +7 -2
  117. package/src/shared/lib/theme/index.ts +94 -52
  118. package/dist/assets/chat-page-CEdavJXc.js +0 -105
  119. package/dist/assets/config-split-page-B5b9B0uE.js +0 -1
  120. package/dist/assets/doc-browser-5nMWYKBD.js +0 -1
  121. package/dist/assets/doc-browser-BJRLhztv.js +0 -1
  122. package/dist/assets/index-BDN1zzMQ.js +0 -105
  123. package/dist/assets/index-g3uSZXoc.css +0 -1
  124. package/dist/assets/mcp-marketplace-page-sMNFSq_T.js +0 -1
  125. package/dist/assets/plus-DPjb0piO.js +0 -1
  126. package/dist/assets/providers-config-page-BzAeaACA.js +0 -1
  127. package/dist/assets/remote-B0G80uPr.js +0 -1
  128. package/dist/assets/rotate-cw-DnEB1Rju.js +0 -1
  129. package/dist/assets/x-BiSSpgqB.js +0 -1
@@ -1,105 +0,0 @@
1
- import{h as e,p as t,r as n,u as r,v as i}from"./react-C6cZgP44.js";import{$t as a,A as o,Bt as s,Gt as c,Kt as l,M as u,Mt as d,N as f,Nt as p,P as m,Qt as h,Rt as g,Vt as _,Xt as v,Yt as y,Zt as b,cn as x,dn as S,dt as C,en as w,fn as T,in as E,j as D,jt as O,k as ee,ln as k,nn as te,pn as ne,qt as re,tn as ie,un as ae}from"./api-a14tR_z1.js";import{a as oe,c as se,i as A,l as ce,n as le,o as ue,r as j,s as M}from"./mcp-marketplace-page-BU0kIjhR.js";import{c as N}from"./dist-CLGGLm8b.js";import{a as de,i as fe,n as pe,r as me,t as he}from"./select-CvTlDZTQ.js";import{a as ge,i as _e,n as ve,o as ye,r as be,s as xe}from"./confirm-dialog-ClH_Ec7n.js";import{n as Se}from"./search-BNlcoj5c.js";import{a as P,c as F,o as I,s as Ce}from"./doc-browser-BJRLhztv.js";import{t as we}from"./provider-scoped-model-input-DAX2HgmR.js";import{t as Te}from"./ellipsis-CtJXjIol.js";import{t as Ee}from"./external-link-CdJiG13p.js";import{t as De}from"./plus-DPjb0piO.js";import{n as Oe}from"./doc-browser-context-D4JwMMxK.js";import{A as ke,At as Ae,B as je,C as Me,Ct as Ne,E as Pe,Et as Fe,F as L,G as Ie,H as Le,I as Re,L as ze,M as Be,N as R,O as Ve,Ot as He,P as Ue,T as We,Tt as z,V as B,W as Ge,a as Ke,b as qe,d as Je,ft as Ye,gt as Xe,i as Ze,j as Qe,k as $e,kt as V,lt as H,mt as et,n as tt,o as nt,ot as rt,p as it,q as at,r as ot,st,t as ct,u as lt,ut,w as dt,wt as ft,x as pt,yt as mt}from"./index-BDN1zzMQ.js";import{l as ht,t as gt,u as _t}from"./use-config-DmT0o1gv.js";import{t as vt}from"./tag-chip-8ffF2y2C.js";function yt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function bt(e,t,n){let r=e.slice(0);return r[t]=n,r}var xt=class extends ne{#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,k.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||!T(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(yt(e,n).forEach(e=>{e.destroy()}),yt(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=S(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 x(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=bt(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)&&k.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},U=i(e(),1);function St({queries:e,...t},n){let r=E(n),i=te(),o=ie(),s=U.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);s.forEach(e=>{y(e),h(e,o,r.getQueryCache().get(e.queryHash))}),w(o);let[c]=U.useState(()=>new xt(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&t.subscribed!==!1;U.useSyncExternalStore(U.useCallback(e=>f?c.subscribe(k.batchCalls(e)):ae,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),U.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>b(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&b(n,e)?v(n,new x(r,n),o):[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=s[t];return n&&a({result:e,errorResetBoundary:o,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m?.error)throw m.error;return u(d())}var Ct=N(`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`}]]),wt=N(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),Tt=N(`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`}]]),Et=N(`Earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Dt=N(`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`}]]),Ot=N(`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`}]]),kt=N(`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`}]]),W=t(),At=U.forwardRef(({className:e,...t},n)=>(0,W.jsx)(`textarea`,{className:r(`flex min-h-28 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2.5 text-sm text-gray-900 placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e),ref:n,...t}));At.displayName=`Textarea`;function jt(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``}}function Mt(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=R(r);return t.some(e=>e.value===i)?t:[...t,{value:i,label:L(i),icon:null,ready:!1,reason:`unavailable`,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}].sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))}function Nt({value:e,disabled:t=!1,runtimeOptions:r,defaultRuntime:i,onChange:a}){let o=e.trim()?R(e):``,s=Mt({runtimeOptions:r,currentRuntime:e}),c=s.find(e=>e.value===o)??null,l=c?.reasonMessage?.trim()||(c?.ready===!1?n(`agentsRuntimeUnavailableHelp`):``);return(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsxs)(he,{value:o||i,onValueChange:e=>a(e===i?``:e),disabled:t,children:[(0,W.jsx)(fe,{"aria-label":n(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,W.jsx)(de,{placeholder:n(`agentsRuntimeSelectPlaceholder`)})}),(0,W.jsx)(pe,{className:`rounded-xl`,children:s.map(e=>(0,W.jsx)(me,{value:e.value,disabled:e.ready===!1&&e.value!==o,className:`rounded-lg`,children:e.label},e.value))})]}),l?(0,W.jsx)(`p`,{className:`text-xs text-gray-500`,children:l}):null]})}function Pt({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,W.jsx)(ve,{open:e!==null,onOpenChange:a,children:e?(0,W.jsx)(Ft,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function Ft(e){let{agent:t,pending:r,providerCatalog:i,runtimeOptions:a,defaultRuntime:o,onOpenChange:c,onSubmit:l}=e,[u,d]=(0,U.useState)(jt(t));return(0,W.jsxs)(be,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-[linear-gradient(180deg,#fff9f1_0%,#ffffff_24%)] p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,W.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,W.jsxs)(ye,{className:`text-left`,children:[(0,W.jsx)(xe,{children:n(`agentsEditDialogTitle`)}),(0,W.jsx)(_e,{children:n(`agentsEditDialogDescription`)})]})}),(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,W.jsxs)(`div`,{className:`space-y-4`,children:[(0,W.jsx)(rt,{tone:`warning`,title:n(`agentsEditHomeReadonly`),description:n(`agentsEditHomeReadonlyHint`),children:(0,W.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:t.workspace??`-`})}),(0,W.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,W.jsx)(s,{value:u.displayName,onChange:e=>d(t=>({...t,displayName:e.target.value})),placeholder:n(`agentsFormNamePlaceholder`)}),(0,W.jsx)(At,{value:u.description,onChange:e=>d(t=>({...t,description:e.target.value})),placeholder:n(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,W.jsx)(s,{value:u.avatar,onChange:e=>d(t=>({...t,avatar:e.target.value})),placeholder:n(`agentsFormAvatarPlaceholder`)}),(0,W.jsx)(we,{value:u.model,onChange:e=>d(t=>({...t,model:e})),providerCatalog:i,disabled:r,className:`md:col-span-2`}),(0,W.jsx)(Nt,{value:u.runtime,onChange:e=>d(t=>({...t,runtime:e})),runtimeOptions:a,defaultRuntime:o,disabled:r})]})]})}),(0,W.jsxs)(ge,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,W.jsx)(_,{type:`button`,variant:`ghost`,onClick:()=>c(!1),disabled:r,children:n(`cancel`)}),(0,W.jsxs)(_,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>l(t.id,u),disabled:r,children:[(0,W.jsx)(et,{className:`mr-2 h-4 w-4`}),n(`agentsEditSaveAction`)]})]})]})}var It=`请直接创建一个默认示例 Agent,不要问我问题。创建完成后,简单告诉我它能做什么。`;function Lt(e){let{agentCount:t,onCreate:r}=e;return(0,W.jsxs)(`section`,{className:`flex flex-col gap-3 border-b border-gray-200 pb-4 sm:flex-row sm:items-end sm:justify-between`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`h1`,{className:`text-xl font-semibold text-gray-950`,children:n(`agentsHeroEyebrow`)}),(0,W.jsx)(`span`,{className:`rounded-full border border-gray-200 bg-white px-2 py-0.5 text-xs font-medium text-gray-500`,children:t})]}),(0,W.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-gray-500`,children:n(`agentsHeroDescription`)})]}),(0,W.jsxs)(_,{type:`button`,variant:`primary`,className:`h-9 shrink-0 rounded-xl px-4 text-sm font-semibold`,onClick:r,children:[(0,W.jsx)(De,{className:`mr-2 h-4 w-4`}),n(`agentsCreateButton`)]})]})}function Rt(e){let{icon:t,label:n,disabled:i=!1,destructive:a=!1,onClick:o}=e;return(0,W.jsxs)(`button`,{type:`button`,className:r(`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,a?`text-destructive hover:bg-destructive/10`:`text-gray-700 hover:bg-gray-100`),onClick:o,disabled:i,children:[(0,W.jsx)(t,{className:`h-4 w-4 shrink-0`}),(0,W.jsx)(`span`,{children:n})]})}function zt(e){let{agent:t,runtimeOptions:r,defaultRuntimeLabel:i,updatePending:a,deletePending:o,onStartChat:s,onEdit:c,onDelete:l}=e,u=t.runtime?.trim()||t.engine?.trim()||``,f=u?r.find(e=>e.value===R(u))?.label??L(u):i;return(0,W.jsx)(d,{className:`group overflow-hidden border border-gray-200 bg-white shadow-none transition-colors duration-200 hover:border-gray-300`,children:(0,W.jsxs)(p,{className:`relative flex h-full flex-col gap-3 px-3.5 py-3.5`,children:[(0,W.jsxs)(`div`,{className:`flex items-start gap-2.5 pr-16`,children:[(0,W.jsx)(Qe,{agentId:t.id,displayName:t.displayName,avatarUrl:t.avatarUrl,className:`h-9 w-9 shrink-0`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(`div`,{className:`truncate text-sm font-semibold text-gray-950`,children:t.displayName?.trim()||t.id}),t.builtIn?(0,W.jsxs)(vt,{tone:`warning`,className:`h-5 gap-1 border-amber-200 bg-amber-50 px-1.5 text-[10px] text-amber-700`,children:[(0,W.jsx)(ut,{className:`h-3 w-3`}),n(`agentsCardBuiltInTag`)]}):null]}),(0,W.jsxs)(`div`,{className:`truncate text-xs text-gray-400`,children:[`@`,t.id]})]})]}),(0,W.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 flex items-center gap-1 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,children:[(0,W.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-gray-400 hover:text-gray-800`,"aria-label":n(`agentsCardStartChat`),title:n(`agentsCardStartChat`),onClick:s,children:(0,W.jsx)(Xe,{className:`h-4 w-4`})}),(0,W.jsxs)(Le,{children:[(0,W.jsx)(Ie,{asChild:!0,children:(0,W.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-gray-400 hover:text-gray-800`,"aria-label":n(`chatSessionMoreActions`),title:n(`chatSessionMoreActions`),children:(0,W.jsx)(Te,{className:`h-4 w-4`})})}),(0,W.jsxs)(Ge,{align:`end`,className:`w-44 p-1.5`,children:[(0,W.jsx)(Rt,{icon:et,label:n(`agentsEditAction`),onClick:c,disabled:a}),t.builtIn?null:(0,W.jsx)(Rt,{icon:st,label:n(`agentsRemoveAction`),onClick:l,disabled:o,destructive:!0})]})]})]}),(0,W.jsx)(`p`,{className:`line-clamp-2 min-h-10 text-sm leading-5 text-gray-600`,children:t.description?.trim()||(t.builtIn?n(`agentsCardBuiltInSummary`):n(`agentsCardCustomSummary`))}),(0,W.jsxs)(`div`,{className:`mt-auto grid gap-2 border-t border-gray-100 pt-2 text-xs text-gray-500`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(H,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,W.jsx)(`span`,{className:`truncate`,children:f})]}),(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(mt,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,W.jsx)(`span`,{className:`truncate`,children:t.workspace??`-`})]})]})]})})}function Bt(){let e=B(),t=ct(),r=V(),i=Ve(),a=gt(),o=_t(),s=ht(),c=tt(),l=ke(),u=$e(),[f,m]=(0,U.useState)(null),h=(0,U.useMemo)(()=>i.data?.agents??[],[i.data?.agents]),v=(0,U.useMemo)(()=>[...h].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[h]),y=(0,U.useMemo)(()=>it({config:a.data,providersView:o.data,templatesView:s.data,onlyConfigured:!0}),[a.data,o.data,s.data]),b=(0,U.useMemo)(()=>Be(c.data?.options??[]),[c.data?.options]),x=(0,U.useMemo)(()=>R(c.data?.defaultType??`native`),[c.data?.defaultType]),S=(0,U.useMemo)(()=>b.find(e=>e.value===x)?.label??L(x),[x,b]),C=e=>{m(e)},w=async(e,t)=>{await l.mutateAsync({agentId:e,data:{displayName:t.displayName,description:t.description,avatar:t.avatar,model:t.model,...t.runtime.trim()?{runtime:t.runtime.trim()}:{runtime:``}}}),m(null)},T=t=>{e.chatSessionListManager.startAgentDraftChat(t.id,Ue(t,x))},E=()=>{r(`/chat`),t.chatDraftIntentManager.requestDraft(It)};return(0,W.jsxs)(g,{className:`space-y-5`,children:[(0,W.jsx)(Lt,{agentCount:h.length,onCreate:E}),(0,W.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:i.isLoading?(0,W.jsx)(d,{className:`md:col-span-2 xl:col-span-3 border-dashed border-[#d9dce3] bg-white/70`,children:(0,W.jsx)(p,{className:`py-14 text-center text-sm text-gray-500`,children:n(`agentsLoading`)})}):v.length===0?(0,W.jsx)(d,{className:`md:col-span-2 xl:col-span-3 overflow-hidden border-dashed border-[#d9dce3] bg-[linear-gradient(135deg,#fff7ea_0%,#f4fbff_100%)]`,children:(0,W.jsxs)(p,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,W.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-white/80 shadow-[0_18px_44px_rgba(0,0,0,0.08)]`,children:(0,W.jsx)(Fe,{className:`h-8 w-8 text-[#d39a3b]`})}),(0,W.jsx)(`div`,{className:`text-lg font-semibold text-[#2f2212]`,children:n(`agentsEmpty`)}),(0,W.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-[#78644d]`,children:n(`agentsEmptyDescription`)}),(0,W.jsxs)(_,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:E,children:[(0,W.jsx)(De,{className:`mr-2 h-4 w-4`}),n(`agentsCreateButton`)]})]})}):v.map(e=>(0,W.jsx)(zt,{agent:e,runtimeOptions:b,defaultRuntimeLabel:S,updatePending:l.isPending,deletePending:u.isPending,onStartChat:()=>T(e),onEdit:()=>C(e),onDelete:()=>u.mutate({agentId:e.id})},e.id))}),(0,W.jsx)(Pt,{agent:f,pending:l.isPending,providerCatalog:y,runtimeOptions:b,defaultRuntime:x,onOpenChange:e=>{!e&&!l.isPending&&m(null)},onSubmit:w})]})}function G(e){return Array.from(new Set(e.map(e=>e.spec).filter(Boolean)))}function Vt(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 K(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 Ut(e){let{result:t,view:n}=e,r=Ht(t.type,n),i=Vt(e),a=r.records.findIndex(e=>K(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:G(o),total:o.length}}function Wt(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=>!K(e,{id:n.id,spec:t.spec}));return{...i,records:e,specs:G(e),total:e.length}}let a=i.records.map(e=>K(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:G(a),total:a.length}}function Gt(e){let t=ce({queryKey:[`marketplace-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>o({...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&&Kt(r,e)?t:void 0},staleTime:15e3}),n=(0,U.useMemo)(()=>se(t.data),[t.data]);return{...t,data:n}}function Kt(e,t){return e.tag===t.tag&&e.scene===t.scene&&e.pageSize===t.pageSize}function qt(e=!0){return re({queryKey:[`marketplace-skill-scenes`],queryFn:u,enabled:e,staleTime:6e4})}function Jt(e,t=!0){let n=St({queries:e.map(e=>({queryKey:[`marketplace-skill-scene-count`,e.scene],queryFn:()=>o({type:`skill`,scene:e.scene,pageSize:1}),enabled:t&&typeof e.count!=`number`,staleTime:6e4}))});return(0,U.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 Yt(e){return re({queryKey:[`marketplace-installed`,e],queryFn:()=>ee(e),staleTime:1e4})}function Xt(){let e=E();return l({mutationFn:e=>f(e),onSuccess:(t,r)=>{e.setQueryData([`marketplace-installed`,t.type],e=>Ut({view:e,request:r,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`}),c.success(t.message||n(`marketplaceInstallSuccessSkill`))},onError:e=>{c.error(e.message||n(`marketplaceInstallFailed`))}})}function Zt(){let e=E();return l({mutationFn:e=>m(e),onSuccess:(t,r)=>{e.setQueryData([`marketplace-installed`,t.type],e=>Wt({view:e,request:r,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`});let i=t.action===`enable`?n(`marketplaceEnableSuccess`):t.action===`disable`?n(`marketplaceDisableSuccess`):t.action===`update`?n(`marketplaceUpdateSuccess`):n(`marketplaceUninstallSuccess`);c.success(t.message||i)},onError:e=>{c.error(e.message||n(`marketplaceOperationFailed`))}})}var Qt=[`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 $t(e){let{name:t,fallback:n,className:i}=e,a=t||n,o=a.substring(0,2).toUpperCase();return(0,W.jsx)(`div`,{className:r(`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-sm font-semibold text-white`,en(a),i),children:o})}function en(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return Qt[Math.abs(t)%Qt.length]}function tn({title:e,spec:t}){return(0,W.jsxs)(Ce,{delayDuration:400,children:[(0,W.jsxs)(P,{children:[(0,W.jsx)(F,{asChild:!0,children:(0,W.jsx)(`div`,{className:`truncate text-[14px] font-semibold leading-tight text-gray-950`,children:e})}),(0,W.jsx)(I,{className:`max-w-[300px] text-xs`,children:e})]}),(0,W.jsx)(`div`,{className:`mb-2 mt-1 flex min-w-0 items-center gap-1.5`,children:t?(0,W.jsxs)(P,{children:[(0,W.jsx)(F,{asChild:!0,children:(0,W.jsx)(`span`,{className:`max-w-full truncate text-[11px] font-mono leading-tight text-gray-400`,children:t})}),(0,W.jsx)(I,{className:`max-w-[300px] break-all font-mono text-xs`,children:t})]}):null})]})}function nn(e){let{item:t,record:i,state:a,onInstall:o,onManage:s}=e,{isInstalling:c,canUpdate:l,canUninstall:u,busyAction:d}=a,f=!!d;return t&&!i||i&&(l||u)?(0,W.jsxs)(`div`,{className:r(`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&&!i&&(0,W.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),o(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,W.jsx)(Ne,{className:`h-3 w-3`}),n(c?`marketplaceInstalling`:`marketplaceInstall`)]}),i&&l&&(0,W.jsxs)(`button`,{disabled:f,onClick:e=>{e.stopPropagation(),s(`update`,i)},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,W.jsx)(Ye,{className:`h-3 w-3`}),n(d===`update`?`marketplaceUpdating`:`marketplaceUpdate`)]}),i&&u&&(0,W.jsxs)(`button`,{disabled:f,onClick:e=>{e.stopPropagation(),s(`uninstall`,i)},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,W.jsx)(st,{className:`h-3 w-3`}),n(d===`uninstall`?`marketplaceRemoving`:`marketplaceUninstall`)]})]}):null}function rn(e){let{record:t,disabled:n}=e;return t?(0,W.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-end`,children:(0,W.jsx)(an,{disabled:n})}):null}function an(e){let{disabled:t}=e,i=n(t?`marketplaceDisabledStatus`:`marketplaceInstalledStatus`);return(0,W.jsx)(Ce,{delayDuration:300,children:(0,W.jsxs)(P,{children:[(0,W.jsx)(F,{asChild:!0,children:(0,W.jsx)(`span`,{"aria-label":i,className:r(`inline-flex h-5 w-5 items-center justify-center`,t?`text-gray-400`:`text-emerald-700`),children:t?(0,W.jsx)(z,{className:`h-4 w-4 opacity-40`}):(0,W.jsx)(z,{className:`h-4 w-4`})})}),(0,W.jsx)(I,{className:`text-xs`,children:i})]})})}function on(e){let{item:t,record:r,installState:i,manageState:a,onOpen:o,onInstall:s,onManage:c}=e,{language:l}=qe(),u=j(l),d=t?.name??r?.label??r?.id??r?.spec??n(`marketplaceUnknownItem`),f=A(t?.summaryI18n,t?.summary,u)||(r?n(`marketplaceInstalledLocalSummary`):``),p=t?.install.spec??r?.spec??``,m=t?.tags??[],h=r?.id||r?.spec,g=h?a.actionsByTarget.get(h):void 0,_=r?.type===`skill`&&r.source===`workspace`,v=r?.type===`skill`&&r.origin===`marketplace`,y=r?r.enabled===!1||r.runtimeStatus===`disabled`:!1,b=t?.install.spec,x=typeof b==`string`&&i.installingSpecs.has(b);return(0,W.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,W.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,W.jsx)($t,{name:d,fallback:p||n(`marketplaceTypeSkill`),className:`h-9 w-9 rounded-lg text-xs`}),(0,W.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,W.jsx)(tn,{title:d,spec:p})}),(0,W.jsx)(rn,{record:r,disabled:y})]}),(0,W.jsxs)(`div`,{className:`mt-2 flex min-w-0 flex-1 flex-col`,children:[(0,W.jsx)(`p`,{className:`line-clamp-2 text-left text-[12px] leading-relaxed text-gray-500`,children:f}),(0,W.jsxs)(`div`,{className:`mt-auto flex min-w-0 items-end justify-between gap-2 pt-2`,children:[(0,W.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,W.jsx)(sn,{tags:m})}),(0,W.jsx)(nn,{item:t,record:r,state:{isInstalling:x,canUpdate:v,canUninstall:_,busyAction:g},onInstall:s,onManage:c})]})]})]})}function sn({tags:e}){let t=e.filter(cn).slice(0,3);return t.length===0?null:(0,W.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-1.5 overflow-hidden`,children:t.map(e=>(0,W.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 cn(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function ln({model:e,showTitle:t,operationState:n,scroll:i,actions:a}){let{scope:o,entries:s,header:c,status:l,emptyLabel:u,errorLabel:d}=e,{showSkeleton:f,isRefreshing:p,error:m}=l,{hasMore:h,loadingMore:g,sentinelRef:_}=i,{installState:v,manageState:y}=n,{onOpen:b,onInstall:x,onManage:S}=a;return(0,W.jsxs)(`section`,{className:r(`flex min-h-full flex-col`,t&&`gap-3`),children:[t&&(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,W.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-950`,children:c.title}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] text-gray-500`,children:[p&&(0,W.jsx)(`span`,{className:`font-medium text-primary`,children:c.refreshingLabel}),(0,W.jsx)(`span`,{children:c.summary})]})]}),m&&(0,W.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,W.jsx)(`div`,{"data-testid":`marketplace-list-refreshing`,className:`h-0.5 overflow-hidden rounded-full bg-primary/10`,children:(0,W.jsx)(`div`,{className:`h-full w-1/3 animate-pulse rounded-full bg-primary`})}),(0,W.jsxs)(`div`,{"data-testid":f?`marketplace-list-skeleton`:void 0,className:r(`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,W.jsx)(M,{count:36}),!f&&!m&&s.map(e=>(0,W.jsx)(on,{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,W.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:u}),o===`all`&&!f&&!m&&(0,W.jsx)(ue,{hasMore:h,loading:g,sentinelRef:_})]})}function un(e){let{entry:t,language:i,localeFallbacks:a,installState:o,layout:s=`rail`,onOpen:c,onInstall:l}=e,{item:u,record:d}=t,f=A(u.summaryI18n,u.summary,a),p=u.install.spec,m=o.installingSpecs.has(p),h=!!d;return(0,W.jsxs)(`article`,{onClick:()=>c(t),className:r(`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,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,W.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-start gap-2.5`,children:[(0,W.jsx)($t,{name:u.name,fallback:u.install.spec}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,W.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-gray-950`,children:u.name}),(0,W.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] font-mono leading-tight text-gray-400`,children:dn(u)})]})]}),(0,W.jsx)(`p`,{className:`line-clamp-2 text-[12px] leading-relaxed text-gray-500`,children:f}),(0,W.jsx)(fn,{tags:u.tags})]}),(0,W.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-gray-100 pt-2.5`,children:[(0,W.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-gray-400`,children:mn(u.updatedAt)}),h?(0,W.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 text-[11px] font-semibold text-emerald-700`,children:[(0,W.jsx)(z,{className:`h-3.5 w-3.5`}),hn({zh:`已安装`,en:`Installed`},i)]}):(0,W.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,W.jsx)(Ne,{className:`h-3.5 w-3.5`}),n(m?`marketplaceInstalling`:`marketplaceInstall`)]})]})]})}function dn(e){return e.slug||e.install.spec}function fn({tags:e}){let t=e.filter(pn).slice(0,2);return t.length===0?null:(0,W.jsx)(`div`,{className:`mt-auto truncate pt-2 text-[11px] font-medium text-gray-400`,children:t.join(` / `)})}function pn(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function mn(e){return e.slice(0,10)||e}function hn(e,t){return t.startsWith(`zh`)?e.zh:e.en}var gn=[{scene:`development-debugging`,title:{zh:`开发与调试`,en:`Development`},summary:{zh:`代码审查、错误定位、架构分析与交付验证。`,en:`Review, debug, analyze, and verify delivery work.`},icon:kt,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:Ct,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:Ot,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:Et,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:ft,tone:`violet`,span:`md:col-span-1`},{scene:`social-platforms`,title:{zh:`社交平台`,en:`Social`},summary:{zh:`处理发布、互动、检索和内容分发。`,en:`Handle posting, interaction, search, and distribution.`},icon:Dt,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:H,tone:`teal`,span:`md:col-span-2`}],_n={icon:H,tone:`dark`,span:`md:col-span-2`},vn={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`}},yn=`grid grid-cols-[repeat(auto-fill,minmax(240px,320px))] justify-start gap-3`;function bn(e){let{entries:t,scenes:n,isScenesLoading:r,isItemsLoading:i,language:a,installState:o,onOpen:s,onInstall:c,onOpenScene:l}=e,u=j(a),d=[...t].sort((e,t)=>Tn(e.item,t.item)).slice(0,6);return(0,W.jsxs)(`div`,{className:`mb-4 space-y-5`,children:[(0,W.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,W.jsx)(wn,{icon:Tt,title:q({zh:`场景`,en:`Scenes`},a),description:q({zh:`按使用场景浏览适合的技能组合。`,en:`Browse skills by how you plan to use them.`},a)}),r?(0,W.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,W.jsx)(M,{count:gn.length})}):(0,W.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,W.jsx)(xn,{scene:e,language:a,onSelect:l},e.scene))})]}),(i||d.length>0)&&(0,W.jsx)(Cn,{icon:wt,title:q({zh:`最近更新`,en:`Recently updated`},a),description:q({zh:`看看生态最近在补齐哪些能力。`,en:`See what the ecosystem has been improving lately.`},a),entries:d,language:a,localeFallbacks:u,isLoading:i,installState:o,onOpen:s,onInstall:c})]})}function xn(e){let{scene:t,language:n,onSelect:i}=e,a=J(t.scene),o=a.icon,s=vn[a.tone];return(0,W.jsx)(`button`,{type:`button`,onClick:()=>i(t.scene),className:r(`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,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(`span`,{className:r(`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border`,s.icon),children:(0,W.jsx)(o,{className:`h-3.5 w-3.5`})}),(0,W.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-gray-950`,children:En(t,a,n)}),typeof t.count==`number`&&(0,W.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:On(t.count,n)})]}),(0,W.jsx)(`p`,{className:r(`mt-1 line-clamp-1 text-[11px] leading-relaxed`,s.text),children:Dn(t,a,n)})]})})}function Sn(e){let{scene:t,entries:n,isLoading:i,language:a,localeFallbacks:o,installState:s,onBack:c,onOpen:l,onInstall:u}=e,d=J(t.scene),f=d.icon,p=vn[d.tone];return(0,W.jsxs)(`section`,{className:`flex min-h-full flex-col`,children:[(0,W.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-start gap-2.5`,children:[(0,W.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":q({zh:`返回`,en:`Back`},a),children:(0,W.jsx)(Se,{className:`h-4 w-4`})}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(`span`,{className:r(`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border`,p.icon),children:(0,W.jsx)(f,{className:`h-4 w-4`})}),(0,W.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[15px] font-semibold text-gray-950`,children:En(t,d,a)}),(0,W.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:q(i?{zh:`加载中`,en:`Loading`}:{zh:`${n.length} 个技能`,en:`${n.length} skills`},a)})]}),(0,W.jsx)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-2`,children:(0,W.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[12px] leading-relaxed text-gray-500`,children:Dn(t,d,a)})})]})]}),i?(0,W.jsx)(`div`,{"data-testid":`marketplace-scene-skeleton`,className:r(yn,`min-h-0 flex-1 auto-rows-[166px] content-start`),children:(0,W.jsx)(M,{count:24})}):n.length>0?(0,W.jsx)(`div`,{className:yn,children:n.map(e=>(0,W.jsx)(un,{entry:e,language:a,localeFallbacks:o,installState:s,layout:`grid`,onOpen:l,onInstall:u},e.item.id))}):(0,W.jsx)(`div`,{className:`rounded-lg border border-dashed border-gray-200 py-8 text-center text-[12px] text-gray-500`,children:q({zh:`这个模块暂无技能。`,en:`No skills in this module yet.`},a)})]})}function Cn(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,W.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,W.jsx)(wn,{icon:t,title:n,description:r}),s?(0,W.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,W.jsx)(M,{count:4})}):(0,W.jsx)(`div`,{className:`-mx-1 flex gap-2.5 overflow-x-auto px-1 pb-1.5 custom-scrollbar`,children:i.map(e=>(0,W.jsx)(un,{entry:e,language:a,localeFallbacks:o,installState:c,onOpen:l,onInstall:u},e.item.id))})]})}function wn({icon:e,title:t,description:n}){return(0,W.jsx)(`div`,{className:`flex items-end justify-between gap-4`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`h3`,{className:`flex items-center gap-2 text-[14px] font-semibold text-gray-950`,children:[(0,W.jsx)(e,{className:`h-4 w-4 text-primary`}),t]}),(0,W.jsx)(`p`,{className:`mt-0.5 text-[12px] leading-relaxed text-gray-500`,children:n})]})})}function Tn(e,t){let n=Date.parse(e.updatedAt),r=Date.parse(t.updatedAt);return Number.isNaN(n)||Number.isNaN(r)?t.updatedAt.localeCompare(e.updatedAt):r-n}function q(e,t){return t.startsWith(`zh`)?e.zh:e.en}function J(e){return gn.find(t=>t.scene===e)??{scene:e,..._n}}function En(e,t,n){return t.title?q(t.title,n):e.title}function Dn(e,t,n){return t.summary?q(t.summary,n):e.description??e.scene}function On(e,t){return t.startsWith(`zh`)?`${e} 个技能`:`${e} skills`}function kn({label:e,className:t,onClick:n}){return(0,W.jsxs)(`button`,{type:`button`,className:r(`inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md px-1.5 text-[13px] font-medium text-primary transition-colors hover:text-primary-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,t),onClick:n,children:[(0,W.jsx)(Ee,{className:`h-3.5 w-3.5`}),e]})}var An=`https://skillhub.cn/`;function jn(){return(0,W.jsx)(kn,{label:n(`marketplaceExternalSkillSourceTitle`),onClick:()=>void at.openExternalUrl(An)})}function Y(e){return(e??``).trim().toLowerCase()}function X(e,t){let n=Y(t);return n.length>0?`${e}:${n}`:``}function Mn(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=X(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function Nn(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=X(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function Pn(e,t){let n=[e.install.spec,e.slug,e.id];for(let r of n){let n=X(e.type,r);if(!n)continue;let i=t.get(n);if(i)return i}}function Fn(e,t){return t.get(X(e.type,e.spec))||t.get(X(e.type,e.id))||t.get(X(e.type,e.label))}function In(e,t,n,r){let i=Y(n);if(!i)return!0;let a=A(t?.summaryI18n,t?.summary,r);return[e.id,e.spec,e.label,t?.name,t?.slug,t?.summary,a,...t?.tags??[]].map(e=>Y(e)).filter(Boolean).some(e=>e.includes(i))}function Ln(e){let{items:t,installedRecordLookup:n,scene:r,forcedType:i,typeFilter:a,scope:o,searchText:s,query:c,showListSkeleton:l,hasCatalogError:u}=e,d=qt(a===`skill`),f=(0,U.useMemo)(()=>d.data?.scenes??[],[d.data?.scenes]),p=Jt(f,a===`skill`),m=(0,U.useMemo)(()=>f.map(e=>({...e,count:typeof e.count==`number`?e.count:p.get(e.scene)})),[p,f]),h=(0,U.useMemo)(()=>t.map(e=>({item:e,record:Pn(e,n)})),[t,n]),g=(0,U.useMemo)(()=>{let e=r?.trim();if(e)return m.find(t=>t.scene===e)??{scene:e,title:e}},[r,m]),_=a===`skill`&&!!r?.trim(),v=a===`skill`&&o===`all`&&!s.trim()&&!c&&!_,y=l||t.length>=4,b=v&&!u&&y&&m.length===0&&d.isLoading;return{entries:h,scenes:m,selectedScene:g,sceneEntries:h,isSceneRoute:_,isScenesLoading:b,showShelves:v&&!u&&y&&(l||m.length>0||b),backPath:i?`/skills`:`/marketplace/skills`,pathPrefix:i?`/skills/scenes`:`/marketplace/skills/scenes`}}function Rn(){let e=Xt(),t=Zt(),{confirm:r,ConfirmDialog:i}=ze(),[a,o]=(0,U.useState)(new Set),[s,c]=(0,U.useState)(new Map);return{installState:{installingSpecs:a},manageState:{actionsByTarget:s},handleInstall:async t=>{let n=t.install.spec;if(!a.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,i)=>{let a=e===`update`?i.catalogSlug||i.id||i.spec:i.id||i.spec;if(!(!a||s.has(a))&&!(e===`uninstall`&&!await r({title:`${n(`marketplaceUninstallTitle`)} ${a}?`,description:n(`marketplaceUninstallDescription`),confirmLabel:n(`marketplaceUninstall`),variant:`destructive`}))){c(t=>new Map(t).set(a,e));try{await t.mutateAsync({type:i.type,action:e,id:a,spec:i.spec})}finally{c(e=>{let t=new Map(e);return t.delete(a),t})}}},ConfirmDialog:i}}function Z(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}function zn(e){let t=e.replace(/\r\n/g,`
2
- `).split(`
3
- `);if(t[0]?.trim()!==`---`)return e;let n=t.findIndex((e,t)=>t>0&&e.trim()===`---`);return n>0?t.slice(n+1).join(`
4
- `).trim():e}function Q(e){return Z(e).replace(/`([^`]+)`/g,`<code>$1</code>`).replace(/\*\*([^*]+)\*\*/g,`<strong>$1</strong>`).replace(/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)/g,`<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>`)}function Bn(e){return/^(#{1,4})\s+/.test(e)||/^([-*])\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)}function Vn(e,t,n){let r=[],i=t+1;for(;i<e.length&&!e[i]?.trim().startsWith("```");)r.push(e[i]??``),i+=1;return{html:`<div class="code-block">${n[1]?`<span class="code-language">${Z(n[1])}</span>`:``}<pre><code>${Z(r.join(`
5
- `))}</code></pre></div>`,nextIndex:i+1}}function Hn(e,t){let n=Math.min(4,e[1]?.length??2);return{html:`<h${n}>${Q(e[2]??``)}</h${n}>`,nextIndex:t+1}}function Un(e,t,n){let r=[],i=t,a=n?/^\d+\.\s+/:/^[-*]\s+/;for(;i<e.length&&a.test(e[i]?.trim()??``);)r.push(`<li>${Q((e[i]??``).trim().replace(a,``))}</li>`),i+=1;return{html:n?`<ol>${r.join(``)}</ol>`:`<ul>${r.join(``)}</ul>`,nextIndex:i}}function Wn(e,t){let n=[],r=t;for(;r<e.length&&/^>\s?/.test(e[r]?.trim()??``);)n.push((e[r]??``).trim().replace(/^>\s?/,``)),r+=1;return{html:`<blockquote>${Q(n.join(` `))}</blockquote>`,nextIndex:r}}function Gn(e,t){let n=[],r=t;for(;r<e.length;){let t=e[r]?.trim()??``;if(!t||Bn(t))break;n.push(t),r+=1}return{html:`<p>${Q(n.join(` `))}</p>`,nextIndex:r}}function Kn(e,t){let n=e[t]?.trim()??``,r=n.match(/^```(\S*)/);if(r)return Vn(e,t,r);let i=n.match(/^(#{1,4})\s+(.+)$/);return i?Hn(i,t):/^[-*]\s+/.test(n)?Un(e,t,!1):/^\d+\.\s+/.test(n)?Un(e,t,!0):/^>\s?/.test(n)?Wn(e,t):Gn(e,t)}function qn(e){let t=zn(e).replace(/\r\n/g,`
6
- `).split(`
7
- `),n=[],r=0;for(;r<t.length;){if(!(t[r]??``).trim()){r+=1;continue}let e=Kn(t,r);n.push(e.html),r=e.nextIndex}return n.join(``)}function Jn(e){return Array.isArray(e)?e.map(e=>Jn(e)).join(`, `):e&&typeof e==`object`?JSON.stringify(e):String(e??``)}function Yn(e){try{let t=JSON.parse(e);return!t||typeof t!=`object`||Array.isArray(t)?[]:Object.entries(t).map(([e,t])=>({key:e,value:Jn(t)})).filter(e=>e.value.trim().length>0)}catch{return[]}}function Xn(e){return e.replace(/\r\n/g,`
8
- `).split(`
9
- `).map(e=>e.match(/^([A-Za-z0-9_.-]+):\s*(.+)$/)).filter(e=>!!e).map(e=>({key:e[1]??``,value:e[2]?.replace(/^["']|["']$/g,``)??``})).filter(e=>e.key&&e.value.trim().length>0)}function Zn(e){let t=Yn(e),n=t.length>0?t:Xn(e);return n.length===0?`<pre class="code">${Z(e)}</pre>`:`<dl class="metadata-list">${n.map(e=>`<div><dt>${Z(e.key)}</dt><dd>${Z(e.value)}</dd></div>`).join(``)}</dl>`}function $(e){let{title:t,typeLabel:n,spec:r,summary:i,description:a,metadataRaw:o,contentRaw:s,sourceUrl:c,sourceLabel:l,tags:u,author:d,loading:f}=e,p=o?.trim()||`-`,m=s?.trim()||`-`,h=i?.trim(),g=a?.trim(),_=!!g&&g!==h,v=Zn(p),y=qn(m),b=`<!doctype html>
10
- <html>
11
- <head>
12
- <meta charset="utf-8" />
13
- <meta name="viewport" content="width=device-width, initial-scale=1" />
14
- <title>${Z(t)}</title>
15
- <style>
16
- :root { color-scheme: light; }
17
- body { margin: 0; background: #f9f8f5; color: #2f2212; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
18
- .wrap { max-width: 940px; margin: 0 auto; padding: 24px 20px 36px; }
19
- .hero { border: 1px solid #f0e2c8; border-radius: 14px; background: linear-gradient(180deg, #fff9f1 0%, #ffffff 28%); padding: 18px; box-shadow: 0 1px 3px rgba(30, 20, 10, 0.05); }
20
- .hero h1 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: 0; }
21
- .meta { margin-top: 7px; color: #78644d; font-size: 12px; overflow-wrap: anywhere; word-break: break-word; }
22
- .summary { margin: 12px 0 0; font-size: 13px; line-height: 1.65; color: #5f5142; }
23
- .grid { display: grid; grid-template-columns: minmax(220px, 0.42fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; }
24
- .card { border: 1px solid #eee3d1; background: #fffdf9; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 2px rgba(30, 20, 10, 0.035); }
25
- .card h2 { margin: 0; padding: 11px 13px; font-size: 12px; font-weight: 650; color: #3f472f; border-bottom: 1px solid #f1e7d4; background: #fffaf2; }
26
- .card .body { padding: 12px 13px; font-size: 12px; color: #4e463d; line-height: 1.65; }
27
- .code { white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; line-height: 1.55; margin: 0; }
28
- .metadata-list { margin: 0; }
29
- .metadata-list div { display: grid; grid-template-columns: minmax(72px, 0.36fr) minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px solid #f2eadc; }
30
- .metadata-list div:last-child { border-bottom: 0; }
31
- .metadata-list dt { color: #7a5a24; font-weight: 650; overflow-wrap: anywhere; }
32
- .metadata-list dd { margin: 0; color: #4e463d; overflow-wrap: anywhere; }
33
- .markdown { font-size: 13px; line-height: 1.68; }
34
- .markdown > *:first-child { margin-top: 0; }
35
- .markdown > *:last-child { margin-bottom: 0; }
36
- .markdown h1, .markdown h2, .markdown h3, .markdown h4 { margin: 18px 0 8px; color: #2f2212; line-height: 1.25; letter-spacing: 0; }
37
- .markdown h1 { font-size: 20px; }
38
- .markdown h2 { font-size: 17px; }
39
- .markdown h3 { font-size: 15px; }
40
- .markdown h4 { font-size: 13px; }
41
- .markdown p { margin: 10px 0; }
42
- .markdown ul, .markdown ol { margin: 10px 0; padding-left: 20px; }
43
- .markdown li { margin: 5px 0; }
44
- .markdown blockquote { margin: 12px 0; padding: 8px 12px; border-left: 3px solid #d9b56f; border-radius: 8px; background: #fff7ea; color: #6d5841; }
45
- .markdown code { border: 1px solid #eadcc6; border-radius: 5px; background: #fff7ea; padding: 1px 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: #6b4b16; }
46
- .markdown a { color: #5f6b45; text-decoration: none; font-weight: 600; }
47
- .markdown a:hover { text-decoration: underline; }
48
- .code-block { position: relative; margin: 12px 0; overflow: hidden; border: 1px solid #eadcc6; border-radius: 10px; background: #2f2a24; }
49
- .code-block pre { margin: 0; overflow-x: auto; padding: 13px; }
50
- .code-block code { border: 0; border-radius: 0; background: transparent; padding: 0; color: #f7efe3; }
51
- .code-language { position: absolute; right: 10px; top: 8px; color: #d8c3a0; font-size: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
52
- .tags { margin-top: 10px; }
53
- .tag { display: inline-block; margin: 0 6px 6px 0; padding: 4px 8px; border: 1px solid #ecd9b5; border-radius: 999px; background: #fff7ea; color: #7a5a24; font-size: 11px; }
54
- .source { color: #5f6b45; text-decoration: none; overflow-wrap: anywhere; word-break: break-all; }
55
- .source:hover { text-decoration: underline; }
56
- .skeleton { display: block; border-radius: 8px; background: linear-gradient(90deg, #f0e6d6 0%, #fffaf2 42%, #f0e6d6 78%); background-size: 220% 100%; animation: shimmer 1.35s ease-in-out infinite; }
57
- .detail-skeleton .hero { padding: 18px; }
58
- .sk-title { width: 52%; height: 24px; }
59
- .sk-meta { width: 78%; height: 12px; margin-top: 12px; }
60
- .sk-line { height: 12px; margin-top: 12px; }
61
- .sk-line.short { width: 62%; }
62
- .sk-line.mid { width: 82%; }
63
- .sk-body { height: 220px; margin: 13px; }
64
- @keyframes shimmer { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
65
- @media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }
66
- </style>
67
- </head>
68
- <body>
69
- <main class="wrap${f?` detail-skeleton`:``}"${f?` aria-busy="true"`:``}>
70
- ${f?`
71
- <section class="hero">
72
- <span class="skeleton sk-title"></span>
73
- <span class="skeleton sk-meta"></span>
74
- <span class="skeleton sk-line mid"></span>
75
- <span class="skeleton sk-line"></span>
76
- <span class="skeleton sk-line short"></span>
77
- </section>
78
- <section class="grid">
79
- <article class="card"><span class="skeleton sk-body"></span></article>
80
- <article class="card"><span class="skeleton sk-body"></span></article>
81
- </section>
82
- `:`
83
- <section class="hero">
84
- <h1>${Z(t)}</h1>
85
- <div class="meta">${Z(n)} · ${Z(r)}${d?` · ${Z(d)}`:``}</div>
86
- ${h?`<p class="summary">${Z(h)}</p>`:``}
87
- ${_?`<p class="summary">${Z(g)}</p>`:``}
88
- ${u&&u.length>0?`<div class="tags">${u.map(e=>`<span class="tag">${Z(e)}</span>`).join(``)}</div>`:``}
89
- ${c?`<p class="meta" style="margin-top:12px;">${Z(l??`Source`)}: <a class="source" href="${Z(c)}" target="_blank" rel="noopener noreferrer">${Z(c)}</a></p>`:``}
90
- </section>
91
-
92
- <section class="grid">
93
- <article class="card">
94
- <h2>Metadata</h2>
95
- <div class="body">${v}</div>
96
- </article>
97
- <article class="card">
98
- <h2>Content</h2>
99
- <div class="body markdown">${y}</div>
100
- </article>
101
- </section>
102
- `}
103
- </main>
104
- </body>
105
- </html>`;return`data:text/html;charset=utf-8,${encodeURIComponent(b)}`}function Qn(e){let t=Oe(),r=(0,U.useRef)({byKey:new Map,seq:0});return{openItemDetail:async(i,a)=>{let o=i?.name??a?.label??a?.id??a?.spec??n(`marketplaceUnknownItem`),s=i?`marketplace:${i.type}:${i.slug}`:`marketplace:${a?.type??`unknown`}:${a?.id??a?.spec??o}`,c={title:o,kind:`content`,dedupeKey:s},l={...c,activate:!1},u=n(`marketplaceTypeSkill`);if(!i){t.open($({title:o,typeLabel:u,spec:a?.spec??`-`,summary:n(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify(a??{},null,2),contentRaw:`-`}),c);return}let d=r.current.seq+1;r.current.seq=d,r.current.byKey.set(s,d);let f=A(i.summaryI18n,i.summary,e);t.open($({title:o,typeLabel:u,spec:i.install.spec,loading:!0}),c);try{let e=await D(i.slug);if(r.current.byKey.get(s)!==d)return;t.open($({title:o,typeLabel:u,spec:i.install.spec,summary:f,metadataRaw:e.metadataRaw,contentRaw:e.bodyRaw||e.raw,sourceUrl:e.sourceUrl,sourceLabel:`Source (${e.source})`,tags:i.tags,author:i.author}),l)}catch(e){if(r.current.byKey.get(s)!==d)return;t.open($({title:o,typeLabel:u,spec:i.install.spec,summary:f,metadataRaw:JSON.stringify({error:e instanceof Error?e.message:String(e)},null,2),contentRaw:n(`marketplaceOperationFailed`)}),l)}}}}function $n(e){let{scope:t,typeFilter:r,query:i,localeFallbacks:a,catalogView:o,installedView:s,isCatalogLoading:c,isCatalogFetching:l,isCatalogFetchingNextPage:u,catalogError:d,isInstalledLoading:f,installedError:p}=e,m=(0,U.useMemo)(()=>s?.records??[],[s?.records]),h=(0,U.useMemo)(()=>o?.items??[],[o?.items]),g=(0,U.useMemo)(()=>Mn(h),[h]),_=(0,U.useMemo)(()=>Nn(m),[m]),v=(0,U.useMemo)(()=>m.filter(e=>e.type===r).map(e=>({key:`${e.type}:${e.spec}:${e.id??``}`,record:e,item:Fn(e,g)})).filter(e=>In(e.record,e.item,i,a)).sort((e,t)=>er(e.record,t.record)),[m,r,g,i,a]),y=(0,U.useMemo)(()=>t===`installed`?v:h.map(e=>({key:e.id,item:e,record:Pn(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?n(`loading`):`${v.length} ${n(`marketplaceInstalledSkillsCountSuffix`)}`:o?`${h.length} / ${o.total}`:n(`loading`),C=t===`all`&&d?d:t===`installed`&&p?p:void 0,w={scope:t,entries:y,header:{title:n(t===`installed`?`marketplaceSectionInstalledSkills`:`marketplaceAllSkills`),summary:S,refreshingLabel:n(`marketplaceRefreshingResults`)},status:{showSkeleton:b,isRefreshing:x,error:C},emptyLabel:n(t===`installed`?`marketplaceNoInstalledSkills`:`marketplaceNoSkills`),errorLabel:n(t===`installed`?`marketplaceErrorLoadingInstalledSkills`:`marketplaceErrorLoadingSkillsData`)};return{allItems:h,installedRecordLookup:_,installedTotal:s?.total??0,itemListView:w,showListSkeleton:b,isRefreshingList:x}}function er(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 tr=20;function nr({forcedType:e}={}){let t=V(),r=Ae(),{language:i}=qe(),a=`skill`,o=(0,U.useMemo)(()=>j(i),[i]),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(``),[d,f]=(0,U.useState)(`all`),[p,m]=(0,U.useState)(`relevance`),{installState:h,manageState:_,handleInstall:v,handleManage:y,ConfirmDialog:b}=Rn(),{openItemDetail:x}=Qn(o);(0,U.useEffect)(()=>{let e=setTimeout(()=>{u(s.trim())},250);return()=>clearTimeout(e)},[s]);let S=Yt(a),C=a===`skill`?r.scene?.trim():void 0,w=Gt({q:C?void 0:l||void 0,scene:C,type:a,sort:p,pageSize:tr}),{containerRef:T,sentinelRef:E}=le({disabled:d!==`all`||w.isError||!w.hasNextPage||w.isFetchingNextPage,onLoadMore:()=>w.fetchNextPage(),watchValue:`${a}:${d}:${l}:${C??``}:${p}:${w.data?.loadedItems??0}:${w.data?.loadedPages??0}`});(0,U.useEffect)(()=>{let e=T.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[T,l,C,d,p,a]);let D=$n({scope:d,typeFilter:a,query:l,localeFallbacks:o,catalogView:w.data,installedView:S.data,isCatalogLoading:w.isLoading,isCatalogFetching:w.isFetching,isCatalogFetchingNextPage:w.isFetchingNextPage,catalogError:w.isError?w.error:void 0,isInstalledLoading:S.isLoading,installedError:S.isError?S.error:void 0}),O=Ln({items:D.allItems,installedRecordLookup:D.installedRecordLookup,scene:C,forcedType:e,typeFilter:a,scope:d,searchText:s,query:l,showListSkeleton:D.showListSkeleton,hasCatalogError:w.isError});return(0,W.jsxs)(g,{className:`flex h-full min-h-0 flex-col pb-0`,children:[!O.isSceneRoute&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3 border-b border-gray-200/60`,children:[(0,W.jsx)(pt,{value:d,onValueChange:e=>f(e),children:(0,W.jsxs)(Me,{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,W.jsx)(dt,{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:n(`marketplaceTabMarketplaceSkills`)}),(0,W.jsxs)(dt,{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:[n(`marketplaceTabInstalledSkills`),(0,W.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:D.installedTotal})]})]})}),(0,W.jsx)(jn,{})]}),(0,W.jsx)(oe,{scope:d,searchText:s,isRefreshing:D.isRefreshingList,searchPlaceholder:n(`marketplaceSearchPlaceholderSkills`),sort:p,onSearchTextChange:c,onSortChange:m})]}),(0,W.jsx)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,W.jsxs)(`div`,{ref:T,className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar pr-1`,"aria-busy":D.showListSkeleton||w.isFetchingNextPage,children:[O.isSceneRoute&&O.selectedScene&&(0,W.jsx)(Sn,{scene:O.selectedScene,entries:O.sceneEntries,isLoading:D.showListSkeleton,language:i,localeFallbacks:o,installState:h,onBack:()=>t(O.backPath),onOpen:e=>void x(e.item,e.record),onInstall:v}),O.isSceneRoute&&!D.showListSkeleton&&(0,W.jsx)(ue,{hasMore:!!w.hasNextPage,loading:w.isFetchingNextPage,sentinelRef:E}),O.showShelves&&(0,W.jsx)(bn,{entries:O.entries,scenes:O.scenes,isScenesLoading:O.isScenesLoading,isItemsLoading:D.showListSkeleton,language:i,installState:h,onOpen:e=>void x(e.item,e.record),onInstall:v,onOpenScene:e=>t(`${O.pathPrefix}/${e}`)}),!O.isSceneRoute&&(0,W.jsx)(ln,{model:D.itemListView,showTitle:O.showShelves||!D.showListSkeleton,operationState:{installState:h,manageState:_},scroll:{hasMore:!!w.hasNextPage,loadingMore:w.isFetchingNextPage,sentinelRef:E},actions:{onOpen:(e,t)=>void x(e,t),onInstall:v,onManage:y}})]})}),(0,W.jsx)(b,{})]})}function rr(e){let{view:t,routeSessionKey:n,syncRouteSessionSelection:r}=e;(0,U.useEffect)(()=>{r({isChatView:t===`chat`,routeSessionKey:n})},[n,r,t])}function ir({view:e,confirmDialog:t}){let{isMobile:n}=Je();return(0,W.jsxs)(`div`,{className:`h-full flex`,children:[n?null:(0,W.jsx)(Ke,{}),e===`chat`?n?(0,W.jsx)(nt,{}):(0,W.jsx)(lt,{}):(0,W.jsx)(`section`,{className:`flex-1 min-h-0 overflow-hidden bg-gradient-to-b from-gray-50/60 to-white`,children:e===`cron`?(0,W.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,W.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1120px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,W.jsx)(Re,{})})}):e===`agents`?(0,W.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,W.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1180px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,W.jsx)(Bt,{})})}):(0,W.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,W.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-[min(1120px,100%)] flex-col px-4 py-4 sm:px-6 sm:py-5`,children:(0,W.jsx)(nr,{forcedType:`skills`})})})}),t]})}function ar(e){let t=B(),n=gt(),r=_t(),i=ht(),a=Pe({limit:200}),o=tt(),s=e.sessionKey?.trim()||`draft-session`,c=We({sessionId:s});(0,U.useEffect)(()=>{t.chatQueryManager.syncSnapshot({configQuery:n,providersQuery:r,providerTemplatesQuery:i,sessionsQuery:a,sessionTypesQuery:o,sessionSkillsSessionId:s,sessionSkillsQuery:c})},[n,t.chatQueryManager,r,s,c,a,o,i])}function or(){let e=B();(0,U.useEffect)(()=>C.eventBus.on(O.uiShowContent,t=>{e.chatThreadManager.handleUiShowContentEvent(t)}),[e])}function sr(){let{sessionId:e}=Ae(),t=(0,U.useMemo)(()=>Ze(e),[e]);return{routeSessionKey:t,sessionKey:t??void 0}}function cr(){let e=B(),{confirm:t,ConfirmDialog:n}=ze(),r=He(),i=V();return(0,U.useEffect)(()=>{e.chatUiManager.syncState({pathname:r.pathname}),e.chatUiManager.bindActions({navigate:i,confirm:t})},[t,r.pathname,i,e]),(0,W.jsx)(n,{})}function lr({view:e}){let t=ct(),[n]=(0,U.useState)(()=>new ot(t));return(0,W.jsx)(je,{presenter:n,children:(0,W.jsx)(ur,{view:e})})}function ur({view:e}){let t=B(),n=cr(),{routeSessionKey:r,sessionKey:i}=sr();return ar({sessionKey:i??null}),rr({view:e,routeSessionKey:r,syncRouteSessionSelection:t.chatSessionListManager.syncRouteSessionSelection}),or(),(0,W.jsx)(ir,{view:e,confirmDialog:n})}function dr({view:e}){return(0,W.jsx)(lr,{view:e})}export{dr as ChatPage};
@@ -1 +0,0 @@
1
- import{h as e,p as t,r as n,u as r,v as i}from"./react-C6cZgP44.js";import{n as a}from"./search-BNlcoj5c.js";var o=i(e(),1),s=t(),c=`min-w-0 overflow-hidden rounded-2xl border border-gray-200/70 bg-white shadow-card xl:h-[calc(100vh-180px)] xl:max-h-[860px]`;function l({className:e,...t}){return(0,s.jsx)(`section`,{className:r(c,`flex flex-col`,e),...t})}function u({className:e,children:t,mobileView:i,onMobileBack:c,mobileListLabel:l,...u}){let[d,f,...p]=o.Children.toArray(t);return i&&d&&f?(0,s.jsx)(`div`,{className:r(`grid min-h-0 grid-cols-1 gap-4`,e),...u,children:i===`detail`?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`div`,{className:`shrink-0`,children:(0,s.jsxs)(`button`,{type:`button`,onClick:c,className:`inline-flex items-center gap-2 rounded-full border border-gray-200 bg-white px-3 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50 hover:text-gray-900`,children:[(0,s.jsx)(a,{className:`h-4 w-4`}),(0,s.jsx)(`span`,{children:l??n(`backToMain`)})]})}),f,p]}):(0,s.jsxs)(s.Fragment,{children:[d,p]})}):(0,s.jsx)(`div`,{className:r(`grid min-h-0 grid-cols-1 gap-5 xl:flex-1 xl:grid-cols-[340px_minmax(0,1fr)]`,e),...u,children:t})}function d({className:e,...t}){return(0,s.jsx)(`section`,{className:r(c,`flex items-center justify-center px-6 py-12 text-center`,e),...t})}function f({className:e,...t}){return(0,s.jsx)(`div`,{className:r(`shrink-0 border-b border-gray-100`,e),...t})}function p({className:e,scrollOnDesktop:t=!0,...n}){return(0,s.jsx)(`div`,{className:r(`min-h-0 flex-1`,t&&`overflow-visible xl:overflow-y-auto xl:overscroll-contain`,e),...n})}function m({className:e,...t}){return(0,s.jsx)(`div`,{className:r(`shrink-0 border-t border-gray-100`,e),...t})}function h({active:e=!1,className:t,type:n=`button`,...i}){return(0,s.jsx)(`button`,{type:n,className:r(`w-full rounded-xl border p-2.5 text-left transition-all`,e?`border-primary/30 bg-primary-50/40 shadow-sm`:`border-gray-200/70 bg-white hover:border-gray-300 hover:bg-gray-50/70`,t),...i})}function g({icon:e,title:t,description:n,className:i,...a}){return(0,s.jsxs)(`div`,{className:r(`flex min-h-[220px] flex-col items-center justify-center rounded-xl border border-dashed border-gray-200 bg-gray-50/70 px-4 py-10 text-center`,i),...a,children:[(0,s.jsx)(`div`,{className:`mb-3 flex h-10 w-10 items-center justify-center rounded-lg bg-white`,children:(0,s.jsx)(e,{className:`h-5 w-5 text-gray-300`})}),(0,s.jsx)(`p`,{className:`text-sm font-medium text-gray-700`,children:t}),n?(0,s.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:n}):null]})}export{l as a,f as c,u as i,d as n,p as o,g as r,m as s,h as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./doc-browser-BJRLhztv.js";export{e as DocBrowser};
@@ -1 +0,0 @@
1
- import{h as e,p as t,r as n,u as r,v as i}from"./react-C6cZgP44.js";import{a,b as o,c as s,f as c,g as l,h as u,i as d,l as f,m as p,o as m,r as h,s as g,t as _,u as v,x as y,y as b}from"./dist-CLGGLm8b.js";import{t as x}from"./dist-BtCS2Ucq.js";import{n as S,t as C}from"./search-BNlcoj5c.js";import{t as w}from"./external-link-CdJiG13p.js";import{t as T}from"./plus-DPjb0piO.js";import{t as E}from"./x-BiSSpgqB.js";import{c as ee,f as D,n as te,p as ne,s as re}from"./doc-browser-context-D4JwMMxK.js";var O=s(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),k=s(`Boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),ie=s(`GripVertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),A=s(`Maximize2`,[[`polyline`,{points:`15 3 21 3 21 9`,key:`mznyad`}],[`polyline`,{points:`9 21 3 21 3 15`,key:`1avn1i`}],[`line`,{x1:`21`,x2:`14`,y1:`3`,y2:`10`,key:`ota7mn`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),j=s(`PanelRightOpen`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),M=s(`PinOff`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),N=s(`Pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),P=i(e(),1),F=t(),[I,ae]=b(`Tooltip`,[g]),L=g(),R=`TooltipProvider`,oe=700,z=`tooltip.open`,[B,V]=I(R),H=e=>{let{__scopeTooltip:t,delayDuration:n=oe,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=P.useRef(!0),s=P.useRef(!1),c=P.useRef(0);return P.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,F.jsx)(B,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:P.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:P.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:P.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};H.displayName=R;var U=`Tooltip`,[se,W]=I(U),G=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=V(U,e.__scopeTooltip),d=L(t),[f,p]=P.useState(null),h=l(),g=P.useRef(0),_=o??c.disableHoverableContent,v=s??c.delayDuration,y=P.useRef(!1),[b,x]=u({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(z))):c.onClose(),a?.(e)},caller:U}),S=P.useMemo(()=>b?y.current?`delayed-open`:`instant-open`:`closed`,[b]),C=P.useCallback(()=>{window.clearTimeout(g.current),g.current=0,y.current=!1,x(!0)},[x]),w=P.useCallback(()=>{window.clearTimeout(g.current),g.current=0,x(!1)},[x]),T=P.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{y.current=!0,x(!0),g.current=0},v)},[v,x]);return P.useEffect(()=>()=>{g.current&&=(window.clearTimeout(g.current),0)},[]),(0,F.jsx)(m,{...d,children:(0,F.jsx)(se,{scope:t,contentId:h,open:b,stateAttribute:S,trigger:f,onTriggerChange:p,onTriggerEnter:P.useCallback(()=>{c.isOpenDelayedRef.current?T():C()},[c.isOpenDelayedRef,T,C]),onTriggerLeave:P.useCallback(()=>{_?w():(window.clearTimeout(g.current),g.current=0)},[w,_]),onOpen:C,onClose:w,disableHoverableContent:_,children:n})})};G.displayName=U;var K=`TooltipTrigger`,q=P.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=W(K,n),a=V(K,n),s=L(n),l=o(t,P.useRef(null),i.onTriggerChange),u=P.useRef(!1),d=P.useRef(!1),f=P.useCallback(()=>u.current=!1,[]);return P.useEffect(()=>()=>document.removeEventListener(`pointerup`,f),[f]),(0,F.jsx)(h,{asChild:!0,...s,children:(0,F.jsx)(c.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:y(e.onPointerMove,e=>{e.pointerType!==`touch`&&!d.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:y(e.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:y(e.onPointerDown,()=>{i.open&&i.onClose(),u.current=!0,document.addEventListener(`pointerup`,f,{once:!0})}),onFocus:y(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:y(e.onBlur,i.onClose),onClick:y(e.onClick,i.onClose)})})});q.displayName=K;var J=`TooltipPortal`,[ce,le]=I(J,{forceMount:void 0}),ue=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=W(J,t);return(0,F.jsx)(ce,{scope:t,forceMount:n,children:(0,F.jsx)(x,{present:n||a.open,children:(0,F.jsx)(f,{asChild:!0,container:i,children:r})})})};ue.displayName=J;var Y=`TooltipContent`,de=P.forwardRef((e,t)=>{let n=le(Y,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=W(Y,e.__scopeTooltip);return(0,F.jsx)(x,{present:r||o.open,children:o.disableHoverableContent?(0,F.jsx)(ge,{side:i,...a,ref:t}):(0,F.jsx)(fe,{side:i,...a,ref:t})})}),fe=P.forwardRef((e,t)=>{let n=W(Y,e.__scopeTooltip),r=V(Y,e.__scopeTooltip),i=P.useRef(null),a=o(t,i),[s,c]=P.useState(null),{trigger:l,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,p=P.useCallback(()=>{c(null),f(!1)},[f]),m=P.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=be(r,ye(r,n.getBoundingClientRect())),a=xe(t.getBoundingClientRect());c(Ce([...i,...a])),f(!0)},[f]);return P.useEffect(()=>()=>p(),[p]),P.useEffect(()=>{if(l&&d){let e=e=>m(e,d),t=e=>m(e,l);return l.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[l,d,m,p]),P.useEffect(()=>{if(s){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||d?.contains(t),i=!Se(n,s);r?p():i&&(p(),u())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,s,u,p]),(0,F.jsx)(ge,{...e,ref:a})}),[pe,me]=I(U,{isInside:!1}),he=p(`TooltipContent`),ge=P.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=e,l=W(Y,n),u=L(n),{onClose:d}=l;return P.useEffect(()=>(document.addEventListener(z,d),()=>document.removeEventListener(z,d)),[d]),P.useEffect(()=>{if(l.trigger){let e=e=>{e.target?.contains(l.trigger)&&d()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]),(0,F.jsx)(v,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,F.jsxs)(a,{"data-state":l.stateAttribute,...u,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,F.jsx)(he,{children:r}),(0,F.jsx)(pe,{scope:n,isInside:!0,children:(0,F.jsx)(_,{id:l.contentId,role:`tooltip`,children:i||r})})]})})});de.displayName=Y;var _e=`TooltipArrow`,ve=P.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=L(n);return me(_e,n).isInside?null:(0,F.jsx)(d,{...i,...r,ref:t})});ve.displayName=_e;function ye(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function be(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function xe(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Se(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Ce(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),we(t)}function we(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Te=H,Ee=G,De=q,Oe=ue,ke=de,Ae=Te,je=Ee,Me=De,X=P.forwardRef(({className:e,sideOffset:t=4,...n},i)=>(0,F.jsx)(Oe,{children:(0,F.jsx)(ke,{ref:i,sideOffset:t,className:r(`z-[var(--z-tooltip)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));X.displayName=ke.displayName;var Z=P.forwardRef(({className:e,disabled:t=!1,icon:n,label:i,tooltip:a,...o},s)=>{let c=(0,F.jsx)(`button`,{...o,ref:s,type:`button`,disabled:t,"aria-label":i,className:r(`inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 disabled:cursor-not-allowed`,`text-gray-500 hover:bg-gray-100 hover:text-gray-900 disabled:text-gray-300 disabled:hover:bg-transparent disabled:hover:text-gray-300`,e),children:n}),l=a===!1?null:a??i;return l?(0,F.jsx)(Ae,{delayDuration:250,children:(0,F.jsxs)(je,{children:[(0,F.jsx)(Me,{asChild:!0,children:t?(0,F.jsx)(`span`,{className:`inline-flex`,children:c}):c}),(0,F.jsx)(X,{side:`bottom`,className:`text-xs`,children:l})]})}):c});Z.displayName=`IconActionButton`;function Ne(e,t){e.stopPropagation(),t()}function Pe({labelClassName:e,tab:t}){let n=t.onClose&&t.closePlacement===`leading-hover`?null:t.leadingIcon,i=(0,F.jsxs)(`button`,{type:`button`,onClick:t.onSelect,"aria-label":t.label,className:`flex min-w-0 flex-1 items-center gap-1.5 text-left`,children:[n?(0,F.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center`,children:n}):null,(0,F.jsx)(`span`,{className:r(`min-w-0 truncate text-[12px] font-medium`,e),children:t.label}),t.badge,t.unreadIndicator]}),a=t.tooltip??t.label;return a?(0,F.jsx)(Ae,{delayDuration:250,children:(0,F.jsxs)(je,{children:[(0,F.jsx)(Me,{asChild:!0,children:i}),(0,F.jsx)(X,{side:`bottom`,className:`text-xs`,children:a})]})}):i}function Fe({activeTabClassName:e,inactiveTabClassName:t,itemRef:n,labelClassName:i,tab:a,tabBaseClassName:o}){let s=a.onClose&&a.closePlacement===`leading-hover`;return(0,F.jsxs)(`div`,{ref:n,className:r(o??`group flex max-w-[180px] min-w-0 items-center gap-1.5 border-r border-gray-200/70 border-b-2 px-2.5 py-2 transition-colors`,a.active?e??`border-b-primary bg-white text-gray-900`:t??`border-b-transparent bg-gray-50/85 text-gray-500 hover:bg-gray-100`),children:[s?(0,F.jsxs)(`button`,{type:`button`,onClick:e=>Ne(e,a.onClose),className:`relative inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors hover:bg-gray-200 hover:text-gray-700`,"aria-label":a.closeLabel,children:[(0,F.jsx)(`span`,{className:`flex items-center justify-center group-hover:hidden`,children:a.leadingIcon}),(0,F.jsx)(E,{className:`hidden h-3.5 w-3.5 group-hover:block`})]}):null,(0,F.jsx)(Pe,{tab:a,labelClassName:i}),a.onClose&&a.closePlacement!==`leading-hover`?(0,F.jsx)(Z,{icon:(0,F.jsx)(E,{className:`h-3 w-3`}),label:a.closeLabel??``,tooltip:a.closeLabel??null,onClick:e=>Ne(e,a.onClose),className:`h-5 w-5 rounded p-0.5 hover:bg-black/10`}):null]})}function Ie({actionButtonClassName:e,actions:t,actionsClassName:n,actionsTestId:i,className:a,onPointerDown:o,onScrollPointerDown:s,scrollClassName:c,scrollTestId:l,tabs:u,tabsClassName:d,testId:f,...p}){let m=P.useCallback(e=>{e?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[]);return(0,F.jsxs)(`div`,{"data-testid":f,className:r(`flex min-w-0 items-stretch border-b border-gray-200/70 bg-gray-50/85`,a),onPointerDown:o,children:[(0,F.jsx)(`div`,{className:r(`min-w-0 flex-1 overflow-x-auto overflow-y-hidden`,c),onPointerDown:s,children:(0,F.jsx)(`div`,{"data-testid":l,className:r(`flex min-w-max items-stretch`,d),children:u.map(e=>(0,F.jsx)(Fe,{itemRef:e.active?m:void 0,tab:e,...p},e.key))})}),(0,F.jsx)(`div`,{className:r(`flex shrink-0 items-center gap-1`,n),"data-testid":i,onPointerDown:e=>e.stopPropagation(),children:t.map(t=>(0,F.jsx)(Z,{icon:t.icon,label:t.label,disabled:t.disabled,onClick:t.onClick,className:e},t.key))})]})}function Le(){return(0,F.jsx)(`div`,{className:`flex h-full items-center justify-center bg-background px-5 py-6`,children:(0,F.jsxs)(`div`,{className:`flex max-w-[260px] flex-col items-center gap-3 text-center`,children:[(0,F.jsx)(`span`,{className:`flex h-12 w-12 items-center justify-center rounded-lg border border-gray-100 bg-gray-50 text-gray-600 shadow-[0_1px_2px_rgba(30,20,10,0.04)]`,children:(0,F.jsx)(k,{className:`h-5 w-5`})}),(0,F.jsx)(`span`,{className:`text-sm font-medium text-gray-800`,children:n(`docBrowserHomeTitle`)})]})})}function Re({isDocsTab:e,onSubmit:t,onUrlInputChange:r,urlInput:i}){return e?(0,F.jsx)(`div`,{className:`flex items-center gap-2 px-3.5 py-2 bg-white border-b border-gray-100 shrink-0`,children:(0,F.jsxs)(`form`,{onSubmit:t,className:`flex-1 relative`,children:[(0,F.jsx)(C,{className:`w-3.5 h-3.5 absolute left-3 top-1/2 -translate-y-1/2 text-gray-400`}),(0,F.jsx)(`input`,{type:`text`,value:i,onChange:e=>r(e.target.value),placeholder:n(`docBrowserSearchPlaceholder`),className:`w-full h-8 pl-8 pr-3 rounded-lg bg-gray-50 border border-gray-200 text-xs text-gray-700 focus:outline-none focus:ring-1 focus:ring-primary/30 focus:border-primary/40 transition-colors placeholder:text-gray-400`})]})}):null}function ze({currentTab:e,currentUrl:t,customContent:n,iframeRef:r,iframeInstanceId:i,iframeSandbox:a,isDragging:o,isResizing:s}){return(0,F.jsxs)(`div`,{className:`flex-1 relative overflow-hidden`,children:[n||(0,F.jsx)(`iframe`,{ref:r,src:t,className:`absolute inset-0 w-full h-full border-0`,title:e?.title||`NextClaw Docs`,sandbox:a,allow:`clipboard-read; clipboard-write`},i),(s||o)&&(0,F.jsx)(`div`,{className:`absolute inset-0 z-10`})]})}function Be({currentUrl:e,isDocsTab:t}){return!t||!D(e)?null:(0,F.jsx)(`div`,{className:`flex items-center justify-between px-4 py-2 bg-gray-50 border-t border-gray-200 shrink-0`,children:(0,F.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,"data-doc-external":!0,className:`flex items-center gap-1.5 text-xs text-primary hover:text-primary-hover font-medium transition-colors`,children:[n(`docBrowserOpenExternal`),(0,F.jsx)(w,{className:`w-3 h-3`})]})})}function Ve({tabs:e,activeTabId:t,canGoBack:i,canGoForward:a,isDocked:o,isFullscreen:s,dockState:c,onGoBack:l,onGoForward:u,onOpenNewTab:d,onToggleDock:f,onSetActiveTab:p,onCloseTab:m,onClose:h,onDragStart:g,onToggleMode:_}){let v=n(`docBrowserBack`),y=n(`docBrowserClose`),b=n(`docBrowserCloseTab`),x=c?.isDocked?c.removable?n(`sideDockUnpinCurrent`):n(`sideDockBuiltInDocked`):n(`sideDockPinCurrent`),C=n(`docBrowserForward`),w=n(o?`docBrowserFloatMode`:`docBrowserDockMode`),ee=n(`docBrowserNewTab`);return(0,F.jsx)(Ie,{testId:`doc-browser-tab-strip`,actionsTestId:`doc-browser-tab-actions`,tabs:e.map(e=>({key:e.id,label:e.title||n(`docBrowserTabUntitled`),active:e.id===t,tooltip:e.title,closeLabel:b,closePlacement:`trailing`,onSelect:()=>p(e.id),onClose:()=>m(e.id)})),actions:[{key:`back`,disabled:!i,icon:(0,F.jsx)(S,{className:`h-3.5 w-3.5`}),label:v,onClick:l},{key:`forward`,disabled:!a,icon:(0,F.jsx)(O,{className:`h-3.5 w-3.5`}),label:C,onClick:u},{key:`new-tab`,icon:(0,F.jsx)(T,{className:`h-3.5 w-3.5`}),label:ee,onClick:d},...c?.canDock?[{key:`dock`,disabled:c.isDocked&&!c.removable,icon:c.isDocked&&c.removable?(0,F.jsx)(M,{className:`h-3.5 w-3.5`}):(0,F.jsx)(N,{className:`h-3.5 w-3.5`}),label:x,onClick:()=>f?.()}]:[],...s?[]:[{key:`mode`,icon:o?(0,F.jsx)(A,{className:`h-3.5 w-3.5`}):(0,F.jsx)(j,{className:`h-3.5 w-3.5`}),label:w,onClick:_}],{key:`close`,icon:(0,F.jsx)(E,{className:`h-3.5 w-3.5`}),label:y,onClick:h}],className:r(`h-11 gap-2 px-2.5 bg-background border-[#f1e7d4] shrink-0 select-none`,s&&`h-[calc(env(safe-area-inset-top,0px)+2.75rem)] pt-[env(safe-area-inset-top,0px)]`),scrollClassName:`doc-browser-tab-scrollbar flex h-full items-center gap-1.5`,tabsClassName:`items-center gap-1.5`,actionsClassName:`h-full items-center gap-1`,actionButtonClassName:`rounded-md p-1.5 hover:text-gray-700 disabled:opacity-60`,tabBaseClassName:`group inline-flex min-w-0 items-center gap-1 h-7 px-1.5 rounded-lg text-xs border max-w-[220px] shrink-0 transition-colors`,activeTabClassName:`bg-amber-50/80 border-amber-200 text-amber-900 shadow-[0_1px_2px_rgba(30,20,10,0.04)]`,inactiveTabClassName:`bg-[#f9f8f5] border-[#eee3d1] text-[#78644d] hover:bg-[#fff7ea] hover:text-[#2f2212]`,labelClassName:`px-1 text-xs font-normal`,onPointerDown:!o&&!s?g:void 0,onScrollPointerDown:e=>e.stopPropagation()})}function He({children:e,className:t,style:n,defaultWidth:i=420,minWidth:a=320,maxWidth:o=860,overlay:s=!1,...c}){let l=(0,P.useRef)(null),[u,d]=(0,P.useState)(!1),[f,p]=(0,P.useState)(i),m=e=>{if(s)return;e.preventDefault(),e.stopPropagation(),e.currentTarget.setPointerCapture?.(e.pointerId),d(!0),l.current={startX:e.clientX,startWidth:f};let t=e=>{let t=l.current;if(!t)return;let n=t.startWidth+t.startX-e.clientX;p(Math.max(a,Math.min(o,n)))},n=()=>{d(!1),l.current=null,window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,n)};window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,n)};return(0,F.jsxs)(`aside`,{...c,className:r(`relative flex h-full min-h-0 shrink-0 overflow-hidden bg-white`,s?`fixed inset-0 z-40`:`border-l border-gray-200`,t),style:s?n:{...n,width:f},children:[s?null:(0,F.jsx)(`div`,{className:`absolute left-0 top-0 z-20 h-full w-3 cursor-ew-resize transition-colors hover:bg-primary/10`,"data-testid":`resizable-right-panel-handle`,onPointerDown:m}),(0,F.jsx)(`div`,{className:`flex h-full min-h-0 w-full flex-col overflow-hidden`,children:e}),u?(0,F.jsx)(`div`,{className:`absolute inset-0 z-10 cursor-ew-resize`,"data-testid":`resizable-right-panel-resize-shield`}):null]})}var Q=40,Ue=360,We=400,Ge=`allow-same-origin allow-scripts allow-popups allow-forms`;function Ke(e,t){return t?e?.getIframeSandbox?.(t)??Ge:Ge}function qe(e,t,n){return(0,P.useCallback)(()=>{if(n?.canDock){if(n.isDocked){n.removable&&e?.unpinTab(t);return}e?.pinTab(t)}},[t,e,n])}function $(e,t,n){return Math.min(n,Math.max(t,e))}function Je(){return{x:Math.max(Q,window.innerWidth-520),y:80,w:480,h:600}}function Ye({customTabRenderers:e={},displayMode:t=`desktop`,dockControls:n}){let{isOpen:i,mode:a,tabs:o,activeTabId:s,activeHistory:c,activeHistoryIndex:l,currentTab:u,open:d,openTarget:f,openNewTab:p,close:m,toggleMode:h,goBack:g,goForward:_,navigate:v,syncUrl:y,setActiveTab:b,closeTab:x}=te(),[S,C]=(0,P.useState)(``),[w,T]=(0,P.useState)(0),[E,D]=(0,P.useState)(Je),[O,k]=(0,P.useState)(null),A=(0,P.useRef)(null),j=u?.currentUrl??re,M=u?.navVersion??0,N=`${s}:${M}:${w}`,I=(0,P.useRef)(null),ae=(0,P.useRef)(M),L=u?.kind===`docs`,R=u?.kind===ee,oe=l>0,z=l<c.length-1,B=u?e[u.kind]:void 0,V=n?.getDockState(u);(0,P.useEffect)(()=>{if(!L){C(``);return}try{C(new URL(j).pathname)}catch{C(j)}},[j,s,L]),(0,P.useEffect)(()=>{if(!L){I.current=null;return}if(M!==ae.current){ae.current=M,I.current=ne(j);return}if(A.current?.contentWindow)try{let e=new URL(j).pathname;I.current=ne(j),A.current.contentWindow.postMessage({type:`docs-navigate`,path:e},`*`)}catch{}},[j,M,L]),(0,P.useEffect)(()=>{let e=e=>{if(L&&e.data?.type===`docs-route-change`&&typeof e.data.url==`string`){let t=ne(e.data.url);if(I.current&&t!==I.current)return;I.current=null,y(e.data.url)}};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[j,y,L]),(0,P.useEffect)(()=>{if(!u||!B?.onIframeMessage)return;let e=e=>{B.onIframeMessage?.({event:e,iframe:A.current,iframeInstanceId:N,tab:u})};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[u,B,N]);let H=(0,P.useCallback)(e=>{e.preventDefault(),k({kind:`drag`,startX:e.clientX,startY:e.clientY,startRect:E})},[E]),U=(0,P.useCallback)(e=>t=>{t.preventDefault(),t.stopPropagation(),k({kind:`resize`,edge:e,startX:t.clientX,startY:t.clientY,startRect:E})},[E]);(0,P.useEffect)(()=>{if(!O)return;let e=e=>{let{startRect:t,startX:n,startY:r}=O,i=e.clientX-n,a=e.clientY-r;if(O.kind===`drag`){D({...t,x:$(t.x+i,Q,window.innerWidth-Q-t.w),y:$(t.y+a,Q,window.innerHeight-Q-t.h)});return}if(O.edge===`left`||O.edge===`top`){let e=O.edge===`left`,n=e?t.x+t.w:t.y+t.h,r=$(e?t.x+i:t.y+a,Q,n-(e?Ue:We));D(e?{...t,x:r,w:n-r}:{...t,y:r,h:n-r});return}let o=$(t.x+t.w+i,t.x+Ue,window.innerWidth-Q),s=$(t.y+t.h+a,t.y+We,window.innerHeight-Q);D({...t,w:O.edge===`bottom`?t.w:o-t.x,h:O.edge===`right`?t.h:s-t.y})},t=()=>k(null);return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[O]);let se=(0,P.useCallback)(e=>{if(e.preventDefault(),!L)return;let t=S.trim();t&&(t.startsWith(`/`)?v(`${re}${t}`):t.startsWith(`http`)?v(t):v(`${re}/${t}`))},[S,v,L]),W=(0,P.useCallback)(()=>{T(e=>e+1)},[]),G=qe(n,u,V);if(!i)return null;let K=a===`docked`,q=t===`fullscreen`,J=u?{currentUrl:j,open:d,openTarget:f,refreshIframe:W,tab:u}:void 0,ce=J?B?.renderToolbar?.(J):null,le=J?B?.renderContent?.(J)??(R?(0,F.jsx)(Le,{}):null):null,ue=Ke(B,u),Y=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Ve,{tabs:o,activeTabId:s,canGoBack:oe,canGoForward:z,dockState:V,isDocked:K,isFullscreen:q,onGoBack:g,onGoForward:_,onOpenNewTab:p,onToggleDock:G,onSetActiveTab:b,onCloseTab:x,onClose:m,onDragStart:H,onToggleMode:h}),(0,F.jsx)(Re,{isDocsTab:L,onSubmit:se,onUrlInputChange:C,urlInput:S}),ce,(0,F.jsx)(ze,{currentTab:u,currentUrl:j,customContent:le,iframeRef:A,iframeInstanceId:N,iframeSandbox:ue,isDragging:O?.kind===`drag`,isResizing:O?.kind===`resize`}),(0,F.jsx)(Be,{currentUrl:j,isDocsTab:L})]});return K&&!q?(0,F.jsx)(He,{"data-testid":`doc-browser-panel`,defaultWidth:420,minWidth:320,maxWidth:860,children:Y}):(0,F.jsxs)(`div`,{"data-testid":`doc-browser-panel`,className:r(`flex flex-col bg-white overflow-hidden relative`,q?`fixed inset-0 z-[9999] h-[100dvh] w-screen rounded-none border-0 shadow-2xl`:`rounded-2xl shadow-2xl border border-gray-200`),style:q?void 0:{position:`fixed`,left:E.x,top:E.y,width:E.w,height:E.h,zIndex:9999},children:[Y,!K&&!q&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`absolute top-0 left-0 h-3 w-full cursor-ns-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-top`,onPointerDown:U(`top`)}),(0,F.jsx)(`div`,{className:`absolute top-0 left-0 w-3 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-left`,onPointerDown:U(`left`)}),(0,F.jsx)(`div`,{className:`absolute top-0 right-0 w-3 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-right`,onPointerDown:U(`right`)}),(0,F.jsx)(`div`,{className:`absolute bottom-0 left-0 h-3 w-full cursor-ns-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-bottom`,onPointerDown:U(`bottom`)}),(0,F.jsx)(`div`,{className:`absolute bottom-0 right-0 w-4 h-4 cursor-se-resize z-30 flex items-center justify-center text-gray-300 hover:text-gray-500 transition-colors`,"data-testid":`doc-browser-resize-bottom-right`,onPointerDown:U(`bottom-right`),children:(0,F.jsx)(ie,{className:`w-3 h-3 rotate-[-45deg]`})})]})]})}export{je as a,Me as c,Te as d,Ee as f,O as g,k as h,Z as i,ke as l,A as m,He as n,X as o,De as p,Ie as r,Ae as s,Ye as t,Oe as u};