import{e as D,b as g,ab as z,f as d,h as i,j as e,O as y,w as l,m as a,y as k,g as r,V as H,a2 as T,J as u,T as p,k as h,t as b,ao as V,bf as j,aR as E,aO as L}from"./jwt-decode.esm-BJTSBhUK.js";import{_ as R}from"./AbstraButton.vue_vue_type_script_setup_true_lang-CmsDa9wk.js";import{F}from"./PhKey.vue-D6QxWTTn.js";import{G as K}from"./PhPencil.vue-X590M3TX.js";import{_ as v,P as w}from"./vue-flow-core-Cu8UrnM4.js";import{C as N}from"./index-B-rtXwyD.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},c=new Error().stack;c&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[c]="d4f232b9-03ad-46f8-bb2a-72eb0157dae1",t._sentryDebugIdIdentifier="sentry-dbid-d4f232b9-03ad-46f8-bb2a-72eb0157dae1")}catch{}})();const G=D({__name:"TableCard",props:{table:{},projectId:{},showHandles:{type:Boolean},maxVisibleColumns:{},connectedColumns:{},highlightedColumns:{},isHighlighted:{type:Boolean},showEditButton:{type:Boolean,default:!0},showDeleteButton:{type:Boolean,default:!1}},emits:["dblclick","delete"],setup(t,{emit:c}){const n=t,C=c,m=g(()=>n.maxVisibleColumns??5),x=g(()=>n.table.getColumns().slice(0,m.value)),B=g(()=>n.table.getColumns().length>m.value),_=g(()=>!n.highlightedColumns||n.highlightedColumns.length===0?!1:n.table.getColumns().slice(m.value).some(o=>o.id&&n.highlightedColumns?.includes(o.id))),I=f=>n.connectedColumns?.includes(f)??!1;return(f,o)=>{const $=z("RouterLink");return i(),d(e(N),{hoverable:!0,class:y(["table-card",{"table-highlighted":t.isHighlighted}]),onDblclick:o[1]||(o[1]=s=>C("dblclick"))},{title:l(()=>[a(e(u),{align:"center",justify:"space-between"},{default:l(()=>[a(e(V),{level:5,style:{margin:"0"}},{default:l(()=>[h(b(t.table.name),1)]),_:1}),a(e(u),{gap:"small",align:"center"},{default:l(()=>[t.showEditButton?(i(),d($,{key:0,to:`/projects/${t.projectId}/tables/${t.table.id}`},{default:l(()=>[a(R,{size:"small",type:"text"},{default:l(()=>[a(e(K),{size:16})]),_:1})]),_:1},8,["to"])):r("",!0),t.showDeleteButton?(i(),k("button",{key:1,class:"delete-btn",onClick:o[0]||(o[0]=j(s=>C("delete"),["stop","prevent"]))},[a(e(E),{size:16})])):r("",!0)]),_:1})]),_:1})]),default:l(()=>[a(e(u),{vertical:"",gap:"small",class:"columns-list"},{default:l(()=>[(i(!0),k(H,null,T(x.value,s=>(i(),d(e(u),{key:s.id,align:"center",gap:"small",class:y(["column-row",{"column-highlighted":s.id&&t.highlightedColumns?.includes(s.id)}])},{default:l(()=>[t.showHandles&&s.foreignKey?(i(),d(e(v),{key:0,id:`target-${s.id}`,type:"target",position:e(w).Left,connectable:!1},null,8,["id","position"])):r("",!0),s.primaryKey?(i(),d(e(F),{key:1,size:14,class:"key-icon"})):r("",!0),a(e(p),{strong:"",style:{flex:"1","font-size":"13px","line-height":"1"}},{default:l(()=>[h(b(s.name),1)]),_:2},1024),a(e(p),{type:"secondary",style:{"line-height":"1"}},{default:l(()=>[h(b(s.type),1)]),_:2},1024),t.showHandles&&(s.primaryKey||s.id&&I(s.id))?(i(),d(e(v),{key:2,id:`source-${s.id}`,type:"source",position:e(w).Right,connectable:!1},null,8,["id","position"])):r("",!0)]),_:2},1032,["class"]))),128)),B.value?(i(),d(e(u),{key:0,justify:"center",align:"center",style:{"padding-top":"8px"},class:y({"more-columns-highlighted":_.value})},{default:l(()=>[a(e(p),{type:"secondary",style:{"font-size":"12px"}},{default:l(()=>[h(" +"+b(t.table.getColumns().length-m.value)+" more columns ",1)]),_:1})]),_:1},8,["class"])):r("",!0)]),_:1})]),_:1},8,["class"])}}}),q=L(G,[["__scopeId","data-v-eb2ff5e4"]]);export{q as T};
//# sourceMappingURL=TableCard-DA6R_e8x.js.map
