1import we from"./tcBW-cF-.js";import ke from"./C4gM1gge.js";import{d as fe,a7 as Ce,Z as ve,b4 as $e,s as Se,f as pe,r as x,c as D,F as Te,q as be,o as r,k as Y,a as d,j as e,t as l,e as t,l as p,b as m,w as v,m as h,Q as W,R as ee,n as de,K as xe,b5 as he,B as _e,a2 as ge,a8 as y,aR as Ie,ax as Me,aI as Ue,a0 as je,aV as Ve}from"./-6Lls737.js";import{_ as me}from"./DnEzZ4vY.js";import{_ as re}from"./uJCw86W8.js";import{_ as Re}from"./C2j6UuSi.js";import{_ as j}from"./C9IHJtY7.js";import{u as Be,_ as ze}from"./Bf3VUeaX.js";import{useMediaRepository as ye}from"./DPW9WYez.js";import{u as Pe}from"./OYRUoAmG.js";import{i as ae}from"./Dn9AdfR4.js";import"./DSV61gAW.js";import"./DlAUqK2U.js";import"./CiiYzqQD.js";import"./B5spvOTL.js";const Ae={class:"bg-white rounded-2xl w-full max-w-lg mx-4 shadow-xl max-h-[90vh] flex flex-col"},De={key:0,class:"flex flex-col items-center justify-center py-12 px-6"},Le=e("div",{class:"w-20 h-20 rounded-full bg-gradient-to-r from-x-pink to-x-orange flex items-center justify-center mb-6"},[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"white","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round"},[e("polyline",{points:"20 6 9 17 4 12"})])],-1),Ee={class:"text-xl font-semibold text-x-grey-20 mb-2"},Fe={class:"text-sm text-x-grey-15 text-center mb-2"},We={key:0,class:"text-sm text-red-500 text-center mb-6"},Ne={class:"flex items-center justify-between p-4 border-b border-x-grey-1"},Oe={class:"text-lg font-semibold text-x-grey-20"},Ge=["disabled"],He=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1),qe=[He],Ke={class:"px-4 py-3 border-b border-x-grey-1 bg-x-grey-1/50"},Qe={class:"flex items-center gap-2"},Ze={class:"flex -space-x-2"},Je=["src","alt"],Xe={key:0,class:"w-10 h-10 rounded-lg bg-x-grey-4 border-2 border-white flex items-center justify-center text-xs font-medium text-x-grey-15"},Ye={class:"text-sm text-x-grey-15"},et={class:"flex border-b border-x-grey-1"},tt=["onClick"],st={key:0,class:"ml-1 text-xs"},ot={key:1,class:"ml-1 inline-block w-3 h-3 border border-x-pink-1 border-t-transparent rounded-full animate-spin"},lt={key:2,class:"absolute bottom-0 left-0 right-0 h-0.5 bg-x-pink-1"},nt={class:"flex-1 overflow-y-auto min-h-[200px] max-h-[300px]"},it={key:0,class:"flex items-center justify-center py-8"},rt=e("div",{class:"w-6 h-6 border-2 border-x-pink-1 border-t-transparent rounded-full animate-spin"},null,-1),at=[rt],dt={key:1,class:"flex flex-col items-center justify-center py-8 text-center px-4"},ct=e("div",{class:"w-12 h-12 rounded-full bg-red-50 flex items-center justify-center mb-3"},[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"text-red-500"},[e("circle",{cx:"12",cy:"12",r:"10"}),e("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),e("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})])],-1),ut={class:"text-sm text-red-600 mb-2"},xt=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("path",{d:"M21 2v6h-6"}),e("path",{d:"M3 12a9 9 0 0 1 15-6.7L21 8"}),e("path",{d:"M3 22v-6h6"}),e("path",{d:"M21 12a9 9 0 0 1-15 6.7L3 16"})],-1),ht={key:2,class:"flex flex-col items-center justify-center py-8 text-center px-4"},mt=e("div",{class:"w-12 h-12 rounded-full bg-x-grey-2 flex items-center justify-center mb-3"},[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"text-x-grey-15"},[e("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),e("circle",{cx:"9",cy:"7",r:"4"}),e("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),e("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})])],-1),ft={class:"text-sm text-x-grey-15"},vt={key:3},pt={class:"flex items-center justify-between px-4 py-2 bg-x-grey-1/50 border-b border-x-grey-1"},bt={class:"text-xs text-x-grey-15"},_t=["onClick"],gt={key:0,xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"white","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round"},yt=e("polyline",{points:"20 6 9 17 4 12"},null,-1),wt=[yt],kt={class:"relative shrink-0"},Ct={class:"w-10 h-10 rounded-full overflow-hidden bg-x-grey-2"},$t=["src","alt"],St={key:1,class:"flex items-center justify-center w-full h-full text-x-pink-1 text-sm uppercase"},Tt={key:0,class:"absolute bottom-0 right-0 w-3 h-3 bg-x-green-1 border-2 border-white rounded-full"},It={class:"flex-1 min-w-0 text-left"},Mt={class:"block text-sm text-black truncate"},Ut={class:"block text-xs text-x-grey-15 truncate"},jt={class:"p-4 border-t border-x-grey-1 space-y-3"},Vt={class:"flex items-center justify-between"},Rt={class:"text-sm font-medium text-x-grey-20"},Bt={class:"block text-xs text-x-grey-15 mb-1"},zt={class:"block text-xs text-x-grey-15 mb-1"},Pt=["placeholder"],At={class:"flex gap-3 p-4 border-t border-x-grey-1"}
1,Dt=fe({__name:"SendMediaToUsersModal",props:{show:{type:Boolean},mediaIds:{},mediaItems:{}},emits:["close","sent"],setup(ce,{emit:J}){const o=ce,L=J,f=Ce(),G=ve(),H=$e(),{currentUser:N}=Se(G),{sendMediaToUsers:A}=ye(),{getProfileViews:E,getGallerySubscribers:te}=Pe(),{t:i}=pe(),V=x("threads"),_=x(new Set),g=x(0),R=x(""),w=x(!1),q=x(!1),k=x(null),I=x(!1),B=x(!1),F=x(!1),C=x(null),M=x([]),$=x([]),z=D(()=>f.conversations.map(s=>{const n=se(s);return!n||ae(n.username)?null:{id:n.id,username:n.username,display_name:n.display_name||void 0,photo_url:n.photo_url||void 0,source:"thread"}}).filter(s=>s!==null)),O=D(()=>M.value.filter(s=>{var n;return((n=s.user)==null?void 0:n.id)&&!ae(s.user.username)}).map(s=>({id:s.user.id,username:s.user.username,display_name:s.user.display_name,photo_url:s.user.photo_url,source:"viewer"}))),P=D(()=>$.value.filter(s=>{var n;return((n=s.user)==null?void 0:n.id)&&!ae(s.user.username)}).map(s=>({id:s.user.id,username:s.user.username,display_name:s.user.display_name,photo_url:s.user.photo_url,source:"subscriber"}))),S=D(()=>{switch(V.value){case"threads":return z.value;case"viewers":return O.value;case"subscribers":return P.value;default:return[]}}),T=D(()=>_.value.size);function se(s){var n;return N.value?((n=s.initiator_user)==null?void 0:n.id)===N.value.id?s.recipient_user:s.initiator_user:null}function oe(s){return H.isUserOnline(s)}function X(s){return _.value.has(s)}function le(s){const n=new Set(_.value);n.has(s)?n.delete(s):n.add(s),_.value=n}function ne(){const s=new Set(_.value);S.value.forEach(n=>s.add(n.id)),_.value=s}function ie(){_.value=new Set}async function K(){B.value=!0;try{const{data:s,error:n}=await E();if(n){C.value=n;return}M.value=s||[]}catch(s){console.error("Error fetching profile viewers:",s),C.value=i("inbox.failedToLoadProfileViewers")}finally{B.value=!1}}async function Q(){F.value=!0;try{const{data:s,error:n}=await te();if(n){C.value=n;return}$.value=s||[]}catch(s){console.error("Error fetching gallery subscribers:",s),C.value=i("inbox.failedToLoadGallerySubscribers")}finally{F.value=!1}}async function Z(){if(f.conversations.length===0){I.value=!0;try{await f.fetchConversations()}finally{I.value=!1}}}async function c(){C.value=null,await Promise.all([Z(),K(),Q()])}async function u(){if(!(T.value===0||o.mediaIds.length===0)){w.value=!0;try{const s=await A(o.mediaIds,Array.from(_.value),g.value,R.value);s.error?(y.error(s.error.message||i("inbox.failedToSendMedia")),L("sent",{success:0,failed:T.value})):s.response&&(k.value={success:s.response.success,failed:s.response.failed},q.value=!0)}catch(s){console.error("Error sending media to users:",s),y.error(i("inbox.failedToSendMedia")),L("sent",{success:0,failed:T.value})}finally{w.value=!1}}}function U(){const s=k.value||{success:0,failed:0};L("sent",s)}function b(){w.value||L("close")}return Te(()=>o.show,s=>{s&&(_.value=new Set,g.value=0,R.value="",q.value=!1,k.value=null,C.value=null,Z(),K(),Q())}),be(()=>{o.show&&(Z(),K(),Q())}),(s,n)=>(r(),Y(ge,{to:"body"},[s.show?(r(),d("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:_e(b,["self"])},[e("div",Ae,[q.value&&k.value?(r(),d("div",De,[Le,e("h3",Ee,l(t(i)("inbox.mediaSentSuccessfully")),1),e("p",Fe,l(t(i)("inbox.mediaSentToUsers",{count:k.value.success,userText:k.value.success===1?t(i)("inbox.user"):t(i)("inbox.users")})),1),k.value.failed>0?(r(),d("p",We,l(t(i)("inbox.failedToSendToUsers",{count:k.value.failed,userText:k.value.failed===1?t(i)("inbox.user"):t(i)("inbox.users")})),1)):p("",!0),m(t(j),{size:"sm",color:"primary",class:"min-w-[200px] mt-4",onClick:U},{default:v(()=>[h(l(t(i)("inbox.done")),1)]),_:1})])):(r(),d(W,{key:1},[e("div",Ne,[e("h3",Oe,l(t(i)("inbox.sendMediaToUsers")),1),e("button",{onClick:b,disabled:w.value,class:"w-8 h-8 flex items-center justify-center rounded-full hover:bg-x-grey-2 transition-colors"},qe,8,Ge)]),e("div",Ke,[e("div",Qe,[e("div",Ze,[(r(!0),d(W,null,ee(s.mediaItems.slice(0,3),a=>(r(),d("div",{key:a.id,class:"w-10 h-10 rounded-lg overflow-hidden border-2 border-white"},[e("img",{src:a.thumbnail_url||a.url,alt:a.original_filename,class:"w-full h-full object-cover"},null,8,Je)]))),128)),s.mediaItems.length>3?(r(),d("div",Xe," +"+l(s.mediaItems.length-3),1)):p("",!0)]),e("span",Ye,l(s.mediaItems.length)+" "+l(s.mediaItems.length===1?t(i)("inbox.item"):t(i)("inbox.items"))+" "+l(t(i)("inbox.selected")),1)])]),e("div",et,[(r(!0),d(W,null,ee([{value:"threads",label:t(i)("inbox.threads"),count:z.value.length,loading:I.value},{value:"viewers",label:t(i)("inbox.viewersTab"),count:O.value.length,loading:B.value},{value:"subscribers",label:t(i)("inbox.subscribersTab"),count:P.value.length,loading:F.value}],a=>(r(),d("button",{key:a.value,onClick:ue=>V.value=a.value,class:de(["flex-1 py-3 text-sm font-medium transition-colors relative",V.value===a.value?"text-x-pink-1":"text-x-grey-15 hover:text-x-grey-20"])},[h(l(a.label)+" ",1),a.loading?(r(),d("span",ot)):(r(),d("span",st,"("+l(a.count)+")",1)),V.value===a.value?(r(),d("span",lt)):p("",!0)],10,tt))),128))]),e("div",nt,[V.value==="threads"&&I.value||V.value==="viewers"&&B.value||V.value==="subscribers"&&F.value?(r(),d("div",it,at)):C.value?(r(),d("div",dt,[ct,e("span",ut,l(C.value),1),e("button",{onClick:c,class:"text-sm text-x-pink-1 hover:underline flex items-center gap-1"},[xt,h(" "+l(t(i)("inbox.retry")),1)])])):S.value.length===0?(r(),d("div",ht,[mt,e("span",ft,l(t(i)("inbox.noUsersFound")),1)])):(r(),d("div",vt,[e("div",pt,[e("span",bt,l(S.value.length)+" "+l(t(i)("inbox.users")),1),e("button",{onClick:ne,class:"text-xs text-x-pink-1 hover:underline"},l(t(i)("inbox.selectAll")),1)]),(r(!0),d(W,null,ee(S.value,a=>(r(),d("button",{key:a.id,onClick:ue=>le(a.id),class:"w-full flex items-center gap-3 p-3 border-b border-x-grey-1 hover:bg-x-grey-1/50 transition-colors"},[e("div",{class:de(["w-5 h-5 rounded border-2 flex items-center justify-center transition-colors shrink-0",X(a.id)?"bg-x-pink-1 border-x-pink-1":"border-x-grey-4"])},[X(a.id)?(r(),d("svg",gt,wt)):p("",!0)],2),e("div",kt,[e("div",Ct,[a.photo_url?(r(),d("img",{key:0,src:a.photo_url,alt:a.display_name||a.username,class:"w-full h-full object-cover"},null,8,$t)):(r(),d("span",St,l((a.display_name||a.username||"?").substring(0,1)),1))]),oe(a.id)?(r(),d("span",Tt)):p("",!0)]),e("div",It,[e("span",Mt,l(a.display_name||a.username),1),e("span",Ut," @"+l(a.username),1)])],8,_t))),128))]))]),e("div",jt,[e("div",Vt,[e("span",Rt,l(t(i)("inbox.selectedCount",{count:T.value}))+" "+l(T.value===1?t(i)("inbox.user"):t(i)("inbox.users")),1),T.value>0?(r(),d("button",{key:0,onClick:ie,class:"text-xs text-x-grey-15 hover:text-x-pink-1"},l(t(i)("inbox.clearAll")),1)):p("",!0)]),e("div",null,[e("label",Bt,l(t(i)("inbox.priceTokens")),1),xe(e("input",{"onUpdate:modelValue":n[0]||(n[0]=a=>g.value=a),type:"number",min:"0",class:"w-full px-3 py-2 border border-x-grey-4 roun
1ded-lg text-sm focus:outline-none focus:border-x-pink-1",placeholder:"0"},null,512),[[he,g.value,void 0,{number:!0}]])]),e("div",null,[e("label",zt,l(t(i)("inbox.messageOptional")),1),xe(e("textarea",{"onUpdate:modelValue":n[1]||(n[1]=a=>R.value=a),rows:"2",maxlength:"1000",class:"w-full px-3 py-2 border border-x-grey-4 rounded-lg text-sm resize-none focus:outline-none focus:border-x-pink-1",placeholder:t(i)("inbox.addMessagePlaceholder")},null,8,Pt),[[he,R.value]])])]),e("div",At,[m(t(j),{size:"sm",color:"secondary",class:"flex-1",disabled:w.value,onClick:b},{default:v(()=>[h(l(t(i)("home.cancel")),1)]),_:1},8,["disabled"]),m(t(j),{size:"sm",color:"primary",class:"flex-1",disabled:T.value===0||w.value,loading:w.value,onClick:u},{default:v(()=>[h(l(t(i)("inbox.sendToCount",{count:T.value}))+" "+l(T.value===1?t(i)("inbox.user"):t(i)("inbox.users")),1)]),_:1},8,["disabled","loading"])])],64))])])):p("",!0)]))}}),Lt={class:"container-sm md:py-4 max-md:p-0"},Et={class:"flex flex-col items-center justify-center py-16 px-4"},Ft=e("div",{class:"bg-x-grey-1 p-4 rounded-full mb-4"},[e("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",class:"text-x-grey-15"},[e("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),e("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})])],-1),Wt={class:"text-lg font-semibold text-x-grey-20 mb-2"},Nt={class:"text-sm text-x-grey-15 text-center max-w-md"},Ot={key:0,class:"flex flex-col items-end gap-1.5"},Gt={class:"flex items-center gap-2"},Ht={class:"flex items-center gap-1 md:hidden"},qt=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1),Kt={class:"hidden md:inline"},Qt=e("span",{class:"md:hidden"},[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),e("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})])],-1),Zt={class:"hidden md:inline"},Jt=e("span",{class:"md:hidden"},[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("path",{d:"M3 6h18"}),e("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),e("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})])],-1),Xt={class:"hidden md:inline"},Yt={key:0,class:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full bg-red-50 border border-red-200 text-red-600 text-xs font-medium"},es=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("circle",{cx:"12",cy:"12",r:"10"}),e("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),e("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})],-1),ts={class:"container-sm md:py-4 max-md:p-0"},ss={class:"flex flex-col gap-4"},os={class:"flex gap-3"},ls={key:0,class:"flex items-center gap-3 p-3 bg-x-grey-1 rounded-xl"},ns=e("div",{class:"w-5 h-5 border-2 border-x-pink-1 border-t-transparent rounded-full animate-spin"},null,-1),is={class:"flex-1"},rs={class:"flex items-center justify-between mb-1"},as={class:"text-sm text-x-grey-20"},ds={class:"text-sm font-medium text-x-grey-20"},cs={class:"w-full h-1.5 bg-x-grey-4 rounded-full overflow-hidden"},us={class:"flex flex-col gap-4"},xs={class:"flex gap-2"},hs=["onClick"],ms={key:0,class:"p-3 bg-red-50 border border-red-200 rounded-xl"},fs={class:"text-sm text-red-600"},vs={key:1,class:"text-center"},ps={key:0,class:"inline-block w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin mr-2"},bs={key:2,class:"text-center text-xs text-x-grey-15"},_s={class:"space-y-2 text-sm text-x-grey-15"},gs={class:"flex items-start gap-2"},ys=e("span",{class:"w-1.5 h-1.5 mt-1.5 rounded-full bg-x-pink shrink-0"},null,-1),ws={class:"flex items-start gap-2"},ks=e("span",{class:"w-1.5 h-1.5 mt-1.5 rounded-full bg-x-pink shrink-0"},null,-1),Cs={class:"flex items-start gap-2"},$s=e("span",{class:"w-1.5 h-1.5 mt-1.5 rounded-full bg-x-pink shrink-0"},null,-1),Ss={class:"flex items-start gap-2"},Ts=e("span",{class:"w-1.5 h-1.5 mt-1.5 rounded-full bg-x-pink shrink-0"},null,-1),Is={class:"flex items-start gap-2"},Ms=e("span",{class:"w-1.5 h-1.5 mt-1.5 rounded-full bg-x-pink shrink-0"},null,-1),Us={class:"bg-white rounded-2xl p-6 max-w-md mx-4 shadow-xl"},js={class:"text-lg font-semibold text-x-grey-20 mb-2"},Vs={class:"text-sm text-x-grey-15 mb-6"},Rs={class:"flex gap-3"},Qs=fe({__name:"media-repository",setup(ce){const J=ve(),{t:o}=pe();
1Ie({title:o("inbox.myContent")});const L=D(()=>!!J.hasRole(je.ESCORT)),f=Be(),{items:G,selectedIds:H,loading:N,pagination:A,counts:E,hasSelection:te,selectionCount:i,filteredItems:V,error:_,currentFilter:g,canSendSelection:R,hasMixedMediaSelection:w}=Me(f),{uploadImageToRepository:q,uploadVideoToRepository:k}=ye(),I=x(!1),B=x(!1),F=x(null),C=x(null),M=x(!1),$=x(0),z=x(null),O=x(null),P=x({current:0,total:0}),S=x(!1),T=D(()=>o("inbox.mediaCount",{images:E.value.images,videos:E.value.videos})),se=D(()=>(G.value??[]).filter(c=>H.value.has(c.id))),oe=c=>{f.toggleSelection(c)},X=c=>{f.setFilter(c),f.fetchRepository(1,c==="all"?void 0:c)},le=async()=>{I.value=!1;const c=await f.deleteSelectedItems();c.success>0&&y.success(o("inbox.successfullyDeletedItems",{count:c.success})),c.failed>0&&y.error(o("inbox.failedToDeleteItems",{count:c.failed}))},ne=async()=>{if(A.value.currentPage<A.value.lastPage&&!N.value.fetch){S.value=!0;const c=g.value==="all"?void 0:g.value;await f.fetchRepository(A.value.currentPage+1,c),S.value=!1}},ie=async c=>{const u=c.target,U=u.files;if(!U||U.length===0)return;const b=Array.from(U);let s=0,n=0;try{M.value=!0,z.value="image",P.value={current:0,total:b.length};for(let a=0;a<b.length;a++)P.value.current=a+1,$.value=Math.round(a/b.length*100),(await q(b[a])).error?n++:s++;$.value=100,s>0&&(y.success(o("inbox.successfullyUploadedImages",{count:s})),await f.fetchRepository(1,g.value==="all"?void 0:g.value)),n>0&&y.error(o("inbox.failedToUploadImagesCount",{count:n}))}catch{y.error(o("inbox.failedToUploadImages"))}finally{M.value=!1,z.value=null,$.value=0,P.value={current:0,total:0},u.value=""}},K=async c=>{var b;const u=c.target,U=(b=u.files)==null?void 0:b[0];if(U)try{M.value=!0,z.value="video",$.value=0,O.value=new AbortController;const s=await k(U,n=>{$.value=n},O.value.signal);s.error?y.error(s.error.message||o("inbox.failedToUploadVideo")):(y.success(o("inbox.videoUploadedSuccessfully")),await f.fetchRepository(1,g.value==="all"?void 0:g.value))}catch{y.error(o("inbox.failedToUploadVideo"))}finally{M.value=!1,z.value=null,$.value=0,O.value=null,u.value=""}},Q=()=>{if(w.value){y.error(o("inbox.cannotSendMixed"));return}if(!R.value){y.error(o("inbox.onlyOneVideoPerMessage"));return}B.value=!0},Z=c=>{B.value=!1,c.success>0&&f.clearSelection()};return be(async()=>{var c;if(L.value){await f.fetchRepository();const u=(c=J.currentUser)==null?void 0:c.id;u&&f.subscribeToVideoUpdates(u)}}),Ue(()=>{f.unsubscribeFromVideoUpdates()}),(c,u)=>{const U=we,b=ke;return L.value?(r(),Y(t(me),{key:1,title:t(o)("inbox.myContent"),description:T.value},{actions:v(()=>[t(te)?(r(),d("div",Ot,[e("div",Gt,[m(t(j),{size:"sm",color:"secondary",title:t(o)("inbox.clearSelectionCount",{count:t(i)}),onClick:u[0]||(u[0]=s=>t(f).clearSelection())},{default:v(()=>[e("span",Ht,[qt,h(" "+l(t(i)),1)]),e("span",Kt,l(t(o)("inbox.clearCount",{count:t(i)})),1)]),_:1},8,["title"]),m(t(j),{size:"sm",variant:"outline",disabled:!t(R),title:t(R)?t(o)("inbox.sendToUsers"):t(w)?t(o)("inbox.cannotSendMixed"):t(o)("inbox.onlyOneVideoPerMessage"),onClick:Q},{default:v(()=>[Qt,e("span",Zt,l(t(o)("inbox.sendToUsers")),1)]),_:1},8,["disabled","title"]),m(t(j),{size:"sm",color:"primary",title:t(o)("inbox.deleteSelected"),onClick:u[1]||(u[1]=s=>I.value=!0)},{default:v(()=>[Jt,e("span",Xt,l(t(o)("inbox.deleteSelected")),1)]),_:1},8,["title"])]),t(R)?p("",!0):(r(),d("span",Yt,[es,h(" "+l(t(w)?t(o)("inbox.cannotMixMedia"):t(o)("inbox.onlyOneVideo")),1)]))])):p("",!0)]),default:v(()=>[e("input",{ref_key:"imageInputRef",ref:F,type:"file",accept:"image/*",multiple:"",class:"hidden",onChange:ie},null,544),e("input",{ref_key:"videoInputRef",ref:C,type:"file",accept:"video/mp4,video/quicktime,video/x-msvideo,video/webm,.mp4,.mov,.avi,.webm",class:"hidden",onChange:K},null,544),e("div",ts,[m(t(re),{title:t(o)("inbox.uploadMedia"),description:t(o)("inbox.uploadMediaDescription")},{default:v(()=>[e("div",ss,[e("div",os,[m(t(j),{size:"sm",variant:"outline",disabled:M.value,onClick:u[2]||(u[2]=s=>{var n;return(n=F.value)==null?void 0:n.click()})},{default:v(()=>[m(U,{class:"w-4 h-4 mr-2",fontControlled:!1}),h(" "+l(t(o)("inbox.uploadImage")),1)]),_:1},8,["disabled"]),m(t(j),{size:"sm",variant:"outline",disabled:M.value,onClick:u[3]||(u[3]=s=>{var n;return(n=C.value)==null?void 0:n.click()})},{default:v(()=>[m(b,{class:"w-4 h-4 mr-2",fontControlled:!1}),h(" "+l(t(o)("inbox.uploadVideo")),1)]),_:1},8,["disabled"])]),M.value?(r(),d("div",ls,[ns,e("div",is,[e("div",rs,[e("span",as,[z.value==="image"&&P.value.total>1?(r(),d(W,{key:0},[h(l(t(o)("inbox.uploadingImageProgress",{current:P.value.current,total:P.value.total})),1)],64)):(r(),d(W,{key:1},[h(l(t(o)("inbox.uploadingType",{type:z.value})),1)],64))]),e("span",ds,l($.value)+"%",1)]),e("div",cs,[e("div",{class:"h-full bg-gradient-to-r from-x-pink to-x-orange transition-all duration-300",style:Ve({width:`${$.value}%`})},null,4)])])])):p("",!0)])]),_:1},8,["title","description"]),m(t(re),{title:t(o)("inbox.yourMedia"),description:t(o)("inbox.selectItemsDescription"),"full-width":!0,class:"mt-3 md:mt-4"},{default:v(()=>[e("div",us,[e("div",xs,[(r(!0),d(W,null,ee([{value:"all",label:t(o)("inbox.all"),count:t(E).total},{value:"image",label:t(o)("inbox.imagesLabel"),count:t(E).images},{value:"video",label:t(o)("inbox.videosLabel"),count:t(E).videos}],s=>(r(),d("button",{key:s.value,class:de(["px-4 py-2 text-sm font-medium rounded-xl transition-colors",t(g)===s.value?"bg-gradient-to-r from-x-pink to-x-orange text-white":"bg-x-grey-1 text-x-grey-15 hover:bg-x-grey-2"]),onClick:n=>X(s.value)},l(s.label)+" ("+l(s.count)+") ",11,hs))),128))]),t(_)?(r(),d("div",ms,[e("p",fs,l(t(_)),1)])):p("",!0),m(ze,{items:t(V),"selected-ids":t(H),selectable:!0,loading:t(N).fetch&&!S.value,"expanded-grid":!0,onToggleSelection:oe},null,8,["items","selected-ids","loading"]),t(A).currentPage<t(A).lastPage?(r(),d("div",vs,[m(t(Re),{disabled:S.value,onClick:ne},{default:v(()=>[S.value?(r(),d("span",ps)):p("",!0),h(" "+l(S.value?t(o)("inbox.loading"):t(o)("inbox.loadMore")),1)]),_:1},8,["disabled"])])):p("",!0),t(G).length>0?(r(),d("p",bs,l(t(o)("inbox.showingItemsCount",{count:t(G).length,total:t(A).total})),1)):p("",!0)])]),_:1},8,["title","description"]),m(t(re),{title:t(o)("inbox.howItWorks"),description:t(o)("inbox.learnAboutRepository"),class:"mt-3 md:mt-4"},{default:v(()=>[e("ul",_s,[e("li",gs,[ys,h(" "+l(t(o)("inbox.howItWorks1")),1)]),e("li",ws,[ks,h(" "+l(t(o)("inbox.howItWorks2")),1)]),e("li",Cs,[$s,h(" "+l(t(o)("inbox.howItWorks3")),1)]),e("li",Ss,[Ts,h(" "+l(t(o)("inbox.howItWorks4")),1)]),e("li",Is,[Ms,h(" "+l(t(o)("inbox.howItWorks5")),1)])])]),_:1},8,["title","description"])]),(r(),Y(ge,{to:"body"},[I.value?(r(),d("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:u[5]||(u[5]=_e(s=>I.value=!1,["self"]))},[e("div",Us,[e("h3",js,l(t(o)("inbox.deleteItemsConfirm",{count:t(i)})),1),e("p",Vs,l(t(o)("inbox.deleteItemsDescription")),1),e("div",Rs,[m(t(j),{size:"sm",color:"secondary",class:"flex-1",onClick:u[4]||(u[4]=s=>I.value=!1)},{default:v(()=>[h(l(t(o)("inbox.cancel")),1)]),_:1}),m(t(j),{size:"sm",color:"primary",class:"flex-1",loading:t(N).delete,onClick:le},{default:v(()=>[h(l(t(o)("inbox.delete")),1)]),_:1},8,["loading"])])])])):p("",!0)])),m(Dt,{show:B.value,"media-ids":Array.from(t(H)),"media-items":se.value,onClose:u[6]||(u[6]=s=>B.value=!1),onSent:Z},null,8,["show","media-ids","media-items"])]),_:1},8,["title","description"])):(r(),Y(t(me),{key:0,title:t(o)("inbox.myContent")},{default:v(()=>[e("div",Lt,[e("div",Et,[Ft,e("h3",Wt,l(t(o)("inbox.notAvailable")),1),e("p",Nt,l(t(o)("inbox.repositoryNotAvailableDescription")),1)])])]),_:1},8,["title"]))}}});
1export{Qs 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.