@markus-global/cli 0.9.7-rc.5 → 0.9.7
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/web-ui/assets/{CommentInput-H50XI7sG.js → CommentInput-JPZATTdP.js} +1 -1
- package/dist/web-ui/assets/{ContentRenderer-CbJWw6ni.js → ContentRenderer-gaxBn1N9.js} +2 -2
- package/dist/web-ui/assets/{DeliverableShareModal-CHdOyC9c.js → DeliverableShareModal-B6qqZgFc.js} +1 -1
- package/dist/web-ui/assets/{Deliverables-B48EGVOS.js → Deliverables-BUi9KGwf.js} +1 -1
- package/dist/web-ui/assets/{Notifications-Q29_jC_0.js → Notifications-W-Mx_v6q.js} +1 -1
- package/dist/web-ui/assets/{Search-BYZ8QKgz.js → Search-Cxtd9r1S.js} +1 -1
- package/dist/web-ui/assets/{Settings-Kck8VNiS.js → Settings-Q87nTBy5.js} +1 -1
- package/dist/web-ui/assets/{Store-afxOnzIy.js → Store-BK54Nx60.js} +1 -1
- package/dist/web-ui/assets/{Team-B7UAO190.js → Team-CWRLD5sM.js} +4 -4
- package/dist/web-ui/assets/{Work-DhJSUJ8s.js → Work-xejZ7HCT.js} +1 -1
- package/dist/web-ui/assets/{arc-oi2C2tM_.js → arc-BqhlYS08.js} +1 -1
- package/dist/web-ui/assets/{architectureDiagram-3BPJPVTR-CK_H0la_.js → architectureDiagram-3BPJPVTR-C8fUeKGJ.js} +1 -1
- package/dist/web-ui/assets/{blockDiagram-GPEHLZMM-B6SjWtm1.js → blockDiagram-GPEHLZMM-eILAtQzQ.js} +1 -1
- package/dist/web-ui/assets/{c4Diagram-AAUBKEIU-DVBOL2Mr.js → c4Diagram-AAUBKEIU-DdV7TyX_.js} +1 -1
- package/dist/web-ui/assets/channel-C-TW97LX.js +1 -0
- package/dist/web-ui/assets/{chunk-2J33WTMH-p074NkEK.js → chunk-2J33WTMH-BwuewEg2.js} +1 -1
- package/dist/web-ui/assets/{chunk-4BX2VUAB-Dgt_oQ5Z.js → chunk-4BX2VUAB-Bv26FANh.js} +1 -1
- package/dist/web-ui/assets/{chunk-55IACEB6-Db-juaJ9.js → chunk-55IACEB6-DFTeZroI.js} +1 -1
- package/dist/web-ui/assets/{chunk-727SXJPM-D8nAWxeV.js → chunk-727SXJPM-i7IiTNSf.js} +1 -1
- package/dist/web-ui/assets/{chunk-AQP2D5EJ-CxZV02WA.js → chunk-AQP2D5EJ-BoPcIU1Z.js} +1 -1
- package/dist/web-ui/assets/{chunk-FMBD7UC4-B5-ZRwUd.js → chunk-FMBD7UC4-DTXl3WfT.js} +1 -1
- package/dist/web-ui/assets/{chunk-ND2GUHAM-Dhk2IHCQ.js → chunk-ND2GUHAM-DdzR-Jnl.js} +1 -1
- package/dist/web-ui/assets/{chunk-QZHKN3VN-EcAQZTUP.js → chunk-QZHKN3VN-DqSW43I1.js} +1 -1
- package/dist/web-ui/assets/classDiagram-4FO5ZUOK-C92nY4nN.js +1 -0
- package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-C92nY4nN.js +1 -0
- package/dist/web-ui/assets/{cose-bilkent-S5V4N54A-DLL4WcR1.js → cose-bilkent-S5V4N54A-C-UFRPSb.js} +1 -1
- package/dist/web-ui/assets/{dagre-BM42HDAG-DrKXWZlt.js → dagre-BM42HDAG-92ucBloh.js} +1 -1
- package/dist/web-ui/assets/{diagram-2AECGRRQ-DLOwNUpQ.js → diagram-2AECGRRQ-B8zRoWWP.js} +1 -1
- package/dist/web-ui/assets/{diagram-5GNKFQAL-BWcPBTuv.js → diagram-5GNKFQAL-CM3pWtYN.js} +1 -1
- package/dist/web-ui/assets/{diagram-KO2AKTUF-CdHvIQGV.js → diagram-KO2AKTUF-V7UmwGTe.js} +1 -1
- package/dist/web-ui/assets/{diagram-LMA3HP47-Dm80PSxk.js → diagram-LMA3HP47-DG1RtUeD.js} +1 -1
- package/dist/web-ui/assets/{diagram-OG6HWLK6-CV3Ynpw5.js → diagram-OG6HWLK6-BTwLdZJw.js} +1 -1
- package/dist/web-ui/assets/{erDiagram-TEJ5UH35-BiOoSELr.js → erDiagram-TEJ5UH35-BNXeXKHH.js} +1 -1
- package/dist/web-ui/assets/{flowDiagram-I6XJVG4X-BuBzkN5x.js → flowDiagram-I6XJVG4X-VP_sRWgd.js} +1 -1
- package/dist/web-ui/assets/{ganttDiagram-6RSMTGT7-CvPvDHVe.js → ganttDiagram-6RSMTGT7-CvnpoufX.js} +1 -1
- package/dist/web-ui/assets/{gitGraphDiagram-PVQCEYII-CmqSg9ZW.js → gitGraphDiagram-PVQCEYII-zO7DNQqQ.js} +1 -1
- package/dist/web-ui/assets/{index-B-xjev59.js → index-B1VN5yM1.js} +4 -4
- package/dist/web-ui/assets/{infoDiagram-5YYISTIA-C_griWOm.js → infoDiagram-5YYISTIA-BSGbaVLq.js} +1 -1
- package/dist/web-ui/assets/{ishikawaDiagram-YF4QCWOH-wLNhIFRK.js → ishikawaDiagram-YF4QCWOH-BatvAQOH.js} +1 -1
- package/dist/web-ui/assets/{journeyDiagram-JHISSGLW-BJUPzH74.js → journeyDiagram-JHISSGLW-Cajy4fZr.js} +1 -1
- package/dist/web-ui/assets/{kanban-definition-UN3LZRKU-C-exBcTE.js → kanban-definition-UN3LZRKU-DLpKR4E5.js} +1 -1
- package/dist/web-ui/assets/{mermaid.core-BcQakp0U.js → mermaid.core-B4fv65oQ.js} +5 -5
- package/dist/web-ui/assets/{mindmap-definition-RKZ34NQL-B7jG8seW.js → mindmap-definition-RKZ34NQL-C2HVqxfu.js} +1 -1
- package/dist/web-ui/assets/{pieDiagram-4H26LBE5-CN4AAPgP.js → pieDiagram-4H26LBE5-Bswg7SQl.js} +1 -1
- package/dist/web-ui/assets/{quadrantDiagram-W4KKPZXB-rK-x9Rbd.js → quadrantDiagram-W4KKPZXB-CyYiDqNE.js} +1 -1
- package/dist/web-ui/assets/{requirementDiagram-4Y6WPE33-XAjhwp64.js → requirementDiagram-4Y6WPE33-BWZmKUo8.js} +1 -1
- package/dist/web-ui/assets/{sankeyDiagram-5OEKKPKP-jxToLEBs.js → sankeyDiagram-5OEKKPKP-C3imZVxk.js} +1 -1
- package/dist/web-ui/assets/{sequenceDiagram-3UESZ5HK-BqiwRyol.js → sequenceDiagram-3UESZ5HK-BrySebCt.js} +1 -1
- package/dist/web-ui/assets/{stateDiagram-AJRCARHV-CiFFWJwO.js → stateDiagram-AJRCARHV-0Lp5CycE.js} +1 -1
- package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-QVZbqffU.js +1 -0
- package/dist/web-ui/assets/{timeline-definition-PNZ67QCA-CWbiUHvH.js → timeline-definition-PNZ67QCA-BIGJbkoS.js} +1 -1
- package/dist/web-ui/assets/{vennDiagram-CIIHVFJN-CwOu2L0b.js → vennDiagram-CIIHVFJN-CS9GEvPk.js} +1 -1
- package/dist/web-ui/assets/{wardley-L42UT6IY-EdI9vfy5.js → wardley-L42UT6IY-BSNtMxtd.js} +1 -1
- package/dist/web-ui/assets/{wardleyDiagram-YWT4CUSO-DZzukmtq.js → wardleyDiagram-YWT4CUSO-CaEGOjwH.js} +1 -1
- package/dist/web-ui/assets/{xychartDiagram-2RQKCTM6-BN5doc0x.js → xychartDiagram-2RQKCTM6-Cr_pwOHb.js} +1 -1
- package/dist/web-ui/index.html +1 -1
- package/package.json +1 -1
- package/dist/web-ui/assets/channel-B2Rur3o9.js +0 -1
- package/dist/web-ui/assets/classDiagram-4FO5ZUOK-DxHkl_eV.js +0 -1
- package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-DxHkl_eV.js +0 -1
- package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-C9aZNCon.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,u as T,r as a,k as ee}from"./index-B-xjev59.js";const te=1920,ne=10*1024*1024,W=5,re=.8;function se(l,u,i){return new Promise((g,f)=>{const y=new Image;y.onload=()=>{let{width:s,height:r}=y;if(s<=u&&r<=u){g(l);return}s>r?(r=Math.round(r*(u/s)),s=u):(s=Math.round(s*(u/r)),r=u);const x=document.createElement("canvas");x.width=s,x.height=r;const b=x.getContext("2d");if(!b){f(new Error("Failed to get canvas context"));return}b.drawImage(y,0,0,s,r),g(x.toDataURL("image/jpeg",i))},y.onerror=()=>f(new Error("Failed to load image")),y.src=l})}function ae({candidates:l,filter:u,anchorRef:i,onSelect:g,selectedIndex:f,onIndexChange:y}){const{t:s}=T("common"),[r,x]=a.useState(null),b=a.useRef(null),w=l.filter(d=>d.name.toLowerCase().includes(u));return a.useEffect(()=>{const d=i.current;if(!d)return;const h=d.getBoundingClientRect();x({top:h.top+window.scrollY-4,left:h.left+window.scrollX+8})},[i,u]),a.useEffect(()=>{if(!b.current||!r)return;if(b.current.getBoundingClientRect().top<8){const h=i.current;if(!h)return;const c=h.getBoundingClientRect();x({top:c.bottom+window.scrollY+4,left:r.left})}},[r,i]),a.useEffect(()=>{f>=w.length&&y(Math.max(0,w.length-1))},[w.length,f,y]),a.useEffect(()=>{if(!b.current)return;b.current.querySelector('[data-selected="true"]')?.scrollIntoView({block:"nearest"})},[f]),!r||w.length===0?null:ee.createPortal(t.jsxs("div",{ref:b,style:{position:"absolute",top:r.top,left:r.left,transform:"translateY(-100%)"},className:"w-60 bg-surface-overlay border border-border-default rounded-lg shadow-xl z-[9999] max-h-48 overflow-y-auto",children:[t.jsx("div",{className:"px-2.5 py-1.5 text-[10px] text-fg-tertiary font-medium uppercase tracking-wider border-b border-border-default",children:s("commentInput.mentionHeading")}),w.map((d,h)=>t.jsxs("button",{"data-selected":h===f,onMouseDown:c=>{c.preventDefault(),g(d)},onMouseEnter:()=>y(h),className:`w-full text-left px-3 py-2 text-xs flex items-center gap-2 transition-colors ${h===f?"bg-brand-500/15 text-brand-500":"hover:bg-surface-elevated"}`,children:[t.jsx("span",{className:`w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-bold shrink-0 ${d.type==="human"?"bg-green-500/20 text-green-500":"bg-brand-500/20 text-brand-500"}`,children:d.name.slice(0,2).toUpperCase()}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("span",{className:"text-fg-primary font-medium",children:d.name}),t.jsx("span",{className:"text-fg-tertiary text-[10px] ml-1.5",children:d.subtitle??d.type})]}),d.type==="agent"&&t.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${d.online?"bg-green-400":"bg-gray-500"}`})]},d.id))]}),document.body)}function oe(l){return/^\w+$/.test(l)?`@${l}`:`@[${l}]`}const K=/@\[([^\]]+)\]|@([\w\p{L}\p{N}]+)/gu;function ie(l){const u=[];let i;for(K.lastIndex=0;(i=K.exec(l))!==null;)u.push(i[1]??i[2]);return u}function ce(l,u,i){const g=[];let f=0;const y=u.map(r=>r.name).sort((r,x)=>x.length-r.length);let s=0;for(;s<l.length;){const r=l.indexOf("@",s);if(r<0){g.push(t.jsx("span",{children:l.slice(s)},f++));break}if(r>s&&g.push(t.jsx("span",{children:l.slice(s,r)},f++)),l[r+1]==="["){const c=l.indexOf("]",r+2);if(c>r+2){const m=l.slice(r+2,c),j=u.find(k=>k.name.toLowerCase()===m.toLowerCase());g.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&j?"cursor-pointer hover:underline":""}`,onClick:i&&j?k=>i(j,k):void 0,title:j?`${j.name} (${j.role})`:void 0,children:["@",m]},f++)),s=c+1;continue}}const x=l.slice(r+1),b=x.toLowerCase(),w=y.find(c=>b.startsWith(c.toLowerCase()));if(w){const c=u.find(m=>m.name.toLowerCase()===w.toLowerCase());g.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&c?"cursor-pointer hover:underline":""}`,onClick:i&&c?m=>i(c,m):void 0,title:c?`${c.name} (${c.role})`:void 0,children:["@",w]},f++)),s=r+1+w.length;continue}const d=/^([\w\p{L}\p{N}]+)/u,h=x.match(d);if(h){const c=h[1],m=u.find(j=>j.name.toLowerCase()===c.toLowerCase());g.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&m?"cursor-pointer hover:underline":""}`,onClick:i&&m?j=>i(m,j):void 0,title:m?`${m.name} (${m.role})`:void 0,children:["@",c]},f++)),s=r+1+c.length;continue}g.push(t.jsx("span",{children:"@"},f++)),s=r+1}return g.length>0?g:[t.jsx("span",{children:l},0)]}function de({agents:l,humans:u,onSubmit:i,placeholder:g,replyTo:f,onCancelReply:y}){const{t:s}=T("common"),[r,x]=a.useState(""),[b,w]=a.useState(!1),[d,h]=a.useState(null),[c,m]=a.useState(!1),[j,k]=a.useState(""),[C,S]=a.useState([]),[B,I]=a.useState(0),[N,M]=a.useState([]),[z,A]=a.useState(!1),F=a.useRef(null),U=a.useRef(null),L=a.useRef(null),$=a.useMemo(()=>{const e=(u??[]).map(n=>({id:n.id,name:n.name,type:"human",subtitle:n.role}));for(const n of l)e.push({id:n.id,name:n.name,type:"agent",subtitle:n.role,online:n.status==="idle"||n.status==="working"});return e},[l,u]),D=$.filter(e=>e.name.toLowerCase().includes(j)),E=a.useCallback(e=>{const n=Array.from(e).filter(o=>o.type.startsWith("image/"));if(n.length!==0)for(const o of n){if(o.size>ne)continue;const p=new FileReader;p.onload=()=>{const R=p.result;se(R,te,re).then(v=>{M(_=>_.length>=W?_:[..._,{id:`img_${Date.now()}_${Math.random().toString(36).slice(2,6)}`,dataUrl:v,name:o.name}])})},p.readAsDataURL(o)}},[]),X=a.useCallback(e=>{M(n=>n.filter(o=>o.id!==e))},[]),Y=a.useCallback(e=>{const n=e.clipboardData?.files;if(n&&n.length>0){const o=Array.from(n).filter(p=>p.type.startsWith("image/"));o.length>0&&(e.preventDefault(),E(o))}},[E]),q=a.useCallback(e=>{e.preventDefault(),A(!1);const n=e.dataTransfer?.files;n&&n.length>0&&E(Array.from(n).filter(o=>o.type.startsWith("image/")))},[E]),G=a.useCallback(e=>{e.preventDefault(),A(!0)},[]),H=a.useCallback(()=>{A(!1)},[]),O=async()=>{if(!(!r.trim()&&N.length===0)){w(!0),h(null),L.current={content:r,mentions:[...C],images:[...N]};try{await i(r,C,[...N],f?.id),x(""),S([]),M([]),L.current=null,y?.()}catch(e){h(String(e instanceof Error?e.message:e)||s("commentInput.sendFailed"))}w(!1)}},Q=async()=>{if(!L.current)return;const{content:e,mentions:n,images:o}=L.current;w(!0),h(null);try{await i(e,n,o),x(""),S([]),M([]),L.current=null}catch(p){h(String(p instanceof Error?p.message:p)||s("commentInput.sendFailed"))}w(!1)},P=a.useCallback(e=>{x(n=>{const o=n.lastIndexOf("@"),p=oe(e.name);return o>=0?n.slice(0,o)+p+" ":n+p+" "}),C.includes(e.id)||S(n=>[...n,e.id]),m(!1),k(""),I(0),F.current?.focus()},[C]),V=e=>{x(e),h(null);const n=e.lastIndexOf("@");if(n>=0&&(n===0||e[n-1]===" ")){const p=e.slice(n+1).toLowerCase();if($.some(v=>v.name.toLowerCase().includes(p))){k(p),m(!0),I(0);return}}m(!1)},Z=e=>{if(c&&D.length>0){const n=e.key==="ArrowUp"||e.ctrlKey&&e.key==="p",o=e.key==="ArrowDown"||e.ctrlKey&&e.key==="n",p=e.key==="Enter"||e.key==="Tab",R=e.key==="Escape";if(n){e.preventDefault(),I(v=>(v-1+D.length)%D.length);return}if(o){e.preventDefault(),I(v=>(v+1)%D.length);return}if(p){e.preventDefault();const v=D[B];v&&P(v);return}if(R){e.preventDefault(),m(!1);return}}e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),O())},J=a.useCallback(()=>{setTimeout(()=>m(!1),200)},[]);return t.jsxs("div",{className:"relative",onDragOver:G,onDragLeave:H,onDrop:q,children:[z&&t.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-brand-500/10 rounded-lg border-2 border-dashed border-brand-500",children:t.jsx("span",{className:"text-sm text-brand-500 font-medium",children:s("commentInput.dragDropHint")})}),c&&t.jsx(ae,{candidates:$,filter:j,anchorRef:F,onSelect:P,selectedIndex:B,onIndexChange:I}),t.jsxs("div",{className:"border border-border-default rounded-lg bg-surface-elevated",children:[f&&t.jsxs("div",{className:"flex items-center gap-2 px-2.5 pt-2 pb-1 border-b border-border-default/50",children:[t.jsxs("div",{className:"flex-1 min-w-0 pl-2 border-l-2 border-brand-500/50",children:[t.jsx("span",{className:"text-[10px] font-medium text-brand-500",children:f.authorName}),t.jsx("p",{className:"text-[10px] text-fg-tertiary truncate",children:f.content})]}),t.jsx("button",{onClick:y,className:"text-fg-tertiary hover:text-fg-secondary shrink-0 p-0.5",children:t.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),C.length>0&&t.jsx("div",{className:"flex gap-1 px-2.5 pt-2 flex-wrap",children:C.map(e=>{const n=$.find(o=>o.id===e);return t.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded-full ${n?.type==="human"?"bg-green-500/15 text-green-500":"bg-brand-500/15 text-brand-500"}`,children:["@",n?.name??e,t.jsx("button",{onClick:()=>S(o=>o.filter(p=>p!==e)),className:"hover:text-red-400",children:"×"})]},e)})}),t.jsx("textarea",{ref:F,value:r,onChange:e=>V(e.target.value),onKeyDown:Z,onBlur:J,onPaste:Y,placeholder:g??s("commentInput.placeholder"),rows:2,className:"w-full px-2.5 py-2 text-xs bg-transparent text-fg-primary placeholder-fg-tertiary outline-none resize-none"}),N.length>0&&t.jsx("div",{className:"flex items-center gap-1.5 px-2.5 pb-1.5 overflow-x-auto",children:N.map(e=>t.jsxs("div",{className:"relative group/img shrink-0",children:[t.jsx("img",{src:e.dataUrl,alt:e.name,className:"w-12 h-12 rounded-lg object-cover border border-border-default"}),t.jsx("button",{onClick:()=>X(e.id),className:"absolute -top-1.5 -right-1.5 w-4 h-4 bg-surface-secondary border border-gray-600 rounded-full flex items-center justify-center text-fg-secondary hover:text-red-500 hover:border-red-500 text-[10px] opacity-0 group-hover/img:opacity-100 transition-opacity",title:s("commentInput.removeImage"),children:"×"})]},e.id))}),d&&t.jsxs("div",{className:"flex items-center gap-2 px-2.5 pb-1.5",children:[t.jsx("span",{className:"text-[11px] text-red-400 flex-1 truncate",children:d}),t.jsxs("button",{onClick:Q,disabled:b,className:"text-[11px] text-amber-500 hover:text-amber-400 font-medium transition-colors flex items-center gap-1",children:[t.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"23 4 23 10 17 10"}),t.jsx("path",{d:"M20.49 15a9 9 0 11-2.12-9.36L23 10"})]}),s("commentInput.retry")]})]}),t.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2",children:[t.jsx("button",{type:"button",onClick:()=>U.current?.click(),disabled:b||N.length>=W,className:"p-1 text-fg-tertiary hover:text-brand-500 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:s("commentInput.attachImage"),children:t.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),t.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),t.jsx("polyline",{points:"21 15 16 10 5 21"})]})}),t.jsx("input",{ref:U,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&E(e.target.files),e.target.value=""}}),t.jsx("button",{onClick:O,disabled:!r.trim()&&N.length===0||b,className:"px-3 py-1 text-[11px] font-medium bg-brand-500 text-white rounded-md hover:bg-brand-600 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:s(b?"commentInput.sending":"commentInput.submit")})]})]}),t.jsx("p",{className:"mt-1 text-center text-[10px] text-fg-tertiary/80 select-none",children:s("aiDisclaimer")})]})}export{de as C,ie as p,ce as r};
|
|
1
|
+
import{j as t,u as T,r as a,k as ee}from"./index-B1VN5yM1.js";const te=1920,ne=10*1024*1024,W=5,re=.8;function se(l,u,i){return new Promise((g,f)=>{const y=new Image;y.onload=()=>{let{width:s,height:r}=y;if(s<=u&&r<=u){g(l);return}s>r?(r=Math.round(r*(u/s)),s=u):(s=Math.round(s*(u/r)),r=u);const x=document.createElement("canvas");x.width=s,x.height=r;const b=x.getContext("2d");if(!b){f(new Error("Failed to get canvas context"));return}b.drawImage(y,0,0,s,r),g(x.toDataURL("image/jpeg",i))},y.onerror=()=>f(new Error("Failed to load image")),y.src=l})}function ae({candidates:l,filter:u,anchorRef:i,onSelect:g,selectedIndex:f,onIndexChange:y}){const{t:s}=T("common"),[r,x]=a.useState(null),b=a.useRef(null),w=l.filter(d=>d.name.toLowerCase().includes(u));return a.useEffect(()=>{const d=i.current;if(!d)return;const h=d.getBoundingClientRect();x({top:h.top+window.scrollY-4,left:h.left+window.scrollX+8})},[i,u]),a.useEffect(()=>{if(!b.current||!r)return;if(b.current.getBoundingClientRect().top<8){const h=i.current;if(!h)return;const c=h.getBoundingClientRect();x({top:c.bottom+window.scrollY+4,left:r.left})}},[r,i]),a.useEffect(()=>{f>=w.length&&y(Math.max(0,w.length-1))},[w.length,f,y]),a.useEffect(()=>{if(!b.current)return;b.current.querySelector('[data-selected="true"]')?.scrollIntoView({block:"nearest"})},[f]),!r||w.length===0?null:ee.createPortal(t.jsxs("div",{ref:b,style:{position:"absolute",top:r.top,left:r.left,transform:"translateY(-100%)"},className:"w-60 bg-surface-overlay border border-border-default rounded-lg shadow-xl z-[9999] max-h-48 overflow-y-auto",children:[t.jsx("div",{className:"px-2.5 py-1.5 text-[10px] text-fg-tertiary font-medium uppercase tracking-wider border-b border-border-default",children:s("commentInput.mentionHeading")}),w.map((d,h)=>t.jsxs("button",{"data-selected":h===f,onMouseDown:c=>{c.preventDefault(),g(d)},onMouseEnter:()=>y(h),className:`w-full text-left px-3 py-2 text-xs flex items-center gap-2 transition-colors ${h===f?"bg-brand-500/15 text-brand-500":"hover:bg-surface-elevated"}`,children:[t.jsx("span",{className:`w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-bold shrink-0 ${d.type==="human"?"bg-green-500/20 text-green-500":"bg-brand-500/20 text-brand-500"}`,children:d.name.slice(0,2).toUpperCase()}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("span",{className:"text-fg-primary font-medium",children:d.name}),t.jsx("span",{className:"text-fg-tertiary text-[10px] ml-1.5",children:d.subtitle??d.type})]}),d.type==="agent"&&t.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${d.online?"bg-green-400":"bg-gray-500"}`})]},d.id))]}),document.body)}function oe(l){return/^\w+$/.test(l)?`@${l}`:`@[${l}]`}const K=/@\[([^\]]+)\]|@([\w\p{L}\p{N}]+)/gu;function ie(l){const u=[];let i;for(K.lastIndex=0;(i=K.exec(l))!==null;)u.push(i[1]??i[2]);return u}function ce(l,u,i){const g=[];let f=0;const y=u.map(r=>r.name).sort((r,x)=>x.length-r.length);let s=0;for(;s<l.length;){const r=l.indexOf("@",s);if(r<0){g.push(t.jsx("span",{children:l.slice(s)},f++));break}if(r>s&&g.push(t.jsx("span",{children:l.slice(s,r)},f++)),l[r+1]==="["){const c=l.indexOf("]",r+2);if(c>r+2){const m=l.slice(r+2,c),j=u.find(k=>k.name.toLowerCase()===m.toLowerCase());g.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&j?"cursor-pointer hover:underline":""}`,onClick:i&&j?k=>i(j,k):void 0,title:j?`${j.name} (${j.role})`:void 0,children:["@",m]},f++)),s=c+1;continue}}const x=l.slice(r+1),b=x.toLowerCase(),w=y.find(c=>b.startsWith(c.toLowerCase()));if(w){const c=u.find(m=>m.name.toLowerCase()===w.toLowerCase());g.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&c?"cursor-pointer hover:underline":""}`,onClick:i&&c?m=>i(c,m):void 0,title:c?`${c.name} (${c.role})`:void 0,children:["@",w]},f++)),s=r+1+w.length;continue}const d=/^([\w\p{L}\p{N}]+)/u,h=x.match(d);if(h){const c=h[1],m=u.find(j=>j.name.toLowerCase()===c.toLowerCase());g.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&m?"cursor-pointer hover:underline":""}`,onClick:i&&m?j=>i(m,j):void 0,title:m?`${m.name} (${m.role})`:void 0,children:["@",c]},f++)),s=r+1+c.length;continue}g.push(t.jsx("span",{children:"@"},f++)),s=r+1}return g.length>0?g:[t.jsx("span",{children:l},0)]}function de({agents:l,humans:u,onSubmit:i,placeholder:g,replyTo:f,onCancelReply:y}){const{t:s}=T("common"),[r,x]=a.useState(""),[b,w]=a.useState(!1),[d,h]=a.useState(null),[c,m]=a.useState(!1),[j,k]=a.useState(""),[C,S]=a.useState([]),[B,I]=a.useState(0),[N,M]=a.useState([]),[z,A]=a.useState(!1),F=a.useRef(null),U=a.useRef(null),L=a.useRef(null),$=a.useMemo(()=>{const e=(u??[]).map(n=>({id:n.id,name:n.name,type:"human",subtitle:n.role}));for(const n of l)e.push({id:n.id,name:n.name,type:"agent",subtitle:n.role,online:n.status==="idle"||n.status==="working"});return e},[l,u]),D=$.filter(e=>e.name.toLowerCase().includes(j)),E=a.useCallback(e=>{const n=Array.from(e).filter(o=>o.type.startsWith("image/"));if(n.length!==0)for(const o of n){if(o.size>ne)continue;const p=new FileReader;p.onload=()=>{const R=p.result;se(R,te,re).then(v=>{M(_=>_.length>=W?_:[..._,{id:`img_${Date.now()}_${Math.random().toString(36).slice(2,6)}`,dataUrl:v,name:o.name}])})},p.readAsDataURL(o)}},[]),X=a.useCallback(e=>{M(n=>n.filter(o=>o.id!==e))},[]),Y=a.useCallback(e=>{const n=e.clipboardData?.files;if(n&&n.length>0){const o=Array.from(n).filter(p=>p.type.startsWith("image/"));o.length>0&&(e.preventDefault(),E(o))}},[E]),q=a.useCallback(e=>{e.preventDefault(),A(!1);const n=e.dataTransfer?.files;n&&n.length>0&&E(Array.from(n).filter(o=>o.type.startsWith("image/")))},[E]),G=a.useCallback(e=>{e.preventDefault(),A(!0)},[]),H=a.useCallback(()=>{A(!1)},[]),O=async()=>{if(!(!r.trim()&&N.length===0)){w(!0),h(null),L.current={content:r,mentions:[...C],images:[...N]};try{await i(r,C,[...N],f?.id),x(""),S([]),M([]),L.current=null,y?.()}catch(e){h(String(e instanceof Error?e.message:e)||s("commentInput.sendFailed"))}w(!1)}},Q=async()=>{if(!L.current)return;const{content:e,mentions:n,images:o}=L.current;w(!0),h(null);try{await i(e,n,o),x(""),S([]),M([]),L.current=null}catch(p){h(String(p instanceof Error?p.message:p)||s("commentInput.sendFailed"))}w(!1)},P=a.useCallback(e=>{x(n=>{const o=n.lastIndexOf("@"),p=oe(e.name);return o>=0?n.slice(0,o)+p+" ":n+p+" "}),C.includes(e.id)||S(n=>[...n,e.id]),m(!1),k(""),I(0),F.current?.focus()},[C]),V=e=>{x(e),h(null);const n=e.lastIndexOf("@");if(n>=0&&(n===0||e[n-1]===" ")){const p=e.slice(n+1).toLowerCase();if($.some(v=>v.name.toLowerCase().includes(p))){k(p),m(!0),I(0);return}}m(!1)},Z=e=>{if(c&&D.length>0){const n=e.key==="ArrowUp"||e.ctrlKey&&e.key==="p",o=e.key==="ArrowDown"||e.ctrlKey&&e.key==="n",p=e.key==="Enter"||e.key==="Tab",R=e.key==="Escape";if(n){e.preventDefault(),I(v=>(v-1+D.length)%D.length);return}if(o){e.preventDefault(),I(v=>(v+1)%D.length);return}if(p){e.preventDefault();const v=D[B];v&&P(v);return}if(R){e.preventDefault(),m(!1);return}}e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),O())},J=a.useCallback(()=>{setTimeout(()=>m(!1),200)},[]);return t.jsxs("div",{className:"relative",onDragOver:G,onDragLeave:H,onDrop:q,children:[z&&t.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-brand-500/10 rounded-lg border-2 border-dashed border-brand-500",children:t.jsx("span",{className:"text-sm text-brand-500 font-medium",children:s("commentInput.dragDropHint")})}),c&&t.jsx(ae,{candidates:$,filter:j,anchorRef:F,onSelect:P,selectedIndex:B,onIndexChange:I}),t.jsxs("div",{className:"border border-border-default rounded-lg bg-surface-elevated",children:[f&&t.jsxs("div",{className:"flex items-center gap-2 px-2.5 pt-2 pb-1 border-b border-border-default/50",children:[t.jsxs("div",{className:"flex-1 min-w-0 pl-2 border-l-2 border-brand-500/50",children:[t.jsx("span",{className:"text-[10px] font-medium text-brand-500",children:f.authorName}),t.jsx("p",{className:"text-[10px] text-fg-tertiary truncate",children:f.content})]}),t.jsx("button",{onClick:y,className:"text-fg-tertiary hover:text-fg-secondary shrink-0 p-0.5",children:t.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),C.length>0&&t.jsx("div",{className:"flex gap-1 px-2.5 pt-2 flex-wrap",children:C.map(e=>{const n=$.find(o=>o.id===e);return t.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded-full ${n?.type==="human"?"bg-green-500/15 text-green-500":"bg-brand-500/15 text-brand-500"}`,children:["@",n?.name??e,t.jsx("button",{onClick:()=>S(o=>o.filter(p=>p!==e)),className:"hover:text-red-400",children:"×"})]},e)})}),t.jsx("textarea",{ref:F,value:r,onChange:e=>V(e.target.value),onKeyDown:Z,onBlur:J,onPaste:Y,placeholder:g??s("commentInput.placeholder"),rows:2,className:"w-full px-2.5 py-2 text-xs bg-transparent text-fg-primary placeholder-fg-tertiary outline-none resize-none"}),N.length>0&&t.jsx("div",{className:"flex items-center gap-1.5 px-2.5 pb-1.5 overflow-x-auto",children:N.map(e=>t.jsxs("div",{className:"relative group/img shrink-0",children:[t.jsx("img",{src:e.dataUrl,alt:e.name,className:"w-12 h-12 rounded-lg object-cover border border-border-default"}),t.jsx("button",{onClick:()=>X(e.id),className:"absolute -top-1.5 -right-1.5 w-4 h-4 bg-surface-secondary border border-gray-600 rounded-full flex items-center justify-center text-fg-secondary hover:text-red-500 hover:border-red-500 text-[10px] opacity-0 group-hover/img:opacity-100 transition-opacity",title:s("commentInput.removeImage"),children:"×"})]},e.id))}),d&&t.jsxs("div",{className:"flex items-center gap-2 px-2.5 pb-1.5",children:[t.jsx("span",{className:"text-[11px] text-red-400 flex-1 truncate",children:d}),t.jsxs("button",{onClick:Q,disabled:b,className:"text-[11px] text-amber-500 hover:text-amber-400 font-medium transition-colors flex items-center gap-1",children:[t.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"23 4 23 10 17 10"}),t.jsx("path",{d:"M20.49 15a9 9 0 11-2.12-9.36L23 10"})]}),s("commentInput.retry")]})]}),t.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2",children:[t.jsx("button",{type:"button",onClick:()=>U.current?.click(),disabled:b||N.length>=W,className:"p-1 text-fg-tertiary hover:text-brand-500 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:s("commentInput.attachImage"),children:t.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),t.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),t.jsx("polyline",{points:"21 15 16 10 5 21"})]})}),t.jsx("input",{ref:U,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&E(e.target.files),e.target.value=""}}),t.jsx("button",{onClick:O,disabled:!r.trim()&&N.length===0||b,className:"px-3 py-1 text-[11px] font-medium bg-brand-500 text-white rounded-md hover:bg-brand-600 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:s(b?"commentInput.sending":"commentInput.submit")})]})]}),t.jsx("p",{className:"mt-1 text-center text-[10px] text-fg-tertiary/80 select-none",children:s("aiDisclaimer")})]})}export{de as C,ie as p,ce as r};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{j as a,r as i,_ as f}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-B1VN5yM1.js","assets/index-BbQpGkiM.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{j as a,r as i,_ as f}from"./index-B1VN5yM1.js";const x=i.lazy(()=>f(()=>import("./index-B1VN5yM1.js").then(e=>e.aE),__vite__mapDeps([0,1])).then(e=>({default:e.MarkdownMessage}))),b=new Set(["ts","tsx","js","jsx","mjs","cjs","py","go","rs","java","kt","kts","c","cc","cpp","cxx","h","hpp","hxx","cs","rb","php","swift","scala","sh","bash","zsh","fish","ps1","sql","yaml","yml","toml","xml","css","scss","less","vue","svelte","graphql","gql","proto","dockerfile","makefile","cmake","rsx","r","lua","pl","pm","ex","exs","erl","hs","clj","zig","nim","dart","gradle","tf","hcl"]);function v(e){const t=e.split(/[/\\]/).pop()?.toLowerCase()||"";if(t==="dockerfile"||t==="makefile")return"code";const r=t.includes(".")?t.split(".").pop():"";switch(r){case"md":case"markdown":return"markdown";case"html":case"htm":return"html";case"json":case"jsonc":return"json";case"csv":case"tsv":return"csv";default:return r&&b.has(r)?"code":r?"text":void 0}}function w(e){const t=e.trimStart();if(/^<!doctype\s+html/i.test(t)||/^<html[\s>]/i.test(t))return"html";if(t.startsWith("{")||t.startsWith("["))try{return JSON.parse(e),"json"}catch{}}function S(e){if(e.format)return e.format;if(e.reference){const t=v(e.reference);if(t)return t}if(e.content){const t=w(e.content);if(t)return t}return e.reference?"text":"markdown"}function y({content:e,className:t,onSelection:r}){const c=i.useRef(null),[l,p]=i.useState(null);i.useEffect(()=>{const o=d=>{d.data?.type==="__htmlpreview_height"&&typeof d.data.height=="number"&&p(d.data.height),d.data?.type==="__htmlpreview_selection"&&r&&r(d.data)};return window.addEventListener("message",o),()=>window.removeEventListener("message",o)},[r]);const h=`<script>
|
|
3
3
|
(function(){
|
|
4
4
|
function getXPath(el){
|
|
5
5
|
if(!el||el.nodeType!==1)return'';
|
package/dist/web-ui/assets/{DeliverableShareModal-CHdOyC9c.js → DeliverableShareModal-B6qqZgFc.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as ce,r as u,h as A,o as de,t as ue,l as N,j as r}from"./index-B-xjev59.js";const O=50*1024*1024;class H extends Error{constructor(e){super(e),this.name="DeliverableShareError"}}class Z extends H{constructor(){super("需要登录 Markus Hub 账号后才能分享产出物。"),this.name="NotLoggedIntoHubError"}}class fe extends H{bytes;limit;constructor(e,a){super(`产出物文件大小 ${e} 字节超过上限 ${a} 字节(50MB),请压缩或拒绝分享。`),this.name="DeliverableTooLargeError",this.bytes=e,this.limit=a}}class he extends H{status;constructor(e,a){super(`Hub 请求失败 (HTTP ${e}): ${a}`),this.name="HubApiError",this.status=e}}function be(t){const e=t.replace(/\s+/g,"");if(!e)return 0;let a=0;return e.endsWith("==")?a=2:e.endsWith("=")&&(a=1),Math.floor(e.length*3/4)-a}function V(t,e){const a=t&&typeof t=="object"?t:{},l=a.share??a.deliverable??{},s=m=>a[m]??l[m],i=s("id")??s("shareId")??"",c=s("slug"),o=c!=null?String(c):void 0,d=s("url")??s("shareUrl");let h=null;d!=null?h=String(d):o&&e&&(h=`${e.replace(/\/+$/,"")}/deliverable/${encodeURIComponent(o)}`);const f=s("reason")??s("rejectNote"),p=s("localDeliverableId")??s("localId");return{id:String(i),slug:o,visibility:s("visibility")??"public",status:s("status")??"pending_review",url:h,reason:f!=null?String(f):null,localId:p!=null?String(p):null}}class pe{basePath;fetchImpl;hubOrigin;constructor(e){this.getHubToken=e.getHubToken,this.hubOrigin=e.hubUrl,this.basePath=(e.proxyBasePath??"/api/hub").replace(/\/+$/,""),this.fetchImpl=e.fetch??(globalThis.fetch?globalThis.fetch.bind(globalThis):(()=>{throw new Error("fetch unavailable")}))}getHubToken;isHubLoggedIn(){return!!this.getHubToken()}assertHubLoggedIn(){if(!this.getHubToken())throw new Z}async doFetch(e,a){const l=this.getHubToken(),s={"Content-Type":"application/json",...a.headers};l&&(s.Authorization=`Bearer ${l}`);const i=await this.fetchImpl(`${this.basePath}${e}`,{...a,headers:s,credentials:"include"});let c=null;try{c=await i.json()}catch{c=null}if(!i.ok){const o=c&&typeof c=="object"&&"error"in c?String(c.error):i.statusText||`HTTP ${i.status}`;throw new he(i.status,o)}return{status:i.status,data:c}}async publish(e){this.assertHubLoggedIn();const a=e.fileSizeBytes??(e.fileBase64?be(e.fileBase64):0);if(a>O)throw new fe(a,O);const l={localDeliverableId:e.localId,visibility:e.visibility,title:e.title,summary:e.summary,tags:e.tags,filename:e.filename,format:e.format,producerAgent:{id:e.producerAgent.id,name:e.producerAgent.name,source:e.producerAgent.source}};e.content&&(l.content=e.content),e.fileBase64&&(l.fileBase64=e.fileBase64);const{data:s}=await this.doFetch("/deliverables/publish",{method:"POST",body:JSON.stringify(l)});return V(s,this.hubOrigin)}async pollStatus(e){this.assertHubLoggedIn();const{data:a}=await this.doFetch(`/deliverables/status?localId=${encodeURIComponent(e)}`,{method:"GET"});return V(a,this.hubOrigin)}async listMine(){this.assertHubLoggedIn();const{data:e}=await this.doFetch("/deliverables/mine",{method:"GET"}),a=e&&typeof e=="object"?e:{};return(Array.isArray(a.shares)?a.shares:[]).map(s=>V(s,this.hubOrigin))}async revoke(e){this.assertHubLoggedIn();const{data:a}=await this.doFetch("/deliverables/revoke",{method:"POST",body:JSON.stringify({localId:e})});return{...V(a,this.hubOrigin),status:"revoked",url:null}}}function me(t,e){return new pe({getHubToken:t,hubUrl:e,proxyBasePath:"/api/hub"})}const ge=/\.(png|jpe?g|gif|webp|svg|bmp|avif|ico)$/i,xe=/\.(mp4|webm|mp3|wav|ogg|m4a|mov|avi|mkv|flac)$/i;function K(t){return ge.test(t)?"image":xe.test(t)?"media":"other"}function ye(t){return t.replace(/^file:\/\//i,"").replace(/^file:/i,"")}function G(t){const e=t.match(/!?\[[^\]]*\]\(([^)]+)\)/);if(e)return e[1].trim().split(/\s+(?="|')/)[0].trim()||null;const a=t.match(/(?:src|href|poster)\s*=\s*["']([^"']+)["']/i);return a?a[1]:null}function X(t){return!t||/^(https?:|data:|mailto:|tel:|#)/i.test(t)||t.startsWith("//")?!1:(t.startsWith("/api/files/"),!0)}function J(t,e){if(!t)return null;const a=t.trim(),l=a.match(/^\/api\/files\/(?:image|stream|preview)\?path=([^&]+)/i);if(l)try{return decodeURIComponent(l[1])||null}catch{return l[1]||null}return/^file:\/\//i.test(a)?ye(a).replace(/\\/g,"/"):/^[a-zA-Z]:[\\/]/.test(a)?a.replace(/\\/g,"/"):a.startsWith("/")?a:e&&(a.startsWith("./")||a.startsWith("../")||!a.includes("://"))?`${e.replace(/\\/g,"/").replace(/\/+$/,"")}/${a.replace(/^\.\//,"").replace(/\\/g,"/")}`:null}function ve(t,e){const a=[],l=new Set,s=/!?\[[^\]]*\]\(([^)\s]+(?:\s+["'][^"']*["'])?)\)/g;for(const c of t.matchAll(s)){const o=c[0],d=G(o);if(!d||!X(d))continue;const h=J(d,e);!h||l.has(o)||(l.add(o),a.push({raw:o,localPath:h,kind:K(h.split("?")[0])}))}const i=/<[a-zA-Z][^>]*(?:src|href|poster)\s*=\s*["'][^"']+["'][^>]*>/gi;for(const c of t.matchAll(i)){const o=c[0],d=G(o);if(!d||!X(d))continue;const h=J(d,e);!h||l.has(o)||(l.add(o),a.push({raw:o,localPath:h,kind:K(h.split("?")[0])}))}return{refs:a,baseDir:e??""}}function ke(t,e){let a=t;for(const[l,s]of e){const i=we(l,s);a=a.split(l).join(i)}return a}function we(t,e){const a=t.match(/^(!?\[[^\]]*\])\([^)]*\)$/);if(a)return`${a[1]}(${e})`;const l=t.match(/(src|href|poster)(\s*=\s*)(["'])[^"']*\3/i);return l?t.replace(/(src|href|poster)(\s*=\s*)(["'])[^"']*\3/i,`${l[1]}${l[2]}${l[3]}${e}${l[3]}`):e}function je(t,e){return/^https?:\/\//i.test(t)?t:`${e.replace(/\/+$/,"")}${t.startsWith("/")?"":"/"}${t}`}function Ne(t,e,a){const l=new Map,s=new Map(t.map(i=>[i.localPath,i]));for(const i of e){if(!i.key)continue;const c=s.get(i.key);!c||!i.url||l.set(c.raw,je(i.url,a))}return l}async function He(t){try{const e=N.files.streamUrl(t),a=await fetch(e).then(d=>d.ok?d.blob():null);if(!a)return null;const l=await a.arrayBuffer(),s=new Uint8Array(l);let i="";const c=32768;for(let d=0;d<s.length;d+=c)i+=String.fromCharCode.apply(null,Array.from(s.subarray(d,d+c)));const o=t.split("/").pop()||"media";return{base64:btoa(i),filename:o}}catch{return null}}async function Ie(t,e){const a=new Map;if(t.length===0)return a;const l=[];for(const c of t){const o=await He(c.localPath);o&&l.push({key:c.localPath,filename:o.filename,base64:o.base64})}if(l.length===0)return a;const{files:s,errors:i}=await A.uploadMediaBatch(l);return i.length>0&&console.warn("[deliverable-share] media upload errors:",i),Ne(t,s,e)}async function Se(t,e,a){if(!t||e==="directory"||t.startsWith("http://")||t.startsWith("https://"))return{};try{const l=await N.files.preview(t);if((l.type==="text"||l.type==="markdown"||l.type==="html"||l.type==="json"||l.type==="csv")&&typeof l.content=="string"){if(!(l.type==="markdown"||l.type==="html"))return{content:l.content};const i=t.replace(/[/\\]/g,"/").split("/").slice(0,-1).join("/"),{refs:c}=ve(l.content,i);if(c.length===0)return{content:l.content};const o=await Ie(c,a);return o.size===0?{content:l.content}:{content:ke(l.content,o),uploadedMedia:o.size}}if(l.type==="image"||l.type==="audio"||l.type==="video"||l.type==="binary"){const s=l.streamUrl||(l.path?N.files.streamUrl(l.path):N.files.streamUrl(t)),c=await(await fetch(s).then(f=>f.blob())).arrayBuffer(),o=new Uint8Array(c);let d="";const h=32768;for(let f=0;f<o.length;f+=h)d+=String.fromCharCode.apply(null,Array.from(o.subarray(f,f+h)));return{fileBase64:btoa(d)}}return{}}catch{return{}}}function Ve({item:t,onClose:e,onShared:a,service:l}){const{t:s}=ce(["deliverables","common"]),i=u.useMemo(()=>l??me(de,A.getUrl()),[l]),[c,o]=u.useState(()=>i?i.isHubLoggedIn():null),[d,h]=u.useState(!1),[f,p]=u.useState(()=>{const n=t.shareStatus;return n==="published"?"published":n==="pending_review"?"pending_review":n==="rejected"?"rejected":"form"}),[m,B]=u.useState("public"),[I,Y]=u.useState(t.title||""),[C,q]=u.useState(t.summary||""),[g,$]=u.useState(Array.isArray(t.tags)?[...t.tags]:[]),[k,M]=u.useState(""),[L,Q]=u.useState(null),[R,P]=u.useState(!1),[S,x]=u.useState(null),U=u.useRef(a);U.current=a;const y=u.useCallback(n=>{Q(n);const b=n.status;p(b==="published"?"published":b==="rejected"?"rejected":b==="revoked"?"revoked":b==="pending_review"?"pending_review":"form"),U.current?.(n)},[]);u.useEffect(()=>{o(i.isHubLoggedIn())},[i]);const ee=u.useCallback(async()=>{h(!0),x(null);try{await ue({force:!0}),o(i.isHubLoggedIn())}catch{o(i.isHubLoggedIn())}finally{h(!1)}},[i]),E=u.useCallback(()=>{const n=k.trim().replace(/^#/,"");n&&!g.includes(n)&&$(b=>[...b,n]),M("")},[k,g]),te=u.useCallback(n=>{$(b=>b.filter(v=>v!==n))},[]),re=u.useCallback(n=>{n.key==="Enter"||n.key===","?(n.preventDefault(),E()):n.key==="Backspace"&&!k&&g.length&&$(b=>b.slice(0,-1))},[E,k,g.length]),se=u.useCallback(()=>{const n=L?.url??t.shareUrl;n&&navigator.clipboard?.writeText(n).then(()=>{P(!0),setTimeout(()=>P(!1),1500)}).catch(()=>{})},[L,t.shareUrl]),ae=u.useCallback(async()=>{x(null),p("busy");try{const n=t.reference.replace(/[/\\]/g,"/").split("/").pop()||"deliverable",b=A.getUrl(),{content:v,fileBase64:ne,uploadedMedia:W}=await Se(t.reference,t.type,b);W&&console.info(`[deliverable-share] uploaded ${W} local media reference(s) to Hub`);const w=t.agentId??"";let _=w;if(w)try{const{agents:ie}=await N.agents.list(),z=ie.find(oe=>oe.id===w);z&&(_=z.name||w)}catch{}const j=await i.publish({localId:t.id,title:I.trim()||t.title,summary:C.trim(),tags:g,visibility:m,filename:n,format:t.format||"markdown",content:v,fileBase64:ne,producerAgent:{id:w,name:_,source:"local"}});y(j),j.status==="rejected"?x(typeof j.reason=="string"&&j.reason?j.reason:"分享被拒绝"):e()}catch(n){if(p("form"),n instanceof Z){o(!1);return}x(n instanceof H||n instanceof Error?n.message:String(n))}},[i,t,I,C,g,m,y]),le=u.useCallback(async()=>{x(null);try{const n=await i.revoke(t.id);y({...n,status:"revoked",url:null})}catch(n){x(n instanceof H?n.message:String(n))}},[i,t.id,y]),D=u.useCallback(()=>{p("form"),x(null)},[]);u.useEffect(()=>{if(f!=="pending_review")return;let n=!1;const b=setInterval(async()=>{try{const v=await i.pollStatus(t.id);if(n)return;v.status!=="pending_review"&&y(v)}catch{}},8e3);return()=>{n=!0,clearInterval(b)}},[f,i,t.id,y]),u.useEffect(()=>{const n=b=>{b.key==="Escape"&&e()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[e]);const T=m==="link",F=L?.url??t.shareUrl;return r.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",onClick:e,children:[r.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm"}),r.jsxs("div",{className:"relative bg-surface-primary rounded-2xl shadow-2xl border border-border-default w-full max-w-md max-h-[85vh] overflow-y-auto",onClick:n=>n.stopPropagation(),children:[r.jsxs("div",{className:"sticky top-0 bg-surface-primary/95 backdrop-blur-sm border-b border-border-default px-5 py-4 flex items-center justify-between rounded-t-2xl z-10",children:[r.jsx("h3",{className:"text-base font-semibold text-fg-primary",children:s("deliverables:share.title",{defaultValue:"分享到 Markus Hub"})}),r.jsx("button",{onClick:e,className:"p-1.5 rounded-lg hover:bg-surface-overlay transition-colors text-fg-tertiary hover:text-fg-primary",children:r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),r.jsx("div",{className:"px-5 py-4 space-y-4",children:c===!1?r.jsxs("div",{className:"space-y-4 py-2",children:[r.jsxs("div",{className:"flex items-start gap-3 rounded-xl bg-amber-500/10 border border-amber-500/25 p-3",children:[r.jsx("span",{className:"text-lg",children:"🔑"}),r.jsx("p",{className:"text-sm text-fg-secondary",children:s("deliverables:share.needHubLogin",{defaultValue:"需登录 Markus Hub 账号后才能分享产出物。"})})]}),r.jsx("button",{onClick:()=>{ee()},disabled:d,className:"w-full px-3 py-2 text-sm font-medium rounded-lg bg-brand-600 text-white hover:bg-brand-500 transition-colors disabled:opacity-60",children:d?s("deliverables:share.loggingIn",{defaultValue:"正在打开登录…"}):s("deliverables:share.loginHub",{defaultValue:"登录 Markus Hub 账号"})}),r.jsx("p",{className:"text-[11px] text-fg-tertiary",children:s("deliverables:share.loginHint",{defaultValue:"解锁后将支持一键公开/链接分享产出物。"})})]}):r.jsx(r.Fragment,{children:f==="published"?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"px-2 py-0.5 text-[11px] rounded-full bg-green-500/15 text-green-500 font-medium",children:s("deliverables:share.published",{defaultValue:"已发布"})}),r.jsx("span",{className:"text-[11px] text-fg-tertiary",children:m==="link"?s("deliverables:share.linkVisibility",{defaultValue:"有链接可见"}):s("deliverables:share.publicVisibility",{defaultValue:"公开"})})]}),F?r.jsxs("div",{className:"flex items-center gap-2 bg-surface-elevated rounded-lg px-3 py-2",children:[r.jsx("span",{className:"text-xs text-fg-secondary font-mono break-all flex-1 select-all",children:F}),r.jsx("button",{onClick:se,className:`px-2 py-1 text-[10px] rounded transition-colors shrink-0 ${R?"bg-green-500/20 text-green-500":"bg-brand-600/20 text-brand-500 hover:bg-brand-600/30"}`,children:R?s("common:copied",{defaultValue:"已复制"}):s("common:copy",{defaultValue:"复制链接"})})]}):r.jsx("p",{className:"text-xs text-fg-tertiary",children:s("deliverables:share.urlPending",{defaultValue:"链接生成中,稍后刷新查看…"})}),r.jsx("button",{onClick:()=>{le()},className:"w-full px-3 py-2 text-xs font-medium rounded-lg text-red-500 border border-red-500/30 hover:bg-red-500/10 transition-colors",children:s("deliverables:share.revoke",{defaultValue:"取消分享"})})]}):f==="pending_review"?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-amber-500 animate-pulse"}),r.jsx("span",{className:"px-2 py-0.5 text-[11px] rounded-full bg-amber-500/15 text-amber-500 font-medium",children:s("deliverables:share.pendingReview",{defaultValue:"审核中"})})]}),r.jsx("p",{className:"text-sm text-fg-secondary",children:s("deliverables:share.pendingHint",{defaultValue:"你的产出物已提交审核,通过后将生成可分享链接。"})})]}):f==="rejected"?r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("span",{className:"px-2 py-0.5 text-[11px] rounded-full bg-red-500/15 text-red-500 font-medium",children:s("deliverables:share.rejected",{defaultValue:"已拒绝"})})}),S&&r.jsx("div",{className:"rounded-lg bg-red-500/10 border border-red-500/25 px-3 py-2 text-xs text-red-500",children:S}),r.jsx("button",{onClick:D,className:"w-full px-3 py-2 text-sm font-medium rounded-lg bg-brand-600 text-white hover:bg-brand-500 transition-colors",children:s("deliverables:share.resubmit",{defaultValue:"重新提交"})})]}):f==="revoked"?r.jsxs("div",{className:"space-y-3",children:[r.jsx("p",{className:"text-sm text-fg-secondary",children:s("deliverables:share.revoked",{defaultValue:"已取消分享,该产出物不再公开可访问。"})}),r.jsx("button",{onClick:D,className:"w-full px-3 py-2 text-sm font-medium rounded-lg bg-brand-600 text-white hover:bg-brand-500 transition-colors",children:s("deliverables:share.shareAgain",{defaultValue:"重新分享"})})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider font-medium",children:s("deliverables:share.visibility",{defaultValue:"可见性"})}),r.jsxs("label",{className:`flex items-start gap-3 rounded-xl border p-3 cursor-pointer transition-colors ${T?"border-border-default hover:bg-surface-elevated":"border-brand-500/50 bg-brand-500/5"}`,children:[r.jsx("input",{type:"radio",name:"visibility",checked:!T,onChange:()=>B("public"),className:"mt-0.5 accent-brand-500"}),r.jsxs("span",{className:"space-y-0.5",children:[r.jsx("span",{className:"block text-sm font-medium text-fg-primary",children:s("deliverables:share.public",{defaultValue:"公开(所有人可见 + 搜索引擎)"})}),r.jsx("span",{className:"block text-[11px] text-fg-tertiary",children:s("deliverables:share.publicHint",{defaultValue:"公开产出物需经 Hub 审核后发布,发布后所有人可见并参与搜索"})})]})]}),r.jsxs("label",{className:`flex items-start gap-3 rounded-xl border p-3 cursor-pointer transition-colors ${T?"border-brand-500/50 bg-brand-500/5":"border-border-default hover:bg-surface-elevated"}`,children:[r.jsx("input",{type:"radio",name:"visibility",checked:T,onChange:()=>B("link"),className:"mt-0.5 accent-brand-500"}),r.jsxs("span",{className:"space-y-0.5",children:[r.jsx("span",{className:"block text-sm font-medium text-fg-primary",children:s("deliverables:share.link",{defaultValue:"有链接可见"})}),r.jsx("span",{className:"block text-[11px] text-fg-tertiary",children:s("deliverables:share.linkHint",{defaultValue:"仅获得链接的人可查看,不参与搜索引擎;同样需经 Hub 审核"})})]})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider font-medium",children:s("deliverables:share.titleField",{defaultValue:"标题"})}),r.jsx("input",{value:I,onChange:n=>Y(n.target.value),placeholder:s("deliverables:share.titlePlaceholder",{defaultValue:"清晰、可检索的标题"}),className:"w-full px-3 py-2 text-sm rounded-lg bg-surface-elevated border border-border-default focus:border-brand-500/60 outline-none"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider font-medium",children:s("deliverables:share.summary",{defaultValue:"摘要"})}),r.jsx("textarea",{value:C,onChange:n=>q(n.target.value),rows:3,placeholder:s("deliverables:share.summaryPlaceholder",{defaultValue:"简要描述该产出物…"}),className:"w-full px-3 py-2 text-sm rounded-lg bg-surface-elevated border border-border-default focus:border-brand-500/60 outline-none resize-y"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider font-medium",children:s("deliverables:share.tags",{defaultValue:"标签"})}),r.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:g.map(n=>r.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-[11px] bg-surface-elevated rounded-md text-fg-secondary",children:[n,r.jsx("button",{onClick:()=>te(n),className:"text-fg-tertiary hover:text-red-500","aria-label":"remove",children:r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},n))}),r.jsx("input",{value:k,onChange:n=>M(n.target.value),onKeyDown:re,onBlur:E,placeholder:s("deliverables:share.tagsPlaceholder",{defaultValue:"输入标签后回车添加"}),className:"w-full px-3 py-2 text-sm rounded-lg bg-surface-elevated border border-border-default focus:border-brand-500/60 outline-none"})]}),S&&r.jsx("div",{className:"rounded-lg bg-red-500/10 border border-red-500/25 px-3 py-2 text-xs text-red-500",children:S}),r.jsxs("button",{type:"button",onClick:()=>{ae()},disabled:f==="busy"||!I.trim(),className:"w-full px-3 py-2.5 text-sm font-medium rounded-lg bg-brand-600 text-white hover:bg-brand-500 transition-colors disabled:opacity-60 flex items-center justify-center gap-2",children:[f==="busy"&&r.jsxs("svg",{className:"animate-spin",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:[r.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",opacity:"0.25"}),r.jsx("path",{d:"M22 12a10 10 0 0 0-10-10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]}),f==="busy"?s("deliverables:share.sharing",{defaultValue:"分享中…"}):s("deliverables:share.shareToHub",{defaultValue:"分享到 Hub"})]})]})})})]})]})}export{Ve as D,me as c};
|
|
1
|
+
import{u as ce,r as u,h as A,o as de,t as ue,l as N,j as r}from"./index-B1VN5yM1.js";const O=50*1024*1024;class H extends Error{constructor(e){super(e),this.name="DeliverableShareError"}}class Z extends H{constructor(){super("需要登录 Markus Hub 账号后才能分享产出物。"),this.name="NotLoggedIntoHubError"}}class fe extends H{bytes;limit;constructor(e,a){super(`产出物文件大小 ${e} 字节超过上限 ${a} 字节(50MB),请压缩或拒绝分享。`),this.name="DeliverableTooLargeError",this.bytes=e,this.limit=a}}class he extends H{status;constructor(e,a){super(`Hub 请求失败 (HTTP ${e}): ${a}`),this.name="HubApiError",this.status=e}}function be(t){const e=t.replace(/\s+/g,"");if(!e)return 0;let a=0;return e.endsWith("==")?a=2:e.endsWith("=")&&(a=1),Math.floor(e.length*3/4)-a}function V(t,e){const a=t&&typeof t=="object"?t:{},l=a.share??a.deliverable??{},s=m=>a[m]??l[m],i=s("id")??s("shareId")??"",c=s("slug"),o=c!=null?String(c):void 0,d=s("url")??s("shareUrl");let h=null;d!=null?h=String(d):o&&e&&(h=`${e.replace(/\/+$/,"")}/deliverable/${encodeURIComponent(o)}`);const f=s("reason")??s("rejectNote"),p=s("localDeliverableId")??s("localId");return{id:String(i),slug:o,visibility:s("visibility")??"public",status:s("status")??"pending_review",url:h,reason:f!=null?String(f):null,localId:p!=null?String(p):null}}class pe{basePath;fetchImpl;hubOrigin;constructor(e){this.getHubToken=e.getHubToken,this.hubOrigin=e.hubUrl,this.basePath=(e.proxyBasePath??"/api/hub").replace(/\/+$/,""),this.fetchImpl=e.fetch??(globalThis.fetch?globalThis.fetch.bind(globalThis):(()=>{throw new Error("fetch unavailable")}))}getHubToken;isHubLoggedIn(){return!!this.getHubToken()}assertHubLoggedIn(){if(!this.getHubToken())throw new Z}async doFetch(e,a){const l=this.getHubToken(),s={"Content-Type":"application/json",...a.headers};l&&(s.Authorization=`Bearer ${l}`);const i=await this.fetchImpl(`${this.basePath}${e}`,{...a,headers:s,credentials:"include"});let c=null;try{c=await i.json()}catch{c=null}if(!i.ok){const o=c&&typeof c=="object"&&"error"in c?String(c.error):i.statusText||`HTTP ${i.status}`;throw new he(i.status,o)}return{status:i.status,data:c}}async publish(e){this.assertHubLoggedIn();const a=e.fileSizeBytes??(e.fileBase64?be(e.fileBase64):0);if(a>O)throw new fe(a,O);const l={localDeliverableId:e.localId,visibility:e.visibility,title:e.title,summary:e.summary,tags:e.tags,filename:e.filename,format:e.format,producerAgent:{id:e.producerAgent.id,name:e.producerAgent.name,source:e.producerAgent.source}};e.content&&(l.content=e.content),e.fileBase64&&(l.fileBase64=e.fileBase64);const{data:s}=await this.doFetch("/deliverables/publish",{method:"POST",body:JSON.stringify(l)});return V(s,this.hubOrigin)}async pollStatus(e){this.assertHubLoggedIn();const{data:a}=await this.doFetch(`/deliverables/status?localId=${encodeURIComponent(e)}`,{method:"GET"});return V(a,this.hubOrigin)}async listMine(){this.assertHubLoggedIn();const{data:e}=await this.doFetch("/deliverables/mine",{method:"GET"}),a=e&&typeof e=="object"?e:{};return(Array.isArray(a.shares)?a.shares:[]).map(s=>V(s,this.hubOrigin))}async revoke(e){this.assertHubLoggedIn();const{data:a}=await this.doFetch("/deliverables/revoke",{method:"POST",body:JSON.stringify({localId:e})});return{...V(a,this.hubOrigin),status:"revoked",url:null}}}function me(t,e){return new pe({getHubToken:t,hubUrl:e,proxyBasePath:"/api/hub"})}const ge=/\.(png|jpe?g|gif|webp|svg|bmp|avif|ico)$/i,xe=/\.(mp4|webm|mp3|wav|ogg|m4a|mov|avi|mkv|flac)$/i;function K(t){return ge.test(t)?"image":xe.test(t)?"media":"other"}function ye(t){return t.replace(/^file:\/\//i,"").replace(/^file:/i,"")}function G(t){const e=t.match(/!?\[[^\]]*\]\(([^)]+)\)/);if(e)return e[1].trim().split(/\s+(?="|')/)[0].trim()||null;const a=t.match(/(?:src|href|poster)\s*=\s*["']([^"']+)["']/i);return a?a[1]:null}function X(t){return!t||/^(https?:|data:|mailto:|tel:|#)/i.test(t)||t.startsWith("//")?!1:(t.startsWith("/api/files/"),!0)}function J(t,e){if(!t)return null;const a=t.trim(),l=a.match(/^\/api\/files\/(?:image|stream|preview)\?path=([^&]+)/i);if(l)try{return decodeURIComponent(l[1])||null}catch{return l[1]||null}return/^file:\/\//i.test(a)?ye(a).replace(/\\/g,"/"):/^[a-zA-Z]:[\\/]/.test(a)?a.replace(/\\/g,"/"):a.startsWith("/")?a:e&&(a.startsWith("./")||a.startsWith("../")||!a.includes("://"))?`${e.replace(/\\/g,"/").replace(/\/+$/,"")}/${a.replace(/^\.\//,"").replace(/\\/g,"/")}`:null}function ve(t,e){const a=[],l=new Set,s=/!?\[[^\]]*\]\(([^)\s]+(?:\s+["'][^"']*["'])?)\)/g;for(const c of t.matchAll(s)){const o=c[0],d=G(o);if(!d||!X(d))continue;const h=J(d,e);!h||l.has(o)||(l.add(o),a.push({raw:o,localPath:h,kind:K(h.split("?")[0])}))}const i=/<[a-zA-Z][^>]*(?:src|href|poster)\s*=\s*["'][^"']+["'][^>]*>/gi;for(const c of t.matchAll(i)){const o=c[0],d=G(o);if(!d||!X(d))continue;const h=J(d,e);!h||l.has(o)||(l.add(o),a.push({raw:o,localPath:h,kind:K(h.split("?")[0])}))}return{refs:a,baseDir:e??""}}function ke(t,e){let a=t;for(const[l,s]of e){const i=we(l,s);a=a.split(l).join(i)}return a}function we(t,e){const a=t.match(/^(!?\[[^\]]*\])\([^)]*\)$/);if(a)return`${a[1]}(${e})`;const l=t.match(/(src|href|poster)(\s*=\s*)(["'])[^"']*\3/i);return l?t.replace(/(src|href|poster)(\s*=\s*)(["'])[^"']*\3/i,`${l[1]}${l[2]}${l[3]}${e}${l[3]}`):e}function je(t,e){return/^https?:\/\//i.test(t)?t:`${e.replace(/\/+$/,"")}${t.startsWith("/")?"":"/"}${t}`}function Ne(t,e,a){const l=new Map,s=new Map(t.map(i=>[i.localPath,i]));for(const i of e){if(!i.key)continue;const c=s.get(i.key);!c||!i.url||l.set(c.raw,je(i.url,a))}return l}async function He(t){try{const e=N.files.streamUrl(t),a=await fetch(e).then(d=>d.ok?d.blob():null);if(!a)return null;const l=await a.arrayBuffer(),s=new Uint8Array(l);let i="";const c=32768;for(let d=0;d<s.length;d+=c)i+=String.fromCharCode.apply(null,Array.from(s.subarray(d,d+c)));const o=t.split("/").pop()||"media";return{base64:btoa(i),filename:o}}catch{return null}}async function Ie(t,e){const a=new Map;if(t.length===0)return a;const l=[];for(const c of t){const o=await He(c.localPath);o&&l.push({key:c.localPath,filename:o.filename,base64:o.base64})}if(l.length===0)return a;const{files:s,errors:i}=await A.uploadMediaBatch(l);return i.length>0&&console.warn("[deliverable-share] media upload errors:",i),Ne(t,s,e)}async function Se(t,e,a){if(!t||e==="directory"||t.startsWith("http://")||t.startsWith("https://"))return{};try{const l=await N.files.preview(t);if((l.type==="text"||l.type==="markdown"||l.type==="html"||l.type==="json"||l.type==="csv")&&typeof l.content=="string"){if(!(l.type==="markdown"||l.type==="html"))return{content:l.content};const i=t.replace(/[/\\]/g,"/").split("/").slice(0,-1).join("/"),{refs:c}=ve(l.content,i);if(c.length===0)return{content:l.content};const o=await Ie(c,a);return o.size===0?{content:l.content}:{content:ke(l.content,o),uploadedMedia:o.size}}if(l.type==="image"||l.type==="audio"||l.type==="video"||l.type==="binary"){const s=l.streamUrl||(l.path?N.files.streamUrl(l.path):N.files.streamUrl(t)),c=await(await fetch(s).then(f=>f.blob())).arrayBuffer(),o=new Uint8Array(c);let d="";const h=32768;for(let f=0;f<o.length;f+=h)d+=String.fromCharCode.apply(null,Array.from(o.subarray(f,f+h)));return{fileBase64:btoa(d)}}return{}}catch{return{}}}function Ve({item:t,onClose:e,onShared:a,service:l}){const{t:s}=ce(["deliverables","common"]),i=u.useMemo(()=>l??me(de,A.getUrl()),[l]),[c,o]=u.useState(()=>i?i.isHubLoggedIn():null),[d,h]=u.useState(!1),[f,p]=u.useState(()=>{const n=t.shareStatus;return n==="published"?"published":n==="pending_review"?"pending_review":n==="rejected"?"rejected":"form"}),[m,B]=u.useState("public"),[I,Y]=u.useState(t.title||""),[C,q]=u.useState(t.summary||""),[g,$]=u.useState(Array.isArray(t.tags)?[...t.tags]:[]),[k,M]=u.useState(""),[L,Q]=u.useState(null),[R,P]=u.useState(!1),[S,x]=u.useState(null),U=u.useRef(a);U.current=a;const y=u.useCallback(n=>{Q(n);const b=n.status;p(b==="published"?"published":b==="rejected"?"rejected":b==="revoked"?"revoked":b==="pending_review"?"pending_review":"form"),U.current?.(n)},[]);u.useEffect(()=>{o(i.isHubLoggedIn())},[i]);const ee=u.useCallback(async()=>{h(!0),x(null);try{await ue({force:!0}),o(i.isHubLoggedIn())}catch{o(i.isHubLoggedIn())}finally{h(!1)}},[i]),E=u.useCallback(()=>{const n=k.trim().replace(/^#/,"");n&&!g.includes(n)&&$(b=>[...b,n]),M("")},[k,g]),te=u.useCallback(n=>{$(b=>b.filter(v=>v!==n))},[]),re=u.useCallback(n=>{n.key==="Enter"||n.key===","?(n.preventDefault(),E()):n.key==="Backspace"&&!k&&g.length&&$(b=>b.slice(0,-1))},[E,k,g.length]),se=u.useCallback(()=>{const n=L?.url??t.shareUrl;n&&navigator.clipboard?.writeText(n).then(()=>{P(!0),setTimeout(()=>P(!1),1500)}).catch(()=>{})},[L,t.shareUrl]),ae=u.useCallback(async()=>{x(null),p("busy");try{const n=t.reference.replace(/[/\\]/g,"/").split("/").pop()||"deliverable",b=A.getUrl(),{content:v,fileBase64:ne,uploadedMedia:W}=await Se(t.reference,t.type,b);W&&console.info(`[deliverable-share] uploaded ${W} local media reference(s) to Hub`);const w=t.agentId??"";let _=w;if(w)try{const{agents:ie}=await N.agents.list(),z=ie.find(oe=>oe.id===w);z&&(_=z.name||w)}catch{}const j=await i.publish({localId:t.id,title:I.trim()||t.title,summary:C.trim(),tags:g,visibility:m,filename:n,format:t.format||"markdown",content:v,fileBase64:ne,producerAgent:{id:w,name:_,source:"local"}});y(j),j.status==="rejected"?x(typeof j.reason=="string"&&j.reason?j.reason:"分享被拒绝"):e()}catch(n){if(p("form"),n instanceof Z){o(!1);return}x(n instanceof H||n instanceof Error?n.message:String(n))}},[i,t,I,C,g,m,y]),le=u.useCallback(async()=>{x(null);try{const n=await i.revoke(t.id);y({...n,status:"revoked",url:null})}catch(n){x(n instanceof H?n.message:String(n))}},[i,t.id,y]),D=u.useCallback(()=>{p("form"),x(null)},[]);u.useEffect(()=>{if(f!=="pending_review")return;let n=!1;const b=setInterval(async()=>{try{const v=await i.pollStatus(t.id);if(n)return;v.status!=="pending_review"&&y(v)}catch{}},8e3);return()=>{n=!0,clearInterval(b)}},[f,i,t.id,y]),u.useEffect(()=>{const n=b=>{b.key==="Escape"&&e()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[e]);const T=m==="link",F=L?.url??t.shareUrl;return r.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",onClick:e,children:[r.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm"}),r.jsxs("div",{className:"relative bg-surface-primary rounded-2xl shadow-2xl border border-border-default w-full max-w-md max-h-[85vh] overflow-y-auto",onClick:n=>n.stopPropagation(),children:[r.jsxs("div",{className:"sticky top-0 bg-surface-primary/95 backdrop-blur-sm border-b border-border-default px-5 py-4 flex items-center justify-between rounded-t-2xl z-10",children:[r.jsx("h3",{className:"text-base font-semibold text-fg-primary",children:s("deliverables:share.title",{defaultValue:"分享到 Markus Hub"})}),r.jsx("button",{onClick:e,className:"p-1.5 rounded-lg hover:bg-surface-overlay transition-colors text-fg-tertiary hover:text-fg-primary",children:r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),r.jsx("div",{className:"px-5 py-4 space-y-4",children:c===!1?r.jsxs("div",{className:"space-y-4 py-2",children:[r.jsxs("div",{className:"flex items-start gap-3 rounded-xl bg-amber-500/10 border border-amber-500/25 p-3",children:[r.jsx("span",{className:"text-lg",children:"🔑"}),r.jsx("p",{className:"text-sm text-fg-secondary",children:s("deliverables:share.needHubLogin",{defaultValue:"需登录 Markus Hub 账号后才能分享产出物。"})})]}),r.jsx("button",{onClick:()=>{ee()},disabled:d,className:"w-full px-3 py-2 text-sm font-medium rounded-lg bg-brand-600 text-white hover:bg-brand-500 transition-colors disabled:opacity-60",children:d?s("deliverables:share.loggingIn",{defaultValue:"正在打开登录…"}):s("deliverables:share.loginHub",{defaultValue:"登录 Markus Hub 账号"})}),r.jsx("p",{className:"text-[11px] text-fg-tertiary",children:s("deliverables:share.loginHint",{defaultValue:"解锁后将支持一键公开/链接分享产出物。"})})]}):r.jsx(r.Fragment,{children:f==="published"?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"px-2 py-0.5 text-[11px] rounded-full bg-green-500/15 text-green-500 font-medium",children:s("deliverables:share.published",{defaultValue:"已发布"})}),r.jsx("span",{className:"text-[11px] text-fg-tertiary",children:m==="link"?s("deliverables:share.linkVisibility",{defaultValue:"有链接可见"}):s("deliverables:share.publicVisibility",{defaultValue:"公开"})})]}),F?r.jsxs("div",{className:"flex items-center gap-2 bg-surface-elevated rounded-lg px-3 py-2",children:[r.jsx("span",{className:"text-xs text-fg-secondary font-mono break-all flex-1 select-all",children:F}),r.jsx("button",{onClick:se,className:`px-2 py-1 text-[10px] rounded transition-colors shrink-0 ${R?"bg-green-500/20 text-green-500":"bg-brand-600/20 text-brand-500 hover:bg-brand-600/30"}`,children:R?s("common:copied",{defaultValue:"已复制"}):s("common:copy",{defaultValue:"复制链接"})})]}):r.jsx("p",{className:"text-xs text-fg-tertiary",children:s("deliverables:share.urlPending",{defaultValue:"链接生成中,稍后刷新查看…"})}),r.jsx("button",{onClick:()=>{le()},className:"w-full px-3 py-2 text-xs font-medium rounded-lg text-red-500 border border-red-500/30 hover:bg-red-500/10 transition-colors",children:s("deliverables:share.revoke",{defaultValue:"取消分享"})})]}):f==="pending_review"?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-amber-500 animate-pulse"}),r.jsx("span",{className:"px-2 py-0.5 text-[11px] rounded-full bg-amber-500/15 text-amber-500 font-medium",children:s("deliverables:share.pendingReview",{defaultValue:"审核中"})})]}),r.jsx("p",{className:"text-sm text-fg-secondary",children:s("deliverables:share.pendingHint",{defaultValue:"你的产出物已提交审核,通过后将生成可分享链接。"})})]}):f==="rejected"?r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("span",{className:"px-2 py-0.5 text-[11px] rounded-full bg-red-500/15 text-red-500 font-medium",children:s("deliverables:share.rejected",{defaultValue:"已拒绝"})})}),S&&r.jsx("div",{className:"rounded-lg bg-red-500/10 border border-red-500/25 px-3 py-2 text-xs text-red-500",children:S}),r.jsx("button",{onClick:D,className:"w-full px-3 py-2 text-sm font-medium rounded-lg bg-brand-600 text-white hover:bg-brand-500 transition-colors",children:s("deliverables:share.resubmit",{defaultValue:"重新提交"})})]}):f==="revoked"?r.jsxs("div",{className:"space-y-3",children:[r.jsx("p",{className:"text-sm text-fg-secondary",children:s("deliverables:share.revoked",{defaultValue:"已取消分享,该产出物不再公开可访问。"})}),r.jsx("button",{onClick:D,className:"w-full px-3 py-2 text-sm font-medium rounded-lg bg-brand-600 text-white hover:bg-brand-500 transition-colors",children:s("deliverables:share.shareAgain",{defaultValue:"重新分享"})})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider font-medium",children:s("deliverables:share.visibility",{defaultValue:"可见性"})}),r.jsxs("label",{className:`flex items-start gap-3 rounded-xl border p-3 cursor-pointer transition-colors ${T?"border-border-default hover:bg-surface-elevated":"border-brand-500/50 bg-brand-500/5"}`,children:[r.jsx("input",{type:"radio",name:"visibility",checked:!T,onChange:()=>B("public"),className:"mt-0.5 accent-brand-500"}),r.jsxs("span",{className:"space-y-0.5",children:[r.jsx("span",{className:"block text-sm font-medium text-fg-primary",children:s("deliverables:share.public",{defaultValue:"公开(所有人可见 + 搜索引擎)"})}),r.jsx("span",{className:"block text-[11px] text-fg-tertiary",children:s("deliverables:share.publicHint",{defaultValue:"公开产出物需经 Hub 审核后发布,发布后所有人可见并参与搜索"})})]})]}),r.jsxs("label",{className:`flex items-start gap-3 rounded-xl border p-3 cursor-pointer transition-colors ${T?"border-brand-500/50 bg-brand-500/5":"border-border-default hover:bg-surface-elevated"}`,children:[r.jsx("input",{type:"radio",name:"visibility",checked:T,onChange:()=>B("link"),className:"mt-0.5 accent-brand-500"}),r.jsxs("span",{className:"space-y-0.5",children:[r.jsx("span",{className:"block text-sm font-medium text-fg-primary",children:s("deliverables:share.link",{defaultValue:"有链接可见"})}),r.jsx("span",{className:"block text-[11px] text-fg-tertiary",children:s("deliverables:share.linkHint",{defaultValue:"仅获得链接的人可查看,不参与搜索引擎;同样需经 Hub 审核"})})]})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider font-medium",children:s("deliverables:share.titleField",{defaultValue:"标题"})}),r.jsx("input",{value:I,onChange:n=>Y(n.target.value),placeholder:s("deliverables:share.titlePlaceholder",{defaultValue:"清晰、可检索的标题"}),className:"w-full px-3 py-2 text-sm rounded-lg bg-surface-elevated border border-border-default focus:border-brand-500/60 outline-none"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider font-medium",children:s("deliverables:share.summary",{defaultValue:"摘要"})}),r.jsx("textarea",{value:C,onChange:n=>q(n.target.value),rows:3,placeholder:s("deliverables:share.summaryPlaceholder",{defaultValue:"简要描述该产出物…"}),className:"w-full px-3 py-2 text-sm rounded-lg bg-surface-elevated border border-border-default focus:border-brand-500/60 outline-none resize-y"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider font-medium",children:s("deliverables:share.tags",{defaultValue:"标签"})}),r.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:g.map(n=>r.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-[11px] bg-surface-elevated rounded-md text-fg-secondary",children:[n,r.jsx("button",{onClick:()=>te(n),className:"text-fg-tertiary hover:text-red-500","aria-label":"remove",children:r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},n))}),r.jsx("input",{value:k,onChange:n=>M(n.target.value),onKeyDown:re,onBlur:E,placeholder:s("deliverables:share.tagsPlaceholder",{defaultValue:"输入标签后回车添加"}),className:"w-full px-3 py-2 text-sm rounded-lg bg-surface-elevated border border-border-default focus:border-brand-500/60 outline-none"})]}),S&&r.jsx("div",{className:"rounded-lg bg-red-500/10 border border-red-500/25 px-3 py-2 text-xs text-red-500",children:S}),r.jsxs("button",{type:"button",onClick:()=>{ae()},disabled:f==="busy"||!I.trim(),className:"w-full px-3 py-2.5 text-sm font-medium rounded-lg bg-brand-600 text-white hover:bg-brand-500 transition-colors disabled:opacity-60 flex items-center justify-center gap-2",children:[f==="busy"&&r.jsxs("svg",{className:"animate-spin",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:[r.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",opacity:"0.25"}),r.jsx("path",{d:"M22 12a10 10 0 0 0-10-10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]}),f==="busy"?s("deliverables:share.sharing",{defaultValue:"分享中…"}):s("deliverables:share.shareToHub",{defaultValue:"分享到 Hub"})]})]})})})]})]})}export{Ve as D,me as c};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{u as nt,j as e,r as a,a as us,b as xs,m as fs,d as hs,c as ms,l as p,w as tt,o as Ut,p as ps,P as L,n as Q,M as gs,q as Pe,h as bs,i as zt,s as ys}from"./index-B-xjev59.js";import{resolveFormat as vs,ContentRenderer as js}from"./ContentRenderer-CbJWw6ni.js";import{c as ks,D as Ns}from"./DeliverableShareModal-CHdOyC9c.js";function M(u){return Array.isArray(u)?u.map(o=>String(o).trim()).filter(Boolean):typeof u=="string"&&u?u.split(",").map(o=>o.trim()).filter(Boolean):[]}function ws(u){return u.files&&typeof u.files=="object"&&!Array.isArray(u.files)?u.files:null}function J({label:u,value:o}){return o?e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:u}),e.jsx("div",{className:"text-xs text-fg-secondary mt-0.5",children:o})]}):null}function re({label:u,value:o,color:c}){if(!o)return null;const n={purple:"bg-brand-500/15 text-brand-500",cyan:"bg-blue-500/15 text-blue-600",indigo:"bg-brand-500/15 text-brand-500",gray:"bg-gray-500/15 text-fg-secondary",emerald:"bg-green-500/15 text-green-600"};return e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:u}),e.jsx("div",{className:`mt-0.5 px-2 py-0.5 rounded-full text-[10px] font-medium ${n[c]??n.gray} capitalize inline-block`,children:o})]})}function st({files:u}){const{t:o}=nt(["builder","common"]),[c,n]=a.useState(Object.keys(u)[0]??""),x=Object.keys(u);return x.length===0?null:e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:o("builder:artifact.files",{count:x.length})}),e.jsxs("div",{className:"mt-1 bg-surface-elevated/50 rounded-lg border border-border-default/30 overflow-hidden",children:[e.jsx("div",{className:"flex gap-0.5 px-1.5 py-1 border-b border-border-default/30 overflow-x-auto",children:x.map(b=>e.jsx("button",{onClick:()=>n(b),className:`px-2 py-0.5 text-[10px] rounded whitespace-nowrap transition-colors ${c===b?"bg-brand-600/30 text-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:b},b))}),c&&u[c]!=null&&e.jsx("pre",{className:"p-2 text-[10px] text-fg-secondary max-h-[120px] overflow-auto whitespace-pre-wrap font-mono",children:u[c]})]})]})}function Ss({artifact:u,mode:o}){const{t:c}=nt(["builder","common"]),n=ws(u),x=u.agent,b=u.team,A=u.dependencies,N=u.displayName??u.name;if(o==="agent"){const k=x?.roleName,$=x?.agentRole,y=x?.llmProvider,P=x?.llmModel,g=M(A?.env),I=M(A?.skills);return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(J,{label:c("builder:artifact.name"),value:N}),e.jsx(J,{label:c("builder:artifact.description"),value:u.description}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[k&&e.jsx(re,{label:c("builder:artifact.baseTemplate"),value:k,color:"indigo"}),e.jsx(re,{label:c("builder:artifact.agentRole"),value:$,color:$==="manager"?"purple":"cyan"})]}),M(u.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:M(u.tags).map(v=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:v},v))}),(y||P)&&e.jsxs("div",{className:"flex gap-2",children:[y&&e.jsx(re,{label:c("builder:artifact.llmProvider"),value:y,color:"gray"}),P&&e.jsx(re,{label:c("builder:artifact.llmModel"),value:P,color:"gray"})]}),g.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:c("builder:artifact.requiredEnv")}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:g.map(v=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-amber-500/10 text-amber-600 rounded font-mono",children:v},v))})]}),I.length>0&&e.jsx(J,{label:c("builder:artifact.skills"),value:I.join(", ")}),n&&e.jsx(st,{files:n})]})}if(o==="team"){const $=b?.members??[];return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(J,{label:c("builder:artifact.name"),value:N}),e.jsx(J,{label:c("builder:artifact.description"),value:u.description}),e.jsx("div",{className:"flex flex-wrap gap-2",children:e.jsx(re,{label:c("builder:artifact.category"),value:u.category,color:"indigo"})}),M(u.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:M(u.tags).map(y=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:y},y))}),n&&e.jsx(st,{files:n}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:c("builder:artifact.members",{count:$.length})}),e.jsx("div",{className:"mt-1.5 space-y-1.5",children:$.map((y,P)=>e.jsxs("div",{className:"bg-surface-elevated/30 rounded-lg px-2 py-1.5 border border-border-default/20",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`w-5 h-5 rounded flex items-center justify-center text-[10px] font-bold ${y.role==="manager"?"bg-brand-500/20 text-brand-500":"bg-blue-500/20 text-blue-600"}`,children:y.role==="manager"?"★":P+1}),e.jsx("span",{className:"text-xs text-fg-secondary flex-1 truncate",children:y.name}),typeof y.roleName=="string"&&y.roleName&&e.jsx("span",{className:"text-[10px] text-brand-500/70 font-mono",children:y.roleName}),e.jsxs("span",{className:"text-[10px] text-fg-tertiary",children:["x",String(y.count??1)]})]}),M(y.skills).length>0&&e.jsx("div",{className:"mt-1 ml-7 flex flex-wrap gap-1",children:M(y.skills).map(g=>e.jsx("span",{className:"px-1 py-0.5 text-[9px] bg-green-500/10 text-green-600 rounded font-mono",children:g},g))})]},P))})]})]})}return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(J,{label:c("builder:artifact.name"),value:N}),e.jsx(J,{label:c("builder:artifact.description"),value:u.description}),e.jsx("div",{className:"flex gap-2",children:e.jsx(re,{label:c("builder:artifact.category"),value:u.category,color:"indigo"})}),n&&e.jsx(st,{files:n}),M(u.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:M(u.tags).map(k=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:k},k))})]})}const ne={file:{icon:"📄",color:"bg-green-500/10 text-green-600"},directory:{icon:"📁",color:"bg-blue-500/10 text-blue-600"}},Cs=["file","directory"];function Be(u){return/^https?:\/\//i.test(u)}function S(u){return u?.shareStatus??null}function Ls(u,o){const c=Date.now(),n=new Date(u).getTime(),x=c-n,b=Math.floor(x/6e4);if(b<1)return o("time.justNow");if(b<60)return o("time.minutesAgo",{count:b});const A=Math.floor(b/60);if(A<24)return o("time.hoursAgo",{count:A});const N=Math.floor(A/24);if(N===1)return o("time.yesterday");if(N<30)return o("time.daysAgo",{count:N});const k=Math.floor(N/30);return k<12?o("time.monthsAgo",{count:k}):o("time.yearsAgo",{count:Math.floor(k/12)})}const F={agent:{icon:"✦",color:"bg-brand-500/10 text-brand-500"},team:{icon:"◈",color:"bg-blue-500/10 text-blue-600"},skill:{icon:"⬡",color:"bg-amber-500/10 text-amber-600"}};function Ts({authUser:u,previewMode:o,previewData:c}={}){const{t:n}=nt(["deliverables","common"]),x=us(),b=xs(L.DELIVERABLES),A=fs({side:"left",defaultWidth:384,minWidth:280,maxWidth:600,storageKey:"markus_deliverables_list"}),[N,k]=a.useState(!1),$=a.useRef(N);$.current=N,a.useEffect(()=>{if(!x)return;const t=()=>{$.current&&k(!1)};return window.addEventListener("popstate",t),()=>window.removeEventListener("popstate",t)},[x]);const y=100,P=5e3,[g,I]=a.useState(c?.items??[]),[v,ae]=a.useState(c?.items?.length??0),[le,at]=a.useState(!1),[lt,it]=a.useState(c?.projects??[]),[ot,ct]=a.useState(c?.agents??[]),[dt,Kt]=a.useState([]),[_,ut]=a.useState(!c),[ye,ve]=a.useState(""),[ie,je]=a.useState(""),[B,oe]=a.useState(""),[D,ce]=a.useState(""),[R,xt]=a.useState("date"),[r,C]=a.useState(()=>c?.initialSelectedId&&c.items?c.items.find(t=>t.id===c.initialSelectedId)??c.items[0]??null:c?.items?.[0]??null),[De,ft]=a.useState(null),[ht,mt]=a.useState(""),[U,Gt]=a.useState(!0),[Ve,de]=a.useState(()=>{const t=new Date,s=`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`;return new Set([s])}),[He,qt]=a.useState(!1),[We,pt]=a.useState(!1),Yt=a.useMemo(()=>[{id:"date"},{id:"project"},{id:"team"},{id:"agent"}],[]),Qt=a.useCallback(t=>{xt(t)},[]),gt=hs(Yt,R,Qt),z=a.useRef(null),[ke,Ne]=a.useState(null),[we,bt]=a.useState("markdown"),[ue,yt]=a.useState(null),[xe,vt]=a.useState(null),[jt,kt]=a.useState(!1),[Nt,fe]=a.useState(!1),[Se,wt]=a.useState(!1),[Fe,Ce]=a.useState(null),[Jt,_e]=a.useState(!1),[Ue,Xt]=a.useState(""),[St,Zt]=a.useState(new Set),[V,O]=a.useState(!1),E=ms(),X=E?.keyboardPane??"content",[he,Z]=a.useState(null),[ee,K]=a.useState(!1),[me,ze]=a.useState(""),[H,G]=a.useState(!1),[Oe,Ct]=a.useState(!1),[Ke,q]=a.useState(null),Ge=a.useRef(null),Lt=a.useCallback(t=>{t&&(t.style.height="auto",t.style.height=t.scrollHeight+"px")},[]),It=a.useRef(void 0);a.useEffect(()=>{Lt(Ge.current)},[me,ee,Lt]);const T=(t,s)=>{ft({type:t,text:s}),setTimeout(()=>ft(null),3e3)},Rt=async t=>{await ys(t)?(wt(!0),setTimeout(()=>wt(!1),1500)):T("error",n("detail.copyFailed"))},Le=a.useMemo(()=>new Map(ot.map(t=>[t.id,t])),[ot]),qe=a.useMemo(()=>new Map(lt.map(t=>[t.id,t])),[lt]),Et=a.useMemo(()=>new Map(dt.map(t=>[t.id,t])),[dt]),Ie=a.useCallback(t=>{if(!t||t==="default")return null;const s=qe.get(t)?.name;return!s||s==="default"?null:s},[qe]);a.useEffect(()=>{o||(p.projects.list().then(t=>it(t.projects)).catch(()=>{}),p.agents.list().then(t=>ct(t.agents??[])).catch(()=>{}),p.teams.list().then(t=>Kt(t.teams??[])).catch(()=>{}),p.system.storage().then(t=>Xt(t.dataDir+"/shared")).catch(()=>{}),p.deliverables.checkHealth().then(t=>Zt(new Set(t.missingFiles))).catch(()=>{}))},[o]),a.useEffect(()=>(It.current=setTimeout(()=>je(ye),300),()=>clearTimeout(It.current)),[ye]);const te=a.useMemo(()=>({q:ie||void 0,type:B||void 0,artifactType:D||void 0}),[ie,B,D]),se=R==="date"?y:P,Ye=a.useCallback((t,s)=>s?{...s,hubShareId:s.hubShareId!=null?s.hubShareId:t.hubShareId??null,shareStatus:s.shareStatus!=null?s.shareStatus:t.shareStatus??null,shareUrl:s.shareUrl!=null?s.shareUrl:t.shareUrl??null,shareVisibility:s.shareVisibility!=null?s.shareVisibility:t.shareVisibility??null,shareReason:s.shareReason!=null?s.shareReason:t.shareReason}:t,[]),Re=a.useCallback(async()=>{try{const{results:t,total:s}=await p.deliverables.search({...te,offset:0,limit:se});I(i=>i.map(l=>{const f=t.find(d=>d.id===l.id);return f?Ye(l,f):l})),ae(s),C(i=>{if(!i)return null;const l=t.find(f=>f.id===i.id);return l?Ye(i,l):i})}catch{}},[te,se,Ye]),Y=a.useCallback(async()=>{ut(!0),z.current?.scrollTo({top:0,behavior:"instant"});try{const{results:t,total:s}=await p.deliverables.search({...te,offset:0,limit:se});I(t),ae(s),C(i=>i&&t.some(l=>l.id===i.id)?i:null)}catch{I([]),ae(0),C(null)}ut(!1)},[te,se]),Ee=a.useCallback(async()=>{if(!(le||g.length>=v)){at(!0);try{const{results:t,total:s}=await p.deliverables.search({...te,offset:g.length,limit:se});I(i=>[...i,...t]),ae(s)}catch{}at(!1)}},[te,se,g.length,v,le]);a.useEffect(()=>{o||Y()},[Y,o]),a.useEffect(()=>{!o||!c||(I(c.items??[]),ae(c.items?.length??0),it(c.projects??[]),ct(c.agents??[]),c.initialSelectedId&&C(c.items?.find(t=>t.id===c.initialSelectedId)??c.items?.[0]??null))},[o,c]);const Qe=a.useRef(r);Qe.current=r,a.useEffect(()=>{if(o||!b)return;const t=tt.on("deliverable:created",()=>Y()),s=tt.on("deliverable:updated",l=>{Re();const f=l.payload?.deliverableId;f&&Qe.current?.id===f&&p.deliverables.get(f).then(d=>{d.deliverable&&(C(h=>({...h??d.deliverable,...d.deliverable,hubShareId:h?.hubShareId??d.deliverable.hubShareId??null,shareStatus:h?.shareStatus??d.deliverable.shareStatus??null,shareUrl:h?.shareUrl??d.deliverable.shareUrl??null,shareVisibility:h?.shareVisibility??d.deliverable.shareVisibility??null,shareReason:h?.shareReason??d.deliverable.shareReason??null})),At(d.deliverable))}).catch(()=>{})}),i=tt.on("deliverable:removed",()=>Y());return()=>{t(),s(),i()}},[Re,b,o]);const Tt=a.useMemo(()=>ks(Ut,bs.getUrl()),[]);a.useEffect(()=>{if(o||!b||!Ut())return;let t=!1;const s=async()=>{try{const l=await Tt.listMine();if(t)return;const f=new Map,d=new Map;for(const m of l)m.id&&f.set(m.id,m),m.localId&&d.set(m.localId,m);const h=new Map;I(m=>m.map(j=>{const w=j.hubShareId&&f.get(j.hubShareId)||d.get(j.id);if(!w)return j;const be={hubShareId:j.hubShareId??w.id??null,shareStatus:w.status??null,shareUrl:w.url??null,shareVisibility:j.shareVisibility??w.visibility??null,...w.reason!=null?{shareReason:w.reason}:{}};return h.set(j.id,be),{...j,...be}})),C(m=>{if(!m)return m;const j=h.get(m.id);return j?{...m,...j}:m});for(const[m,j]of h)p.deliverables.update(m,j).catch(w=>{console.warn("[deliverables] Hub 分享状态本地持久化失败:",w)})}catch{}};s();const i=setInterval(s,3e4);return()=>{t=!0,clearInterval(i)}},[Tt,b,o]);const Te=a.useRef(null),Je=a.useRef(g);Je.current=g;const pe=a.useCallback(t=>{const s=l=>{C(l),x&&(k(!0),history.pushState({mobileDetail:L.DELIVERABLES},"",window.location.hash))},i=Je.current.find(l=>l.id===t);if(i){s(i);return}p.deliverables.get(t).then(l=>{l.deliverable&&s(l.deliverable)}).catch(()=>{})},[x]);a.useEffect(()=>{if(o)return;const t=window.location.hash.slice(1).split("/"),s=ps(t[0])===L.DELIVERABLES?t[1]:void 0,i=localStorage.getItem("markus_nav_openDeliverable")||s;i&&(localStorage.removeItem("markus_nav_openDeliverable"),Je.current.length>0?pe(i):Te.current=i);const l=f=>{const d=f.detail;d?.params?.openDeliverable&&(localStorage.removeItem("markus_nav_openDeliverable"),pe(d.params.openDeliverable))};return window.addEventListener("markus:navigate",l),()=>window.removeEventListener("markus:navigate",l)},[pe,o]),a.useEffect(()=>{const t=Te.current;!t||g.length===0||(Te.current=null,pe(t))},[g,pe]);const Mt=a.useCallback(()=>{const t=z.current;!t||_||le||g.length>=v||t.scrollHeight<=t.clientHeight+100&&Ee()},[_,le,g.length,v,Ee]);a.useEffect(()=>{const t=z.current;if(!t)return;const s=()=>{t.scrollTop+t.clientHeight>=t.scrollHeight-100&&Ee()};return t.addEventListener("scroll",s,{passive:!0}),()=>t.removeEventListener("scroll",s)},[Ee]),a.useEffect(()=>{Mt()},[Mt,U,Ve]);const W=a.useMemo(()=>{const t=new Map;for(const i of g){let l,f;if(R==="project"){const d=Ie(i.projectId);l=d?i.projectId??"_none":"_none",f=d??n("noProject")}else if(R==="team"){const h=(i.agentId?Le.get(i.agentId):void 0)?.teamId??"_none";l=h,f=h!=="_none"?Et.get(h)?.name??h:n("noTeam")}else if(R==="agent")l=i.agentId??"_none",f=i.agentId?Le.get(i.agentId)?.name??i.agentId:n("common:unknown");else{const d=new Date(i.updatedAt);l=`${d.getFullYear()}-${String(d.getMonth()+1).padStart(2,"0")}-${String(d.getDate()).padStart(2,"0")}`,f=l}t.has(l)||t.set(l,{label:f,items:[]}),t.get(l).items.push(i)}const s=[...t.entries()];return R==="date"?s.sort((i,l)=>l[0].localeCompare(i[0])):s.sort((i,l)=>i[1].label.localeCompare(l[1].label)),s},[g,R,qe,Le,Et,n]);a.useEffect(()=>{if(R==="date"&&U){const t=new Date,s=`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`;de(new Set([s]))}else de(new Set)},[R]);const es=async t=>{mt("remove");try{await p.deliverables.remove(t.id),T("success",n("removed")),C(null),Y()}catch(s){T("error",n("common:error",{message:String(s)}))}mt("")},ts=a.useCallback(t=>{const s=Qe.current,i=s?.id;if(!i)return;const l={hubShareId:t.id??null,shareStatus:t.status??null,shareUrl:t.url??null,shareVisibility:t.visibility??null,...t.reason!=null||t.status==="rejected"?{shareReason:t.reason??s?.shareReason??null}:{}},f={...l,shareStatus:l.shareStatus??s?.shareStatus??null};C(d=>d&&d.id===i?{...d,...f}:d),I(d=>d.map(h=>h.id===i?{...h,...f}:h)),(async()=>{try{await p.deliverables.update(i,l)}catch(d){console.warn("[deliverables] 分享状态本地回写失败,将由 Hub 轮询补偿:",d)}Re()})()},[Re]),ss=()=>{Q.navigate(L.BUILDER)},At=async t=>{if(t.reference&&!Be(t.reference)){if(t.type==="directory"){fe(!0);return}kt(!0);try{const s=await p.files.preview(t.reference);if(s.type==="image"&&s.mimeType)yt({src:`data:${s.mimeType};base64,${s.content}`,name:s.name});else if(s.type==="audio"||s.type==="video"){const i=s.streamUrl||(s.path?p.files.streamUrl(s.path):p.files.streamUrl(t.reference));vt({kind:s.type,src:i,name:s.name})}else s.type==="binary"?fe(!0):typeof s.content=="string"?(Ne(s.content),bt(vs({format:t.format,reference:t.reference,content:s.content}))):fe(!0)}catch{Ne(null),t.type==="file"&&fe(!0)}kt(!1)}};a.useEffect(()=>{o||(Ne(null),bt("markdown"),yt(null),vt(null),fe(!1),r&&At(r))},[r?.id,o]);const $t=a.useCallback(t=>U!==Ve.has(t),[U,Ve]),Pt=W.length>0&&W.every(([t])=>$t(t)),rs=a.useCallback(t=>{de(s=>{const i=new Set(s);return i.has(t)?i.delete(t):i.add(t),i})},[]),Bt=a.useCallback(t=>{de(s=>{if(s.has(t)===U)return s;const i=new Set(s);return U?i.add(t):i.delete(t),i})},[U]),ns=a.useCallback(()=>{Gt(t=>!t),de(new Set)},[]),Me=!!(B||D||ie),Dt=a.useCallback(()=>{oe(""),ce(""),ve(""),je("")},[]),ge=a.useMemo(()=>W.flatMap(([,t])=>t.items),[W]);a.useEffect(()=>{o||x||_||r||Te.current||ge.length!==0&&C(ge[0])},[o,x,_,r,ge]);const Xe=a.useRef(null);a.useEffect(()=>{if(!r){Xe.current=null;return}if(Xe.current===r.id)return;const t=W.find(([,s])=>s.items.some(i=>i.id===r.id));t&&(Xe.current=r.id,Bt(t[0]))},[r?.id,W,Bt]);const Vt=a.useRef(null),Ht=a.useRef(null),Ae=a.useRef(!1),Wt=a.useRef(X);a.useEffect(()=>{if(o||x||!b)return;const t=Wt.current;Wt.current=X,!(X!=="l1"||t==="l1")&&V&&(Ae.current=!0,O(!1))},[X,o,x,b,V]),a.useEffect(()=>{if(o||x||!b)return;const t=s=>{if(s.metaKey||s.ctrlKey){if(s.target instanceof HTMLInputElement||s.target instanceof HTMLTextAreaElement){s.key==="Escape"&&(s.target.blur(),s.preventDefault());return}if(zt(s.target))return;if(s.key==="f"){s.preventDefault(),Vt.current?.focus();return}if(s.key.toLowerCase()==="b"){s.preventDefault(),O(w=>{const be=!w;return be&&(Ae.current=!0,E?.setKeyboardPane("l1"),requestAnimationFrame(()=>Ht.current?.focus())),be});return}if(s.key.toLowerCase()==="l"){s.preventDefault(),et();return}return s.altKey,void 0}if(E?.keyboardPane==="l0")return;if(s.target instanceof HTMLInputElement||s.target instanceof HTMLTextAreaElement){s.key==="Escape"&&(s.target.blur(),s.preventDefault());return}if(zt(s.target)||s.metaKey||s.ctrlKey||s.altKey)return;const l=s.key.length===1?s.key.toLowerCase():s.key;if(l==="h"||l==="ArrowLeft"){s.preventDefault(),V&&O(!1),E?.setL0FocusPageId(L.DELIVERABLES),E?.setLeftCollapsed(!1),E?.setKeyboardPane("l0");return}if(l==="l"||l==="ArrowRight"){s.preventDefault(),V&&O(!1),E?.keyboardPane!=="l1"&&E?.setKeyboardPane("l1");return}const f=l==="j"||l==="ArrowDown"?1:l==="k"||l==="ArrowUp"?-1:0;if(!f)return;s.preventDefault(),E?.setKeyboardPane("l1"),V&&(Ae.current=!0,O(!1));const d=ge;if(d.length===0)return;const h=r?d.findIndex(w=>w.id===r.id):-1,m=h<0?f>0?-1:0:h,j=Math.max(0,Math.min(d.length-1,m+f));Ft(d[j]),requestAnimationFrame(()=>{document.querySelector(`[data-deliverable-id="${d[j].id}"]`)?.scrollIntoView({block:"nearest"})})};return document.addEventListener("keydown",t,!0),()=>document.removeEventListener("keydown",t,!0)},[ge,r,o,x,b,E,V]);const $e=a.useRef(null),as=a.useCallback(t=>{if(!x)return;const s=z.current;!s||s.scrollTop>0||($e.current={y:t.touches[0].clientY,scrollTop:s.scrollTop})},[x]),ls=a.useCallback(t=>{if(!x||!$e.current||We)return;const s=t.changedTouches[0].clientY-$e.current.y;$e.current=null,s>80&&z.current&&z.current.scrollTop<=0&&(pt(!0),Y().finally(()=>pt(!1)))},[x,We,Y]),Ft=t=>{const s=()=>{C(t),_e(!1),K(!1),G(!1),x&&(k(!0),history.pushState({mobileDetail:L.DELIVERABLES},"",window.location.hash))};H?q({action:s}):s()},is=()=>{if(!H){const t=ke??r?.summary??"";ze(t)}K(!0)},os=()=>{H?q({action:()=>{K(!1),G(!1)}}):K(!1)},_t=async()=>{if(!(!r?.reference||Oe)){Ct(!0);try{await p.files.write(r.reference,me),Ne(me),G(!1),K(!1),T("success",n("detail.saved"))}catch(t){T("error",n("detail.saveFailed")+": "+String(t))}Ct(!1)}},cs=()=>{K(!1),G(!1),q(null)};a.useEffect(()=>{if(!H)return;const t=s=>{s.preventDefault()};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)},[H]),a.useEffect(()=>{if(!H)return;const t=s=>{s.preventDefault(),s.stopImmediatePropagation(),q({action:()=>{K(!1),G(!1);const{page:i,params:l}=s.detail||{};i&&Q.navigate(i,l)}})};return window.addEventListener("markus:navigate",t),()=>window.removeEventListener("markus:navigate",t)},[H]);const Ze=a.useRef(null),et=a.useCallback((t,s)=>{const i=r?.agentId??"",l=r?.id??"",f={};l&&(f.openDeliverable=l);const d=[];if(l){const h=r?.title?.trim()||l,m=h.length>40?`${h.slice(0,24)}…${h.slice(-12)}`:h;d.push({label:`📄 ${m}`,content:["[deliverable]",`ID: ${l}`,`Title: ${r?.title??""}`,r?.reference?`Reference: ${r.reference}`:"",r?.taskId?`Task: ${r.taskId}`:"",r?.projectId?`Project: ${r.projectId}`:""].filter(Boolean).join(`
|
|
1
|
+
import{u as nt,j as e,r as a,a as us,b as xs,m as fs,d as hs,c as ms,l as p,w as tt,o as Ut,p as ps,P as L,n as Q,M as gs,q as Pe,h as bs,i as zt,s as ys}from"./index-B1VN5yM1.js";import{resolveFormat as vs,ContentRenderer as js}from"./ContentRenderer-gaxBn1N9.js";import{c as ks,D as Ns}from"./DeliverableShareModal-B6qqZgFc.js";function M(u){return Array.isArray(u)?u.map(o=>String(o).trim()).filter(Boolean):typeof u=="string"&&u?u.split(",").map(o=>o.trim()).filter(Boolean):[]}function ws(u){return u.files&&typeof u.files=="object"&&!Array.isArray(u.files)?u.files:null}function J({label:u,value:o}){return o?e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:u}),e.jsx("div",{className:"text-xs text-fg-secondary mt-0.5",children:o})]}):null}function re({label:u,value:o,color:c}){if(!o)return null;const n={purple:"bg-brand-500/15 text-brand-500",cyan:"bg-blue-500/15 text-blue-600",indigo:"bg-brand-500/15 text-brand-500",gray:"bg-gray-500/15 text-fg-secondary",emerald:"bg-green-500/15 text-green-600"};return e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:u}),e.jsx("div",{className:`mt-0.5 px-2 py-0.5 rounded-full text-[10px] font-medium ${n[c]??n.gray} capitalize inline-block`,children:o})]})}function st({files:u}){const{t:o}=nt(["builder","common"]),[c,n]=a.useState(Object.keys(u)[0]??""),x=Object.keys(u);return x.length===0?null:e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:o("builder:artifact.files",{count:x.length})}),e.jsxs("div",{className:"mt-1 bg-surface-elevated/50 rounded-lg border border-border-default/30 overflow-hidden",children:[e.jsx("div",{className:"flex gap-0.5 px-1.5 py-1 border-b border-border-default/30 overflow-x-auto",children:x.map(b=>e.jsx("button",{onClick:()=>n(b),className:`px-2 py-0.5 text-[10px] rounded whitespace-nowrap transition-colors ${c===b?"bg-brand-600/30 text-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:b},b))}),c&&u[c]!=null&&e.jsx("pre",{className:"p-2 text-[10px] text-fg-secondary max-h-[120px] overflow-auto whitespace-pre-wrap font-mono",children:u[c]})]})]})}function Ss({artifact:u,mode:o}){const{t:c}=nt(["builder","common"]),n=ws(u),x=u.agent,b=u.team,A=u.dependencies,N=u.displayName??u.name;if(o==="agent"){const k=x?.roleName,$=x?.agentRole,y=x?.llmProvider,P=x?.llmModel,g=M(A?.env),I=M(A?.skills);return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(J,{label:c("builder:artifact.name"),value:N}),e.jsx(J,{label:c("builder:artifact.description"),value:u.description}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[k&&e.jsx(re,{label:c("builder:artifact.baseTemplate"),value:k,color:"indigo"}),e.jsx(re,{label:c("builder:artifact.agentRole"),value:$,color:$==="manager"?"purple":"cyan"})]}),M(u.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:M(u.tags).map(v=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:v},v))}),(y||P)&&e.jsxs("div",{className:"flex gap-2",children:[y&&e.jsx(re,{label:c("builder:artifact.llmProvider"),value:y,color:"gray"}),P&&e.jsx(re,{label:c("builder:artifact.llmModel"),value:P,color:"gray"})]}),g.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:c("builder:artifact.requiredEnv")}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:g.map(v=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-amber-500/10 text-amber-600 rounded font-mono",children:v},v))})]}),I.length>0&&e.jsx(J,{label:c("builder:artifact.skills"),value:I.join(", ")}),n&&e.jsx(st,{files:n})]})}if(o==="team"){const $=b?.members??[];return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(J,{label:c("builder:artifact.name"),value:N}),e.jsx(J,{label:c("builder:artifact.description"),value:u.description}),e.jsx("div",{className:"flex flex-wrap gap-2",children:e.jsx(re,{label:c("builder:artifact.category"),value:u.category,color:"indigo"})}),M(u.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:M(u.tags).map(y=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:y},y))}),n&&e.jsx(st,{files:n}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:c("builder:artifact.members",{count:$.length})}),e.jsx("div",{className:"mt-1.5 space-y-1.5",children:$.map((y,P)=>e.jsxs("div",{className:"bg-surface-elevated/30 rounded-lg px-2 py-1.5 border border-border-default/20",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`w-5 h-5 rounded flex items-center justify-center text-[10px] font-bold ${y.role==="manager"?"bg-brand-500/20 text-brand-500":"bg-blue-500/20 text-blue-600"}`,children:y.role==="manager"?"★":P+1}),e.jsx("span",{className:"text-xs text-fg-secondary flex-1 truncate",children:y.name}),typeof y.roleName=="string"&&y.roleName&&e.jsx("span",{className:"text-[10px] text-brand-500/70 font-mono",children:y.roleName}),e.jsxs("span",{className:"text-[10px] text-fg-tertiary",children:["x",String(y.count??1)]})]}),M(y.skills).length>0&&e.jsx("div",{className:"mt-1 ml-7 flex flex-wrap gap-1",children:M(y.skills).map(g=>e.jsx("span",{className:"px-1 py-0.5 text-[9px] bg-green-500/10 text-green-600 rounded font-mono",children:g},g))})]},P))})]})]})}return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(J,{label:c("builder:artifact.name"),value:N}),e.jsx(J,{label:c("builder:artifact.description"),value:u.description}),e.jsx("div",{className:"flex gap-2",children:e.jsx(re,{label:c("builder:artifact.category"),value:u.category,color:"indigo"})}),n&&e.jsx(st,{files:n}),M(u.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:M(u.tags).map(k=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:k},k))})]})}const ne={file:{icon:"📄",color:"bg-green-500/10 text-green-600"},directory:{icon:"📁",color:"bg-blue-500/10 text-blue-600"}},Cs=["file","directory"];function Be(u){return/^https?:\/\//i.test(u)}function S(u){return u?.shareStatus??null}function Ls(u,o){const c=Date.now(),n=new Date(u).getTime(),x=c-n,b=Math.floor(x/6e4);if(b<1)return o("time.justNow");if(b<60)return o("time.minutesAgo",{count:b});const A=Math.floor(b/60);if(A<24)return o("time.hoursAgo",{count:A});const N=Math.floor(A/24);if(N===1)return o("time.yesterday");if(N<30)return o("time.daysAgo",{count:N});const k=Math.floor(N/30);return k<12?o("time.monthsAgo",{count:k}):o("time.yearsAgo",{count:Math.floor(k/12)})}const F={agent:{icon:"✦",color:"bg-brand-500/10 text-brand-500"},team:{icon:"◈",color:"bg-blue-500/10 text-blue-600"},skill:{icon:"⬡",color:"bg-amber-500/10 text-amber-600"}};function Ts({authUser:u,previewMode:o,previewData:c}={}){const{t:n}=nt(["deliverables","common"]),x=us(),b=xs(L.DELIVERABLES),A=fs({side:"left",defaultWidth:384,minWidth:280,maxWidth:600,storageKey:"markus_deliverables_list"}),[N,k]=a.useState(!1),$=a.useRef(N);$.current=N,a.useEffect(()=>{if(!x)return;const t=()=>{$.current&&k(!1)};return window.addEventListener("popstate",t),()=>window.removeEventListener("popstate",t)},[x]);const y=100,P=5e3,[g,I]=a.useState(c?.items??[]),[v,ae]=a.useState(c?.items?.length??0),[le,at]=a.useState(!1),[lt,it]=a.useState(c?.projects??[]),[ot,ct]=a.useState(c?.agents??[]),[dt,Kt]=a.useState([]),[_,ut]=a.useState(!c),[ye,ve]=a.useState(""),[ie,je]=a.useState(""),[B,oe]=a.useState(""),[D,ce]=a.useState(""),[R,xt]=a.useState("date"),[r,C]=a.useState(()=>c?.initialSelectedId&&c.items?c.items.find(t=>t.id===c.initialSelectedId)??c.items[0]??null:c?.items?.[0]??null),[De,ft]=a.useState(null),[ht,mt]=a.useState(""),[U,Gt]=a.useState(!0),[Ve,de]=a.useState(()=>{const t=new Date,s=`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`;return new Set([s])}),[He,qt]=a.useState(!1),[We,pt]=a.useState(!1),Yt=a.useMemo(()=>[{id:"date"},{id:"project"},{id:"team"},{id:"agent"}],[]),Qt=a.useCallback(t=>{xt(t)},[]),gt=hs(Yt,R,Qt),z=a.useRef(null),[ke,Ne]=a.useState(null),[we,bt]=a.useState("markdown"),[ue,yt]=a.useState(null),[xe,vt]=a.useState(null),[jt,kt]=a.useState(!1),[Nt,fe]=a.useState(!1),[Se,wt]=a.useState(!1),[Fe,Ce]=a.useState(null),[Jt,_e]=a.useState(!1),[Ue,Xt]=a.useState(""),[St,Zt]=a.useState(new Set),[V,O]=a.useState(!1),E=ms(),X=E?.keyboardPane??"content",[he,Z]=a.useState(null),[ee,K]=a.useState(!1),[me,ze]=a.useState(""),[H,G]=a.useState(!1),[Oe,Ct]=a.useState(!1),[Ke,q]=a.useState(null),Ge=a.useRef(null),Lt=a.useCallback(t=>{t&&(t.style.height="auto",t.style.height=t.scrollHeight+"px")},[]),It=a.useRef(void 0);a.useEffect(()=>{Lt(Ge.current)},[me,ee,Lt]);const T=(t,s)=>{ft({type:t,text:s}),setTimeout(()=>ft(null),3e3)},Rt=async t=>{await ys(t)?(wt(!0),setTimeout(()=>wt(!1),1500)):T("error",n("detail.copyFailed"))},Le=a.useMemo(()=>new Map(ot.map(t=>[t.id,t])),[ot]),qe=a.useMemo(()=>new Map(lt.map(t=>[t.id,t])),[lt]),Et=a.useMemo(()=>new Map(dt.map(t=>[t.id,t])),[dt]),Ie=a.useCallback(t=>{if(!t||t==="default")return null;const s=qe.get(t)?.name;return!s||s==="default"?null:s},[qe]);a.useEffect(()=>{o||(p.projects.list().then(t=>it(t.projects)).catch(()=>{}),p.agents.list().then(t=>ct(t.agents??[])).catch(()=>{}),p.teams.list().then(t=>Kt(t.teams??[])).catch(()=>{}),p.system.storage().then(t=>Xt(t.dataDir+"/shared")).catch(()=>{}),p.deliverables.checkHealth().then(t=>Zt(new Set(t.missingFiles))).catch(()=>{}))},[o]),a.useEffect(()=>(It.current=setTimeout(()=>je(ye),300),()=>clearTimeout(It.current)),[ye]);const te=a.useMemo(()=>({q:ie||void 0,type:B||void 0,artifactType:D||void 0}),[ie,B,D]),se=R==="date"?y:P,Ye=a.useCallback((t,s)=>s?{...s,hubShareId:s.hubShareId!=null?s.hubShareId:t.hubShareId??null,shareStatus:s.shareStatus!=null?s.shareStatus:t.shareStatus??null,shareUrl:s.shareUrl!=null?s.shareUrl:t.shareUrl??null,shareVisibility:s.shareVisibility!=null?s.shareVisibility:t.shareVisibility??null,shareReason:s.shareReason!=null?s.shareReason:t.shareReason}:t,[]),Re=a.useCallback(async()=>{try{const{results:t,total:s}=await p.deliverables.search({...te,offset:0,limit:se});I(i=>i.map(l=>{const f=t.find(d=>d.id===l.id);return f?Ye(l,f):l})),ae(s),C(i=>{if(!i)return null;const l=t.find(f=>f.id===i.id);return l?Ye(i,l):i})}catch{}},[te,se,Ye]),Y=a.useCallback(async()=>{ut(!0),z.current?.scrollTo({top:0,behavior:"instant"});try{const{results:t,total:s}=await p.deliverables.search({...te,offset:0,limit:se});I(t),ae(s),C(i=>i&&t.some(l=>l.id===i.id)?i:null)}catch{I([]),ae(0),C(null)}ut(!1)},[te,se]),Ee=a.useCallback(async()=>{if(!(le||g.length>=v)){at(!0);try{const{results:t,total:s}=await p.deliverables.search({...te,offset:g.length,limit:se});I(i=>[...i,...t]),ae(s)}catch{}at(!1)}},[te,se,g.length,v,le]);a.useEffect(()=>{o||Y()},[Y,o]),a.useEffect(()=>{!o||!c||(I(c.items??[]),ae(c.items?.length??0),it(c.projects??[]),ct(c.agents??[]),c.initialSelectedId&&C(c.items?.find(t=>t.id===c.initialSelectedId)??c.items?.[0]??null))},[o,c]);const Qe=a.useRef(r);Qe.current=r,a.useEffect(()=>{if(o||!b)return;const t=tt.on("deliverable:created",()=>Y()),s=tt.on("deliverable:updated",l=>{Re();const f=l.payload?.deliverableId;f&&Qe.current?.id===f&&p.deliverables.get(f).then(d=>{d.deliverable&&(C(h=>({...h??d.deliverable,...d.deliverable,hubShareId:h?.hubShareId??d.deliverable.hubShareId??null,shareStatus:h?.shareStatus??d.deliverable.shareStatus??null,shareUrl:h?.shareUrl??d.deliverable.shareUrl??null,shareVisibility:h?.shareVisibility??d.deliverable.shareVisibility??null,shareReason:h?.shareReason??d.deliverable.shareReason??null})),At(d.deliverable))}).catch(()=>{})}),i=tt.on("deliverable:removed",()=>Y());return()=>{t(),s(),i()}},[Re,b,o]);const Tt=a.useMemo(()=>ks(Ut,bs.getUrl()),[]);a.useEffect(()=>{if(o||!b||!Ut())return;let t=!1;const s=async()=>{try{const l=await Tt.listMine();if(t)return;const f=new Map,d=new Map;for(const m of l)m.id&&f.set(m.id,m),m.localId&&d.set(m.localId,m);const h=new Map;I(m=>m.map(j=>{const w=j.hubShareId&&f.get(j.hubShareId)||d.get(j.id);if(!w)return j;const be={hubShareId:j.hubShareId??w.id??null,shareStatus:w.status??null,shareUrl:w.url??null,shareVisibility:j.shareVisibility??w.visibility??null,...w.reason!=null?{shareReason:w.reason}:{}};return h.set(j.id,be),{...j,...be}})),C(m=>{if(!m)return m;const j=h.get(m.id);return j?{...m,...j}:m});for(const[m,j]of h)p.deliverables.update(m,j).catch(w=>{console.warn("[deliverables] Hub 分享状态本地持久化失败:",w)})}catch{}};s();const i=setInterval(s,3e4);return()=>{t=!0,clearInterval(i)}},[Tt,b,o]);const Te=a.useRef(null),Je=a.useRef(g);Je.current=g;const pe=a.useCallback(t=>{const s=l=>{C(l),x&&(k(!0),history.pushState({mobileDetail:L.DELIVERABLES},"",window.location.hash))},i=Je.current.find(l=>l.id===t);if(i){s(i);return}p.deliverables.get(t).then(l=>{l.deliverable&&s(l.deliverable)}).catch(()=>{})},[x]);a.useEffect(()=>{if(o)return;const t=window.location.hash.slice(1).split("/"),s=ps(t[0])===L.DELIVERABLES?t[1]:void 0,i=localStorage.getItem("markus_nav_openDeliverable")||s;i&&(localStorage.removeItem("markus_nav_openDeliverable"),Je.current.length>0?pe(i):Te.current=i);const l=f=>{const d=f.detail;d?.params?.openDeliverable&&(localStorage.removeItem("markus_nav_openDeliverable"),pe(d.params.openDeliverable))};return window.addEventListener("markus:navigate",l),()=>window.removeEventListener("markus:navigate",l)},[pe,o]),a.useEffect(()=>{const t=Te.current;!t||g.length===0||(Te.current=null,pe(t))},[g,pe]);const Mt=a.useCallback(()=>{const t=z.current;!t||_||le||g.length>=v||t.scrollHeight<=t.clientHeight+100&&Ee()},[_,le,g.length,v,Ee]);a.useEffect(()=>{const t=z.current;if(!t)return;const s=()=>{t.scrollTop+t.clientHeight>=t.scrollHeight-100&&Ee()};return t.addEventListener("scroll",s,{passive:!0}),()=>t.removeEventListener("scroll",s)},[Ee]),a.useEffect(()=>{Mt()},[Mt,U,Ve]);const W=a.useMemo(()=>{const t=new Map;for(const i of g){let l,f;if(R==="project"){const d=Ie(i.projectId);l=d?i.projectId??"_none":"_none",f=d??n("noProject")}else if(R==="team"){const h=(i.agentId?Le.get(i.agentId):void 0)?.teamId??"_none";l=h,f=h!=="_none"?Et.get(h)?.name??h:n("noTeam")}else if(R==="agent")l=i.agentId??"_none",f=i.agentId?Le.get(i.agentId)?.name??i.agentId:n("common:unknown");else{const d=new Date(i.updatedAt);l=`${d.getFullYear()}-${String(d.getMonth()+1).padStart(2,"0")}-${String(d.getDate()).padStart(2,"0")}`,f=l}t.has(l)||t.set(l,{label:f,items:[]}),t.get(l).items.push(i)}const s=[...t.entries()];return R==="date"?s.sort((i,l)=>l[0].localeCompare(i[0])):s.sort((i,l)=>i[1].label.localeCompare(l[1].label)),s},[g,R,qe,Le,Et,n]);a.useEffect(()=>{if(R==="date"&&U){const t=new Date,s=`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`;de(new Set([s]))}else de(new Set)},[R]);const es=async t=>{mt("remove");try{await p.deliverables.remove(t.id),T("success",n("removed")),C(null),Y()}catch(s){T("error",n("common:error",{message:String(s)}))}mt("")},ts=a.useCallback(t=>{const s=Qe.current,i=s?.id;if(!i)return;const l={hubShareId:t.id??null,shareStatus:t.status??null,shareUrl:t.url??null,shareVisibility:t.visibility??null,...t.reason!=null||t.status==="rejected"?{shareReason:t.reason??s?.shareReason??null}:{}},f={...l,shareStatus:l.shareStatus??s?.shareStatus??null};C(d=>d&&d.id===i?{...d,...f}:d),I(d=>d.map(h=>h.id===i?{...h,...f}:h)),(async()=>{try{await p.deliverables.update(i,l)}catch(d){console.warn("[deliverables] 分享状态本地回写失败,将由 Hub 轮询补偿:",d)}Re()})()},[Re]),ss=()=>{Q.navigate(L.BUILDER)},At=async t=>{if(t.reference&&!Be(t.reference)){if(t.type==="directory"){fe(!0);return}kt(!0);try{const s=await p.files.preview(t.reference);if(s.type==="image"&&s.mimeType)yt({src:`data:${s.mimeType};base64,${s.content}`,name:s.name});else if(s.type==="audio"||s.type==="video"){const i=s.streamUrl||(s.path?p.files.streamUrl(s.path):p.files.streamUrl(t.reference));vt({kind:s.type,src:i,name:s.name})}else s.type==="binary"?fe(!0):typeof s.content=="string"?(Ne(s.content),bt(vs({format:t.format,reference:t.reference,content:s.content}))):fe(!0)}catch{Ne(null),t.type==="file"&&fe(!0)}kt(!1)}};a.useEffect(()=>{o||(Ne(null),bt("markdown"),yt(null),vt(null),fe(!1),r&&At(r))},[r?.id,o]);const $t=a.useCallback(t=>U!==Ve.has(t),[U,Ve]),Pt=W.length>0&&W.every(([t])=>$t(t)),rs=a.useCallback(t=>{de(s=>{const i=new Set(s);return i.has(t)?i.delete(t):i.add(t),i})},[]),Bt=a.useCallback(t=>{de(s=>{if(s.has(t)===U)return s;const i=new Set(s);return U?i.add(t):i.delete(t),i})},[U]),ns=a.useCallback(()=>{Gt(t=>!t),de(new Set)},[]),Me=!!(B||D||ie),Dt=a.useCallback(()=>{oe(""),ce(""),ve(""),je("")},[]),ge=a.useMemo(()=>W.flatMap(([,t])=>t.items),[W]);a.useEffect(()=>{o||x||_||r||Te.current||ge.length!==0&&C(ge[0])},[o,x,_,r,ge]);const Xe=a.useRef(null);a.useEffect(()=>{if(!r){Xe.current=null;return}if(Xe.current===r.id)return;const t=W.find(([,s])=>s.items.some(i=>i.id===r.id));t&&(Xe.current=r.id,Bt(t[0]))},[r?.id,W,Bt]);const Vt=a.useRef(null),Ht=a.useRef(null),Ae=a.useRef(!1),Wt=a.useRef(X);a.useEffect(()=>{if(o||x||!b)return;const t=Wt.current;Wt.current=X,!(X!=="l1"||t==="l1")&&V&&(Ae.current=!0,O(!1))},[X,o,x,b,V]),a.useEffect(()=>{if(o||x||!b)return;const t=s=>{if(s.metaKey||s.ctrlKey){if(s.target instanceof HTMLInputElement||s.target instanceof HTMLTextAreaElement){s.key==="Escape"&&(s.target.blur(),s.preventDefault());return}if(zt(s.target))return;if(s.key==="f"){s.preventDefault(),Vt.current?.focus();return}if(s.key.toLowerCase()==="b"){s.preventDefault(),O(w=>{const be=!w;return be&&(Ae.current=!0,E?.setKeyboardPane("l1"),requestAnimationFrame(()=>Ht.current?.focus())),be});return}if(s.key.toLowerCase()==="l"){s.preventDefault(),et();return}return s.altKey,void 0}if(E?.keyboardPane==="l0")return;if(s.target instanceof HTMLInputElement||s.target instanceof HTMLTextAreaElement){s.key==="Escape"&&(s.target.blur(),s.preventDefault());return}if(zt(s.target)||s.metaKey||s.ctrlKey||s.altKey)return;const l=s.key.length===1?s.key.toLowerCase():s.key;if(l==="h"||l==="ArrowLeft"){s.preventDefault(),V&&O(!1),E?.setL0FocusPageId(L.DELIVERABLES),E?.setLeftCollapsed(!1),E?.setKeyboardPane("l0");return}if(l==="l"||l==="ArrowRight"){s.preventDefault(),V&&O(!1),E?.keyboardPane!=="l1"&&E?.setKeyboardPane("l1");return}const f=l==="j"||l==="ArrowDown"?1:l==="k"||l==="ArrowUp"?-1:0;if(!f)return;s.preventDefault(),E?.setKeyboardPane("l1"),V&&(Ae.current=!0,O(!1));const d=ge;if(d.length===0)return;const h=r?d.findIndex(w=>w.id===r.id):-1,m=h<0?f>0?-1:0:h,j=Math.max(0,Math.min(d.length-1,m+f));Ft(d[j]),requestAnimationFrame(()=>{document.querySelector(`[data-deliverable-id="${d[j].id}"]`)?.scrollIntoView({block:"nearest"})})};return document.addEventListener("keydown",t,!0),()=>document.removeEventListener("keydown",t,!0)},[ge,r,o,x,b,E,V]);const $e=a.useRef(null),as=a.useCallback(t=>{if(!x)return;const s=z.current;!s||s.scrollTop>0||($e.current={y:t.touches[0].clientY,scrollTop:s.scrollTop})},[x]),ls=a.useCallback(t=>{if(!x||!$e.current||We)return;const s=t.changedTouches[0].clientY-$e.current.y;$e.current=null,s>80&&z.current&&z.current.scrollTop<=0&&(pt(!0),Y().finally(()=>pt(!1)))},[x,We,Y]),Ft=t=>{const s=()=>{C(t),_e(!1),K(!1),G(!1),x&&(k(!0),history.pushState({mobileDetail:L.DELIVERABLES},"",window.location.hash))};H?q({action:s}):s()},is=()=>{if(!H){const t=ke??r?.summary??"";ze(t)}K(!0)},os=()=>{H?q({action:()=>{K(!1),G(!1)}}):K(!1)},_t=async()=>{if(!(!r?.reference||Oe)){Ct(!0);try{await p.files.write(r.reference,me),Ne(me),G(!1),K(!1),T("success",n("detail.saved"))}catch(t){T("error",n("detail.saveFailed")+": "+String(t))}Ct(!1)}},cs=()=>{K(!1),G(!1),q(null)};a.useEffect(()=>{if(!H)return;const t=s=>{s.preventDefault()};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)},[H]),a.useEffect(()=>{if(!H)return;const t=s=>{s.preventDefault(),s.stopImmediatePropagation(),q({action:()=>{K(!1),G(!1);const{page:i,params:l}=s.detail||{};i&&Q.navigate(i,l)}})};return window.addEventListener("markus:navigate",t),()=>window.removeEventListener("markus:navigate",t)},[H]);const Ze=a.useRef(null),et=a.useCallback((t,s)=>{const i=r?.agentId??"",l=r?.id??"",f={};l&&(f.openDeliverable=l);const d=[];if(l){const h=r?.title?.trim()||l,m=h.length>40?`${h.slice(0,24)}…${h.slice(-12)}`:h;d.push({label:`📄 ${m}`,content:["[deliverable]",`ID: ${l}`,`Title: ${r?.title??""}`,r?.reference?`Reference: ${r.reference}`:"",r?.taskId?`Task: ${r.taskId}`:"",r?.projectId?`Project: ${r.projectId}`:""].filter(Boolean).join(`
|
|
2
2
|
`)})}if(t?.trim()){const h=t.trim().length>40?`${t.trim().slice(0,24)}…${t.trim().slice(-12)}`:t.trim();if(s){const m=r?.reference??"";d.push({label:`🌐 ${h}`,content:["[html-selection]",`Text: "${t.trim()}"`,`CSS Selector: ${s.cssSelector}`,`XPath: ${s.xpath}`,m?`File: ${m}`:""].filter(Boolean).join(`
|
|
3
3
|
`)})}else d.push({label:`📝 ${h}`,content:t.trim()})}d.length>0&&(f.chatChips=JSON.stringify(d)),i&&(f.agentId=i),Z(null),window.getSelection()?.removeAllRanges(),Q.navigate(L.TEAM,f)},[r]),ds=a.useCallback(t=>{if(!t.text.trim())return;const i=Ze.current?.querySelector("iframe")?.getBoundingClientRect(),l=(i?.left??0)+t.rect.x+t.rect.width/2,f=(i?.top??0)+t.rect.y;Z({x:l,y:f,text:t.text,htmlMeta:{xpath:t.xpath,cssSelector:t.cssSelector}})},[]);return a.useEffect(()=>{const t=Ze.current;if(!t)return;const s=()=>{requestAnimationFrame(()=>{const l=window.getSelection(),f=l?.toString().trim();if(!f||!l?.rangeCount){Z(null);return}const d=l.getRangeAt(0);if(!t.contains(d.commonAncestorContainer)){Z(null);return}const h=d.getBoundingClientRect();Z({x:h.left+h.width/2,y:h.top,text:f})})},i=l=>{const f=document.getElementById("selection-toolbar");f&&f.contains(l.target)||Z(null)};return t.addEventListener("mouseup",s),document.addEventListener("mousedown",i),()=>{t.removeEventListener("mouseup",s),document.removeEventListener("mousedown",i)}},[]),e.jsxs("div",{className:"flex-1 overflow-hidden flex",children:[e.jsxs("div",{ref:Ht,tabIndex:-1,"data-keyboard-pane":"l1",className:`${x?"flex-1 min-w-0":"shrink-0"} flex flex-col bg-surface-secondary rounded-xl m-1 mr-0 outline-none ${!x&&X==="l1"?"ring-1 ring-inset ring-brand-500/30":""}`,style:x?N?{display:"none"}:void 0:V?{display:"none"}:{width:A.width},children:[e.jsxs("div",{"data-electron-drag":!0,className:"p-4 space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between gap-2",children:e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[x&&e.jsx(gs,{}),!x&&e.jsx("button",{onClick:()=>O(!0),className:"w-8 h-8 flex items-center justify-center rounded-lg transition-colors shrink-0 bg-brand-500/15 text-brand-500 hover:bg-brand-500/25",title:n("sidebar.collapse"),children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"9",y1:"3",x2:"9",y2:"21"})]})}),e.jsxs("h2",{className:"text-sm font-semibold text-fg-secondary truncate",children:[n("title"),v>0&&e.jsxs("span",{className:"ml-1.5 text-fg-tertiary font-normal",children:["(",v,")"]})]})]})}),e.jsxs("div",{className:"relative",children:[e.jsxs("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-fg-muted pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{ref:Vt,value:ye,onChange:t=>ve(t.target.value),placeholder:n("searchPlaceholder"),className:"w-full bg-surface-elevated border border-border-default rounded-lg pl-8 pr-8 py-2 text-sm text-fg-primary focus:border-brand-500 focus:outline-none transition-colors"}),ye&&e.jsx("button",{onClick:()=>{ve(""),je("")},className:"absolute right-2.5 top-1/2 -translate-y-1/2 w-4 h-4 flex items-center justify-center rounded-full bg-surface-overlay text-fg-tertiary hover:text-fg-secondary transition-colors",children:e.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),Ue&&!x&&e.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 bg-surface-elevated rounded-lg text-[10px] text-fg-tertiary",children:[e.jsx("span",{className:"truncate font-mono",children:Ue}),e.jsx("button",{onClick:()=>{p.system.openPath(Ue)},className:"shrink-0 underline hover:text-fg-secondary transition-colors",children:n("common:open")})]}),x&&e.jsxs("button",{onClick:()=>qt(t=>!t),className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs transition-colors ${He||Me?"bg-brand-500/15 text-brand-500":"bg-surface-elevated text-fg-secondary"}`,children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),e.jsx("line",{x1:"8",y1:"12",x2:"20",y2:"12"}),e.jsx("line",{x1:"12",y1:"18",x2:"20",y2:"18"})]}),n("filters.filtersLabel"),Me&&e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-brand-500"}),e.jsx("svg",{className:`w-3 h-3 ml-auto transition-transform ${He?"rotate-180":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),e.jsxs("div",{className:x&&!He?"hidden":"space-y-3",children:[e.jsxs("div",{className:"flex gap-1 overflow-x-auto scrollbar-hide filter-pills-fade",children:[e.jsx(rt,{label:n("filters.allTypes"),value:"",current:B||D||"",onClick:()=>{oe(""),ce("")}}),Cs.map(t=>e.jsx(rt,{label:`${ne[t]?.icon??""} ${t}`,value:t,current:B,onClick:s=>{oe(s),ce("")}},t)),["agent","team","skill"].map(t=>e.jsx(rt,{label:`${F[t].icon} ${n(`artifactTypes.${t}`)}`,value:t,current:D,onClick:s=>{ce(s),oe("")}},t))]}),e.jsxs("div",{className:"flex gap-1.5 items-center",children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary",children:n("filters.group")}),["date","project","team","agent"].map(t=>e.jsx("button",{onClick:()=>{xt(t)},className:`px-2 py-1 rounded text-xs transition-colors ${R===t?"bg-brand-600 text-white":"bg-surface-elevated text-fg-secondary hover:bg-surface-overlay"}`,children:n(`groupBy.${t}`)},t)),W.length>1&&e.jsx("button",{onClick:ns,className:"ml-auto px-1.5 py-1 rounded text-[10px] text-fg-tertiary hover:text-fg-secondary hover:bg-surface-elevated transition-colors",title:n(Pt?"expandAllTooltip":"collapseAllTooltip"),children:n(Pt?"expandAll":"collapseAll")})]})]}),Me&&e.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[ie&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-brand-500/10 text-brand-500 text-[10px]",children:["“",ie,"”",e.jsx("button",{onClick:()=>{ve(""),je("")},className:"hover:text-brand-400",children:e.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),B&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-brand-500/10 text-brand-500 text-[10px]",children:[ne[B]?.icon," ",B,e.jsx("button",{onClick:()=>oe(""),className:"hover:text-brand-400",children:e.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),D&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-brand-500/10 text-brand-500 text-[10px]",children:[F[D]?.icon," ",n(`artifactTypes.${D}`),e.jsx("button",{onClick:()=>ce(""),className:"hover:text-brand-400",children:e.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e.jsx("button",{onClick:Dt,className:"text-[10px] text-fg-tertiary hover:text-brand-500 ml-auto transition-colors",children:n("filters.clearAll")})]})]}),De&&e.jsx("div",{className:`mx-4 mt-2 px-3 py-1.5 text-xs rounded-lg ${De.type==="success"?"bg-green-500/15 text-green-600":"bg-red-500/15 text-red-500"}`,children:De.text}),e.jsxs("div",{ref:z,className:"flex-1 overflow-y-auto p-2 space-y-1 transition-opacity duration-150",style:{opacity:_?.5:1},onTouchStart:x?t=>{gt.onTouchStart(t),as(t)}:void 0,onTouchEnd:x?t=>{gt.onTouchEnd(t),ls(t)}:void 0,children:[We&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-2 text-brand-500",children:[e.jsx(Ot,{})," ",e.jsx("span",{className:"text-[10px]",children:n("filters.refreshing")})]}),_?e.jsx("div",{className:"p-4 space-y-3",children:[1,2,3].map(t=>e.jsxs("div",{className:"animate-pulse space-y-2",children:[e.jsx("div",{className:"h-4 bg-surface-elevated rounded w-3/4"}),e.jsx("div",{className:"h-3 bg-surface-elevated rounded w-1/2"})]},t))}):g.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-6 text-center",children:[e.jsx("svg",{className:"w-12 h-12 text-fg-muted mb-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),Me?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-fg-secondary",children:n("empty.noResults")}),e.jsx("p",{className:"text-xs text-fg-tertiary mt-1 mb-3",children:n("empty.noResultsHint")}),e.jsx("button",{onClick:Dt,className:"text-xs px-3 py-1.5 rounded-lg bg-brand-600 hover:bg-brand-500 text-white transition-colors",children:n("filters.clearAll")})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-fg-secondary",children:n("empty.title")}),e.jsx("p",{className:"text-xs text-fg-tertiary mt-1 mb-3",children:n("empty.subtitle")}),e.jsx("button",{onClick:()=>Q.navigate(L.WORK),className:"text-xs px-3 py-1.5 rounded-lg bg-brand-600 hover:bg-brand-500 text-white transition-colors",children:n("empty.goToWork")})]})]}):W.map(([t,s])=>{const i=$t(t);return e.jsxs("div",{className:"mb-1",children:[e.jsxs("button",{onClick:()=>rs(t),className:"w-full flex items-center gap-1.5 px-2 py-2 rounded-md hover:bg-surface-elevated/50 transition-colors group/header border-b border-border-subtle/50",children:[e.jsx("svg",{className:`w-3 h-3 text-fg-tertiary transition-transform duration-200 shrink-0 ${i?"":"rotate-90"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),e.jsx("span",{className:"text-[11px] font-semibold text-fg-tertiary uppercase tracking-wider truncate",children:s.label}),e.jsxs("span",{className:"text-[10px] text-fg-muted bg-surface-elevated px-1.5 py-0.5 rounded-full shrink-0",children:[s.items.length,g.length<v?"+":""]})]}),e.jsx("div",{className:`overflow-hidden transition-all duration-200 ${i?"max-h-0 opacity-0":"max-h-[5000px] opacity-100"}`,children:s.items.map(l=>e.jsx("button",{"data-deliverable-id":l.id,onClick:()=>Ft(l),className:`w-full text-left px-3 py-2 rounded-lg transition-all duration-150 ${r?.id===l.id?X==="l1"?"bg-brand-500/25 ring-1 ring-inset ring-brand-500/40 border-l-2 border-l-brand-500 border-y border-r border-y-brand-500/20 border-r-brand-500/20":"bg-brand-600/15 border-l-2 border-l-brand-500 border-y border-r border-y-brand-500/20 border-r-brand-500/20":"hover:bg-surface-elevated/60 border-l-2 border-l-transparent border-y border-r border-transparent"}`,children:e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[l.artifactType&&F[l.artifactType]?e.jsx("span",{className:`text-[10px] px-1 py-0.5 rounded font-medium shrink-0 ${F[l.artifactType].color}`,children:F[l.artifactType].icon}):e.jsx("span",{className:`text-[10px] px-1 py-0.5 rounded font-medium uppercase shrink-0 ${ne[l.type]?.color??"bg-surface-overlay text-fg-secondary"}`,children:ne[l.type]?.icon??l.type.charAt(0)}),e.jsx("span",{className:"text-sm font-medium text-fg-primary truncate flex-1",children:l.title}),S(l)==="published"&&e.jsxs("svg",{className:"shrink-0 text-green-500",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-label":n("share.published",{defaultValue:"已发布到 Hub"}),children:[e.jsx("title",{children:n("share.published",{defaultValue:"已发布到 Hub"})}),e.jsx("circle",{cx:"18",cy:"5",r:"3"}),e.jsx("circle",{cx:"6",cy:"12",r:"3"}),e.jsx("circle",{cx:"18",cy:"19",r:"3"}),e.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),e.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),S(l)==="pending_review"&&e.jsxs("svg",{className:"shrink-0 text-amber-500 animate-pulse",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-label":n("share.pendingReview",{defaultValue:"Hub 审核中"}),children:[e.jsx("title",{children:n("share.pendingReview",{defaultValue:"Hub 审核中"})}),e.jsx("circle",{cx:"18",cy:"5",r:"3"}),e.jsx("circle",{cx:"6",cy:"12",r:"3"}),e.jsx("circle",{cx:"18",cy:"19",r:"3"}),e.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),e.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),S(l)==="rejected"&&e.jsxs("svg",{className:"shrink-0 text-red-500",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-label":n("share.rejected",{defaultValue:"Hub 已拒绝"}),children:[e.jsx("title",{children:n("share.rejected",{defaultValue:"Hub 已拒绝"})}),e.jsx("circle",{cx:"18",cy:"5",r:"3"}),e.jsx("circle",{cx:"6",cy:"12",r:"3"}),e.jsx("circle",{cx:"18",cy:"19",r:"3"}),e.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),e.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),St.has(l.id)&&e.jsx("span",{className:"shrink-0 text-amber-500",title:n("detail.fileMissing"),children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}),e.jsx("span",{className:"text-[10px] text-fg-muted shrink-0",children:Ls(l.updatedAt,n)})]})},l.id))})]},t)}),le&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-3 text-fg-tertiary",children:[e.jsx(Ot,{})," ",e.jsx("span",{className:"text-[10px]",children:n("common:loadingMore")})]}),!_&&g.length>0&&e.jsx("div",{className:"text-center text-[10px] text-fg-tertiary py-2",children:g.length<v?n("count.partial",{loaded:g.length,total:v}):n("count.total",{total:v})})]})]}),!x&&e.jsx("div",{className:"w-2 shrink-0 cursor-col-resize group relative flex items-center justify-center hover:bg-brand-500/5 transition-colors",onMouseDown:A.onResizeStart,children:e.jsxs("div",{className:"flex flex-col gap-1 items-center opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx("div",{className:"w-1 h-1 rounded-full bg-fg-muted"}),e.jsx("div",{className:"w-1 h-1 rounded-full bg-fg-muted"}),e.jsx("div",{className:"w-1 h-1 rounded-full bg-fg-muted"})]})}),(!x||N)&&e.jsxs("div",{"data-no-drag":!0,className:"flex-1 overflow-hidden min-w-0 flex relative self-stretch",children:[e.jsxs("div",{ref:Ze,className:"flex-1 overflow-y-auto min-w-0 h-full",children:[V&&!x&&e.jsxs("div",{className:"sticky top-0 z-10 bg-surface-primary/80 backdrop-blur-sm px-4 py-2 flex items-center gap-2",children:[e.jsx("button",{onClick:()=>{Ae.current=!0,O(!1)},className:"w-8 h-8 flex items-center justify-center rounded-lg transition-colors shrink-0 text-fg-tertiary hover:text-fg-secondary hover:bg-surface-elevated",title:n("sidebar.expand"),children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"9",y1:"3",x2:"9",y2:"21"})]})}),e.jsx("span",{className:"text-sm font-medium text-fg-secondary truncate",children:r?.title??n("detail.details")})]}),x&&e.jsxs("div",{className:"sticky top-0 z-10 bg-surface-secondary px-4 py-2.5 flex items-center gap-2",children:[e.jsx("button",{onClick:()=>history.back(),className:"text-fg-secondary hover:text-fg-primary transition-colors p-1 -ml-1",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"15 18 9 12 15 6"})})}),e.jsx("span",{className:"text-sm font-medium truncate",children:r?.title??n("detail.details")})]}),r?e.jsxs("div",{className:"p-6 space-y-4",children:[!o&&St.has(r.id)&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-amber-500/10 border border-amber-500/20 rounded-lg text-amber-600 text-xs",children:[e.jsxs("svg",{className:"w-4 h-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),e.jsx("span",{children:n("detail.fileMissing")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("h2",{className:"text-xl font-semibold text-fg-primary",children:r.title}),!o&&e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsxs("button",{onClick:()=>_e(!0),title:n("share.title",{defaultValue:"分享到 Markus Hub"}),"aria-label":n("share.title",{defaultValue:"分享到 Markus Hub"}),className:`relative p-1.5 rounded-lg transition-colors ${S(r)==="published"?"text-green-500 hover:text-green-400 hover:bg-green-500/10":S(r)==="pending_review"?"text-amber-500 hover:text-amber-400 hover:bg-amber-500/10":"text-fg-tertiary hover:text-fg-secondary hover:bg-surface-elevated"}`,children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"18",cy:"5",r:"3"}),e.jsx("circle",{cx:"6",cy:"12",r:"3"}),e.jsx("circle",{cx:"18",cy:"19",r:"3"}),e.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),e.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),S(r)==="published"||S(r)==="pending_review"||S(r)==="rejected"?e.jsx("span",{className:`absolute top-0.5 right-0.5 w-2 h-2 rounded-full border border-surface-primary ${S(r)==="published"?"bg-green-500":S(r)==="pending_review"?"bg-amber-500 animate-pulse":"bg-red-500"}`,"aria-hidden":!0}):null]}),e.jsx("button",{onClick:()=>Ce(r),disabled:!!ht,className:"p-1.5 rounded-lg text-fg-tertiary hover:text-red-500 hover:bg-red-500/10 transition-colors disabled:opacity-50 shrink-0",title:n("common:remove"),children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("span",{className:`px-2 py-0.5 rounded text-xs font-medium uppercase ${ne[r.type]?.color??"bg-surface-overlay text-fg-secondary"}`,children:[ne[r.type]?.icon??""," ",r.type]}),r.artifactType&&F[r.artifactType]&&e.jsxs("span",{className:`px-2 py-0.5 rounded text-xs font-medium ${F[r.artifactType].color}`,children:[F[r.artifactType].icon," ",n("detail.builderWithType",{type:n(`artifactTypes.${r.artifactType}`)})]}),r.tags.length>0&&r.tags.map(t=>e.jsx("span",{className:"px-2 py-0.5 text-xs bg-surface-elevated text-fg-secondary rounded",children:t},t)),S(r)==="published"&&e.jsxs("a",{href:r.shareUrl??void 0,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium bg-green-500/15 text-green-600 hover:bg-green-500/25 hover:underline",title:r.shareUrl??void 0,children:[e.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"18",cy:"5",r:"3"}),e.jsx("circle",{cx:"6",cy:"12",r:"3"}),e.jsx("circle",{cx:"18",cy:"19",r:"3"}),e.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),e.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),n("share.published",{defaultValue:"已发布"})]}),S(r)==="pending_review"&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium bg-amber-500/15 text-amber-500",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-500 animate-pulse"}),n("share.pendingReview",{defaultValue:"审核中"})]}),S(r)==="rejected"&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium bg-red-500/15 text-red-500",title:r.shareReason??void 0,children:[n("share.rejected",{defaultValue:"已拒绝"}),r.shareReason?e.jsxs("span",{className:"text-red-400/90 font-normal",children:["— ",r.shareReason]}):null]})]}),(r.taskId||r.agentId||Ie(r.projectId))&&e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.taskId&&e.jsx("button",{onClick:()=>Q.navigate(L.WORK,{openTask:r.taskId}),className:"text-xs text-brand-500 hover:underline bg-brand-500/10 px-2 py-0.5 rounded",children:n("links.task",{id:`${r.taskId.slice(0,12)}...`})}),r.agentId&&e.jsx("button",{onClick:()=>Q.navigate(L.TEAM,{selectAgent:r.agentId}),className:"text-xs text-blue-600 hover:underline bg-blue-500/10 px-2 py-0.5 rounded",children:n("links.agent",{name:Le.get(r.agentId)?.name??r.agentId.slice(0,12)})}),Ie(r.projectId)&&e.jsx("button",{onClick:()=>Q.navigate(L.WORK,{projectId:r.projectId}),className:"text-xs text-blue-600 hover:underline bg-blue-500/10 px-2 py-0.5 rounded",children:n("links.project",{name:Ie(r.projectId)})})]}),(r.diffStats||r.testResults)&&e.jsxs("div",{className:"flex gap-3 flex-wrap",children:[r.diffStats&&e.jsxs("div",{className:"bg-surface-elevated rounded-lg px-3 py-2 text-xs flex items-center gap-2",children:[e.jsxs("span",{className:"text-fg-tertiary font-medium",children:[n("diffStats.title"),":"]}),e.jsx("span",{className:"text-fg-secondary",children:n("diffStats.files",{count:r.diffStats.filesChanged})}),e.jsxs("span",{className:"text-green-600",children:["+",r.diffStats.additions]}),e.jsxs("span",{className:"text-red-500",children:["-",r.diffStats.deletions]})]}),r.testResults&&e.jsxs("div",{className:"bg-surface-elevated rounded-lg px-3 py-2 text-xs flex items-center gap-2",children:[e.jsxs("span",{className:"text-fg-tertiary font-medium",children:[n("testResults.title"),":"]}),e.jsx("span",{className:"text-green-600",children:n("testResults.passed",{count:r.testResults.passed})}),e.jsx("span",{className:"text-red-500",children:n("testResults.failed",{count:r.testResults.failed})}),e.jsx("span",{className:"text-fg-secondary",children:n("testResults.skipped",{count:r.testResults.skipped})})]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-[10px] text-fg-tertiary flex-wrap",children:[e.jsxs("span",{children:[n("metadata.created")," ",new Date(r.createdAt).toLocaleString()]}),e.jsxs("span",{children:[n("metadata.updated")," ",new Date(r.updatedAt).toLocaleString()]}),e.jsx("span",{className:"text-fg-muted select-all",children:r.id.slice(0,12)})]}),r.reference&&!Be(r.reference)&&r.type==="file"&&e.jsxs("div",{className:"flex items-center gap-2 bg-surface-elevated rounded-lg px-3 py-2",children:[e.jsx("button",{onClick:()=>{p.files.reveal(r.reference).catch(()=>T("error",n("detail.failedToOpenBrowser")))},className:"text-xs font-mono text-brand-500 hover:text-brand-500 hover:underline truncate flex-1 text-left cursor-pointer",title:n("detail.openInFileBrowser"),children:r.reference}),e.jsx("button",{onClick:()=>{p.files.reveal(r.reference).catch(()=>T("error",n("detail.failedToOpenBrowser")))},className:"px-2 py-1 text-[10px] rounded bg-brand-600/20 text-brand-500 hover:bg-brand-600/30 transition-colors shrink-0",title:n("detail.revealInFinder"),children:n("common:open")}),e.jsx("button",{onClick:()=>Rt(r.reference),className:`px-2 py-1 text-[10px] rounded transition-colors shrink-0 ${Se?"bg-green-500/20 text-green-600":"bg-surface-overlay/50 text-fg-secondary hover:bg-surface-overlay"}`,title:n("detail.copyPath"),children:n(Se?"common:copied":"common:copy")})]}),r.reference&&!Be(r.reference)&&r.type!=="file"&&r.type!=="directory"&&e.jsx("span",{className:"text-xs text-fg-tertiary font-mono break-all",children:r.reference})]}),r.artifactType&&r.artifactData?e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-surface-elevated rounded-xl p-5",children:e.jsx(Ss,{artifact:r.artifactData,mode:r.artifactType})}),r.reference&&e.jsxs("div",{className:"px-3 py-2 bg-surface-elevated rounded-lg",children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider block mb-1",children:n("detail.artifactDirectory")}),e.jsx("span",{className:"text-xs text-fg-secondary font-mono break-all",children:r.reference})]}),e.jsx("div",{className:"flex gap-2",children:e.jsx("button",{onClick:ss,className:"flex-1 px-4 py-2.5 bg-brand-600 hover:bg-brand-500 text-white text-sm font-medium rounded-lg transition-colors",children:n("detail.openInBuilder")})}),r.summary&&e.jsx("div",{className:"bg-surface-elevated rounded-xl p-5",children:e.jsx(Pe,{content:r.summary,className:"text-fg-secondary text-sm"})})]}):r.reference&&Be(r.reference)?e.jsxs("div",{className:"space-y-4",children:[r.summary&&e.jsx("div",{className:"bg-surface-elevated rounded-xl p-5",children:e.jsx(Pe,{content:r.summary,className:"text-fg-secondary text-sm"})}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-10",children:[e.jsxs("svg",{className:"w-10 h-10 text-fg-muted mb-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),e.jsx("p",{className:"text-xs text-fg-tertiary font-mono mb-4 px-4 text-center break-all select-all",children:r.reference}),e.jsx("button",{onClick:()=>window.open(r.reference,"_blank","noopener,noreferrer"),className:"px-6 py-2.5 bg-brand-600 hover:bg-brand-500 text-white text-sm font-medium rounded-lg transition-colors",children:n("detail.openUrl")})]})]}):r.type==="directory"&&r.reference?e.jsxs("div",{className:"space-y-4",children:[r.summary&&e.jsx("div",{className:"bg-surface-elevated rounded-xl p-5",children:e.jsx(Pe,{content:r.summary,className:"text-fg-secondary text-sm"})}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-10",children:[e.jsx("svg",{className:"w-10 h-10 text-fg-muted mb-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})}),e.jsx("p",{className:"text-xs text-fg-tertiary font-mono mb-4 px-4 text-center break-all select-all",children:r.reference}),e.jsx("button",{onClick:()=>{p.files.reveal(r.reference).catch(()=>T("error",n("detail.failedToOpenBrowser")))},className:"px-6 py-2.5 bg-brand-600 hover:bg-brand-500 text-white text-sm font-medium rounded-lg transition-colors",children:n("detail.openInFileBrowser")})]})]}):e.jsxs("div",{className:"bg-surface-elevated rounded-xl overflow-hidden",children:[(ke||r.summary)&&!jt&&!ue&&!Nt&&r.reference&&r.type==="file"&&(we==="markdown"||we==="text"||we==="html")&&e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border-subtle bg-surface-secondary/50",children:[e.jsx("button",{onClick:os,className:`px-3 py-1 rounded text-xs font-medium transition-colors ${ee?"text-fg-tertiary hover:text-fg-secondary":"bg-brand-600/20 text-brand-500"}`,children:n("detail.preview")}),e.jsx("button",{onClick:is,className:`px-3 py-1 rounded text-xs font-medium transition-colors ${ee?"bg-brand-600/20 text-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:n("detail.edit")}),e.jsx("div",{className:"flex-1"}),ee&&e.jsx("button",{onClick:_t,disabled:!H||Oe,className:"px-3 py-1 rounded text-xs font-medium bg-brand-600 hover:bg-brand-500 text-white transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:n(Oe?"detail.saving":"detail.save")})]}),e.jsx("div",{className:"p-5",children:jt?e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"h-4 bg-surface-overlay/60 rounded w-full"}),e.jsx("div",{className:"h-4 bg-surface-overlay/60 rounded w-5/6"}),e.jsx("div",{className:"h-4 bg-surface-overlay/60 rounded w-4/6"}),e.jsx("div",{className:"h-32 bg-surface-overlay/40 rounded-lg w-full mt-2"}),e.jsx("div",{className:"h-4 bg-surface-overlay/60 rounded w-3/4"}),e.jsx("div",{className:"h-4 bg-surface-overlay/60 rounded w-2/3"})]}):ue?e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("img",{src:ue.src,alt:ue.name,className:"max-w-full max-h-[60vh] rounded-lg object-contain"}),e.jsx("span",{className:"text-xs text-fg-tertiary",children:ue.name})]}):xe?e.jsxs("div",{className:"flex flex-col gap-3 py-4",children:[xe.kind==="audio"?e.jsx("audio",{controls:!0,preload:"metadata",src:xe.src,className:"w-full"}):e.jsx("video",{controls:!0,preload:"metadata",src:xe.src,className:"w-full max-h-[60vh] rounded-lg bg-black"}),e.jsx("span",{className:"text-xs text-fg-tertiary",children:xe.name})]}):ke?ee?e.jsx("div",{className:"animate-fadeIn",children:e.jsx("textarea",{ref:Ge,value:me,onChange:t=>{ze(t.target.value),G(!0)},className:"w-full min-h-[120px] p-3 text-sm font-mono bg-surface-primary border border-border-subtle rounded-lg text-fg-secondary focus:outline-none focus:ring-1 focus:ring-brand-500/50 overflow-hidden",style:{resize:"none"},spellCheck:!1})},"edit"):e.jsx("div",{className:"animate-fadeIn",children:e.jsx(js,{content:ke,format:we,className:"text-fg-secondary text-sm",onHtmlSelection:ds,basePath:r?.reference?r.reference.replace(/[/\\][^/\\]+$/,""):void 0})},"preview"):Nt?e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-fg-secondary",children:n("detail.cannotPreview",{type:r.type})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>{p.files.reveal(r.reference).catch(()=>T("error",n("detail.failedToOpen")))},className:"text-xs bg-surface-elevated px-3 py-2 rounded text-brand-500 hover:text-brand-500 hover:underline flex-1 truncate text-left cursor-pointer font-mono",title:n("detail.openInFileBrowser"),children:r.reference}),e.jsx("button",{onClick:()=>{p.files.reveal(r.reference).catch(()=>T("error",n("detail.failedToOpen")))},className:"px-3 py-2 text-xs rounded-lg bg-brand-600/20 text-brand-500 hover:bg-brand-600/30 transition-colors shrink-0",children:n("common:open")}),e.jsx("button",{onClick:()=>Rt(r.reference),className:`px-3 py-2 text-xs rounded-lg transition-colors shrink-0 ${Se?"bg-green-500/20 text-green-600":"bg-surface-overlay/50 text-fg-secondary hover:bg-surface-overlay"}`,children:n(Se?"common:copied":"common:copy")})]})]}):r.summary?ee?e.jsx("textarea",{ref:Ge,value:me,onChange:t=>{ze(t.target.value),G(!0)},className:"w-full min-h-[120px] p-3 text-sm font-mono bg-surface-primary border border-border-subtle rounded-lg text-fg-secondary focus:outline-none focus:ring-1 focus:ring-brand-500/50 overflow-hidden",style:{resize:"none"},spellCheck:!1}):e.jsx(Pe,{content:r.summary,className:"text-fg-secondary text-sm"}):e.jsx("p",{className:"text-sm text-fg-tertiary italic",children:n("detail.noContent")})})]})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center h-full",children:e.jsxs("div",{className:"text-center text-fg-tertiary space-y-3 max-w-xs",children:[e.jsx("div",{className:"w-16 h-16 mx-auto rounded-2xl bg-surface-elevated/60 flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-fg-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}),e.jsx("p",{className:"text-sm text-fg-secondary",children:n("detail.selectToView")}),!x&&e.jsx("p",{className:"text-[10px] text-fg-muted",children:n("detail.keyboardHint")})]})})]}),r?.agentId&&!x&&e.jsx("button",{type:"button",onClick:()=>et(),className:"absolute bottom-6 right-6 z-20 w-12 h-12 rounded-full bg-brand-600 hover:bg-brand-500 text-white shadow-lg shadow-black/20 flex items-center justify-center transition-transform hover:scale-105 animate-fab-in",title:n("chat.openChat",{defaultValue:"Open in Team Chat"}),children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})})]}),he&&e.jsx("div",{id:"selection-toolbar",className:"fixed z-50 -translate-x-1/2 -translate-y-full bg-surface-elevated border border-border-default rounded-lg shadow-xl overflow-hidden",style:{left:he.x,top:he.y-8},children:e.jsxs("button",{onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),et(he.text,he.htmlMeta)},className:"px-3 py-1.5 text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-1.5 whitespace-nowrap",children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),n("contextMenu.addToConversation")]})}),Jt&&r&&e.jsx(Ns,{item:r,onClose:()=>_e(!1),onShared:ts}),Fe&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>Ce(null),children:e.jsxs("div",{className:"bg-surface-secondary border border-border-default rounded-xl p-6 max-w-sm mx-4 shadow-2xl",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-red-500/15 flex items-center justify-center shrink-0",children:e.jsxs("svg",{className:"w-5 h-5 text-red-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-fg-primary",children:n("detail.confirmRemoveTitle")}),e.jsx("div",{className:"text-xs text-fg-secondary mt-0.5",children:n("detail.confirmRemoveMessage",{name:Fe.title})})]})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>Ce(null),className:"px-4 py-1.5 text-xs text-fg-secondary hover:text-fg-primary border border-border-default hover:border-gray-600 rounded-lg transition-colors",children:n("common:cancel")}),e.jsx("button",{onClick:()=>{const t=Fe;Ce(null),es(t)},disabled:!!ht,className:"px-4 py-1.5 text-xs bg-red-600 hover:bg-red-500 text-white rounded-lg transition-colors disabled:opacity-50",children:n("common:remove")})]})]})}),Ke&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>q(null),children:e.jsxs("div",{className:"bg-surface-secondary border border-border-default rounded-xl p-6 max-w-sm mx-4 shadow-2xl",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-amber-500/15 flex items-center justify-center shrink-0",children:e.jsx("svg",{className:"w-5 h-5 text-amber-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-fg-primary",children:n("detail.unsavedTitle")}),e.jsx("div",{className:"text-xs text-fg-secondary mt-0.5",children:n("detail.unsavedMessage")})]})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>q(null),className:"px-4 py-1.5 text-xs text-fg-secondary hover:text-fg-primary border border-border-default hover:border-gray-600 rounded-lg transition-colors",children:n("common:cancel")}),e.jsx("button",{onClick:()=>{cs(),Ke.action()},className:"px-4 py-1.5 text-xs text-fg-secondary hover:text-fg-primary border border-border-default hover:border-gray-600 rounded-lg transition-colors",children:n("detail.discard")}),e.jsx("button",{onClick:async()=>{await _t(),Ke.action(),q(null)},className:"px-4 py-1.5 text-xs bg-brand-600 hover:bg-brand-500 text-white rounded-lg transition-colors",children:n("detail.saveAndLeave")})]})]})})]})}function rt({label:u,value:o,current:c,onClick:n}){return e.jsx("button",{onClick:()=>n(c===o?"":o),className:`px-2 py-1 rounded text-xs whitespace-nowrap shrink-0 transition-colors ${c===o?"bg-brand-600 text-white":"bg-surface-elevated text-fg-secondary hover:bg-surface-overlay"}`,children:u})}function Ot(){return e.jsxs("svg",{className:"animate-spin h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})}export{Ts as DeliverablesPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as o,a as l,j as e,M as t,N as n}from"./index-
|
|
1
|
+
import{u as o,a as l,j as e,M as t,N as n}from"./index-B1VN5yM1.js";function r({authUser:s}){const{t:a}=o("nav"),i=l();return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{"data-electron-drag":!0,className:"flex items-center gap-2 px-4 h-14",children:[i&&e.jsx(t,{}),e.jsx("h2",{className:"text-base font-bold",children:a("notifications")})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(n,{collapsed:!1,userId:s?.id,embeddedMode:!0})})]})}export{r as NotificationsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as I,r as i,l as c,j as e,n as d,P as x,A as O}from"./index-B-xjev59.js";function D(){const{t:l}=I(["common","home","work"]),[u,y]=i.useState(""),[r,o]=i.useState("all"),[t,m]=i.useState({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),[h,b]=i.useState(!1),[w,p]=i.useState(!1),v=i.useRef(null),j=i.useRef(void 0);i.useEffect(()=>{setTimeout(()=>v.current?.focus(),100)},[]);const W=i.useCallback(async s=>{if(!s.trim()){m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),p(!1);return}b(!0),p(!0);const n=s.toLowerCase();try{const[N,C,V,R,L,A]=await Promise.allSettled([c.agents.list(),c.tasks.list({search:s,pageSize:20}),c.requirements.list(),c.projects.list(),c.deliverables.search({q:s,limit:20}),c.teams.list()]),E=N.status==="fulfilled"?N.value.agents.filter(a=>a.name?.toLowerCase().includes(n)||a.role?.toLowerCase().includes(n)):[],M=C.status==="fulfilled"?C.value.tasks:[],H=V.status==="fulfilled"?V.value.requirements.filter(a=>a.title?.toLowerCase().includes(n)||a.description?.toLowerCase().includes(n)):[],T=R.status==="fulfilled"?R.value.projects.filter(a=>a.name?.toLowerCase().includes(n)||a.description?.toLowerCase().includes(n)):[],z=L.status==="fulfilled"?L.value.results:[],S=[];if(A.status==="fulfilled"){const a=await Promise.allSettled(A.value.teams.map(f=>c.workflows.list(f.id)));for(const f of a)if(f.status==="fulfilled")for(const g of f.value.workflows)(g.name.toLowerCase().includes(n)||(g.displayName||"").toLowerCase().includes(n)||g.description?.toLowerCase().includes(n))&&S.push(g)}m({agents:E,tasks:M,requirements:H,projects:T,deliverables:z,workflows:S})}catch{m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]})}finally{b(!1)}},[]),B=s=>{y(s),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>W(s),400)},q=[{id:"all",label:l("common:all",{defaultValue:"全部"})},{id:"agents",label:l("common:agents",{defaultValue:"智能体"})},{id:"tasks",label:l("common:tasks",{defaultValue:"任务"})},{id:"requirements",label:l("common:requirements",{defaultValue:"需求"})},{id:"projects",label:l("common:projects",{defaultValue:"项目"})},{id:"deliverables",label:l("common:deliverables",{defaultValue:"交付物"})},{id:"workflows",label:l("common:workflows",{defaultValue:"工作流"})}],k=t.agents.length>0||t.tasks.length>0||t.requirements.length>0||t.projects.length>0||t.deliverables.length>0||t.workflows.length>0;return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"shrink-0 px-4 pt-4 pb-2 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>d.navigate(x.HOME),className:"p-1.5 rounded-lg hover:bg-surface-overlay transition-colors shrink-0",children:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M19 12H5"}),e.jsx("polyline",{points:"12 19 5 12 12 5"})]})}),e.jsxs("div",{className:"flex-1 relative",children:[e.jsxs("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg-tertiary",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{ref:v,value:u,onChange:s=>B(s.target.value),placeholder:l("common:search"),className:"w-full bg-surface-elevated border border-border-default rounded-xl pl-9 pr-3 py-2.5 text-sm text-fg-primary placeholder:text-fg-tertiary focus:border-brand-500 focus:outline-none transition-colors"}),u&&e.jsx("button",{onClick:()=>{y(""),m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),p(!1),v.current?.focus()},className:"absolute right-3 top-1/2 -translate-y-1/2 text-fg-tertiary hover:text-fg-secondary",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),e.jsx("div",{className:"flex gap-1 overflow-x-auto scrollbar-hide",children:q.map(s=>e.jsx("button",{onClick:()=>o(s.id),className:`px-3 py-1.5 text-xs rounded-lg whitespace-nowrap transition-colors ${r===s.id?"bg-brand-600 text-white":"bg-surface-elevated text-fg-secondary hover:text-fg-primary"}`,children:s.label},s.id))})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-4",children:[h&&e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"text-fg-tertiary text-sm animate-pulse",children:l("common:loading")})}),!h&&w&&!k&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-fg-tertiary mb-3",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("p",{className:"text-sm text-fg-tertiary",children:l("common:noResults",{defaultValue:"没有找到相关结果"})})]}),!h&&k&&e.jsxs("div",{className:"space-y-4",children:[(r==="all"||r==="agents")&&t.agents.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:agents",{defaultValue:"智能体"})}),e.jsx("div",{className:"space-y-1",children:(r==="all"?t.agents.slice(0,8):t.agents).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.TEAM,{agentId:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx(O,{name:s.name||"Agent",avatarUrl:s.avatarUrl,size:32}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-fg-primary truncate",children:s.name}),e.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:s.role||s.status})]}),e.jsx(P,{status:s.status})]},s.id))}),r==="all"&&t.agents.length>8&&e.jsxs("button",{onClick:()=>o("agents"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.agents.length,")"]})]}),(r==="all"||r==="tasks")&&t.tasks.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:tasks",{defaultValue:"任务"})}),e.jsx("div",{className:"space-y-1",children:(r==="all"?t.tasks.slice(0,8):t.tasks).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{openTask:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx(K,{status:s.status}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.status," · ",s.priority||""]})]})]},s.id))}),r==="all"&&t.tasks.length>8&&e.jsxs("button",{onClick:()=>o("tasks"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.tasks.length,")"]})]}),(r==="all"||r==="requirements")&&t.requirements.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:requirements",{defaultValue:"需求"})}),e.jsx("div",{className:"space-y-1",children:(r==="all"?t.requirements.slice(0,8):t.requirements).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{openRequirement:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0 ${s.status==="approved"?"text-green-500 bg-green-500/15":s.status==="pending"?"text-amber-500 bg-amber-500/15":s.status==="rejected"?"text-red-500 bg-red-500/15":"text-fg-tertiary bg-surface-elevated"}`,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),e.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.status," · ",s.priority||""]})]})]},s.id))}),r==="all"&&t.requirements.length>8&&e.jsxs("button",{onClick:()=>o("requirements"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.requirements.length,")"]})]}),(r==="all"||r==="projects")&&t.projects.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:projects",{defaultValue:"项目"})}),e.jsx("div",{className:"space-y-1",children:(r==="all"?t.projects.slice(0,8):t.projects).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{projectId:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand-500/15 flex items-center justify-center shrink-0",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-brand-500",children:e.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.name}),s.description&&e.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:s.description})]})]},s.id))}),r==="all"&&t.projects.length>8&&e.jsxs("button",{onClick:()=>o("projects"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.projects.length,")"]})]}),(r==="all"||r==="deliverables")&&t.deliverables.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:deliverables",{defaultValue:"交付物"})}),e.jsx("div",{className:"space-y-1",children:(r==="all"?t.deliverables.slice(0,8):t.deliverables).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.DELIVERABLES,{openDeliverable:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-purple-500/15 flex items-center justify-center shrink-0",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-purple-500",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.type," · ",s.status]})]})]},s.id))}),r==="all"&&t.deliverables.length>8&&e.jsxs("button",{onClick:()=>o("deliverables"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.deliverables.length,")"]})]}),(r==="all"||r==="workflows")&&t.workflows.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:workflows",{defaultValue:"工作流"})}),e.jsx("div",{className:"space-y-1",children:(r==="all"?t.workflows.slice(0,8):t.workflows).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{boardType:"workflows"}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-teal-500/15 flex items-center justify-center shrink-0",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-teal-500",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.displayName||s.name}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.stepCount," steps · v",s.version]})]})]},s.name))}),r==="all"&&t.workflows.length>8&&e.jsxs("button",{onClick:()=>o("workflows"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.workflows.length,")"]})]})]}),!h&&!w&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-fg-tertiary mb-3",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("p",{className:"text-sm text-fg-tertiary",children:l("common:search")})]})]})]})}function P({status:l}){const u=l==="active"||l==="idle"?"bg-green-500":l==="working"||l==="busy"?"bg-blue-500":"bg-gray-400";return e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${u}`})}function K({status:l}){const u=l==="completed"?"text-green-500 bg-green-500/15":l==="in_progress"?"text-blue-500 bg-blue-500/15":l==="pending"?"text-amber-500 bg-amber-500/15":"text-fg-tertiary bg-surface-elevated";return e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0 ${u}`,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M9 11l3 3L22 4"}),e.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})})}export{D as SearchPage};
|
|
1
|
+
import{u as I,r as i,l as c,j as e,n as d,P as x,A as O}from"./index-B1VN5yM1.js";function D(){const{t:l}=I(["common","home","work"]),[u,y]=i.useState(""),[r,o]=i.useState("all"),[t,m]=i.useState({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),[h,b]=i.useState(!1),[w,p]=i.useState(!1),v=i.useRef(null),j=i.useRef(void 0);i.useEffect(()=>{setTimeout(()=>v.current?.focus(),100)},[]);const W=i.useCallback(async s=>{if(!s.trim()){m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),p(!1);return}b(!0),p(!0);const n=s.toLowerCase();try{const[N,C,V,R,L,A]=await Promise.allSettled([c.agents.list(),c.tasks.list({search:s,pageSize:20}),c.requirements.list(),c.projects.list(),c.deliverables.search({q:s,limit:20}),c.teams.list()]),E=N.status==="fulfilled"?N.value.agents.filter(a=>a.name?.toLowerCase().includes(n)||a.role?.toLowerCase().includes(n)):[],M=C.status==="fulfilled"?C.value.tasks:[],H=V.status==="fulfilled"?V.value.requirements.filter(a=>a.title?.toLowerCase().includes(n)||a.description?.toLowerCase().includes(n)):[],T=R.status==="fulfilled"?R.value.projects.filter(a=>a.name?.toLowerCase().includes(n)||a.description?.toLowerCase().includes(n)):[],z=L.status==="fulfilled"?L.value.results:[],S=[];if(A.status==="fulfilled"){const a=await Promise.allSettled(A.value.teams.map(f=>c.workflows.list(f.id)));for(const f of a)if(f.status==="fulfilled")for(const g of f.value.workflows)(g.name.toLowerCase().includes(n)||(g.displayName||"").toLowerCase().includes(n)||g.description?.toLowerCase().includes(n))&&S.push(g)}m({agents:E,tasks:M,requirements:H,projects:T,deliverables:z,workflows:S})}catch{m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]})}finally{b(!1)}},[]),B=s=>{y(s),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>W(s),400)},q=[{id:"all",label:l("common:all",{defaultValue:"全部"})},{id:"agents",label:l("common:agents",{defaultValue:"智能体"})},{id:"tasks",label:l("common:tasks",{defaultValue:"任务"})},{id:"requirements",label:l("common:requirements",{defaultValue:"需求"})},{id:"projects",label:l("common:projects",{defaultValue:"项目"})},{id:"deliverables",label:l("common:deliverables",{defaultValue:"交付物"})},{id:"workflows",label:l("common:workflows",{defaultValue:"工作流"})}],k=t.agents.length>0||t.tasks.length>0||t.requirements.length>0||t.projects.length>0||t.deliverables.length>0||t.workflows.length>0;return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"shrink-0 px-4 pt-4 pb-2 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>d.navigate(x.HOME),className:"p-1.5 rounded-lg hover:bg-surface-overlay transition-colors shrink-0",children:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M19 12H5"}),e.jsx("polyline",{points:"12 19 5 12 12 5"})]})}),e.jsxs("div",{className:"flex-1 relative",children:[e.jsxs("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg-tertiary",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{ref:v,value:u,onChange:s=>B(s.target.value),placeholder:l("common:search"),className:"w-full bg-surface-elevated border border-border-default rounded-xl pl-9 pr-3 py-2.5 text-sm text-fg-primary placeholder:text-fg-tertiary focus:border-brand-500 focus:outline-none transition-colors"}),u&&e.jsx("button",{onClick:()=>{y(""),m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),p(!1),v.current?.focus()},className:"absolute right-3 top-1/2 -translate-y-1/2 text-fg-tertiary hover:text-fg-secondary",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),e.jsx("div",{className:"flex gap-1 overflow-x-auto scrollbar-hide",children:q.map(s=>e.jsx("button",{onClick:()=>o(s.id),className:`px-3 py-1.5 text-xs rounded-lg whitespace-nowrap transition-colors ${r===s.id?"bg-brand-600 text-white":"bg-surface-elevated text-fg-secondary hover:text-fg-primary"}`,children:s.label},s.id))})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-4",children:[h&&e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"text-fg-tertiary text-sm animate-pulse",children:l("common:loading")})}),!h&&w&&!k&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-fg-tertiary mb-3",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("p",{className:"text-sm text-fg-tertiary",children:l("common:noResults",{defaultValue:"没有找到相关结果"})})]}),!h&&k&&e.jsxs("div",{className:"space-y-4",children:[(r==="all"||r==="agents")&&t.agents.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:agents",{defaultValue:"智能体"})}),e.jsx("div",{className:"space-y-1",children:(r==="all"?t.agents.slice(0,8):t.agents).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.TEAM,{agentId:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx(O,{name:s.name||"Agent",avatarUrl:s.avatarUrl,size:32}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-fg-primary truncate",children:s.name}),e.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:s.role||s.status})]}),e.jsx(P,{status:s.status})]},s.id))}),r==="all"&&t.agents.length>8&&e.jsxs("button",{onClick:()=>o("agents"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.agents.length,")"]})]}),(r==="all"||r==="tasks")&&t.tasks.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:tasks",{defaultValue:"任务"})}),e.jsx("div",{className:"space-y-1",children:(r==="all"?t.tasks.slice(0,8):t.tasks).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{openTask:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx(K,{status:s.status}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.status," · ",s.priority||""]})]})]},s.id))}),r==="all"&&t.tasks.length>8&&e.jsxs("button",{onClick:()=>o("tasks"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.tasks.length,")"]})]}),(r==="all"||r==="requirements")&&t.requirements.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:requirements",{defaultValue:"需求"})}),e.jsx("div",{className:"space-y-1",children:(r==="all"?t.requirements.slice(0,8):t.requirements).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{openRequirement:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0 ${s.status==="approved"?"text-green-500 bg-green-500/15":s.status==="pending"?"text-amber-500 bg-amber-500/15":s.status==="rejected"?"text-red-500 bg-red-500/15":"text-fg-tertiary bg-surface-elevated"}`,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),e.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.status," · ",s.priority||""]})]})]},s.id))}),r==="all"&&t.requirements.length>8&&e.jsxs("button",{onClick:()=>o("requirements"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.requirements.length,")"]})]}),(r==="all"||r==="projects")&&t.projects.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:projects",{defaultValue:"项目"})}),e.jsx("div",{className:"space-y-1",children:(r==="all"?t.projects.slice(0,8):t.projects).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{projectId:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand-500/15 flex items-center justify-center shrink-0",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-brand-500",children:e.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.name}),s.description&&e.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:s.description})]})]},s.id))}),r==="all"&&t.projects.length>8&&e.jsxs("button",{onClick:()=>o("projects"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.projects.length,")"]})]}),(r==="all"||r==="deliverables")&&t.deliverables.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:deliverables",{defaultValue:"交付物"})}),e.jsx("div",{className:"space-y-1",children:(r==="all"?t.deliverables.slice(0,8):t.deliverables).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.DELIVERABLES,{openDeliverable:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-purple-500/15 flex items-center justify-center shrink-0",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-purple-500",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.type," · ",s.status]})]})]},s.id))}),r==="all"&&t.deliverables.length>8&&e.jsxs("button",{onClick:()=>o("deliverables"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.deliverables.length,")"]})]}),(r==="all"||r==="workflows")&&t.workflows.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:workflows",{defaultValue:"工作流"})}),e.jsx("div",{className:"space-y-1",children:(r==="all"?t.workflows.slice(0,8):t.workflows).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{boardType:"workflows"}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-teal-500/15 flex items-center justify-center shrink-0",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-teal-500",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.displayName||s.name}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.stepCount," steps · v",s.version]})]})]},s.name))}),r==="all"&&t.workflows.length>8&&e.jsxs("button",{onClick:()=>o("workflows"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.workflows.length,")"]})]})]}),!h&&!w&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-fg-tertiary mb-3",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("p",{className:"text-sm text-fg-tertiary",children:l("common:search")})]})]})]})}function P({status:l}){const u=l==="active"||l==="idle"?"bg-green-500":l==="working"||l==="busy"?"bg-blue-500":"bg-gray-400";return e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${u}`})}function K({status:l}){const u=l==="completed"?"text-green-500 bg-green-500/15":l==="in_progress"?"text-blue-500 bg-blue-500/15":l==="pending"?"text-amber-500 bg-amber-500/15":"text-fg-tertiary bg-surface-elevated";return e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0 ${u}`,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M9 11l3 3L22 4"}),e.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})})}export{D as SearchPage};
|