import{r as e}from"./rolldown-runtime-DIIn1E2Q.js";import{Y as t}from"./vendor-primevue-DyvCA8Nd.js";import{A as n,D as r,Ht as i,I as a,Lt as o,O as s,Ot as c,R as l,Vt as u,_t as d,at as f,et as p,j as m,vt as h,zt as g}from"./vendor-vue-core-IZuWV8u3.js";import{t as _}from"./src-B0kocU_l.js";var v={class:`flex max-w-xs min-w-40 flex-col gap-2 p-3`},y={class:`text-sm font-inter`},b={key:1,class:`text-xs`},x={class:`flex max-w-xs min-w-40 flex-col gap-2 p-3`},S={class:`text-sm font-inter`},C={key:1,class:`text-xs`},w=`cursor-pointer transition-opacity hover:opacity-80`,T=l({__name:`TopbarBadge`,props:{badge:{},displayMode:{default:`full`},reverseOrder:{type:Boolean,default:!1},noPadding:{type:Boolean,default:!1},backgroundColor:{default:`var(--comfy-menu-bg)`}},setup(e){let l=e,T=c(),togglePopover=e=>{T.value?.toggle(e)},E=r(()=>l.badge.variant??`info`),D=r(()=>({backgroundColor:l.backgroundColor})),O=r(()=>{switch(E.value){case`error`:return`bg-danger-100 text-white`;case`warning`:return`bg-gold-600 text-black`;default:return`bg-white text-black`}}),k=r(()=>{switch(E.value){case`error`:return`text-danger-100`;case`warning`:return`text-warning-background`;default:return`text-text-primary`}}),A=r(()=>k.value),j=r(()=>{if(l.badge.icon)return l.badge.icon;switch(E.value){case`error`:return`pi pi-exclamation-circle`;case`warning`:return`icon-[lucide--triangle-alert]`;default:return}}),M=r(()=>{switch(E.value){case`error`:return`bg-danger-100`;case`warning`:return`bg-gold-600`;default:return`bg-slate-100`}}),N=r(()=>({root:{class:_(`absolute z-50`)},content:{class:_(`mt-1 rounded-lg`,`bg-base-background`,`text-base-foreground`,`shadow-lg`,`border border-border-default`)}}));return(e,r)=>{let c=f(`tooltip`);return e.displayMode===`icon-only`?(p(),m(`div`,{key:0,class:g([`relative inline-flex h-full shrink-0 items-center justify-center px-2`,w]),style:u(D.value),onClick:togglePopover},[j.value?(p(),m(`i`,{key:0,class:g([`shrink-0 text-base`,j.value,A.value])},null,2)):e.badge.label?(p(),m(`div`,{key:1,class:g([`shrink-0 rounded-full px-1.5 py-0.5 text-xxxs font-semibold`,O.value])},i(e.badge.label),3)):(p(),m(`div`,{key:2,class:g([`size-2 shrink-0 rounded-full`,M.value])},null,2)),a(o(t),{ref_key:`popover`,ref:T,"append-to":`body`,"auto-z-index":!0,"base-z-index":1e3,dismissable:!0,"close-on-escape":!0,unstyled:``,pt:N.value},{default:d(()=>[s(`div`,v,[e.badge.label?(p(),m(`div`,{key:0,class:g([`w-fit rounded-full px-1.5 py-0.5 text-xxxs font-semibold`,O.value])},i(e.badge.label),3)):n(``,!0),s(`div`,y,i(e.badge.text),1),e.badge.tooltip?(p(),m(`div`,b,i(e.badge.tooltip),1)):n(``,!0)])]),_:1},8,[`pt`])],4)):e.displayMode===`compact`?(p(),m(`div`,{key:1,class:`relative inline-flex h-full`,style:u(D.value)},[s(`div`,{class:g([`flex h-full shrink-0 items-center gap-2 whitespace-nowrap`,[{"flex-row-reverse":e.reverseOrder},e.noPadding?``:`px-3`,w]]),onClick:togglePopover},[j.value?(p(),m(`i`,{key:0,class:g([`shrink-0 text-base`,j.value,A.value])},null,2)):n(``,!0),e.badge.label?(p(),m(`div`,{key:1,class:g([`shrink-0 rounded-full px-1.5 py-0.5 text-xxxs font-semibold`,O.value])},i(e.badge.label),3)):n(``,!0)],2),a(o(t),{ref_key:`popover`,ref:T,"append-to":`body`,"auto-z-index":!0,"base-z-index":1e3,dismissable:!0,"close-on-escape":!0,unstyled:``,pt:N.value},{default:d(()=>[s(`div`,x,[e.badge.label?(p(),m(`div`,{key:0,class:g([`w-fit rounded-full px-1.5 py-0.5 text-xxxs font-semibold`,O.value])},i(e.badge.label),3)):n(``,!0),s(`div`,S,i(e.badge.text),1),e.badge.tooltip?(p(),m(`div`,C,i(e.badge.tooltip),1)):n(``,!0)])]),_:1},8,[`pt`])],4)):h((p(),m(`div`,{key:2,class:g([`flex h-full shrink-0 items-center gap-2 whitespace-nowrap`,[{"flex-row-reverse":e.reverseOrder},e.noPadding?``:`px-3`]]),style:u(D.value)},[j.value?(p(),m(`i`,{key:0,class:g([`shrink-0 text-base`,j.value,A.value])},null,2)):n(``,!0),e.badge.label?(p(),m(`div`,{key:1,class:g([`shrink-0 rounded-full px-1.5 py-0.5 text-xxxs font-semibold`,O.value])},i(e.badge.label),3)):n(``,!0),s(`div`,{class:g([`font-inter text-sm`,k.value])},i(e.badge.text),3)],6)),[[c,e.badge.tooltip]])}}});export{T as t};
//# sourceMappingURL=TopbarBadge-tX_mtSzl.js.map