import{d as A,f as H}from"./chunk-MY54U2QA.js";import{j as F,k as V}from"./chunk-77VV6VS7.js";import{c as a,d as O}from"./chunk-E7BKRPHP.js";import{l as v}from"./chunk-QVLAHW2O.js";import{$b as r,Bd as P,Cd as R,Dd as b,Gc as p,Ha as _,Hc as f,Ia as h,Kb as D,Qb as g,Qc as I,Sd as E,Xc as u,Yc as m,hc as l,ic as c,kc as S,lc as w,nc as C,nd as M,qc as x,sb as y,sc as o,xb as i,zd as L}from"./chunk-PGS4AHIT.js";O();M();E();V();H();var q=()=>[];function G(t,d){if(t&1&&(l(0,"span"),p(1),u(2,"translate"),c()),t&2){let e=o(2);i(),f(m(2,1,e.linkDef.label))}}function N(t,d){if(t&1&&(l(0,"span"),p(1),c()),t&2){let e=o(2);i(),f(e.linkDef.link)}}function B(t,d){if(t&1){let e=C();l(0,"a",4),x("click",function(s){_(e);let k=o();return h(k.onLinkSelected(s))}),l(1,"button",5),g(2,G,3,3,"span",6)(3,N,2,1,"span",6),c()()}if(t&2){let e=o();r("pawId",e.linkId)("routerLink",e.linkDef.link||I(7,q))("queryParams",e.linkDef.queryParams)("ngClass",e.linkDef.styleCss),i(),r("pawId","grid-link-btn-"+e.linkId),i(),r("ngIf",e.linkDef.label),i(),r("ngIf",e.linkDef.link&&!e.linkDef.label)}}function $(t,d){if(t&1&&(l(0,"span"),p(1),u(2,"translate"),c()),t&2){let e=o(2);i(),f(m(2,1,e.linkDef.label))}}function Q(t,d){if(t&1&&(l(0,"span"),p(1),c()),t&2){let e=o(2);i(),f(e.linkDef.href)}}function U(t,d){if(t&1){let e=C();l(0,"a",7),x("click",function(s){_(e);let k=o();return h(k.onLinkSelected(s))}),l(1,"button",5),g(2,$,3,3,"span",6)(3,Q,2,1,"span",6),c()()}if(t&2){let e=o();r("pawId",e.linkId)("href",e.linkDef.href,y)("ngClass",e.linkDef.styleCss),i(),r("pawId","grid-link-btn-"+e.linkId),i(),r("ngIf",e.linkDef.label),i(),r("ngIf",e.linkDef.href&&!e.linkDef.label)}}function z(t,d){if(t&1&&(l(0,"span"),p(1),u(2,"translate"),c()),t&2){let e=o();i(),f(m(2,1,e.linkDef.label))}}var Z=(()=>{class t{static get agRenderer(){return!0}static{this.allowTooltip=!0}constructor(){this.linkDef={},this.link=[],this.state={type:null},this.linkId=null}agInit(e){this.setAgGridHandler(e.colDef?.cellRendererParams.agGridHandler),this.setLinkId(e.node.id,e.node.rowIndex),this.setLinkLabelFromParams(e)}refresh(e){return this.setLinkLabelFromParams(e),!0}setLinkLabelFromParams(e){if(!a.isSet(e.colDef)||!a.isSet(e.colDef.cellRendererParams)||!a.isSet(e.data))return;let n=e.colDef.cellRendererParams;if(a.isFunction(n.getParams)){this.linkDef=n.getParams(e.data),this.calcState();return}a.isFunction(n.getLabel)&&(this.linkDef.label=n.getLabel(e.data)),a.isFunction(n.getLink)&&(this.linkDef.link=n.getLink(e.data)),a.isFunction(n.getHref)&&(this.linkDef.href=n.getHref(e.data)),a.isFunction(n.getQueryParams)&&(this.linkDef.queryParams=n.getQueryParams(e.data)),a.isFunction(n.getStyleCss)&&(this.linkDef.styleCss=n.getStyleCss(e.data)),this.calcState()}onLinkSelected(e){a.isFunction(this.linkDef.onSelected)&&this.linkDef.onSelected(e)}setAgGridHandler(e){this.agGridHandler=e}setLinkId(e,n){if(this.agGridHandler&&(e||n)){let s=this.agGridHandler.settings?.id,k=s?`${s}-`:"",T=!e||e==="undefined"?n:e;this.linkId=`ag-router-link-${k}${T}`;return}this.linkId=null}calcState(){if(this.linkDef?.link||this.linkDef?.queryParams){this.state.type="link";return}if(this.linkDef?.href){this.state.type="href";return}if(this.linkDef?.label){this.state.type="label";return}this.state.type=null}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=D({type:t,selectors:[["paw-ag-router-link-renderer"]],standalone:!1,decls:4,vars:4,consts:[[3,"ngSwitch"],[3,"pawId","routerLink","queryParams","ngClass","click",4,"ngSwitchCase"],["target","_blank",3,"pawId","href","ngClass","click",4,"ngSwitchCase"],[4,"ngSwitchCase"],[3,"click","pawId","routerLink","queryParams","ngClass"],[3,"pawId"],[4,"ngIf"],["target","_blank",3,"click","pawId","href","ngClass"]],template:function(n,s){n&1&&(S(0,0),g(1,B,4,8,"a",1)(2,U,4,6,"a",2)(3,z,3,3,"span",3),w()),n&2&&(r("ngSwitch",s.state.type),i(),r("ngSwitchCase","link"),i(),r("ngSwitchCase","href"),i(),r("ngSwitchCase","label"))},dependencies:[L,P,R,b,v,F,A],styles:["[_nghost-%COMP%]   a[_ngcontent-%COMP%]{color:var(--paw-text-link);text-decoration:none;font-weight:500}[_nghost-%COMP%]   a[_ngcontent-%COMP%] > button[_ngcontent-%COMP%]{background:none;border:none;padding:0;margin:0;font:inherit;color:inherit;cursor:inherit}[_nghost-%COMP%]   a.paw-text-primary[_ngcontent-%COMP%]{color:var(--paw-text-primary)!important;cursor:default}"]})}}return t})();export{Z as a};
