@nextclaw/ui 0.12.30 → 0.12.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +130 -0
- package/dist/assets/{api-CKKNxbsy.js → api-rASx2-N4.js} +1 -1
- package/dist/assets/{app-manager-provider-BM1hziPv.js → app-manager-provider-CUkcbdWk.js} +1 -1
- package/dist/assets/{channels-list-page-B6JASU3q.js → channels-list-page-CE_9jne_.js} +1 -1
- package/dist/assets/{chat-page-C_lQm75P.js → chat-page-BMJLtk3O.js} +1 -1
- package/dist/assets/cpu-DKc3bQic.js +3 -0
- package/dist/assets/desktop-DJpQzxsz.js +3 -0
- package/dist/assets/{desktop-update-config-jWt63bXG.js → desktop-update-config-DAD9JN9Q.js} +1 -1
- package/dist/assets/{dialog-DWZeMf9V.js → dialog-CR80q3Rm.js} +1 -1
- package/dist/assets/{dist-DN-YM_0Y.js → dist-NBjcwlsw.js} +1 -1
- package/dist/assets/doc-browser-B19cYGxa.js +1 -0
- package/dist/assets/{doc-browser-CAhfnm0D.js → doc-browser-CDBYvb8A.js} +1 -1
- package/dist/assets/doc-browser-IRh6LCzu.js +1 -0
- package/dist/assets/{doc-browser-context-FukQHvyo.js → doc-browser-context-BPeeiNJ_.js} +1 -1
- package/dist/assets/{es2015-ZJ-nWL4L.js → es2015-CVAuMqlM.js} +1 -1
- package/dist/assets/index-BEn7o-oH.js +100 -0
- package/dist/assets/index-DV57tBmg.css +1 -0
- package/dist/assets/{marketplace-page-BdiLk2eA.js → marketplace-page-B3Q_uKOZ.js} +2 -2
- package/dist/assets/marketplace-page-CCq1bFb1.js +1 -0
- package/dist/assets/{mcp-marketplace-page-DTCFgcDl.js → mcp-marketplace-page-D9maE_Sf.js} +1 -1
- package/dist/assets/mcp-marketplace-page-O5AQzBYl.js +1 -0
- package/dist/assets/{model-config-QChwQThC.js → model-config-BsEQYJvz.js} +1 -1
- package/dist/assets/{notice-card-BM2_YNoc.js → notice-card-CF4AJPM3.js} +1 -1
- package/dist/assets/{popover-2H9DS7Cv.js → popover-DeAliE_4.js} +1 -1
- package/dist/assets/{provider-scoped-model-input-DsZJ44ZV.js → provider-scoped-model-input-B8LJ6RCt.js} +1 -1
- package/dist/assets/{providers-list-lpGJJ21M.js → providers-list-5mA-2zno.js} +1 -1
- package/dist/assets/remote-DiPWGRZc.js +1 -0
- package/dist/assets/runtime-config-page-BSoKMvCh.js +1 -0
- package/dist/assets/{search-config-CJOrq3h0.js → search-config-DxWm2GrK.js} +1 -1
- package/dist/assets/{secrets-config-C17j6mjS.js → secrets-config-qutTAlFx.js} +1 -1
- package/dist/assets/{select-C2c10F3e.js → select-HI5kiwX_.js} +1 -1
- package/dist/assets/{setting-row-CB_ZFbIZ.js → setting-row-B4QnghjV.js} +1 -1
- package/dist/assets/{tag-chip-CrQfVN3A.js → tag-chip-BPgMfp9l.js} +1 -1
- package/dist/assets/{use-config-jAYudJxy.js → use-config-BFqzVF8Y.js} +1 -1
- package/dist/assets/{use-infinite-scroll-loader-zzviKbU8.js → use-infinite-scroll-loader-CyNa4Vj6.js} +1 -1
- package/dist/index.html +18 -18
- package/package.json +9 -9
- package/src/app/components/layout/app-layout.test.tsx +58 -4
- package/src/app/components/layout/app-layout.tsx +2 -2
- package/src/app/components/theme-provider.tsx +0 -1
- package/src/app/hooks/use-viewport-layout.ts +0 -1
- package/src/features/chat/components/chat-session-workspace-panel.tsx +54 -51
- package/src/features/chat/components/conversation/chat-conversation-panel.test.tsx +2 -1
- package/src/features/chat/managers/chat-session-list.manager.test.ts +6 -4
- package/src/features/chat/managers/chat-session-list.manager.ts +0 -6
- package/src/features/chat/utils/chat-message-invalid-tool-arguments.utils.test.ts +79 -0
- package/src/features/chat/utils/chat-message-part.utils.ts +34 -19
- package/src/main.tsx +5 -3
- package/src/platforms/desktop/components/desktop-app-shell.test.tsx +16 -4
- package/src/platforms/desktop/components/desktop-window-chrome.tsx +56 -13
- package/src/platforms/desktop/types/desktop-update.types.ts +2 -2
- package/src/shared/components/doc-browser/doc-browser-context.tsx +0 -27
- package/src/shared/components/doc-browser/doc-browser.test.tsx +11 -9
- package/src/shared/components/doc-browser/doc-browser.tsx +37 -63
- package/src/shared/components/resizable-right-panel/resizable-right-panel.test.tsx +38 -0
- package/src/shared/components/resizable-right-panel/resizable-right-panel.tsx +46 -0
- package/dist/assets/cpu-DPPwMzoC.js +0 -3
- package/dist/assets/desktop-CmIbyIrg.js +0 -3
- package/dist/assets/doc-browser-p9DDNPWB.js +0 -1
- package/dist/assets/doc-browser-rZIQIjuw.js +0 -1
- package/dist/assets/index-CTfzteME.js +0 -100
- package/dist/assets/index-DKC9hvsP.css +0 -1
- package/dist/assets/marketplace-page-C3RVIckE.js +0 -1
- package/dist/assets/mcp-marketplace-page-BVCDibC7.js +0 -1
- package/dist/assets/remote-Dm6hKGew.js +0 -1
- package/dist/assets/runtime-config-page-CDEAJFfY.js +0 -1
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/doc-browser-p9DDNPWB.js","assets/doc-browser-rZIQIjuw.js","assets/i18n-D1144VAA.js","assets/createLucideIcon-DzY6wN61.js","assets/search-CRtQwr-h.js","assets/book-open-BcnAiKde.js","assets/external-link-CpEvG65F.js","assets/plus-B-YHtTNC.js","assets/x-BeyYA_h6.js","assets/doc-browser-context-FukQHvyo.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{_ as e,i as t,m as n,p as r,r as i,u as a}from"./i18n-D1144VAA.js";import{Dt as o,Et as s,Lt as c,Nt as l,Ot as u,Tt as d,bt as f,gt as p,mt as m,pt as h,wt as g,yt as ee}from"./api-CKKNxbsy.js";import{d as _,i as v,t as y}from"./cpu-DPPwMzoC.js";import{t as b}from"./createLucideIcon-DzY6wN61.js";import{n as te,t as ne}from"./search-CRtQwr-h.js";import{t as re}from"./book-open-BcnAiKde.js";import{i as ie,k as ae,n as oe,r as x,t as se}from"./select-C2c10F3e.js";import{t as S}from"./download-CMM8po31.js";import{t as ce}from"./key-round-DUq47t0P.js";import{h as le,n as ue}from"./app-manager-provider-BM1hziPv.js";import{n as de,t as fe}from"./settings-MWL2SMyk.js";import{t as pe}from"./refresh-cw-CrbD8EkT.js";import{t as me}from"./sparkles-BmgOD4nY.js";import{t as he}from"./x-BeyYA_h6.js";import{i as ge}from"./doc-browser-context-FukQHvyo.js";import{n as _e}from"./doc-browser-CAhfnm0D.js";import{t as ve}from"./use-config-jAYudJxy.js";import{n as ye,r as be,t as xe}from"./popover-2H9DS7Cv.js";var C=b(`AlarmClock`,[[`circle`,{cx:`12`,cy:`13`,r:`8`,key:`3y4lt7`}],[`path`,{d:`M12 9v4l2 2`,key:`1c63tq`}],[`path`,{d:`M5 3 2 6`,key:`18tl5t`}],[`path`,{d:`m22 6-3-3`,key:`1opdir`}],[`path`,{d:`M6.38 18.7 4 21`,key:`17xu3x`}],[`path`,{d:`M17.64 18.67 20 21`,key:`kv2oe2`}]]),w=b(`Bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),T=b(`BrainCircuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),E=b(`Languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),D=b(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),O=b(`Palette`,[[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`path`,{d:`M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z`,key:`12rzf8`}]]),Se=b(`Plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M9 8V2`,key:`14iosj`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z`,key:`osxo6l`}]]),Ce=b(`Shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),we=b(`Smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Te=b(`Wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),k=b(`Wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]),A=f(()=>({supported:!1,initialized:!1,busyAction:null,snapshot:null})),Ee=new class{constructor(){this.start=async()=>{let e=this.getDesktopApi();if(!e){this.markUnsupported();return}A.setState({supported:!0,initialized:!1,busyAction:`loading`});try{let t=await e.getPresenceState();A.setState({supported:!0,initialized:!0,busyAction:null,snapshot:t})}catch(e){A.setState({supported:!0,initialized:!0,busyAction:null}),c.error(`${i(`runtimePresenceLoadFailed`)}: ${this.getErrorMessage(e)}`)}},this.markUnsupported=()=>{A.setState({supported:!1,initialized:!0,busyAction:null,snapshot:null})},this.updatePreferences=async e=>{let t=this.getDesktopApi();if(!t)throw Error(i(`runtimePresenceLaunchAtLoginUnavailable`));A.setState({busyAction:`saving-preferences`});try{let n=await t.updatePresencePreferences(e);return A.setState({supported:!0,initialized:!0,snapshot:n}),c.success(i(`runtimePresenceSaved`)),n}catch(e){throw c.error(`${i(`runtimePresenceSaveFailed`)}: ${this.getErrorMessage(e)}`),e}finally{A.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:i(`error`)}},j=f(()=>({supported:!1,initialized:!1,busyAction:null,snapshot:null}));new class{constructor(){this.unsubscribe=null,this.subscriptionCount=0,this.start=async()=>{this.subscriptionCount+=1;let e=this.getDesktopApi();if(!e){j.setState({supported:!1,initialized:!0,snapshot:null});return}this.unsubscribe||=e.onUpdateStateChanged(e=>{j.setState({supported:!0,initialized:!0,snapshot:e})}),j.setState({supported:!0,initialized:!1});try{let t=await e.getUpdateState();j.setState({supported:!0,initialized:!0,snapshot:t})}catch(e){j.setState({supported:!0,initialized:!0}),c.error(`${i(`desktopUpdatesLoadFailed`)}: ${this.getErrorMessage(e)}`)}},this.stop=()=>{this.subscriptionCount=Math.max(0,this.subscriptionCount-1),!(this.subscriptionCount>0)&&(this.unsubscribe?.(),this.unsubscribe=null)},this.checkForUpdates=async()=>{let e;try{e=await this.runSnapshotCommand(`checking`,i(`desktopUpdatesCheckFailed`),async e=>await e.checkForUpdates())}catch{return}if(e.status===`up-to-date`){c.success(i(`desktopUpdatesAlreadyLatest`));return}if(e.status===`update-available`){c.success(i(`desktopUpdatesAvailable`).replace(`{version}`,e.availableVersion??i(`desktopUpdatesUnknownVersion`)));return}if(e.status===`downloaded`){c.success(i(`desktopUpdatesReadyToApply`));return}e.status===`failed`&&e.errorMessage&&c.error(e.errorMessage)},this.downloadUpdate=async()=>{let e;try{e=await this.runSnapshotCommand(`downloading`,i(`desktopUpdatesDownloadFailed`),async e=>await e.downloadUpdate())}catch{return}e.status===`downloaded`&&c.success(i(`desktopUpdatesReadyToApply`))},this.applyDownloadedUpdate=async()=>{try{await this.runSnapshotCommand(`applying`,i(`desktopUpdatesApplyFailed`),async e=>await e.applyDownloadedUpdate())}catch{return}},this.updatePreferences=async e=>{try{await this.runSnapshotCommand(`saving-preferences`,i(`desktopUpdatesPreferencesFailed`),async t=>await t.updatePreferences(e))}catch{return}},this.updateChannel=async e=>{if(j.getState().snapshot?.channel===e)return;let t;try{t=await this.runSnapshotCommand(`switching-channel`,i(`desktopUpdatesChannelChangeFailed`),async t=>await t.updateChannel(e))}catch{return}if(t.status===`update-available`&&t.availableVersion){c.success(i(`desktopUpdatesChannelChangedWithUpdate`).replace(`{channel}`,this.getChannelLabel(e)).replace(`{version}`,t.availableVersion));return}c.success(i(`desktopUpdatesChannelChanged`).replace(`{channel}`,this.getChannelLabel(e)))},this.runSnapshotCommand=async(e,t,n)=>{let r=this.getDesktopApi();if(!r)throw Error(i(`desktopUpdatesDesktopOnlyDescription`));j.setState({busyAction:e});try{let e=await n(r);return j.setState({snapshot:e}),e}catch(e){throw c.error(`${t}: ${this.getErrorMessage(e)}`),e}finally{j.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:i(`error`),this.getChannelLabel=e=>i(e===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}};function De(e,t){let n=e.toLowerCase(),r=t.toLowerCase();return n===r||n.startsWith(`${r}/`)}function Oe(e){let t=e.toLowerCase();return t===`/chat`||t.startsWith(`/chat/`)||t===`/skills`||t.startsWith(`/skills/`)||t===`/cron`||t.startsWith(`/cron/`)||t===`/agents`||t.startsWith(`/agents/`)}function ke(e){let t=e.toLowerCase();return t.startsWith(`/chat/`)&&t!==`/chat`}function Ae(e){return[{target:`/chat`,label:e(`chat`),icon:D},{target:`/skills`,label:e(`marketplaceFilterSkills`),icon:T},{target:`/agents`,label:e(`agentsPageTitle`),icon:w},{target:`/settings`,label:e(`settings`),icon:fe}]}function je(e){return[{target:`/model`,label:e(`model`),icon:y},{target:`/providers`,label:e(`providers`),icon:me},{target:`/channels`,label:e(`channels`),icon:de},{target:`/search`,label:e(`searchChannels`),icon:ne},{target:`/runtime`,label:e(`runtime`),icon:y},{target:`/updates`,label:e(`updates`),icon:S},{target:`/remote`,label:e(`remote`),icon:Te},{target:`/security`,label:e(`security`),icon:Ce},{target:`/secrets`,label:e(`secrets`),icon:ce},{target:`/cron`,label:e(`cron`),icon:C},{target:`/marketplace/plugins`,label:e(`marketplaceFilterPlugins`),icon:Se},{target:`/marketplace/mcp`,label:e(`marketplaceFilterMcp`),icon:k}]}function M(e){return[{target:`/language`,label:e(`language`),icon:E},...je(e)]}function Me(e){let t=e.toLowerCase();return t===`/settings`?!0:M(e=>e).some(e=>De(t,e.target))}function Ne(e,t){let n=e.toLowerCase(),r=M(t);if(ke(n))return{title:t(`chat`),backTarget:`/chat`,backLabel:t(`chat`)};if(n===`/chat`)return{title:t(`chat`),backTarget:null,backLabel:null};if(n===`/skills`||n.startsWith(`/skills/`))return{title:t(`marketplaceFilterSkills`),backTarget:null,backLabel:null};if(n===`/agents`||n.startsWith(`/agents/`))return{title:t(`agentsPageTitle`),backTarget:null,backLabel:null};if(n===`/settings`)return{title:t(`settings`),backTarget:null,backLabel:null};for(let e of r)if(De(n,e.target))return{title:e.label,backTarget:`/settings`,backLabel:t(`settings`)};return{title:t(`settings`),backTarget:null,backLabel:null}}var Pe=`nextclaw.ui.theme`,N=[{value:`warm`,labelKey:`themeWarm`},{value:`cool`,labelKey:`themeCool`}],P=`warm`,F=!1,I=new Set;function Fe(e){return e===`warm`||e===`cool`}function L(e){typeof document>`u`||document.documentElement.setAttribute(`data-theme`,e)}function Ie(){if(typeof window>`u`)return`warm`;try{let e=window.localStorage.getItem(Pe);if(Fe(e))return e}catch{}return`warm`}function R(){return F||=(P=Ie(),L(P),!0),P}function Le(){return F?P:R()}function Re(e){if(R(),e!==P){if(P=e,L(P),typeof window<`u`)try{window.localStorage.setItem(Pe,P)}catch{}I.forEach(e=>e(P))}}function ze(e){return I.add(e),()=>{I.delete(e)}}var z=r(),Be={healthy:`bg-emerald-500 shadow-[0_0_0_3px_rgba(16,185,129,0.14)]`,attention:`bg-amber-400 shadow-[0_0_0_3px_rgba(251,191,36,0.16)]`,inactive:`bg-gray-300 shadow-[0_0_0_3px_rgba(156,163,175,0.12)]`};function Ve(){let e=p(),t=e.actionLabel===i(`runtimeStatusRestartAction`),n=async()=>{if(t)try{let e=await ee.runRuntimeControlAction(`restart-service`);c.success(e.message)}catch(e){let t=e instanceof Error?e.message:i(`runtimeControlActionFailed`);c.error(`${i(`runtimeControlActionFailed`)}: ${t}`)}};return(0,z.jsxs)(xe,{children:[(0,z.jsx)(be,{asChild:!0,children:(0,z.jsx)(`button`,{type:`button`,className:`inline-flex items-center justify-center rounded-full p-0.5 transition-transform hover:scale-105`,"aria-label":e.title,title:e.title,"data-testid":`runtime-status-entry`,children:(0,z.jsx)(`span`,{className:a(`h-2.5 w-2.5 rounded-full`,Be[e.tone])})})}),(0,z.jsxs)(ye,{align:`start`,sideOffset:10,className:`w-[290px] space-y-3 rounded-2xl border border-gray-200 bg-white p-4`,children:[(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-gray-900`,children:e.title}),(0,z.jsx)(`p`,{className:`text-xs leading-5 text-gray-600`,children:e.description})]}),e.reasonLines.length>0?(0,z.jsx)(`div`,{className:`space-y-2`,children:e.reasonLines.map(e=>(0,z.jsx)(`div`,{className:`rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-5 text-amber-900`,children:e},e))}):null,e.actionLabel?(0,z.jsxs)(`div`,{className:`flex items-center justify-between border-t border-gray-100 pt-1`,children:[(0,z.jsx)(`span`,{className:`text-[11px] text-gray-500`,children:i(`runtimeStatusActionHint`)}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>void n(),disabled:e.isBusy,className:`text-sm font-semibold text-sky-600 transition-colors hover:text-sky-700 disabled:text-gray-400`,children:e.isBusy?i(`runtimeStatusRestartingAction`):e.actionLabel})]}):null]})]})}var B=e(n(),1);function V({className:e,density:t=`sidebar`,suffix:n}){let{data:r}=ve(),i=r?.name??`NextClaw`,o=r?.productVersion?.trim(),s=o?`v${o}`:null,c=n??(0,z.jsx)(Ve,{}),l=typeof window<`u`&&window.nextclawDesktop?.platform===`darwin`,u=t===`chrome`;return(0,z.jsxs)(`div`,{className:a(e??`flex min-w-0 items-center gap-2`,l&&`pl-[58px]`),children:[(0,z.jsx)(`div`,{className:a(`flex shrink-0 items-center justify-center overflow-hidden`,`h-6 w-6 rounded-md`),children:(0,z.jsx)(`img`,{src:`/logo.svg`,alt:i,className:`h-full w-full object-contain`})}),(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,z.jsx)(`span`,{className:a(`shrink-0 font-semibold text-gray-800`,u?`text-[15px]`:`text-[14px]`),children:i}),s?(0,z.jsx)(He,{versionLabel:s,density:t}):null]}),(0,z.jsx)(Ue,{}),c?(0,z.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:c}):null]})]})}function He({versionLabel:e,density:t}){let[n,r]=(0,B.useState)(!1);return(0,z.jsxs)(`span`,{className:`relative min-w-0 flex-1`,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onFocus:()=>r(!0),onBlur:()=>r(!1),children:[(0,z.jsx)(`span`,{tabIndex:0,"aria-label":e,className:a(`block min-w-0 truncate font-medium text-gray-500 outline-none`,`text-[12px]`),children:e}),n?(0,z.jsx)(`span`,{className:`pointer-events-none absolute left-0 top-full z-[var(--z-tooltip)] mt-1 w-max max-w-none whitespace-nowrap rounded-md border bg-popover px-3 py-1.5 text-xs font-medium text-popover-foreground shadow-md`,children:e}):null]})}function Ue(){let{supported:e,busyAction:t,snapshot:n}=m();return!e||!n?null:n.status===`downloading`||n.status===`blocked`||n.status===`failed`?(0,z.jsx)(We,{snapshot:n}):n.status===`downloaded`?(0,z.jsx)(`button`,{type:`button`,className:`inline-flex h-5 shrink-0 items-center rounded-full bg-emerald-50 px-2 text-[11px] font-semibold leading-none text-emerald-700 ring-1 ring-emerald-100 transition-colors hover:bg-emerald-100 disabled:opacity-70`,disabled:t===`applying`,onClick:()=>void h.applyDownloadedUpdate(),children:i(t===`applying`?`desktopUpdatesInlineApplying`:`desktopUpdatesInlineReady`)}):n.status===`update-available`?(0,z.jsx)(`button`,{type:`button`,className:`inline-flex h-5 shrink-0 items-center rounded-full bg-amber-50 px-2 text-[11px] font-semibold leading-none text-amber-700 ring-1 ring-amber-100 transition-colors hover:bg-amber-100 disabled:opacity-70`,disabled:t===`downloading`,onClick:()=>void h.downloadUpdate(),children:i(t===`downloading`?`desktopUpdatesInlineDownloading`:`desktopUpdatesInlineDownload`)}):null}function We({snapshot:e}){if(e.status===`blocked`||e.status===`failed`)return(0,z.jsx)(Ge,{snapshot:e});let t=e.status===`downloading`?Ke(e):null;return t?(0,z.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded-full bg-amber-50 px-2 text-[11px] font-semibold leading-none text-amber-700 ring-1 ring-amber-100 transition-colors hover:bg-amber-100 disabled:opacity-70`,title:i(`updates`),children:t}):null}function Ge({snapshot:e}){let t=e.status===`failed`?i(`desktopUpdatesStatusFailed`):i(`desktopUpdatesStatusBlocked`),n=e.recoveryCommand?.trim()||null,r=e.errorMessage?.trim()||e.blockReason?.trim()||null,a=[t,e.status===`blocked`&&e.blockReason?i(`desktopUpdatesBlockedRootCause.${e.blockReason}`):null,r,n].filter(Boolean).join(`
|
|
3
|
-
`);return(0,z.jsx)(`span`,{role:`img`,"aria-label":t,title:a,tabIndex:0,className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-amber-50 text-[13px] font-bold leading-none text-amber-700 ring-1 ring-amber-100`,children:`!`})}function Ke(e){let t=e.progress?.percent;return t==null?i(`desktopUpdatesInlineDownloading`):i(`desktopUpdatesInlineDownloadingPercent`).replace(`{percent}`,String(t))}var qe={default:{row:`gap-3 px-3 py-2.5 text-[14px]`,icon:`h-[17px] w-[17px]`,value:`text-xs`,gap:`gap-3`},compact:{row:`gap-2.5 px-3 py-2 text-[13px]`,icon:`h-4 w-4`,value:`text-[11px]`,gap:`gap-2.5`}};function H(e){return qe[e]}function U({to:e,label:t,icon:n,density:r=`default`,className:i}){let o=H(r);return(0,z.jsx)(v,{to:e,className:({isActive:e})=>a(`group flex w-full items-center rounded-xl font-medium transition-colors duration-base`,o.row,e?`bg-gray-200 text-gray-900 shadow-sm`:`text-gray-600 hover:bg-gray-200/60 hover:text-gray-900`,i),children:({isActive:e})=>(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(n,{className:a(o.icon,`transition-colors`,e?`text-gray-900`:`text-gray-500 group-hover:text-gray-800`)}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:t})]})})}function W({label:e,icon:t,onClick:n,density:r=`default`,className:i,labelClassName:o,trailing:s,trailingClassName:c,testId:l,trailingTestId:u}){let d=H(r);return(0,z.jsxs)(`button`,{type:`button`,onClick:n,className:a(`flex w-full items-center rounded-xl font-medium text-gray-600 transition-all duration-base hover:bg-gray-200/60 hover:text-gray-800`,d.row,i),"data-testid":l,children:[(0,z.jsx)(t,{className:a(d.icon,`shrink-0 text-gray-400`)}),(0,z.jsx)(`span`,{className:a(`min-w-0 flex-1 text-left`,o),children:e}),s?(0,z.jsx)(`span`,{className:a(`shrink-0 text-gray-500`,d.value,c),"data-testid":u,children:s}):null]})}function G({label:e,icon:t,value:n,valueLabel:r,onValueChange:i,density:o=`default`,children:s}){let c=H(o);return(0,z.jsxs)(se,{value:n,onValueChange:i,children:[(0,z.jsxs)(ie,{className:a(`h-auto w-full rounded-xl border-0 bg-transparent font-medium text-gray-600 shadow-none hover:bg-gray-200/60 focus:ring-0`,c.row),children:[(0,z.jsxs)(`div`,{className:a(`flex min-w-0 items-center`,c.gap),children:[(0,z.jsx)(t,{className:a(c.icon,`text-gray-400`)}),(0,z.jsx)(`span`,{className:`text-left`,children:e})]}),(0,z.jsx)(`span`,{className:a(`ml-auto text-gray-500`,c.value),children:r})]}),(0,z.jsx)(oe,{children:s})]})}var K=`nextclaw-pwa-install-banner-dismissed`,q=`nextclaw-pwa-install-banner-dismissed-until`;function Je(){let e=J();return e?e.getItem(`nextclaw-pwa-install-banner-dismissed`)===`1`?!0:Ze(e):!1}function Ye(){let e=J();e?.setItem(K,`1`),e?.removeItem(q)}function Xe(){let e=J();e?.removeItem(K),e?.removeItem(q)}function J(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Ze(e){let t=e.getItem(q);if(!t)return!1;let n=Number.parseInt(t,10);return e.removeItem(q),!Number.isFinite(n)||n<=Date.now()?!1:(e.setItem(K,`1`),!0)}function Qe(){return{initialized:!1,installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`,dismissedInstallPrompt:Je(),updateAvailable:!1,registrationFailed:!1}}var Y=f(()=>Qe()),X=`nextclaw-pwa-dev-sw-reset`,Z=new class{constructor(){this.started=!1,this.registration=null,this.reloadWhenControllerChanges=!1,this.start=async()=>{if(!(this.started||typeof window>`u`)&&(this.started=!0,!(!(`serviceWorker`in navigator)||!this.isEligibleInstallContext()))){if(this.isDevelopmentServer()){await this.cleanupDevelopmentRegistrations();return}try{let e=await navigator.serviceWorker.register(`/sw.js`);this.registration=e,this.bindRegistration(e),navigator.serviceWorker.addEventListener(`controllerchange`,this.handleControllerChange),await this.syncUpdateAvailability()}catch{Y.setState({registrationFailed:!0})}}},this.syncUpdateAvailability=async()=>{if(typeof window>`u`||!(`serviceWorker`in navigator)||typeof navigator.serviceWorker.getRegistration!=`function`){Y.setState({updateAvailable:!1});return}let e=this.registration??await navigator.serviceWorker.getRegistration(`/sw.js`)??null;Y.setState({updateAvailable:this.shouldSurfaceUpdate(e)})},this.applyUpdate=async()=>{let e=this.registration??await navigator.serviceWorker.getRegistration(`/sw.js`)??null;if(!e){window.location.reload();return}e.waiting||await e.update();let t=e.waiting;if(!t){window.location.reload();return}this.reloadWhenControllerChanges=!0,t.postMessage({type:`SKIP_WAIT`})},this.stop=()=>{!this.started||typeof window>`u`||!(`serviceWorker`in navigator)||(navigator.serviceWorker.removeEventListener(`controllerchange`,this.handleControllerChange),this.started=!1,this.registration=null,this.reloadWhenControllerChanges=!1)},this.bindRegistration=e=>{e.addEventListener(`updatefound`,()=>{let t=e.installing;t&&t.addEventListener(`statechange`,()=>{t.state===`installed`&&this.syncUpdateAvailability()})})},this.handleControllerChange=()=>{this.reloadWhenControllerChanges&&(this.reloadWhenControllerChanges=!1,window.location.reload())},this.isEligibleInstallContext=()=>window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>!1,this.shouldSurfaceUpdate=e=>!e?.waiting||!navigator.serviceWorker.controller?!1:Y.getState().installability===`installed`,this.cleanupDevelopmentRegistrations=async()=>{if(typeof navigator.serviceWorker.getRegistrations!=`function`)return;let e=(await navigator.serviceWorker.getRegistrations()).filter(e=>[e.active?.scriptURL,e.installing?.scriptURL,e.waiting?.scriptURL].filter(e=>!!e).some(e=>e.endsWith(`/sw.js`)));if(e.length===0){this.clearDevResetMarker();return}if(await Promise.all(e.map(async e=>await e.unregister())),await this.clearNextClawCaches(),navigator.serviceWorker.controller&&!this.hasDevResetMarker()){this.setDevResetMarker(),window.location.reload();return}this.clearDevResetMarker()},this.clearNextClawCaches=async()=>{if(typeof window>`u`||!(`caches`in window)||typeof caches.keys!=`function`)return;let e=await caches.keys();await Promise.all(e.filter(e=>e.startsWith(`nextclaw-ui-`)).map(async e=>await caches.delete(e)))},this.hasDevResetMarker=()=>{try{return window.sessionStorage.getItem(X)===`1`}catch{return!1}},this.setDevResetMarker=()=>{try{window.sessionStorage.setItem(X,`1`)}catch{}},this.clearDevResetMarker=()=>{try{window.sessionStorage.removeItem(X)}catch{}}}},Q=new class{constructor(){this.started=!1,this.deferredPrompt=null,this.displayModeMediaQuery=null,this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.addEventListener(`appinstalled`,this.handleAppInstalled),typeof window.matchMedia==`function`&&(this.displayModeMediaQuery=window.matchMedia(`(display-mode: standalone)`),this.bindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged)),this.refreshState())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.removeEventListener(`appinstalled`,this.handleAppInstalled),this.displayModeMediaQuery&&=(this.unbindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged),null),this.deferredPrompt=null,this.started=!1)},this.resetForTests=()=>{this.stop(),Y.setState(Qe())},this.refreshState=()=>{let e=this.resolveInstallability();Y.setState(t=>({...t,initialized:!0,installability:e.installability,installMethod:e.installMethod,blockedReason:e.blockedReason,dismissedInstallPrompt:Je()})),Z.syncUpdateAvailability()},this.dismissInstallPrompt=()=>{Ye(),Y.setState({dismissedInstallPrompt:!0})},this.promptInstall=async()=>{let e=this.resolveInstallability();if(e.installability!==`available`)return`unavailable`;if(e.installMethod===`manual`||!this.deferredPrompt)return`manual`;this.deferredPrompt.prompt();let t=await this.deferredPrompt.userChoice;return this.deferredPrompt=null,t.outcome===`accepted`?(Xe(),this.refreshState(),c.success(i(`pwaInstallAccepted`)),`accepted`):(this.dismissInstallPrompt(),this.refreshState(),`dismissed`)},this.handleBeforeInstallPrompt=e=>{e.preventDefault(),this.deferredPrompt=e,this.refreshState()},this.handleAppInstalled=()=>{this.deferredPrompt=null,Xe(),Y.setState({dismissedInstallPrompt:!0}),c.success(i(`pwaInstalledToast`)),this.refreshState()},this.handleDisplayModeChanged=()=>{this.refreshState()},this.resolveInstallability=()=>this.isDevelopmentServer()?{installability:`unsupported`,installMethod:`none`,blockedReason:`dev-server`}:this.hasDesktopHost()?{installability:`suppressed`,installMethod:`none`,blockedReason:`desktop-host`}:this.isStandalone()?{installability:`installed`,installMethod:`none`,blockedReason:null}:this.hasInstallSurfaceSupport()?this.isEligibleInstallContext()?{installability:`available`,installMethod:this.deferredPrompt?`prompt`:`manual`,blockedReason:null}:{installability:`unsupported`,installMethod:`none`,blockedReason:`insecure-context`}:{installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`},this.hasDesktopHost=()=>typeof window<`u`&&!!window.nextclawDesktop,this.hasInstallSurfaceSupport=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&`serviceWorker`in navigator,this.isEligibleInstallContext=()=>typeof window>`u`?!1:window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>typeof window<`u`&&!1,this.isStandalone=()=>{if(typeof window>`u`)return!1;let e=window.navigator;return typeof window.matchMedia==`function`&&window.matchMedia(`(display-mode: standalone)`).matches||e.standalone===!0},this.bindDisplayModeListener=(e,t)=>{if(`addEventListener`in e){e.addEventListener(`change`,t);return}e.addListener?.(t)},this.unbindDisplayModeListener=(e,t)=>{if(`removeEventListener`in e){e.removeEventListener(`change`,t);return}e.removeListener?.(t)}}};function $e(){let e=Y(e=>e.installability);return(0,z.jsx)(`span`,{className:a(`inline-flex items-center rounded-full border px-3 py-1 text-xs font-medium`,e===`installed`?`bg-emerald-50 text-emerald-700 border-emerald-200`:e===`available`?`bg-amber-50 text-amber-700 border-amber-200`:`bg-gray-100 text-gray-600 border-gray-200`),children:et(e)})}function et(e){return i(e===`available`?`pwaInstallStatusAvailable`:e===`installed`?`pwaInstallStatusInstalled`:e===`suppressed`?`pwaInstallStatusDesktopHost`:`pwaInstallStatusUnavailable`)}function tt(e,t,n){return i(e===`installed`?`pwaInstallCardInstalled`:e===`suppressed`?`pwaInstallCardSuppressed`:e===`available`&&t===`prompt`?`pwaInstallCardPrompt`:e===`available`?`pwaInstallCardManual`:n===`insecure-context`?`pwaInstallCardInsecureContext`:n===`dev-server`?`pwaInstallCardDevServer`:`pwaInstallCardUnsupported`)}function nt(){let e=Y(e=>e.installability),t=Y(e=>e.installMethod),n=Y(e=>e.blockedReason);return(0,z.jsxs)(g,{children:[(0,z.jsxs)(o,{className:`flex flex-row items-start justify-between gap-4 space-y-0`,children:[(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(u,{children:i(`pwaInstallTitle`)}),(0,z.jsx)(s,{children:i(`pwaInstallDescription`)})]}),(0,z.jsx)($e,{})]}),(0,z.jsxs)(d,{className:`space-y-4`,children:[(0,z.jsx)(`div`,{className:`rounded-2xl border border-gray-200 bg-gray-50/90 p-4`,children:(0,z.jsx)(`p`,{className:`text-sm leading-6 text-gray-700`,children:tt(e,t,n)})}),e===`available`&&t===`prompt`?(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,z.jsxs)(l,{type:`button`,className:`gap-2`,onClick:()=>{Q.promptInstall()},children:[(0,z.jsx)(S,{className:`h-4 w-4`}),i(`pwaInstallAction`)]}),(0,z.jsx)(`p`,{className:`text-sm text-gray-500`,children:i(`pwaInstallPromptHint`)})]}):null,e===`available`&&t===`manual`?(0,z.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl border border-dashed border-gray-300 bg-white p-4`,children:[(0,z.jsx)(we,{className:`mt-0.5 h-4 w-4 text-gray-500`}),(0,z.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:i(`pwaInstallManualHint`)})]}):null]})]})}function rt(){let e=Y(e=>e.installability),t=Y(e=>e.installMethod),n=Y(e=>e.dismissedInstallPrompt);return e!==`available`||t!==`prompt`||n?null:(0,z.jsxs)(`div`,{className:`fixed bottom-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:i(`pwaInstallBannerTitle`)}),(0,z.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:i(`pwaInstallBannerDescription`)})]}),(0,z.jsx)(`button`,{type:`button`,"aria-label":i(`pwaInstallDismiss`),className:`rounded-full p-1 text-gray-400 transition hover:bg-gray-100 hover:text-gray-600`,onClick:()=>{Q.dismissInstallPrompt()},children:(0,z.jsx)(he,{className:`h-4 w-4`})})]}),(0,z.jsxs)(`div`,{className:`mt-4 flex items-center gap-3`,children:[(0,z.jsxs)(l,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{Q.promptInstall()},children:[(0,z.jsx)(S,{className:`h-4 w-4`}),i(`pwaInstallAction`)]}),(0,z.jsx)(l,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{Q.dismissInstallPrompt()},children:i(`pwaInstallDismiss`)})]})]})}function it(){let e=Y(e=>e.updateAvailable),t=Y(e=>e.installability);return!e||t!==`installed`?null:(0,z.jsxs)(`div`,{className:`fixed top-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,z.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:i(`pwaUpdateBannerTitle`)}),(0,z.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:i(`pwaUpdateBannerDescription`)})]})}),(0,z.jsx)(`div`,{className:`mt-4`,children:(0,z.jsxs)(l,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{Z.applyUpdate()},children:[(0,z.jsx)(pe,{className:`h-4 w-4`}),i(`pwaUpdateAction`)]})})]})}var $=!1;function at(){$||typeof window>`u`||($=!0,Q.start(),Z.start())}var ot={warm:`#F9F8F5`,cool:`#F8FAFB`},st=new class{constructor(){this.syncTheme=e=>{if(typeof document>`u`)return;let t=ot[e];this.updateThemeMeta(t),this.updateSurfaceBackgrounds(t),document.documentElement.style.colorScheme=`light`},this.syncCurrentTheme=()=>{if(typeof document>`u`)return;let e=document.documentElement.getAttribute(`data-theme`)===`cool`?`cool`:`warm`;this.syncTheme(e)},this.updateThemeMeta=e=>{let t=document.querySelector(`meta[name="theme-color"]`);t instanceof HTMLMetaElement&&(t.content=e)},this.updateSurfaceBackgrounds=e=>{document.documentElement.style.backgroundColor=e,document.body.style.backgroundColor=e;let t=document.getElementById(`root`);t&&(t.style.backgroundColor=e)}}},ct=(0,B.createContext)(null);function lt({children:e}){let[t,n]=(0,B.useState)(()=>R());(0,B.useEffect)(()=>{st.syncTheme(t),window.nextclawDesktop?.setShellTheme?.(t)},[t]),(0,B.useEffect)(()=>ze(e=>{n(e)}),[]);let r=(0,B.useCallback)(e=>{Re(e),n(Le())},[]),i=(0,B.useMemo)(()=>({theme:t,setTheme:r}),[t,r]);return(0,z.jsx)(ct.Provider,{value:i,children:e})}function ut(){let e=(0,B.useContext)(ct);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}function dt(){let{language:e,setLanguage:n}=_e();return{currentLanguage:e,currentLanguageLabel:t.find(t=>t.value===e)?.label??e,languageOptions:t,selectLanguage:(0,B.useCallback)(t=>{e!==t&&(n(t),window.location.reload())},[e,n])}}function ft(){let{currentLanguage:e,currentLanguageLabel:t,languageOptions:n,selectLanguage:r}=dt();return(0,z.jsxs)(`section`,{className:`mx-auto w-full max-w-3xl space-y-4`,children:[(0,z.jsx)(`div`,{className:`rounded-3xl border border-gray-200/80 bg-white p-5 shadow-card`,children:(0,z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,z.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl bg-gray-100 text-gray-600`,children:(0,z.jsx)(E,{className:`h-4 w-4`})}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`h2`,{className:`text-base font-semibold text-gray-900`,children:i(`language`)}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-gray-500`,children:t})]})]})}),(0,z.jsx)(`div`,{className:`overflow-hidden rounded-3xl border border-gray-200/80 bg-white shadow-card`,children:n.map(t=>{let n=t.value===e;return(0,z.jsxs)(`button`,{type:`button`,onClick:()=>r(t.value),className:a(`flex w-full items-center justify-between gap-3 border-b border-gray-100 px-5 py-4 text-left text-sm transition-colors last:border-b-0`,n?`bg-gray-50 text-gray-900`:`text-gray-700 hover:bg-gray-50/70`),"aria-current":n?`true`:void 0,children:[(0,z.jsx)(`span`,{className:`font-medium`,children:t.label}),n?(0,z.jsx)(ae,{className:`h-4 w-4 text-gray-700`}):null]},t.value)})})]})}function pt({mode:e}){let t=ue(),n=ge(),r=le(),{currentLanguage:o,currentLanguageLabel:s,languageOptions:c,selectLanguage:l}=dt(),{theme:u,setTheme:d}=ut(),f=e===`settings`,p=i(N.find(e=>e.value===u)?.labelKey??`themeWarm`),m=r.data?.account.email?.trim(),h=!!r.data?.account.loggedIn,g=e=>{u!==e&&d(e)},ee=[{target:`/chat`,label:i(`chat`),icon:D},{target:`/chat/cron`,label:i(`cron`),icon:C},{target:`/chat/skills`,label:i(`marketplaceFilterSkills`),icon:T},{target:`/agents`,label:i(`agentsPageTitle`),icon:w}],_=je(i),y=f?_:ee,b=f?`compact`:`default`;return(0,z.jsxs)(`aside`,{className:`w-[240px] shrink-0 flex h-full min-h-0 flex-col overflow-hidden bg-secondary px-4 py-6`,children:[f?(0,z.jsx)(`div`,{className:`shrink-0 px-2 pb-3`,children:(0,z.jsxs)(`div`,{className:`flex items-center gap-2 px-1 py-1`,"data-testid":`settings-sidebar-header`,children:[(0,z.jsxs)(v,{to:`/chat`,className:`group inline-flex min-w-0 items-center gap-1.5 rounded-lg px-1 py-1 text-[12px] font-medium text-gray-500 transition-colors hover:bg-gray-200/60 hover:text-gray-900`,children:[(0,z.jsx)(te,{className:`h-3.5 w-3.5 shrink-0 text-gray-400 group-hover:text-gray-700`}),(0,z.jsx)(`span`,{className:`truncate`,children:i(`backToMain`)})]}),(0,z.jsx)(`span`,{className:`h-4 w-px shrink-0 bg-[#dddfe6]`,"aria-hidden":`true`}),(0,z.jsx)(`h1`,{className:`truncate text-[15px] font-semibold tracking-[-0.01em] text-gray-800`,children:i(`settings`)})]})}):(0,z.jsx)(`div`,{className:`shrink-0 px-2 pb-8`,children:(0,z.jsx)(V,{className:`flex items-center gap-2.5 cursor-pointer`})}),(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,z.jsx)(`nav`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto pr-1`,children:(0,z.jsx)(`ul`,{className:a(f?`space-y-0.5 pb-3`:`space-y-1 pb-4`),children:y.map(e=>(0,z.jsx)(`li`,{children:(0,z.jsx)(U,{to:e.target,label:e.label,icon:e.icon,density:b})},e.target))})}),(0,z.jsxs)(`div`,{className:a(`shrink-0 border-t border-[#dde0ea] bg-secondary`,f?`mt-2 pt-3`:`mt-3 pt-3`),children:[f?(0,z.jsx)(W,{onClick:()=>t.accountManager.openAccountPanel(),icon:ce,label:i(`remoteAccountEntryManage`),density:`compact`,className:`mb-1.5`,trailing:h?m||i(`remoteAccountEntryConnected`):i(`remoteAccountEntryDisconnected`),trailingClassName:`max-w-[92px] truncate text-right`,testId:`settings-sidebar-account-entry`,trailingTestId:`settings-sidebar-account-status`}):null,e===`main`&&(0,z.jsx)(`div`,{className:`mb-2`,children:(0,z.jsx)(U,{to:`/settings`,label:i(`settings`),icon:fe})}),(0,z.jsx)(`div`,{className:`mb-2`,children:(0,z.jsx)(G,{value:u,onValueChange:e=>g(e),icon:O,label:i(`theme`),valueLabel:p,density:b,children:N.map(e=>(0,z.jsx)(x,{value:e.value,className:`text-xs`,children:i(e.labelKey)},e.value))})}),(0,z.jsx)(`div`,{className:`mb-2`,children:(0,z.jsx)(G,{value:o,onValueChange:e=>l(e),icon:E,label:i(`language`),valueLabel:s,density:b,children:c.map(e=>(0,z.jsx)(x,{value:e.value,className:`text-xs`,children:e.label},e.value))})}),(0,z.jsx)(W,{onClick:()=>n.open(void 0,{kind:`docs`,newTab:!0,title:`Docs`}),icon:re,label:i(`docBrowserHelp`),density:b})]})]})]})}function mt(){return(0,z.jsxs)(`header`,{className:`flex h-[var(--desktop-titlebar-height)] shrink-0 bg-background`,"data-testid":`desktop-window-chrome`,children:[(0,z.jsxs)(`div`,{className:`desktop-window-drag flex h-full w-[var(--desktop-sidebar-width)] shrink-0 items-center bg-secondary pl-4 pr-3 text-secondary-foreground`,"data-testid":`desktop-window-chrome-sidebar`,children:[(0,z.jsx)(`div`,{className:`desktop-window-no-drag flex min-w-0 shrink-0 items-center`,children:(0,z.jsx)(V,{className:`flex min-w-0 items-center gap-2.5`,density:`chrome`})}),(0,z.jsx)(`div`,{className:`min-w-0 flex-1 self-stretch`,"aria-hidden":`true`})]}),(0,z.jsx)(`div`,{className:`desktop-window-drag flex min-w-0 flex-1 items-center border-b border-[#ebe7dc]/80 bg-secondary pr-[var(--desktop-caption-safe-right)]`,"aria-hidden":`true`,"data-testid":`desktop-window-chrome-main`,children:(0,z.jsx)(`div`,{className:`min-w-0 flex-1 self-stretch`})})]})}function ht(){return typeof window>`u`?null:vt()??window.nextclawDesktop?.platform??null}function gt(){return ht()===`darwin`}function _t(){return ht()===`win32`}function vt(){return null}var yt=(0,B.lazy)(async()=>({default:(await _(async()=>{let{DocBrowser:e}=await import(`./doc-browser-p9DDNPWB.js`);return{DocBrowser:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))).DocBrowser}));function bt(e){return{"--desktop-titlebar-height":`40px`,"--desktop-caption-safe-right":`140px`,"--desktop-sidebar-width":e?`280px`:`240px`}}function xt({pathname:e,isDocBrowserOpen:t,docBrowserMode:n,children:r}){let i=Oe(e),o=_t();return(0,z.jsxs)(`div`,{className:a(`h-screen flex flex-col overflow-hidden bg-background font-sans text-foreground`,o?`rounded-[10px]`:null),style:o?bt(i):void 0,children:[o?(0,z.jsx)(mt,{}):null,(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[!i&&(0,z.jsx)(pt,{mode:`settings`}),(0,z.jsxs)(`div`,{className:`flex-1 flex min-w-0 overflow-hidden relative`,children:[(0,z.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:i?(0,z.jsx)(`div`,{className:`flex-1 h-full overflow-hidden`,children:r}):(0,z.jsx)(`main`,{className:`flex-1 overflow-auto p-8 pb-16 custom-scrollbar`,children:(0,z.jsx)(`div`,{className:`mx-auto h-full max-w-6xl animate-fade-in`,children:r})})}),t&&n===`docked`?(0,z.jsx)(B.Suspense,{fallback:null,children:(0,z.jsx)(yt,{})}):null]})]}),t&&n===`floating`?(0,z.jsx)(B.Suspense,{fallback:null,children:(0,z.jsx)(yt,{})}):null]})}export{O as C,w as D,T as E,C as O,k as S,E as T,Oe as _,lt as a,Ee as b,rt as c,U as d,V as f,ke as g,M as h,ft as i,nt as l,Ae as m,gt as n,ut as o,N as p,_t as r,at as s,xt as t,it as u,Me as v,D as w,A as x,Ne as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./doc-browser-rZIQIjuw.js";export{e as DocBrowser};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,m as t,p as n,r,u as i}from"./i18n-D1144VAA.js";import{t as a}from"./createLucideIcon-DzY6wN61.js";import{n as o,t as ee}from"./search-CRtQwr-h.js";import{t as s}from"./book-open-BcnAiKde.js";import{t as c}from"./external-link-CpEvG65F.js";import{t as l}from"./plus-B-YHtTNC.js";import{t as u}from"./x-BeyYA_h6.js";import{i as d,r as f,t as p}from"./doc-browser-context-FukQHvyo.js";var te=a(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),m=a(`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`}]]),h=a(`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`}]]),g=a(`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`}]]),_=e(t(),1),v=n();function y(e,t){return i(`flex flex-col bg-white overflow-hidden relative`,e?`fixed inset-0 z-[9999] h-[100dvh] w-screen rounded-none border-0 shadow-2xl`:t?`h-full border-l border-gray-200 shrink-0`:`rounded-2xl shadow-2xl border border-gray-200`)}function b(e){let{isFullscreen:t,isDocked:n,dockedWidth:r,floatPos:i,floatSize:a}=e;if(!t)return n?{width:r}:{position:`fixed`,left:i.x,top:i.y,width:a.w,height:a.h,zIndex:9999}}function x({displayMode:e=`desktop`}){let{isOpen:t,mode:n,tabs:a,activeTabId:x,currentTab:S,currentUrl:C,navVersion:w,close:T,toggleMode:E,goBack:D,goForward:ne,canGoBack:re,canGoForward:ie,navigate:O,syncUrl:k,setActiveTab:ae,closeTab:oe,openNewTab:A}=d(),[j,M]=(0,_.useState)(``),[N,P]=(0,_.useState)(!1),[F,I]=(0,_.useState)(!1),[L,R]=(0,_.useState)(()=>({x:Math.max(40,window.innerWidth-520),y:80})),[z,B]=(0,_.useState)({w:480,h:600}),[V,H]=(0,_.useState)(420),U=(0,_.useRef)(null),W=(0,_.useRef)(null),G=(0,_.useRef)(null),K=(0,_.useRef)(null),q=(0,_.useRef)(w),J=S?.kind===`docs`;(0,_.useEffect)(()=>{if(!J){M(``);return}try{M(new URL(C).pathname)}catch{M(C)}},[C,x,J]),(0,_.useEffect)(()=>{if(J){if(w!==q.current){q.current=w;return}if(K.current?.contentWindow)try{let e=new URL(C).pathname;K.current.contentWindow.postMessage({type:`docs-navigate`,path:e},`*`)}catch{}}},[C,w,J]),(0,_.useEffect)(()=>{n===`floating`&&R(e=>({x:Math.max(40,window.innerWidth-z.w-40),y:e.y}))},[n,z.w]),(0,_.useEffect)(()=>{let e=e=>{J&&e.data?.type===`docs-route-change`&&typeof e.data.url==`string`&&k(e.data.url)};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[k,J]);let se=(0,_.useCallback)(e=>{if(e.preventDefault(),!J)return;let t=j.trim();t&&(t.startsWith(`/`)?O(`${p}${t}`):t.startsWith(`http`)?O(t):O(`${p}/${t}`))},[j,O,J]),ce=(0,_.useCallback)(e=>{n===`floating`&&(P(!0),U.current={startX:e.clientX,startY:e.clientY,startPosX:L.x,startPosY:L.y})},[n,L]);(0,_.useEffect)(()=>{if(!N)return;let e=e=>{U.current&&R({x:U.current.startPosX+(e.clientX-U.current.startX),y:U.current.startPosY+(e.clientY-U.current.startY)})},t=()=>{P(!1),U.current=null};return window.addEventListener(`mousemove`,e),window.addEventListener(`mouseup`,t),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}},[N]);let Y=(0,_.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),I(!0);let{axis:t}=e.currentTarget.dataset;W.current={startX:e.clientX,startY:e.clientY,startW:z.w,startH:z.h};let n=e=>{W.current&&B(n=>({w:t===`y`?n.w:Math.max(360,W.current.startW+(e.clientX-W.current.startX)),h:t===`x`?n.h:Math.max(400,W.current.startH+(e.clientY-W.current.startY))}))},r=()=>{I(!1),W.current=null,window.removeEventListener(`mousemove`,n),window.removeEventListener(`mouseup`,r)};window.addEventListener(`mousemove`,n),window.addEventListener(`mouseup`,r)},[z]),le=(0,_.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),I(!0),G.current={startX:e.clientX,startW:V};let t=e=>{if(!G.current)return;let t=G.current.startX-e.clientX;H(Math.max(320,Math.min(860,G.current.startW+t)))},n=()=>{I(!1),G.current=null,window.removeEventListener(`mousemove`,t),window.removeEventListener(`mouseup`,n)};window.addEventListener(`mousemove`,t),window.addEventListener(`mouseup`,n)},[V]),X=(0,_.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),I(!0);let t=e.clientX,n=z.w,r=L.x,i=e=>{let i=t-e.clientX,a=Math.max(360,n+i);B(e=>({...e,w:a})),R(e=>({...e,x:r-(a-n)}))},a=()=>{I(!1),window.removeEventListener(`mousemove`,i),window.removeEventListener(`mouseup`,a)};window.addEventListener(`mousemove`,i),window.addEventListener(`mouseup`,a)},[z.w,L.x]);if(!t)return null;let Z=n===`docked`,Q=e===`fullscreen`,$=!Z&&!Q;return(0,v.jsxs)(`div`,{"data-testid":`doc-browser-panel`,className:y(Q,Z),style:b({isFullscreen:Q,isDocked:Z,dockedWidth:V,floatPos:L,floatSize:z}),children:[Z&&!Q&&(0,v.jsx)(`div`,{className:`absolute top-0 left-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors`,onMouseDown:le}),(0,v.jsxs)(`div`,{className:i(`flex items-center justify-between px-4 py-2.5 bg-gray-50 border-b border-gray-200 shrink-0 select-none`,$&&`cursor-grab active:cursor-grabbing`,Q&&`pt-[calc(env(safe-area-inset-top,0px)+0.625rem)]`),onMouseDown:$?ce:void 0,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,v.jsx)(s,{className:`w-4 h-4 text-primary shrink-0`}),(0,v.jsx)(`span`,{className:`text-sm font-semibold text-gray-900 truncate`,children:r(`docBrowserTitle`)})]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-1`,children:[Q?null:(0,v.jsx)(`button`,{onClick:E,className:`hover:bg-gray-200 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors`,title:r(Z?`docBrowserFloatMode`:`docBrowserDockMode`),children:Z?(0,v.jsx)(h,{className:`w-3.5 h-3.5`}):(0,v.jsx)(g,{className:`w-3.5 h-3.5`})}),(0,v.jsx)(`button`,{onClick:T,className:`hover:bg-gray-200 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors`,title:r(`docBrowserClose`),children:(0,v.jsx)(u,{className:`w-3.5 h-3.5`})})]})]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 py-2 bg-background border-b border-[#f1e7d4] overflow-x-auto custom-scrollbar`,children:[a.map(e=>(0,v.jsxs)(`div`,{className:i(`inline-flex items-center gap-1 h-7 px-1.5 rounded-lg text-xs border max-w-[220px] shrink-0 transition-colors`,e.id===x?`bg-amber-50/80 border-amber-200 text-amber-900 shadow-[0_1px_2px_rgba(30,20,10,0.04)]`:`bg-[#f9f8f5] border-[#eee3d1] text-[#78644d] hover:bg-[#fff7ea] hover:text-[#2f2212]`),children:[(0,v.jsx)(`button`,{type:`button`,onClick:()=>ae(e.id),className:`truncate text-left px-1`,title:e.title,children:e.title||r(`docBrowserTabUntitled`)}),(0,v.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),oe(e.id)},className:`rounded p-0.5 hover:bg-black/10`,"aria-label":r(`docBrowserCloseTab`),children:(0,v.jsx)(u,{className:`w-3 h-3`})})]},e.id)),(0,v.jsx)(`button`,{onClick:()=>A(void 0,{kind:`docs`,title:`Docs`}),className:`inline-flex items-center justify-center w-7 h-7 rounded-lg border border-[#eee3d1] bg-white text-[#78644d] hover:bg-[#fff7ea] hover:text-[#2f2212] shrink-0`,title:r(`docBrowserNewTab`),children:(0,v.jsx)(l,{className:`w-3.5 h-3.5`})})]}),J&&(0,v.jsxs)(`div`,{className:`flex items-center gap-2 px-3.5 py-2 bg-white border-b border-gray-100 shrink-0`,children:[(0,v.jsx)(`button`,{onClick:D,disabled:!re,className:`p-1.5 rounded-md hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed text-gray-600 transition-colors`,children:(0,v.jsx)(o,{className:`w-4 h-4`})}),(0,v.jsx)(`button`,{onClick:ne,disabled:!ie,className:`p-1.5 rounded-md hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed text-gray-600 transition-colors`,children:(0,v.jsx)(te,{className:`w-4 h-4`})}),(0,v.jsxs)(`form`,{onSubmit:se,className:`flex-1 relative`,children:[(0,v.jsx)(ee,{className:`w-3.5 h-3.5 absolute left-3 top-1/2 -translate-y-1/2 text-gray-400`}),(0,v.jsx)(`input`,{type:`text`,value:j,onChange:e=>M(e.target.value),placeholder:r(`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`})]})]}),(0,v.jsxs)(`div`,{className:`flex-1 relative overflow-hidden`,children:[(0,v.jsx)(`iframe`,{ref:K,src:C,className:`absolute inset-0 w-full h-full border-0`,title:S?.title||`NextClaw Docs`,sandbox:`allow-same-origin allow-scripts allow-popups allow-forms`,allow:`clipboard-read; clipboard-write`},`${x}:${w}`),(F||N)&&(0,v.jsx)(`div`,{className:`absolute inset-0 z-10`})]}),J&&f(C)&&(0,v.jsx)(`div`,{className:`flex items-center justify-between px-4 py-2 bg-gray-50 border-t border-gray-200 shrink-0`,children:(0,v.jsxs)(`a`,{href:C,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:[r(`docBrowserOpenExternal`),(0,v.jsx)(c,{className:`w-3 h-3`})]})}),!Z&&!Q&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`div`,{className:`absolute top-0 left-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors`,onMouseDown:X}),(0,v.jsx)(`div`,{className:`absolute top-0 right-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors`,onMouseDown:Y,"data-axis":`x`}),(0,v.jsx)(`div`,{className:`absolute bottom-0 left-0 h-1.5 w-full cursor-ns-resize z-20 hover:bg-primary/10 transition-colors`,onMouseDown:Y,"data-axis":`y`}),(0,v.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`,onMouseDown:Y,children:(0,v.jsx)(m,{className:`w-3 h-3 rotate-[-45deg]`})})]})]})}export{x as t};
|