import{d as A,Q as E,r as d,o as m,c as b,f as u,B as o,a as t,E as _,k as W,A as k,F as B,R as J,G as M,a2 as T,as as j,at as D,V as K,a8 as q,W as G,K as L,Z as P,__tla as Q}from"./index-92ad187a.js";import{_ as Z,__tla as z}from"./Dialog-44c9fa34.js";import{C as H}from"./constants-c811e5ff.js";import{b as X,D as Y,__tla as $}from"./dict-221f3e01.js";import{g as aa,c as ea,u as la,__tla as ta}from"./index-ca1ef6de.js";import{u as sa,__tla as ra}from"./useMessage-d9788660.js";let g,oa=Promise.all([(()=>{try{return Q}catch{}})(),(()=>{try{return z}catch{}})(),(()=>{try{return $}catch{}})(),(()=>{try{return ta}catch{}})(),(()=>{try{return ra}catch{}})()]).then(async()=>{g=A({name:"WalletChannelForm",__name:"WalletChannelForm",emits:["success"],setup(ua,{expose:V,emit:w}){const{t:f}=E(),p=sa(),n=d(!1),v=d(""),c=d(!1),e=d({appId:"",code:"",status:void 0,feeRate:0,remark:"",config:{name:"mock-conf"}}),C={status:[{required:!0,message:"\u6E20\u9053\u72B6\u6001\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]},i=d();V({open:async(l,a)=>{n.value=!0,c.value=!0,F(l,a);try{const r=await aa(l,a);r&&r.id&&(e.value=r,e.value.config=JSON.parse(r.config)),v.value=e.value.id?"\u7F16\u8F91\u652F\u4ED8\u6E20\u9053":"\u521B\u5EFA\u652F\u4ED8\u6E20\u9053"}finally{c.value=!1}}});const x=w,S=async()=>{if(i&&await i.value.validate()){c.value=!0;try{const l={...e.value};l.config=JSON.stringify(e.value.config),l.id?(await la(l),p.success(f("common.updateSuccess"))):(await ea(l),p.success(f("common.createSuccess"))),n.value=!1,x("success")}finally{c.value=!1}}},F=(l,a)=>{var r;e.value={appId:l,code:a,status:H.ENABLE,remark:"",feeRate:0,config:{name:"mock-conf"}},(r=i.value)==null||r.resetFields()};return(l,a)=>{const r=j,I=D,y=K,R=q,N=G,h=L,O=Z,U=P;return m(),b("div",null,[u(O,{modelValue:t(n),"onUpdate:modelValue":a[3]||(a[3]=s=>T(n)?n.value=s:null),title:t(v),onClosed:l.close,width:"800px"},{footer:o(()=>[u(h,{disabled:t(c),type:"primary",onClick:S},{default:o(()=>[_("\u786E \u5B9A")]),_:1},8,["disabled"]),u(h,{onClick:a[2]||(a[2]=s=>n.value=!1)},{default:o(()=>[_("\u53D6 \u6D88")]),_:1})]),default:o(()=>[W((m(),k(N,{ref_key:"formRef",ref:i,model:t(e),rules:C,"label-width":"100px"},{default:o(()=>[u(y,{"label-width":"180px",label:"\u6E20\u9053\u72B6\u6001",prop:"status"},{default:o(()=>[u(I,{modelValue:t(e).status,"onUpdate:modelValue":a[0]||(a[0]=s=>t(e).status=s)},{default:o(()=>[(m(!0),b(B,null,J(t(X)(t(Y).COMMON_STATUS),s=>(m(),k(r,{key:parseInt(s.value),label:parseInt(s.value)},{default:o(()=>[_(M(s.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1}),u(y,{"label-width":"180px",label:"\u5907\u6CE8",prop:"remark"},{default:o(()=>[u(R,{modelValue:t(e).remark,"onUpdate:modelValue":a[1]||(a[1]=s=>t(e).remark=s),style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])),[[U,t(c)]])]),_:1},8,["modelValue","title","onClosed"])])}}})});export{g as _,oa as __tla};
