import{a as H,b as X}from"./chunk-XN6DQ6IR.js";import{e as p,f as J,g as m,i as u,j as K,k as B,l as Q}from"./chunk-BX7D5OPW.js";import{wa as R,xa as W,ya as A}from"./chunk-QH7CG3K4.js";import{b as j,c as z}from"./chunk-IBUDDWQO.js";import{K as q,s as $}from"./chunk-HJI5FNS6.js";import{$c as T,Bb as r,Bd as V,Dc as O,Gb as f,Hc as N,Ic as a,Ja as D,Ka as k,La as w,Rb as E,Sd as M,Ua as y,Xb as g,Yc as P,_c as h,ad as U,kc as C,md as b,oc as v,sc as S,uc as F,vc as x,wc as L,xc as l,yc as c,zc as I}from"./chunk-XJKQ67XR.js";import{e as G}from"./chunk-SZAW6ZBW.js";function te(t,s){if(t&1&&(l(0,"li",4),h(1),c()),t&2){let e=s.$implicit;r(),T(e)}}function ie(t,s){if(t&1&&(l(0,"ul",3),x(1,te,2,1,"li",4,F),c()),t&2){let e=a(2);r(),L(e.licenseList)}}function oe(t,s){if(t&1&&(l(0,"div",4),h(1),c()),t&2){let e=a(2);r(),T(e.tooltip)}}function ne(t,s){if(t&1&&(l(0,"div",6),I(1,"i",7),c()),t&2){let e=s.$implicit;C("ngStyle",b(5,Y,e.bgColor))("title",e.name),r(),v(e.iconClass+" text-base"),C("ngStyle",b(7,Z,e.iconColor))}}function se(t,s){if(t&1&&(l(0,"div",5),x(1,ne,2,9,"div",6,ee),c()),t&2){let e=a(2);r(),L(e.productTiles)}}function re(t,s){if(t&1&&(l(0,"div",2),g(1,ie,3,0,"ul",3)(2,oe,2,1,"div",4)(3,se,3,0,"div",5),c()),t&2){let e=a();r(),S(e.licenseList.length>0?1:2),r(2),S(e.showIcons?3:-1)}}var Y,Z,ee,xe,le=G(()=>{M();J();A();q();K();M();z();X();Q();A();Y=t=>({"background-color":t}),Z=t=>({color:t}),ee=(t,s)=>s.name;xe=(()=>{class t{constructor(e,i,o){this.translatorService=e,this.productConfigService=i,this.licensesService=o,this.licenses=[],this.isClickable=!1,this.isDataSourceOwner=!1,this.isFreeVersion=!1,this.licenseClick=new y,this.tooltip="",this.licenseList=[],this.productTiles=[],this.showIcons=!1}ngOnChanges(e){this.buildTooltipData(),this.productTiles=this.computeProductTiles(),this.showIcons=this.productTiles.length>0}buildTooltipData(){if(this.isDataSourceOwner&&this.isFreeVersion){this.tooltip=this.translatorService.translate(u[m.SOLO].productLabel),this.licenseList=[];return}if(!this.licenses||this.licenses.length===0){this.tooltip=this.translatorService.translate(u[m.WPM].productLabel),this.licenseList=[];return}let e=this.licenses.map(i=>i.productDescription&&i.productDescription.trim()!==""?i.productDescription:i.shortName&&i.shortName.trim()!==""?i.shortName:this.licensesService.getLicenseDisplayNameFromSku(i.sku)).filter(i=>i);e.length===1?(this.tooltip=e[0],this.licenseList=[]):(this.tooltip="",this.licenseList=e)}onLicenseClick(){this.isClickable&&this.licenseClick.emit()}computeProductTiles(){let e=[];if(this.isDataSourceOwner&&this.isFreeVersion)return this.computeDefaultProductTiles(u[m.SOLO].products);if(!this.licenses||this.licenses.length===0)return this.computeDefaultProductTiles(u[m.WPM].products);if(this.licenses.length>1)return[];let i=this.licenses[0],o=this.productConfigService.getConfig(p.DWS);if(e.push({name:o.name,iconClass:`dvl-icon ${o.icon}`,bgColor:o.bgColor,iconColor:o.iconColor}),i.products?.length){let n=[p.HUB,p.DVLS,p.DWS];for(let _ of i.products){if(n.includes(_))continue;let d=this.productConfigService.getConfig(_);e.push({name:d.name,iconClass:`dvl-icon ${d.icon}`,bgColor:d.bgColor,iconColor:d.iconColor})}}return e}computeDefaultProductTiles(e){let i=[];for(let o of e){let n=this.productConfigService.getConfig(o);i.push({name:n.name,iconClass:`dvl-icon ${n.icon}`,bgColor:n.bgColor,iconColor:n.iconColor})}return i}static{this.\u0275fac=function(i){return new(i||t)(f(j),f(H),f(B))}}static{this.\u0275cmp=E({type:t,selectors:[["dvls-col-user-license"]],inputs:{licensesDisplay:"licensesDisplay",licenses:"licenses",isClickable:"isClickable",isDataSourceOwner:"isDataSourceOwner",isFreeVersion:"isFreeVersion"},outputs:{licenseClick:"licenseClick"},features:[D],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(i,o){if(i&1){let n=O();l(0,"span",1),N("click",function(){return k(n),w(o.onLicenseClick())}),h(1),c(),g(2,re,4,2,"ng-template",null,0,V)}if(i&2){let n=P(3);v(o.isClickable?"cursor-pointer underline text-[var(--text-action)]":""),C("pTooltip",n)("tooltipDisabled",!o.tooltip&&o.licenseList.length===0)("escape",!1),r(),U(" ",o.licensesDisplay,`
`)}},dependencies:[W,R,$],encapsulation:2})}}return t})()});export{xe as a,le as b};
