import{Aa as f,Ba as o,Ca as r,Gc as D,Ha as b,Hc as O,Ja as S,K as E,Ka as l,L as g,R as p,Ta as t,Ua as s,ba as a,de as $,ha as T,ma as m,oc as I,pb as y,qa as x,qc as F,qd as k,rd as B,vb as w,wa as C,ya as v,za as h}from"./chunk-7SK34GC7.js";function H(n,c){if(n&1&&(t(0,`
              `),o(1,"th"),t(2),r(),t(3,`
              `)),n&2){let e=l().$implicit,i=l();a(2),s(i.formatHeader(e))}}function A(n,c){if(n&1&&(t(0,`
              `),m(1,H,4,1)),n&2){let e=c.$implicit,i=l();a(),C(i.inclusive(e)?1:-1)}}function M(n,c){if(n&1&&(t(0,`
              `),o(1,"td"),t(2),r(),t(3,`
              `)),n&2){let e=l().$implicit,i=l().$implicit;a(2),s(i[e])}}function V(n,c){if(n&1&&(t(0,`
              `),m(1,M,4,1)),n&2){let e=c.$implicit,i=l(2);a(),C(i.inclusive(e)?1:-1)}}function P(n,c){if(n&1){let e=b();o(0,"a",8),S("click",function(){let d=E(e).$implicit,_=l().$implicit,u=l();return g(d.action=="edit"?u.editItem(_):d.action=="delete"?u.deleteItem(_):u.otherAction(_))}),t(1),r()}if(n&2){let e=c.$implicit;x("color",e.color),a(),s(e.label)}}function j(n,c){if(n&1&&(o(0,"tr",5),t(1,`
              `),o(2,"th",6),t(3),r(),t(4,`
              `),h(5,V,2,1,null,null,v),o(7,"td"),t(8,`
                `),m(9,P,2,2,"a",7),t(10,`
              `),r(),t(11,`
            `),r()),n&2){let e=c.index,i=l();a(3),s(e+1),a(2),f(i.getHeaders()),a(4),x("ngForOf",i.actions)}}var it=(()=>{class n{constructor(){this.data=[],this.exclude=[],this.actions=[],this.editEvent=new p,this.deleteEvent=new p,this.otherEvent=new p,this.excludedCols=["id"],this.headers=[]}ngOnInit(){console.log(this.data),this.excludedCols=this.excludedCols.concat(this.exclude),this.getHeaders()}getHeaders(){var e=this.data.length>0?Object.keys(this.data[0]):[];return e}inclusive(e){return!this.excludedCols.includes(e)}formatHeader(e){return e.replace(/[^a-zA-Z0-9]/g," ").toUpperCase()}editItem(e){this.editEvent.emit(e)}deleteItem(e){this.deleteEvent.emit(e)}otherAction(e){this.otherEvent.emit(e)}static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275cmp=T({type:n,selectors:[["app-table"]],inputs:{data:"data",exclude:"exclude",actions:"actions",buttonTemplate:"buttonTemplate"},outputs:{editEvent:"editEvent",deleteEvent:"deleteEvent",otherEvent:"otherEvent"},decls:33,vars:1,consts:[["xs","12"],[1,"mb-4"],["cTable","","caption","top",1,"overflow-hidden"],["scope","col"],["class","",4,"ngFor","ngForOf"],[1,""],["scope","row"],["class","ms-1 me-1","cButton","",3,"color","click",4,"ngFor","ngForOf"],["cButton","",1,"ms-1","me-1",3,"click","color"]],template:function(i,d){i&1&&(o(0,"c-row"),t(1,`
  `),o(2,"c-col",0),t(3,`
    `),o(4,"c-card",1),t(5,`
      `),o(6,"c-card-body"),t(7,`
        `),o(8,"table",2),t(9,`
          `),o(10,"thead"),t(11,`
            `),o(12,"tr"),t(13,`
              `),o(14,"th",3),t(15,"#"),r(),t(16,`
              `),h(17,A,2,1,null,null,v),o(19,"th"),t(20,"Action"),r(),t(21,`
            `),r(),t(22,`
          `),r(),t(23,`
          `),o(24,"tbody"),t(25,`
            `),m(26,j,12,2,"tr",4),t(27,`
          `),r(),t(28,`
        `),r(),t(29,`
      `),r(),t(30,`
    `),r(),t(31,`
  `),r(),t(32,`

`),r()),i&2&&(a(17),f(d.getHeaders()),a(9),x("ngForOf",d.data))},dependencies:[B,k,D,w,y,O,$,F,I],styles:[".p-3[_ngcontent-%COMP%]{padding:3rem}.primary[_ngcontent-%COMP%]{background-color:#583488}"]})}}return n})();export{it as a};
