import{C as g}from"./CrudView-rrsoigo0.js";import{e as x,r as I,i as e,an as C,b as A,aQ as h,aR as D,p as M,h as P,m as s,j as a,w as l,aS as j,k as _,t as u,T,af as V,V as B}from"./jwt-decode.esm-og2W_mys.js";import{a as E}from"./asyncComputed-Pl8A6UUZ.js";import{A as p}from"./apiKey-DGyLY9oH.js";import"./router-C9ojQjj-.js";import{M as N}from"./member-DHGKyfkF.js";import{a as R}from"./project-t7d7Fcqy.js";import"./tables-BDU7F3na.js";import"./DocsButton.vue_vue_type_script_setup_true_lang-ZMVTGi4m.js";import"./constants-DLqQBhqI.js";import"./url-Di0QLUa5.js";import"./PhDotsThreeVertical.vue-DfbvrtyB.js";import"./index--EPiUUke.js";import"./ts.worker-BQuKpghy.js";import"./record-D5CgGTou.js";import"./string-zda83L05.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]="af067a5d-fdb8-4040-94a9-e5d0d86470a9",o._sentryDebugIdIdentifier="sentry-dbid-af067a5d-fdb8-4040-94a9-e5d0d86470a9")}catch{}})();const ee=x({__name:"ApiKeys",setup(o){const i=I(null),m=[{key:"name",label:e.translate("i18n_apikeysview_field_name")}],r=C().params.projectId,y=new N,{loading:f,result:w,refetch:c}=E(async()=>Promise.all([p.list(r),R.get(r).then(t=>y.list(t.organizationId))]).then(([t,n])=>t.map(d=>({apiKey:d,member:n.find(k=>k.authorId===d.ownerId)})))),v=async t=>{const n=await p.create({projectId:r,name:t.name});c(),i.value=n.value},b=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 p.delete(r,t.id),c()}}]}]}))??[]}));return(t,n)=>(P(),M(B,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:b.value,fields:m,create:v},null,8,["entity-name","create-button-text","loading","title","description","empty-title","table"]),s(a(V),{open:!!i.value,title:a(e).translate("i18n_apikeysview_modal_title"),onCancel:n[0]||(n[0]=d=>i.value=null)},{footer:l(()=>[...n[1]||(n[1]=[])]),default:l(()=>[s(a(j),null,{default:l(()=>[_(u(a(e).translate("i18n_apikeysview_modal_description")),1)]),_:1}),s(a(T),{code:"",copyable:""},{default:l(()=>[_(u(i.value),1)]),_:1})]),_:1},8,["open","title"])],64))}});export{ee as default};
//# sourceMappingURL=ApiKeys-Csf5jA0P.js.map
