(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,230752,e=>{"use strict";let n=(0,e.i(816709).create)(e=>({pendingSendToChannel:null,pendingSendToIssue:null,setPendingSendToChannel:n=>e({pendingSendToChannel:n}),setPendingSendToIssue:n=>e({pendingSendToIssue:n})}));e.s(["useEditorSendStore",0,n])},305938,e=>{"use strict";var n=e.i(738776),t=e.i(482560),s=e.i(209988),i=e.i(260218),a=e.i(788010),l=e.i(239340),o=e.i(355819),r=e.i(31807),d=e.i(230752),c=e.i(360112);e.s(["SendToChannelDialog",0,function(){let{pendingSendToChannel:e,setPendingSendToChannel:u}=(0,d.useEditorSendStore)(),{agents:g}=(0,o.useAgentStore)(),{createChannel:h,sendMessage:p}=(0,r.useChannelStore)(),[m,x]=(0,t.useState)([]),[f,S]=(0,t.useState)(""),[j,C]=(0,t.useState)(!1),[T,b]=(0,t.useState)(!1),v=g.filter(e=>!1!==e.enabled);(0,t.useEffect)(()=>{e&&(S(e.position),x([]))},[e]);let y=e=>{e||(u(null),x([]),S(""))},A=async()=>{if(e&&0!==m.length){b(!0);try{let n=g.find(e=>e.id===m[0]),t=n?.name||m[0];await h(e.workspaceId,"","general",m,f);let{channels:s}=r.useChannelStore.getState(),i=s[s.length-1];if(i){let n=`<span data-type="mention" data-id="${m[0]}" data-label="${t}"></span>`,s=`${n} ${f}`;p(e.workspaceId,i.id,s,m)}c.toast.success("已创建频道并发送消息"),y(!1)}catch{c.toast.error("操作失败")}finally{b(!1)}}};if(!e)return null;let w=m.length>0?v.find(e=>e.id===m[0]):null;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s.Dialog,{open:!0,onOpenChange:y,children:(0,n.jsxs)(s.DialogContent,{className:"sm:max-w-md",children:[(0,n.jsxs)(s.DialogHeader,{children:[(0,n.jsx)(s.DialogTitle,{children:"发送到新频道"}),(0,n.jsx)(s.DialogDescription,{children:"选择目标 Agent，创建频道并发送代码位置"})]}),(0,n.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)("label",{className:"text-sm font-medium text-foreground",children:"目标 Agent"}),(0,n.jsx)("button",{type:"button",onClick:()=>C(!0),className:"flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-colors hover:bg-muted",children:w?(0,n.jsx)("span",{className:"truncate",children:w.name}):(0,n.jsx)("span",{className:"text-muted-foreground",children:"选择 Agent..."})})]}),(0,n.jsx)(a.Textarea,{value:f,onChange:e=>S(e.target.value),rows:3,placeholder:"消息内容"}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(i.Button,{variant:"outline",onClick:()=>y(!1),children:"取消"}),(0,n.jsx)(i.Button,{onClick:A,disabled:T||0===m.length,children:T?"发送中...":"确定"})]})]})]})}),(0,n.jsx)(l.AgentPickerDialog,{open:j,onClose:()=>C(!1),onConfirm:()=>C(!1),title:"选择 Agent",description:"选择一个 Agent 作为频道目标",agents:v.map(e=>({id:e.id,name:e.name,avatarUrl:e.avatarUrl,icon:e.icon,description:e.description})),selected:m,onToggle:e=>x([e]),confirmText:"选择",singleSelect:!0})]})}])},648944,e=>{e.n(e.i(305938))}]);