import{n as e,s as t}from"./rolldown-runtime-BG2f4sTM.js";import{A5 as n,B5 as r,Dvt as i,FI as a,II as o,Kx as s,LI as c,Mft as l,Mvt as u,Mx as d,N_t as f,Nvt as p,O_t as m,P_t as h,Rut as g,att as _,jft as v,mgt as y,npt as b,pZ as x,qx as S,rtt as C,uZ as w,z5 as T,zut as E,zx as D}from"./app-initial-BHB6SClA.js";import{n as O,t as k}from"./quick-chat-window-Bto6eBBo.js";function A(){let e=(0,M.c)(13),t=f(v),{conversationId:n}=T(),[i]=r(),o=h(D),s,l;if(e[0]===n?(s=e[1],l=e[2]):(s=()=>{w();let e=requestAnimationFrame(()=>{g.quickChatWindow?.rendererReady(n??null)});return()=>cancelAnimationFrame(e)},l=[n],e[0]=n,e[1]=s,e[2]=l),(0,N.useEffect)(s,l),n==null)return null;let u;if(e[3]!==n||e[4]!==i||e[5]!==o){let t=a(n),r=i.get(`contextSourceConversationId`);u=o??{contextSourceConversationId:r==null?null:y(r),conversationId:t,hasConversation:!c(t),initialScrollMode:`follow`,projectId:null,projectName:null,selectedTextSourceConversationId:null,title:null},e[3]=n,e[4]=i,e[5]=o,e[6]=u}else u=e[6];let d=u,p;e[7]!==t||e[8]!==d.hasConversation?(p=e=>{S(t,{action:C.CODEX_QUICK_CHAT_LIFECYCLE_ACTION_CLOSED,hasConversation:d.hasConversation,source:e,surface:_.CODEX_QUICK_CHAT_SURFACE_WINDOW}),window.close()},e[7]=t,e[8]=d.hasConversation,e[9]=p):p=e[9];let m;return e[10]!==d||e[11]!==p?(m=(0,P.jsx)(k,{canPopOut:!1,session:d,variant:`window`,onAddToComposer:j,onClose:p}),e[10]=d,e[11]=p,e[12]=m):m=e[12],m}async function j(e){let t=g.quickChatWindow;if(t==null)throw Error(`Quick Chat window service is unavailable`);await t.addToComposer(e)}var M,N,P;e((()=>{M=u(),m(),b(),N=t(p(),1),n(),x(),E(),l(),o(),s(),d(),O(),P=i()}))();export{A as QuickChatWindowPage};
//# sourceMappingURL=quick-chat-window-page-CRV4LSi-.js.map