"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("../../common/utils/index.cjs"),p=require("@dialpad/dialtone-icons/vue3"),h=require("../../localization/index.cjs"),e=require("vue"),m=require("../../_plugin-vue_export-helper-BRilXfQE.cjs"),f=require("../button/button.cjs"),w=require("../badge/badge.cjs"),C=require("../emoji-text-wrapper/emoji-text-wrapper.cjs"),v={compatConfig:{MODE:3},name:"DtRecipeContactCentersRow",components:{DtButton:f.default,DtBadge:w.default,DtEmojiTextWrapper:C.default,DtIconHeadphones:p.DtIconHeadphones,DtIconChevronDown:p.DtIconChevronDown},inheritAttrs:!1,props:{ariaLabel:{type:String,default:""},description:{type:String,required:!0},selected:{type:Boolean,default:!1},hideActions:{type:Boolean,default:!1},unreadCount:{type:String,default:null,validator(t){return t?/^\d+\+?$/.test(t):!0}}},emits:["click","click-menu"],data(){return{labelWidth:"auto",i18n:new h.DialtoneLocalization}},computed:{leftbarContactCentersRowClasses(){return["d-recipe-leftbar-row","d-recipe-leftbar-row--contact-centers",{"d-recipe-leftbar-row__unread-count":this.showUnreadCount,"d-recipe-leftbar-row--selected":this.selected}]},getAriaLabel(){const t=isNaN(this.unreadCount)?this.unreadCount:Number(this.unreadCount);return this.ariaLabel?this.ariaLabel:a.safeConcatStrings([this.description,this.i18n.$t("DIALTONE_UNREAD_MESSAGE_COUNT_TEXT",{unreadCount:t})])},contactRowListeners(){return a.extractVueListeners(this.$attrs)},showUnreadCount(){return!!this.unreadCount},menuButtonLabel(){return this.i18n.$t("DIALTONE_CONTACT_CENTERS_ROW_MENU_BUTTON_LABEL")}},watch:{$props:{deep:!0,async handler(){await this.$nextTick(),this.adjustLabelWidth()}}},mounted(){this.resizeObserver=new ResizeObserver(this.adjustLabelWidth),this.resizeObserver.observe(a.returnFirstEl(this.$el)),this.adjustLabelWidth()},beforeUnmount:function(){this.resizeObserver.disconnect()},methods:{removeClassStyleAttrs:a.removeClassStyleAttrs,addClassStyleAttrs:a.addClassStyleAttrs,adjustLabelWidth(){var i,r,s,l,d,c;const t=((r=(i=a.returnFirstEl(this.$el))==null?void 0:i.querySelector(".d-recipe-leftbar-row__primary"))==null?void 0:r.clientWidth)||0,o=((l=(s=a.returnFirstEl(this.$el))==null?void 0:s.querySelector(".d-recipe-leftbar-row__omega"))==null?void 0:l.clientWidth)||0,n=((c=(d=a.returnFirstEl(this.$el))==null?void 0:d.querySelector(".d-recipe-leftbar-row__alpha"))==null?void 0:c.clientWidth)||0,_=12;this.labelWidth=t-(o+n+_)+"px"}}},g=["data-qa","aria-label","title","href"],y={class:"d-recipe-leftbar-row__alpha"},N={key:0,class:"d-recipe-leftbar-row__omega"},E={class:"d-recipe-leftbar-row__action-container"},S={class:"d-recipe-leftbar-row__bottom"};function q(t,o,n,_,i,r){const s=e.resolveComponent("dt-icon-headphones"),l=e.resolveComponent("dt-emoji-text-wrapper"),d=e.resolveComponent("dt-badge"),c=e.resolveComponent("dt-icon-chevron-down"),b=e.resolveComponent("dt-button");return e.openBlock(),e.createElementBlock("div",e.mergeProps({class:["d-recipe-leftbar-row__container",{"d-recipe-leftbar-row__container--off-duty":t.$slots.timer}]},r.addClassStyleAttrs(t.$attrs)),[e.createElementVNode("div",{class:e.normalizeClass(r.leftbarContactCentersRowClasses),"data-qa":"dt-recipe-contact-centers-row"},[e.createElementVNode("a",e.mergeProps({class:"d-recipe-leftbar-row__primary","data-qa":t.$attrs["data-qa"]??"d-recipe-leftbar-row-link","aria-label":r.getAriaLabel,title:n.description,href:t.$attrs.href??"javascript:void(0)"},r.removeClassStyleAttrs(t.$attrs),e.toHandlers(r.contactRowListeners,!0),{onClick:o[0]||(o[0]=u=>t.$emit("click",u))}),[e.createElementVNode("div",y,[e.createVNode(s,{size:"300","data-qa":"dt-recipe-leftbar-row-icon"})]),e.createElementVNode("div",{class:"d-recipe-leftbar-row__label",style:e.normalizeStyle(`flex-basis: ${i.labelWidth}`)},[e.createVNode(l,{class:"d-recipe-leftbar-row__description","data-qa":"dt-recipe-leftbar-row-description",size:"200"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.description),1)]),_:1})],4)],16,g),n.hideActions?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",N,[e.renderSlot(t.$slots,"right"),e.createElementVNode("div",E,[r.showUnreadCount?(e.openBlock(),e.createBlock(d,{key:0,class:"d-recipe-leftbar-row__unread-badge","data-qa":"dt-recipe-leftbar-row-unread-badge",kind:"count",type:"bulletin"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.unreadCount),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(b,{class:"d-recipe-leftbar-row__action","data-qa":"dt-recipe-leftbar-row-action-button","aria-label":r.menuButtonLabel,title:r.menuButtonLabel,importance:"clear",size:"xs",circle:"",onClick:o[1]||(o[1]=e.withModifiers(u=>t.$emit("click-menu",u),["stop"]))},{icon:e.withCtx(()=>[e.createVNode(c,{size:"100"})]),_:1},8,["aria-label","title"])])]))],2),e.createElementVNode("div",S,[e.renderSlot(t.$slots,"timer")])],16)}const L=m._(v,[["render",q]]);exports.default=L;
//# sourceMappingURL=contact-centers-row.cjs.map
