1import{d as de,f as ce,a4 as ue,aQ as fe,c as p,a7 as ve,be as he,ax as Q,Z as _e,r as k,F as U,q as pe,ba as D,aG as V,v as xe,o as i,a as r,b as G,e as n,j as a,t as u,n as Y,Q as E,R as O,l as x,B as be,m as ye,w as ge,bf as me,k as we,a2 as ke,M as Ee,bb as Ce,bc as Me,aw as Se,bg as De}from"./DIRkIRWB.js";import{g as K}from"./DOHqYavS.js";import{_ as Te,a as $e}from"./CZQBe-vj.js";import{u as Ne}from"./DWG8sWje.js";import{_ as je}from"./4fc316aI.js";import{i as Be}from"./Dn9AdfR4.js";import{_ as Ae}from"./DlAUqK2U.js";import"./DkKBxmfE.js";import"./DQa3KIq6.js";import"./DKcOAgYu.js";import"./D6dOeW3N.js";import"./DekfMc5K.js";const C=T=>(Ce("data-v-6bf64a58"),T=T(),Me(),T),Le={ref:"messagesContainer",class:"h-screen overflow-y-auto p-4 md:p-6 max-md:bg-x-grey-2 max-md:pt-[58px]"},He={key:0,class:"absolute inset-0 z-10 flex items-center justify-center bg-white/80 backdrop-blur-sm"},Ue={class:"flex flex-col items-center gap-3"},Ge=C(()=>a("div",{class:"w-8 h-8 border-2 border-x-pink-1 border-t-transparent rounded-full animate-spin"},null,-1)),Oe={class:"text-xs text-x-grey-15"},Ve={key:1,class:"flex flex-col items-center justify-center h-full"},Fe=Ee('<div class="bg-gradient-vertical-light-pink p-4 rounded-xl mb-4" data-v-6bf64a58><div class="w-12 h-12 flex items-center justify-center text-white" data-v-6bf64a58><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-6bf64a58><rect x="3" y="3" width="18" height="18" rx="2" ry="2" data-v-6bf64a58></rect><circle cx="8.5" cy="8.5" r="1.5" data-v-6bf64a58></circle><polyline points="21 15 16 10 5 21" data-v-6bf64a58></polyline></svg></div></div>',1),ze={class:"text-sm text-black font-semibold"},Re={class:"text-xs text-x-grey-15 text-center max-w-60 mt-2"},qe={key:2},We={class:"flex mb-6 relative border-0 sticky top-0 z-10 bg-white max-md:bg-x-grey-2 pb-4 -mt-4 pt-4",style:{"border-bottom":"1px solid #ff5281"}},Pe={key:0,class:"flex flex-col items-center justify-center py-8"},Qe={class:"text-sm text-black font-semibold"},Ye={class:"text-xs text-x-grey-15 text-center max-w-60 mt-2"},Ke={key:1},Ze={class:"grid grid-cols-3 md:grid-cols-4 gap-2"},Je={class:"text-xs col-span-full my-2"},Xe=["onClick"],Ie=["src","alt","onError"],et={key:1,class:"absolute inset-0 bg-gradient-to-br from-pink-400 via-pink-500 to-red-500 flex items-center justify-center"},tt={key:0,class:"bg-black/30 rounded-full p-3"},st=C(()=>a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",viewBox:"0 0 24 24",fill:"white",stroke:"white","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[a("polygon",{points:"5 3 19 12 5 21 5 3"})],-1)),ot=[st],nt={key:2,class:"absolute inset-0 flex items-center justify-center pointer-events-none"},at=C(()=>a("div",{class:"bg-black/50 rounded-full p-3"},[a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",viewBox:"0 0 24 24",fill:"white",stroke:"white","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[a("polygon",{points:"5 3 19 12 5 21 5 3"})])],-1)),it={key:0,class:"absolute bottom-2 right-2 bg-black/70 text-white text-[10px] px-1.5 py-0.5 rounded"},rt={key:3,class:"absolute bottom-2 right-2 bg-black/70 text-white text-[10px] px-1.5 py-0.5 rounded"},lt={key:4,class:"absolute inset-0 bg-black/40 flex flex-col items-center justify-center"},dt=C(()=>a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"white","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"drop-shadow-md"},[a("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})],-1)),ct=["onClick","disabled"],ut={key:0},ft=C(()=>a("span",{class:"inline-block w-2 h-2 border-[1.5px] border-t-transparent border-white rounded-full animate-spin mr-1 align-middle"},null,-1)),vt={key:1},ht={key:0,class:"hidden"},_t=["href","data-fancybox","data-media-id","data-type","data-thumb"],pt={key:1,class:"hidden"},xt=["href","data-fancybox","data-media-id","data-type","data-thumb"],bt=C(()=>a("div",{class:"bg-x-pink-1 rounded-full p-2 flex-shrink-0"},[a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"white","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[a("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})])],-1)),yt={class:"flex-1 overflow-hidden"},gt={class:"text-sm font-medium text-black"},mt={class:"text-xs text-gray-600 truncate"},wt={class:"text-xs text-x-pink-1 mt-1"},kt=de({__name:"media",setup(T){const{t:d}=ce(),Z=ue(),J=fe(),f=p(()=>Number(Z.params.id)),g=ve();he();const{media:F,loading:X,currentMessages:I}=Q(g),ee=_e(),{currentUser:b}=Q(ee),v=k("received"),{initFancybox:te,bindFancybox:m}=Ne(),M=p(()=>`received-gallery-${f.value}`),S=p(()=>`sent-gallery-${f.value}`),$=k(!1),z=k(""),R=k(""),N=k({}),j=k({}),se=e=>{j.value[e]=!0},oe=async e=>{var l;if(!e)return;const t=B.value.find(w=>w.message_id===e);if(!t)return;const o=Se(),{unlockMessage:s}=De(),c=_(t)?"video":"image";o.showPurchaseConfirmationModal({imageUrl:t.blurred_url||y(t),count:1,creditCost:((l=t.message)==null?void 0:l.price)||1,mediaType:c,onConfirm:async()=>{var P;const w=`unlock-message-${e}`;N.value[e]=!0,await s(f.value,e,{loadingKey:w,setIsUnlocking:le=>{N.value[e]=le},onRefresh:()=>
1{g.fetchMedia(f.value)},modalData:{imageUrl:t.blurred_url||y(t),count:1,creditCost:((P=t.message)==null?void 0:P.price)||1,mediaType:c}})}})};U(()=>f.value,async e=>{e&&await g.fetchMedia(e)},{immediate:!0}),U(()=>I.value,(e,t)=>{var o,s,c,h;if(e&&t&&e.length>t.length){const l=e[e.length-1];l&&((o=l.user)==null?void 0:o.id)!==((s=b.value)==null?void 0:s.id)&&(R.value=((c=l.user)==null?void 0:c.display_name)||((h=l.user)==null?void 0:h.username)||d("inbox.someone"),z.value=l.content,$.value=!0,setTimeout(()=>{$.value=!1},5e3))}},{deep:!0});const ne=()=>{$.value=!1,J.push(`/users/account/messages/${f.value}`)},_=e=>e.media_type==="video"||"video_url"in e,B=p(()=>F.value[f.value]||[]);U(()=>v.value,()=>{V(()=>{v.value==="received"?m(`[data-fancybox="${M.value}"]`,{infinite:!0,caption:!1,showClass:"fancybox-fadeIn",hideClass:"fancybox-fadeOut",Html:{video:{autoplay:!1,controls:!0,playsinline:!0,tpl:'<video class="fancybox__html5video" playsinline controls controlsList="nodownload"><source src="{{src}}" type="{{format}}" /></video>'}}}):m(`[data-fancybox="${S.value}"]`,{infinite:!0,caption:!1,showClass:"fancybox-fadeIn",hideClass:"fancybox-fadeOut",Html:{video:{autoplay:!1,controls:!0,playsinline:!0,tpl:'<video class="fancybox__html5video" playsinline controls controlsList="nodownload"><source src="{{src}}" type="{{format}}" /></video>'}}})})}),U(()=>F.value[f.value],()=>{V(()=>{m(`[data-fancybox="${M.value}"]`,{infinite:!0,caption:!1,showClass:"fancybox-fadeIn",hideClass:"fancybox-fadeOut",Html:{video:{autoplay:!1,controls:!0,playsinline:!0,tpl:'<video class="fancybox__html5video" playsinline controls controlsList="nodownload"><source src="{{src}}" type="{{format}}" /></video>'}}}),m(`[data-fancybox="${S.value}"]`,{infinite:!0,caption:!1,showClass:"fancybox-fadeIn",hideClass:"fancybox-fadeOut",Html:{video:{autoplay:!1,controls:!0,playsinline:!0,tpl:'<video class="fancybox__html5video" playsinline controls controlsList="nodownload"><source src="{{src}}" type="{{format}}" /></video>'}}})})},{deep:!0});const A=e=>{const o=e.detail;o&&(o.conversationId,f.value)},ae=e=>{if(e.is_locked)return;const t=v.value==="sent"?S.value:M.value,o=`[data-fancybox="${t}"][data-media-id="${e.id}"]`,s=document.querySelector(o);if(s)s.click();else{const c=document.querySelector(`[data-fancybox="${t}"]`);c&&c.click()}};pe(async()=>{window.addEventListener(D.TEMP_MESSAGE_ADDED,A),window.addEventListener(D.CONTENT_MESSAGE_ADDED,A),await te(),V(()=>{m(`[data-fancybox="${M.value}"]`,{infinite:!0,caption:!1,showClass:"fancybox-fadeIn",hideClass:"fancybox-fadeOut",Html:{video:{autoplay:!1,controls:!0,playsinline:!0,tpl:'<video class="fancybox__html5video" playsinline controls controlsList="nodownload"><source src="{{src}}" type="{{format}}" /></video>'}}}),m(`[data-fancybox="${S.value}"]`,{infinite:!0,caption:!1,showClass:"fancybox-fadeIn",hideClass:"fancybox-fadeOut",Html:{video:{autoplay:!1,controls:!0,playsinline:!0,tpl:'<video class="fancybox__html5video" playsinline controls controlsList="nodownload"><source src="{{src}}" type="{{format}}" /></video>'}}})})}),xe(()=>{window.removeEventListener(D.TEMP_MESSAGE_ADDED,A),window.removeEventListener(D.CONTENT_MESSAGE_ADDED,A),setTimeout(()=>{window.dispatchEvent(new CustomEvent(D.CONTENT_MESSAGE_ADDED,{detail:{conversationId:f.value,messageId:null}}))},50)});const L=p(()=>{if(!b.value)return[];const e=b.value.id;return B.value.filter(t=>{var o;if(t.user_id!==void 0)return t.user_id===e;if(t.message_id){const s=(o=g.messages[f.value])==null?void 0:o.find(c=>c.id===t.message_id);if(s)return s.user.id===e}return!0})}),H=p(()=>{if(!b.value)return[];const e=b.value.id;return B.value.filter(t=>{var o;if(t.user_id!==void 0)return t.user_id!==e;if(t.message_id){const s=(o=g.messages[f.value])==null?void 0:o.find(c=>c.id===t.message_id);if(s)return s.user.id!==e}return!1})}),ie=p(()=>{const e=v.value==="sent"?L.value:H.value;if(!e.length)return[];const t={},o=new Date,s=new Date(o);s.setDate(o.getDate()-o.getDay());const c=new Date(s);return c.setDate(c.getDate()-7),e.forEach(h=>{let l=d("inbox.earlier");const w=h.message_id?new Date(h.created_at||new Date):new Date;w>=s?l=d("inbox.recent"):w>=c&&(l=d("inbox.lastWeek")),t[l]||(t[l]=[]),t[l].push(h)}),Object.entries(t).filter(([h,l])=>l.length>0).map(([h,l])=>({name:h,items:l}))}),y=e=>{if(e.is_locked&&e.blurred_url)return e.blurred_url;if(_(e))return e.thumbnail_url||"";const t=e;return t.small_thumbnail_url?t.small_thumbnail_url:t.thumbnail_url?t.thumbnail_url:t.url?t.url:K(t,"thumbnail",f.value)},q=e=>{if(e.is_locked)return e.blurred_url||y(e);if(_(e))return e.video_url;const t=e;return t.url?t.url:K(t,"original",f.value)},W=p(()=>{const e=g.conversations.find(o=>o.id===f.value);return e?b.value&&e.initiator_user.id===b.value.id?e.recipient_user:e.initiator_user:null}),re=p(()=>{var e;return Be((e=W.value)==null?void 0:e.username)});return(e,t)=>(i(),r(E,null,[G(je,{user:n(W)||{display_name:""},isInternal:n(re),showBackButton:!0,showTabs:!0},null,8,["user","isInternal"]),a("div",Le,[n(X).media?(i(),r("div",He,[a("div",Ue,[Ge,a("p",Oe,u(n(d)("inbox.loadingMedia")),1)])])):n(B).length?(i(),r("div",qe,[a("div",We,[a("button",{onClick:t[0]||(t[0]=o=>v.value="received"),class:Y(["px-4 py-2.5 text-sm font-medium relative focus:outline-none",n(v)==="received"?"text-x-pink-1 font-medium":"text-gray-500"])},u(n(d)("inbox.receivedMedia"))+" ("+u(n(H).length)+") ",3),a("button",{onClick:t[1]||(t[1]=o=>v.value="sent"),class:Y(["px-4 py-2.5 text-sm font-medium relative focus:outline-none",n(v)==="sent"?"text-x-pink-1 font-medium":"text-gray-500"])},u(n(d)("inbox.sentMedia"))+" ("+u(n(L).length)+") ",3)]),n(v)==="sent"&&!n(L).length||n(v)==="received"&&!n(H).length?(i(),r("div",Pe,[a("span",Qe,u(n(v)==="sent"?n(d)("inbox.noSentMedia"):n(d)("inbox.noReceivedMedia")),1),a("span",Ye,u(n(v)==="sent"?n(d)("inbox.mediaYouShareHere"):n(d)("inbox.mediaSharedWithYouHere")),1)])):(i(),r("div",Ke,[a("div",Ze,[(i(!0),r(E,null,O(n(ie),o=>(i(),r(E,{key:o.name},[a("span",Je,u(o.name),1),(i(!0),r(E,null,O(o.items,(s,c)=>{var h;return i(),r("div",{key:s.id,class:"aspect-square rounded-2xl overflow-hidden relative cursor-pointer",onClick:l=>!s.is_locked&&ae(s)},[y(s)&&!n(j)[s.id]?(i(),r("img",{key:0,class:"w-full h-full object-cover",src:y(s),alt:s.original_filename||"Media",onError:()=>se(s.id)},null,40,Ie)):(i(),r("div",et,[_(s)?(i(),r("div",tt,ot)):x("",!0)])),_(s)&&!s.is_locked&&y(s)&&!n(j)[s.id]?(i(),r("div",nt,[at,s.formatted_duration?(i(),r("div",it,u(s.formatted_duration),1)):x("",!0)])):x("",!0),_(s)&&!s.is_locked&&(!y(s)||n(j)[s.id])&&s.formatted_duration?(i(),r("div",rt,u(s.formatted_duration),1)):x("",!0),s.is_locked?(i(),r("div",lt,[dt,a("button",{class:"mt-2 bg-x-pink-1 text-white text-[10px] py-0.5 px-2 rounded-full shadow-md hover:bg-x-pink-1/90 transition-colors mx-2",onClick:be(l=>oe(s.message_id||0),["stop"]),disabled:n(N)[s.message_id||0]},[n(N)[s.message_id||0]?(i(),r("span",ut,[ft,ye(" "+u(n(d)("inbox.unlocking")),1)])):(i(),r("span",vt,u(n(d)("inbox.unlockFor
1Credits",{price:((h=s.message)==null?void 0:h.price)||1})),1))],8,ct)])):x("",!0)],8,Xe)}),128))],64))),128))]),n(v)==="sent"?(i(),r("div",ht,[(i(!0),r(E,null,O(n(L).filter(o=>!o.is_locked),(o,s)=>(i(),r("a",{key:`sent-link-${o.id}`,href:q(o),"data-fancybox":n(S),"data-media-id":o.id,"data-type":_(o)?"html5video":"image","data-thumb":_(o)?o.thumbnail_url:void 0},null,8,_t))),128))])):x("",!0),n(v)==="received"?(i(),r("div",pt,[(i(!0),r(E,null,O(n(H).filter(o=>!o.is_locked),(o,s)=>(i(),r("a",{key:`received-link-${o.id}`,href:q(o),"data-fancybox":n(M),"data-media-id":o.id,"data-type":_(o)?"html5video":"image","data-thumb":_(o)?o.thumbnail_url:void 0},null,8,xt))),128))])):x("",!0)]))])):(i(),r("div",Ve,[Fe,a("span",ze,u(n(d)("inbox.noMedia")),1),a("span",Re,u(n(d)("inbox.mediaSharedHere")),1)])),G(me,{name:"slide-up"},{default:ge(()=>[n($)?(i(),r("div",{key:0,onClick:ne,class:"fixed bottom-20 left-1/2 transform -translate-x-1/2 bg-white rounded-xl shadow-md p-3 cursor-pointer flex items-start gap-3 z-50 border border-x-pink-1/30 max-w-[90%] min-w-[240px] hover:bg-gray-50 transition-colors"},[bt,a("div",yt,[a("div",gt,u(n(d)("inbox.sentNewMessage",{name:n(R)})),1),a("div",mt,u(n(z)),1),a("div",wt,u(n(d)("inbox.clickToView")),1)])])):x("",!0)]),_:1}),(i(),we(ke,{to:"body"},[G(Te),G($e)]))],512)],64))}}),Ht=Ae(kt,[["__scopeId","data-v-6bf64a58"]]);export{Ht as default};
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.