@nextclaw/ui 0.13.1 → 0.13.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.
- package/CHANGELOG.md +128 -0
- package/dist/assets/app-presenter-provider-DIcnNB9s.js +3 -0
- package/dist/assets/{wrench-qVIwShTF.js → boxes-BvA-I63l.js} +1 -1
- package/dist/assets/channels-list-page-wK3l7p5R.js +8 -0
- package/dist/assets/chat-page-DgehvdJT.js +105 -0
- package/dist/assets/{confirm-dialog-B0TP-vPd.js → confirm-dialog-CGrKHbAW.js} +1 -1
- package/dist/assets/desktop-update-config-CehWxSSg.js +1 -0
- package/dist/assets/doc-browser-BgxmVsTx.js +1 -0
- package/dist/assets/doc-browser-CZn5-Qbu.js +1 -0
- package/dist/assets/doc-browser-context-B8gk7HMr.js +1 -0
- package/dist/assets/index-DORmh0Cy.css +1 -0
- package/dist/assets/index-DcFpvnge.js +101 -0
- package/dist/assets/key-round-D41Oe35x.js +1 -0
- package/dist/assets/mcp-marketplace-page-DBLhJWOJ.js +1 -0
- package/dist/assets/{mcp-marketplace-page-DDjeHd1I.js → mcp-marketplace-page-Dvi8mCBd.js} +2 -2
- package/dist/assets/model-config-B-EJXGtO.js +1 -0
- package/dist/assets/popover-YieElO8c.js +1 -0
- package/dist/assets/{provider-scoped-model-input-t1tCP5y5.js → provider-scoped-model-input-BPRNGqYn.js} +1 -1
- package/dist/assets/providers-list-CtBpL1ZY.js +1 -0
- package/dist/assets/remote-BGHbHoHf.js +1 -0
- package/dist/assets/rotate-cw-jueVCNJQ.js +1 -0
- package/dist/assets/runtime-config-page-C1Hv7mad.js +1 -0
- package/dist/assets/search-config-G2O1fcRb.js +1 -0
- package/dist/assets/{secrets-config-D1AUSEXX.js → secrets-config-TenzxYbE.js} +2 -2
- package/dist/assets/status-dot-BSMG7ZaC.js +1 -0
- package/dist/assets/tabs-D1CjpWNX.js +1 -0
- package/dist/assets/trash-2-DSWTsARW.js +1 -0
- package/dist/index.html +19 -13
- package/package.json +8 -8
- package/src/app/components/layout/app-layout.test.tsx +2 -1
- package/src/app/components/layout/app-layout.tsx +18 -4
- package/src/app/components/layout/sidebar.tsx +1 -1
- package/src/app/presenters/app.presenter.ts +6 -0
- package/src/features/chat/components/layout/chat-sidebar.test.tsx +1 -2
- package/src/features/chat/components/layout/chat-sidebar.tsx +1 -1
- package/src/features/panel-apps/utils/panel-app-doc-browser.utils.tsx +17 -13
- package/src/features/right-panel-resources/components/right-panel-resource-home-page.tsx +96 -0
- package/src/features/right-panel-resources/configs/right-panel-resource-routes.config.ts +171 -0
- package/src/features/right-panel-resources/index.ts +18 -0
- package/src/features/right-panel-resources/types/right-panel-resource.types.ts +36 -0
- package/src/features/right-panel-resources/utils/right-panel-resource-route-resolver.utils.test.ts +38 -0
- package/src/features/right-panel-resources/utils/right-panel-resource-route-resolver.utils.ts +89 -0
- package/src/features/right-panel-resources/utils/right-panel-resource-uri.utils.ts +48 -0
- package/src/features/side-dock/components/side-dock.test.tsx +58 -0
- package/src/features/side-dock/components/side-dock.tsx +117 -0
- package/src/features/side-dock/configs/side-dock-built-in-items.config.ts +43 -0
- package/src/features/side-dock/index.ts +10 -0
- package/src/features/side-dock/managers/side-dock.manager.test.ts +62 -0
- package/src/features/side-dock/managers/side-dock.manager.ts +58 -0
- package/src/features/side-dock/stores/side-dock.store.ts +42 -0
- package/src/features/side-dock/types/side-dock.types.ts +29 -0
- package/src/features/side-dock/utils/side-dock-item.utils.test.ts +77 -0
- package/src/features/side-dock/utils/side-dock-item.utils.ts +126 -0
- package/src/platforms/desktop/components/desktop-app-shell.tsx +3 -0
- package/src/shared/components/doc-browser/doc-browser-context.test.tsx +52 -5
- package/src/shared/components/doc-browser/doc-browser-context.tsx +22 -14
- package/src/shared/components/doc-browser/doc-browser-home-page.tsx +9 -89
- package/src/shared/components/doc-browser/doc-browser-renderer.types.ts +1 -0
- package/src/shared/components/doc-browser/doc-browser.test.tsx +5 -3
- package/src/shared/components/doc-browser/doc-browser.tsx +3 -1
- package/src/shared/components/doc-browser/managers/doc-browser.manager.ts +92 -43
- package/src/shared/components/doc-browser/types/doc-browser.types.ts +24 -0
- package/src/shared/components/doc-browser/utils/doc-browser-route-resolver.utils.ts +65 -0
- package/src/shared/components/doc-browser/utils/doc-browser-state.utils.ts +5 -4
- package/src/shared/lib/resource-uri/index.ts +11 -0
- package/src/shared/lib/resource-uri/types/resource-uri.types.ts +19 -0
- package/src/shared/lib/resource-uri/utils/resource-uri-resolver.utils.test.ts +49 -0
- package/src/shared/lib/resource-uri/utils/resource-uri-resolver.utils.ts +35 -0
- package/src/shared/lib/resource-uri/utils/resource-uri.utils.ts +48 -0
- package/dist/assets/channels-list-page-DXH1qYLs.js +0 -8
- package/dist/assets/chat-page-Cpo0AFHb.js +0 -105
- package/dist/assets/desktop-update-config-Be8x1jNy.js +0 -1
- package/dist/assets/doc-browser-BI7HSaMK.js +0 -3
- package/dist/assets/doc-browser-context-DB6TTHeE.js +0 -1
- package/dist/assets/doc-browser-route-registry.utils-x5ijvk0u.js +0 -1
- package/dist/assets/doc-browser-yTfN7UBH.js +0 -1
- package/dist/assets/index-GVTiCf1s.js +0 -101
- package/dist/assets/index-v0fAGXQW.css +0 -1
- package/dist/assets/mcp-marketplace-page-WUkc7n94.js +0 -1
- package/dist/assets/model-config-BjXMpU9U.js +0 -1
- package/dist/assets/providers-list-C1D5p9kK.js +0 -1
- package/dist/assets/remote-BHeENKxL.js +0 -1
- package/dist/assets/runtime-config-page--O0Wq01S.js +0 -1
- package/dist/assets/search-config-Dzpizo-_.js +0 -1
- package/src/shared/components/doc-browser/utils/doc-browser-route-registry.utils.ts +0 -232
- /package/dist/assets/{book-open-cPX0Za7Z.js → book-open-CRotBOF2.js} +0 -0
- /package/dist/assets/{config-hints-CY1lg9IE.js → config-hints-A7G_jMTU.js} +0 -0
- /package/dist/assets/{config-split-page-BFh_Qixx.js → config-split-page-BnTO1mAM.js} +0 -0
- /package/dist/assets/{external-link-C3usm3se.js → external-link-DHjFdCpy.js} +0 -0
- /package/dist/assets/{play-CqNi0u02.js → play-C-0vo7hi.js} +0 -0
- /package/dist/assets/{plus-BcIC8dG1.js → plus-Cr_akLp2.js} +0 -0
- /package/dist/assets/{save-D10M5vQg.js → save-aYdSdK97.js} +0 -0
- /package/dist/assets/{setting-row-8VkukJoH.js → setting-row-BNu0qhOM.js} +0 -0
- /package/dist/assets/{tabs-custom-BBXu1OGs.js → tabs-custom-CRSN1ekg.js} +0 -0
- /package/dist/assets/{tag-chip-ix15P-r4.js → tag-chip-DEashiw6.js} +0 -0
- /package/dist/assets/{x-Chb07O-Y.js → x-D1v_vb54.js} +0 -0
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import{d as e,h as t,i as n,m as r,v as i}from"./react-B2X_ph0a.js";import{A as a,At as o,D as s,E as c,Gt as l,Ht as u,Jt as d,Kt as f,Lt as p,Mt as m,Nt as h,O as g,Rt as _,Tt as v,Ut as y,Vt as b,Wt as x,Xt as S,_t as C,an as w,en as T,in as E,j as D,k as O,kt as ee,nn as te,qt as ne,rn as re,tn as k,wt as A,zt as j}from"./api-DruAcori.js";import{d as ie,f as ae,p as oe}from"./doc-browser-BI7HSaMK.js";import{a as se,c as M,i as N,l as ce,n as le,o as ue,r as de,s as P}from"./mcp-marketplace-page-DDjeHd1I.js";import{a as F,c as fe,i as I,n as pe,o as L,r as R,s as me}from"./confirm-dialog-B0TP-vPd.js";import{t as z}from"./createLucideIcon-Br1EFMEr.js";import{n as he}from"./search-CdhgFNwf.js";import{i as ge,n as _e,r as ve,t as ye}from"./provider-scoped-model-input-t1tCP5y5.js";import{t as be}from"./play-CqNi0u02.js";import{t as xe}from"./plus-BcIC8dG1.js";import{n as Se}from"./doc-browser-context-DB6TTHeE.js";import{$t as Ce,A as we,B as Te,C as Ee,Ct as De,D as Oe,E as ke,Et as Ae,F as je,H as Me,I as B,J as V,Jt as Ne,K as Pe,Kt as H,L as Fe,M as Ie,Mt as Le,N as Re,Nt as ze,O as Be,P as Ve,Q as He,Qt as Ue,R as We,S as Ge,St as Ke,T as qe,Tt as Je,V as Ye,X as Xe,Y as Ze,Yt as Qe,Z as $e,_ as et,a as tt,b as nt,c as rt,cn as it,d as at,dn as ot,f as st,fn as ct,ft as lt,g as ut,h as dt,i as ft,in as pt,j as mt,jt as ht,k as gt,l as _t,lt as vt,m as yt,n as bt,nt as xt,o as St,ot as Ct,p as wt,q as Tt,r as Et,s as Dt,sn as Ot,st as kt,t as At,tn as jt,tt as Mt,u as U,v as Nt,w as Pt,wt as Ft,x as W,xt as It,y as G,z as Lt}from"./index-GVTiCf1s.js";import{t as Rt}from"./tabs-custom-BBXu1OGs.js";import{t as zt}from"./tag-chip-ix15P-r4.js";function Bt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Vt(e,t,n){let r=e.slice(0);return r[t]=n,r}var Ht=class extends w{#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||!E(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Bt(e,n).forEach(e=>{e.destroy()}),Bt(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=re(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 T(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Vt(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)})})}}},K=i(t(),1);function Ut({queries:e,...t},n){let r=S(n),i=d(),a=ne(),o=K.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{b(e),x(e,a,r.getQueryCache().get(e.queryHash))}),f(a);let[s]=K.useState(()=>new Ht(r,o,t)),[c,p,m]=s.getOptimisticResult(o,t.combine),h=!i&&t.subscribed!==!1;K.useSyncExternalStore(K.useCallback(e=>h?s.subscribe(k.batchCalls(e)):te,[s,h]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),K.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let g=c.some((e,t)=>y(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&y(n,e)?u(n,new T(r,n),a):[]}):[];if(g.length>0)throw Promise.all(g);let _=c.find((e,t)=>{let n=o[t];return n&&l({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(_?.error)throw _.error;return p(m())}var Wt=z(`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`}]]),Gt=z(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Kt=z(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),qt=z(`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`}]]),Jt=z(`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`}]]),Yt=z(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Xt=z(`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`}]]),Zt=z(`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`}]]),Qt=z(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),$t=z(`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`}]]),q=r(),en=K.forwardRef(({className:t,...n},r)=>(0,q.jsx)(`textarea`,{className:e(`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`,t),ref:r,...n}));en.displayName=`Textarea`;function tn(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``}}function nn(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=G(r);return t.some(e=>e.value===i)?t:[...t,{value:i,label:W(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 rn({value:e,disabled:t=!1,runtimeOptions:r,defaultRuntime:i,onChange:a}){let o=e.trim()?G(e):``,s=nn({runtimeOptions:r,currentRuntime:e}),c=s.find(e=>e.value===o)??null,l=c?.reasonMessage?.trim()||(c?.ready===!1?n(`agentsRuntimeUnavailableHelp`):``);return(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsxs)(Pe,{value:o||i,onValueChange:e=>a(e===i?``:e),disabled:t,children:[(0,q.jsx)(Ze,{"aria-label":n(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,q.jsx)(Xe,{placeholder:n(`agentsRuntimeSelectPlaceholder`)})}),(0,q.jsx)(Tt,{className:`rounded-xl`,children:s.map(e=>(0,q.jsx)(V,{value:e.value,disabled:e.ready===!1&&e.value!==o,className:`rounded-lg`,children:e.label},e.value))})]}),l?(0,q.jsx)(`p`,{className:`text-xs text-gray-500`,children:l}):null]})}function an({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,q.jsx)(R,{open:e!==null,onOpenChange:a,children:e?(0,q.jsx)(on,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function on(e){let{agent:t,pending:r,providerCatalog:i,runtimeOptions:a,defaultRuntime:o,onOpenChange:s,onSubmit:c}=e,[l,u]=(0,K.useState)(tn(t));return(0,q.jsxs)(I,{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,q.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,q.jsxs)(me,{className:`text-left`,children:[(0,q.jsx)(fe,{children:n(`agentsEditDialogTitle`)}),(0,q.jsx)(F,{children:n(`agentsEditDialogDescription`)})]})}),(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(pe,{tone:`warning`,title:n(`agentsEditHomeReadonly`),description:n(`agentsEditHomeReadonlyHint`),children:(0,q.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:t.workspace??`-`})}),(0,q.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,q.jsx)(m,{value:l.displayName,onChange:e=>u(t=>({...t,displayName:e.target.value})),placeholder:n(`agentsFormNamePlaceholder`)}),(0,q.jsx)(en,{value:l.description,onChange:e=>u(t=>({...t,description:e.target.value})),placeholder:n(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,q.jsx)(m,{value:l.avatar,onChange:e=>u(t=>({...t,avatar:e.target.value})),placeholder:n(`agentsFormAvatarPlaceholder`)}),(0,q.jsx)(ye,{value:l.model,onChange:e=>u(t=>({...t,model:e})),providerCatalog:i,disabled:r,className:`md:col-span-2`}),(0,q.jsx)(rn,{value:l.runtime,onChange:e=>u(t=>({...t,runtime:e})),runtimeOptions:a,defaultRuntime:o,disabled:r})]})]})}),(0,q.jsxs)(L,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,q.jsx)(h,{type:`button`,variant:`ghost`,onClick:()=>s(!1),disabled:r,children:n(`cancel`)}),(0,q.jsxs)(h,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>c(t.id,l),disabled:r,children:[(0,q.jsx)(Ce,{className:`mr-2 h-4 w-4`}),n(`agentsEditSaveAction`)]})]})]})}var sn=`请直接创建一个默认示例 Agent,不要问我问题。创建完成后,简单告诉我它能做什么。`;function cn(e){let{agentCount:t,onCreate:r}=e;return(0,q.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,q.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h1`,{className:`text-xl font-semibold text-gray-950`,children:n(`agentsHeroEyebrow`)}),(0,q.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,q.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-gray-500`,children:n(`agentsHeroDescription`)})]}),(0,q.jsxs)(h,{type:`button`,variant:`primary`,className:`h-9 shrink-0 rounded-xl px-4 text-sm font-semibold`,onClick:r,children:[(0,q.jsx)(xe,{className:`mr-2 h-4 w-4`}),n(`agentsCreateButton`)]})]})}function ln(t){let{icon:n,label:r,disabled:i=!1,destructive:a=!1,onClick:o}=t;return(0,q.jsxs)(`button`,{type:`button`,className:e(`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,q.jsx)(n,{className:`h-4 w-4 shrink-0`}),(0,q.jsx)(`span`,{children:r})]})}function un(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()||``,d=u?r.find(e=>e.value===G(u))?.label??W(u):i;return(0,q.jsx)(A,{className:`group overflow-hidden border border-gray-200 bg-white shadow-none transition-colors duration-200 hover:border-gray-300`,children:(0,q.jsxs)(v,{className:`relative flex h-full flex-col gap-3 px-3.5 py-3.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-2.5 pr-16`,children:[(0,q.jsx)(Me,{agentId:t.id,displayName:t.displayName,avatarUrl:t.avatarUrl,className:`h-9 w-9 shrink-0`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`div`,{className:`truncate text-sm font-semibold text-gray-950`,children:t.displayName?.trim()||t.id}),t.builtIn?(0,q.jsxs)(zt,{tone:`warning`,className:`h-5 gap-1 border-amber-200 bg-amber-50 px-1.5 text-[10px] text-amber-700`,children:[(0,q.jsx)(Qe,{className:`h-3 w-3`}),n(`agentsCardBuiltInTag`)]}):null]}),(0,q.jsxs)(`div`,{className:`truncate text-xs text-gray-400`,children:[`@`,t.id]})]})]}),(0,q.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,q.jsx)(h,{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,q.jsx)(jt,{className:`h-4 w-4`})}),(0,q.jsxs)(ht,{children:[(0,q.jsx)(ze,{asChild:!0,children:(0,q.jsx)(h,{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,q.jsx)(Yt,{className:`h-4 w-4`})})}),(0,q.jsxs)(Le,{align:`end`,className:`w-44 p-1.5`,children:[(0,q.jsx)(ln,{icon:Ce,label:n(`agentsEditAction`),onClick:c,disabled:a}),t.builtIn?null:(0,q.jsx)(ln,{icon:H,label:n(`agentsRemoveAction`),onClick:l,disabled:o,destructive:!0})]})]})]}),(0,q.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,q.jsxs)(`div`,{className:`mt-auto grid gap-2 border-t border-gray-100 pt-2 text-xs text-gray-500`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(Ne,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,q.jsx)(`span`,{className:`truncate`,children:d})]}),(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(pt,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,q.jsx)(`span`,{className:`truncate`,children:t.workspace??`-`})]})]})]})})}function dn(){let e=Lt(),t=Ee(),r=$e(),i=He(),a=Dt(),s=qe(),c=Pt(),[l,u]=(0,K.useState)(null),d=(0,K.useMemo)(()=>t.data?.agents??[],[t.data?.agents]),f=(0,K.useMemo)(()=>[...d].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[d]),p=(0,K.useMemo)(()=>_e({config:r.data,meta:i.data,onlyConfigured:!0}),[i.data,r.data]),m=(0,K.useMemo)(()=>Nt(a.data?.options??[]),[a.data?.options]),g=(0,K.useMemo)(()=>G(a.data?.defaultType??`native`),[a.data?.defaultType]),_=(0,K.useMemo)(()=>m.find(e=>e.value===g)?.label??W(g),[g,m]),y=e=>{u(e)},b=async(e,t)=>{await s.mutateAsync({agentId:e,data:{displayName:t.displayName,description:t.description,avatar:t.avatar,model:t.model,...t.runtime.trim()?{runtime:t.runtime.trim()}:{runtime:``}}}),u(null)},x=t=>{e.chatSessionListManager.startAgentDraftChat(t.id,nt(t,g))};return(0,q.jsxs)(o,{className:`space-y-5`,children:[(0,q.jsx)(cn,{agentCount:d.length,onCreate:()=>e.startAgentCreationDraft(sn)}),(0,q.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:t.isLoading?(0,q.jsx)(A,{className:`md:col-span-2 xl:col-span-3 border-dashed border-[#d9dce3] bg-white/70`,children:(0,q.jsx)(v,{className:`py-14 text-center text-sm text-gray-500`,children:n(`agentsLoading`)})}):f.length===0?(0,q.jsx)(A,{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,q.jsxs)(v,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,q.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,q.jsx)(ot,{className:`h-8 w-8 text-[#d39a3b]`})}),(0,q.jsx)(`div`,{className:`text-lg font-semibold text-[#2f2212]`,children:n(`agentsEmpty`)}),(0,q.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-[#78644d]`,children:n(`agentsEmptyDescription`)}),(0,q.jsxs)(h,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:()=>e.startAgentCreationDraft(sn),children:[(0,q.jsx)(xe,{className:`mr-2 h-4 w-4`}),n(`agentsCreateButton`)]})]})}):f.map(e=>(0,q.jsx)(un,{agent:e,runtimeOptions:m,defaultRuntimeLabel:_,updatePending:s.isPending,deletePending:c.isPending,onStartChat:()=>x(e),onEdit:()=>y(e),onDelete:()=>c.mutate({agentId:e.id})},e.id))}),(0,q.jsx)(an,{agent:l,pending:s.isPending,providerCatalog:p,runtimeOptions:m,defaultRuntime:g,onOpenChange:e=>{!e&&!s.isPending&&u(null)},onSubmit:b})]})}function fn(e,t){let n=t.trim().toLowerCase();return n?[e.id,e.name,e.payload.message,e.payload.sessionId??``,e.payload.channel??``,e.payload.to??``].join(` `).toLowerCase().includes(n):!0}function pn(e,t){return t===`all`?!0:t===`enabled`?e.enabled:!e.enabled}function mn(t){let{job:r,onDelete:i,onRun:a,onToggle:o}=t;return(0,q.jsx)(A,{className:`border border-gray-200`,children:(0,q.jsx)(v,{className:`pt-5 pb-5`,children:(0,q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,q.jsxs)(`div`,{className:`min-w-[220px] flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`text-sm font-semibold text-gray-900`,children:r.name||r.id}),(0,q.jsx)(`span`,{className:`rounded-full bg-gray-100 px-2 py-0.5 text-[10px] font-semibold text-gray-500`,children:r.id}),(0,q.jsx)(`span`,{className:e(`rounded-full px-2 py-0.5 text-[10px] font-semibold`,r.enabled?`bg-emerald-50 text-emerald-700`:`bg-gray-100 text-gray-500`),children:r.enabled?n(`enabled`):n(`disabled`)}),r.deleteAfterRun?(0,q.jsx)(`span`,{className:`rounded-full bg-amber-50 px-2 py-0.5 text-[10px] font-semibold text-amber-700`,children:n(`cronOneShot`)}):null]}),(0,q.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[n(`cronScheduleLabel`),`: `,st(r)]}),(0,q.jsx)(`div`,{className:`mt-2 whitespace-pre-wrap break-words text-sm text-gray-700`,children:r.payload.message}),(0,q.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[n(`cronSessionLabel`),`: `,wt(r)]}),(0,q.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[n(`cronDeliverTo`),`: `,at(r)]})]}),(0,q.jsxs)(`div`,{className:`min-w-[220px] space-y-2 text-xs text-gray-500`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[n(`cronNextRun`),`:`]}),` `,yt(r.state.nextRunAt)]}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[n(`cronLastRun`),`:`]}),` `,yt(r.state.lastRunAt)]}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[n(`cronLastStatus`),`:`]}),` `,r.state.lastStatus??`-`]}),r.state.lastError?(0,q.jsx)(`div`,{className:`break-words text-[11px] text-red-500`,children:r.state.lastError}):null]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-end gap-2`,children:[(0,q.jsxs)(h,{variant:`subtle`,size:`sm`,onClick:()=>a(r),className:`gap-1`,children:[(0,q.jsx)(be,{className:`h-3.5 w-3.5`}),n(`cronRunNow`)]}),(0,q.jsxs)(h,{variant:r.enabled?`outline`:`primary`,size:`sm`,onClick:()=>o(r),className:`gap-1`,children:[(0,q.jsx)(Qt,{className:`h-3.5 w-3.5`}),r.enabled?n(`cronDisable`):n(`cronEnable`)]}),(0,q.jsxs)(h,{variant:`destructive`,size:`sm`,onClick:()=>i(r),className:`gap-1`,children:[(0,q.jsx)(H,{className:`h-3.5 w-3.5`}),n(`delete`)]})]})]})})})}function hn(){let[t,r]=(0,K.useState)(``),[i,a]=(0,K.useState)(`all`),s=Mt({all:!0}),c=xt(),l=lt(),u=vt(),{confirm:d,ConfirmDialog:f}=dt(),p=(0,K.useMemo)(()=>(s.data?.jobs??[]).filter(e=>fn(e,t)).filter(e=>pn(e,i)),[s.data,t,i]),g=async e=>{await d({title:`${n(`cronDeleteConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:`destructive`,confirmLabel:n(`delete`)})&&c.mutate({id:e.id})},_=async e=>{let t=!e.enabled;await d({title:t?`${n(`cronEnableConfirm`)}?`:`${n(`cronDisableConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:t?`default`:`destructive`,confirmLabel:n(t?`cronEnable`:`cronDisable`)})&&l.mutate({id:e.id,enabled:t})},v=async e=>{let t=!e.enabled;await d({title:t?`${n(`cronRunForceConfirm`)}?`:`${n(`cronRunConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,confirmLabel:n(`cronRunNow`)})&&u.mutate({id:e.id,force:t})};return(0,q.jsxs)(o,{fullHeight:!0,children:[(0,q.jsx)(ee,{title:n(`cronPageTitle`),description:n(`cronPageDescription`),actions:(0,q.jsx)(h,{variant:`ghost`,size:`icon`,className:`h-9 w-9 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100`,onClick:()=>s.refetch(),children:(0,q.jsx)(Ue,{className:e(`h-4 w-4`,s.isFetching&&`animate-spin`)})})}),(0,q.jsx)(`div`,{className:`mb-6`,children:(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center`,children:[(0,q.jsxs)(`div`,{className:`relative flex-1 min-w-[240px]`,children:[(0,q.jsx)(m,{value:t,onChange:e=>r(e.target.value),placeholder:n(`cronSearchPlaceholder`),className:`pl-9`}),(0,q.jsx)(ct,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`})]}),(0,q.jsx)(`div`,{className:`min-w-[180px]`,children:(0,q.jsxs)(Pe,{value:i,onValueChange:e=>a(e),children:[(0,q.jsx)(Ze,{className:`w-full`,children:(0,q.jsx)(Xe,{placeholder:n(`cronStatusLabel`)})}),(0,q.jsxs)(Tt,{children:[(0,q.jsx)(V,{value:`all`,children:n(`cronStatusAll`)}),(0,q.jsx)(V,{value:`enabled`,children:n(`cronStatusEnabled`)}),(0,q.jsx)(V,{value:`disabled`,children:n(`cronStatusDisabled`)})]})]})}),(0,q.jsxs)(`div`,{className:`text-xs text-gray-500 ml-auto`,children:[n(`cronTotalLabel`),`: `,s.data?.total??0,` / `,p.length]})]})}),(0,q.jsx)(`div`,{className:`flex-1 overflow-auto custom-scrollbar`,children:s.isLoading?(0,q.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:n(`cronLoading`)}):p.length===0?(0,q.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:n(`cronEmpty`)}):(0,q.jsx)(`div`,{className:`space-y-4`,children:p.map(e=>(0,q.jsx)(mn,{job:e,onDelete:g,onRun:v,onToggle:_},e.id))})}),(0,q.jsx)(f,{})]})}function gn(e){return Array.from(new Set(e.map(e=>e.spec).filter(Boolean)))}function _n(e){let t=new Date().toISOString();return e.result.type===`skill`?{type:`skill`,spec:e.result.spec,id:e.request.skill??e.result.spec,label:e.request.skill??e.result.name??e.result.spec,source:`workspace`,installPath:e.request.installPath,installedAt:t}:{type:e.result.type,spec:e.result.spec,id:e.result.name??e.result.spec,label:e.result.name??e.result.spec,source:`marketplace`,origin:`marketplace`,enabled:e.request.enabled??!0,runtimeStatus:e.request.enabled===!1?`disabled`:`ready`,installedAt:t}}function vn(e,t){return!!(t.spec&&e.spec===t.spec||t.id&&e.id===t.id)}function yn(e,t){return t??{type:e,total:0,specs:[],records:[]}}function bn(e){let t=yn(e.result.type,e.view),n=_n(e),r=t.records.findIndex(e=>vn(e,{id:n.id,spec:n.spec})),i=[...t.records];return r>=0?i[r]={...i[r],...n}:i.unshift(n),{...t,type:e.result.type,records:i,specs:gn(i),total:i.length}}function xn(e){let t=yn(e.result.type,e.view);if(e.result.action===`uninstall`||e.result.action===`remove`){let n=t.records.filter(t=>!vn(t,{id:e.result.id,spec:e.request.spec}));return{...t,records:n,specs:gn(n),total:n.length}}let n=t.records.map(t=>vn(t,{id:e.result.id,spec:e.request.spec})?e.result.action===`disable`?{...t,enabled:!1,runtimeStatus:`disabled`}:{...t,enabled:!0,runtimeStatus:`ready`}:t);return{...t,records:n,specs:gn(n),total:n.length}}function Sn(e){let t=ce({queryKey:[`marketplace-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>s({...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&&Cn(r,e)?t:void 0},staleTime:15e3}),n=(0,K.useMemo)(()=>M(t.data),[t.data]);return{...t,data:n}}function Cn(e,t){return e.q===t.q&&e.tag===t.tag&&e.scene===t.scene&&e.sort===t.sort&&e.pageSize===t.pageSize}function wn(e=!0){return j({queryKey:[`marketplace-skill-scenes`],queryFn:O,enabled:e,staleTime:6e4})}function Tn(e,t=!0){let n=Ut({queries:e.map(e=>({queryKey:[`marketplace-skill-scene-count`,e.scene],queryFn:()=>s({type:`skill`,scene:e.scene,pageSize:1}),enabled:t&&typeof e.count!=`number`,staleTime:6e4}))});return(0,K.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 En(e){return j({queryKey:[`marketplace-installed`,e],queryFn:()=>c(e),staleTime:1e4})}function Dn(){let e=S();return _({mutationFn:e=>a(e),onSuccess:(t,r)=>{e.setQueryData([`marketplace-installed`,t.type],e=>bn({view:e,request:r,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`}),p.success(t.message||n(`marketplaceInstallSuccessSkill`))},onError:e=>{p.error(e.message||n(`marketplaceInstallFailed`))}})}function On(){let e=S();return _({mutationFn:e=>D(e),onSuccess:(t,r)=>{e.setQueryData([`marketplace-installed`,t.type],e=>xn({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`):n(`marketplaceUninstallSuccess`);p.success(t.message||i)},onError:e=>{p.error(e.message||n(`marketplaceOperationFailed`))}})}function kn(e){return(e??``).trim().toLowerCase()}function J(e,t){let n=kn(t);return n.length>0?`${e}:${n}`:``}function An(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=J(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function jn(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=J(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function Mn(e,t){let n=[e.install.spec,e.slug,e.id];for(let r of n){let n=J(e.type,r);if(!n)continue;let i=t.get(n);if(i)return i}}function Nn(e,t){return t.get(J(e.type,e.spec))||t.get(J(e.type,e.id))||t.get(J(e.type,e.label))}function Pn(e,t,n,r){let i=kn(n);if(!i)return!0;let a=N(t?.summaryI18n,t?.summary,r);return[e.id,e.spec,e.label,t?.name,t?.slug,t?.summary,a,...t?.tags??[]].map(e=>kn(e)).filter(Boolean).some(e=>e.includes(i))}function Y(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function Fn(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 X(e){return Y(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 In(e){return/^(#{1,4})\s+/.test(e)||/^([-*])\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)}function Ln(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">${Y(n[1])}</span>`:``}<pre><code>${Y(r.join(`
|
|
5
|
-
`))}</code></pre></div>`,nextIndex:i+1}}function Rn(e,t){let n=Math.min(4,e[1]?.length??2);return{html:`<h${n}>${X(e[2]??``)}</h${n}>`,nextIndex:t+1}}function zn(e,t,n){let r=[],i=t,a=n?/^\d+\.\s+/:/^[-*]\s+/;for(;i<e.length&&a.test(e[i]?.trim()??``);)r.push(`<li>${X((e[i]??``).trim().replace(a,``))}</li>`),i+=1;return{html:n?`<ol>${r.join(``)}</ol>`:`<ul>${r.join(``)}</ul>`,nextIndex:i}}function Bn(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>${X(n.join(` `))}</blockquote>`,nextIndex:r}}function Vn(e,t){let n=[],r=t;for(;r<e.length;){let t=e[r]?.trim()??``;if(!t||In(t))break;n.push(t),r+=1}return{html:`<p>${X(n.join(` `))}</p>`,nextIndex:r}}function Hn(e,t){let n=e[t]?.trim()??``,r=n.match(/^```(\S*)/);if(r)return Ln(e,t,r);let i=n.match(/^(#{1,4})\s+(.+)$/);return i?Rn(i,t):/^[-*]\s+/.test(n)?zn(e,t,!1):/^\d+\.\s+/.test(n)?zn(e,t,!0):/^>\s?/.test(n)?Bn(e,t):Vn(e,t)}function Un(e){let t=Fn(e).replace(/\r\n/g,`
|
|
6
|
-
`).split(`
|
|
7
|
-
`),n=[],r=0;for(;r<t.length;){if(!(t[r]??``).trim()){r+=1;continue}let e=Hn(t,r);n.push(e.html),r=e.nextIndex}return n.join(``)}function Wn(e){return Array.isArray(e)?e.map(e=>Wn(e)).join(`, `):e&&typeof e==`object`?JSON.stringify(e):String(e??``)}function Gn(e){try{let t=JSON.parse(e);return!t||typeof t!=`object`||Array.isArray(t)?[]:Object.entries(t).map(([e,t])=>({key:e,value:Wn(t)})).filter(e=>e.value.trim().length>0)}catch{return[]}}function Kn(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 qn(e){let t=Gn(e),n=t.length>0?t:Kn(e);return n.length===0?`<pre class="code">${Y(e)}</pre>`:`<dl class="metadata-list">${n.map(e=>`<div><dt>${Y(e.key)}</dt><dd>${Y(e.value)}</dd></div>`).join(``)}</dl>`}function Z(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=qn(p),y=Un(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>${Y(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>${Y(t)}</h1>
|
|
85
|
-
<div class="meta">${Y(n)} · ${Y(r)}${d?` · ${Y(d)}`:``}</div>
|
|
86
|
-
${h?`<p class="summary">${Y(h)}</p>`:``}
|
|
87
|
-
${_?`<p class="summary">${Y(g)}</p>`:``}
|
|
88
|
-
${u&&u.length>0?`<div class="tags">${u.map(e=>`<span class="tag">${Y(e)}</span>`).join(``)}</div>`:``}
|
|
89
|
-
${c?`<p class="meta" style="margin-top:12px;">${Y(l??`Source`)}: <a class="source" href="${Y(c)}" target="_blank" rel="noopener noreferrer">${Y(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)}`}var Jn=[`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 Yn(t){let{name:n,fallback:r,className:i}=t,a=n||r,o=a.substring(0,2).toUpperCase();return(0,q.jsx)(`div`,{className:e(`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-sm font-semibold text-white`,Xn(a),i),children:o})}function Xn(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return Jn[Math.abs(t)%Jn.length]}function Zn({title:e,spec:t,summary:n}){return(0,q.jsxs)(Je,{delayDuration:400,children:[(0,q.jsxs)(De,{children:[(0,q.jsx)(Ae,{asChild:!0,children:(0,q.jsx)(`div`,{className:`truncate text-[14px] font-semibold leading-tight text-gray-900`,children:e})}),(0,q.jsx)(Ft,{className:`max-w-[300px] text-xs`,children:e})]}),(0,q.jsx)(`div`,{className:`mb-1.5 mt-0.5 flex min-w-0 items-center gap-1.5`,children:t?(0,q.jsxs)(De,{children:[(0,q.jsx)(Ae,{asChild:!0,children:(0,q.jsx)(`span`,{className:`max-w-full truncate text-[11px] font-mono text-gray-400`,children:t})}),(0,q.jsx)(Ft,{className:`max-w-[300px] break-all font-mono text-xs`,children:t})]}):null}),(0,q.jsx)(`p`,{className:`line-clamp-2 text-left text-[12px] leading-relaxed text-gray-500/90`,children:n})]})}function Qn(t){let{item:r,record:i,isInstalling:a,isDisabled:o,canUninstall:s,busyAction:c,busyForRecord:l,language:u,onInstall:d,onManage:f}=t,p=!!(r&&!i||i&&s);return(0,q.jsxs)(`div`,{className:e(`relative flex h-8 shrink-0 items-center justify-end`,i?`md:w-5`:`md:w-0`),children:[(0,q.jsx)(`div`,{className:e(`hidden items-center justify-end transition-opacity duration-150 md:flex`,p&&`group-hover:opacity-0 group-focus-within:opacity-0`),children:i?(0,q.jsx)($n,{disabled:o,language:u}):null}),(0,q.jsxs)(`div`,{className:e(`flex w-max items-center justify-end gap-2 transition-opacity duration-150`,`opacity-100 md:pointer-events-none md:absolute md:right-0 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:[r&&!i&&(0,q.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),d(r)},disabled:a,className:`inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-xl bg-primary px-3 text-xs font-medium text-white transition-colors hover:bg-primary-600 disabled:opacity-50`,children:[(0,q.jsx)(Ot,{className:`h-3.5 w-3.5`}),n(a?`marketplaceInstalling`:`marketplaceInstall`)]}),i&&s&&(0,q.jsxs)(`button`,{disabled:l,onClick:e=>{e.stopPropagation(),f(`uninstall`,i)},className:`inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-xl border border-gray-200/80 bg-white px-3 text-xs font-medium text-gray-500 transition-colors hover:border-rose-200 hover:bg-rose-50 hover:text-rose-600 disabled:opacity-50`,children:[(0,q.jsx)(H,{className:`h-3.5 w-3.5`}),n(c===`uninstall`?`marketplaceRemoving`:`marketplaceUninstall`)]})]})]})}function $n(t){let{disabled:n,language:r}=t,i=tr(n?{zh:`已禁用`,en:`Disabled`}:{zh:`已安装`,en:`Installed`},r);return(0,q.jsx)(Je,{delayDuration:300,children:(0,q.jsxs)(De,{children:[(0,q.jsx)(Ae,{asChild:!0,children:(0,q.jsx)(`span`,{"aria-label":i,className:e(`inline-flex h-5 w-5 items-center justify-center`,n?`text-gray-400`:`text-emerald-700`),children:n?(0,q.jsx)(Gt,{className:`h-4 w-4 opacity-40`}):(0,q.jsx)(Gt,{className:`h-4 w-4`})})}),(0,q.jsx)(Ft,{className:`text-xs`,children:i})]})})}function er(e){let{item:t,record:r,language:i,installState:a,manageState:o,onOpen:s,onInstall:c,onManage:l}=e,u=de(i),d=t?.name??r?.label??r?.id??r?.spec??n(`marketplaceUnknownItem`),f=N(t?.summaryI18n,t?.summary,u)||(r?n(`marketplaceInstalledLocalSummary`):``),p=t?.install.spec??r?.spec??``,m=r?.id||r?.spec,h=m?o.actionsByTarget.get(m):void 0,g=!!h,_=r?.type===`skill`&&r.source===`workspace`,v=r?r.enabled===!1||r.runtimeStatus===`disabled`:!1,y=t?.install.spec,b=typeof y==`string`&&a.installingSpecs.has(y);return(0,q.jsxs)(`article`,{onClick:s,className:`group flex cursor-pointer items-start justify-between gap-3.5 rounded-2xl border border-gray-200/40 bg-white px-5 py-4 shadow-sm transition-all hover:border-blue-300/80 hover:shadow-md`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 gap-3`,children:[(0,q.jsx)(Yn,{name:d,fallback:p||n(`marketplaceTypeSkill`)}),(0,q.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col justify-center`,children:(0,q.jsx)(Zn,{title:d,spec:p,summary:f})})]}),(0,q.jsx)(Qn,{item:t,record:r,isInstalling:b,isDisabled:v,canUninstall:_,busyAction:h,busyForRecord:g,language:i,onInstall:c,onManage:l})]})}function tr(e,t){return t.startsWith(`zh`)?e.zh:e.en}function nr(t){let{scope:n,title:r,summary:i,showTitle:a,showListSkeleton:o,skeletonCardCount:s,allItems:c,installedEntries:l,installedRecordLookup:u,language:d,installState:f,manageState:p,onOpen:m,onInstall:h,onManage:g}=t;return(0,q.jsxs)(`section`,{className:e(`flex min-h-full flex-col`,a&&`gap-3`),children:[a&&(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,q.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-950`,children:r}),(0,q.jsx)(`span`,{className:`text-[12px] text-gray-500`,children:i})]}),(0,q.jsxs)(`div`,{"data-testid":o?`marketplace-list-skeleton`:void 0,className:e(`grid grid-cols-1 gap-3 lg:grid-cols-2 2xl:grid-cols-3`,o&&`min-h-0 flex-1 auto-rows-[104px] content-start`),children:[o&&(0,q.jsx)(P,{count:s}),!o&&n===`all`&&c.map(e=>(0,q.jsx)(er,{item:e,record:Mn(e,u),language:d,installState:f,manageState:p,onOpen:()=>m(e,Mn(e,u)),onInstall:h,onManage:g},e.id)),!o&&n===`installed`&&l.map(e=>(0,q.jsx)(er,{item:e.item,record:e.record,language:d,installState:f,manageState:p,onOpen:()=>m(e.item,e.record),onInstall:h,onManage:g},e.key))]})]})}function rr(t){let{entry:r,language:i,localeFallbacks:a,installState:o,layout:s=`rail`,onOpen:c,onInstall:l}=t,{item:u,record:d}=r,f=N(u.summaryI18n,u.summary,a),p=u.install.spec,m=o.installingSpecs.has(p),h=!!d;return(0,q.jsxs)(`article`,{onClick:()=>c(r),className:e(`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,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-start gap-2.5`,children:[(0,q.jsx)(Yn,{name:u.name,fallback:u.install.spec}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,q.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-gray-950`,children:u.name}),(0,q.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] font-mono leading-tight text-gray-400`,children:ir(u)})]})]}),(0,q.jsx)(`p`,{className:`line-clamp-2 text-[12px] leading-relaxed text-gray-500`,children:f}),(0,q.jsx)(ar,{tags:u.tags})]}),(0,q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-gray-100 pt-2.5`,children:[(0,q.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-gray-400`,children:or(u.updatedAt)}),h?(0,q.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 text-[11px] font-semibold text-emerald-700`,children:[(0,q.jsx)(Gt,{className:`h-3.5 w-3.5`}),sr({zh:`已安装`,en:`Installed`},i)]}):(0,q.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,q.jsx)(Ot,{className:`h-3.5 w-3.5`}),n(m?`marketplaceInstalling`:`marketplaceInstall`)]})]})]})}function ir(e){return e.slug||e.install.spec}function ar({tags:e}){let t=e.slice(0,2);return t.length===0?null:(0,q.jsx)(`div`,{className:`mt-2 truncate text-[11px] font-medium text-gray-400`,children:t.join(` / `)})}function or(e){return e.slice(0,10)||e}function sr(e,t){return t.startsWith(`zh`)?e.zh:e.en}var cr=[{scene:`development-debugging`,title:{zh:`开发与调试`,en:`Development`},summary:{zh:`代码审查、错误定位、架构分析与交付验证。`,en:`Review, debug, analyze, and verify delivery work.`},icon:$t,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:Wt,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:Zt,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:Jt,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:it,tone:`violet`,span:`md:col-span-1`},{scene:`social-platforms`,title:{zh:`社交平台`,en:`Social`},summary:{zh:`处理发布、互动、检索和内容分发。`,en:`Handle posting, interaction, search, and distribution.`},icon:Xt,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:Ne,tone:`teal`,span:`md:col-span-2`}],lr={icon:Ne,tone:`dark`,span:`md:col-span-2`},ur={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`}},dr=`grid grid-cols-[repeat(auto-fill,minmax(240px,320px))] justify-start gap-3`,fr=24;function pr(e){let{entries:t,scenes:n,isScenesLoading:r,isItemsLoading:i,language:a,installState:o,onOpen:s,onInstall:c,onOpenScene:l}=e,u=de(a),d=[...t].sort((e,t)=>br(e.item,t.item)).slice(0,6);return(0,q.jsxs)(`div`,{className:`mb-4 space-y-5`,children:[(0,q.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,q.jsx)(yr,{icon:qt,title:Q({zh:`场景`,en:`Scenes`},a),description:Q({zh:`按使用场景浏览适合的技能组合。`,en:`Browse skills by how you plan to use them.`},a)}),r?(0,q.jsx)(mr,{}):(0,q.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,q.jsx)(hr,{scene:e,language:a,onSelect:l},e.scene))})]}),(i||d.length>0)&&(0,q.jsx)(_r,{icon:Kt,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 mr(){return(0,q.jsx)(`div`,{"data-testid":`marketplace-scenes-skeleton`,className:`grid grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:cr.map(e=>(0,q.jsxs)(`div`,{className:`flex min-h-[74px] flex-col justify-center rounded-lg border border-gray-200/70 bg-white px-3 py-2.5 shadow-sm`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(U,{className:`h-7 w-7 shrink-0 rounded-md`}),(0,q.jsx)(U,{className:`h-3.5 min-w-0 flex-1`}),(0,q.jsx)(U,{className:`h-3 w-8 shrink-0`})]}),(0,q.jsx)(U,{className:`mt-2 h-3 w-4/5`})]},e.scene))})}function hr(t){let{scene:n,language:r,onSelect:i}=t,a=xr(n.scene),o=a.icon,s=ur[a.tone];return(0,q.jsx)(`button`,{type:`button`,onClick:()=>i(n.scene),className:e(`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,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`span`,{className:e(`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border`,s.icon),children:(0,q.jsx)(o,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-gray-950`,children:Sr(n,a,r)}),typeof n.count==`number`&&(0,q.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:wr(n.count,r)})]}),(0,q.jsx)(`p`,{className:e(`mt-1 line-clamp-1 text-[11px] leading-relaxed`,s.text),children:Cr(n,a,r)})]})})}function gr(t){let{scene:n,entries:r,isLoading:i,language:a,localeFallbacks:o,installState:s,onBack:c,onOpen:l,onInstall:u}=t,d=xr(n.scene),f=d.icon,p=ur[d.tone];return(0,q.jsxs)(`section`,{className:`flex min-h-full flex-col`,children:[(0,q.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-start gap-2.5`,children:[(0,q.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,q.jsx)(he,{className:`h-4 w-4`})}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`span`,{className:e(`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border`,p.icon),children:(0,q.jsx)(f,{className:`h-4 w-4`})}),(0,q.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[15px] font-semibold text-gray-950`,children:Sr(n,d,a)}),(0,q.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:Q(i?{zh:`加载中`,en:`Loading`}:{zh:`${r.length} 个技能`,en:`${r.length} skills`},a)})]}),(0,q.jsx)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-2`,children:(0,q.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[12px] leading-relaxed text-gray-500`,children:Cr(n,d,a)})})]})]}),i?(0,q.jsx)(`div`,{"data-testid":`marketplace-scene-skeleton`,className:e(dr,`min-h-0 flex-1 auto-rows-[166px] content-start`),children:(0,q.jsx)(P,{count:fr})}):r.length>0?(0,q.jsx)(`div`,{className:dr,children:r.map(e=>(0,q.jsx)(rr,{entry:e,language:a,localeFallbacks:o,installState:s,layout:`grid`,onOpen:l,onInstall:u},e.item.id))}):(0,q.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 _r(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,q.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,q.jsx)(yr,{icon:t,title:n,description:r}),s?(0,q.jsx)(vr,{}):(0,q.jsx)(`div`,{className:`-mx-1 flex gap-2.5 overflow-x-auto px-1 pb-1.5 custom-scrollbar`,children:i.map(e=>(0,q.jsx)(rr,{entry:e,language:a,localeFallbacks:o,installState:c,onOpen:l,onInstall:u},e.item.id))})]})}function vr(){return(0,q.jsx)(`div`,{"data-testid":`marketplace-recent-skeleton`,className:`-mx-1 flex gap-2.5 overflow-hidden px-1 pb-1.5`,children:Array.from({length:4},(e,t)=>(0,q.jsxs)(`article`,{className:`flex min-h-[166px] w-[260px] shrink-0 flex-col justify-between rounded-xl border border-gray-200/70 bg-white p-3 shadow-sm`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-start gap-2.5`,children:[(0,q.jsx)(U,{className:`h-10 w-10 shrink-0 rounded-xl`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5 pt-0.5`,children:[(0,q.jsx)(U,{className:`h-3.5 w-32 max-w-full`}),(0,q.jsx)(U,{className:`h-3 w-24 max-w-full`})]})]}),(0,q.jsx)(U,{className:`h-3 w-full`}),(0,q.jsx)(U,{className:`mt-1.5 h-3 w-4/5`}),(0,q.jsx)(U,{className:`mt-2 h-3 w-24`})]}),(0,q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-gray-100 pt-2.5`,children:[(0,q.jsx)(U,{className:`h-3 w-20`}),(0,q.jsx)(U,{className:`h-7 w-16 rounded-md`})]})]},`marketplace-recent-skeleton-${t}`))})}function yr({icon:e,title:t,description:n}){return(0,q.jsx)(`div`,{className:`flex items-end justify-between gap-4`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`h3`,{className:`flex items-center gap-2 text-[14px] font-semibold text-gray-950`,children:[(0,q.jsx)(e,{className:`h-4 w-4 text-primary`}),t]}),(0,q.jsx)(`p`,{className:`mt-0.5 text-[12px] leading-relaxed text-gray-500`,children:n})]})})}function br(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 xr(e){return cr.find(t=>t.scene===e)??{scene:e,...lr}}function Sr(e,t,n){return t.title?Q(t.title,n):e.title}function Cr(e,t,n){return t.summary?Q(t.summary,n):e.description??e.scene}function wr(e,t){return t.startsWith(`zh`)?`${e} 个技能`:`${e} skills`}function Tr(e){let{items:t,installedRecordLookup:n,scene:r,forcedType:i,typeFilter:a,scope:o,searchText:s,query:c,showListSkeleton:l,hasCatalogError:u}=e,d=wn(a===`skill`),f=(0,K.useMemo)(()=>d.data?.scenes??[],[d.data?.scenes]),p=Tn(f,a===`skill`),m=(0,K.useMemo)(()=>f.map(e=>({...e,count:typeof e.count==`number`?e.count:p.get(e.scene)})),[p,f]),h=(0,K.useMemo)(()=>t.map(e=>({item:e,record:Mn(e,n)})),[t,n]),g=(0,K.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`}}var Er=20,Dr=36;function Or(){return{pageTitle:`marketplaceSkillsPageTitle`,pageDescription:`marketplaceSkillsPageDescription`,tabMarketplace:`marketplaceTabMarketplaceSkills`,tabInstalled:`marketplaceTabInstalledSkills`,searchPlaceholder:`marketplaceSearchPlaceholderSkills`,sectionCatalog:`marketplaceSectionSkills`,sectionInstalled:`marketplaceSectionInstalledSkills`,errorLoadData:`marketplaceErrorLoadingSkillsData`,errorLoadInstalled:`marketplaceErrorLoadingInstalledSkills`,emptyData:`marketplaceNoSkills`,emptyInstalled:`marketplaceNoInstalledSkills`,installedCountSuffix:`marketplaceInstalledSkillsCountSuffix`}}function kr(e={}){let{forcedType:t}=e,r=ae(),i=oe(),{language:a}=Ke(),s=Se(),c=`skill`,l=(0,K.useMemo)(()=>de(a),[a]),u=Or(),[d,f]=(0,K.useState)(``),[p,m]=(0,K.useState)(``),[h,_]=(0,K.useState)(`all`),[v,y]=(0,K.useState)(`relevance`),[b,x]=(0,K.useState)(new Set),[S,C]=(0,K.useState)(new Map),w=(0,K.useRef)({byKey:new Map,seq:0});(0,K.useEffect)(()=>{let e=setTimeout(()=>{m(d.trim())},250);return()=>clearTimeout(e)},[d]);let T=En(c),E=c===`skill`?i.scene?.trim():void 0,D=Sn({q:E?void 0:p||void 0,scene:E,type:c,sort:v,pageSize:Er}),O=le({disabled:h!==`all`||D.isError||!D.hasNextPage||D.isFetchingNextPage,onLoadMore:()=>D.fetchNextPage(),watchValue:`${c}:${h}:${p}:${E??``}:${v}:${D.data?.loadedItems??0}:${D.data?.loadedPages??0}`});(0,K.useEffect)(()=>{let e=O.containerRef.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[O.containerRef,p,E,h,v,c]);let ee=Dn(),te=On(),{confirm:ne,ConfirmDialog:re}=dt(),k=(0,K.useMemo)(()=>T.data?.records??[],[T.data?.records]),A=(0,K.useMemo)(()=>D.data?.items??[],[D.data?.items]),j=(0,K.useMemo)(()=>An(A),[A]),ie=(0,K.useMemo)(()=>jn(k),[k]),M=(0,K.useMemo)(()=>{let e=k.filter(e=>e.type===c).map(e=>({key:`${e.type}:${e.spec}:${e.id??``}`,record:e,item:Nn(e,j)})).filter(e=>Pn(e.record,e.item,p,l));return e.sort((e,t)=>{let n=e.record.installedAt?Date.parse(e.record.installedAt):NaN,r=t.record.installedAt?Date.parse(t.record.installedAt):NaN;return!Number.isNaN(n)&&!Number.isNaN(r)&&n!==r?r-n:e.record.spec.localeCompare(t.record.spec)}),e},[k,c,j,p,l]),ce=h===`installed`?M.length:D.data?.total??0,P={showCatalog:h===`all`&&D.isLoading&&!D.data,showInstalled:h===`installed`&&T.isLoading&&!T.data},F=P.showCatalog||P.showInstalled,fe=(0,K.useMemo)(()=>h===`installed`?T.isLoading&&!T.data?n(`loading`):`${M.length} ${n(u.installedCountSuffix)}`:D.data?`${A.length} / ${ce}`:n(`loading`),[h,T.data,T.isLoading,M.length,D.data,A.length,ce,u.installedCountSuffix]),I={installingSpecs:b},pe={actionsByTarget:S},L=Tr({items:A,installedRecordLookup:ie,scene:E,forcedType:t,typeFilter:c,scope:h,searchText:d,query:p,showListSkeleton:F,hasCatalogError:D.isError}),R=async e=>{let t=e.install.spec;if(!b.has(t)){x(e=>{let n=new Set(e);return n.add(t),n});try{await ee.mutateAsync({type:e.type,spec:t,kind:e.install.kind,skill:e.slug,installPath:`skills/${e.slug}`})}catch{}finally{x(e=>{if(!e.has(t))return e;let n=new Set(e);return n.delete(t),n})}}},me=async(e,t)=>{let r=t.id||t.spec;if(r&&!S.has(r)&&!(e===`uninstall`&&!await ne({title:`${n(`marketplaceUninstallTitle`)} ${r}?`,description:n(`marketplaceUninstallDescription`),confirmLabel:n(`marketplaceUninstall`),variant:`destructive`}))){C(t=>{let n=new Map(t);return n.set(r,e),n});try{await te.mutateAsync({type:t.type,action:e,id:r,spec:t.spec})}finally{C(e=>{if(!e.has(r))return e;let t=new Map(e);return t.delete(r),t})}}},z=async(e,t)=>{let r=e?.name??t?.label??t?.id??t?.spec??n(`marketplaceUnknownItem`),i=e?`marketplace:${e.type}:${e.slug}`:`marketplace:${t?.type??`unknown`}:${t?.id??t?.spec??r}`,a={title:r,kind:`content`,dedupeKey:i},o={...a,activate:!1};if(!e){let e=Z({title:r,typeLabel:n(`marketplaceTypeSkill`),spec:t?.spec??`-`,summary:n(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify(t??{},null,2),contentRaw:`-`});s.open(e,a);return}let c=w.current.seq+1;w.current.seq=c,w.current.byKey.set(i,c);let u=N(e.summaryI18n,e.summary,l),d={typeLabel:n(`marketplaceTypeSkill`),loadContent:()=>g(e.slug),fallbackContent:n(`marketplaceOperationFailed`),defaultContent:void 0};s.open(Z({title:r,typeLabel:d.typeLabel,spec:e.install.spec,loading:!0}),a);try{let t=await d.loadContent();if(w.current.byKey.get(i)!==c)return;let n=Z({title:r,typeLabel:d.typeLabel,spec:e.install.spec,summary:u,metadataRaw:t.metadataRaw,contentRaw:t.bodyRaw||t.raw||d.defaultContent,sourceUrl:t.sourceUrl,sourceLabel:`Source (${t.source})`,tags:e.tags,author:e.author});s.open(n,o)}catch(t){if(w.current.byKey.get(i)!==c)return;let n=Z({title:r,typeLabel:d.typeLabel,spec:e.install.spec,summary:u,metadataRaw:JSON.stringify({error:t instanceof Error?t.message:String(t)},null,2),contentRaw:d.fallbackContent});s.open(n,o)}};return(0,q.jsxs)(o,{className:`flex h-full min-h-0 flex-col pb-0`,children:[!L.isSceneRoute&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Rt,{tabs:[{id:`all`,label:n(u.tabMarketplace)},{id:`installed`,label:n(u.tabInstalled),count:T.data?.total??0}],activeTab:h,onChange:e=>_(e),className:`mb-3`}),(0,q.jsx)(se,{scope:h,searchText:d,searchPlaceholder:n(u.searchPlaceholder),sort:v,onSearchTextChange:f,onSortChange:y})]}),(0,q.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[!L.isSceneRoute&&!L.showShelves&&!F&&(0,q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,q.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-900`,children:h===`installed`?n(u.sectionInstalled):a.startsWith(`zh`)?`全部技能`:`All Skills`}),(0,q.jsx)(`span`,{className:`text-[12px] text-gray-500`,children:fe})]}),h===`all`&&D.isError&&(0,q.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[n(u.errorLoadData),`: `,D.error.message]}),h===`installed`&&T.isError&&(0,q.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[n(u.errorLoadInstalled),`: `,T.error.message]}),(0,q.jsxs)(`div`,{ref:O.containerRef,className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar pr-1`,"aria-busy":F||D.isFetchingNextPage,children:[L.isSceneRoute&&L.selectedScene&&(0,q.jsx)(gr,{scene:L.selectedScene,entries:L.sceneEntries,isLoading:F,language:a,localeFallbacks:l,installState:I,onBack:()=>r(L.backPath),onOpen:e=>void z(e.item,e.record),onInstall:R}),L.showShelves&&(0,q.jsx)(pr,{entries:L.entries,scenes:L.scenes,isScenesLoading:L.isScenesLoading,isItemsLoading:F,language:a,installState:I,onOpen:e=>void z(e.item,e.record),onInstall:R,onOpenScene:e=>r(`${L.pathPrefix}/${e}`)}),!L.isSceneRoute&&(0,q.jsx)(nr,{scope:h,title:h===`installed`?n(u.sectionInstalled):a.startsWith(`zh`)?`全部技能`:`All Skills`,summary:fe,showTitle:L.showShelves,showListSkeleton:F,skeletonCardCount:Dr,allItems:A,installedEntries:M,installedRecordLookup:ie,language:a,installState:I,manageState:pe,onOpen:(e,t)=>void z(e,t),onInstall:R,onManage:me}),h===`all`&&!L.isSceneRoute&&!F&&!D.isError&&A.length===0&&(0,q.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:n(u.emptyData)}),h===`installed`&&!L.isSceneRoute&&!F&&!T.isError&&M.length===0&&(0,q.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:n(u.emptyInstalled)}),h===`all`&&!F&&!D.isError&&(0,q.jsx)(ue,{hasMore:!!D.hasNextPage,loading:D.isFetchingNextPage,sentinelRef:O.sentinelRef})]})]}),(0,q.jsx)(re,{})]})}function Ar(e){let{view:t,routeSessionKey:n,selectedSessionKey:r,setSelectedSessionKey:i,selectedSessionKeyRef:a,resetStreamState:o}=e;(0,K.useEffect)(()=>{if(t===`chat`){if(n){r!==n&&i(n);return}r!==null&&(i(null),o())}},[o,n,r,i,t]),(0,K.useEffect)(()=>{a.current=r},[r,a])}function jr({view:e,confirmDialog:t}){let{isMobile:n}=It();return(0,q.jsxs)(`div`,{className:`h-full flex`,children:[n?null:(0,q.jsx)(rt,{}),e===`chat`?n?(0,q.jsx)(At,{}):(0,q.jsx)(_t,{}):(0,q.jsx)(`section`,{className:`flex-1 min-h-0 overflow-hidden bg-gradient-to-b from-gray-50/60 to-white`,children:e===`cron`?(0,q.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,q.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1120px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,q.jsx)(hn,{})})}):e===`agents`?(0,q.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,q.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1180px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,q.jsx)(dn,{})})}):(0,q.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,q.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,q.jsx)(kr,{forcedType:`skills`})})})}),t]})}function Mr(e,t){return e.filter(e=>Ye(e,t))}function Nr(e){let{config:t,meta:n}=e;return(0,K.useMemo)(()=>{let e=_e({meta:n,config:t,onlyConfigured:!0}),r=new Set,i=[];for(let t of e)for(let e of t.models){let n=ve(t.prefix,e);!n||r.has(n)||(r.add(n),i.push({value:n,modelLabel:e,providerLabel:t.displayName,thinkingCapability:ge(t.modelThinking,e,t.aliases)}))}return i.sort((e,t)=>{let n=e.providerLabel.localeCompare(t.providerLabel);return n===0?e.modelLabel.localeCompare(t.modelLabel):n})},[t,n])}function Pr(e){let{sessions:t,sessionKey:n,sessionType:r}=e;return{recentSessionPreferredModel:(0,K.useMemo)(()=>bt({sessions:t,selectedSessionKey:n??``,sessionType:r,readPreference:e=>e.preferredModel?.trim()||void 0}),[n,r,t]),recentSessionPreferredThinking:(0,K.useMemo)(()=>bt({sessions:t,selectedSessionKey:n??``,sessionType:r,readPreference:e=>e.preferredThinking??void 0}),[n,r,t])}}function Fr(e){let{currentSelectedModel:t,modelOptions:n}=e,r=(0,K.useMemo)(()=>n.find(e=>e.value===t),[t,n]);return{supportedThinkingLevels:(0,K.useMemo)(()=>r?.thinkingCapability?.supported??[],[r?.thinkingCapability?.supported]),defaultThinkingLevel:(0,K.useMemo)(()=>r?.thinkingCapability?.default??null,[r?.thinkingCapability?.default])}}function Ir(e){let{modelOptions:t,supportedModels:n}=e;if(!n||n.length===0)return t;let r=new Set(n),i=t.filter(e=>r.has(e.value));return i.length>0?i:t}function Lr(e){let{currentSelectedModel:t,pendingSessionType:n,projectRootOverride:r,query:i,sessionKey:a,setPendingSessionType:o,setSelectedModel:s,setSelectedThinkingLevel:c}=e,l=$e(),u=He(),d=kt({limit:200}),f=Dt(),p=Ct({sessionId:a?.trim()||`draft-session`,...Object.prototype.hasOwnProperty.call(e,`projectRootOverride`)?{projectRoot:r??null}:{}}),m=(l.isFetched||l.isSuccess)&&(u.isFetched||u.isSuccess),h=Nr({config:l.data,meta:u.data}),g=(0,K.useMemo)(()=>d.data?.sessions??[],[d.data?.sessions]),_=(0,K.useMemo)(()=>Oe(g),[g]),v=(0,K.useMemo)(()=>Mr(_,i),[_,i]),y=(0,K.useMemo)(()=>_.find(e=>e.key===a)??null,[_,a]),b=(0,K.useMemo)(()=>p.data?.records??[],[p.data?.records]),x=Ge({selectedSession:y,pendingSessionType:n,setPendingSessionType:o,sessionTypesData:f.data}),S=(0,K.useMemo)(()=>Ir({modelOptions:h,supportedModels:x.selectedSessionTypeOption?.supportedModels}),[h,x.selectedSessionTypeOption?.supportedModels]),{recentSessionPreferredModel:C,recentSessionPreferredThinking:w}=Pr({sessions:_,sessionKey:a,sessionType:x.selectedSessionType}),{supportedThinkingLevels:T,defaultThinkingLevel:E}=Fr({currentSelectedModel:t,modelOptions:S});return Et({modelOptions:S,selectedSessionKey:a??``,selectedSessionExists:!!y,selectedSessionPreferredModel:y?.preferredModel,fallbackPreferredModel:x.selectedSessionTypeOption?.recommendedModel??C,defaultModel:x.selectedSessionTypeOption?.recommendedModel??l.data?.agents.defaults.model,setSelectedModel:s}),ft({supportedThinkingLevels:T,selectedSessionKey:a??``,selectedSessionExists:!!y,selectedSessionPreferredThinking:y?.preferredThinking??null,fallbackPreferredThinking:w??null,defaultThinkingLevel:E,setSelectedThinkingLevel:c}),{configQuery:l,configMetaQuery:u,sessionsQuery:d,sessionTypesQuery:f,sessionSkillsQuery:p,isProviderStateResolved:m,modelOptions:S,sessionSummaries:g,sessions:v,skillRecords:b,selectedSession:y,...x}}function Rr(e){return e.parentSessionKey?e.sessionSummaries.map(Be).filter(t=>t.parentSessionId===e.parentSessionKey).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)).map(e=>({sessionKey:e.key,parentSessionKey:e.parentSessionId??null,label:e.label??null,agentId:e.agentId??null})):[]}function zr(e){let{availableAgents:t,parentSessionId:n,selectedAgentId:r,selectedSession:i,selectedSessionType:a,sessionKey:o,sessionSummaries:s,sessionTypeOptions:c}=e,l=i?Te(i):void 0,u=i?.agentId??r,d=t.find(e=>e.id===u)??null,f=(0,K.useMemo)(()=>{if(!n)return null;let e=s.find(e=>e.sessionId===n)??null;return e?Be(e):null},[n,s]),p=c.find(e=>e.value===a)??null;return{currentSessionDisplayName:l,currentAgentId:u,currentAgent:d,parentSession:f,currentSessionTypeLabel:p?.label??W(a),currentSessionTypeIcon:p?.icon??null,currentChildSessionTabs:(0,K.useMemo)(()=>Rr({parentSessionKey:o,sessionSummaries:s}),[o,s])}}function Br(e){(0,K.useEffect)(()=>{e.presenter.chatInputManager.syncSnapshot({isProviderStateResolved:e.isProviderStateResolved,defaultSessionType:e.defaultSessionType,canStopGeneration:e.canStopCurrentRun,stopDisabledReason:e.stopDisabledReason,stopSupported:!0,stopReason:void 0,sendError:e.lastSendError,isSending:e.isSending,modelOptions:e.modelOptions,sessionTypeOptions:e.sessionTypeOptions,selectedSessionType:e.selectedSessionType,canEditSessionType:e.canEditSessionType,sessionTypeUnavailable:e.sessionTypeUnavailable,skillRecords:e.skillRecords,isSkillsLoading:e.isSkillsLoading}),e.presenter.chatThreadManager.syncSnapshot({isProviderStateResolved:e.isProviderStateResolved,modelOptions:e.modelOptions,sessionTypeUnavailable:e.sessionTypeUnavailable,sessionTypeUnavailableMessage:e.sessionTypeUnavailableMessage,sessionTypeLabel:e.currentSessionTypeLabel,sessionTypeIcon:e.currentSessionTypeIcon,sessionKey:e.sessionKey??null,agentId:e.currentAgentId,agentDisplayName:e.currentAgent?.displayName??null,agentAvatarUrl:e.currentAgent?.avatarUrl??null,availableAgents:e.availableAgents,sessionDisplayName:e.currentSessionDisplayName,sessionProjectRoot:e.effectiveSessionProjectRoot,sessionProjectName:e.effectiveSessionProjectName,canDeleteSession:!!e.selectedSession,threadRef:e.threadRef,isHistoryLoading:e.agent.isHydrating,messages:e.agent.visibleMessages,isSending:e.isSending,isAwaitingAssistantOutput:e.isAwaitingAssistantOutput,contextWindow:ke(e.agent.snapshot.contextWindow),parentSessionKey:e.parentSession?.key??null,parentSessionLabel:e.parentSession?Te(e.parentSession):null,childSessionTabs:e.childSessionTabs})},[e])}function Vr(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function $(e,t){return e?Object.fromEntries(t.map(t=>[t,e])):{}}function Hr(e){let t=we(e.projectRoot),n={...$(e.model?.trim(),[`model`,`preferred_model`]),...$(e.thinkingLevel?.trim(),[`thinkingEffort`,`thinking`,`preferred_thinking`]),...$(e.sessionType?.trim(),[`agentRuntimeId`,`session_type`,`runtime`]),...$(e.agentId?.trim(),[`agentId`,`agent_id`]),...$(t??void 0,[`projectRoot`,`project_root`])},r=Vr(e.requestedSkills);r.length>0&&(n.requested_skill_refs=r);let i=e.composerNodes?Ie(e.composerNodes):[];return i.length>0&&(n[mt]=i),n}function Ur(e){let{pendingProjectRoot:t,pendingProjectRootSessionKey:n,sessionKey:r,selectedSessionProjectRoot:i}=e;return t!==null&&n!==null&&r===n&&(i??null)===t}function Wr(e){let t=je(e=>e.snapshot.query),n=je(e=>e.snapshot.selectedSessionKey),r=je(e=>e.snapshot.selectedAgentId),i=B(e=>e.snapshot.pendingSessionType),a=B(e=>e.snapshot.pendingProjectRoot),o=B(e=>e.snapshot.pendingProjectRootSessionKey),s=B(e=>e.snapshot.selectedModel),c=C(),l=Re(c),u=Ee(),{confirm:d,ConfirmDialog:f}=dt(),p=ie(),m=ae(),{sessionId:h}=oe(),g=(0,K.useRef)(null),_=(0,K.useRef)(n),v=(0,K.useMemo)(()=>St(h),[h]),y=v??void 0,b=a!==null&&(!y||o===y),x=Lr({query:t,sessionKey:y??null,projectRootOverride:b?a:void 0,currentSelectedModel:s,pendingSessionType:i,setPendingSessionType:e.chatInputManager.setPendingSessionType,setSelectedModel:e.chatInputManager.setSelectedModel,setSelectedThinkingLevel:e.chatInputManager.setSelectedThinkingLevel});return{presenter:e,selectedSessionKey:n,selectedAgentId:r,pendingProjectRoot:a,pendingProjectRootSessionKey:o,systemStatus:c,isRuntimeBlocked:l,agentsQuery:u,confirm:d,ConfirmDialog:f,location:p,navigate:m,threadRef:g,selectedSessionKeyRef:_,routeSessionKey:v,sessionKey:y,hasSessionProjectRootOverride:b,agent:et(y),...x}}function Gr(e){let t=Wr(e),{agent:n,agentsQuery:r,hasSessionProjectRootOverride:i,pendingProjectRoot:a,isRuntimeBlocked:o,systemStatus:s,selectedAgentId:c,selectedSession:l,selectedSessionType:u,sessionKey:d,sessionSummaries:f,sessionTypeOptions:p}=t,m=i?a:l?.projectRoot??null,h=i?gt(m):l?.projectName??gt(m),g=n.hydrateError?.message??n.snapshot.error?.message??null,_=s.phase===`ready`&&ut(g)?null:g,v=(r.data?.agents?.length??0)>0?r.data?.agents??[]:[{id:l?.agentId??c}],y=zr({sessionKey:d??null,selectedSession:l,selectedAgentId:c,availableAgents:v,parentSessionId:l?.parentSessionId??null,sessionSummaries:f,selectedSessionType:u,sessionTypeOptions:p}),b=n.isRunning||l?.status===`running`;return{...t,availableAgents:v,effectiveSessionProjectRoot:m,effectiveSessionProjectName:h,isSending:n.isSending||b,isAwaitingAssistantOutput:b,canStopCurrentRun:b,stopDisabledReason:b?null:`__preparing__`,lastSendError:o?null:s.phase===`ready`?_:Ve({message:_,status:s}),...y}}function Kr(e){let{agent:t,pendingProjectRoot:n,pendingProjectRootSessionKey:r,presenter:i,selectedSession:a,selectedSessionKeyRef:o,sessionKey:s}=e;(0,K.useEffect)(()=>{i.chatStreamActionsManager.bind({sendMessage:async e=>{if((e.sessionKey??null)!==(s??null))return;let o=Hr({agentId:e.agentId,model:e.model,thinkingLevel:e.thinkingLevel,sessionType:e.sessionType,projectRoot:!e.sessionKey||e.sessionKey===r?n:a?.projectRoot??null,requestedSkills:e.requestedSkills,composerNodes:e.composerNodes}),c=Fe({sessionId:e.sessionKey,text:e.message,attachments:e.attachments,parts:e.parts,metadata:o});if(c)try{let n=await t.send(c);!e.sessionKey&&n?.sessionId&&i.chatSessionListManager.materializeRootSessionRoute(n.sessionId)}catch(t){throw e.restoreDraftOnError&&(e.composerNodes&&e.composerNodes.length>0?i.chatInputManager.restoreComposerState?.(e.composerNodes,e.attachments??[]):i.chatInputManager.setDraft(t=>t.trim().length===0?e.message:t)),t}},stopCurrentRun:async()=>{await t.abort()},resumeRun:async e=>{e.sessionKey===s&&await t.streamRun()},resetStreamState:()=>{o.current=null},applyHistoryMessages:()=>{}})},[t,n,r,i,a?.projectRoot,o,s])}function qr(e){let{pendingProjectRoot:t,pendingProjectRootSessionKey:n,selectedSession:r}=e;(0,K.useEffect)(()=>{!r||!Ur({pendingProjectRoot:t,pendingProjectRootSessionKey:n,sessionKey:r.key,selectedSessionProjectRoot:r.projectRoot??null})||B.getState().setSnapshot({pendingProjectRoot:null,pendingProjectRootSessionKey:null})},[t,n,r])}function Jr(e){let{confirm:t,location:n,navigate:r,presenter:i}=e;(0,K.useEffect)(()=>{i.chatUiManager.syncState({pathname:n.pathname}),i.chatUiManager.bindActions({navigate:r,confirm:t})},[t,n.pathname,r,i])}function Yr(e){let{presenter:t,selectedAgentId:n,selectedSession:r}=e;(0,K.useEffect)(()=>{!r?.agentId||n===r.agentId||t.chatSessionListManager.setSelectedAgentId(r.agentId)},[t,n,r?.agentId])}function Xr(e){let{agent:t,presenter:n,routeSessionKey:r}=e,i=t.snapshot.activeRun?.sessionId??t.visibleMessages.find(e=>e.sessionId.trim())?.sessionId??null;(0,K.useEffect)(()=>{r||!i||n.chatSessionListManager.materializeRootSessionRoute(i)},[i,n,r])}function Zr({view:e}){let[t]=(0,K.useState)(()=>new tt),n=Gr(t);return Kr(n),qr(n),Jr(n),Yr(n),Xr(n),Ar({view:e,routeSessionKey:n.routeSessionKey,selectedSessionKey:n.selectedSessionKey,setSelectedSessionKey:t.chatSessionListManager.setSelectedSessionKey,selectedSessionKeyRef:n.selectedSessionKeyRef,resetStreamState:t.chatStreamActionsManager.resetStreamState}),Br({presenter:t,isProviderStateResolved:n.isProviderStateResolved,defaultSessionType:n.defaultSessionType,canStopCurrentRun:n.canStopCurrentRun,stopDisabledReason:n.stopDisabledReason,lastSendError:n.lastSendError,isSending:n.isSending,modelOptions:n.modelOptions,sessionTypeOptions:n.sessionTypeOptions,selectedSessionType:n.selectedSessionType,canEditSessionType:n.canEditSessionType,sessionTypeUnavailable:n.sessionTypeUnavailable,skillRecords:n.skillRecords,isSkillsLoading:n.sessionSkillsQuery.isLoading,sessionTypeUnavailableMessage:n.sessionTypeUnavailableMessage,currentSessionTypeLabel:n.currentSessionTypeLabel,currentSessionTypeIcon:n.currentSessionTypeIcon,sessionKey:n.sessionKey,currentAgentId:n.currentAgentId,currentAgent:n.currentAgent,availableAgents:n.availableAgents,currentSessionDisplayName:n.currentSessionDisplayName,effectiveSessionProjectRoot:n.effectiveSessionProjectRoot,effectiveSessionProjectName:n.effectiveSessionProjectName,selectedSession:n.selectedSession,threadRef:n.threadRef,agent:n.agent,isAwaitingAssistantOutput:n.isAwaitingAssistantOutput,parentSession:n.parentSession,childSessionTabs:n.currentChildSessionTabs}),(0,q.jsx)(We,{presenter:t,children:(0,q.jsx)(jr,{view:e,confirmDialog:(0,q.jsx)(n.ConfirmDialog,{})})})}function Qr({view:e}){return(0,q.jsx)(Zr,{view:e})}export{Qr as ChatPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as e,i as t,m as n,n as r}from"./react-B2X_ph0a.js";import{At as i,Dt as a,Et as o,Nt as s,Ot as c,Tt as l,ft as u,jt as d,kt as f,mt as p,pt as m,wt as h}from"./api-DruAcori.js";import{t as g}from"./external-link-C3usm3se.js";import{J as _,K as v,Qt as y,X as b,Y as x,Zt as S,q as C,sn as w}from"./index-GVTiCf1s.js";var T=n(),E={checking:`desktopUpdatesStatusChecking`,"update-available":`desktopUpdatesStatusAvailable`,downloading:`desktopUpdatesStatusDownloading`,downloaded:`desktopUpdatesStatusDownloaded`,"up-to-date":`desktopUpdatesStatusUpToDate`,blocked:`desktopUpdatesStatusBlocked`,failed:`desktopUpdatesStatusFailed`};function D({status:t}){return(0,T.jsx)(`span`,{className:e(`inline-flex rounded-full px-3 py-1 text-xs font-medium ring-1`,L(t)),children:I(t)})}function O({label:e,value:t}){return(0,T.jsxs)(`div`,{className:`rounded-xl border border-gray-200 bg-gray-50/60 p-4`,children:[(0,T.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-[0.08em] text-gray-500`,children:e}),(0,T.jsx)(`p`,{className:`mt-2 text-base font-semibold text-gray-900`,children:t})]})}function k({snapshot:e}){if(e.status!==`downloading`)return null;let n=e.progress?.percent,r=n==null?t(`desktopUpdatesDownloadProgressUnknown`):t(`desktopUpdatesDownloadProgressPercent`).replace(`{percent}`,String(n)),i=N(e.progress?.downloadedBytes??0,e.progress?.totalBytes??null);return(0,T.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 p-4`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-amber-800`,children:r}),(0,T.jsx)(`p`,{className:`text-xs font-medium text-amber-700`,children:i})]}),(0,T.jsx)(`div`,{className:`mt-3 h-2 overflow-hidden rounded-full bg-amber-100`,children:(0,T.jsx)(`div`,{className:`h-full rounded-full bg-amber-500 transition-[width]`,style:{width:`${n??0}%`}})})]})}function A({label:e,help:t,checked:n,disabled:r,onCheckedChange:i}){return(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-4 rounded-xl border border-gray-200 p-4`,children:[(0,T.jsxs)(`div`,{className:`space-y-1`,children:[(0,T.jsx)(d,{children:e}),(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:t})]}),(0,T.jsx)(u,{checked:n,disabled:r,onCheckedChange:i})]})}function j(e){return e?.trim()||`-`}function M(e){return e?r(e):`-`}function N(e,t){let n=P(e);return t&&t>0?`${n} / ${P(t)}`:n}function P(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=10||r===0?n.toFixed(0):n.toFixed(1)} ${t[r]}`}function F(e){return t(e===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}function I(e){return t(E[e]??`desktopUpdatesStatusIdle`)}function L(e){return e===`downloaded`?`bg-emerald-50 text-emerald-700 ring-emerald-100`:e===`update-available`||e===`downloading`||e===`checking`?`bg-amber-50 text-amber-700 ring-amber-100`:e===`failed`||e===`blocked`?`bg-red-50 text-red-700 ring-red-100`:`bg-gray-100 text-gray-700 ring-gray-200`}function R(){return(0,T.jsxs)(i,{className:`space-y-6`,children:[(0,T.jsx)(f,{title:t(`runtimeUpdatesPageTitle`),description:t(`runtimeUpdatesPageDescription`)}),(0,T.jsxs)(h,{children:[(0,T.jsxs)(a,{children:[(0,T.jsx)(c,{children:t(`runtimeUpdatesUnavailableTitle`)}),(0,T.jsx)(o,{children:t(`runtimeUpdatesUnavailableDescription`)})]}),(0,T.jsx)(l,{children:(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`runtimeUpdatesUnavailableHint`)})})]})]})}function z(){let{supported:n,initialized:r,busyAction:u,snapshot:E}=p();if(!r)return(0,T.jsx)(`div`,{className:`p-8 text-gray-400`,children:t(`loading`)});if(!n||!E)return(0,T.jsx)(R,{});let N=u===`checking`,P=u===`downloading`,I=u===`applying`,L=u===`saving-preferences`,z=u===`switching-channel`,B=E.status===`update-available`&&!P&&!I,V=E.status===`downloaded`&&!I,H=[[t(`runtimeUpdatesHostVersion`),j(E.hostVersion)],[t(`desktopUpdatesCurrentBundleVersion`),j(E.currentVersion)],[t(`desktopUpdatesAvailableVersion`),j(E.availableVersion)],[t(`desktopUpdatesLastCheckedAt`),M(E.lastCheckedAt)],[t(`desktopUpdatesCurrentChannel`),F(E.channel)]];return(0,T.jsxs)(i,{className:`space-y-6`,children:[(0,T.jsx)(f,{title:t(`runtimeUpdatesPageTitle`),description:t(`runtimeUpdatesPageDescription`),actions:(0,T.jsxs)(s,{variant:`outline`,onClick:()=>void m.checkForUpdates(),disabled:N||P||I,children:[(0,T.jsx)(y,{className:e(`mr-2 h-4 w-4`,N&&`animate-spin`)}),t(`desktopUpdatesCheckNow`)]})}),(0,T.jsxs)(h,{children:[(0,T.jsxs)(a,{children:[(0,T.jsx)(c,{children:t(`desktopUpdatesOverviewTitle`)}),(0,T.jsx)(o,{children:t(`desktopUpdatesOverviewDescription`)})]}),(0,T.jsxs)(l,{className:`space-y-5`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,T.jsx)(`span`,{className:`text-sm font-medium text-gray-700`,children:t(`desktopUpdatesStatusLabel`)}),(0,T.jsx)(D,{status:E.status})]}),(0,T.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-5`,children:H.map(([e,t])=>(0,T.jsx)(O,{label:e,value:t},e))}),E.channel===`beta`?(0,T.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 p-4`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-amber-800`,children:t(`desktopUpdatesBetaBadgeTitle`)}),(0,T.jsx)(`p`,{className:`mt-1 text-sm text-amber-700`,children:t(`desktopUpdatesBetaBadgeDescription`)})]}):null,E.downloadedVersion?(0,T.jsxs)(`div`,{className:`rounded-2xl border border-emerald-200 bg-emerald-50/70 p-4`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-emerald-800`,children:t(`desktopUpdatesDownloadedBannerTitle`)}),(0,T.jsx)(`p`,{className:`mt-1 text-sm text-emerald-700`,children:t(`runtimeUpdatesDownloadedBannerDescription`).replace(`{version}`,E.downloadedVersion)})]}):null,(0,T.jsx)(k,{snapshot:E}),E.status===`blocked`?(0,T.jsxs)(`div`,{className:`rounded-2xl border border-red-200 bg-red-50/70 p-4`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-red-800`,children:t(`desktopUpdatesBlockedTitle`)}),(0,T.jsx)(`p`,{className:`mt-1 text-sm text-red-700`,children:E.errorMessage??t(`desktopUpdatesBlockedDescription`)}),E.recoveryCommand?(0,T.jsx)(`code`,{className:`mt-3 block rounded-lg bg-white/70 px-3 py-2 text-xs text-red-800`,children:E.recoveryCommand}):null]}):null,E.errorMessage&&E.status!==`blocked`?(0,T.jsx)(`div`,{className:`rounded-2xl border border-red-200 bg-red-50/70 p-4 text-sm text-red-700`,children:E.errorMessage}):null]})]}),(0,T.jsxs)(h,{children:[(0,T.jsxs)(a,{children:[(0,T.jsx)(c,{children:t(`desktopUpdatesPreferencesTitle`)}),(0,T.jsx)(o,{children:t(`desktopUpdatesPreferencesDescription`)})]}),(0,T.jsxs)(l,{className:`space-y-5`,children:[(0,T.jsx)(`div`,{className:`rounded-xl border border-gray-200 p-4`,children:(0,T.jsxs)(`div`,{className:`space-y-3`,children:[(0,T.jsxs)(`div`,{className:`space-y-1`,children:[(0,T.jsx)(d,{children:t(`desktopUpdatesReleaseChannel`)}),(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`desktopUpdatesReleaseChannelHelp`)})]}),(0,T.jsxs)(v,{value:E.channel,disabled:z||N||P||I,onValueChange:e=>void m.updateChannel(e),children:[(0,T.jsx)(x,{className:`w-full max-w-sm`,children:(0,T.jsx)(b,{placeholder:t(`desktopUpdatesReleaseChannel`)})}),(0,T.jsxs)(C,{children:[(0,T.jsx)(_,{value:`stable`,children:t(`desktopUpdatesChannelStable`)}),(0,T.jsx)(_,{value:`beta`,children:t(`desktopUpdatesChannelBeta`)})]})]}),(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`desktopUpdatesReleaseChannelDowngradeHint`)})]})}),(0,T.jsx)(A,{label:t(`desktopUpdatesAutomaticChecks`),help:t(`desktopUpdatesAutomaticChecksHelp`),checked:E.preferences.automaticChecks,disabled:L||z,onCheckedChange:e=>void m.updatePreferences({automaticChecks:e})}),(0,T.jsx)(A,{label:t(`desktopUpdatesAutoDownload`),help:t(`desktopUpdatesAutoDownloadHelp`),checked:E.preferences.autoDownload,disabled:L||z,onCheckedChange:e=>void m.updatePreferences({autoDownload:e})})]})]}),(0,T.jsxs)(h,{children:[(0,T.jsxs)(a,{children:[(0,T.jsx)(c,{children:t(`desktopUpdatesActionsTitle`)}),(0,T.jsx)(o,{children:t(`runtimeUpdatesActionsDescription`)})]}),(0,T.jsxs)(l,{className:`flex flex-wrap items-center gap-3`,children:[(0,T.jsxs)(s,{variant:`outline`,onClick:()=>void m.checkForUpdates(),disabled:N||P||I,children:[(0,T.jsx)(y,{className:e(`mr-2 h-4 w-4`,N&&`animate-spin`)}),t(`desktopUpdatesCheckNow`)]}),(0,T.jsxs)(s,{onClick:()=>void m.downloadUpdate(),disabled:!B,children:[(0,T.jsx)(w,{className:e(`mr-2 h-4 w-4`,P&&`animate-bounce`)}),t(`desktopUpdatesDownloadNow`)]}),(0,T.jsxs)(s,{variant:`secondary`,onClick:()=>void m.applyDownloadedUpdate(),disabled:!V,children:[(0,T.jsx)(S,{className:e(`mr-2 h-4 w-4`,I&&`animate-spin`)}),t(`runtimeUpdatesApplyNow`)]}),E.releaseNotesUrl?(0,T.jsxs)(s,{variant:`ghost`,onClick:()=>window.open(E.releaseNotesUrl??``,`_blank`,`noopener,noreferrer`),children:[(0,T.jsx)(g,{className:`mr-2 h-4 w-4`}),t(`desktopUpdatesReleaseNotes`)]}):null]})]})]})}export{z as DesktopUpdateConfig};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{d as e,h as t,i as n,m as r,v as i}from"./react-B2X_ph0a.js";import{t as a}from"./createLucideIcon-Br1EFMEr.js";import{n as o,t as s}from"./search-CdhgFNwf.js";import{t as c}from"./book-open-cPX0Za7Z.js";import{n as l,t as u}from"./wrench-qVIwShTF.js";import{t as d}from"./external-link-C3usm3se.js";import{t as f}from"./plus-BcIC8dG1.js";import{t as p}from"./x-Chb07O-Y.js";import{a as m,i as h,l as g,o as _,u as v}from"./doc-browser-route-registry.utils-x5ijvk0u.js";import{n as ee}from"./doc-browser-context-DB6TTHeE.js";var y=`modulepreload`,b=function(e){return`/`+e},x={},S=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=b(t,n),t in x)return;x[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:y,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},C=i(t(),1),w=`popstate`;function T(e={}){let{initialEntries:t=[`/`],initialIndex:n,v5Compat:r=!1}=e,i;i=t.map((e,t)=>u(e,typeof e==`string`?null:e.state,t===0?`default`:void 0));let a=c(n??i.length-1),o=`POP`,s=null;function c(e){return Math.min(Math.max(e,0),i.length-1)}function l(){return i[a]}function u(e,t=null,n){let r=k(i?l().pathname:`/`,e,t,n);return D(r.pathname.charAt(0)===`/`,`relative pathnames are not supported in memory history: ${JSON.stringify(e)}`),r}function d(e){return typeof e==`string`?e:A(e)}return{get index(){return a},get action(){return o},get location(){return l()},createHref:d,createURL(e){return new URL(d(e),`http://localhost`)},encodeLocation(e){let t=typeof e==`string`?j(e):e;return{pathname:t.pathname||``,search:t.search||``,hash:t.hash||``}},push(e,t){o=`PUSH`;let n=u(e,t);a+=1,i.splice(a,i.length,n),r&&s&&s({action:o,location:n,delta:1})},replace(e,t){o=`REPLACE`;let n=u(e,t);i[a]=n,r&&s&&s({action:o,location:n,delta:0})},go(e){o=`POP`;let t=c(a+e),n=i[t];a=t,s&&s({action:o,location:n,delta:e})},listen(e){return s=e,()=>{s=null}}}}function te(e={}){function t(e,t){let{pathname:n,search:r,hash:i}=e.location;return k(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){return typeof t==`string`?t:A(t)}return M(t,n,null,e)}function E(e,t){if(e===!1||e==null)throw Error(t)}function D(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function ne(){return Math.random().toString(36).substring(2,10)}function O(e,t){return{usr:e.state,key:e.key,idx:t}}function k(e,t,n=null,r){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?j(t):t,state:n,key:t&&t.key||r||ne()}}function A({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function j(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function M(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=k(h.location,e,t);n&&n(r,e),l=u()+1;let d=O(r,l),f=h.createHref(r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=k(h.location,e,t);n&&n(r,e),l=u();let i=O(r,l),d=h.createHref(r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return re(e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(w,d),c=e,()=>{i.removeEventListener(w,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function re(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),E(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:A(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function N(e,t,n=`/`){return ie(e,t,n,!1)}function ie(e,t,n,r){let i=B((typeof t==`string`?j(t):t).pathname||`/`,n);if(i==null)return null;let a=ae(e);se(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=he(i);o=pe(a[e],t,r)}return o}function P(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function ae(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;E(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=V([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(E(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),ae(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:R(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of oe(e.path))a(e,t,!0,n)}),t}function oe(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=oe(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function se(e){e.sort((e,t)=>e.score===t.score?fe(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var F=/^:[\w-]+$/,ce=3,I=2,le=1,ue=10,de=-2,L=e=>e===`*`;function R(e,t){let n=e.split(`/`),r=n.length;return n.some(L)&&(r+=de),t&&(r+=I),n.filter(e=>!L(e)).reduce((e,t)=>e+(F.test(t)?ce:t===``?le:ue),r)}function fe(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function pe(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=z({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=z({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:V([a,u.pathname]),pathnameBase:Ce(V([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=V([a,u.pathnameBase]))}return o}function z(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=me(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function me(e,t=!1,n=!0){D(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(r.push({paramName:t,isOptional:n!=null}),n?`/?([^\\/]+)?`:`/([^\\/]+)`)).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function he(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return D(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function B(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var ge=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function _e(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?j(e):e,a;return n?(n=n.replace(/\/\/+/g,`/`),a=n.startsWith(`/`)?ve(n.substring(1),`/`):ve(n,t)):a=t,{pathname:a,search:we(r),hash:Te(i)}}function ve(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function ye(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function be(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function xe(e){let t=be(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Se(e,t,n,r=!1){let i;typeof e==`string`?i=j(e):(i={...e},E(!i.pathname||!i.pathname.includes(`?`),ye(`?`,`pathname`,`search`,i)),E(!i.pathname||!i.pathname.includes(`#`),ye(`#`,`pathname`,`hash`,i)),E(!i.search||!i.search.includes(`#`),ye(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=_e(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var V=e=>e.join(`/`).replace(/\/\/+/g,`/`),Ce=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),we=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Te=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Ee=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function De(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Oe(e){return e.map(e=>e.route.path).filter(Boolean).join(`/`).replace(/\/\/*/g,`/`)||`/`}var ke=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Ae(e,t){let n=e;if(typeof n!=`string`||!ge.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(ke)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=B(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{D(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var je=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(je);var Me=[`GET`,...je];new Set(Me);var H=C.createContext(null);H.displayName=`DataRouter`;var U=C.createContext(null);U.displayName=`DataRouterState`;var Ne=C.createContext(!1),Pe=C.createContext({isTransitioning:!1});Pe.displayName=`ViewTransition`;var Fe=C.createContext(new Map);Fe.displayName=`Fetchers`;var Ie=C.createContext(null);Ie.displayName=`Await`;var W=C.createContext(null);W.displayName=`Navigation`;var G=C.createContext(null);G.displayName=`Location`;var K=C.createContext({outlet:null,matches:[],isDataRoute:!1});K.displayName=`Route`;var Le=C.createContext(null);Le.displayName=`RouteError`;var Re=`REACT_ROUTER_ERROR`,ze=`REDIRECT`,Be=`ROUTE_ERROR_RESPONSE`;function Ve(e){if(e.startsWith(`${Re}:${ze}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function He(e){if(e.startsWith(`${Re}:${Be}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Ee(t.status,t.statusText,t.data)}catch{}}function Ue(e,{relative:t}={}){E(q(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=C.useContext(W),{hash:i,pathname:a,search:o}=Y(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:V([n,a])),r.createHref({pathname:s,search:o,hash:i})}function q(){return C.useContext(G)!=null}function J(){return E(q(),`useLocation() may be used only in the context of a <Router> component.`),C.useContext(G).location}var We=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Ge(e){C.useContext(W).static||C.useLayoutEffect(e)}function Ke(){let{isDataRoute:e}=C.useContext(K);return e?pt():qe()}function qe(){E(q(),`useNavigate() may be used only in the context of a <Router> component.`);let e=C.useContext(H),{basename:t,navigator:n}=C.useContext(W),{matches:r}=C.useContext(K),{pathname:i}=J(),a=JSON.stringify(xe(r)),o=C.useRef(!1);return Ge(()=>{o.current=!0}),C.useCallback((r,s={})=>{if(D(o.current,We),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Se(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:V([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}C.createContext(null);function Je(){let{matches:e}=C.useContext(K),t=e[e.length-1];return t?t.params:{}}function Y(e,{relative:t}={}){let{matches:n}=C.useContext(K),{pathname:r}=J(),i=JSON.stringify(xe(n));return C.useMemo(()=>Se(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Ye(e,t){return Xe(e,t)}function Xe(e,t,n,r,i){E(q(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:a}=C.useContext(W),{matches:o}=C.useContext(K),s=o[o.length-1],c=s?s.params:{},l=s?s.pathname:`/`,u=s?s.pathnameBase:`/`,d=s&&s.route;{let e=d&&d.path||``;ht(l,!d||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
2
|
-
|
|
3
|
-
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let f=J(),p;if(t){let e=typeof t==`string`?j(t):t;E(u===`/`||e.pathname?.startsWith(u),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${u}" but pathname "${e.pathname}" was given in the \`location\` prop.`),p=e}else p=f;let m=p.pathname||`/`,h=m;if(u!==`/`){let e=u.replace(/^\//,``).split(`/`);h=`/`+m.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let g=N(e,{pathname:h});D(d||g!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),D(g==null||g[g.length-1].route.element!==void 0||g[g.length-1].route.Component!==void 0||g[g.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let _=rt(g&&g.map(e=>Object.assign({},e,{params:Object.assign({},c,e.params),pathname:V([u,a.encodeLocation?a.encodeLocation(e.pathname.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?u:V([u,a.encodeLocation?a.encodeLocation(e.pathnameBase.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),o,n,r,i);return t&&_?C.createElement(G.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,...p},navigationType:`POP`}},_):_}function Ze(){let e=ft(),t=De(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=C.createElement(C.Fragment,null,C.createElement(`p`,null,`💿 Hey developer 👋`),C.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,C.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,C.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),C.createElement(C.Fragment,null,C.createElement(`h2`,null,`Unexpected Application Error!`),C.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?C.createElement(`pre`,{style:i},n):null,o)}var Qe=C.createElement(Ze,null),$e=class extends C.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=He(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:C.createElement(K.Provider,{value:this.props.routeContext},C.createElement(Le.Provider,{value:e,children:this.props.component}));return this.context?C.createElement(tt,{error:e},t):t}};$e.contextType=Ne;var et=new WeakMap;function tt({children:e,error:t}){let{basename:n}=C.useContext(W);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Ve(t.digest);if(e){let r=et.get(t);if(r)throw r;let i=Ae(e.location,n);if(ke&&!et.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw et.set(t,n),n}return C.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function nt({routeContext:e,match:t,children:n}){let r=C.useContext(H);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),C.createElement(K.Provider,{value:e},n)}function rt(e,t=[],n=null,r=null,i=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,o=n?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);E(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(`,`)}`),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,c=-1;if(n)for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:r}=n,i=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!r||r[t.route.id]===void 0);if(t.route.lazy||i){s=!0,a=c>=0?a.slice(0,c+1):[a[0]];break}}}let l=n&&r?(e,t)=>{r(e,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:Oe(n.matches),errorInfo:t})}:void 0;return a.reduceRight((e,r,i)=>{let u,d=!1,f=null,p=null;n&&(u=o&&r.route.id?o[r.route.id]:void 0,f=r.route.errorElement||Qe,s&&(c<0&&i===0?(ht(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):c===i&&(d=!0,p=r.route.hydrateFallbackElement||null)));let m=t.concat(a.slice(0,i+1)),h=()=>{let t;return t=u?f:d?p:r.route.Component?C.createElement(r.route.Component,null):r.route.element?r.route.element:e,C.createElement(nt,{match:r,routeContext:{outlet:e,matches:m,isDataRoute:n!=null},children:t})};return n&&(r.route.ErrorBoundary||r.route.errorElement||i===0)?C.createElement($e,{location:n.location,revalidation:n.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function it(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function at(e){let t=C.useContext(H);return E(t,it(e)),t}function ot(e){let t=C.useContext(U);return E(t,it(e)),t}function st(e){let t=C.useContext(K);return E(t,it(e)),t}function ct(e){let t=st(e),n=t.matches[t.matches.length-1];return E(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function lt(){return ct(`useRouteId`)}function ut(){return ot(`useNavigation`).navigation}function dt(){let{matches:e,loaderData:t}=ot(`useMatches`);return C.useMemo(()=>e.map(e=>P(e,t)),[e,t])}function ft(){let e=C.useContext(Le),t=ot(`useRouteError`),n=ct(`useRouteError`);return e===void 0?t.errors?.[n]:e}function pt(){let{router:e}=at(`useNavigate`),t=ct(`useNavigate`),n=C.useRef(!1);return Ge(()=>{n.current=!0}),C.useCallback(async(r,i={})=>{D(n.current,We),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var mt={};function ht(e,t,n){!t&&!mt[e]&&(mt[e]=!0,D(!1,n))}C.useOptimistic,C.memo(gt);function gt({routes:e,future:t,state:n,onError:r}){return Xe(e,void 0,n,r,t)}function _t({basename:e,children:t,initialEntries:n,initialIndex:r,unstable_useTransitions:i}){let a=C.useRef();a.current??=T({initialEntries:n,initialIndex:r,v5Compat:!0});let o=a.current,[s,c]=C.useState({action:o.action,location:o.location}),l=C.useCallback(e=>{i===!1?c(e):C.startTransition(()=>c(e))},[i]);return C.useLayoutEffect(()=>o.listen(l),[o,l]),C.createElement(bt,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:o,unstable_useTransitions:i})}function vt({to:e,replace:t,state:n,relative:r}){E(q(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=C.useContext(W);D(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=C.useContext(K),{pathname:o}=J(),s=Ke(),c=Se(e,xe(a),o,r===`path`),l=JSON.stringify(c);return C.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function yt(e){E(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function bt({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){E(!q(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=C.useMemo(()=>({basename:s,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=j(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`}=n,m=C.useMemo(()=>{let e=B(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p},navigationType:r}},[s,l,u,d,f,p,r]);return D(m!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),m==null?null:C.createElement(W.Provider,{value:c},C.createElement(G.Provider,{children:t,value:m}))}function xt({children:e,location:t}){return Ye(St(e),t)}C.Component;function St(e,t=[]){let n=[];return C.Children.forEach(e,(e,r)=>{if(!C.isValidElement(e))return;let i=[...t,r];if(e.type===C.Fragment){n.push.apply(n,St(e.props.children,i));return}E(e.type===yt,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),E(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=St(e.props.children,i)),n.push(a)}),n}var Ct=`get`,wt=`application/x-www-form-urlencoded`;function Tt(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Et(e){return Tt(e)&&e.tagName.toLowerCase()===`button`}function Dt(e){return Tt(e)&&e.tagName.toLowerCase()===`form`}function Ot(e){return Tt(e)&&e.tagName.toLowerCase()===`input`}function kt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function At(e,t){return e.button===0&&(!t||t===`_self`)&&!kt(e)}var jt=null;function Mt(){if(jt===null)try{new FormData(document.createElement(`form`),0),jt=!1}catch{jt=!0}return jt}var Nt=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Pt(e){return e!=null&&!Nt.has(e)?(D(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${wt}"`),null):e}function Ft(e,t){let n,r,i,a,o;if(Dt(e)){let o=e.getAttribute(`action`);r=o?B(o,t):null,n=e.getAttribute(`method`)||Ct,i=Pt(e.getAttribute(`enctype`))||wt,a=new FormData(e)}else if(Et(e)||Ot(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?B(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Ct,i=Pt(e.getAttribute(`formenctype`))||Pt(o.getAttribute(`enctype`))||wt,a=new FormData(o,e),!Mt()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Tt(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Ct,r=null,i=wt,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var It={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Lt=/[&><\u2028\u2029]/g;function Rt(e){return e.replace(Lt,e=>It[e])}function zt(e,t){if(e===!1||e==null)throw Error(t)}function Bt(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&B(i.pathname,t)===`/`?i.pathname=`${t.replace(/\/$/,``)}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,``)}.${r}`,i}async function Vt(e,t){if(e.id in t)return t[e.id];try{let n=await S(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Ht(e){return e!=null&&typeof e.page==`string`}function Ut(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Wt(e,t,n){return Yt((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Vt(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Ut).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Gt(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Kt(e,t,{includeHydrateFallback:n}={}){return qt(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function qt(e){return[...new Set(e)]}function Jt(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Yt(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Ht(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Jt(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Xt(){let e=C.useContext(H);return zt(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Zt(){let e=C.useContext(U);return zt(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Qt=C.createContext(void 0);Qt.displayName=`FrameworkContext`;function $t(){let e=C.useContext(Qt);return zt(e,`You must render this element inside a <HydratedRouter> element`),e}function en(e,t){let n=C.useContext(Qt),[r,i]=C.useState(!1),[a,o]=C.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=C.useRef(null);C.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),C.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:X(s,p),onBlur:X(c,m),onMouseEnter:X(l,p),onMouseLeave:X(u,m),onTouchStart:X(d,p)}]:[a,f,{}]:[!1,f,{}]}function X(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function tn({page:e,...t}){let{router:n}=Xt(),r=C.useMemo(()=>N(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?C.createElement(rn,{page:e,matches:r,...t}):null}function nn(e){let{manifest:t,routeModules:n}=$t(),[r,i]=C.useState([]);return C.useEffect(()=>{let r=!1;return Wt(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function rn({page:e,matches:t,...n}){let r=J(),{future:i,manifest:a,routeModules:o}=$t(),{basename:s}=Xt(),{loaderData:c,matches:l}=Zt(),u=C.useMemo(()=>Gt(e,t,l,a,r,`data`),[e,t,l,a,r]),d=C.useMemo(()=>Gt(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=C.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Bt(e,s,i.unstable_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.unstable_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=C.useMemo(()=>Kt(d,a),[d,a]),m=nn(d);return C.createElement(C.Fragment,null,f.map(e=>C.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>C.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>C.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function an(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}C.Component;var on=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{on&&(window.__reactRouterVersion=`7.13.0`)}catch{}function sn({basename:e,children:t,unstable_useTransitions:n,window:r}){let i=C.useRef();i.current??=te({window:r,v5Compat:!0});let a=i.current,[o,s]=C.useState({action:a.action,location:a.location}),c=C.useCallback(e=>{n===!1?s(e):C.startTransition(()=>s(e))},[n]);return C.useLayoutEffect(()=>a.listen(c),[a,c]),C.createElement(bt,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,unstable_useTransitions:n})}function cn({basename:e,children:t,history:n,unstable_useTransitions:r}){let[i,a]=C.useState({action:n.action,location:n.location}),o=C.useCallback(e=>{r===!1?a(e):C.startTransition(()=>a(e))},[r]);return C.useLayoutEffect(()=>n.listen(o),[n,o]),C.createElement(bt,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,unstable_useTransitions:r})}cn.displayName=`unstable_HistoryRouter`;var ln=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,un=C.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,state:o,target:s,to:c,preventScrollReset:l,viewTransition:u,unstable_defaultShouldRevalidate:d,...f},p){let{basename:m,unstable_useTransitions:h}=C.useContext(W),g=typeof c==`string`&&ln.test(c),_=Ae(c,m);c=_.to;let v=Ue(c,{relative:r}),[ee,y,b]=en(n,f),x=_n(c,{replace:a,state:o,target:s,preventScrollReset:l,relative:r,viewTransition:u,unstable_defaultShouldRevalidate:d,unstable_useTransitions:h});function S(t){e&&e(t),t.defaultPrevented||x(t)}let w=C.createElement(`a`,{...f,...b,href:_.absoluteURL||v,onClick:_.isExternal||i?e:S,ref:an(p,y),target:s,"data-discover":!g&&t===`render`?`true`:void 0});return ee&&!g?C.createElement(C.Fragment,null,w,C.createElement(tn,{page:v})):w});un.displayName=`Link`;var dn=C.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Y(a,{relative:c.relative}),d=J(),f=C.useContext(U),{navigator:p,basename:m}=C.useContext(W),h=f!=null&&Dn(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=B(v,m)||v);let ee=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,y=_===g||!r&&_.startsWith(g)&&_.charAt(ee)===`/`,b=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),x={isActive:y,isPending:b,isTransitioning:h},S=y?e:void 0,w;w=typeof n==`function`?n(x):[n,y?`active`:null,b?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(x):i;return C.createElement(un,{...c,"aria-current":S,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(x):s)});dn.displayName=`NavLink`;var fn=C.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Ct,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:h}=C.useContext(W),g=bn(),_=xn(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,ee=typeof s==`string`&&ln.test(s);return C.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f});h&&n!==!1?C.startTransition(()=>p()):p()},...p,"data-discover":!ee&&e===`render`?`true`:void 0})});fn.displayName=`Form`;function pn({getKey:e,storageKey:t,...n}){let r=C.useContext(Qt),{basename:i}=C.useContext(W),a=J(),o=dt();Tn({getKey:e,storageKey:t});let s=C.useMemo(()=>{if(!r||!e)return null;let t=wn(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return C.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${Rt(JSON.stringify(t||Sn))}, ${Rt(JSON.stringify(s))})`}})}pn.displayName=`ScrollRestoration`;function mn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function hn(e){let t=C.useContext(H);return E(t,mn(e)),t}function gn(e){let t=C.useContext(U);return E(t,mn(e)),t}function _n(e,{target:t,replace:n,state:r,preventScrollReset:i,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:s,unstable_useTransitions:c}={}){let l=Ke(),u=J(),d=Y(e,{relative:a});return C.useCallback(f=>{if(At(f,t)){f.preventDefault();let t=n===void 0?A(u)===A(d):n,p=()=>l(e,{replace:t,state:r,preventScrollReset:i,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:s});c?C.startTransition(()=>p()):p()}},[u,l,d,n,r,t,e,i,a,o,s,c])}var vn=0,yn=()=>`__${String(++vn)}__`;function bn(){let{router:e}=hn(`useSubmit`),{basename:t}=C.useContext(W),n=lt(),r=e.fetch,i=e.navigate;return C.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Ft(e,t);a.navigate===!1?await r(a.fetcherKey||yn(),n,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function xn(e,{relative:t}={}){let{basename:n}=C.useContext(W),r=C.useContext(K);E(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Y(e||`.`,{relative:t})},o=J();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:V([n,a.pathname])),A(a)}var Sn=`react-router-scroll-positions`,Cn={};function wn(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:B(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Tn({getKey:e,storageKey:t}={}){let{router:n}=hn(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=gn(`useScrollRestoration`),{basename:a}=C.useContext(W),o=J(),s=dt(),c=ut();C.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),En(C.useCallback(()=>{if(c.state===`idle`){let t=wn(o,s,a,e);Cn[t]=window.scrollY}try{sessionStorage.setItem(t||Sn,JSON.stringify(Cn))}catch(e){D(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(C.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Sn);e&&(Cn=JSON.parse(e))}catch{}},[t]),C.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Cn,()=>window.scrollY,e?(t,n)=>wn(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),C.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{D(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function En(e,t){let{capture:n}=t||{};C.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Dn(e,{relative:t}={}){let n=C.useContext(Pe);E(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=hn(`useViewTransitionState`),i=Y(e,{relative:t});if(!n.isTransitioning)return!1;let a=B(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=B(n.nextLocation.pathname,r)||n.nextLocation.pathname;return z(i.pathname,o)!=null||z(i.pathname,a)!=null}var On=a(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),kn=a(`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`}]]),An=a(`Grid3x3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),jn=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`}]]),Mn=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`}]]),Nn=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`}]]),Z=r(),Pn={apps:{accentClassName:`bg-emerald-50 text-emerald-700 border-emerald-100`,icon:(0,Z.jsx)(l,{className:`h-5 w-5`})},"service-apps":{accentClassName:`bg-sky-50 text-sky-700 border-sky-100`,icon:(0,Z.jsx)(An,{className:`h-5 w-5`})},docs:{accentClassName:`bg-amber-50 text-amber-700 border-amber-100`,icon:(0,Z.jsx)(c,{className:`h-5 w-5`})},"skill-marketplace":{accentClassName:`bg-rose-50 text-rose-700 border-rose-100`,icon:(0,Z.jsx)(kn,{className:`h-5 w-5`})},"mcp-marketplace":{accentClassName:`bg-indigo-50 text-indigo-700 border-indigo-100`,icon:(0,Z.jsx)(u,{className:`h-5 w-5`})}};function Fn(e){return Pn[e.id]??{accentClassName:`bg-gray-50 text-gray-700 border-gray-100`,icon:(0,Z.jsx)(l,{className:`h-5 w-5`})}}function In({open:t}){let n=Ke(),r=h.getHomeNavigationItems(),i=e=>{if(e.type===`app-route`){n(e.path);return}t(e.url,e.options)};return(0,Z.jsx)(`div`,{className:`h-full overflow-auto bg-[#fbfaf7] px-5 py-6`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-[640px]`,children:(0,Z.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(88px,1fr))] gap-x-3 gap-y-5`,children:r.map(t=>{let n=Fn(t);return(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>i(t.target),className:`group flex min-h-[82px] flex-col items-center gap-2 rounded-lg px-2 py-2 text-center transition-colors hover:bg-white/80`,children:[(0,Z.jsx)(`span`,{className:e(`flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl border shadow-[0_1px_2px_rgba(30,20,10,0.04)] transition-transform group-hover:scale-[1.03]`,n.accentClassName),children:n.icon}),(0,Z.jsx)(`span`,{className:`min-w-0 max-w-full`,children:(0,Z.jsx)(`span`,{className:`line-clamp-2 block text-xs font-medium leading-snug text-gray-800`,children:t.label})})]},t.id)})})})})}function Ln({isDocsTab:e,onSubmit:t,onUrlInputChange:r,urlInput:i}){return e?(0,Z.jsx)(`div`,{className:`flex items-center gap-2 px-3.5 py-2 bg-white border-b border-gray-100 shrink-0`,children:(0,Z.jsxs)(`form`,{onSubmit:t,className:`flex-1 relative`,children:[(0,Z.jsx)(s,{className:`w-3.5 h-3.5 absolute left-3 top-1/2 -translate-y-1/2 text-gray-400`}),(0,Z.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 Rn({currentTab:e,currentUrl:t,customContent:n,iframeRef:r,iframeInstanceId:i,iframeSandbox:a,isDragging:o,isResizing:s}){return(0,Z.jsxs)(`div`,{className:`flex-1 relative overflow-hidden`,children:[n||(0,Z.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,Z.jsx)(`div`,{className:`absolute inset-0 z-10`})]})}function zn({currentUrl:e,isDocsTab:t}){return!t||!g(e)?null:(0,Z.jsx)(`div`,{className:`flex items-center justify-between px-4 py-2 bg-gray-50 border-t border-gray-200 shrink-0`,children:(0,Z.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,Z.jsx)(d,{className:`w-3 h-3`})]})})}function Bn({tabs:t,activeTabId:r,canGoBack:i,canGoForward:a,isDocked:s,isFullscreen:c,onGoBack:l,onGoForward:u,onOpenNewTab:d,onSetActiveTab:m,onCloseTab:h,onClose:g,onDragStart:_,onToggleMode:v}){return(0,Z.jsxs)(`div`,{"data-testid":`doc-browser-tab-strip`,className:e(`flex h-11 items-stretch gap-2 px-2.5 bg-background border-b border-[#f1e7d4] shrink-0 select-none`,c&&`h-[calc(env(safe-area-inset-top,0px)+2.75rem)] pt-[env(safe-area-inset-top,0px)]`),onPointerDown:!s&&!c?_:void 0,children:[(0,Z.jsx)(`div`,{className:`doc-browser-tab-scrollbar flex h-full min-w-0 flex-1 items-center gap-1.5 overflow-x-auto`,onPointerDown:e=>e.stopPropagation(),children:t.map(t=>(0,Z.jsxs)(`div`,{className:e(`inline-flex items-center gap-1 h-7 px-1.5 rounded-lg text-xs border max-w-[220px] shrink-0 transition-colors`,t.id===r?`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,Z.jsx)(`button`,{type:`button`,onClick:()=>m(t.id),className:`truncate text-left px-1`,title:t.title,children:t.title||n(`docBrowserTabUntitled`)}),(0,Z.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h(t.id)},className:`rounded p-0.5 hover:bg-black/10`,"aria-label":n(`docBrowserCloseTab`),children:(0,Z.jsx)(p,{className:`w-3 h-3`})})]},t.id))}),(0,Z.jsxs)(`div`,{className:`flex h-full items-center gap-1 shrink-0`,"data-testid":`doc-browser-tab-actions`,onPointerDown:e=>e.stopPropagation(),children:[(0,Z.jsx)(`button`,{type:`button`,onClick:l,disabled:!i,className:`rounded-md p-1.5 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 disabled:cursor-not-allowed disabled:text-gray-300 disabled:opacity-60 disabled:hover:bg-transparent disabled:hover:text-gray-300`,title:n(`docBrowserBack`),children:(0,Z.jsx)(o,{className:`w-3.5 h-3.5`})}),(0,Z.jsx)(`button`,{type:`button`,onClick:u,disabled:!a,className:`rounded-md p-1.5 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 disabled:cursor-not-allowed disabled:text-gray-300 disabled:opacity-60 disabled:hover:bg-transparent disabled:hover:text-gray-300`,title:n(`docBrowserForward`),children:(0,Z.jsx)(On,{className:`w-3.5 h-3.5`})}),(0,Z.jsx)(`button`,{type:`button`,onClick:d,className:`hover:bg-gray-100 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors`,title:n(`docBrowserNewTab`),children:(0,Z.jsx)(f,{className:`w-3.5 h-3.5`})}),c?null:(0,Z.jsx)(`button`,{type:`button`,onClick:v,className:`hover:bg-gray-100 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors`,title:n(s?`docBrowserFloatMode`:`docBrowserDockMode`),children:s?(0,Z.jsx)(Mn,{className:`w-3.5 h-3.5`}):(0,Z.jsx)(Nn,{className:`w-3.5 h-3.5`})}),(0,Z.jsx)(`button`,{type:`button`,onClick:g,className:`hover:bg-gray-100 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors`,title:n(`docBrowserClose`),children:(0,Z.jsx)(p,{className:`w-3.5 h-3.5`})})]})]})}function Vn({children:t,className:n,style:r,defaultWidth:i=420,minWidth:a=320,maxWidth:o=860,overlay:s=!1,...c}){let l=(0,C.useRef)(null),[u,d]=(0,C.useState)(!1),[f,p]=(0,C.useState)(i),m=e=>{if(s)return;e.preventDefault(),e.stopPropagation(),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(`mousemove`,t),window.removeEventListener(`mouseup`,n)};window.addEventListener(`mousemove`,t),window.addEventListener(`mouseup`,n)};return(0,Z.jsxs)(`aside`,{...c,className:e(`relative flex h-full min-h-0 shrink-0 overflow-hidden bg-white`,s?`fixed inset-0 z-40`:`border-l border-gray-200`,n),style:s?r:{...r,width:f},children:[s?null:(0,Z.jsx)(`div`,{className:`absolute left-0 top-0 z-20 h-full w-1.5 cursor-ew-resize transition-colors hover:bg-primary/10`,"data-testid":`resizable-right-panel-handle`,onMouseDown:m}),(0,Z.jsx)(`div`,{className:`flex h-full min-h-0 w-full flex-col overflow-hidden`,children:t}),u?(0,Z.jsx)(`div`,{className:`absolute inset-0 z-10`}):null]})}var Q=40,Hn=360,Un=400;function $(e,t,n){return Math.min(n,Math.max(t,e))}function Wn(){return{x:Math.max(Q,window.innerWidth-520),y:80,w:480,h:600}}function Gn({customTabRenderers:t={},displayMode:n=`desktop`}){let{isOpen:r,mode:i,tabs:a,activeTabId:o,activeHistory:s,activeHistoryIndex:c,currentTab:l,open:u,openNewTab:d,close:f,toggleMode:p,goBack:h,goForward:g,navigate:y,syncUrl:b,setActiveTab:x,closeTab:S}=ee(),[w,T]=(0,C.useState)(``),[te,E]=(0,C.useState)(0),[D,ne]=(0,C.useState)(Wn),[O,k]=(0,C.useState)(null),A=(0,C.useRef)(null),j=l?.currentUrl??m,M=l?.navVersion??0,re=`${o}:${M}:${te}`,N=(0,C.useRef)(null),ie=(0,C.useRef)(M),P=l?.kind===`docs`,ae=l?.kind===_,oe=c>0,se=c<s.length-1,F=l?t[l.kind]:void 0;(0,C.useEffect)(()=>{if(!P){T(``);return}try{T(new URL(j).pathname)}catch{T(j)}},[j,o,P]),(0,C.useEffect)(()=>{if(!P){N.current=null;return}if(M!==ie.current){ie.current=M,N.current=v(j);return}if(A.current?.contentWindow)try{let e=new URL(j).pathname;N.current=v(j),A.current.contentWindow.postMessage({type:`docs-navigate`,path:e},`*`)}catch{}},[j,M,P]),(0,C.useEffect)(()=>{let e=e=>{if(P&&e.data?.type===`docs-route-change`&&typeof e.data.url==`string`){let t=v(e.data.url);if(N.current&&t!==N.current)return;N.current=null,b(e.data.url)}};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[j,b,P]),(0,C.useEffect)(()=>{if(!l||!F?.onIframeMessage)return;let e=e=>{F.onIframeMessage?.({event:e,iframe:A.current,iframeInstanceId:re,tab:l})};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[l,F,re]);let ce=(0,C.useCallback)(e=>{e.preventDefault(),k({kind:`drag`,startX:e.clientX,startY:e.clientY,startRect:D})},[D]),I=(0,C.useCallback)(e=>t=>{t.preventDefault(),t.stopPropagation(),k({kind:`resize`,edge:e,startX:t.clientX,startY:t.clientY,startRect:D})},[D]);(0,C.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`){ne({...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?Hn:Un));ne(e?{...t,x:r,w:n-r}:{...t,y:r,h:n-r});return}let o=$(t.x+t.w+i,t.x+Hn,window.innerWidth-Q),s=$(t.y+t.h+a,t.y+Un,window.innerHeight-Q);ne({...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 le=(0,C.useCallback)(e=>{if(e.preventDefault(),!P)return;let t=w.trim();t&&(t.startsWith(`/`)?y(`${m}${t}`):t.startsWith(`http`)?y(t):y(`${m}/${t}`))},[w,y,P]),ue=(0,C.useCallback)(()=>{E(e=>e+1)},[]);if(!r)return null;let de=i===`docked`,L=n===`fullscreen`,R=l?{currentUrl:j,open:u,refreshIframe:ue,tab:l}:void 0,fe=R?F?.renderToolbar?.(R):null,pe=R?F?.renderContent?.(R)??(ae?(0,Z.jsx)(In,{open:u}):null):null,z=l?F?.getIframeSandbox?.(l)??`allow-same-origin allow-scripts allow-popups allow-forms`:`allow-same-origin allow-scripts allow-popups allow-forms`,me=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Bn,{tabs:a,activeTabId:o,canGoBack:oe,canGoForward:se,isDocked:de,isFullscreen:L,onGoBack:h,onGoForward:g,onOpenNewTab:d,onSetActiveTab:x,onCloseTab:S,onClose:f,onDragStart:ce,onToggleMode:p}),(0,Z.jsx)(Ln,{isDocsTab:P,onSubmit:le,onUrlInputChange:T,urlInput:w}),fe,(0,Z.jsx)(Rn,{currentTab:l,currentUrl:j,customContent:pe,iframeRef:A,iframeInstanceId:re,iframeSandbox:z,isDragging:O?.kind===`drag`,isResizing:O?.kind===`resize`}),(0,Z.jsx)(zn,{currentUrl:j,isDocsTab:P})]});return de&&!L?(0,Z.jsx)(Vn,{"data-testid":`doc-browser-panel`,defaultWidth:420,minWidth:320,maxWidth:860,children:me}):(0,Z.jsxs)(`div`,{"data-testid":`doc-browser-panel`,className:e(`flex flex-col bg-white overflow-hidden relative`,L?`fixed inset-0 z-[9999] h-[100dvh] w-screen rounded-none border-0 shadow-2xl`:`rounded-2xl shadow-2xl border border-gray-200`),style:L?void 0:{position:`fixed`,left:D.x,top:D.y,width:D.w,height:D.h,zIndex:9999},children:[me,!de&&!L&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`absolute top-0 left-0 h-1.5 w-full cursor-ns-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-top`,onPointerDown:I(`top`)}),(0,Z.jsx)(`div`,{className:`absolute top-0 left-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-left`,onPointerDown:I(`left`)}),(0,Z.jsx)(`div`,{className:`absolute top-0 right-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-right`,onPointerDown:I(`right`)}),(0,Z.jsx)(`div`,{className:`absolute bottom-0 left-0 h-1.5 w-full cursor-ns-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-bottom`,onPointerDown:I(`bottom`)}),(0,Z.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:I(`bottom-right`),children:(0,Z.jsx)(jn,{className:`w-3 h-3 rotate-[-45deg]`})})]})]})}export{un as a,vt as c,J as d,Ke as f,sn as i,yt as l,S as m,Vn as n,_t as o,Je as p,kn as r,dn as s,Gn as t,xt as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as e,m as t,t as n,v as r}from"./react-B2X_ph0a.js";import{c as i,i as a,o,s}from"./doc-browser-route-registry.utils-x5ijvk0u.js";var c=0;function l(){return c+=1,`doc-tab-${Date.now()}-${c}`}function u(e,t,n,r){let a=n?.trim()||i(e,t,t===`docs`?`Docs`:`Detail`);return{id:l(),kind:t,title:a,currentUrl:e,dedupeKey:r,history:[e],historyIndex:0,navVersion:0}}function d(e){return{kind:e.kind,tabId:e.id,url:e.currentUrl}}function f(){let e=u(s(),`docs`,`Docs`);return{isOpen:!1,mode:`docked`,tabs:[e],activeTabId:e.id,activeHistory:[d(e)],activeHistoryIndex:0}}function p(e,t){let n;try{n=e()}catch{return}return{getItem:e=>{let r=e=>e===null?null:JSON.parse(e,t?.reviver),i=n.getItem(e)??null;return i instanceof Promise?i.then(r):r(i)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,t?.replacer)),removeItem:e=>n.removeItem(e)}}var m=e=>t=>{try{let n=e(t);return n instanceof Promise?n:{then(e){return m(e)(n)},catch(e){return this}}}catch(e){return{then(e){return this},catch(t){return m(t)(e)}}}},h=(e,t)=>(n,r,i)=>{let a={storage:p(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1,s=0,c=new Set,l=new Set,u=a.storage;if(!u)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)},r,i);let d=()=>{let e=a.partialize({...r()});return u.setItem(a.name,{state:e,version:a.version})},f=i.setState;i.setState=(e,t)=>(f(e,t),d());let h=e((...e)=>(n(...e),d()),r,i);i.getInitialState=()=>h;let g,_=()=>{if(!u)return;let e=++s;o=!1,c.forEach(e=>e(r()??h));let t=a.onRehydrateStorage?.call(a,r()??h)||void 0;return m(u.getItem.bind(u))(a.name).then(e=>{if(e)if(typeof e.version==`number`&&e.version!==a.version){if(a.migrate){let t=a.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`)}else return[!1,e.state];return[!1,void 0]}).then(t=>{if(e!==s)return;let[i,o]=t;if(g=a.merge(o,r()??h),n(g,!0),i)return d()}).then(()=>{e===s&&(t?.(g,void 0),g=r(),o=!0,l.forEach(e=>e(g)))}).catch(n=>{e===s&&t?.(void 0,n)})};return i.persist={setOptions:e=>{a={...a,...e},e.storage&&(u=e.storage)},clearStorage:()=>{u?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>_(),hasHydrated:()=>o,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(l.add(e),()=>{l.delete(e)})},a.skipHydration||_(),g||h},g=`nextclaw.doc-browser.state`,_=1,v=8;function y(e){return!!e&&typeof e==`object`}function b(e){return e===`floating`||e===`docked`}function x(e,t){if(!Array.isArray(e))return[t];let n=e.filter(e=>typeof e==`string`&&e.trim().length>0);return n.length>0?n:[t]}function S(e,t,n,r){return typeof e==`number`&&Number.isFinite(e)?Math.min(n,Math.max(t,e)):r}function C(e){if(!y(e)||typeof e.id!=`string`||typeof e.kind!=`string`||typeof e.title!=`string`||typeof e.currentUrl!=`string`||e.currentUrl.trim().length===0)return null;let t=x(e.history,e.currentUrl),n=S(e.historyIndex,0,t.length-1,t.length-1),r=S(e.navVersion,0,2**53-1,0),i=typeof e.dedupeKey==`string`&&e.dedupeKey.trim().length>0?e.dedupeKey:void 0;return{id:e.id,kind:e.kind,title:e.title,currentUrl:t[n]??e.currentUrl,dedupeKey:i,history:t,historyIndex:n,navVersion:r}}function w(e){return{kind:e.kind,tabId:e.id,url:e.currentUrl}}function T(e,t){return!y(e)||typeof e.tabId!=`string`||typeof e.kind!=`string`||typeof e.url!=`string`||e.url.trim().length===0||!t.has(e.tabId)?null:{kind:e.kind,tabId:e.tabId,url:e.url}}function E(e){if(!y(e))return null;let t=Array.isArray(e.tabs)?e.tabs.map(C).filter(e=>e!==null).slice(-v):[];if(t.length===0)return null;let n=typeof e.activeTabId==`string`?e.activeTabId:null,r=t.some(e=>e.id===n)?n??t[0].id:t[0].id,i=new Map(t.map(e=>[e.id,e])),a=Array.isArray(e.activeHistory)?e.activeHistory.map(e=>T(e,i)).filter(e=>e!==null):[],o=[w(i.get(r)??t[0])],s=a.length>0?a:o,c=S(e.activeHistoryIndex,0,s.length-1,s.length-1),l=s[c],u=i.has(l.tabId)?l.tabId:r;return{isOpen:e.isOpen===!0,mode:b(e.mode)?e.mode:`docked`,tabs:t,activeTabId:u,activeHistory:s,activeHistoryIndex:c}}function D(e,t){return typeof t==`function`?t(e):t}var O=n()(h(e=>({snapshot:f(),setSnapshot:t=>e(e=>({snapshot:D(e.snapshot,t)}))}),{name:g,version:_,storage:p(()=>window.localStorage),partialize:e=>({snapshot:{isOpen:e.snapshot.isOpen,mode:e.snapshot.mode,tabs:e.snapshot.tabs.slice(-v),activeTabId:e.snapshot.activeTabId,activeHistory:e.snapshot.activeHistory,activeHistoryIndex:e.snapshot.activeHistoryIndex}}),merge:(e,t)=>{let n=E(y(e)?e.snapshot:null);return n?{...t,snapshot:n}:t}}));function k(e,t,n){return{...e,tabs:e.tabs.map(e=>e.id===t?n(e):e)}}function A(e,t){return k(e,e.activeTabId,t)}function j(e,t){let n=[...e.history.slice(0,e.historyIndex+1),t];return{history:n,historyIndex:n.length-1}}function M(e,t){return e.tabId===t.tabId&&e.kind===t.kind&&a.areUrlsEquivalent(e.url,t.url,e.kind,t.kind)}function N(e,t){let n=e.activeHistory[e.activeHistoryIndex];if(n&&M(n,t))return e;let r=[...e.activeHistory.slice(0,e.activeHistoryIndex+1),t];return{...e,activeHistory:r,activeHistoryIndex:r.length-1}}function P(e,t){for(let n=e.history.length-1;n>=0;--n)if(a.areUrlsEquivalent(e.history[n],t,e.kind,e.kind))return n;return-1}function F(e,t){let n=e.tabs.find(e=>e.id===t.tabId);if(!n)return e;let r=a.resolveOpenTarget({activeTab:n,kind:t.kind,url:t.url}),i=P(n,r.url);return k({...e,activeTabId:n.id,isOpen:!0},n.id,e=>({...e,currentUrl:r.url,dedupeKey:r.dedupeKey,historyIndex:i>=0?i:e.historyIndex,kind:r.kind,title:r.title}))}function I(e,t,n,r){let i={...e,title:n?.title||t.title||e.title,kind:t.kind,dedupeKey:r};return a.areUrlsEquivalent(e.currentUrl,t.url,e.kind,t.kind)?i:{...i,currentUrl:t.url,...j(e,t.url),navVersion:e.navVersion+1}}function L(e,t,n){let{activate:r,dedupeKey:i,kind:o,newTab:s,title:c}=n??{},l=e.tabs.find(t=>t.id===e.activeTabId)??e.tabs[0],f=a.resolveOpenTarget({activeTab:l,kind:o,url:t}),p=i?.trim()||f.dedupeKey,m=p?e.tabs.find(e=>e.dedupeKey===p):void 0;if(m){let t=k(e,m.id,e=>I(e,f,n,p)),i=r!==!1,a=i?m.id:e.activeTabId,o={...t,activeTabId:a,isOpen:!0};return i||m.id===e.activeTabId?N(o,{kind:f.kind,tabId:m.id,url:f.url}):o}if(s||p||!l||l.kind!==f.kind){let t=u(f.url,f.kind,c??f.title,p);return N({...e,isOpen:!0,tabs:[...e.tabs,t],activeTabId:t.id},d(t))}return N({...A(e,e=>I(e,f,n,p)),isOpen:!0},{kind:f.kind,tabId:e.activeTabId,url:f.url})}var R=class{constructor(){this.setSnapshot=e=>{O.getState().setSnapshot(e)},this.open=(e,t)=>{this.setSnapshot(n=>L(n,e,t))},this.openNewTab=()=>{this.open(void 0,{kind:o,newTab:!0})},this.close=()=>{this.setSnapshot(e=>({...e,isOpen:!1}))},this.toggleMode=()=>{this.setSnapshot(e=>({...e,mode:e.mode===`floating`?`docked`:`floating`}))},this.navigate=e=>{this.setSnapshot(t=>{if(!t.tabs.length){let e=u(s(),`docs`,`Docs`);return{...t,tabs:[e],activeTabId:e.id,isOpen:!0}}let n=A(t,t=>{if(!a.usesManagedHistory(t))return t;let n=a.resolveOpenTarget({activeTab:t,url:e});return a.areUrlsEquivalent(t.currentUrl,n.url,t.kind,n.kind)?t:{...t,currentUrl:n.url,dedupeKey:n.dedupeKey,...j(t,n.url),kind:n.kind,navVersion:t.navVersion+1,title:n.title}}),r=n.tabs.find(e=>e.id===n.activeTabId);return r?N(n,d(r)):n})},this.syncUrl=e=>{this.setSnapshot(t=>{if(!t.tabs.length){let e=u(s(),`docs`,`Docs`);return{...t,tabs:[e],activeTabId:e.id}}let n=A(t,t=>{if(!a.usesManagedHistory(t))return t;let n=a.resolveOpenTarget({activeTab:t,kind:t.kind,url:e});return a.areUrlsEquivalent(t.currentUrl,n.url,t.kind,n.kind)?t:{...t,currentUrl:n.url,dedupeKey:n.dedupeKey,...j(t,n.url),kind:n.kind,title:n.title}}),r=n.tabs.find(e=>e.id===n.activeTabId);return r?N(n,d(r)):n})},this.goBack=()=>{this.setSnapshot(e=>{if(e.activeHistoryIndex<=0)return e;let t=e.activeHistoryIndex-1,n=e.activeHistory[t];return n?F({...e,activeHistoryIndex:t},n):e})},this.goForward=()=>{this.setSnapshot(e=>{if(e.activeHistoryIndex>=e.activeHistory.length-1)return e;let t=e.activeHistoryIndex+1,n=e.activeHistory[t];return n?F({...e,activeHistoryIndex:t},n):e})},this.closeTab=e=>{this.setSnapshot(t=>{if(t.tabs.length<=1)return{...f(),isOpen:!1};let n=t.tabs.findIndex(t=>t.id===e);if(n<0)return t;let r=t.tabs.filter(t=>t.id!==e),i=t.activeTabId===e?r[Math.max(0,n-1)]?.id??r[0].id:t.activeTabId,a={...t,tabs:r,activeTabId:i},o=a.activeHistory.filter(t=>t.tabId!==e),s=a.activeHistory.slice(0,a.activeHistoryIndex+1).filter(t=>t.tabId!==e),c=r.find(e=>e.id===i)??r[0],l={...a,activeHistory:o.length>0?o:[d(c)],activeHistoryIndex:Math.min(Math.max(0,s.length-1),Math.max(0,o.length-1))};return t.activeTabId===e?N(l,d(c)):l})},this.setActiveTab=e=>{this.setSnapshot(t=>{if(!t.tabs.some(t=>t.id===e))return t;let n=t.tabs.find(t=>t.id===e);return n?N({...t,activeTabId:e,isOpen:!0},d(n)):t})}}},z=r(e(),1),B=t(),V=(0,z.createContext)(null),H=new R;function U(){let e=(0,z.useContext)(V);if(!e)throw Error(`useDocBrowser must be used within DocBrowserProvider`);return e}function W({children:e}){let t=O(e=>e.snapshot),n=(0,z.useMemo)(()=>t.tabs.find(e=>e.id===t.activeTabId)??t.tabs[0],[t.activeTabId,t.tabs]),r=(0,z.useMemo)(()=>({...t,currentTab:n,open:H.open,openNewTab:H.openNewTab,close:H.close,toggleMode:H.toggleMode,navigate:H.navigate,syncUrl:H.syncUrl,goBack:H.goBack,goForward:H.goForward,closeTab:H.closeTab,setActiveTab:H.setActiveTab}),[n,t]);return(0,B.jsx)(V.Provider,{value:r,children:e})}export{h as i,U as n,p as r,W as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,o as t}from"./react-B2X_ph0a.js";var n=`docs.nextclaw.io`,r=`nextclaw-docs.pages.dev`,i=new Set([n,`www.${n}`,r,`www.${r}`]),a=`https://${n}`,o=`home`,s=`nextclaw://new-tab`,c=`/guide/getting-started`;function l(e){return e===`zh`?`zh`:`en`}function u(e,t){let n=e.startsWith(`/`)?e:`/${e}`;return n===`/`||n===``?`/${t}/`:/^\/(en|zh)(\/|$)/.test(n)?n:`/${t}${n}`}function d(e){let n=l(t());try{let t=new URL(e,a);return i.has(t.hostname)&&(t.pathname=u(t.pathname,n)),t.toString()}catch{return new URL(`/${n}${c}`,a).toString()}}function f(){return d(c)}function p(e){try{return new URL(e).pathname.replace(/\.html$/,``).replace(/\/$/,``)}catch{return e}}function m(e,t,n=`Docs`){try{let r=new URL(e,a);if(r.protocol===`data:`)return t===`docs`?n:`Detail`;let i=r.pathname.split(`/`).filter(Boolean),o=i[i.length-1]??n;return decodeURIComponent(o).replace(/[-_]/g,` `).slice(0,40)||n}catch{return n}}function h(e){try{let t=new URL(e,window.location.origin);return i.has(t.hostname)}catch{return!1}}function g(e,t){return t===`docs`?d(e):e}var _=`apps`,v=`nextclaw://apps`,y=`${v}?tab=service-apps`;function b(e,t){return e===t||e.startsWith(`${t}?`)||e.startsWith(`${t}/`)}function x(e){try{return new URL(e).searchParams.get(`tab`)===`service-apps`?y:v}catch{return v}}function S(e){return e&&h(e)?`docs`:`content`}var C=class{constructor(e){this.kind=e,this.historyPolicy=`managed`,this.defaultUrl=()=>this.kind===`docs`?a:`about:blank`,this.getTitle=e=>m(e,this.kind,this.kind===`docs`?`Docs`:`Detail`),this.matchUrl=()=>!1,this.normalizeUrl=e=>g(e,this.kind),this.urlsEquivalent=(e,t)=>e===t,this.id=`fallback:${e}`}},w=[{defaultUrl:()=>s,getTitle:()=>e(`docBrowserHomeTitle`),historyPolicy:`managed`,id:`home`,kind:o,matchUrl:e=>e===s,normalizeUrl:()=>s,urlsEquivalent:(e,t)=>e===t},{defaultUrl:f,getTitle:()=>`Docs`,historyPolicy:`managed`,id:`docs`,kind:`docs`,matchUrl:h,normalizeUrl:e=>g(e,`docs`),urlsEquivalent:(e,t)=>p(e)===p(t)},{defaultUrl:()=>v,getDedupeKey:()=>`apps`,getTitle:t=>x(t)===y?e(`serviceAppsTitle`):e(`appsTitle`),historyPolicy:`managed`,id:`apps`,kind:_,matchUrl:e=>b(e,v),normalizeUrl:x,urlsEquivalent:(e,t)=>x(e)===x(t)}],T=new class{constructor(){this.routeDefinitions=w,this.resolveOpenTarget=e=>{let{activeTab:t,kind:n,url:r}=e,i=this.resolveRouteDefinition(r,n,t),a=r?.trim()||(!n&&t&&t.kind!==`docs`?t.currentUrl:i.defaultUrl()),o=i.normalizeUrl(a);return{dedupeKey:i.getDedupeKey?.(o),historyPolicy:i.historyPolicy,kind:i.kind,title:i.getTitle(o),url:o}},this.areUrlsEquivalent=(e,t,n,r)=>n===r?this.resolveRouteDefinition(e,n).urlsEquivalent?.(e,t)??e===t:!1,this.usesManagedHistory=e=>this.resolveRouteDefinition(e.currentUrl,e.kind).historyPolicy===`managed`,this.getHomeNavigationItems=()=>[{id:`apps`,label:e(`appsTitle`),target:{type:`doc-browser`,url:v}},{id:`service-apps`,label:e(`serviceAppsTitle`),target:{type:`doc-browser`,url:y}},{id:`docs`,label:e(`docBrowserHelp`),target:{options:{newTab:!0},type:`doc-browser`,url:f()}},{id:`skill-marketplace`,label:e(`marketplaceSkillsPageTitle`),target:{path:`/marketplace/skills`,type:`app-route`}},{id:`mcp-marketplace`,label:e(`marketplaceMcpPageTitle`),target:{path:`/marketplace/mcp`,type:`app-route`}}],this.resolveRouteDefinition=(e,t,n)=>{let r=t??(e?void 0:n?.kind);return(r?this.routeDefinitions.find(e=>e.kind===r):void 0)||(e?this.routeDefinitions.find(t=>t.matchUrl(e)):void 0)||new C(t??n?.kind??S(e))}}};export{a,m as c,T as i,h as l,v as n,o,y as r,f as s,_ as t,p as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./doc-browser-BI7HSaMK.js";export{e as DocBrowser};
|