(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6737],{20234:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/share/e/[[...shareParams]]",function(){return t(57610)}])},57610:function(e,n,t){"use strict";t.r(n),t.d(n,{__N_SSP:function(){return E},default:function(){return N}});var r=t(21722),a=t(39324),i=t(71209),s=t(22830),o=t(38104),u=t(35250),c=t(59119),l=t(6780),d=t(1821),h=t(88798),f=t(95137),v=t(37469),_=t(32542),p=t(5268),g=t(13995);t(68993);var y=t(44675),w="".concat(y.env.INTERNAL_API_URL,"/api");function b(){return(b=(0,r._)(function(e){var n,t,r,a,i,s,u,c,l,d;return(0,o.Jh)(this,function(o){switch(o.label){case 0:n=e.ids,t=[],r=!0,a=!1,i=void 0;try{for(s=n[Symbol.iterator]();!(r=(u=s.next()).done);r=!0)c=u.value,t.push(["ids",c])}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}return l=new URLSearchParams(t),[4,fetch("".concat(w,"/public/plugins/by-id?").concat(l),{method:"GET",headers:{"Content-Type":"application/json"}})];case 1:if(200===(d=o.sent()).status)return[2,d.json()];throw Error("Failed to get plugins by id: "+d.status)}})})).apply(this,arguments)}var m=t(70079),T=t(70671),P=t(94968),E=!0;function N(e){var n=e.sharedConversationId,t=(0,p.a)(["shared-conversation/".concat(n)],function(){return f.ZP.getAuthedSharedConversation(n)}),y=t.data,w=t.isError,P=(0,s._)((0,m.useState)(function(){return(0,v.OX)()}),1)[0],E=(0,s._)((0,m.useState)(!1),2),N=E[0],S=E[1],x=(0,g.NL)(),j=(0,T.Z)();return(0,m.useEffect)(function(){w&&(h.m.danger(j.formatMessage(C.unableToFindConversation),{duration:5}),window.location.href="/")},[w,j]),(0,m.useEffect)(function(){function e(){return(e=(0,r._)(function(){var e,t,r;return(0,o.Jh)(this,function(a){switch(a.label){case 0:if(!(y&&P))return[3,3];if(!((t=null!==(e=y.plugin_ids)&&void 0!==e?e:[]).length>0))return[3,2];return[4,function(e){return b.apply(this,arguments)}({ids:t})];case 1:r=a.sent(),x.setQueryData(r.items.map(function(e){return e.id}),r),a.label=2;case 2:v.tQ.initThreadFromServerData(P,y,!0,n),S(!0),a.label=3;case 3:return[2]}})})).apply(this,arguments)}!function(){e.apply(this,arguments)}()},[y,n,P,x]),N?e.continueMode?(0,u.jsx)(c.ZP,(0,i._)((0,a._)({},e.chatPageProps),{clientThreadId:P})):(0,u.jsx)(_.gB.Provider,{value:{serverSharedThreadId:n},children:(0,u.jsx)(l.Z,{clientThreadId:P,setClientThreadId:function(){},initiallyHighlightedMessageId:null==y?void 0:y.highlighted_message_id,continueConversationUrl:null==y?void 0:y.continue_conversation_url})}):(0,u.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,u.jsx)(d.Z,{className:"text-gray-400 dark:text-gray-500"})})}var C=(0,P.vU)({unableToFindConversation:{id:"workspaceSharePage.unableToFindConversation",defaultMessage:"Unable to find shared conversation",description:"Toast message for error when loading shared conversaion"}})}},function(e){e.O(0,[6786,3656,5960,2104,1438,7985,4137,9441,8937,2357,4099,722,2766,9119,9774,2888,179],function(){return e(e.s=20234)}),_N_E=e.O()}]);