1!function(){try{var e="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c03b2539-1cd1-4ff1-b032-916ea6c0e4b5",e._sentryDebugIdIdentifier="sentry-dbid-c03b2539-1cd1-4ff1-b032-916ea6c0e4b5")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[62263],{17374:(e,t,r)=>{r.d(t,{l:()=>m});var a=r(11241),n=r(451286),i=r(439400),s=r(21497),l=r(727292),o=r(834023),c=r(215604),d=r(751355);let u=(0,d.U)(` 2 subscription GetModuleRevisionContentUpdate($id: ID!) { 3 moduleRevisionContentUpdate(id: $id) { 4 id 5 content 6 response 7 status 8 } 9 } 10`),p=(0,d.U)(` 11 subscription GetModuleUpdate($id: ID!) { 12 moduleUpdate(id: $id) { 13 id 14 latestRevision { 15 id 16 } 17 } 18 } 19`);function m(e){let t,r,n,s,l=(0,a.c)(8),{projectId:c,revisionId:d,subscribeToMore:m}=e;l[0]!==d||l[1]!==m?(t=()=>d?m({document:u,variables:{id:d},onError:f,updateQuery:g}):i.l,r=[d,m],l[0]=d,l[1]=m,l[2]=t,l[3]=r):(t=l[2],r=l[3]),(0,o.useEffect)(t,r),l[4]!==c||l[5]!==m?(n=()=>{if(c)return m({document:p,variables:{id:c},onError:h,updateQuery:x})},s=[c,m],l[4]=c,l[5]=m,l[6]=n,l[7]=s):(n=l[6],s=l[7]),(0,o.useEffect)(n,s)}function x(e,t){let{complete:r,previousData:a,subscriptionData:n}=t;if(!n.data)return;let{latestRevision:i}=n.data.moduleUpdate;if(a?.projectById?.latestRevision?.id!==c.I&&r)return(0,s.h)({},a,{projectById:{latestRevision:{id:i?.id}}})}function h(e){n.Cp(e)}function g(e,t){let{complete:r,previousData:a,subscriptionData:n}=t;if(!n.data)return;let i=(0,l.U)(n.data.moduleRevisionContentUpdate,["status","content","id","response"]);if(a?.projectById?.latestRevision?.id===i.id&&r)return(0,s.h)({},a,{projectById:{latestRevision:i}})}function f(e){n.Cp(e)}},20912:(e,t,r)=>{r.d(t,{GL:()=>o,H5:()=>l,_1:()=>c,aE:()=>s});let a=e=>{if(e.size<=5e3)return;let t=e.size-5e3,r=0;for(let a of e.keys()){if(r>=t)break;e.delete(a),r++}},n=new Map,i=new Map,s=({clientId:e,revisionId:t})=>{n.set(t,e),a(n)},l=({clientId:e,command:t})=>{i.set(t,e),a(i)},o=e=>n.get(e)??i.get(e)??e,c=e=>i.get(e)??e},30739:(e,t,r)=>{r.d(t,{B:()=>i,y:()=>s});var a=r(11241),n=r(834023);function i(e){let t,r,i=(0,a.c)(9),{textToType:s,typingIntervalMs:l,skipSpaces:o,breakOnSpaces:c,textElementRef:d,delayMs:u,chunkSize:p}=e,m=void 0===o||o,x=void 0!==c&&c,h=void 0===u?0:u,g=void 0===p?1:p,f=(0,n.useRef)(0),b=(0,n.useRef)(0),y=(0,n.useRef)(!0);i[0]!==x||i[1]!==g||i[2]!==h||i[3]!==m||i[4]!==d||i[5]!==s||i[6]!==l?(t=()=>{let e,t=()=>{let t,r,a=s.at(f.current),n=a?.length??0;if(b.current<n){if(x){let e=a?.indexOf(" ",b.current+1);void 0!==e&&(-1!==e?b.current=e:b.current=n)}let e=a?.charAt(b.current+1);m&&1===g&&" "===e?b.current=b.current+2:b.current=b.current+g}else clearInterval(e),y.current=!1;t=!y.current,r=s.at(f.current),d.current&&(d.current.textContent=r?.substring(0,b.current)??" ",t||(d.current.textContent=d.current.textContent+" |"))},r=setTimeout(()=>{e=setInterval(t,l)},h);return()=>{clearInterval(e),clearTimeout(r)}},r=[g,m,d,s,l,h,x],i[0]=x,i[1]=g,i[2]=h,i[3]=m,i[4]=d,i[5]=s,i[6]=l,i[7]=t,i[8]=r):(t=i[7],r=i[8]),(0,n.useEffect)(t,r)}function s(e){let t,r,i=(0,a.c)(8),{textToType:s,typingIntervalMs:l,deletingIntervalMs:o,skipSpaces:c,textElementRef:d,pauseDelayMs:u}=e,p=void 0===c||c,m=void 0===u?0:u,x=(0,n.useRef)(0),h=(0,n.useRef)(0),g=(0,n.useRef)(!0);i[0]!==o||i[1]!==m||i[2]!==p||i[3]!==d||i[4]!==s||i[5]!==l?(t=()=>{let e,t,r=()=>{let e=s.at(x.current);d.current&&(d.current.textContent=e?.substring(0,h.current)??"")},a=()=>{let a=s.at(x.current),i=a?.length??0;if(h.current<i){let e=a?.charAt(h.current+1);p&&" "===e?h.current=h.current+2:h.current=h.current+1,r()}else clearInterval(e),g.current=!1,m>0?t=setTimeout(()=>{e=setInterval(n,o)},m):e=setInterval(n,o)},n=()=>
19{if(h.current>0){let e=s.at(x.current)?.charAt(h.current-1);p&&" "===e?h.current=h.current-2:h.current=h.current-1,r()}else clearInterval(e),g.current=!0,x.current=(x.current+1)%s.length,e=setInterval(a,l)};return e=g.current?setInterval(a,l):setInterval(n,o),()=>{clearInterval(e),t&&clearTimeout(t)}},r=[o,p,d,s,l,m],i[0]=o,i[1]=m,i[2]=p,i[3]=d,i[4]=s,i[5]=l,i[6]=t,i[7]=r):(t=i[6],r=i[7]),(0,n.useEffect)(t,r)}},57711:(e,t,r)=>{r.d(t,{I:()=>a});let a="fake-id"},63174:(e,t,r)=>{r.d(t,{r:()=>f});var a=r(294799),n=r(11241),i=r(445870),s=r(449259),l=r(917339),o=r(99873),c=r(890292),d=r(971288),u=r(109835),p=r(71940),m=r(834023);let x=(0,m.forwardRef)((e,t)=>{let{isVisible:r=!1,className:n,...i}=e,s=(0,m.useRef)(null);return(0,m.useEffect)(()=>{s.current&&(clearTimeout(s.current),s.current=null)},[r]),(0,m.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]),(0,a.jsx)("input",{id:i.id,ref:t,type:r?"text":"password",autoComplete:"off",className:n,...i,onChange:t=>{e.onChange&&e.onChange(t),!r&&s.current&&clearTimeout(s.current)}})}),h="tablet:text-sm focus:border-link w-full flex-1 rounded border py-[6px] px-[8px] outline-none transition-colors flex gap-[4px]",g="border-comeback-gray-75 placeholder:text-comeback-gray-500 bg-white selection:bg-[#E9EBFD] disabled:cursor-not-allowed disabled:text-comeback-gray-400",f=e=>{let t,r,f,b,y,v,j,I,w,N,T,E,S,_,k=(0,n.c)(46),{fieldName:C,placeholder:R,autoFocus:A,hasError:G,isLocked:P,onUnlock:O,inputProps:U,onDismiss:M,initialIsVisible:L,isDisabled:D}=e,B=(0,m.useRef)(null),$=(0,m.useRef)(null),F=(0,m.useRef)(null);k[0]===Symbol.for("react.memo_cache_sentinel")?(t={},k[0]=t):t=k[0];let{hoverProps:H,isHovered:q}=(0,u.M)(t),[z,V]=(0,m.useState)(L??!1),W=D||!P;k[1]!==O||k[2]!==W?(r={onPress:O,isDisabled:W},k[1]=O,k[2]=W,k[3]=r):r=k[3];let{buttonProps:Y}=(0,d.s)(r,B);k[4]!==z?(f=()=>V(!z),k[4]=z,k[5]=f):f=k[5],k[6]!==D||k[7]!==f?(b={onPress:f,isDisabled:D},k[6]=D,k[7]=f,k[8]=b):b=k[8];let{buttonProps:Q}=(0,d.s)(b,$);k[9]!==D||k[10]!==M?(y={onPress:M,isDisabled:D},k[9]=D,k[10]=M,k[11]=y):y=k[11];let{buttonProps:X}=(0,d.s)(y,F);k[12]!==H||k[13]!==Y?(v=(0,p.v)(Y,H),k[12]=H,k[13]=Y,k[14]=v):v=k[14];let K=v,J=G&&"text-comeback-red-400";k[15]!==J?(j=(0,l.cn)("flex flex-1 flex-shrink-0 flex-row items-center justify-between gap-[4px] text-ellipsis rounded-l p-[6px] tablet:text-sm text-comeback-gray-500",J),k[15]=J,k[16]=j):j=k[16],k[17]===Symbol.for("react.memo_cache_sentinel")?(I=(0,a.jsx)(i.A,{content:c.lg}),k[17]=I):I=k[17],k[18]!==C?(w=(0,a.jsxs)("div",{className:"flex flex-1 items-center gap-[4px] text-ellipsis rounded-l tablet:text-sm text-comeback-gray-500",children:[I,C]}),k[18]=C,k[19]=w):w=k[19],k[20]!==X||k[21]!==M?(N=M&&(0,a.jsx)(s._u,{content:"Dismiss",align:"center",side:"right",isInstant:!0,children:(0,a.jsx)("button",{type:"button",className:"w-fit outline-none ring-offset-background focus-visible:ring-[2px] focus-visible:ring-ring focus-visible:ring-offset-[2px] hover:text-comeback-red-600","aria-label":"Dismiss",...X,children:(0,a.jsx)(i.A,{content:o.tx,size:"xs"})})}),k[20]=X,k[21]=M,k[22]=N):N=k[22],k[23]!==w||k[24]!==N||k[25]!==j?(T=(0,a.jsxs)("div",{className:j,children:[w,N]}),k[23]=w,k[24]=N,k[25]=j,k[26]=T):T=k[26];let Z=P?"Saved":void 0;return k[27]!==A||k[28]!==C||k[29]!==G||k[30]!==Q||k[31]!==U||k[32]!==P||k[33]!==z||k[34]!==K||k[35]!==q||k[36]!==O||k[37]!==R?(E=P?(0,a.jsxs)("div",{className:(0,l.cn)("flex w-full flex-row justify-between overflow-hidden text-ellipsis whitespace-nowrap",h,P?"border-comeback-gray-75 bg-comeback-gray-25 text-comeback-gray-400":g),children:[(0,a.jsx)("span",{children:"â¢".repeat(16)}),O?(0,a.jsx)("button",{...K,"aria-label":"Unlock secret",className:"outline-none ring-offset-background focus-visible:ring-[2px] focus-visible:ring-ring focus-visible:ring-offset-[2px] hover:text-comeback-gray-600",children:(0,a.jsx)(i.A,{content:q?c.bt:c.wg})}):null]}):(0,a.jsxs)("div",{className:(0,l.cn)(h,G&&"border-error focus:border-error",P?"border-comeback-gray-75 bg-comeback-gray-25 text-comeback-gray-400":g),children:[(0,a.jsx)(x,{id:C,className:"w-full outline-none",placeholder:R??C.toLowerCase().replace(/_/g," "),autoFocus:A,isVisible:z,"aria-description":`${C} secret input`,...U}),(0,a.jsx)(s._u,{content:z?"Hide":"Show",align:"center",side:"right",children:(0,a.jsx)("button",{type:"button",className:"outline-none ring-offset-background focus-visible:ring-[2px] focus-visible:ring-ring focus-visible:ring-offset-[2px] hover:text-comeback-gray-600","aria-label":z?"Hide secret":"Show secret",...Q,children:(0,a.jsx)(i.A,{content:z?c.GF:c.Vt,size:"small"})})})]}),k[27]=A,k[28]=C,k[29]=G,k[30]=Q,k[31]=U,k[32]=P,k[33]=z,k[34]=K,k[35]=q,k[36]=O,k[37]=R,k[38]=E):E=k[38],k[39]!==Z||k[40]!==E?(S=(0,a.jsx)(s._u,{content:Z,al
19ign:"center",side:"right",isInstant:!0,children:E}),k[39]=Z,k[40]=E,k[41]=S):S=k[41],k[42]!==C||k[43]!==T||k[44]!==S?(_=(0,a.jsxs)("label",{className:"flex w-full flex-col justify-center rounded",htmlFor:C,children:[T,S]}),k[42]=C,k[43]=T,k[44]=S,k[45]=_):_=k[45],_}},85694:(e,t,r)=>{r.d(t,{q:()=>l});var a=r(294799),n=r(11241),i=r(917339),s=r(309894);let l=e=>{let t,r,l=(0,n.c)(8),{onPress:o,disabled:c,children:d,className:u,type:p}=e;return l[0]!==u?(t=(0,i.cn)("line-clamp-4 w-fit max-w-[360px] justify-start whitespace-break-spaces text-left","focus-visible:ring-2 focus-visible:ring-comeback-blue-400 focus-visible:ring-offset-1",u),l[0]=u,l[1]=t):t=l[1],l[2]!==d||l[3]!==c||l[4]!==o||l[5]!==t||l[6]!==p?(r=(0,a.jsx)(s.Button,{onPress:o,disabled:c,type:p,color:"light",className:t,children:d}),l[2]=d,l[3]=c,l[4]=o,l[5]=t,l[6]=p,l[7]=r):r=l[7],r}},106768:(e,t,r)=>{r.d(t,{T:()=>l});var a=r(767838),n=r(232726),i=r(648803);let s=(0,a.y)((e,t)=>({selectedRevisionId:null,setSelectedRevisionId:t=>e({selectedRevisionId:t}),projectId:null,setProjectId:t=>e({projectId:t}),initializeWithFirstRevision:r=>{!t().selectedRevisionId&&r.length>0&&e({selectedRevisionId:r[0]?.id||null})},reset:()=>e({selectedRevisionId:null,projectId:null})})),l=e=>(0,n.P)(s,(0,i.k)(e))},142886:(e,t,r)=>{r.d(t,{o:()=>n});var a=r(439502);let n=()=>{let{autoModeRemoved:e}=(0,a.Wi)();return e?"thinking":"auto"}},148999:(e,t,r)=>{r.d(t,{L:()=>o,y:()=>l});var a=r(767838),n=r(232726),i=r(648803),s=r(364150);let l=(0,a.y)()(e=>({textAreaHeight:0,setTextAreaHeight:t=>e({textAreaHeight:t}),bannerHeight:0,setBannerHeight:t=>e({bannerHeight:t}),queueTrayHeight:0,setQueueTrayHeight:t=>e({queueTrayHeight:t}),dockHeight:0,setDockHeight:t=>e({dockHeight:t}),tipCardHeight:0,setTipCardHeight:t=>e({tipCardHeight:t}),mode:"auto",setMode:t=>e({mode:t}),setModel:t=>e(e=>({value:{...e.value,preferredGenerationProvider:t}})),setSubmittingCommand:t=>e(e=>({value:{...e.value,submittingCommand:t}})),setIsGenerating:t=>e(e=>{let r=new Map(e.value.isGenerating);return t.generating?r.set(t.threadId,!0):r.delete(t.threadId),{value:{...e.value,isGenerating:r}}}),setBannerVisible:t=>e(e=>({value:{...e.value,isBannerVisible:t}})),setBannerDismissed:(t,r)=>e(e=>({value:{...e.value,dismissedBanners:{...e.value.dismissedBanners,[t]:r}}})),setChatError:t=>e(e=>({value:{...e.value,chatError:t}})),setPendingFigmaUrl:t=>e(e=>({value:{...e.value,pendingFigmaUrl:t}})),clearPendingFigmaUrl:()=>e(e=>({value:{...e.value,pendingFigmaUrl:null}})),addPendingMobbinScreens:t=>e(e=>({value:{...e.value,pendingMobbinScreens:(0,s.TZ)(e.value.pendingMobbinScreens,t)}})),clearPendingMobbinScreens:()=>e(e=>({value:{...e.value,pendingMobbinScreens:[]}})),selectedQueuedMessageId:null,setSelectedQueuedMessageId:t=>e({selectedQueuedMessageId:t}),queuedMessages:new Map,addQueuedMessage:({threadId:t,message:r})=>e(e=>{let a=new Map(e.queuedMessages),n=a.get(t)??[];return n.some(e=>e.id===r.id)?e:(a.set(t,[...n,r]),{queuedMessages:a})}),removeQueuedMessage:({threadId:t,messageId:r})=>e(e=>{let a=new Map(e.queuedMessages),n=a.get(t)??[];return a.set(t,n.filter(e=>e.id!==r)),{queuedMessages:a,selectedQueuedMessageId:e.selectedQueuedMessageId===r?null:e.selectedQueuedMessageId}}),replaceQueuedMessageId:({threadId:t,oldId:r,newId:a})=>e(e=>{let n=new Map(e.queuedMessages),i=n.get(t)??[];return n.set(t,i.map(e=>e.id===r?{...e,id:a}:e)),{queuedMessages:n}}),markQueuedMessagesAsSending:({threadId:t})=>e(e=>{let r=new Map(e.queuedMessages),a=r.get(t)??[];return r.set(t,a.map(e=>({...e,status:"sending"}))),{queuedMessages:r,selectedQueuedMessageId:null}}),clearQueuedMessages:({threadId:t})=>e(e=>{let r=new Map(e.queuedMessages);return r.delete(t),{queuedMessages:r,selectedQueuedMessageId:null}}),reset:()=>e(e=>({...e,textAreaHeight:0,bannerHeight:0,queueTrayHeight:0,dockHeight:0,mode:"auto",selectedQueuedMessageId:null,queuedMessages:new Map,value:{preferredGenerationProvider:"default",submittingCommand:null,isGenerating:new Map,isBannerVisible:!1,dismissedBanners:{},chatError:null,pendingFigmaUrl:null,pendingMobbinScreens:[]}})),value:{preferredGenerationProvider:"default",submittingCommand:null,isGenerating:new Map,isBannerVisible:!1,dismissedBanners:{},chatError:null,pendingFigmaUrl:null,pendingMobbinScreens:[]}})),o=e=>(0,n.P)(l,(0,i.k)(e))},150375:(e,t,r)=>{r.d(t,{J:()=>c});var a=r(294799),n=r(11241),i=r(33031),s=r(30739),l=r(702459),o=r(834023);let c=e=>{let t,r,c=(0,n.c)(3),{status:d}=e,u=(0,o.useRef)(null);return c[0]===Symbol.for("react.memo_cache_sentinel")?(t={textElementRef:u,deletingIntervalMs:250,textToType:["..."],typingIntervalMs:500},c[0]=t):t=c[0],(0,s.y)(t),c[1]!==d?(r=d===i.ProjectRevisionStatus.QUEUED?(0,a.jsxs)(l.E,{className:"comeback-text-body-md flex w-fit flex-row",color:"yellow",children:["Waiting",(0,a.jsx)("span",{ref:u,className:"block w-[10px] text-left"})]}):(0,i.isStatusIndicatingRevisionIsBuilding)(d)?(0,a.jsxs)(l.E,{className:"comeback-text-body-md flex w-fit flex-row",color:"blue",children:["Building",(0,a.jsx)("span",{ref:u,className:"block w-[10px] text-left"})]}):(0,a.jsx)(l.E,{className:"w-fit",color:"green",children:"Finished"}),c[1]=d,c[2]=r):r=c[2],r}},156766:(e,t,r)=>{r.d(t,{A:()=>i});var a=r(294799),n=r(11241);let i=(0,r(834023).forwardRef)(function(e,t){let r,i,s,l,o,c,d,u,p,m,x,h=(0,n.c)(26);h[0]!==e?({src:o,title:c,width:d,height:r,scale:l,overflow:i,...s}=e,h[0]=e,h[1]=r,h[2]=i,h[3]=s,h[4]=l,h[5]=o,h[6]=c,h[7]=d):(r=h[1],i=h[2],s=h[3],l=h[4],o=h[5],c=h[6],d=h[7]);let g=i??"hidden";h[8]!==r||h[9]!==g||h[10]!==d?(u={width:d,height:r,overflow:g,position:"relative",margin:"auto"},h[8]=r,h[9]=g,h[10]=d,h[11]=u):u=h[11];let f=o||void 0,b=`scale(${l})`,y=`${100/l}%`,v=`${100/l}%`;return h[12]!==s.style||h[13]!==b||h[14]!==y||h[15]!==v?(p={...s.style,transform:b,transformOrigin:"top left",width:y,height:v,border:"none",position:"absolute"},h[12]=s.style,h[13]=b,h[14]=y,h[15]=v,h[16]=p):p=h[16],h[17]!==t||h[18]!==s||h[19]!==f||h[20]!==p||h[21]!==c?(m=(0,a.jsx)("iframe",{src:f,title:c,ref:t,...s,style:p}),h[17]=t,h[18]=s,h[19]=f,h[20]=p,h[21]=c,h[22]=m):m=h[22],h[23]!==u||h[24]!==m?(x=(0,a.jsx)("div",{style:u,children:m}),h[23]=u,h[24]=m,h[25]=x):x=h[25],x})},163195:(e,t,r)=>{r.d(t,{HJ:()=>A,I6:()=>C,k8:()=>G});var a=r(294799),n=r(11241),i=r(898936),s=r(765833),l=r(692552),o=r(127167),c=r(35279),d=r
19(106504),u=r(233888),p=r(917339),m=r(400642),x=r(706023),h=r(33031),g=r(904997),f=r(289873),b=r(482515),y=r(834023),v=r(430210),j=r(875457),I=r(982027),w=r(910189),N=r(751355),T=r(510822),E=r(814121);let S=(0,N.U)(` 20 query GetProjectGroupIntegrations { 21 integrations: publicProjectGroups(input: { tags: ["integration"] }) { 22 totalCount 23 pageInfo { 24 endCursor 25 hasNextPage 26 startCursor 27 hasPreviousPage 28 } 29 edges { 30 node { 31 id 32 name 33 marketingIconURL 34 marketingDescription 35 } 36 } 37 } 38 } 39`),_=(0,N.U)(` 40 mutation SelectIntegrationFromChat($input: SelectIntegrationFromChatInput!) { 41 selectIntegrationFromChat(input: $input) { 42 success 43 projectGroupRevision { 44 id 45 ...ProjectGroupRevisionForChat 46 thread { 47 ...ThreadForProjectGroupChat 48 } 49 } 50 } 51 } 52`),k=e=>{let t,r,i,s,l,o,d,u,p,m,x,h,g=(0,n.c)(28),{reference:y,isDisabled:v,onSelect:I}=e,w=(0,c.GM)();g[0]===Symbol.for("react.memo_cache_sentinel")?(t={},g[0]=t):t=g[0];let{data:N}=(0,T.I)(S,t);if(g[1]!==N?.integrations.edges||g[2]!==w||g[3]!==v||g[4]!==I||g[5]!==y){p=Symbol.for("react.early_return_sentinel");e:{let e;g[14]!==y?(e=e=>{let{node:t}=e;return t.id===y},g[14]=y,g[15]=e):e=g[15];let t=(N?.integrations.edges??[]).find(e);if(!t){p=null;break e}let{marketingIconURL:n,name:c,marketingDescription:m}=t.node;i=c,r=j.G,o=()=>{I(t.node.id)},d=v,u=w?m??void 0:void 0,s="flex flex-row items-center gap-[4px]",l=n?(0,a.jsx)(b.default,{src:n,width:16,height:16,alt:(0,f.l)(i),className:"rounded-[4px]"}):null}g[1]=N?.integrations.edges,g[2]=w,g[3]=v,g[4]=I,g[5]=y,g[6]=r,g[7]=i,g[8]=s,g[9]=l,g[10]=o,g[11]=d,g[12]=u,g[13]=p}else r=g[6],i=g[7],s=g[8],l=g[9],o=g[10],d=g[11],u=g[12],p=g[13];return p!==Symbol.for("react.early_return_sentinel")?p:(g[16]!==i?(m=(0,a.jsx)("div",{className:"truncate text-body-sm text-comeback-gray-900",children:i}),g[16]=i,g[17]=m):m=g[17],g[18]!==s||g[19]!==l||g[20]!==m?(x=(0,a.jsxs)("div",{className:s,children:[l,m]}),g[18]=s,g[19]=l,g[20]=m,g[21]=x):x=g[21],g[22]!==r||g[23]!==o||g[24]!==d||g[25]!==u||g[26]!==x?(h=(0,a.jsx)(r,{onPress:o,isDisabled:d,tooltip:u,children:x}),g[22]=r,g[23]=o,g[24]=d,g[25]=u,g[26]=x,g[27]=h):h=g[27],h)},C=e=>{let t,r,s,g,N,T,S,C=(0,n.c)(32),{suggestions:R,isDisabled:A,className:G,delayMs:M}=e,{handleChat:L,mutationResult:D}=(0,l.n)(),{called:B}=D,$=(0,i.nZ)(P),[F,H]=(0,E.n)(_),{called:q}=H,z=(0,o.MN)().id,V=A||B||q,W=(0,w.eE)(O);C[0]!==W||C[1]!==L?(t=async e=>{await L({chat:(0,m.YD)({id:e}),action:h.ProjectGroupRevisionAction.CHAT,isThinkingMode:!1,attachments:null}),W?.()},C[0]=W,C[1]=L,C[2]=t):t=C[2];let Y=t,Q=(0,I.C)(U);C[3]!==z||C[4]!==$||C[5]!==W||C[6]!==F||C[7]!==L||C[8]!==Q?(r=async e=>{let t=(0,u.a)();if($){await L({chat:(0,m.NG)({integration:e}),action:h.ProjectGroupRevisionAction.CHAT,isThinkingMode:!1,attachments:null}),W?.();return}await F({variables:{input:{projectGroupId:z,integration:e}},update:(e,r)=>{let{data:a}=r,n=a?.selectIntegrationFromChat.projectGroupRevision;if(!n)return;let i=n.thread;i&&(0,v.U)({cache:e,projectGroupId:z,thread:i}),Q({revisionId:n.id,threadId:n.thread?.id??null}),(0,v.m)({cache:e,projectGroupId:z,revision:n,clientId:t,threadId:i?i.id:null}),W?.()}}),W?.()},C[3]=z,C[4]=$,C[5]=W,C[6]=F,C[7]=L,C[8]=Q,C[9]=r):r=C[9];let X=r,[K,J]=(0,y.useState)(void 0===M);C[10]!==M?(s=()=>{if(void 0!==M){let e=setTimeout(()=>{J(!0)},M);return()=>{clearTimeout(e)}}},g=[M],C[10]=M,C[11]=s,C[12]=g):(s=C[11],g=C[12]),(0,y.useEffect)(s,g);let Z=(0,c.GM)(),ee=void 0!==M&&"animate-fade-in-bottom",et=K?V?"opacity-40":"opacity-100":"pointer-events-none hidden opacity-0";if(C[13]!==G||C[14]!==ee||C[15]!==et?(N=(0,p.cn)(G,ee,et),C[13]=G,C[14]=ee,C[15]=et,C[16]=N):N=C[16],C[17]!==V||C[18]!==X||C[19]!==Y||C[20]!==Z||C[21]!==R){let e;C[23]!==V||C[24]!==X||C[25]!==Y||C[26]!==Z?(e=e=>{if(!(0,x.t2)(e))return(0,a.jsx)(k,{reference:e,isDisabled:V,onSelect:e=>Y(e)},e);let{name:t,description:r}=(0,x.Rx)(e),n=(0,d.l_)({integration:e});return(0,a.jsx)(j.G,{onPress:()=>X(e),isDisabled:V,tooltip:Z?r:void 0,children:(0,a.jsxs)("div",{className:"flex flex-row items-center gap-[4px]",children:[(0,a.jsx)(b.default,{src:n,width:16,height:16,alt:(0,f.l)(t),className:"rounded-[4px]"}),(0,a.jsx)("div",{className:"truncate text-body-sm text-comeback-gray-900",children:t})]})},e)}
52,C[23]=V,C[24]=X,C[25]=Y,C[26]=Z,C[27]=e):e=C[27],T=R.map(e),C[17]=V,C[18]=X,C[19]=Y,C[20]=Z,C[21]=R,C[22]=T}else T=C[22];return C[28]!==V||C[29]!==T||C[30]!==N?(S=(0,a.jsx)(j.b,{isDisabled:V,className:N,children:T}),C[28]=V,C[29]=T,C[30]=N,C[31]=S):S=C[31],S},R=Object.values(x.n3).filter(e=>e!==x.n3.GOOGLE_GEMINI_1_5&&e!==x.n3.GOOGLE_GEMINI_1_5_FLASH).flatMap(e=>(0,x.Rx)(e).useCases.map(t=>[(0,g.k)(t),e])).reduce((e,[t,r])=>{let a=e.get(t)??[];return a.push(r),e.set(t,a),e},new Map),A=e=>{let t,r,i=(0,n.c)(7),{tag:s,isDisabled:l,className:o,delayMs:c}=e;i[0]!==s?(t=R.get((0,g.k)(s))??[],i[0]=s,i[1]=t):t=i[1];let d=t;return i[2]!==o||i[3]!==c||i[4]!==l||i[5]!==d?(r=(0,a.jsx)(C,{suggestions:d,isDisabled:l,className:o,delayMs:c}),i[2]=o,i[3]=c,i[4]=l,i[5]=d,i[6]=r):r=i[6],r},G=e=>{let t,r=(0,n.c)(3),{integration:i,className:l}=e;return r[0]!==l||r[1]!==i?(t=(0,a.jsx)("div",{className:"my-[4px]",children:(0,a.jsx)(s.b2,{integration:i,selected:!0,className:l})}),r[0]=l,r[1]=i,r[2]=t):t=r[2],t};function P(e){let{value:t}=e;return t.viewingModuleId}function O(e){return e.actions?.scrollToEnd}function U(e){return e.addRevisionId}},171005:(e,t,r)=>{r.d(t,{M:()=>l});var a=r(294799),n=r(11241),i=r(917339),s=r(756785);let l=e=>{let t,r,l,o,c,d,u,p,m,x,h,g,f,b,y,v=(0,n.c)(23),{className:j,children:I}=e,w=navigator?.vendor&&/apple/i.test(navigator.vendor);v[0]===Symbol.for("react.memo_cache_sentinel")?(t={x:"13.6691",y:"13.6691",width:"447.662",height:"970.504",rx:"66.0671"},v[0]=t):t=v[0];let N=t;if(w){let e,t,r;return v[1]===Symbol.for("react.memo_cache_sentinel")?(e=(0,i.cn)("no-scrollbar relative tablet:aspect-[475/998] h-full tablet:min-h-[100px] desktop:max-w-[475px] overflow-y-auto tablet:rounded-[76px] tablet:border-[10px] tablet:border-black bg-white"),t=(0,i.cn)("h-full w-full"),v[1]=e,v[2]=t):(e=v[1],t=v[2]),v[3]!==I?(r=(0,a.jsx)("div",{className:e,children:(0,a.jsx)("div",{className:t,children:I})}),v[3]=I,v[4]=r):r=v[4],r}return v[5]!==j?(r=(0,i.cn)("overflow-hidden",j),v[5]=j,v[6]=r):r=v[6],v[7]===Symbol.for("react.memo_cache_sentinel")?(l={clipPath:w?"none":"url('#clip0_11662_1408')"},v[7]=l):l=v[7],v[8]!==I?(o=(0,a.jsx)("g",{style:l,children:(0,a.jsx)("foreignObject",{...N,fill:"white",children:I})}),v[8]=I,v[9]=o):o=v[9],v[10]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)("rect",{x:"151.098",y:"970.132",width:"173.141",height:"5.69544",rx:"2.84772",fill:"black"}),x=(0,a.jsx)("rect",{opacity:"0.35",x:"394.121",y:"39.2265",width:"27.3381",height:"13.6691",rx:"4.32854",stroke:"#4A4A4A",strokeWidth:"1.13909"}),h=(0,a.jsx)("path",{opacity:"0.4",d:"M423.054 43.9728V48.5291C423.971 48.1432 424.567 47.2455 424.567 46.251C424.567 45.2564 423.971 44.3587 423.054 43.9728",fill:"#4A4A4A"}),g=(0,a.jsx)("rect",{x:"395.83",y:"40.9352",width:"23.9209",height:"10.2518",rx:"2.84772",fill:"#4A4A4A"}),f=(0,a.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M375.342 42.8532C378.177 42.8534 380.904 43.8842 382.959 45.7328C383.114 45.8755 383.361 45.8737 383.513 45.7288L384.992 44.3162C385.07 44.2427 385.113 44.1431 385.112 44.0395C385.111 43.9359 385.067 43.8368 384.989 43.7641C379.596 38.8732 371.088 38.8732 365.694 43.7641C365.616 43.8367 365.572 43.9358 365.571 44.0394C365.571 44.143 365.614 44.2427 365.691 44.3162L367.17 45.7288C367.322 45.874 367.57 45.8758 367.725 45.7328C369.78 43.8841 372.507 42.8532 375.342 42.8532ZM375.34 47.5715C376.887 47.5714 378.379 48.1435 379.526 49.1767C379.681 49.3233 379.926 49.3201 380.077 49.1695L381.544 47.6945C381.622 47.6172 381.665 47.5122 381.664 47.4031C381.662 47.2941 381.617 47.19 381.539 47.1142C378.046 43.8823 372.637 43.8823 369.145 47.1142C369.066 47.19 369.021 47.2941 369.02 47.4032C369.019 47.5123 369.062 47.6173 369.139 47.6945L370.606 49.1695C370.757 49.3201 371.002 49.3233 371.157 49.1767C372.303 48.1442 373.794 47.5721 375.34 47.5715ZM378.215 50.6946C378.217 50.8124 378.175 50.926 378.098 51.0085L375.617 53.7529C375.544 53.8335 375.445 53.8789 375.342 53.8789C375.238 53.8789 375.139 53.8335 375.066 53.7529L372.585 51.0085C372.508 50.9259 372.466 50.8123 372.468 50.6945C372.47 50.5768 372.517 50.4652 372.597 50.3863C374.181 48.9173 376.502 48.9173 378.087 50.3863C378.166 50.4653 378.213 50.5769 378.215 50.6946Z",fill:"#4A4A4A"}),c=(0,a.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M357.022 41.2635C357.022 40.5558 356.477 39.9821 355.806 39.9821H354.59C353.918 39.9821 353.374 40.5558 353.374 41.2635V52.3696C353.374 53.0774 353.918 53.6511 354.59 53.6511H355.806C356.477 53.6511 357.022 53.0774 357.022 52.3696V41.2635ZM348.548 42.7159H349.764C350.436 42.7159 350.98 43.3034 350.98 44.0281V52.3389C350.98 53.0636 350.436 53.6512 349.764 53.6512H348.548C347.877 53.6512 347.332 53.0636 347.332 52.3389V44.0281C347.332 43.3034 347.877 42.7159 348.548 42.7159ZM343.608 45.6775H342.392C341.721 45.6775 341.177 46.2725 341.177 47.0064V52.3222C341.177 53.0561 341.721 53.6511 342.392 53.6511H343.608C344.28 53.6511 344.824 53.0561 344.824 52.3222V47.0064C344.824 46.2725 344.28 45.6775 343.608 45.6775ZM337.567 48.4113H33
526.351C335.679 48.4113 335.135 48.9978 335.135 49.7213V52.3412C335.135 53.0647 335.679 53.6511 336.351 53.6511H337.567C338.238 53.6511 338.783 53.0647 338.783 52.3412V49.7213C338.783 48.9978 338.238 48.4113 337.567 48.4113Z",fill:"#4A4A4A"}),d=(0,a.jsx)("rect",{x:"164.598",y:"26.575",width:"142.386",height:"41.7704",rx:"20.8852",fill:"black"}),u=(0,a.jsx)("rect",{x:"9.68226",y:"9.68226",width:"455.635",height:"978.477",rx:"70.054",stroke:"black",strokeWidth:"9.97362"}),p=(0,a.jsx)("rect",{x:"2.84771",y:"2.84771",width:"469.305",height:"992.146",rx:"76.8885",stroke:"black",strokeWidth:"5.69544"}),v[10]=c,v[11]=d,v[12]=u,v[13]=p,v[14]=m,v[15]=x,v[16]=h,v[17]=g,v[18]=f):(c=v[10],d=v[11],u=v[12],p=v[13],m=v[14],x=v[15],h=v[16],g=v[17],f=v[18]),v[19]===Symbol.for("react.memo_cache_sentinel")?(b=(0,a.jsx)("defs",{children:(0,a.jsx)("clipPath",{id:"clip0_11662_1408",children:(0,a.jsx)("rect",{x:"13.6691",y:"13.6691",width:"447.662",height:"970.504",rx:"66.0671",fill:"white"})})}),v[19]=b):b=v[19],v[20]!==r||v[21]!==o?(y=(0,a.jsxs)("svg",{viewBox:s.We,className:r,fill:"none",xmlns:"http://www.w3.org/2000/svg",height:"100%",width:"100%",children:[o,m,x,h,g,f,c,d,u,p,b]}),v[20]=r,v[21]=o,v[22]=y):y=v[22],y}},213728:(e,t,r)=>{r.d(t,{O:()=>l});var a=r(767838),n=r(232726),i=r(648803);let s=(0,a.y)(e=>({planContent:null,isStreaming:!1,isDisabled:!1,dismissed:!1,setPlan:t=>e(e=>({...t,dismissed:!t.isStreaming&&e.dismissed})),dismiss:()=>e({dismissed:!0}),reset:()=>e({planContent:null,isStreaming:!1,isDisabled:!1,dismissed:!1})})),l=e=>(0,n.P)(s,(0,i.k)(e))},215604:(e,t,r)=>{r.d(t,{I:()=>u,W:()=>p});var a=r(11241),n=r(814121),i=r(434666),s=r(33031),l=r(417666),o=r(751355);let c=(0,o.U)(` 53 query GetProjectForAppBuilderByProjectId( 54 $id: ID! 55 $revisionsFirst: Int 56 $revisionsAfter: String 57 $replaceFunctions: Boolean 58 $environment: CreateEnvironment! 59 ) { 60 projectById(id: $id) { 61 ...ProjectForAppBuilder 62 } 63 } 64`),d=(0,o.U)(` 65 mutation CreateProjectRevision( 66 $projectId: ID! 67 $content: String! 68 $action: ProjectRevisionAction 69 $context: String 70 $replaceFunctions: Boolean 71 ) { 72 createRevision( 73 input: { 74 projectId: $projectId 75 content: $content 76 context: $context 77 action: $action 78 } 79 ) { 80 success 81 projectRevision { 82 ...RevisionForProject 83 } 84 } 85 } 86`),u="fake-id",p=e=>{let t,r,o=(0,a.c)(8),{projectId:p,onAdded:x}=e,[h]=(0,n.n)(d);o[0]!==p?(t={projectId:p},o[0]=p,o[1]=t):t=o[1];let{latestRevision:g}=(0,l._)(t),f=g?.needsAuth??!1,{cache:b}=(0,i.m)();return o[2]!==b||o[3]!==h||o[4]!==f||o[5]!==x||o[6]!==p?(r={addRevision:async e=>{let{action:t,content:r,context:a}=e,n=void 0===r?"":r;if(!p)return;let{data:i}=await h({variables:{action:t,projectId:p,content:n,context:a},update:(e,t)=>{let{data:r}=t;if(!r?.createRevision.projectRevision)return;let{projectById:a}=e.readQuery({query:c,variables:{id:p,environment:s.CreateEnvironment.DEVELOPMENT}})??{};a&&e.modify({id:`Project:${p}`,fields:{latestRevision:()=>({...r.createRevision.projectRevision,__typename:"ProjectRevision",id:u})}})},optimisticResponse:()=>{let{projectById:e}=b.readQuery({query:c,variables:{id:p,environment:s.CreateEnvironment.DEVELOPMENT}})??{},r=e?.latestRevision,i={__typename:"Mutation",createRevision:{__typename:"CreateProjectRevisionResponse",success:!0,projectRevision:{__typename:"ProjectRevision",id:u,prompt:r?.prompt??"",cleanedPrompt:r?.cleanedPrompt??"",action:t,content:n,createdAt:new Date().toISOString(),context:a??null,previewURL:null,componentNameMapping:{},dataStoreNameMapping:{},assetNameMapping:{},functionNameMapping:{},projectGroupToForkNameMapping:{},generationAttempt:0,needsAuth:f,status:s.ProjectRevisionStatus.VALID,filePath:r?.filePath??null,routingBehavior:null}}};return e&&b.modify({id:`Project:${p}`,fields:{latestRevision:m}}),i}}),l=i?.createRevision.projectRevision?.id;if(!l)throw Error("No revision id");return x?.({revisionId:l}),{revisionId:l,data:i}}},o[2]=b,o[3]=h,o[4]=f,o[5]=x,o[6]=p,o[7]=r):r=o[7],r};function m(){return{__typename:"ProjectRevision",id:u}}},216074:(e,t,r)=>{r.d(t,{Eh:()=>s,QV:()=>a,gZ:()=>n,lX:()=>l,rc:()=>i});let a=(0,r(388001).A)(),n=()=>
86{a.emit("codegenStarted")},i=()=>{a.emit("codegenGenerating")},s=()=>{a.emit("codegenStopped")},l=()=>{a.emit("codegenError")}},233888:(e,t,r)=>{r.d(t,{a:()=>a});let a=()=>Math.random().toString(36).slice(2)},244893:(e,t,r)=>{r.d(t,{lY:()=>o,rV:()=>d,rl:()=>c,vo:()=>u,w2:()=>l});var a=r(11241),n=r(106504),i=r(91976),s=r(232726);let l=Symbol("NEW_THREAD"),o=(0,s.v)((e,t)=>({emptyThreadUpdatedAt:null,initialized:!1,setEmptyThreadUpdatedAt:t=>e(()=>({emptyThreadUpdatedAt:t})),setInitialThreadId:r=>{if(!t().initialized)return e(()=>({selectedThreadId:r,initialized:!0}))},reset:()=>e(()=>({selectedThreadId:null,emptyThreadUpdatedAt:null,initialized:!1}))})),c=()=>{let e,t,r=(0,a.c)(3),s=(0,i.useSearchParams)();if(r[0]!==s){t=Symbol.for("react.early_return_sentinel");e:{let r=(0,n.qn)(s,n.uI.THREAD_ID)??null;if("n"===r){t=l;break e}e=r?(0,n.c)(r):null}r[0]=s,r[1]=e,r[2]=t}else e=r[1],t=r[2];return t!==Symbol.for("react.early_return_sentinel")?t:e},d=()=>{let e,t=(0,a.c)(4),{replace:r}=(0,i.useRouter)(),s=(0,i.usePathname)(),o=(0,i.useSearchParams)();return t[0]!==o||t[1]!==s||t[2]!==r?(e=e=>{let t=new URLSearchParams(o.toString());t.delete("thread"),e===l?t.set(n.uI.THREAD_ID,"n"):e?t.set(n.uI.THREAD_ID,(0,n.H$)(e)):t.delete(n.uI.THREAD_ID),r(t.toString()?`${s}?${t.toString()}`:s)},t[0]=o,t[1]=s,t[2]=r,t[3]=e):e=t[3],e},u=(0,s.v)(e=>({panelMode:null,setPanelMode:t=>e({panelMode:t}),setIsOpen:t=>e({panelMode:t?"threads":null})}))},268640:(e,t,r)=>{r.d(t,{A:()=>n});var a=r(834023);function n(e){let t=(0,a.useRef)(null);return e&&"instance"in e?t:e??t}},285530:(e,t,r)=>{r.d(t,{p:()=>y,m$:()=>I,IJ:()=>u,D_:()=>T,ln:()=>C,tI:()=>f,uS:()=>g,UB:()=>O,Zv:()=>m,JM:()=>G,_r:()=>A,dC:()=>c,UN:()=>S});var a=r(912857);let n=a.Ik({title:a.Yj().describe("The page title shown in browser tabs and search results.").optional(),description:a.Yj().describe("The page description shown in search results and social previews.").optional(),openGraphImage:a.Yj().describe("The preview image URL shown when sharing the app link on social media.").optional(),favicon:a.Yj().describe("The favicon URL shown in browser tabs.").optional()}),i=function e(t){if(t instanceof a.bv){let r={};for(let n in t.shape){let i=t.shape[n];r[n]=a.Ii.create(e(i))}return new a.bv({...t._def,shape:()=>r})}return t instanceof a.n?new a.n({...t._def,type:e(t.element)}):t instanceof a.Ii?a.Ii.create(e(t.unwrap())):t instanceof a.l1?a.l1.create(e(t.unwrap())):t instanceof a.y0?a.y0.create(t.items.map(t=>e(t))):t}(a.Ik({auth:a.Ik({email:a.zM().describe("Whether to enable email authentication.").optional(),google:a.zM().optional().describe("Whether to enable Google authentication."),facebook:a.zM().optional().describe("Whether to enable Facebook authentication."),twitter:a.zM().optional().describe("Whether to enable X (formerly known as Twitter) authentication.")}).describe("Settings related to authentication. Setting any key inside of this object will make sure that auth is enabled. Enabled for the first time, a signup, sign in, and logout page are added to the user's project. In addition, a new database will be created with the initial schema for managing user accounts. Do not take any additional action for adding other modules, or updating databases unless explicitly requested"),seo:n.describe("SEO and social sharing metadata settings. Use this to update page title, description, open graph image (preview image for social sharing), and favicon.").optional()}));var s=r(33031),l=r(451286);let o=a.YO(a.Yj()),c=e=>{try{let t=JSON.parse(e);return o.parse(t)}catch(e){return l.Cp(e),null}},d=a.YO(a.Yj()),u=e=>{try{let t=JSON.parse(e.replaceAll("\n","\\n"));return d.parse(t)}catch(e){return l.Cp(e),null}},p=a.Ik({tag:a.Yj()}).optional(),m=e=>{try{return p.parse(e)}catch(e){return l.Cp(e),null}},x=a.Ik({[s.IntegrationSelectionTagArg.AUTO_SELECT]:a.Yj().optional(),tag:a.Yj().optional()}).optional(),h=a.YO(a.Yj()),g=e=>{try{let t=JSON.parse(e.replaceAll("\n","\\n"));return h.parse(t)}catch(e){return l.Cp(e),null}},f=e=>{try{return x.parse(e)}catch(e){return l.Cp(e),null}},b=a.Ik({id:a.Yj()}).passthrough(),y=e=>{try{return b.parse(e)}catch(e){return l.Cp(e),null}},v=a.Ik({id:a.Yj(),question:a.Yj(),type:a.k5(["single_select","multi_select","free_text"]),options:a.YO(a.Yj()).nullable()}),j=a.Ik({questions:a.YO(v).min(1)}),I=e=>{try{let t=JSON.parse(e);return j.parse(t)}catch(e){return l.Cp(e),null}},w=a.Ik({title:a.Yj(),imageUrl:a.Yj(),sourceUrl:a.Yj()}),N=a.Ik({images:a.YO(w).min(1)}),T=e=>{try{let t=JSON.parse(e);return N.parse(t)}catch(e){return l.Cp(e),null}},E=a.Ik({ready:a.zM(),issues:a.YO(a.Yj()),warnings:a.YO(a.Yj()),passed:a.YO(a.Yj())}),S=e=>{try{let t=JSON.parse(e);return E.parse(t)}catch(e){return l.Cp(e),null}},_=a.Ik({description:a.Yj(),prefix:a.Yj().nullable().catch(null),route:a.Yj(),screenshotUrl:a.Yj().nullable(),files:a.YO(a.Yj())}),k=a.Ik({originalRoute:a.Yj(),originalScreenshotUrl:a.Yj().nullable(),originalFiles:a.YO(a.Yj()).nullable().catch(null),projectGroupRevisionId:a.Yj().nullable().catch(null),variants:a.YO(_)}),C=e=>{try{let t=JSON.parse(e);return k.parse(t)}catch(e){return l.Cp(e),null}},R=a.Ik({prompt:a.Yj()}),A=e=>{try{let t=JSON.parse(e);return R.parse(t)}catch(e){return l.Cp(e),null}},G=e=>{try{let t=JSON.parse(e);return i.parse(t)}catch(e){return l.Cp(e),null}},P=a.Ik({text:a.Yj(),status:a.fc(s.ToolCallTagStatus).nullable(),hidden:a.zM()});function O(e){return P.parse({text:"string"==typeof e?.[s.ToolCallTagArg.TEXT]?e[s.ToolCallTagArg.TEXT]:"",status:"string"==typeof e?.[s.ToolCallTagArg.STATUS]?e[s.ToolCallTagArg.STATUS]:null,hidden:e?.[s.ToolCallTagArg.HIDDEN]==="true"})}},330547:(e,t,r)=>{r.d(t,{T:()=>a});let a={required:{value:!0,message:"Must be at least 5 characters"},minLength:{value:5,message:"Must be at least 5 characters"},maxLength:{value:31,message:"Must be less than 32 characters"},pattern:{value:/^[a-zA-Z0-9-]+$/,message:"Must only contain letters, numbers, and dashes"}}},359878:(e,t,r)=>{r.d(t,{e:()=>i});var a=r(125695),n=r(33031);let i=({projectGroupId:e,projectGroupRevisionId:t,server:r,pathname:i="/",devServerDomain:s,environment:l})=>{let o=s||a.Ay.NEXT_PUBLIC_DEV_SERVER_DOMAIN,c=o.includes("localhost")?"http":"https",d=[...t?[t,l===n.SandboxEnvironment.BUILDER?"revision":l]:[e],r,o].join(o.endsWith(".ngrok.app")?"-":".");return`${c}://${d}${!i||"/"===i?"":i}`}},364150:(e,t,r)=>{r.d(t,{De:()=>i,TZ:()=>l,_T:()=>o,cI:()=>s});let a=/!\[([^\]]*)\]\(([^)]+)\)/g,n=/\[\[mobbin-reference-context\]\][\s\S]*?\[\[\/mobbin-reference-context\]\]/g;function i(){return`[[mobbin-reference-context]] 87If any of the screenshots above include a "curated by Mobbin" bar along the bottom edge, crop it out and disregard it â that bar is not part of the design being referenced. Otherwise, use the screenshots as normal design references. Do not copy the brand identity of the reference â if the screenshot shows a recognizable brand name, logo, product name, or company-specific copy, do not carry any of that over into the generated app. Use the screenshots only for layout, structure, interaction patterns, and visual style. 88[[/mobbin-reference-context]]`}function s(e){let t=[],r=new Set,i=e.replace(n,"").replace(a,(e,a,n)=>!function(e){try{return"bytescale.mobbin.com"===new URL(e).hostname}catch{return!1}}(n)?e:(r.has(n)||(r.add(n),t.push({imageUrl:n,appName:a})),""));return{screens:t,remainingText:i}}function l(e,t){let r=new Set(e.map(e=>e.imageUrl)),a=[...e];for(let e of t)r.has(e.imageUrl)||(r.add(e.imageUrl),a.push(e));return a}function o(e){return e.map(e=>``).join("\n\n")}},374282:(e,t,r)=>{r.d(t,{o:()=>g});var a=r(294799),n=r(11241),i=r(917339),s=r(789545),l=r(655665),o=r(115565),c=r(99873),d=r(387928),u=r(834023);let p=()=>{let e,t=(0,n.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)("div",{className:"flex h-[28px] w-[28px] shrink-0 items-center justify-center rounded-[4px]",children:(0,a.jsx)(s.I,{content:d.Ne,size:"custom",viewBoxWidth:511,viewBoxHeight:235,className:"w-[28px] text-comeback-gray-900"})}),t[0]=e):e=t[0],e},m="-6.5%",x=e=>{let t,r,i,s,o,c,d,u,p,x,h=(0,n.c)(23),{screen:g}=e;return h[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,a.jsx)(l.aF.Overlay,{}),h[0]=t):t=h[0],h[1]!==g.appName?(r=(0,a.jsx)(l.aF.Title,{hidden:!0,children:g.a
88ppName}),h[1]=g.appName,h[2]=r):r=h[2],h[3]===Symbol.for("react.memo_cache_sentinel")?(i={marginBottom:m},h[3]=i):i=h[3],h[4]!==g.appName||h[5]!==g.imageUrl?(s=(0,a.jsx)("div",{className:"w-fit overflow-hidden",children:(0,a.jsx)("img",{src:g.imageUrl,alt:g.appName,style:i,className:"block max-h-[90dvh] max-w-[min(90vw,1000px)]"})}),h[4]=g.appName,h[5]=g.imageUrl,h[6]=s):s=h[6],h[7]!==r||h[8]!==s?(o=(0,a.jsxs)(l.aF.Content,{className:"z-modal flex max-h-[90dvh] max-w-[min(90vw,1000px)] items-center justify-center overflow-hidden rounded-[8px] !bg-white",children:[r,s]}),h[7]=r,h[8]=s,h[9]=o):o=h[9],h[10]===Symbol.for("react.memo_cache_sentinel")?(c={marginBottom:m},h[10]=c):c=h[10],h[11]!==g.appName||h[12]!==g.imageUrl?(d=(0,a.jsx)("div",{className:"w-full overflow-hidden rounded-[6px] border border-comeback-gray-75 transition-[box-shadow,transform] hover:shadow-sm active:scale-[0.98]",children:(0,a.jsx)("img",{src:g.imageUrl,alt:g.appName,decoding:"async",loading:"lazy",style:c,className:"block w-full"})}),h[11]=g.appName,h[12]=g.imageUrl,h[13]=d):d=h[13],h[14]!==g.appName?(u=(0,a.jsx)("span",{className:"truncate text-[10px] leading-[12px] text-comeback-gray-500",children:g.appName}),h[14]=g.appName,h[15]=u):u=h[15],h[16]!==g.appName||h[17]!==d||h[18]!==u?(p=(0,a.jsx)(l.aF.Trigger,{children:(0,a.jsxs)("button",{type:"button",title:g.appName,className:"flex flex-col gap-[4px] outline-none",children:[d,u]})}),h[16]=g.appName,h[17]=d,h[18]=u,h[19]=p):p=h[19],h[20]!==o||h[21]!==p?(x=(0,a.jsxs)(l.aF.Root,{children:[t,o,p]}),h[20]=o,h[21]=p,h[22]=x):x=h[22],x},h=e=>{let t,r,i,s,l=(0,n.c)(8),{screens:o}=e;l[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,a.jsx)("span",{className:"text-[12px] font-medium leading-[16px] text-comeback-gray-900",children:"Mobbin Screenshots"}),l[0]=t):t=l[0];let c=`repeat(${Math.min(o.length,3)}, 128px)`;return l[1]!==c?(r={gridTemplateColumns:c},l[1]=c,l[2]=r):r=l[2],l[3]!==o?(i=o.map(f),l[3]=o,l[4]=i):i=l[4],l[5]!==r||l[6]!==i?(s=(0,a.jsxs)("div",{className:"flex max-h-[420px] w-fit max-w-[80vw] flex-col gap-[16px] overflow-y-auto p-[20px]",children:[t,(0,a.jsx)("div",{className:"grid gap-[12px]",style:r,children:i})]}),l[5]=r,l[6]=i,l[7]=s):s=l[7],s},g=e=>{let t,r,l,d,m,x,g,f,b,y=(0,n.c)(21),{screens:v,onRemove:j}=e,[I,w]=(0,u.useState)(!1),N=v.length;if(0===N)return null;y[0]!==v?(t=(0,a.jsx)(h,{screens:v}),y[0]=v,y[1]=t):t=y[1];let T=j?"rounded-l-[8px] pr-[8px]":"rounded-[8px] pr-[12px]";y[2]!==T?(r=(0,i.cn)("flex min-w-0 items-center gap-[8px] py-[8px] pl-[4px] outline-none transition-colors hover:bg-comeback-gray-25",T),y[2]=T,y[3]=r):r=y[3],y[4]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(p,{}),y[4]=l):l=y[4],y[5]===Symbol.for("react.memo_cache_sentinel")?(d=(0,a.jsx)("span",{className:"w-fit truncate text-[12px] font-medium leading-[16px] text-comeback-gray-900",children:"Mobbin Screenshots"}),y[5]=d):d=y[5];let E=1===N?"image":"images";return y[6]!==N||y[7]!==E?(m=(0,a.jsxs)("span",{className:"flex min-w-0 flex-col items-start overflow-clip",children:[d,(0,a.jsxs)("span",{className:"text-[10px] leading-[12px] text-comeback-gray-500",children:[N," ",E]})]}),y[6]=N,y[7]=E,y[8]=m):m=y[8],y[9]!==r||y[10]!==m?(x=(0,a.jsxs)("button",{type:"button",className:r,children:[l,m]}),y[9]=r,y[10]=m,y[11]=x):x=y[11],y[12]!==I||y[13]!==t||y[14]!==x?(g=(0,a.jsx)(o.A,{open:I,onOpenChange:w,side:"top",align:"start",modal:!0,content:t,children:x}),y[12]=I,y[13]=t,y[14]=x,y[15]=g):g=y[15],y[16]!==j?(f=j&&(0,a.jsx)("button",{type:"button",onClick:j,"aria-label":"Remove Mobbin screenshots",className:"mr-[8px] flex h-[16px] w-[16px] shrink-0 items-center justify-center rounded-full text-comeback-gray-400 transition-colors hover:bg-comeback-gray-100 hover:text-comeback-gray-600",children:(0,a.jsx)(s.I,{content:c.tx,size:"xxs"})}),y[16]=j,y[17]=f):f=y[17],y[18]!==f||y[19]!==g?(b=(0,a.jsxs)("div",{className:"flex w-fit max-w-full items-center rounded-[8px] border border-comeback-gray-75 bg-white",children:[g,f]}),y[18]=f,y[19]=g,y[20]=b):b=y[20],b};function f(e){return(0,a.jsx)(x,{screen:e},e.imageUrl)}},387631:(e,t,r)=>{r.d(t,{QY:()=>n,ft:()=>a});let a=50,n="codegen-loading"},397748:(e,t,r)=>{r.d(t,{B:()=>o});var a=r(294799),n=r(125695),i=r(834023),s=r(130790);let l={renderIdeas:()=>null,renderAppBuilderSelection:()=>null},o=(0,i.forwardRef)((e,t)=>{let{data:r,startReached:i,atBottomStateChange:o,atTopStateChange:c,followOutput:d,renderChatMessage:u,renderAppBuilderSelection:p,className:m,alignToBottom:x=!0,bottomPadding:h=0}={...l,...e};return(0,a.jsx)(s.aY,{data:r,ref:t,startReached:i,className:m,alignToBottom:x,atTopStateChange:c,atBottomStateChange:o,followOutput:d,atTopThreshold:20,atBottomThreshold:150,increaseViewportBy:400,skipAnimationFrameInResizeObserver:!0,components:{Footer:()=>h>0?(0,a.jsx)("div",{style:{height:h}}):null}
88,initialTopMostItemIndex:"test"===n.Ay.NODE_ENV?void 0:r&&r.length>0?r.length-1:0,itemContent:(e,t)=>"app-builder-selection"===t.type?p(t.selected,e):u(t.data,e)})})},400642:(e,t,r)=>{r.d(t,{$b:()=>c,Bw:()=>I,NG:()=>b,PK:()=>o,Pg:()=>j,WA:()=>f,YD:()=>y,_L:()=>h,cR:()=>g,eW:()=>x,nu:()=>l,rU:()=>m,sY:()=>v,sk:()=>p,u8:()=>w});var a,n=r(706023),i=r(33031),s=r(129765);let l=({revisions:e})=>{let t=new Map;return[...e].filter((e,t,r)=>t===r.findIndex(t=>e.id===t.id)).sort((e,t)=>t.id.localeCompare(e.id)).map(({id:e,aliasRenderName:r,content:a})=>{let n=r,s=t.get(n)??0;return s&&(n=`${n}${s+1}`),t.set(n,s+1),{id:e,name:n,implementation:a.replaceAll(i.MAIN_COMPONENT_NAME,n).replaceAll(i.STORY_COMPONENT_NAME,`${n}Story`)}})},o=((a={}).COMPONENT="component",a.PAGE="page",a.EXPO_PAGE="expo-page",a.DATABASE="database",a.CLIENT_INTEGRATION="client_integration",a.CUSTOM_INTEGRATION="custom_integration",a.INTEGRATION="integration",a.PROJECT_GROUP_TO_FORK="project_group_to_fork",a.DATA_STORE="data_store",a.ASSET="asset",a.FUNCTION="function",a),c=(e,t)=>{if((0,i.isEnumValue)(e,t))return e},d="[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}",u=({markdown:e,type:t})=>{let r=RegExp(`{${t}:(${d})}`,"g"),a=[],n=r.exec(e);for(;n?.length;){let[,t]=n;t&&a.push(t),n=r.exec(e)}
88return[...new Set(a)]},p=e=>u({markdown:e,type:o.FUNCTION}),m=e=>u({markdown:e,type:"design_system"}),x=({id:e})=>`{${o.COMPONENT}:${e}}`,h=({id:e})=>`{${o.PAGE}:${e}}`,g=({id:e})=>`{${o.DATABASE}:${e}}`,f=({src:e})=>`{${o.CLIENT_INTEGRATION}:${e}}`,b=({integration:e})=>`{${o.INTEGRATION}:${e}}`,y=({id:e})=>`{${o.PROJECT_GROUP_TO_FORK}:${e}}`,v=({id:e})=>`{${o.DATA_STORE}:${e}}`,j=({id:e})=>`{${o.ASSET}:${e}}`,I=({id:e})=>`{${o.FUNCTION}:${e}}`,w=({type:e})=>{let t,r;return"uuid"===(e=>{switch(e){case o.DATA_STORE:case o.ASSET:case o.FUNCTION:case o.COMPONENT:case o.PAGE:case o.EXPO_PAGE:case o.DATABASE:case o.CUSTOM_INTEGRATION:case o.PROJECT_GROUP_TO_FORK:return{type:"uuid",validate:s.isUUID};case o.INTEGRATION:return{type:"enum",validate:e=>(0,i.isEnumValue)(e,n.n3)};case o.CLIENT_INTEGRATION:return{type:"enum",validate:e=>(0,i.isEnumValue)(e,i.ClientIntegrationType)};default:return e}})(e).type?(t=RegExp(`{${e}:(${d})}`),r=RegExp(`{${e}:(${d})}$`)):(t=RegExp(`{${e}:([^}]*)}`),r=RegExp(`{${e}:([^}]*)}$`)),{importRegExp:t,regExp:r}}},401499:(e,t,r)=>{r.r(t),r.d(t,{ViewCodeBlock:()=>c});var a=r(294799),n=r(11241),i=r(917339),s=r(834023),l=r(491387);let o=(0,l.R)(),c=e=>{let t,r,c,d,u=(0,n.c)(10),{code:p,isGenerating:m,lang:x,className:h}=e,g=(0,s.useRef)(null);u[0]!==p?(t=()=>{g.current&&void 0!==p&&g.current.updateCode(p)},r=[p],u[0]=p,u[1]=t,u[2]=r):(t=u[1],r=u[2]),(0,s.useEffect)(t,r);let f="js"===x||"javascript"===x||"ts"===x||"typescript"===x||"tsx"===x||"jsx"===x?"js":"sql"===x?"sql":null;return u[3]!==h?(c=(0,i.cn)("max-h-[400px] min-h-fit w-full overflow-x-auto whitespace-pre-wrap rounded-[8px] border-comeback-gray-75 border-t bg-comeback-gray-50 font-mono text-body-xs transition-opacity",h),u[3]=h,u[4]=c):c=u[4],u[5]!==p||u[6]!==m||u[7]!==f||u[8]!==c?(d=(0,a.jsx)(l.g,{isGenerating:m,compartment:o,dialect:f,ref:g,code:p,className:c,showCopyButton:!0,lineWrapping:!0}),u[5]=p,u[6]=m,u[7]=f,u[8]=c,u[9]=d):d=u[9],d}},417384:(e,t,r)=>{r.d(t,{I:()=>b});var a=r(11241),n=r(544245),i=r(127167),s=r(359878),l=r(33031),o=r(451286),c=r(834023),d=r(652982),u=r(637284),p=r(793376),m=r(751355),x=r(994503);let h=(0,m.U)(` 89 subscription SubscribeToPreviewDevServerUpdates($id: String!) { 90 devServerUpdate(id: $id) { 91 id 92 webUrl 93 mobileUrl 94 status 95 error 96 updatedAt 97 } 98 } 99`),g=n.zM;function f(e){let t=Date.parse(e);return Number.isNaN(t)?Date.now():t}function b(e){let t,r,n,m,b,y,v,j,I,w,N,T,E,S=(0,a.c)(42),{historicalProjectGroupRevisionId:_}=e;S[0]===Symbol.for("react.memo_cache_sentinel")?(t={level:g},S[0]=t):t=S[0];let{debug:k,error:C}=(0,d._)(t),{id:R,filesystemVersion:A,organizationPlan:G}=(0,i.MN)(),P=A!==l.FilesystemVersion.NOT_FILE_BASED,O=(0,u.C)();S[1]===Symbol.for("react.memo_cache_sentinel")?(r={status:null,error:null,updatedAtMs:0},S[1]=r):r=S[1];let[U,M]=(0,c.useState)(r);S[2]!==_||S[3]!==G||S[4]!==R?(n={organizationPlan:G,projectGroupId:R,projectGroupRevisionId:_,server:"web",environment:l.SandboxEnvironment.BUILDER},S[2]=_,S[3]=G,S[4]=R,S[5]=n):n=S[5];let L=(0,p.a)(n);S[6]!==_||S[7]!==G||S[8]!==R?(m={organizationPlan:G,projectGroupId:R,projectGroupRevisionId:_,server:"mobile",environment:l.SandboxEnvironment.BUILDER},S[6]=_,S[7]=G,S[8]=R,S[9]=m):m=S[9];let D=(0,p.a)(m);S[10]!==O||S[11]!==k||S[12]!==C||S[13]!==_||S[14]!==P||S[15]!==R?(b=()=>{if(!P)return;let e=_?{projectGroupRevisionId:_}:{projectGroupId:R};(async e=>{k(`[debug] Booting dev server with input: ${JSON.stringify(e)}`);let t=await O({input:e}),r=t?.data?.bootDevServer.devServerSession;if(!r){C("[debug] Failed to boot dev server",{variant:"error"}),o.Cp(Error("Failed to boot dev server"));return}return M({status:r.status,error:r.error??null,updatedAtMs:f(r.updatedAt)}),r})(e).catch(t=>{C("[debug] boot failed",{variant:"error"}),o.Cp(t,{tags:e})})},y=[O,k,C,_,R,P],S[10]=O,S[11]=k,S[12]=C,S[13]=_,S[14]=P,S[15]=R,S[16]=b,S[17]=y):(b=S[16],y=S[17]),(0,c.useEffect)(b,y);let B=_??null;S[18]!==R||S[19]!==B?(v=(0,l.getDevServerId)({projectGroupId:R,projectGroupRevisionId:B,environment:l.SandboxEnvironment.BUILDER}),S[18]=R,S[19]=B,S[20]=v):v=S[20];let $=v,F=!P;if(S[21]!==$?(j={id:$},S[21]=$,S[22]=j):j=S[22],S[23]!==k?(I=e=>{let{data:t}=e,r=t.data?.devServerUpdate;if(r){let e=f(r.updatedAt);M(t=>e<t.updatedAtMs?t:{status:r.status,error:r.error??null,updatedAtMs:e})}k("[debug] Received dev server update from subscription")},S[23]=k,S[24]=I):I=S[24],S[25]!==j||S[26]!==I||S[27]!==F?(w={skip:F,variables:j,onData:I},S[25]=j,S[26]=I,S[27]=F,S[28]=w):w=S[28],(0,x.R)(h,w),!P)return null;let H=U.status,q=U.error,z=L??null;S[29]!==_||S[30]!==R||S[31]!==z?(N=(0,s.e)({projectGroupId:R,projectGroupRevisionId:_,server:"web",pathname:null,devServerDomain:z,environment:l.SandboxEnvironment.BUILDER}),S[29]=_,S[30]=R,S[31]=z,S[32]=N):N=S[32];let V=D??null;return S[33]!==_||S[34]!==R||S[35]!==V?(T=(0,s.e)({projectGroupId:R,projectGroupRevisionId:_,server:"mobile",pathname:null,devServerDomain:V,environment:l.SandboxEnvironment.BUILDER}),S[33]=_,S[34]=R,S[35]=V,S[36]=T):T=S[36],S[37]!==U.error||S[38]!==U.status||S[39]!==N||S[40]!==T?(E={status:H,error:q,web:N,mobile:T},S[37]=U.error,S[38]=U.status,S[39]=N,S[40]=T,S[41]=E):E=S[41],E}},417666:(e,t,r)=>{r.d(t,{_:()=>u});var a=r(11241),n=r(898936),i=r(33031),s=r(771768),l=r(751355),o=r(510822);let c=(0,l.U)(` 100 query GetHistoricalRevisionForAppBuilder( 101 $id: ID! 102 $replaceFunctions: Boolean 103 ) {
104 projectRevisionById(id: $id) { 105 ...RevisionForAppBuilder 106 projectGroupRevision { 107 id 108 } 109 } 110 } 111`),d=(0,l.U)(` 112 query GetProjectForAppBuilderByProjectId( 113 $id: ID! 114 $revisionsFirst: Int 115 $revisionsAfter: String 116 $replaceFunctions: Boolean 117 $environment: CreateEnvironment! 118 ) { 119 projectById(id: $id) { 120 ...ProjectForAppBuilder 121 } 122 } 123`),u=e=>{let t,r,l,u,x,h,g,f,b,y,v,j,I=(0,a.c)(35),{projectId:w}=e,N=!w;I[0]!==w?(t={id:w,environment:i.CreateEnvironment.DEVELOPMENT},I[0]=w,I[1]=t):t=I[1],I[2]!==N||I[3]!==t?(r={skip:N,variables:t},I[2]=N,I[3]=t,I[4]=r):r=I[4];let T=(0,o.I)(d,r);I[5]!==T?({data:l,...u}=T,I[5]=T,I[6]=l,I[7]=u):(l=I[6],u=I[7]),I[8]!==w?(x=e=>e.value.viewingModuleId===w?e.value.viewingHistoricalRevisionId:null,I[8]=w,I[9]=x):x=I[9];let E=(0,n.nZ)(x),S=!E;I[10]!==E?(h={id:E},I[10]=E,I[11]=h):h=I[11],I[12]!==S||I[13]!==h?(g={skip:S,variables:h},I[12]=S,I[13]=h,I[14]=g):g=I[14];let{data:_}=(0,o.I)(c,g),k=E?_?.projectRevisionById:void 0,C=l?.projectById??void 0;I[15]!==C?.revisions?.edges?(f=C?.revisions?.edges?.map(p).filter(Boolean)??[],I[15]=C?.revisions?.edges,I[16]=f):f=I[16];let R=f,A=C?.organization,G=C?.projectGroup;I[17]!==A||I[18]!==C||I[19]!==G||I[20]!==R?(b=C?.id&&C.name&&A?.id&&A.plan&&G?.id&&G.name&&G.publishState&&C.moduleType?{id:C.id,name:C.name,revisions:R,hidePublishedCreateBranding:C.hidePublishedCreateBranding??!1,plan:A.plan,previewURL:C.previewURL??void 0,canvasPreviewURL:C.canvasPreviewURL??void 0,slug:G.slug??void 0,canEdit:C.canEdit??!1,moduleType:C.moduleType,lastPublishedAt:C.lastPublishedAt?new Date(C.lastPublishedAt):void 0,projectGroup:{id:G.id,name:G.name,publishState:G.publishState,hasLegacyAuthDb:G.hasLegacyAuthDb??!1,rewriteLegacyDb:G.rewriteLegacyDb??!1,lastPublishedAt:G.lastPublishedAt?new Date(G.lastPublishedAt):void 0,slug:G.slug??null,organizationId:G.organizationId??"",authEnabled:G.authEnabled??!1,designSystemId:G.designSystem?.id??null,domains:G.domains??[]},isPublished:!!G.slug,organizationId:A.id,pathSegment:C.pathSegment??void 0,withCustomAuth:C.withCustomAuth??!1,filePath:C.filePath??null}:void 0,I[17]=A,I[18]=C,I[19]=G,I[20]=R,I[21]=b):b=I[21];let P=b,O=C?.latestRevision??void 0,U=C?.publishedRevision??void 0;I[22]!==O?.components?(y=(0,s.o)({revisions:(O?.components??[]).flatMap(m)}),I[22]=O?.components,I[23]=y):y=I[23];let M=y;I[24]!==l?.projectById?.projectGroup?.publicEnvVariables?(v=[],l?.projectById?.projectGroup?.publicEnvVariables?.forEach(e=>{let{key:t,value:r}=e;t&&r&&v.push([t,r])}),I[24]=l?.projectById?.projectGroup?.publicEnvVariables,I[25]=v):v=I[25];let L=C?.revisions?.pageInfo;return I[26]!==M||I[27]!==v||I[28]!==k||I[29]!==O||I[30]!==P||I[31]!==U||I[32]!==u||I[33]!==L?(j={...u,revisionsPageInfo:L,project:P,latestRevision:O,historicalRevision:k,publishedRevision:U,components:M,envVariables:v},I[26]=M,I[27]=v,I[28]=k,I[29]=O,I[30]=P,I[31]=U,I[32]=u,I[33]=L,I[34]=j):j=I[34],j};function p(e){let{node:t}=e;return t}function m(e){return e?.id&&e.content&&e.aliasRenderName&&e.project?.id&&e.project.name?[{id:e.id,content:e.content,aliasRenderName:e.aliasRenderName,project:{id:e.project.id,name:e.project.name}}]:[]}},430210:(e,t,r)=>{r.d(t,{U:()=>c,m:()=>o});var a=r(20912),n=r(244893),i=r(751355);let s=(0,i.U)(` 124 query GetProjectGroupRevisionsForChat( 125 $projectGroupId: ID! 126 $threadId: ID 127 $first: Int 128 $after: String 129 ) { 130 projectGroupById(id: $projectGroupId) { 131 id 132 latestRevision: latestRevisionForThread(threadId: $threadId) { 133 id 134 status 135 createdAt 136 thread { 137 id 138 } 139 } 140 revisions( 141 order: [{ createdAt: "DESC" }] 142 first: $first 143 after: $after 144 input: { 145 threadId: $threadId 146 actions: [ 147 CHAT 148 AUTO_SELECT_CHAT 149 DEEP_DEBUGGING 150 EXPERT_SWE 151 DISCUSSION 152 ORCHESTRATOR 153 DELEGATE_TO_SUB_AGENT 154 DESIGN_AGENT 155 INTRODUCE_BUG 156 AGENT_AUTO_SELECT_INTEGRATION 157 FORK_WITH_CHAT_MESSAGE 158 FORK_MODULE_WITH_CHAT_MESSAGE 159 SELECT_INTEGRATION_WITH_CHAT_MESSAGE 160 PUBLISH_PROJECT_AND_CONTINUE_CHAT 161 CHANGE_DESIGN_SYSTEM_AND_CONTINUE_CHAT 162 SAVE_SECRET_AND_CONTINUE_CHAT 163 ADD_AUTH_AND_CONTINUE_CHAT 164 RESTORE 165 PROJECT_FIX_CHANGE 166 PLAN_AGENT 167 ] 168 } 169 ) { 170 totalCount 171 pageInfo { 172 hasNextPage 173 hasPreviousPage 174 endCursor 175 startCursor 176 } 177 edges { 178 node { 179 ...ProjectGroupRevisionForChat 180 } 181 } 182 } 183 } 184 } 185`),l=(0,i.U)(` 186 query GetThreadsForProjectGroup( 187 $input: ProjectGroupRevisionThreadsByProjectGroupIdInput! 188 $projectGroupId: ID! 189 $after: String 190 ) { 191 projectGroupById(id: $projectGroupId) { 192 id 193 latestThread { 194 id 195 } 196 } 197 projectGroupRevisionThreadsByProjectGroupId(input: $input, after: $after) { 198 pageInfo { 199 hasNextPage 200 endCursor 201 } 202 edges { 203 node { 204 ...ThreadForProjectGroupChat 205 } 206 } 207 } 208 } 209`),o=({cache:e,revision:t,projectGroupId:r,clientId:i,threadId:o})=>{(0,a.aE)({clientId:i,revisionId:t.id}),(({cache:e,revision:t,projectGroupId:r,threadId:a})=>{let n={...t,__typename:"ProjectGroupRevision"},i=e.readQuery({query:s,variables:{projectGroupId:r,threadId:a}});i&&e.writeQuery({query:s,data:{projectGroupById:{...i.projectGroupById,latestRevision:n,revisions:{...i.projectGroupById.revisions,edges:[{__typename:"ProjectGroupRevisionEdge",node:n},...i.projectGroupById.revisions.edges.filter(e=>
209e.node.id!==n.id)]}}},variables:{projectGroupId:r,threadId:a}})})({cache:e,revision:t,projectGroupId:r,clientId:i,threadId:o}),(({cache:e,projectGroupId:t,threadId:r})=>{let a=e.readQuery({query:l,variables:{input:{projectGroupId:t},projectGroupId:t}});r?a&&e.writeQuery({query:l,variables:{input:{projectGroupId:t},projectGroupId:t},data:{projectGroupById:{...a.projectGroupById,latestThread:a.projectGroupRevisionThreadsByProjectGroupId.edges.find(e=>e.node.id===r)?.node||a.projectGroupById.latestThread},projectGroupRevisionThreadsByProjectGroupId:{__typename:"ProjectGroupRevisionThreadConnection",pageInfo:a.projectGroupRevisionThreadsByProjectGroupId.pageInfo,edges:a.projectGroupRevisionThreadsByProjectGroupId.edges.map(e=>({...e,node:e.node.id===r?{...e.node,updatedAt:new Date().toISOString()}:e.node}))}}}):n.lY.getState().setEmptyThreadUpdatedAt(new Date)})({cache:e,projectGroupId:r,threadId:o,clientId:i,revision:t})},c=({cache:e,projectGroupId:t,thread:r})=>{let a=e.readQuery({query:l,variables:{input:{projectGroupId:t},projectGroupId:t}});a?e.writeQuery({query:l,variables:{input:{projectGroupId:t},projectGroupId:t},data:{projectGroupById:{...a.projectGroupById,latestThread:r},projectGroupRevisionThreadsByProjectGroupId:{__typename:"ProjectGroupRevisionThreadConnection",pageInfo:a.projectGroupRevisionThreadsByProjectGroupId.pageInfo,edges:[{__typename:"ProjectGroupRevisionThreadEdge",node:r},...a.projectGroupRevisionThreadsByProjectGroupId.edges.filter(e=>e.node.id!==r.id)]}}}):e.writeQuery({query:l,variables:{input:{projectGroupId:t},projectGroupId:t},data:{projectGroupById:{__typename:"ProjectGroup",id:t,latestThread:r},projectGroupRevisionThreadsByProjectGroupId:{__typename:"ProjectGroupRevisionThreadConnection",pageInfo:{__typename:"PageInfo",hasNextPage:!1,endCursor:null},edges:[{__typename:"ProjectGroupRevisionThreadEdge",node:r}]}}})}},433524:(e,t,r)=>{r.d(t,{y:()=>m});var a=r(294799),n=r(834023),i=r(962770),s=r(600428),l=r(88237),o=r(859144),c=r(921513),d=r(888202),u=r(261578),p=r(400093);function m({step:e,stepNumber:t,isLastAndStreaming:r,isStreaming:x}){let h=(0,p.f6)(),{displayText:g}=(0,d.wy)(e.content,r&&!h),f=(0,u.q)({text:e.content,enabled:r&&h}
209),b=h?f:r?(0,d.hD)(g):e.content,[y,v]=(0,n.useState)(null),j=(0,n.useRef)(r);j.current&&!r&&x&&null===y&&v(!1),j.current=r;let I=!!b&&!r;return(0,a.jsxs)(o.P.div,{className:"flex gap-[12px]",initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.2},children:[(0,a.jsxs)("span",{className:"shrink-0 text-[14px] font-medium leading-[20px] text-comeback-gray-300",children:[t,"."]}),(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-[6px]",children:[(0,a.jsx)("button",{type:"button",onClick:I?()=>{v(e=>null!==e&&!e)}:void 0,className:`text-left text-[14px] font-semibold leading-[20px] text-comeback-gray-500 ${I?"cursor-pointer":"cursor-default"}`,children:e.title}),(0,a.jsx)(c.N,{initial:!1,children:(y??!0)&&b?(0,a.jsx)(o.P.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:1.2,ease:"easeInOut"},style:{overflow:"hidden"},children:(0,a.jsx)("div",{className:"text-[13px] leading-[18px] text-comeback-gray-300 [&_code]:rounded-[3px] [&_code]:bg-comeback-gray-25 [&_code]:px-[4px] [&_code]:py-[1px] [&_code]:text-[12px] [&_hr]:hidden [&_li]:ml-[16px] [&_li]:list-disc [&_ol>li]:list-decimal [&_p+p]:mt-[6px] [&_ul]:mt-[4px]",children:h?(0,a.jsx)(p.c,{isStreaming:r,className:null,components:p.BL,children:b}):(0,a.jsx)(i.o,{remarkPlugins:[s.A],rehypePlugins:[l.A],children:b})})},"content"):null})]})]},e.title)}},451758:(e,t,r)=>{r.d(t,{l:()=>n});var a=r(33031);let n=e=>[a.LLMTag.PAGE,a.LLMTag.EXPO_PAGE,a.LLMTag.COMPONENT,a.LLMTag.FUNCTION,a.LLMTag.FILE].includes(e.tag)&&"string"==typeof e.args?.[a.ModuleTagArg.REVISION_ID]?e.args[a.ModuleTagArg.REVISION_ID]:null},471976:(e,t,r)=>{Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});let a=r(939621),n=r(432040),i=r(33031);r(687967);let s=e=>{let t=/^<(?:\/)?([a-zA-Z0-9._]+)(\s|>)/m.exec(e);return t?t[1]:""},l=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),o=e=>l.has(e),c=({position:e,lines:t})=>t.slice(0,e.row).reduce((e,t)=>e+t.length+1,e.column),d=['"','"',"`"],u=["{","(","["],p=["}",")","]"],m={"{":"}","(":")","[":"]","'":"'",'"':'"',"`":"`"},x=(0,n.invert)(m),h=({code:e,fullCode:t,externalComponents:r,treeSitter:a,isMultifile:n})=>{var i;let l,g=e.split("\n"),f=[],b=[];for(let i of a.parse(e)??[]){let{isMissing:e,rawNode:a,cursor:o,typeEscaped:m}=i;if(l=i.rawNode,["jsx_opening_element"].includes(m)){let e=s(o.nodeText);f.push({type:e??"",node:a})}if(["jsx_element","jsx_self_closing_element"].includes(m)){let e=s(o.nodeText);e&&function({tagName:e,fullCode:t,externalComponents:r,isMultifile:a}){return!a&&!(!(e&&e[0]!==e[0]?.toLowerCase())||r.some(t=>e.startsWith(t))||RegExp(`function\\s+${e}\\s*\\(`,"gm").test(t)||RegExp(`(const|let|var)\\s+${e}\\s*=`,"gm").test(t)||r.some(r=>!!RegExp(`(const|let|var)\\s*{\\s*[^}]*${e}[^}]*\\s*\\}\\s*=\\s${r}`,"gm").exec(t))||e.startsWith("React."))}({tagName:e,fullCode:t,externalComponents:r,isMultifile:n})&&b.push({start:c({position:a.startPosition,lines:g}),end:c({lines:g,position:a.endPosition}),replace:!0})}let h=f[f.length-1];if(u.includes(m)&&f.push({type:m,node:a}),d.includes(m)&&h?.type!==m&&f.push({type:m,node:a}),["<"].includes(m)&&a.parent?.type!=="jsx_opening_element"&&a.parent?.type!=="jsx_self_closing_element"&&a.parent?.type!=="binary_expression"){let e=a.nextSibling;e?e.nextSibling?f.push({type:"partial",node:e}):b.push({start:c({position:a.startPosition,lines:g}),end:c({lines:g,position:e?.endPosition}),replace:!1}):b.push({start:c({position:a.startPosition,lines:g}),end:c({lines:g,position:a.endPosition}),replace:!1})}h&&(["jsx_closing_element"].includes(m)&&h.type===s(o.nodeText)&&f.pop(),[...p,...d].includes(m)&&h.type===x[m]&&!e&&f.pop())}let y=f[f.length-1],v=l?.type===">"||l?.type==="/>",j=y?.node.type==="jsx_opening_element"&&!v&&l?("jsx_text"===(i=l).type?i.endIndex:"</"===i.type||"}"===i.type||"<"===i.type?i.startIndex:i.previousSibling?.startIndex)??e.length:e.length,I=f.slice().reverse().find(e=>o(e.type));if(I?.node&&">"===e.at(I.node.endIndex-1)){let i=c({lines:g,position:I.node.endPosition})-1,s=`${e.slice(0,i)} /${e.slice(i)}`.trim();return e.startsWith("<>")||(s=`<>${s}</>`),h({code:s,fullCode:t,treeSitter:a,externalComponents:r,isMultifile:n})}let{modifiedCode:w,modifiedPosition:N}=function(e,t,r){e.sort((e,t)=>
209e.start-t.start);let[a,...n]=e;if(!a)return{modifiedCode:t,modifiedPosition:r};let i=[a],{start:s,end:l}=a;for(let e of n){let{start:t,end:r}=e;if(!(t>s)||!(r<=l)){if(t<l&&r>l)throw Error("Detected overlapping ranges when removing nodes for fixing.");i.push(e),s=t,l=r}}i.sort((e,t)=>t.start-e.start);let o=r,c=t;for(let{start:e,end:t,replace:r}of i){c=`${c.slice(0,e)}${r?"<></>":""}${c.slice(t)}`;let a=5*!!r;o>t?o-=t-(e+a):r&&(o=e+a)}return{modifiedCode:c,modifiedPosition:o}}(b,e,j);return`${w.slice(0,N)}${f.slice().reverse().map(e=>{if("partial"===e.type)return" />";let t=m[e.type];return t||`</${e.type}>`}).join("")}`.replace(/(new\s+)*(\s*)Array\s*\(\s*(\d+)\s*\)/g,"$2Array.from({length: $3})")},g=["example"];function f(e,t){let r,a,n=[...g,...t??[]],s=(a=n.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),RegExp(`(?:\`\`\`(([\\w:]+)\\n)?([\\s\\S]*?)(\\n\\s*\`\`\`|$))|(?:<(${a})((\\s+[\\w-]+=(?:"[^"]*"|'[^']*'))*)\\s*>([\\s\\S]*?)<\\/\\5>)`,"gi")),l=[],o=0;for(;null!==(r=s.exec(e));){if(o<r.index){let t=e.slice(o,r.index).trim();t.length&&l.push({type:"text",content:t,original:t})}let t="code",a=r[0],i=r[2]||void 0,s=r[4]?.trim().length===0,c=r[5];c&&n.includes(c)&&(t="tag",a=a.replace(RegExp(`<${c}[^>]*>`,"g"),"").replace(RegExp(`</${c}>`,"g"),""),i=i??/```((\w+)\n)?([\s\S]+?)(\n```|$)/g.exec(a)?.[2]);let d=a.replace(/```(\s*[\w:]+)?\s*\n|```/g,"").trim();if("code"===t&&l.push({type:t,content:d,language:i,isPartial:s,original:r[0]}),"tag"===t&&c){let e=r[6]?.trim().match(/[\w-]+=(?:"[^"]*"|'[^']*')/gm)?.reduce((e,t)=>{let[r,...a]=t.split("=");return void 0===r||0===a.length?e:{...e,[r]:a.join("=").replace(/['"]/g,"")}},{});l.push({type:t,tag:c,content:d,language:i,original:r[0],args:e})}o=r.index+r[0].length}if(0===l.length&&(e.trim().startsWith(`function ${i.MAIN_COMPONENT_NAME}(`)||e.trim().startsWith(`export function ${i.STORY_COMPONENT_NAME}(`)))return[{type:"code",content:e,language:"javascript",isPartial:!1,original:e}];if(o<e.length){let t=e.slice(o).trim();t.length&&l.push({type:"text",content:t,original:t})}return l}function b(e){return f(e).filter(e=>"code"===e.type).map(e=>({lang:"language"in e?e.language??"unknown":"unknown",code:e.content.trim(),isPartial:!1}))}let y=["jsx","javascript","js","unknown","tsx","typescript","ts"],v=e=>{let t=e.trim();return t.startsWith("//")?t.slice(2).trim():t.startsWith("/*")&&t.endsWith("*/")?t.slice(2,-2).trim().split("\\n").map(e=>{let t=e.trim();return t.startsWith("*")?t.slice(1).trim():t}).join("\n").trim():t},j=e=>`{/* ${e} */}`,I=e=>`// ${e}`,w=new Set(["jsx_element","lexical_declaration","function_declaration"]),N=new Set(["jsx_self_closing_element","parenthesized_expression",...w]),T=({groups:e,rawNode:t})=>e.some(e=>[t.startIndex,t.endIndex].some(t=>e.startIndex<=t&&e.endIndex>=t)),E={highWaterMark:32768},S=a.SaxEventType.OpenTag|a.SaxEventType.CloseTag|a.SaxEventType.Text|a.SaxEventType.Attribute,_=(e,t)=>{switch(e){case"choices":var r=t;try{let e=JSON.parse(r);if(!Array.isArray(e)||0===e.length)return null;return e.map((e,t)=>`${t+1}. ${e}`).join("\n")}catch{return null}case"ask-questions":var a=t;try{let e=JSON.parse(a);if(!e.questions||!Array.isArray(e.questions))return null;let t=[];for(let r of e.questions)if(t.push(r.question),r.options&&Array.isArray(r.options))for(let[e,a]of r.options.entries())t.push(`${e+1}. ${a}`);return t.join("\n")}catch{return null}case"database":return"[database changes]";case"project-settings":return"Updated project settings";case"continue":return"Continuing...";default:return null}};var k=class{rootNode;[Symbol.iterator](){return function* e(t,r){for(;;){let a=t.nodeType.replace("\n","\\n"),n=t.nodeText.replace(/\n/g,"\\n"),i=t.currentNode,{isMissing:s}=i;if(yield{rawNode:i,cursor:t,typeEscaped:a,textEscaped:n,isMissing:s},t.gotoFirstChild()&&(yield*e(t,(r??0)+1),t.gotoParent()),!t.gotoNextSibling())break}}(this.rootNode.walk())}constructor(e){this.rootNode=e}delete(){"delete"in this.rootNode.tree&&this.rootNode.tree.delete()}},C=class{parser;constructor(e,t){this.parser=e,t?.timeoutMs?this.parser.setTimeoutMicros(1e3*t.timeoutMs):this.parser.setTimeoutMicros(5e6),t?.logger&&this.parser.setLogger(t.logger)}setOptions(e){e.timeoutMs&&this.parser.setTimeoutMicros(1e3*e.timeoutMs),e.logger&&this.parser.setLogger(e.logger)}parse(e){if("string"!=typeof e)return null;try{let t=this.parser.parse(e,void 0,{bufferSize:5242880});if(null===t)return null;return new k(t.rootNode)}catch{return null}}};t.CUSTOM_COMPONENT_PREFIX="Custom",t.DEFAULT_EVENTS=S,t.DEFAULT_OPTIONS=E,t.DEFAULT_TRANSFORM_OPTIONS={jsc:{target:"es2022",transform:{react:{development:!0}},loose:!0,parser:{syntax:"ecmascript",jsx:!0}}},Object.defineProperty(t,"SAXParser",{enumerable:!0,get:function(){return a.SAXParser}}),Object.defineProperty(t,"SaxEventType",{enumerable:!0,get:function(){return a.SaxEventType}}),Object.defineProperty(t,"Tag",{enumerable:!0,get:function(){return a.Tag}}),t.TreesitterParser=C,t.blocksToPlainText=function(e,t=_){let r=[];for(let a of e)switch(a.type){case"text":r.push(a.content);break;case"tag":{let e=t(a.tag,a.content);e&&r.push(e)}}return r.join("\n\n").trim()},t.cleanCode=({code:e,fullCode:t,externalComponents:r,treeSitter:a,isMultifile:n,shouldExtractCodeBlocks:i})=>(({code:e,treeSitter:t,fullCode:r,externalComponents:a,isMultifile:n})=>{let i=h({code:e,fullCode:r,treeSitter:t,externalComponents:a,isMultifile:n}),s=null;try{if(!(s=t.parse(e))||n)return e;return function({code:e,root:t}){let r=t.descendantsOfType("export_statement");return function e({replaceLocations:t,code:r}){let[a,...n]=t;if(!a)return r;let i=`${r.slice(0,a.start)}${a.value}${r.slice(a.end)}`,s=a.value.length-(a.end-a.start);return e({replaceLocations:n.map(e=>{let{start:t,end:r}=e;return{start:t>a.start?t+s:t,end:r>a.start?r+s:r,value:e.value}}),code:i}
209)}({code:e,replaceLocations:[...r,...t.descendantsOfType("import_statement")].map(({startIndex:e,endIndex:t})=>({start:e,end:t,value:""}))})}({code:i,root:s.rootNode})}finally{s&&s.delete()}})({code:(i?b(e).filter(e=>y.includes(e.lang)).map(e=>e.code).join("\n"):e)||e,treeSitter:a,fullCode:t,externalComponents:r,isMultifile:n}),t.createParser=()=>new a.SAXParser(S,E),t.detectImports=({code:e,treeSitter:t})=>{let r=t.parse(e);return r?t.parser.getLanguage().query(`(import_statement 210 source: (string 211 (_) @import.path))`).matches(r.rootNode).map(e=>{let t=e.captures[0]?.node.text;return t||null}).filter(e=>!!e):[]},t.extractCodeBlocks=b,t.extractComments=({code:e,treeSitter:t})=>{let r=t.parse(e),a=[],n=0;for(let e of r??[])"comment"===e.typeEscaped&&(a.push({text:e.textEscaped,rawText:v(e.textEscaped),num:n,position:{start:e.rawNode.startIndex,end:e.rawNode.endIndex}}),n++);return a},t.getIndexFromPosition=c,t.getIndexFromSaxPosition=({position:e,lines:t})=>c({position:{row:e.line,column:e.character},lines:t}),t.groupCode=({code:e,treeSitter:t,maxLength:r,minLength:a})=>{let i=e.trim(),s=Math.min(r,i.length-1),l=t.parse(i),o=[];for(let e of l??[])w.has(e.typeEscaped)&&o.push(e);let c=(0,n.sortBy)(o,({rawNode:e})=>e.startIndex),d=[];c.forEach(e=>{let{textEscaped:t,rawNode:r}=e;if(T({rawNode:r,groups:d}))return;let{length:i}=t;if(i>=s||i<a)return;let{matchingSiblings:l}=function({rawNode:e,length:t,groups:r,maxLength:a}){let n=t,i=[],{previousSibling:s}=e;for(n+=s?.text.length??0;s&&!T({rawNode:s,groups:r})&&N.has(s.type)&&n<a;)i.push(s),s=s.previousSibling,n+=s?.text.length??0;let{nextSibling:l}=e;for(n+=l?.text.length??0;l&&!T({rawNode:l,groups:r})&&N.has(l.type)&&n<a;)i.push(l),l=l.nextSibling,n+=l?.text.length??0;return{matchingSiblings:i,overallLength:t}}({rawNode:r,length:i,groups:d,maxLength:s}),o=(0,n.sortBy)([e.rawNode,...l],e=>e.startIndex);d.push({startIndex:Math.min(...o.map(e=>e.startIndex)),endIndex:Math.max(...o.map(e=>e.endIndex)),nodes:o})});let u=(0,n.sortBy)(d,e=>e.startIndex).map((e,t)=>{let r=`group${t}`;return{startIndex:e.startIndex,endIndex:e.endIndex,text:e.nodes.map(e=>e.text).join("\n"),name:r,comment:e.nodes[0]?.parent?.type==="jsx_element"?j(r):I(r)}}),p=i;return(0,n.sortBy)(u,e=>e.endIndex).forEach(e=>{p=p.replace(i.slice(e.startIndex,e.endIndex),e.comment)}),{groups:u,shortened:p}},t.isVoidTag=o,t.mergeCode=({groups:e,code:t})=>{let r=t.trim();return(0,n.sortBy)(e,e=>e.name.length).forEach(e=>{r=r.replace(I(e.name),e.text).replace(j(e.name),e.text)}),r},t.splitIntoBlocks=f},538432:(e,t,r)=>{r.d(t,{A:()=>tf});var a=r(294799),n=r(11241),i=r(898936),s=r(821126),l=r(910189),o=r(917339),c=r(451286),d=r(859144),u=r(229159),p=r(386010),m=r(481446),x=r(791176),h=r(35279),g=r(18057),f=r(555246),b=r(568611),y=r(402952),v=r(706023),j=r(33031),I=r(387928),w=r(702459),N=r(789545),T=r(103967),E=r(971288),S=r(897599),_=r(403209),k=r(848217),C=r(781981),R=r(423045),A=r(358820),G=r(926518),P=r(809856),O=r(665237),U=r(115565),M=r(921513),L=r(834023),D=r(962770),B=r(600428),$=r(449259),F=r(697343),H=r(943211),q=r(285530);let z=e=>{if([H.I.REVENUE_CAT_CONNECT_ACCOUNT,H.I.APP_STORE_CONNECT_ACCOUNT,H.I.ASK_QUESTIONS,H.I.SATISFACTION_SURVEY,H.I.PLAN,H.I.DESIGN_VARIATION,H.I.DESIGN_EXPLORATION,H.I.DATABASE_MIGRATION].includes(e.type))return!0;if("tag"!==e.type)return!1;if(j.INTERACTIVE_LLM_TAGS.has(e.tag))return!0;let t=e.args?.uiType;return!!((0,j.isUIBlockType)(t)&&j.INTERACTIVE_UI_BLOCK_TYPES.has(t))},V=e=>"tag"===e.type&&e.args?.uiType===j.UIBlockType.CREATE_NEW_PROJECT,W=e=>{if("tag"!==e.type)return!1;let t=e.args?.uiType;return t===j.UIBlockType.SUMMARY||t===j.UIBlockType.VERSION_HISTORY||t===j.UIBlockType.SUBMISSION_READINESS};var Y=r(745792);let Q=e=>e.type===H.I.TAG&&e.tag===j.LLMTag.FILE_BASED_BLOCK&&e.args?.uiType==="interjection",X=e=>"tag"===e.type&&e.args?.uiType===j.UIBlockType.SUBAGENT,K=({blocks:e,isGenerating:t,isBeforeLeftChat:r})=>{let a=e.findLastIndex(e=>e.type===H.I.ASK_QUESTIONS),n=a>=0&&e.slice(a+1).some(e=>Q(e)),i=a>=0&&!n?e.slice(0,a+1):e,s=i[i.length-1];if(!s)return{visible:[],collapsed:[]};if(r)return{visible:i,collapsed:[]};let l=[],o=!1;
211for(let e of([...i].reverse().forEach(e=>{if(!o){if(t){let t="text"!==e.type&&"animated-text"!==e.type&&"code"!==e.type&&!z(e)&&!Q(e)&&!X(e);t?0===l.length&&l.push(e):(!z(e)||r)&&l.push(e),o=t;return}"code"===e.type||"text"===e.type||"animated-text"===e.type||z(e)||Q(e)||X(e)?l.push(e):o=!0}}),0===l.length&&l.push(s),i))if(z(e)&&!l.includes(e)){if(t&&W(e))continue;l.push(e)}(t?[]:(({blocks:e})=>{let t=[];return[[Y.E4,{type:H.I.REVENUE_CAT_CONNECT_ACCOUNT}],[Y.Mu,{type:H.I.REVENUE_CAT_CONNECT_ACCOUNT}],[Y.NY,{type:H.I.APP_STORE_CONNECT_ACCOUNT}],[Y.x3,{type:H.I.APP_STORE_CONNECT_ACCOUNT}]].forEach(([r,a])=>{for(let n of e)if("text"===n.type&&r.test(n.code)&&!t.some(e=>e.type===a.type)){t.push(a);break}}),t})({blocks:i})).forEach(e=>{l.includes(e)||l.push(e)});let c=i.filter(e=>!l.includes(e));return{visible:l.reverse().sort((e,t)=>{let r=z(e)&&!V(e),a=z(t)&&!V(t);return r&&!a?1:!r&&a?-1:i.indexOf(e)-i.indexOf(t)}),collapsed:c}};var J=r(127167),Z=r(985413),ee=r(883690),et=r(309894),er=r(319173),ea=r(202723),en=r(879732),ei=r(737356),es=r(751355),el=r(814121);let eo=(0,es.U)(` 212 query GetRevisionTotalCredits($id: ID!) { 213 projectGroupRevisionById(id: $id) { 214 id 215 totalCredits 216 refundedAt 217 } 218 } 219`),ec=(0,es.U)(` 220 mutation RefundChatRevision($input: RefundChatRevisionInput!) { 221 refundChatRevision(input: $input) { 222 success 223 failureReason 224 } 225 } 226`);function ed({projectGroupRevisionId:e,refundedAt:t,disabled:r=!1}){let[n,i]=(0,L.useState)(!1),s=null!==t,l=(0,f.jt)(),{organizationId:o,organizationPlan:c}=(0,J.MN)(),{open:d}=(0,Z.W)(),[u,{loading:p}]=(0,el.n)(ec,{update:(t,{data:r})=>{r?.refundChatRevision.success&&t.updateQuery({query:eo,variables:{id:e}},e=>e?.projectGroupRevisionById?{...e,projectGroupRevisionById:{...e.projectGroupRevisionById,refundedAt:new Date().toISOString()}}:e)}}),{register:m,handleSubmit:x,formState:{errors:h},reset:g}=(0,en.mN)({defaultValues:{reason:""}}),b=(0,L.useCallback)(()=>{(0,j.isPaidPlan)(c)?i(!0):d({title:"Upgrade to Pro",subTitle:"Get more credits per month and all Pro features",description:null,organizationId:o,source:"chat_refund"})},[o,c,d]),y=async t=>{try{let r=await u({variables:{input:{projectGroupRevisionId:e,reason:t.reason}}});l("Chat Refund Requested",{projectGroupRevisionId:e,reason:t.reason,source:"chat_actions"}),r.data?.refundChatRevision.success?(ei.oR.success("Refund successful. Confirmation will be sent to your email."),g(),i(!1)):ei.oR.error(function(e){switch(e){case ee.NB4.REFUND_LIMIT_REACHED:return"You've reached your monthly refund limit.";case ee.NB4.ALREADY_REFUNDED:return"This generation has already been refunded.";case ee.NB4.INELIGIBLE:return"This generation is not eligible for a refund.";default:return"Refund request failed."}}(r.data?.refundChatRevision.failureReason??null))}catch{ei.oR.error("Refund request failed.")}},v=(0,a.jsxs)("form",{onSubmit:x(y),className:"flex tablet:w-[400px] w-full flex-col items-center justify-center gap-[20px] bg-white px-[24px] py-[20px] tablet:py-[32px]",children:[(0,a.jsx)(O.h,{className:"mt-0 desktop:hidden"}),(0,a.jsxs)("div",{className:"mx-0 tablet:mx-[25px] flex flex-col items-center justify-center gap-[9px]",children:[(0,a.jsx)(T.E,{type:"display-xs",weight:"medium",children:"Request Credit Refund"}),(0,a.jsx)(T.E,{type:"body-md",className:"text-center text-comeback-gray-900",children:"Tell us why this response didn't meet your expectations."})]}),(0,a.jsxs)("div",{className:"w-full",children:[(0,a.jsx)(ea.f,{...m("reason",{required:"Please provide a reason for the refund",minLength:{value:10,message:"Reason must be at least 10 characters"}}),placeholder:"Tell us why you're requesting a refund.",className:"h-[130px] w-full resize-none",rows:8}),h.reason&&(0,a.jsx)(T.E,{type:"body-sm",className:"mt-1 text-comeback-red-500",children:h.reason.message})]}),(0,a.jsx)(et.Button,{color:"dark",size:"sm",type:"submit",className:"w-fit self-end",disabled:p,children:(0,a.jsx)(T.E,{type:"body-md",children:p?"Processingâ¦":"Send Request"})})]});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(et.Button,{color:"light",size:"sm",className:"w-full",onPress:b,disabled:s||r,children:(0,a.jsx)(T.E,{type:"body-sm",children:s?"Refund Sent":"Request Refund"})}),(0,a.jsx)(er.C,{open:n,onOpenChange:i,content:v,modal:!0})]})}var eu=r(541104),ep=r(338989);let em=(0,es.U)(` 227 mutation SetProjectGroupRevisionUserRating( 228 $input: SetProjectGroupRevisionUserRatingInput! 229 ) { 230 setProjectGroupRevisionUserRating(input: $input) { 231 userRating 232 } 233 } 234`),ex=e=>{let t,r,i,s,l=(0,n.c)(12),{icon:c,onClick:d,tooltip:u,isActive:p,className:m}=e,x=(0,L.useRef)(null);l[0]!==d?(t={onPress:d},l[0]=d,l[1]=t):t=l[1];let{buttonProps:h}=(0,E.s)(t,x),g=p&&"text-comeback-gray-700";return l[2]!==m||l[3]!==g?(r=(0,o.cn)("rounded p-[4px] text-comeback-gray-500 outline-none transition hover:bg-comeback-gray-50 active:scale-90 active:bg-comeback-gray-75 active:text-comeback-gray-700",g,m),l[2]=m,l[3]=g,l[4]=r):r=l[4],l[5]!==h||l[6]!==c||l[7]!==r?(i=(0,a.jsx)("button",{type:"button",...h,className:r,children:c}
234),l[5]=h,l[6]=c,l[7]=r,l[8]=i):i=l[8],l[9]!==i||l[10]!==u?(s=(0,a.jsx)($.m_,{content:u,asChild:!0,side:"top",align:"center",children:i}),l[9]=i,l[10]=u,l[11]=s):s=l[11],s};function eh(e){let t,r,i,s,l,c,d,u,p,m,x=(0,n.c)(27),{projectGroupRevisionId:h,userRating:g}=e,[f]=(0,el.n)(em);x[0]!==h||x[1]!==f||x[2]!==g?(t=e=>{f({variables:{input:{projectGroupRevisionId:h,userRating:g===e?null:e}},update:(e,t)=>{let{data:r}=t;r?.setProjectGroupRevisionUserRating?.userRating!==void 0&&e.modify({id:`ProjectGroupRevision:${h}`,fields:{userRating:()=>r.setProjectGroupRevisionUserRating.userRating}})}})},x[0]=h,x[1]=f,x[2]=g,x[3]=t):t=x[3];let b=t,y=g===j.UserGenerationRating.LIKE&&"fill-comeback-gray-75 transition-fill";x[4]!==y?(r=(0,o.cn)(y),x[4]=y,x[5]=r):r=x[5],x[6]!==r?(i=(0,a.jsx)(eu.t,{width:16,height:16,strokeWidth:1,className:r}),x[6]=r,x[7]=i):i=x[7],x[8]!==b?(s=()=>b(j.UserGenerationRating.LIKE),x[8]=b,x[9]=s):s=x[9];let v=g===j.UserGenerationRating.LIKE;x[10]!==i||x[11]!==s||x[12]!==v?(l=(0,a.jsx)(ex,{icon:i,onClick:s,tooltip:"Good Response",isActive:v}),x[10]=i,x[11]=s,x[12]=v,x[13]=l):l=x[13];let I=g===j.UserGenerationRating.DISLIKE&&"fill-comeback-gray-75 transition-fill";x[14]!==I?(c=(0,o.cn)(I),x[14]=I,x[15]=c):c=x[15],x[16]!==c?(d=(0,a.jsx)(ep.S,{width:16,height:16,strokeWidth:1,className:c}),x[16]=c,x[17]=d):d=x[17],x[18]!==b?(u=()=>b(j.UserGenerationRating.DISLIKE),x[18]=b,x[19]=u):u=x[19];let w=g===j.UserGenerationRating.DISLIKE;return x[20]!==d||x[21]!==u||x[22]!==w?(p=(0,a.jsx)(ex,{icon:d,onClick:u,tooltip:"Bad Response",isActive:w}),x[20]=d,x[21]=u,x[22]=w,x[23]=p):p=x[23],x[24]!==p||x[25]!==l?(m=(0,a.jsxs)("div",{className:"flex flex-row gap-[4px]",children:[l,p]}),x[24]=p,x[25]=l,x[26]=m):m=x[26],m}var eg=r(480077),ef=r(355505),eb=r(387631),ey=r(244893),ev=r(106504),ej=r(480011);let eI=(0,es.U)(` 235 query GetProjectGroupRevisionsForChat( 236 $projectGroupId: ID! 237 $threadId: ID 238 $first: Int 239 $after: String 240 ) { 241 projectGroupById(id: $projectGroupId) { 242 id 243 latestRevision: latestRevisionForThread(threadId: $threadId) { 244 id 245 status 246 createdAt 247 thread { 248 id 249 } 250 } 251 revisions( 252 order: [{ createdAt: "DESC" }] 253 first: $first 254 after: $after 255 input: { 256 threadId: $threadId 257 actions: [ 258 CHAT 259 AUTO_SELECT_CHAT 260 DEEP_DEBUGGING 261 EXPERT_SWE 262 DISCUSSION 263 ORCHESTRATOR 264 DELEGATE_TO_SUB_AGENT 265 DESIGN_AGENT 266 INTRODUCE_BUG 267 AGENT_AUTO_SELECT_INTEGRATION 268 FORK_WITH_CHAT_MESSAGE 269 FORK_MODULE_WITH_CHAT_MESSAGE 270 SELECT_INTEGRATION_WITH_CHAT_MESSAGE 271 PUBLISH_PROJECT_AND_CONTINUE_CHAT 272 CHANGE_DESIGN_SYSTEM_AND_CONTINUE_CHAT 273 SAVE_SECRET_AND_CONTINUE_CHAT 274 ADD_AUTH_AND_CONTINUE_CHAT 275 RESTORE 276 PROJECT_FIX_CHANGE 277 PLAN_AGENT 278 ] 279 } 280 ) { 281 totalCount 282 pageInfo { 283 hasNextPage 284 hasPreviousPage 285 endCursor 286 startCursor 287 } 288 edges { 289 node { 290 ...ProjectGroupRevisionForChat 291 } 292 } 293 } 294 } 295 } 296`),ew=(0,es.U)(` 297 query GetRevisionTotalCredits($id: ID!) { 298 projectGroupRevisionById(id: $id) { 299 id 300 totalCredits 301 refundedAt 302 } 303 } 304`),eN=(0,es.U)(` 305 query GetRevisionStats($id: ID!) { 306 projectGroupRevisionById(id: $id) { 307 id 308 generation { 309 id 310 totalInputTokens 311 totalOutputTokens 312 contextWindowSize 313 compressedTurnsCount 314 compressedConversationRevisionCount 315 } 316 } 317 } 318`),eT=(0,es.U)(` 319 mutation RestoreProjectGroupRevision( 320 $input: RestoreProjectGroupRevisionInput! 321 ) { 322 restoreProjectGroupRevision(input: $input) { 323 success 324 projectGroupRevision { 325 ...ProjectGroupRevisionForChat 326 } 327 } 328 } 329`),eE=(0,es.U)(` 330 mutation AdminTranslateText($input: AdminTranslateTextInput!) { 331 adminTranslateText(input: $input) { 332 translatedText 333 } 334 } 335`),eS={blue:"bg-comeback-blue-600",gray:"bg-comeback-gray-400",yellow:"bg-comeback-yellow-800",black:"bg-comeback-gray-800"},e_="rounded items-center justify-center outline-none ring-offset-background focus-visible:ring-[2px] focus-visible:ring-ring focus-visible:ring-offset-[2px] transition-colors p-[4px] bg-none hover:bg-comeback-gray-50 active:bg-comeback-gray-75 text-comeback-gray-500 active:text-comeback-gray-700",ek=(e,t)=>`\`\`\`${t} 336${e} 337\`\`\``,eC=e=>(0,R.Y)(new Date,1)<e?"just now":(0,R.Y)(new Date,60)<e?(0,A.B)(e,new Date,{addSuffix:!0}):new Date().getDate()===e.getDate()?(0,b.fU)(e):(0,b.Yq)(e),eR=e=>{let t,r=(0,n.c)(5),a=(0,l.UB)();return r[0]!==a||r[1]!==e.actor||r[2]!==e.blocks||r[3]!==e.isGenerating?(t=(({blocks:e})=>e.map(e=>{switch(e.type){case H.I.TEXT:return"unknown"===e.lang?e.code:ek(e.code,e.lang);case H.I.ANIMATED_TEXT:return e.text;case H.I.TAG:switch(e.tag){case j.LLMTag.PUBLISH:return"";case j.LLMTag.CHOICES:{let t=(0,q.IJ)(e.code);
337if(!t||0===t.length)return"";return t.join(", ")}case j.LLMTag.EXPO_PAGE:case j.LLMTag.PAGE:case j.LLMTag.FUNCTION:case j.LLMTag.FILE:case j.LLMTag.COMPONENT:return`[${e.tag.toLowerCase()}]`;case j.LLMTag.DESIGN_SYSTEM_SELECTION:return"[suggested design systems]";case j.LLMTag.INTEGRATION_SELECTION:{let t=(0,q.tI)(e.args);if(!t?.tag)return"";return`[suggested ${t.tag} integrations]`}case j.LLMTag.MODULE_SELECTION:{let t=(0,q.Zv)(e.args);if(!t?.tag)return"";return`[suggested ${t.tag} options]`}case j.LLMTag.SUGGEST_ENVIRONMENT_VARIABLES:case j.LLMTag.THINKING:case j.LLMTag.VIEW_TRANSITION:case j.LLMTag.ACTION:return"";case j.LLMTag.DATABASE:return ek(e.code,"sql");case j.LLMTag.PROJECT_SETTINGS:return"Updated project settings";case j.LLMTag.TOOL_CALL:case j.LLMTag.WEB_SEARCH:case j.LLMTag.URL_ACCESS:case j.LLMTag.FILE_BASED_BLOCK:return"";case j.LLMTag.CONTINUE:return"Continue generating";default:return e}case H.I.CODE:return ek(e.code,e.lang);case H.I.EMAIL:case H.I.SIGNUP:case H.I.SELECTED_MODULE:return"";case H.I.SELECTED_INTEGRATION:{let{name:t}=(0,v.Rx)(e.integration);return t}case H.I.SELECTED_DESIGN_SYSTEM:case H.I.UI:case H.I.TOMBSTONE:case H.I.ERROR:case H.I.APP_STORE_CONNECT_ACCOUNT:case H.I.REVENUE_CAT_CONNECT_ACCOUNT:case H.I.ASK_QUESTIONS:case H.I.DESIGN_EXPLORATION:case H.I.FIGMA_IMPORT:case H.I.MOBBIN_IMPORT:case H.I.PLAN:case H.I.DESIGN_VARIATION:case H.I.SATISFACTION_SURVEY:case H.I.DATABASE_MIGRATION:return"";default:return e}}).join("\n").trim())({blocks:"assistant"===e.actor?K({blocks:e.blocks,isGenerating:e.isGenerating,isBeforeLeftChat:a}).visible:e.blocks}),r[0]=a,r[1]=e.actor,r[2]=e.blocks,r[3]=e.isGenerating,r[4]=t):t=r[4],t},eA=e=>{let t,r,i,s,l,c,d,u=(0,n.c)(16),{message:p}=e,m=(0,f.jt)(),x=eR(p);u[0]===Symbol.for("react.memo_cache_sentinel")?(t={defaultState:!1},u[0]=t):t=u[0];let{toggleValue:b,toggle:y}=(0,g.A)(t);u[1]!==x||u[2]!==y||u[3]!==m?(r=()=>{m("Copy Message Clicked",{message:x.slice(0,100),length:x.length}),!x||navigator.clipboard&&(y(),navigator.clipboard.writeText(x))},u[1]=x,u[2]=y,u[3]=m,u[4]=r):r=u[4];let v=r,j=(0,h.OD)(),w=(0,L.useRef)(null);u[5]!==v?(i={onPress:v},u[5]=v,u[6]=i):i=u[6];let{buttonProps:T}=(0,E.s)(i,w),S=j?"Copy":void 0;u[7]===Symbol.for("react.memo_cache_sentinel")?(s=(0,o.cn)(e_,"text-comeback-gray-500"),u[7]=s):s=u[7];let _=b?I.bC:I.gd;return u[8]!==_?(l=(0,a.jsx)(N.I,{content:_,size:"small"}),u[8]=_,u[9]=l):l=u[9],u[10]!==T||u[11]!==l?(c=(0,a.jsx)("button",{type:"button",...T,className:s,children:l}),u[10]=T,u[11]=l,u[12]=c):c=u[12],u[13]!==S||u[14]!==c?(d=(0,a.jsx)($._u,{content:S,side:"top",align:"center",asChild:!0,children:c}),u[13]=S,u[14]=c,u[15]=d):d=u[15],d},eG=e=>{let t,r,s,c,d,u,p=(0,n.c)(20),{className:m,projectGroupRevisionId:x}=e,g=(0,f.jt)(),b=(0,h.OD)(),[y]=(0,el.n)(eT),v=(0,i.nZ)(eD),j=(0,l.eE)(eB),{id:I}=(0,J.MN)(),w=(0,ey.rl)(),[N,T]=(0,L.useState)(!1);p[0]!==v||p[1]!==I||p[2]!==x||p[3]!==y||p[4]!==j||p[5]!==w||p[6]!==g?(t=()=>{T(!0),g("Revert Revision Clicked",{projectGroupRevisionId:x}),v(),F.M.emit("resetPreviewReady"),j?.(),y({variables:{input:{projectGroupRevisionId:x}},update(e,t){let{data:r}=t,a=r?.restoreProjectGroupRevision.projectGroupRevision;a&&e.updateQuery({query:eI,variables:{projectGroupId:I,threadId:"string"==typeof w?w:null,first:eb.ft}},e=>e?.projectGroupById?{...e,projectGroupById:{...e.projectGroupById,latestRevision:{__typename:"ProjectGroupRevision",id:a.id,status:a.status,createdAt:a.createdAt,thread:a.thread},revisions:{...e.projectGroupById.revisions,totalCount:e.projectGroupById.revisions.totalCount+1,edges:[{__typename:"ProjectGroupRevisionEdge",node:a},...e.projectGroupById.revisions.edges]}}}:e)}}).then(()=>{F.M.emit("refreshIframe",{isManual:!1}),j?.()})},p[0]=v,p[1]=I,p[2]=x,p[3]=y,p[4]=j,p[5]=w,p[6]=g,p[7]=t):t=p[7];let _=t,k=(0,L.useRef)(null);p[8]!==_||p[9]!==N?(r={onPress:_,isDisabled:N},p[8]=_,p[9]=N,p[10]=r):r=p[10];let{buttonProps:C}=(0,E.s)(r,k);if(N)return null;let R=b?"Revert":void 0;return p[11]!==m?(s=(0,o.cn)(m,e_),p[11]=m,p[12]=s):s=p[12],p[13]===Symbol.for("react.memo_cache_sentinel")?(c=(0,a.jsx)(S.U,{height:18,width:18,strokeWidth:1}),p[13]=c):c=p[13],p[14]!==C||p[15]!==s?(d=(0,a.jsx)("button",{type:"button",className:s,...C,children:c}),p[14]=C,p[15]=s,p[16]=d):d=p[16],p[17]!==R||p[18]!==d?(u=(0,a.jsx)($._u,{content:R,side:"top",align:"center",asChild:!0,children:d}),p[17]=R,p[18]=d,p[19]=u):u=p[19],u},eP=()=>{let e,t,r,i,s,l=(0,n.c)(10),c=(0,h.GM)(),d=(0,p.yT)(e$),{toggle:u}=(0,x.e)(),g=(0,L.useRef)(null);l[0]!==c||l[1]!==d||l[2]!==u?(e=c?u:()=>d(m.e.LOGS),l[0]=c,l[1]=d,l[2]=u,l[3]=e):e=l[3],l[4]!==e?(t={onPress:e},l[4]=e,l[5]=t):t=l[5];let{buttonProps:f}=(0,E.s)(t,g);return l[6]===Symbol.for("react.memo_cache_sentinel")?(r=(0,o.cn)(e_,"tablet:block hidden"),i=(0,a.jsx)(N.I,{content:I.O3,size:"small"}),l[6]=r,l[7]=i):(r=l[6],i=l[7]),l[8]!==f?(s=(0,a.jsx)($._u,{content:"Logs",side:"top",align:"center",asChild:!0,children:(0,a.jsx)("button",{type:"button",...f,className:r,children:i})}),l[8]=f,l[9]=s):s=l[9],s},eO=e=>{let t,r,i,s,l,c=(0,n.c)(18),{mode:d,modeKey:u,message:p,projectGroupRevisionId:m,creditLabel:x,isFreeFix:h,refundedAt:g}=e,f=p.revision?.createdAt||x||h;return c[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,a.jsx)(O.h,{className:"mt-[8px] tablet:hidden"}),c[0]=t):t=c[0],c[1]!==d||c[2]!==u?(r=d&&(0,a.jsxs)("div",{className:"flex flex-col gap-[8px] px-[16px] pt-[14px] pb-[4px]",children:[(0,a.jsxs)("div",{className:"flex items-center gap-[8px]",children:[(0,a.jsx)("div",{className:(0,o.cn)("h-[8px] w-[8px] shrink-0 rounded-full",eS[d.color])}),"max"===u?(0,a.jsx)(P.A.Text,{className:"h-[16px] w-[38px]"}):(0,a.jsx)("span",{className:"font-semibold text-[14px] text-comeback-gray-900 leading-[18px] tracking-[-0.01em]",children:d.label})]}),(0,a.jsx)("p",{className:"text-[12px] text-comeback-gray-400 leading-[16
337px]",children:d.description})]}),c[1]=d,c[2]=u,c[3]=r):r=c[3],c[4]!==x||c[5]!==h||c[6]!==p.revision||c[7]!==d||c[8]!==f?(i=f&&(0,a.jsxs)("div",{className:(0,o.cn)("flex items-center justify-between px-[16px] pb-[10px]",d?"pt-[4px]":"pt-[14px]"),children:[(0,a.jsxs)("div",{className:"flex flex-col gap-[2px]",children:[p.revision?.createdAt?(0,a.jsx)("p",{className:"text-[11px] text-comeback-gray-400",children:(0,b.Yq)(p.revision.createdAt)}):null,p.revision?.generationDurationMs!=null?(0,a.jsxs)("p",{className:"text-[11px] text-comeback-gray-400",children:["Generated in"," ",(0,y.u)(p.revision.generationDurationMs)]}):null]}),(h||x)&&(0,a.jsxs)("div",{className:"flex items-center gap-[4px] text-comeback-gray-400",children:[(0,a.jsx)(_.s,{width:12,height:12,strokeWidth:1.5}),x&&(0,a.jsx)("span",{className:(0,o.cn)("text-[11px] tabular-nums",h&&"line-through"),children:x}),h&&(0,a.jsx)(w.E,{color:"gray",size:"small",children:"Free"})]})]}),c[4]=x,c[5]=h,c[6]=p.revision,c[7]=d,c[8]=f,c[9]=i):i=c[9],c[10]!==h||c[11]!==m||c[12]!==g?(s=(0,a.jsx)("div",{className:"px-[16px] pb-[12px]",children:(0,a.jsx)(ed,{projectGroupRevisionId:m,refundedAt:g,disabled:h})}),c[10]=h,c[11]=m,c[12]=g,c[13]=s):s=c[13],c[14]!==r||c[15]!==i||c[16]!==s?(l=(0,a.jsxs)("div",{className:"flex tablet:w-[240px] w-full flex-col bg-white",children:[t,r,i,s]}),c[14]=r,c[15]=i,c[16]=s,c[17]=l):l=c[17],l},eU=e=>{let t,r,i,s,l,c=(0,n.c)(12),{message:d}=e,u=(()=>{let e,t=(0,n.c)(2),{me:r}=(0,ef.y)();return t[0]!==r?.roles?(e=r?.roles.includes(j.UserRole.ADMIN)??!1,t[0]=r?.roles,t[1]=e):e=t[1],e})(),[p,m]=(0,L.useState)(null),[x,h]=(0,el.n)(eE),{loading:g}=h,f=eR(d);return u?(c[0]!==x||c[1]!==f||c[2]!==p?(t=async e=>{if(e&&!p&&f){let{data:e}=await x({variables:{input:{text:f}}});e?.adminTranslateText.translatedText&&m(e.adminTranslateText.translatedText)}},c[0]=x,c[1]=f,c[2]=p,c[3]=t):t=c[3],c[4]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)("span",{className:"font-semibold text-[14px] text-comeback-gray-900 leading-[18px] tracking-[-0.01em]",children:"Translation"}),c[4]=r):r=c[4],c[5]!==g||c[6]!==p?(i=(0,a.jsxs)("div",{className:"flex w-[300px] flex-col gap-[8px] bg-white p-[16px]",children:[r,g&&!p?(0,a.jsx)("span",{className:"text-[12px] text-comeback-gray-400 leading-[16px]",children:"Translatingâ¦"}):p?(0,a.jsx)("div",{className:"prose prose-sm max-w-none text-[12px] text-comeback-gray-700 leading-[16px]",children:(0,a.jsx)(D.o,{remarkPlugins:[B.A],children:p})}):(0,a.jsx)("span",{className:"text-[12px] text-comeback-gray-400 leading-[16px]",children:"No text to translate."})]}),c[5]=g,c[6]=p,c[7]=i):i=c[7],c[8]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)("button",{type:"button","aria-label":"Translate",className:(0,o.cn)(e_),children:(0,a.jsx)(k.w,{height:18,width:18,strokeWidth:1})}),c[8]=s):s=c[8],c[9]!==t||c[10]!==i?(l=(0,a.jsx)(U.A,{side:"top",align:"start",sideOffset:10,modal:!0,disableAutoFocus:!0,contentClassName:"z-overlay",className:"overflow-hidden rounded-[10px]",onOpenChange:t,content:i,children:s}),c[9]=t,c[10]=i,c[11]=l):l=c[11],l):null},eM=e=>{let t,r,i,s,l,c,d,u,p,m,x,h,g,f,b,y=(0,n.c)(38),{revisionId:v,projectGroupId:I}=e,{me:w}=(0,ef.y)(),N=w?.roles.includes(j.UserRole.ADMIN)??!1,[T,E]=(0,ej._)(eN),{data:S}=E;if(!N)return null;let _=S?.projectGroupRevisionById?.generation,k=_?.totalInputTokens??null,R=_?.totalOutputTokens??null,A=_?.contextWindowSize??null,G=_?.compressedTurnsCount??null,P=_?.compressedConversationRevisionCount??null;y[0]!==A||y[1]!==k?(t=null!=k&&A?Math.round(k/A*100):null,y[0]=A,y[1]=k,y[2]=t):t=y[2];let O=t;return(y[3]!==T||y[4]!==v?(r=e=>{e&&T({variables:{id:v}})},y[3]=T,y[4]=v,y[5]=r):r=y[5],y[6]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)("span",{className:"font-semibold text-[14px] text-comeback-gray-900 leading-[18px] tracking-[-0.01em]",children:"Stats for Nerds"}),y[6]=i):i=y[6],y[7]!==O||y[8]!==A||y[9]!==k)?(s=null!=k&&null!=A&&(0,a.jsxs)("div",{className:"flex flex-col gap-[2px]",children:[(0,a.jsx)("span",{className:"text-[11px] text-comeback-gray-500 leading-[14px]",children:"Context usage"}),(0,a.jsxs)("span",{className:"text-[12px] text-comeback-gray-900 leading-[16
337px]",children:[k.toLocaleString()," /"," ",A.toLocaleString()," (",O,"%)"]})]}),y[7]=O,y[8]=A,y[9]=k,y[10]=s):s=y[10],y[11]!==R?(l=null!=R&&(0,a.jsxs)("div",{className:"flex flex-col gap-[2px]",children:[(0,a.jsx)("span",{className:"text-[11px] text-comeback-gray-500 leading-[14px]",children:"Output tokens"}),(0,a.jsx)("span",{className:"text-[12px] text-comeback-gray-900 leading-[16px]",children:R.toLocaleString()})]}),y[11]=R,y[12]=l):l=y[12],y[13]!==G?(c=null!=G&&G>0&&(0,a.jsxs)("div",{className:"flex flex-col gap-[2px]",children:[(0,a.jsx)("span",{className:"text-[11px] text-comeback-gray-500 leading-[14px]",children:"Compressed turns"}),(0,a.jsx)("span",{className:"text-[12px] text-comeback-gray-900 leading-[16px]",children:G})]}),y[13]=G,y[14]=c):c=y[14],y[15]!==P?(d=null!=P&&P>0&&(0,a.jsxs)("div",{className:"flex flex-col gap-[2px]",children:[(0,a.jsx)("span",{className:"text-[11px] text-comeback-gray-500 leading-[14px]",children:"Compressed revisions"}),(0,a.jsx)("span",{className:"text-[12px] text-comeback-gray-900 leading-[16px]",children:P})]}),y[15]=P,y[16]=d):d=y[16],y[17]!==v?(u=(0,ev.Bv)({revisionId:v}),y[17]=v,y[18]=u):u=y[18],y[19]!==u?(p=(0,a.jsx)("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] text-comeback-blue-600 leading-[16px] underline hover:text-comeback-blue-700",children:"View Revision"}),y[19]=u,y[20]=p):p=y[20],y[21]!==I?(m=(0,ev.w4)({projectGroupId:I}),y[21]=I,y[22]=m):m=y[22],y[23]!==m?(x=(0,a.jsx)("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] text-comeback-blue-600 leading-[16px] underline hover:text-comeback-blue-700",children:"View Project Group"}),y[23]=m,y[24]=x):x=y[24],y[25]!==p||y[26]!==x?(h=(0,a.jsxs)("div",{className:"flex flex-col gap-[4px]",children:[p,x]}),y[25]=p,y[26]=x,y[27]=h):h=y[27],y[28]!==h||y[29]!==s||y[30]!==l||y[31]!==c||y[32]!==d?(g=(0,a.jsxs)("div",{className:"flex w-[240px] flex-col gap-[8px] bg-white p-[16px]",children:[i,s,l,c,d,h]}),y[28]=h,y[29]=s,y[30]=l,y[31]=c,y[32]=d,y[33]=g):g=y[33],y[34]===Symbol.for("react.memo_cache_sentinel")?(f=(0,a.jsx)("button",{type:"button","aria-label":"Stats",className:(0,o.cn)(e_),children:(0,a.jsx)(C.S,{height:18,width:18,strokeWidth:1})}),y[34]=f):f=y[34],y[35]!==g||y[36]!==r?(b=(0,a.jsx)(U.A,{side:"top",align:"start",sideOffset:10,modal:!0,disableAutoFocus:!0,contentClassName:"z-overlay",className:"overflow-hidden rounded-[10px]",onOpenChange:r,content:g,children:f}),y[35]=g,y[36]=r,y[37]=b):b=y[37],b},eL=e=>{let t,r,i,s,c,u,p,m,x,h=(0,n.c)(37),{message:g,className:f}=e,b=(0,J.MN)(),y=(0,l.RB)(eF),[v,I]=(0,ej._)(ew),{data:N}=I;h[0]!==v||h[1]!==g.revision?(t=e=>{e&&g.revision&&v({variables:{id:g.revision.id}})},h[0]=v,h[1]=g.revision,h[2]=t):t=h[2];let E=t,S=N?.projectGroupRevisionById?.totalCredits??null;h[3]!==S?(r=S&&"0"!==S?(0,G.EU)(S):null,h[3]=S,h[4]=r):r=h[4];let _=r,k=N?.projectGroupRevisionById?.refundedAt??null;h[5]!==g.revision?.createdAt?(i=()=>g.revision?.createdAt?eC(g.revision?.createdAt):"",h[5]=g.revision?.createdAt,h[6]=i):i=h[6];let[C,A]=(0,L.useState)(i);h[7]!==g.revision?.createdAt?(s=()=>{let e=g.revision?.createdAt;if(!e||!((0,R.Y)(new Date,60)<new Date(e)))return;let t=setInterval(()=>{(0,R.Y)(new Date,60)<new Date(e)?A(eC(e)):clearInterval(t)},6e4);return()=>clearInterval(t)},h[7]=g.revision?.createdAt,h[8]=s):s=h[8];let O=g.revision?.createdAt;if(h[9]!==O?(c=[O],h[9]=O,h[10]=c):c=h[10],(0,L.useEffect)(s,c),!g.revision)return null;h[11]!==g.blocks||h[12]!==g.revision.action?(u=g.revision.action?(0,eg.wZ)({action:g.revision.action,hasExtendedThinking:(0,eg.P2)(g.blocks)}):null,h[11]=g.blocks,h[12]=g.revision.action,h[13]=u):u=h[13];let D=u,B=D?eg.Gv[D]:null,$=g.revision.action===j.ProjectGroupRevisionAction.PROJECT_FIX_CHANGE,F=g.revision.autoSelectedAction===j.ProjectGroupRevisionAction.EXPERT_SWE,H=g.revision.id,q=B||g.revision.createdAt||_;h[14]!==_||h[15]!==E||h[16]!==q||h[17]!==$||h[18]!==g||h[19]!==B||h[20]!==D||h[21]!==H||h[22]!==k||h[23]!==C?(p=q?(0,a.jsx)(U.A,{side:"top",align:"start",sideOffset:10,modal:!0,disableAutoFocus:!0,onOpenChange:E,contentClassName:"z-overlay",className:"overflow-hidden rounded-[10px]",content:(0,a.jsx)(eO,{mode:B,modeKey:D,message:g,projectGroupRevisionId:H,creditLabel:_,isFreeFix:$,refundedAt:k}),children:(0,a.jsxs)("button",{type:"button",className:(0,o.cn)(e_,"flex shrink-0 items-center gap-[2px] whitespace-nowrap rounded-[4px] px-[6px]"),children:[(0,a.jsx)(T.E,{type:"body-sm",weight:"regular",as:"span",children:C}),(0,a.jsx)("svg",{"aria-hidden":"true",className:"text-comeback-gray-300",height:"8",viewBox:"0 0 8 8",width:"8",children:(0,a.jsx)("path",{d:"M2 3L4 5L6 3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})})]})}):(0,a.jsx)(T.E,{type:"body-sm",weight:"regular",className:"shrink-0 truncate whitespace-nowrap text-comeback-gray-500",children:C}),h[14]=_,h[15]=E,h[16]=q,h[17]=$,h[18]=g,h[19]=B,h[20]=D,h[21]=H,h[22]=k,h[23]=C,h[24]=p):p=h[24];let z=p;return h[25]!==f||h[26]!==$||h[27]!==g||h[28]!==z||h[29]!==D||h[30]!==b||h[31]!==H||h[32]!==y||h[33]!==F?(m=!g.isGenerating&&(0,a.jsxs)(d.P.div,{initial:{opacity:0}
337,animate:{opacity:1},exit:{opacity:0},className:(0,o.cn)("flex flex-row items-center gap-[4px] desktop:opacity-0 transition-opacity group-hover:opacity-100",f),children:[(0,a.jsx)(eA,{message:g}),H&&(0,a.jsx)(eG,{projectGroupRevisionId:H,className:g.isLatest?"hidden":""}),y&&(0,a.jsx)(eP,{}),(0,a.jsx)(eh,{projectGroupRevisionId:H,userRating:g.revision.userRating}),z,"design"===D&&(0,a.jsx)(w.E,{color:"gray",size:"small",children:"Design"}),$&&(0,a.jsx)(w.E,{color:"gray",size:"small",children:"Free"}),F&&(0,a.jsx)(P.A.Text,{className:"h-[14px] w-[35px]",duration:3}),(0,a.jsx)(eU,{message:g}),(0,a.jsx)(eM,{revisionId:H,projectGroupId:b.id})]}),h[25]=f,h[26]=$,h[27]=g,h[28]=z,h[29]=D,h[30]=b,h[31]=H,h[32]=y,h[33]=F,h[34]=m):m=h[34],h[35]!==m?(x=(0,a.jsx)(M.N,{children:m}),h[35]=m,h[36]=x):x=h[36],x};function eD(e){return e.clearHistoricalRevision}function eB(e){return e.actions?.scrollToEnd}function e$(e){return e.setSelection}function eF(e){return"left-chat"===e}var eH=r(451758),eq=r(937973),ez=r(99873);let eV=e=>{let t,r,i,s=(0,n.c)(10),{isGenerating:c,hasMultipleBlocks:u,isCollapsed:p,onPress:m}=e,x=(0,L.useRef)(null);s[0]!==m?(t={onPress:m},s[0]=m,s[1]=t):t=s[1];let{buttonProps:h}=(0,E.s)(t,x),g=(0,l.UB)();return s[2]!==h||s[3]!==u||s[4]!==g||s[5]!==p||s[6]!==c?(r=g?null:(0,a.jsxs)(d.P.button,{className:"mt-[6px] flex w-fit cursor-pointer items-center justify-center gap-[4px] outline-none ring-offset-background focus-visible:ring-[2px] focus-visible:ring-ring focus-visible:ring-offset-[2px]",...h,children:[(0,a.jsx)(d.P.div,{className:(0,o.cn)("flex items-center gap-[4px] text-body-xs transition-[width] hover:text-comeback-gray-600",c?"bg-[length:200%_100%] bg-gradient-to-r from-comeback-gray-900 via-white to-comeback-gray-900 bg-clip-text text-transparent":"text-comeback-gray-500",u?"cursor-pointer":"cursor-default",p?"w-[56px]":"w-[64px]"),...c?{initial:{backgroundPosition:"0% 0%"},animate:{backgroundPosition:"-200% 0%"},transition:{duration:2.5,repeat:1/0,ease:"linear"}}:{initial:{opacity:0,y:p?10:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:p?-10:10},transition:{duration:.3,ease:"easeInOut"}},children:c?"Workingâ¦":p?"See steps":"Hide steps"},p?"expand":"collapse"),(0,a.jsx)(N.I,{content:ez.e5,className:(0,o.cn)("transition-transform duration-200",p?"":"rotate-90"),size:"xs"})]}),s[2]=h,s[3]=u,s[4]=g,s[5]=p,s[6]=c,s[7]=r):r=s[7],s[8]!==r?(i=(0,a.jsx)(M.N,{mode:"wait",children:r}),s[8]=r,s[9]=i):i=s[9],i};var eW=r(814394),eY=r(57757);function eQ(e){return e.type===H.I.TAG&&e.tag===j.LLMTag.FILE_BASED_BLOCK&&e.args?.isBackground==="true"}function eX(e){let t,r,i,s,l,o,c,u,p,m,x,h,g,f,b,y,v=(0,n.c)(47),{blocks:I,isGenerating:w}=e,[T,E]=(0,L.useState)(!1);if(v[0]!==I){let e;e=I.length,t=`${e} Background ${1===e?"Task":"Tasks"}`,v[0]=I,v[1]=t}else t=v[1];let S=t;if(v[2]!==I||v[3]!==T||v[4]!==w||v[5]!==S){let e,t,n;v[17]!==w?(e=e=>{if(e.type!==H.I.TAG)return[];let t=(0,eW.m)(e.args),r=w||t.status!==j.ToolCallTagStatus.RUNNING?t.status:j.ToolCallTagStatus.SUCCESS;return[{...t,status:r}]},v[17]=w,v[18]=e):e=v[18];let g=I.flatMap(e);v[19]===Symbol.for("react.memo_cache_sentinel")?(t=()=>{E(eJ)},v[19]=t):t=v[19];let f=t;s="comeback-text-body-md flex w-full flex-row items-center justify-start overflow-hidden rounded-[8px] bg-white pt-[4px] text-left text-comeback-gray-900 outline-none transition-colors",h="flex w-full min-w-0 flex-col items-start",v[20]===Symbol.for("react.memo_cache_sentinel")?(n=(0,a.jsx)("div",{className:"flex-shrink-0 px-[2px]",children:(0,a.jsx)("div",{className:"flex h-[16px] w-[16px] items-center justify-center",children:(0,a.jsx)(N.I,{content:ez.bC,size:"small",className:"text-comeback-gray-600"})})}),v[20]=n):n=v[20],v[21]!==S?(i=(0,a.jsx)("div",{className:"flex w-fit min-w-0 max-w-full flex-row items-center gap-x-[12px]",children:(0,a.jsxs)("button",{type:"button",className:"flex min-w-0 cursor-pointer flex-row items-center gap-x-[12px] rounded-[4px] border-0 bg-transparent p-0 text-left",onClick:f,children:[n,(0,a.jsx)("p",{className:"truncate font-medium text-sm text-comeback-gray-700",children:S})]})}),v[21]=S,v[22]=i):i=v[22],r=d.P.div,c="relative w-full",u=!1;let b=T?"auto":0,y=+!!T,_=12*!!T;v[23]!==b||v[24]!==y||v[25]!==_?(p={height:b,opacity:y,marginTop:_},v[23]=b,v[24]=y,v[25]=_,v[26]=p):p=v[26],v[27]===Symbol.for("react.memo_cache_sentinel")?(m={duration:.35,ease:[.4,0,.2,1]},x={overflow:"hidden"},v[27]=m,v[28]=x):(m=v[27],x=v[28]),l="flex flex-col gap-[4px] pl-[6px]",o=g.map(eK),v[2]=I,v[3]=T,v[4]=w,v[5]=S,v[6]=r,v[7]=i,v[8]=s,v[9]=l,v[10]=o,v[11]=c,v[12]=u,v[13]=p,v[14]=m,v[15]=x,v[16]=h}else r=v[6],i=v[7],s=v[8],l=v[9],o=v[10],c=v[11],u=v[12],p=v[13],m=v[14],x=v[15],h=v[16];return v[29]!==l||v[30]!==o?(g=(0,a.jsx)("div",{className:l,children:o}),v[29]=l,v[30]=o,v[31]=g):g=v[31],v[32]!==r||v[33]!==g||v[34]!==c||v[35]!==u||v[36]!==p||v[37]!==m||v[38]!==x?(f=(0,a.jsx)(r,{className:c,initial:u,animate:p,transition:m,style:x,children:g}),v[32]=r,v[33]=g,v[34]=c,v[35]=u,v[36]=p,v[37]=m,v[38]=x,v[39]=f):f=v[39],v[40]!==i||v[41]!==f||v[42]!==h?(b=(0,a.jsxs)("div",{className:h,children:[i,f]}),v[40]=i,v[41]=f,v[42]=h,v[43]=b):b=v[43],v[44]!==s||v[45]!==b?(y=(0,a.jsx)("div",{className:s,children:b}),v[44]=s,v[45]=b,v[46]=y):y=v[46],y}function eK(e,t){return(0,a.jsxs)("div",{className:"flex flex-row items-center gap-x-[12px]",children:[(0,a.jsx)("div",{className:"flex-shrink-0 px-[2px]",children:(0,a.jsx)(eY.gX,{status:{isRunning:e.status===j.ToolCallTagStatus.RUNNING,isError:e.status===j.ToolCallTagStatus.ERROR,isCancelled:e.status===j.ToolCallTagStatus.CANCELLED,isLatest:!1},data:{thinkingType:void 0}})}),(0,a.jsx)("p",{className:(0,o.cn)("truncate text-sm",e.status===j.ToolCallTagStatus.CANCELLED?"text-comeback-gray-500":"text-comeback-gray-700"),children:e.text})]},e.toolCallId??t)}function eJ(e){return!e}function eZ(e){let t=(0,n.c)(3),{status:r}=e;switch(r){case"completed":{let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)(N.I,{content:ez.bC,size:"small",className:"text-comeback-green-500"}),t[0]=e):e=t[0],e}case"in_progress":{let e;return t[1]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)(d.P.div,{className:"h-[8px] w-[8px] rounded-full bg-comeback-yellow-400",animate:{o
337pacity:[1,.4,1]},transition:{duration:1.5,repeat:1/0,ease:"easeInOut"}}),t[1]=e):e=t[1],e}case"pending":{let e;return t[2]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)("div",{className:"h-[8px] w-[8px] rounded-full border border-comeback-gray-300"}),t[2]=e):e=t[2],e}}}function e0(e){let t,r,i,s,l,o,c=(0,n.c)(14),{block:u}=e,p=u.type===H.I.TAG?(0,eW.m)(u.args):null,m=p?.todos??[],x=m.filter(e3).length,h=m.length,g=h>0&&x===h&&p?.status!==j.ToolCallTagStatus.RUNNING,[f,b]=(0,L.useState)(!g),[y,v]=(0,L.useState)(g);g!==y&&(v(g),g&&b(!1)),c[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>{b(e2)},c[0]=t):t=c[0];let I=t;if(0===h)return null;c[1]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)("div",{className:"flex-shrink-0 px-[2px]",children:(0,a.jsx)("div",{className:"flex h-[16px] w-[16px] items-center justify-center",children:(0,a.jsx)(N.I,{content:ez.bC,size:"small",className:"text-comeback-gray-600"})})}),c[1]=r):r=c[1];let w=d.P,T=f?"auto":0,E=+!!f,S=12*!!f;c[2]!==T||c[3]!==E||c[4]!==S?(i={height:T,opacity:E,marginTop:S},c[2]=T,c[3]=E,c[4]=S,c[5]=i):i=c[5],c[6]===Symbol.for("react.memo_cache_sentinel")?(s={duration:.35,ease:[.4,0,.2,1]},c[6]=s):s=c[6];let _=m.map(e1);return c[7]!==_?(l=(0,a.jsx)("div",{className:"flex flex-col gap-[4px] pl-[6px]",children:_}),c[7]=_,c[8]=l):l=c[8],c[9]!==s||c[10]!==l||c[11]!==w.div||c[12]!==i?(o=(0,a.jsx)(w.div,{className:"relative w-full overflow-hidden",initial:!1,animate:i,transition:s,children:l}),c[9]=s,c[10]=l,c[11]=w.div,c[12]=i,c[13]=o):o=c[13],(0,a.jsx)("div",{className:"comeback-text-body-md flex w-full flex-row items-center justify-start overflow-hidden rounded-[8px] bg-white pt-[4px] text-left text-comeback-gray-900 outline-none transition-colors",children:(0,a.jsxs)("div",{className:"flex w-full min-w-0 flex-col items-start",children:[(0,a.jsx)("div",{className:"flex w-fit min-w-0 max-w-full flex-row items-center gap-x-[12px]",children:(0,a.jsxs)("button",{type:"button",className:"flex min-w-0 cursor-pointer flex-row items-center gap-x-[12px] rounded-[4px] border-0 bg-transparent p-0 text-left",onClick:I,children:[r,(0,a.jsxs)("p",{className:"truncate font-medium text-sm text-comeback-gray-700",children:["Plan (",x,"/",h," completed)"]})]})}),o]})})}function e1(e){return(0,a.jsxs)("div",{className:"flex flex-row items-center gap-x-[12px]",children:[(0,a.jsx)("div",{className:"flex-shrink-0 px-[2px]",children:(0,a.jsx)("div",{className:"flex h-[16px] w-[16px] items-center justify-center",children:(0,a.jsx)(eZ,{status:e.status})})}),(0,a.jsx)("p",{className:(0,o.cn)("truncate text-sm","completed"===e.status?"text-comeback-gray-500 line-through":"text-comeback-gray-700"),children:e.content})]},e.id)}function e2(e){return!e}function e3(e){return"completed"===e.status}var e4=r(242417);let e5=/^\{generated_video:[^}]+\}$/,e7=(0,L.memo)(({message:e,variant:t})=>{let[r,n]=(0,L.useState)(!0),i=(0,ey.rl)(),s=(0,l.UB)(),o=(0,L.useRef)(!1);(0,L.useEffect)(()=>{e.isGenerating&&(o.current=!0)},[e.isGenerating]);let c=(0,L.useRef)(-1),{galleryImages:u,pendingAssetCount:p,cancelledAssetCount:m,firstGalleryBlockIndex:x}=(({blocks:e,lockedGalleryIndexRef:t})=>{let r=new Set,a=[],n=0,i=0,s=-1;for(let t=0;t<e.length;t++){let l=e[t];if(l){if(l.type===H.I.TEXT){let{images:e}=(0,e4.dH)(l.code);for(let n of e)r.has(n.src)||(r.add(n.src),a.push(n),-1===s&&(s=t))}if(eQ(l)&&l.type===H.I.TAG){let e=(0,eW.m)(l.args);e.thinkingType===j.ThinkingType.ASSET_GENERATION&&(e.status===j.ToolCallTagStatus.RUNNING?(n++,-1===s&&(s=t)):e.status===j.ToolCallTagStatus.CANCELLED&&i++)}}}return s>=0&&-1===t.current&&(t.current=s),{galleryImages:a,pendingAssetCount:n,cancelledAssetCount:i,firstGalleryBlockIndex:t.current>=0?t.current:s}})({blocks:e.blocks,lockedGalleryIndexRef:c}),h=u.length+p+m,g=e.blocks.findLastIndex(e=>e.type===H.I.ASK_QUESTIONS),f=({block:r,isLast:n})=>{let s=e.blocks.indexOf(r),l=`${r.type}-${s>=0?s:"special"}-${i===ey.w2?"new":i}`,c=s>=0&&s===e.blocks.length-1,d=(({block:e})=>{if(e.type===H.I.TEXT&&"code"in e&&"string"==typeof e.code&&e5.test(e.code.trim()))return!1;switch(e.type){case H.I.PLAN:case H.I.TEXT:case H.I.ASK_QUESTIONS:case H.I.SATISFACTION_SURVEY:case H.I.CODE:return!0;case H.I.ANIMATED_TEXT:case H.I.APP_STORE_CONNECT_ACCOUNT:case H.I.DESIGN_EXPLORATION:case H.I.DESIGN_VARIATION:case H.I.EMAIL:case H.I.ERROR:case H.I.FIGMA_IMPORT:case H.I.MOBBIN_IMPORT:case H.I.REVENUE_CAT_CONNECT_ACCOUNT:case H.I.SELECTED_DESIGN_SYSTEM:case H.I.SELECTED_INTEGRATION:case H.I.SELECTED_MODULE:case H.I.SIGNUP:case H.I.TAG:case H.I.TOMBSTONE:case H.I.UI:case H.I.DATABASE_MIGRATION:return!1;default:return e}})({block:r}
337)&&e.isLatest&&"assistant"===e.actor&&o.current&&n,u=r.type===H.I.ASK_QUESTIONS&&s!==g;return(0,a.jsx)(eq.d,{block:r,index:s>=0?s:e.blocks.length,variant:t,shouldUseStreamingAnimation:d,threadId:i,isLatestBlock:c,isLatestMessage:e.isLatest,isGenerating:e.isGenerating,createdAt:e.revision?.createdAt??null,revisionId:e.revision?.id??null,revisionAction:e.revision?.autoSelectedAction??e.revision?.action??null,isInteractive:!0,isSupersededAskQuestions:u,galleryToRender:null,pendingAssetCount:0},l)},{visible:b,collapsed:y}=K({isGenerating:e.isGenerating,blocks:e.blocks,isBeforeLeftChat:s}),v=h>=2||p>0?(0,a.jsx)(e4.Iu,{images:u,pendingCount:p,cancelledCount:m},"asset-gallery"):null,I=t=>{let r=function(e){let t=[],r=[],a=()=>{r.length>0&&(t.push({kind:"background-group",blocks:[...r]}),r=[])};for(let n of e)eQ(n)?r.push(n):(a(),t.push({kind:"block",block:n}));return a(),t}(t),n=[],s=!1;for(let o of r)if("background-group"===o.kind){let t=o.blocks[0],r=t?e.blocks.indexOf(t):0,l=`bg-group-${r}-${i===ey.w2?"new":i}`;!s&&v&&x>=0&&o.blocks.some(t=>e.blocks.indexOf(t)>=x)&&(n.push(v),s=!0),n.push((0,a.jsx)(eX,{blocks:o.blocks,isGenerating:e.isGenerating},l))}else{var l;let r=t.indexOf(o.block),c=e.blocks.indexOf(o.block);(!s&&v&&x>=0&&c>=x&&(n.push(v),s=!0),(l=o.block).type!==H.I.TAG||l.tag!==j.LLMTag.FILE_BASED_BLOCK?1:(0,eW.m)(l.args).uiType!==j.UIBlockType.TODO_LIST)?n.push(f({block:o.block,isLast:r===t.length-1})):n.push((0,a.jsx)(e0,{block:o.block},`todo-${c}-${i===ey.w2?"new":i}`))}return!s&&v&&n.push(v),n};return"homepage"===t?(0,a.jsx)("div",{className:"flex flex-col gap-[12px]",children:I(e.blocks)}):(0,a.jsxs)("div",{className:"flex flex-col gap-[12px]",children:[e.blocks.length>1&&(0,a.jsx)(eV,{isGenerating:e.isGenerating,hasMultipleBlocks:y.length>=2,isCollapsed:r,onPress:()=>{0!==y.length&&n(e=>!e)}}),(0,a.jsx)(M.N,{initial:!1,children:!r&&y.length>0&&(0,a.jsx)(d.P.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.35,ease:[.4,0,.2,1]},style:{overflow:"hidden"},className:"ml-[4px] flex w-full flex-col gap-[12px] border-comeback-gray-50 border-l pl-[12px]",children:I(y)})}),I(b)]})});var e8=r(649585),e6=r(374282),e9=r(863349),te=r(163195),tt=r(401499),tr=r(179487);let ta=e=>{let t,r,i,s,l,c,d,u,p=(0,n.c)(23),{code:m,isGenerating:x,lang:h,variant:g}=e,[f,b]=(0,L.useState)(!1),[y,v]=(0,L.useState)(!1),j=(0,L.useRef)(null);p[0]!==g?(t=()=>{let e=j.current;if(!e)return;let t="homepage"===g?200:250,r=new ResizeObserver(()=>{v(e.scrollHeight>t)});return r.observe(e),()=>r.disconnect()},r=[g],p[0]=g,p[1]=t,p[2]=r):(t=p[1],r=p[2]),(0,L.useEffect)(t,r);let I="homepage"===g&&!f&&"max-h-[200px] overflow-hidden",w="homepage"!==g&&!f&&"overflow-hidden";return p[3]!==I||p[4]!==w?(i=(0,o.cn)("rounded-[8px]",I,w),p[3]=I,p[4]=w,p[5]=i):i=p[5],p[6]!==f||p[7]!==g?(s=f||"homepage"===g?void 0:{maxHeight:"250px"},p[6]=f,p[7]=g,p[8]=s):s=p[8],p[9]!==m||p[10]!==x||p[11]!==h?(l=(0,a.jsx)(tt.ViewCodeBlock,{code:m,isGenerating:x,lang:h,className:"max-h-none"}),p[9]=m,p[10]=x,p[11]=h,p[12]=l):l=p[12],p[13]!==i||p[14]!==s||p[15]!==l?(c=(0,a.jsx)("div",{ref:j,className:i,style:s,children:l}),p[13]=i,p[14]=s,p[15]=l,p[16]=c):c=p[16],p[17]!==f||p[18]!==y?(d=y&&(0,a.jsxs)("div",{className:"absolute right-0 bottom-0 left-0 z-float flex flex-col items-center rounded-b-[8px]",children:[!f&&(0,a.jsx)("div",{className:"h-[60px] w-full rounded-b-[8px] bg-gradient-to-t from-[#1a1b26] to-transparent"}),(0,a.jsx)("button",{type:"button",onClick:()=>b(tn),className:"flex w-full items-center justify-center rounded-b-[8px] bg-[#1a1b26] py-[4px] text-comeback-gray-400 hover:text-comeback-gray-300",children:(0,a.jsx)(tr.y,{size:14,className:(0,o.cn)("transition-transform",f&&"rotate-180")})})]}),p[17]=f,p[18]=y,p[19]=d):d=p[19],p[20]!==c||p[21]!==d?(u=(0,a.jsxs)("div",{className:"relative max-w-[75%]",children:[c,d]}),p[20]=c,p[21]=d,p[22]=u):u=p[22],u};function tn(e){return!e}var ti=r(133532),ts=r(88237),tl=r(562355),to=r(676044);function tc({filename:e}){let t=e.split(".");return t.length<2?"":t[t.length-1]?.toUpperCase()??""}function td({extension:e}){switch(e){case"PDF":return{badge:"bg-comeback-red-25 text-comeback-red-700",chip:"bg-comeback-red-25 border-comeback-red-200"};case"DOC":case"DOCX":return{badge:"bg-comeback-blue-25 text-comeback-blue-700",chip:"bg-comeback-blue-25 border-comeback-blue-200"};case"CSV":case"XLS":case"XLSX":return{badge:"bg-comeback-green-25 text-comeback-green-700",chip:"bg-comeback-green-25 border-comeback-green-200"};default:return{badge:"bg-comeback-gray-50 text-comeback-gray-700",chip:"bg-comeback-gray-50 border-comeback-gray-100"}}}function tu(e){let t,r,i,s,l=(0,n.c)(8),{filename:c}=e;if(l[0]!==c){let{badge:e}=td({extension:t=tc({filename:c})});r=(0,o.cn)("flex h-[24px] min-w-[28px] items-center justify-center rounded-[4px]",e),l[0]=c,l[1]=t,l[2]=r}else t=l[1],r=l[2];let d=t||"?";return l[3]!==d?(i=(0,a.jsx)("span",{className:"text-[9px] font-bold leading-none",children:d}),l[3]=d,l[4]=i):i=l[4],l[5]!==r||l[6]!==i?(s=(0,a.jsx)("div",{className:r,children:i}),l[5]=r,l[6]=i,l[7]=s):s=l[7],s}function tp(e){let t,r,i,s,l,c,d=(0,n.c)(19),{filename:u,status:p,onRemove:m}=e,x="error"===p,h="uploading"===p;if(d[0]!==u||d[1]!==x||d[2]!==h){let{chip:e}=td({extension:tc({filename:u})});t=(0,o.cn)("flex items-center gap-[6px] rounded-[8px] border px-[8px] py-[4px]",e,h&&"animate-pulse",x&&"border-comeback-red-300"),d[0]=u,d[1]=x,d[2]=h,d[3]=t}else t=d[3];d[4]!==u?(r=(0,a.jsx)(tu,{filename:u}),d[4]=u,d[5]=r):r=d[5];let g=x?"text-comeback-red-500":"text-comeback-gray-700";return d[6]!==g?(i=(0,o.cn)("max-w-[150px] truncate text-body-xs",g),d[6]=g,d[7]=i):i=d[7],d[8]!==u||d[9]!==i?(s=(0,a.jsx)("span",{className:i,children:u}),d[8]=u,d[9]=i,d[10]=s):s=d[10],d[11]!==u||d[12]!==m?(l=null!==m&&(0,a.jsx)("button",{type:"button",onClick:m,className:"flex items-center justify-center text-comeback-gray-400 transition-colors hover:text-comeback-gray-700","aria-label":`Remove ${u}`,children:(0,a.jsx)(to.X,{width:14,height:14})}),d[11]=u,d[12]=m,d[13]=l):l=d[13],d[14]!==t||d[15]!==r||d[16]!==s||d[17]!==l?(c=(0,a.jsxs)("div",{className:t,children:[r,s,l]}),d[14]=t,d[15]=r,d[16]=s,d[17]=l,d[18]=c):c=d[18],c}let tm=e=>{let t,r,i,s,l=(0,n.c)(19),{message:c,variant:d}
337=e,[u,p]=(0,L.useState)(!1),[m,x]=(0,L.useState)(!1);l[0]!==c.attachments?(t=c.attachments??[],l[0]=c.attachments,l[1]=t):t=l[1];let h=t,g=h.length>0;if(l[2]!==h||l[3]!==g?(r=g&&(0,a.jsx)("div",{className:"flex max-w-[75%] flex-wrap justify-end gap-[6px]",children:h.map(tx)}),l[2]=h,l[3]=g,l[4]=r):r=l[4],l[5]!==u||l[6]!==m||l[7]!==c.blocks||l[8]!==c.isGenerating||l[9]!==d){let e;l[11]!==u||l[12]!==m||l[13]!==c.isGenerating||l[14]!==d?(e=(e,t)=>{let r=`${e.type}-${t}`;switch(e.type){case H.I.SELECTED_MODULE:return(0,a.jsx)(e9.Id,{id:e.moduleId},r);case H.I.SELECTED_INTEGRATION:return(0,a.jsx)(te.k8,{integration:e.integration},r);case H.I.SELECTED_DESIGN_SYSTEM:return null;case H.I.FIGMA_IMPORT:return(0,a.jsx)(e8.FigmaImport,{figmaUrl:e.figmaUrl,fileName:e.fileName},r);case H.I.MOBBIN_IMPORT:return(0,a.jsx)(e6.o,{screens:e.screens,onRemove:null},r);case H.I.CODE:return(0,a.jsx)(ta,{code:e.code,isGenerating:c.isGenerating,lang:e.lang,variant:d},r);default:{if(!(0,H.z)(e))return null;let t=(0,ti.EO)(e.code);return(0,a.jsxs)("div",{className:"relative w-fit max-w-[75%]",children:[(0,a.jsx)("div",{ref:e=>{if(!e)return;let t="homepage"===d?200:250;x(e.scrollHeight>t)},className:(0,o.cn)("whitespace-pre-wrap break-words rounded-[8px] bg-comeback-gray-50 px-[12px] py-[8px] text-body-sm text-comeback-gray-900",m&&"pb-[28px]","homepage"===d&&!u&&"max-h-[200px] overflow-hidden","homepage"!==d&&!u&&"overflow-hidden"),style:u||"homepage"===d?void 0:{maxHeight:"250px"},children:(0,a.jsx)(D.o,{remarkPlugins:[B.A],rehypePlugins:[ts.A],components:tl.dK,children:(0,tl.OS)(t)})}),m&&(0,a.jsxs)("div",{className:"absolute right-0 bottom-0 left-0 z-float flex flex-col items-center rounded-b-[8px]",children:[!u&&(0,a.jsx)("div",{className:"h-[60px] w-full bg-gradient-to-t from-comeback-gray-50 to-transparent"}),(0,a.jsx)("button",{type:"button",onClick:()=>p(th),className:"flex w-full items-center justify-center rounded-b-[8px] bg-comeback-gray-50 py-[4px] text-comeback-gray-500 hover:text-comeback-gray-700",children:(0,a.jsx)(tr.y,{size:14,className:(0,o.cn)("transition-transform",u&&"rotate-180")})})]})]},r)}}},l[11]=u,l[12]=m,l[13]=c.isGenerating,l[14]=d,l[15]=e):e=l[15],i=c.blocks.map(e),l[5]=u,l[6]=m,l[7]=c.blocks,l[8]=c.isGenerating,l[9]=d,l[10]=i}else i=l[10];return l[16]!==r||l[17]!==i?(s=(0,a.jsxs)(a.Fragment,{children:[r,i]}),l[16]=r,l[17]=i,l[18]=s):s=l[18],s};function tx(e){return(0,a.jsx)(tp,{filename:e.filename,mimeType:e.mimeType,status:"uploaded",onRemove:null},e.url)}function th(e){return!e}let tg="intromessage",tf=e=>{let t,r,p,m,x,h,g,f,b,y,v,j,I=(0,n.c)(40),{index:w,message:N,previousMessage:T,className:E,variant:S,containerHeight:_}=e,k=void 0===S?"default":S,C=(0,l.RB)(tb),R=(0,l.RB)(ty);I[0]!==N.id?(t=e=>{c.Cp(Error("Failed to render chat message",{cause:e}),{extra:{messageId:N.id}})},I[0]=N.id,I[1]=t):t=I[1];let A=t;I[2]!==N.blocks||I[3]!==N.revision?(r=e=>{let{value:t}=e;return!(!t.viewingHistoricalRevisionId||!N.revision||N.revision.id===t.viewingHistoricalRevisionId||N.blocks.some(e=>"tag"===e.type&&(0,eH.l)(e)===t.viewingHistoricalRevisionId))},I[2]=N.blocks,I[3]=N.revision,I[4]=r):r=I[4];let G=(0,i.nZ)(r);I[5]!==N.blocks?(p=N.blocks.every(tv),I[5]=N.blocks,I[6]=p):p=I[6];let P=p;I[7]!==N.blocks?(m=N.blocks.some(tj),I[7]=N.blocks,I[8]=m):m=I[8];let O=m;I[9]!==E?(x=(0,o.cn)("flex flex-col gap-[12px]",E),I[9]=E,I[10]=x):x=I[10];let U=`chat message from ${N.actor}`,M="user"===N.actor?"justify-end":"justify-start",L="homepage"===k&&"assistant"===N.actor&&"animate-fade-in-bottom";I[11]!==M||I[12]!==L?(h=(0,o.cn)("!h-fit flex w-full items-center gap-[4px]",M,L),I[11]=M,I[12]=L,I[13]=h):h=I[13];let D="user"===N.actor&&"items-end justify-end pr-[20px]",B=G?"opacity-40":"opacity-100";return I[14]!==D||I[15]!==B?(g=(0,o.cn)("flex w-full flex-col gap-[6px] overflow-x-hidden overflow-y-hidden rounded text-comeback-gray-900 transition-opacity",D,B),I[14]=D,I[15]=B,I[16]=g):g=I[16],I[17]!==_||I[18]!==R||I[19]!==O||I[20]!==w||I[21]!==P||I[22]!==C||I[23]!==N||I[24]!==T||I[25]!==k?(f="assistant"===N.actor?(0,a.jsxs)("div",{className:(0,o.cn)("flex flex-col gap-[8px]","homepage"===k?"px-[8px]":"px-[20px]"),style:{minHeight:(({message:e,variant:t,previousMessage:r,isLeftChat:a,containerHeight:n})=>{if(e.id===tg&&a)return"calc(100dvh - 238px)";if(e.isLatest&&e.id!==tg&&"default"===t){if(e.blocks.some(e=>"tombstone"===e.type||"error"===e.type))return"calc(100dvh - 420px)";let t=r?.blocks.every(e=>"tombstone"===e.type)?250:316;return`calc(100dvh - ${t}px)`}return"auto"})({message:N,variant:k,previousMessage:T,isLeftChat:C,containerHeight:_})},children:[(0,a.jsxs)("div",{className:"flex flex-row gap-[8px]",children:[!O&&(0,a.jsx)("div",{className:(0,o.cn)("flex min-h-[20px] min-w-[20px] flex-col items-center gap-[6px]","homepage"===k?"pt-[2px]":"pt-[4px]"),children:N.isGenerating&&P?(0,a.jsx)(d.P.div,{className:"h-[12px] w-[12px] rounded-full bg-black",animate:{scale:[1,1.3,1]},transition:{duration:1.5,repeat:1/0,ease:"easeInOut",delay:+("centered-chatbox"===R)}}):(0,a.jsx)(s.gu,{size:"xs"})}),(0,a.jsx)("div",{className:"flex w-full min-w-0 flex-col gap-[12px] pr-[8px]",children:(0,a.jsx)(e7,{message:N,variant:k})})]}),"default"===k&&!O&&!N.isGenerating&&(0,a.jsx)(eL,{message:N,className:(0,o.cn)("default"===k&&"ml-[18px] max-w-[75%]")})]}):(0,a.jsxs)("div",{className:(0,o.cn)("group flex w-full flex-col items-end gap-[4px]",0!==w&&"pt-[12px]"),children:[(0,a.jsx)(tm,{message:N,variant:k}),(0,a.jsxs)("div",{className:"flex w-full items-center justify-end gap-[4px] opacity-0 transition-opacity group-hover:opacity-100",children:[(0,a.jsx)(eU,{message:N}),!N.blocks.some(tI)&&(0,a.jsx)(eA,{message:N})]})]}),I[17]=_,I[18]=R,I[19]=O,I[20]=w,I[21]=P,I[22]=C,I[23]=N,I[24]=T,I[25]=k,I[26]=f):f=I[26],I[27]!==g||I[28]!==f?(b=(0,a.jsx)("div",{className:g,children:f}),I[27]=g,I[28]=f,I[29]=b):b=I[29],I[30]!==h||I[31]!==b?(y=(0,a.jsx)("div",{className:h,children:b}),I[30]=h,I[31]=b,I[32]=y):y=I[32],I[33]!==A||I[34]!==y?(v=(0,a.jsx)(u.tH,{fallback:null,onError:A,children:y}),I[33]=A,I[34]=y,I[35]=v):v=I[35],I[36]!==v||I[37]!==x||I[38]!==U?(j=(0,a.jsx)("article",{className:x,"aria-label":U,children:v}),I[36]=v,I[37]=x,I[38]=U,I[39]=j):j=I[39],j};function tb(e){return"left-chat"===e}function ty(e){return e}function tv(e){return"text"===e.type?!e.code?.trim():"animated-text"===e.type&&!e.text?.trim()}function tj(e){return"tombstone"===e.type||"error"===e.type}
337function tI(e){return e.type===H.I.CODE}},569781:(e,t,r)=>{r.d(t,{x:()=>u}),r(976413),r(718881);var a=r(917339);r(514886);var n=r(268640),i=r(211158),s=r(294799),l=r(834023),o=r(971288),c=r(71940);let d={color:"gray",size:"xs"},u=l.forwardRef((e,t)=>{let r={...d,...e},{icon:l,disabled:u,onPress:p,onClick:m,hoverProps:x}=r,h=(0,n.A)(t),{buttonProps:g}=(0,o.s)({isDisabled:r.disabled,onPress:p||m,type:r.type},h),f=(0,c.v)((({color:e,className:t,disabled:r,onClick:n})=>({onClick:n,className:(0,a.cn)("items-center justify-center rounded p-[4px] outline-none ring-offset-background focus-visible:ring-[2px] focus-visible:ring-ring focus-visible:ring-offset-[2px] transition-colors",{"bg-none text-comeback-gray-500 hover:bg-comeback-gray-50 active:bg-comeback-gray-75 active:text-comeback-gray-700":"gray"===e&&!r,"bg-comeback-gray-50 text-comeback-gray-75":r},t)}))(r),g,x,Object.keys(r).reduce((e,t)=>(t.startsWith("aria-")&&(e[t]=r[t]),e),{}));return(0,s.jsx)("button",{onClick:m,...f,onPointerDown:m?void 0:f.onPointerDown,disabled:u,ref:t,children:(0,s.jsx)(i.I,{content:l,size:r.size})})})},637284:(e,t,r)=>{r.d(t,{C:()=>d,R:()=>c});var a=r(11241),n=r(936457),i=r(232726),s=r(751355),l=r(814121);let o=(0,s.U)(` 338 mutation ThrottledBootDevServer($input: BootDevServerInput!) { 339 bootDevServer(input: $input) { 340 success 341 devServerSession { 342 id 343 status 344 webUrl 345 mobileUrl 346 healthCheckUrl 347 error 348 updatedAt 349 } 350 } 351 } 352`),c=(0,i.v)(e=>({argMap:new Map,reset:()=>{e({argMap:new Map})}})),d=()=>{let e,t,r=(0,a.c)(4),[i]=(0,l.n)(o),s=c(u);return r[0]!==s||r[1]!==i?(e=e=>{let t=Date.now(),r=JSON.stringify(e);for(let[e,r]of s)t-r.timestamp>=1e3&&s.delete(e);let a=s.get(r);if(a)return a.result;let n=i({variables:e});return s.set(r,{result:n,timestamp:t}),n},r[0]=s,r[1]=i,r[2]=e):e=r[2],r[3]===Symbol.for("react.memo_cache_sentinel")?(t={leading:!0,trailing:!1},r[3]=t):t=r[3],(0,n.dh)(e,1e4,t)};function u(e){return e.argMap}},649585:(e,t,r)=>{r.r(t),r.d(t,{FigmaImport:()=>l});var a=r(294799),n=r(11241),i=r(789545),s=r(121180);let l=e=>{let t,r,l,o=(0,n.c)(6),{figmaUrl:c,fileName:d}=e;o[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,a.jsx)(i.I,{content:s.a0,size:"custom",viewBoxHeight:308,viewBoxWidth:205,className:"h-[14px] w-[10px] shrink-0"}),o[0]=t):t=o[0];let u=d??"Imported from Figma";return o[1]!==u?(r=(0,a.jsx)("span",{className:"truncate text-body-xs text-comeback-gray-700",children:u}),o[1]=u,o[2]=r):r=o[2],o[3]!==c||o[4]!==r?(l=(0,a.jsxs)("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"flex w-fit max-w-full items-center gap-[8px] rounded-full border border-comeback-gray-75 px-[10px] py-[5px] no-underline transition-colors hover:bg-comeback-gray-50",children:[t,r]}),o[3]=c,o[4]=r,o[5]=l):l=o[5],l}},652982:(e,t,r)=>{r.d(t,{_:()=>o});var a=r(11241),n=r(125695),i=r(98349),s=r(421455);let l=["debug","info","warn","error"],o=e=>{let t,r,o=(0,a.c)(5);o[0]!==e?(t=void 0===e?{}:e,o[0]=e,o[1]=t):t=o[1];let{level:c}=t,d=(0,s.A)(),u=l.indexOf(c??"debug"),p="development"===n.Ay.NODE_ENV?d.sendToast:i.l;return o[2]!==u||o[3]!==p?(r={log:(...e)=>{u<=l.indexOf("info")&&p(...e)},debug:(...e)=>{u<=l.indexOf("debug")&&p(...e)}
352,info:(...e)=>{u<=l.indexOf("info")&&p(...e)},warn:(...e)=>{u<=l.indexOf("warn")&&p(...e)},error:(...e)=>{u<=l.indexOf("error")&&p(...e)}},o[2]=u,o[3]=p,o[4]=r):r=o[4],r}},692552:(e,t,r)=>{r.d(t,{n:()=>k});var a=r(898936),n=r(430210),i=r(127167),s=r(20912),l=r(910189),o=r(982027),c=r(148999),d=r(33031),u=r(555246),p=r(233888),m=r(451286),x=r(814121),h=r(834023),g=r(244893),f=r(709298),b=r(216074),y=r(387631),v=r(751355);let j=(0,v.U)(` 353 query GetProjectGroupRevisionsForChat( 354 $projectGroupId: ID! 355 $threadId: ID 356 $first: Int 357 $after: String 358 ) { 359 projectGroupById(id: $projectGroupId) { 360 id 361 latestRevision: latestRevisionForThread(threadId: $threadId) { 362 id 363 status 364 createdAt 365 thread { 366 id 367 } 368 } 369 revisions( 370 order: [{ createdAt: "DESC" }] 371 first: $first 372 after: $after 373 input: { 374 threadId: $threadId 375 actions: [ 376 CHAT 377 AUTO_SELECT_CHAT 378 DEEP_DEBUGGING 379 EXPERT_SWE 380 DISCUSSION 381 ORCHESTRATOR 382 DELEGATE_TO_SUB_AGENT 383 DESIGN_AGENT 384 INTRODUCE_BUG 385 AGENT_AUTO_SELECT_INTEGRATION 386 FORK_WITH_CHAT_MESSAGE 387 FORK_MODULE_WITH_CHAT_MESSAGE 388 SELECT_INTEGRATION_WITH_CHAT_MESSAGE 389 PUBLISH_PROJECT_AND_CONTINUE_CHAT 390 CHANGE_DESIGN_SYSTEM_AND_CONTINUE_CHAT 391 SAVE_SECRET_AND_CONTINUE_CHAT 392 ADD_AUTH_AND_CONTINUE_CHAT 393 RESTORE 394 PROJECT_FIX_CHANGE 395 PLAN_AGENT 396 ] 397 } 398 ) { 399 totalCount 400 pageInfo { 401 hasNextPage 402 hasPreviousPage 403 endCursor 404 startCursor 405 } 406 edges { 407 node { 408 ...ProjectGroupRevisionForChat 409 } 410 } 411 } 412 } 413 } 414`),I=({cache:e,cacheThreadId:t,projectGroupId:r})=>{let a=e.readQuery({query:j,variables:{projectGroupId:r,threadId:t,first:y.ft}});if(!a?.projectGroupById)return;let n=a.projectGroupById.latestRevision;n&&e.writeQuery({query:j,variables:{projectGroupId:r,threadId:t,first:y.ft},data:{projectGroupById:{...a.projectGroupById,latestRevision:{...n,status:d.ProjectGroupRevisionStatus.INVALID},revisions:{...a.projectGroupById.revisions,edges:a.projectGroupById.revisions.edges.map(e=>e.node.id===n.id?{...e,node:{...e.node,status:d.ProjectGroupRevisionStatus.INVALID}}:e)}}}})},w=(0,v.U)(` 415 query ChatUsageByOrganizationId($organizationId: ID!) { 416 organizationById(id: $organizationId) { 417 id 418 plan 419 chatLimits { 420 window 421 count 422 limit 423 hasReachedLimit 424 } 425 hasReachedChatCreditsLimit 426 subscriptionStartDate 427 creditBalance 428 planCredits 429 integrationCreditStatus { 430 allowed 431 code 432 retryAfterSeconds 433 } 434 } 435 } 436`),N=(0,v.U)(` 437 mutation CancelLatestInflightRevisionForThread( 438 $input: CancelLatestInflightRevisionForThreadInput! 439 ) { 440 cancelLatestInflightRevisionForThread(input: $input) { 441 success 442 projectGroup { 443 id 444 } 445 thread { 446 id 447 } 448 } 449 } 450`),T=(0,v.U)(` 451 mutation CancelLatestInflightRevision( 452 $input: CancelLatestInflightRevisionInput! 453 ) { 454 cancelLatestInflightRevision(input: $input) { 455 success 456 projectGroup { 457 id 458 } 459 } 460 } 461`),E=(0,v.U)(` 462 mutation GenerateProjectGroupRevisionFromChat( 463 $input: GenerateProjectGroupRevisionFromChatInput! 464 ) { 465 generateProjectGroupRevisionFromChat(input: $input) { 466 success 467 projectGroupRevision { 468 id 469 ...ProjectGroupRevisionForChat 470 thread { 471 ...ThreadForProjectGroupChat 472 } 473 } 474 askForUserProfileInfo 475 errors { 476 kind 477 message 478 } 479 } 480 } 481`),S=(0,v.U)(` 482 mutation EnqueueMessageForGeneration( 483 $input: EnqueueMessageForGenerationInput! 484 ) { 485 enqueueMessageForGeneration(input: $input) { 486 success 487 queuedMessage { 488 id 489 content 490 position 491 } 492 } 493 } 494`),_=(0,v.U)(` 495 mutation CancelQueuedMessage($input: CancelQueuedMessageInput!) { 496 cancelQueuedMessage(input: $input) 497 } 498`),k=()=>{let{id:e,organizationId:t}=(0,i.MN)(),r=(0,u.jt)(),[y,v]=(0,x.n)(E),[j]=(0,x.n)(T),[k]=(0,x.n)(N),C=(0,a.nZ)(({value:e})=>e.viewingModuleId),R=(0,a.nZ)(e=>e.supportsErrorDetected),A=(0,l.eE)(e=>e.setHasSubmittedChat),G=(0,c.L)(({value:e})=>e.preferredGenerationProvider),P=(0,c.L)(e=>e.setIsGenerating),O=(0,c.L)(e=>e.setSubmittingCommand),U=(0,c.L)(e=>e.setChatError),M=(0,g.rl)(),L=(0,g.rV)(),D=(0,o.C)(e=>e.addRevisionId),B=(0,h.useCallback)(async({chat:a,action:i,isThinkingMode:l,attachments:o})=>{let c;A({threadId:M===g.w2?null:M,hasSubmittedChat:!0}),r("Sent chat message",{projectGroupId:e,message:a.length>0?`${a.slice(0,100)}...`:a}),R?f.A.Loading():(0,b.gZ)();let u=M===g.w2?null:M;P({threadId:u,generating:!0});let m=(0,p.a)();(0,s.H5)({clientId:m,command:a});try{c=await y({variables:{input:{projectGroupId:e,content:a,viewingModuleId:C||null,action:i,useExtendedThinking:l,preferredGenerationProvider:"default"===G?null:G,...M===g.
498w2?{createNewThread:!0}:{threadId:M},...o&&o.length>0?{attachments:o}:{}}},update:(t,{data:r})=>{let a=r?.generateProjectGroupRevisionFromChat.projectGroupRevision,i=a?.thread;M===g.w2&&i&&(L(i.id),(0,n.U)({cache:t,projectGroupId:e,thread:i}),P({threadId:null,generating:!1}),P({threadId:i.id,generating:!0})),a&&(D({revisionId:a.id,threadId:a.thread?.id??null}),(0,n.m)({cache:t,projectGroupId:e,revision:a,clientId:m,threadId:M===g.w2?r.generateProjectGroupRevisionFromChat.projectGroupRevision.thread?.id??null:M}))},refetchQueries:[{query:w,variables:{organizationId:t}}]})}catch(e){throw P({threadId:u,generating:!1}),O(null),R?f.A.Error():(0,b.lX)(),e}let x=c.data?.generateProjectGroupRevisionFromChat.projectGroupRevision.id;if(R||(0,b.rc)(),i===d.ProjectGroupRevisionAction.PROJECT_FIX_CHANGE&&f.A.FreeFix(),!x)throw R?f.A.Error():(0,b.lX)(),Error("Failed to generate revision");return{revisionId:x,askForUserProfileInfo:c.data?.generateProjectGroupRevisionFromChat.askForUserProfileInfo??!1,threadId:M===g.w2?c.data?.generateProjectGroupRevisionFromChat.projectGroupRevision.thread?.id??null:M,errors:c.data?.generateProjectGroupRevisionFromChat.errors?.map(e=>e.kind)??[]}},[e,t,r,y,C,A,P,G,M,L,D,R]),$=(0,c.L)(e=>e.addQueuedMessage),F=(0,c.L)(e=>e.removeQueuedMessage),H=(0,c.L)(e=>e.replaceQueuedMessageId),[q]=(0,x.n)(S),[z]=(0,x.n)(_),V=(0,h.useCallback)(async({chat:t})=>{let r=M===g.w2?null:M,a=(0,p.a)();$({threadId:r,message:{id:a,clientId:a,content:t,status:"pending"}});try{let n=await q({variables:{input:{projectGroupId:e,threadId:r,content:t}}}),i=n.data?.enqueueMessageForGeneration?.queuedMessage;if(!i)return F({threadId:r,messageId:a}),null;return H({threadId:r,oldId:a,newId:i.id}),{messageId:i.id}}catch(e){return m.Cp(e),f.A.Error(),F({threadId:r,messageId:a}),null}},[e,M,q,$,F,H]),W=(0,h.useCallback)(async({messageId:t})=>{let r=M===g.w2?null:M;F({threadId:r,messageId:t});try{await z({variables:{input:{projectGroupId:e,threadId:r,messageId:t}}})}catch(e){m.Cp(e),f.A.Error()}},[e,M,z,F]),Y=(0,c.L)(e=>e.clearQueuedMessages),Q=(0,h.useCallback)(async()=>{let t=M===g.w2?null:M;(Y({threadId:t}),A({threadId:t,hasSubmittedChat:!1}),P({threadId:t,generating:!1}),O(null),U(null),r("Cancelled generation",{projectGroupId:e}),R?f.A.Error():(0,b.Eh)(),"string"==typeof M||null===M)?await k({variables:{input:{projectGroupId:e,threadId:M}},optimisticResponse:{__typename:"Mutation",cancelLatestInflightRevisionForThread:{__typename:"CancelLatestInflightRevisionForThreadPayload",success:!0,projectGroup:{__typename:"ProjectGroup",id:e},thread:M?{__typename:"ProjectGroupRevisionThread",id:M}:null}},update:t=>{I({cache:t,cacheThreadId:M,projectGroupId:e})}}):await j({variables:{input:{projectGroupId:e}},optimisticResponse:{__typename:"Mutation",cancelLatestInflightRevision:{__typename:"CancelLatestInflightRevisionPayload",success:!0,projectGroup:{__typename:"ProjectGroup",id:e}}},update:t=>{I({cache:t,cacheThreadId:null,projectGroupId:e})}})},[e,r,j,M,k,A,P,O,U,Y,R]);return{handleChat:B,mutationResult:(0,h.useMemo)(()=>v,[v]),handleCancel:Q,handleEnqueue:V,handleCancelQueuedMessage:W}}},697343:(e,t,r)=>{r.d(t,{M:()=>l,g:()=>o});var a=r(11241),n=r(952712),i=r(388001),s=r(834023);let l=(0,i.A)(),o=e=>{let t,r,i,o=(0,a.c)(9);o[0]===Symbol.for("react.memo_cache_sentinel")?(t=Date.now(),o[0]=t):t=o[0];let[c,d]=(0,s.useState)(t),{handleClearLogs:u,shouldAutoClearLogs:p}=(0,n.o)();o[1]!==u||o[2]!==e||o[3]!==p?(r=()=>{let t=t=>{e?.onRefresh?.(t.isManual),d(Date.now()),p&&u()};return l.on("refreshIframe",t),()=>{l.off("refreshIframe",t)}},o[1]=u,o[2]=e,o[3]=p,o[4]=r):r=o[4];let m=e?.onRefresh;return o[5]!==u||o[6]!==p||o[7]!==m?(i=[m,u,p],o[5]=u,o[6]=p,o[7]=m,o[8]=i):i=o[8],(0,s.useEffect)(r,i),c}},709298:(e,t,r)=>{r.d(t,{A:()=>c});var a=r(294799),n=r(737356),i=r(387631),s=r(57757),l=r(917339);let o="w-[356px] h-[54px] flex flex-row items-center gap-[6px] rounded-[8px] border border-[#2C2D2F] bg-[#18191B] p-[10px] text-[13px] text-white shadow-sm",c={Success:()=>{n.oR.custom(()=>(0,a.jsxs)("div",{className:o,children:[(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20",children:[(0,a.jsx)("title",{children:"Success"}),(0,a.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})]}),(0,a.jsx)("span",{children:"Updated successfully"})]}),{id:i.QY,duration:3e3})},Loading:()=>{n.oR.custom(()=>(0,a.jsxs)("div",{className:(0,l.cn)(o,"px-[12px] py-[10px]"),children:[(0,a.jsx)(s.a9,{className:"h-[14px] w-[14px] bg-white"}),(0,a.jsx)("span",{children:"Updating"})]}),{id:i.QY,duration:1/0})},Error:()=>{n.oR.custom(()=>(0,a.jsxs)("div",{className:o,children:[(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"
498currentColor",height:"20",width:"20",children:[(0,a.jsx)("title",{children:"Error"}),(0,a.jsx)("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})]}),(0,a.jsx)("span",{children:"Update Cancelled"})]}),{id:i.QY,duration:3e3})},FreeFix:()=>{n.oR.custom(()=>(0,a.jsxs)("div",{className:o,children:[(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20",children:[(0,a.jsx)("title",{children:"Free fix"}),(0,a.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})]}),(0,a.jsx)("span",{children:"This fix is free. No credits used."})]}),{id:i.QY,duration:3e3})}}},717864:(e,t,r)=>{r.d(t,{w:()=>x});var a=r(294799),n=r(11241),i=r(917339),s=r(756785),l=r(834023);let o=e=>{let t,r,a,i,s,o=(0,n.c)(13),{x:c,y:d,color:u,as:p,className:m}=e;o[0]===Symbol.for("react.memo_cache_sentinel")?(t=new Date,o[0]=t):t=o[0];let[x,h]=(0,l.useState)(t);o[1]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{let e=()=>h(new Date),t=new Date,r=setTimeout(()=>{e();let t=setInterval(e,6e4);return()=>clearInterval(t)},6e4-(1e3*t.getSeconds()+t.getMilliseconds()));return()=>clearTimeout(r)},a=[],o[1]=r,o[2]=a):(r=o[1],a=o[2]),(0,l.useEffect)(r,a);let g=x.getHours();o[3]!==x?(i=x.getMinutes().toString().padStart(2,"0"),o[3]=x,o[4]=i):i=o[4];let f=i;return o[5]!==p||o[6]!==m||o[7]!==u||o[8]!==g||o[9]!==f||o[10]!==c||o[11]!==d?(s=(0,l.createElement)(p,{x:c,y:d,className:m,..."text"===p?{fontFamily:"SF Pro Text;Inter;sans-serif",fontSize:"18",fill:u,fontWeight:"550"}:{style:{fontFamily:"SF Pro Text, Inter, sans-serif",fontSize:"14px",color:u,fontWeight:"550"}}},`${g%12||12}:${f}`),o[5]=p,o[6]=m,o[7]=u,o[8]=g,o[9]=f,o[10]=c,o[11]=d,o[12]=s):s=o[12],s},c=e=>{let t,r=(0,n.c)(2),{color:i}=e;return r[0]!==i?(t=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M357.022 41.2635C357.022 40.5558 356.477 39.9821 355.806 39.9821H354.59C353.918 39.9821 353.374 40.5558 353.374 41.2635V52.3696C353.374 53.0774 353.918 53.6511 354.59 53.6511H355.806C356.477 53.6511 357.022 53.0774 357.022 52.3696V41.2635ZM348.548 42.7159H349.764C350.436 42.7159 350.98 43.3034 350.98 44.0281V52.3389C350.98 53.0636 350.436 53.6512 349.764 53.6512H348.548C347.877 53.6512 347.332 53.0636 347.332 52.3389V44.0281C347.332 43.3034 347.877 42.7159 348.548 42.7159ZM343.608 45.6775H342.392C341.721 45.6775 341.177 46.2725 341.177 47.0064V52.3222C341.177 53.0561 341.721 53.6511 342.392 53.6511H343.608C344.28 53.6511 344.824 53.0561 344.824 52.3222V47.0064C344.824 46.2725 344.28 45.6775 343.608 45.6775ZM337.567 48.4113H336.351C335.679 48.4113 335.135 48.9978 335.135 49.7213V52.3412C335.135 53.0647 335.679 53.6511 336.351 53.6511H337.567C338.238 53.6511 338.783 53.0647 338.783 52.3412V49.7213C338.783 48.9978 338.238 48.4113 337.567 48.4113Z",fill:i}),(0,a.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M375.342 42.8532C378.177 42.8534 380.904 43.8842 382.959 45.7328C383.114 45.8755 383.361 45.8737 383.513 45.7288L384.992 44.3162C385.07 44.2427 385.113 44.1431 385.112 44.0395C385.111 43.9359 385.067 43.8368 384.989 43.7641C379.596 38.8732 371.088 38.8732 365.694 43.7641C365.616 43.8367 365.572 43.9358 365.571 44.0394C365.571 44.143 365.614 44.2427 365.691 44.3162L367.17 45.7288C367.322 45.874 367.57 45.8758 367.725 45.7328C369.78 43.8841 372.507 42.8532 375.342 42.8532ZM375.34 47.5715C376.887 47.5714 378.379 48.1435 379.526 49.1767C379.681 49.3233 379.926 49.3201 380.077 49.1695L381.544 47.6945C381.622 47.6172 381.665 47.5122 381.664 47.4031C381.662 47.2941 381.617 47.19 381.539 47.1142C378.046 43.8823 372.637 43.8823 369.145 47.1142C369.066 47.19 369.021 47.2941 369.02 47.4032C369.019 47.5123 369.062 47.6173 369.139 47.6945L370.606 49.1695C370.757 49.3201 371.002 49.3233 371.157 49.1767C372.303 48.1442 373.794 47.5721 375.34 47.5715ZM378.215 50.6946C378.217 50.8124 378.175 50.926 378.098 51.0085L375.617 53.7529C375.544 53.8335 375.445 53.8789 375.342 53.8789C375.238 53.8789 375.139 53.8335 375.066 53.7529L372.585 51.0085C372.508 50.9259 372.466 50.8123 372.468 50.6945C372.47 50.5768 372.517 50.4652 372.597 50.3863C374.181 48.9173 376.502 48.9173 378.087 50.3863C378.166 50.4653 378.213 50.5769 378.215 50.6946Z",fill:i}),(0,a.jsx)("rect",{opacity:"0.35",x:"394.121",y:"39.2265",width:"27.3381",height:"13.6691",rx:"4.32854",stroke:i,strokeWidth:"1.13909"}),(0,a.jsx)("path",{opacity:"0.4",d:"M423.054 43.9728V48.5291C423.971 48.1432 424.567 47.2455 424.567 46.251C424.567 45.2564 423.971 44.3587 423.054 43.9728",fill:i}),(0,a.jsx)("rect",{x:"395.83",y:"40.9352",width:"23.9209",height:"10.2518",rx:"2.84772",fill:i})]}),r[0]=i,r[1]=t):t=r[1],t},d=()=>{let e,t=(0,n.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)("rect",{x:"151.098",y:"970.132",width:"173.141",height:"5.69544",rx:"2.84772",fill:"black"}),t[0]=e):e=t[0],e},u=e=>{let t,r=(0,n.c)(2),{color:i}=e;return r[0]!==i?(t=(0,a.jsx)("svg",{viewBox:"333 37 95 19",width:"76",height:"15",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,a.jsx)(c,{color:i})}),r[0]=i,r[1]=t):t=r[1],t},p=e=>{let t,r,s,l,c,d,p,m,x,h,g,f=(0,n.c)(29),{children:b,statusBarColor:y,variant:v}=e,j="phone"===v,I=j?"tablet:aspect-[475/998] tablet:min-h-[min(998px,calc(100vh-300px))] tablet:max-h-[998px] desktop:max-w-[475px] desktop:rounded-[70px] tablet:rounded-[50px] tablet:border-[8px] tablet:border-black":"aspect-[820/1180] min-h-[min(1000px,calc(100vh-300px))] max-w-[820px] rounded-[24px] border-[12px] border-black";f[0]!==I?(t=(0,i.cn)("no-scrollbar relative flex h-full flex-col overflow-x-hidden bg-white",I),f[0]=I,f[1]=t):t=f[1];let w=j?"tablet:flex hidden px-[12%] py-[2.5%]":"flex px-[5%] py-[1.5%]";f[2]!==w?(r=(0,i.cn)("relative flex shrink-0 items-center justify-between",w),f[2]=w,f[3]=r):r=f[3],f[4]!==y?(s=(0,a.jsx)(o,{x:"0",y:"0",color:y,as:"span",className:"ml-[6%] font-semibold"}),f[4]=y,f[5]=s):s=f[5],f[6]!==j?(l=j&&(0,a.jsx)("div",{className:"absolute left-1/2 top-1/2 h-[70%] w-[30%] -translate-x-1/2 -translate-y-1/2 roun
498ded-full bg-black"}),f[6]=j,f[7]=l):l=f[7],f[8]!==y?(c=(0,a.jsx)(u,{color:y}),f[8]=y,f[9]=c):c=f[9],f[10]!==r||f[11]!==s||f[12]!==l||f[13]!==c?(d=(0,a.jsxs)("div",{className:r,children:[s,l,c]}),f[10]=r,f[11]=s,f[12]=l,f[13]=c,f[14]=d):d=f[14],f[15]!==b?(p=(0,a.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:b}),f[15]=b,f[16]=p):p=f[16];let N=j?"tablet:block hidden my-[1%] h-[5px] w-[30%]":"my-[0.8%] h-[4px] w-[24%]";return f[17]!==N?(m=(0,i.cn)("shrink-0 self-center rounded-full",N),f[17]=N,f[18]=m):m=f[18],f[19]!==y?(x={style:{backgroundColor:y}},f[19]=y,f[20]=x):x=f[20],f[21]!==m||f[22]!==x?(h=(0,a.jsx)("div",{className:m,...x}),f[21]=m,f[22]=x,f[23]=h):h=f[23],f[24]!==h||f[25]!==t||f[26]!==d||f[27]!==p?(g=(0,a.jsxs)("div",{className:t,children:[d,p,h]}),f[24]=h,f[25]=t,f[26]=d,f[27]=p,f[28]=g):g=f[28],g},m=e=>{let t,r,s,l,u,p,m,x,h,g,f=(0,n.c)(19),{children:b,statusBarColor:y,className:v}=e;return f[0]!==v?(t=(0,i.cn)("h-full max-h-[1180px] max-w-[820px] aspect-[820/1180]",v,"flex-none"),f[0]=v,f[1]=t):t=f[1],f[2]!==b?(r=(0,a.jsx)("g",{className:"[clip-path:url('#clip_tablet_frame')]",children:(0,a.jsx)("foreignObject",{x:"0",y:"0",width:"820",height:"1180",fill:"white",children:b})}),f[2]=b,f[3]=r):r=f[3],f[4]!==y?(s=(0,a.jsx)(o,{x:"45",y:"42",color:y,as:"text",className:null}),f[4]=y,f[5]=s):s=f[5],f[6]!==y?(l=(0,a.jsx)("svg",{x:"700",y:"20",width:"90",height:"22",viewBox:"333 36 92 22",fill:"none",children:(0,a.jsx)(c,{color:y})}),f[6]=y,f[7]=l):l=f[7],f[8]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsx)("svg",{x:"260",y:"1147",width:"300",height:"7",viewBox:"151.098 970.132 173.141 5.69544",children:(0,a.jsx)(d,{})}),p=(0,a.jsx)("rect",{x:"8",y:"8",width:"804",height:"1164",rx:"20",stroke:"black",strokeWidth:"8"}),m=(0,a.jsx)("rect",{x:"3",y:"3",width:"814",height:"1174",rx:"24",stroke:"black",strokeWidth:"6"}),f[8]=u,f[9]=p,f[10]=m):(u=f[8],p=f[9],m=f[10]),f[11]===Symbol.for("react.memo_cache_sentinel")?(x=(0,a.jsx)("defs",{children:(0,a.jsx)("clipPath",{id:"clip_tablet_frame",children:(0,a.jsx)("rect",{x:"9",y:"9",width:"802",height:"1162",rx:"16",fill:"white"})})}),f[11]=x):x=f[11],f[12]!==r||f[13]!==s||f[14]!==l?(h=(0,a.jsxs)("svg",{viewBox:"0 0 820 1180",className:"h-full w-full overflow-hidden",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"Tablet Frame",children:[r,s,l,u,p,m,x]}),f[12]=r,f[13]=s,f[14]=l,f[15]=h):h=f[15],f[16]!==t||f[17]!==h?(g=(0,a.jsx)("div",{className:t,children:h}),f[16]=t,f[17]=h,f[18]=g):g=f[18],g},x=e=>{let t,r,l,u,x,h,g,f=(0,n.c)(28),{children:b,statusBarColor:y,className:v,variant:j}=e,I=void 0===v?null:v,w="phone"===j,N=navigator?.vendor&&(/apple/i.test(navigator.vendor)||/firefox/i.test(navigator.userAgent));if(w&&N){let e;return f[0]!==b||f[1]!==y?(e=(0,a.jsx)(p,{statusBarColor:y,variant:"phone",children:b}),f[0]=b,f[1]=y,f[2]=e):e=f[2],e}if("tablet"===j){let e;return f[3]!==b||f[4]!==I||f[5]!==y?(e=(0,a.jsx)(m,{statusBarColor:y,className:I,children:b}),f[3]=b,f[4]=I,f[5]=y,f[6]=e):e=f[6],e}f[7]!==w?(t=w?{x:"13.6691",y:"13.6691",width:"447.662",height:"970.504",rx:"66.0671"}:{x:"0",y:"0",width:"100%",height:"100%",className:"flex justify-items-center"},f[7]=w,f[8]=t):t=f[8];let T=t;f[9]!==I||f[10]!==w?(r=w?{viewBox:s.We,className:(0,i.cn)("max-h-[998px] max-w-[475px] overflow-hidden",I)}:{className:(0,i.cn)("flex w-full",I)},f[9]=I,f[10]=w,f[11]=r):r=f[11];let E=w&&!N?"[clip-path:url('#clip0_11662_1408')]":"[clip-path:none]";return f[12]!==b||f[13]!==T?(l=(0,a.jsx)("foreignObject",{...T,fill:"white",children:b}),f[12]=b,f[13]=T,f[14]=l):l=f[14],f[15]!==E||f[16]!==l?(u=(0,a.jsx)("g",{className:E,children:l}),f[15]=E,f[16]=l,f[17]=u):u=f[17],f[18]!==w||f[19]!==y?(x=w&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o,{x:"78",y:"53",color:y,as:"text",className:null}),(0,a.jsx)(d,{}),(0,a.jsx)(c,{color:y})]}),f[18]=w,f[19]=y,f[20]=x):x=f[20],f[21]!==w?(h=w&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("rect",{x:"164.598",y:"26.575",width:"142.386",height:"41.7704",rx:"20.8852",fill:"black"}),(0,a.jsx)("rect",{x:"9.68226",y:"9.68226",width:"455.635",height:"978.477",rx:"70.054",stroke:"black",strokeWidth:"9.97362"}),(0,a.jsx)("rect",{x:"2.84771",y:"2.84771",width:"469.305",height:"992.146",rx:"76.8885",stroke:"black",strokeWidth:"5.69544"}),(0,a.jsx)("defs",{children:(0,a.jsx)("clipPath",{id:"clip0_11662_1408",children:(0,a.jsx)("rect",{x:"13.6691",y:"13.6691",width:"447.662",he
498ight:"970.504",rx:"66.0671",fill:"white"})})})]}),f[21]=w,f[22]=h):h=f[22],f[23]!==r||f[24]!==u||f[25]!==x||f[26]!==h?(g=(0,a.jsxs)("svg",{...r,fill:"none",xmlns:"http://www.w3.org/2000/svg",height:"100%",width:"100%",children:[u,x,h]}),f[23]=r,f[24]=u,f[25]=x,f[26]=h,f[27]=g):g=f[27],g}},756785:(e,t,r)=>{r.d(t,{We:()=>i,e$:()=>s,h:()=>n,wO:()=>a});let a=475,n=998,i=`0 0 ${a} ${n}`,s={x:13.6691,y:13.6691,width:447.662,height:970.504,rx:66.0671}},768129:(e,t,r)=>{r.d(t,{HR:()=>o,g8:()=>s,mT:()=>l});var a=r(232726),n=r(451286),i=r(412923);let s=(0,a.v)()((0,i.Zr)(e=>({soundEnabled:!1,notificationEnabled:!1,setSoundEnabled:t=>e({soundEnabled:t}),setNotificationEnabled:t=>e({notificationEnabled:t})}),{name:"generation-notification-preferences"}));async function l(){return"u"<typeof Notification?"denied":Notification.requestPermission()}function o(){let{soundEnabled:e,notificationEnabled:t}=s.getState();e&&new Audio("/completed.mp3").play().catch(e=>{n.Cp(e)}),t&&(!document.hidden||"u"<typeof Notification||"granted"===Notification.permission&&new Notification("Generation complete",{body:"Your app has been updated successfully.",icon:"/notification-icon.png"}))}},771768:(e,t,r)=>{r.d(t,{o:()=>n});var a=r(400642);let n=({revisions:e})=>{let t=new Map(e.map(e=>[e.id,e.project]));return(0,a.nu)({revisions:e}).map(({id:e,implementation:r,name:a})=>{let n=t.get(e);if(!n)throw Error(`Project id not found for revision ${e}`);return{code:r,name:n.name,projectId:n.id,revisionId:e,aliasRenderName:a}})}},791176:(e,t,r)=>{r.d(t,{e:()=>a});let a=(0,r(232726).v)()(e=>({isExpanded:!1,size:4.5,setExpanded:t=>e({isExpanded:t}),setSize:t=>e({size:t}),toggle:()=>e(e=>({isExpanded:!e.isExpanded,size:e.isExpanded?4.5:30})),open:()=>e({isExpanded:!0,size:30})}))},793376:(e,t,r)=>{r.d(t,{a:()=>u});var a=r(11241),n=r(125695),i=r(359878),s=r(33031),l=r(451286),o=r(834023),c=r(829307);async function d({response:e,extra:t}){let r;try{r=await e.text()}catch{r="[could not read body]"}l.Cp(Error("Failed to validate dev server domain"),{extra:{...t,status:e.status,body:r}})}function u(e){let t,r,l,u,x=(0,a.c)(13),{organizationPlan:h,projectGroupId:g,projectGroupRevisionId:f,server:b,environment:y}=e,[v,j]=(0,c.i7)("devServerDomain",""),[I,w]=(0,o.useState)(v||null);x[0]!==y||x[1]!==g||x[2]!==f||x[3]!==b?(t=async e=>{let t=g||f,r=e.includes("localhost")?"http":"https",a=t?(0,i.e)({projectGroupId:g,projectGroupRevisionId:f,server:b,pathname:"/",devServerDomain:e,environment:y}):`${r}://${e}/`;try{let t=await fetch(a,{method:"HEAD",headers:{[s.DEV_SERVER_HEALTH_CHECK_HEADER]:"1"}});return t.ok||await d({response:t,extra:{domain:e,projectGroupId:g,url:a}}),t.ok}catch{return!1}},x[0]=y,x[1]=g,x[2]=f,x[3]=b,x[4]=t):t=x[4];let N=t;x[5]!==h||x[6]!==j||x[7]!==v||x[8]!==N?(r=async()=>{if(v&&await N(v))return w(v),v;for(let e of(h&&(0,s.isPaidPlan)(h)?n.Ay.NEXT_PUBLIC_PAID_DEV_SERVER_DOMAINS:n.Ay.NEXT_PUBLIC_DEV_SERVER_DOMAINS).split(",").map(m))if(e&&await N(e))return j(e),w(e),e;let e=n.Ay.NEXT_PUBLIC_DEV_SERVER_DOMAIN;return await N(e)?(j(e),w(e),e):(w(null),null)},x[5]=h,x[6]=j,x[7]=v,x[8]=N,x[9]=r):r=x[9];let T=r;return x[10]!==T?(l=()=>{T().catch(p)},u=[T],x[10]=T,x[11]=l,x[12]=u):(l=x[11],u=x[12]),(0,o.useEffect)(l,u),I}function p(e){l.Cp(e)}function m(e){return e.trim()}},814394:(e,t,r)=>{r.d(t,{m:()=>y});let a=e=>e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'");var n=r(33031),i=r(912857),s=r(451286);let l=i.L5().transform(e=>"string"==typeof e?a(e):""),o=i.L5().transform(e=>"string"==typeof e&&a(e)||void 0),c=i.L5().transform(e=>{if("number"==typeof e)return e;if("string"==typeof e){let t=Number(a(e));return Number.isNaN(t)?void 0:t}}),d=i.L5().transform(e=>"boolean"==typeof e?e:"string"==typeof e?"true"===a(e):void 0),u=i.Ik({device:i.fc(n.PreviewDevice),url:i.Yj()}),p=i.L5().transform(e=>{if("string"==typeof e)try{let t=JSON.parse(a(e));return i.YO(u).parse(t)}catch{return}}),m=i.Ik({id:i.Yj(),createdAt:i.Yj(),action:i.Yj(),content:i.Yj()}),x=i.L5().transform(e=>{if("string"==typeof e)try{let t=JSON.parse(a(e));return i.YO(m).parse(t)}catch{return}}),h=i.Ik({id:i.Yj(),content:i.Yj(),status:i.k5(["pending","in_progress","completed"])}),g=i.L5().transform(e=>{if("string"==typeof e)try{let t=a(e);if(!t||"[]"===t)return;let r=JSON.parse(t);return i.YO(h).parse(r)}catch{return}}),f=i.Ik({uiType:l.pipe(i.fc(n.UIBlockType)),status:o.pipe(i.fc(n.ToolCallTagStatus).optional()),text:l,subtext:l,code:o,domains:l,thinkingType:o.pipe(i.fc(n.ThinkingType).optional()),toolCallId:o,browserLiveUrl:o,browserSize:o.pipe(i.fc(n.BrowserSize).optional()),browserReplayUrl:o,browserCurrentUrl:o,simulatorWebrtcUrl:o,simulatorToken:o,simulatorPlatform:o.pipe(i.fc(n.SimulatorPlatform).optional()),simulatorReplayUrl:o,simulatorLastActionType:o.pipe(i.fc(n.SimulatorActionType).optional()),simulatorLastActionX:c,simulatorLastActionY:c,simulatorLastActionEndX:c,simulatorLastActionEndY:c,updates:p,revisions:x,suggestedRevisionId:o,cancellable:d.transform(e=>
498e??!1),progress:c,isBackground:d.transform(e=>e??!1),todos:g,timeoutMs:c,truncated:d}).transform(e=>{let t=e.browserLiveUrl??e.browserSize??e.browserReplayUrl??e.browserCurrentUrl?{liveUrl:e.browserLiveUrl,size:e.browserSize,replayUrl:e.browserReplayUrl,currentUrl:e.browserCurrentUrl}:void 0,r=e.simulatorLastActionType?{type:e.simulatorLastActionType,x:e.simulatorLastActionX,y:e.simulatorLastActionY,endX:e.simulatorLastActionEndX,endY:e.simulatorLastActionEndY}:null,a=e.simulatorWebrtcUrl??e.simulatorToken??e.simulatorPlatform??e.simulatorReplayUrl??e.simulatorLastActionType?{webrtcUrl:e.simulatorWebrtcUrl,token:e.simulatorToken,platform:e.simulatorPlatform,replayUrl:e.simulatorReplayUrl,lastAction:r}:void 0;return{uiType:e.uiType,status:e.status,text:e.text,subtext:e.subtext,code:e.code,domains:e.domains,thinkingType:e.thinkingType,toolCallId:e.toolCallId,browser:t,simulator:a,updates:e.updates,revisions:e.revisions,suggestedRevisionId:e.suggestedRevisionId,cancellable:e.cancellable,progress:e.progress,isBackground:e.isBackground,todos:e.todos,timeoutMs:e.timeoutMs,truncated:e.truncated}}),b={uiType:n.UIBlockType.FILE,text:"",subtext:"",domains:"",cancellable:!1,isBackground:!1};function y(e){if(!e)return b;let t=f.safeParse({uiType:e.uiType,status:e.status,text:e.text,subtext:e.subtext,code:e.code,domains:e.domains,thinkingType:e.thinkingType,toolCallId:e.id,browserLiveUrl:e.browserLiveUrl,browserSize:e.browserSize,browserReplayUrl:e.browserReplayUrl,browserCurrentUrl:e.browserCurrentUrl,simulatorWebrtcUrl:e.simulatorWebrtcUrl,simulatorToken:e.simulatorToken,simulatorPlatform:e.simulatorPlatform,simulatorReplayUrl:e.simulatorReplayUrl,simulatorLastActionType:e.simulatorLastActionType,simulatorLastActionX:e.simulatorLastActionX,simulatorLastActionY:e.simulatorLastActionY,simulatorLastActionEndX:e.simulatorLastActionEndX,simulatorLastActionEndY:e.simulatorLastActionEndY,updates:e.updates,revisions:e.revisions,suggestedRevisionId:e.suggestedRevisionId,cancellable:e.cancellable,progress:e.progress,isBackground:e.isBackground,todos:e.todos,timeoutMs:e.timeoutMs,truncated:e.truncated});return t.success?t.data:(s.Cp(t.error,{extra:{args:e}}),b)}},850594:(e,t,r)=>{r.d(t,{E:()=>i}),r(976413),r(718881);var a=r(917339),n=r(294799);function i({className:e,...t}){return(0,n.jsx)("div",{"aria-hidden":"true",className:(0,a.cn)("animate-pulse rounded-md bg-muted",e),...t})}},863349:(e,t,r)=>{r.d(t,{Id:()=>S,JE:()=>E});var a=r(294799),n=r(11241),i=r(127167),s=r(555246),l=r(233888),o=r(917339),c=r(103967),d=r(971288),u=r(451286),p=r(834023),m=r(430210),x=r(244893),h=r(982027),g=r(910189),f=r(751355),b=r(814121),y=r(510822);let v=(0,f.U)(` 499 mutation ForkModuleFromChat($input: ForkModuleFromChatInput!) { 500 forkModuleFromChat(input: $input) { 501 success 502 projectGroupRevision { 503 id 504 ...ProjectGroupRevisionForChat 505 } 506 } 507 } 508`),j=(0,f.U)(` 509 query GetModulesByTag($first: Int, $after: String, $tag: String) { 510 publicProjects( 511 first: $first 512 after: $after 513 input: { 514 kind: TAGGED 515 sortOption: MOST_POPULAR 516 tag: $tag 517 moduleType: FUNCTION 518 } 519 ) { 520 pageInfo { 521 hasNextPage 522 hasPreviousPage 523 endCursor 524 startCursor 525 } 526 edges { 527 node { 528 ...ModuleDataForChat 529 } 530 } 531 } 532 } 533`),I=(0,f.U)(` 534 query GetSelectedModuleForChat($id: ID!) { 535 publicProjectRevisionById(id: $id) { 536 id 537 publicProject { 538 ...ModuleDataForChat 539 } 540 } 541 } 542`),w=e=>{let t,r,i,s,l,d,u,p,m,x=(0,n.c)(24),{name:h,description:g,previewURLs:f,iconURL:b}=e,y=f.length;x[0]!==g||x[1]!==b?(t=b?(0,a.jsx)("img",{src:b,className:"h-[40px] w-[40px] rounded-[4px]",alt:g??"icon"}):null,x[0]=g,x[1]=b,x[2]=t):t=x[2],x[3]!==h?(r=(0,a.jsx)(c.E,{type:"body-md",weight:"medium",className:"w-full overflow-hidden truncate text-ellipsis whitespace-nowrap",children:h}),x[3]=h,x[4]=r):r=x[4];let v=g??" ";x[5]!==v?(i=(0,a.jsx)(c.E,{type:"body-md",className:"w-full overflow-hidden truncate text-ellipsis whitespace-nowrap text-comeback-gray-500",children:v}),x[5]=v,x[6]=i):i=x[6],x[7]!==r||x[8]!==i?(s=(0,a.jsxs)("div",{className:"flex w-full flex-col gap-0 overflow-hidden",children:[r,i]}),x[7]=r,x[8]=i,x[9]=s):s=x[9],x[10]!==t||x[11]!==s?(l=(0,a.jsxs)("div",{className:"flex flex-row gap-[12px]",children:[t,s]}),x[10]=t,x[11]=s,x[12]=l):l=x[12];let j=!f.length&&"hidden";return x[13]!==j?(d=(0,o.cn)("flex min-h-[150px] w-full flex-row gap-[4px]",j),x[13]=j,x[14]=d):d=x[14],x[15]!==y||x[16]!==f?(u=f.slice(0,2).map(e=>(0,a.jsx)("div",{className:(0,o.cn)("rounded-[4px] bg-center bg-cover",{"bg-comeback-gray-100":!e,"aspect-video h-[150px] w-full":1===y,"aspect-square h-[150px] w-[150px]":1!==y}),style:f?{backgroundImage:`url('${e}')`}:{}},e)),x[15]=y,x[16]=f,x[17]=u):u=x[17],x[18]!==d||x[19]!==u?(p=(0,a.jsx)("div",{className:d,children:u}),x[18]=d,x[19]=u,x[20]=p):p=x[20],x[21]!==p||x[22]!==l?(m=(0,a.jsxs)("div",{className:"flex w-[328px] shrink-0 flex-col justify-start gap-[12px] rounded-[8px] border border-comeback-gray-75 p-[12px] text-left text-body-sm text-comeback-gray-900",children:[l,p]}),x[21]=p,x[22]=l,x[23]=m):m=x[23],m},N=()=>{let e,t,r=(0,n.c)(2);return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsxs)("div",{className:"flex w-full flex-col gap-[2px] overflow-hidden",children:[(0,a.jsx)("div",{className:"h-[18px] w-[75%] animate-pulse bg-comeback-gray-100"}),(0,a.jsx)("div",{className:"h-[14px] w-[50%] animate-pulse bg-comeback-gray-100"})]}),r[0]=e):e=r[0],r[1]===Symbol.for("react.memo_cache_sentinel")?(t=(0,a.jsxs)("div",{className:"flex w-[328px] shrink-0 flex-col justify-start gap-[12px] rounded-[8px] border border-comeback-gray-75 p-[12px] text-left text-body-sm text-comeback-gray-900",children:[e,(0,a.jsx)("div",{className:"flex min-h-[150px] w-full flex-row gap-[4px]",children:Array.from({length:2}).map(_)})]}),r[1]=t):t=r[1],t},T=e=>{let t,r,i,s,l=(0,n.c)(14),{name:c,description:u,previewURLs:m,onPress:x,isDisabled:h,iconURL:g}=e,f=(0,p.useRef)(null);l[0]!==h||l[1]!==x?(t={onPress:x,isDisabled:h},l[0]=h,l[1]=x,l[2]=t):t=l[2];let{buttonProps:b}=(0,d.s)(t,f),y=!h&&"hover:bg-comeback-gray-25 aria-pressed:bg-comeback-gray-50";return l[3]!==y?(r=(0,o.cn)("rounded-[8px] outline-none",y),l[3]=y,l[4]=r):r=l[4],l[5]!==u||l[6]!==g||l[7]!==c||l[8]!==m?(i=(0,a.jsx)(w,{name:c,description:u,previewURLs:m,iconURL:g}),l[5]=u,l[6]=g,l[7]=c,l[8]=m,l[9]=i):i=l[9],l[10]!==b||l[11]!==r||l[12]!==i?(s=(0,a.jsx)("button",{...b,className:r,children:i}),l[10]=b,l[11]=r,l[12]=i,l[13]=s):s=l[13],s},E=e=>{let t,r,c,d,u,f=(0,n.c)(20),{tag:I,className:w,isDisabled:N,delayMs:E}=e,[S,_]=(0,b.n)(v),{called:U}=_,M=(0,i.MN)().id,L=(0,g.eE)(k),D=(0,s.jt)(),B=(0,x.rl)(),$=(0,h.C)(C);f[0]!==S||f[1]!==M||f[2]!==L||f[3]!==$||f[4]!==B||f[5]!==D?(t=e=>{let t=(0,l.a)();D("Forked module from chat",{projectGroupId:M,moduleId:e}),S({variables:{input:{projectGroupId:M,moduleId:e}},update:(e,r)=>{let{data:a}=r,n=a?.forkModuleFromChat.projectGroupRevision;n&&($({revisionId:n.id,threadId:n.thread?.id??null}
542),(0,m.m)({cache:e,projectGroupId:M,revision:n,clientId:t,threadId:B===x.w2?a.forkModuleFromChat.projectGroupRevision.thread?.id??null:B}),L?.())}}).catch(R)},f[0]=S,f[1]=M,f[2]=L,f[3]=$,f[4]=B,f[5]=D,f[6]=t):t=f[6];let F=t;f[7]!==I?(r={variables:{tag:I,first:100}},f[7]=I,f[8]=r):r=f[8];let{data:H,loading:q}=(0,y.I)(j,r),z=H?.publicProjects?.edges.map(A)??[],[V,W]=(0,p.useState)(void 0===E),Y=z.flatMap(G);(0,p.useEffect)(()=>{if(void 0!==E){Y.forEach(P);let e=setTimeout(()=>{W(!0)},E);return()=>{clearTimeout(e)}}},[E,Y]);let Q=N||U,X=void 0!==E&&"animate-fade-in-bottom",K=V?Q?"opacity-40":"opacity-100":"pointer-events-none hidden opacity-0";f[9]!==w||f[10]!==X||f[11]!==K?(c=(0,o.cn)("flex snap-x snap-mandatory flex-row flex-nowrap gap-[12px] overflow-x-auto transition-opacity",w,X,K),f[9]=w,f[10]=X,f[11]=K,f[12]=c):c=f[12];let J=q&&0===z.length&&Array.from({length:3}).map(O);f[13]!==Q||f[14]!==F?(d=e=>{let{id:t,name:r,marketingDescription:n,marketingImageURLs:i,marketingIconURL:s}=e;return(0,a.jsx)(T,{name:r,description:n??"",previewURLs:i??[],iconURL:s??null,onPress:()=>{F(t)},isDisabled:Q},t)},f[13]=Q,f[14]=F,f[15]=d):d=f[15];let Z=z.map(d);return f[16]!==c||f[17]!==J||f[18]!==Z?(u=(0,a.jsxs)("div",{className:c,children:[J,Z]}),f[16]=c,f[17]=J,f[18]=Z,f[19]=u):u=f[19],u},S=e=>{let t,r,i,s,l,c=(0,n.c)(16),{id:d,className:u}=e;c[0]!==d?(t={variables:{id:d}},c[0]=d,c[1]=t):t=c[1];let{data:p,loading:m}=(0,y.I)(I,t);if(m){let e;return c[2]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)(N,{}),c[2]=e):e=c[2],e}c[3]!==u?(r=(0,o.cn)("flex cursor-default snap-x snap-mandatory flex-row flex-nowrap gap-[12px] overflow-x-auto rounded-[8px]",u),c[3]=u,c[4]=r):r=c[4];let x=p?.publicProjectRevisionById.publicProject?.name??"",h=p?.publicProjectRevisionById.publicProject?.marketingIconURL??null,g=p?.publicProjectRevisionById.publicProject.marketingDescription??null;return c[5]!==p?.publicProjectRevisionById.publicProject?.marketingImageURLs?(i=p?.publicProjectRevisionById.publicProject?.marketingImageURLs??[],c[5]=p?.publicProjectRevisionById.publicProject?.marketingImageURLs,c[6]=i):i=c[6],c[7]!==d||c[8]!==x||c[9]!==h||c[10]!==g||c[11]!==i?(s=(0,a.jsx)(w,{name:x,iconURL:h,description:g,previewURLs:i},d),c[7]=d,c[8]=x,c[9]=h,c[10]=g,c[11]=i,c[12]=s):s=c[12],c[13]!==r||c[14]!==s?(l=(0,a.jsx)("div",{className:r,children:s}),c[13]=r,c[14]=s,c[15]=l):l=c[15],l};function _(e,t){return(0,a.jsx)("div",{className:(0,o.cn)("aspect-square h-[150px] w-[150px] animate-pulse rounded-[4px] bg-center bg-comeback-gray-100 bg-cover")},t)}function k(e){return e.actions?.scrollToEnd}function C(e){return e.addRevisionId}function R(e){u.Cp(e)}function A(e){return e.node}function G(e){return e.marketingImageURLs??[]}function P(e){new Image().src=e}function O(e,t){return(0,a.jsx)(N,{},t)}},875457:(e,t,r)=>{r.d(t,{G:()=>c,b:()=>o});var a=r(294799),n=r(11241),i=r(449259),s=r(917339),l=r(85694);let o=e=>{let t,r,i=(0,n.c)(6),{isDisabled:l,className:o,children:c}=e,d=l&&"pointer-events-none opacity-40";return i[0]!==o||i[1]!==d?(t=(0,s.cn)("flex snap-x snap-mandatory flex-row tablet:flex-wrap flex-nowrap gap-[12px] overflow-x-auto",d,o),i[0]=o,i[1]=d,i[2]=t):t=i[2],i[3]!==c||i[4]!==t?(r=(0,a.jsx)("div",{className:t,children:c}),i[3]=c,i[4]=t,i[5]=r):r=i[5],r},c=e=>{let t,r,s=(0,n.c)(7),{children:o,onPress:c,isDisabled:d,tooltip:u}=e;return s[0]!==o||s[1]!==d||s[2]!==c?(t=(0,a.jsx)(l.q,{onPress:c,disabled:d,children:o}),s[0]=o,s[1]=d,s[2]=c,s[3]=t):t=s[3],s[4]!==t||s[5]!==u?(r=(0,a.jsx)(i._u,{isInstant:!0,content:u,children:t}),s[4]=t,s[5]=u,s[6]=r):r=s[6],r}},904230:(e,t,r)=>{function a(e){let t=[],r=e.match(/files?\s*:\s*(.+)/gi);if(r)for(let e of r){let r=e.replace(/^files?\s*:\s*/i,"").match(/`([^`]+)`/g);if(r)for(let e of r)t.push(e.replace(/`/g,""))}if(!e.match(/```[\s\S]*?```/g)){let r=e.match(/`([^`\s]+\.[a-zA-Z]{1,10})`/g);if(r)for(let e of r){let r=e.replace(/`/g,"");(r.includes("/")||r.includes("."))&&!t.includes(r)&&t.push(r)}}return t}function n(e,t){let r=e.split("\n").map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith("|")&&!e.startsWith("```")&&!e.match(/^files?\s*:/i)).map(e=>e.replace(/^[-*]\s+/,"").replace(/^\d+\.\s+/,"")).join(" ").replace(/`([^`]+)`/g,"$1");if(r.length<=t)return r;let a=r.match(/[^.!?]+[.!?]+/g);if(!a)return r.slice(0,t).trim()+"â¦";let n="";for(let e of a){if(n.length+e.length>t)break;n+=e}return n.trim()||r.slice(0,t).trim()+"â¦"}function i(e){return e.split("\n").filter(e=>!e.trim().match(/^files?\s*:/i)).join("\n").trim()}r.d(t,{Q:()=>h});let s=/<plan_title>([\s\S]*?)<\/plan_title>/,l=/<plan_step\s+title="([^"]*)"[^>]*>/g,o=/<\/plan_step>\s*$/,c=[/^overview$/i,/^project\s+overview$/i,/^context\s+requirements?$/i,/^technical\s+(details|specifications?)$/i,/^ui\/?ux\s+requirements?$/i,/^integration\s+considerations?$/i,/^testing(\s+and\s+quality\s+assurance)?$/i,/^(potential\s+)?challenges?(\s+and\s+mitigations?)?$/i,/^risks?$/i,/^summary$/i,/^implementation\s+plan$/i];function d(e){return e.replace(/^(phase|step)\s+\d+\s*[:.)\-ââ]\s*/i,"").replace(/^\d+\s*[:.)\-ââ]\s*/,"").trim()}let u=/^(phase|step)\s+\d+/i,p=/^\d+[.)]/,m=/\(optional\)/i;function x(e,t,r){return e.slice(t,r).join("\n")}function h(e){return/<plan_step\s/.test(e)?function(e){let t,r=e.match(s),c=r?.[1]?.trim()??"Implementation Plan",d=RegExp(l.source,"g"),u=[];for(;null!==(t=d.exec(e));)u.push({title:t[1]??"",tagStart:t.index,contentStart:t.index+t[0].length});if(0===u.length)return null;let p=[];for(let t=0;t<u.length;t++){let r=u[t];if(!r)continue;let s=u[t+1],l=s?s.tagStart:e.length,c=e.slice(r.contentStart,l).replace(o,"");p.push(function(e,t){let r=t.trim();return{title:e,description:n(r,200),content:i(r),files:a(r)}}(r.title,c))}if(0===p.length)return null;let m=[...new Set(p.flatMap(e=>e.files))];
542return{title:c,steps:p,allFiles:m}}(e):function(e){let t=e.split("\n"),r=function(e){let t=[];for(let r=0;r<e.length;r++){let a=e[r]?.match(/^(#{1,6})\s+(.+)/);if(!a)continue;let n=a[1],i=a[2];n&&i&&t.push({level:n.length,title:i.trim(),lineIndex:r})}return t}(t);if(0===r.length)return null;let s="Implementation Plan",l=r.find(e=>1===e.level);l&&(s=l.title);let o=r.filter(e=>{let t;return t=e.title.trim(),u.test(t)||p.test(t)||m.test(t)});if(o.length>0){let e=o[0]?.level??2,l=[];for(let s=0;s<o.length;s++){let c=o[s];if(!c)continue;let u=r.find(t=>t.lineIndex>c.lineIndex&&t.level<=e),p=u?.lineIndex??t.length,m=x(t,c.lineIndex+1,p);l.push({title:d(c.title),description:n(m,200),content:i(m),files:a(m)})}if(0===l.length)return null;let c=[...new Set(l.flatMap(e=>e.files))];return{title:s,steps:l,allFiles:c}}let h=r.filter(e=>e.level>1);if(0===h.length)return null;let g=h[0]?.level??2,f=h.filter(e=>e.level===g),b=[];for(let e=0;e<f.length;e++){let s=f[e];if(!s||function(e){return c.some(t=>t.test(e.trim()))}(s.title))continue;let l=r.find(e=>e.lineIndex>s.lineIndex&&e.level<=g),o=l?.lineIndex??t.length,u=x(t,s.lineIndex+1,o);b.push({title:d(s.title),description:n(u,200),content:i(u),files:a(u)})}if(0===b.length)return null;let y=[...new Set(b.flatMap(e=>e.files))];return{title:s,steps:b,allFiles:y}}(e)}},910189:(e,t,r)=>{r.d(t,{RB:()=>w,Sl:()=>T,UB:()=>N,eE:()=>j,qx:()=>E,wN:()=>I,xK:()=>S});var a=r(883690),n=r(35279),i=r(33031),s=r(834023),l=r(232726),o=r(648803),c=r(127167),d=r(697343),u=r(751355),p=r(510822),m=r(994503);let x=(0,u.U)(` 543 subscription GetModulesCreatedForProjectGroup($id: ID!) { 544 projectGroupModulesCreated(id: $id) { 545 id 546 moduleIds 547 } 548 } 549`),h=(0,u.U)(` 550 subscription GetDatabasesCreatedForProjectGroup($id: ID!) { 551 projectGroupDatabasesCreated(id: $id) { 552 id 553 databaseIds 554 } 555 } 556`),g=(0,u.U)(` 557 subscription ProjectGroupRevisionsCreated($id: ID!) { 558 projectGroupRevisionsCreated(id: $id) { 559 id 560 revisionIds 561 } 562 } 563`),f=(0,u.U)(` 564 subscription ProjectGroupFilesSyncedToDevServer($id: ID!) { 565 projectGroupFilesSyncedToDevServer( 566 id: $id 567 input: { environment: BUILDER } 568 ) { 569 id 570 operation 571 files 572 initialSync 573 } 574 } 575`),b=(0,u.U)(` 576 query ProjectGroupHasContent($projectGroupId: ID!) { 577 projectGroupById(id: $projectGroupId) { 578 id 579 hasModules 580 hasDatabases 581 hasRevision 582 } 583 } 584`),y=["centered-chatbox","transition-from-centered-chatbox-to-bottom-chat","bottom-chat","transition-from-bottom-chat-to-left-chat","left-chat"],v={"centered-chatbox":{"bottom-chat":"transition-from-centered-chatbox-to-bottom-chat"},"bottom-chat":{"left-chat":"transition-from-bottom-chat-to-left-chat"},"transition-from-centered-chatbox-to-bottom-chat":{"bottom-chat":"bottom-chat"},"transition-from-bottom-chat-to-left-chat":{"left-chat":"left-chat"}},j=(0,l.v)()((e,t)=>({view:null,transitionTimer:null,leftPanelSize:0,isCompactMode:!1,hasSubmittedChat:new Map,isAtTopOfChat:!0,actions:null,eagerSyncFile:null,setEagerSyncFile:t=>e({eagerSyncFile:t}),eagerPlatform:null,setEagerPlatform:t=>e({eagerPlatform:t}),setAppBuilderView:(r,a)=>{let n=t().view;if(n===r)return;let i=n&&v[n]?.[r];if(i===r){if(!t().transitionTimer){if(e({view:r,transitionTimer:null}),"left-chat"===r){let e=t().actions?.scrollToEnd;e&&setTimeout(()=>e(),100)}a&&a()}return}let s=t().transitionTimer;if(s&&clearTimeout(s),i){e({view:i});let n=setTimeout(()=>{if(e({view:r,transitionTimer:null}),"left-chat"===r){let e=t().actions?.scrollToEnd;e&&setTimeout(()=>e(),100)}a&&a()},1e3);e({transitionTimer:n})}else{if(e({view:r,transitionTimer:null}),"left-chat"===r){let e=t().actions?.scrollToEnd;e&&setTimeout(()=>e(),100)}a&&a()}},setChatActions:({scrollToEnd:t,setText:r,insertCodeReference:a,insertCodeReferenceWithMessage:n})=>e({actions:{scrollToEnd:t,setText:r,insertCodeReference:a,insertCodeReferenceWithMessage:n}}),setIsCompactMode:t=>e({isCompactMode:t}),setLeftPanelSize:t=>e({leftPanelSize:t}),setHasSubmittedChat:({threadId:t,hasSubmittedChat:r})=>{e(e=>{let a=new Map(e.hasSubmittedChat);return r?a.set(t,!0):a.delete(t),{hasSubmittedChat:a}})},setIsAtTopOfChat:t=>e({isAtTopOfChat:t}),reset:()=>{let r=t().transitionTimer;r&&clearTimeout(r),e({view:null,transitionTimer:null,eagerSyncFile:null,eagerPlatform:null,isCompactMode:!1,actions:null,isAtTopOfChat:!0,hasSubmittedChat:new Map})}})),I=()=>{let{id:e,initialHasModules:t,initialHasDatabases:r,initialHasRevisions:l,filesystemVersion:o}=(0,c.MN)(),u=j(e=>e.setAppBuilderView),y=j(e=>Array.from(e.hasSubmittedChat.values()).some(e=>e)),{data:v,subscribeToMore:I,startPolling:w,stopPolling:N}=(0,p.I)(b,{variables:{projectGroupId:e}}),T=(0,n.OD)({initializeWithValue:!0}
584),[E,S]=(0,s.useState)(!1),_=!T||v?.projectGroupById.hasModules||t,k=!!T&&(!!v?.projectGroupById.hasDatabases||r),C=l||!T||!!v?.projectGroupById.hasRevision||y||l,R=j(e=>e.setEagerSyncFile),A=j(e=>e.eagerSyncFile),G=j(e=>e.setEagerPlatform),P=j(e=>e.eagerPlatform),O=o===i.FilesystemVersion.V2;(0,m.R)(f,{variables:{id:e},skip:E||!O&&_,onData:({data:e})=>{let t=e.data?.projectGroupFilesSyncedToDevServer;if(!t)return;let{operation:r,initialSync:n,files:s}=t;if(r!==a.KX1.WRITE||n)return;if(null===P)for(let e of s){if(e.startsWith("/apps/mobile/")){G("mobile");break}if(e.startsWith("/apps/web/")&&!e.startsWith("/apps/web/src/app/api/")){G("web");break}}let l=["expo-page","page"],c=s.map(e=>({file:e,behavior:(0,i.getRoutingBehaviorForPathAndStack)({filePath:e,stack:o})})).find(({behavior:e})=>e&&l.includes(e));if(c){if(A)return void d.M.emit("refreshIframe",{isManual:!1});R(c.file),S(!0)}}}),(0,s.useEffect)(()=>{let t=I({document:x,variables:{id:e},updateQuery:(t,{subscriptionData:r})=>{if(!r.data)return;let{projectGroupModulesCreated:a}=r.data;if(a.id===e&&0!==a.moduleIds.length)return{...t,projectGroupById:{...t.projectGroupById,hasModules:!0}}}}),r=I({document:h,variables:{id:e},updateQuery:(t,{subscriptionData:r})=>{if(!r.data)return;let{projectGroupDatabasesCreated:a}=r.data;if(a.id===e&&0!==a.databaseIds.length)return{...t,projectGroupById:{...t.projectGroupById,hasDatabases:!0}}}}),a=I({document:g,variables:{id:e},updateQuery:(t,{subscriptionData:r})=>{if(!r.data)return;let{projectGroupRevisionsCreated:a}=r.data;if(a.id===e&&0!==a.revisionIds.length)return{...t,projectGroupById:{...t.projectGroupById,hasRevision:!0}}}});return()=>{t(),r(),a()}},[e,I]),(0,s.useEffect)(()=>(_||E||k?N():w(3e4),()=>N()),[_,E,k,w,N]),(0,s.useEffect)(()=>{let e=_||E||t||k;u(C||_||E||k?e?"left-chat":"bottom-chat":"centered-chatbox")},[_,k,E,C,t,u])},w=e=>j((0,o.k)(t=>e(t.view))),N=()=>w(e=>!!e&&y.indexOf(e)<y.indexOf("left-chat")),T=()=>w(e=>!!e&&y.indexOf(e)<y.indexOf("transition-from-bottom-chat-to-left-chat")),E=()=>w(e=>!!e&&y.indexOf(e)<y.indexOf("bottom-chat")),S=()=>w(e=>!!e&&y.indexOf(e)>=y.indexOf("transition-from-centered-chatbox-to-bottom-chat"))},937973:(e,t,r)=>{r.d(t,{d:()=>ag});var a=r(294799),n=r(11241),i=r(33031),s=r(229159),l=r(888202),o=r(917339),c=r(133532),d=r(971677),u=r(826649),p=r(962770),m=r(88237),x=r(600428),h=r(702459),g=r(387928),f=r(789545),b=r(103967),y=r(834023),v=r(751355),j=r(510822);let I=(0,v.U)(` 585 query GetModuleForAction($id: ID!) { 586 projectRevisionById(id: $id) { 587 id 588 project { 589 id 590 name 591 marketingDescription 592 marketingImageURLs 593 marketingIconURL 594 } 595 } 596 } 597`),w=e=>{let t,r,i,s,l,c,d,u=(0,n.c)(20),{modules:p,loading:m,className:x,isDisabled:h,delayMs:g}=e,[f,b]=(0,y.useState)(void 0===g);u[0]!==p?(t=p.flatMap(T),u[0]=p,u[1]=t):t=u[1];let v=t;u[2]!==g||u[3]!==v?(r=()=>{if(void 0!==g){v.forEach(E);let e=setTimeout(()=>{b(!0)},g);return()=>{clearTimeout(e)}}},i=[g,v],u[2]=g,u[3]=v,u[4]=r,u[5]=i):(r=u[4],i=u[5]),(0,y.useEffect)(r,i);let j=void 0!==g&&"animate-fade-in-bottom",I=f?h?"opacity-40":"opacity-100":"pointer-events-none hidden opacity-0";return u[6]!==x||u[7]!==j||u[8]!==I?(s=(0,o.cn)("flex snap-x snap-mandatory flex-row flex-nowrap gap-[12px] overflow-x-auto transition-opacity",x,j,I),u[6]=x,u[7]=j,u[8]=I,u[9]=s):s=u[9],u[10]!==m||u[11]!==p.length?(l=m&&0===p.length&&(0,a.jsxs)("div",{className:"flex w-[328px] shrink-0 flex-row items-center justify-start gap-[4px] rounded-[8px] border border-comeback-gray-75 p-[8px]",children:[(0,a.jsx)("div",{className:"h-[18px] w-[18px] animate-pulse rounded-[4px] bg-comeback-gray-100"}),(0,a.jsx)("div",{className:"h-[18px] w-full animate-pulse bg-comeback-gray-100"})]}),u[10]=m,u[11]=p.length,u[12]=l):l=u[12],u[13]!==m||u[14]!==p?(c=!m&&p.map(S),u[13]=m,u[14]=p,u[15]=c):c=u[15],u[16]!==s||u[17]!==l||u[18]!==c?(d=(0,a.jsxs)("div",{className:s,children:[l,c]}),u[16]=s,u[17]=l,u[18]=c,u[19]=d):d=u[19],d},N=e=>{let t,r,i,s=(0,n.c)(10),{result:l,className:o,isDisabled:c,delayMs:d}=e;s[0]!==l.id?(t={variables:{id:l.id}},s[0]=l.id,s[1]=t):t=s[1];let{data:u,loading:p}=(0,j.I)(I,t);s[2]!==u?.projectRevisionById?.project?(r=u?.projectRevisionById?.project?[u?.projectRevisionById?.project]:[],s[2]=u?.projectRevisionById?.project,s[3]=r):r=s[3];let m=r;return s[4]!==o||s[5]!==d||s[6]!==c||s[7]!==p||s[8]!==m?(i=(0,a.jsx)(w,{modules:m,loading:p,className:o,delayMs:d,isDisabled:c}),s[4]=o,s[5]=d,s[6]=c,s[7]=p,s[8]=m,s[9]=i):i=s[9],i};function T(e){return e.marketingImageURLs??[]}function E(e){new Image().src=e}function S(e){let{id:t,name:r,marketingDescription:n,marketingIconURL:i}=e;return(0,a.jsxs)("div",{className:"flex w-[328px] shrink-0 flex-row items-center justify-start gap-[4px] rounded-[8px] border border-comeback-gray-75 p-[8px]",children:[i?(0,a.jsx)("img",{src:i,className:"h-[18px] w-[18px] rounded-[4px]",alt:n??"icon"}):null,(0,a.jsx)(b.E,{type:"body-md",weight:"medium",className:"w-full overflow-hidden truncate text-ellipsis whitespace-nowrap",children:r}),(0,a.jsxs)(h.E,{color:"green",className:"flex flex-row gap-[4px]",children:[(0,a.jsx)(f.I,{content:g.bC,size:"small"}),"Done"]})]},t)}var _=r(30739);let k=e=>{let t,r,i,s=(0,n.c)(8),{children:l,delayMs:o,typingIntervalMs:c,breakOnSpaces:d}=e,u=void 0===o?500:o,p=void 0===c?50:c,m=void 0!==d&&d,x=(0,y.useRef)(null);return s[0]!==l?(t=[l],s[0]=l,s[1]=t):t=s[1],s[2]!==m||s[3]!==u||s[4]!==t||s[5]!==p?(r={textToType:t,typingIntervalMs:p,breakOnSpaces:m,textElementRef:x,delayMs:u},s[2]=m,s[3]=u,s[4]=t,s[5]=p,s[6]=r):r=s[6],(0,_.B)(r),s[7]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)("div",{className:"min-h-[21px] w-fit",ref:x}),s[7]=i):i=s[7],i};var C=r(163195),R=r(692552),A=r(910189),G=r(875457);let P=e=>{let t,r,s=(0,n.c)(13),{choices:l,isDisabled:o,className:c}=e,{handleChat:d,mutationResult:u}=(0,R.n)(),{called:p}=u,m=o||p,x=(0,A.eE)(O);if(s[0]!==l||s[1]!==m||s[2]!==d||s[3]!==x){let e;s[5]!==m||s[6]!==d||s[7]!==x?(e=(e,t)=>(0,a.jsxs)(G.G,{onPress:()=>{d({chat:e,action:i.ProjectGroupRevisionAction.CHAT,isThinkingMode:!1,attachments:null}),x?.()},isDisabled:m,children:[(0,a.jsxs)("span",{className:"text-comeback-gray-400",children:[t+1,"."]})," ",e]},e),s[5]=m,s[6]=d,s[7]=x,s[8]=e):e=s[8],t=l.map(e),s[0]=l,s[1]=m,s[2]=d,s[3]=x,s[4]=t}else t=s[4];return s[9]!==c||s[10]!==o||s[11]!==t?(r=(0,a.jsx)(G.b,{isDisabled:o,className:c,children:t}),s[9]=c,s[10]=o,s[11]=t,s[12]=r):r=s[12],r};function O(e){return e.actions?.scrollToEnd}var U=r(362652),M=r(883690),L=r(106504),D=r(422408),B=r(711300),$=r(309894),F=r(121180),H=r(234441),q=r(226824),z=r(91976),V=r(879732),W=r(912857),Y=r(175746),Q=r(445870),X=r(61853),K=r(555246),J=r(451286),Z=r(814121);let ee=(0,v.U)(` 598 mutation SignUpWithMagicLinkOrRequestMagicLink( 599 $input: SignUpWithMagicLinkOrRequestMagicLinkInput! 600 ) { 601 signUpWithMagicLinkOrRequestMagicLink(input: $input) { 602 success 603 errors { 604 kind 605 message 606 } 607 } 608 } 609`);function et(e){let t,r,i,s,l,o=(0,n.c)(15),{length:c,onChange:d,inputMode:u}=e,p=void 0===c?6:c,m=void 0===u?"numeric":u;o[0]!==p?(t=Array(p).fill(""),o[0]=p,o[1]=t):t=o[1];let[x,h]=(0,y.useState)(t);o[2]===Symbol.for("react.memo_cache_sentinel")?(r=[],o[2]=r):r=o[2];let g=(0,y.useRef)(r);if(o[3]!==m||o[4]!==p||o[5]!==d||o[6]!==x){let e,t=e=>{g.current[e]&&g.current[e]?.focus()};o[9]!==d||o[10]!==x?(e=(e,t)=>{let r=[...x];r[e]=t,h(r),d?.(r.join(""))},o[9]=d,o[10]=x,o[11]=e):e=o[11];let r=e;i="flex items-center justify-between gap-2",s=x.map((e,n)=>(0,a.jsx)("input",{ref:e=>{g.current[n]=e}
609,value:e,onChange:e=>((e,a)=>{let n=a.target.value;if(n.length>1){let r=n.replace(/\D/g,"").slice(0,p-e);if(!r)return;let a=[...x];for(let t=0;t<r.length;t++)a[e+t]=r[t]||"";h(a),d?.(a.join("")),t(Math.min(e+r.length,p-1));return}let i=n.replace(/\D/g,"");i?(r(e,i),e<p-1&&t(e+1)):r(e,"")})(n,e),onKeyDown:e=>{"Backspace"===e.key?(e.preventDefault(),x[n]?r(n,""):n>0&&(r(n-1,""),t(n-1))):"ArrowLeft"===e.key&&n>0?e.preventDefault():"ArrowRight"===e.key&&n<p-1&&e.preventDefault()},onPaste:e=>{e.preventDefault();let r=e.clipboardData.getData("text").replace(/\D/g,"").slice(0,p-n);if(!r)return;let a=[...x];for(let e=0;e<r.length;e++)a[n+e]=r[e]||"";h(a),d?.(a.join("")),t(Math.min(n+r.length,p-1))},name:`otp-digit-${n+1}`,"aria-label":`Digit ${n+1} of ${p}`,inputMode:m,autoComplete:0===n?"one-time-code":"off",maxLength:1,className:"h-[40px] w-[48px] rounded-[10px] border border-gray-200 text-center text-[14px] outline-none ring-offset-background focus-visible:ring-[2px] focus-visible:ring-ring focus-visible:ring-offset-[2px]"},n)),o[3]=m,o[4]=p,o[5]=d,o[6]=x,o[7]=i,o[8]=s}else i=o[7],s=o[8];return o[12]!==i||o[13]!==s?(l=(0,a.jsx)("div",{className:i,children:s}),o[12]=i,o[13]=s,o[14]=l):l=o[14],l}var er=r(1205),ea=r(850594);function en(){let e,t=(0,n.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsxs)("div",{className:"flex w-full flex-col items-end justify-center tablet:min-w-[320px]",children:[(0,a.jsxs)("div",{className:"w-full",children:[(0,a.jsx)(ea.E,{className:"mb-[4px] h-[14px] w-[40px] rounded-[4px]"}),(0,a.jsx)(ea.E,{className:"h-[38px] w-full rounded-[10px]"})]}),(0,a.jsx)(ea.E,{className:"mt-[20px] h-[40px] w-full rounded-[8px]"})]}),t[0]=e):e=t[0],e}var ei=r(480011),es=r(439502);let el=(0,v.U)(` 610 query CheckIfGoogleUserExists($email: String!) { 611 checkIfGoogleUserExists(email: $email) { 612 exists 613 } 614 } 615`),eo=(0,v.U)(` 616 mutation SignInWithMagicLinkCodeAndStartGeneration( 617 $input: SignInWithMagicLinkCodeAndStartGenerationInput! 618 ) { 619 signInWithMagicLinkCodeAndStartGeneration(input: $input) { 620 user { 621 id 622 email 623 } 624 accessToken 625 refreshToken 626 projectGroup { 627 id 628 } 629 } 630 } 631 `),ec=W.Ik({email:W.Yj().refine(e=>q.t(e),{message:"Please enter a valid email."})}),ed=e=>{let{className:t,instructions:r,showOAuthOnTop:n=!1,...i}=e,{magicLinkSignupEnabled:s=!0,requirePaidGenerationEnabled:l=!1}=(0,es.Wi)(),c=(0,z.useRouter)(),[d,u]=(0,y.useState)(!1),[p,m]=(0,y.useState)(null),[x,h]=(0,y.useState)(null),[g]=(0,ei._)(el),[f]=(0,Z.n)(eo),{register:b,handleSubmit:v,formState:{errors:j},clearErrors:I}=(0,V.mN)({mode:"onSubmit",resolver:(0,H.u)(ec)}),[w,N]=(0,y.useState)(!1),[T,E]=(0,y.useState)(!1),{submit:S,loading:_}=(()=>{let e=(0,K.jt)(),[t]=(0,Z.n)(ee),[r,a]=(0,y.useState)(!1),n=async({chat:r,email:n,turnstileToken:i})=>{a(!0);try{let{data:a}=await t({variables:{input:{email:n,failIfEmailExists:!0,turnstileToken:i??null}}});if(a?.signUpWithMagicLinkOrRequestMagicLink.success)return e("Landing Page Form Submitted",{chat:r,email:n}),{projectGroupId:null,projectId:null,error:null};let s=a?.signUpWithMagicLinkOrRequestMagicLink.errors?.[0]?.kind;return{projectGroupId:null,projectId:null,error:s??"unknown"}}catch(e){return J.Cp(e),{projectGroupId:null,projectId:null,error:"unknown"}}finally{a(!1)}};return{submit:async t=>{let{email:r,chat:a,turnstileToken:i}=t;return e("Sign Up Attempted",{email:r}),n({email:r,chat:a,turnstileToken:i})},loading:r}})(),[k,C]=(0,y.useState)(""),[R,A]=(0,y.useState)(),[G,P]=(0,y.useState)(""),[O,q]=(0,y.useState)(null),W=(0,y.useRef)(null);(0,y.useEffect)(()=>()=>{W.current&&clearInterval(W.current)},[]);let ea=v(async({email:e})=>{if(_)return;let{data:t}=await g({variables:{email:e}});if(t?.checkIfGoogleUserExists.exists)return void m(M.w6e.EMAIL_ALREADY_SIGNED_UP);m(null),C(e),N(!0);try{let[t]=await Promise.all([S({email:e,chat:i.chat,turnstileToken:R}),new Promise(e=>setTimeout(e,1e3))]);if(null!==t.error)return void m(t.error);W.current&&clearInterval(W.current),q(30),W.current=setInterval(()=>{q(e=>e&&e<=1?(W.current&&(clearInterval(W.current),W.current=null),0):e?e-1:null)},1e3)}catch{N(!1)}}),ed=async e=>{if("chat"in i&&!d){h(null),u(!0);try{let{data:t}=await f({variables:{input:{email:k,codeAttempt:e,chat:i.chat}}});if(t?.signInWithMagicLinkCodeAndStartGeneration){let{projectGroup:e,accessToken:r}=t.signInWithMagicLinkCodeAndStartGeneration;if(r&&((0,B.sF)({token:r}),(0,B.r9)("email")),l)return void c.push((0,L.HJ)({origin:(0,D.S)(),prompt:i.chat}));let a=(0,L.Sj)({projectGroupId:e.id,viewingModuleId:null,viewingDatabaseId:null});c.push(a)}}catch(e){u(!1),h(e instanceof Error?"Invalid code. Please try again":"An unknown error occurred")}}},eu=!!p||Object.keys(j).length>0,ep=w&&!eu&&null!==O,em=w&&6!==G.length&&!d;return s?(0,a.jsx)(er.BoneyardSkeleton,{name:"email-message",loading:d,fallback:(0,a.jsx)(en,{}),className:null,fixture:null,children:(0,a.jsxs)("div",{className:(0,o.cn)("flex w-full tablet:min-w-[320px] animate-fade-in-bottom flex-col gap-[12px] justify-center",t),children:[(0,a.jsx)(X.l,{chatInput:"chat"in i?i.chat:null,templateId:null,createBlankProject:!1,type:"sign-up",
631showOAuthOnTop:!0,showDivider:null,className:"w-full",redirectUrl:null,referralCode:null}),T?(0,a.jsxs)("form",{noValidate:!0,className:"flex w-full flex-col items-end justify-center",onSubmit:e=>{if(w){e.preventDefault(),6!==G.length||d||ed(G);return}ea(e)},children:[(0,a.jsxs)("label",{className:(0,o.cn)("w-full text-body-sm",eu?"text-comeback-red-500":"text-comeback-gray-500"),children:["Email",(0,a.jsx)("input",{required:!0,type:"email",className:(0,o.cn)("w-full cursor-text rounded-[10px] border bg-comeback-gray-25 p-[8px] text-body-sm text-comeback-gray-900 outline-none focus:ring-0 focus:ring-offset-0",eu?"border-comeback-red-500":"border-comeback-gray-75"),placeholder:"[email protected]",autoFocus:!0,...b("email",{onChange:()=>{I("email"),m(null),N(!1)}})}),eu&&(0,a.jsx)(U.e,{size:"xs",serverError:p,fieldErrors:j,redirectUrl:null}),r&&(0,a.jsx)("div",{className:"mt-4",children:r})]}),(0,a.jsx)(Y.$,{onVerify:A,visible:!w}),(0,a.jsxs)("div",{className:(0,o.cn)("mt-[20px] flex w-full flex-col gap-[4px] overflow-hidden whitespace-pre-wrap text-body-sm transition-[max-height,opacity] duration-300 ease-in-out",ep?"mb-[12px] max-h-[500px] opacity-100":"mb-0 max-h-0 opacity-0"),children:[(0,a.jsx)("div",{className:"text-body-sm text-comeback-gray-500",children:"Enter the code sent to your email"}),(0,a.jsx)(et,{length:6,onChange:e=>{x&&h(null),P(e)}}),(0,a.jsxs)("div",{className:"text-body-xs text-comeback-gray-400",children:["This code expires in ",15," minutes."]}),x&&(0,a.jsx)("div",{className:"w-fit text-body-xs text-comeback-red-500",children:x})]}),(0,a.jsx)("div",{className:"flex w-full flex-row-reverse items-center justify-between",children:(0,a.jsx)($.Button,{disabled:em,color:"dark",type:"submit",className:"w-full",iconRight:(0,a.jsx)(Q.A,{size:"small",content:F.u2,viewBoxWidth:16,viewBoxHeight:14}),children:"Submit"})}),ep&&(0,a.jsxs)("div",{className:"mt-[8px] flex w-full justify-center gap-[4px] text-body-xs text-comeback-gray-500",children:[(0,a.jsx)("span",{children:"Didn't receive?"}),(0,a.jsxs)("button",{type:"button",disabled:O>0,onClick:ea,className:(0,o.cn)("underline",O>0?"cursor-not-allowed opacity-50":"cursor-pointer hover:text-comeback-gray-700"),children:["Resend OTP",O>0&&(0,a.jsxs)("span",{children:[" (",O,"s)"]})]})]}),(0,a.jsx)("button",{type:"button",onClick:()=>E(!1),className:"mt-[8px] w-full cursor-pointer text-center text-body-sm text-comeback-gray-500 underline underline-offset-2 hover:text-comeback-gray-700",children:"Back"})]}):(0,a.jsx)($.Button,{color:"light",type:"button",className:"w-full",onPress:()=>E(!0),children:"Continue with email"})]})}):(0,a.jsx)("div",{className:(0,o.cn)("flex w-full tablet:min-w-[320px] animate-fade-in-bottom flex-col items-center justify-center",t),children:(0,a.jsx)(X.l,{chatInput:"chat"in i?i.chat:null,templateId:null,createBlankProject:!1,type:"sign-up",showOAuthOnTop:!0,showDivider:!1,className:"w-full pt-[12px]",redirectUrl:null,referralCode:null})})};var eu=r(863349),ep=r(898936),em=r(150375),ex=r(717864),eh=r(17374);let eg=(0,v.U)(` 632 query GetLatestRevision($id: ID!, $replaceFunctions: Boolean) { 633 projectById(id: $id) { 634 id 635 projectGroup { 636 id 637 authEnabled 638 } 639 latestRevision { 640 id 641 ...RevisionForProject 642 } 643 } 644 } 645`);var ef=r(117616),eb=r(354127),ey=r(971288),ev=r(439400),ej=r(21497);let eI=(0,v.U)(` 646 subscription GetModuleRevisionUpdate($id: ID!) { 647 moduleRevisionUpdate(id: $id) { 648 id 649 status 650 } 651 } 652`),ew=(0,v.U)(` 653 query GetModuleForTopDownChatByRevisionId($id: ID!) { 654 projectRevisionById(id: $id) { 655 id 656 status 657 previewURL 658 createdAt 659 project { 660 id 661 name 662 moduleType 663 } 664 } 665 } 666`),eN={},eT=e=>{let t,r,i,s,l=(0,n.c)(6),{className:c}=e;return l[0]!==c?(t=(0,o.cn)("comeback-text-body-md flex w-full flex-row items-center justify-start gap-[12px] rounded-[8px] border-[1px] border-comeback-gray-75 bg-white p-[8px] text-left text-comeback-gray-900 outline-none transition-colors",c),l[0]=c,l[1]=t):t=l[1],l[2]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)("div",{className:"flex aspect-video h-[80px] animate-pulse flex-col rounded-[4px] bg-comeback-gray-75 bg-cover",style:{boxShadow:"inset 0 0 0 2000px rgba(0, 0, 0, 0.02)"}}),l[2]=r):r=l[2],l[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsxs)("div",{className:"flex w-full flex-col items-start justify-start gap-[4px]",children:[(0,a.jsx)("div",{className:"h-[20px] w-full animate-pulse rounded-[4px] bg-comeback-gray-75"}),(0,a.jsx)("div",{className:"h-[20px] w-[75%] animate-pulse rounded-[4px] bg-comeback-gray-75"})]}),l[3]=i):i=l[3],l[4]!==t?(s=(0,a.jsxs)("div",{className:t,children:[r,i]}),l[4]=t,l[5]=s):s=l[5],s},eE=(0,y.forwardRef)((e,t)=>{let r,s=(0,n.c)(2),l={...eN,...e},{onPress:c}=l,d=(0,eb.A)(t),{buttonProps:u}=(0,ey.s)({onPress:c},d),{loadedImageSrc:p,loading:m}=(e=>{let t,r,a,i=(0,n.c)(6),[s,l]=(0,y.useState)(null),[o,c]=(0,y.useState)(!1);return i[0]!==e?(t=()=>{if(e){c(!0),l(null);let t=new Image;t.src=e,t.onload=()=>
666{l(e),c(!1)}}},r=[e],i[0]=e,i[1]=t,i[2]=r):(t=i[1],r=i[2]),(0,y.useEffect)(t,r),i[3]!==s||i[4]!==o?(a={loadedImageSrc:s,loading:o},i[3]=s,i[4]=o,i[5]=a):a=i[5],a})(l.src);s[0]!==p?(r=p??(({status:e,previewURL:t})=>{switch(e){case i.ProjectRevisionStatus.QUEUED:return"/images/project-revision-button-image-loading-state.png";case i.ProjectRevisionStatus.BUILDING:return"/images/project-revision-button-building-loading-state.gif";default:return t}})({status:i.ProjectRevisionStatus.QUEUED,previewURL:null}),s[0]=p,s[1]=r):r=s[1];let x=r;return l.projectExists&&(0,a.jsx)("div",{className:"overflow-visible py-[1px]",children:(0,a.jsxs)("button",{className:(0,o.cn)("comeback-text-body-md flex w-full flex-row items-center justify-start gap-[12px] overflow-clip rounded-[8px] border-[1px] bg-white p-[8px] text-left text-comeback-gray-900 outline-none ring-1 transition-colors",!l.isSelected&&"border-comeback-gray-75 ring-transparent hover:bg-comeback-gray-50 active:bg-comeback-gray-75",l.isSelected&&"border-comeback-blue-400 ring-comeback-blue-400",l.className,"max-w-[min(75%,300px)]"),...u,ref:t,children:[(0,a.jsx)("div",{className:(0,o.cn)("flex aspect-video flex-shrink-0 flex-col overflow-hidden rounded-[4px] bg-comeback-gray-75 transition-[opacity,transform,background-color] duration-[200ms] ease-out",l.status===i.ProjectRevisionStatus.QUEUED||m?"animate-heart-beat-background opacity-40":"",l.isSelected?"h-[80px]":"h-[40px]"),style:(0,i.isStatusIndicatingRevisionIsBuilding)(l.status)||m?{backgroundColor:"white"}:{},children:(0,a.jsx)(ex.w,{variant:l.moduleType===i.ModuleType.EXPO_PAGE?"phone":"none",className:null,statusBarColor:"#000000",children:(0,a.jsx)("div",{className:"h-full w-full bg-center bg-cover bg-no-repeat",style:{backgroundImage:`url('${x}')`,boxShadow:"inset 0 0 0 2000px rgba(0, 0, 0, 0.02)",...(0,i.isStatusIndicatingRevisionIsBuilding)(l.status)||m?{backgroundSize:"60px"}:{}}})})}),(0,a.jsxs)("div",{className:(0,o.cn)("flex min-w-0 flex-1 justify-start transition-[opacity,transform,background-color] duration-[200ms] ease-out",l.isSelected?"flex-col gap-[4px]":"flex-row items-center gap-[8px]"),children:[(0,a.jsx)(b.E,{type:"body-md",weight:"medium",className:"truncate",title:l.name??"",children:l.name}),(0,a.jsx)(em.J,{status:l.status})]})]})})}),eS=(0,y.forwardRef)((e,t)=>{let r,s,l,o,c,d,u,p,m=(0,n.c)(36);m[0]!==e.projectRevisionId?(r={variables:{id:e.projectRevisionId}},m[0]=e.projectRevisionId,m[1]=r):r=m[1];let{data:x,subscribeToMore:h,loading:g,error:f}=(0,j.I)(ew,r),{projectRevisionId:b}=e,v=!g&&!f&&!!x?.projectRevisionById?.project?.id,I=x?.projectRevisionById.status,w=x?.projectRevisionById.project.moduleType??null;m[2]!==I?(s=!!I&&((0,i.isStatusIndicatingRevisionIsBuilding)(I)||I===i.ProjectRevisionStatus.QUEUED),m[2]=I,m[3]=s):s=m[3];let N=s;m[4]!==b||m[5]!==N||m[6]!==h?(l=()=>{if(!N)return ev.l;let e=h({document:eI,variables:{id:b},updateQuery:(e,t)=>{let{subscriptionData:r}=t;if(!r.data)return;let{moduleRevisionUpdate:a}=r.data;if(a.id===b)return(0,ej.h)({},e,{projectRevisionById:{status:a.status}})}});return()=>{e()}},o=[b,h,N],m[4]=b,m[5]=N,m[6]=h,m[7]=l,m[8]=o):(l=m[7],o=m[8]),(0,y.useEffect)(l,o);let T=x?.projectRevisionById.project.id??null;m[9]!==T?(c={projectId:T,pollingEnabled:!1},m[9]=T,m[10]=c):c=m[10];let{latestRevision:E}=function(e){let t,r,a,s,l,o=(0,n.c)(16),{projectId:c,pollingEnabled:d}=e,u=!c;o[0]!==c?(t={id:c},o[0]=c,o[1]=t):t=o[1];let p=d&&c?2e3:0;o[2]!==u||o[3]!==t||o[4]!==p?(r={skip:u,variables:t,pollInterval:p},o[2]=u,o[3]=t,o[4]=p,o[5]=r):r=o[5];let{data:m,subscribeToMore:x}=(0,j.I)(eg,r),h=m?.projectById?.latestRevision,g=h?.id??null;o[6]!==c||o[7]!==x||o[8]!==g?(a={revisionId:g,projectId:c,subscribeToMore:x},o[6]=c,o[7]=x,o[8]=g,o[9]=a):a=o[9],(0,eh.l)(a);let f=m?.projectById?.projectGroup?.authEnabled??!1;o[10]!==h?(s=h?.status&&(0,i.isStatusIndicatingRevisionIsBuilding)(h.status),o[10]=h,o[11]=s):s=o[11];let b=s;return o[12]!==f||o[13]!==b||o[14]!==h?(l={authEnabled:f,latestRevision:h,isActive:b},o[12]=f,o[13]=b,o[14]=h,o[15]=l):l=o[15],l}(c),S=E?.id,_=x?.projectRevisionById.project.id,k=(0,ep.nZ)(e_),C=(0,ep.nZ)(ek),R=(0,ep.nZ)(eC),A=(0,ep.nZ)(eR),G=(0,ef.useDispatch)();m[11]!==C||m[12]!==G||m[13]!==S||m[14]!==_||m[15]!==b||m[16]!==e.isLatest||m[17]!==A||m[18]!==k||m[19]!==R?(d=()=>
666{if(_){if(k(_),G({type:"focus-node",nodeId:_,withAnimation:!0}),e.isLatest||b===R||S===b)return void C();A({moduleId:_,revisionId:b})}},m[11]=C,m[12]=G,m[13]=S,m[14]=_,m[15]=b,m[16]=e.isLatest,m[17]=A,m[18]=k,m[19]=R,m[20]=d):d=m[20];let P=d;m[21]!==S||m[22]!==_||m[23]!==b?(u=e=>{let{value:t}=e;return!!_&&(t.viewingHistoricalRevisionId?t.viewingHistoricalRevisionId===b:t.viewingModuleId===_&&S===b)},m[21]=S,m[22]=_,m[23]=b,m[24]=u):u=m[24];let O=(0,ep.nZ)(u),U=x?.projectRevisionById.createdAt?new Date(x?.projectRevisionById.createdAt):null,M=U&&Date.now()-U.getTime()>18e5,L=x?.projectRevisionById.project.name??null,D=x?.projectRevisionById.previewURL??null,B=x?.projectRevisionById.status??(M?i.ProjectRevisionStatus.GENERATION_FAILED:i.ProjectRevisionStatus.QUEUED);return m[25]!==t||m[26]!==P||m[27]!==O||m[28]!==w||m[29]!==v||m[30]!==e.className||m[31]!==e.isLatest||m[32]!==B||m[33]!==L||m[34]!==D?(p=(0,a.jsx)(eE,{ref:t,name:L,onPress:P,src:D,className:e.className,status:B,isSelected:O,isLatest:e.isLatest,projectExists:v,moduleType:w}),m[25]=t,m[26]=P,m[27]=O,m[28]=w,m[29]=v,m[30]=e.className,m[31]=e.isLatest,m[32]=B,m[33]=L,m[34]=D,m[35]=p):p=m[35],p});function e_(e){return e.setViewingModuleId}function ek(e){return e.clearHistoricalRevision}function eC(e){return e.value.viewingHistoricalRevisionId}function eR(e){return e.setViewingHistoricalRevisionId}var eA=r(127167),eG=r(423045),eP=r(921513),eO=r(859144),eU=r(994503);let eM=(0,v.U)(` 667 query GetAuthProjectsForSettingsUpdate($projectGroupId: ID!) { 668 projectGroupById(id: $projectGroupId) { 669 id 670 databases { 671 id 672 name 673 } 674 projects( 675 input: { 676 moduleTypes: [AUTH_PAGE_SIGN_IN, AUTH_PAGE_SIGN_UP, AUTH_PAGE_LOGOUT] 677 } 678 ) { 679 edges { 680 node { 681 id 682 latestRevision { 683 id 684 } 685 } 686 } 687 } 688 } 689 } 690`),eL=(0,v.U)(` 691 subscription GetModulesCreatedForProjectGroup($id: ID!) { 692 projectGroupModulesCreated(id: $id) { 693 id 694 moduleIds 695 } 696 } 697`),eD=e=>{let t,r,i,s,l,o,c,d,u=(0,n.c)(23),{settings:p,isLatest:m,createdAt:x,className:h}=e,{id:g}=(0,eA.MN)(),f=Object.values(p.auth??{}).some(eB),b=!f;u[0]!==g?(t={projectGroupId:g},u[0]=g,u[1]=t):t=u[1],u[2]!==b||u[3]!==t?(r={skip:b,variables:t},u[2]=b,u[3]=t,u[4]=r):r=u[4];let{data:y,refetch:v,loading:I,previousData:w}=(0,j.I)(eM,r),N=I?w:y;u[5]!==N?.projectGroupById?.projects.edges?(i=new Set(N?.projectGroupById?.projects.edges.map(e$)??[]),u[5]=N?.projectGroupById?.projects.edges,u[6]=i):i=u[6];let T=i;if(u[7]!==g?(s={id:g},u[7]=g,u[8]=s):s=u[8],u[9]!==T||u[10]!==v?(l=e=>{let t=e.data.data?.projectGroupModulesCreated.moduleIds.filter(e=>!T.has(e));t&&t.length>0&&v().catch(eF)},u[9]=T,u[10]=v,u[11]=l):l=u[11],u[12]!==s||u[13]!==l?(o={variables:s,onData:l},u[12]=s,u[13]=l,u[14]=o):o=u[14],(0,eU.R)(eL,o),!f)return null;if(u[15]!==h||u[16]!==x||u[17]!==N?.projectGroupById?.projects.edges||u[18]!==m){d=Symbol.for("react.early_return_sentinel");e:{let e=N?.projectGroupById?.projects.edges.map(eH)??[];if(0===e.length){let e;if(!x||!m||(0,eG.Y)(new Date,1)>x){d=null;break e}u[21]!==h?(e=(0,a.jsx)(eT,{className:h}),u[21]=h,u[22]=e):e=u[22],d=e;break e}c=(0,a.jsx)(eP.N,{mode:"wait",children:0===e.length?(0,a.jsx)(eO.P.div,{initial:{opacity:0}
697,animate:{opacity:1},exit:{opacity:0},children:(0,a.jsx)(eT,{className:h})},"loading"):(0,a.jsx)(eO.P.div,{className:"flex flex-col gap-[4px]",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:e.map((e,t)=>{let{id:r,latestRevision:n}=e;return n?(0,a.jsx)(eO.P.div,{initial:{opacity:0,y:10*t},animate:{opacity:1,y:0},children:(0,a.jsx)(eS,{projectRevisionId:n.id,isLatest:m,className:h})},r):null})},"modules")})}u[15]=h,u[16]=x,u[17]=N?.projectGroupById?.projects.edges,u[18]=m,u[19]=c,u[20]=d}else c=u[19],d=u[20];return d!==Symbol.for("react.early_return_sentinel")?d:c};function eB(e){return!!e}function e$(e){let{node:t}=e;return t.id}function eF(e){return J.Cp(e)}function eH(e){let{node:t}=e;return t}var eq=r(552417),ez=r(125695),eV=r(57711),eW=r(233888),eY=r(430210),eQ=r(890292);let eX=e=>{let t,r,i,s,l=(0,n.c)(8),{className:c,error:d}=e;return l[0]!==c?(t=(0,o.cn)(c,"flex items-center gap-[10px] text-error"),l[0]=c,l[1]=t):t=l[1],l[2]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Q.A,{content:eQ.R$,className:"tablet:w-[16px] w-[20px]",size:"custom"}),l[2]=r):r=l[2],l[3]!==d?(i=(0,a.jsx)("p",{className:"tablet:text-body-xs text-body-md text-error",children:d}),l[3]=d,l[4]=i):i=l[4],l[5]!==t||l[6]!==i?(s=(0,a.jsxs)("div",{className:t,children:[r,i]}),l[5]=t,l[6]=i,l[7]=s):s=l[7],s};function eK(e){let t,r,i=(0,n.c)(4);i[0]!==e.errors?(t=Object.values(e.errors).map(eJ),i[0]=e.errors,i[1]=t):t=i[1];let s=t.join("\n");return s?(i[2]!==s?(r=(0,a.jsx)(eX,{error:s}),i[2]=s,i[3]=r):r=i[3],r):null}function eJ(e){let{message:t}=e;return t}var eZ=r(330547),e0=r(35279),e1=r(244893),e2=r(982027);let e3=(0,v.U)(` 698 mutation ClaimSlugForChat($input: ClaimSlugInput!) { 699 claimSlugForChat(input: $input) { 700 success 701 projectGroup { 702 ...ClaimSlugProjectGroup 703 } 704 revision { 705 ...ProjectGroupRevisionForChat 706 } 707 } 708 } 709`),e4=(0,v.U)(` 710 query IsSlugAvailable($slug: String!) { 711 isSlugAvailable(slug: $slug) { 712 isAvailable 713 } 714 } 715`);function e5(e){let t,r,s,l,c,d,u,p,m,x,h,g,f,b,y,v=(0,n.c)(45),{className:j}=e,I=(0,eA.MN)(),[w]=(0,Z.n)(e3),[N]=(0,ei._)(e4),T=(0,A.eE)(e8);v[0]!==I?(t={defaultValues:async()=>I.slug?{slug:I.slug}:{slug:""},mode:"onSubmit"},v[0]=I,v[1]=t):t=v[1];let{handleSubmit:E,register:S,setError:_,formState:k,reset:C}=(0,V.mN)(t),{isSubmitting:R,errors:G}=k,P=(0,e1.rl)(),O=(0,e2.C)(e7);v[2]!==w||v[3]!==N||v[4]!==I||v[5]!==T||v[6]!==_||v[7]!==O||v[8]!==P?(r=async e=>{let{data:t}=await N({variables:{slug:e}});if(!t?.isSlugAvailable.isAvailable)return _("slug",{message:"That domain is taken. Try another."}),!1;let r=(0,eW.a)();return await w({variables:{input:{projectGroupId:I.id,slug:e}},optimisticResponse:{claimSlugForChat:{success:!0,projectGroup:{__typename:"ProjectGroup",id:I.id,slug:e,publishState:i.ProjectGroupPublishState.HAS_UPDATES},revision:{__typename:"ProjectGroupRevision",id:eV.I,action:i.ProjectGroupRevisionAction.PUBLISH_PROJECT_AND_CONTINUE_CHAT,autoSelectedAction:i.ProjectGroupRevisionAction.PUBLISH_PROJECT_AND_CONTINUE_CHAT,status:i.ProjectGroupRevisionStatus.VALID,chat:{__typename:"ProjectGroupChat",id:eV.I,content:"",attachments:null},thread:"string"==typeof P?{id:P,__typename:"ProjectGroupRevisionThread",updatedAt:new Date().toISOString(),title:null}:null,response:null,previewURL:null,createdAt:new Date().toISOString(),userRating:null,generationContext:null,generationDurationMs:null,queuedMessages:[]}}},update:(e,t)=>{let{data:a}=t,n=a?.claimSlugForChat.revision;n&&(O({revisionId:n.id,threadId:n.thread?.id??null}),(0,eY.m)({cache:e,projectGroupId:I.id,revision:a.claimSlugForChat.revision,clientId:r,threadId:null}),T?.())}}),!0},v[2]=w,v[3]=N,v[4]=I,v[5]=T,v[6]=_,v[7]=O,v[8]=P,v[9]=r):r=v[9];let U=r;v[10]!==U||v[11]!==C?(s=async e=>{let{slug:t}=e;await U(t)&&C({slug:t})},v[10]=U,v[11]=C,v[12]=s):s=v[12];let M=s;v[13]!==E||v[14]!==M?(l=E(M),v[13]=E,v[14]=M,v[15]=l):l=v[15];let L=l,D=(0,e0.OD)();v[16]!==j?(c=(0,o.cn)("flex flex-col gap-[10px]",j),v[16]=j,v[17]=c):c=v[17];let B=G.slug&&"border-error focus:border-error";v[18]!==B?(d=(0,o.cn)("w-full flex-1 rounded-l border border-comeback-gray-75 bg-white py-[6px] pl-[8px] tablet:text-sm outline-none selection:bg-[#E9EBFD] placeholder:text-comeback-gray-500 focus:border-link",B),v[18]=B,v[19]=d):d=v[19],v[20]!==S?(u=S("slug",eZ.T),v[20]=S,v[21]=u):u=v[21],v[22]!==D||v[23]!==d||v[24]!==u?(p=(0,a.jsx)("input",{className:d,placeholder:"name","aria-label":"Your site's address",...u,autoF
715ocus:D}),v[22]=D,v[23]=d,v[24]=u,v[25]=p):p=v[25];let F=G.slug&&"border-error";return v[26]!==F?(m=(0,o.cn)("rounded-r border-comeback-gray-50 border-y border-r p-[6px] tablet:text-sm text-comeback-gray-500",F),v[26]=F,v[27]=m):m=v[27],v[28]!==m?(x=(0,a.jsxs)("div",{className:m,children:[".",ez.Ay.NEXT_PUBLIC_HOSTED_DOMAIN]}),v[28]=m,v[29]=x):x=v[29],v[30]!==p||v[31]!==x?(h=(0,a.jsxs)("label",{className:"flex items-center rounded bg-comeback-gray-25",children:[p,x]}),v[30]=p,v[31]=x,v[32]=h):h=v[32],v[33]!==G?(g=(0,a.jsx)(eK,{errors:G}),v[33]=G,v[34]=g):g=v[34],v[35]!==h||v[36]!==g?(f=(0,a.jsxs)("div",{className:"flex flex-col gap-[8px]",children:[h,g]}),v[35]=h,v[36]=g,v[37]=f):f=v[37],v[38]!==R?(b=(0,a.jsx)($.Button,{type:"submit",color:"dark",className:"w-fit self-end",disabled:R,children:"Save"}),v[38]=R,v[39]=b):b=v[39],v[40]!==L||v[41]!==f||v[42]!==b||v[43]!==c?(y=(0,a.jsxs)("form",{className:c,onSubmit:L,children:[f,b]}),v[40]=L,v[41]=f,v[42]=b,v[43]=c,v[44]=y):y=v[44],y}function e7(e){return e.addRevisionId}function e8(e){return e.actions?.scrollToEnd}let e6=(0,v.U)(` 716 query GetProjectGroupForPublish($id: ID!) { 717 projectGroupById(id: $id) { 718 ...ProjectGroupForPublish 719 } 720 } 721`),e9=({className:e})=>{let t=(0,eA.MN)(),{data:r,loading:n}=(0,j.I)(e6,{variables:{id:t.id}}),s=r?.projectGroupById.publishState,l=(r?.projectGroupById.domains??[])?.[0]?.domain??`https://${r?.projectGroupById.slug??""}.${ez.Ay.NEXT_PUBLIC_HOSTED_DOMAIN}`,c=(e=>{switch(e){case i.ProjectGroupPublishState.NO_DOMAIN_CLAIMED:case i.ProjectGroupPublishState.HAS_UPDATES:return!0;case i.ProjectGroupPublishState.UP_TO_DATE:case i.ProjectGroupPublishState.NEVER_PUBLISHED_BEFORE:case void 0:return!1;default:return e}})(s),d=(0,y.useRef)(null),u=(0,y.useCallback)(async()=>{try{d.current?.select(),await navigator.clipboard.writeText(l)}catch(e){J.Cp(Error("Could not copy text",{cause:e}))}},[l]);return n?null:c?(0,a.jsx)(e5,{className:e}):(0,a.jsxs)("div",{className:(0,o.cn)("relative flex items-center rounded",e),onClick:u,onKeyDown:async e=>{"Enter"===e.key&&await u()},children:[(0,a.jsx)("input",{value:l,ref:d,readOnly:!0,"aria-label":"published address",onClick:u,className:"w-full flex-shrink-0 overflow-clip whitespace-nowrap rounded border border-comeback-gray-75 bg-white px-[12px] py-[5px]"}),(0,a.jsx)(eq.Ay,{textToCopy:l,variant:"tooltip",className:"absolute right-0 flex h-full items-center rounded-r border border-comeback-gray-75 bg-comeback-gray-25 p-[8px] transition-colors hover:bg-comeback-gray-50"})]})};var te=r(63174),tt=r(434666),tr=r(756275);let ta=(0,v.U)(` 722 query SecretsForFunction( 723 $projectGroupId: ID! 724 $environment: CreateEnvironment 725 ) { 726 projectGroupById(id: $projectGroupId) { 727 id 728 secrets(environment: $environment) { 729 edges { 730 node { 731 ...SecretsForProjectGroup 732 } 733 } 734 } 735 } 736 } 737`),tn=(0,v.U)(` 738 mutation AddSecretsToProjectGroupForChat($input: AddSecretsForChatInput!) { 739 addSecretsForChat(input: $input) { 740 projectGroup { 741 id 742 secrets { 743 edges { 744 node { 745 id 746 displayName 747 } 748 } 749 } 750 } 751 revision { 752 ...ProjectGroupRevisionForChat 753 } 754 } 755 } 756`),ti=(0,v.U)(` 757 mutation AddSecretsToProjectGroup($input: AddSecretsInput!) { 758 addSecrets(input: $input) { 759 projectGroup { 760 id 761 secrets { 762 edges { 763 node { 764 id 765 displayName 766 } 767 } 768 } 769 } 770 } 771 } 772`),ts=e=>{let t,r,s,l,c,d,u,p,m,x,h,g,f,b,v=(0,n.c)(47),{secretNames:I,isLatest:w,className:N}=e,[T,E]=(0,Z.n)(tn),{loading:S}=E,[_]=(0,Z.n)(ti),k=(0,eA.MN)(),[C]=(0,ei._)(ta),[R,G]=(0,tr.ko)(),{set:P}=G;v[0]!==C||v[1]!==k.id||v[2]!==I||v[3]!==P?(t={defaultValues:async()=>{let e=new Map((await C({variables:{environment:i.CreateEnvironment.PRODUCTION,projectGroupId:k.id}})).data?.projectGroupById.secrets.edges.map(tl));return[...e.keys()].forEach(e=>{P(e,!0)}),{secrets:I.map(t=>({name:t,key:e.get(t)??""}))}},mode:"onSubmit"},v[0]=C,v[1]=k.id,v[2]=I,v[3]=P,v[4]=t):t=v[4];let{register:O,formState:U,handleSubmit:M,control:L}=(0,V.mN)(t),{errors:D}=U,[B,F]=(0,tr.ko)(),{set:H,setAll:q}=F;v[5]!==L?(r={control:L,name:"secrets"},v[5]=L,v[6]=r):r=v[6];let{fields:z,update:W}=(0,V.jz)(r);v[7]!==k.id?(s={variables:{projectGroupId:k.id,environment:i.CreateEnvironment.PRODUCTION}},v[7]=k.id,v[8]=s):s=v[8];let{data:Y}=(0,j.I)(ta,s),Q=(0,y.useRef)(!1);v[9]!==Y||v[10]!==I||v[11]!==H||v[12]!==W?(l=()=>{Y&&!Q.current&&(Q.current=!0,Y.projectGroupById.secrets.edges.forEac
772h(e=>{let t=I.indexOf(e.node.displayName),r=e.node.value;-1===t||r&&(H(e.node.displayName,!0),W(t,{key:r,name:e.node.displayName}))}))},c=[Y,I,H,W],v[9]=Y,v[10]=I,v[11]=H,v[12]=W,v[13]=l,v[14]=c):(l=v[13],c=v[14]),(0,y.useEffect)(l,c);let X=new Map((Y?.projectGroupById?.secrets?.edges??[]).flatMap(to)),{cache:K}=(0,tt.m)(),J=(0,A.eE)(tc);v[15]!==J?(d=()=>{setTimeout(()=>{J?.()},100)},v[15]=J,v[16]=d):d=v[16];let ee=d,et=(0,e1.rl)(),er=(0,ef.useDispatch)(),ea=(0,e2.C)(td),en=M(async e=>{let{secrets:t}=e;if(et===e1.w2)return;K.writeQuery({query:ta,data:{__typename:"Query",projectGroupById:{...Y?.projectGroupById,id:k.id,secrets:{__typename:"SecretsConnection",edges:t.map((e,t)=>{let{name:r,key:a}=e;return{__typename:"SecretsEdge",node:{__typename:"Secret",id:X.get(r)?.id??`FAKE_ID_${t}`,createdAt:X.get(r)?.createdAt??new Date().toISOString(),updatedAt:X.get(r)?.updatedAt??new Date().toISOString(),displayName:r,envKey:r,value:a,environment:i.CreateEnvironment.PRODUCTION}}})}}},variables:{projectGroupId:k.id,environment:i.CreateEnvironment.PRODUCTION}});let r=(0,eW.a)();q(I.map(tu));let a={input:{projectGroupId:k.id,secrets:t.map(tp),environment:i.CreateEnvironment.PRODUCTION}},n=await T({variables:a,update:(e,t)=>{let{data:a}=t,n=a?.addSecretsForChat.revision;n&&((0,eY.m)({cache:e,projectGroupId:k.id,revision:n,clientId:r,threadId:et}),ee?.())}}),s=n.data?.addSecretsForChat.revision.id;s&&ea({revisionId:s,threadId:et}),er({type:"refresh-ui"})},tm);v[17]!==_||v[18]!==k.id||v[19]!==P?(u=e=>{let{name:t}=e;return async()=>{let e={input:{projectGroupId:k.id,secrets:[{displayName:t,value:""}],environment:i.CreateEnvironment.PRODUCTION}};P(t,!0),await _({variables:e})}},v[17]=_,v[18]=k.id,v[19]=P,v[20]=u):u=v[20];let es=u,el=I.every(e=>!!B.get(e)&&!!X.get(e));v[21]!==R?(p=e=>{let{name:t}=e;return!R.get(t)},v[21]=R,v[22]=p):p=v[22];let eo=z.filter(p);v[23]!==_||v[24]!==k.id||v[25]!==I||v[26]!==q||v[27]!==P?(m=async()=>{q(I.map(tx)),I.forEach(e=>{P(e,!0)});let e={input:{projectGroupId:k.id,secrets:I.map(th),environment:i.CreateEnvironment.PRODUCTION}};await _({variables:e})},v[23]=_,v[24]=k.id,v[25]=I,v[26]=q,v[27]=P,v[28]=m):m=v[28];let ec=m,ed=(0,e0.OD)();if(!eo.length)return null;v[29]!==N?(x=(0,o.cn)("flex max-w-[75%] flex-col items-end gap-[10px]",N),v[29]=N,v[30]=x):x=v[30];let eu=eo.map((e,t)=>{let{name:r,key:n,id:i}=e,s=!!B.get(r)&&!!X.get(r);return(0,a.jsx)(te.r,{isLocked:s,initialIsVisible:!0,fieldName:r,hasError:!!D.secrets?.[t]?.key,inputProps:O(`secrets.${t}.key`,{required:`Add ${r.toLowerCase().replace(/_/g," ")}`,value:n}),autoFocus:0===t&&w&&ed,onDismiss:es({name:r}),onUnlock:()=>{if(H(r,!1),!X.get(r))return}},i)});v[31]!==ec||v[32]!==el||v[33]!==S||v[34]!==I.length?(h=I.length>1?(0,a.jsx)($.Button,{type:"button",color:"light",disabled:el||S,onPress:ec,children:"Dismiss All"}):null,v[31]=ec,v[32]=el,v[33]=S,v[34]=I.length,v[35]=h):h=v[35];let ep=el||S,em=el?"Saved":"Save";return v[36]!==ep||v[37]!==em?(g=(0,a.jsx)($.Button,{type:"submit",color:"dark",disabled:ep,children:em}),v[36]=ep,v[37]=em,v[38]=g):g=v[38],v[39]!==h||v[40]!==g?(f=(0,a.jsxs)("div",{className:"flex gap-[4px]",children:[h,g]}),v[39]=h,v[40]=g,v[41]=f):f=v[41],v[42]!==en||v[43]!==x||v[44]!==eu||v[45]!==f?(b=(0,a.jsxs)("form",{className:x,onSubmit:en,autoComplete:"off",children:[eu,f]}),v[42]=en,v[43]=x,v[44]=eu,v[45]=f,v[46]=b):b=v[46],b};function tl(e){return[e.node.envKey,e.node.value]}function to(e){let t=e?.node;return t?.displayName?[[t.displayName,t]]:[]}function tc(e){return e.actions?.scrollToEnd}function td(e){return e.addRevisionId}function tu(e){return[e,!0]}function tp(e){let{name:t,key:r}=e;return{displayName:t,value:r}}function tm(e){J.Cp(Error("Failed to submit form"),{extra:{errors:e}})}function tx(e){return[e,!1]}function th(e){return{displayName:e,value:""}}var tg=r(359878),tf=r(38500),tb=r(85694);let ty="golden-style-id:",tv=({option:e})=>{let t=e.match(RegExp(`\\[${ty}([0-9a-fA-F-]{36})\\]`)),r=e.match(RegExp("\\[golden-style-preview-url:([^]]+)\\]")),a=e.match(RegExp("\\[golden-style-preview-project-id:([0-9a-fA-F-]{36})\\]")),n=t?.[1]??null,i=a?.[1]??null,s=r?.[1]?decodeURIComponent(r[1]):i?`/deployed/${i}/opengraph-image`:null;return n||s?{projectGroupId:n,previewUrl:s,displayOption:e.replace(t?.[0]??"","").replace(r?.[0]??"","").replace(a?.[0]??"","").replace(/\s+/g," ").trim()}:{projectGroupId:null,previewUrl:null,displayOption:e}},tj=({option:e})=>{let{projectGroupId:t,displayOption:r}=tv({option:e});return t?`${r} 773<!-- [${ty}${t}] -->`:r}
773,tI=e=>{let t,r,s,l,c,d,u=(0,n.c)(20),{question:p,value:m,onChange:x,isDisabled:h}=e;if(u[0]!==h||u[1]!==x||u[2]!==p.options||u[3]!==p.question||u[4]!==m){let e=p.options?.some(tE)??!1;s="flex flex-col gap-[8px]",u[9]!==p.question?(l=(0,a.jsx)("p",{className:"font-medium text-body-sm",children:p.question}),u[9]=p.question,u[10]=l):l=u[10];let n=e?"flex-col":"flex-wrap";u[11]!==n?(t=(0,o.cn)("flex gap-[8px]",n),u[11]=n,u[12]=t):t=u[12],r=p.options?.map(t=>{let{projectGroupId:r,displayOption:n}=tv({option:t}),s=(({option:e})=>{let[t]=e.split("â");return(t??e).replace(/\s*\([0-9.]+\)\s*$/,"").trim()})({option:n}),l=r?(({projectGroupId:e})=>ez.Ay.NEXT_PUBLIC_HOSTED_DOMAIN.includes("localhost")?(0,tg.e)({projectGroupId:e,projectGroupRevisionId:null,server:"web",pathname:"/",devServerDomain:null,environment:i.SandboxEnvironment.BUILDER}):(0,L.wO)({projectGroupId:e,slug:null}))({projectGroupId:r}):null;return(0,a.jsxs)("div",{className:(0,o.cn)("flex flex-col gap-[6px]",e&&"w-full min-w-0"),children:[(0,a.jsx)(tb.q,{type:"button",onPress:()=>x(t),disabled:h,className:(0,o.cn)(e&&"w-full max-w-none",m===t&&"border-comeback-blue-500 bg-comeback-blue-50 text-comeback-blue-700"),children:s}),l&&r?(0,a.jsxs)("a",{href:`/share/${r}`,target:"_blank",rel:"noreferrer",className:"group block w-full overflow-hidden rounded-[8px] border border-comeback-gray-100",children:[(0,a.jsx)("iframe",{title:`${s} preview`,src:l,scrolling:"no",className:"h-[320px] w-full border-0 pointer-events-none"}),(0,a.jsx)("div",{className:"px-[8px] py-[6px] text-[12px] font-medium text-comeback-blue-500 group-hover:text-comeback-blue-700",children:"Open in new tab"})]}):null]},t)}),u[0]=h,u[1]=x,u[2]=p.options,u[3]=p.question,u[4]=m,u[5]=t,u[6]=r,u[7]=s,u[8]=l}else t=u[5],r=u[6],s=u[7],l=u[8];return u[13]!==t||u[14]!==r?(c=(0,a.jsx)("div",{className:t,children:r}),u[13]=t,u[14]=r,u[15]=c):c=u[15],u[16]!==s||u[17]!==l||u[18]!==c?(d=(0,a.jsxs)("div",{className:s,children:[l,c]}),u[16]=s,u[17]=l,u[18]=c,u[19]=d):d=u[19],d},tw=e=>{let t,r,i,s,l,c=(0,n.c)(15),{question:d,value:u,onChange:p,isDisabled:m}=e;c[0]!==p||c[1]!==u?(t=e=>{u.includes(e)?p(u.filter(t=>t!==e)):p([...u,e])},c[0]=p,c[1]=u,c[2]=t):t=c[2];let x=t;return c[3]!==d.question?(r=(0,a.jsx)("p",{className:"font-medium text-body-sm",children:d.question}),c[3]=d.question,c[4]=r):r=c[4],c[5]!==m||c[6]!==d.options||c[7]!==x||c[8]!==u?(i=d.options?.map(e=>(0,a.jsx)(tb.q,{type:"button",onPress:()=>x(e),disabled:m,className:(0,o.cn)(u.includes(e)&&"border-comeback-blue-500 bg-comeback-blue-50 text-comeback-blue-700"),children:e},e)),c[5]=m,c[6]=d.options,c[7]=x,c[8]=u,c[9]=i):i=c[9],c[10]!==i?(s=(0,a.jsx)("div",{className:"flex flex-wrap gap-[8px]",children:i}),c[10]=i,c[11]=s):s=c[11],c[12]!==r||c[13]!==s?(l=(0,a.jsxs)("div",{className:"flex flex-col gap-[8px]",children:[r,s]}),c[12]=r,c[13]=s,c[14]=l):l=c[14],l},tN=e=>{let t,r,i,s,l=(0,n.c)(11),{question:o,value:c,onChange:d,isDisabled:u}=e;return l[0]!==o.question?(t=(0,a.jsx)("p",{className:"font-medium text-body-sm",children:o.question}),l[0]=o.question,l[1]=t):t=l[1],l[2]!==d?(r=e=>d(e.target.value),l[2]=d,l[3]=r):r=l[3],l[4]!==u||l[5]!==r||l[6]!==c?(i=(0,a.jsx)(tf.A_,{value:c,onChange:r,placeholder:"Type your answerâ¦",disabled:u,className:"w-full"}),l[4]=u,l[5]=r,l[6]=c,l[7]=i):i=l[7],l[8]!==t||l[9]!==i?(s=(0,a.jsxs)("div",{className:"flex flex-col gap-[8px]",children:[t,i]}),l[8]=t,l[9]=i,l[10]=s):s=l[10],s},tT=({data:e,isDisabled:t,revisionAction:r})=>{let{questions:n}=e,{handleChat:s,mutationResult:{called:l}}=(0,R.n)(),c=(0,A.eE)(e=>e.actions?.scrollToEnd),d=t||l,u={};for(let e of n)"multi_select"===e.type?u[e.id]=[]:u[e.id]="";let{setValue:p,watch:m,handleSubmit:x}=(0,V.mN)({defaultValues:u}),h=m(),g=n.every(e=>{let t=h[e.id];return Array.isArray(t)?t.length>0:"string"==typeof t&&t.trim().length>0}),[f,b]=(0,y.useState)(!1),v=x(e=>{s({chat:function({questions:e,values:t}){let r=!1,a=null,n=e.map(e=>{let n=t[e.id];if(Array.isArray(n))return r=r||n.some(e=>tv({option:e}).projectGroupId),`**${e.question}** 774${n.map(e=>tj({option:e})).join(", ")}`;let i=n??"";if(r=r||null!==tv({option:i}
774).projectGroupId,!a){let t=(e.options??[]).map((e,t)=>{let r=tv({option:e});return r.projectGroupId?{goldenDesignId:r.projectGroupId,rank:t+1}:null}).filter(e=>null!==e);t.length>0&&(a={prompt:null,selectedGoldenDesignId:tv({option:i}).projectGroupId,candidates:t})}return`**${e.question}** 775${tj({option:i})}`}).join("\n\n");if(!r)return n;let i=a?btoa(JSON.stringify(a)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,""):null;return`${n}${i?` 776<!-- [golden-style-tournament:v1:${i}] -->`:""} 777 778The design style is now selected. Continue implementing the existing app request from this thread immediately using this style as the baseline. Do not ask what to build, do not ask for clarification, and start writing code now.`}({questions:n,values:e}),action:r??i.ProjectGroupRevisionAction.CHAT,isThinkingMode:!1,attachments:null}),c?.()}),j=(0,y.useCallback)(e=>{if(!g){e.preventDefault(),b(!0);return}v(e)},[g,v]),I=(0,y.useCallback)(e=>{if("Enter"===e.key&&(e.metaKey||e.ctrlKey)){if(e.preventDefault(),!g)return void b(!0);d||v()}},[g,d,v]);return(0,a.jsxs)("form",{onSubmit:j,onKeyDown:I,className:(0,o.cn)("flex w-full flex-col gap-[16px] rounded-[8px] border border-comeback-gray-75 p-[16px]",d&&"pointer-events-none opacity-40"),children:[n.map(e=>{switch(e.type){case"single_select":return(0,a.jsx)(tI,{question:e,value:"string"==typeof h[e.id]&&h[e.id]||null,onChange:t=>p(e.id,t),isDisabled:d},e.id);case"multi_select":return(0,a.jsx)(tw,{question:e,value:Array.isArray(h[e.id])?h[e.id]:[],onChange:t=>p(e.id,t),isDisabled:d},e.id);case"free_text":return(0,a.jsx)(tN,{question:e,value:"string"==typeof h[e.id]?h[e.id]:"",onChange:t=>p(e.id,t),isDisabled:d},e.id);default:return null}}),(0,a.jsxs)("div",{className:"flex flex-col gap-[8px]",children:[(0,a.jsx)($.Button,{type:"submit",variant:"dark",disabled:d,className:"w-fit",children:"Submit"}),f&&!g&&(0,a.jsx)("p",{className:"text-body-xs text-comeback-red-500",children:"Please answer all questions before submitting."})]})]})};function tE(e){return null!==tv({option:e}).projectGroupId}var tS=r(374282),t_=r(386010),tk=r(481446),tC=r(148999),tR=r(142886),tA=r(471976),tG=r(904230),tP=r(433524),tO=r(213728),tU=r(57757);let tM="planning_analysis";function tL(){let e,t=(0,n.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsxs)(eO.P.div,{className:"flex items-center gap-[8px]",initial:{opacity:0}
778,animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[(0,a.jsx)(tU.a9,{className:"h-[8px] w-[8px]"}),(0,a.jsx)("span",{className:"text-[13px] text-comeback-gray-200",children:"Writing planâ¦"})]},"loading"),t[0]=e):e=t[0],e}let tD=({planContent:e,isDisabled:t,isStreaming:r})=>{let n,s,l,c=r&&(n=`<${tM}`,s=`</${tM}>`,-1!==(l=e.lastIndexOf(n))&&-1===e.indexOf(s,l)),d=c?"":(0,tA.splitIntoBlocks)(e,[tM]).filter(e=>"tag"!==e.type||e.tag!==tM).map(e=>e.original).join("").trim(),[u,p]=(0,y.useState)(""),{handleChat:m,mutationResult:{called:x}}=(0,R.n)(),h=(0,A.eE)(e=>e.actions?.scrollToEnd),g=(0,A.RB)(e=>"left-chat"===e),f=(0,t_.yT)(e=>e.setSelection),b=(0,tO.O)(e=>e.setPlan),v=(0,tO.O)(e=>e.dismissed),j=(0,e1.rl)(),I=j===e1.w2?null:"string"==typeof j?j:null,w=(0,tC.L)(e=>j!==e1.w2&&(e.value.isGenerating.get(I)??!1)),N=t||x||w,T=(0,y.useRef)(null),E=(0,y.useMemo)(()=>{let e=(0,tG.Q)(d);return e&&e.steps.length>0&&(T.current=e),e??T.current},[d]),S=(0,y.useMemo)(()=>(E?.steps??[]).map((e,t)=>({...e,stepNumber:t+1})),[E]);(0,y.useEffect)(()=>{g&&b({planContent:e,isStreaming:r,isDisabled:t})},[g,e,r,t,b]),(0,y.useEffect)(()=>{g&&r&&!v&&f(tk.e.PLAN)},[g,r,v,f]);let _=(0,tC.L)(e=>e.setMode),k=(0,tR.o)(),C=!r&&E,G=E?.steps.length??0;if(g)return(0,a.jsxs)("button",{type:"button",className:(0,o.cn)("flex w-full items-center gap-[12px] rounded-[8px] border border-comeback-gray-75 p-[12px] text-left transition-colors hover:bg-comeback-gray-25",N&&!r&&"pointer-events-none opacity-40"),onClick:()=>{b({planContent:e,isStreaming:r,isDisabled:t}),f(tk.e.PLAN)},children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-[8px]",children:[0===G?(0,a.jsx)(tU.a9,{className:"h-[8px] w-[8px]"}):null,(0,a.jsx)("span",{className:"text-[13px] font-semibold text-comeback-gray-500",children:E?.title??"Implementation Plan"}),G>0?(0,a.jsxs)("span",{className:"text-[11px] font-medium uppercase tracking-[0.05em] text-comeback-gray-200",children:[G," ",1===G?"step":"steps"]}):null]}),(0,a.jsx)("span",{className:"text-[12px] text-comeback-gray-200","aria-hidden":!0,children:"âº"})]});let P=u.trim().length>0,O=()=>{var e;e=u.trim(),m({chat:`Revise the plan based on my feedback: 779 780${e}`,action:i.ProjectGroupRevisionAction.PLAN_AGENT,isThinkingMode:!0,attachments:null}),h?.(),p("")};return(0,a.jsxs)("div",{className:(0,o.cn)("flex w-full flex-col gap-[16px] rounded-[8px] border border-comeback-gray-75 p-[16px]",N&&!r&&"pointer-events-none opacity-40"),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-[14px] font-semibold text-comeback-gray-500",children:E?.title??"Implementation Plan"}),(0,a.jsx)(eP.N,{children:G>0?(0,a.jsxs)(eO.P.span,{className:"text-[11px] font-medium uppercase tracking-[0.05em] text-comeback-gray-200",initial:{opacity:0}
780,animate:{opacity:1},children:[G," ",1===G?"step":"steps"]},G):null})]}),G>0?(0,a.jsx)("div",{className:"h-[1px] bg-comeback-gray-75"}):null,(0,a.jsx)("div",{className:"flex flex-col gap-[16px]",children:(0,a.jsxs)(eP.N,{children:[r&&(c||0===G)?(0,a.jsx)(tL,{}):null,S.map((e,t)=>(0,a.jsx)(tP.y,{step:e,stepNumber:e.stepNumber,isLastAndStreaming:r&&t===S.length-1,isStreaming:r},e.title))]})}),(0,a.jsx)(eP.N,{children:C?(0,a.jsxs)(eO.P.div,{className:"flex items-center gap-[8px] border-t border-comeback-gray-75 pt-[12px]",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.1},children:[(0,a.jsx)("input",{type:"text",value:u,disabled:N,onChange:e=>p(e.target.value),onKeyDown:e=>{"Enter"===e.key&&P&&O()},placeholder:"Add feedback to revise the planâ¦",className:"flex-1 bg-transparent text-[13px] text-comeback-gray-400 outline-none placeholder:text-comeback-gray-200 disabled:opacity-40"}),(0,a.jsx)($.Button,{type:"button",color:"dark",size:"sm",disabled:N,onPress:P?O:()=>{_(k),m({chat:"Approved. Execute the plan.",action:i.ProjectGroupRevisionAction.CHAT,isThinkingMode:!0,attachments:null}),h?.()},children:P?"Revise":"Approve"})]}):null})]})},tB=(0,v.U)(` 781 mutation SubmitSatisfactionSurvey($input: SubmitSatisfactionSurveyInput!) { 782 submitSatisfactionSurvey(input: $input) { 783 id 784 } 785 } 786`),t$=[{label:"Terrible",value:"TERRIBLE"},{label:"Bad",value:"BAD"},{label:"Good",value:"GOOD"},{label:"Great",value:"GREAT"}],tF=e=>"TERRIBLE"===e||"BAD"===e,tH=e=>{let t,r,s,l,c,d,u,p,m=(0,n.c)(29),{data:x,isDisabled:h,revisionId:g}=e,[f,b]=(0,y.useState)(null),[v,j]=(0,y.useState)(""),{handleChat:I,mutationResult:w}=(0,R.n)(),{called:N}=w,[T]=(0,Z.n)(tB),E=(0,A.eE)(tq),S=h||N;m[0]!==v||m[1]!==I||m[2]!==g||m[3]!==E||m[4]!==f||m[5]!==T?(t=()=>{if(!f)return;let e=t$.find(e=>e.value===f)?.label??f,t=tF(f)&&v.trim()?` 787 788Feedback: ${v.trim()}`:"";I({chat:`Rating: **${e}**${t}`,action:i.ProjectGroupRevisionAction.CHAT,isThinkingMode:!1,attachments:null}),g?T({variables:{input:{projectGroupRevisionId:g,rating:f,feedback:tF(f)&&v.trim()||null}}}).catch(tz):console.warn("No revisionId available to persist satisfaction survey"),E?.()},m[0]=v,m[1]=I,m[2]=g,m[3]=E,m[4]=f,m[5]=T,m[6]=t):t=m[6];let _=t,k=S&&"pointer-events-none opacity-40";m[7]!==k?(r=(0,o.cn)("mx-[16px] flex flex-col gap-[16px] rounded-[8px] border border-comeback-gray-75 p-[16px]",k),m[7]=k,m[8]=r):r=m[8],m[9]!==x.prompt?(s=(0,a.jsx)("p",{className:"font-medium text-body-sm",children:x.prompt}),m[9]=x.prompt,m[10]=s):s=m[10],m[11]!==S||m[12]!==f?(l=t$.map(e=>(0,a.jsx)(tb.q,{onPress:()=>b(e.value),disabled:S,className:(0,o.cn)(f===e.value&&"border-comeback-blue-500 bg-comeback-blue-50 text-comeback-blue-700"),children:e.label},e.value)),m[11]=S,m[12]=f,m[13]=l):l=m[13],m[14]!==l?(c=(0,a.jsx)("div",{className:"flex flex-wrap gap-[8px]",children:l}),m[14]=l,m[15]=c):c=m[15],m[16]!==S||m[17]!==v||m[18]!==f?(d=f&&tF(f)&&(0,a.jsx)(tf.A_,{value:v,onChange:e=>j(e.target.value),placeholder:"What's going wrong?",disabled:S,className:"w-full"}),m[16]=S,m[17]=v,m[18]=f,m[19]=d):d=m[19];let C=S||!f;return m[20]!==_||m[21]!==C?(u=(0,a.jsx)("div",{children:(0,a.jsx)(tb.q,{onPress:_,disabled:C,children:"Submit"})}),m[20]=_,m[21]=C,m[22]=u):u=m[22],m[23]!==u||m[24]!==r||m[25]!==s||m[26]!==c||m[27]!==d?(p=(0,a.jsxs)("div",{className:r,children:[s,c,d,u]}),m[23]=u,m[24]=r,m[25]=s,m[26]=c,m[27]=d,m[28]=p):p=m[28],p};function tq(e){return e.actions?.scrollToEnd}function tz(e){J.Cp(e)}var tV=r(387116);let tW=e=>{let t,r,s,l,c,d,u,p,m,x,h,g=(0,n.c)(17),{className:f,isLatestMessage:b}=e,{handleChat:y,mutationResult:v}=(0,R.n)(),{called:j}=v;if(!b)return null;g[0]!==y?(t=()=>{y({chat:"Please continue with the next step. Be concise and to the point.",action:i.ProjectGroupRevisionAction.CHAT,isThinkingMode:!1,attachments:null})},g[0]=y,g[1]=t):t=g[1];let I=t;g[2]!==I?(r=()=>{I()},g[2]=I,g[3]=r):r=g[3];let w=j&&"hidden";return g[4]!==f||g[5]!==w?(s=(0,o.cn)("comeback-text-body-md flex min-h-fit w-fit flex-row items-center justify-center overflow-hidden rounded-[8px] border-transparent bg-black px-[8px] py-[4px] text-left text-white shadow-sm outline-none transition-colors hover:bg-comeback-gray-700 active:bg-comeback-gray-600",w,f),g[4]=f,g[5]=w,g[6]=s):s=g[6],g[7]===Symbol.for("react.memo_cache_sentinel")?(l={opacity:0,y:-15,scale:.95},c={opacity:1,y:0,scale:1},g[7]=l,g[8]=c):(l=g[7],c=g[8]),g[9]===Symbol.for("react.memo_cache_sentinel")?(d={duration:.4,ease:"easeOut",layout:{duration:.4,ease:"easeOut"},delay:.7},g[9]=d):d=g[9],g[10]===Symbol.for("react.memo_cache_sentinel")?(m={opacity:0,y:-20},u={opacity:1,y:0},p={duration:.4,delay:.1,ease:"easeOut"},g[10]=u,g[11]=p,g[12]=m):(u=g[10],p=g[11],m=g[12]),g[13]===Symbol.for("react.memo_cache_sentinel")?(x=(0,a.jsx)(eO.P.div,{className:"flex w-full min-w-0 flex-row items-center justify-between gap-[12px]",initial:m,animate:u,transition:p,layout:!0,children:(0,a.jsxs)("div",{className:"flex flex-row items-center gap-[12px]",children:[(0,a.jsx)("p",{className:"text-body-sm text-white",children:"Continue generating"}),(0,a.jsx)(tV.N,{height:18,width:18,className:"text-white"})]})}),g[13]=x):x=g[13],g[14]!==r||g[15]!==s?(h=(0,a.jsx)(eO.P.button,{type:"button",onClick:r,className:s,initial:l,animate:c,layout:!0,transition:d,children:x}),g[14]=r,g[15]=s,g[16]=h):h=g[16],h};var tY=r(99873),tQ=r(400515);let tX=e=>{let t,r,s=(0,n.c)(7),{text:l,hidden:c,status:d,className:u}=e;return s[0]!==u||s[1]!==c||s[2]!==d||s[3]!==l?(t=!c&&(0,a.jsx)(eO.P.div,{initial:{opacity:0,height:0}
788,animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:(0,o.cn)("comeback-text-body-md flex w-full flex-row items-center justify-start gap-[12px] overflow-clip rounded-[8px] border-[1px] bg-white p-[8px] text-left text-comeback-gray-900 outline-none ring-1 transition-colors","border-comeback-gray-75 ring-transparent","max-w-[min(75%,300px)]",u),children:(0,a.jsxs)("div",{className:(0,o.cn)("flex min-w-0 flex-1 justify-start transition-[opacity,transform] duration-[200ms] ease-out","flex-row items-center gap-[8px]"),children:[(e=>{switch(e){case i.ToolCallTagStatus.RUNNING:return(0,a.jsx)(tQ.h,{size:"xxs"});case i.ToolCallTagStatus.SUCCESS:return(0,a.jsx)(f.I,{content:eQ.bC,size:"small",className:"text-comeback-green-500"});case i.ToolCallTagStatus.ERROR:return(0,a.jsx)(f.I,{content:tY.ZQ,size:"small",className:"text-comeback-yellow-500"});case i.ToolCallTagStatus.CANCELLED:return(0,a.jsx)(f.I,{content:tY.tx,size:"xs",className:"text-comeback-gray-500"});default:return null}})(d),(0,a.jsx)(b.E,{type:"body-md",weight:"medium",className:"truncate",title:l,children:l})]})}),s[0]=u,s[1]=c,s[2]=d,s[3]=l,s[4]=t):t=s[4],s[5]!==t?(r=(0,a.jsx)(eP.N,{children:t}),s[5]=t,s[6]=r):r=s[6],r};var tK=r(491387);let tJ=(0,tK.R)(),tZ=e=>{let t,r,i,s,l,c,d,u,p,m,x,h,g,f,b,v,j=(0,n.c)(26),{dialect:I,className:w,code:N,isGenerating:T}=e,E=void 0!==T&&T,S=I??"js",_=(0,y.useRef)(null),k=(0,y.useRef)(null),C=(0,y.useRef)(null);j[0]!==N?(t=!!N&&N.trim().length>0,j[0]=N,j[1]=t):t=j[1];let R=t;return j[2]!==E?(r=()=>{!E&&_.current&&(_.current.scrollTop=0)},i=[E],j[2]=E,j[3]=r,j[4]=i):(r=j[3],i=j[4]),(0,y.useEffect)(r,i),j[5]!==E?(s=()=>{let e;if(!E)return;let t=_.current?.scrollTop??0,r=()=>{let a=_.current;if(a){let e=a.scrollHeight-a.clientHeight;e-t>0&&(a.scrollTop=t=Math.min(e,t+.4))}e=requestAnimationFrame(r)};return e=requestAnimationFrame(r),()=>{cancelAnimationFrame(e)}},l=[E],j[5]=E,j[6]=s,j[7]=l):(s=j[6],l=j[7]),(0,y.useEffect)(s,l),j[8]===Symbol.for("react.memo_cache_sentinel")?(d={opacity:0},u={opacity:1},p={opacity:0},c={duration:.3,ease:"easeInOut"},j[8]=c,j[9]=d,j[10]=u,j[11]=p):(c=j[8],d=j[9],u=j[10],p=j[11]),j[12]!==w?(m=(0,o.cn)("flex w-fit flex-col items-center justify-center overflow-hidden bg-white",w),j[12]=w,j[13]=m):m=j[13],j[14]===Symbol.for("react.memo_cache_sentinel")?(x=(0,a.jsx)("div",{className:"pointer-events-none absolute inset-0 z-raised",style:{background:"\n linear-gradient(to bottom, white 0, transparent 32px, transparent calc(100% - 32px), white 100%),\n linear-gradient(to right, white 0, transparent 64px, transparent calc(100% - 64px), white 100%),\n linear-gradient(to top, white 0, transparent 32px),\n linear-gradient(to left, white 0, transparent 64px)\n "}}),j[14]=x):x=j[14],j[15]===Symbol.for("react.memo_cache_sentinel")?(h={opacity:0},g={opacity:1},f={duration:.3,ease:"easeInOut"},j[15]=h,j[16]=g,j[17]=f):(h=j[15],g=j[16],f=j[17]),j[18]!==N||j[19]!==R||j[20]!==E||j[21]!==S?(b=(0,a.jsxs)("div",{className:"relative h-[200px] max-h-[200px] w-full",children:[x,(0,a.jsx)("div",{ref:_,className:"no-scrollbar pointer-events-none relative h-full w-full select-none overflow-x-hidden overflow-y-scroll",children:(0,a.jsx)(eO.P.div,{initial:h,animate:g,transition:f,className:"relative",children:R?(0,a.jsx)("div",{ref:C,className:"relative",style:{willChange:"transform"},children:(0,a.jsx)(tK.g,{ref:k,compartment:tJ,isGenerating:E,dialect:S,theme:"light",showLineNumbers:!0,lineWrapping:!1,code:N||"",className:(0,o.cn)("no-scrollbar whitespace-pre-wrap bg-comeback-gray-50 font-mono text-body-xs")})}):(0,a.jsx)(tK.g,{ref:k,compartment:tJ,isGenerating:E,dialect:S,theme:"light",showLineNumbers:!0,lineWrapping:!1,code:N||"",className:(0,o.cn)("no-scrollbar whitespace-pre-wrap border-comeback-gray-75 bg-comeback-gray-50 font-mono text-body-xs")})})})]}),j[18]=N,j[19]=R,j[20]=E,j[21]=S,j[22]=b):b=j[22],j[23]!==m||j[24]!==b?(v=(0,a.jsx)(eP.N,{children:(0,a.jsx)(eO.P.div,{initial:d,animate:u,exit:p,transition:c,className:"absolute inset-0 z-base flex h-full items-center justify-start bg-white",children:(0,a.jsx)("div",{className:m,children:b})})}),j[23]=m,j[24]=b,j[25]=v):v=j[25],v},t0=e=>{let t,r,i,s,l,c,d,u,p,m,x,h,g,f,b=(0,n.c)(27),{text:y,subtext:v,status:j,isLatest:I,progress:w}=e;if("success"===j){let e,t,r,n,i;return b[0]===Symbol.for("react.memo_cache_sentinel")?(e={opacity:0}
788,t={opacity:1},r={duration:.3},n=(0,a.jsx)("div",{className:"h-[6px] w-[6px] flex-shrink-0 rounded-full bg-comeback-gray-300"}),b[0]=e,b[1]=t,b[2]=r,b[3]=n):(e=b[0],t=b[1],r=b[2],n=b[3]),b[4]!==y?(i=(0,a.jsxs)(eO.P.div,{className:"flex flex-row items-center gap-x-[8px] py-[4px]",initial:e,animate:t,transition:r,children:[n,(0,a.jsx)("p",{className:"text-comeback-gray-400 text-xs",children:y})]}),b[4]=y,b[5]=i):i=b[5],i}if(!I||"running"!==j)return null;b[6]!==v?(t=function(e){if(!e)return null;let t=e.split("\n").filter(e=>""!==e.trim());return t[t.length-1]??null}(v),b[6]=v,b[7]=t):t=b[7];let N=t;return b[8]===Symbol.for("react.memo_cache_sentinel")?(r=(0,o.cn)("comeback-text-body-md flex w-full flex-row items-start justify-start overflow-hidden rounded-[8px] border border-comeback-gray-75 bg-white text-left text-comeback-gray-900 outline-none transition-colors","p-[8px]"),i={opacity:0,scale:.95},s={opacity:1,scale:1},l={duration:.3,ease:"easeOut"},b[8]=r,b[9]=i,b[10]=s,b[11]=l):(r=b[8],i=b[9],s=b[10],l=b[11]),b[12]===Symbol.for("react.memo_cache_sentinel")?(c=(0,a.jsx)("div",{className:"flex-shrink-0 px-[2px]",children:(0,a.jsx)(eO.P.div,{className:"flex h-[16px] w-[16px] items-center justify-center",children:(0,a.jsx)(eO.P.div,{className:"h-[8px] w-[8px] rounded-full bg-comeback-yellow-400",animate:{opacity:[1,.4,1]},transition:{duration:1.5,repeat:1/0,ease:"easeInOut"}})})}),b[12]=c):c=b[12],b[13]===Symbol.for("react.memo_cache_sentinel")?(u={opacity:0,y:-10},p={opacity:1,y:0},m={opacity:0,y:10},d={duration:.3,ease:"easeOut"},b[13]=d,b[14]=u,b[15]=p,b[16]=m):(d=b[13],u=b[14],p=b[15],m=b[16]),b[17]!==y?(x=(0,a.jsxs)("div",{className:"flex min-w-0 max-w-full flex-row items-center gap-x-[12px]",children:[c,(0,a.jsx)(eP.N,{mode:"wait",children:(0,a.jsx)(eO.P.p,{className:"truncate font-medium text-comeback-gray-700 text-sm",initial:u,animate:p,exit:m,transition:d,children:y})})]}),b[17]=y,b[18]=x):x=b[18],b[19]!==N?(h=N?(0,a.jsx)(eP.N,{mode:"wait",children:(0,a.jsx)(eO.P.p,{className:"truncate pl-[32px] text-comeback-gray-500 text-xs",initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{duration:.2,ease:"easeOut"},children:N},N)}):null,b[19]=N,b[20]=h):h=b[20],b[21]!==w?(g=null!=w?(0,a.jsx)(eO.P.div,{className:"mt-[4px] ml-[32px] h-[4px] w-[200px] overflow-hidden rounded-full bg-comeback-gray-100",initial:{opacity:0}
788,animate:{opacity:1},transition:{duration:.2},children:(0,a.jsx)(eO.P.div,{className:"h-full rounded-full bg-comeback-gray-900",initial:{width:0},animate:{width:`${w}%`},transition:{duration:.3,ease:"easeOut"}})}):null,b[21]=w,b[22]=g):g=b[22],b[23]!==x||b[24]!==h||b[25]!==g?(f=(0,a.jsx)(eO.P.div,{className:r,initial:i,animate:s,transition:l,children:(0,a.jsxs)("div",{className:"flex w-full min-w-0 flex-col gap-[2px]",children:[x,h,g]})}),b[23]=x,b[24]=h,b[25]=g,b[26]=f):f=b[26],f};var t1=r(562355),t2=r(544245),t3=r(655665),t4=r(569781),t5=r(130790),t7=r(156766),t8=r(765841),t6=r(158976);let t9=({collapseScreenshots:e})=>({...t1.dK,img:t=>e&&"Screenshot"===t.alt?(0,a.jsxs)("a",{href:t.src,target:"_blank",rel:"noreferrer",className:"flex w-fit flex-row items-center gap-1 rounded bg-comeback-gray-25 px-2 py-1 text-comeback-gray-400 text-xs",children:[(0,a.jsx)(f.I,{content:tY.QC,size:"xs"}),"Screenshot"]}):t1.dK.img(t)});var re=r(171005);let rt=e=>{if(!e)return null;try{let{hostname:t}=new URL(e);return t.replace("www.","")}catch{return null}},rr=e=>{let t,r,a,i=(0,n.c)(9),{isCollapsed:s,size:l}=e;i[0]===Symbol.for("react.memo_cache_sentinel")?(t={defaultValue:!0},i[0]=t):t=i[0];let o=(0,e0.OD)(t),c=(0,A.UB)();i[1]!==c||i[2]!==s||i[3]!==o||i[4]!==l?(r=e=>{let t=s?89:76;if(!o)return window.innerWidth-t;if("mobile"===l||c)return 450;let r=s?114:100;return e.leftPanelSize*window.innerWidth/r-t},i[1]=c,i[2]=s,i[3]=o,i[4]=l,i[5]=r):r=i[5];let d=(0,A.eE)(r),u=d*("desktop"===l?.7476635514018691:2);return i[6]!==u||i[7]!==d?(a={width:d,height:u},i[6]=u,i[7]=d,i[8]=a):a=i[8],a},ra=e=>{let t,r,i,s=(0,n.c)(8),{variant:l}=e,c="live"===l?"border-comeback-red-500 bg-comeback-red-25 text-comeback-red-500":"border-comeback-green-500 bg-comeback-green-25 text-comeback-green-500";s[0]!==c?(t=(0,o.cn)("flex select-none flex-row items-center gap-1 rounded-lg border px-[8px] py-[2px] font-medium text-body-xs transition-colors duration-[160ms] ease-out",c),s[0]=c,s[1]=t):t=s[1],s[2]!==l?(r="live"===l?(0,a.jsxs)("span",{className:"relative flex size-2",children:[(0,a.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-comeback-red-500 opacity-75",style:{animationDuration:"2s"}}),(0,a.jsx)("span",{className:"relative inline-flex size-2 rounded-full bg-comeback-red-500"})]}):null,s[2]=l,s[3]=r):r=s[3];let d="live"===l?"Live":"Replay";return s[4]!==t||s[5]!==r||s[6]!==d?(i=(0,a.jsxs)("div",{className:t,children:[r,d]}),s[4]=t,s[5]=r,s[6]=d,s[7]=i):i=s[7],i},rn=({title:e,subtext:t,liveUrl:r,replayUrl:n,currentUrl:i,className:s,isLatest:d,status:u,isInteractive:h,size:g})=>{let f=(0,e0.OD)({defaultValue:!0}),{height:b}=rr({isCollapsed:!d,size:g}),{height:v}=(0,tr.lW)(),j=(0,A.eE)(e=>f?Math.ceil(e.leftPanelSize)/100:1),I=n||r,w=(0,y.useRef)(null),N=(0,y.useRef)(null),T=(0,y.useRef)(null),E=(0,y.useRef)(null),[S,_]=(0,y.useState)(!1),k="running"===u&&d,{displayText:C}=(0,l.wy)(t||"",k),R=(0,y.useMemo)(()=>C?C.split(/\n\n+/).filter(e=>e.trim().length>0).map((e,t)=>({id:t,content:e.trim(),type:e.startsWith("```")?"code":"text"})):[],[C]),G=(0,y.useRef)(null);if((0,y.useEffect)(()=>{T.current?.scrollToIndex({index:R.length-1,align:"end",behavior:"smooth"})},[R]),!I)return null;let P="mobile"===g?re.M:t8.h,O=(0,a.jsx)(eO.P.div,{initial:{opacity:0}
788,animate:{opacity:1},exit:{opacity:0},className:(0,o.cn)("group",s),children:(0,a.jsx)(P,{className:(0,o.cn)("relative w-full overflow-hidden","mobile"===g?"w-[150px]":"rounded"),children:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(t7.A,{ref:w,className:(0,o.cn)("user-select-none pointer-events-none","mobile"===g?"top-[60px]":void 0),title:`Agent visiting ${i?rt(i):"a website"}`,allow:t2.vG,scale:j,src:I,width:"100%",height:b,overflow:"visible"}),(0,a.jsx)(t4.x,{"aria-label":"Expand browser preview",onPress:()=>_(!0),color:"gray",type:"button",className:(0,o.cn)("absolute z-float border border-comeback-gray-50 bg-white opacity-0 shadow-sm transition-opacity hover:bg-comeback-gray-50 group-hover:opacity-100",h?"":"hidden","mobile"===g?"right-8 bottom-8 origin-bottom-right scale-[2]":"right-2 bottom-2"),icon:F.yc,size:"medium"})]})})});if(!f||!h)return O;let U=.7*v-100;return(0,a.jsxs)(t3.aF.Root,{open:S,onOpenChange:_,children:[(0,a.jsx)(t3.aF.Overlay,{}),(0,a.jsx)(t3.aF.Trigger,{children:O}),(0,a.jsxs)(t3.aF.Content,{className:"flex flex-col",children:[(0,a.jsx)("div",{className:"relative",children:(0,a.jsx)(t4.x,{"aria-label":"Close browser preview",onPress:()=>_(!1),color:"gray",type:"button",icon:tY.tx,className:"absolute top-1 right-1 z-float"})}),(0,a.jsx)("div",{className:"flex max-h-[80dvh] tablet:w-[80dvw] flex-col gap-2 overflow-y-auto px-4",children:(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 bg-white py-4",children:[(0,a.jsxs)("div",{className:"flex w-full flex-row items-center gap-4",children:[(0,a.jsx)("div",{className:"flex h-[16px] w-[16px] items-center justify-center text-comeback-gray-500",children:n?(0,a.jsx)(t6.P,{}):(0,a.jsx)(tU.Ip,{thinkingType:"browser_use"})}),(0,a.jsx)(eO.P.div,{className:(0,o.cn)("text-body-md",k?"bg-[length:200%_100%] bg-gradient-to-r from-comeback-gray-900 via-white to-comeback-gray-900 bg-clip-text text-transparent":"text-comeback-gray-500"),...k?{initial:{backgroundPosition:"0% 0%"},animate:{backgroundPosition:"-200% 0%"},transition:{duration:2.5,repeat:1/0,ease:"linear"}}:void 0,children:e??" "}),(0,a.jsx)(ra,{variant:n?"replay":"live"})]}),(0,a.jsxs)("div",{className:"grid w-full grid-cols-1 tablet:grid-cols-4 items-start gap-2",children:[(0,a.jsx)(P,{className:(0,o.cn)("relative col-span-3 h-fit w-full overflow-hidden","mobile"===g?"mx-auto max-w-[300px]":"rounded"),ref:E,style:{height:U},children:(0,a.jsx)(t7.A,{title:`Agent visiting ${i?rt(i):"a website"}`,allow:t2.vG,className:(0,o.cn)("w-full",n?void 0:"pointer-events-none","mobile"===g?"top-[60px]":void 0),overflow:"visible",height:"mobile"===g?U+310:U-27,width:E.current?.clientWidth??void 0,scale:1,src:I,...n?void 0:{tabIndex:-1,inert:!0},ref:N})}),(0,a.jsx)("div",{role:"presentation",className:(0,o.cn)("col-span-1 shrink-0 overflow-hidden pb-4 text-comeback-gray-500 text-sm [overflow-wrap:anywhere]",k&&"[&::-webkit-scrollbar]:hidden"),style:{maxHeight:U},ref:G,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),children:(0,a.jsx)(t5.aY,{ref:T,data:R,style:{height:U-16},itemContent:(e,t)=>(0,a.jsx)("div",{className:"mb-2 whitespace-pre-wrap",children:(0,a.jsx)(p.o,{remarkPlugins:[x.A],rehypePlugins:[m.A],components:t9({collapseScreenshots:!n}),children:(0,c.EO)(t.content)})}),followOutput:"smooth",alignToBottom:!0,overscan:5})})]})]})})]})]})};var ri=r(112956);function rs(e){if(!e.ok)throw Error(`Failed to fetch manifest: ${e.status}`);return e.json()}let rl=[1,2,4],ro=e=>{let t,r,i,s,l,c,d,u,p,m,x,h,g,f,b,v,j,I,w,N,T,E,S=(0,n.c)(57),{frames:_,compact:k,height:C}=e,[R,A]=(0,y.useState)(0),[G,P]=(0,y.useState)(!1),[O,U]=(0,y.useState)(1),M=(0,y.useRef)(null),L=(0,y.useRef)(!1),D=_[R];S[0]!==G?(t=()=>{L.current=G},r=[G],S[0]=G,S[1]=t,S[2]=r):(t=S[1],r=S[2]),(0,y.useEffect)(t,r),S[3]!==R||S[4]!==_?(i=()=>{for(let e=1;e<=3;e++){let t=_[R+e];t&&(new window.Image().src=t.screenshotUrl)}},s=[R,_],S[3]=R,S[4]=_,S[5]=i,S[6]=s):(i=S[5],s=S[6]),(0,y.useEffect)(i,s),S[7]!==R||S[8]!==_||S[9]!==G||S[10]!==O?(l=()=>{if(M.current&&(clearTimeout(M.current),M.current=null),!G)return;let e=t=>{let r=t+1;if(r>=_.length)return void P(!1);let a=_[t]?.timestampMs??0;M.current=setTimeout(()=>{L.current&&(A(r),e(r))},Math.min(2e3,Math.max(50,((_[r]?.timestampMs??0)-a)/O)))};return e(R),()=>
788{M.current&&(clearTimeout(M.current),M.current=null)}},S[7]=R,S[8]=_,S[9]=G,S[10]=O,S[11]=l):l=S[11],S[12]!==G||S[13]!==O?(c=[G,O],S[12]=G,S[13]=O,S[14]=c):c=S[14],(0,y.useEffect)(l,c),S[15]!==R||S[16]!==_.length?(d=()=>{R>=_.length-1?(A(0),P(!0)):P(ru)},S[15]=R,S[16]=_.length,S[17]=d):d=S[17];let B=d;S[18]===Symbol.for("react.memo_cache_sentinel")?(u=e=>{let t=Number(e.target.value);P(!1),A(t)},S[18]=u):u=S[18];let $=u;S[19]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{U(rp)},S[19]=p):p=S[19];let F=p;if(!D)return null;let H=_[_.length-1]?.timestampMs??0,q=rm;S[20]!==C?(m={width:"100%",height:C},S[20]=C,S[21]=m):m=S[21],S[22]===Symbol.for("react.memo_cache_sentinel")?(x={width:"100%",height:"100%",objectFit:"contain"},S[22]=x):x=S[22],S[23]!==D.screenshotUrl?(h=(0,a.jsx)("img",{src:D.screenshotUrl,alt:"",style:x}),S[23]=D.screenshotUrl,S[24]=h):h=S[24],S[25]!==m||S[26]!==h?(g=(0,a.jsx)("div",{className:"relative overflow-hidden rounded-[12px] border border-comeback-gray-200 bg-black",style:m,children:h}),S[25]=m,S[26]=h,S[27]=g):g=S[27];let z=k?"px-0.5":"gap-2 px-1";S[28]!==z?(f=(0,o.cn)("flex w-full items-center gap-1",z),S[28]=z,S[29]=f):f=S[29];let V=G?"Pause replay":"Play replay",W=k?"h-4 w-4":"h-5 w-5";S[30]!==W?(b=(0,o.cn)("flex flex-shrink-0 items-center justify-center rounded-full bg-comeback-gray-900 text-white",W),S[30]=W,S[31]=b):b=S[31],S[32]!==k||S[33]!==G?(v=G?(0,a.jsxs)("svg",{width:k?6:8,height:k?6:8,viewBox:"0 0 12 12",fill:"currentColor",children:[(0,a.jsx)("title",{children:"Pause"}),(0,a.jsx)("rect",{x:"1",y:"1",width:"3.5",height:"10",rx:"1"}),(0,a.jsx)("rect",{x:"7.5",y:"1",width:"3.5",height:"10",rx:"1"})]}):(0,a.jsxs)("svg",{width:k?6:8,height:k?6:8,viewBox:"0 0 12 12",fill:"currentColor",children:[(0,a.jsx)("title",{children:"Play"}),(0,a.jsx)("polygon",{points:"2,0 12,6 2,12"})]}),S[32]=k,S[33]=G,S[34]=v):v=S[34],S[35]!==B||S[36]!==V||S[37]!==b||S[38]!==v?(j=(0,a.jsx)("button",{type:"button",onClick:B,"aria-label":V,className:b,children:v}),S[35]=B,S[36]=V,S[37]=b,S[38]=v,S[39]=j):j=S[39];let Y=_.length-1;return S[40]!==R||S[41]!==Y?(I=(0,a.jsx)("input",{type:"range",min:0,max:Y,value:R,onChange:$,"aria-label":"Replay scrubber",className:"replay-scrubber min-w-0 flex-1"}),S[40]=R,S[41]=Y,S[42]=I):I=S[42],S[43]!==k||S[44]!==D.timestampMs||S[45]!==O||S[46]!==H?(w=k?null:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("button",{type:"button",onClick:F,className:"flex-shrink-0 rounded border border-comeback-gray-200 px-1 font-mono text-[10px] text-comeback-gray-500",children:[O,"x"]}),(0,a.jsxs)("span",{className:"flex-shrink-0 font-mono text-[10px] text-comeback-gray-400",children:[q(D.timestampMs),"/",q(H)]})]}),S[43]=k,S[44]=D.timestampMs,S[45]=O,S[46]=H,S[47]=w):w=S[47],S[48]!==f||S[49]!==j||S[50]!==I||S[51]!==w?(N=(0,a.jsxs)("div",{className:f,children:[j,I,w]}),S[48]=f,S[49]=j,S[50]=I,S[51]=w,S[52]=N):N=S[52],S[53]===Symbol.for("react.memo_cache_sentinel")?(T=(0,a.jsx)("style",{children:"\n .replay-scrubber {\n -webkit-appearance: none;\n appearance: none;\n height: 4px;\n border-radius: 2px;\n background: #ddd;\n outline: none;\n cursor: pointer;\n touch-action: none;\n }\n .replay-scrubber::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 12px;\n height: 12px;\n border-radius: 50%;\n background: #333;\n cursor: pointer;\n }\n .replay-scrubber::-moz-range-thumb {\n width: 12px;\n height: 12px;\n border-radius: 50%;\n background: #333;\n cursor: pointer;\n border: none;\n }\n "}),S[53]=T):T=S[53],S[54]!==g||S[55]!==N?(E=(0,a.jsxs)("div",{className:"flex flex-col items-center gap-1",children:[g,N,T]}),S[54]=g,S[55]=N,S[56]=E):E=S[56],E},rc=e=>{let t,r,s=(0,n.c)(6),{lastAction:l,tapKey:o}=e;if(l?.type!==i.SimulatorActionType.TAP||null==l.x||null==l.y)return null;let c=`tap-${o}`,d=`${l.x/390*100}%`,u=`${l.y/844*100}%`;return s[0]!==d||s[1]!==u?(t={left:d,top:u,width:24,height:24,transform:"translate(-50%, -50%)",animation:"simulatorTapPing 1s ease-out forwards"},s[0]=d,s[1]=u,s[2]=t):t=s[2],s[3]!==c||s[4]!==t?(r=(0,a.jsx)("div",{className:"pointer-events-none absolute rounded-full border-2 border-red-500",style:t},c),s[3]=c,s[4]=t,s[5]=r):r=s[5],r},rd=e=>{let t,r,s,c,d,u,p,m,x,h,g,f,b,v,j,I,w,N,T,E,S,_,k,C,R,A,G,P,O,U,M,L,D,B,$,H,q,z,V,W,Y=(0,n.c)(151),{webrtcUrl:Q,token:X,replayUrl:K,toolCallId:J,isLatest:Z,status:ee,lastAction:et,className:er,title:ea,subtext:en,isInteractive:ei}=e;Y[0]===Symbol.for("react.memo_cache_sentinel")?(t={defaultValue:!0},Y[0]=t):t=Y[0];let es=(0,e0.OD)(t),el="running"===ee&&Z,eo=`simulator-preview-${J??"unknown"}`,[ec,ed]=(0,y.useState)(0),[eu,ep]=(0,y.useState)(!1),{height:em}=(0,tr.lW)(),ex=(0,y.useRef)(null),{displayText:eh}=(0,l.wy)(en||"",el);Y[1]!==eh?(r=eh?eh.split(/\n\n+/).filter(rx).map(rh):[],Y[1]=eh,Y[2]=r):r=Y[2];let eg=r;Y[3]!==eh?(s=()=>{let e=eh?eh.split(/\n\n+/).filter(rg).length:0;0!==e&&ex.current?.scrollToIndex({index:e-1,align:"end",behavior:"smooth"})},c=[eh],Y[3]=eh,Y[4]=s,Y[5]=c):(s=Y[4],c=Y[5]),(0,y.useEffect)(s,c),Y[6]!==et?(d=()=>{et?.type===i.SimulatorActionType.TAP&&null!=et.x&&ed(rf)},u=[et],Y[6]=et,Y[7]=d,Y[8]=u):(d=Y[7],u=Y[8]),(0,y.useEffect)(d,u);let ef=es&&ei,eb=.7*em-100,{frames:ey,isLoading:ev}=function(e){let t,r,a,i,s=(0,n.c)(7);s[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],s[0]=t):t=s[0];let[l,o]=(0,y.useState)(t),[c,d]=(0,y.useState)(!1),u=(0,y.useRef)(null);return s[1]!==e?(r=()=>{let t;if(!e||u.current===e)return;let r=(t=e.split("/"))[t.length-1]??null;r&&(u.current=e,d(!0),o([]),fetch(`https://ucarecdn.com/${r}/`).then(rs).then(e=>{e.frames&&e.frames.length>=2&&o(e.frames)}).catch(()=>{o([]),u.current=null}).finally(()=>{d(!1)}))},a=[e],s[1]=e,s[2]=r,s[3]=a):(r=s[2],a=s[3]),(0,y.useEffect)(r,a),s[4]!==l||s[5]!==c?(i={frames:l,isLoading:c},s[4]=l,s[5]=c,s[6]=i):i=s[6],i}(K),ej=ey.length>=2;if(!el&&!K){let e,t,r,n,i,s;return Y[9]===Symbol.for("react.memo_cache_sentinel")?(e={opacity:0}
788,t={opacity:1},Y[9]=e,Y[10]=t):(e=Y[9],t=Y[10]),Y[11]!==er?(r=(0,o.cn)("flex items-center gap-2 text-comeback-gray-400 text-sm",er),Y[11]=er,Y[12]=r):r=Y[12],Y[13]===Symbol.for("react.memo_cache_sentinel")?(n=(0,a.jsx)(tU.Ip,{thinkingType:"mobile_use"}),i=(0,a.jsx)("span",{children:"Loading replay..."}),Y[13]=n,Y[14]=i):(n=Y[13],i=Y[14]),Y[15]!==r?(s=(0,a.jsxs)(eO.P.div,{initial:e,animate:t,className:r,children:[n,i]}),Y[15]=r,Y[16]=s):s=Y[16],s}if(!el&&K){let e,t,r,n,i,s,l,c,d,u,p,m,x,h,g,f,b,y,v,j,I,w,N,T,E,S,_;if(ev){let e,t,r,n,i,s;return Y[17]===Symbol.for("react.memo_cache_sentinel")?(e={opacity:0},t={opacity:1},Y[17]=e,Y[18]=t):(e=Y[17],t=Y[18]),Y[19]!==er?(r=(0,o.cn)("flex items-center gap-2 text-comeback-gray-400 text-sm",er),Y[19]=er,Y[20]=r):r=Y[20],Y[21]===Symbol.for("react.memo_cache_sentinel")?(n=(0,a.jsx)(tU.Ip,{thinkingType:"mobile_use"}),i=(0,a.jsx)("span",{children:"Loading replay..."}),Y[21]=n,Y[22]=i):(n=Y[21],i=Y[22]),Y[23]!==r?(s=(0,a.jsxs)(eO.P.div,{initial:e,animate:t,className:r,children:[n,i]}),Y[23]=r,Y[24]=s):s=Y[24],s}if(!ej)return null;Y[25]===Symbol.for("react.memo_cache_sentinel")?(e={opacity:0}
788,t={opacity:1},r={opacity:0},Y[25]=e,Y[26]=t,Y[27]=r):(e=Y[25],t=Y[26],r=Y[27]),Y[28]!==er?(n=(0,o.cn)("group",er),Y[28]=er,Y[29]=n):n=Y[29],Y[30]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)("div",{className:"mb-1 flex items-center gap-2",children:(0,a.jsx)(ra,{variant:"replay"})}),Y[30]=i):i=Y[30],Y[31]!==ey?(s=(0,a.jsx)(ro,{frames:ey,compact:!0,height:325}),Y[31]=ey,Y[32]=s):s=Y[32],Y[33]===Symbol.for("react.memo_cache_sentinel")?(l=()=>ep(!0),Y[33]=l):l=Y[33];let k=ef?"":"hidden";Y[34]!==k?(c=(0,o.cn)("absolute right-2 bottom-2 z-float border border-comeback-gray-50 bg-white opacity-0 shadow-sm transition-opacity hover:bg-comeback-gray-50 group-hover:opacity-100",k),Y[34]=k,Y[35]=c):c=Y[35],Y[36]!==c?(d=(0,a.jsx)(t4.x,{"aria-label":"Expand preview",onPress:l,color:"gray",type:"button",className:c,icon:F.yc,size:"medium"}),Y[36]=c,Y[37]=d):d=Y[37],Y[38]!==s||Y[39]!==d?(u=(0,a.jsxs)("div",{className:"relative w-[150px]",children:[s,d]}),Y[38]=s,Y[39]=d,Y[40]=u):u=Y[40],Y[41]!==n||Y[42]!==u?(p=(0,a.jsxs)(eO.P.div,{initial:e,animate:t,exit:r,className:n,children:[i,u]}),Y[41]=n,Y[42]=u,Y[43]=p):p=Y[43];let C=p;if(!ef)return C;Y[44]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(t3.aF.Overlay,{}),Y[44]=m):m=Y[44],Y[45]!==C?(x=(0,a.jsx)(t3.aF.Trigger,{children:C}),Y[45]=C,Y[46]=x):x=Y[46],Y[47]===Symbol.for("react.memo_cache_sentinel")?(h=(0,a.jsx)("div",{className:"relative",children:(0,a.jsx)(t4.x,{"aria-label":"Close preview",onPress:()=>ep(!1),color:"gray",type:"button",icon:tY.tx,className:"absolute top-1 right-1 z-float"})}),Y[47]=h):h=Y[47];let R=ea??"Session Replay";Y[48]!==R?(g=(0,a.jsx)("span",{className:"font-medium text-comeback-gray-700 text-sm",children:R}),Y[48]=R,Y[49]=g):g=Y[49],Y[50]===Symbol.for("react.memo_cache_sentinel")?(f=(0,a.jsx)(ra,{variant:"replay"}),Y[50]=f):f=Y[50],Y[51]!==g?(b=(0,a.jsxs)("div",{className:"flex w-full flex-row items-center gap-4",children:[g,f]}),Y[51]=g,Y[52]=b):b=Y[52],Y[53]!==eb?(y={height:eb},Y[53]=eb,Y[54]=y):y=Y[54];let A=eb-30;Y[55]!==ey||Y[56]!==A?(v=(0,a.jsx)(ro,{frames:ey,compact:!1,height:A}),Y[55]=ey,Y[56]=A,Y[57]=v):v=Y[57],Y[58]!==y||Y[59]!==v?(j=(0,a.jsx)("div",{className:"col-span-3 mx-auto w-full max-w-[300px]",style:y,children:v}),Y[58]=y,Y[59]=v,Y[60]=j):j=Y[60],Y[61]!==eb?(I={maxHeight:eb},Y[61]=eb,Y[62]=I):I=Y[62];let G=eb-16;return Y[63]!==G?(w={height:G},Y[63]=G,Y[64]=w):w=Y[64],Y[65]!==eg||Y[66]!==w?(N=(0,a.jsx)(t5.aY,{ref:ex,data:eg,style:w,itemContent:rj,followOutput:"smooth",alignToBottom:!0,overscan:5}),Y[65]=eg,Y[66]=w,Y[67]=N):N=Y[67],Y[68]!==I||Y[69]!==N?(T=(0,a.jsx)("div",{className:"col-span-1 shrink-0 overflow-hidden pb-4 text-comeback-gray-500 text-sm [overflow-wrap:anywhere] [&::-webkit-scrollbar]:hidden",style:I,role:"presentation",onClick:rb,onKeyDown:ry,onMouseDown:rv,children:N}),Y[68]=I,Y[69]=N,Y[70]=T):T=Y[70],Y[71]!==j||Y[72]!==T?(E=(0,a.jsxs)("div",{className:"grid w-full grid-cols-1 tablet:grid-cols-4 items-start gap-2",children:[j,T]}),Y[71]=j,Y[72]=T,Y[73]=E):E=Y[73],Y[74]!==b||Y[75]!==E?(S=(0,a.jsxs)(t3.aF.Content,{className:"flex flex-col",children:[h,(0,a.jsx)("div",{className:"flex max-h-[80dvh] tablet:w-[80dvw] flex-col gap-2 overflow-y-auto px-4",children:(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 bg-white py-4",children:[b,E]})})]}),Y[74]=b,Y[75]=E,Y[76]=S):S=Y[76],Y[77]!==eu||Y[78]!==x||Y[79]!==S?(_=(0,a.jsxs)(t3.aF.Root,{open:eu,onOpenChange:ep,children:[m,x,S]}),Y[77]=eu,Y[78]=x,Y[79]=S,Y[80]=_):_=Y[80],_}Y[81]===Symbol.for("react.memo_cache_sentinel")?(p={opacity:0},m={opacity:1},x={opacity:0},Y[81]=p,Y[82]=m,Y[83]=x):(p=Y[81],m=Y[82],x=Y[83]),Y[84]!==er?(h=(0,o.cn)("group",er),Y[84]=er,Y[85]=h):h=Y[85],Y[86]===Symbol.for("react.memo_cache_sentinel")?(g=(0,a.jsx)("div",{className:"mb-1 flex items-center gap-2",children:(0,a.jsx)(ra,{variant:"live"})}),Y[86]=g):g=Y[86],Y[87]!==eu||Y[88]!==eo||Y[89]!==X||Y[90]!==Q?(f=eu?null:Q&&X?(0,a.jsx)(ri.q,{url:Q,token:X,sessionId:eo}):null,Y[87]=eu,Y[88]=eo,Y[89]=X,Y[90]=Q,Y[91]=f):f=Y[91],Y[92]!==et||Y[93]!==ec?(b=(0,a.jsx)(rc,{lastAction:et,tapKey:ec}),Y[92]=et,Y[93]=ec,Y[94]=b):b=Y[94],Y[95]===Symbol.for("react.memo_cache_sentinel")?(v=()=>ep(!0),Y[95]=v):v=Y[95];let eI=ef?"":"hidden";Y[96]!==eI?(j=(0,o.cn)("pointer-events-auto absolute right-8 bottom-8 z-float origin-bottom-right scale-[2] border border-comeback-gray-50 bg-white opacity-0 shadow-sm transition-opacity hover:bg-comeback-gray-50 group-hover:opacity-100",eI),Y[96]=eI,Y[97]=j):j=Y[97],Y[98]!==j?(I=(0,a.jsx)(t4.x,{"aria-label":"Expand preview",onPress:v,color:"gray",type:"button",className:j,icon:F.yc,size:"medium"}),Y[98]=j,Y[99]=I):I=Y[99],Y[100]!==f||Y[101]!==b||Y[102]!==I?(w=(0,a.jsxs)("div",{className:"pointer-events-none relative w-[150px]",children:[f,b,I]}),Y[100]=f,Y[101]=b,Y[102]=I,Y[103]=w):w=Y[103],Y[104]===Symbol.for("react.memo_cache_sentinel")?(N=(0,a.jsx)("style",{children:"\n @keyframes simulatorTapPing {\n 0% {\n transform: translate(-50%, -50%) scale(0.5);\n opacity: 1;\n }\n 100% {\n transform: translate(-50%, -50%) scale(2);\n opacity: 0;\n }\n }\n "}),Y[104]=N):N=Y[104],Y[105]!==h||Y[106]!==w?(T=(0,a.jsxs)(eO.P.div,{initial:p,animate:m,exit:x,className:h,children:[g,w,N]}),Y[105]=h,Y[106]=w,Y[107]=T):T=Y[107];let ew=T;if(!ef)return ew;Y[108]===Symbol.for("react.memo_cache_sentinel")?(E=(0,a.jsx)(t3.aF.Overlay,{}),Y[108]=E):E=Y[108],Y[109]!==ew?(S=(0,a.jsx)(t3.aF.Trigger,{children:ew}),Y[109]=ew,Y[110]=S):S=Y[110],Y[111]===Symbol.for("react.memo_cache_sentinel")?(_=(0,a.jsx)("div",{className:"relative",children:(0,a.jsx)(t4.x,{"aria-label":"Close preview",onPress:()=>ep(!1),color:"gray",type:"button",icon:tY.tx,className:"absolute top-1 right-1 z-float"})}),Y[111]=_):_=Y[111],Y[112]===Symbol.for("react.memo_cache_sentinel")?(k=(0,a.jsx)("div",{className:"flex h-[16px] w-[16px] items-center justify-center text-comeback-gray-500",children:(0,a.jsx)(tU.Ip,{thinkingType:"mobile_use"})}),Y[112]=k):k=Y[112],Y[113]===Symbol.for("react.memo_cache_sentinel")?(C=(0,o.cn)("text-body-md","bg-[length:200%_100%] bg-gradient-to-r from-comeback-gray-900 via-white to-comeback-gray-900 bg-clip-text text-transparent"),R={backgroundPosition:"0% 0%"},A={backgroundPosition:"-200% 0%"},G={duration:2.5,repeat:1/0,ease:"linear"},Y[113]=C,Y[114]=R,Y[115]=A,Y[116]=G):(C=Y[113],R=Y[114],A=Y[115],G=Y[116]);let eN=ea??" ";Y[117]!==eN?(P=(0,a.jsx)(eO.P.div,{className:C,initial:R,animate:A,transition:G,children:eN}),Y[117]=eN,Y[118]=P):P=Y[118],Y[119]===Symbol.for("react.memo_cache_sentinel")?(O=(0,a.jsx)(ra,{variant:"live"}),Y[119]=O):O=Y[119],Y[120]!==P?(U=(0,a.jsxs)("div",{className:"flex w-full flex-row items-center gap-4",children:[k,P,O]}),Y[120]=P,Y[121]=U):U=Y[121],Y[122]!==eb?(M={height:eb},Y[122]=eb,Y[123]=M):M=Y[123],Y[124]!==eo||Y[125]!==X||Y[126]!==Q?(L=Q&&X?(0,a.jsx)(ri.q,{url:Q,token:X,sessionId:`${eo}-expanded`}):null,Y[124]=eo,Y[125]=X,Y[126]=Q,Y[127]=L):L=Y[127],Y[128]!==M||Y[129]!==L?(D=(0,a.jsx)("div",{className:"relative col-span-3 mx-auto h-fit w-full max-w-[300px] overflow-hidden",style:M,children:L}),Y[128]=M,Y[129]=L,Y[130]=D):D=Y[130],Y[131]!==eb?(B={maxHeight:eb},Y[131]=eb,Y[132]=B):B=Y[132];let eT=eb-16;return Y[133]!==eT?($={height:eT},Y[133]=eT,Y[134]=$):$=Y[134],Y[135]!==eg||Y[136]!==$?(H=(0,a.jsx)(t5.aY,{ref:ex,data:eg,style:$,itemContent:rT,followOutput:"smooth",alignToBottom:!0,overscan:5}),Y[135]=eg,Y[136]=$,Y[137]=H):H=Y[137],Y[138]!==B||Y[139]!==H?(q=(0,a.jsx)("div",{className:"col-span-1 shrink-0 overflow-hidden pb-4 text-comeback-gray-500 text-sm [overflow-wrap:anywhere] [&::-webkit-scrollbar]:hidden",style:B,role:"presentation",onClick:rI,onKeyDown:rw,onMouseDown:rN,children:H}),Y[138]=B,Y[139]=H,Y[140]=q):q=Y[140],Y[141]!==D||Y[142]!==q?(z=(0,a.jsxs)("div",{className:"grid w-full grid-cols-1 tablet:grid-cols-4 items-start gap-2",children:[D,q]}),Y[141]=D,Y[142]=q,Y[143]=z):z=Y[143],Y[144]!==U||Y[145]!==z?(V=(0,a.jsxs)(t3.aF.Content,{className:"flex flex-col",children:[_,(0,a.jsx)("div",{className:"flex max-h-[80dvh] tablet:w-[80dvw] flex-col gap-2 overflow-y-auto px-4",children:(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 bg-white py-4",children:[U,z]})})]}),Y[144]=U,Y[145]=z,Y[146]=V):V=Y[146],Y[147]!==eu||Y[148]!==S||Y[149]!==V?(W=(0,a.jsxs)(t3.aF.Root,{open:eu,onOpenChange:ep,children:[E,S,V]}),Y[147]=eu,Y[148]=S,Y[149]=V,Y[150]=W):W=Y[150],W};function ru(e){return!e}function rp(e){let t=rl.indexOf(e);return rl[(t+1)%rl.length]??1}function rm(e){let t=Math.floor(e/1e3);return`${String(Math.floor(t/60)).padStart(2,"0")}
788:${String(t%60).padStart(2,"0")}`}function rx(e){return e.trim().length>0}function rh(e,t){return{id:t,content:e.trim(),type:e.startsWith("```")?"code":"text"}}function rg(e){return e.trim().length>0}function rf(e){return e+1}function rb(e){return e.stopPropagation()}function ry(e){return e.stopPropagation()}function rv(e){return e.stopPropagation()}function rj(e,t){return(0,a.jsx)("div",{className:"mb-2 whitespace-pre-wrap",children:(0,a.jsx)(p.o,{remarkPlugins:[x.A],rehypePlugins:[m.A],components:t9({collapseScreenshots:!1}),children:(0,c.EO)(t.content)})})}function rI(e){return e.stopPropagation()}function rw(e){return e.stopPropagation()}function rN(e){return e.stopPropagation()}function rT(e,t){return(0,a.jsx)("div",{className:"mb-2 whitespace-pre-wrap",children:(0,a.jsx)(p.o,{remarkPlugins:[x.A],rehypePlugins:[m.A],components:t9({collapseScreenshots:!1}),children:(0,c.EO)(t.content)})})}let rE=(0,v.U)(` 789 mutation CancelInflightToolCallById( 790 $input: CancelInflightToolCallByIdInput! 791 ) { 792 cancelInflightToolCallById(input: $input) { 793 success 794 } 795 } 796`),rS=e=>{let t,r,s,c,d,u,g,b,v,j,I,w,N,T,E,S,_,k,C,R,A,G,P,O,U,M,L,D,B,$,F,H,q,z,V,W,Y=(0,n.c)(125),{text:Q,subtext:X,status:K,domains:J,isLatest:ee,thinkingType:et,browser:er,simulator:ea,isInteractive:en,toolCallId:ei,cancellable:es,timeoutMs:el,threadId:eo,truncated:ec}=e,ed=!!ea?.webrtcUrl||!!ea?.replayUrl,eu=ed?ea?.replayUrl||ea?.webrtcUrl:er?.replayUrl||er?.liveUrl,[ep,em]=(0,y.useState)(!1),[ex,eh]=(0,y.useState)(!1),[eg,ef]=(0,y.useState)(0),eb=ep?"cancelled":K,ey="running"===eb&&ee,ev="success"===eb,ej="cancelled"===eb,eI="error"===eb,ew=ey&&"shell"===et&&!!el,eN=el?Math.ceil(el/1e3):0,eT=Math.min(eg,eN);Y[0]!==ew||Y[1]!==eN?(t=()=>{if(!ew)return void ef(0);let e=setInterval(()=>{ef(e=>Math.min(e+1,eN))},1e3);return()=>clearInterval(e)},r=[ew,eN],Y[0]=ew,Y[1]=eN,Y[2]=t,Y[3]=r):(t=Y[2],r=Y[3]),(0,y.useEffect)(t,r),Y[4]!==J?(s=J?.split(",").filter(r_),Y[4]=J,Y[5]=s):s=Y[5];let eE=s,{displayText:eS}=(0,l.wy)(X||"",ey),e_=(0,y.useRef)(null),[ek,eC]=(0,y.useState)(!1),[eR,eG]=(0,y.useState)(!ee&&!!X||!!ea?.replayUrl||ed),[eU,eM]=(0,y.useState)(0),eL=ey||ev&&eR||(ej||ev)&&ed;Y[6]!==ed||Y[7]!==ea?.replayUrl?(c=()=>{(ea?.replayUrl||ed)&&eG(!0)},Y[6]=ed,Y[7]=ea?.replayUrl,Y[8]=c):c=Y[8];let eD=ea?.replayUrl;Y[9]!==ed||Y[10]!==eD?(d=[eD,ed],Y[9]=ed,Y[10]=eD,Y[11]=d):d=Y[11],(0,y.useEffect)(c,d),Y[12]!==ed||Y[13]!==ej||Y[14]!==ev||Y[15]!==eR||Y[16]!==X?(u=()=>{(ev||ej)&&(X||ed)&&eG(!eR)},Y[12]=ed,Y[13]=ej,Y[14]=ev,Y[15]=eR,Y[16]=X,Y[17]=u):u=Y[17];let eB=u;Y[18]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{if(!e_.current)return;let e=e_.current,t=()=>{eC(e.scrollHeight>e.clientHeight)};return e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)},b=[],Y[18]=g,Y[19]=b):(g=Y[18],b=Y[19]),(0,y.useEffect)(g,b),Y[20]!==ey?(v=()=>{if(!e_.current)return;let e=e_.current;(async()=>{let t=e.getElementsByTagName("img");t.length>0&&await Promise.all(Array.from(t).map(rk)),eM(Math.min(e.scrollHeight,200))})().catch(()=>{eM(Math.min(e.scrollHeight,200))}).then(()=>{ey&&(e.scrollTop=e.scrollHeight)}).catch(rC);let t=requestAnimationFrame(()=>{if(!e_.current)return;let e=e_.current;eC(e.scrollHeight>e.clientHeight)});return()=>cancelAnimationFrame(t)},Y[20]=ey,Y[21]=v):v=Y[21],Y[22]!==ey||Y[23]!==eR||Y[24]!==eS?(j=[eS,eR,ey],Y[22]=ey,Y[23]=eR,Y[24]=eS,Y[25]=j):j=Y[25],(0,y.useEffect)(v,j);let e$=ed||er?.size===i.BrowserSize.MOBILE?i.BrowserSize.MOBILE:i.BrowserSize.DESKTOP,eF=!ee;Y[26]!==e$||Y[27]!==eF?(I={isCollapsed:eF,size:e$},Y[26]=e$,Y[27]=eF,Y[28]=I):I=Y[28];let{height:eH}=rr(I),{id:eq}=(0,eA.MN)(),ez=eo&&eo!==e1.w2?eo:null,[eV,eW]=(0,Z.n)(rE),{loading:eY}=eW,eQ=!!(es&&ei&&en&&ee&&"running"===eb&&!ep&&Q);Y[29]!==eV||Y[30]!==eq||Y[31]!==ez||Y[32]!==ei?(w=async()=>{if(ei){em(!0);try{await eV({variables:{input:{projectGroupId:eq,threadId:ez,toolCallId:ei}}})}catch(e){em(!1)}}},Y[29]=eV,Y[30]=eq,Y[31]=ez,Y[32]=ei,Y[33]=w):w=Y[33];let eX=w;if(!K&&!Q)return null;Y[34]===Symbol.for("react.memo_cache_sentinel")?(N=(0,o.cn)("comeback-text-body-md flex w-full flex-row items-center justify-start overflow-hidden rounded-[8px] bg-white text-left text-comeback-gray-900 outline-none transition-colors","pt-[4px]"),Y[34]=N):N=Y[34],Y[35]!==ee?(T=ee?{opacity:0,scale:.95}:{opacity:1,scale:1},Y[35]=ee,Y[36]=T):T=Y[36],Y[37]===Symbol.for("react.memo_cache_sentinel")?(E={opacity:1,scale:1},Y[37]=E):E=Y[37],Y[38]!==ee?(S=ee?{duration:.3,ease:"easeOut"}:{duration:0},Y[38]=ee,Y[39]=S):S=Y[39],Y[40]===Symbol.for("react.memo_cache_sentinel")?(_=(0,o.cn)("flex w-full min-w-0 flex-col items-start"),Y[40]=_):_=Y[40];let eK=(ev||ej)&&"cursor-pointer rounded-[4px]",eJ=!X&&"cursor-default";Y[41]!==eK||Y[42]!==eJ?(k=(0,o.cn)("flex min-w-0 flex-row items-center gap-x-[12px]","border-0 bg-transparent p-0 text-left",eK,eJ),Y[41]=eK,Y[42]=eJ,Y[43]=k):k=Y[43],Y[44]!==ej||Y[45]!==eI||Y[46]!==ee||Y[47]!==ey?(C={isRunning:ey,isError:eI,isCancelled:ej,isLatest:ee},Y[44]=ej,Y[45]=eI,Y[46]=ee,Y[47]=ey,Y[48]=C):C=Y[48],Y[49]!==eE||Y[50]!==et?(R={domainsArray:eE,thinkingType:et},Y[49]=eE,Y[50]=et,Y[51]=R):R=Y[51],Y[52]!==eR?(A={isExpanded:eR},Y[52]=eR,Y[53]=A):A=Y[53],Y[54]!==C||Y[55]!==R||Y[56]!==A?(G=(0,a.jsx)("div",{className:"flex-shrink-0 px-[2px]",children:(0,a.jsx)(eP.N,{mode:"wait",children:(0,a.jsx)(tU.gX,{status:C,data:R,interaction:A})})}),Y[54]=C,Y[55]=R,Y[56]=A,Y[57]=G):G=Y[57];let eZ=ej?"text-comeback-gray-500":"text-comeback-gray-700";return Y[58]!==eZ?(P=(0,o.cn)("truncate font-medium text-sm",eZ),Y[58]=eZ,Y[59]=P):P=Y[59],Y[60]!==ee?(O=ee?{opacity:0,y:-10}:{opacity:1,y:0}
796,Y[60]=ee,Y[61]=O):O=Y[61],Y[62]===Symbol.for("react.memo_cache_sentinel")?(U={opacity:1,y:0},Y[62]=U):U=Y[62],Y[63]!==ee?(M=ee?{opacity:0,y:10}:{opacity:1,y:0},L=ee?{duration:.3,ease:"easeOut"}:{duration:0},Y[63]=ee,Y[64]=M,Y[65]=L):(M=Y[64],L=Y[65]),Y[66]!==Q||Y[67]!==P||Y[68]!==O||Y[69]!==M||Y[70]!==L?(D=(0,a.jsx)(eP.N,{mode:"wait",children:(0,a.jsx)(eO.P.p,{className:P,initial:O,animate:U,exit:M,transition:L,children:Q})}),Y[66]=Q,Y[67]=P,Y[68]=O,Y[69]=M,Y[70]=L,Y[71]=D):D=Y[71],Y[72]!==eT||Y[73]!==ew||Y[74]!==eN?(B=ew?(0,a.jsxs)("span",{className:(0,o.cn)("shrink-0 tabular-nums text-[12px] font-normal",eT/eN>=.9?"text-comeback-red-500":eT/eN>=.75?"text-comeback-yellow-500":"text-comeback-gray-400"),children:[eT,"s / ",eN,"s"]}):null,Y[72]=eT,Y[73]=ew,Y[74]=eN,Y[75]=B):B=Y[75],Y[76]!==eB||Y[77]!==k||Y[78]!==G||Y[79]!==D||Y[80]!==B?($=(0,a.jsxs)("button",{type:"button",className:k,onClick:eB,children:[G,D,B]}),Y[76]=eB,Y[77]=k,Y[78]=G,Y[79]=D,Y[80]=B,Y[81]=$):$=Y[81],Y[82]!==eX||Y[83]!==eY||Y[84]!==ex||Y[85]!==ee||Y[86]!==eQ?(F=eQ?(0,a.jsxs)(eO.P.button,{layout:!0,type:"button",onClick:eX,disabled:eY,className:"group flex h-[24px] shrink-0 items-center overflow-hidden rounded-full border border-comeback-gray-300 bg-white text-comeback-gray-500 shadow-sm transition-[border-color,background-color,color,box-shadow] duration-[160ms] ease-out hover:border-comeback-gray-400 hover:bg-comeback-gray-75 hover:text-comeback-gray-900 hover:shadow disabled:opacity-50",initial:ee?{opacity:0}:{opacity:1},animate:{opacity:1},transition:{layout:{duration:.2,ease:"easeOut"},opacity:ee?{duration:.3,ease:"easeOut"}:{duration:0}},onMouseEnter:()=>eh(!0),onMouseLeave:()=>eh(!1),title:"Skip tool call",children:[(0,a.jsx)(eO.P.span,{initial:{width:0,opacity:0},animate:{width:ex?"auto":0,opacity:+!!ex},transition:{duration:.2,ease:"easeOut"},className:"overflow-hidden whitespace-nowrap font-medium text-xs",children:(0,a.jsx)("span",{className:"block pl-2",children:"Skip"})}),(0,a.jsx)(eO.P.div,{layout:!0,className:"flex h-[24px] flex-shrink-0 items-center justify-center px-1.5",children:(0,a.jsx)(f.I,{content:tY.ax,size:"small"})})]}):null,Y[82]=eX,Y[83]=eY,Y[84]=ex,Y[85]=ee,Y[86]=eQ,Y[87]=F):F=Y[87],Y[88]!==$||Y[89]!==F?(H=(0,a.jsxs)("div",{className:"flex w-fit min-w-0 max-w-full flex-row items-center gap-x-[12px]",children:[$,F]}),Y[88]=$,Y[89]=F,Y[90]=H):H=Y[90],Y[91]!==er?.currentUrl||Y[92]!==er?.liveUrl||Y[93]!==er?.replayUrl||Y[94]!==er?.size||Y[95]!==eH||Y[96]!==eU||Y[97]!==eu||Y[98]!==ed||Y[99]!==eL||Y[100]!==en||Y[101]!==ee||Y[102]!==ey||Y[103]!==eR||Y[104]!==ek||Y[105]!==ea?.lastAction||Y[106]!==ea?.replayUrl||Y[107]!==ea?.token||Y[108]!==ea?.webrtcUrl||Y[109]!==K||Y[110]!==eS||Y[111]!==X||Y[112]!==Q||Y[113]!==ei||Y[114]!==ec?(q=(X||eu)&&(0,a.jsxs)(eO.P.div,{className:"relative w-full",initial:!!ee&&{height:0,opacity:0,marginTop:0},animate:{height:eL?eu?eH+120:eU:0,opacity:+!!eL,marginTop:12*!!eL},transition:{duration:.35,ease:[.4,0,.2,1],height:{duration:.35*!ey}},style:{overflow:"hidden"},children:[(0,a.jsxs)("div",{ref:e_,className:(0,o.cn)("no-scrollbar flex h-full w-full flex-col gap-4 overflow-y-auto whitespace-pre-wrap text-comeback-gray-500 text-sm [overflow-wrap:anywhere]"),onClick:rR,onKeyDown:rA,role:"presentation",children:[ed?(0,a.jsx)(rd,{className:"sticky top-0 bg-white pb-1",webrtcUrl:ea?.webrtcUrl??null,token:ea?.token??null,replayUrl:ea?.replayUrl??null,toolCallId:ei??null,isLatest:ee,status:K??null,title:Q??null,subtext:X??null,isInteractive:en,lastAction:ea?.lastAction??null}):(0,a.jsx)(rn,{className:"sticky top-0 bg-white pb-1",title:Q??null,subtext:X??null,liveUrl:er?.liveUrl??null,size:er?.size===i.BrowserSize.MOBILE?i.BrowserSize.MOBILE:i.BrowserSize.DESKTOP,replayUrl:er?.replayUrl??null,currentUrl:er?.currentUrl??null,isLatest:ee,status:K,isInteractive:en}),(0,a.jsxs)("div",{className:(0,o.cn)(eu&&"flex-1 overflow-y-auto"),children:[(0,a.jsx)(p.o,{remarkPlugins:[x.A],rehypePlugins:[m.A],components:t9({collapseScreenshots:!0}),children:(0,t1.OS)(ee?eS:X??"")}),ec?(0,a.jsxs)("div",{className:"mt-[8px] flex items-center gap-[6px]",children:[(0,a.jsx)(h.E,{color:"yellow",children:"Truncated"}),(0,a.jsx)("span",{className:"text-[12px] text-comeback-gray-400",children:"Output truncated â full result saved to agent workspace"})]}):null]})]}),(0,a.jsx)(eP.N,{children:!ek||eR||eu?null:(0,a.jsx)(eO.P.div,{className:"pointer-events-none absolute top-0 right-0 left-0 h-[24px]",style:{background:"linear-gradient(to bottom, rgba(255,255,255,1) 0%, rgba(255,255,255,0.8) 60%, rgba(255,255,255,0) 100%)"},initial:{opacity:0}
796,animate:{opacity:1},exit:{opacity:0},transition:{duration:.3,ease:"easeInOut"}})})]}),Y[91]=er?.currentUrl,Y[92]=er?.liveUrl,Y[93]=er?.replayUrl,Y[94]=er?.size,Y[95]=eH,Y[96]=eU,Y[97]=eu,Y[98]=ed,Y[99]=eL,Y[100]=en,Y[101]=ee,Y[102]=ey,Y[103]=eR,Y[104]=ek,Y[105]=ea?.lastAction,Y[106]=ea?.replayUrl,Y[107]=ea?.token,Y[108]=ea?.webrtcUrl,Y[109]=K,Y[110]=eS,Y[111]=X,Y[112]=Q,Y[113]=ei,Y[114]=ec,Y[115]=q):q=Y[115],Y[116]!==q?(z=(0,a.jsx)("div",{className:"flex w-full min-w-0 flex-1 flex-col gap-[8px] overflow-hidden",children:q}),Y[116]=q,Y[117]=z):z=Y[117],Y[118]!==H||Y[119]!==z?(V=(0,a.jsxs)("div",{className:_,children:[H,z]}),Y[118]=H,Y[119]=z,Y[120]=V):V=Y[120],Y[121]!==T||Y[122]!==S||Y[123]!==V?(W=(0,a.jsx)(eO.P.div,{className:N,initial:T,animate:E,transition:S,children:V}),Y[121]=T,Y[122]=S,Y[123]=V,Y[124]=W):W=Y[124],W};function r_(e){return""!==e}function rk(e){return new Promise(t=>{e.complete?t(!0):(e.onload=()=>t(!0),e.onerror=()=>t(!0))})}function rC(){}function rR(e){return e.stopPropagation()}function rA(e){return e.stopPropagation()}let rG=e=>{let t,r,i,s,c,d,u,m,x,h,g,f,b,y,v,j=(0,n.c)(35),{text:I,subtext:w,status:N,isLatest:T}=e,E="running"===N,{displayText:S}=(0,l.wy)(w||"",E),_=T?S:w;if(!N&&!I)return null;j[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,o.cn)("comeback-text-body-md flex w-full flex-row items-start justify-start overflow-hidden rounded-[8px] border border-comeback-gray-75 bg-white text-left text-comeback-gray-900 outline-none transition-colors","p-[8px]"),j[0]=t):t=j[0],j[1]!==T?(r=T?{opacity:0,scale:.95}:{opacity:1,scale:1},j[1]=T,j[2]=r):r=j[2],j[3]===Symbol.for("react.memo_cache_sentinel")?(i={opacity:1,scale:1},j[3]=i):i=j[3],j[4]!==T?(s=T?{duration:.3,ease:"easeOut"}:{duration:0},j[4]=T,j[5]=s):s=j[5],j[6]!==E?(c=(0,a.jsx)("div",{className:"flex-shrink-0 px-[2px]",children:(0,a.jsx)(eP.N,{mode:"wait",children:(0,a.jsx)(rP,{isRunning:E})})}),j[6]=E,j[7]=c):c=j[7];let k="cancelled"===N?"text-comeback-gray-500":"text-comeback-gray-700";return j[8]!==k?(d=(0,o.cn)("truncate font-medium text-sm",k),j[8]=k,j[9]=d):d=j[9],j[10]!==T?(u=T?{opacity:0,y:-10}:{opacity:1,y:0},j[10]=T,j[11]=u):u=j[11],j[12]===Symbol.for("react.memo_cache_sentinel")?(m={opacity:1,y:0},j[12]=m):m=j[12],j[13]!==T?(x=T?{opacity:0,y:10}:{opacity:1,y:0},h=T?{duration:.3,ease:"easeOut"}:{duration:0},j[13]=T,j[14]=x,j[15]=h):(x=j[14],h=j[15]),j[16]!==x||j[17]!==h||j[18]!==d||j[19]!==u||j[20]!==I?(g=(0,a.jsx)(eP.N,{mode:"wait",children:(0,a.jsx)(eO.P.p,{className:d,initial:u,animate:m,exit:x,transition:h,children:I})}),j[16]=x,j[17]=h,j[18]=d,j[19]=u,j[20]=I,j[21]=g):g=j[21],j[22]!==g||j[23]!==c?(f=(0,a.jsxs)("div",{className:"flex min-w-0 max-w-full flex-row items-center gap-x-[12px]",children:[c,g]}),j[22]=g,j[23]=c,j[24]=f):f=j[24],j[25]!==_||j[26]!==T?(b=_?(0,a.jsx)(eP.N,{mode:"wait",children:(0,a.jsx)(eO.P.div,{className:"truncate pl-[32px] text-comeback-gray-500 text-xs [&_code]:rounded [&_code]:bg-comeback-gray-50 [&_code]:px-[4px] [&_code]:py-[1px] [&_code]:font-mono [&_code]:text-comeback-gray-600",initial:T?{opacity:0,y:6}:{opacity:1,y:0},animate:{opacity:1,y:0},exit:T?{opacity:0,y:-6}:{opacity:1,y:0},transition:T?{duration:.2,ease:"easeOut"}:{duration:0},children:(0,a.jsx)(p.o,{components:{p:rO},children:_})},_)}):null,j[25]=_,j[26]=T,j[27]=b):b=j[27],j[28]!==f||j[29]!==b?(y=(0,a.jsxs)("div",{className:"flex w-full min-w-0 flex-col gap-[2px]",children:[f,b]}),j[28]=f,j[29]=b,j[30]=y):y=j[30],j[31]!==y||j[32]!==r||j[33]!==s?(v=(0,a.jsx)(eO.P.div,{className:t,initial:r,animate:i,transition:s,children:y}),j[31]=y,j[32]=r,j[33]=s,j[34]=v):v=j[34],v},rP=e=>{let t,r=(0,n.c)(2),{isRunning:i}=e;if(i){let e;return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)(eO.P.div,{className:"flex h-[16px] w-[16px] items-center justify-center",children:(0,a.jsx)(eO.P.div,{className:"h-[8px] w-[8px] rounded-full bg-comeback-yellow-400",animate:{opacity:[1,.4,1]},transition:{duration:1.5,repeat:1/0,ease:"easeInOut"}})},"running"),r[0]=e):e=r[0],e}return r[1]===Symbol.for("react.memo_cache_sentinel")?(t=(0,a.jsx)(eO.P.div,{className:"flex h-[16px] w-[16px] items-center justify-center",children:(0,a.jsx)(f.I,{content:tY.bC,size:"small",className:"text-green-600"})},"done"),r[1]=t):t=r[1],t};function rO(e){let{children:t}=e;return(0,a.jsx)("span",{children:t})}
796var rU=r(417384),rM=r(467105),rL=r.n(rM),rD=r(336532);let rB=(0,v.U)(` 797 query GetMobileDevServerSession($projectGroupId: ID!) { 798 projectGroupById(id: $projectGroupId) { 799 id 800 mobileDevServerSession { 801 id 802 qrCode 803 builderUrl 804 expoPreviewReady 805 } 806 } 807 } 808`),r$=(0,v.U)(` 809 query GetModulesForURLBar( 810 $projectGroupId: ID! 811 $order: ProjectOrderBy 812 $after: String 813 $input: ProjectGroupProjectsInput 814 ) { 815 projectGroupById(id: $projectGroupId) { 816 id 817 databases { 818 id 819 name 820 } 821 filesystemVersion 822 projects(order: $order, after: $after, input: $input) { 823 pageInfo { 824 hasNextPage 825 endCursor 826 } 827 edges { 828 node { 829 id 830 name 831 filePath 832 routingBehavior 833 } 834 } 835 } 836 } 837 } 838`);function rF(e){let t,r,s,l,c,d,u,p,m,x,h,g,b,v,I,w,N,T=(0,n.c)(45),{href:E,device:S}=e;T[0]===Symbol.for("react.memo_cache_sentinel")?(t=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),T[0]=t):t=T[0];let _=t,{id:k,filesystemVersion:C}=(0,eA.MN)(),R=C!==i.FilesystemVersion.NOT_FILE_BASED,A=(0,ep.nZ)(rH),G=!k;T[1]===Symbol.for("react.memo_cache_sentinel")?(r={routingBehaviors:["page","expo-page"]},T[1]=r):r=T[1],T[2]!==k?(s={projectGroupId:k,input:r},T[2]=k,T[3]=s):s=T[3],T[4]!==G||T[5]!==s?(l={skip:G,variables:s},T[4]=G,T[5]=s,T[6]=l):l=T[6];let{data:P,loading:O}=(0,j.I)(r$,l);T[7]!==P?.projectGroupById.projects.edges||T[8]!==S||T[9]!==E?(c=P?.projectGroupById.projects.edges.find(e=>{let t=e.node.filePath;if(!t)return!1;let r=(0,i.getWebRouteFromPath)(t),a="mobile"===S?M.Xu3.EXPO_PAGE:M.Xu3.PAGE;return r===E&&e.node.routingBehavior===a}),T[7]=P?.projectGroupById.projects.edges,T[8]=S,T[9]=E,T[10]=c):c=T[10];let U=c,L=(0,y.useRef)(null),D=(0,y.useRef)(null);T[11]!==U||T[12]!==A?(d=()=>{U&&A(U.node.id)},T[11]=U,T[12]=A,T[13]=d):d=T[13];let B=!E||O||!U||!R;T[14]!==d||T[15]!==B?(u={onPress:d,isDisabled:B},T[14]=d,T[15]=B,T[16]=u):u=T[16];let{buttonProps:$}=(0,ey.s)(u,L);T[17]!==U||T[18]!==A?(p=()=>{U&&A(U.node.id)},T[17]=U,T[18]=A,T[19]=p):p=T[19];let F=!E||O||!U||!R;T[20]!==p||T[21]!==F?(m={onPress:p,isDisabled:F,elementType:"a"},T[20]=p,T[21]=F,T[22]=m):m=T[22];let{linkProps:H}=(0,rD.i)(m,D),q=E&&!O&&U&&R,z=q&&"hover:text-comeback-blue-500 hover:underline";T[23]!==z?(x=(0,o.cn)("flex w-full cursor-pointer items-center gap-2 border-comeback-gray-75 border-b p-[20px] tablet:px-[12px] tablet:py-[8px] text-left text-comeback-gray-500 outline-none transition-colors last:border-b-0 hover:bg-comeback-gray-50 disabled:cursor-default disabled:hover:bg-transparent",z),T[23]=z,T[24]=x):x=T[24];let V=x,W="mobile"===S?tY.zW:tY._t;T[25]!==W?(h=(0,a.jsx)(f.I,{content:W,size:_?"medium":"xs"}),T[25]=W,T[26]=h):h=T[26];let Y="/"===E&&"web"===S?"Homepage":"/"===E&&"mobile"===S?"Homescreen":U?.node.name??E;T[27]!==Y?(g=(0,a.jsx)("span",{children:Y}),T[27]=Y,T[28]=g):g=T[28],T[29]!==h||T[30]!==g?(b=(0,a.jsxs)("div",{className:"flex w-full items-center gap-2",children:[h,g]}),T[29]=h,T[30]=g,T[31]=b):b=T[31],T[32]===Symbol.for("react.memo_cache_sentinel")?(v=(0,a.jsx)(f.I,{content:eQ.ke,size:_?"medium":"xs",className:"tablet:hidden"}),T[32]=v):v=T[32],T[33]!==b?(I=(0,a.jsxs)("div",{className:"pointer-events-none flex w-full items-center justify-between gap-2",children:[b,v]}),T[33]=b,T[34]=I):I=T[34];let Q=I;T[35]!==S||T[36]!==E?(w={device:S,href:E},T[35]=S,T[36]=E,T[37]=w):w=T[37];let X=(e=>{let t,r,a=(0,n.c)(9),{device:i,href:s}=e,{id:l}=(0,eA.MN)();a[0]===Symbol.for("react.memo_cache_sentinel")?(t={historicalProjectGroupRevisionId:null},a[0]=t):t=a[0];let o=(0,rU.I)(t);a[1]!==l?(r={variables:{projectGroupId:l}},a[1]=l,a[2]=r):r=a[2];let{data:c}=(0,j.I)(rB,r),d=c?.projectGroupById?.mobileDevServerSession?.qrCode;if("mobile"===i){if(d)return d;else if(o?.mobile){let e;return a[3]!==o.mobile||a[4]!==s?(e=rL()(o.mobile,s),a[3]=o.mobile,a[4]=s,a[5]=e):e=a[5],e}}if("web"===i&&o?.web){let e;return a[6]!==o.web||a[7]!==s?(e=rL()(o.web,s),a[6]=o.web,a[7]=s,a[8]=e):e=a[8],e}return null})(w);return T[38]!==X||T[39]!==H||T[40]!==$||T[41]!==V||T[42]!==Q||T[43]!==q?(N=_?(0,a.jsx)("a",{...H,target:"_blank",rel:"noopener noreferrer",href:q&&X?X:void 0,className:V,children:Q}
838):(0,a.jsx)("button",{ref:L,type:"button",...$,className:V,children:Q}),T[38]=X,T[39]=H,T[40]=$,T[41]=V,T[42]=Q,T[43]=q,T[44]=N):N=T[44],N}function rH(e){return e.setViewingModuleId}function rq(e){let t,r,i=(0,n.c)(5),{updates:s,isLatest:l}=e;return i[0]!==l||i[1]!==s?(t=s?.length&&(0,a.jsxs)(eO.P.div,{initial:{opacity:+!l},animate:{opacity:1},transition:{duration:.5,ease:"easeOut",delay:.1},className:"flex h-fit w-full tablet:max-w-[300px] flex-col items-start justify-center gap-[4px]",children:[(0,a.jsx)(b.E,{className:"comeback-text-body-xs text-left text-comeback-gray-400 uppercase",type:"body-xs",children:"Updates"}),(0,a.jsx)("div",{className:"flex w-full flex-col overflow-hidden overflow-y-auto rounded-[8px] border border-comeback-gray-75 bg-white text-body-sm text-comeback-gray-500",children:s?.map(rz)})]}),i[0]=l,i[1]=s,i[2]=t):t=i[2],i[3]!==t?(r=(0,a.jsx)(eP.N,{mode:"wait",children:t}),i[3]=t,i[4]=r):r=i[4],r}function rz(e){return(0,a.jsx)(rF,{href:e.url,device:e.device},`${e.device}-${e.url}`)}var rV=r(106768),rW=r(387631),rY=r(460674);let rQ=(0,v.U)(` 839 query GetProjectGroupRevisionsForChat( 840 $projectGroupId: ID! 841 $threadId: ID 842 $first: Int 843 $after: String 844 ) { 845 projectGroupById(id: $projectGroupId) { 846 id 847 latestRevision: latestRevisionForThread(threadId: $threadId) { 848 id 849 status 850 createdAt 851 thread { 852 id 853 } 854 } 855 revisions( 856 order: [{ createdAt: "DESC" }] 857 first: $first 858 after: $after 859 input: { 860 threadId: $threadId 861 actions: [ 862 CHAT 863 AUTO_SELECT_CHAT 864 DEEP_DEBUGGING 865 EXPERT_SWE 866 DISCUSSION 867 ORCHESTRATOR 868 DELEGATE_TO_SUB_AGENT 869 DESIGN_AGENT 870 INTRODUCE_BUG 871 AGENT_AUTO_SELECT_INTEGRATION 872 FORK_WITH_CHAT_MESSAGE 873 FORK_MODULE_WITH_CHAT_MESSAGE 874 SELECT_INTEGRATION_WITH_CHAT_MESSAGE 875 PUBLISH_PROJECT_AND_CONTINUE_CHAT 876 CHANGE_DESIGN_SYSTEM_AND_CONTINUE_CHAT 877 SAVE_SECRET_AND_CONTINUE_CHAT 878 ADD_AUTH_AND_CONTINUE_CHAT 879 RESTORE 880 PROJECT_FIX_CHANGE 881 PLAN_AGENT 882 ] 883 } 884 ) { 885 totalCount 886 pageInfo { 887 hasNextPage 888 hasPreviousPage 889 endCursor 890 startCursor 891 } 892 edges { 893 node { 894 ...ProjectGroupRevisionForChat 895 } 896 } 897 } 898 } 899 } 900`),rX=(0,v.U)(` 901 mutation RestoreProjectGroupRevision( 902 $input: RestoreProjectGroupRevisionInput! 903 ) { 904 restoreProjectGroupRevision(input: $input) { 905 success 906 projectGroupRevision { 907 ...ProjectGroupRevisionForChat 908 } 909 } 910 } 911`);function rK({revisions:e,suggestedRevisionId:t,isInteractive:r,isDisabled:n}){let[i,s]=(0,y.useState)("idle"),[l]=(0,Z.n)(rX),o=(0,ep.nZ)(e=>e.clearHistoricalRevision),c=(0,A.eE)(e=>e.actions?.scrollToEnd),d=(0,t_.yT)(e=>e.setSelection),u=(0,rV.T)(e=>e.setSelectedRevisionId),{id:x}=(0,eA.MN)(),h=(0,e1.rl)(),g=e.find(e=>e.id===t)??e[0]??null,v=(0,y.useCallback)(()=>{g&&(u(g.id),d(tk.e.VERSION_HISTORY))},[g,u,d]),j=(0,y.useCallback)(async()=>{if(g){s("restoring");try{c?.(),await l({variables:{input:{projectGroupRevisionId:g.id}},update(e,{data:t}){let r=t?.restoreProjectGroupRevision.projectGroupRevision;r&&e.updateQuery({query:rQ,variables:{projectGroupId:x,threadId:"string"==typeof h?h:null,first:rW.ft}},e=>e?.projectGroupById?{...e,projectGroupById:{...e.projectGroupById,latestRevision:{__typename:"ProjectGroupRevision",id:r.id,status:r.status,createdAt:r.createdAt,thread:r.thread},revisions:{...e.projectGroupById.revisions,totalCount:e.projectGroupById.revisions.totalCount+1,edges:[{__typename:"ProjectGroupRevisionEdge",node:r},...e.projectGroupById.revisions.edges]}}}:e)}}),o(),c?.(),s("restored")}catch(e){J.Cp(e),s("error")}}},[g,l,o,c,x,h]);if(0===e.length||!g)return null;let I=(0,rY.m)(new Date(g.createdAt),{addSuffix:!0});return(0,a.jsx)(eP.N,{mode:"wait",children:(0,a.jsxs)(eO.P.div,{initial:{opacity:0}
911,animate:{opacity:1},transition:{duration:.4,ease:"easeOut"},className:"flex h-fit w-full tablet:max-w-[350px] flex-col items-start justify-center gap-[4px]",children:[(0,a.jsx)(b.E,{className:"comeback-text-body-xs text-left text-comeback-gray-400 uppercase",type:"body-xs",children:"Version History"}),(0,a.jsxs)("div",{className:"flex w-full flex-col overflow-hidden rounded-lg border border-comeback-gray-75 bg-white",children:[(0,a.jsx)("div",{className:"flex items-center justify-between gap-[12px] p-[12px]",children:(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"line-clamp-2 text-comeback-gray-700 comeback-text-body-sm [&_code]:rounded [&_code]:bg-comeback-gray-50 [&_code]:px-[4px] [&_code]:py-[1px] [&_code]:font-mono [&_code]:text-comeback-gray-600",children:(0,a.jsx)(p.o,{rehypePlugins:[m.A],components:{...t1.dK,p:({children:e})=>(0,a.jsx)("span",{children:e})},children:(0,t1.OS)(g.content)})}),(0,a.jsx)("div",{className:"flex items-center gap-[6px]",children:(0,a.jsx)(b.E,{type:"body-xs",className:"text-comeback-gray-400",children:I})})]})}),r&&"restored"!==i&&(0,a.jsxs)("div",{className:"flex w-full items-center gap-[8px] px-[12px] pb-[12px]",children:[(0,a.jsx)($.Button,{size:"sm",color:"light",className:"w-full",onPress:v,children:"Preview"}),(0,a.jsx)($.Button,{size:"sm",color:"light",className:"w-full",onPress:()=>{"restoring"!==i&&j().catch(e=>{J.Cp(e)})},disabled:n||"restoring"===i,children:"restoring"===i?"Restoring...":"restored"===i?"Restored":"error"===i?"Retry Restore":"Restore"})]}),(0,a.jsxs)("button",{type:"button",className:"flex items-center gap-[4px] border-comeback-gray-75 border-t px-[12px] py-[8px] text-left transition-colors hover:bg-comeback-gray-25",onClick:()=>d(tk.e.VERSION_HISTORY),children:[(0,a.jsx)(f.I,{content:eQ.$U,size:"custom",className:"h-[12px] w-[12px] text-comeback-gray-400"}),(0,a.jsx)(b.E,{type:"body-xs",className:"text-comeback-gray-400",children:"View all versions"})]})]}),"error"===i&&(0,a.jsx)(b.E,{type:"body-xs",className:"text-comeback-red-500",children:"Failed to restore version. Please try again."})]})})}let rJ={ready:"â",warnings:"!",issues:"â"},rZ={ready:"bg-comeback-green-50 text-comeback-green-600",warnings:"bg-comeback-yellow-50 text-comeback-yellow-700",issues:"bg-comeback-red-50 text-comeback-red-600"},r0=()=>{let e,t=(0,n.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,a.jsx)("path",{d:"M4 6l4 4 4-4"})}),t[0]=e):e=t[0],e},r1={issues:"â",warnings:"!",passed:"â"},r2={issues:"Issues",warnings:"Warnings",passed:"Passed"},r3={issues:"bg-comeback-red-50 text-comeback-red-600",warnings:"bg-comeback-yellow-50 text-comeback-yellow-700",passed:"bg-comeback-green-50 text-comeback-green-600"},r4={issues:"text-comeback-red-500",warnings:"text-comeback-yellow-600",passed:"text-comeback-green-500"},r5=e=>{let t,r,i,s,l,c,d,u,p,m,x,h=(0,n.c)(29),{variant:g,items:f}=e,[b,v]=(0,y.useState)(!1);if(0===f.length)return null;h[0]!==b?(t=()=>v(!b),h[0]=b,h[1]=t):t=h[1];let j=r2[g],I=r3[g];h[2]!==I?(r=(0,o.cn)("flex h-[18px] min-w-[18px] items-center justify-center rounded-full px-[5px] font-semibold text-[11px] leading-none",I),h[2]=I,h[3]=r):r=h[3],h[4]!==f.length||h[5]!==r?(i=(0,a.jsx)("span",{className:r,children:f.length}),h[4]=f.length,h[5]=r,h[6]=i):i=h[6],h[7]!==j||h[8]!==i?(s=(0,a.jsxs)("span",{className:"flex items-center gap-[6px] font-medium",children:[j,i]}),h[7]=j,h[8]=i,h[9]=s):s=h[9];let w=b&&"rotate-180";return h[10]!==w?(l=(0,o.cn)("ml-auto h-[14px] w-[14px] text-comeback-gray-400 transition-transform duration-150",w),h[10]=w,h[11]=l):l=h[11],h[12]===Symbol.for("react.memo_cache_sentinel")?(c=(0,a.jsx)(r0,{}),h[12]=c):c=h[12],h[13]!==l?(d=(0,a.jsx)("span",{className:l,children:c}),h[13]=l,h[14]=d):d=h[14],h[15]!==b||h[16]!==t||h[17]!==d||h[18]!==s?(u=(0,a.jsxs)("button",{type:"button",className:"flex w-full items-center gap-[8px] px-[16px] py-[10px] text-left focus-visible:outline-2 focus-visible:outline-comeback-blue-500 focus-visible:outline-offset-[-2px]",onClick:t,"aria-expanded":b,children:[s,d]}),h[15]=b,h[16]=t,h[17]=d,h[18]=s,h[19]=u):u=h[19],h[20]!==b||h[21]!==f||h[22]!==g?(p=b&&(0,a.jsx)(eO.P.ul,{className:"flex flex-col gap-[1px] px-[16px] pb-[12px]",initial:{height:0,opacity:0}
911,animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},style:{overflow:"hidden"},children:f.map((e,t)=>(0,a.jsxs)("li",{className:"flex items-start gap-[8px] py-[4px] text-comeback-gray-700 leading-snug",children:[(0,a.jsx)("span",{className:(0,o.cn)("mt-[2px] flex h-[16px] w-[16px] flex-shrink-0 items-center justify-center text-[11px]",r4[g]),children:r1[g]}),(0,a.jsx)("span",{children:e})]},t))}),h[20]=b,h[21]=f,h[22]=g,h[23]=p):p=h[23],h[24]!==p?(m=(0,a.jsx)(eP.N,{initial:!1,children:p}),h[24]=p,h[25]=m):m=h[25],h[26]!==u||h[27]!==m?(x=(0,a.jsxs)("div",{className:"border-comeback-gray-50 border-t",children:[u,m]}),h[26]=u,h[27]=m,h[28]=x):x=h[28],x},r7=e=>{let t,r,i,s,l,c,d,u,p,m,x,h,g,f,b,y=(0,n.c)(45),{data:v,isDisabled:j}=e;if(y[0]!==v.issues||y[1]!==v.warnings||y[2]!==j){let e,n=function({issues:e,warnings:t}){return e.length>0?"issues":t.length>0?"warnings":"ready"}({issues:v.issues,warnings:v.warnings}),d=j&&"pointer-events-none opacity-40";y[9]!==d?(c=(0,o.cn)("flex w-full flex-col rounded-[8px] border border-comeback-gray-75 text-body-sm",d),y[9]=d,y[10]=c):c=y[10],s="flex items-center gap-[10px] px-[16px] py-[12px]";let u=rZ[n];y[11]!==u?(e=(0,o.cn)("flex h-[28px] w-[28px] flex-shrink-0 items-center justify-center rounded-full text-[14px]",u),y[11]=u,y[12]=e):e=y[12];let p=rJ[n];y[13]!==p||y[14]!==e?(l=(0,a.jsx)("div",{className:e,children:p}),y[13]=p,y[14]=e,y[15]=l):l=y[15],i="flex flex-1 flex-col gap-[2px]",t="font-semibold text-comeback-gray-900 leading-tight",r=function({status:e}){switch(e){case"ready":return"Ready for submission";case"warnings":return"Ready with warnings";case"issues":return"Not ready for submission"}}({status:n}),y[0]=v.issues,y[1]=v.warnings,y[2]=j,y[3]=t,y[4]=r,y[5]=i,y[6]=s,y[7]=l,y[8]=c}else t=y[3],r=y[4],i=y[5],s=y[6],l=y[7],c=y[8];return y[16]!==t||y[17]!==r?(d=(0,a.jsx)("p",{className:t,children:r}),y[16]=t,y[17]=r,y[18]=d):d=y[18],y[19]!==v.issues.length||y[20]!==v.passed.length||y[21]!==v.warnings.length?(u=function({issueCount:e,warningCount:t,passedCount:r}){let a=[];return e>0&&a.push(`${e} issue${1!==e?"s":""}`),t>0&&a.push(`${t} warning${1!==t?"s":""}`),r>0&&a.push(`${r} passed`),a.join(" \xb7 ")}({issueCount:v.issues.length,warningCount:v.warnings.length,passedCount:v.passed.length}),y[19]=v.issues.length,y[20]=v.passed.length,y[21]=v.warnings.length,y[22]=u):u=y[22],y[23]!==u?(p=(0,a.jsx)("p",{className:"text-[12px] text-comeback-gray-500 leading-tight",children:u}),y[23]=u,y[24]=p):p=y[24],y[25]!==i||y[26]!==d||y[27]!==p?(m=(0,a.jsxs)("div",{className:i,children:[d,p]}),y[25]=i,y[26]=d,y[27]=p,y[28]=m):m=y[28],y[29]!==m||y[30]!==s||y[31]!==l?(x=(0,a.jsxs)("div",{className:s,children:[l,m]}),y[29]=m,y[30]=s,y[31]=l,y[32]=x):x=y[32],y[33]!==v.issues?(h=(0,a.jsx)(r5,{variant:"issues",items:v.issues}),y[33]=v.issues,y[34]=h):h=y[34],y[35]!==v.warnings?(g=(0,a.jsx)(r5,{variant:"warnings",items:v.warnings}),y[35]=v.warnings,y[36]=g):g=y[36],y[37]!==v.passed?(f=(0,a.jsx)(r5,{variant:"passed",items:v.passed}),y[37]=v.passed,y[38]=f):f=y[38],y[39]!==x||y[40]!==h||y[41]!==g||y[42]!==f||y[43]!==c?(b=(0,a.jsxs)("div",{className:c,children:[x,h,g,f]}),y[39]=x,y[40]=h,y[41]=g,y[42]=f,y[43]=c,y[44]=b):b=y[44],b};var r8=r(285530);let r6=()=>{let e,t,r=(0,n.c)(2);return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)("div",{className:"flex-shrink-0",children:(0,a.jsx)(f.I,{content:g._t,size:"xs"})}),r[0]=e):e=r[0],r[1]===Symbol.for("react.memo_cache_sentinel")?(t=(0,a.jsx)("a",{className:"flex w-[300px] max-w-[300px] items-center gap-[12px] rounded-[8px] border border-comeback-gray-75 bg-white px-[20px] py-[12px] shadow-sm transition-colors hover:bg-comeback-gray-25",href:L.M$,target:"_blank",rel:"noopener noreferrer",children:(0,a.jsxs)("div",{className:"flex flex-row gap-[8px] justify-between items-center w-full",children:[e,(0,a.jsx)("div",{className:"flex min-w-0 flex-1 flex-col gap-[2px] overflow-hidden",children:(0,a.jsx)(b.E,{type:"body-md",className:"truncate text-comeback-gray-700",children:"Start a new project"})}),(0,a.jsx)(f.I,{content:g.e5,size:"xs"})]})}),r[1]=t):t=r[1],t},r9=["Initializing new document...","Setting up file structure...","Building framework...","Processing requirements...","Flowing words onto page...","Thinking deeply...","Analyzing context...","Enhancing clarity...","Smoothing rough edges...","Fine-tuning details..."],ae=e=>{let t,r,s,l=(0,n.c)(61),{data:c,isLatest:d,isLoading:u,isInteractive:p,isLatestMessage:m,threadId:x}=e,[h,g]=(0,y.useState)(0);switch(l[0]!==u?(t=()=>{if(!u)return;g(0);let e=setInterval(()=>{g(at)},3e3);return()=>clearInterval(e)},r=[u],l[0]=u,l[1]=t,l[2]=r):(t=l[1],r=l[2]),(0,y.useEffect)(t,r),c.uiType){case i.UIBlockType.THINKING:{let e;if(c.thinkingType===i.ThinkingType.CONTEXT_COMPRESSION){let e,t=c.text??null,r=c.subtext??null,n=c.status??null,i=c.progress??null;return l[3]!==d||l[4]!==t||l[5]!==r||l[6]!==n||l[7]!==i?(e=(0,a.jsx)(t0,{text:t,subtext:r,status:n,isLatest:d,progress:i}),l[3]=d,l[4]=t,l[5]=r,l[6]=n,l[7]=i,l[8]=e):e=l[8],e}let t=c.browser??null,r=c.simulator??null;return l[9]!==c.cancellable||l[10]!==c.domains||l[11]!==c.status||l[12]!==c.subtext||l[13]!==c.text||l[14]!==c.thinkingType||l[15]!==c.timeoutMs||l[16]!==c.toolCallId||l[17]!==c.truncated||l[18]!==p||l[19]!==d||l[20]!==t||l[21]!==r||l[22]!==x?(e=(0,a.jsx)(rS,{text:c.text,subtext:c.subtext,status:c.status,isLatest:d,domains:c.domains,thinkingType:c.thinkingType,browser:t,simulator:r,isInteractive:p,toolCallId:c.toolCallId,cancellable:c.cancellable,timeoutMs:c.timeoutMs,threadId:x,truncated:c.truncated}),l[9]=c.cancellable,l[10]=c.domains,l[11]=c.status,l[12]=c.subtext,l[13]=c.text,l[14]=c.thinkingType,l[15]=c.timeoutMs,l[16]=c.toolCallId,l[17]=c.truncated,l[18]=p,l[19]=d,l[20]=t,l[21]=r,l[22]=x,l[23]=e):e=l[23],e}case i.UIBlockType.SUBAGENT:{let e,t=c.text??null,r=c.subtext??null,n=c.status??null;return l[24]!==d||l[25]!==t||l[26]!==r||l[27]!==n?(e=(0,a.jsx)(rG,{text:t,subtext:r,status:n,isLatest:d}),l[24]=d,l[25]=t,l[26]=r,l[27]=n,l[28]=e):e=l[28],e}case i.UIBlockType.SUMMARY:{let e,t;return l[29]!==c.updates?(e=c?.updates??[],l[29]=c.updates,l[30]=e):e=l[30],l[31]!==d||l[32]!==e?(t=(0,a.jsx)(rq,{updates:e,isLatest:d}),l[31]=d,l[32]=e,l[33]=t):t=l[33],t}case i.UIBlockType.VERSION_HISTORY:{let e,t;l[34]!==c.revisions?(e=c.revisions??[],l[34]=c.revisions,l[35]=e):e=l[35];
911let r=c.suggestedRevisionId??null,n=!m;return l[36]!==p||l[37]!==e||l[38]!==r||l[39]!==n?(t=(0,a.jsx)(rK,{revisions:e,suggestedRevisionId:r,isInteractive:p,isDisabled:n}),l[36]=p,l[37]=e,l[38]=r,l[39]=n,l[40]=t):t=l[40],t}case i.UIBlockType.SUBMISSION_READINESS:{let e,t;l[41]!==c.code?(e=c.code?(0,r8.UN)(c.code):null,l[41]=c.code,l[42]=e):e=l[42];let r=e;if(!r)return null;let n=!p;return l[43]!==r||l[44]!==n?(t=(0,a.jsx)(r7,{data:r,isDisabled:n}),l[43]=r,l[44]=n,l[45]=t):t=l[45],t}case i.UIBlockType.CREATE_NEW_PROJECT:{let e;return l[46]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)(r6,{}),l[46]=e):e=l[46],e}case i.UIBlockType.PLAN:{let e,t=c.code??"",r=!m,n=u&&d;return l[47]!==t||l[48]!==r||l[49]!==n?(e=(0,a.jsx)(tD,{planContent:t,isDisabled:r,isStreaming:n}),l[47]=t,l[48]=r,l[49]=n,l[50]=e):e=l[50],e}case i.UIBlockType.INTERJECTION:case i.UIBlockType.FILE:case i.UIBlockType.DATABASE:case i.UIBlockType.TODO_LIST:break;default:return c.uiType}let v="cancelled"===c.status,j=u&&""!==c.code;return l[51]!==h||l[52]!==c.code||l[53]!==c.subtext||l[54]!==c.text||l[55]!==c.uiType||l[56]!==v||l[57]!==d||l[58]!==u||l[59]!==j?(s=(0,a.jsx)(eP.N,{mode:"wait",children:j?(0,a.jsx)(eO.P.div,{className:"relative w-full",initial:{height:0,opacity:0,marginTop:0},animate:{height:200,opacity:1,marginTop:12},exit:{height:50,opacity:0,marginTop:12},transition:{duration:.5,ease:"easeInOut",exit:{duration:.3,ease:"easeOut",opacity:{duration:.15,ease:"easeIn"}}},style:{overflow:"hidden"},children:(0,a.jsx)(tZ,{code:c.code,isGenerating:u,dialect:null})},"code-preview"):(0,a.jsx)(eO.P.div,{className:"comeback-text-body-md flex min-h-fit w-[300px] max-w-[300px] flex-row items-center justify-start overflow-hidden rounded-[8px] border-[1px] border-comeback-gray-75 bg-white px-[20px] py-[12px] text-left text-comeback-gray-900 shadow-sm outline-none transition-colors",initial:!1,animate:{opacity:1,scale:1},transition:d?{duration:.3,ease:"easeOut"}:{duration:0},children:(0,a.jsx)(eP.N,{mode:"wait",children:(0,a.jsx)(eO.P.div,{className:(0,o.cn)("flex w-full min-w-0 flex-row gap-[12px]",u?"items-center":"items-start"),initial:d?{opacity:0,y:-20}:{opacity:1,y:0},animate:{opacity:1,y:0},exit:d?{opacity:0,y:20}:{opacity:1,y:0},transition:d?{duration:.3,ease:"easeOut",bounce:0}:{duration:0,bounce:0},children:u&&!j?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"flex-shrink-0",children:(0,a.jsx)("div",{className:"pulsing-dot h-[12px] w-[12px] rounded-full bg-comeback-gray-600"})}),(0,a.jsx)("div",{className:"min-w-0 flex-1 overflow-hidden",children:(0,a.jsx)(eP.N,{mode:"wait",children:(0,a.jsx)(eO.P.p,{className:"truncate text-comeback-gray-700 text-sm",initial:d?{opacity:0,y:-10}:{opacity:1,y:0},animate:{opacity:1,y:0},exit:d?{opacity:0,y:10}:{opacity:1,y:0},transition:d?{duration:.3,ease:"easeOut"}:{duration:0},children:r9[h]},h)})})]}):c.uiType===i.UIBlockType.FILE||c.uiType===i.UIBlockType.DATABASE?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"flex-shrink-0",children:(0,a.jsx)("div",{className:"relative",children:(0,a.jsx)(f.I,{content:c.uiType===i.UIBlockType.DATABASE?tY.QN:tY._t,size:"xs",className:"mt-[4px]"})})}),(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-[2px] overflow-hidden",children:[c.text&&(0,a.jsx)(b.E,{type:"body-md",className:(0,o.cn)("truncate text-comeback-gray-700",v&&"text-comeback-gray-500"),children:c.text}),c.subtext&&(0,a.jsx)(b.E,{type:"body-sm",className:(0,o.cn)("truncate text-comeback-gray-400"),children:c.subtext})]})]}):null},u?"loading":"content")})},"ui-block")}),l[51]=h,l[52]=c.code,l[53]=c.subtext,l[54]=c.text,l[55]=c.uiType,l[56]=v,l[57]=d,l[58]=u,l[59]=j,l[60]=s):s=l[60],s};function at(e){return Math.min(e+1,r9.length-1)}var ar=r(943211),aa=r(451758),an=r(814394),ai=r(400093),as=r(513124),al=r(242417);let ao=(0,u.default)(()=>r.e(89367).then(r.bind(r,689367)),{loadableGenerated:{webpack:()=>[689367]}}),ac=(0,u.default)(()=>Promise.all([r.e(49746),r.e(39305)]).then(r.bind(r,139305)),{loadableGenerated:{webpack:()=>[139305]}}),ad=(0,u.default)(()=>Promise.resolve().then(r.bind(r,401499)).then(e=>e.ViewCodeBlock),{loadableGenerated:{webpack:()=>[401499]}}),au=(0,u.default)(()=>Promise.all([r.e(61175),r.e(32329)]).then(r.bind(r,732329)).then(e=>e.DesignExploration),{loadableGenerated:{webpack:()=>[732329]}}),ap=(0,u.default)(()=>Promise.all([r.e(10791),r.e(32297)]).then(r.bind(r,232297)).then(e=>e.DesignVariation),{loadableGenerated:{webpack:()=>[232297]}}),am=(0,u.default)(()=>Promise.resolve().then(r.bind(r,649585)).then(e=>e.FigmaImport),{loadableGenerated:{webpack:()=>[649585]}}),ax=(0,u.default)(()=>Promise.resolve().then(r.bind(r,844966)).then(e=>e.RevenueCatSection),{loadableGenerated:{webpack:()=>[844966]}}),ah=(0,u.default)(()=>Promise.resolve().then(r.bind(r,405233)).then(e=>e.AppStoreConnectSection),{loadableGenerated:{webpack:()=>[405233]}}),ag=e=>{let t=(0,n.c)(241),{block:r,index:u,variant:h,threadId:g,isLatestBlock:f,isGenerating:b,createdAt:y,shouldUseStreamingAnimation:v,isInteractive:j,isLatestMessage:I,revisionId:w,revisionAction:T,isSupersededAskQuestions:E,galleryToRender:S,pendingAssetCount:_}=e,R=(0,ai.f6)(),A=`${r.type}-${u}-${g===e1.w2?"new":g}`;switch(r.type){case ar.I.TAG:switch(r.tag){case i.LLMTag.SUGGEST_ENVIRONMENT_VARIABLES:{let e,n;t[0]!==r.code?(e=(0,r8.dC)(r.code),t[0]=r.code,t[1]=e):e=t[1];let i=e;if(!i||0===i.length)return null;return t[2]!==f||t[3]!==A||t[4]!==i?(n=(0,a.jsx)(ts,{secretNames:i,isLatest:f},A),t[2]=f,t[3]=A,t[4]=i,t[5]=n):n=t[5],n}case i.LLMTag.FILE_BASED_BLOCK:{let e,n,s,l=r.args?.uiType;if(!l||"string"!=typeof l)return null;if("interjection"===l){let e,n,i,s,l,o="string"==typeof r.args?.text?r.args.text:"";return t[6]===Symbol.for("react.memo_cache_sentinel")?(e=[x.A],n=[m.A],t[6]=e,t[7]=n):(e=t[6],n=t[7]),t[8]!==o?(i=(0,t1.OS)(o),t[8]=o,t[9]=i):i=t[9],t[10]!==i?(s=(0,a.jsx)("div",{className:"w-fit max-w-[75%] whitespace-pre-wrap break-words rounded-[8px] bg-comeback-gray-50 px-[12px] py-[8px] text-body-sm text-comeback-gray-900",children:(0,a.jsx)(p.o,{remarkPlugins:e,rehypePlugins:n,components:t1.dK,children:i})}),t[10]=i,t[11]=s):s=t[11],t[12]!==A||t[13]!==s?(l=(0,a.jsx)("div",{className:"-ml-[28px] flex w-[calc(100%+28px)] justify-end",children:s},A),t[12]=A,t[13]=s,t[14]=l):l=t[14],l}
911t[15]!==r.args?(e=(0,an.m)(r.args),t[15]=r.args,t[16]=e):e=t[16];let o=e,c=o.status===i.ToolCallTagStatus.RUNNING;if(!b){let e,r=o.status===i.ToolCallTagStatus.RUNNING?i.ToolCallTagStatus.SUCCESS:o.status;t[17]!==o||t[18]!==r?(e={...o,status:r},t[17]=o,t[18]=r,t[19]=e):e=t[19],o=e}let d=c&&b,u=b&&f;return t[20]!==o||t[21]!==j||t[22]!==I||t[23]!==d||t[24]!==u||t[25]!==g?(n=(0,a.jsx)(ae,{data:o,isLoading:d,isLatest:u,isInteractive:j,isLatestMessage:I,threadId:g}),t[20]=o,t[21]=j,t[22]=I,t[23]=d,t[24]=u,t[25]=g,t[26]=n):n=t[26],t[27]!==A||t[28]!==n?(s=(0,a.jsx)("div",{className:"flex flex-row items-stretch justify-start gap-[12px]",children:n},A),t[27]=A,t[28]=n,t[29]=s):s=t[29],s}case i.LLMTag.TOOL_CALL:{let e,n;t[30]!==r.args?(e=(0,r8.UB)(r.args),t[30]=r.args,t[31]=e):e=t[31];let{text:i,hidden:s,status:l}=e;return t[32]!==s||t[33]!==A||t[34]!==l||t[35]!==i?(n=(0,a.jsx)(tX,{className:"w-full max-w-[75%]",text:i,hidden:s,status:l},A),t[32]=s,t[33]=A,t[34]=l,t[35]=i,t[36]=n):n=t[36],n}case i.LLMTag.THINKING:case i.LLMTag.VIEW_TRANSITION:return null;case i.LLMTag.PROJECT_SETTINGS:{let e,n;t[37]!==r.code?(e=(0,r8.JM)(r.code),t[37]=r.code,t[38]=e):e=t[38];let i=e;if(!i)return null;let s=y??null;return t[39]!==f||t[40]!==i||t[41]!==s?(n=(0,a.jsx)(eD,{settings:i,isLatest:f,className:"w-full max-w-[75%]",createdAt:s}),t[39]=f,t[40]=i,t[41]=s,t[42]=n):n=t[42],n}case i.LLMTag.FUNCTION:case i.LLMTag.COMPONENT:case i.LLMTag.PAGE:case i.LLMTag.EXPO_PAGE:case i.LLMTag.FILE:{let e,n,s;t[43]!==r?(e=(0,aa.l)(r),t[43]=r,t[44]=e):e=t[44];let l=e;if(l){let e;return t[45]!==f||t[46]!==A||t[47]!==l?(e=(0,a.jsx)(eS,{projectRevisionId:l,className:"w-full max-w-[75%]",isLatest:f},A),t[45]=f,t[46]=A,t[47]=l,t[48]=e):e=t[48],e}let o=r.args?.name;return t[49]!==r.tag||t[50]!==o?(n="string"==typeof o?o:`New ${(0,d.N)(r.tag)}`,t[49]=r.tag,t[50]=o,t[51]=n):n=t[51],t[52]!==f||t[53]!==n?(s=(0,a.jsx)(eE,{src:null,name:n,status:i.ProjectRevisionStatus.QUEUED,className:"w-full max-w-[75%]",isSelected:!1,isLatest:f,projectExists:!0,moduleType:null}),t[52]=f,t[53]=n,t[54]=s):s=t[54],s}case i.LLMTag.DATABASE:{let e,n,s=r.args?.[i.DatabaseTagArg.DB_ID],l=r.args?.[i.DatabaseTagArg.MIGRATION_ID];return t[55]!==s||t[56]!==l?(e="string"==typeof s?{id:s,migration:"string"==typeof l?{id:l}:null}:null,t[55]=s,t[56]=l,t[57]=e):e=t[57],t[58]!==r.code||t[59]!==b||t[60]!==A||t[61]!==e?(n=(0,a.jsx)(ao,{className:"w-full max-w-[75%]",database:e,isGenerating:b,children:r.code},A),t[58]=r.code,t[59]=b,t[60]=A,t[61]=e,t[62]=n):n=t[62],n}case i.LLMTag.CONTINUE:{let e;return t[63]!==I||t[64]!==A?(e=(0,a.jsx)(tW,{isLatestMessage:I},A),t[63]=I,t[64]=A,t[65]=e):e=t[65],e}case i.LLMTag.CHOICES:{let e,n;t[66]!==r.code?(e=(0,r8.IJ)(r.code),t[66]=r.code,t[67]=e):e=t[67];let i=e;if(!i||0===i.length)return null;let s=!I;return t[68]!==i||t[69]!==A||t[70]!==s?(n=(0,a.jsx)(P,{choices:i,className:"mx-[16px]",isDisabled:s},A),t[68]=i,t[69]=A,t[70]=s,t[71]=n):n=t[71],n}case i.LLMTag.MODULE_SELECTION:{let e,n;t[72]!==r.args?(e=(0,r8.Zv)(r.args),t[72]=r.args,t[73]=e):e=t[73];let i=e;if(!i?.tag)return null;let s=!I;return t[74]!==r.delayMs||t[75]!==A||t[76]!==i.tag||t[77]!==s?(n=(0,a.jsx)(eu.JE,{tag:i.tag,isDisabled:s,delayMs:r.delayMs},A),t[74]=r.delayMs,t[75]=A,t[76]=i.tag,t[77]=s,t[78]=n):n=t[78],n}case i.LLMTag.INTEGRATION_SELECTION:{let e,n,i,s;if(t[79]!==r.args?(e=(0,r8.tI)(r.args),n=e?.autoselect?.toLowerCase(),t[79]=r.args,t[80]=e,t[81]=n):(e=t[80],n=t[81]),"true"===n)return null;if(e?.tag){let n,i=!I;return t[82]!==r.delayMs||t[83]!==A||t[84]!==e.tag||t[85]!==i?(n=(0,a.jsx)(C.HJ,{tag:e.tag,isDisabled:i,delayMs:r.delayMs},A),t[82]=r.delayMs,t[83]=A,t[84]=e.tag,t[85]=i,t[86]=n):n=t[86],n}t[87]!==r.code?(i=(0,r8.uS)(r.code),t[87]=r.code,t[88]=i):i=t[88];let l=i;if(!l||0===l.length)return null;let o=!I;return t[89]!==r.delayMs||t[90]!==l||t[91]!==A||t[92]!==o?(s=(0,a.jsx)(C.I6,{suggestions:l,isDisabled:o,delayMs:r.delayMs},A),t[89]=r.delayMs,t[90]=l,t[91]=A,t[92]=o,t[93]=s):s=t[93],s}case i.LLMTag.DESIGN_SYSTEM_SELECTION:return null;case i.LLMTag.PUBLISH:{let e;return t[94]!==A?(e=(0,a.jsx)(e9,{className:"max-w-[75%]"},A),t[94]=A,t[95]=e):e=t[95],e}case i.LLMTag.ACTION:{let e,n;t[96]!==r.args?(e=(0,r8.p)(r.args),t[96]=r.args,t[97]=e):e=t[97];let i=e;if(!i?.id)return null;let s=!I;return t[98]!==r.delayMs||t[99]!==A||t[100]!==i||t[101]!==s?(n=(0,a.jsx)(N,{result:i,isDisabled:s,delayMs:r.delayMs},A),t[98]=r.delayMs,t[99]=A,t[100]=i,t[101]=s,t[102]=n):n=t[102],n}default:{let e,n,i,s="default"===h&&"bg-comeback-gray-50";return t[103]!==s?(e=(0,o.cn)("my-[12px] overflow-auto whitespace-pre-wrap rounded-[4px] p-[4px]",s),t[103]=s,t[104]=e):e=t[104],t[105]!==r.code?(n=(0,a.jsx)("pre",{children:(0,a.jsx)("code",{children:r.code})}),t[105]=r.code,t[106]=n):n=t[106],t[107]!==A||t[108]!==e||t[109]!==n?(i=(0,a.jsx)("div",{className:e,children:n},A),t[107]=A,t[108]=e,t[109]=n,t[110]=i):i=t[110],i}}case ar.I.CODE:{let e;if(R){let e;return t[111]!==r.code||t[112]!==r.lang||t[113]!==b||t[114]!==A?(e=(0,a.jsx)(as.J,{code:r.code,language:r.lang,isStreaming:b,className:null},A),t[111]=r.code,t[112]=r.lang,t[113]=b,t[114]=A,t[115]=e):e=t[115],e}return t[116]!==r.code||t[117]!==r.lang||t[118]!==b||t[119]!==A?(e=(0,a.jsx)(ad,{code:r.code,isGenerating:b,lang:r.lang},A),t[116]=r.code,t[117]=r.lang,t[118]=b,t[119]=A,t[120]=e):e=t[120],e}case ar.I.EMAIL:{let e,n,i=r.command;return t[121]===Symbol.for("react.memo_cache_sentinel")?(e=(0,o.cn)("tablet:w-fit w-full"),t[121]=e):e=t[121],t[122]!==r.command||t[123]!==r.instructions||t[124]!==A?(n=(0,a.jsx)(ed,{chat:i,className:e,instructions:r.instructions,showOAuthOnTop:!1},A),t[122]=r.command,t[123]=r.instructions,t[124]=A,t[125]=n):n=t[125],n}case ar.I.SIGNUP:{let e,n,i=r.command;return t[126]===Symbol.for("react.memo_cache_sentinel")?(e=(0,o.cn)("tablet:w-fit w-full"),t[126]=e):e=t[126],t[127]!==r.command||t[128]!==r.instructions||t[129]!==A?(n=(0,a.jsx)(ed,{chat:i,className:e,instructions:r.instructions,showOAuthOnTop:!0},A),t[127]=r.command,t[128]=r.instructions,t[129]=A,t[130]=n):n=t[130],n}case ar.I.ANIMATED_TEXT:{let e,n,i,s="default"===h&&"bg-white";return t[131]!==s?(e=(0,o.cn)("w-fit whitespace-pre-wrap text-body-sm",s),t[131]=s,t[132]=e):e=t[132],t[133]!==r.breakOnSpaces||t[134]!==r.delayMs||t[135]!==r.text||t[136]!==r.typingIntervalMs?(n=(0,a.jsx)(k,{delayMs:r.delayMs,typingIntervalMs:r.typingIntervalMs,breakOnSpaces:r.breakOnSpaces,children:r.text}),t[133]=r.breakOnSpaces,t[134]=r.delayMs,t[135]=r.text,t[136]=r.typingIntervalMs,t[137]=n):n=t[137],t[138]!==A||t[139]!==e||t[140]!==n?(i=(0,a.jsx)("div",{className:e,children:n},A),t[138]=A,t[139]=e,t[140]=n,t[141]=i):i=t[141],i}case ar.I.SELECTED_MODULE:{let e;return t[142]!==r.moduleId||t[143]!==A?(e=(0,a.jsx)(eu.Id,{id:r.moduleId},A),t[142]=r.moduleId,t[143]=A,t[144]=e):e=t[144],e}case ar.I.SELECTED_INTEGRATION:{let e;return t[145]!==r.integration||t[146]!==A?(e=(0,a.jsx)(C.k8,{integration:r.integration},A),t[145]=r.integration,t[146]=A,t[147]=e):e=t[147],e}case ar.I.SELECTED_DESIGN_SYSTEM:return null;case ar.I.TOMBSTONE:{let e;return t[148]!==r.code||t[149]!==A?(e=(0,a.jsx)("div",{className:"text-center text-body-sm text-comeback-gray-500",children:r.code},A),t[148]=r.code,t[149]=A,t[150]=e):e=t[150],e}case ar.I.TEXT:{let e,n,i,s,d,u,g;if(!(0,ar.z)(r)||!r.code.trim().length)return null;let f=(S?.length??0)+_;t[151]!==S||t[152]!==_||t[153]!==f?(e=S&&f>=2?(0,a.jsx)(al.Iu,{images:S,pendingCount:_,cancelledCount:0}):null,t[151]=S,t[152]=_,t[153]=f,t[154]=e):e=t[154];let y=e;if(v){let e,n,i,s,c,d,u,p;if(t[155]!==r.code||t[156]!==A||t[157]!==h){let{text:a}=(0,al.dH)(r.code);s=A,c="flex flex-col gap-[12px]";let d="default"===h&&"bg-white";t[163]!==d?(i=(0,o.cn)("flex w-fit flex-col gap-[12px] whitespace-pre-wrap rounded-[4px] text-body-sm [overflow-wrap:anywhere]",d),t[163]=d,t[164]=i):i=t[164],e=l.SC,n=(0,al.ag)((0,t1.h7)((0,t1.OS)(a))),t[155]=r.code,t[156]=A,t[157]=h,t[158]=e,t[159]=n,t[160]=i,t[161]=s,t[162]=c}else e=t[158],n=t[159],i=t[160],s=t[161],c=t[162];return t[165]!==e||t[166]!==b||t[167]!==n?(d=(0,a.jsx)(e,{text:n,typingIntervalMs:null,className:null,markdownComponents:t1.dK,isStreaming:b}),t[165]=e,t[166]=b,t[167]=n,t[168]=d):d=t[168],t[169]!==i||t[170]!==d?(u=(0,a.jsx)("div",{className:i,children:d}),t[169]=i,t[170]=d,t[171]=u):u=t[171],t[172]!==y||t[173]!==s||t[174]!==c||t[175]!==u?(p=(0,a.jsxs)("div",{className:c,children:[u,y]}
911,s),t[172]=y,t[173]=s,t[174]=c,t[175]=u,t[176]=p):p=t[176],p}if(t[177]!==r.code||t[178]!==A||t[179]!==R||t[180]!==h){let{text:e}=(0,al.dH)(r.code),l=(0,c.EO)(e);s=A,d="flex flex-col gap-[12px]";let u="default"===h&&"bg-white";t[185]!==u?(n=(0,o.cn)("flex w-fit flex-col gap-[12px] whitespace-pre-wrap rounded-[4px] text-body-sm [overflow-wrap:anywhere]",u),t[185]=u,t[186]=n):n=t[186],i=R?(0,a.jsx)(ai.c,{isStreaming:!1,className:"flex flex-col gap-[12px]",components:t1.dK,children:(0,al.ag)((0,t1.h7)((0,t1.OS)(l)))}):(0,a.jsx)(p.o,{remarkPlugins:[x.A],rehypePlugins:[m.A],components:t1.dK,children:(0,al.ag)((0,t1.h7)((0,t1.OS)(l)))}),t[177]=r.code,t[178]=A,t[179]=R,t[180]=h,t[181]=n,t[182]=i,t[183]=s,t[184]=d}else n=t[181],i=t[182],s=t[183],d=t[184];return t[187]!==n||t[188]!==i?(u=(0,a.jsx)("div",{className:n,children:i}),t[187]=n,t[188]=i,t[189]=u):u=t[189],t[190]!==y||t[191]!==s||t[192]!==d||t[193]!==u?(g=(0,a.jsxs)("div",{className:d,children:[u,y]},s),t[190]=y,t[191]=s,t[192]=d,t[193]=u,t[194]=g):g=t[194],g}case ar.I.APP_STORE_CONNECT_ACCOUNT:{let e;return t[195]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)(s.tH,{fallbackRender:ay,children:(0,a.jsx)(ab,{})}),t[195]=e):e=t[195],e}case ar.I.REVENUE_CAT_CONNECT_ACCOUNT:{let e;return t[196]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)(s.tH,{fallbackRender:av,children:(0,a.jsx)(af,{})}),t[196]=e):e=t[196],e}case ar.I.ASK_QUESTIONS:{let e,n;t[197]!==r.code?(e=(0,r8.m$)(r.code),t[197]=r.code,t[198]=e):e=t[198];let i=e;if(!i)return null;let s=!I||E;return t[199]!==i||t[200]!==A||t[201]!==T||t[202]!==s?(n=(0,a.jsx)(tT,{data:i,isDisabled:s,revisionAction:T},A),t[199]=i,t[200]=A,t[201]=T,t[202]=s,t[203]=n):n=t[203],n}case ar.I.SATISFACTION_SURVEY:{let e,n;t[204]!==r.code?(e=(0,r8._r)(r.code),t[204]=r.code,t[205]=e):e=t[205];let i=e;if(!i)return null;let s=!I;return t[206]!==A||t[207]!==w||t[208]!==i||t[209]!==s?(n=(0,a.jsx)(tH,{data:i,isDisabled:s,revisionId:w},A),t[206]=A,t[207]=w,t[208]=i,t[209]=s,t[210]=n):n=t[210],n}case ar.I.DATABASE_MIGRATION:{let e,n=r.args?.[i.DatabaseTagArg.MIGRATION_ID],s=r.args?.summary,l="string"==typeof n?n:null,o="string"==typeof s?s:null;return t[211]!==r.code||t[212]!==b||t[213]!==A||t[214]!==l||t[215]!==o?(e=(0,a.jsx)(ac,{migrationId:l,isGenerating:b,summary:o,children:r.code},A),t[211]=r.code,t[212]=b,t[213]=A,t[214]=l,t[215]=o,t[216]=e):e=t[216],e}case ar.I.DESIGN_EXPLORATION:{let e,n;t[217]!==r.code?(e=(0,r8.D_)(r.code),t[217]=r.code,t[218]=e):e=t[218];let i=e;if(!i)return null;let s=!I;return t[219]!==i||t[220]!==A||t[221]!==s?(n=(0,a.jsx)(au,{data:i,isDisabled:s},A),t[219]=i,t[220]=A,t[221]=s,t[222]=n):n=t[222],n}case ar.I.FIGMA_IMPORT:{let e;return t[223]!==r.figmaUrl||t[224]!==r.fileName||t[225]!==A?(e=(0,a.jsx)(am,{figmaUrl:r.figmaUrl,fileName:r.fileName},A),t[223]=r.figmaUrl,t[224]=r.fileName,t[225]=A,t[226]=e):e=t[226],e}case ar.I.MOBBIN_IMPORT:{let e;return t[227]!==r.screens||t[228]!==A?(e=(0,a.jsx)(tS.o,{screens:r.screens,onRemove:null},A),t[227]=r.screens,t[228]=A,t[229]=e):e=t[229],e}case ar.I.PLAN:{let e,n=!I,i=v&&b&&f;return t[230]!==r.code||t[231]!==A||t[232]!==n||t[233]!==i?(e=(0,a.jsx)(tD,{planContent:r.code,isDisabled:n,isStreaming:i},A),t[230]=r.code,t[231]=A,t[232]=n,t[233]=i,t[234]=e):e=t[234],e}case ar.I.DESIGN_VARIATION:{let e,n;t[235]!==r.code?(e=(0,r8.ln)(r.code),t[235]=r.code,t[236]=e):e=t[236];let i=e;if(!i)return null;let s=!I;return t[237]!==i||t[238]!==A||t[239]!==s?(n=(0,a.jsx)(ap,{data:i,isDisabled:s},A),t[237]=i,t[238]=A,t[239]=s,t[240]=n):n=t[240],n}}},af=()=>{let e,t=(0,n.c)(2),r=(0,A.UB)()?"default":"mobile";return t[0]!==r?(e=(0,a.jsx)(ax,{className:"w-full rounded-[8px] border border-comeback-gray-75 p-2",layout:r}),t[0]=r,t[1]=e):e=t[1],e},ab=()=>{let e,t=(0,n.c)(3),{organizationId:r}=(0,eA.MN)(),i=(0,A.UB)()?"default":"mobile";return t[0]!==r||t[1]!==i?(e=(0,a.jsx)(ah,{organizationId:r,projectGroupId:null,className:"w-full rounded-[8px] border border-comeback-gray-75 p-2",layout:i}),t[0]=r,t[1]=i,t[2]=e):e=t[2],e};function ay(){return null}function av(){return null}},952712:(e,t,r)=>{r.d(t,{o:()=>o});var a=r(898936),n=r(434666),i=r(834023),s=r(127167);let l=(0,r(751355).U)(` 912 query GetProjectGroupBuilderLogs( 913 $projectGroupId: ID! 914 $first: Int 915 $after: String 916 ) { 917 projectGroupById(id: $projectGroupId) { 918 id 919 builderLogs(first: $first, after: $after) { 920 edges { 921 node { 922 id 923 level 924 message 925 timestamp 926 source 927 devServerId 928 } 929 } 930 pageInfo { 931 hasNextPage 932 endCursor 933 } 934 } 935 } 936 } 937`),o=()=>{let e=(0,a.nZ)(e=>e.value.shouldAutoClearLogs),t=(0,a.nZ)(e=>e.setShouldAutoClearLogs),r=(0,a.nZ)(e=>e.clearLogs),o=(0,n.m)(),{id:c}=(0,s.MN)(),d=(0,i.useCallback)(()=>{o.writeQuery({query:l,variables:{projectGroupId:c},data:{projectGroupById:{__typename:"ProjectGroup",id:c,builderLogs:{__typename:"UserLogsConnection",edges:[],pageInfo:{__typename:"PageInfo",hasNextPage:!1,endCursor:null}}}}})},[o.writeQuery,c]);return{handleClearLogs:(0,i.useCallback)(()=>{r(),d()}
937,[r,d]),shouldAutoClearLogs:e,setShouldAutoClearLogs:t}}},982027:(e,t,r)=>{r.d(t,{$:()=>_,C:()=>S});var a=r(451286),n=r(480011),i=r(434666),s=r(33031),l=r(98349),o=r(834023),c=r(232726),d=r(387631),u=r(127167),p=r(148999),m=r(84967),x=r(936457),h=r(910189),g=r(709298),f=r(216074),b=r(898936),y=r(768129),v=r(751355),j=r(439502);let I=(0,v.U)(` 938 subscription GetProjectGroupRevisionContentUpdate($id: ID!) { 939 projectGroupRevisionContentUpdate(id: $id) { 940 id 941 response 942 status 943 autoSelectedAction 944 } 945 } 946`),w=(0,v.U)(` 947 query GetProjectGroupRevisionsForChat( 948 $projectGroupId: ID! 949 $threadId: ID 950 $first: Int 951 $after: String 952 ) { 953 projectGroupById(id: $projectGroupId) { 954 id 955 latestRevision: latestRevisionForThread(threadId: $threadId) { 956 id 957 status 958 createdAt 959 thread { 960 id 961 } 962 } 963 revisions( 964 order: [{ createdAt: "DESC" }] 965 first: $first 966 after: $after 967 input: { 968 threadId: $threadId 969 actions: [ 970 CHAT 971 AUTO_SELECT_CHAT 972 DEEP_DEBUGGING 973 EXPERT_SWE 974 DISCUSSION 975 ORCHESTRATOR 976 DELEGATE_TO_SUB_AGENT 977 DESIGN_AGENT 978 INTRODUCE_BUG 979 AGENT_AUTO_SELECT_INTEGRATION 980 FORK_WITH_CHAT_MESSAGE 981 FORK_MODULE_WITH_CHAT_MESSAGE 982 SELECT_INTEGRATION_WITH_CHAT_MESSAGE 983 PUBLISH_PROJECT_AND_CONTINUE_CHAT 984 CHANGE_DESIGN_SYSTEM_AND_CONTINUE_CHAT 985 SAVE_SECRET_AND_CONTINUE_CHAT 986 ADD_AUTH_AND_CONTINUE_CHAT 987 RESTORE 988 PROJECT_FIX_CHANGE 989 PLAN_AGENT 990 ] 991 } 992 ) { 993 totalCount 994 pageInfo { 995 hasNextPage 996 hasPreviousPage 997 endCursor 998 startCursor 999 } 1000 edges { 1001 node { 1002 ...ProjectGroupRevisionForChat 1003 } 1004 } 1005 } 1006 } 1007 } 1008`),N=(0,v.U)(` 1009 subscription ProjectGroupRevisionsCreated($id: ID!) { 1010 projectGroupRevisionsCreated(id: $id) { 1011 id 1012 revisionIds 1013 } 1014 } 1015`),T=(0,v.U)(` 1016 subscription QueuedMessageAccepted($projectGroupId: ID!) { 1017 queuedMessageAccepted(projectGroupId: $projectGroupId) { 1018 messageId 1019 revisionId 1020 threadId 1021 } 1022 } 1023`),E=(0,v.U)(` 1024 query ProjectGroupRevisionForChatById($id: ID!) { 1025 projectGroupRevisionById(id: $id) { 1026 ...ProjectGroupRevisionForChat 1027 } 1028 } 1029`),S=(0,c.v)(e=>({revisionIdsToSubscribe:new Set,removeByRevisionId:({revisionId:t})=>e(e=>{let r=new Set(e.revisionIdsToSubscribe);for(let e of r)e.revisionId===t&&r.delete(e);return{revisionIdsToSubscribe:r}}),addRevisionId:({revisionId:t,threadId:r})=>e(e=>{let a=new Set(e.revisionIdsToSubscribe);return a.add({revisionId:t,threadId:r}),{revisionIdsToSubscribe:a}}),clear:()=>e({revisionIdsToSubscribe:new Set})})),_=()=>{let e=Array.from(S(e=>e.revisionIdsToSubscribe)),[t]=(0,n._)(E),r=(0,i.m)(),{id:c}=(0,u.MN)(),v=(0,p.L)(e=>e.setIsGenerating),_=(0,h.eE)(e=>e.setHasSubmittedChat),k=S(e=>e.removeByRevisionId),C=(0,b.nZ)(e=>e.supportsErrorDetected),R=(0,p.L)(e=>e.removeQueuedMessage),A=(0,p.L)(e=>e.setSubmittingCommand),{generationNotificationsEnabled:G=!1}=(0,j.Wi)();(0,o.useEffect)(()=>{let n=r.cache,i=e.map(({revisionId:e,threadId:t})=>{let a=r.subscribe({query:I,variables:{id:e}}).subscribe({next:e=>{if(!e.data)return;let a=n.readQuery({query:w,variables:{projectGroupId:c,threadId:t}}),i=e.data.projectGroupRevisionContentUpdate;if((e=>{let r=(0,s.isStatusIndicatingRevisionIsBuilding)(e.status);if(v({threadId:t,generating:r}),r){C||(0,f.rc)();return}C?g.A.Success():(0,f.Eh)(),G&&(0,y.HR)(),k({revisionId:e.id}),_({threadId:t,hasSubmittedChat:!1}),A(null)})(i),!a){n.modify({id:n.identify({__typename:"ProjectGroupRevision",id:i.id}),fields:{response:e=>i.response??e,status:()=>i.status,autoSelectedAction:e=>i.autoSelectedAction??e}}),r.query({query:w,variables:{projectGroupId:c,threadId:t,first:d.ft},fetchPolicy:"network-only"}).catch(l.l);return}let o=a.projectGroupById?.revisions.edges.map(e=>
1029e.node.id===i.id?{...e,node:{...e.node,...i,autoSelectedAction:i.autoSelectedAction??e.node.autoSelectedAction,__typename:"ProjectGroupRevision"}}:e)??[],u=a.projectGroupById.latestRevision;n.writeQuery({query:w,data:{projectGroupById:{...a.projectGroupById,latestRevision:i.id===u?.id?{...u,...i,__typename:"ProjectGroupRevision"}:u,revisions:{...a.projectGroupById.revisions,edges:o}}},variables:{projectGroupId:c,threadId:t}})}});return()=>{a.unsubscribe()}});for(let{revisionId:t,threadId:a}of e)r.query({query:E,variables:{id:t},fetchPolicy:"network-only"}).then(e=>{let t=e.data?.projectGroupRevisionById;if(!t)return;let r=(0,s.isStatusIndicatingRevisionIsBuilding)(t.status);v({threadId:a,generating:r}),r||(k({revisionId:t.id}),_({threadId:a,hasSubmittedChat:!1}),A(null))}).catch(l.l);let o=e.length>0?window.setInterval(()=>{for(let{revisionId:e,threadId:t}of Array.from(S.getState().revisionIdsToSubscribe))r.query({query:E,variables:{id:e},fetchPolicy:"network-only"}).then(e=>{let r=e.data?.projectGroupRevisionById;if(!r)return;let a=(0,s.isStatusIndicatingRevisionIsBuilding)(r.status);v({threadId:t,generating:a}),a||(k({revisionId:r.id}),_({threadId:t,hasSubmittedChat:!1}),A(null))}).catch(e=>{a.Cp(e)})},5e3):null,u=r.subscribe({query:N,variables:{id:c}}),p=e.map(({threadId:e})=>{let t=u.subscribe({next:t=>{let a=r.readQuery({query:w,variables:{projectGroupId:c,threadId:e,first:d.ft}});if(!a||!t.data)return;let{projectGroupRevisionsCreated:n}=t.data;if(n.id!==c||0===n.revisionIds.length)return a;0!==n.revisionIds.filter(e=>!a.projectGroupById?.revisions?.edges.some(t=>t.node.id===e)).length&&r.query({query:w,variables:{projectGroupId:c,threadId:e,first:d.ft}})}});return()=>{t.unsubscribe()}}),x=r.subscribe({query:T,variables:{projectGroupId:c}}).subscribe({next:e=>{if(!e.data)return;let{messageId:t,threadId:r}=e.data.queuedMessageAccepted;R({threadId:r??null,messageId:t})}}),h=async()=>{try{let[a,...n]=await Promise.all([r.query({query:w,fetchPolicy:"network-only",variables:{projectGroupId:c,threadId:null,first:d.ft}}),...e.map(e=>t({variables:{id:e.revisionId}}))]);[...n.map(e=>e.data?.projectGroupRevisionById),a.data?.projectGroupById?.latestRevision].forEach(e=>{if(!e)return;let t=(0,s.isStatusIndicatingRevisionIsBuilding)(e.status),r=e.thread?.id??null;v({threadId:r,generating:t}),t||k({revisionId:e.id})})}catch(e){a.Cp(e)}};return m.W.on("reconnected",h),()=>{null!=o&&window.clearInterval(o),m.W.off("reconnected",h),x.unsubscribe(),[...i,...p].forEach(e=>{e()})}},[JSON.stringify(e),c,r,v,t,k,R,A,_,C,G]);let P=S(e=>e.addRevisionId),O=(0,o.useCallback)(async()=>{((await r.query({query:w,fetchPolicy:"network-only",variables:{projectGroupId:c,threadId:null,first:d.ft}})).data?.projectGroupById?.revisions?.edges?.filter(({node:e})=>e&&(e=>{if(!(0,s.isStatusIndicatingRevisionIsBuilding)(e.status))return!1;if(null==e.createdAt)return!0;let t=new Date(e.createdAt).getTime();return!!Number.isNaN(t)||Date.now()-t<126e5})(e)).map(({node:e})=>
1029e).filter(Boolean)??[]).forEach(e=>{let t=e.thread?.id??null;v({threadId:t,generating:!0}),P({revisionId:e.id,threadId:t})})},[r,c,v,P]),U=(0,x.dh)(O,1e3,{leading:!0,trailing:!1});(0,o.useEffect)(()=>{U()?.catch(e=>{a.Cp(e)})},[U])}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.