var R=Object.defineProperty,A=Object.defineProperties;var D=Object.getOwnPropertyDescriptors;var C=Object.getOwnPropertySymbols;var T=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable;var h=(o,t,e)=>t in o?R(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,_=(o,t)=>{for(var e in t||(t={}))T.call(t,e)&&h(o,e,t[e]);if(C)for(var e of C(t))$.call(t,e)&&h(o,e,t[e]);return o},x=(o,t)=>A(o,D(t));var B=(o,t,e)=>new Promise((c,p)=>{var y=s=>{try{f(e.next(s))}catch(r){p(r)}},n=s=>{try{f(e.throw(s))}catch(r){p(r)}},f=s=>s.done?c(s.value):Promise.resolve(s.value).then(y,n);f((e=e.apply(o,t)).next())});import{_ as N}from"./Write.vue_vue_type_script_setup_true_lang-CYPIEAap.js";import{_ as I}from"./ContentDetailWrap.vue_vue_type_script_setup_true_lang-BT6PDDaO.js";import{c as S}from"./index-OziN21LA.js";import{l as V,aB as q,aI as E,r as g,ai as M,m as O,M as U,O as d,U as w,S as k,u as m,n as j}from"./vue-chunks-l-AyUCfi.js";import{a as z,u as F,c as G,s as H}from"./index-DDEMnpwQ.js";import{u as J}from"./useEventBus-yN5ROQx3.js";import{o as L}from"./element-plus-C2aeItNs.js";import"./useForm-DFfbRY9m.js";import"./wang-editor-D6T5hJzu.js";import"./tsxHelper-BLTo71S4.js";import"./useValidator-dY8qp_qX.js";import"./message.vue_vue_type_script_setup_true_lang-C0R52Rsd.js";import"./selectFriend.vue_vue_type_script_setup_true_lang-B_XN1vat.js";import"./index-Cl3s0rC0.js";import"./selectRoom.vue_vue_type_script_setup_true_lang-CqEi0UST.js";import"./index-CDMLWrOk.js";import"./selectPromat.vue_vue_type_script_setup_true_lang-CBWPCMhl.js";import"./addPromat.vue_vue_type_style_index_0_lang-B_-MzK0I.js";const pt=V({__name:"operate",props:{type:{type:String,default:"add"},id:{type:Number,default:0}},setup(o){const t=o,{emit:e}=J(),{push:c,go:p}=q();E();const{t:y}=S(),n=g(null);B(this,null,function*(){if(t.type=="add")return;const i=yield z(t.id);i&&(n.value=i,i.type!="contact"?n.value.roomList=i.targets||[]:n.value.friendList=i.targets||[],j(()=>{const a=m(s);a==null||a.init(n.value)}))});const s=g(),r=g(!1),b=()=>B(this,null,function*(){const i=m(s),a=yield i==null?void 0:i.submit();if(a){r.value=!0;let l=null,u=[];a.type!="contact"?u=a.roomList||[]:u=a.friendList||[];const v=L(x(_({},a),{targets:u}),["roomList","friendList"]);t.type=="edit"?l=yield F(_({},v)).catch(()=>{}).finally(()=>{r.value=!1}):t.type=="copy"?l=yield G(L(v,["id"])).catch(()=>{}).finally(()=>{r.value=!1}):l=yield H(v).catch(()=>{}).finally(()=>{r.value=!1}),l&&(e("getList",t.type),c("/aibot/customchat"))}});return(i,a)=>{const l=M("BaseButton");return O(),U(m(I),{title:m(y)("exampleDemo.edit"),onBack:a[1]||(a[1]=u=>m(c)("/example/example-page"))},{header:d(()=>[w(l,{onClick:a[0]||(a[0]=u=>m(p)(-1))},{default:d(()=>[k(" 返回 ")]),_:1}),w(l,{type:"primary",loading:r.value,onClick:b},{default:d(()=>[k(" 保存 ")]),_:1},8,["loading"])]),default:d(()=>[w(N,{ref_key:"writeRef",ref:s,"current-row":n.value},null,8,["current-row"])]),_:1},8,["title"])}}});export{pt as default};
