PageSourceSearch

https://lidomatrip.com/_next/static/chunks/pages/chats-374a26bed4b8f9e2.js

js lidomatrip.com collected 2026-10-02 20:27:19 UTC 10,049 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7044],{51568:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/chats",function(){return n(70341)}])},70341:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSP:function(){return k},default:function(){return C}});var a=n(85893),s=n(67294),r=n(11163),i=n(85945),l=n(36492),d=n(70530),c=n(91879),o=n(31138),u=n(89987),m=n(47416),x=n(83888),h=n(41664),p=n.n(h),f=n(68220),g=n(63871),y=n(34051),v=n(79121),b=n(25675),j=n.n(b),_=n(56050),N=function(e){let{items:t,selectedId:n,onSelect:s}=e,r=(0,v.A)(),i=e=>{var t;return"SUPPORT"===e.type?null:(0,v.d)(r,null===(t=e.peer)||void 0===t?void 0:t.id)};return 0===t.length?(0,a.jsxs)("div",{className:"flex h-full flex-col items-center justify-center px-24 py-40 text-center",children:[(0,a.jsx)("span",{className:"flex h-64 w-64 items-center justify-center rounded-full bg-gray-F8F8F8",children:(0,a.jsx)("i",{"aria-hidden":"true",className:"icon-message text-28 text-gray-CACFD3"})}),(0,a.jsx)("p",{className:"mt-16 text-14 leading-24 font-m text-black",children:"هنوز چتی ندارید"}),(0,a.jsx)("p",{className:"mt-4 text-12 leading-20 font-r text-gray-77828F",children:"با ثبت اولین رزرو، چت با میزبان همین‌جا باز می‌شود."})]}):(0,a.jsx)("ul",{className:"flex flex-col gap-y-8 py-4",children:t.map((e,t)=>{var r,l,d,c,o,u;let m=e.id===n,x="SUPPORT"===e.type,h=x?e.subject||"پشتیبانی لیدوماتریپ":(null===(r=e.peer)||void 0===r?void 0:r.name)||"کاربر لیدوماتریپ";return(0,a.jsx)("li",{children:(0,a.jsxs)("button",{type:"button",onClick:()=>s(e.id),"aria-current":m?"true":void 0,className:`flex w-full items-start gap-x-12 rounded-16 border-1 border-solid px-14 py-12 text-right transition-[background-color,border-color,transform] duration-150 ease-out active:scale-[0.99] ${m?"border-primary-main bg-primary-light bg-opacity-40":e.unread_count>0?"border-gray-F0F0F0 bg-white shadow-[0_1px_3px_rgba(24,39,58,0.06)]":"border-gray-F0F0F0 bg-white hover:bg-gray-F8F8F8"}`,children:[(0,a.jsxs)("span",{className:"relative shrink-0",children:[(0,a.jsx)("span",{className:"flex h-46 w-46 items-center justify-center overflow-hidden rounded-full bg-gray-F8F8F8 ring-1 ring-white",children:x?(0,a.jsx)("i",{"aria-hidden":"true",className:"icon-OnlineContact text-20 text-primary-dark"}):(null===(l=e.peer)||void 0===l?void 0:l.avatar)||(null===(d=e.residence)||void 0===d?void 0:d.image)||i(e)?(0,a.jsx)(j(),{src:(null===(c=e.peer)||void 0===c?void 0:c.avatar)||(null===(o=e.residence)||void 0===o?void 0:o.image)||(null===(u=i(e))||void 0===u?void 0:u.url),alt:"",width:46,height:46,className:"h-full w-full object-cover"}):(0,a.jsx)("i",{"aria-hidden":"true",className:"icon-Profile text-20 text-gray-A9B1BC"})}),e.unread_count>0&&(0,a.jsx)("span",{"aria-hidden":"true",className:"absolute -left-1 -top-1 h-12 w-12 rounded-full border-2 border-solid border-white bg-primary-main"})]}),(0,a.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("span",{className:"flex items-center justify-between gap-x-8",children:[(0,a.jsx)("span",{className:`truncate text-14 leading-22 ${e.unread_count>0?"font-b text-black":"font-m text-black"}`,children:h}),(0,a.jsx)("span",{className:"shrink-0 text-11 leading-16 font-r text-gray-A9B1BC",children:(0,_.vs)(e.last_message_at)})]}),e.residence&&!x&&(0,a.jsx)("span",{className:"mt-3 block truncate text-11 leading-18 font-r text-gray-A9B1BC",children:e.residence.name}),(0,a.jsxs)("span",{className:"mt-6 flex items-center justify-between gap-x-8",children:[(0,a.jsx)("span",{className:`truncate text-12 leading-20 ${e.unread_count>0?"font-m text-black":"font-r text-gray-77828F"}`,children:e.last_message||"…"}),(0,a.jsxs)("span",{className:"flex shrink-0 items-center gap-x-6",children:[e.is_muted&&(0,a.jsx)("i",{"aria-hidden":"true",title:"بی‌صدا",className:"icon-BellFill text-14 text-gray-CACFD3"}),e.unread_count>0&&(0,a.jsxs)("span",{className:"flex h-20 min-w-[20px] items-center justify-center rounded-full bg-primary-main px-6 text-11 leading-16 font-b text-black",children:[e.unread_count.toLocaleStr
1ing("fa-IR"),(0,a.jsx)("span",{className:"sr-only",children:" پیام خوانده‌نشده"})]})]})]})]})]})},e.id)})})},w=function(){let e=(0,r.useRouter)(),t=(0,i.NL)(),n=(0,c.Gr)(),h=(null==n?void 0:n.id)??0,v=(0,o.a)("(min-width: 1024px)"),[b,j]=(0,s.useState)(!1),_=function(){let[e,t]=(0,s.useState)(null);return(0,s.useEffect)(()=>{let e=window.visualViewport,n=()=>t(Math.round(e?e.height:window.innerHeight));return(n(),e)?(e.addEventListener("resize",n),e.addEventListener("scroll",n),()=>{e.removeEventListener("resize",n),e.removeEventListener("scroll",n)}):(window.addEventListener("resize",n),()=>window.removeEventListener("resize",n))},[]),e}(),[w,F]=(0,s.useState)("all"),[k,C]=(0,s.useState)(null),S="string"==typeof e.query.c?e.query.c:null,E=(0,s.useCallback)(t=>{let n={...e.query};t?n.c=t:delete n.c,e.push({pathname:e.pathname,query:n},void 0,{shallow:!0})},[e]),{data:P,isLoading:I}=(0,l.a)({queryKey:["conversations","all"],queryFn:()=>(0,d.uv)({take:50}),refetchInterval:!!b&&15e3}),B=(0,s.useMemo)(()=>(null==P?void 0:P.items)??[],[P]),L=(0,s.useCallback)(e=>{var n;let a=null===(n=e.data)||void 0===n?void 0:n.conversation_id;if(a){if("message"===e.type){let n=e.data.message;t.setQueryData(["messages",a],e=>{if(!e)return e;let t=e.items.some(e=>e.id===n.id||!!e.client_nonce&&e.client_nonce===n.client_nonce);return t?{...e,items:e.items.map(e=>e.client_nonce&&e.client_nonce===n.client_nonce?n:e)}:{...e,items:[...e.items,n]}}),t.invalidateQueries({queryKey:["conversations"]}),n.sender_id!==h&&t.invalidateQueries({queryKey:["chat-unread"]});return}if("read"===e.type){t.setQueryData(["conversation",a],t=>t&&e.data.reader_id!==h?{...t,peer_last_read_message_id:e.data.last_read_message_id}:t);return}if("typing"===e.type){C({conversationId:a,userId:e.data.user_id});return}"message-deleted"===e.type&&t.setQueryData(["messages",a],t=>t?{...t,items:t.items.map(t=>t.id===e.data.message_id?{...t,deleted:!0,body:""}:t)}:t)}},[h,t]);(0,u.Q)(!!h,L,j),(0,s.useEffect)(()=>{if(!k)return;let e=setTimeout(()=>C(null),4e3);return()=>clearTimeout(e)},[k]);let O=B.filter(e=>"SUPPORT"===e.type),T=B.filter(e=>"SUPPORT"!==e.type),q=O.reduce((e,t)=>e+t.unread_count,0),A=!!S;return(0,a.jsxs)("div",{className:"pb-40 md:pb-0",children:[(v||!A)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(m.Z,{title:"چت",icon:(0,a.jsx)("i",{"aria-hidden":"true",className:"icon-message text-24"}),containerClassname:"mb-16"}),(0,a.jsx)("div",{className:"mb-16 md:mb-24",children:(0,a.jsx)(x.Z,{activeIndex:"support"===w?1:0,onChange:e=>{F(1===e?"support":"all"),E(null)},data:[{tabLabel:T.length?`${(null==n?void 0:n.is_host)?"مهمانان":"همه"} (${(0,f.YS)(T.length)})`:(null==n?void 0:n.is_host)?"مهمانان":"همه",tabIndex:0},{tabLabel:(0,a.jsxs)("span",{className:"flex items-center gap-x-6",children:["پشتیبانی",q>0&&(0,a.jsx)("span",{className:"flex h-18 min-w-[18px] items-center justify-center rounded-full bg-primary-main px-4 text-10 leading-14 font-b text-black",children:(0,f.YS)(q)})]}),tabIndex:1}]})})]}),(0,a.jsxs)("div",{style:A&&!v&&_?{height:_-(_<window.innerHeight-80?0:59)}:void 0,className:`grid grid-cols-1 ${A&&!v?"fixed inset-x-0 top-0 z-6 h-[100dvh]":"h-[calc(100dvh-252px)]"} overflow-hidden bg-white md:static md:z-auto md:h-[calc(100vh-280px)] md:min-h-[420px] md:rounded-24 md:border-1 md:border-solid md:border-gray-F0F0F0 md:shadow-[0_1px_3px_rgba(24,39,58,0.05)] md:grid-cols-[360px_1fr]`,children:[(v||!A)&&(0,a.jsx)("div",{className:"min-h-0 overflow-y-auto md:border-l-1 md:border-solid md:border-gray-F0F0F0",children:I?(0,a.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,a.jsx)(g.O,{})}):(0,a.jsx)(a.Fragment,{children:"support"===w&&0===O.length?(0,a.jsxs)("div",{className:"flex h-full flex-col items-center justify-center px-24 py-40 text-center",children:[(0,a.jsx)("span",{className:"flex h-64 w-64 items-center justify-center rounded-full bg-gray-F8F8F8",children:(0,a.jsx)("i",{"aria-hidden":"true",className:"icon-OnlineContact text-28 text-primary-main"})}),(0,a.jsx)("p",{className:"mt-16 text-14 leading-24 font-m text-black",children:"هنوز گفتگویی با پشتیبانی ندارید"}),(0,a.jsx)("p",{className:"mt-4 text-12 leading-20 font-r text-gray-77828F",children:"اگر سوالی دارید، از همین‌جا شروع کنید."}),(0,a.jsx)(p(),{href:"/support",prefetch:!1,className:"mt-16 inline-flex h-40 items-center rounded-10 bg-primary-main px-16 text-13 leading-20 font-m text-black transition-transform active:scale-[0.97]",children:"چت با پشتیبانی"})]}):(0,a.jsx)(N,{items:"support"===w?O:T,selectedId:S,onSelect:E})})}),A?(0,a.jsx)(y.Z,{conversationId:S,meId:h,isDesktop:v,typingFrom:(null==k?void 0:k.conversationId)===S?k.userId:null,onBack:()=>E(null)},S):v&&(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center bg-gray-F8F8F8 px-24 text-center",children:[(0,a.jsx)("span",{className:"flex h-72 w-72 items-center justify-center rounded-full bg-white shadow-[0_1px_3px_rgba(24,39,58,0.06)]",children:(0,a.jsx)("i",{"aria-hidden":"true",className:"icon-message text-32 text-primary-main"})}),(0,a.jsx)("p",{className:"mt-16 text-15 leading-24 font-b text-black",children:"یک چت را از فهرست انتخاب کنید"}),(0,a.jsx)("p",{className:"mt-4 text-12 leading-20 font-r text-gray-77828F",children:"پیام‌های شما با میزبان‌ها و پشتیبانی همین‌جا جمع می‌شود."})]})]}),b&&(0,a.jsx)("p",{className:"mt-8 text-center text-11 leading-18 font-r text-gray-A9B1BC",children:"اتصال زنده برقرار نشد؛ پیام‌ها هر چند ثانیه به‌روز می‌شوند."})]})};let F=()=>(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(w,{})});var k=!0,C=F}},function(e){e.O(0,[8220,3776,9774,2888,179],function(){return e(e.s=51568)}),_N_E=e.O()}]);

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.