@xopcai/xopc 0.0.440 → 0.0.441
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/dist/browser-ext/dist/sidepanel.js +5 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DOcr7J4E.js → apps-page-B0qorxfq.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-6ti-Fduf.js → automations-page-D3Cb5vfR.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-AJhsnIMA.js → automations-workspace-BBSTBucV.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-bTEnfGla.js → capabilities-CrAs-oqU.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-DSfd2fMv.js → capabilities-DG0ckPuF.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-BmTXUhQp.js → capabilities-page-CJLVUcD4.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-DWelRpM-.js → capabilities-settings-panel-D8t5F998.js} +2 -2
- package/dist/gateway/static/root/assets/{channels-DVTl7Jqc.js → channels-OiT-5N_6.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-page-ATnFh_yO.js → chat-page-DBAezT9u.js} +3 -3
- package/dist/gateway/static/root/assets/{chat-terminal-dock-BJ8SYeo7.js → chat-terminal-dock-CEaFlZEs.js} +1 -1
- package/dist/gateway/static/root/assets/{command-palette-api-DUDKFXBH.js → command-palette-api-C3G6veE2.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-payload-handoff-Cqi83bL5.js → composer-payload-handoff-Ccq_KF1W.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-B_qTQG1-.js → connectors-page-Cbn4LSpC.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CSsZoz0G.js → extension-debug-page-DXGpnxwM.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-DHeeJG5w.js → extension-iframe-host-DTwDBQQ9.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DhQJVav9.js → extension-page-BVBxNzys.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-CJQkyfle.js → extension-provider-D-Fa5PU-.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-qUg8c93J.js → extension-settings-page-ycMuOpv3.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-BjAejNQt.js → home-page-eXW3llb0.js} +2 -2
- package/dist/gateway/static/root/assets/{index-Bn4t_KuI.js → index-CQ570IAI.js} +5 -5
- package/dist/gateway/static/root/assets/{local-app-workbench-page-B6iL_VbY.js → local-app-workbench-page-xV9a7McI.js} +1 -1
- package/dist/gateway/static/root/assets/local-session-drafts-v7v7Hb6T.js +4 -0
- package/dist/gateway/static/root/assets/{note-detail-panel-i_c7IJon.js → note-detail-panel-CVrfF6XL.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-DUpUq3ca.js → notes-page-BOCURwg6.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-BJASJMLv.js → page-context-capture-button-Dor5Y5Bf.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-draft-5xnVOZAF.js → page-context-draft-B8DQ5lNT.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-Cen6HXw_.js → personal-page-DUykELZZ.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-BpFMnYqe.js → project-detail-page-BHLOHrat.js} +1 -1
- package/dist/gateway/static/root/assets/{route-preload-C2b1djX_.js → route-preload-Coy9Gjyy.js} +2 -2
- package/dist/gateway/static/root/assets/{session-manager-BpO7h2es.js → session-manager-CZyY5Y87.js} +2 -2
- package/dist/gateway/static/root/assets/{settings-page-JEaz5Vzy.js → settings-page-SQwLKlTr.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-pLEAG660.js → share-preview-page-B6yMj5nG.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-Zdv1sVrv.js → shares-settings-vxTYg6Hp.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-ftr5UzWS.js → skills-page-Xbnh0-6I.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-BkPUm6sy.js → task-detail-page-B9akf3i8.js} +1 -1
- package/dist/gateway/static/root/assets/{task-result-evidence-MOHY0Myr.js → task-result-evidence-DFiu5SlL.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-CgVehTrs.js → use-composer-attachments-fK2PUQbB.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-GOK8-Bzy.js → use-file-preview-expanded-ivMxmMu1.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-CU-lW_cN.js → use-workspace-tree-CiLbOQHQ.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-transcribe-api-Z56gWWll.js → voice-transcribe-api-NpNY_gsE.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-api-DJ3Ebhz_.js → workspace-api-BKbezgv-.js} +2 -2
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-BlVJ5Vmn.js → workspace-file-preview-dialog-CS8-ZbVG.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-jAwoLoam.js → workspace-open-location-menu-BQrTy-8o.js} +1 -1
- package/dist/gateway/static/root/index.html +19 -19
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/session-input-command.js +5 -1
- package/dist/src/gateway/service/session-command-service.js +6 -0
- package/dist/src/storage/sqlite/session-creation-repository.js +2 -1
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/local-session-drafts-DILglF8O.js +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r}from"./locale-store-DGtk-KSF.js";import{t as i}from"./messages-DYDySzn1.js";import{r as a}from"./extension-provider-
|
|
1
|
+
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r}from"./locale-store-DGtk-KSF.js";import{t as i}from"./messages-DYDySzn1.js";import{r as a}from"./extension-provider-D-Fa5PU-.js";import{n as o,t as s}from"./settings-page-header-4d1u-o-F.js";import"./settings-page-layout-Cy9_VBag.js";var c=t();e();var l=n();function u(){let e=(0,c.c)(40),t=r(p),n;e[0]===t?n=e[1]:(n=i(t),e[0]=t,e[1]=n);let u=n.extensionDebug,m=a(),h;e[2]===m?h=e[3]:(h=m.toSorted(f),e[2]=m,e[3]=h);let g=h,_;e[4]!==u.subtitle||e[5]!==u.title?(_=(0,l.jsx)(s,{title:u.title,subtitle:u.subtitle}),e[4]=u.subtitle,e[5]=u.title,e[6]=_):_=e[6];let v;e[7]===u.listHeading?v=e[8]:(v=(0,l.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:u.listHeading}),e[7]=u.listHeading,e[8]=v);let y;e[9]===u.colId?y=e[10]:(y=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colId}),e[9]=u.colId,e[10]=y);let b;e[11]===u.colName?b=e[12]:(b=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colName}),e[11]=u.colName,e[12]=b);let x;e[13]===u.colPermissions?x=e[14]:(x=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colPermissions}),e[13]=u.colPermissions,e[14]=x);let S;e[15]!==y||e[16]!==b||e[17]!==x?(S=(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{className:`text-xs uppercase text-fg-muted`,children:[y,b,x]})}),e[15]=y,e[16]=b,e[17]=x,e[18]=S):S=e[18];let C;e[19]===g?C=e[20]:(C=g.map(d),e[19]=g,e[20]=C);let w;e[21]===C?w=e[22]:(w=(0,l.jsx)(`tbody`,{children:C}),e[21]=C,e[22]=w);let T;e[23]!==S||e[24]!==w?(T=(0,l.jsx)(`div`,{className:`mt-3 overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full min-w-[32rem] border-separate border-spacing-y-1 text-left text-sm`,children:[S,w]})}),e[23]=S,e[24]=w,e[25]=T):T=e[25];let E;e[26]!==T||e[27]!==v?(E=(0,l.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[v,T]}),e[26]=T,e[27]=v,e[28]=E):E=e[28];let D;e[29]===u.futureHeading?D=e[30]:(D=(0,l.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:u.futureHeading}),e[29]=u.futureHeading,e[30]=D);let O;e[31]===u.futureBody?O=e[32]:(O=(0,l.jsx)(`p`,{className:`mt-2`,children:u.futureBody}),e[31]=u.futureBody,e[32]=O);let k;e[33]!==D||e[34]!==O?(k=(0,l.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4 text-sm text-fg-muted`,children:[D,O]}),e[33]=D,e[34]=O,e[35]=k):k=e[35];let A;return e[36]!==E||e[37]!==k||e[38]!==_?(A=(0,l.jsxs)(o,{gap:`gap-5`,children:[_,E,k]}),e[36]=E,e[37]=k,e[38]=_,e[39]=A):A=e[39],A}function d(e){return(0,l.jsxs)(`tr`,{className:`bg-surface-base/55`,children:[(0,l.jsx)(`td`,{className:`rounded-l-lg px-3 py-2 font-mono text-xs text-fg`,children:e.id}),(0,l.jsx)(`td`,{className:`px-3 py-2 text-fg`,children:e.name}),(0,l.jsx)(`td`,{className:`rounded-r-lg px-3 py-2 font-mono text-xs text-fg-muted`,children:(e.ui?.permissions??[]).join(`, `)||`—`})]},e.id)}function f(e,t){return e.id.localeCompare(t.id)}function p(e){return e.language}export{u as ExtensionDebugPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,l as a,n as ee,o}from"./locale-store-DGtk-KSF.js";import{t as te}from"./messages-DYDySzn1.js";import{a as s,n as c,o as l,r as ne,s as re,t as u}from"./dist-BGTk37IG.js";import{c as d,n as f}from"./extension-provider-CJQkyfle.js";import{i as p}from"./theme-store-D58tk8pq.js";import{r as m}from"./settings-form-draft-Dy10ldo8.js";var h=e(t(),1),ie=n();function g(e){return e.split(`/`).filter(Boolean).map(e=>encodeURIComponent(e)).join(`/`)}function _(e,t){let n=g(t);return i(`/api/extensions/${encodeURIComponent(e)}/assets/${n}`)}var v={"capability:xopc.notes.create":`Create notes in this workspace`,"capability:xopc.notes.update":`Change notes in this workspace at an exact revision`,"capability:xopc.notes.append":`Append content to notes in this workspace`,"capability:xopc.notes.get":`Read notes in this workspace by ID`,"capability:xopc.notes.list":`Search and list notes in this workspace`,"capability:xopc.tasks.get":`Read tasks and their context in this workspace`,"capability:xopc.tasks.list":`Search and list tasks in this workspace`,theme:`Read theme (light / dark)`,"agent.send":`Send messages to the assistant`,"agent.subscribe":`Receive live agent stream events for a chat`,"session.read":`List and open chat sessions`,"config.read":`Read plugin configuration`,"config.write":`Write plugin configuration`,storage:`Read and write plugin storage`,notification:`Show in-app notifications`},y={"capability:xopc.notes.create":`在当前工作区创建笔记`,"capability:xopc.notes.update":`按精确版本修改当前工作区的笔记`,"capability:xopc.notes.append":`向当前工作区的笔记追加内容`,"capability:xopc.notes.get":`按 ID 读取当前工作区的笔记`,"capability:xopc.notes.list":`搜索和列出当前工作区的笔记`,"capability:xopc.tasks.get":`读取当前工作区的任务及其上下文`,"capability:xopc.tasks.list":`搜索和列出当前工作区的任务`,theme:`读取主题(浅色/深色)`,"agent.send":`向助手发送消息`,"agent.subscribe":`接收会话的实时助手流式事件`,"session.read":`列出并打开聊天会话`,"config.read":`读取插件配置`,"config.write":`写入插件配置`,storage:`读写插件存储`,notification:`显示应用内通知`};function b(e,t){let n=v[e];return t===`zh`&&y[e]?y[e]:n??e}var x=r();function S(e){let t=(0,ie.c)(59),{open:n,onOpenChange:r,extensionId:i,extensionName:a,permissions:o,onConfirm:d,confirmDisabled:f}=e,p=ee(w),m,h,g,_,v,y,S,T,E,D,O,k;t[0]!==a||t[1]!==p||t[2]!==r||t[3]!==n?(v=te(p).extensionUi,_=u,O=n,k=r,g=l,t[16]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,x.jsx)(s,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[16]=D):D=t[16],h=ne,T=`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-overlay p-5`,E=C,m=re,y=`text-base font-semibold text-fg`,S=v.permissionTitle.replace(`{{name}}`,a),t[0]=a,t[1]=p,t[2]=r,t[3]=n,t[4]=m,t[5]=h,t[6]=g,t[7]=_,t[8]=v,t[9]=y,t[10]=S,t[11]=T,t[12]=E,t[13]=D,t[14]=O,t[15]=k):(m=t[4],h=t[5],g=t[6],_=t[7],v=t[8],y=t[9],S=t[10],T=t[11],E=t[12],D=t[13],O=t[14],k=t[15]);let A;t[17]!==m||t[18]!==y||t[19]!==S?(A=(0,x.jsx)(m,{className:y,children:S}),t[17]=m,t[18]=y,t[19]=S,t[20]=A):A=t[20];let j;t[21]===i?j=t[22]:(j=(0,x.jsxs)(`span`,{className:`font-mono text-xs text-fg-muted`,title:i,children:[`(`,i,`)`]}),t[21]=i,t[22]=j);let M;t[23]!==v.permissionSubtitle||t[24]!==j?(M=(0,x.jsxs)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:[v.permissionSubtitle,` `,j]}),t[23]=v.permissionSubtitle,t[24]=j,t[25]=M):M=t[25];let N;t[26]!==p||t[27]!==o||t[28]!==v.permissionsNone?(N=o.length===0?(0,x.jsx)(`p`,{className:`mt-4 text-sm text-fg-muted`,children:v.permissionsNone}):(0,x.jsx)(`ul`,{className:`mt-4 max-h-48 list-inside list-disc space-y-1 overflow-y-auto text-sm text-fg`,children:o.map(e=>(0,x.jsx)(`li`,{children:b(e,p)},e))}),t[26]=p,t[27]=o,t[28]=v.permissionsNone,t[29]=N):N=t[29];let P;t[30]===v.deny?P=t[31]:(P=(0,x.jsx)(c,{asChild:!0,children:(0,x.jsx)(`button`,{type:`button`,className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-inset`,children:v.deny})}),t[30]=v.deny,t[31]=P);let F;t[32]!==d||t[33]!==r?(F=()=>{d(),r(!1)},t[32]=d,t[33]=r,t[34]=F):F=t[34];let I;t[35]!==f||t[36]!==v.allow||t[37]!==F?(I=(0,x.jsx)(`button`,{type:`button`,disabled:f,className:`rounded-lg bg-accent px-3 py-2 text-sm font-medium text-on-accent hover:opacity-90`,onClick:F,children:v.allow}),t[35]=f,t[36]=v.allow,t[37]=F,t[38]=I):I=t[38];let L;t[39]!==P||t[40]!==I?(L=(0,x.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[P,I]}),t[39]=P,t[40]=I,t[41]=L):L=t[41];let R;t[42]!==h||t[43]!==M||t[44]!==N||t[45]!==L||t[46]!==T||t[47]!==E||t[48]!==A?(R=(0,x.jsxs)(h,{className:T,onOpenAutoFocus:E,children:[A,M,N,L]}),t[42]=h,t[43]=M,t[44]=N,t[45]=L,t[46]=T,t[47]=E,t[48]=A,t[49]=R):R=t[49];let z;t[50]!==g||t[51]!==R||t[52]!==D?(z=(0,x.jsxs)(g,{children:[D,R]}),t[50]=g,t[51]=R,t[52]=D,t[53]=z):z=t[53];let B;return t[54]!==_||t[55]!==z||t[56]!==O||t[57]!==k?(B=(0,x.jsx)(_,{open:O,onOpenChange:k,children:z}),t[54]=_,t[55]=z,t[56]=O,t[57]=k,t[58]=B):B=t[58],B}function C(e){return e.preventDefault()}function w(e){return e.language}async function T(e){let{grant:t}=await o(i(`/api/extensions/${encodeURIComponent(e)}/ui-grant`));return t}async function E(e,t){return(await o(i(`/api/extensions/${encodeURIComponent(e)}/ui-grant`),{method:`POST`,body:JSON.stringify({manifestDigest:t})})).grant}var D=48,O=2e3,k=`allow-scripts allow-forms allow-popups`;function A(e){let t=(0,ie.c)(98),{extensionId:n,extensionName:r,entrypoint:i,permissions:o,title:s,className:c,fixedHeight:l,maxHeight:ne,minHeight:re,initialData:u}=e,g=ne===void 0?O:ne,v=re===void 0?D:re,y=ee(P),b;t[0]===y?b=t[1]:(b=te(y),t[0]=y,t[1]=b);let C=b.extensionUi,w=f(),A=a(N),F=a(M),I=(0,h.useRef)(0),L=(0,h.useRef)(!1),R=(0,h.useRef)(null),z=p(j),B;t[2]!==n||t[3]!==r?(B=r?.trim()||n,t[2]=n,t[3]=r,t[4]=B):B=t[4];let ae=B,oe;t[5]!==n||t[6]!==s?(oe=s?.trim()||`Extension ${n}`,t[5]=n,t[6]=s,t[7]=oe):oe=t[7];let se=oe,V;t[8]===o?V=t[9]:(V=JSON.stringify(Array.from(o??[]).toSorted()),t[8]=o,t[9]=V);let ce=V,H;t[10]===ce?H=t[11]:(H=JSON.parse(ce),t[10]=ce,t[11]=H);let le=H,ue=l??Math.min(g,Math.max(v,320)),U;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(U=[],t[12]=U):U=t[12];let W;t[13]===ue?W=t[14]:(W={allowed:!1,dialogOpen:!1,reloadKey:0,loadError:!1,dynamicHeight:ue,grantResolved:!1,grantError:null,manifestDigest:null,grantedPermissions:U},t[13]=ue,t[14]=W);let[G,K]=(0,h.useReducer)(m,W),{allowed:q,dialogOpen:J,reloadKey:Y,loadError:de,dynamicHeight:fe,grantResolved:pe,grantError:X}=G,me;t[15]===n?me=t[16]:(me=()=>{let e=!0;return L.current=!1,K({type:`patch`,patch:{allowed:!1,dialogOpen:!1,grantResolved:!1,grantError:null,manifestDigest:null,grantedPermissions:[]}}),T(n).then(t=>{if(e){if(t.extensionId!==n||!t.manifestDigest)throw Error(`Could not verify plugin permissions`);K({type:`patch`,patch:{allowed:t.granted,dialogOpen:!t.granted,grantResolved:!0,manifestDigest:t.manifestDigest,grantedPermissions:t.permissions}})}}).catch(t=>{e&&K({type:`patch`,patch:{allowed:!1,dialogOpen:!0,grantResolved:!0,grantError:t instanceof Error?t.message:String(t)}})}),()=>{e=!1,I.current+=1}},t[15]=n,t[16]=me);let he;t[17]!==n||t[18]!==A||t[19]!==F||t[20]!==le||t[21]!==Y?(he=[n,le,A,F,Y],t[17]=n,t[18]=A,t[19]=F,t[20]=le,t[21]=Y,t[22]=he):he=t[22],(0,h.useEffect)(me,he);let ge;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ge=e=>K({type:`patch`,patch:{dialogOpen:e}}),t[23]=ge):ge=t[23];let _e=ge,ve;t[24]!==i||t[25]!==n?(ve=_(n,i),t[24]=i,t[25]=n,t[26]=ve):ve=t[26];let ye=ve,be;t[27]!==q||t[28]!==n||t[29]!==l||t[30]!==g||t[31]!==v||t[32]!==w||t[33]!==G.grantedPermissions||t[34]!==G.manifestDigest?(be=()=>{if(!q)return;let e=R.current;if(!e)return;w.registerIframe(n,e,G.grantedPermissions,G.manifestDigest??void 0);let t=w.subscribeExtensionEvents(n,e=>{if(e.event!==`ui.resize`||!e.data||typeof e.data!=`object`||e.data===null)return;let t=Number(e.data.height);Number.isFinite(t)&&l===void 0&&K({type:`patch`,patch:{dynamicHeight:Math.min(g,Math.max(v,t))}})});return()=>{t(),w.unregisterIframe(n)}},t[27]=q,t[28]=n,t[29]=l,t[30]=g,t[31]=v,t[32]=w,t[33]=G.grantedPermissions,t[34]=G.manifestDigest,t[35]=be):be=t[35];let xe;t[36]!==q||t[37]!==n||t[38]!==l||t[39]!==g||t[40]!==v||t[41]!==Y||t[42]!==w||t[43]!==G.grantedPermissions||t[44]!==G.manifestDigest?(xe=[q,n,l,g,v,G.grantedPermissions,G.manifestDigest,w,Y],t[36]=q,t[37]=n,t[38]=l,t[39]=g,t[40]=v,t[41]=Y,t[42]=w,t[43]=G.grantedPermissions,t[44]=G.manifestDigest,t[45]=xe):xe=t[45],(0,h.useLayoutEffect)(be,xe);let Se,Ce;t[46]!==q||t[47]!==n||t[48]!==z||t[49]!==w?(Se=()=>{if(!q)return;let e=d(z);w.sendEvent(n,`theme.changed`,e)},Ce=[q,n,z,w],t[46]=q,t[47]=n,t[48]=z,t[49]=w,t[50]=Se,t[51]=Ce):(Se=t[50],Ce=t[51]),(0,h.useEffect)(Se,Ce);let we;t[52]!==fe||t[53]!==l?(we=l===void 0?{width:`100%`,height:fe,border:`none`}:{width:`100%`,height:l,border:`none`},t[52]=fe,t[53]=l,t[54]=we):we=t[54];let Te=we,Ee;t[55]!==n||t[56]!==A||t[57]!==F||t[58]!==G.manifestDigest?(Ee=()=>{if(L.current||!G.manifestDigest)return;L.current=!0;let e=I.current,t=()=>I.current===e&&a.getState().baseUrl===A&&a.getState().conversationId===F;E(n,G.manifestDigest).then(e=>{if(t()){if(!e.granted||e.extensionId!==n||e.manifestDigest!==G.manifestDigest)throw Error(`Permission grant was not persisted`);K({type:`patch`,patch:{allowed:!0,grantError:null}})}}).catch(e=>{t()&&K({type:`patch`,patch:{allowed:!1,manifestDigest:null,grantError:e instanceof Error?e.message:String(e)}})}).finally(()=>{t()&&(L.current=!1)})},t[55]=n,t[56]=A,t[57]=F,t[58]=G.manifestDigest,t[59]=Ee):Ee=t[59];let De=Ee;if(!pe){let e=`${c??``} min-h-32 animate-pulse rounded-lg bg-surface-inset`,n;return t[60]===e?n=t[61]:(n=(0,x.jsx)(`div`,{className:e}),t[60]=e,t[61]=n),n}if(!q){let e=!G.manifestDigest,r;t[62]!==J||t[63]!==ae||t[64]!==n||t[65]!==De||t[66]!==e||t[67]!==G.grantedPermissions?(r=(0,x.jsx)(S,{open:J,onOpenChange:_e,extensionId:n,extensionName:ae,permissions:G.grantedPermissions,confirmDisabled:e,onConfirm:De}),t[62]=J,t[63]=ae,t[64]=n,t[65]=De,t[66]=e,t[67]=G.grantedPermissions,t[68]=r):r=t[68];let i;t[69]!==c||t[70]!==J||t[71]!==X||t[72]!==Y||t[73]!==C?(i=J?null:(0,x.jsxs)(`div`,{className:c?`${c} rounded-lg border border-edge border-dashed bg-surface-base p-4 text-sm text-fg-muted`:`rounded-lg border border-edge border-dashed bg-surface-base p-4 text-sm text-fg-muted`,children:[X?(0,x.jsx)(`p`,{className:`mb-2 text-danger`,children:X}):null,(0,x.jsx)(`p`,{children:C.deniedHint}),(0,x.jsx)(`button`,{type:`button`,className:`mt-2 text-sm font-medium text-accent underline-offset-2 hover:underline`,onClick:()=>K({type:`patch`,patch:{reloadKey:Y+1}}),children:C.reviewPermissions})]}),t[69]=c,t[70]=J,t[71]=X,t[72]=Y,t[73]=C,t[74]=i):i=t[74];let a;return t[75]!==r||t[76]!==i?(a=(0,x.jsxs)(x.Fragment,{children:[r,i]}),t[75]=r,t[76]=i,t[77]=a):a=t[77],a}let Z;t[78]!==de||t[79]!==Y||t[80]!==C?(Z=de?(0,x.jsxs)(`div`,{className:`mb-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm text-fg`,children:[(0,x.jsx)(`p`,{children:C.loadFailed}),(0,x.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:C.loadFailedConnectionHint}),(0,x.jsx)(`button`,{type:`button`,className:`mt-2 font-medium text-accent underline-offset-2 hover:underline`,onClick:()=>{K({type:`patch`,patch:{loadError:!1,reloadKey:Y+1}})},children:C.retryLoad})]}):null,t[78]=de,t[79]=Y,t[80]=C,t[81]=Z):Z=t[81];let Oe=`${n}-${i}-${Y}`,ke;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(ke=()=>K({type:`patch`,patch:{loadError:!0}}),t[82]=ke):ke=t[82];let Q;t[83]!==n||t[84]!==u||t[85]!==y||t[86]!==w?(Q=()=>{K({type:`patch`,patch:{loadError:!1}}),w.sendInit(n,d(p.getState().resolved),y),u!==void 0&&w.sendEvent(n,`widget.data`,u)},t[83]=n,t[84]=u,t[85]=y,t[86]=w,t[87]=Q):Q=t[87];let $;t[88]!==c||t[89]!==se||t[90]!==ye||t[91]!==Te||t[92]!==Oe||t[93]!==Q?($=(0,x.jsx)(`iframe`,{ref:R,className:c,title:se,src:ye,style:Te,sandbox:k,referrerPolicy:`no-referrer`,onError:ke,onLoad:Q},Oe),t[88]=c,t[89]=se,t[90]=ye,t[91]=Te,t[92]=Oe,t[93]=Q,t[94]=$):$=t[94];let Ae;return t[95]!==Z||t[96]!==$?(Ae=(0,x.jsxs)(`div`,{className:`flex flex-1 min-h-0 min-w-0 flex-col`,children:[Z,$]}),t[95]=Z,t[96]=$,t[97]=Ae):Ae=t[97],Ae}function j(e){return e.resolved}function M(e){return e.conversationId}function N(e){return e.baseUrl}function P(e){return e.language}export{A as t};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,l as a,n as ee,o}from"./locale-store-DGtk-KSF.js";import{t as te}from"./messages-DYDySzn1.js";import{a as s,n as c,o as l,r as ne,s as re,t as u}from"./dist-BGTk37IG.js";import{c as d,n as f}from"./extension-provider-D-Fa5PU-.js";import{i as p}from"./theme-store-D58tk8pq.js";import{r as m}from"./settings-form-draft-Dy10ldo8.js";var h=e(t(),1),ie=n();function g(e){return e.split(`/`).filter(Boolean).map(e=>encodeURIComponent(e)).join(`/`)}function _(e,t){let n=g(t);return i(`/api/extensions/${encodeURIComponent(e)}/assets/${n}`)}var v={"capability:xopc.notes.create":`Create notes in this workspace`,"capability:xopc.notes.update":`Change notes in this workspace at an exact revision`,"capability:xopc.notes.append":`Append content to notes in this workspace`,"capability:xopc.notes.get":`Read notes in this workspace by ID`,"capability:xopc.notes.list":`Search and list notes in this workspace`,"capability:xopc.tasks.get":`Read tasks and their context in this workspace`,"capability:xopc.tasks.list":`Search and list tasks in this workspace`,theme:`Read theme (light / dark)`,"agent.send":`Send messages to the assistant`,"agent.subscribe":`Receive live agent stream events for a chat`,"session.read":`List and open chat sessions`,"config.read":`Read plugin configuration`,"config.write":`Write plugin configuration`,storage:`Read and write plugin storage`,notification:`Show in-app notifications`},y={"capability:xopc.notes.create":`在当前工作区创建笔记`,"capability:xopc.notes.update":`按精确版本修改当前工作区的笔记`,"capability:xopc.notes.append":`向当前工作区的笔记追加内容`,"capability:xopc.notes.get":`按 ID 读取当前工作区的笔记`,"capability:xopc.notes.list":`搜索和列出当前工作区的笔记`,"capability:xopc.tasks.get":`读取当前工作区的任务及其上下文`,"capability:xopc.tasks.list":`搜索和列出当前工作区的任务`,theme:`读取主题(浅色/深色)`,"agent.send":`向助手发送消息`,"agent.subscribe":`接收会话的实时助手流式事件`,"session.read":`列出并打开聊天会话`,"config.read":`读取插件配置`,"config.write":`写入插件配置`,storage:`读写插件存储`,notification:`显示应用内通知`};function b(e,t){let n=v[e];return t===`zh`&&y[e]?y[e]:n??e}var x=r();function S(e){let t=(0,ie.c)(59),{open:n,onOpenChange:r,extensionId:i,extensionName:a,permissions:o,onConfirm:d,confirmDisabled:f}=e,p=ee(w),m,h,g,_,v,y,S,T,E,D,O,k;t[0]!==a||t[1]!==p||t[2]!==r||t[3]!==n?(v=te(p).extensionUi,_=u,O=n,k=r,g=l,t[16]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,x.jsx)(s,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[16]=D):D=t[16],h=ne,T=`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-overlay p-5`,E=C,m=re,y=`text-base font-semibold text-fg`,S=v.permissionTitle.replace(`{{name}}`,a),t[0]=a,t[1]=p,t[2]=r,t[3]=n,t[4]=m,t[5]=h,t[6]=g,t[7]=_,t[8]=v,t[9]=y,t[10]=S,t[11]=T,t[12]=E,t[13]=D,t[14]=O,t[15]=k):(m=t[4],h=t[5],g=t[6],_=t[7],v=t[8],y=t[9],S=t[10],T=t[11],E=t[12],D=t[13],O=t[14],k=t[15]);let A;t[17]!==m||t[18]!==y||t[19]!==S?(A=(0,x.jsx)(m,{className:y,children:S}),t[17]=m,t[18]=y,t[19]=S,t[20]=A):A=t[20];let j;t[21]===i?j=t[22]:(j=(0,x.jsxs)(`span`,{className:`font-mono text-xs text-fg-muted`,title:i,children:[`(`,i,`)`]}),t[21]=i,t[22]=j);let M;t[23]!==v.permissionSubtitle||t[24]!==j?(M=(0,x.jsxs)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:[v.permissionSubtitle,` `,j]}),t[23]=v.permissionSubtitle,t[24]=j,t[25]=M):M=t[25];let N;t[26]!==p||t[27]!==o||t[28]!==v.permissionsNone?(N=o.length===0?(0,x.jsx)(`p`,{className:`mt-4 text-sm text-fg-muted`,children:v.permissionsNone}):(0,x.jsx)(`ul`,{className:`mt-4 max-h-48 list-inside list-disc space-y-1 overflow-y-auto text-sm text-fg`,children:o.map(e=>(0,x.jsx)(`li`,{children:b(e,p)},e))}),t[26]=p,t[27]=o,t[28]=v.permissionsNone,t[29]=N):N=t[29];let P;t[30]===v.deny?P=t[31]:(P=(0,x.jsx)(c,{asChild:!0,children:(0,x.jsx)(`button`,{type:`button`,className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-inset`,children:v.deny})}),t[30]=v.deny,t[31]=P);let F;t[32]!==d||t[33]!==r?(F=()=>{d(),r(!1)},t[32]=d,t[33]=r,t[34]=F):F=t[34];let I;t[35]!==f||t[36]!==v.allow||t[37]!==F?(I=(0,x.jsx)(`button`,{type:`button`,disabled:f,className:`rounded-lg bg-accent px-3 py-2 text-sm font-medium text-on-accent hover:opacity-90`,onClick:F,children:v.allow}),t[35]=f,t[36]=v.allow,t[37]=F,t[38]=I):I=t[38];let L;t[39]!==P||t[40]!==I?(L=(0,x.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[P,I]}),t[39]=P,t[40]=I,t[41]=L):L=t[41];let R;t[42]!==h||t[43]!==M||t[44]!==N||t[45]!==L||t[46]!==T||t[47]!==E||t[48]!==A?(R=(0,x.jsxs)(h,{className:T,onOpenAutoFocus:E,children:[A,M,N,L]}),t[42]=h,t[43]=M,t[44]=N,t[45]=L,t[46]=T,t[47]=E,t[48]=A,t[49]=R):R=t[49];let z;t[50]!==g||t[51]!==R||t[52]!==D?(z=(0,x.jsxs)(g,{children:[D,R]}),t[50]=g,t[51]=R,t[52]=D,t[53]=z):z=t[53];let B;return t[54]!==_||t[55]!==z||t[56]!==O||t[57]!==k?(B=(0,x.jsx)(_,{open:O,onOpenChange:k,children:z}),t[54]=_,t[55]=z,t[56]=O,t[57]=k,t[58]=B):B=t[58],B}function C(e){return e.preventDefault()}function w(e){return e.language}async function T(e){let{grant:t}=await o(i(`/api/extensions/${encodeURIComponent(e)}/ui-grant`));return t}async function E(e,t){return(await o(i(`/api/extensions/${encodeURIComponent(e)}/ui-grant`),{method:`POST`,body:JSON.stringify({manifestDigest:t})})).grant}var D=48,O=2e3,k=`allow-scripts allow-forms allow-popups`;function A(e){let t=(0,ie.c)(98),{extensionId:n,extensionName:r,entrypoint:i,permissions:o,title:s,className:c,fixedHeight:l,maxHeight:ne,minHeight:re,initialData:u}=e,g=ne===void 0?O:ne,v=re===void 0?D:re,y=ee(P),b;t[0]===y?b=t[1]:(b=te(y),t[0]=y,t[1]=b);let C=b.extensionUi,w=f(),A=a(N),F=a(M),I=(0,h.useRef)(0),L=(0,h.useRef)(!1),R=(0,h.useRef)(null),z=p(j),B;t[2]!==n||t[3]!==r?(B=r?.trim()||n,t[2]=n,t[3]=r,t[4]=B):B=t[4];let ae=B,oe;t[5]!==n||t[6]!==s?(oe=s?.trim()||`Extension ${n}`,t[5]=n,t[6]=s,t[7]=oe):oe=t[7];let se=oe,V;t[8]===o?V=t[9]:(V=JSON.stringify(Array.from(o??[]).toSorted()),t[8]=o,t[9]=V);let ce=V,H;t[10]===ce?H=t[11]:(H=JSON.parse(ce),t[10]=ce,t[11]=H);let le=H,ue=l??Math.min(g,Math.max(v,320)),U;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(U=[],t[12]=U):U=t[12];let W;t[13]===ue?W=t[14]:(W={allowed:!1,dialogOpen:!1,reloadKey:0,loadError:!1,dynamicHeight:ue,grantResolved:!1,grantError:null,manifestDigest:null,grantedPermissions:U},t[13]=ue,t[14]=W);let[G,K]=(0,h.useReducer)(m,W),{allowed:q,dialogOpen:J,reloadKey:Y,loadError:de,dynamicHeight:fe,grantResolved:pe,grantError:X}=G,me;t[15]===n?me=t[16]:(me=()=>{let e=!0;return L.current=!1,K({type:`patch`,patch:{allowed:!1,dialogOpen:!1,grantResolved:!1,grantError:null,manifestDigest:null,grantedPermissions:[]}}),T(n).then(t=>{if(e){if(t.extensionId!==n||!t.manifestDigest)throw Error(`Could not verify plugin permissions`);K({type:`patch`,patch:{allowed:t.granted,dialogOpen:!t.granted,grantResolved:!0,manifestDigest:t.manifestDigest,grantedPermissions:t.permissions}})}}).catch(t=>{e&&K({type:`patch`,patch:{allowed:!1,dialogOpen:!0,grantResolved:!0,grantError:t instanceof Error?t.message:String(t)}})}),()=>{e=!1,I.current+=1}},t[15]=n,t[16]=me);let he;t[17]!==n||t[18]!==A||t[19]!==F||t[20]!==le||t[21]!==Y?(he=[n,le,A,F,Y],t[17]=n,t[18]=A,t[19]=F,t[20]=le,t[21]=Y,t[22]=he):he=t[22],(0,h.useEffect)(me,he);let ge;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ge=e=>K({type:`patch`,patch:{dialogOpen:e}}),t[23]=ge):ge=t[23];let _e=ge,ve;t[24]!==i||t[25]!==n?(ve=_(n,i),t[24]=i,t[25]=n,t[26]=ve):ve=t[26];let ye=ve,be;t[27]!==q||t[28]!==n||t[29]!==l||t[30]!==g||t[31]!==v||t[32]!==w||t[33]!==G.grantedPermissions||t[34]!==G.manifestDigest?(be=()=>{if(!q)return;let e=R.current;if(!e)return;w.registerIframe(n,e,G.grantedPermissions,G.manifestDigest??void 0);let t=w.subscribeExtensionEvents(n,e=>{if(e.event!==`ui.resize`||!e.data||typeof e.data!=`object`||e.data===null)return;let t=Number(e.data.height);Number.isFinite(t)&&l===void 0&&K({type:`patch`,patch:{dynamicHeight:Math.min(g,Math.max(v,t))}})});return()=>{t(),w.unregisterIframe(n)}},t[27]=q,t[28]=n,t[29]=l,t[30]=g,t[31]=v,t[32]=w,t[33]=G.grantedPermissions,t[34]=G.manifestDigest,t[35]=be):be=t[35];let xe;t[36]!==q||t[37]!==n||t[38]!==l||t[39]!==g||t[40]!==v||t[41]!==Y||t[42]!==w||t[43]!==G.grantedPermissions||t[44]!==G.manifestDigest?(xe=[q,n,l,g,v,G.grantedPermissions,G.manifestDigest,w,Y],t[36]=q,t[37]=n,t[38]=l,t[39]=g,t[40]=v,t[41]=Y,t[42]=w,t[43]=G.grantedPermissions,t[44]=G.manifestDigest,t[45]=xe):xe=t[45],(0,h.useLayoutEffect)(be,xe);let Se,Ce;t[46]!==q||t[47]!==n||t[48]!==z||t[49]!==w?(Se=()=>{if(!q)return;let e=d(z);w.sendEvent(n,`theme.changed`,e)},Ce=[q,n,z,w],t[46]=q,t[47]=n,t[48]=z,t[49]=w,t[50]=Se,t[51]=Ce):(Se=t[50],Ce=t[51]),(0,h.useEffect)(Se,Ce);let we;t[52]!==fe||t[53]!==l?(we=l===void 0?{width:`100%`,height:fe,border:`none`}:{width:`100%`,height:l,border:`none`},t[52]=fe,t[53]=l,t[54]=we):we=t[54];let Te=we,Ee;t[55]!==n||t[56]!==A||t[57]!==F||t[58]!==G.manifestDigest?(Ee=()=>{if(L.current||!G.manifestDigest)return;L.current=!0;let e=I.current,t=()=>I.current===e&&a.getState().baseUrl===A&&a.getState().conversationId===F;E(n,G.manifestDigest).then(e=>{if(t()){if(!e.granted||e.extensionId!==n||e.manifestDigest!==G.manifestDigest)throw Error(`Permission grant was not persisted`);K({type:`patch`,patch:{allowed:!0,grantError:null}})}}).catch(e=>{t()&&K({type:`patch`,patch:{allowed:!1,manifestDigest:null,grantError:e instanceof Error?e.message:String(e)}})}).finally(()=>{t()&&(L.current=!1)})},t[55]=n,t[56]=A,t[57]=F,t[58]=G.manifestDigest,t[59]=Ee):Ee=t[59];let De=Ee;if(!pe){let e=`${c??``} min-h-32 animate-pulse rounded-lg bg-surface-inset`,n;return t[60]===e?n=t[61]:(n=(0,x.jsx)(`div`,{className:e}),t[60]=e,t[61]=n),n}if(!q){let e=!G.manifestDigest,r;t[62]!==J||t[63]!==ae||t[64]!==n||t[65]!==De||t[66]!==e||t[67]!==G.grantedPermissions?(r=(0,x.jsx)(S,{open:J,onOpenChange:_e,extensionId:n,extensionName:ae,permissions:G.grantedPermissions,confirmDisabled:e,onConfirm:De}),t[62]=J,t[63]=ae,t[64]=n,t[65]=De,t[66]=e,t[67]=G.grantedPermissions,t[68]=r):r=t[68];let i;t[69]!==c||t[70]!==J||t[71]!==X||t[72]!==Y||t[73]!==C?(i=J?null:(0,x.jsxs)(`div`,{className:c?`${c} rounded-lg border border-edge border-dashed bg-surface-base p-4 text-sm text-fg-muted`:`rounded-lg border border-edge border-dashed bg-surface-base p-4 text-sm text-fg-muted`,children:[X?(0,x.jsx)(`p`,{className:`mb-2 text-danger`,children:X}):null,(0,x.jsx)(`p`,{children:C.deniedHint}),(0,x.jsx)(`button`,{type:`button`,className:`mt-2 text-sm font-medium text-accent underline-offset-2 hover:underline`,onClick:()=>K({type:`patch`,patch:{reloadKey:Y+1}}),children:C.reviewPermissions})]}),t[69]=c,t[70]=J,t[71]=X,t[72]=Y,t[73]=C,t[74]=i):i=t[74];let a;return t[75]!==r||t[76]!==i?(a=(0,x.jsxs)(x.Fragment,{children:[r,i]}),t[75]=r,t[76]=i,t[77]=a):a=t[77],a}let Z;t[78]!==de||t[79]!==Y||t[80]!==C?(Z=de?(0,x.jsxs)(`div`,{className:`mb-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm text-fg`,children:[(0,x.jsx)(`p`,{children:C.loadFailed}),(0,x.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:C.loadFailedConnectionHint}),(0,x.jsx)(`button`,{type:`button`,className:`mt-2 font-medium text-accent underline-offset-2 hover:underline`,onClick:()=>{K({type:`patch`,patch:{loadError:!1,reloadKey:Y+1}})},children:C.retryLoad})]}):null,t[78]=de,t[79]=Y,t[80]=C,t[81]=Z):Z=t[81];let Oe=`${n}-${i}-${Y}`,ke;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(ke=()=>K({type:`patch`,patch:{loadError:!0}}),t[82]=ke):ke=t[82];let Q;t[83]!==n||t[84]!==u||t[85]!==y||t[86]!==w?(Q=()=>{K({type:`patch`,patch:{loadError:!1}}),w.sendInit(n,d(p.getState().resolved),y),u!==void 0&&w.sendEvent(n,`widget.data`,u)},t[83]=n,t[84]=u,t[85]=y,t[86]=w,t[87]=Q):Q=t[87];let $;t[88]!==c||t[89]!==se||t[90]!==ye||t[91]!==Te||t[92]!==Oe||t[93]!==Q?($=(0,x.jsx)(`iframe`,{ref:R,className:c,title:se,src:ye,style:Te,sandbox:k,referrerPolicy:`no-referrer`,onError:ke,onLoad:Q},Oe),t[88]=c,t[89]=se,t[90]=ye,t[91]=Te,t[92]=Oe,t[93]=Q,t[94]=$):$=t[94];let Ae;return t[95]!==Z||t[96]!==$?(Ae=(0,x.jsxs)(`div`,{className:`flex flex-1 min-h-0 min-w-0 flex-col`,children:[Z,$]}),t[95]=Z,t[96]=$,t[97]=Ae):Ae=t[97],Ae}function j(e){return e.resolved}function M(e){return e.conversationId}function N(e){return e.baseUrl}function P(e){return e.language}export{A as t};
|
package/dist/gateway/static/root/assets/{extension-page-DhQJVav9.js → extension-page-BVBxNzys.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{t as a}from"./resource-unavailable-BaczkGfK.js";import{r as o,s}from"./extension-provider-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{t as a}from"./resource-unavailable-BaczkGfK.js";import{r as o,s}from"./extension-provider-D-Fa5PU-.js";import{t as c}from"./page-header-store-f8XcAs9b.js";import{t as l}from"./extension-iframe-host-DTwDBQQ9.js";var u=n(),d=e(t(),1),f=r();function p(){let e=(0,u.c)(24),{extensionId:t,pageId:n}=i(),r=o(),p=c(h),g=c(m),_,v,y;e[0]!==t||e[1]!==r||e[2]!==n?(_=t?r.find(e=>e.id===t&&s(e)):void 0,v=_?.ui?.contributions?.pages,y=t&&v?.length?n?v.find(e=>e.id===n||e.id===`${t}.${n}`):v[0]:void 0,e[0]=t,e[1]=r,e[2]=n,e[3]=_,e[4]=v,e[5]=y):(_=e[3],v=e[4],y=e[5]);let b=y,x,S;if(e[6]!==g||e[7]!==_||e[8]!==t||e[9]!==b||e[10]!==p?(x=()=>{if(!t||!_||!b)return g(),()=>g();let e=b.title?.trim()||_.name||t;return p({startExtra:null,main:(0,f.jsx)(`div`,{className:`w-full min-w-0 px-3 sm:px-5 xl:px-6`,children:(0,f.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,title:e,children:e})}),end:null}),()=>g()},S=[g,_,t,b,p],e[6]=g,e[7]=_,e[8]=t,e[9]=b,e[10]=p,e[11]=x,e[12]=S):(x=e[11],S=e[12]),(0,d.useLayoutEffect)(x,S),!t){let t;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(a,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[13]=t):t=e[13],t}if(!_){let n=r.some(e=>e.id===t)?`plugin-page`:`plugin`,i;return e[14]===n?i=e[15]:(i=(0,f.jsx)(a,{kind:n,backTo:`/capabilities/extensions`}),e[14]=n,e[15]=i),i}if(!v?.length){let t;return e[16]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(a,{kind:`plugin-page`,backTo:`/capabilities/extensions`}),e[16]=t):t=e[16],t}if(!b){let t;return e[17]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(a,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[17]=t):t=e[17],t}let C=_.ui?.permissions,w;return e[18]!==_.name||e[19]!==t||e[20]!==b.entrypoint||e[21]!==b.title||e[22]!==C?(w=(0,f.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,f.jsx)(l,{extensionId:t,extensionName:_.name,entrypoint:b.entrypoint,permissions:C,title:b.title,className:`min-h-0 flex-1`,fixedHeight:void 0,maxHeight:99999})}),e[18]=_.name,e[19]=t,e[20]=b.entrypoint,e[21]=b.title,e[22]=C,e[23]=w):w=e[23],w}function m(e){return e.clearPageHeader}function h(e){return e.setPageHeader}export{p as ExtensionPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{a as i,i as a,l as o,o as s}from"./locale-store-DGtk-KSF.js";import{i as c,m as l,n as u,p as d,u as f}from"./schemas-CCWMleym.js";import{d as p,i as m,t as h}from"./session-manager-BpO7h2es.js";import{t as g}from"./capabilities-bTEnfGla.js";import{i as _}from"./vendor-swr-CdRzEUwF.js";import{a as v}from"./gateway-realtime-Bg4Mf7HA.js";import{t as y}from"./activity-store-t5c6XavH.js";import{i as b}from"./theme-store-D58tk8pq.js";var x=d({id:u([`xopc.notes.get`,`xopc.notes.list`,`xopc.tasks.get`,`xopc.tasks.list`,`xopc.notes.create`,`xopc.notes.update`,`xopc.notes.append`]),majorVersion:f().int().positive(),descriptorDigest:l().regex(/^[a-f0-9]{64}$/)});c(x).max(7).refine(e=>new Set(e.map(e=>e.id)).size===e.length,`Duplicate capability binding`);var S=e(t(),1),C=n(),w=`agent-stream-event`;function T(e){return e===`off`||e===`on`||e===`stream`}function E(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=typeof t.conversationId==`string`?t.conversationId.trim():``,r=typeof t.runId==`string`?t.runId.trim():``;return n&&r?{conversationId:n,runId:r}:null}function D(e,t,n){return t&&typeof t==`object`&&!Array.isArray(t)?{...t,seq:n}:{type:e,seq:n,payload:t}}async function O(e){try{let t=await i(a(`/api/sessions/${encodeURIComponent(e)}/agent-config`));if(!t.ok)return`on`;let n=await t.json(),r=n.payload?.activityDetail?.effective;if(T(r))return r;let o=n.payload?.activityDetail?.default;return T(o)?o:`on`}catch{return`on`}}function k(e){window.dispatchEvent(new CustomEvent(w,{detail:e}))}function A(e={}){let t=e.subscribe??v,n=e.loadActivityDetailLevel??O,r=e.dispatch??k,i=new Map,a=!1,o=e=>{let o=E(e.detail);if(!o||i.has(o.runId))return;let s=`on`,c=!1,l,u=!1,d=!1,f=()=>{},p=()=>{u||(u=!0,f(),i.get(o.runId)===p&&i.delete(o.runId))},m=e=>{a||u||r({conversationId:o.conversationId,event:e,activityDetailLevel:s})};n(o.conversationId).then(e=>{s=e,c=!0,e===`stream`&&l&&!d&&m(l),l=void 0}),f=t(`run:${o.runId}`,{onEvent:e=>{if(u||d)return;let t=D(e.event,e.data,e.seq);e.event===`thinking_delta`&&!c?l=t:m(t),e.event===`run_end`&&(d=!0,l=void 0,queueMicrotask(p))},onGap:e=>{e.recoverable||p()}},0),i.set(o.runId,p)},s=e=>{let t=E(e.detail);t&&i.get(t.runId)?.()};return window.addEventListener(`run-started`,o),window.addEventListener(`run-completed`,s),window.addEventListener(`agent-run-ended`,s),()=>{a=!0,window.removeEventListener(`run-started`,o),window.removeEventListener(`run-completed`,s),window.removeEventListener(`agent-run-ended`,s);for(let e of[...i.values()])e()}}var j=function(e){return e[e.PermissionDenied=4001]=`PermissionDenied`,e[e.InvalidRequest=4002]=`InvalidRequest`,e[e.MethodNotFound=4003]=`MethodNotFound`,e[e.InternalError=4004]=`InternalError`,e[e.Timeout=4005]=`Timeout`,e[e.ExtensionNotFound=4006]=`ExtensionNotFound`,e[e.RateLimited=4007]=`RateLimited`,e}({});async function M(e,t,n){let r=new h,i=await r.loadSessionAgentConfig(e);await r.loadSession(e),p(e,i),await new m().send(t,e,n,i.thinkingLevel)}var N=[`--color-surface-base`,`--color-surface-panel`,`--color-surface-hover`,`--color-fg`,`--color-fg-muted`,`--color-fg-subtle`,`--color-accent`,`--color-accent-hover`,`--color-accent-soft`,`--color-edge`,`--color-edge-subtle`,`--color-danger`,`--color-success`,`--color-warning`,`--radius-sm`,`--radius-lg`,`--radius-xl`];function P(e){let t=getComputedStyle(document.documentElement),n={};for(let e of N){let r=t.getPropertyValue(e).trim();r&&(n[e]=r)}return{mode:e,tokens:n,fontFamily:t.getPropertyValue(`font-family`).trim(),fontFamilyMono:t.getPropertyValue(`--font-mono`).trim()}}var F={"agent.sendMessage":`agent.send`,"session.list":`session.read`,"session.navigate":`session.read`,"config.get":`config.read`,"config.set":`config.write`,"storage.get":`storage`,"storage.set":`storage`,"storage.remove":`storage`,"storage.keys":`storage`,"ui.notification":`notification`,"theme.get":`theme`},I=class{iframes=new Map;byContentWindow=new WeakMap;handlers=new Map;extensionPermissions=new Map;releaseBindings=new Map;eventSubscribers=new Map;agentStreamSubscriptions=new Map;boundListener=e=>{this.onWindowMessage(e)};constructor(){window.addEventListener(`message`,this.boundListener)}dispose(){window.removeEventListener(`message`,this.boundListener),this.iframes.clear(),this.handlers.clear(),this.extensionPermissions.clear(),this.releaseBindings.clear(),this.eventSubscribers.clear(),this.agentStreamSubscriptions.clear()}registerIframe(e,t,n,r){let i=this.iframes.get(e);if(i&&i!==t&&i.contentWindow&&this.byContentWindow.delete(i.contentWindow),this.iframes.set(e,t),this.extensionPermissions.set(e,new Set(n)),this.releaseBindings.delete(e),r){let t=o.getState();this.releaseBindings.set(e,{digest:r,baseUrl:t.baseUrl,namespace:t.conversationId})}this.rememberIframeWindow(e,t)}unregisterIframe(e){let t=this.iframes.get(e);this.sendEvent(e,`panel.dispose`),t?.contentWindow&&this.byContentWindow.delete(t.contentWindow),this.iframes.delete(e),this.extensionPermissions.delete(e),this.releaseBindings.delete(e),this.agentStreamSubscriptions.delete(e)}rememberIframeWindow(e,t){let n=t.contentWindow;n&&this.byContentWindow.set(n,{extensionId:e,iframe:t})}subscribeAgentStream(e,t){let n=this.agentStreamSubscriptions.get(e);n||(n=new Set,this.agentStreamSubscriptions.set(e,n)),n.add(t)}unsubscribeAgentStream(e,t){this.agentStreamSubscriptions.get(e)?.delete(t)}forwardAgentStreamEvent(e,t){for(let[n,r]of this.agentStreamSubscriptions)r.has(e)&&this.sendEvent(n,`agent.stream.${e}`,t)}broadcastExtensionEvent(e,t,n){let r=t.startsWith(`ext.`)?t:`ext.${t}`;for(let[t]of this.iframes)t!==e&&this.sendEvent(t,r,n)}handleExtensionEvent(e,t,n){if(t.startsWith(`ext.`)){let r=t.slice(4);this.broadcastExtensionEvent(e,r,n);return}if(t===`agent.subscribe`||t===`agent.unsubscribe`){if(!(this.extensionPermissions.get(e)??new Set).has(`agent.subscribe`))return;let{conversationId:r}=n??{};if(typeof r!=`string`||!r.trim())return;let i=r.trim();t===`agent.subscribe`?this.subscribeAgentStream(e,i):this.unsubscribeAgentStream(e,i)}}registerMethod(e,t){this.handlers.set(e,t)}getReleaseDigest(e){let t=this.releaseBindings.get(e),n=o.getState();if(!t||t.baseUrl!==n.baseUrl||t.namespace!==n.conversationId)throw Error(`Extension release authorization is unavailable`);return t.digest}subscribeExtensionEvents(e,t){let n=this.eventSubscribers.get(e);return n||(n=new Set,this.eventSubscribers.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&this.eventSubscribers.delete(e)}}sendInit(e,t,n){let r=this.iframes.get(e);if(!r?.contentWindow)return;this.rememberIframeWindow(e,r);let i=[...this.extensionPermissions.get(e)??[]];r.contentWindow.postMessage({source:`xopc-host`,type:`init`,extensionId:e,permissions:i,theme:t,locale:n},`*`)}sendEvent(e,t,n){let r=this.iframes.get(e);r?.contentWindow&&r.contentWindow.postMessage({source:`xopc-host`,type:`event`,event:t,data:n},`*`)}broadcastEvent(e,t){for(let[,n]of this.iframes)n.contentWindow?.postMessage({source:`xopc-host`,type:`event`,event:e,data:t},`*`)}postResponse(e,t,n,r,i){let a=e.contentWindow,o={source:`xopc-host`,type:`response`,requestId:n,result:r,error:i};!a||a!==t?.source||a.postMessage(o,`*`)}async onWindowMessage(e){let t=e.data;if(!t||t.source!==`xopc-extension`||!e.source)return;let n=this.byContentWindow.get(e.source);if(!n)return;let{iframe:r,extensionId:i}=n;if(this.iframes.get(i)!==r||r.contentWindow!==e.source)return;if(t.type===`event`){this.handleExtensionEvent(i,t.event,t.data);let e=this.eventSubscribers.get(i);if(e){let n={event:t.event,data:t.data};for(let t of e)try{t(n)}catch{}}return}if(t.type!==`request`)return;let{requestId:a,method:s,params:c}=t;if(typeof a!=`string`||a.length>200||typeof s!=`string`||s.length>200)return;let l=this.handlers.get(s);if(!l){this.postResponse(r,e,a,void 0,{code:j.MethodNotFound,message:`Unknown method: ${s}`});return}let u=c&&typeof c==`object`&&`id`in c?c.id:void 0,d=s===`capability.describe`||s===`capability.call`?`capability:${typeof u==`string`?u:``}`:F[s],f=this.extensionPermissions.get(i)??new Set;if(d&&!f.has(d)){this.postResponse(r,e,a,void 0,{code:j.PermissionDenied,message:`Missing permission: ${d}`});return}let p=o.getState(),m=()=>this.iframes.get(i)===r&&r.contentWindow===e.source&&this.extensionPermissions.get(i)===f&&o.getState().baseUrl===p.baseUrl&&o.getState().conversationId===p.conversationId;try{let t=await l(i,c);if(!m())return;this.postResponse(r,e,a,t)}catch(t){if(!m())return;let n=t instanceof Error?t.message:String(t);this.postResponse(r,e,a,void 0,{code:j.InternalError,message:n})}}};function L(e){let t=d({id:x.shape.id}),n=t.extend({call:g});e.registerMethod(`capability.describe`,async(n,r)=>{let{id:i}=t.parse(r),o=e.getReleaseDigest(n),c=(await s(a(`/api/local-app-capabilities/${encodeURIComponent(n)}?manifestDigest=${encodeURIComponent(o)}`))).capabilities.find(e=>e.id===i);if(!c)throw Error(`Capability is unavailable for this release`);return c}),e.registerMethod(`capability.call`,async(t,r)=>{let{id:i,call:o}=n.parse(r),c=e.getReleaseDigest(t);return s(a(`/api/local-app-capabilities/${encodeURIComponent(t)}/${encodeURIComponent(i)}/invocations`),{method:`POST`,body:JSON.stringify({manifestDigest:c,call:o})})}),e.registerMethod(`theme.get`,async()=>P(b.getState().resolved)),e.registerMethod(`ui.navigate`,async(e,t)=>{let n=t&&typeof t==`object`&&t&&`path`in t?String(t.path??``):``;if(n){let e=n.startsWith(`/`)?n:`/${n}`;window.location.hash=`#${e}`}}),e.registerMethod(`ui.notification`,async(e,t)=>{if(!t||typeof t!=`object`)return;let n=t,r=typeof n.title==`string`?n.title.trim():``;r&&y({tone:n.type===`success`||n.type===`warning`||n.type===`error`||n.type===`info`?n.type:`info`,title:r,message:typeof n.message==`string`?n.message:void 0,source:e,dedupeKey:`extension:${e}:${r}`})}),e.registerMethod(`session.navigate`,async(e,t)=>{let n=t&&typeof t==`object`&&t&&`conversationId`in t?String(t.conversationId??``):``;n&&window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:n},bubbles:!0}))}),e.registerMethod(`session.list`,async()=>{let e=await i(a(`/api/sessions`));if(!e.ok)throw Error(`Failed to list sessions: ${e.status}`);return((await e.json()).items??[]).map(e=>({conversationId:e.key,title:e.name,lastMessageAt:e.updatedAt??e.lastAccessedAt,messageCount:e.messageCount}))}),e.registerMethod(`agent.sendMessage`,async(e,t)=>{let{message:n,conversationId:r,newSession:i}=t,a=r?.trim()||``;return(i||!a)&&(a=(await new h().createSession()).key),await M(a,n),{conversationId:a}}),e.registerMethod(`config.get`,async e=>{let t=await i(a(`/api/extensions/${encodeURIComponent(e)}/config`));if(!t.ok)throw Error(`Failed to get config: ${t.status}`);return t.json()}),e.registerMethod(`config.set`,async(e,t)=>{let n=t&&typeof t==`object`&&t&&!Array.isArray(t)?t:{},r=await i(a(`/api/extensions/${encodeURIComponent(e)}/config`),{method:`PATCH`,body:JSON.stringify(n)});if(!r.ok)throw Error(`Failed to set config: ${r.status}`)}),e.registerMethod(`storage.get`,async(e,t)=>{let n=t&&typeof t==`object`&&t&&`key`in t?String(t.key??``):``,r=await i(a(`/api/extensions/${encodeURIComponent(e)}/storage/${encodeURIComponent(n)}`));if(r.status!==404){if(!r.ok)throw Error(`Failed to get storage key: ${r.status}`);return(await r.json()).value}}),e.registerMethod(`storage.set`,async(e,t)=>{let n=t,r=n&&typeof n.key==`string`?n.key:``,o=await i(a(`/api/extensions/${encodeURIComponent(e)}/storage/${encodeURIComponent(r)}`),{method:`PUT`,body:JSON.stringify({value:n?.value})});if(!o.ok)throw Error(`Failed to set storage key: ${o.status}`)}),e.registerMethod(`storage.remove`,async(e,t)=>{let n=t&&typeof t==`object`&&t&&`key`in t?String(t.key??``):``,r=await i(a(`/api/extensions/${encodeURIComponent(e)}/storage/${encodeURIComponent(n)}`),{method:`DELETE`});if(r.status!==404&&!r.ok)throw Error(`Failed to remove storage key: ${r.status}`)}),e.registerMethod(`storage.keys`,async e=>{let t=await i(a(`/api/extensions/${encodeURIComponent(e)}/storage`));if(!t.ok)throw Error(`Failed to list storage keys: ${t.status}`);return(await t.json()).keys??[]})}function R(e){return e.active||e.activationEligible===!0}function z(e){let t=e.ui?.contributions;return t?Array.isArray(t.pages)&&t.pages.length>0||Array.isArray(t.settingsPanels)&&t.settingsPanels.length>0||Array.isArray(t.chatWidgets)&&t.chatWidgets.length>0:!1}function B(e){return e.source===`bundled`&&e.hasUi===!0&&z(e)}function V(e){return e.kind===`image-generation`||e.kind===`media-provider`}function H(e){return R(e)?e.hasConfigSchema||V(e)?!0:e.hasUi?z(e):!1:!1}function U(e){return H(e)||B(e)}var W=r(),G=(0,S.createContext)(null);function K({children:e}){let t=(0,S.useRef)(null);if(!t.current){let e=new I;L(e),t.current=e}let n=t.current,{data:r,isLoading:i,mutate:c}=_(o(e=>!!e.conversationId)?`gateway-extensions-list`:null,()=>s(a(`/api/extensions`)),{revalidateOnFocus:!1}),l=r?.extensions??[],u=b(e=>e.resolved);(0,S.useEffect)(()=>{let e=()=>{c()};return window.addEventListener(`config-reload`,e),window.addEventListener(`registry-updated`,e),()=>{window.removeEventListener(`config-reload`,e),window.removeEventListener(`registry-updated`,e)}},[c]);let d=(0,S.useCallback)(e=>{let t=e.detail;t?.conversationId&&n.forwardAgentStreamEvent(t.conversationId,t.event??t)},[n]),f=(0,S.useRef)(d);f.current=d,(0,S.useEffect)(()=>{let e=e=>{f.current(e)};return window.addEventListener(w,e),()=>{window.removeEventListener(w,e)}},[]),(0,S.useEffect)(()=>{let e=P(u);n.broadcastEvent(`theme.changed`,e)},[u,n]);let p=(0,S.useRef)(n);p.current=n,(0,S.useEffect)(()=>()=>{p.current.dispose(),t.current=null},[]);let m=(0,S.useMemo)(()=>({router:n,extensions:l,loading:i}),[n,l,i]);return(0,W.jsx)(G.Provider,{value:m,children:e})}function q(){let e=(0,S.useContext)(G);if(!e)throw Error(`useExtensionRouter must be used within ExtensionProvider`);return e.router}function J(){let e=(0,S.useContext)(G);if(!e)throw Error(`useExtensions must be used within ExtensionProvider`);return e.extensions}function Y(){let e=(0,C.c)(2),t=J(),n;return e[0]===t?n=e[1]:(n=t.filter(H),e[0]=t,e[1]=n),n}function X(){let e=(0,S.useContext)(G);if(!e)throw Error(`useExtensionsLoading must be used within ExtensionProvider`);return e.loading}export{Y as a,P as c,A as d,X as i,M as l,q as n,V as o,J as r,U as s,K as t,w as u};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{a as i,i as a,l as o,o as s}from"./locale-store-DGtk-KSF.js";import{i as c,m as l,n as u,p as d,u as f}from"./schemas-CCWMleym.js";import{d as p,i as m,t as h}from"./session-manager-CZyY5Y87.js";import{t as g}from"./capabilities-CrAs-oqU.js";import{i as _}from"./vendor-swr-CdRzEUwF.js";import{a as v}from"./gateway-realtime-Bg4Mf7HA.js";import{t as y}from"./activity-store-t5c6XavH.js";import{i as b}from"./theme-store-D58tk8pq.js";var x=d({id:u([`xopc.notes.get`,`xopc.notes.list`,`xopc.tasks.get`,`xopc.tasks.list`,`xopc.notes.create`,`xopc.notes.update`,`xopc.notes.append`]),majorVersion:f().int().positive(),descriptorDigest:l().regex(/^[a-f0-9]{64}$/)});c(x).max(7).refine(e=>new Set(e.map(e=>e.id)).size===e.length,`Duplicate capability binding`);var S=e(t(),1),C=n(),w=`agent-stream-event`;function T(e){return e===`off`||e===`on`||e===`stream`}function E(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=typeof t.conversationId==`string`?t.conversationId.trim():``,r=typeof t.runId==`string`?t.runId.trim():``;return n&&r?{conversationId:n,runId:r}:null}function D(e,t,n){return t&&typeof t==`object`&&!Array.isArray(t)?{...t,seq:n}:{type:e,seq:n,payload:t}}async function O(e){try{let t=await i(a(`/api/sessions/${encodeURIComponent(e)}/agent-config`));if(!t.ok)return`on`;let n=await t.json(),r=n.payload?.activityDetail?.effective;if(T(r))return r;let o=n.payload?.activityDetail?.default;return T(o)?o:`on`}catch{return`on`}}function k(e){window.dispatchEvent(new CustomEvent(w,{detail:e}))}function A(e={}){let t=e.subscribe??v,n=e.loadActivityDetailLevel??O,r=e.dispatch??k,i=new Map,a=!1,o=e=>{let o=E(e.detail);if(!o||i.has(o.runId))return;let s=`on`,c=!1,l,u=!1,d=!1,f=()=>{},p=()=>{u||(u=!0,f(),i.get(o.runId)===p&&i.delete(o.runId))},m=e=>{a||u||r({conversationId:o.conversationId,event:e,activityDetailLevel:s})};n(o.conversationId).then(e=>{s=e,c=!0,e===`stream`&&l&&!d&&m(l),l=void 0}),f=t(`run:${o.runId}`,{onEvent:e=>{if(u||d)return;let t=D(e.event,e.data,e.seq);e.event===`thinking_delta`&&!c?l=t:m(t),e.event===`run_end`&&(d=!0,l=void 0,queueMicrotask(p))},onGap:e=>{e.recoverable||p()}},0),i.set(o.runId,p)},s=e=>{let t=E(e.detail);t&&i.get(t.runId)?.()};return window.addEventListener(`run-started`,o),window.addEventListener(`run-completed`,s),window.addEventListener(`agent-run-ended`,s),()=>{a=!0,window.removeEventListener(`run-started`,o),window.removeEventListener(`run-completed`,s),window.removeEventListener(`agent-run-ended`,s);for(let e of[...i.values()])e()}}var j=function(e){return e[e.PermissionDenied=4001]=`PermissionDenied`,e[e.InvalidRequest=4002]=`InvalidRequest`,e[e.MethodNotFound=4003]=`MethodNotFound`,e[e.InternalError=4004]=`InternalError`,e[e.Timeout=4005]=`Timeout`,e[e.ExtensionNotFound=4006]=`ExtensionNotFound`,e[e.RateLimited=4007]=`RateLimited`,e}({});async function M(e,t,n){let r=new h,i=await r.loadSessionAgentConfig(e);await r.loadSession(e),p(e,i),await new m().send(t,e,n,i.thinkingLevel)}var N=[`--color-surface-base`,`--color-surface-panel`,`--color-surface-hover`,`--color-fg`,`--color-fg-muted`,`--color-fg-subtle`,`--color-accent`,`--color-accent-hover`,`--color-accent-soft`,`--color-edge`,`--color-edge-subtle`,`--color-danger`,`--color-success`,`--color-warning`,`--radius-sm`,`--radius-lg`,`--radius-xl`];function P(e){let t=getComputedStyle(document.documentElement),n={};for(let e of N){let r=t.getPropertyValue(e).trim();r&&(n[e]=r)}return{mode:e,tokens:n,fontFamily:t.getPropertyValue(`font-family`).trim(),fontFamilyMono:t.getPropertyValue(`--font-mono`).trim()}}var F={"agent.sendMessage":`agent.send`,"session.list":`session.read`,"session.navigate":`session.read`,"config.get":`config.read`,"config.set":`config.write`,"storage.get":`storage`,"storage.set":`storage`,"storage.remove":`storage`,"storage.keys":`storage`,"ui.notification":`notification`,"theme.get":`theme`},I=class{iframes=new Map;byContentWindow=new WeakMap;handlers=new Map;extensionPermissions=new Map;releaseBindings=new Map;eventSubscribers=new Map;agentStreamSubscriptions=new Map;boundListener=e=>{this.onWindowMessage(e)};constructor(){window.addEventListener(`message`,this.boundListener)}dispose(){window.removeEventListener(`message`,this.boundListener),this.iframes.clear(),this.handlers.clear(),this.extensionPermissions.clear(),this.releaseBindings.clear(),this.eventSubscribers.clear(),this.agentStreamSubscriptions.clear()}registerIframe(e,t,n,r){let i=this.iframes.get(e);if(i&&i!==t&&i.contentWindow&&this.byContentWindow.delete(i.contentWindow),this.iframes.set(e,t),this.extensionPermissions.set(e,new Set(n)),this.releaseBindings.delete(e),r){let t=o.getState();this.releaseBindings.set(e,{digest:r,baseUrl:t.baseUrl,namespace:t.conversationId})}this.rememberIframeWindow(e,t)}unregisterIframe(e){let t=this.iframes.get(e);this.sendEvent(e,`panel.dispose`),t?.contentWindow&&this.byContentWindow.delete(t.contentWindow),this.iframes.delete(e),this.extensionPermissions.delete(e),this.releaseBindings.delete(e),this.agentStreamSubscriptions.delete(e)}rememberIframeWindow(e,t){let n=t.contentWindow;n&&this.byContentWindow.set(n,{extensionId:e,iframe:t})}subscribeAgentStream(e,t){let n=this.agentStreamSubscriptions.get(e);n||(n=new Set,this.agentStreamSubscriptions.set(e,n)),n.add(t)}unsubscribeAgentStream(e,t){this.agentStreamSubscriptions.get(e)?.delete(t)}forwardAgentStreamEvent(e,t){for(let[n,r]of this.agentStreamSubscriptions)r.has(e)&&this.sendEvent(n,`agent.stream.${e}`,t)}broadcastExtensionEvent(e,t,n){let r=t.startsWith(`ext.`)?t:`ext.${t}`;for(let[t]of this.iframes)t!==e&&this.sendEvent(t,r,n)}handleExtensionEvent(e,t,n){if(t.startsWith(`ext.`)){let r=t.slice(4);this.broadcastExtensionEvent(e,r,n);return}if(t===`agent.subscribe`||t===`agent.unsubscribe`){if(!(this.extensionPermissions.get(e)??new Set).has(`agent.subscribe`))return;let{conversationId:r}=n??{};if(typeof r!=`string`||!r.trim())return;let i=r.trim();t===`agent.subscribe`?this.subscribeAgentStream(e,i):this.unsubscribeAgentStream(e,i)}}registerMethod(e,t){this.handlers.set(e,t)}getReleaseDigest(e){let t=this.releaseBindings.get(e),n=o.getState();if(!t||t.baseUrl!==n.baseUrl||t.namespace!==n.conversationId)throw Error(`Extension release authorization is unavailable`);return t.digest}subscribeExtensionEvents(e,t){let n=this.eventSubscribers.get(e);return n||(n=new Set,this.eventSubscribers.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&this.eventSubscribers.delete(e)}}sendInit(e,t,n){let r=this.iframes.get(e);if(!r?.contentWindow)return;this.rememberIframeWindow(e,r);let i=[...this.extensionPermissions.get(e)??[]];r.contentWindow.postMessage({source:`xopc-host`,type:`init`,extensionId:e,permissions:i,theme:t,locale:n},`*`)}sendEvent(e,t,n){let r=this.iframes.get(e);r?.contentWindow&&r.contentWindow.postMessage({source:`xopc-host`,type:`event`,event:t,data:n},`*`)}broadcastEvent(e,t){for(let[,n]of this.iframes)n.contentWindow?.postMessage({source:`xopc-host`,type:`event`,event:e,data:t},`*`)}postResponse(e,t,n,r,i){let a=e.contentWindow,o={source:`xopc-host`,type:`response`,requestId:n,result:r,error:i};!a||a!==t?.source||a.postMessage(o,`*`)}async onWindowMessage(e){let t=e.data;if(!t||t.source!==`xopc-extension`||!e.source)return;let n=this.byContentWindow.get(e.source);if(!n)return;let{iframe:r,extensionId:i}=n;if(this.iframes.get(i)!==r||r.contentWindow!==e.source)return;if(t.type===`event`){this.handleExtensionEvent(i,t.event,t.data);let e=this.eventSubscribers.get(i);if(e){let n={event:t.event,data:t.data};for(let t of e)try{t(n)}catch{}}return}if(t.type!==`request`)return;let{requestId:a,method:s,params:c}=t;if(typeof a!=`string`||a.length>200||typeof s!=`string`||s.length>200)return;let l=this.handlers.get(s);if(!l){this.postResponse(r,e,a,void 0,{code:j.MethodNotFound,message:`Unknown method: ${s}`});return}let u=c&&typeof c==`object`&&`id`in c?c.id:void 0,d=s===`capability.describe`||s===`capability.call`?`capability:${typeof u==`string`?u:``}`:F[s],f=this.extensionPermissions.get(i)??new Set;if(d&&!f.has(d)){this.postResponse(r,e,a,void 0,{code:j.PermissionDenied,message:`Missing permission: ${d}`});return}let p=o.getState(),m=()=>this.iframes.get(i)===r&&r.contentWindow===e.source&&this.extensionPermissions.get(i)===f&&o.getState().baseUrl===p.baseUrl&&o.getState().conversationId===p.conversationId;try{let t=await l(i,c);if(!m())return;this.postResponse(r,e,a,t)}catch(t){if(!m())return;let n=t instanceof Error?t.message:String(t);this.postResponse(r,e,a,void 0,{code:j.InternalError,message:n})}}};function L(e){let t=d({id:x.shape.id}),n=t.extend({call:g});e.registerMethod(`capability.describe`,async(n,r)=>{let{id:i}=t.parse(r),o=e.getReleaseDigest(n),c=(await s(a(`/api/local-app-capabilities/${encodeURIComponent(n)}?manifestDigest=${encodeURIComponent(o)}`))).capabilities.find(e=>e.id===i);if(!c)throw Error(`Capability is unavailable for this release`);return c}),e.registerMethod(`capability.call`,async(t,r)=>{let{id:i,call:o}=n.parse(r),c=e.getReleaseDigest(t);return s(a(`/api/local-app-capabilities/${encodeURIComponent(t)}/${encodeURIComponent(i)}/invocations`),{method:`POST`,body:JSON.stringify({manifestDigest:c,call:o})})}),e.registerMethod(`theme.get`,async()=>P(b.getState().resolved)),e.registerMethod(`ui.navigate`,async(e,t)=>{let n=t&&typeof t==`object`&&t&&`path`in t?String(t.path??``):``;if(n){let e=n.startsWith(`/`)?n:`/${n}`;window.location.hash=`#${e}`}}),e.registerMethod(`ui.notification`,async(e,t)=>{if(!t||typeof t!=`object`)return;let n=t,r=typeof n.title==`string`?n.title.trim():``;r&&y({tone:n.type===`success`||n.type===`warning`||n.type===`error`||n.type===`info`?n.type:`info`,title:r,message:typeof n.message==`string`?n.message:void 0,source:e,dedupeKey:`extension:${e}:${r}`})}),e.registerMethod(`session.navigate`,async(e,t)=>{let n=t&&typeof t==`object`&&t&&`conversationId`in t?String(t.conversationId??``):``;n&&window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:n},bubbles:!0}))}),e.registerMethod(`session.list`,async()=>{let e=await i(a(`/api/sessions`));if(!e.ok)throw Error(`Failed to list sessions: ${e.status}`);return((await e.json()).items??[]).map(e=>({conversationId:e.key,title:e.name,lastMessageAt:e.updatedAt??e.lastAccessedAt,messageCount:e.messageCount}))}),e.registerMethod(`agent.sendMessage`,async(e,t)=>{let{message:n,conversationId:r,newSession:i}=t,a=r?.trim()||``;return(i||!a)&&(a=(await new h().createSession()).key),await M(a,n),{conversationId:a}}),e.registerMethod(`config.get`,async e=>{let t=await i(a(`/api/extensions/${encodeURIComponent(e)}/config`));if(!t.ok)throw Error(`Failed to get config: ${t.status}`);return t.json()}),e.registerMethod(`config.set`,async(e,t)=>{let n=t&&typeof t==`object`&&t&&!Array.isArray(t)?t:{},r=await i(a(`/api/extensions/${encodeURIComponent(e)}/config`),{method:`PATCH`,body:JSON.stringify(n)});if(!r.ok)throw Error(`Failed to set config: ${r.status}`)}),e.registerMethod(`storage.get`,async(e,t)=>{let n=t&&typeof t==`object`&&t&&`key`in t?String(t.key??``):``,r=await i(a(`/api/extensions/${encodeURIComponent(e)}/storage/${encodeURIComponent(n)}`));if(r.status!==404){if(!r.ok)throw Error(`Failed to get storage key: ${r.status}`);return(await r.json()).value}}),e.registerMethod(`storage.set`,async(e,t)=>{let n=t,r=n&&typeof n.key==`string`?n.key:``,o=await i(a(`/api/extensions/${encodeURIComponent(e)}/storage/${encodeURIComponent(r)}`),{method:`PUT`,body:JSON.stringify({value:n?.value})});if(!o.ok)throw Error(`Failed to set storage key: ${o.status}`)}),e.registerMethod(`storage.remove`,async(e,t)=>{let n=t&&typeof t==`object`&&t&&`key`in t?String(t.key??``):``,r=await i(a(`/api/extensions/${encodeURIComponent(e)}/storage/${encodeURIComponent(n)}`),{method:`DELETE`});if(r.status!==404&&!r.ok)throw Error(`Failed to remove storage key: ${r.status}`)}),e.registerMethod(`storage.keys`,async e=>{let t=await i(a(`/api/extensions/${encodeURIComponent(e)}/storage`));if(!t.ok)throw Error(`Failed to list storage keys: ${t.status}`);return(await t.json()).keys??[]})}function R(e){return e.active||e.activationEligible===!0}function z(e){let t=e.ui?.contributions;return t?Array.isArray(t.pages)&&t.pages.length>0||Array.isArray(t.settingsPanels)&&t.settingsPanels.length>0||Array.isArray(t.chatWidgets)&&t.chatWidgets.length>0:!1}function B(e){return e.source===`bundled`&&e.hasUi===!0&&z(e)}function V(e){return e.kind===`image-generation`||e.kind===`media-provider`}function H(e){return R(e)?e.hasConfigSchema||V(e)?!0:e.hasUi?z(e):!1:!1}function U(e){return H(e)||B(e)}var W=r(),G=(0,S.createContext)(null);function K({children:e}){let t=(0,S.useRef)(null);if(!t.current){let e=new I;L(e),t.current=e}let n=t.current,{data:r,isLoading:i,mutate:c}=_(o(e=>!!e.conversationId)?`gateway-extensions-list`:null,()=>s(a(`/api/extensions`)),{revalidateOnFocus:!1}),l=r?.extensions??[],u=b(e=>e.resolved);(0,S.useEffect)(()=>{let e=()=>{c()};return window.addEventListener(`config-reload`,e),window.addEventListener(`registry-updated`,e),()=>{window.removeEventListener(`config-reload`,e),window.removeEventListener(`registry-updated`,e)}},[c]);let d=(0,S.useCallback)(e=>{let t=e.detail;t?.conversationId&&n.forwardAgentStreamEvent(t.conversationId,t.event??t)},[n]),f=(0,S.useRef)(d);f.current=d,(0,S.useEffect)(()=>{let e=e=>{f.current(e)};return window.addEventListener(w,e),()=>{window.removeEventListener(w,e)}},[]),(0,S.useEffect)(()=>{let e=P(u);n.broadcastEvent(`theme.changed`,e)},[u,n]);let p=(0,S.useRef)(n);p.current=n,(0,S.useEffect)(()=>()=>{p.current.dispose(),t.current=null},[]);let m=(0,S.useMemo)(()=>({router:n,extensions:l,loading:i}),[n,l,i]);return(0,W.jsx)(G.Provider,{value:m,children:e})}function q(){let e=(0,S.useContext)(G);if(!e)throw Error(`useExtensionRouter must be used within ExtensionProvider`);return e.router}function J(){let e=(0,S.useContext)(G);if(!e)throw Error(`useExtensions must be used within ExtensionProvider`);return e.extensions}function Y(){let e=(0,C.c)(2),t=J(),n;return e[0]===t?n=e[1]:(n=t.filter(H),e[0]=t,e[1]=n),n}function X(){let e=(0,S.useContext)(G);if(!e)throw Error(`useExtensionsLoading must be used within ExtensionProvider`);return e.loading}export{Y as a,P as c,A as d,X as i,M as l,q as n,V as o,J as r,U as s,K as t,w as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,t as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{a as o,i as s,l as c,n as l,o as u}from"./locale-store-DGtk-KSF.js";import{t as d}from"./messages-DYDySzn1.js";import{t as f}from"./resource-unavailable-BaczkGfK.js";import{n as p,r as m}from"./popover-select-CEMWIrtY.js";import{t as h}from"./cn-0WouolD0.js";import{r as g}from"./extension-provider-CJQkyfle.js";import{i as _}from"./vendor-swr-CdRzEUwF.js";import{t as v}from"./button-Cc4hUNTt.js";import{a as y,o as b,s as x}from"./form-field-width-DJw_jULe.js";import{n as S}from"./model-sort-_Tz8s_4N.js";import{t as C}from"./extension-iframe-host-DHeeJG5w.js";import{t as w}from"./settings-loading-skeleton-BTqvr_Fw.js";import{n as T,t as E}from"./settings-page-header-4d1u-o-F.js";import"./settings-page-layout-Cy9_VBag.js";import{n as D,t as O}from"./use-autosave-xytwr7Lc.js";import{a as k,c as A,o as j}from"./voice-config-api-fqUzP-ZY.js";import{t as M}from"./voice-api-key-field-Dn092u0X.js";import{t as N}from"./schema-form-C-jw6Hid.js";var P=e(t(),1),F=n(),I=r();function L(e){let t=(0,F.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,I.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=r),r}function R(e){let t=e?.manifest?.mediaUnderstandingProviders?.[0];if(typeof t==`string`&&t.trim())return t.trim();let n=e?.manifest?.contracts?.mediaUnderstandingProviders?.[0];if(typeof n==`string`&&n.trim())return n.trim()}function z(){return h(b,y)}function B(){return h(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,x,`dark:border-edge`)}function V(e,t,n){if(!e||!t)return{apiKey:``,model:n};let r=e.stt.providers?.[t];return{apiKey:typeof r?.apiKey==`string`?r.apiKey:``,model:typeof r?.model==`string`?r.model:n}}function H({providerId:e,voiceSettings:t,mutateVoice:n}){let r=d(l(e=>e.language)),i=r.voiceSettings,a=r.extensionSttMedia,o={maskedHelp:i.apiKeyMaskedHelp,copy:i.apiKeyCopy,copied:i.apiKeyCopied,show:i.apiKeyShow,hide:i.apiKeyHide,notInConfigFile:i.apiKeyNotInConfigFile,loadFailed:i.apiKeyRevealFailed},{data:c}=_(s(`/api/voice/stt-providers`),j,{revalidateOnFocus:!1}),u=(0,P.useMemo)(()=>c?.providers.find(t=>t.id===e),[e,c]),f=u?.configured??!1,g=u?.models??[],v=g[0]?.id??u?.fields.find(e=>e.key===`model`)?.defaultValue??``,b=(0,P.useMemo)(()=>V(t,e,v),[v,e,t]),x=(0,P.useRef)(!1),[C,w]=(0,P.useState)(null),T=C??b,E=(0,P.useRef)(T);E.current=T;let k=b,N=O({value:T,dirty:T.apiKey!==k.apiKey||T.model!==k.model,onSave:(0,P.useCallback)(async r=>{let i=structuredClone(t);i.stt.enabled=!0,i.stt.provider=e,i.stt.providers={...i.stt.providers??{},[e]:{...i.stt.providers?.[e]??{},apiKey:r.apiKey,model:r.model}},await A(i,`transcription`),await n(i,!1),x.current=JSON.stringify(E.current)!==JSON.stringify(r),w(e=>e&&JSON.stringify(e)===JSON.stringify(r)?null:e)},[n,e,t])}),F=g.length>0?[...g].sort(S):T.model?[{id:T.model,name:T.model}]:[];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-xl bg-surface-base p-4`,onBlurCapture:N.onBlurCapture,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:a.credentialsTitle}),(0,I.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.credentialsHint.replace(`{providerId}`,e)})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(D,{status:N.status,error:N.error}),(0,I.jsx)(`span`,{className:h(`rounded-full px-2 py-0.5 text-xs font-medium`,f?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:f?a.configured:a.notConfigured})]})]}),(0,I.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,I.jsxs)(`div`,{className:h(`flex flex-col gap-1.5`,y),children:[(0,I.jsx)(L,{children:i.stt.apiKey}),(0,I.jsx)(M,{kind:`stt`,providerId:e,fieldId:`ext-stt-${e}-api-key`,value:T.apiKey,onChange:e=>{x.current=!0,w(t=>({...t??b,apiKey:e}))},labels:o,placeholder:e===`groq`?`gsk_...`:`sk-...`}),(0,I.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[i.stt.apiKeyDesc,e===`groq`?` (GROQ_API_KEY)`:``]})]}),(0,I.jsxs)(`div`,{className:h(`flex flex-col gap-1.5`,y),children:[(0,I.jsx)(L,{children:i.stt.model}),F.length>0?(0,I.jsx)(p,{className:z(),value:T.model,onChange:e=>{x.current=!0,w(t=>({...t??b,model:e.target.value})),N.saveNow({...T,model:e.target.value})},children:F.map(e=>(0,I.jsx)(m,{value:e.id,children:e.name},e.id))}):(0,I.jsx)(`input`,{className:B(),value:T.model,onChange:e=>{x.current=!0,w(t=>({...t??b,model:e.target.value}))}})]})]})]})}function U(e){let t=(0,F.c)(13),{extensionId:n}=e,r=l(G),i=c(W),a;t[0]===n?a=t[1]:(a=()=>u(s(`/api/extensions/${encodeURIComponent(n)}`)),t[0]=n,t[1]=a);let{data:o,isLoading:d}=_(i&&n?`ext-stt-detail-${n}`:null,a),f;t[2]===o?f=t[3]:(f=R(o),t[2]=o,t[3]=f);let p=f,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},t[4]=m):m=t[4];let{data:h,mutate:g,isLoading:v}=_(i?`voice-settings-ext-stt`:null,k,m);if(!i)return null;if(d||v){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,I.jsx)(w,{rows:2}),t[5]=e):e=t[5],e}if(!p){let e=r===`zh`?`该插件未声明 mediaUnderstandingProviders。`:`This plugin does not declare mediaUnderstandingProviders.`,n;return t[6]===e?n=t[7]:(n=(0,I.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[6]=e,t[7]=n),n}if(!h)return null;let y=`${n}:${p}`,b;return t[8]!==g||t[9]!==p||t[10]!==y||t[11]!==h?(b=(0,I.jsx)(H,{providerId:p,voiceSettings:h,mutateVoice:g},y),t[8]=g,t[9]=p,t[10]=y,t[11]=h,t[12]=b):b=t[12],b}function W(e){return!!e.conversationId}function G(e){return e.language}function K(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q(e){let t={};if(e.type!==`object`||!K(e.properties))return t;for(let[n,r]of Object.entries(e.properties))K(r)&&Object.prototype.hasOwnProperty.call(r,`default`)&&(t[n]=r.default);return t}function J(e,t){switch(t.type){case`sync`:return{localValues:t.value,isDirty:!1};case`change`:return{localValues:t.value,isDirty:!0};case`reset-defaults`:return{localValues:t.value,isDirty:!0};case`saved`:return JSON.stringify(e.localValues)===JSON.stringify(t.value)?{localValues:e.localValues,isDirty:!1}:e}}function Y({extensionId:e}){let t=c(e=>!!e.conversationId),{data:n,error:r}=_(t&&e?`ext-detail-${e}`:null,()=>u(s(`/api/extensions/${encodeURIComponent(e)}`))),{data:i,mutate:a,error:l}=_(t&&e?`ext-cfg-${e}`:null,()=>u(s(`/api/extensions/${encodeURIComponent(e)}/config`))),d=n?.manifest?.configSchema,f=(0,P.useMemo)(()=>d&&d.type===`object`?q(d):{},[d]),p=(0,P.useMemo)(()=>({...f,...i??{}}),[f,i]),[m,h]=(0,P.useReducer)(J,{localValues:{},isDirty:!1}),g=(0,P.useRef)(!1),y=(0,P.useRef)(m.localValues);y.current=m.localValues;let b=(0,P.useRef)(p);!g.current&&b.current!==p&&(b.current=p,h({type:`sync`,value:p}));let x=(0,P.useCallback)(e=>{g.current=!0,h({type:`change`,value:e})},[]),S=(0,P.useCallback)(()=>{!d||d.type!==`object`||(g.current=!0,h({type:`reset-defaults`,value:{...q(d)}}))},[d]),C=(0,P.useCallback)(async t=>{if(!e)return;let n=await o(s(`/api/extensions/${encodeURIComponent(e)}/config`),{method:`PATCH`,body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error?.message??n.statusText)}await a(t,!1),h({type:`saved`,value:t}),g.current=JSON.stringify(y.current)!==JSON.stringify(t)},[e,a]),w=O({value:m.localValues,dirty:m.isDirty,onSave:C});if(!t)return null;if(r||l){let e=r??l;return(0,I.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`Could not load extension settings: `,e instanceof Error?e.message:String(e)]})}return!d||d.type!==`object`?null:(0,I.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl bg-surface-hover/20 p-4`,onBlurCapture:w.onBlurCapture,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Configuration`}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(D,{status:w.status,error:w.error}),(0,I.jsx)(v,{type:`button`,variant:`ghost`,className:`h-8 text-xs`,onClick:S,children:`Reset to defaults`})]})]}),(0,I.jsx)(N,{schema:d,values:m.localValues,onChange:x})]})}function X(){let e=(0,F.c)(36),t=l(Z),n;e[0]===t?n=e[1]:(n=d(t),e[0]=t,e[1]=n);let r=n.extensionSttMedia,{extensionId:o,panelId:s}=i(),c=g();if(!o){let t;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(f,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[2]=t):t=e[2],t}let u,p,m;if(e[3]!==o||e[4]!==c||e[5]!==s){m=Symbol.for(`react.early_return_sentinel`);bb0:{let t;if(e[9]===o?t=e[10]:(t=e=>e.id===o,e[9]=o,e[10]=t),u=c.find(t),!u){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(f,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[11]=t):t=e[11],m=t;break bb0}let n=u.ui?.contributions?.settingsPanels;p=s?n?.find(e=>e.id===s||e.id===`${o}.${s}`):n?.[0]}e[3]=o,e[4]=c,e[5]=s,e[6]=u,e[7]=p,e[8]=m}else u=e[6],p=e[7],m=e[8];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h=p,_=!!(h&&u.ui),v=!!u.hasConfigSchema,y=u.kind===`media-provider`;if(!v&&!_&&!y){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(f,{kind:`plugin-settings`,backTo:`/capabilities/extensions`}),e[12]=t):t=e[12],t}let b=h?.title??(t===`zh`?`${u.name} 设置`:`${u.name} Settings`),x;e[13]===b?x=e[14]:(x=(0,I.jsx)(E,{title:b}),e[13]=b,e[14]=x);let S;e[15]!==y||e[16]!==r?(S=y?(0,I.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-base px-4 py-3 text-sm`,children:[(0,I.jsx)(`p`,{className:`leading-relaxed text-fg-muted`,children:r.banner}),(0,I.jsx)(a,{to:`/settings/capabilities/models?configure=transcription`,className:`w-fit font-medium text-accent hover:underline`,children:r.openVoice})]}):null,e[15]=y,e[16]=r,e[17]=S):S=e[17];let w;e[18]!==o||e[19]!==y?(w=y?(0,I.jsx)(U,{extensionId:o}):null,e[18]=o,e[19]=y,e[20]=w):w=e[20];let D;e[21]!==o||e[22]!==v?(D=v?(0,I.jsx)(Y,{extensionId:o}):null,e[21]=o,e[22]=v,e[23]=D):D=e[23];let O;e[24]!==u.name||e[25]!==u.ui||e[26]!==o||e[27]!==_||e[28]!==h?(O=_&&h&&u.ui?(0,I.jsx)(`div`,{className:`overflow-hidden rounded-xl bg-surface-base shadow-surface`,children:(0,I.jsx)(C,{extensionId:o,extensionName:u.name,entrypoint:h.entrypoint,permissions:u.ui?.permissions,title:h.title,className:`w-full`,minHeight:120,maxHeight:2e3})}):null,e[24]=u.name,e[25]=u.ui,e[26]=o,e[27]=_,e[28]=h,e[29]=O):O=e[29];let k;return e[30]!==x||e[31]!==S||e[32]!==w||e[33]!==D||e[34]!==O?(k=(0,I.jsxs)(T,{gap:`gap-5`,children:[x,S,w,D,O]}),e[30]=x,e[31]=S,e[32]=w,e[33]=D,e[34]=O,e[35]=k):k=e[35],k}function Z(e){return e.language}export{X as ExtensionSettingsPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,t as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{a as o,i as s,l as c,n as l,o as u}from"./locale-store-DGtk-KSF.js";import{t as d}from"./messages-DYDySzn1.js";import{t as f}from"./resource-unavailable-BaczkGfK.js";import{n as p,r as m}from"./popover-select-CEMWIrtY.js";import{t as h}from"./cn-0WouolD0.js";import{r as g}from"./extension-provider-D-Fa5PU-.js";import{i as _}from"./vendor-swr-CdRzEUwF.js";import{t as v}from"./button-Cc4hUNTt.js";import{a as y,o as b,s as x}from"./form-field-width-DJw_jULe.js";import{n as S}from"./model-sort-_Tz8s_4N.js";import{t as C}from"./extension-iframe-host-DTwDBQQ9.js";import{t as w}from"./settings-loading-skeleton-BTqvr_Fw.js";import{n as T,t as E}from"./settings-page-header-4d1u-o-F.js";import"./settings-page-layout-Cy9_VBag.js";import{n as D,t as O}from"./use-autosave-xytwr7Lc.js";import{a as k,c as A,o as j}from"./voice-config-api-fqUzP-ZY.js";import{t as M}from"./voice-api-key-field-Dn092u0X.js";import{t as N}from"./schema-form-C-jw6Hid.js";var P=e(t(),1),F=n(),I=r();function L(e){let t=(0,F.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,I.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=r),r}function R(e){let t=e?.manifest?.mediaUnderstandingProviders?.[0];if(typeof t==`string`&&t.trim())return t.trim();let n=e?.manifest?.contracts?.mediaUnderstandingProviders?.[0];if(typeof n==`string`&&n.trim())return n.trim()}function z(){return h(b,y)}function B(){return h(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,x,`dark:border-edge`)}function V(e,t,n){if(!e||!t)return{apiKey:``,model:n};let r=e.stt.providers?.[t];return{apiKey:typeof r?.apiKey==`string`?r.apiKey:``,model:typeof r?.model==`string`?r.model:n}}function H({providerId:e,voiceSettings:t,mutateVoice:n}){let r=d(l(e=>e.language)),i=r.voiceSettings,a=r.extensionSttMedia,o={maskedHelp:i.apiKeyMaskedHelp,copy:i.apiKeyCopy,copied:i.apiKeyCopied,show:i.apiKeyShow,hide:i.apiKeyHide,notInConfigFile:i.apiKeyNotInConfigFile,loadFailed:i.apiKeyRevealFailed},{data:c}=_(s(`/api/voice/stt-providers`),j,{revalidateOnFocus:!1}),u=(0,P.useMemo)(()=>c?.providers.find(t=>t.id===e),[e,c]),f=u?.configured??!1,g=u?.models??[],v=g[0]?.id??u?.fields.find(e=>e.key===`model`)?.defaultValue??``,b=(0,P.useMemo)(()=>V(t,e,v),[v,e,t]),x=(0,P.useRef)(!1),[C,w]=(0,P.useState)(null),T=C??b,E=(0,P.useRef)(T);E.current=T;let k=b,N=O({value:T,dirty:T.apiKey!==k.apiKey||T.model!==k.model,onSave:(0,P.useCallback)(async r=>{let i=structuredClone(t);i.stt.enabled=!0,i.stt.provider=e,i.stt.providers={...i.stt.providers??{},[e]:{...i.stt.providers?.[e]??{},apiKey:r.apiKey,model:r.model}},await A(i,`transcription`),await n(i,!1),x.current=JSON.stringify(E.current)!==JSON.stringify(r),w(e=>e&&JSON.stringify(e)===JSON.stringify(r)?null:e)},[n,e,t])}),F=g.length>0?[...g].sort(S):T.model?[{id:T.model,name:T.model}]:[];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-xl bg-surface-base p-4`,onBlurCapture:N.onBlurCapture,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:a.credentialsTitle}),(0,I.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.credentialsHint.replace(`{providerId}`,e)})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(D,{status:N.status,error:N.error}),(0,I.jsx)(`span`,{className:h(`rounded-full px-2 py-0.5 text-xs font-medium`,f?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:f?a.configured:a.notConfigured})]})]}),(0,I.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,I.jsxs)(`div`,{className:h(`flex flex-col gap-1.5`,y),children:[(0,I.jsx)(L,{children:i.stt.apiKey}),(0,I.jsx)(M,{kind:`stt`,providerId:e,fieldId:`ext-stt-${e}-api-key`,value:T.apiKey,onChange:e=>{x.current=!0,w(t=>({...t??b,apiKey:e}))},labels:o,placeholder:e===`groq`?`gsk_...`:`sk-...`}),(0,I.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[i.stt.apiKeyDesc,e===`groq`?` (GROQ_API_KEY)`:``]})]}),(0,I.jsxs)(`div`,{className:h(`flex flex-col gap-1.5`,y),children:[(0,I.jsx)(L,{children:i.stt.model}),F.length>0?(0,I.jsx)(p,{className:z(),value:T.model,onChange:e=>{x.current=!0,w(t=>({...t??b,model:e.target.value})),N.saveNow({...T,model:e.target.value})},children:F.map(e=>(0,I.jsx)(m,{value:e.id,children:e.name},e.id))}):(0,I.jsx)(`input`,{className:B(),value:T.model,onChange:e=>{x.current=!0,w(t=>({...t??b,model:e.target.value}))}})]})]})]})}function U(e){let t=(0,F.c)(13),{extensionId:n}=e,r=l(G),i=c(W),a;t[0]===n?a=t[1]:(a=()=>u(s(`/api/extensions/${encodeURIComponent(n)}`)),t[0]=n,t[1]=a);let{data:o,isLoading:d}=_(i&&n?`ext-stt-detail-${n}`:null,a),f;t[2]===o?f=t[3]:(f=R(o),t[2]=o,t[3]=f);let p=f,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},t[4]=m):m=t[4];let{data:h,mutate:g,isLoading:v}=_(i?`voice-settings-ext-stt`:null,k,m);if(!i)return null;if(d||v){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,I.jsx)(w,{rows:2}),t[5]=e):e=t[5],e}if(!p){let e=r===`zh`?`该插件未声明 mediaUnderstandingProviders。`:`This plugin does not declare mediaUnderstandingProviders.`,n;return t[6]===e?n=t[7]:(n=(0,I.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[6]=e,t[7]=n),n}if(!h)return null;let y=`${n}:${p}`,b;return t[8]!==g||t[9]!==p||t[10]!==y||t[11]!==h?(b=(0,I.jsx)(H,{providerId:p,voiceSettings:h,mutateVoice:g},y),t[8]=g,t[9]=p,t[10]=y,t[11]=h,t[12]=b):b=t[12],b}function W(e){return!!e.conversationId}function G(e){return e.language}function K(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q(e){let t={};if(e.type!==`object`||!K(e.properties))return t;for(let[n,r]of Object.entries(e.properties))K(r)&&Object.prototype.hasOwnProperty.call(r,`default`)&&(t[n]=r.default);return t}function J(e,t){switch(t.type){case`sync`:return{localValues:t.value,isDirty:!1};case`change`:return{localValues:t.value,isDirty:!0};case`reset-defaults`:return{localValues:t.value,isDirty:!0};case`saved`:return JSON.stringify(e.localValues)===JSON.stringify(t.value)?{localValues:e.localValues,isDirty:!1}:e}}function Y({extensionId:e}){let t=c(e=>!!e.conversationId),{data:n,error:r}=_(t&&e?`ext-detail-${e}`:null,()=>u(s(`/api/extensions/${encodeURIComponent(e)}`))),{data:i,mutate:a,error:l}=_(t&&e?`ext-cfg-${e}`:null,()=>u(s(`/api/extensions/${encodeURIComponent(e)}/config`))),d=n?.manifest?.configSchema,f=(0,P.useMemo)(()=>d&&d.type===`object`?q(d):{},[d]),p=(0,P.useMemo)(()=>({...f,...i??{}}),[f,i]),[m,h]=(0,P.useReducer)(J,{localValues:{},isDirty:!1}),g=(0,P.useRef)(!1),y=(0,P.useRef)(m.localValues);y.current=m.localValues;let b=(0,P.useRef)(p);!g.current&&b.current!==p&&(b.current=p,h({type:`sync`,value:p}));let x=(0,P.useCallback)(e=>{g.current=!0,h({type:`change`,value:e})},[]),S=(0,P.useCallback)(()=>{!d||d.type!==`object`||(g.current=!0,h({type:`reset-defaults`,value:{...q(d)}}))},[d]),C=(0,P.useCallback)(async t=>{if(!e)return;let n=await o(s(`/api/extensions/${encodeURIComponent(e)}/config`),{method:`PATCH`,body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error?.message??n.statusText)}await a(t,!1),h({type:`saved`,value:t}),g.current=JSON.stringify(y.current)!==JSON.stringify(t)},[e,a]),w=O({value:m.localValues,dirty:m.isDirty,onSave:C});if(!t)return null;if(r||l){let e=r??l;return(0,I.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`Could not load extension settings: `,e instanceof Error?e.message:String(e)]})}return!d||d.type!==`object`?null:(0,I.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl bg-surface-hover/20 p-4`,onBlurCapture:w.onBlurCapture,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Configuration`}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(D,{status:w.status,error:w.error}),(0,I.jsx)(v,{type:`button`,variant:`ghost`,className:`h-8 text-xs`,onClick:S,children:`Reset to defaults`})]})]}),(0,I.jsx)(N,{schema:d,values:m.localValues,onChange:x})]})}function X(){let e=(0,F.c)(36),t=l(Z),n;e[0]===t?n=e[1]:(n=d(t),e[0]=t,e[1]=n);let r=n.extensionSttMedia,{extensionId:o,panelId:s}=i(),c=g();if(!o){let t;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(f,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[2]=t):t=e[2],t}let u,p,m;if(e[3]!==o||e[4]!==c||e[5]!==s){m=Symbol.for(`react.early_return_sentinel`);bb0:{let t;if(e[9]===o?t=e[10]:(t=e=>e.id===o,e[9]=o,e[10]=t),u=c.find(t),!u){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(f,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[11]=t):t=e[11],m=t;break bb0}let n=u.ui?.contributions?.settingsPanels;p=s?n?.find(e=>e.id===s||e.id===`${o}.${s}`):n?.[0]}e[3]=o,e[4]=c,e[5]=s,e[6]=u,e[7]=p,e[8]=m}else u=e[6],p=e[7],m=e[8];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h=p,_=!!(h&&u.ui),v=!!u.hasConfigSchema,y=u.kind===`media-provider`;if(!v&&!_&&!y){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(f,{kind:`plugin-settings`,backTo:`/capabilities/extensions`}),e[12]=t):t=e[12],t}let b=h?.title??(t===`zh`?`${u.name} 设置`:`${u.name} Settings`),x;e[13]===b?x=e[14]:(x=(0,I.jsx)(E,{title:b}),e[13]=b,e[14]=x);let S;e[15]!==y||e[16]!==r?(S=y?(0,I.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-base px-4 py-3 text-sm`,children:[(0,I.jsx)(`p`,{className:`leading-relaxed text-fg-muted`,children:r.banner}),(0,I.jsx)(a,{to:`/settings/capabilities/models?configure=transcription`,className:`w-fit font-medium text-accent hover:underline`,children:r.openVoice})]}):null,e[15]=y,e[16]=r,e[17]=S):S=e[17];let w;e[18]!==o||e[19]!==y?(w=y?(0,I.jsx)(U,{extensionId:o}):null,e[18]=o,e[19]=y,e[20]=w):w=e[20];let D;e[21]!==o||e[22]!==v?(D=v?(0,I.jsx)(Y,{extensionId:o}):null,e[21]=o,e[22]=v,e[23]=D):D=e[23];let O;e[24]!==u.name||e[25]!==u.ui||e[26]!==o||e[27]!==_||e[28]!==h?(O=_&&h&&u.ui?(0,I.jsx)(`div`,{className:`overflow-hidden rounded-xl bg-surface-base shadow-surface`,children:(0,I.jsx)(C,{extensionId:o,extensionName:u.name,entrypoint:h.entrypoint,permissions:u.ui?.permissions,title:h.title,className:`w-full`,minHeight:120,maxHeight:2e3})}):null,e[24]=u.name,e[25]=u.ui,e[26]=o,e[27]=_,e[28]=h,e[29]=O):O=e[29];let k;return e[30]!==x||e[31]!==S||e[32]!==w||e[33]!==D||e[34]!==O?(k=(0,I.jsxs)(T,{gap:`gap-5`,children:[x,S,w,D,O]}),e[30]=x,e[31]=S,e[32]=w,e[33]=D,e[34]=O,e[35]=k):k=e[35],k}function Z(e){return e.language}export{X as ExtensionSettingsPage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/workspace-file-preview-dialog-
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{l as a,m as o,t as s,u as c}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as l}from"./locale-store-DGtk-KSF.js";import{t as u}from"./messages-DYDySzn1.js";import{a as d,i as f,n as p,o as m,r as h,s as g,t as _}from"./dist-BGTk37IG.js";import{t as v}from"./calendar-clock-D-quYVPe.js";import{t as y}from"./chevron-down-ccbiQQz_.js";import{t as b}from"./chevron-right-BweFrslA.js";import{t as x}from"./circle-alert-BEjgurr2.js";import{t as S}from"./circle-check-C23XjkUj.js";import{t as C}from"./clock-3-DnrAnuyZ.js";import{t as w}from"./external-link-DjqjBmc3.js";import{t as T}from"./history-DXH_9jsE.js";import{F as E,M as D}from"./markdown-view-JXJ3e1CB.js";import{t as O}from"./message-circle-Badhj-4D.js";import{t as k}from"./paperclip-f1HujQY1.js";import{t as A}from"./plus-Q2yW6OE7.js";import{t as j}from"./refresh-cw-BRlGaq2w.js";import{t as M}from"./settings-2-D-csvaET.js";import{t as N}from"./sparkles-DHlfQFAF.js";import{t as P}from"./x-B_N4OPjy.js";import{t as F}from"./cn-0WouolD0.js";import{t as I}from"./skeleton-BI5TyibZ.js";import{s as L}from"./tasks-DRmd6sWt.js";import{C as R,E as z,S as B,_ as V,a as H,b as U,f as W,g as G,l as K,n as q,t as J,u as ee,v as te,w as ne,x as re}from"./use-composer-attachments-CgVehTrs.js";import{t as Y}from"./button-Cc4hUNTt.js";import{a as ie,i as ae,o as oe,s as se}from"./dist-GJ8-1PAx.js";import{a as ce,c as le,d as ue,h as de,i as fe,o as pe,r as me,t as he}from"./composer-payload-handoff-Cqi83bL5.js";import{t as ge}from"./page-header-store-f8XcAs9b.js";import{t as _e}from"./sliding-tab-list-DuQyViqe.js";import{n as ve,r as ye}from"./voice-input-shortcut-events-D7QdPeuj.js";import{n as be}from"./date-formatters-DukWSVwc.js";import{n as xe}from"./tab-completion-input-CxtEp0aP.js";import{n as Se,r as X,t as Ce}from"./task-result-evidence-MOHY0Myr.js";var Z=n(),Q=e(t(),1);function we(e,t,n=!1){let[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!0),[s,c]=(0,Q.useState)(null),l=(0,Q.useRef)(0),u=(0,Q.useCallback)(async()=>{let t=++l.current;c(null);try{let r=await(n?G(e,!0):G(e));t===l.current&&i(r)}catch(e){t===l.current&&c(e instanceof Error?e.message:String(e))}finally{t===l.current&&o(!1)}},[e,n]);return(0,Q.useEffect)(()=>(u(),()=>{l.current++}),[u,t]),(0,Q.useEffect)(()=>{let e,t=1/0,n=n=>{let r=Date.now()+n;r>=t||(window.clearTimeout(e),t=r,e=window.setTimeout(()=>{e=void 0,t=1/0,u()},n))},r=()=>n(100),i=()=>n(750),a=()=>{document.visibilityState===`visible`&&r()},o=[`task-changed-v2`,`task-updated`,`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`home-advisor-updated`,`gateway-realtime-connected`,`realtime-gap`,`focus`],s=[`session-updated`,`session-transcript-updated`];return o.forEach(e=>window.addEventListener(e,r)),s.forEach(e=>window.addEventListener(e,i)),document.addEventListener(`visibilitychange`,a),()=>{o.forEach(e=>window.removeEventListener(e,r)),s.forEach(e=>window.removeEventListener(e,i)),document.removeEventListener(`visibilitychange`,a),window.clearTimeout(e)}},[u]),{home:r,loading:a,loadError:s,setLoadError:c,load:u}}var $=r(),Te=12e3;function Ee(e){let t=(0,Z.c)(107),{variant:n,inputId:r,inputRef:i,intent:a,labels:o,attachments:s,isDragging:c,attachmentBusy:l,attachmentsFull:u,voice:d,chat:f,cancelAction:p,onIntentChange:m,onPickFiles:h,onRemoveAttachment:g,onPaste:_,onDragOver:v,onDragLeave:y,onDrop:b,onSubmit:x}=e,S=n===`inline`,C;t[0]!==s||t[1]!==a?(C=!!a.trim()||s.length>0,t[0]=s,t[1]=a,t[2]=C):C=t[2];let w=C,T=d.voiceActive&&d.phase!==`error`,E;t[3]!==x||t[4]!==d.voiceActive?(E=e=>{if(d.voiceActive){e.preventDefault();return}x(e)},t[3]=x,t[4]=d.voiceActive,t[5]=E):E=t[5];let D=S?`mx-auto mt-6 w-full overflow-hidden rounded-xl border border-edge bg-surface-base p-2 text-left shadow-surface transition-colors focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15 sm:mt-8`:`flex min-h-0 flex-1 flex-col`,O;t[6]===D?O=t[7]:(O=F(`relative`,D),t[6]=D,t[7]=O);let A;t[8]!==S||t[9]!==c||t[10]!==o.dropFiles?(A=c?(0,$.jsx)(`div`,{className:F(`pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-accent-soft/90 text-sm font-medium text-accent-fg backdrop-blur-[1px]`,S&&`rounded-2xl`),children:o.dropFiles}):null,t[8]=S,t[9]=c,t[10]=o.dropFiles,t[11]=A):A=t[11];let j=!S&&`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,M;t[12]===j?M=t[13]:(M=F(j),t[12]=j,t[13]=M);let P=S?`sr-only`:`mb-2 shrink-0 text-sm font-medium text-fg`,I;t[14]!==r||t[15]!==o.intentLabel||t[16]!==P?(I=(0,$.jsx)(`label`,{htmlFor:r,className:P,children:o.intentLabel}),t[14]=r,t[15]=o.intentLabel,t[16]=P,t[17]=I):I=t[17];let L;t[18]!==l||t[19]!==f||t[20]!==d.audioLevel||t[21]!==d.cancelVoiceInput||t[22]!==d.confirmVoiceInput||t[23]!==d.elapsedLabel||t[24]!==d.error||t[25]!==d.finalTranscript||t[26]!==d.partialTranscript||t[27]!==d.phase||t[28]!==d.recordedDictation||t[29]!==d.retryVoiceInput||t[30]!==d.settingsRequired||t[31]!==d.voiceActive?(L=d.voiceActive?(0,$.jsx)(me,{phase:d.phase,elapsedLabel:d.elapsedLabel,recordedDictation:d.recordedDictation,audioLevel:d.audioLevel,partialTranscript:d.partialTranscript,finalTranscript:d.finalTranscript,error:d.error,settingsRequired:d.settingsRequired,disabled:l,chat:f,onCancel:d.cancelVoiceInput,onConfirm:d.confirmVoiceInput,onRetry:d.retryVoiceInput}):null,t[18]=l,t[19]=f,t[20]=d.audioLevel,t[21]=d.cancelVoiceInput,t[22]=d.confirmVoiceInput,t[23]=d.elapsedLabel,t[24]=d.error,t[25]=d.finalTranscript,t[26]=d.partialTranscript,t[27]=d.phase,t[28]=d.recordedDictation,t[29]=d.retryVoiceInput,t[30]=d.settingsRequired,t[31]=d.voiceActive,t[32]=L):L=t[32];let R=T&&`hidden`,z=S?`min-h-24 bg-transparent px-3 py-2`:`min-h-32 flex-1 rounded-xl border border-edge bg-surface-base p-3 focus:border-accent focus:ring-2 focus:ring-accent/20`,B;t[33]!==R||t[34]!==z?(B=F(`w-full resize-none text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle`,R,z),t[33]=R,t[34]=z,t[35]=B):B=t[35];let V;t[36]===m?V=t[37]:(V=e=>m(e.target.value),t[36]=m,t[37]=V);let H=!S,U;t[38]!==r||t[39]!==i||t[40]!==a||t[41]!==o.intentPlaceholder||t[42]!==o.intentSuggestion||t[43]!==m||t[44]!==_||t[45]!==B||t[46]!==V||t[47]!==H?(U=(0,$.jsx)(xe,{ref:i,id:r,className:B,value:a,onChange:V,onPaste:_,suggestion:o.intentSuggestion,onAcceptSuggestion:m,onKeyDown:De,placeholder:o.intentPlaceholder,maxLength:Te,autoFocus:H}),t[38]=r,t[39]=i,t[40]=a,t[41]=o.intentPlaceholder,t[42]=o.intentSuggestion,t[43]=m,t[44]=_,t[45]=B,t[46]=V,t[47]=H,t[48]=U):U=t[48];let W=S?`border-b-0 bg-transparent px-3 pb-2 pt-0`:`mt-3 border-b-0 bg-transparent px-0 pb-0`,G;t[49]!==s||t[50]!==g||t[51]!==W?(G=(0,$.jsx)(q,{attachments:s,topPadded:!1,onRemove:g,className:W}),t[49]=s,t[50]=g,t[51]=W,t[52]=G):G=t[52];let K;t[53]!==S||t[54]!==a.length||t[55]!==o.shortcut?(K=S?null:(0,$.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:o.shortcut}),(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[a.length.toLocaleString(),` / `,Te.toLocaleString()]})]}),t[53]=S,t[54]=a.length,t[55]=o.shortcut,t[56]=K):K=t[56];let J;t[57]!==L||t[58]!==U||t[59]!==G||t[60]!==K||t[61]!==M||t[62]!==I?(J=(0,$.jsxs)(`div`,{className:M,children:[I,L,U,G,K]}),t[57]=L,t[58]=U,t[59]=G,t[60]=K,t[61]=M,t[62]=I,t[63]=J):J=t[63];let ee=S?`border-edge-subtle px-1 pt-2`:`border-edge px-5 py-4`,te;t[64]===ee?te=t[65]:(te=F(`flex shrink-0 items-center gap-2 border-t`,ee),t[64]=ee,t[65]=te);let ne=!S&&`mr-auto`,re;t[66]===ne?re=t[67]:(re=F(`flex items-center gap-1`,ne),t[66]=ne,t[67]=re);let ie=l||u,ae;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(k,{className:`size-4`,"aria-hidden":!0}),t[68]=ae):ae=t[68];let oe;t[69]!==o.attachTitle||t[70]!==h||t[71]!==ie?(oe=(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`size-9 rounded-lg p-0`,disabled:ie,title:o.attachTitle,"aria-label":o.attachTitle,onClick:h,children:ae}),t[69]=o.attachTitle,t[70]=h,t[71]=ie,t[72]=oe):oe=t[72];let se;t[73]!==l||t[74]!==f||t[75]!==d.startVoiceInput||t[76]!==d.voiceActive?(se=d.voiceActive?null:(0,$.jsx)(ce,{disabled:l,chat:f,onStart:d.startVoiceInput}),t[73]=l,t[74]=f,t[75]=d.startVoiceInput,t[76]=d.voiceActive,t[77]=se):se=t[77];let le;t[78]!==re||t[79]!==oe||t[80]!==se?(le=(0,$.jsxs)(`div`,{className:re,children:[oe,se]}),t[78]=re,t[79]=oe,t[80]=se,t[81]=le):le=t[81];let ue;t[82]!==p||t[83]!==S||t[84]!==o.shortcut?(ue=S?(0,$.jsx)(`span`,{className:`hidden text-[11px] text-fg-subtle sm:inline`,children:o.shortcut}):p,t[82]=p,t[83]=S,t[84]=o.shortcut,t[85]=ue):ue=t[85];let de=S?`ml-auto h-9 rounded-lg px-3.5 text-xs`:`min-w-32`,fe=!w||l||d.voiceActive,pe=S?`size-3.5`:`size-4`,he;t[86]===pe?he=t[87]:(he=(0,$.jsx)(N,{className:pe,"aria-hidden":!0}),t[86]=pe,t[87]=he);let ge;t[88]!==o.submit||t[89]!==de||t[90]!==fe||t[91]!==he?(ge=(0,$.jsxs)(Y,{type:`submit`,variant:`primary`,className:de,disabled:fe,children:[he,o.submit]}),t[88]=o.submit,t[89]=de,t[90]=fe,t[91]=he,t[92]=ge):ge=t[92];let _e;t[93]!==te||t[94]!==le||t[95]!==ue||t[96]!==ge?(_e=(0,$.jsxs)(`div`,{className:te,children:[le,ue,ge]}),t[93]=te,t[94]=le,t[95]=ue,t[96]=ge,t[97]=_e):_e=t[97];let ve;return t[98]!==y||t[99]!==v||t[100]!==b||t[101]!==E||t[102]!==J||t[103]!==_e||t[104]!==O||t[105]!==A?(ve=(0,$.jsxs)(`form`,{onSubmit:E,onDragOver:v,onDragLeave:y,onDrop:b,className:O,children:[A,J,_e]}),t[98]=y,t[99]=v,t[100]=b,t[101]=E,t[102]=J,t[103]=_e,t[104]=O,t[105]=A,t[106]=ve):ve=t[106],ve}function De(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}function Oe(e){let t=(0,Z.c)(12),{href:n,children:r,onOpen:i}=e,o=a();if(n&&/^https?:\/\//i.test(n)){let e;return t[0]!==r||t[1]!==n?(e=(0,$.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:`rounded-sm text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r}),t[0]=r,t[1]=n,t[2]=e):e=t[2],e}if(n?.startsWith(`/`)&&!n.startsWith(`//`)){let e=`${o.pathname}${o.search}`,a;t[3]!==n||t[4]!==e?(a=D(e,n),t[3]=n,t[4]=e,t[5]=a):a=t[5];let c;return t[6]!==r||t[7]!==i||t[8]!==a?(c=(0,$.jsx)(s,{to:a,className:`rounded-sm text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:i,children:r}),t[6]=r,t[7]=i,t[8]=a,t[9]=c):c=t[9],c}let c;return t[10]===r?c=t[11]:(c=(0,$.jsx)(`span`,{children:r}),t[10]=r,t[11]=c),c}function ke(e){let t=(0,Z.c)(6),{opportunity:n,onOpen:r}=e,i=l(Ae),a,o;if(t[0]!==i||t[1]!==r||t[2]!==n.evidence||t[3]!==n.evidencePresentation){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=u(i).projectsPage.home.advisorEvidenceCopy,t=n.evidencePresentation,s=t?.locale===i?t.groups:void 0,c=new Intl.DateTimeFormat(i===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),l=t=>(0,$.jsx)(`ul`,{className:`mt-2 space-y-3 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:t.map(t=>{let n=!!(t.href&&(/^https?:\/\//i.test(t.href)||t.href.startsWith(`/`)&&!t.href.startsWith(`//`)));return(0,$.jsxs)(`li`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[(0,$.jsxs)(`p`,{className:`text-fg-subtle`,children:[e.sources[t.sourceType],` · `,(0,$.jsx)(`time`,{dateTime:new Date(t.observedAt).toISOString(),children:c.format(t.observedAt)})]}),(0,$.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap`,children:t.observation}),(0,$.jsx)(`p`,{className:`mt-1`,children:n?(0,$.jsx)(Oe,{href:t.href,onOpen:r,children:e.openSource}):e.noSource})]},t.id)})}),d=(t,r)=>(0,$.jsxs)(`li`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[(0,$.jsx)(`p`,{className:`text-fg-muted`,children:t.summary}),(0,$.jsxs)(`details`,{className:`mt-1`,children:[(0,$.jsxs)(`summary`,{className:`min-h-9 cursor-pointer rounded-sm py-2 text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.originals,` · `,e.sourceCount.replace(`{{count}}`,String(t.evidenceIds.length))]}),l(n.evidence.filter(e=>t.evidenceIds.includes(e.id)))]})]},r);if(!s){o=(0,$.jsxs)(`div`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:[(0,$.jsx)(`p`,{children:e.unavailable}),(0,$.jsxs)(`details`,{children:[(0,$.jsx)(`summary`,{className:`min-h-9 cursor-pointer rounded-sm py-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:e.originals}),l(n.evidence)]})]});break bb0}a=(0,$.jsxs)(`div`,{className:`mt-2 text-xs leading-5`,children:[(0,$.jsx)(`p`,{className:`mb-3 text-fg-subtle`,children:e.aiNote}),(0,$.jsx)(`ul`,{className:`space-y-3 border-l border-edge pl-3`,children:s.slice(0,3).map(d)}),s.length>3?(0,$.jsxs)(`details`,{className:`mt-2`,children:[(0,$.jsx)(`summary`,{className:`min-h-9 cursor-pointer rounded-sm py-2 text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:e.more.replace(`{{count}}`,String(s.length-3))}),(0,$.jsx)(`ul`,{className:`space-y-3 border-l border-edge pl-3`,children:s.slice(3).map(d)})]}):null]})}t[0]=i,t[1]=r,t[2]=n.evidence,t[3]=n.evidencePresentation,t[4]=a,t[5]=o}else a=t[4],o=t[5];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function Ae(e){return e.language}function je(e){let t=(0,Z.c)(4),{label:n,onClick:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(T,{className:`size-3.5`,"aria-hidden":!0}),t[0]=i):i=t[0];let a;return t[1]!==n||t[2]!==r?(a=(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-9 items-center gap-1.5 rounded-lg px-2 text-xs font-medium text-fg-muted transition-colors duration-150 hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:r,children:[i,n]}),t[1]=n,t[2]=r,t[3]=a):a=t[3],a}function Me(e){let t=(0,Z.c)(63),{opportunity:n,copy:r,onOpenHistory:i}=e,a,o,s,c,l,u;if(t[0]!==r.aiLabel||t[1]!==r.automationAction||t[2]!==r.automationHint||t[3]!==r.history||t[4]!==r.minutes||t[5]!==r.needsSetup||t[6]!==r.why||t[7]!==i||t[8]!==n.capabilities||t[9]!==n.continuation||t[10]!==n.estimatedMinutes||t[11]!==n.outcome||t[12]!==n.rationale||t[13]!==n.title){let e=n.capabilities.filter(Ne),d;t[20]===r.aiLabel?d=t[21]:(d=(0,$.jsx)(`span`,{children:r.aiLabel}),t[20]=r.aiLabel,t[21]=d);let f;t[22]!==r.minutes||t[23]!==n.estimatedMinutes?(f=n.estimatedMinutes?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),n.estimatedMinutes,` `,r.minutes]}):null,t[22]=r.minutes,t[23]=n.estimatedMinutes,t[24]=f):f=t[24];let p;t[25]!==d||t[26]!==f?(p=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[d,f]}),t[25]=d,t[26]=f,t[27]=p):p=t[27];let m;t[28]!==r.history||t[29]!==i?(m=(0,$.jsx)(je,{label:r.history,onClick:i}),t[28]=r.history,t[29]=i,t[30]=m):m=t[30],t[31]!==m||t[32]!==p?(a=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[p,m]}),t[31]=m,t[32]=p,t[33]=a):a=t[33],t[34]===n.title?o=t[35]:(o=(0,$.jsx)(`h3`,{className:`mt-3 text-xl font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[34]=n.title,t[35]=o),t[36]===n.outcome?s=t[37]:(s=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n.outcome}),t[36]=n.outcome,t[37]=s);let h;t[38]===r.why?h=t[39]:(h=(0,$.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.why,`:`]}),t[38]=r.why,t[39]=h),t[40]!==n.rationale||t[41]!==h?(c=(0,$.jsxs)(`p`,{className:`mt-4 text-sm leading-6 text-fg-muted`,children:[h,n.rationale]}),t[40]=n.rationale,t[41]=h,t[42]=c):c=t[42],t[43]!==r.automationAction||t[44]!==r.automationHint||t[45]!==n.continuation?(l=n.continuation?.kind===`automation`?(0,$.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 rounded-xl border border-edge bg-surface-subtle p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:r.automationHint}),(0,$.jsx)(`a`,{href:`#${n.continuation.href}`,className:`inline-flex min-h-11 shrink-0 items-center rounded-lg px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.automationAction})]}):null,t[43]=r.automationAction,t[44]=r.automationHint,t[45]=n.continuation,t[46]=l):l=t[46],u=e.length>0?(0,$.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,"aria-label":r.needsSetup,children:e.map(e=>(0,$.jsxs)(`a`,{href:`#${e.recoveryPath??`/settings`}`,className:`rounded-full border border-accent/25 bg-accent-soft px-2.5 py-1 text-xs text-accent hover:border-accent/50`,children:[r.needsSetup,` · `,e.capability]},`${e.kind}:${e.capability}`))}):null,t[0]=r.aiLabel,t[1]=r.automationAction,t[2]=r.automationHint,t[3]=r.history,t[4]=r.minutes,t[5]=r.needsSetup,t[6]=r.why,t[7]=i,t[8]=n.capabilities,t[9]=n.continuation,t[10]=n.estimatedMinutes,t[11]=n.outcome,t[12]=n.rationale,t[13]=n.title,t[14]=a,t[15]=o,t[16]=s,t[17]=c,t[18]=l,t[19]=u}else a=t[14],o=t[15],s=t[16],c=t[17],l=t[18],u=t[19];let d;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(y,{className:`size-3.5 transition-transform group-open:rotate-180`,"aria-hidden":!0}),t[47]=d):d=t[47];let f;t[48]===r.evidence?f=t[49]:(f=(0,$.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer list-none items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.evidence,d]}),t[48]=r.evidence,t[49]=f);let p;t[50]===n?p=t[51]:(p=(0,$.jsx)(ke,{opportunity:n}),t[50]=n,t[51]=p);let m;t[52]!==f||t[53]!==p?(m=(0,$.jsxs)(`details`,{open:!0,className:`mt-4 group`,children:[f,p]}),t[52]=f,t[53]=p,t[54]=m):m=t[54];let h;return t[55]!==a||t[56]!==m||t[57]!==o||t[58]!==s||t[59]!==c||t[60]!==l||t[61]!==u?(h=(0,$.jsxs)($.Fragment,{children:[a,o,s,c,l,u,m]}),t[55]=a,t[56]=m,t[57]=o,t[58]=s,t[59]=c,t[60]=l,t[61]=u,t[62]=h):h=t[62],h}function Ne(e){return e.readiness!==`ready`}function Pe(e){let t=(0,Z.c)(134),{advisor:n,copy:r,busy:i,onRefresh:a,onAction:o,onFeedback:s,onClarification:c,onOpenHistory:l,preflight:u,receipt:d}=e,[f,p]=(0,Q.useState)(),m;t[0]!==n.alternatives||t[1]!==n.primary||t[2]!==n.state?(m=n.state===`ready`?[n.primary,...n.alternatives]:[],t[0]=n.alternatives,t[1]=n.primary,t[2]=n.state,t[3]=m):m=t[3];let h=m,g;t[4]!==h||t[5]!==f?(g=h.find(e=>e.id===f)??h[0],t[4]=h,t[5]=f,t[6]=g):g=t[6];let _=g,v;t[7]===h[0]?.id?v=t[8]:(v=()=>p(h[0]?.id),t[7]=h[0]?.id,t[8]=v);let y=h[0]?.id,b;if(t[9]!==n.state||t[10]!==y?(b=[n.state,y],t[9]=n.state,t[10]=y,t[11]=b):b=t[11],(0,Q.useEffect)(v,b),n.state===`disabled`)return null;if(d){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(S,{className:`size-5 shrink-0 text-success`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===d.title?n=t[14]:(n=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:d.title}),t[13]=d.title,t[14]=n);let i;t[15]===d.detail?i=t[16]:(i=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:d.detail}),t[15]=d.detail,t[16]=i);let a;t[17]!==n||t[18]!==i?(a=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[n,i]}),t[17]=n,t[18]=i,t[19]=a):a=t[19];let o;t[20]!==r.history||t[21]!==l?(o=(0,$.jsx)(je,{label:r.history,onClick:l}),t[20]=r.history,t[21]=l,t[22]=o):o=t[22];let s=`#${d.href}`,c;t[23]!==r.viewProgress||t[24]!==s?(c=(0,$.jsx)(Y,{asChild:!0,variant:`secondary`,className:`min-h-10 text-xs`,children:(0,$.jsx)(`a`,{href:s,children:r.viewProgress})}),t[23]=r.viewProgress,t[24]=s,t[25]=c):c=t[25];let u;t[26]!==o||t[27]!==c?(u=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[o,c]}),t[26]=o,t[27]=c,t[28]=u):u=t[28];let f;return t[29]!==u||t[30]!==a?(f=(0,$.jsx)(`section`,{className:`mt-7 rounded-2xl border border-success/25 bg-success-soft px-5 py-4`,role:`status`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[e,a,u]})}),t[29]=u,t[30]=a,t[31]=f):f=t[31],f}if(n.state===`quiet`||n.state===`refreshing`)return null;if(n.state===`clarification`){let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(N,{className:`size-4`,"aria-hidden":!0}),t[32]=e):e=t[32];let a;t[33]===r.aiLabel?a=t[34]:(a=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-accent`,children:[e,r.aiLabel]}),t[33]=r.aiLabel,t[34]=a);let o;t[35]!==r.history||t[36]!==l?(o=(0,$.jsx)(je,{label:r.history,onClick:l}),t[35]=r.history,t[36]=l,t[37]=o):o=t[37];let s;t[38]!==a||t[39]!==o?(s=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[a,o]}),t[38]=a,t[39]=o,t[40]=s):s=t[40];let u;t[41]===n.question.question?u=t[42]:(u=(0,$.jsx)(`h3`,{id:`home-advisor-question`,className:`mt-3 text-lg font-semibold text-fg`,children:n.question.question}),t[41]=n.question.question,t[42]=u);let d;if(t[43]!==n.question.options||t[44]!==n.question.question||t[45]!==i||t[46]!==c){let e;t[48]!==n.question.question||t[49]!==i||t[50]!==c?(e=e=>(0,$.jsx)(Y,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>c(n.question.question,e.label),children:e.label},e.id),t[48]=n.question.question,t[49]=i,t[50]=c,t[51]=e):e=t[51],d=n.question.options.map(e),t[43]=n.question.options,t[44]=n.question.question,t[45]=i,t[46]=c,t[47]=d}else d=t[47];let f;t[52]===d?f=t[53]:(f=(0,$.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:d}),t[52]=d,t[53]=f);let p;return t[54]!==u||t[55]!==f||t[56]!==s?(p=(0,$.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base px-5 py-5`,"aria-labelledby":`home-advisor-question`,children:[s,u,f]}),t[54]=u,t[55]=f,t[56]=s,t[57]=p):p=t[57],p}if(!_)return null;let x=u?.opportunityId===_.id?u.value:void 0,C;t[58]!==n.stale||t[59]!==r.refreshing?(C=n.stale?(0,$.jsxs)(`p`,{className:`mb-3 inline-flex items-center gap-2 text-xs text-accent`,children:[(0,$.jsx)(j,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),r.refreshing]}):null,t[58]=n.stale,t[59]=r.refreshing,t[60]=C):C=t[60];let w;t[61]!==r||t[62]!==l||t[63]!==_?(w=(0,$.jsx)(Me,{opportunity:_,copy:r,onOpenHistory:l}),t[61]=r,t[62]=l,t[63]=_,t[64]=w):w=t[64];let T;t[65]!==i||t[66]!==r.configure||t[67]!==r.degradedStart||t[68]!==r.setupHint||t[69]!==r.setupTitle||t[70]!==o||t[71]!==_||t[72]!==x?(T=x?.state===`needs_setup`?(0,$.jsx)(`div`,{className:`mt-5 rounded-xl border border-accent/25 bg-accent-soft/40 p-4`,role:`alert`,"aria-live":`polite`,children:(0,$.jsxs)(`div`,{className:`flex gap-3`,children:[(0,$.jsx)(M,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:r.setupTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r.setupHint}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:x.blockers.map(Fe)}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[x.recoveryActions.map(e=>(0,$.jsxs)(`a`,{href:`#${e.href}`,className:`inline-flex min-h-11 items-center rounded-lg border border-accent/30 px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.configure,` · `,e.capability]},e.capability)),x.degradedAction?(0,$.jsx)(Y,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(_,`degraded_start`),children:r.degradedStart}):null]})]})]})}):null,t[65]=i,t[66]=r.configure,t[67]=r.degradedStart,t[68]=r.setupHint,t[69]=r.setupTitle,t[70]=o,t[71]=_,t[72]=x,t[73]=T):T=t[73];let E;t[74]!==i||t[75]!==r.start||t[76]!==o||t[77]!==_?(E=_.actions.canStart?(0,$.jsxs)(Y,{type:`button`,variant:`primary`,className:`min-h-11`,disabled:i,onClick:()=>o(_,`start`),children:[(0,$.jsx)(N,{className:`size-4`,"aria-hidden":!0}),r.start]}):null,t[74]=i,t[75]=r.start,t[76]=o,t[77]=_,t[78]=E):E=t[78];let D;t[79]!==i||t[80]!==r.discuss||t[81]!==o||t[82]!==_?(D=_.actions.canDiscuss?(0,$.jsxs)(Y,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(_,`discuss`),children:[(0,$.jsx)(O,{className:`size-4`,"aria-hidden":!0}),r.discuss]}):null,t[79]=i,t[80]=r.discuss,t[81]=o,t[82]=_,t[83]=D):D=t[83];let k;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(j,{className:`size-4`,"aria-hidden":!0}),t[84]=k):k=t[84];let A;t[85]!==i||t[86]!==r.refresh||t[87]!==a?(A=(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`min-h-11`,disabled:i,onClick:a,title:r.refresh,children:[k,r.refresh]}),t[85]=i,t[86]=r.refresh,t[87]=a,t[88]=A):A=t[88];let P;t[89]===r.feedback?P=t[90]:(P=(0,$.jsx)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center rounded-lg px-3 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.feedback}),t[89]=r.feedback,t[90]=P);let F;t[91]===r.alreadyDone?F=t[92]:(F=[`already_done`,r.alreadyDone],t[91]=r.alreadyDone,t[92]=F);let I;t[93]===r.irrelevant?I=t[94]:(I=[`irrelevant`,r.irrelevant],t[93]=r.irrelevant,t[94]=I);let L;t[95]===r.later?L=t[96]:(L=[`too_early`,r.later],t[95]=r.later,t[96]=L);let R;t[97]===r.sourceIncorrect?R=t[98]:(R=[`source_incorrect`,r.sourceIncorrect],t[97]=r.sourceIncorrect,t[98]=R);let z;t[99]===r.lessLikeThis?z=t[100]:(z=[`less_like_this`,r.lessLikeThis],t[99]=r.lessLikeThis,t[100]=z);let B;t[101]!==F||t[102]!==I||t[103]!==L||t[104]!==R||t[105]!==z?(B=[F,I,L,R,z],t[101]=F,t[102]=I,t[103]=L,t[104]=R,t[105]=z,t[106]=B):B=t[106];let V=B,H;t[107]!==i||t[108]!==s||t[109]!==_||t[110]!==V?(H=(0,$.jsx)(`div`,{className:`absolute right-0 z-20 mt-1 w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-float`,children:V.map(e=>{let[t,n]=e;return(0,$.jsx)(`button`,{type:`button`,disabled:i,className:`min-h-10 w-full rounded-lg px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>s(_,t),children:n},t)})}),t[107]=i,t[108]=s,t[109]=_,t[110]=V,t[111]=H):H=t[111];let U;t[112]!==P||t[113]!==H?(U=(0,$.jsxs)(`details`,{className:`relative ml-auto`,children:[P,H]}),t[112]=P,t[113]=H,t[114]=U):U=t[114];let W;t[115]!==D||t[116]!==A||t[117]!==U||t[118]!==E?(W=(0,$.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-2`,children:[E,D,A,U]}),t[115]=D,t[116]=A,t[117]=U,t[118]=E,t[119]=W):W=t[119];let G;t[120]!==W||t[121]!==C||t[122]!==w||t[123]!==T?(G=(0,$.jsxs)(`div`,{className:`px-5 py-5 sm:px-6`,children:[C,w,T,W]}),t[120]=W,t[121]=C,t[122]=w,t[123]=T,t[124]=G):G=t[124];let K;t[125]!==i||t[126]!==r.alternatives||t[127]!==h||t[128]!==_.id?(K=h.length>1?(0,$.jsxs)(`div`,{className:`border-t border-edge-subtle px-5 py-4 sm:px-6`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:r.alternatives}),(0,$.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:h.filter(e=>e.id!==_.id).map(e=>(0,$.jsx)(`button`,{type:`button`,disabled:i,className:`min-h-10 rounded-lg border border-edge px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>p(e.id),children:e.title},e.id))})]}):null,t[125]=i,t[126]=r.alternatives,t[127]=h,t[128]=_.id,t[129]=K):K=t[129];let q;return t[130]!==r.aiLabel||t[131]!==G||t[132]!==K?(q=(0,$.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base`,"aria-label":r.aiLabel,children:[G,K]}),t[130]=r.aiLabel,t[131]=G,t[132]=K,t[133]=q):q=t[133],q}function Fe(e){return(0,$.jsx)(`li`,{children:e.message},`${e.kind}:${e.capability}`)}var Ie=new Set([`started`,`discussing`,`completed`]);function Le(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[0,1,2].map(Re)}),e[0]=t):t=e[0],t}function Re(e){return(0,$.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-edge-subtle p-4`,children:[(0,$.jsx)(I,{className:`h-4 w-24 rounded`}),(0,$.jsx)(I,{className:`h-5 w-4/5 rounded`}),(0,$.jsx)(I,{className:`h-4 w-3/5 rounded`})]},e)}function ze(e){let t=(0,Z.c)(11),{open:n,refreshKey:r,onOpenChange:i,onReevaluate:a}=e,o=l(Be),s=u(o).projectsPage.home,v=c(),[b,x]=(0,Q.useState)(`all`),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[0]=S):S=t[0];let[E,O]=(0,Q.useState)(S),[k,A]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(),F;t[1]===n?F=t[2]:(F=()=>{if(!n)return;let e=!0;return A(!0),N(void 0),V().then(t=>{e&&O(t.items)}).catch(t=>{e&&N(t instanceof Error?t.message:String(t))}).finally(()=>{e&&A(!1)}),()=>{e=!1}},t[1]=n,t[2]=F);let I;t[3]!==n||t[4]!==r?(I=[n,r],t[3]=n,t[4]=r,t[5]=I):I=t[5],(0,Q.useEffect)(F,I);let L=E.filter(e=>b===`all`||(b===`adopted`?Ie.has(e.status):!Ie.has(e.status))),R=new Intl.DateTimeFormat(o===`zh`?`zh-CN`:`en`,{dateStyle:`medium`}),z=new Intl.DateTimeFormat(o===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),B=new Map;for(let e of L){let t=R.format(new Date(e.updatedAt));B.set(t,[...B.get(t)??[],e])}let H=[...B.entries()],U=e=>e.feedbackKind===`already_done`?s.advisorHistoryStatusCompleted:e.feedbackKind===`irrelevant`?s.advisorHistoryStatusIrrelevant:e.feedbackKind===`source_incorrect`?s.advisorHistoryStatusSourceIncorrect:e.feedbackKind===`less_like_this`?s.advisorHistoryStatusLessLikeThis:{available:s.advisorHistoryStatusAvailable,started:s.advisorHistoryStatusStarted,discussing:s.advisorHistoryStatusDiscussing,completed:s.advisorHistoryStatusCompleted,snoozed:s.advisorHistoryStatusSnoozed,dismissed:s.advisorHistoryStatusDismissed,expired:s.advisorHistoryStatusExpired,superseded:s.advisorHistoryStatusSuperseded}[e.status],W=e=>{if(e.href){i(!1),v(D(`/`,e.href));return}e.status===`discussing`&&(i(!1),v(`/chat/new?${new URLSearchParams({draft:e.opportunity.actionPrompt}).toString()}`))},G;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsx)(d,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[6]=G):G=t[6];let K;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(T,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),t[7]=K):K=t[7];let q;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(P,{className:`size-4`,"aria-hidden":!0}),t[8]=q):q=t[8];let J=k?(0,$.jsx)(Le,{}):M?(0,$.jsxs)(`div`,{className:`rounded-xl border border-danger/25 bg-danger-soft p-4 text-sm text-danger`,children:[(0,$.jsx)(`p`,{children:s.advisorHistoryLoadFailed}),(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`mt-2`,onClick:()=>i(!1),children:s.advisorHistoryClose})]}):H.length===0?(0,$.jsxs)(`div`,{className:`py-16 text-center`,children:[(0,$.jsx)(T,{className:`mx-auto size-6 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:s.advisorHistoryEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:s.advisorHistoryEmptyHint})]}):(0,$.jsx)(`div`,{className:`space-y-6`,children:H.map(e=>{let[t,n]=e;return(0,$.jsxs)(`section`,{"aria-label":t,children:[(0,$.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-subtle`,children:t}),(0,$.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>{let t=!!e.href||e.status===`discussing`,n=[`snoozed`,`dismissed`,`expired`,`superseded`].includes(e.status);return(0,$.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-accent`,children:U(e)}),(0,$.jsx)(`h4`,{className:`mt-1.5 text-sm font-semibold leading-5 text-fg`,children:e.opportunity.title}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.opportunity.outcome})]}),(0,$.jsx)(`time`,{className:`shrink-0 text-[11px] text-fg-subtle`,dateTime:new Date(e.updatedAt).toISOString(),children:z.format(new Date(e.updatedAt))})]}),e.snoozedUntil?(0,$.jsxs)(`p`,{className:`mt-2 inline-flex items-center gap-1 text-xs text-fg-muted`,children:[(0,$.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),s.advisorHistoryReturnsAt,` `,z.format(new Date(e.snoozedUntil))]}):null,(0,$.jsxs)(`details`,{className:`group mt-3`,children:[(0,$.jsxs)(`summary`,{className:`flex min-h-8 cursor-pointer list-none items-center gap-1 text-xs font-medium text-fg-muted hover:text-fg`,children:[s.advisorHistoryEvidence,(0,$.jsx)(y,{className:`size-3.5 transition-transform duration-200 group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,$.jsx)(ke,{opportunity:e.opportunity,onOpen:()=>i(!1)})]}),t||n?(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[t?(0,$.jsxs)(Y,{type:`button`,variant:`secondary`,className:`min-h-9 text-xs`,onClick:()=>W(e),children:[(0,$.jsx)(w,{className:`size-3.5`,"aria-hidden":!0}),e.status===`discussing`?s.advisorHistoryContinueDiscussion:s.advisorHistoryViewProgress]}):null,n?(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`min-h-9 text-xs`,onClick:()=>{i(!1),a()},children:[(0,$.jsx)(j,{className:`size-3.5`,"aria-hidden":!0}),s.advisorHistoryReevaluate]}):null]}):null]},e.opportunity.id)})})]},t)})}),ee;return t[9]===J?ee=t[10]:(ee=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:J}),t[9]=J,t[10]=ee),(0,$.jsx)(_,{open:n,onOpenChange:i,children:(0,$.jsxs)(m,{children:[G,(0,$.jsxs)(h,{className:`xopc-drawer-right fixed right-0 top-0 z-[90] flex size-full max-w-lg flex-col overflow-hidden border-l border-edge bg-surface-overlay shadow-popover outline-none`,"aria-describedby":`home-advisor-history-description`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start gap-3 border-b border-edge px-5 py-4`,children:[K,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(g,{className:`text-base font-semibold text-fg`,children:s.advisorHistoryTitle}),(0,$.jsx)(f,{id:`home-advisor-history-description`,className:`mt-1 text-xs leading-5 text-fg-muted`,children:s.advisorHistoryDescription})]}),(0,$.jsx)(p,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`-mr-2 size-9 shrink-0 p-0`,"aria-label":s.advisorHistoryClose,children:q})})]}),(0,$.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-5 py-3`,children:(0,$.jsx)(_e,{className:`inline-flex rounded-lg bg-surface-inset p-1`,role:`group`,"aria-label":s.advisorHistoryFilterLabel,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[[`all`,s.advisorHistoryFilterAll],[`adopted`,s.advisorHistoryFilterAdopted],[`other`,s.advisorHistoryFilterOther]].map(e=>{let[t,n]=e;return(0,$.jsx)(`button`,{type:`button`,className:`min-h-9 rounded-md px-3 text-xs font-medium transition-colors duration-150 ${b===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`}`,"aria-pressed":b===t,onClick:()=>x(t),children:n},t)})})}),ee]})]})})}function Be(e){return e.language}function Ve(e,t){return e.replace(`{{count}}`,String(t))}function He(e,t){if(e.state===`disabled`)return null;if(e.state===`ready`){let n=1+e.alternatives.length;return{label:Ve(t.ready,n),detail:e.primary.title,tone:`accent`,refreshing:!!e.stale}}return e.state===`clarification`?{label:t.clarification,detail:e.question.question,tone:`accent`,refreshing:!1}:e.state===`refreshing`?{label:t.refreshing,detail:e.previous?.title??t.refreshingDetail,tone:`accent`,refreshing:!0}:e.reason===`generation_failed`?{label:t.generationFailed,detail:t.generationFailedDetail,tone:`danger`,refreshing:!1}:e.reason===`budget_exhausted`?{label:t.budgetExhausted,detail:t.budgetExhaustedDetail,tone:`warning`,refreshing:!1}:e.reason===`model_unavailable`?{label:t.modelUnavailable,detail:t.modelUnavailableDetail,tone:`warning`,refreshing:!1}:{label:t.idle,detail:t.idleDetail,tone:`neutral`,refreshing:!1}}var Ue={accent:`bg-accent`,danger:`bg-danger`,neutral:`bg-fg-subtle`,warning:`bg-warning`};function We(e){let t=(0,Z.c)(50),{advisor:n,busy:r,copy:i,onOpenHistory:a,onRefresh:o}=e,[s,c]=(0,Q.useState)(!1),l;t[0]!==n||t[1]!==i?(l=He(n,i),t[0]=n,t[1]=i,t[2]=l):l=t[2];let u=l;if(!u)return null;let d=n.state!==`refreshing`,f=n.state===`ready`?i.findAnother:i.retry,p=`${i.label}:${u.label}`,m;t[3]===u.refreshing?m=t[4]:(m=u.refreshing?(0,$.jsx)(j,{className:`size-3.5 shrink-0 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,$.jsx)(N,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[3]=u.refreshing,t[4]=m);let h=Ue[u.tone],g;t[5]===h?g=t[6]:(g=F(`size-1.5 shrink-0 rounded-full`,h),t[5]=h,t[6]=g);let _;t[7]===g?_=t[8]:(_=(0,$.jsx)(`span`,{className:g,"aria-hidden":!0}),t[7]=g,t[8]=_);let v;t[9]!==i.label||t[10]!==u.label?(v=(0,$.jsxs)(`span`,{className:`truncate`,children:[i.label,` · `,u.label]}),t[9]=i.label,t[10]=u.label,t[11]=v):v=t[11];let y;t[12]!==p||t[13]!==m||t[14]!==_||t[15]!==v?(y=(0,$.jsx)(se,{asChild:!0,children:(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-9 max-w-56 rounded-lg px-2.5`,"aria-label":p,children:[m,_,v]})}),t[12]=p,t[13]=m,t[14]=_,t[15]=v,t[16]=y):y=t[16];let b;t[17]===u.refreshing?b=t[18]:(b=(0,$.jsx)(`span`,{className:`mt-1 flex size-7 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:u.refreshing?(0,$.jsx)(j,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,$.jsx)(N,{className:`size-4`,"aria-hidden":!0})}),t[17]=u.refreshing,t[18]=b);let x;t[19]===u.label?x=t[20]:(x=(0,$.jsx)(`p`,{className:`font-semibold text-fg`,children:u.label}),t[19]=u.label,t[20]=x);let S;t[21]===u.detail?S=t[22]:(S=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:u.detail}),t[21]=u.detail,t[22]=S);let C;t[23]!==x||t[24]!==S?(C=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]}),t[23]=x,t[24]=S,t[25]=C):C=t[25];let w;t[26]!==C||t[27]!==b?(w=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[b,C]}),t[26]=C,t[27]=b,t[28]=w):w=t[28];let E;t[29]===a?E=t[30]:(E=()=>{c(!1),a()},t[29]=a,t[30]=E);let D;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(T,{className:`size-3.5`,"aria-hidden":!0}),t[31]=D):D=t[31];let O;t[32]!==i.history||t[33]!==E?(O=(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:E,children:[D,i.history]}),t[32]=i.history,t[33]=E,t[34]=O):O=t[34];let k;t[35]!==r||t[36]!==d||t[37]!==o||t[38]!==f?(k=d?(0,$.jsxs)(Y,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg text-xs`,disabled:r,onClick:()=>{c(!1),o()},children:[(0,$.jsx)(j,{className:`size-3.5`,"aria-hidden":!0}),f]}):null,t[35]=r,t[36]=d,t[37]=o,t[38]=f,t[39]=k):k=t[39];let A;t[40]!==O||t[41]!==k?(A=(0,$.jsxs)(`div`,{className:`mt-4 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:[O,k]}),t[40]=O,t[41]=k,t[42]=A):A=t[42];let M;t[43]!==w||t[44]!==A?(M=(0,$.jsx)(ie,{children:(0,$.jsxs)(ae,{side:`bottom`,align:`end`,sideOffset:6,className:`z-[70] w-[min(21rem,calc(100vw-1.5rem))] rounded-xl border border-edge bg-surface-overlay p-4 text-sm text-fg shadow-popover outline-none`,onOpenAutoFocus:Ge,children:[w,A]})}),t[43]=w,t[44]=A,t[45]=M):M=t[45];let P;return t[46]!==s||t[47]!==M||t[48]!==y?(P=(0,$.jsxs)(oe,{open:s,onOpenChange:c,children:[y,M]}),t[46]=s,t[47]=M,t[48]=y,t[49]=P):P=t[49],P}function Ge(e){return e.preventDefault()}async function Ke(e,t=`en`){let n=await te(e),r=n.runs.filter(e=>!e.parentRunId).sort((e,t)=>t.queuedAt-e.queuedAt)[0];if(!n.allowedCommands.includes(`start`)||r?.status!==`failed`)throw Error(t===`zh`?`任务状态已变化,暂时无法重试。请刷新并查看当前状态。`:`Task is no longer available for retry. Refresh and review its current state.`);await W(e,{type:`start`,executor:L.parse({...r.executorRef,kind:r.executorKind})},n.task.version)}function qe(e){let t=e.runs.filter(e=>!e.parentRunId).sort((e,t)=>t.queuedAt-e.queuedAt)[0],n=e.conversation?.currentExecutorAgentId??e.task.delegateAgentId,r=n?{kind:`agent`,agentId:n}:t?{...t.executorRef,kind:t.executorKind}:void 0,i=L.safeParse(r);return i.success?i.data:void 0}var Je=(0,Q.lazy)(()=>i(()=>import(`./workspace-file-preview-dialog-BlVJ5Vmn.js`).then(e=>e.n).then(e=>({default:e.WorkspaceFilePreviewPanel})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74])));function Ye({taskId:e,language:t,onComplete:n,onUpdated:r}){let i=t===`zh`,o=a(),c=`${o.pathname}${o.search}`,[l,u]=(0,Q.useState)(),[f,p]=(0,Q.useState)(),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(),[S,C]=(0,Q.useState)(!1),w=(0,Q.useRef)(!1),T=(0,Q.useRef)(0),[D,O]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{u(void 0),x(void 0)},[e]),(0,Q.useEffect)(()=>{let t=!0,n=++T.current;return p(void 0),te(e).then(e=>{t&&n===T.current&&!w.current&&u(e)}).catch(e=>{t&&n===T.current&&p(e instanceof Error?e.message:String(e))}),()=>{t=!1}},[e,D]),(0,Q.useEffect)(()=>{let t=()=>{w.current||O(e=>e+1)},n=n=>{n.detail?.taskId===e&&t()};return window.addEventListener(`task-changed-v2`,n),window.addEventListener(`focus`,t),window.addEventListener(`realtime-gap`,t),window.addEventListener(`gateway-realtime-connected`,t),()=>{window.removeEventListener(`task-changed-v2`,n),window.removeEventListener(`focus`,t),window.removeEventListener(`realtime-gap`,t),window.removeEventListener(`gateway-realtime-connected`,t)}},[e]);let k=l?de(l):[],A=l?.task.phase===`review`&&l.allowedCommands.includes(`close`)&&l.waits.length===0&&k.length>0&&k.every(e=>e.status===`passed`),j=l?qe(l):void 0,M=l?.allowedCommands.includes(`start`)&&l.waits.length===0&&j,N=e=>{T.current++,u(e),r?.(e)};async function P(e,t,r=!1){if(!w.current){w.current=!0,T.current++,C(!0),p(void 0);try{N(await e()),x(t),r&&n()}catch(e){p(e instanceof Error?e.message:String(e))}finally{w.current=!1,C(!1)}}}let F=l?.receipts.filter(e=>l.runs.some(t=>t.id===e.runId&&t.contractVersion===l.task.latestContractVersion)).sort((e,t)=>t.finalizedAt-e.finalizedAt)[0],L=k.filter(e=>e.status===`passed`).length,z=k.filter(e=>e.status===`failed`).length,B=k.length-L-z,V=l?.task.contract?.acceptancePolicy===`verified_auto`,H=E(c,e);return(0,$.jsxs)(`section`,{className:`mt-4 space-y-4 rounded-xl border border-edge bg-surface-panel p-4`,"aria-label":i?`任务结果与处理`:`Task result and actions`,"aria-busy":S,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i?`执行结果`:`Result`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Y,{variant:`ghost`,disabled:S,onClick:()=>O(e=>e+1),children:i?`刷新状态`:`Refresh status`}),(0,$.jsx)(s,{to:H,className:`inline-flex min-h-9 items-center text-xs font-medium text-accent-fg hover:underline`,children:i?`查看任务详情`:`Task details`})]})]}),f?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:f}):null,S?(0,$.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:i?`正在处理…`:`Processing…`}):null,b?(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-success`,children:b}):null,!l&&!f?(0,$.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,$.jsx)(I,{className:`h-5 w-1/3`}),(0,$.jsx)(I,{className:`h-24 w-full`})]}):null,l?(0,$.jsxs)($.Fragment,{children:[F?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:F.completionVerdict===`achieved`?i?`执行报告已达成目标,请结合依据逐项验收。`:`The run reports the goal achieved. Review the evidence before accepting.`:i?`当前为阶段性结果,尚有工作需要推进。`:`This is a partial result. More work is needed.`}),(0,$.jsx)(X,{content:F.summary,contentKey:`home:${e}:result:${F.runId}`,language:t,previewHeight:180}),F.remainingWork.length>0?(0,$.jsxs)(`div`,{className:`text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:i?`尚待完成`:`Remaining work`}),(0,$.jsx)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5`,children:F.remainingWork.map((e,t)=>(0,$.jsx)(`li`,{children:e},t))})]}):null,F.nextAction?(0,$.jsxs)(`p`,{className:`whitespace-pre-wrap text-sm text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i?`下一步:`:`Next step: `}),F.nextAction]}):null,F.judgment?(0,$.jsxs)(`div`,{className:`space-y-1 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:i?`判断依据`:`Assessment`}),(0,$.jsx)(`p`,{children:F.judgment.recommendation}),(0,$.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:F.judgment.reasons.map((e,t)=>(0,$.jsx)(`li`,{children:e},t))}),F.judgment.uncertainty?(0,$.jsxs)(`p`,{children:[i?`待确认:`:`Uncertainty: `,F.judgment.uncertainty]}):null]}):null,(0,$.jsx)(Ce,{evidence:F.evidence,projectId:l.task.projectId,conversationId:l.conversation?.activeConversationId,language:t,onOpenFile:y})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i?`当前任务版本暂无执行结果,可先处理等待事项或查看执行进度。`:`No result for the current task version. Resolve pending items or view progress.`}),k.length>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`h3`,{className:`text-sm font-semibold text-fg`,children:[i?`验收条件`:`Acceptance criteria`,` `,(0,$.jsxs)(`span`,{className:`font-normal text-fg-muted`,children:[L,`/`,k.length]})]}),k.map((n,r)=>(0,$.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle pt-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 text-sm text-fg`,children:[(0,$.jsx)(`p`,{className:`break-words`,children:n.text}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:i?{passed:`已通过`,failed:`未通过`,unverified:`待判定`}[n.status]:{passed:`Passed`,failed:`Failed`,unverified:`Not reviewed`}[n.status]})]}),l.task.phase===`review`&&!V?(0,$.jsx)(`div`,{className:`flex gap-2`,children:[`passed`,`failed`].map(t=>(0,$.jsx)(Y,{variant:`secondary`,disabled:S||n.status===t,onClick:()=>void P(()=>R(e,r,t,l.task.version,l.task.latestContractVersion),i?`判定已保存。`:`Review saved.`),children:i?t===`passed`?`确认通过`:`未通过`:t===`passed`?`Mark passed`:`Mark failed`},t))}):null]}),n.note?(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.note}):null,n.review?.note?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.review.note}):null,(0,$.jsx)(Ce,{evidence:n.evidence,projectId:l.task.projectId,conversationId:l.conversation?.activeConversationId,language:t,onOpenFile:y})]},r))]}):null,l.waits.length>0?(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i?`等待处理`:`Pending items`}),l.waits.map(t=>(0,$.jsx)(`div`,{children:l.allowedCommands.includes(`resolve_wait`)&&(t.kind===`user_input`||t.kind===`approval`&&typeof t.condition.capability==`string`)&&t.condition.type!==`connection`?(0,$.jsx)(Se,{wait:t,detail:l,zh:i,onUpdated:N}):(0,$.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{children:t.reason}),t.kind===`paused`&&l.allowedCommands.includes(`resolve_wait`)?(0,$.jsx)(Y,{className:`mt-2`,disabled:S,onClick:()=>void P(()=>W(e,{type:`resolve_wait`,waitId:t.id},l.task.version),i?`已解除暂停,任务状态已更新。`:`Pause resolved. Task status updated.`),children:i?`恢复任务`:`Resume task`}):(0,$.jsx)(s,{to:typeof t.condition.dependsOnTaskId==`string`?E(c,t.condition.dependsOnTaskId):H,className:`mt-2 inline-flex min-h-9 items-center text-accent-fg hover:underline`,children:i?`查看并处理`:`View and resolve`})]})},t.id))]}):null,l.task.phase===`review`&&!A?(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:i?`尚有 ${B} 项待判定、${z} 项未通过、${l.waits.length} 项等待处理。${V?`此任务需要执行验证;请继续执行以补齐依据和未完成项。`:`查看依据后逐项判定;未通过时可继续执行修正。`}`:`${B} unreviewed, ${z} failed, ${l.waits.length} pending items. ${V?`This task requires execution verification. Continue execution to supply missing evidence.`:`Review the evidence and mark each criterion; continue execution to fix failures.`}`}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[l.task.phase===`review`?(0,$.jsx)(Y,{variant:`primary`,disabled:S||!A,onClick:()=>void P(()=>W(e,{type:`close`,resolution:`done`},l.task.version),i?`任务已验收完成。`:`Task accepted.`,!0),children:i?`验收完成`:`Accept task`}):null,M?(0,$.jsx)(Y,{variant:A?`secondary`:`primary`,disabled:S,onClick:()=>void P(()=>W(e,{type:`start`,executor:j},l.task.version),i?`已开始执行,结果将自动更新。`:`Execution started. Results will update automatically.`),children:i?F?`继续执行并验证`:`开始执行`:F?`Continue and verify`:`Start execution`}):null]})]}):null,l&&v?(0,$.jsx)(_,{open:!0,onOpenChange:e=>{e||y(null)},children:(0,$.jsxs)(m,{children:[(0,$.jsx)(d,{className:`fixed inset-0 z-[80] bg-scrim`}),(0,$.jsxs)(h,{className:`app-main-surface fixed left-1/2 top-1/2 z-[90] flex h-[min(54rem,calc(100dvh-2rem))] w-[min(72rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel outline-none`,"aria-describedby":void 0,children:[(0,$.jsxs)(g,{className:`sr-only`,children:[i?`交付物预览`:`Artifact preview`,` · `,v]}),(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsxs)(`div`,{className:`flex-1 space-y-3 p-4`,"aria-busy":!0,children:[(0,$.jsx)(I,{className:`h-9 w-full`}),(0,$.jsx)(I,{className:`h-64 w-full`})]}),children:(0,$.jsx)(Je,{filePath:v,projectId:l.task.projectId,conversationId:l.conversation?.activeConversationId,onClose:()=>y(null)})})]})]})}):null]})}function Xe(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Ze(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`space-y-8`,"aria-busy":!0,children:[(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(I,{className:`h-10 w-3/5 rounded-xl`}),(0,$.jsx)(I,{className:`h-5 w-4/5 rounded-lg`})]}),(0,$.jsx)(I,{className:`h-64 rounded-2xl`}),(0,$.jsx)(I,{className:`h-32 rounded-xl`})]}),e[0]=t):t=e[0],t}function Qe(e){let t=(0,Z.c)(61),{item:n,busy:r,recommendationLabel:i,dueLabel:a,failureLabel:s,locale:c,onAction:l,onComplete:u,onUpdated:d}=e,[f,p]=o(),m;t[0]===n.openAction?m=t[1]:(m=n.openAction?.type===`open`?/^\/tasks\/([^/?#]+)/.exec(n.openAction.href):null,t[0]=n.openAction,t[1]=m);let h=m,g=n.primaryAction?.type===`task_review`?n.primaryAction.taskId:h?decodeURIComponent(h[1]):void 0,_;t[2]!==g||t[3]!==f?(_=g&&f.get(`reviewTask`)===g,t[2]=g,t[3]=f,t[4]=_):_=t[4];let v=!!_,y;t[5]!==g||t[6]!==f||t[7]!==p?(y=e=>{let t=new URLSearchParams(f);e&&g?t.set(`reviewTask`,g):t.delete(`reviewTask`),p(t)},t[5]=g,t[6]=f,t[7]=p,t[8]=y):y=t[8];let b=y,x;t[9]!==a||t[10]!==n.dueAt||t[11]!==c?(x=n.dueAt?`${a} ${be(new Date(n.dueAt),c)}`:null,t[9]=a,t[10]=n.dueAt,t[11]=c,t[12]=x):x=t[12];let S=x,C=n.kind===`failure`?s:S,w;t[13]===C?w=t[14]:(w=C?(0,$.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-medium text-warning`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-warning`,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:C})]}):null,t[13]=C,t[14]=w);let T=!n.openAction,E;t[15]!==n.id||t[16]!==n.openAction||t[17]!==l?(E=()=>n.openAction&&l(n.openAction,n.id),t[15]=n.id,t[16]=n.openAction,t[17]=l,t[18]=E):E=t[18];let D;t[19]===n.title?D=t[20]:(D=(0,$.jsx)(`span`,{className:`block text-lg font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[19]=n.title,t[20]=D);let O;t[21]===n.summary?O=t[22]:(O=(0,$.jsx)(`span`,{className:`mt-1.5 block text-sm leading-6 text-fg-muted`,children:n.summary}),t[21]=n.summary,t[22]=O);let k;t[23]!==T||t[24]!==E||t[25]!==D||t[26]!==O?(k=(0,$.jsxs)(`button`,{type:`button`,className:`block w-full text-left outline-none focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:T,onClick:E,children:[D,O]}),t[23]=T,t[24]=E,t[25]=D,t[26]=O,t[27]=k):k=t[27];let A;t[28]!==n.recommendation||t[29]!==i?(A=n.recommendation?(0,$.jsxs)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:[(0,$.jsxs)(`span`,{className:`font-semibold text-fg`,children:[i,`:`]}),n.recommendation]}):null,t[28]=n.recommendation,t[29]=i,t[30]=A):A=t[30];let j;t[31]!==r||t[32]!==n.id||t[33]!==n.primaryAction||t[34]!==n.secondaryActions||t[35]!==l||t[36]!==v||t[37]!==g||t[38]!==b?(j=n.primaryAction||n.secondaryActions.length>0?(0,$.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[n.primaryAction?(0,$.jsx)(Y,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3.5 text-xs`,disabled:r,"aria-expanded":g&&[`task_review`,`open`].includes(n.primaryAction.type)?v:void 0,onClick:()=>g&&[`task_review`,`open`].includes(n.primaryAction.type)?b(!v):l(n.primaryAction,n.id),children:n.primaryAction.label}):null,n.secondaryActions.map(e=>(0,$.jsx)(Y,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3.5 text-xs shadow-none`,disabled:r,onClick:()=>l(e,n.id),children:e.label},`${e.type}:${e.label}`))]}):null,t[31]=r,t[32]=n.id,t[33]=n.primaryAction,t[34]=n.secondaryActions,t[35]=l,t[36]=v,t[37]=g,t[38]=b,t[39]=j):j=t[39];let M;t[40]!==n.primaryAction?.type||t[41]!==c||t[42]!==v||t[43]!==g||t[44]!==b?(M=g&&n.primaryAction?.type===`retry_task`?(0,$.jsx)(Y,{variant:`ghost`,className:`mt-2`,"aria-expanded":v,onClick:()=>b(!v),children:c===`zh`?`查看结果与依据`:`View result and evidence`}):null,t[40]=n.primaryAction?.type,t[41]=c,t[42]=v,t[43]=g,t[44]=b,t[45]=M):M=t[45];let N;t[46]!==c||t[47]!==u||t[48]!==d||t[49]!==v||t[50]!==g||t[51]!==b?(N=v&&g?(0,$.jsx)(Ye,{taskId:g,language:c,onUpdated:d,onComplete:()=>{b(!1),u()}},g):null,t[46]=c,t[47]=u,t[48]=d,t[49]=v,t[50]=g,t[51]=b,t[52]=N):N=t[52];let P;return t[53]!==r||t[54]!==k||t[55]!==A||t[56]!==j||t[57]!==M||t[58]!==N||t[59]!==w?(P=(0,$.jsxs)(`article`,{className:`px-5 py-5 sm:px-6 sm:py-6`,"aria-busy":r,children:[w,k,A,j,M,N]}),t[53]=r,t[54]=k,t[55]=A,t[56]=j,t[57]=M,t[58]=N,t[59]=w,t[60]=P):P=t[60],P}function $e(e){let t=(0,Z.c)(38),{item:n,onAction:r,language:i,onUpdated:a}=e,[o,s]=(0,Q.useState)(!1),c;t[0]===n.openAction?c=t[1]:(c=n.openAction?.type===`open`?/^\/tasks\/([^/?#]+)/.exec(n.openAction.href):null,t[0]=n.openAction,t[1]=c);let l=c,u=l?decodeURIComponent(l[1]):void 0,d;t[2]===n.kind?d=t[3]:(d=n.kind===`scheduled`?(0,$.jsx)(v,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-fg-subtle`,"aria-hidden":!0}),t[2]=n.kind,t[3]=d);let f=d,p=!n.openAction,m=u?o:void 0,h;t[4]!==n.id||t[5]!==n.openAction||t[6]!==r||t[7]!==u?(h=()=>u?s(et):n.openAction&&r(n.openAction,n.id),t[4]=n.id,t[5]=n.openAction,t[6]=r,t[7]=u,t[8]=h):h=t[8];let g;t[9]===f?g=t[10]:(g=(0,$.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-fg-subtle`,children:f}),t[9]=f,t[10]=g);let _;t[11]===n.title?_=t[12]:(_=(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.title}),t[11]=n.title,t[12]=_);let y;t[13]===n.summary?y=t[14]:(y=(0,$.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.summary}),t[13]=n.summary,t[14]=y);let x;t[15]!==_||t[16]!==y?(x=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,y]}),t[15]=_,t[16]=y,t[17]=x):x=t[17];let S;t[18]===n.statusLabel?S=t[19]:(S=n.statusLabel?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.statusLabel}):null,t[18]=n.statusLabel,t[19]=S);let C;t[20]===n.openAction?C=t[21]:(C=n.openAction?(0,$.jsx)(b,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[20]=n.openAction,t[21]=C);let w;t[22]!==S||t[23]!==C||t[24]!==p||t[25]!==m||t[26]!==h||t[27]!==g||t[28]!==x?(w=(0,$.jsxs)(`button`,{type:`button`,className:`flex min-h-16 w-full items-center gap-3 py-3 text-left outline-none hover:text-fg focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:p,"aria-expanded":m,onClick:h,children:[g,x,S,C]}),t[22]=S,t[23]=C,t[24]=p,t[25]=m,t[26]=h,t[27]=g,t[28]=x,t[29]=w):w=t[29];let T;t[30]!==o||t[31]!==i||t[32]!==a||t[33]!==u?(T=u&&o?(0,$.jsx)(Ye,{taskId:u,language:i,onUpdated:a,onComplete:()=>s(!1)}):null,t[30]=o,t[31]=i,t[32]=a,t[33]=u,t[34]=T):T=t[34];let E;return t[35]!==w||t[36]!==T?(E=(0,$.jsxs)(`div`,{children:[w,T]}),t[35]=w,t[36]=T,t[37]=E):E=t[37],E}function et(e){return!e}function tt(){let e=l(e=>e.language),t=u(e),n=t.projectsPage,r=ue(e),i=c(),o=a(),s=ge(e=>e.setPageHeader),v=ge(e=>e.clearPageHeader),[y,b]=(0,Q.useState)(!1),{home:S,loading:C,loadError:w,setLoadError:T,load:E}=we(e,o.key,y),[O,k]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(``),N=(0,Q.useRef)(!1),[F,I]=(0,Q.useState)(),[L,R]=(0,Q.useState)(!1),[V,W]=(0,Q.useState)(null),[G,q]=(0,Q.useState)(!1),[te,ie]=(0,Q.useState)(),[ae,oe]=(0,Q.useState)(!1),[se,ce]=(0,Q.useState)(0),[de,me]=(0,Q.useState)(),[_e,be]=(0,Q.useState)(),[xe,Se]=(0,Q.useState)(!1),X=J({chat:t.chat}),Ce=(0,Q.useRef)(null),Z=le({disabled:xe,chat:t.chat,onTranscript:e=>{M(t=>fe(t,e)),window.setTimeout(()=>Ce.current?.focus(),0)}}),{phase:Te,voiceActive:De,startVoiceInput:Oe,cancelVoiceInput:ke,confirmVoiceInput:Ae,retryVoiceInput:je}=Z;(0,Q.useEffect)(()=>{if(!de)return;let e=window.setTimeout(()=>me(void 0),8e3);return()=>window.clearTimeout(e)},[de]);let Me=(0,Q.useCallback)(async e=>{if(!(e.length===0||xe)){Se(!0);try{await X.processFiles(e)}finally{Se(!1)}}},[xe,X.processFiles]),Ne=(0,Q.useCallback)(async e=>{let t=pe(e.clipboardData);t.length!==0&&(e.preventDefault(),await Me(t))},[Me]),Fe=(0,Q.useCallback)(e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,X.setIsDragging(!0))},[X.setIsDragging]),Ie=(0,Q.useCallback)(e=>{let t=e.relatedTarget;(!(t instanceof Node)||!e.currentTarget.contains(t))&&X.setIsDragging(!1)},[X.setIsDragging]),Le=(0,Q.useCallback)(async e=>{e.preventDefault(),X.setIsDragging(!1),await Me(Array.from(e.dataTransfer.files))},[X.setIsDragging,Me]),Re=(0,Q.useCallback)(e=>{e.preventDefault();let t=X.wireAttachmentsPayload(),n=t.length>0?he(t):void 0,r=H(j,n,{projectScope:`none`});r&&(k(!1),M(``),X.clearAttachments(),i(r))},[X.clearAttachments,X.wireAttachmentsPayload,j,i]),Be=X.attachments.length>=10,Ve={attachTitle:Be?Xe(t.chat.maxAttachmentsReached,{max:10}):`${t.chat.attachFile} (${X.attachments.length}/10)`,dropFiles:t.chat.dropFiles,intentLabel:r.intentLabel,intentPlaceholder:r.intentPlaceholder,intentSuggestion:r.intentSuggestion,shortcut:n.home.submitShortcut,submit:r.newWork},He=(0,Q.useMemo)(()=>({label:n.home.advisorStatusLabel,ready:n.home.advisorStatusReady,clarification:n.home.advisorStatusClarification,refreshing:n.home.advisorStatusRefreshing,refreshingDetail:n.home.advisorRefreshing,idle:n.home.advisorStatusIdle,idleDetail:n.home.advisorUnavailableTitle,generationFailed:n.home.advisorStatusGenerationFailed,budgetExhausted:n.home.advisorStatusBudgetExhausted,modelUnavailable:n.home.advisorStatusModelUnavailable,generationFailedDetail:n.home.advisorGenerationFailed,budgetExhaustedDetail:n.home.advisorBudgetExhausted,modelUnavailableDetail:n.home.advisorModelUnavailable,history:n.home.advisorHistory,retry:n.home.retry,findAnother:n.home.advisorRefresh}),[n.home]),Ue=!!(S&&S.needsUser.length===0&&S.backgroundCount===0),Ge=!!(S&&S.needsUser.length===0),qe=Ge||O;(0,Q.useEffect)(()=>{!qe&&De&&ke()},[ke,qe,De]),(0,Q.useEffect)(()=>{let e=e=>{let t=e.detail?.target;t&&t!==`chat`||!qe||xe||(e.preventDefault(),Te===`recording`?Ae():Te===`idle`?(Ce.current?.focus(),Oe()):Te===`error`&&je())},t=e=>{let t=e.detail?.target;t&&t!==`chat`||!qe||!De||(e.preventDefault(),ke(),Ce.current?.focus())};return window.addEventListener(ye,e),window.addEventListener(ve,t),()=>{window.removeEventListener(ye,e),window.removeEventListener(ve,t)}},[xe,ke,qe,Ae,je,Oe,De,Te]);let Je=(0,Q.useCallback)(e=>{e||ke(),k(e)},[ke]),Ye=(0,Q.useCallback)((t,n)=>{if(t.type===`open`){i(D(`/`,t.href));return}t.type===`task_review`||N.current||(N.current=!0,W(n),I(void 0),T(null),(async()=>{try{if(t.type===`retry_task`)await Ke(t.taskId,e),I({message:e===`zh`?`任务已重新开始,可查看执行进度。`:`Task restarted. View progress.`,href:D(`/`,`/tasks/${encodeURIComponent(t.taskId)}`)});else if(t.type===`connector_decision`)await re({kind:`connector_approval`,approvalId:t.approvalId},t.decision),I({message:e===`zh`?t.decision===`approve`?`已批准授权,任务状态将自动更新。`:`已拒绝授权。`:t.decision===`approve`?`Permission approved. Task status will update.`:`Permission denied.`});else if(t.type===`retry_run`){let n=await B({kind:t.subjectKind,runId:t.runId});I({message:e===`zh`?`已发起重试,可查看新的执行结果。`:`Retry started. Follow the new execution.`,href:n.conversationId?`/chat/${encodeURIComponent(n.conversationId)}`:`/automations?run=${encodeURIComponent(n.runId)}`})}else t.type===`acknowledge_run`&&(await K({kind:t.subjectKind,runId:t.runId}),I({message:e===`zh`?`已确认此异常,已从待处理事项移除。`:`Issue acknowledged and removed from pending items.`}));await E()}catch(e){T(e instanceof Error?e.message:String(e))}finally{N.current=!1,W(null)}})())},[e,E,i]),et=(0,Q.useCallback)(t=>{I({message:e===`zh`?t.task.phase===`closed`?`任务已验收完成。`:`操作已保存,任务状态已更新。`:t.task.phase===`closed`?`Task accepted.`:`Action saved. Task status updated.`,href:D(`/`,`/tasks/${encodeURIComponent(t.task.id)}`)}),E()},[e,E]),tt=(0,Q.useCallback)(()=>{q(!0),ie(void 0),be(void 0),T(null),U(e).then(()=>E()).catch(e=>T(e instanceof Error?e.message:String(e))).finally(()=>q(!1))},[e,E]),nt=(0,Q.useCallback)((e,t)=>{q(!0),T(null),ee(e,t).then(async t=>{if(t.outcome===`needs_setup`){be({opportunityId:e.id,value:t.preflight});return}if(be(void 0),ce(e=>e+1),t.outcome===`task`){ie({title:n.home.advisorStartedTitle,detail:Xe(n.home.advisorStartedDetail,{title:e.title}),href:D(`/`,t.href)}),await E();return}i(t.href)}).catch(e=>T(e instanceof Error?e.message:String(e))).finally(()=>q(!1))},[E,i,n.home.advisorStartedDetail,n.home.advisorStartedTitle]),rt=(0,Q.useCallback)((e,t)=>{q(!0),ie(void 0),be(void 0),T(null),ne(e,{kind:t,snoozedUntil:t===`too_early`?Date.now()+4320*6e4:void 0}).then(({idempotencyKey:t})=>(me({opportunityId:e.id,idempotencyKey:t}),ce(e=>e+1),E())).catch(e=>T(e instanceof Error?e.message:String(e))).finally(()=>q(!1))},[E]),it=(0,Q.useCallback)(()=>{if(!de)return;let e=de;me(void 0),q(!0),T(null),z(e.opportunityId,e.idempotencyKey).then(()=>(ce(e=>e+1),E())).catch(t=>{me(e),T(t instanceof Error?t.message:String(t))}).finally(()=>q(!1))},[de,E]),at=(0,Q.useCallback)((e,t)=>{i(`/chat/new?${new URLSearchParams({draft:`${e}\n\n${t}`}).toString()}`)},[i]),ot=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[S?(0,$.jsx)(We,{advisor:S.advisor,busy:G,copy:He,onOpenHistory:()=>oe(!0),onRefresh:tt}):null,Ge?null:(0,$.jsxs)(Y,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>k(!0),children:[(0,$.jsx)(A,{className:`size-4`,"aria-hidden":!0}),r.newWork]})]}),[G,He,r.newWork,S,tt,Ge]);(0,Q.useLayoutEffect)(()=>(s({startExtra:null,main:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:ot}),()=>v()),[v,ot,s,n.title]);let st=S?.needsUser.length??0,ct=S?.backgroundCount??0,lt=st>0?Xe(n.home.attentionTitle,{count:st}):ct>0?n.home.clearTitle:n.home.idleTitle,ut=st>0?ct>0?Xe(n.home.attentionIntroWithBackground,{count:ct}):n.home.attentionIntro:ct>0?Xe(n.home.clearIntro,{count:ct}):n.home.idleIntro;return(0,$.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[920px] flex-1 flex-col px-4 pb-8 pt-3 sm:px-6 lg:px-8 lg:pb-12 lg:pt-4`,children:[(0,$.jsx)(`input`,{ref:X.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{let t=e.target.files;t&&Me(Array.from(t)),e.target.value=``}}),(0,$.jsx)(_,{open:O,onOpenChange:Je,children:(0,$.jsxs)(m,{children:[(0,$.jsx)(d,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(h,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(g,{className:`text-base font-semibold text-fg`,children:r.dialogTitle}),(0,$.jsx)(f,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r.dialogDescription})]}),(0,$.jsx)(p,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,children:(0,$.jsx)(P,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsx)(Ee,{variant:`dialog`,inputId:`new-conversation-intent`,inputRef:Ce,intent:j,labels:{...Ve,submit:r.submit},attachments:X.attachments,isDragging:X.isDragging,attachmentBusy:xe,attachmentsFull:Be,voice:Z,chat:t.chat,cancelAction:(0,$.jsx)(p,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,children:n.cancel})}),onIntentChange:M,onPickFiles:()=>X.fileInputRef.current?.click(),onRemoveAttachment:X.removeAttachment,onPaste:e=>void Ne(e),onDragOver:Fe,onDragLeave:Ie,onDrop:e=>void Le(e),onSubmit:Re})]})]})}),(0,$.jsx)(ze,{open:ae,refreshKey:se,onOpenChange:oe,onReevaluate:tt}),w?(0,$.jsxs)(`div`,{role:`alert`,className:`mb-6 flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,$.jsx)(`span`,{children:w}),(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void E(),children:n.home.retry})]}):null,F?(0,$.jsxs)(`div`,{role:`status`,className:`mb-5 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-success/25 bg-success-soft px-4 py-3 text-sm text-fg`,children:[(0,$.jsx)(`span`,{children:F.message}),F.href?(0,$.jsx)(Y,{variant:`ghost`,onClick:()=>i(F.href),children:e===`zh`?`查看进展与结果`:`View progress and result`}):null]}):null,C?(0,$.jsx)(Ze,{}):S?(0,$.jsxs)(`div`,{className:Ue?`mx-auto my-auto w-full max-w-[640px]`:`w-full`,children:[(0,$.jsxs)(`section`,{className:Ue?`w-full text-center`:`max-w-3xl`,children:[(0,$.jsx)(`h2`,{className:`text-3xl font-semibold leading-tight tracking-[-0.035em] text-fg sm:text-4xl`,children:lt}),(0,$.jsx)(`p`,{className:Ue?`mx-auto mt-3 max-w-xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`:`mt-3 max-w-2xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`,children:ut})]}),Ge?(0,$.jsx)(Ee,{variant:`inline`,inputId:`home-conversation-intent`,inputRef:Ce,intent:j,labels:Ve,attachments:X.attachments,isDragging:X.isDragging,attachmentBusy:xe,attachmentsFull:Be,voice:Z,chat:t.chat,onIntentChange:M,onPickFiles:()=>X.fileInputRef.current?.click(),onRemoveAttachment:X.removeAttachment,onPaste:e=>void Ne(e),onDragOver:Fe,onDragLeave:Ie,onDrop:e=>void Le(e),onSubmit:Re}):null,(0,$.jsx)(Pe,{advisor:S.advisor,busy:G,copy:{aiLabel:n.home.advisorAiLabel,why:n.home.advisorWhy,evidence:n.home.advisorEvidence,needsSetup:n.home.advisorNeedsSetup,start:n.home.advisorStart,discuss:n.home.advisorDiscuss,refresh:n.home.advisorRefresh,refreshing:n.home.advisorRefreshing,history:n.home.advisorHistory,viewProgress:n.home.advisorViewProgress,alternatives:n.home.advisorAlternatives,feedback:n.home.advisorFeedback,alreadyDone:n.home.advisorAlreadyDone,irrelevant:n.home.advisorIrrelevant,later:n.home.advisorLater,lessLikeThis:n.home.advisorLessLikeThis,sourceIncorrect:n.home.advisorSourceIncorrect,minutes:n.home.advisorMinutes,setupTitle:n.home.advisorSetupTitle,setupHint:n.home.advisorSetupHint,configure:n.home.advisorConfigure,degradedStart:n.home.advisorDegradedStart,automationHint:n.home.advisorAutomationHint,automationAction:n.home.advisorAutomationAction},onRefresh:tt,onAction:nt,onFeedback:rt,onClarification:at,onOpenHistory:()=>oe(!0),preflight:_e,receipt:te}),S.needsUser.length>0?(0,$.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-needs-user-title`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 px-1`,children:[(0,$.jsx)(x,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{id:`home-needs-user-title`,className:`text-sm font-semibold text-fg`,children:n.home.needsUserTitle})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base`,children:S.needsUser.map(t=>(0,$.jsx)(Qe,{item:t,busy:V!==null,recommendationLabel:n.home.recommendationLabel,dueLabel:n.home.dueLabel,failureLabel:r.runAttention,locale:e,onAction:Ye,onComplete:()=>void E(),onUpdated:et},t.id))}),y||(S.attentionPolicy?.suppressedDecisionCount??0)+(S.attentionPolicy?.suppressedAttentionCount??0)>0?(0,$.jsx)(Y,{variant:`ghost`,className:`mt-2`,"aria-expanded":y,onClick:()=>b(e=>!e),children:e===`zh`?y?`收起待处理事项`:`查看其余 ${(S.attentionPolicy?.suppressedDecisionCount??0)+(S.attentionPolicy?.suppressedAttentionCount??0)} 项待处理事项`:y?`Show fewer pending items`:`View ${(S.attentionPolicy?.suppressedDecisionCount??0)+(S.attentionPolicy?.suppressedAttentionCount??0)} more pending items`}):null]}):null,S.background.length>0?(0,$.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-background-title`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1`,children:[(0,$.jsx)(`h2`,{id:`home-background-title`,className:`text-sm font-semibold text-fg`,children:n.home.backgroundTitle}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Xe(n.home.backgroundCount,{count:S.backgroundCount})})]}),(0,$.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle border-y border-edge-subtle`,children:(L?S.background:S.background.slice(0,3)).map(t=>(0,$.jsx)($e,{item:t,language:e,onAction:Ye,onUpdated:et},t.id))}),S.background.length>3?(0,$.jsx)(Y,{variant:`ghost`,className:`mt-2`,"aria-expanded":L,onClick:()=>R(e=>!e),children:e===`zh`?L?`收起`:`查看全部 ${S.backgroundCount} 项`:L?`Show less`:`View all ${S.backgroundCount} items`}):null]}):null]}):null,de?(0,$.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-[100] flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-overlay px-4 py-3 text-sm text-fg shadow-float`,children:[(0,$.jsx)(`span`,{children:n.home.advisorFeedbackSaved}),(0,$.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:it,children:n.home.advisorUndo})]}):null]})}export{tt as HomePage};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/workspace-file-preview-dialog-CS8-ZbVG.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js","assets/locale-store-DGtk-KSF.js","assets/messages-DYDySzn1.js","assets/use-file-preview-expanded-ivMxmMu1.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-CiwuuyV8.js","assets/createLucideIcon-DPHK1VkS.js","assets/app-window-DXFNqt_0.js","assets/check-DUBLcKHA.js","assets/chevron-down-ccbiQQz_.js","assets/copy-Dv6d4Dvw.js","assets/download-Dk-ZjtO6.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-CABVeTq0.js","assets/folder-open-CyzJ19I9.js","assets/link-2-D_ZKYUW7.js","assets/loader-circle-CifKLtgG.js","assets/markdown-view-JXJ3e1CB.js","assets/dist-BGTk37IG.js","assets/es2015-DBLcMg5B.js","assets/dist-CxGUk8J-.js","assets/file-image-CDUPkZvG.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/app-link-DRy3-k7j.js","assets/product-delivery-DRyD9_Xq.js","assets/schemas-CCWMleym.js","assets/local-apps-Ck6kACsY.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-C-DHb3Io.css","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/paperclip-f1HujQY1.js","assets/pencil-DmIY3Oa-.js","assets/refresh-cw-BRlGaq2w.js","assets/rotate-cw-LIg3Am9S.js","assets/save-DRDABU--.js","assets/search-DA7gz22f.js","assets/skeleton-BI5TyibZ.js","assets/constants-DBtMsXdW.js","assets/session-api-CpZ24vrQ.js","assets/gateway-startup-retry-DCjREMIO.js","assets/attachment-utils-core-BIOUBrpT.js","assets/interaction-BdhHBbYa.js","assets/activity-store-t5c6XavH.js","assets/app-chrome-BeB4KgOf.js","assets/electron-env-DHOGevH3.js","assets/use-async-resource-BHFGZCY2.js","assets/sliding-tab-list-DuQyViqe.js","assets/sliding-indicator-hwz0sx3h.js","assets/index.module-Cd9ENXfk.js","assets/workspace-api-BKbezgv-.js","assets/files-BNL4kkSB.js","assets/dist-ZrL34Ps4.js","assets/dist-BuHnPloF.js","assets/floating-ui.dom-seOukHzT.js","assets/share-link-dialog-Apq3cegw.js","assets/popover-select-CEMWIrtY.js","assets/dist-GJ8-1PAx.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/globe-DSSGFWFn.js","assets/button-Cc4hUNTt.js","assets/copy-text-row-CpiRzq4G.js","assets/file-preview-surface-D62ph0m0.js","assets/phone-workspace-store-BhJAeHdQ.js","assets/shares-api-Q5x_ty6F.js","assets/theme-store-D58tk8pq.js","assets/middleware-Pd0e8Igk.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{l as a,m as o,t as s,u as c}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as l}from"./locale-store-DGtk-KSF.js";import{t as u}from"./messages-DYDySzn1.js";import{a as d,i as f,n as p,o as m,r as h,s as g,t as _}from"./dist-BGTk37IG.js";import{t as v}from"./calendar-clock-D-quYVPe.js";import{t as y}from"./chevron-down-ccbiQQz_.js";import{t as b}from"./chevron-right-BweFrslA.js";import{t as x}from"./circle-alert-BEjgurr2.js";import{t as S}from"./circle-check-C23XjkUj.js";import{t as C}from"./clock-3-DnrAnuyZ.js";import{t as w}from"./external-link-DjqjBmc3.js";import{t as T}from"./history-DXH_9jsE.js";import{F as E,M as D}from"./markdown-view-JXJ3e1CB.js";import{t as O}from"./message-circle-Badhj-4D.js";import{t as k}from"./paperclip-f1HujQY1.js";import{t as A}from"./plus-Q2yW6OE7.js";import{t as j}from"./refresh-cw-BRlGaq2w.js";import{t as M}from"./settings-2-D-csvaET.js";import{t as N}from"./sparkles-DHlfQFAF.js";import{t as P}from"./x-B_N4OPjy.js";import{t as F}from"./cn-0WouolD0.js";import{t as I}from"./skeleton-BI5TyibZ.js";import{s as L}from"./tasks-DRmd6sWt.js";import{C as R,E as z,S as B,_ as V,a as H,b as U,f as W,g as G,l as K,n as q,t as J,u as ee,v as te,w as ne,x as re}from"./use-composer-attachments-fK2PUQbB.js";import{t as Y}from"./button-Cc4hUNTt.js";import{a as ie,i as ae,o as oe,s as se}from"./dist-GJ8-1PAx.js";import{a as ce,c as le,d as ue,h as de,i as fe,o as pe,r as me,t as he}from"./composer-payload-handoff-Ccq_KF1W.js";import{t as ge}from"./page-header-store-f8XcAs9b.js";import{t as _e}from"./sliding-tab-list-DuQyViqe.js";import{n as ve,r as ye}from"./voice-input-shortcut-events-D7QdPeuj.js";import{n as be}from"./date-formatters-DukWSVwc.js";import{n as xe}from"./tab-completion-input-CxtEp0aP.js";import{n as Se,r as X,t as Ce}from"./task-result-evidence-DFiu5SlL.js";var Z=n(),Q=e(t(),1);function we(e,t,n=!1){let[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!0),[s,c]=(0,Q.useState)(null),l=(0,Q.useRef)(0),u=(0,Q.useCallback)(async()=>{let t=++l.current;c(null);try{let r=await(n?G(e,!0):G(e));t===l.current&&i(r)}catch(e){t===l.current&&c(e instanceof Error?e.message:String(e))}finally{t===l.current&&o(!1)}},[e,n]);return(0,Q.useEffect)(()=>(u(),()=>{l.current++}),[u,t]),(0,Q.useEffect)(()=>{let e,t=1/0,n=n=>{let r=Date.now()+n;r>=t||(window.clearTimeout(e),t=r,e=window.setTimeout(()=>{e=void 0,t=1/0,u()},n))},r=()=>n(100),i=()=>n(750),a=()=>{document.visibilityState===`visible`&&r()},o=[`task-changed-v2`,`task-updated`,`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`home-advisor-updated`,`gateway-realtime-connected`,`realtime-gap`,`focus`],s=[`session-updated`,`session-transcript-updated`];return o.forEach(e=>window.addEventListener(e,r)),s.forEach(e=>window.addEventListener(e,i)),document.addEventListener(`visibilitychange`,a),()=>{o.forEach(e=>window.removeEventListener(e,r)),s.forEach(e=>window.removeEventListener(e,i)),document.removeEventListener(`visibilitychange`,a),window.clearTimeout(e)}},[u]),{home:r,loading:a,loadError:s,setLoadError:c,load:u}}var $=r(),Te=12e3;function Ee(e){let t=(0,Z.c)(107),{variant:n,inputId:r,inputRef:i,intent:a,labels:o,attachments:s,isDragging:c,attachmentBusy:l,attachmentsFull:u,voice:d,chat:f,cancelAction:p,onIntentChange:m,onPickFiles:h,onRemoveAttachment:g,onPaste:_,onDragOver:v,onDragLeave:y,onDrop:b,onSubmit:x}=e,S=n===`inline`,C;t[0]!==s||t[1]!==a?(C=!!a.trim()||s.length>0,t[0]=s,t[1]=a,t[2]=C):C=t[2];let w=C,T=d.voiceActive&&d.phase!==`error`,E;t[3]!==x||t[4]!==d.voiceActive?(E=e=>{if(d.voiceActive){e.preventDefault();return}x(e)},t[3]=x,t[4]=d.voiceActive,t[5]=E):E=t[5];let D=S?`mx-auto mt-6 w-full overflow-hidden rounded-xl border border-edge bg-surface-base p-2 text-left shadow-surface transition-colors focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15 sm:mt-8`:`flex min-h-0 flex-1 flex-col`,O;t[6]===D?O=t[7]:(O=F(`relative`,D),t[6]=D,t[7]=O);let A;t[8]!==S||t[9]!==c||t[10]!==o.dropFiles?(A=c?(0,$.jsx)(`div`,{className:F(`pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-accent-soft/90 text-sm font-medium text-accent-fg backdrop-blur-[1px]`,S&&`rounded-2xl`),children:o.dropFiles}):null,t[8]=S,t[9]=c,t[10]=o.dropFiles,t[11]=A):A=t[11];let j=!S&&`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,M;t[12]===j?M=t[13]:(M=F(j),t[12]=j,t[13]=M);let P=S?`sr-only`:`mb-2 shrink-0 text-sm font-medium text-fg`,I;t[14]!==r||t[15]!==o.intentLabel||t[16]!==P?(I=(0,$.jsx)(`label`,{htmlFor:r,className:P,children:o.intentLabel}),t[14]=r,t[15]=o.intentLabel,t[16]=P,t[17]=I):I=t[17];let L;t[18]!==l||t[19]!==f||t[20]!==d.audioLevel||t[21]!==d.cancelVoiceInput||t[22]!==d.confirmVoiceInput||t[23]!==d.elapsedLabel||t[24]!==d.error||t[25]!==d.finalTranscript||t[26]!==d.partialTranscript||t[27]!==d.phase||t[28]!==d.recordedDictation||t[29]!==d.retryVoiceInput||t[30]!==d.settingsRequired||t[31]!==d.voiceActive?(L=d.voiceActive?(0,$.jsx)(me,{phase:d.phase,elapsedLabel:d.elapsedLabel,recordedDictation:d.recordedDictation,audioLevel:d.audioLevel,partialTranscript:d.partialTranscript,finalTranscript:d.finalTranscript,error:d.error,settingsRequired:d.settingsRequired,disabled:l,chat:f,onCancel:d.cancelVoiceInput,onConfirm:d.confirmVoiceInput,onRetry:d.retryVoiceInput}):null,t[18]=l,t[19]=f,t[20]=d.audioLevel,t[21]=d.cancelVoiceInput,t[22]=d.confirmVoiceInput,t[23]=d.elapsedLabel,t[24]=d.error,t[25]=d.finalTranscript,t[26]=d.partialTranscript,t[27]=d.phase,t[28]=d.recordedDictation,t[29]=d.retryVoiceInput,t[30]=d.settingsRequired,t[31]=d.voiceActive,t[32]=L):L=t[32];let R=T&&`hidden`,z=S?`min-h-24 bg-transparent px-3 py-2`:`min-h-32 flex-1 rounded-xl border border-edge bg-surface-base p-3 focus:border-accent focus:ring-2 focus:ring-accent/20`,B;t[33]!==R||t[34]!==z?(B=F(`w-full resize-none text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle`,R,z),t[33]=R,t[34]=z,t[35]=B):B=t[35];let V;t[36]===m?V=t[37]:(V=e=>m(e.target.value),t[36]=m,t[37]=V);let H=!S,U;t[38]!==r||t[39]!==i||t[40]!==a||t[41]!==o.intentPlaceholder||t[42]!==o.intentSuggestion||t[43]!==m||t[44]!==_||t[45]!==B||t[46]!==V||t[47]!==H?(U=(0,$.jsx)(xe,{ref:i,id:r,className:B,value:a,onChange:V,onPaste:_,suggestion:o.intentSuggestion,onAcceptSuggestion:m,onKeyDown:De,placeholder:o.intentPlaceholder,maxLength:Te,autoFocus:H}),t[38]=r,t[39]=i,t[40]=a,t[41]=o.intentPlaceholder,t[42]=o.intentSuggestion,t[43]=m,t[44]=_,t[45]=B,t[46]=V,t[47]=H,t[48]=U):U=t[48];let W=S?`border-b-0 bg-transparent px-3 pb-2 pt-0`:`mt-3 border-b-0 bg-transparent px-0 pb-0`,G;t[49]!==s||t[50]!==g||t[51]!==W?(G=(0,$.jsx)(q,{attachments:s,topPadded:!1,onRemove:g,className:W}),t[49]=s,t[50]=g,t[51]=W,t[52]=G):G=t[52];let K;t[53]!==S||t[54]!==a.length||t[55]!==o.shortcut?(K=S?null:(0,$.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:o.shortcut}),(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[a.length.toLocaleString(),` / `,Te.toLocaleString()]})]}),t[53]=S,t[54]=a.length,t[55]=o.shortcut,t[56]=K):K=t[56];let J;t[57]!==L||t[58]!==U||t[59]!==G||t[60]!==K||t[61]!==M||t[62]!==I?(J=(0,$.jsxs)(`div`,{className:M,children:[I,L,U,G,K]}),t[57]=L,t[58]=U,t[59]=G,t[60]=K,t[61]=M,t[62]=I,t[63]=J):J=t[63];let ee=S?`border-edge-subtle px-1 pt-2`:`border-edge px-5 py-4`,te;t[64]===ee?te=t[65]:(te=F(`flex shrink-0 items-center gap-2 border-t`,ee),t[64]=ee,t[65]=te);let ne=!S&&`mr-auto`,re;t[66]===ne?re=t[67]:(re=F(`flex items-center gap-1`,ne),t[66]=ne,t[67]=re);let ie=l||u,ae;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(k,{className:`size-4`,"aria-hidden":!0}),t[68]=ae):ae=t[68];let oe;t[69]!==o.attachTitle||t[70]!==h||t[71]!==ie?(oe=(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`size-9 rounded-lg p-0`,disabled:ie,title:o.attachTitle,"aria-label":o.attachTitle,onClick:h,children:ae}),t[69]=o.attachTitle,t[70]=h,t[71]=ie,t[72]=oe):oe=t[72];let se;t[73]!==l||t[74]!==f||t[75]!==d.startVoiceInput||t[76]!==d.voiceActive?(se=d.voiceActive?null:(0,$.jsx)(ce,{disabled:l,chat:f,onStart:d.startVoiceInput}),t[73]=l,t[74]=f,t[75]=d.startVoiceInput,t[76]=d.voiceActive,t[77]=se):se=t[77];let le;t[78]!==re||t[79]!==oe||t[80]!==se?(le=(0,$.jsxs)(`div`,{className:re,children:[oe,se]}),t[78]=re,t[79]=oe,t[80]=se,t[81]=le):le=t[81];let ue;t[82]!==p||t[83]!==S||t[84]!==o.shortcut?(ue=S?(0,$.jsx)(`span`,{className:`hidden text-[11px] text-fg-subtle sm:inline`,children:o.shortcut}):p,t[82]=p,t[83]=S,t[84]=o.shortcut,t[85]=ue):ue=t[85];let de=S?`ml-auto h-9 rounded-lg px-3.5 text-xs`:`min-w-32`,fe=!w||l||d.voiceActive,pe=S?`size-3.5`:`size-4`,he;t[86]===pe?he=t[87]:(he=(0,$.jsx)(N,{className:pe,"aria-hidden":!0}),t[86]=pe,t[87]=he);let ge;t[88]!==o.submit||t[89]!==de||t[90]!==fe||t[91]!==he?(ge=(0,$.jsxs)(Y,{type:`submit`,variant:`primary`,className:de,disabled:fe,children:[he,o.submit]}),t[88]=o.submit,t[89]=de,t[90]=fe,t[91]=he,t[92]=ge):ge=t[92];let _e;t[93]!==te||t[94]!==le||t[95]!==ue||t[96]!==ge?(_e=(0,$.jsxs)(`div`,{className:te,children:[le,ue,ge]}),t[93]=te,t[94]=le,t[95]=ue,t[96]=ge,t[97]=_e):_e=t[97];let ve;return t[98]!==y||t[99]!==v||t[100]!==b||t[101]!==E||t[102]!==J||t[103]!==_e||t[104]!==O||t[105]!==A?(ve=(0,$.jsxs)(`form`,{onSubmit:E,onDragOver:v,onDragLeave:y,onDrop:b,className:O,children:[A,J,_e]}),t[98]=y,t[99]=v,t[100]=b,t[101]=E,t[102]=J,t[103]=_e,t[104]=O,t[105]=A,t[106]=ve):ve=t[106],ve}function De(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}function Oe(e){let t=(0,Z.c)(12),{href:n,children:r,onOpen:i}=e,o=a();if(n&&/^https?:\/\//i.test(n)){let e;return t[0]!==r||t[1]!==n?(e=(0,$.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:`rounded-sm text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r}),t[0]=r,t[1]=n,t[2]=e):e=t[2],e}if(n?.startsWith(`/`)&&!n.startsWith(`//`)){let e=`${o.pathname}${o.search}`,a;t[3]!==n||t[4]!==e?(a=D(e,n),t[3]=n,t[4]=e,t[5]=a):a=t[5];let c;return t[6]!==r||t[7]!==i||t[8]!==a?(c=(0,$.jsx)(s,{to:a,className:`rounded-sm text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:i,children:r}),t[6]=r,t[7]=i,t[8]=a,t[9]=c):c=t[9],c}let c;return t[10]===r?c=t[11]:(c=(0,$.jsx)(`span`,{children:r}),t[10]=r,t[11]=c),c}function ke(e){let t=(0,Z.c)(6),{opportunity:n,onOpen:r}=e,i=l(Ae),a,o;if(t[0]!==i||t[1]!==r||t[2]!==n.evidence||t[3]!==n.evidencePresentation){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=u(i).projectsPage.home.advisorEvidenceCopy,t=n.evidencePresentation,s=t?.locale===i?t.groups:void 0,c=new Intl.DateTimeFormat(i===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),l=t=>(0,$.jsx)(`ul`,{className:`mt-2 space-y-3 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:t.map(t=>{let n=!!(t.href&&(/^https?:\/\//i.test(t.href)||t.href.startsWith(`/`)&&!t.href.startsWith(`//`)));return(0,$.jsxs)(`li`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[(0,$.jsxs)(`p`,{className:`text-fg-subtle`,children:[e.sources[t.sourceType],` · `,(0,$.jsx)(`time`,{dateTime:new Date(t.observedAt).toISOString(),children:c.format(t.observedAt)})]}),(0,$.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap`,children:t.observation}),(0,$.jsx)(`p`,{className:`mt-1`,children:n?(0,$.jsx)(Oe,{href:t.href,onOpen:r,children:e.openSource}):e.noSource})]},t.id)})}),d=(t,r)=>(0,$.jsxs)(`li`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[(0,$.jsx)(`p`,{className:`text-fg-muted`,children:t.summary}),(0,$.jsxs)(`details`,{className:`mt-1`,children:[(0,$.jsxs)(`summary`,{className:`min-h-9 cursor-pointer rounded-sm py-2 text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.originals,` · `,e.sourceCount.replace(`{{count}}`,String(t.evidenceIds.length))]}),l(n.evidence.filter(e=>t.evidenceIds.includes(e.id)))]})]},r);if(!s){o=(0,$.jsxs)(`div`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:[(0,$.jsx)(`p`,{children:e.unavailable}),(0,$.jsxs)(`details`,{children:[(0,$.jsx)(`summary`,{className:`min-h-9 cursor-pointer rounded-sm py-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:e.originals}),l(n.evidence)]})]});break bb0}a=(0,$.jsxs)(`div`,{className:`mt-2 text-xs leading-5`,children:[(0,$.jsx)(`p`,{className:`mb-3 text-fg-subtle`,children:e.aiNote}),(0,$.jsx)(`ul`,{className:`space-y-3 border-l border-edge pl-3`,children:s.slice(0,3).map(d)}),s.length>3?(0,$.jsxs)(`details`,{className:`mt-2`,children:[(0,$.jsx)(`summary`,{className:`min-h-9 cursor-pointer rounded-sm py-2 text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:e.more.replace(`{{count}}`,String(s.length-3))}),(0,$.jsx)(`ul`,{className:`space-y-3 border-l border-edge pl-3`,children:s.slice(3).map(d)})]}):null]})}t[0]=i,t[1]=r,t[2]=n.evidence,t[3]=n.evidencePresentation,t[4]=a,t[5]=o}else a=t[4],o=t[5];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function Ae(e){return e.language}function je(e){let t=(0,Z.c)(4),{label:n,onClick:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(T,{className:`size-3.5`,"aria-hidden":!0}),t[0]=i):i=t[0];let a;return t[1]!==n||t[2]!==r?(a=(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-9 items-center gap-1.5 rounded-lg px-2 text-xs font-medium text-fg-muted transition-colors duration-150 hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:r,children:[i,n]}),t[1]=n,t[2]=r,t[3]=a):a=t[3],a}function Me(e){let t=(0,Z.c)(63),{opportunity:n,copy:r,onOpenHistory:i}=e,a,o,s,c,l,u;if(t[0]!==r.aiLabel||t[1]!==r.automationAction||t[2]!==r.automationHint||t[3]!==r.history||t[4]!==r.minutes||t[5]!==r.needsSetup||t[6]!==r.why||t[7]!==i||t[8]!==n.capabilities||t[9]!==n.continuation||t[10]!==n.estimatedMinutes||t[11]!==n.outcome||t[12]!==n.rationale||t[13]!==n.title){let e=n.capabilities.filter(Ne),d;t[20]===r.aiLabel?d=t[21]:(d=(0,$.jsx)(`span`,{children:r.aiLabel}),t[20]=r.aiLabel,t[21]=d);let f;t[22]!==r.minutes||t[23]!==n.estimatedMinutes?(f=n.estimatedMinutes?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),n.estimatedMinutes,` `,r.minutes]}):null,t[22]=r.minutes,t[23]=n.estimatedMinutes,t[24]=f):f=t[24];let p;t[25]!==d||t[26]!==f?(p=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[d,f]}),t[25]=d,t[26]=f,t[27]=p):p=t[27];let m;t[28]!==r.history||t[29]!==i?(m=(0,$.jsx)(je,{label:r.history,onClick:i}),t[28]=r.history,t[29]=i,t[30]=m):m=t[30],t[31]!==m||t[32]!==p?(a=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[p,m]}),t[31]=m,t[32]=p,t[33]=a):a=t[33],t[34]===n.title?o=t[35]:(o=(0,$.jsx)(`h3`,{className:`mt-3 text-xl font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[34]=n.title,t[35]=o),t[36]===n.outcome?s=t[37]:(s=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n.outcome}),t[36]=n.outcome,t[37]=s);let h;t[38]===r.why?h=t[39]:(h=(0,$.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.why,`:`]}),t[38]=r.why,t[39]=h),t[40]!==n.rationale||t[41]!==h?(c=(0,$.jsxs)(`p`,{className:`mt-4 text-sm leading-6 text-fg-muted`,children:[h,n.rationale]}),t[40]=n.rationale,t[41]=h,t[42]=c):c=t[42],t[43]!==r.automationAction||t[44]!==r.automationHint||t[45]!==n.continuation?(l=n.continuation?.kind===`automation`?(0,$.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 rounded-xl border border-edge bg-surface-subtle p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:r.automationHint}),(0,$.jsx)(`a`,{href:`#${n.continuation.href}`,className:`inline-flex min-h-11 shrink-0 items-center rounded-lg px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.automationAction})]}):null,t[43]=r.automationAction,t[44]=r.automationHint,t[45]=n.continuation,t[46]=l):l=t[46],u=e.length>0?(0,$.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,"aria-label":r.needsSetup,children:e.map(e=>(0,$.jsxs)(`a`,{href:`#${e.recoveryPath??`/settings`}`,className:`rounded-full border border-accent/25 bg-accent-soft px-2.5 py-1 text-xs text-accent hover:border-accent/50`,children:[r.needsSetup,` · `,e.capability]},`${e.kind}:${e.capability}`))}):null,t[0]=r.aiLabel,t[1]=r.automationAction,t[2]=r.automationHint,t[3]=r.history,t[4]=r.minutes,t[5]=r.needsSetup,t[6]=r.why,t[7]=i,t[8]=n.capabilities,t[9]=n.continuation,t[10]=n.estimatedMinutes,t[11]=n.outcome,t[12]=n.rationale,t[13]=n.title,t[14]=a,t[15]=o,t[16]=s,t[17]=c,t[18]=l,t[19]=u}else a=t[14],o=t[15],s=t[16],c=t[17],l=t[18],u=t[19];let d;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(y,{className:`size-3.5 transition-transform group-open:rotate-180`,"aria-hidden":!0}),t[47]=d):d=t[47];let f;t[48]===r.evidence?f=t[49]:(f=(0,$.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer list-none items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.evidence,d]}),t[48]=r.evidence,t[49]=f);let p;t[50]===n?p=t[51]:(p=(0,$.jsx)(ke,{opportunity:n}),t[50]=n,t[51]=p);let m;t[52]!==f||t[53]!==p?(m=(0,$.jsxs)(`details`,{open:!0,className:`mt-4 group`,children:[f,p]}),t[52]=f,t[53]=p,t[54]=m):m=t[54];let h;return t[55]!==a||t[56]!==m||t[57]!==o||t[58]!==s||t[59]!==c||t[60]!==l||t[61]!==u?(h=(0,$.jsxs)($.Fragment,{children:[a,o,s,c,l,u,m]}),t[55]=a,t[56]=m,t[57]=o,t[58]=s,t[59]=c,t[60]=l,t[61]=u,t[62]=h):h=t[62],h}function Ne(e){return e.readiness!==`ready`}function Pe(e){let t=(0,Z.c)(134),{advisor:n,copy:r,busy:i,onRefresh:a,onAction:o,onFeedback:s,onClarification:c,onOpenHistory:l,preflight:u,receipt:d}=e,[f,p]=(0,Q.useState)(),m;t[0]!==n.alternatives||t[1]!==n.primary||t[2]!==n.state?(m=n.state===`ready`?[n.primary,...n.alternatives]:[],t[0]=n.alternatives,t[1]=n.primary,t[2]=n.state,t[3]=m):m=t[3];let h=m,g;t[4]!==h||t[5]!==f?(g=h.find(e=>e.id===f)??h[0],t[4]=h,t[5]=f,t[6]=g):g=t[6];let _=g,v;t[7]===h[0]?.id?v=t[8]:(v=()=>p(h[0]?.id),t[7]=h[0]?.id,t[8]=v);let y=h[0]?.id,b;if(t[9]!==n.state||t[10]!==y?(b=[n.state,y],t[9]=n.state,t[10]=y,t[11]=b):b=t[11],(0,Q.useEffect)(v,b),n.state===`disabled`)return null;if(d){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(S,{className:`size-5 shrink-0 text-success`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===d.title?n=t[14]:(n=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:d.title}),t[13]=d.title,t[14]=n);let i;t[15]===d.detail?i=t[16]:(i=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:d.detail}),t[15]=d.detail,t[16]=i);let a;t[17]!==n||t[18]!==i?(a=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[n,i]}),t[17]=n,t[18]=i,t[19]=a):a=t[19];let o;t[20]!==r.history||t[21]!==l?(o=(0,$.jsx)(je,{label:r.history,onClick:l}),t[20]=r.history,t[21]=l,t[22]=o):o=t[22];let s=`#${d.href}`,c;t[23]!==r.viewProgress||t[24]!==s?(c=(0,$.jsx)(Y,{asChild:!0,variant:`secondary`,className:`min-h-10 text-xs`,children:(0,$.jsx)(`a`,{href:s,children:r.viewProgress})}),t[23]=r.viewProgress,t[24]=s,t[25]=c):c=t[25];let u;t[26]!==o||t[27]!==c?(u=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[o,c]}),t[26]=o,t[27]=c,t[28]=u):u=t[28];let f;return t[29]!==u||t[30]!==a?(f=(0,$.jsx)(`section`,{className:`mt-7 rounded-2xl border border-success/25 bg-success-soft px-5 py-4`,role:`status`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[e,a,u]})}),t[29]=u,t[30]=a,t[31]=f):f=t[31],f}if(n.state===`quiet`||n.state===`refreshing`)return null;if(n.state===`clarification`){let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(N,{className:`size-4`,"aria-hidden":!0}),t[32]=e):e=t[32];let a;t[33]===r.aiLabel?a=t[34]:(a=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-accent`,children:[e,r.aiLabel]}),t[33]=r.aiLabel,t[34]=a);let o;t[35]!==r.history||t[36]!==l?(o=(0,$.jsx)(je,{label:r.history,onClick:l}),t[35]=r.history,t[36]=l,t[37]=o):o=t[37];let s;t[38]!==a||t[39]!==o?(s=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[a,o]}),t[38]=a,t[39]=o,t[40]=s):s=t[40];let u;t[41]===n.question.question?u=t[42]:(u=(0,$.jsx)(`h3`,{id:`home-advisor-question`,className:`mt-3 text-lg font-semibold text-fg`,children:n.question.question}),t[41]=n.question.question,t[42]=u);let d;if(t[43]!==n.question.options||t[44]!==n.question.question||t[45]!==i||t[46]!==c){let e;t[48]!==n.question.question||t[49]!==i||t[50]!==c?(e=e=>(0,$.jsx)(Y,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>c(n.question.question,e.label),children:e.label},e.id),t[48]=n.question.question,t[49]=i,t[50]=c,t[51]=e):e=t[51],d=n.question.options.map(e),t[43]=n.question.options,t[44]=n.question.question,t[45]=i,t[46]=c,t[47]=d}else d=t[47];let f;t[52]===d?f=t[53]:(f=(0,$.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:d}),t[52]=d,t[53]=f);let p;return t[54]!==u||t[55]!==f||t[56]!==s?(p=(0,$.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base px-5 py-5`,"aria-labelledby":`home-advisor-question`,children:[s,u,f]}),t[54]=u,t[55]=f,t[56]=s,t[57]=p):p=t[57],p}if(!_)return null;let x=u?.opportunityId===_.id?u.value:void 0,C;t[58]!==n.stale||t[59]!==r.refreshing?(C=n.stale?(0,$.jsxs)(`p`,{className:`mb-3 inline-flex items-center gap-2 text-xs text-accent`,children:[(0,$.jsx)(j,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),r.refreshing]}):null,t[58]=n.stale,t[59]=r.refreshing,t[60]=C):C=t[60];let w;t[61]!==r||t[62]!==l||t[63]!==_?(w=(0,$.jsx)(Me,{opportunity:_,copy:r,onOpenHistory:l}),t[61]=r,t[62]=l,t[63]=_,t[64]=w):w=t[64];let T;t[65]!==i||t[66]!==r.configure||t[67]!==r.degradedStart||t[68]!==r.setupHint||t[69]!==r.setupTitle||t[70]!==o||t[71]!==_||t[72]!==x?(T=x?.state===`needs_setup`?(0,$.jsx)(`div`,{className:`mt-5 rounded-xl border border-accent/25 bg-accent-soft/40 p-4`,role:`alert`,"aria-live":`polite`,children:(0,$.jsxs)(`div`,{className:`flex gap-3`,children:[(0,$.jsx)(M,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:r.setupTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r.setupHint}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:x.blockers.map(Fe)}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[x.recoveryActions.map(e=>(0,$.jsxs)(`a`,{href:`#${e.href}`,className:`inline-flex min-h-11 items-center rounded-lg border border-accent/30 px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.configure,` · `,e.capability]},e.capability)),x.degradedAction?(0,$.jsx)(Y,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(_,`degraded_start`),children:r.degradedStart}):null]})]})]})}):null,t[65]=i,t[66]=r.configure,t[67]=r.degradedStart,t[68]=r.setupHint,t[69]=r.setupTitle,t[70]=o,t[71]=_,t[72]=x,t[73]=T):T=t[73];let E;t[74]!==i||t[75]!==r.start||t[76]!==o||t[77]!==_?(E=_.actions.canStart?(0,$.jsxs)(Y,{type:`button`,variant:`primary`,className:`min-h-11`,disabled:i,onClick:()=>o(_,`start`),children:[(0,$.jsx)(N,{className:`size-4`,"aria-hidden":!0}),r.start]}):null,t[74]=i,t[75]=r.start,t[76]=o,t[77]=_,t[78]=E):E=t[78];let D;t[79]!==i||t[80]!==r.discuss||t[81]!==o||t[82]!==_?(D=_.actions.canDiscuss?(0,$.jsxs)(Y,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(_,`discuss`),children:[(0,$.jsx)(O,{className:`size-4`,"aria-hidden":!0}),r.discuss]}):null,t[79]=i,t[80]=r.discuss,t[81]=o,t[82]=_,t[83]=D):D=t[83];let k;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(j,{className:`size-4`,"aria-hidden":!0}),t[84]=k):k=t[84];let A;t[85]!==i||t[86]!==r.refresh||t[87]!==a?(A=(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`min-h-11`,disabled:i,onClick:a,title:r.refresh,children:[k,r.refresh]}),t[85]=i,t[86]=r.refresh,t[87]=a,t[88]=A):A=t[88];let P;t[89]===r.feedback?P=t[90]:(P=(0,$.jsx)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center rounded-lg px-3 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.feedback}),t[89]=r.feedback,t[90]=P);let F;t[91]===r.alreadyDone?F=t[92]:(F=[`already_done`,r.alreadyDone],t[91]=r.alreadyDone,t[92]=F);let I;t[93]===r.irrelevant?I=t[94]:(I=[`irrelevant`,r.irrelevant],t[93]=r.irrelevant,t[94]=I);let L;t[95]===r.later?L=t[96]:(L=[`too_early`,r.later],t[95]=r.later,t[96]=L);let R;t[97]===r.sourceIncorrect?R=t[98]:(R=[`source_incorrect`,r.sourceIncorrect],t[97]=r.sourceIncorrect,t[98]=R);let z;t[99]===r.lessLikeThis?z=t[100]:(z=[`less_like_this`,r.lessLikeThis],t[99]=r.lessLikeThis,t[100]=z);let B;t[101]!==F||t[102]!==I||t[103]!==L||t[104]!==R||t[105]!==z?(B=[F,I,L,R,z],t[101]=F,t[102]=I,t[103]=L,t[104]=R,t[105]=z,t[106]=B):B=t[106];let V=B,H;t[107]!==i||t[108]!==s||t[109]!==_||t[110]!==V?(H=(0,$.jsx)(`div`,{className:`absolute right-0 z-20 mt-1 w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-float`,children:V.map(e=>{let[t,n]=e;return(0,$.jsx)(`button`,{type:`button`,disabled:i,className:`min-h-10 w-full rounded-lg px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>s(_,t),children:n},t)})}),t[107]=i,t[108]=s,t[109]=_,t[110]=V,t[111]=H):H=t[111];let U;t[112]!==P||t[113]!==H?(U=(0,$.jsxs)(`details`,{className:`relative ml-auto`,children:[P,H]}),t[112]=P,t[113]=H,t[114]=U):U=t[114];let W;t[115]!==D||t[116]!==A||t[117]!==U||t[118]!==E?(W=(0,$.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-2`,children:[E,D,A,U]}),t[115]=D,t[116]=A,t[117]=U,t[118]=E,t[119]=W):W=t[119];let G;t[120]!==W||t[121]!==C||t[122]!==w||t[123]!==T?(G=(0,$.jsxs)(`div`,{className:`px-5 py-5 sm:px-6`,children:[C,w,T,W]}),t[120]=W,t[121]=C,t[122]=w,t[123]=T,t[124]=G):G=t[124];let K;t[125]!==i||t[126]!==r.alternatives||t[127]!==h||t[128]!==_.id?(K=h.length>1?(0,$.jsxs)(`div`,{className:`border-t border-edge-subtle px-5 py-4 sm:px-6`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:r.alternatives}),(0,$.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:h.filter(e=>e.id!==_.id).map(e=>(0,$.jsx)(`button`,{type:`button`,disabled:i,className:`min-h-10 rounded-lg border border-edge px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>p(e.id),children:e.title},e.id))})]}):null,t[125]=i,t[126]=r.alternatives,t[127]=h,t[128]=_.id,t[129]=K):K=t[129];let q;return t[130]!==r.aiLabel||t[131]!==G||t[132]!==K?(q=(0,$.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base`,"aria-label":r.aiLabel,children:[G,K]}),t[130]=r.aiLabel,t[131]=G,t[132]=K,t[133]=q):q=t[133],q}function Fe(e){return(0,$.jsx)(`li`,{children:e.message},`${e.kind}:${e.capability}`)}var Ie=new Set([`started`,`discussing`,`completed`]);function Le(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[0,1,2].map(Re)}),e[0]=t):t=e[0],t}function Re(e){return(0,$.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-edge-subtle p-4`,children:[(0,$.jsx)(I,{className:`h-4 w-24 rounded`}),(0,$.jsx)(I,{className:`h-5 w-4/5 rounded`}),(0,$.jsx)(I,{className:`h-4 w-3/5 rounded`})]},e)}function ze(e){let t=(0,Z.c)(11),{open:n,refreshKey:r,onOpenChange:i,onReevaluate:a}=e,o=l(Be),s=u(o).projectsPage.home,v=c(),[b,x]=(0,Q.useState)(`all`),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[0]=S):S=t[0];let[E,O]=(0,Q.useState)(S),[k,A]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(),F;t[1]===n?F=t[2]:(F=()=>{if(!n)return;let e=!0;return A(!0),N(void 0),V().then(t=>{e&&O(t.items)}).catch(t=>{e&&N(t instanceof Error?t.message:String(t))}).finally(()=>{e&&A(!1)}),()=>{e=!1}},t[1]=n,t[2]=F);let I;t[3]!==n||t[4]!==r?(I=[n,r],t[3]=n,t[4]=r,t[5]=I):I=t[5],(0,Q.useEffect)(F,I);let L=E.filter(e=>b===`all`||(b===`adopted`?Ie.has(e.status):!Ie.has(e.status))),R=new Intl.DateTimeFormat(o===`zh`?`zh-CN`:`en`,{dateStyle:`medium`}),z=new Intl.DateTimeFormat(o===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),B=new Map;for(let e of L){let t=R.format(new Date(e.updatedAt));B.set(t,[...B.get(t)??[],e])}let H=[...B.entries()],U=e=>e.feedbackKind===`already_done`?s.advisorHistoryStatusCompleted:e.feedbackKind===`irrelevant`?s.advisorHistoryStatusIrrelevant:e.feedbackKind===`source_incorrect`?s.advisorHistoryStatusSourceIncorrect:e.feedbackKind===`less_like_this`?s.advisorHistoryStatusLessLikeThis:{available:s.advisorHistoryStatusAvailable,started:s.advisorHistoryStatusStarted,discussing:s.advisorHistoryStatusDiscussing,completed:s.advisorHistoryStatusCompleted,snoozed:s.advisorHistoryStatusSnoozed,dismissed:s.advisorHistoryStatusDismissed,expired:s.advisorHistoryStatusExpired,superseded:s.advisorHistoryStatusSuperseded}[e.status],W=e=>{if(e.href){i(!1),v(D(`/`,e.href));return}e.status===`discussing`&&(i(!1),v(`/chat/new?${new URLSearchParams({draft:e.opportunity.actionPrompt}).toString()}`))},G;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsx)(d,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[6]=G):G=t[6];let K;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(T,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),t[7]=K):K=t[7];let q;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(P,{className:`size-4`,"aria-hidden":!0}),t[8]=q):q=t[8];let J=k?(0,$.jsx)(Le,{}):M?(0,$.jsxs)(`div`,{className:`rounded-xl border border-danger/25 bg-danger-soft p-4 text-sm text-danger`,children:[(0,$.jsx)(`p`,{children:s.advisorHistoryLoadFailed}),(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`mt-2`,onClick:()=>i(!1),children:s.advisorHistoryClose})]}):H.length===0?(0,$.jsxs)(`div`,{className:`py-16 text-center`,children:[(0,$.jsx)(T,{className:`mx-auto size-6 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:s.advisorHistoryEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:s.advisorHistoryEmptyHint})]}):(0,$.jsx)(`div`,{className:`space-y-6`,children:H.map(e=>{let[t,n]=e;return(0,$.jsxs)(`section`,{"aria-label":t,children:[(0,$.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-subtle`,children:t}),(0,$.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>{let t=!!e.href||e.status===`discussing`,n=[`snoozed`,`dismissed`,`expired`,`superseded`].includes(e.status);return(0,$.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-accent`,children:U(e)}),(0,$.jsx)(`h4`,{className:`mt-1.5 text-sm font-semibold leading-5 text-fg`,children:e.opportunity.title}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.opportunity.outcome})]}),(0,$.jsx)(`time`,{className:`shrink-0 text-[11px] text-fg-subtle`,dateTime:new Date(e.updatedAt).toISOString(),children:z.format(new Date(e.updatedAt))})]}),e.snoozedUntil?(0,$.jsxs)(`p`,{className:`mt-2 inline-flex items-center gap-1 text-xs text-fg-muted`,children:[(0,$.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),s.advisorHistoryReturnsAt,` `,z.format(new Date(e.snoozedUntil))]}):null,(0,$.jsxs)(`details`,{className:`group mt-3`,children:[(0,$.jsxs)(`summary`,{className:`flex min-h-8 cursor-pointer list-none items-center gap-1 text-xs font-medium text-fg-muted hover:text-fg`,children:[s.advisorHistoryEvidence,(0,$.jsx)(y,{className:`size-3.5 transition-transform duration-200 group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,$.jsx)(ke,{opportunity:e.opportunity,onOpen:()=>i(!1)})]}),t||n?(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[t?(0,$.jsxs)(Y,{type:`button`,variant:`secondary`,className:`min-h-9 text-xs`,onClick:()=>W(e),children:[(0,$.jsx)(w,{className:`size-3.5`,"aria-hidden":!0}),e.status===`discussing`?s.advisorHistoryContinueDiscussion:s.advisorHistoryViewProgress]}):null,n?(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`min-h-9 text-xs`,onClick:()=>{i(!1),a()},children:[(0,$.jsx)(j,{className:`size-3.5`,"aria-hidden":!0}),s.advisorHistoryReevaluate]}):null]}):null]},e.opportunity.id)})})]},t)})}),ee;return t[9]===J?ee=t[10]:(ee=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:J}),t[9]=J,t[10]=ee),(0,$.jsx)(_,{open:n,onOpenChange:i,children:(0,$.jsxs)(m,{children:[G,(0,$.jsxs)(h,{className:`xopc-drawer-right fixed right-0 top-0 z-[90] flex size-full max-w-lg flex-col overflow-hidden border-l border-edge bg-surface-overlay shadow-popover outline-none`,"aria-describedby":`home-advisor-history-description`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start gap-3 border-b border-edge px-5 py-4`,children:[K,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(g,{className:`text-base font-semibold text-fg`,children:s.advisorHistoryTitle}),(0,$.jsx)(f,{id:`home-advisor-history-description`,className:`mt-1 text-xs leading-5 text-fg-muted`,children:s.advisorHistoryDescription})]}),(0,$.jsx)(p,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`-mr-2 size-9 shrink-0 p-0`,"aria-label":s.advisorHistoryClose,children:q})})]}),(0,$.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-5 py-3`,children:(0,$.jsx)(_e,{className:`inline-flex rounded-lg bg-surface-inset p-1`,role:`group`,"aria-label":s.advisorHistoryFilterLabel,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[[`all`,s.advisorHistoryFilterAll],[`adopted`,s.advisorHistoryFilterAdopted],[`other`,s.advisorHistoryFilterOther]].map(e=>{let[t,n]=e;return(0,$.jsx)(`button`,{type:`button`,className:`min-h-9 rounded-md px-3 text-xs font-medium transition-colors duration-150 ${b===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`}`,"aria-pressed":b===t,onClick:()=>x(t),children:n},t)})})}),ee]})]})})}function Be(e){return e.language}function Ve(e,t){return e.replace(`{{count}}`,String(t))}function He(e,t){if(e.state===`disabled`)return null;if(e.state===`ready`){let n=1+e.alternatives.length;return{label:Ve(t.ready,n),detail:e.primary.title,tone:`accent`,refreshing:!!e.stale}}return e.state===`clarification`?{label:t.clarification,detail:e.question.question,tone:`accent`,refreshing:!1}:e.state===`refreshing`?{label:t.refreshing,detail:e.previous?.title??t.refreshingDetail,tone:`accent`,refreshing:!0}:e.reason===`generation_failed`?{label:t.generationFailed,detail:t.generationFailedDetail,tone:`danger`,refreshing:!1}:e.reason===`budget_exhausted`?{label:t.budgetExhausted,detail:t.budgetExhaustedDetail,tone:`warning`,refreshing:!1}:e.reason===`model_unavailable`?{label:t.modelUnavailable,detail:t.modelUnavailableDetail,tone:`warning`,refreshing:!1}:{label:t.idle,detail:t.idleDetail,tone:`neutral`,refreshing:!1}}var Ue={accent:`bg-accent`,danger:`bg-danger`,neutral:`bg-fg-subtle`,warning:`bg-warning`};function We(e){let t=(0,Z.c)(50),{advisor:n,busy:r,copy:i,onOpenHistory:a,onRefresh:o}=e,[s,c]=(0,Q.useState)(!1),l;t[0]!==n||t[1]!==i?(l=He(n,i),t[0]=n,t[1]=i,t[2]=l):l=t[2];let u=l;if(!u)return null;let d=n.state!==`refreshing`,f=n.state===`ready`?i.findAnother:i.retry,p=`${i.label}:${u.label}`,m;t[3]===u.refreshing?m=t[4]:(m=u.refreshing?(0,$.jsx)(j,{className:`size-3.5 shrink-0 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,$.jsx)(N,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[3]=u.refreshing,t[4]=m);let h=Ue[u.tone],g;t[5]===h?g=t[6]:(g=F(`size-1.5 shrink-0 rounded-full`,h),t[5]=h,t[6]=g);let _;t[7]===g?_=t[8]:(_=(0,$.jsx)(`span`,{className:g,"aria-hidden":!0}),t[7]=g,t[8]=_);let v;t[9]!==i.label||t[10]!==u.label?(v=(0,$.jsxs)(`span`,{className:`truncate`,children:[i.label,` · `,u.label]}),t[9]=i.label,t[10]=u.label,t[11]=v):v=t[11];let y;t[12]!==p||t[13]!==m||t[14]!==_||t[15]!==v?(y=(0,$.jsx)(se,{asChild:!0,children:(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-9 max-w-56 rounded-lg px-2.5`,"aria-label":p,children:[m,_,v]})}),t[12]=p,t[13]=m,t[14]=_,t[15]=v,t[16]=y):y=t[16];let b;t[17]===u.refreshing?b=t[18]:(b=(0,$.jsx)(`span`,{className:`mt-1 flex size-7 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:u.refreshing?(0,$.jsx)(j,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,$.jsx)(N,{className:`size-4`,"aria-hidden":!0})}),t[17]=u.refreshing,t[18]=b);let x;t[19]===u.label?x=t[20]:(x=(0,$.jsx)(`p`,{className:`font-semibold text-fg`,children:u.label}),t[19]=u.label,t[20]=x);let S;t[21]===u.detail?S=t[22]:(S=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:u.detail}),t[21]=u.detail,t[22]=S);let C;t[23]!==x||t[24]!==S?(C=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]}),t[23]=x,t[24]=S,t[25]=C):C=t[25];let w;t[26]!==C||t[27]!==b?(w=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[b,C]}),t[26]=C,t[27]=b,t[28]=w):w=t[28];let E;t[29]===a?E=t[30]:(E=()=>{c(!1),a()},t[29]=a,t[30]=E);let D;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(T,{className:`size-3.5`,"aria-hidden":!0}),t[31]=D):D=t[31];let O;t[32]!==i.history||t[33]!==E?(O=(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:E,children:[D,i.history]}),t[32]=i.history,t[33]=E,t[34]=O):O=t[34];let k;t[35]!==r||t[36]!==d||t[37]!==o||t[38]!==f?(k=d?(0,$.jsxs)(Y,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg text-xs`,disabled:r,onClick:()=>{c(!1),o()},children:[(0,$.jsx)(j,{className:`size-3.5`,"aria-hidden":!0}),f]}):null,t[35]=r,t[36]=d,t[37]=o,t[38]=f,t[39]=k):k=t[39];let A;t[40]!==O||t[41]!==k?(A=(0,$.jsxs)(`div`,{className:`mt-4 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:[O,k]}),t[40]=O,t[41]=k,t[42]=A):A=t[42];let M;t[43]!==w||t[44]!==A?(M=(0,$.jsx)(ie,{children:(0,$.jsxs)(ae,{side:`bottom`,align:`end`,sideOffset:6,className:`z-[70] w-[min(21rem,calc(100vw-1.5rem))] rounded-xl border border-edge bg-surface-overlay p-4 text-sm text-fg shadow-popover outline-none`,onOpenAutoFocus:Ge,children:[w,A]})}),t[43]=w,t[44]=A,t[45]=M):M=t[45];let P;return t[46]!==s||t[47]!==M||t[48]!==y?(P=(0,$.jsxs)(oe,{open:s,onOpenChange:c,children:[y,M]}),t[46]=s,t[47]=M,t[48]=y,t[49]=P):P=t[49],P}function Ge(e){return e.preventDefault()}async function Ke(e,t=`en`){let n=await te(e),r=n.runs.filter(e=>!e.parentRunId).sort((e,t)=>t.queuedAt-e.queuedAt)[0];if(!n.allowedCommands.includes(`start`)||r?.status!==`failed`)throw Error(t===`zh`?`任务状态已变化,暂时无法重试。请刷新并查看当前状态。`:`Task is no longer available for retry. Refresh and review its current state.`);await W(e,{type:`start`,executor:L.parse({...r.executorRef,kind:r.executorKind})},n.task.version)}function qe(e){let t=e.runs.filter(e=>!e.parentRunId).sort((e,t)=>t.queuedAt-e.queuedAt)[0],n=e.conversation?.currentExecutorAgentId??e.task.delegateAgentId,r=n?{kind:`agent`,agentId:n}:t?{...t.executorRef,kind:t.executorKind}:void 0,i=L.safeParse(r);return i.success?i.data:void 0}var Je=(0,Q.lazy)(()=>i(()=>import(`./workspace-file-preview-dialog-CS8-ZbVG.js`).then(e=>e.n).then(e=>({default:e.WorkspaceFilePreviewPanel})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74])));function Ye({taskId:e,language:t,onComplete:n,onUpdated:r}){let i=t===`zh`,o=a(),c=`${o.pathname}${o.search}`,[l,u]=(0,Q.useState)(),[f,p]=(0,Q.useState)(),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(),[S,C]=(0,Q.useState)(!1),w=(0,Q.useRef)(!1),T=(0,Q.useRef)(0),[D,O]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{u(void 0),x(void 0)},[e]),(0,Q.useEffect)(()=>{let t=!0,n=++T.current;return p(void 0),te(e).then(e=>{t&&n===T.current&&!w.current&&u(e)}).catch(e=>{t&&n===T.current&&p(e instanceof Error?e.message:String(e))}),()=>{t=!1}},[e,D]),(0,Q.useEffect)(()=>{let t=()=>{w.current||O(e=>e+1)},n=n=>{n.detail?.taskId===e&&t()};return window.addEventListener(`task-changed-v2`,n),window.addEventListener(`focus`,t),window.addEventListener(`realtime-gap`,t),window.addEventListener(`gateway-realtime-connected`,t),()=>{window.removeEventListener(`task-changed-v2`,n),window.removeEventListener(`focus`,t),window.removeEventListener(`realtime-gap`,t),window.removeEventListener(`gateway-realtime-connected`,t)}},[e]);let k=l?de(l):[],A=l?.task.phase===`review`&&l.allowedCommands.includes(`close`)&&l.waits.length===0&&k.length>0&&k.every(e=>e.status===`passed`),j=l?qe(l):void 0,M=l?.allowedCommands.includes(`start`)&&l.waits.length===0&&j,N=e=>{T.current++,u(e),r?.(e)};async function P(e,t,r=!1){if(!w.current){w.current=!0,T.current++,C(!0),p(void 0);try{N(await e()),x(t),r&&n()}catch(e){p(e instanceof Error?e.message:String(e))}finally{w.current=!1,C(!1)}}}let F=l?.receipts.filter(e=>l.runs.some(t=>t.id===e.runId&&t.contractVersion===l.task.latestContractVersion)).sort((e,t)=>t.finalizedAt-e.finalizedAt)[0],L=k.filter(e=>e.status===`passed`).length,z=k.filter(e=>e.status===`failed`).length,B=k.length-L-z,V=l?.task.contract?.acceptancePolicy===`verified_auto`,H=E(c,e);return(0,$.jsxs)(`section`,{className:`mt-4 space-y-4 rounded-xl border border-edge bg-surface-panel p-4`,"aria-label":i?`任务结果与处理`:`Task result and actions`,"aria-busy":S,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i?`执行结果`:`Result`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Y,{variant:`ghost`,disabled:S,onClick:()=>O(e=>e+1),children:i?`刷新状态`:`Refresh status`}),(0,$.jsx)(s,{to:H,className:`inline-flex min-h-9 items-center text-xs font-medium text-accent-fg hover:underline`,children:i?`查看任务详情`:`Task details`})]})]}),f?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:f}):null,S?(0,$.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:i?`正在处理…`:`Processing…`}):null,b?(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-success`,children:b}):null,!l&&!f?(0,$.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,$.jsx)(I,{className:`h-5 w-1/3`}),(0,$.jsx)(I,{className:`h-24 w-full`})]}):null,l?(0,$.jsxs)($.Fragment,{children:[F?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:F.completionVerdict===`achieved`?i?`执行报告已达成目标,请结合依据逐项验收。`:`The run reports the goal achieved. Review the evidence before accepting.`:i?`当前为阶段性结果,尚有工作需要推进。`:`This is a partial result. More work is needed.`}),(0,$.jsx)(X,{content:F.summary,contentKey:`home:${e}:result:${F.runId}`,language:t,previewHeight:180}),F.remainingWork.length>0?(0,$.jsxs)(`div`,{className:`text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:i?`尚待完成`:`Remaining work`}),(0,$.jsx)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5`,children:F.remainingWork.map((e,t)=>(0,$.jsx)(`li`,{children:e},t))})]}):null,F.nextAction?(0,$.jsxs)(`p`,{className:`whitespace-pre-wrap text-sm text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i?`下一步:`:`Next step: `}),F.nextAction]}):null,F.judgment?(0,$.jsxs)(`div`,{className:`space-y-1 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:i?`判断依据`:`Assessment`}),(0,$.jsx)(`p`,{children:F.judgment.recommendation}),(0,$.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:F.judgment.reasons.map((e,t)=>(0,$.jsx)(`li`,{children:e},t))}),F.judgment.uncertainty?(0,$.jsxs)(`p`,{children:[i?`待确认:`:`Uncertainty: `,F.judgment.uncertainty]}):null]}):null,(0,$.jsx)(Ce,{evidence:F.evidence,projectId:l.task.projectId,conversationId:l.conversation?.activeConversationId,language:t,onOpenFile:y})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i?`当前任务版本暂无执行结果,可先处理等待事项或查看执行进度。`:`No result for the current task version. Resolve pending items or view progress.`}),k.length>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`h3`,{className:`text-sm font-semibold text-fg`,children:[i?`验收条件`:`Acceptance criteria`,` `,(0,$.jsxs)(`span`,{className:`font-normal text-fg-muted`,children:[L,`/`,k.length]})]}),k.map((n,r)=>(0,$.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle pt-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 text-sm text-fg`,children:[(0,$.jsx)(`p`,{className:`break-words`,children:n.text}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:i?{passed:`已通过`,failed:`未通过`,unverified:`待判定`}[n.status]:{passed:`Passed`,failed:`Failed`,unverified:`Not reviewed`}[n.status]})]}),l.task.phase===`review`&&!V?(0,$.jsx)(`div`,{className:`flex gap-2`,children:[`passed`,`failed`].map(t=>(0,$.jsx)(Y,{variant:`secondary`,disabled:S||n.status===t,onClick:()=>void P(()=>R(e,r,t,l.task.version,l.task.latestContractVersion),i?`判定已保存。`:`Review saved.`),children:i?t===`passed`?`确认通过`:`未通过`:t===`passed`?`Mark passed`:`Mark failed`},t))}):null]}),n.note?(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.note}):null,n.review?.note?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.review.note}):null,(0,$.jsx)(Ce,{evidence:n.evidence,projectId:l.task.projectId,conversationId:l.conversation?.activeConversationId,language:t,onOpenFile:y})]},r))]}):null,l.waits.length>0?(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i?`等待处理`:`Pending items`}),l.waits.map(t=>(0,$.jsx)(`div`,{children:l.allowedCommands.includes(`resolve_wait`)&&(t.kind===`user_input`||t.kind===`approval`&&typeof t.condition.capability==`string`)&&t.condition.type!==`connection`?(0,$.jsx)(Se,{wait:t,detail:l,zh:i,onUpdated:N}):(0,$.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{children:t.reason}),t.kind===`paused`&&l.allowedCommands.includes(`resolve_wait`)?(0,$.jsx)(Y,{className:`mt-2`,disabled:S,onClick:()=>void P(()=>W(e,{type:`resolve_wait`,waitId:t.id},l.task.version),i?`已解除暂停,任务状态已更新。`:`Pause resolved. Task status updated.`),children:i?`恢复任务`:`Resume task`}):(0,$.jsx)(s,{to:typeof t.condition.dependsOnTaskId==`string`?E(c,t.condition.dependsOnTaskId):H,className:`mt-2 inline-flex min-h-9 items-center text-accent-fg hover:underline`,children:i?`查看并处理`:`View and resolve`})]})},t.id))]}):null,l.task.phase===`review`&&!A?(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:i?`尚有 ${B} 项待判定、${z} 项未通过、${l.waits.length} 项等待处理。${V?`此任务需要执行验证;请继续执行以补齐依据和未完成项。`:`查看依据后逐项判定;未通过时可继续执行修正。`}`:`${B} unreviewed, ${z} failed, ${l.waits.length} pending items. ${V?`This task requires execution verification. Continue execution to supply missing evidence.`:`Review the evidence and mark each criterion; continue execution to fix failures.`}`}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[l.task.phase===`review`?(0,$.jsx)(Y,{variant:`primary`,disabled:S||!A,onClick:()=>void P(()=>W(e,{type:`close`,resolution:`done`},l.task.version),i?`任务已验收完成。`:`Task accepted.`,!0),children:i?`验收完成`:`Accept task`}):null,M?(0,$.jsx)(Y,{variant:A?`secondary`:`primary`,disabled:S,onClick:()=>void P(()=>W(e,{type:`start`,executor:j},l.task.version),i?`已开始执行,结果将自动更新。`:`Execution started. Results will update automatically.`),children:i?F?`继续执行并验证`:`开始执行`:F?`Continue and verify`:`Start execution`}):null]})]}):null,l&&v?(0,$.jsx)(_,{open:!0,onOpenChange:e=>{e||y(null)},children:(0,$.jsxs)(m,{children:[(0,$.jsx)(d,{className:`fixed inset-0 z-[80] bg-scrim`}),(0,$.jsxs)(h,{className:`app-main-surface fixed left-1/2 top-1/2 z-[90] flex h-[min(54rem,calc(100dvh-2rem))] w-[min(72rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel outline-none`,"aria-describedby":void 0,children:[(0,$.jsxs)(g,{className:`sr-only`,children:[i?`交付物预览`:`Artifact preview`,` · `,v]}),(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsxs)(`div`,{className:`flex-1 space-y-3 p-4`,"aria-busy":!0,children:[(0,$.jsx)(I,{className:`h-9 w-full`}),(0,$.jsx)(I,{className:`h-64 w-full`})]}),children:(0,$.jsx)(Je,{filePath:v,projectId:l.task.projectId,conversationId:l.conversation?.activeConversationId,onClose:()=>y(null)})})]})]})}):null]})}function Xe(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Ze(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`space-y-8`,"aria-busy":!0,children:[(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(I,{className:`h-10 w-3/5 rounded-xl`}),(0,$.jsx)(I,{className:`h-5 w-4/5 rounded-lg`})]}),(0,$.jsx)(I,{className:`h-64 rounded-2xl`}),(0,$.jsx)(I,{className:`h-32 rounded-xl`})]}),e[0]=t):t=e[0],t}function Qe(e){let t=(0,Z.c)(61),{item:n,busy:r,recommendationLabel:i,dueLabel:a,failureLabel:s,locale:c,onAction:l,onComplete:u,onUpdated:d}=e,[f,p]=o(),m;t[0]===n.openAction?m=t[1]:(m=n.openAction?.type===`open`?/^\/tasks\/([^/?#]+)/.exec(n.openAction.href):null,t[0]=n.openAction,t[1]=m);let h=m,g=n.primaryAction?.type===`task_review`?n.primaryAction.taskId:h?decodeURIComponent(h[1]):void 0,_;t[2]!==g||t[3]!==f?(_=g&&f.get(`reviewTask`)===g,t[2]=g,t[3]=f,t[4]=_):_=t[4];let v=!!_,y;t[5]!==g||t[6]!==f||t[7]!==p?(y=e=>{let t=new URLSearchParams(f);e&&g?t.set(`reviewTask`,g):t.delete(`reviewTask`),p(t)},t[5]=g,t[6]=f,t[7]=p,t[8]=y):y=t[8];let b=y,x;t[9]!==a||t[10]!==n.dueAt||t[11]!==c?(x=n.dueAt?`${a} ${be(new Date(n.dueAt),c)}`:null,t[9]=a,t[10]=n.dueAt,t[11]=c,t[12]=x):x=t[12];let S=x,C=n.kind===`failure`?s:S,w;t[13]===C?w=t[14]:(w=C?(0,$.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-medium text-warning`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-warning`,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:C})]}):null,t[13]=C,t[14]=w);let T=!n.openAction,E;t[15]!==n.id||t[16]!==n.openAction||t[17]!==l?(E=()=>n.openAction&&l(n.openAction,n.id),t[15]=n.id,t[16]=n.openAction,t[17]=l,t[18]=E):E=t[18];let D;t[19]===n.title?D=t[20]:(D=(0,$.jsx)(`span`,{className:`block text-lg font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[19]=n.title,t[20]=D);let O;t[21]===n.summary?O=t[22]:(O=(0,$.jsx)(`span`,{className:`mt-1.5 block text-sm leading-6 text-fg-muted`,children:n.summary}),t[21]=n.summary,t[22]=O);let k;t[23]!==T||t[24]!==E||t[25]!==D||t[26]!==O?(k=(0,$.jsxs)(`button`,{type:`button`,className:`block w-full text-left outline-none focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:T,onClick:E,children:[D,O]}),t[23]=T,t[24]=E,t[25]=D,t[26]=O,t[27]=k):k=t[27];let A;t[28]!==n.recommendation||t[29]!==i?(A=n.recommendation?(0,$.jsxs)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:[(0,$.jsxs)(`span`,{className:`font-semibold text-fg`,children:[i,`:`]}),n.recommendation]}):null,t[28]=n.recommendation,t[29]=i,t[30]=A):A=t[30];let j;t[31]!==r||t[32]!==n.id||t[33]!==n.primaryAction||t[34]!==n.secondaryActions||t[35]!==l||t[36]!==v||t[37]!==g||t[38]!==b?(j=n.primaryAction||n.secondaryActions.length>0?(0,$.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[n.primaryAction?(0,$.jsx)(Y,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3.5 text-xs`,disabled:r,"aria-expanded":g&&[`task_review`,`open`].includes(n.primaryAction.type)?v:void 0,onClick:()=>g&&[`task_review`,`open`].includes(n.primaryAction.type)?b(!v):l(n.primaryAction,n.id),children:n.primaryAction.label}):null,n.secondaryActions.map(e=>(0,$.jsx)(Y,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3.5 text-xs shadow-none`,disabled:r,onClick:()=>l(e,n.id),children:e.label},`${e.type}:${e.label}`))]}):null,t[31]=r,t[32]=n.id,t[33]=n.primaryAction,t[34]=n.secondaryActions,t[35]=l,t[36]=v,t[37]=g,t[38]=b,t[39]=j):j=t[39];let M;t[40]!==n.primaryAction?.type||t[41]!==c||t[42]!==v||t[43]!==g||t[44]!==b?(M=g&&n.primaryAction?.type===`retry_task`?(0,$.jsx)(Y,{variant:`ghost`,className:`mt-2`,"aria-expanded":v,onClick:()=>b(!v),children:c===`zh`?`查看结果与依据`:`View result and evidence`}):null,t[40]=n.primaryAction?.type,t[41]=c,t[42]=v,t[43]=g,t[44]=b,t[45]=M):M=t[45];let N;t[46]!==c||t[47]!==u||t[48]!==d||t[49]!==v||t[50]!==g||t[51]!==b?(N=v&&g?(0,$.jsx)(Ye,{taskId:g,language:c,onUpdated:d,onComplete:()=>{b(!1),u()}},g):null,t[46]=c,t[47]=u,t[48]=d,t[49]=v,t[50]=g,t[51]=b,t[52]=N):N=t[52];let P;return t[53]!==r||t[54]!==k||t[55]!==A||t[56]!==j||t[57]!==M||t[58]!==N||t[59]!==w?(P=(0,$.jsxs)(`article`,{className:`px-5 py-5 sm:px-6 sm:py-6`,"aria-busy":r,children:[w,k,A,j,M,N]}),t[53]=r,t[54]=k,t[55]=A,t[56]=j,t[57]=M,t[58]=N,t[59]=w,t[60]=P):P=t[60],P}function $e(e){let t=(0,Z.c)(38),{item:n,onAction:r,language:i,onUpdated:a}=e,[o,s]=(0,Q.useState)(!1),c;t[0]===n.openAction?c=t[1]:(c=n.openAction?.type===`open`?/^\/tasks\/([^/?#]+)/.exec(n.openAction.href):null,t[0]=n.openAction,t[1]=c);let l=c,u=l?decodeURIComponent(l[1]):void 0,d;t[2]===n.kind?d=t[3]:(d=n.kind===`scheduled`?(0,$.jsx)(v,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-fg-subtle`,"aria-hidden":!0}),t[2]=n.kind,t[3]=d);let f=d,p=!n.openAction,m=u?o:void 0,h;t[4]!==n.id||t[5]!==n.openAction||t[6]!==r||t[7]!==u?(h=()=>u?s(et):n.openAction&&r(n.openAction,n.id),t[4]=n.id,t[5]=n.openAction,t[6]=r,t[7]=u,t[8]=h):h=t[8];let g;t[9]===f?g=t[10]:(g=(0,$.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-fg-subtle`,children:f}),t[9]=f,t[10]=g);let _;t[11]===n.title?_=t[12]:(_=(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.title}),t[11]=n.title,t[12]=_);let y;t[13]===n.summary?y=t[14]:(y=(0,$.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.summary}),t[13]=n.summary,t[14]=y);let x;t[15]!==_||t[16]!==y?(x=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,y]}),t[15]=_,t[16]=y,t[17]=x):x=t[17];let S;t[18]===n.statusLabel?S=t[19]:(S=n.statusLabel?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.statusLabel}):null,t[18]=n.statusLabel,t[19]=S);let C;t[20]===n.openAction?C=t[21]:(C=n.openAction?(0,$.jsx)(b,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[20]=n.openAction,t[21]=C);let w;t[22]!==S||t[23]!==C||t[24]!==p||t[25]!==m||t[26]!==h||t[27]!==g||t[28]!==x?(w=(0,$.jsxs)(`button`,{type:`button`,className:`flex min-h-16 w-full items-center gap-3 py-3 text-left outline-none hover:text-fg focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:p,"aria-expanded":m,onClick:h,children:[g,x,S,C]}),t[22]=S,t[23]=C,t[24]=p,t[25]=m,t[26]=h,t[27]=g,t[28]=x,t[29]=w):w=t[29];let T;t[30]!==o||t[31]!==i||t[32]!==a||t[33]!==u?(T=u&&o?(0,$.jsx)(Ye,{taskId:u,language:i,onUpdated:a,onComplete:()=>s(!1)}):null,t[30]=o,t[31]=i,t[32]=a,t[33]=u,t[34]=T):T=t[34];let E;return t[35]!==w||t[36]!==T?(E=(0,$.jsxs)(`div`,{children:[w,T]}),t[35]=w,t[36]=T,t[37]=E):E=t[37],E}function et(e){return!e}function tt(){let e=l(e=>e.language),t=u(e),n=t.projectsPage,r=ue(e),i=c(),o=a(),s=ge(e=>e.setPageHeader),v=ge(e=>e.clearPageHeader),[y,b]=(0,Q.useState)(!1),{home:S,loading:C,loadError:w,setLoadError:T,load:E}=we(e,o.key,y),[O,k]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(``),N=(0,Q.useRef)(!1),[F,I]=(0,Q.useState)(),[L,R]=(0,Q.useState)(!1),[V,W]=(0,Q.useState)(null),[G,q]=(0,Q.useState)(!1),[te,ie]=(0,Q.useState)(),[ae,oe]=(0,Q.useState)(!1),[se,ce]=(0,Q.useState)(0),[de,me]=(0,Q.useState)(),[_e,be]=(0,Q.useState)(),[xe,Se]=(0,Q.useState)(!1),X=J({chat:t.chat}),Ce=(0,Q.useRef)(null),Z=le({disabled:xe,chat:t.chat,onTranscript:e=>{M(t=>fe(t,e)),window.setTimeout(()=>Ce.current?.focus(),0)}}),{phase:Te,voiceActive:De,startVoiceInput:Oe,cancelVoiceInput:ke,confirmVoiceInput:Ae,retryVoiceInput:je}=Z;(0,Q.useEffect)(()=>{if(!de)return;let e=window.setTimeout(()=>me(void 0),8e3);return()=>window.clearTimeout(e)},[de]);let Me=(0,Q.useCallback)(async e=>{if(!(e.length===0||xe)){Se(!0);try{await X.processFiles(e)}finally{Se(!1)}}},[xe,X.processFiles]),Ne=(0,Q.useCallback)(async e=>{let t=pe(e.clipboardData);t.length!==0&&(e.preventDefault(),await Me(t))},[Me]),Fe=(0,Q.useCallback)(e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,X.setIsDragging(!0))},[X.setIsDragging]),Ie=(0,Q.useCallback)(e=>{let t=e.relatedTarget;(!(t instanceof Node)||!e.currentTarget.contains(t))&&X.setIsDragging(!1)},[X.setIsDragging]),Le=(0,Q.useCallback)(async e=>{e.preventDefault(),X.setIsDragging(!1),await Me(Array.from(e.dataTransfer.files))},[X.setIsDragging,Me]),Re=(0,Q.useCallback)(e=>{e.preventDefault();let t=X.wireAttachmentsPayload(),n=t.length>0?he(t):void 0,r=H(j,n,{projectScope:`none`});r&&(k(!1),M(``),X.clearAttachments(),i(r))},[X.clearAttachments,X.wireAttachmentsPayload,j,i]),Be=X.attachments.length>=10,Ve={attachTitle:Be?Xe(t.chat.maxAttachmentsReached,{max:10}):`${t.chat.attachFile} (${X.attachments.length}/10)`,dropFiles:t.chat.dropFiles,intentLabel:r.intentLabel,intentPlaceholder:r.intentPlaceholder,intentSuggestion:r.intentSuggestion,shortcut:n.home.submitShortcut,submit:r.newWork},He=(0,Q.useMemo)(()=>({label:n.home.advisorStatusLabel,ready:n.home.advisorStatusReady,clarification:n.home.advisorStatusClarification,refreshing:n.home.advisorStatusRefreshing,refreshingDetail:n.home.advisorRefreshing,idle:n.home.advisorStatusIdle,idleDetail:n.home.advisorUnavailableTitle,generationFailed:n.home.advisorStatusGenerationFailed,budgetExhausted:n.home.advisorStatusBudgetExhausted,modelUnavailable:n.home.advisorStatusModelUnavailable,generationFailedDetail:n.home.advisorGenerationFailed,budgetExhaustedDetail:n.home.advisorBudgetExhausted,modelUnavailableDetail:n.home.advisorModelUnavailable,history:n.home.advisorHistory,retry:n.home.retry,findAnother:n.home.advisorRefresh}),[n.home]),Ue=!!(S&&S.needsUser.length===0&&S.backgroundCount===0),Ge=!!(S&&S.needsUser.length===0),qe=Ge||O;(0,Q.useEffect)(()=>{!qe&&De&&ke()},[ke,qe,De]),(0,Q.useEffect)(()=>{let e=e=>{let t=e.detail?.target;t&&t!==`chat`||!qe||xe||(e.preventDefault(),Te===`recording`?Ae():Te===`idle`?(Ce.current?.focus(),Oe()):Te===`error`&&je())},t=e=>{let t=e.detail?.target;t&&t!==`chat`||!qe||!De||(e.preventDefault(),ke(),Ce.current?.focus())};return window.addEventListener(ye,e),window.addEventListener(ve,t),()=>{window.removeEventListener(ye,e),window.removeEventListener(ve,t)}},[xe,ke,qe,Ae,je,Oe,De,Te]);let Je=(0,Q.useCallback)(e=>{e||ke(),k(e)},[ke]),Ye=(0,Q.useCallback)((t,n)=>{if(t.type===`open`){i(D(`/`,t.href));return}t.type===`task_review`||N.current||(N.current=!0,W(n),I(void 0),T(null),(async()=>{try{if(t.type===`retry_task`)await Ke(t.taskId,e),I({message:e===`zh`?`任务已重新开始,可查看执行进度。`:`Task restarted. View progress.`,href:D(`/`,`/tasks/${encodeURIComponent(t.taskId)}`)});else if(t.type===`connector_decision`)await re({kind:`connector_approval`,approvalId:t.approvalId},t.decision),I({message:e===`zh`?t.decision===`approve`?`已批准授权,任务状态将自动更新。`:`已拒绝授权。`:t.decision===`approve`?`Permission approved. Task status will update.`:`Permission denied.`});else if(t.type===`retry_run`){let n=await B({kind:t.subjectKind,runId:t.runId});I({message:e===`zh`?`已发起重试,可查看新的执行结果。`:`Retry started. Follow the new execution.`,href:n.conversationId?`/chat/${encodeURIComponent(n.conversationId)}`:`/automations?run=${encodeURIComponent(n.runId)}`})}else t.type===`acknowledge_run`&&(await K({kind:t.subjectKind,runId:t.runId}),I({message:e===`zh`?`已确认此异常,已从待处理事项移除。`:`Issue acknowledged and removed from pending items.`}));await E()}catch(e){T(e instanceof Error?e.message:String(e))}finally{N.current=!1,W(null)}})())},[e,E,i]),et=(0,Q.useCallback)(t=>{I({message:e===`zh`?t.task.phase===`closed`?`任务已验收完成。`:`操作已保存,任务状态已更新。`:t.task.phase===`closed`?`Task accepted.`:`Action saved. Task status updated.`,href:D(`/`,`/tasks/${encodeURIComponent(t.task.id)}`)}),E()},[e,E]),tt=(0,Q.useCallback)(()=>{q(!0),ie(void 0),be(void 0),T(null),U(e).then(()=>E()).catch(e=>T(e instanceof Error?e.message:String(e))).finally(()=>q(!1))},[e,E]),nt=(0,Q.useCallback)((e,t)=>{q(!0),T(null),ee(e,t).then(async t=>{if(t.outcome===`needs_setup`){be({opportunityId:e.id,value:t.preflight});return}if(be(void 0),ce(e=>e+1),t.outcome===`task`){ie({title:n.home.advisorStartedTitle,detail:Xe(n.home.advisorStartedDetail,{title:e.title}),href:D(`/`,t.href)}),await E();return}i(t.href)}).catch(e=>T(e instanceof Error?e.message:String(e))).finally(()=>q(!1))},[E,i,n.home.advisorStartedDetail,n.home.advisorStartedTitle]),rt=(0,Q.useCallback)((e,t)=>{q(!0),ie(void 0),be(void 0),T(null),ne(e,{kind:t,snoozedUntil:t===`too_early`?Date.now()+4320*6e4:void 0}).then(({idempotencyKey:t})=>(me({opportunityId:e.id,idempotencyKey:t}),ce(e=>e+1),E())).catch(e=>T(e instanceof Error?e.message:String(e))).finally(()=>q(!1))},[E]),it=(0,Q.useCallback)(()=>{if(!de)return;let e=de;me(void 0),q(!0),T(null),z(e.opportunityId,e.idempotencyKey).then(()=>(ce(e=>e+1),E())).catch(t=>{me(e),T(t instanceof Error?t.message:String(t))}).finally(()=>q(!1))},[de,E]),at=(0,Q.useCallback)((e,t)=>{i(`/chat/new?${new URLSearchParams({draft:`${e}\n\n${t}`}).toString()}`)},[i]),ot=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[S?(0,$.jsx)(We,{advisor:S.advisor,busy:G,copy:He,onOpenHistory:()=>oe(!0),onRefresh:tt}):null,Ge?null:(0,$.jsxs)(Y,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>k(!0),children:[(0,$.jsx)(A,{className:`size-4`,"aria-hidden":!0}),r.newWork]})]}),[G,He,r.newWork,S,tt,Ge]);(0,Q.useLayoutEffect)(()=>(s({startExtra:null,main:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:ot}),()=>v()),[v,ot,s,n.title]);let st=S?.needsUser.length??0,ct=S?.backgroundCount??0,lt=st>0?Xe(n.home.attentionTitle,{count:st}):ct>0?n.home.clearTitle:n.home.idleTitle,ut=st>0?ct>0?Xe(n.home.attentionIntroWithBackground,{count:ct}):n.home.attentionIntro:ct>0?Xe(n.home.clearIntro,{count:ct}):n.home.idleIntro;return(0,$.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[920px] flex-1 flex-col px-4 pb-8 pt-3 sm:px-6 lg:px-8 lg:pb-12 lg:pt-4`,children:[(0,$.jsx)(`input`,{ref:X.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{let t=e.target.files;t&&Me(Array.from(t)),e.target.value=``}}),(0,$.jsx)(_,{open:O,onOpenChange:Je,children:(0,$.jsxs)(m,{children:[(0,$.jsx)(d,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(h,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(g,{className:`text-base font-semibold text-fg`,children:r.dialogTitle}),(0,$.jsx)(f,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r.dialogDescription})]}),(0,$.jsx)(p,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,children:(0,$.jsx)(P,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsx)(Ee,{variant:`dialog`,inputId:`new-conversation-intent`,inputRef:Ce,intent:j,labels:{...Ve,submit:r.submit},attachments:X.attachments,isDragging:X.isDragging,attachmentBusy:xe,attachmentsFull:Be,voice:Z,chat:t.chat,cancelAction:(0,$.jsx)(p,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,children:n.cancel})}),onIntentChange:M,onPickFiles:()=>X.fileInputRef.current?.click(),onRemoveAttachment:X.removeAttachment,onPaste:e=>void Ne(e),onDragOver:Fe,onDragLeave:Ie,onDrop:e=>void Le(e),onSubmit:Re})]})]})}),(0,$.jsx)(ze,{open:ae,refreshKey:se,onOpenChange:oe,onReevaluate:tt}),w?(0,$.jsxs)(`div`,{role:`alert`,className:`mb-6 flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,$.jsx)(`span`,{children:w}),(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void E(),children:n.home.retry})]}):null,F?(0,$.jsxs)(`div`,{role:`status`,className:`mb-5 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-success/25 bg-success-soft px-4 py-3 text-sm text-fg`,children:[(0,$.jsx)(`span`,{children:F.message}),F.href?(0,$.jsx)(Y,{variant:`ghost`,onClick:()=>i(F.href),children:e===`zh`?`查看进展与结果`:`View progress and result`}):null]}):null,C?(0,$.jsx)(Ze,{}):S?(0,$.jsxs)(`div`,{className:Ue?`mx-auto my-auto w-full max-w-[640px]`:`w-full`,children:[(0,$.jsxs)(`section`,{className:Ue?`w-full text-center`:`max-w-3xl`,children:[(0,$.jsx)(`h2`,{className:`text-3xl font-semibold leading-tight tracking-[-0.035em] text-fg sm:text-4xl`,children:lt}),(0,$.jsx)(`p`,{className:Ue?`mx-auto mt-3 max-w-xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`:`mt-3 max-w-2xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`,children:ut})]}),Ge?(0,$.jsx)(Ee,{variant:`inline`,inputId:`home-conversation-intent`,inputRef:Ce,intent:j,labels:Ve,attachments:X.attachments,isDragging:X.isDragging,attachmentBusy:xe,attachmentsFull:Be,voice:Z,chat:t.chat,onIntentChange:M,onPickFiles:()=>X.fileInputRef.current?.click(),onRemoveAttachment:X.removeAttachment,onPaste:e=>void Ne(e),onDragOver:Fe,onDragLeave:Ie,onDrop:e=>void Le(e),onSubmit:Re}):null,(0,$.jsx)(Pe,{advisor:S.advisor,busy:G,copy:{aiLabel:n.home.advisorAiLabel,why:n.home.advisorWhy,evidence:n.home.advisorEvidence,needsSetup:n.home.advisorNeedsSetup,start:n.home.advisorStart,discuss:n.home.advisorDiscuss,refresh:n.home.advisorRefresh,refreshing:n.home.advisorRefreshing,history:n.home.advisorHistory,viewProgress:n.home.advisorViewProgress,alternatives:n.home.advisorAlternatives,feedback:n.home.advisorFeedback,alreadyDone:n.home.advisorAlreadyDone,irrelevant:n.home.advisorIrrelevant,later:n.home.advisorLater,lessLikeThis:n.home.advisorLessLikeThis,sourceIncorrect:n.home.advisorSourceIncorrect,minutes:n.home.advisorMinutes,setupTitle:n.home.advisorSetupTitle,setupHint:n.home.advisorSetupHint,configure:n.home.advisorConfigure,degradedStart:n.home.advisorDegradedStart,automationHint:n.home.advisorAutomationHint,automationAction:n.home.advisorAutomationAction},onRefresh:tt,onAction:nt,onFeedback:rt,onClarification:at,onOpenHistory:()=>oe(!0),preflight:_e,receipt:te}),S.needsUser.length>0?(0,$.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-needs-user-title`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 px-1`,children:[(0,$.jsx)(x,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{id:`home-needs-user-title`,className:`text-sm font-semibold text-fg`,children:n.home.needsUserTitle})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base`,children:S.needsUser.map(t=>(0,$.jsx)(Qe,{item:t,busy:V!==null,recommendationLabel:n.home.recommendationLabel,dueLabel:n.home.dueLabel,failureLabel:r.runAttention,locale:e,onAction:Ye,onComplete:()=>void E(),onUpdated:et},t.id))}),y||(S.attentionPolicy?.suppressedDecisionCount??0)+(S.attentionPolicy?.suppressedAttentionCount??0)>0?(0,$.jsx)(Y,{variant:`ghost`,className:`mt-2`,"aria-expanded":y,onClick:()=>b(e=>!e),children:e===`zh`?y?`收起待处理事项`:`查看其余 ${(S.attentionPolicy?.suppressedDecisionCount??0)+(S.attentionPolicy?.suppressedAttentionCount??0)} 项待处理事项`:y?`Show fewer pending items`:`View ${(S.attentionPolicy?.suppressedDecisionCount??0)+(S.attentionPolicy?.suppressedAttentionCount??0)} more pending items`}):null]}):null,S.background.length>0?(0,$.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-background-title`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1`,children:[(0,$.jsx)(`h2`,{id:`home-background-title`,className:`text-sm font-semibold text-fg`,children:n.home.backgroundTitle}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Xe(n.home.backgroundCount,{count:S.backgroundCount})})]}),(0,$.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle border-y border-edge-subtle`,children:(L?S.background:S.background.slice(0,3)).map(t=>(0,$.jsx)($e,{item:t,language:e,onAction:Ye,onUpdated:et},t.id))}),S.background.length>3?(0,$.jsx)(Y,{variant:`ghost`,className:`mt-2`,"aria-expanded":L,onClick:()=>R(e=>!e),children:e===`zh`?L?`收起`:`查看全部 ${S.backgroundCount} 项`:L?`Show less`:`View all ${S.backgroundCount} items`}):null]}):null]}):null,de?(0,$.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-[100] flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-overlay px-4 py-3 text-sm text-fg shadow-float`,children:[(0,$.jsx)(`span`,{children:n.home.advisorFeedbackSaved}),(0,$.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:it,children:n.home.advisorUndo})]}):null]})}export{tt as HomePage};
|