import{F as U,P as a,_ as h,R as m,a1 as e,X as c,T as i,W as f,a0 as u,a2 as v,Y as B,bq as z,e as l,Z as E,a8 as N,Q as D,S as A,D as P,a6 as F,a7 as H}from"./vendor-d3O24IFR.js";import{u as I}from"./usePushMessages-BgHf80IE.js";import{_ as L}from"./push-message.vue_vue_type_script_setup_true_lang-BiIBxJ7F.js";const q={class:"vc-push-messages__head"},Q={class:"vc-push-messages__title"},W={class:"vc-push-messages__items"},X={key:0,class:"vc-push-messages__empty"},Y={class:"vc-push-messages__empty-title"},Z={class:"vc-push-messages__empty-text"},j={class:"vc-push-messages__foot"},G=U({__name:"vc-push-messages",props:{totalCount:{},unreadCount:{},removable:{type:Boolean},canViewAll:{type:Boolean},showUnreadOnly:{type:Boolean},withOptions:{type:Boolean},offsetOptions:{default:12},placement:{default:"bottom-end"}},emits:["markReadAll","markUnreadAll","clearAll","viewAll","update:showUnreadOnly"],setup(o,{emit:d}){const p=z(o,"showUnreadOnly",d);return(s,_)=>{const k=a("VcBadge"),w=a("VcSwitch"),g=a("VcIcon"),n=a("VcButton"),t=a("VcMenuItem"),C=a("VcDropdownMenu"),M=a("VcDialogHeader"),O=a("VcDialogContent"),b=a("VcDialogFooter"),R=a("VcDialog"),S=a("VcPopover");return m(),h(S,{class:"vc-push-messages",placement:o.placement,"offset-options":o.offsetOptions,"arrow-enabled":"","max-height":"none"},{default:e(({triggerProps:$})=>[A(s.$slots,"trigger",{triggerProps:$})]),content:e(({close:$})=>[c(R,{dividers:"",size:"xs"},{default:e(()=>[c(M,{closable:!1},{default:e(()=>[i("div",q,[i("div",Q,[i("span",null,u(s.$t("push_messages.title")),1),o.unreadCount>0?(m(),h(k,{key:0,variant:"outline",size:"sm",rounded:""},{default:e(()=>[v(u(o.unreadCount),1)]),_:1})):f("",!0)]),c(w,{modelValue:l(p),"onUpdate:modelValue":_[0]||(_[0]=r=>B(p)?p.value=r:null),size:"sm"},{default:e(()=>[v(u(s.$t("push_messages.show_unread_only")),1)]),_:1},8,["modelValue"]),c(C,{class:E(["vc-push-messages__options",{"vc-push-messages__options--invisible":!o.withOptions}]),placement:"bottom-end",width:"9rem"},{trigger:e(({triggerProps:r})=>[c(n,N({icon:"",variant:"no-background"},r),{default:e(()=>[c(g,{class:"vc-push-messages__options-icon",name:"dots-vertical",size:"sm"})]),_:1},16)]),content:e(({close:r})=>[c(t,{truncate:"",onClick:T=>{r(),s.$emit("markReadAll")}},{default:e(()=>[i("span",null,u(s.$t("push_messages.options.make_all_as_read")),1)]),_:1},8,["onClick"]),c(t,{truncate:"",onClick:T=>{r(),s.$emit("markUnreadAll")}},{default:e(()=>[i("span",null,u(s.$t("push_messages.options.make_all_as_unread")),1)]),_:1},8,["onClick"])]),_:1},8,["class"])])]),_:1}),c(O,null,{container:e(()=>[i("div",W,[A(s.$slots,"items")]),o.totalCount===0?(m(),D("div",X,[i("div",Y,u(s.$t("push_messages.empty.title")),1),i("div",Z,u(s.$t("push_messages.empty.description")),1)])):f("",!0)]),_:3}),c(b,null,{default:e(()=>[i("div",j,[o.removable&&o.totalCount?(m(),h(n,{key:0,variant:"outline",color:"secondary",class:"vc-push-messages__action-start",onClick:_[1]||(_[1]=r=>s.$emit("clearAll"))},{default:e(()=>[v(u(s.$t("push_messages.clear_all")),1)]),_:1})):f("",!0),o.canViewAll?(m(),h(n,{key:1,variant:"outline",color:"secondary",class:"vc-push-messages__action-end",onClick:r=>{$(),s.$emit("viewAll")}},{default:e(()=>[v(u(s.$t("push_messages.view_all")),1)]),_:1},8,["onClick"])):f("",!0)])]),_:2},1024)]),_:2},1024)]),_:3},8,["placement","offset-options"])}}}),ee=U({__name:"push-messages",props:{offsetOptions:{}},setup(o){const d=P("showUnreadOnly_pushMessages_popup",!1),{totalCount:V,unreadCount:y,items:p,markReadAll:s,markUnreadAll:_,clearAll:k}=I({showUnreadOnly:d});function w(g){const n=document.querySelector(`.vc-push-messages__items .vc-push-message:nth-child(${g+2})`);if(n instanceof HTMLElement){n.focus();return}const t=document.querySelector(".vc-push-messages__foot");t instanceof HTMLElement&&t.focus()}return(g,n)=>(m(),h(G,{ref:"pushMessagesRef","show-unread-only":l(d),"onUpdate:showUnreadOnly":n[0]||(n[0]=t=>B(d)?d.value=t:null),"total-count":l(V),"unread-count":l(y),items:l(p),removable:"","can-view-all":"","with-options":"","offset-options":o.offsetOptions,onMarkReadAll:l(s),onMarkUnreadAll:l(_),onClearAll:l(k),onViewAll:n[1]||(n[1]=t=>g.$router.push({name:"Notifications"}))},{trigger:e(({triggerProps:t})=>[A(g.$slots,"trigger",{totalCount:l(V),unreadCount:l(y),triggerProps:t})]),items:e(()=>[(m(!0),D(F,null,H(l(p),(t,C)=>(m(),h(L,{key:t.id,"push-message":t,onToggleRead:M=>w(C)},null,8,["push-message","onToggleRead"]))),128))]),_:3},8,["show-unread-only","total-count","unread-count","items","offset-options","onMarkReadAll","onMarkUnreadAll","onClearAll"]))}});export{ee as _};
//# sourceMappingURL=push-messages.vue_vue_type_script_setup_true_lang-CrVPf_Il.js.map
