import{a as q,b as Z}from"./chunk-IS24YCZB.js";import{c as u,d as Q,f as m,h as d,i as X,j as G,k as Y}from"./chunk-6PLZSWB7.js";import{f as A,g as B,h as H}from"./chunk-ZBM6BFOI.js";import{b as W,c as K}from"./chunk-YBNTOQCK.js";import{K as J,q as R}from"./chunk-LDWBA6DZ.js";import{Db as E,Dc as P,Ea as k,Fa as w,Fd as $,Hc as U,Jb as C,Jc as p,Qb as F,Tc as V,Wa as y,Wb as I,Xc as L,Yc as _,Zc as b,_c as M,be as j,mc as v,oc as S,qc as O,qd as D,rc as x,sc as T,tc as h,uc as c,vc as a,wc as N,yb as l}from"./chunk-WL5U2YIT.js";import{e as z}from"./chunk-ADEKKGI2.js";function oe(e,i){if(e&1&&(c(0,"li",4),_(1),a()),e&2){let o=i.$implicit;l(),b(o)}}function ne(e,i){if(e&1&&(c(0,"ul",3),x(1,oe,2,1,"li",4,O),a()),e&2){let o=p(2);l(),T(o.licenseList)}}function se(e,i){if(e&1&&(c(0,"div",4),_(1),a()),e&2){let o=p(2);l(),b(o.tooltip)}}function re(e,i){if(e&1&&(c(0,"div",6),N(1,"i",7),a()),e&2){let o=i.$implicit;h("ngStyle",D(5,ee,o.bgColor))("title",o.name),l(),L(o.iconClass+" text-base"),h("ngStyle",D(7,te,o.iconColor))}}function le(e,i){if(e&1&&(c(0,"div",5),x(1,re,2,9,"div",6,ie),a()),e&2){let o=p(2);l(),T(o.productTiles)}}function ce(e,i){if(e&1&&(c(0,"div",2),v(1,ne,3,0,"ul",3)(2,se,2,1,"div",4),v(3,le,3,0,"div",5),a()),e&2){let o=p();l(),S(o.licenseList.length>0?1:2),l(2),S(o.showIcons?3:-1)}}var ee,te,ie,Le,ae=z(()=>{j();Q();H();J();X();j();K();Z();Y();H();ee=e=>({"background-color":e}),te=e=>({color:e}),ie=(e,i)=>i.name;Le=(()=>{let i=class i{constructor(n,t,s){this.translatorService=n,this.productConfigService=t,this.licensesService=s,this.licenses=[],this.isClickable=!1,this.isDataSourceOwner=!1,this.isFreeVersion=!1,this.licenseClick=new E,this.tooltip="",this.licenseList=[],this.productTiles=[],this.showIcons=!1}ngOnChanges(n){this.buildTooltipData(),this.productTiles=this.computeProductTiles(),this.showIcons=this.productTiles.length>0}buildTooltipData(){if(this.isDataSourceOwner&&this.isFreeVersion){this.tooltip=this.translatorService.translate(d[m.SOLO].productLabel),this.licenseList=[];return}if(!this.licenses||this.licenses.length===0){this.tooltip=this.translatorService.translate(d[m.WPM].productLabel),this.licenseList=[];return}let n=this.licenses.map(t=>t.productDescription&&t.productDescription.trim()!==""?t.productDescription:t.shortName&&t.shortName.trim()!==""?t.shortName:this.licensesService.getLicenseDisplayNameFromSku(t.sku)).filter(t=>t);n.length===1?(this.tooltip=n[0],this.licenseList=[]):(this.tooltip="",this.licenseList=n)}onLicenseClick(){this.isClickable&&this.licenseClick.emit()}computeProductTiles(){let n=[];if(this.isDataSourceOwner&&this.isFreeVersion)return this.computeDefaultProductTiles(d[m.SOLO].products);if(!this.licenses||this.licenses.length===0)return this.computeDefaultProductTiles(d[m.WPM].products);if(this.licenses.length>1)return[];let t=this.licenses[0],s=this.productConfigService.getConfig(u.DWS);if(n.push({name:s.name,iconClass:`dvl-icon ${s.icon}`,bgColor:s.bgColor,iconColor:s.iconColor}),t.products?.length){let r=[u.HUB,u.DVLS,u.DWS];for(let g of t.products){if(r.includes(g))continue;let f=this.productConfigService.getConfig(g);n.push({name:f.name,iconClass:`dvl-icon ${f.icon}`,bgColor:f.bgColor,iconColor:f.iconColor})}}return n}computeDefaultProductTiles(n){let t=[];for(let s of n){let r=this.productConfigService.getConfig(s);t.push({name:r.name,iconClass:`dvl-icon ${r.icon}`,bgColor:r.bgColor,iconColor:r.iconColor})}return t}};i.\u0275fac=function(t){return new(t||i)(C(W),C(q),C(G))},i.\u0275cmp=F({type:i,selectors:[["dvls-col-user-license"]],inputs:{licensesDisplay:"licensesDisplay",licenses:"licenses",isClickable:"isClickable",isDataSourceOwner:"isDataSourceOwner",isFreeVersion:"isFreeVersion"},outputs:{licenseClick:"licenseClick"},features:[y],decls:4,vars:6,consts:[["tooltipRef",""],["tooltipPosition","bottom","tooltipStyleClass","[&_.p-tooltip-text]:!bg-[var(--bg-100)] [&_.p-tooltip-text]:!text-[var(--text-400)]",3,"click","pTooltip","tooltipDisabled","escape"],[1,"flex","flex-col","gap-2","bg-[var(--bg-100)]",2,"max-width","none","width","max-content"],[1,"list-disc","pl-4","m-0"],[1,"whitespace-nowrap"],[1,"flex","gap-1.5","items-center","flex-wrap"],[1,"flex","items-center","justify-center","rounded-md","p-1.5","w-6","h-6",3,"ngStyle","title"],[3,"ngStyle"]],template:function(t,s){if(t&1){let r=P();c(0,"span",1),U("click",function(){return k(r),w(s.onLicenseClick())}),_(1),a(),I(2,ce,4,2,"ng-template",null,0,$)}if(t&2){let r=V(3);L(s.isClickable?"cursor-pointer underline text-[var(--text-action)]":""),h("pTooltip",r)("tooltipDisabled",!s.tooltip&&s.licenseList.length===0)("escape",!1),l(),M(" ",s.licensesDisplay,`
`)}},dependencies:[B,A,R],encapsulation:2});let e=i;return e})()});export{Le as a,ae as b};
