import{r as e}from"./rolldown-runtime-DCMCV6zW.js";import{$ as t}from"./vendor-primevue-DxVRNMbC.js";import{A as n,Bt as r,D as i,Dt as a,I as o,It as s,O as c,R as l,Rt as u,Vt as d,_t as f,at as p,et as m,gt as h,j as g}from"./vendor-vue-core-X6q-rGJs.js";import{t as _}from"./src-Bx0QZVd-.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=a(),togglePopover=e=>{T.value?.toggle(e)},E=i(()=>l.badge.variant??`info`),D=i(()=>({backgroundColor:l.backgroundColor})),O=i(()=>{switch(E.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=i(()=>{switch(E.value){case`error`:return`text-danger-100`;case`warning`:return`text-warning-background`;case`info`:default:return`text-text-primary`}}),A=i(()=>k.value),j=i(()=>{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]`;case`info`:default:return}}),M=i(()=>{switch(E.value){case`error`:return`bg-danger-100`;case`warning`:return`bg-gold-600`;case`info`:default:return`bg-slate-100`}}),N=i(()=>({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,i)=>{let a=p(`tooltip`);return e.displayMode===`icon-only`?(m(),g(`div`,{key:0,class:u([`relative inline-flex h-full shrink-0 items-center justify-center px-2`,w]),style:r(D.value),onClick:togglePopover},[j.value?(m(),g(`i`,{key:0,class:u([`shrink-0 text-base`,j.value,A.value])},null,2)):e.badge.label?(m(),g(`div`,{key:1,class:u([`shrink-0 rounded-full px-1.5 py-0.5 text-xxxs font-semibold`,O.value])},d(e.badge.label),3)):(m(),g(`div`,{key:2,class:u([`size-2 shrink-0 rounded-full`,M.value])},null,2)),o(s(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:h(()=>[c(`div`,v,[e.badge.label?(m(),g(`div`,{key:0,class:u([`w-fit rounded-full px-1.5 py-0.5 text-xxxs font-semibold`,O.value])},d(e.badge.label),3)):n(``,!0),c(`div`,y,d(e.badge.text),1),e.badge.tooltip?(m(),g(`div`,b,d(e.badge.tooltip),1)):n(``,!0)])]),_:1},8,[`pt`])],4)):e.displayMode===`compact`?(m(),g(`div`,{key:1,class:`relative inline-flex h-full`,style:r(D.value)},[c(`div`,{class:u([`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?(m(),g(`i`,{key:0,class:u([`shrink-0 text-base`,j.value,A.value])},null,2)):n(``,!0),e.badge.label?(m(),g(`div`,{key:1,class:u([`shrink-0 rounded-full px-1.5 py-0.5 text-xxxs font-semibold`,O.value])},d(e.badge.label),3)):n(``,!0)],2),o(s(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:h(()=>[c(`div`,x,[e.badge.label?(m(),g(`div`,{key:0,class:u([`w-fit rounded-full px-1.5 py-0.5 text-xxxs font-semibold`,O.value])},d(e.badge.label),3)):n(``,!0),c(`div`,S,d(e.badge.text),1),e.badge.tooltip?(m(),g(`div`,C,d(e.badge.tooltip),1)):n(``,!0)])]),_:1},8,[`pt`])],4)):f((m(),g(`div`,{key:2,class:u([`flex h-full shrink-0 items-center gap-2 whitespace-nowrap`,[{"flex-row-reverse":e.reverseOrder},e.noPadding?``:`px-3`]]),style:r(D.value)},[j.value?(m(),g(`i`,{key:0,class:u([`shrink-0 text-base`,j.value,A.value])},null,2)):n(``,!0),e.badge.label?(m(),g(`div`,{key:1,class:u([`shrink-0 rounded-full px-1.5 py-0.5 text-xxxs font-semibold`,O.value])},d(e.badge.label),3)):n(``,!0),c(`div`,{class:u([`font-inter text-sm`,k.value])},d(e.badge.text),3)],6)),[[a,e.badge.tooltip]])}}});export{T as t};
//# sourceMappingURL=TopbarBadge-E4og8RTb.js.map