import{e as D,b as h,Z as z,n as d,g as i,p as t,x as g,w as s,q as a,f as b,j as r,W as j,X as V,aN as u,U as y,R as C,S as w,a0 as _,a$ as E,b0 as L,ar as N}from"./jwt-decode.esm-B1xmpboS.js";import{_ as R}from"./AbstraButton.vue_vue_type_script_setup_true_lang-CqpCOX-v.js";import{_ as x,P as k,H as v}from"./HighlightedText-DfkuqCnP.js";import{F}from"./PhKey.vue-CYGIwIBn.js";import{G as K}from"./PhPencil.vue-Cdh59807.js";import{C as G}from"./index-CzrlPNrx.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},c=new Error().stack;c&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[c]="b9d9a8f4-0a47-4716-ad39-fda37dcde454",e._sentryDebugIdIdentifier="sentry-dbid-b9d9a8f4-0a47-4716-ad39-fda37dcde454")}catch{}})();const M=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},searchTerm:{}},emits:["dblclick","delete"],setup(e,{emit:c}){const n=e,p=c,m=h(()=>n.maxVisibleColumns??5),B=h(()=>n.table.getColumns().slice(0,m.value)),T=h(()=>n.table.getColumns().length>m.value),$=h(()=>!n.highlightedColumns||n.highlightedColumns.length===0?!1:n.table.getColumns().slice(m.value).some(o=>o.id&&n.highlightedColumns?.includes(o.id))),H=f=>n.connectedColumns?.includes(f)??!1;return(f,o)=>{const I=z("RouterLink");return i(),d(t(G),{hoverable:!0,class:g(["table-card",{"table-highlighted":e.isHighlighted}]),onDblclick:o[1]||(o[1]=l=>p("dblclick"))},{title:s(()=>[a(t(u),{align:"center",justify:"space-between",wrap:"nowrap",style:{gap:"8px"}},{default:s(()=>[a(t(_),{level:5,style:{margin:"0",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"}},{default:s(()=>[a(v,{text:e.table.name,term:e.searchTerm},null,8,["text","term"])]),_:1}),a(t(u),{gap:"small",align:"center",wrap:"nowrap",style:{"flex-shrink":"0"}},{default:s(()=>[e.showEditButton?(i(),d(I,{key:0,to:`/projects/${e.projectId}/tables/${e.table.id}`},{default:s(()=>[a(R,{size:"small",type:"text"},{default:s(()=>[a(t(K),{size:16})]),_:1})]),_:1},8,["to"])):r("",!0),e.showDeleteButton?(i(),b("button",{key:1,class:"delete-btn",onClick:o[0]||(o[0]=E(l=>p("delete"),["stop","prevent"]))},[a(t(L),{size:16})])):r("",!0)]),_:1})]),_:1})]),default:s(()=>[a(t(u),{vertical:"",gap:"small",class:"columns-list"},{default:s(()=>[(i(!0),b(j,null,V(B.value,l=>(i(),d(t(u),{key:l.id,align:"center",gap:"small",class:g(["column-row",{"column-highlighted":l.id&&e.highlightedColumns?.includes(l.id)}])},{default:s(()=>[e.showHandles&&l.foreignKey?(i(),d(t(x),{key:0,id:`target-${l.id}`,type:"target",position:t(k).Left,connectable:!1},null,8,["id","position"])):r("",!0),l.primaryKey?(i(),d(t(F),{key:1,size:14,class:"key-icon"})):r("",!0),a(t(y),{strong:"",style:{flex:"1","font-size":"13px","line-height":"1"}},{default:s(()=>[a(v,{text:l.name,term:e.searchTerm},null,8,["text","term"])]),_:2},1024),a(t(y),{type:"secondary",style:{"line-height":"1"}},{default:s(()=>[C(w(l.type),1)]),_:2},1024),e.showHandles&&(l.primaryKey||l.id&&H(l.id))?(i(),d(t(x),{key:2,id:`source-${l.id}`,type:"source",position:t(k).Right,connectable:!1},null,8,["id","position"])):r("",!0)]),_:2},1032,["class"]))),128)),T.value?(i(),d(t(u),{key:0,justify:"center",align:"center",style:{"padding-top":"8px"},class:g({"more-columns-highlighted":$.value})},{default:s(()=>[a(t(y),{type:"secondary",style:{"font-size":"12px"}},{default:s(()=>[C(" +"+w(e.table.getColumns().length-m.value)+" more columns ",1)]),_:1})]),_:1},8,["class"])):r("",!0)]),_:1})]),_:1},8,["class"])}}}),X=N(M,[["__scopeId","data-v-573f54c1"]]);export{X as T};
//# sourceMappingURL=TableCard-BxXnPsoX.js.map
