import{i as e,n as t}from"./rolldown-runtime-BKYq3fBv.js";import{$n as n,Cr as r,Nn as i,Or as a,Qt as o,Rr as s,Xn as c,Xr as l,Zn as u,Zt as d,ai as f,ar as p,er as m,li as h,si as g,sr as _,ui as v,zr as y}from"./vendor-primevue-D50rA9nL.js";import{n as b,t as x}from"./tailwindUtil-CORTPblY.js";var S,C,w,T,E,D,O,k,A=t((()=>{i(),d(),x(),S={class:`flex max-w-xs min-w-40 flex-col gap-2 p-3`},C={class:`text-sm font-inter`},w={key:1,class:`text-xs`},T={class:`flex max-w-xs min-w-40 flex-col gap-2 p-3`},E={class:`text-sm font-inter`},D={key:1,class:`text-xs`},O=`cursor-pointer transition-opacity hover:opacity-80`,k=_({__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 t=e,i=l(),togglePopover=e=>{i.value?.toggle(e)},d=c(()=>t.badge.variant??`info`),_=c(()=>({backgroundColor:t.backgroundColor})),x=c(()=>{switch(d.value){case`error`:return`bg-danger-100 text-white`;case`warning`:return`bg-gold-600 text-black`;case`info`:default:return`bg-white text-black`}}),k=c(()=>{switch(d.value){case`error`:return`text-danger-100`;case`warning`:return`text-warning-background`;case`info`:default:return`text-text-primary`}}),A=c(()=>k.value),j=c(()=>{if(t.badge.icon)return t.badge.icon;switch(d.value){case`error`:return`pi pi-exclamation-circle`;case`warning`:return`icon-[lucide--triangle-alert]`;case`info`:default:return}}),M=c(()=>{switch(d.value){case`error`:return`bg-danger-100`;case`warning`:return`bg-gold-600`;case`info`:default:return`bg-slate-100`}}),N=c(()=>({root:{class:b(`absolute z-50`)},content:{class:b(`mt-1 rounded-lg`,`bg-base-background`,`text-base-foreground`,`shadow-lg`,`border border-border-default`)}}));return(e,t)=>{let c=a(`tooltip`);return e.displayMode===`icon-only`?(r(),m(`div`,{key:0,class:g([`relative inline-flex h-full shrink-0 items-center justify-center px-2`,O]),style:h(_.value),onClick:togglePopover},[j.value?(r(),m(`i`,{key:0,class:g([`shrink-0 text-base`,j.value,A.value])},null,2)):e.badge.label?(r(),m(`div`,{key:1,class:g([`shrink-0 rounded-full px-1.5 py-0.5 text-xxxs font-semibold`,x.value])},v(e.badge.label),3)):(r(),m(`div`,{key:2,class:g([`size-2 shrink-0 rounded-full`,M.value])},null,2)),p(f(o),{ref_key:`popover`,ref:i,"append-to":`body`,"auto-z-index":!0,"base-z-index":1e3,dismissable:!0,"close-on-escape":!0,unstyled:``,pt:N.value},{default:s(()=>[u(`div`,S,[e.badge.label?(r(),m(`div`,{key:0,class:g([`w-fit rounded-full px-1.5 py-0.5 text-xxxs font-semibold`,x.value])},v(e.badge.label),3)):n(``,!0),u(`div`,C,v(e.badge.text),1),e.badge.tooltip?(r(),m(`div`,w,v(e.badge.tooltip),1)):n(``,!0)])]),_:1},8,[`pt`])],4)):e.displayMode===`compact`?(r(),m(`div`,{key:1,class:`relative inline-flex h-full`,style:h(_.value)},[u(`div`,{class:g([`flex h-full shrink-0 items-center gap-2 whitespace-nowrap`,[{"flex-row-reverse":e.reverseOrder},e.noPadding?``:`px-3`,O]]),onClick:togglePopover},[j.value?(r(),m(`i`,{key:0,class:g([`shrink-0 text-base`,j.value,A.value])},null,2)):n(``,!0),e.badge.label?(r(),m(`div`,{key:1,class:g([`shrink-0 rounded-full px-1.5 py-0.5 text-xxxs font-semibold`,x.value])},v(e.badge.label),3)):n(``,!0)],2),p(f(o),{ref_key:`popover`,ref:i,"append-to":`body`,"auto-z-index":!0,"base-z-index":1e3,dismissable:!0,"close-on-escape":!0,unstyled:``,pt:N.value},{default:s(()=>[u(`div`,T,[e.badge.label?(r(),m(`div`,{key:0,class:g([`w-fit rounded-full px-1.5 py-0.5 text-xxxs font-semibold`,x.value])},v(e.badge.label),3)):n(``,!0),u(`div`,E,v(e.badge.text),1),e.badge.tooltip?(r(),m(`div`,D,v(e.badge.tooltip),1)):n(``,!0)])]),_:1},8,[`pt`])],4)):y((r(),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:h(_.value)},[j.value?(r(),m(`i`,{key:0,class:g([`shrink-0 text-base`,j.value,A.value])},null,2)):n(``,!0),e.badge.label?(r(),m(`div`,{key:1,class:g([`shrink-0 rounded-full px-1.5 py-0.5 text-xxxs font-semibold`,x.value])},v(e.badge.label),3)):n(``,!0),u(`div`,{class:g([`font-inter text-sm`,k.value])},v(e.badge.text),3)],6)),[[c,e.badge.tooltip]])}}})})),j,M=t((()=>{A(),A(),j=k}));export{M as n,j as t};
//# sourceMappingURL=TopbarBadge-DHYqSR1E.js.map