import{a4 as N,a5 as B,a2 as d,i as R,M as C,P as E,f as F}from"./app-JmgyQoR0.js";import{F as I}from"./section-yxO0GkeZ.js";import{b as S,ad as A,a as s,c as U,h as D,t as P,l as a,j as o,K as t,u as h,E as j,z}from"./vue-y3KLWBaS.js";const K={class:"_formRoot"},L=h("i",{class:"ph-lock ph-bold ph-lg"},null,-1),T={class:"_formBlock",style:{display:"flex",gap:"var(--margin)","flex-wrap":"wrap"}},W=h("i",{class:"ph-check ph-bold ph-lg"},null,-1),J=S({__name:"webhook.edit",props:{webhookId:{}},async setup(g){let m,y;const x=g,u=([m,y]=A(()=>F("i/webhooks/show",{webhookId:x.webhookId})),m=await m,y(),m);let i=s(u.name),r=s(u.url),p=s(u.secret),v=s(u.active),f=s(u.on.includes("follow")),V=s(u.on.includes("followed")),c=s(u.on.includes("note")),k=s(u.on.includes("reply")),_=s(u.on.includes("renote")),w=s(u.on.includes("reaction")),b=s(u.on.includes("mention"));async function M(){const n=[];f.value&&n.push("follow"),V.value&&n.push("followed"),c.value&&n.push("note"),k.value&&n.push("reply"),_.value&&n.push("renote"),w.value&&n.push("reaction"),b.value&&n.push("mention"),E("i/webhooks/update",{name:i.value,url:r.value,secret:p.value,on:n,active:v.value})}return U(()=>[]),U(()=>[]),N({title:"Edit webhook",icon:"ph-webhooks-logo ph-bold ph-lg"}),(n,e)=>(D(),P("div",K,[a(B,{modelValue:i.value,"onUpdate:modelValue":e[0]||(e[0]=l=>i.value=l),class:"_formBlock"},{label:o(()=>[t("Name")]),_:1},8,["modelValue"]),a(B,{modelValue:r.value,"onUpdate:modelValue":e[1]||(e[1]=l=>r.value=l),type:"url",class:"_formBlock"},{label:o(()=>[t("URL")]),_:1},8,["modelValue"]),a(B,{modelValue:p.value,"onUpdate:modelValue":e[2]||(e[2]=l=>p.value=l),class:"_formBlock"},{prefix:o(()=>[L]),label:o(()=>[t("Secret")]),_:1},8,["modelValue"]),a(I,null,{label:o(()=>[t("Events")]),default:o(()=>[a(d,{modelValue:f.value,"onUpdate:modelValue":e[3]||(e[3]=l=>f.value=l),class:"_formBlock"},{default:o(()=>[t("Follow")]),_:1},8,["modelValue"]),a(d,{modelValue:V.value,"onUpdate:modelValue":e[4]||(e[4]=l=>V.value=l),class:"_formBlock"},{default:o(()=>[t("Followed")]),_:1},8,["modelValue"]),a(d,{modelValue:c.value,"onUpdate:modelValue":e[5]||(e[5]=l=>c.value=l),class:"_formBlock"},{default:o(()=>[t("Note")]),_:1},8,["modelValue"]),a(d,{modelValue:k.value,"onUpdate:modelValue":e[6]||(e[6]=l=>k.value=l),class:"_formBlock"},{default:o(()=>[t("Reply")]),_:1},8,["modelValue"]),a(d,{modelValue:_.value,"onUpdate:modelValue":e[7]||(e[7]=l=>_.value=l),class:"_formBlock"},{default:o(()=>[t("Renote")]),_:1},8,["modelValue"]),a(d,{modelValue:w.value,"onUpdate:modelValue":e[8]||(e[8]=l=>w.value=l),class:"_formBlock"},{default:o(()=>[t("Reaction")]),_:1},8,["modelValue"]),a(d,{modelValue:b.value,"onUpdate:modelValue":e[9]||(e[9]=l=>b.value=l),class:"_formBlock"},{default:o(()=>[t("Mention")]),_:1},8,["modelValue"])]),_:1}),a(d,{modelValue:v.value,"onUpdate:modelValue":e[10]||(e[10]=l=>v.value=l),class:"_formBlock"},{default:o(()=>[t("Active")]),_:1},8,["modelValue"]),h("div",T,[a(C,{primary:"",inline:"",onClick:M},{default:o(()=>[W,t(" "+j(z(R).ts.save),1)]),_:1})])]))}});export{J as default};
