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