"use strict";const e=require("../../../../common/vendor.js");require("../../../adapter-vue.js");const a=require("../../common/Toast/index.js"),t=require("../server.js"),r=require("../../common/Toast/type.js");Math||s();const s=()=>"../../common/SelectUser/index.js",n=e.defineComponent({__name:"index",setup(s){const n=t.TUIContactServer.getInstance(),o=n.constants,i=e.ref(!1),c=e.ref([]),u=e.ref([]),l=e.ref(null),d=e.ref({isRadio:!1,isNeedSearch:!1,title:""});e.watchEffect((()=>{const a=n.getOnCallParams(o.TUIContact.SERVICE.METHOD.SELECT_FRIEND);var t;d.value.title=a.title,d.value.isRadio=a.isRadio,d.value.isNeedSearch=a.isNeedSearch,a.isNeedSearch&&(t=a.isNeedSearch,l.value=e.R.getService(o.TUISearch.SERVICE.NAME),l.value?i.value=t:console.warn("请添加 TUISearch 组件")),e.ts.getFriendList().then((e=>{c.value=e.data.map((e=>e.profile)),u.value=c.value})).catch((e=>{console.warn("getFriendList error:",e)}))}));const v=a=>{e.Jt.update(e.o.CUSTOM,"isShowSelectFriendComponent",!1);const t=n.getOnCallCallback(o.TUIContact.SERVICE.METHOD.SELECT_FRIEND);t&&t(a)},S=()=>{a.Toast({message:e.Wt.t("TUIGroup.该用户不存在"),type:r.TOAST_TYPE.ERROR}),u.value=[...c.value]},E=async e=>{if(!e)return u.value=c.value;try{const a=await l.value.searchUser(e);if(!a.data[0])return S();u.value=a.data;const t=c.value.filter((e=>e.userID===a.data[0].userID));c.value=t.length?c.value:[...c.value,...u.value]}catch(a){return S()}};return(a,t)=>({a:e.o$1(E),b:e.o$1(v),c:e.p({isRadio:e.unref(d).isRadio,isNeedSearch:e.unref(d).isNeedSearch,title:e.unref(d).title,userList:e.unref(u)})})}});wx.createComponent(n);
