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