1import{aj as w,a5 as I,a2 as B,$ as F,d as S,o as y,f as v,e as i,t as x,ag as j,ad as H,w as t,b as s,q as _,g as h,h as C,i as z,D as T,L as E,T as O,r as K,u as N,B as q,C as L,c as R,a4 as W}from"./CIdpLQwD.js";import{_ as M}from"./jHTfN-vg.js";import{_ as Y}from"./DjEqRkPe.js";import{_ as Z}from"./DP64_T6c.js";import{f as G}from"./DR5zOtHK.js";import{_ as J}from"./Pd-Fxry8.js";import{_ as Q}from"./Bj7tDWXM.js";import{_ as X}from"./YvckqJO0.js";import{_ as ee}from"./BQ2BwNfE.js";import{c as U,v as te}from"./CoCvJ9F4.js";import{a as $,m as ne}from"./CUSSiNY4.js";import{D as se}from"./DO6Jo_M6.js";import{_ as oe}from"./1E80kbW-.js";import"./D5ArSJWR.js";import"./BKKDfau0.js";import"./B8t1wytl.js";import"./DPKbA1DQ.js";import"./_-Po-rS8.js";import"./Ca60vlf1.js";import"./CPritXKW.js";import"./BIYJaGt7.js";import"./BkSpKr3M.js";import"./DqM1xwCv.js";import"./B_GJh_6j.js";import"./Z1AwCsQE.js";import"./BIWhm_QI.js";import"./Dlzc5NbE.js";import"./DjyoiwTB.js";import"./Bw6vnHKQ.js";import"./BmElZo1T.js";import"./Xt796qFe.js";import"./B-d5qxIQ.js";function ae(){const r=w("apiKeys");return I("useSettingsApi",async()=>{const{result:a}=await r.fetchPost("/list");return a},{api_keys:[]},{watchEvents:["SettingsApiKeysUpdated"]})}function ie(r){const a=w("apiKeys");return I(null,async()=>{const{result:e}=await a.fetchPost("/create",F(r));return e},null,{immediate:!1})}function re(r){const a=w("apiKeys"),e=B();return I(null,async()=>a.fetchPost("/delete",F(r)),null,{immediate:!1,onSuccess:{callback(){e.add({message:"Api Key Deleted"})},emit:["SettingsApiKeysUpdated"]}})}const ce=S({__name:"ActionsSettingsApiKey",props:{apiKey:{}},setup(r){const e=re({api_key_id:r.apiKey.id}),d=x(()=>[{icon:"deleteIcon",text:"Delete",onClick:e.execute,loading:e.pending.value}]);return(c,p)=>{const o=M;return y(),v(o,{items:i(d)},null,8,["items"])}}}),le=Object.assign(ce,{__name:"ActionsSettingsApiKey"}),pe={class:"zent-stack zent-stack_center"},me=S({__name:"TableSettingsApiKeys",emits:["create"],setup(r,{emit:a}){const e=a,d=j({sort:[],headers:[{title:"API Key Description",key:"description"},{title:"Access Key",key:"access_key"},{title:"IP Whitelist",key:"ip_whitelist"},{title:"Created At",key:"created_at",transform:G}],enabledHeaders:[],sortedHeaders:H("settingsApiKeys.table.sortedHeaders",()=>[])}),c=ae();return(p,o)=>{const g=le,u=z,n=h,A=Y,l=Z;return y(),v(l,{headers:i(d).headers,rows:i(c).data.value.api_keys,"row-key":"id",loading:i(c).pending.value,"extra-fit":"","sorted-headers":i(d).sortedHeaders,"onUpdate:sortedHeaders":o[1]||(o[1]=f=>i(d).sortedHeaders=f),draggable:""},{"body-cell-ip_whitelist":t(({row:f})=>[C(T(f.allowed_ips?.join(", ")||"-"),1)]),extra:t(({row:f})=>[s(g,{"api-key":f},null,8,["api-key"])]),empty:t(()=>[s(A,{title:"No API Keys created"},{description:t(()=>[_("div",pe,[s(n,{size:"small",onClick:o[0]||(o[0]=f=>e("create"))},{"left-icon":t(()=>[s(u,{name:"plus"})]),default:t(()=>[o[2]||(o[2]=C(" Create API Key ",-1))]),_:1})])]),_:1})]),_:1},8,["headers","rows","loading","sorted-headers"])}}}),_e=Object.assign(me,{__name:"TableSettingsApiKeys"}),de={class:"zent-stack zent-stack_offset-24"},ue={class:"zent-stack zent-stack_offset-12",style:{"word-break":"break-word"}},fe={class:"zent-stack zent-stack_row zent-stack_offset-4 zent-tx-color-gray"},ye={class:"zent-box-size-16"},ge={class:"zent-stack zent-stack_offset-4"},ve=S({__name:"FormSettingsApiKeyCreate",props:{isCreated:{type:Boolean},confirmationData:{}},emits:["success","close"],setup(r,{emit:a}){const e=a,d=K(),c={description:"",allowed_ips:""},p=K({...c}),o=ie(x(()=>({...p.value,allowed_ips:U(p.value.allowed_ips)})));async function g(){await o.execute(),o.error.value||e("success",o.data.value)}return(u,n)=>{const A=J,l=Q,f=z,D=h,P=X,b=ee;return y(),v(O,{name:"fade",mode:"out-in"},{default:t(()=>[r.isCreated?(y(),v(P,{key:0},{header:t(()=>[s(A,{title:"API Key Details"})]),actions:t(()=>[s(D,{"full-width":"",onClick:n[0]||(n[0]=m=>e("close"))},{default:t(()=>[...n[4]||(n[4]=[C(" Done ",-1)])]),_:1})]),default:t(()=>[_("div",de,[_("div",ue,[s(l,{value:r.confirmationData?.data?.description,placeholder:"API Key Description"},null,8,["value"]),s(l,{value:r.confirmationData?.data?.access_key,placeholder:"Access Key","with-copy":""},null,8,["value"]),s(l,{value:r.confirmationData?.data?.secret_key,placeholder:"Secret Key","with-copy":""},null,8,["value"])]),_("div",fe,[_("div",ye,[s(f,{name:"info"})]),n[3]||(n[3]=_("div",{class:"zent-text-12"}," Please save the Secret Key now. You cannot access it after closing this page. ",-1))])])]),_:1})):(y(),v(P,{key:1,ref_key:"form",ref:d,modelValue:i(p),"onUpdate:modelValue":n[1]||(n[1]=m=>E(p)?p.value=m:null),form:c,"validation-schema":{description:i($)().required(i(ne).required).max(250),allowed_ips:i($)().test({test:m=>("splitIpString"in u?u.splitIpString:i(U))(m||"").every(k=>("validateIp"in u?u.validateIp:i(te))(k)),message:"IP address is not correct"})},onClose:n[2]||(n[2]=m=>e("close"))},{header:t(()=>[s(A,{title:"Create API Key"})]),"field-description":t(({field:m})=>[s(b,{modelValue:m.value.value,"onUpdate:modelValue":k=>m.value.value=k,placeholder:"API Key Description"},null,8,["modelValue","onUpdate:modelValue"])]),"field-allowed_ips":t(({field:m})=>[_("div",ge,[s(b,{modelValue:m.value.value,"onUpdate:modelValue":k=>m.value.value=k,placeholder:"Allowed IPs"},null,8,["modelValue","onUpdate:modelValue"]),n[5]||(n[5]=_("div",{class:"zent-text-10 zent-tx-color-gray"}," Enter a list of IPs separated by comma ",-1))])]),actions:t(({submit:m})=>[s(D,{"full-width":"",loading:i(o).pending.value,onClick:k=>m(g)},{default:t(()=>[...n[6]||(n[6]=[C(" Create ",-1)])]),_:1},8,["loading","onClick"])]),_:1},8,["modelValue","validation-schema"]))]),_:1})}}}),V=Object.assign(ve,{__name:"FormSettingsApiKeyCreate"}),Ae=S({__name:"StepsFormSettingsApiKeyCreate",emits:["success","close"],setup(r,{emit:a}){const e=a,d=B(),c=L(V),p=K({}),o=N(),g=K(!1),u=()=>{e("close")},n=async l=>{if(l?.data&&(p.value={...l?.authentication?.task,confirmation_method:l?.authentication?.task?.authentication_method,data:l?.data}),l?.authentication?.required&&l?.authentication?.task!==null&&l?.authentication?.task?.authentication_method!=="none"&&!l?.confirmed){c.value=se;return}A()},A=async()=>{g.value=!0,c.value=V,d.add({message:"Api Key Created"}),o.emit("SettingsApiKeysUpdated")};return(l,f)=>(y(),v(O,{name:"fade",mode:"out-in"},{default:t(()=>[(y(),v(q(i(c)),{"confirmation-data":i(p),"is-created":i(g),onClose:u,onSuccess:n},null,40,["confirmation-data","is-created"]))]),_:1}))}}),ke=Object.assign(Ae,{__name:"StepsFormSettingsApiKeyCreate"}),Ke=S({__name:"PageDrawerSettingsApiKeyCreate",setup(r,{expose:a}){const e=K();return a({open:()=>e.value?.open(),close:()=>e.value?.close(),isOpened:x(()=>e.value?.isOpened)}),(d,c)=>{const p=ke;return y(),v(i(oe),{ref_key:"drawer",ref:e},{default:t(({close:o})=>[s(p,{onClose:o},null,8,["onClose"])]),_:1},512)}}}),Se=Object.assign(Ke,{__name:"PageDrawerSettingsApiKeyCreate"}),Ce={class:"zent-stack zent-stack_offset-24"},we={class:"zent-stack zent-stack_row zent-stack_between zent-stack_center"}
1,st=S({__name:"api",setup(r){const a=K();function e(){a.value?.open()}return(d,c)=>{const p=z,o=h,g=_e,u=W,n=Se;return y(),R("div",null,[_("div",Ce,[_("div",we,[c[1]||(c[1]=_("div",{class:"zent-text-16 zent-text-medium"}," API Key Management ",-1)),_("div",null,[s(o,{size:"small",onClick:e},{"left-icon":t(()=>[s(p,{name:"plus"})]),default:t(()=>[c[0]||(c[0]=C(" Create API Key ",-1))]),_:1})])]),_("div",null,[s(u,null,{default:t(()=>[s(g,{onCreate:e})]),_:1})])]),s(n,{ref_key:"drawerSettingsApiKeyCreate",ref:a},null,512)])}}});export{st as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.