import{e as D,b as f,a2 as H,n as r,g as i,p as e,E as p,w as l,q as a,f as w,j as d,H as j,V as z,b5 as u,ai as b,R as h,S as y,al as V,bi as T,bj as E,aM as L}from"./jwt-decode.esm-C7p7KYmD.js";import{_ as R}from"./AbstraButton.vue_vue_type_script_setup_true_lang-DEp2OjRm.js";import{F}from"./PhKey.vue-B31JfRqu.js";import{G as K}from"./PhPencil.vue-DXKUnx8k.js";import{_ as k,P as v}from"./vue-flow-core-yjpTdLzx.js";import{C as M}from"./index-Bq1tJAxg.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]="e5243504-6833-4017-a90a-3e4a644642bc",t._sentryDebugIdIdentifier="sentry-dbid-e5243504-6833-4017-a90a-3e4a644642bc")}catch{}})();const N=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=f(()=>n.maxVisibleColumns??5),x=f(()=>n.table.getColumns().slice(0,m.value)),B=f(()=>n.table.getColumns().length>m.value),_=f(()=>!n.highlightedColumns||n.highlightedColumns.length===0?!1:n.table.getColumns().slice(m.value).some(o=>o.id&&n.highlightedColumns?.includes(o.id))),I=g=>n.connectedColumns?.includes(g)??!1;return(g,o)=>{const $=H("RouterLink");return i(),r(e(M),{hoverable:!0,class:p(["table-card",{"table-highlighted":t.isHighlighted}]),onDblclick:o[1]||(o[1]=s=>C("dblclick"))},{title:l(()=>[a(e(u),{align:"center",justify:"space-between",wrap:"nowrap",style:{gap:"8px"}},{default:l(()=>[a(e(V),{level:5,style:{margin:"0",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"}},{default:l(()=>[h(y(t.table.name),1)]),_:1}),a(e(u),{gap:"small",align:"center",wrap:"nowrap",style:{"flex-shrink":"0"}},{default:l(()=>[t.showEditButton?(i(),r($,{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"])):d("",!0),t.showDeleteButton?(i(),w("button",{key:1,class:"delete-btn",onClick:o[0]||(o[0]=T(s=>C("delete"),["stop","prevent"]))},[a(e(E),{size:16})])):d("",!0)]),_:1})]),_:1})]),default:l(()=>[a(e(u),{vertical:"",gap:"small",class:"columns-list"},{default:l(()=>[(i(!0),w(j,null,z(x.value,s=>(i(),r(e(u),{key:s.id,align:"center",gap:"small",class:p(["column-row",{"column-highlighted":s.id&&t.highlightedColumns?.includes(s.id)}])},{default:l(()=>[t.showHandles&&s.foreignKey?(i(),r(e(k),{key:0,id:`target-${s.id}`,type:"target",position:e(v).Left,connectable:!1},null,8,["id","position"])):d("",!0),s.primaryKey?(i(),r(e(F),{key:1,size:14,class:"key-icon"})):d("",!0),a(e(b),{strong:"",style:{flex:"1","font-size":"13px","line-height":"1"}},{default:l(()=>[h(y(s.name),1)]),_:2},1024),a(e(b),{type:"secondary",style:{"line-height":"1"}},{default:l(()=>[h(y(s.type),1)]),_:2},1024),t.showHandles&&(s.primaryKey||s.id&&I(s.id))?(i(),r(e(k),{key:2,id:`source-${s.id}`,type:"source",position:e(v).Right,connectable:!1},null,8,["id","position"])):d("",!0)]),_:2},1032,["class"]))),128)),B.value?(i(),r(e(u),{key:0,justify:"center",align:"center",style:{"padding-top":"8px"},class:p({"more-columns-highlighted":_.value})},{default:l(()=>[a(e(b),{type:"secondary",style:{"font-size":"12px"}},{default:l(()=>[h(" +"+y(t.table.getColumns().length-m.value)+" more columns ",1)]),_:1})]),_:1},8,["class"])):d("",!0)]),_:1})]),_:1},8,["class"])}}}),O=L(N,[["__scopeId","data-v-a12e1c88"]]);export{O as T};
//# sourceMappingURL=TableCard-D71a5Hlg.js.map
