import {i,v}from'./chunk-BpC5uLBd.js';import {N as Ne,H,V as Ve,I as It,b as a,s,G as Ge}from'./chunk-6zPu8Pcy.js';import {J,c as tS,dt as Mr,c9 as qn,H as ul,by as it,w as wo,N as Sr,f as QT,dO as W1,e1 as j1,dV as yn,a0 as ks,a3 as Py,v as W_,a2 as Uu,cE as py,d8 as CM,co as E_,T as P_,a4 as Sy,A as Iw,C as Qu,cF as rD,bp as QC,bz as f_,br as ZC,cl as JC,dj as KC,cm as XC,c2 as iv,a1 as Ny,bN as lM}from'./main-WUGO6e7n.js';function Z(t,n){if(t&1&&(ks(0,"li",4),W_(1),Uu()),t&2){let e=n.$implicit;Iw(),iv(e);}}function ee(t,n){if(t&1&&(ks(0,"ul",3),JC(1,Z,2,1,"li",4,KC),Uu()),t&2){let e=f_(2);Iw(),XC(e.licenseList);}}function te(t,n){if(t&1&&(ks(0,"div",4),W_(1),Uu()),t&2){let e=f_(2);Iw(),iv(e.tooltip);}}function ie(t,n){if(t&1&&(ks(0,"div",6),Ny(1,"i",7),Uu()),t&2){let e=n.$implicit;Sy("ngStyle",lM(5,Q,e.bgColor))("title",e.name),Iw(),P_(e.iconClass+" text-base"),Sy("ngStyle",lM(7,X,e.iconColor));}}function oe(t,n){if(t&1&&(ks(0,"div",5),JC(1,ie,2,9,"div",6,Y),Uu()),t&2){let e=f_(2);Iw(),XC(e.productTiles);}}function ne(t,n){if(t&1&&(ks(0,"div",2),QC(1,ee,3,0,"ul",3)(2,te,2,1,"div",4),QC(3,oe,3,0,"div",5),Uu()),t&2){let e=f_();Iw(),ZC(e.licenseList.length>0?1:2),Iw(2),ZC(e.showIcons?3:-1);}}var Q,X,Y,Se,se=J(()=>{tS();Ne();Mr();qn();H();tS();ul();i();Ve();Mr();Q=t=>({"background-color":t}),X=t=>({color:t}),Y=(t,n)=>n.name;Se=(()=>{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 it,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(It[a.SOLO].productLabel),this.licenseList=[];return}if(!this.licenses||this.licenses.length===0){this.tooltip=this.translatorService.translate(It[a.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(It[a.SOLO].products);if(!this.licenses||this.licenses.length===0)return this.computeDefaultProductTiles(It[a.WPM].products);if(this.licenses.length>1)return [];let i=this.licenses[0],o=this.productConfigService.getConfig(s.DWS);if(e.push({name:o.name,iconClass:`dvl-icon ${o.icon}`,bgColor:o.bgColor,iconColor:o.iconColor}),i.products?.length){let s$1=[s.HUB,s.DVLS,s.DWS];for(let D of i.products){if(s$1.includes(D))continue;let d=this.productConfigService.getConfig(D);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 s=this.productConfigService.getConfig(o);i.push({name:s.name,iconClass:`dvl-icon ${s.icon}`,bgColor:s.bgColor,iconColor:s.iconColor});}return i}static{this.\u0275fac=function(i){return new(i||t)(wo(Sr),wo(v),wo(Ge))};}static{this.\u0275cmp=QT({type:t,selectors:[["dvls-col-user-license"]],inputs:{licensesDisplay:"licensesDisplay",licenses:"licenses",isClickable:"isClickable",isDataSourceOwner:"isDataSourceOwner",isFreeVersion:"isFreeVersion"},outputs:{licenseClick:"licenseClick"},features:[rD],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&&(ks(0,"span",1),Py("click",function(){return o.onLicenseClick()}),W_(1),Uu(),py(2,ne,4,2,"ng-template",null,0,CM)),i&2){let s=E_(3);P_(o.isClickable?"cursor-pointer underline text-[var(--text-action)]":""),Sy("pTooltip",s)("tooltipDisabled",!o.tooltip&&o.licenseList.length===0)("escape",!1),Iw(),Qu(" ",o.licensesDisplay,`
`);}},dependencies:[W1,j1,yn],encapsulation:2,changeDetection:1});}}return t})();});export{Se as S,se as s};