import{C as g}from"./CrudView-mhs4hgbB.js";import{a as x,r as I,i as e,ak as C,c as A,aP as h,aQ as D,k as P,f as M,h as s,u as a,w as l,aR as T,g as _,t as u,T as j,ac as R,R as V}from"./jwt-decode.esm-CcQ3pRvv.js";import{a as B}from"./asyncComputed-VbQnPyCS.js";import{A as d}from"./apiKey-CtcNHmc0.js";import"./router-Iw95qt13.js";import{M as E}from"./member-DcAnLpqP.js";import{a as N}from"./project-DUd1sdnK.js";import"./tables-DLhg5GAC.js";import"./DocsButton.vue_vue_type_script_setup_true_lang-D0wHmB3y.js";import"./constants-peN43IX4.js";import"./url-CpkKDaxC.js";import"./PhDotsThreeVertical.vue-Dp2HW3E-.js";import"./index-6vAXNHbI.js";import"./ts.worker-DX00X54-.js";import"./record-DPnmu5lF.js";import"./string-Bh1XBwdI.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},i=new Error().stack;i&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[i]="a06c15e0-f41a-4cc4-8646-dd62ee903a36",o._sentryDebugIdIdentifier="sentry-dbid-a06c15e0-f41a-4cc4-8646-dd62ee903a36")}catch{}})();const ee=x({__name:"ApiKeys",setup(o){const i=I(null),c=[{key:"name",label:e.translate("i18n_apikeysview_field_name")}],r=C().params.projectId,y=new E,{loading:f,result:w,refetch:m}=B(async()=>Promise.all([d.list(r),N.get(r).then(t=>y.list(t.organizationId))]).then(([t,n])=>t.map(p=>({apiKey:p,member:n.find(b=>b.authorId===p.ownerId)})))),v=async t=>{const n=await d.create({projectId:r,name:t.name});m(),i.value=n.value},k=A(()=>({columns:[{title:e.translate("i18n_apikeysview_column_name")},{title:e.translate("i18n_apikeysview_column_creation_date")},{title:e.translate("i18n_apikeysview_column_owner")},{title:"",align:"right"}],rows:w.value?.map(({apiKey:t,member:n})=>({key:t.id,cells:[{type:"text",text:t.name},{type:"text",text:h(t.createdAt)},{type:"text",text:n?.email??e.translate("i18n_apikeysview_owner_unknown")},{type:"actions",actions:[{label:e.translate("i18n_apikeysview_action_delete"),icon:D,dangerous:!0,onClick:async()=>{await d.delete(r,t.id),m()}}]}]}))??[]}));return(t,n)=>(M(),P(V,null,[s(g,{"entity-name":a(e).translate("i18n_apikeysview_entity_name"),"create-button-text":a(e).translate("i18n_apikeysview_create_button"),loading:a(f),title:a(e).translate("i18n_apikeysview_title"),description:a(e).translate("i18n_apikeysview_description"),"empty-title":a(e).translate("i18n_apikeysview_empty_title"),table:k.value,fields:c,create:v},null,8,["entity-name","create-button-text","loading","title","description","empty-title","table"]),s(a(R),{open:!!i.value,title:a(e).translate("i18n_apikeysview_modal_title"),onCancel:n[0]||(n[0]=p=>i.value=null)},{footer:l(()=>[...n[1]||(n[1]=[])]),default:l(()=>[s(a(T),null,{default:l(()=>[_(u(a(e).translate("i18n_apikeysview_modal_description")),1)]),_:1}),s(a(j),{code:"",copyable:""},{default:l(()=>[_(u(i.value),1)]),_:1})]),_:1},8,["open","title"])],64))}});export{ee as default};
//# sourceMappingURL=ApiKeys-Bi75RIm1.js.map
