import{e as D,b as h,Z as z,q as r,g as i,s as t,t as g,C as l,x as a,f as b,j as d,W as j,X as V,aN as u,a0 as y,S as C,T as w,$ as _,a$ as E,b0 as L,ar as N}from"./jwt-decode.esm-rEBc1yJt.js";import{_ as F}from"./AbstraButton.vue_vue_type_script_setup_true_lang-CQ398DyA.js";import{_ as x,P as k,H as v}from"./HighlightedText-CprIKvfu.js";import{F as K}from"./PhKey.vue-Cjtzov1D.js";import{G as R}from"./PhPencil.vue-Bzy91iFg.js";import{C as G}from"./index-D9LKNmUT.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]="df878819-774e-494a-a65b-ce43d11c61f8",e._sentryDebugIdIdentifier="sentry-dbid-df878819-774e-494a-a65b-ce43d11c61f8")}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(),r(t(G),{hoverable:!0,class:g(["table-card",{"table-highlighted":e.isHighlighted}]),onDblclick:o[1]||(o[1]=s=>p("dblclick"))},{title:l(()=>[a(t(u),{align:"center",justify:"space-between",wrap:"nowrap",style:{gap:"8px"}},{default:l(()=>[a(t(_),{level:5,style:{margin:"0",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"}},{default:l(()=>[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:l(()=>[e.showEditButton?(i(),r(I,{key:0,to:`/projects/${e.projectId}/tables/${e.table.id}`},{default:l(()=>[a(F,{size:"small",type:"text"},{default:l(()=>[a(t(R),{size:16})]),_:1})]),_:1},8,["to"])):d("",!0),e.showDeleteButton?(i(),b("button",{key:1,class:"delete-btn",onClick:o[0]||(o[0]=E(s=>p("delete"),["stop","prevent"]))},[a(t(L),{size:16})])):d("",!0)]),_:1})]),_:1})]),default:l(()=>[a(t(u),{vertical:"",gap:"small",class:"columns-list"},{default:l(()=>[(i(!0),b(j,null,V(B.value,s=>(i(),r(t(u),{key:s.id,align:"center",gap:"small",class:g(["column-row",{"column-highlighted":s.id&&e.highlightedColumns?.includes(s.id)}])},{default:l(()=>[e.showHandles&&s.foreignKey?(i(),r(t(x),{key:0,id:`target-${s.id}`,type:"target",position:t(k).Left,connectable:!1},null,8,["id","position"])):d("",!0),s.primaryKey?(i(),r(t(K),{key:1,size:14,class:"key-icon"})):d("",!0),a(t(y),{strong:"",style:{flex:"1","font-size":"13px","line-height":"1"}},{default:l(()=>[a(v,{text:s.name,term:e.searchTerm},null,8,["text","term"])]),_:2},1024),a(t(y),{type:"secondary",style:{"line-height":"1"}},{default:l(()=>[C(w(s.type),1)]),_:2},1024),e.showHandles&&(s.primaryKey||s.id&&H(s.id))?(i(),r(t(x),{key:2,id:`source-${s.id}`,type:"source",position:t(k).Right,connectable:!1},null,8,["id","position"])):d("",!0)]),_:2},1032,["class"]))),128)),T.value?(i(),r(t(u),{key:0,justify:"center",align:"center",style:{"padding-top":"8px"},class:g({"more-columns-highlighted":$.value})},{default:l(()=>[a(t(y),{type:"secondary",style:{"font-size":"12px"}},{default:l(()=>[C(" +"+w(e.table.getColumns().length-m.value)+" more columns ",1)]),_:1})]),_:1},8,["class"])):d("",!0)]),_:1})]),_:1},8,["class"])}}}),Z=N(M,[["__scopeId","data-v-573f54c1"]]);export{Z as T};
//# sourceMappingURL=TableCard-D_bnh9Ca.js.map
