1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4072],{72685:function(e,s,t){var a=t(85893),r=t(9191);s.Z=e=>(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",...e,children:[(0,a.jsx)("circle",{className:"opacity-25",cx:12,cy:12,r:10,stroke:r.Z["bushride-primary-300"],strokeWidth:4}),(0,a.jsx)("path",{className:"opacity-75",fill:r.Z["bushride-primary-500"],d:"M4 12a8 8 0 0 1 8-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 0 1 4 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})},49563:function(e,s,t){t.d(s,{Z:function(){return A}});var a=t(85893),r=t(11163),i=t(41664),n=t.n(i),l=t(25675),d=t.n(l),o=t(30749),c=t(94027),u=t(67294),m=t(9589),h=t(88385),x=t(44942),p=t(30120),g=t(47235),y=t(54763),v=t(77426),b=t(44706),f=t(32017),j=t(61076);function w(e){let{id:s,userId:t,content:r,createdAt:i,currentUserId:n}=e,[l,d]=(0,u.useState)(null);return(0,u.useEffect)(()=>{d(p.ou.fromISO(i).setZone("system"))},[]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:(0,j.Z)("flex flex-row",n==t?"justify-end":"justify-start"),children:(0,a.jsx)("div",{className:(0,j.Z)("flex flex-col text-xs order-2",n==t?"pl-8 sm:pl-16":"pr-8 sm:pr-16"),children:(0,a.jsx)("span",{className:(0,j.Z)("whitespace-pre-wrap px-4 py-2 rounded-lg inline-block",n==t?"rounded-br-none bg-bushride-primary-500 text-white":"rounded-bl-none bg-gray-300 text-gray-600"),children:r})})}),(0,a.jsx)("div",{className:(0,j.Z)("mt-[0.1rem] px-2 flex flex-row",n==t?"justify-end":"justify-start"),children:(0,a.jsx)("h1",{className:"text-xs text-gray-400 font-medium",children:null!=l?n==t?"Delivered - ".concat(l.toLocaleString(p.ou.TIME_24_SIMPLE)):l.toLocaleString(p.ou.TIME_24_SIMPLE):"..."})})]})}var N=t(97650),S=t(72685),C=t(29816),I=t(57098),R=t(64015);function A(){let e=(0,r.useRouter)(),{user:s,setUser:t}=(0,u.useContext)(m.S),{rooms:i,setRooms:l}=(0,u.useContext)(h.a),{roomsIsArchived:A,setRoomsIsArchived:E}=(0,u.useContext)(x.w),[F,_]=(0,u.useState)(null),[T,Z]=(0,u.useState)([]),[O,k]=(0,u.useState)([]),[M,U]=(0,u.useState)(""),[D,B]=(0,u.useState)(!1),[q,P]=(0,u.useState)(!1),[L,z]=(0,u.useState)(!1),[H,Y]=(0,u.useState)(null),[G,K]=(0,u.useState)(null),[W,X]=(0,u.useState)(null),[$,V]=(0,u.useState)(null),[J,Q]=(0,u.useState)(!1),[ee,es]=(0,u.useState)(!1),et=()=>!0;function ea(){0!=Object.keys(i).length&&l({}),0!=Object.keys(A).length&&E({})}function er(){et()&&window.scrollTo({top:document.body.scrollHeight,behavior:"smooth"})}async function ei(){!0!=L&&en()}async function en(){let e;if(null==H)return;if(P(!0),null==F){P(!1);return}let s={roomId:F.roomid,sortDirection:"DESC",limit:20,filter:{isDeleted:{eq:!1}},nextToken:H};try{e=await v.b.graphql({variables:s,query:g.ci,authMode:"AMAZON_COGNITO_USER_POOLS"}),Z([...e.data.messagesByRoomIdSortCreatedAt.items.reverse(),...T]),null==e.data.messagesByRoomIdSortCreatedAt.nextToken?(z(!0),Y(null)):Y(e.data.messagesByRoomIdSortCreatedAt.nextToken),P(!1)}catch(e){P(!1),console.error(e)}}async function el(){""!=M&&null!=F.roomid&&await ed()}async function ed(){let s,t,a;B(!0);try{t=await y.g.currentAuthenticatedUser({bypassCache:!1})}catch(s){console.error(s),e.push({pathname:"/login",query:{redirect:e.asPath}});return}s=t.signInUserSession.idToken.jwtToken;let r={content:M,roomId:F.roomid};try{a=await v.b.post("messageapi","/create",{headers:{Authorization:s},body:r}),"CREATE_MESSAGE"==a.success.code&&U(""),B(!1)}catch(e){console.error(e),B(!1)}}return(0,u.useEffect)(()=>{if(!e.isReady)return;let s=e.query;_(s),null!=s.roomid?(async()=>{let t,a,r,i;try{t=await y.g.currentAuthenticatedUser({bypassCache:!1})}catch(s){console.error(s),e.push({pathname:"/login",query:{redirect:e.asPath}});return}let n=s.roomid.split("#");K((a=await v.b.graphql({variables:{id:n[0]},query:g.U8,authMode:"API_KEY"})).data.getRide),V(p.ou.fromISO(a.data.getRide.departureDateTime).setZone(a.data.getRide.departureTimezone));let l=t.signInUserSession.idToken.payload.sub;var d=n.indexOf(l);n.splice(d,1);let o=n[1],c=(r=await v.b.graphql({variables:{id:o},query:g.PR,authMode:"API_KEY"})).data.getUser.reviewsReceivedOneStarCount+r.data.getUser.reviewsReceivedTwoStarCount+r.data.getUser.reviewsReceivedThreeStarCount+r.data.getUser.reviewsReceivedFourStarCount+r.data.getUser.reviewsReceivedFiveStarCount,u=null;0!=c&&(u=r.data.getUser.reviewsReceivedOneStarCount/c*1+r.data.getUser.reviewsReceivedTwoStarCount/c*2+r.data.getUser.reviewsReceivedThreeStarCount/c*3+r.data.getUser.reviewsReceivedFourStarCount/c*4+r.data.getUser.reviewsReceivedFiveStarCount/c*5),X({...r.data.getUser,totalReviews:c,averageRating:u});let m={roomId:s.roomid,sortDirection:"DESC",limit:20,filter:null};Z((i=await v.b.graphql({variables:m,query:g.ci,authMode:"AMAZON_COGNITO_USER_POOLS"})).data.messagesByRoomIdSortCreatedAt.items.reverse()),null==i.data.messagesByRoomIdSortCreatedAt.nextToken?(z(!0),Y(null)):Y(i.data.messagesByRoomIdSortCreatedAt.nextToken),es(!0)})():null!=s.ride_id&&(async()=>{let t,a,r,i;try{t=await y.g.currentAuthenticatedUser({bypassCache:!1})}catch(s){console.error(s),e.replace({pathname:"/login",query:{redirect:e.asPath}});return}let n=[t.signInUserSession.idToken.payload.sub,s.user_id].sort();a=t.signInUserSession.idToken.jwtToken;let l={rideId:s.ride_id,recipientId:s.user_id};try{if(r=await v.b.post("messageapi","/roomcheck",{headers:{Authorization:a},body:l}),"ROOM_ALREADY_EXIST"==r.success.code){e.replace({pathname:"/messages/".concat(s.ride_id,"#").concat(n[0],"#").concat(n[1])});return}}catch(e){console.error(e)}
1if(null==s.ride_id||null==s.user_id)return;let d={rideId:s.ride_id,userId:s.user_id};try{if(i=await v.b.post("messageapi","/initiate",{headers:{Authorization:a},body:d}),"CREATE_ROOM_SUCCESS"==i.success.code||"TRANSACTION_FAILED_ROOM_ALREADY_EXIST"==i.success.code){let a=[t.signInUserSession.idToken.payload.sub,s.user_id].sort();e.replace({pathname:"/messages/".concat(s.ride_id,"#").concat(a[0],"#").concat(a[1])})}else i.success.code}catch(e){console.error(e)}})();let t={roomId:s.roomid};if(null!=s.roomid){let e=v.b.graphql({variables:t,query:"\n subscription OnCreateMessageByRoomId($roomId: ID!) {\n onCreateMessageByRoomId(roomId: $roomId) {\n id\n userId\n content\n isDeleted\n createdAt\n }\n }\n",authMode:"AMAZON_COGNITO_USER_POOLS"}).subscribe({next:e=>{k([e.value.data.onCreateMessageByRoomId])},error:e=>console.error(e)});return()=>{e.unsubscribe()}}},[e.isReady]),(0,u.useEffect)(()=>{if(0!=O.length){if(T.filter(e=>e.id==O[0].id).length>0){ea();return}Z([...T,...O]),Q(!0),ea()}},[O]),(0,u.useEffect)(()=>{!0==ee&&(er(),es(!ee)),!0==J&&(er(),Q(!J))},[T]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:(0,j.Z)("bg-slate-100 pt-2 md:pt-4",null!=G?"":"pointer-events-none"),children:(0,a.jsx)(n(),{href:null!=G?"/ride/".concat(G.id):"",children:(0,a.jsxs)("div",{className:"group relative py-2 pl-3 rounded-xl hover:bg-white",children:[null!=$?(0,a.jsx)("h1",{className:"text-xl font-bold text-gray-900 group-hover:text-gray-600",children:$.toFormat("EEE d MMM, HH:mm")}):(0,a.jsx)("div",{className:"h-2.5 mt-2.5 bg-slate-200 w-40 md:w-48 rounded-full animate-wave"}),null!=G?(0,a.jsx)("h1",{className:"text-sm text-gray-400 pr-8",children:"".concat(G.departurePlaceText," â ").concat(G.arrivalPlaceText)}):(0,a.jsx)("div",{className:"h-2.5 mt-2.5 mb-1.5 bg-slate-200 w-24 md:w-28 rounded-full animate-wave"}),(0,a.jsx)("div",{className:"absolute flex justify-center h-full top-0 right-1.5",children:(0,a.jsx)("div",{className:"flex justify-center items-center",children:null!=G?(0,a.jsx)(o.Z,{className:"h-5 w-5 text-gray-400 group-hover:text-gray-200"}):""})})]})})}),(0,a.jsx)("div",{className:(0,j.Z)("relative bg-slate-100",null!=W?"":"pointer-events-none"),children:(0,a.jsxs)(n(),{href:null!=W?"/user/".concat(W.id):"",children:[(0,a.jsx)("div",{className:"group relative py-2 pl-3 rounded-xl hover:bg-white",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("div",{className:"flex-shrink h-10 w-10",children:(0,a.jsxs)("span",{className:"relative inline-block",children:[null!=W?null!=W.picture&&""!=W.picture?(0,a.jsx)(d(),{className:"h-10 w-10 rounded-full",src:W.picture,alt:"Recipient profile picture",width:40,height:40}):(0,a.jsx)(R.Z,{className:"h-10 w-10 text-gray-300 rounded-full"}):(0,a.jsx)(R.Z,{className:"h-10 w-10 text-slate-200 rounded-full animate-wave animation-delay-[200ms]"}),null!=W&&W.verifiedProfile?(0,a.jsx)(I.Z,{className:"absolute -bottom-1 -right-1 block h-5 w-5 rounded-full fill-bushride-secondary-700 bg-slate-100"}):""]})}),(0,a.jsxs)("div",{className:"ml-2.5 flex flex-col",children:[null!=W?(0,a.jsx)("h3",{className:"text-lg font-medium leading-none text-gray-900 capitalize",children:null!=W.givenName?W.givenName.toLowerCase():""}):(0,a.jsx)("div",{className:"h-2.5 bg-slate-200 w-28 md:w-32 rounded-full animate-wave animation-delay-[200ms]"}),null!=W&&0!=W.totalReviews?(0,a.jsxs)("div",{className:"flex items-center pt-1 ml-0.5",children:[(0,a.jsx)(C.Z,{className:"h-4 w-4 -ml-1 text-gray-400","aria-hidden":"true"}),(0,a.jsxs)("h3",{className:"pl-0.5 text-xs font-medium leading-none text-gray-400",children:[W.averageRating.toFixed(1)," (",W.totalReviews," ",1==W.totalReviews?"rating":"ratings",")"]})]}):""]})]})}),(0,a.jsx)("div",{className:"absolute flex justify-center h-full top-0 right-1.5",children:(0,a.jsx)("div",{className:"flex justify-center items-center",children:null!=W?(0,a.jsx)(o.Z,{className:"h-5 w-5 text-gray-400 group-hover:text-gray-700"}):""})})]})}),(0,a.jsx)("div",{className:"bg-slate-100 pt-1 px-3",children:null!=F&&null!=F.roomid?(0,a.jsxs)("h3",{className:"text-xs text-gray-400",children:["We may moderate messages. Please report anything inappropriate\xa0",(0,a.jsx)(n(),{href:{pathname:null!=F?"/report/category/".concat(F.roomid):"",query:{report_object:"Chat",return_url:e.asPath}},className:"font-semibold text-xs text-bushride-primary-500 hover:text-bushride-primary-700 focus:outline-none focus:underline transition ease-in-out duration-150",children:"here"}),"."]}):(0,a.jsx)("div",{className:"h-2.5 bg-slate-200 w-28 md:w-32 rounded-full animate-wave animation-delay-[400ms]"})}),(0,a.jsxs)("div",{className:"relative pb-4 md:pb-6 flex flex-col justify-end min-h-[calc(100vh-356px)] sm:min-h-[calc(100vh-348px)] md:min-
1h-[calc(100vh-336px)]",children:[(0,a.jsxs)("div",{className:"space-y-4 pb-4",children:[(0,a.jsx)(N.df,{as:"div",onChange:(e,s)=>{!0==e&&ei()}}),!0==q?(0,a.jsx)("div",{className:"flex items-center justify-center",children:(0,a.jsx)(S.Z,{className:"mt-6 animate-spin h-12 w-12","aria-hidden":"true"})}):"",L?(0,a.jsx)("div",{className:"pb-4 flex flex-col justify-center items-center",children:(0,a.jsx)(n(),{href:"/messages",passHref:!0,className:"px-1 mt-2 text-xs font-medium text-bushride-primary-500 hover:text-bushride-primary-700 text-center",children:(0,a.jsxs)("div",{className:"flex flex-row",children:[(0,a.jsx)(c.Z,{className:"h-3 w-3 mt-0.5 mr-1"}),(0,a.jsx)("span",{children:"My messages"})]})})}):"",null!=T&&null!=s?T.map(e=>(0,a.jsx)("div",{children:(0,a.jsx)(w,{id:e.id,userId:e.userId,content:e.content,createdAt:e.createdAt,currentUserId:s.signInUserSession.idToken.payload.sub})},e.id)):""]}),(0,a.jsxs)("div",{className:"relative flex flex-row",children:[null!=F&&null!=F.roomid?(0,a.jsx)(f.Z,{minRows:1,maxRows:6,className:"block pr-8 w-full resize-none rounded-md border-gray-300 shadow-sm focus:border-bushride-primary-500 focus:ring-bushride-primary-500 text-base sm:text-sm disabled:bg-slate-100 placeholder-gray-400",placeholder:"Your message",value:M,maxLength:1e3,disabled:D,onChange:e=>U(e.target.value)}):(0,a.jsxs)("div",{className:"flex flex-col w-full",children:[(0,a.jsx)("div",{className:"mb-2 h-2.5 bg-slate-200 w-full rounded-full animate-wave animation-delay-[800ms]"}),(0,a.jsx)("div",{className:"mb-2 h-2.5 bg-slate-200 w-1/2 rounded-full animate-wave animation-delay-[800ms]"})]}),""!=M?(0,a.jsx)("button",{onClick:()=>el(),disabled:D,className:"absolute -bottom-[3px] md:bottom-[0px] right-0.5 px-2.5 py-[0.591rem]",children:D?(0,a.jsx)(S.Z,{className:"pointer-events-none animate-spin h-5 w-5","aria-hidden":"true"}):(0,a.jsx)(b.Z,{className:"h-5 w-5 text-bushride-primary-500"})}):""]})]})]})}},34820:function(e,s,t){t.d(s,{Z:function(){return d}});var a=t(85893),r=t(9008),i=t.n(r),n=t(75063),l=t(82210);function d(e){let{children:s}=e;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(i(),{children:[(0,a.jsx)("meta",{property:"og:image",content:"https://".concat("ea.cdn.bushride.com","/bushride-og.png")}),(0,a.jsx)("meta",{name:"apple-itunes-app",content:"app-id=6459408637"})]}),(0,a.jsx)(n.Z,{isFocusMode:!1}),(0,a.jsx)("main",{children:s}),(0,a.jsx)(l.Z,{isFocusMode:!1})]})}},98789:function(e,s,t){t.d(s,{Z:function(){return i}});var a=t(85893),r=t(61076);function i(e){let{maxWidthSize:s,children:t}=e;return(0,a.jsx)("div",{className:"bg-slate-100 min-h-[calc(100vh-192px)] sm:min-h-[calc(100vh-200px)] md:min-h-[calc(100vh-11rem-4px)]",children:(0,a.jsx)("div",{className:(0,r.Z)(s,"mx-auto px-4 sm:px-6 lg:px-8"),children:t})})}},9191:function(e,s){s.Z={"bushride-primary-negative-200":"#F2FAF6","bushride-primary-negative-100":"#D4F0E0","bushride-primary-negative-50":"#C5EAD4","bushride-primary-0":"#B6E5C9","bushride-primary-50":"#A7E0BE","bushride-primary-100":"#98DBB3","bushride-primary-200":"#7AD09D","bushride-primary-300":"#5BC587","bushride-primary-400":"#41B772","bushride-primary-500":"#36995F","bushride-primary-600":"#2A774A","bushride-primary-700":"#1E5535","bushride-primary-800":"#123320","bushride-primary-900":"#06110B","bushride-secondary-50":"#FFF3F5","bushride-secondary-100":"#FFEBEF","bushride-secondary-200":"#FFDCE2","bushride-secondary-300":"#FFCDD6","bushride-secondary-400":"#FFBDC9","bushride-secondary-500":"#FFAEBD","bushride-secondary-600":"#FF95A8","bushride-secondary-700":"#FF7B93","bushride-secondary-800":"#FF627F","bushride-secondary-900":"#FF486A"}}}]);
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.