Files
weiyu/deploy/server/admin/9210.38154c0c.async.js
jack ning e89a80b135 update
2025-11-04 09:26:36 +08:00

1 line
61 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use strict";(self.webpackChunkadmin=self.webpackChunkadmin||[]).push([[9210],{18313:function(e,t,n){n.d(t,{IH:function(){return v},RB:function(){return w},SJ:function(){return m},Xy:function(){return y},iO:function(){return x},u9:function(){return c},wU:function(){return S}});var i=n(90819),r=n.n(i),s=n(73193),o=n.n(s),a=n(89933),l=n.n(a),u=n(68992),d=n(62395);function c(e){return g.apply(this,arguments)}function g(){return(g=l()(r()().mark((function e(t){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/agent/settings/query/org",{method:"GET",params:o()(o()({},t),{},{channel:u.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function v(e){return f.apply(this,arguments)}function f(){return(f=l()(r()().mark((function e(t){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/agent/settings/create",{method:"POST",data:o()(o()({},t),{},{channel:u.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function S(e){return p.apply(this,arguments)}function p(){return(p=l()(r()().mark((function e(t){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/agent/settings/update",{method:"POST",data:o()(o()({},t),{},{channel:u.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function m(e){return h.apply(this,arguments)}function h(){return(h=l()(r()().mark((function e(t){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/agent/settings/delete",{method:"POST",data:o()(o()({},t),{},{channel:u.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function w(e){return b.apply(this,arguments)}function b(){return(b=l()(r()().mark((function e(t){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/agent/settings/enable",{method:"POST",data:o()(o()({},t),{},{channel:u.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function x(e){return k.apply(this,arguments)}function k(){return(k=l()(r()().mark((function e(t){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/agent/settings/disable",{method:"POST",data:o()(o()({},t),{},{channel:u.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function y(e){return U.apply(this,arguments)}function U(){return(U=l()(r()().mark((function e(t){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/agent/settings/publish",{method:"POST",data:o()(o()({},t),{},{channel:u.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},34203:function(e,t,n){n.d(t,{Dm:function(){return w},Y2:function(){return S},jT:function(){return v},zN:function(){return m},zc:function(){return c}});var i=n(90819),r=n.n(i),s=n(73193),o=n.n(s),a=n(89933),l=n.n(a),u=n(68992),d=n(62395);function c(e){return g.apply(this,arguments)}function g(){return(g=l()(r()().mark((function e(t){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/workgroup/settings/query/org",{method:"GET",params:o()(o()({},t),{},{channel:u.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function v(e){return f.apply(this,arguments)}function f(){return(f=l()(r()().mark((function e(t){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/workgroup/settings/create",{method:"POST",data:o()(o()({},t),{},{channel:u.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function S(e){return p.apply(this,arguments)}function p(){return(p=l()(r()().mark((function e(t){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/workgroup/settings/update",{method:"POST",data:o()(o()({},t),{},{channel:u.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function m(e){return h.apply(this,arguments)}function h(){return(h=l()(r()().mark((function e(t){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/workgroup/settings/delete",{method:"POST",data:o()(o()({},t),{},{channel:u.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function w(e){return b.apply(this,arguments)}function b(){return(b=l()(r()().mark((function e(t){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.request)("/api/v1/workgroup/settings/publish",{method:"POST",data:o()(o()({},t),{},{channel:u.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},98257:function(e,t,n){n(90819),n(89933),n(73193),n(45332),n(18313),n(90170),n(34203),n(66675),n(48388),n(81997),n(68992),n(62395),n(44194),n(85684),n(91733),n(83262),n(31549)},84005:function(e,t,n){var i=n(73193),r=n.n(i),s=n(90819),o=n.n(s),a=n(89933),l=n.n(a),u=n(45332),d=n.n(u),c=n(91733),g=n(68992),v=n(18313),f=n(90170),S=n(34203),p=(n(62134),n(89007)),m=n(59853),h=n(62395),w=n(44194),b=(n(91743),n(99754)),x=n(31549);t.Z=function(e){var t=e.type,n=(0,h.useIntl)(),i=p.A.useForm(),s=d()(i,1)[0],a=(0,b.Z)().translateString,u=(0,w.useState)(!1),k=d()(u,2),y=(k[0],k[1]),U=(0,w.useState)(""),j=d()(U,2),q=(j[0],j[1]),C=(0,c.z)((function(e){return{currentRobotSettings:e.currentRobotSettings,currentAgentSettings:e.currentAgentSettings,currentWorkgroupSettings:e.currentWorkgroupSettings,setCurrentRobotSettings:e.setCurrentRobotSettings,setCurrentAgentSettings:e.setCurrentAgentSettings,setCurrentWorkgroupSettings:e.setCurrentWorkgroupSettings}})),T=C.currentRobotSettings,R=C.currentAgentSettings,F=C.currentWorkgroupSettings,A=C.setCurrentRobotSettings,M=C.setCurrentAgentSettings,Z=C.setCurrentWorkgroupSettings,N=(0,w.useState)(!1),X=d()(N,2),K=X[0],_=X[1];(0,w.useEffect)((function(){var e,n,i,r;if(t===g.Njn)s.setFieldValue("showRateBtn",null==R||null===(e=R.serviceSettings)||void 0===e?void 0:e.showRateBtn),s.setFieldValue("autoInviteRate",null==R||null===(n=R.serviceSettings)||void 0===n?void 0:n.autoInviteRate),q(a(null==R||null===(i=R.serviceSettings)||void 0===i?void 0:i.inviteRateTip)),y(!(null==R||null===(r=R.serviceSettings)||void 0===r||!r.showRateBtn));else if(t===g.aZD){var o,l,u,d;s.setFieldValue("showRateBtn",null==F||null===(o=F.serviceSettings)||void 0===o?void 0:o.showRateBtn),s.setFieldValue("autoInviteRate",null==F||null===(l=F.serviceSettings)||void 0===l?void 0:l.autoInviteRate),q(a(null==F||null===(u=F.serviceSettings)||void 0===u?void 0:u.inviteRateTip)),y(!(null==F||null===(d=F.serviceSettings)||void 0===d||!d.showRateBtn))}else if(t===g._X4){var c,v,f,S;s.setFieldValue("showRateBtn",null==T||null===(c=T.serviceSettings)||void 0===c?void 0:c.showRateBtn),s.setFieldValue("autoInviteRate",null==T||null===(v=T.serviceSettings)||void 0===v?void 0:v.autoInviteRate),q(a(null==T||null===(f=T.serviceSettings)||void 0===f?void 0:f.inviteRateTip)),y(!(null==T||null===(S=T.serviceSettings)||void 0===S||!S.showRateBtn))}}),[null==T?void 0:T.uid,null==R?void 0:R.uid,null==F?void 0:F.uid]);var I=function(){var e=l()(o()().mark((function e(t){return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("onFinish:",t);case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),W=function(){var e=l()(o()().mark((function e(n){var i;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(console.log("TabRating handleChange autoInviteRate",n),s.setFieldValue("autoInviteRate",n),i={autoInviteRate:n},t===g.Njn&&R?M(r()(r()({},R),{},{serviceSettings:r()(r()({},R.serviceSettings),i),draftServiceSettings:r()(r()({},R.draftServiceSettings||{}),i)})):t===g._X4&&T?A(r()(r()({},T),{},{serviceSettings:r()(r()({},T.serviceSettings),i),draftServiceSettings:r()(r()({},T.draftServiceSettings||{}),i)})):t===g.aZD&&F&&Z(r()(r()({},F),{},{serviceSettings:r()(r()({},F.serviceSettings),i),draftServiceSettings:r()(r()({},F.draftServiceSettings||{}),i)})),e.prev=4,_(!0),t!==g.Njn||null==R||!R.uid){e.next=11;break}return e.next=9,(0,v.wU)({uid:R.uid,serviceSettings:i});case 9:e.next=19;break;case 11:if(t!==g._X4||null==T||!T.uid){e.next=16;break}return e.next=14,(0,f.sK)({uid:T.uid,serviceSettings:i});case 14:e.next=19;break;case 16:if(t!==g.aZD||null==F||!F.uid){e.next=19;break}return e.next=19,(0,S.Y2)({uid:F.uid,serviceSettings:i});case 19:e.next=24;break;case 21:e.prev=21,e.t0=e.catch(4),console.warn("autoInviteRate 即时保存失败(忽略):",e.t0);case 24:return e.prev=24,_(!1),e.finish(24);case 27:case"end":return e.stop()}}),e,null,[[4,21,24,27]])})));return function(t){return e.apply(this,arguments)}}();return(0,x.jsx)(x.Fragment,{children:(0,x.jsxs)(p.A,{form:s,onFinish:I,submitter:!1,style:{marginLeft:"20px"},children:[(0,x.jsx)(m.Z,{width:"md",name:"autoInviteRate",label:n.formatMessage({id:"rate.auto.invite.rate"}),tooltip:n.formatMessage({id:"rate.auto.invite.rate.tooltip"}),fieldProps:{onChange:W,disabled:K}}),!1]})})}},30394:function(e,t,n){var i=n(73193),r=n.n(i),s=n(90819),o=n.n(s),a=n(89933),l=n.n(a),u=n(45332),d=n.n(u),c=n(61489),g=n(18313),v=n(90170),f=n(34203),S=n(72309),p=n(54008),m=n(66675),h=n(48388),w=n(81997),b=n(91733),x=n(77686),k=n(99754),y=n(68992),U=n(89007),j=n(59853),q=n(47268),C=n(50447),T=n(62395),R=n(44194),F=n(88130),A=n(44528),M=n(78380),Z=n(70378),N=n(4308),X=n(82325),K=n(87005),_=n(83262),I=n(6677),W=n(94571),L=n(44635),D=n(31549);t.Z=function(e){var t,n,i,s,a,u,V,P,E=e.type,z=e.settingsUid,O=e.isActive,B=void 0===O||O,J=(0,T.useIntl)(),Q=U.A.useForm(),Y=d()(Q,1)[0],$=(0,x.u)((function(e){return e.currentOrg})),H=(0,k.Z)().translateString,G=(0,R.useState)(),ee=d()(G,2),te=ee[0],ne=ee[1],ie=(0,R.useState)(),re=d()(ie,2),se=re[0],oe=re[1],ae=(0,R.useState)(),le=d()(ae,2),ue=le[0],de=le[1],ce=(0,R.useState)("iframe"),ge=d()(ce,2),ve=ge[0],fe=ge[1],Se=(0,R.useState)(0),pe=d()(Se,2),me=pe[0],he=pe[1],we=(0,R.useState)(!1),be=d()(we,2),xe=be[0],ke=be[1],ye=(0,R.useRef)(Promise.resolve()),Ue=(0,R.useState)("desktop"),je=d()(Ue,2),qe=je[0],Ce=je[1],Te=(0,R.useState)(),Re=d()(Te,2),Fe=Re[0],Ae=Re[1],Me=(0,R.useState)(),Ze=d()(Me,2),Ne=Ze[0],Xe=Ze[1],Ke=(0,R.useState)(),_e=d()(Ke,2),Ie=_e[0],We=_e[1],Le=(0,R.useCallback)((function(){var e=(null==$?void 0:$.uid)||"unknown",t=E===y.Njn?"agent":E===y._X4?"robot":"workgroup";return"admin.preview.selected.".concat(t,".").concat(e)}),[null==$?void 0:$.uid,E]),De=(0,R.useCallback)((function(){try{return localStorage.getItem(Le())||void 0}catch(e){return}}),[Le]),Ve=(0,R.useCallback)((function(e){try{var t=Le();e?localStorage.setItem(t,e):localStorage.removeItem(t)}catch(e){}}),[Le]),Pe=(0,h.V)((function(e){return{robotResult:e.robotResult,setRobotResult:e.setRobotResult}})),Ee=Pe.robotResult,ze=Pe.setRobotResult,Oe=(0,m.E)((function(e){return{agentResult:e.agentResult,setAgentResult:e.setAgentResult}})),Be=Oe.agentResult,Je=Oe.setAgentResult,Qe=(0,w.$)((function(e){return{workgroupResult:e.workgroupResult,setWorkgroupResult:e.setWorkgroupResult}})),Ye=Qe.workgroupResult,$e=Qe.setWorkgroupResult,He=(0,b.z)((function(e){return{currentRobotSettings:e.currentRobotSettings,currentAgentSettings:e.currentAgentSettings,currentWorkgroupSettings:e.currentWorkgroupSettings,setCurrentRobotSettings:e.setCurrentRobotSettings,setCurrentAgentSettings:e.setCurrentAgentSettings,setCurrentWorkgroupSettings:e.setCurrentWorkgroupSettings}})),Ge=He.currentRobotSettings,et=He.currentAgentSettings,tt=He.currentWorkgroupSettings,nt=He.setCurrentRobotSettings,it=He.setCurrentAgentSettings,rt=He.setCurrentWorkgroupSettings,st=(0,R.useCallback)(function(){var e=l()(o()().mark((function e(t){return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ye.current=ye.current.then(l()(o()().mark((function e(){return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ke(!0),e.prev=1,E!==y.Njn||!et){e.next=7;break}return e.next=5,(0,g.wU)({uid:et.uid,serviceSettings:t});case 5:case 10:e.next=15;break;case 7:if(E!==y._X4||!Ge){e.next=12;break}return e.next=10,(0,v.sK)({uid:Ge.uid,serviceSettings:t});case 12:if(E!==y.aZD||!tt){e.next=15;break}return e.next=15,(0,f.Y2)({uid:tt.uid,serviceSettings:t});case 15:return e.prev=15,ke(!1),e.finish(15);case 18:case"end":return e.stop()}}),e,null,[[1,,15,18]])})))),e.abrupt("return",ye.current);case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[E,et,Ge,tt]),ot=(0,R.useMemo)((function(){if(E===y._X4){var e,t=Fe||(null==Ee||null===(e=Ee.data)||void 0===e||null===(e=e.content)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.uid)||"";return{chatType:y.ACv,chatSid:t}}if(E===y.Njn){var n,i=Ne||(null==Be||null===(n=Be.data)||void 0===n||null===(n=n.content)||void 0===n||null===(n=n[0])||void 0===n?void 0:n.uid)||"";return{chatType:y._0X,chatSid:i}}if(E===y.aZD){var r,s=Ie||(null==Ye||null===(r=Ye.data)||void 0===r||null===(r=r.content)||void 0===r||null===(r=r[0])||void 0===r?void 0:r.uid)||"";return{chatType:y.I$6,chatSid:s}}return{chatType:y.ACv,chatSid:""}}),[E,Fe,null==Ee||null===(t=Ee.data)||void 0===t?void 0:t.content,Ne,null==Be||null===(n=Be.data)||void 0===n?void 0:n.content,Ie,null==Ye||null===(i=Ye.data)||void 0===i?void 0:i.content]),at=ot.chatType,lt=ot.chatSid,ut=function(){var e=l()(o()().mark((function e(){var t,n,i,r,s,a,l;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c.yw.loading(J.formatMessage({id:"loading",defaultMessage:"Loading"})),t={pageNumber:0,pageSize:50,type:y.QPQ,orgUid:null==$?void 0:$.uid},e.prev=2,e.next=5,(0,p.AP)(t);case 5:n=e.sent,console.log("TabRight.getKbases response:",t,n),c.yw.destroy(),200===n.code?(r={code:n.code,message:n.message,data:{content:n.data.content.map((function(e){return{uid:e.uid,name:e.name,type:e.type,orgUid:e.orgUid}})),totalElements:n.data.totalElements,totalPages:n.data.totalPages,number:n.data.number}},oe(r),a=E===y._X4?null==Ge?void 0:Ge.draftServiceSettings:E===y.Njn?null==et?void 0:et.draftServiceSettings:null==tt?void 0:tt.draftServiceSettings,l=E===y._X4?null==Ge?void 0:Ge.serviceSettings:E===y.Njn?null==et?void 0:et.serviceSettings:null==tt?void 0:tt.serviceSettings,null!=a&&a.faqKbUid?s=a.faqKbUid:null!=l&&l.faqKbUid?s=l.faqKbUid:(null===(i=r.data)||void 0===i||null===(i=i.content)||void 0===i?void 0:i.length)>0&&(s=r.data.content[0].uid),s&&(de(s),Y.setFieldValue("faqKbUid",s),dt(s))):c.yw.error(n.message),e.next=16;break;case 11:e.prev=11,e.t0=e.catch(2),c.yw.destroy(),console.error("TabRight 获取知识库失败:",e.t0),c.yw.error("获取知识库失败");case 16:case"end":return e.stop()}}),e,null,[[2,11]])})));return function(){return e.apply(this,arguments)}}(),dt=function(){var e=l()(o()().mark((function e(t){var n,i,r,s,a,l,u,d;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t||ue){e.next=4;break}return console.log("TabRight: 没有选择知识库无法获取FAQ"),ne(void 0),e.abrupt("return");case 4:return c.yw.loading(J.formatMessage({id:"loading",defaultMessage:"Loading"})),n={pageNumber:0,pageSize:100,orgUid:null==$?void 0:$.uid,kbUid:t||ue},e.prev=6,e.next=9,(0,S.pf)(n);case 9:i=e.sent,console.log("TabRight.getFaqs response:",n,i),c.yw.destroy(),200===i.code?(r={code:i.code,message:i.message,data:{content:i.data.content.map((function(e){return{uid:e.uid,question:e.question,answer:e.answer,kbUid:e.kbUid,orgUid:e.orgUid}})),totalElements:i.data.totalElements,totalPages:i.data.totalPages,number:i.data.number}},ne(r),s=t||ue,a=Y.getFieldValue("faqUids")||[],s&&a.length>0&&(u=(null===(l=r.data.content)||void 0===l?void 0:l.map((function(e){return e.uid})))||[],(d=a.filter((function(e){return u.includes(e)}))).length!==a.length&&Y.setFieldValue("faqUids",d))):c.yw.error(i.message),e.next=20;break;case 15:e.prev=15,e.t0=e.catch(6),c.yw.destroy(),console.error("TabRight 获取FAQ失败:",e.t0),c.yw.error("获取FAQ失败");case 20:case"end":return e.stop()}}),e,null,[[6,15]])})));return function(t){return e.apply(this,arguments)}}();(0,R.useEffect)((function(){if(E===y._X4){var e=(null==Ge?void 0:Ge.draftServiceSettings)||(null==Ge?void 0:Ge.serviceSettings),t=null==e?void 0:e.showRightIframe,n=null==e?void 0:e.showFaqs;Y.setFieldsValue({showRightIframe:t,rightIframeUrl:null==e?void 0:e.rightIframeUrl,showFaqs:n,faqKbUid:null==e?void 0:e.faqKbUid,faqUids:Array.isArray(null==e?void 0:e.faqUids)?null==e?void 0:e.faqUids:Array.isArray(null==e?void 0:e.faqs)?(null==e?void 0:e.faqs).map((function(e){return null==e?void 0:e.uid})).filter(Boolean):[]})}else if(E===y.Njn){var i=(null==et?void 0:et.draftServiceSettings)||(null==et?void 0:et.serviceSettings),r=null==i?void 0:i.showRightIframe,s=null==i?void 0:i.showFaqs;Y.setFieldsValue({showRightIframe:r,rightIframeUrl:null==i?void 0:i.rightIframeUrl,showFaqs:s,faqKbUid:null==i?void 0:i.faqKbUid,faqUids:Array.isArray(null==i?void 0:i.faqUids)?null==i?void 0:i.faqUids:Array.isArray(null==i?void 0:i.faqs)?(null==i?void 0:i.faqs).map((function(e){return null==e?void 0:e.uid})).filter(Boolean):[]})}else if(E===y.aZD){var o=(null==tt?void 0:tt.draftServiceSettings)||(null==tt?void 0:tt.serviceSettings),a=null==o?void 0:o.showRightIframe,l=null==o?void 0:o.showFaqs;Y.setFieldsValue({showRightIframe:a,rightIframeUrl:null==o?void 0:o.rightIframeUrl,showFaqs:l,faqKbUid:null==o?void 0:o.faqKbUid,faqUids:Array.isArray(null==o?void 0:o.faqUids)?null==o?void 0:o.faqUids:Array.isArray(null==o?void 0:o.faqs)?(null==o?void 0:o.faqs).map((function(e){return null==e?void 0:e.uid})).filter(Boolean):[]})}}),[Ge,et,tt,at,lt,null==$?void 0:$.uid]),(0,R.useEffect)((function(){null!=$&&$.uid&&ut()}),[null==$?void 0:$.uid,E]),(0,R.useEffect)((function(){var e=function(){var e=l()(o()().mark((function e(){var t,n,i,r,s,a,l,u,d,c,g,v,f,S,p,m,h,w,b,x,k;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=$&&$.uid){e.next=2;break}return e.abrupt("return");case 2:if(e.prev=2,E!==y.Njn){e.next=11;break}return t={pageNumber:0,pageSize:100,orgUid:$.uid},e.next=7,(0,I._t)(t);case 7:200===(n=e.sent).code&&(Je(n),r=(null===(i=n.data)||void 0===i?void 0:i.content)||[],s=De(),(a=s?r.find((function(e){return(null==e?void 0:e.uid)===s})):void 0)?Xe(a.uid):!Ne&&r.length&&(l=r[0],Xe(null==l?void 0:l.uid),Ve(null==l?void 0:l.uid))),e.next=25;break;case 11:if(E!==y._X4){e.next=19;break}return u={pageNumber:0,pageSize:100,level:y.whQ,type:y.f4h,orgUid:$.uid},e.next=15,(0,W.p0)(u);case 15:200===(d=e.sent).code&&(ze(d),g=(null===(c=d.data)||void 0===c?void 0:c.content)||[],v=De(),(f=v?g.find((function(e){return(null==e?void 0:e.uid)===v})):void 0)?Ae(f.uid):!Fe&&g.length&&(S=g[0],Ae(null==S?void 0:S.uid),Ve(null==S?void 0:S.uid))),e.next=25;break;case 19:if(E!==y.aZD){e.next=25;break}return p={pageNumber:0,pageSize:100,orgUid:$.uid},e.next=23,(0,L.LE)(p);case 23:200===(m=e.sent).code&&($e(m),w=(null===(h=m.data)||void 0===h?void 0:h.content)||[],b=De(),(x=b?w.find((function(e){return(null==e?void 0:e.uid)===b})):void 0)?We(x.uid):!Ie&&w.length&&(k=w[0],We(null==k?void 0:k.uid),Ve(null==k?void 0:k.uid)));case 25:e.next=30;break;case 27:e.prev=27,e.t0=e.catch(2),console.warn("加载预览实体失败(忽略):",e.t0);case 30:case"end":return e.stop()}}),e,null,[[2,27]])})));return function(){return e.apply(this,arguments)}}();e()}),[null==$?void 0:$.uid,E,Je,ze,$e,Ne,Fe,Ie,De,Ve]),(0,R.useEffect)((function(){void 0!==z&&gt("switch-settings")}),[z]);var ct=function(){var e=l()(o()().mark((function e(){var t,n;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(E===y.Njn?null==et?void 0:et.uid:E===y._X4?null==Ge?void 0:Ge.uid:null==tt?void 0:tt.uid){e.next=3;break}return e.abrupt("return",!0);case 3:return e.prev=3,e.next=6,Y.validateFields();case 6:e.next=12;break;case 8:return e.prev=8,e.t0=e.catch(3),c.yw.warning(J.formatMessage({id:"form.validate.failed",defaultMessage:"请先修正表单校验错误"})),e.abrupt("return",!1);case 12:if(t=Y.getFieldsValue(),n={showRightIframe:t.showRightIframe,rightIframeUrl:t.rightIframeUrl,showFaqs:t.showFaqs,faqKbUid:t.faqKbUid,faqUids:Array.isArray(t.faqUids)?t.faqUids:void 0},e.prev=14,ke(!0),E!==y.Njn||!et){e.next=21;break}return e.next=19,(0,g.wU)({uid:et.uid,serviceSettings:n});case 19:case 24:e.next=29;break;case 21:if(E!==y._X4||!Ge){e.next=26;break}return e.next=24,(0,v.sK)({uid:Ge.uid,serviceSettings:n});case 26:if(E!==y.aZD||!tt){e.next=29;break}return e.next=29,(0,f.Y2)({uid:tt.uid,serviceSettings:n});case 29:return e.abrupt("return",!0);case 32:return e.prev=32,e.t1=e.catch(14),console.warn("保存右侧配置失败(忽略刷新):",e.t1),c.yw.error(J.formatMessage({id:"save.failed",defaultMessage:"保存失败"})),e.abrupt("return",!1);case 37:return e.prev=37,ke(!1),e.finish(37);case 40:case"end":return e.stop()}}),e,null,[[3,8],[14,32,37,40]])})));return function(){return e.apply(this,arguments)}}(),gt=function(){var e=l()(o()().mark((function e(t){return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ye.current;case 2:if(!xe){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,ct();case 6:e.sent&&B&&he((function(e){return e+1}));case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),vt=function(){var e=l()(o()().mark((function e(t){return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("onFinish:",t);case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ft=function(){var e=l()(o()().mark((function e(t){var n,i;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("TabRight handleChange showRightIframe",t),Y.setFieldValue("showRightIframe",t),n={showRightIframe:t},E===y.Njn&&et?it(r()(r()({},et),{},{serviceSettings:r()(r()({},et.serviceSettings),n),draftServiceSettings:r()(r()({},et.draftServiceSettings||{}),n)})):E===y._X4&&Ge?nt(r()(r()({},Ge),{},{serviceSettings:r()(r()({},Ge.serviceSettings),n),draftServiceSettings:r()(r()({},Ge.draftServiceSettings||{}),n)})):E===y.aZD&&tt&&rt(r()(r()({},tt),{},{serviceSettings:r()(r()({},tt.serviceSettings),n),draftServiceSettings:r()(r()({},tt.draftServiceSettings||{}),n)})),e.prev=4,i={showRightIframe:t},e.next=8,st(i);case 8:he((function(e){return e+1})),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),console.warn("showRightIframe 即时保存失败(忽略):",e.t0);case 14:case"end":return e.stop()}}),e,null,[[4,11]])})));return function(t){return e.apply(this,arguments)}}(),St=function(){var e=l()(o()().mark((function e(t){var n,i;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("TabRight handleChange showFaqs",t),Y.setFieldValue("showFaqs",t),n={showFaqs:t},E===y.Njn&&et?it(r()(r()({},et),{},{serviceSettings:r()(r()({},et.serviceSettings),n),draftServiceSettings:r()(r()({},et.draftServiceSettings||{}),n)})):E===y._X4&&Ge?nt(r()(r()({},Ge),{},{serviceSettings:r()(r()({},Ge.serviceSettings),n),draftServiceSettings:r()(r()({},Ge.draftServiceSettings||{}),n)})):E===y.aZD&&tt&&rt(r()(r()({},tt),{},{serviceSettings:r()(r()({},tt.serviceSettings),n),draftServiceSettings:r()(r()({},tt.draftServiceSettings||{}),n)})),e.prev=4,i={showFaqs:t},e.next=8,st(i);case 8:he((function(e){return e+1})),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),console.warn("showFaqs 即时保存失败(忽略):",e.t0);case 14:case"end":return e.stop()}}),e,null,[[4,11]])})));return function(t){return e.apply(this,arguments)}}(),pt=(0,R.useMemo)((function(){return z||(E===y.Njn?null==et?void 0:et.uid:E===y._X4?null==Ge?void 0:Ge.uid:E===y.aZD?null==tt?void 0:tt.uid:void 0)}),[z,E,null==et?void 0:et.uid,null==Ge?void 0:Ge.uid,null==tt?void 0:tt.uid]);(0,R.useEffect)((function(){B&&gt("tab-activated")}),[B]);var mt=(0,R.useMemo)((function(){if(!B)return"";var e=(0,K.Cn)(),t=new URLSearchParams({org:(null==$?void 0:$.uid)||"",t:at,sid:lt,debug:"1",k:String(me)});pt&&t.set("settingsUid",pt);var n="".concat(e,"?").concat(t.toString());return console.log("Chat Preview URL Right:",n),n}),[null==$?void 0:$.uid,at,lt,me,pt,B]),ht=(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(j.Z,{width:"md",name:"showRightIframe",label:(0,D.jsxs)("span",{children:[J.formatMessage({id:"showRightIframe"}),(0,D.jsx)(_.Z,{type:"service",keys:["showRightIframe"],live:E===y.Njn?null==et?void 0:et.serviceSettings:E===y._X4?null==Ge?void 0:Ge.serviceSettings:null==tt?void 0:tt.serviceSettings,draft:E===y.Njn?null==et?void 0:et.draftServiceSettings:E===y._X4?null==Ge?void 0:Ge.draftServiceSettings:null==tt?void 0:tt.draftServiceSettings})]}),fieldProps:{onChange:ft,disabled:xe}}),(0,D.jsx)(q.Z,{width:"md",name:"rightIframeUrl",label:(0,D.jsxs)("span",{children:[J.formatMessage({id:"rightIframeUrl"}),(0,D.jsx)(_.Z,{type:"service",keys:["rightIframeUrl"],live:E===y.Njn?null==et?void 0:et.serviceSettings:E===y._X4?null==Ge?void 0:Ge.serviceSettings:null==tt?void 0:tt.serviceSettings,draft:E===y.Njn?null==et?void 0:et.draftServiceSettings:E===y._X4?null==Ge?void 0:Ge.draftServiceSettings:null==tt?void 0:tt.draftServiceSettings})]}),placeholder:J.formatMessage({id:"rightIframeUrl.placeholder",defaultMessage:"请输入以 http:// 或 https:// 开头的URL"}),rules:[{type:"url",message:J.formatMessage({id:"rightIframeUrl.invalid",defaultMessage:"请输入有效的URL地址"})},{pattern:/^https?:\/\/[^\s]+$/i,message:J.formatMessage({id:"rightIframeUrl.scheme.required",defaultMessage:"必须以 http:// 或 https:// 开头"})}],fieldProps:{type:"url",inputMode:"url",allowClear:!0,disabled:xe}})]}),wt=(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(j.Z,{width:"md",name:"showFaqs",label:(0,D.jsxs)("span",{children:[J.formatMessage({id:"faq.show.faqs"}),(0,D.jsx)(_.Z,{type:"service",keys:["showFaqs"],live:E===y.Njn?null==et?void 0:et.serviceSettings:E===y._X4?null==Ge?void 0:Ge.serviceSettings:null==tt?void 0:tt.serviceSettings,draft:E===y.Njn?null==et?void 0:et.draftServiceSettings:E===y._X4?null==Ge?void 0:Ge.draftServiceSettings:null==tt?void 0:tt.draftServiceSettings})]}),fieldProps:{onChange:St,disabled:xe}}),(0,D.jsx)(C.Z,{name:"faqKbUid",width:"md",label:(0,D.jsxs)("span",{children:[J.formatMessage({id:"faq.kbase.select",defaultMessage:"选择侧边栏常见问题知识库"}),(0,D.jsx)(_.Z,{type:"service",keys:["faqKbUid"],live:E===y.Njn?null==et?void 0:et.serviceSettings:E===y._X4?null==Ge?void 0:Ge.serviceSettings:null==tt?void 0:tt.serviceSettings,draft:E===y.Njn?null==et?void 0:et.draftServiceSettings:E===y._X4?null==Ge?void 0:Ge.draftServiceSettings:null==tt?void 0:tt.draftServiceSettings})]}),options:null==se||null===(s=se.data)||void 0===s||null===(s=s.content)||void 0===s?void 0:s.map((function(e){return{label:H(e.name),value:e.uid}})),fieldProps:{onChange:function(e){console.log("TabRight selected kbase:",e),de(e),Y.setFieldValue("faqUids",[]),dt(e);var t={faqKbUid:e,faqs:void 0,faqUids:[]};E===y.Njn&&et?it(r()(r()({},et),{},{serviceSettings:r()(r()({},et.serviceSettings),t),draftServiceSettings:r()(r()({},et.draftServiceSettings||{}),t)})):E===y._X4&&Ge?nt(r()(r()({},Ge),{},{serviceSettings:r()(r()({},Ge.serviceSettings),t),draftServiceSettings:r()(r()({},Ge.draftServiceSettings||{}),t)})):E===y.aZD&&tt&&rt(r()(r()({},tt),{},{serviceSettings:r()(r()({},tt.serviceSettings),t),draftServiceSettings:r()(r()({},tt.draftServiceSettings||{}),t)}))},allowClear:!0,placeholder:J.formatMessage({id:"choose",defaultMessage:"Choose"}),disabled:xe}}),(0,D.jsx)(C.Z,{name:"faqUids",width:"md",label:(0,D.jsxs)("span",{children:[J.formatMessage({id:"menu.kbase.faq"}),(0,D.jsx)(_.Z,{type:"service",keys:["faqUids"],live:E===y.Njn?null==et?void 0:et.serviceSettings:E===y._X4?null==Ge?void 0:Ge.serviceSettings:null==tt?void 0:tt.serviceSettings,draft:E===y.Njn?null==et?void 0:et.draftServiceSettings:E===y._X4?null==Ge?void 0:Ge.draftServiceSettings:null==tt?void 0:tt.draftServiceSettings})]}),options:null==te||null===(a=te.data)||void 0===a||null===(a=a.content)||void 0===a?void 0:a.map((function(e){return{label:H(e.question),value:e.uid}})),fieldProps:{mode:"multiple",allowClear:!0,placeholder:J.formatMessage({id:"choose",defaultMessage:"Choose"}),disabled:xe}})]});return(0,D.jsxs)(F.Z,{children:[(0,D.jsx)(F.Z.Panel,{defaultSize:"30%",min:"20%",max:"50%",children:(0,D.jsx)("div",{style:{padding:"0 16px",height:"100%",overflowY:"auto"},children:(0,D.jsx)(U.A,{form:Y,onFinish:vt,onValuesChange:function(e,t){var n={rightIframeUrl:t.rightIframeUrl,faqKbUid:t.faqKbUid,faqUids:t.faqUids,showRightIframe:t.showRightIframe,showFaqs:t.showFaqs};E===y.Njn&&et?it(r()(r()({},et),{},{serviceSettings:r()(r()({},et.serviceSettings),n),draftServiceSettings:r()(r()({},et.draftServiceSettings||{}),n)})):E===y._X4&&Ge?nt(r()(r()({},Ge),{},{serviceSettings:r()(r()({},Ge.serviceSettings),n),draftServiceSettings:r()(r()({},Ge.draftServiceSettings||{}),n)})):E===y.aZD&&tt&&rt(r()(r()({},tt),{},{serviceSettings:r()(r()({},tt.serviceSettings),n),draftServiceSettings:r()(r()({},tt.draftServiceSettings||{}),n)}))},submitter:!1,children:(0,D.jsx)(A.Z,{activeKey:ve,onChange:fe,items:[{key:"iframe",label:J.formatMessage({id:"showRightIframe",defaultMessage:"右侧iframe"}),children:ht},{key:"faq",label:J.formatMessage({id:"faq.show.faqs",defaultMessage:"常见问题"}),children:wt}]})})})}),(0,D.jsx)(F.Z.Panel,{children:(0,D.jsxs)("div",{style:{height:"100%",padding:"16px",background:"#f0f2f5",display:"flex",flexDirection:"column"},children:[(0,D.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8,gap:12},children:[E===y.Njn&&(0,D.jsx)(M.Z,{style:{minWidth:220},value:Ne,placeholder:J.formatMessage({id:"preview.select.agent",defaultMessage:"选择预览客服"}),options:((null==Be||null===(u=Be.data)||void 0===u?void 0:u.content)||[]).map((function(e){return{value:e.uid,label:H(e.nickname)}})),onChange:function(e){Xe(e),Ve(e),gt("switch-agent")},allowClear:!0,disabled:xe}),E===y._X4&&(0,D.jsx)(M.Z,{style:{minWidth:220},value:Fe,placeholder:J.formatMessage({id:"preview.select.robot",defaultMessage:"选择预览机器人"}),options:((null==Ee||null===(V=Ee.data)||void 0===V?void 0:V.content)||[]).map((function(e){return{value:e.uid,label:H(e.nickname)}})),onChange:function(e){Ae(e),Ve(e),gt("switch-robot")},allowClear:!0,disabled:xe}),E===y.aZD&&(0,D.jsx)(M.Z,{style:{minWidth:220},value:Ie,placeholder:J.formatMessage({id:"preview.select.workgroup",defaultMessage:"选择预览工作组"}),options:((null==Ye||null===(P=Ye.data)||void 0===P?void 0:P.content)||[]).map((function(e){return{value:e.uid,label:H(e.nickname)}})),onChange:function(e){We(e),Ve(e),gt("switch-workgroup")},allowClear:!0,disabled:xe}),(0,D.jsx)(Z.Z,{value:qe,onChange:function(e){return Ce(e)},options:[{value:"desktop",icon:(0,D.jsx)(N.Z,{})},{value:"mobile",icon:(0,D.jsx)(X.Z,{})}],disabled:xe})]}),(0,D.jsx)("div",{style:{flex:1,minHeight:720,display:"flex",justifyContent:"center"},children:(0,D.jsx)("div",{style:{width:"mobile"===qe?390:"100%",height:"100%",border:"1px solid #d9d9d9",borderRadius:4,overflow:"hidden",background:"#fff"},children:(0,D.jsx)("iframe",{src:mt,style:{width:"100%",height:"100%",border:"none"},title:"Chat Preview"},me)})})]})})]})}},51898:function(e,t,n){var i=n(73193),r=n.n(i),s=n(45332),o=n.n(s),a=n(91733),l=n(66675),u=n(68992),d=n(89007),c=n(82465),g=n(86772),v=n(62395),f=n(44194),S=n(83262),p=n(31549);t.Z=function(e){var t=e.type,n=d.A.useForm(),i=o()(n,1)[0],s=(0,v.useIntl)(),m=(0,a.z)((function(e){return{currentRobotSettings:e.currentRobotSettings,currentAgentSettings:e.currentAgentSettings,currentWorkgroupSettings:e.currentWorkgroupSettings,setCurrentRobotSettings:e.setCurrentRobotSettings,setCurrentAgentSettings:e.setCurrentAgentSettings,setCurrentWorkgroupSettings:e.setCurrentWorkgroupSettings}})),h=m.currentRobotSettings,w=m.currentAgentSettings,b=m.currentWorkgroupSettings,x=m.setCurrentRobotSettings,k=m.setCurrentAgentSettings,y=m.setCurrentWorkgroupSettings,U=(0,l.E)((function(e){return{currentAgent:e.currentAgent}})).currentAgent;(0,f.useEffect)((function(){if(t===u._X4&&(null!=h&&h.draftServiceSettings||null!=h&&h.serviceSettings)){var e=(null==h?void 0:h.draftServiceSettings)||(null==h?void 0:h.serviceSettings);i.setFieldValue("autoCloseMin",null==e?void 0:e.autoCloseMin),i.setFieldValue("showLogo",null==e?void 0:e.showLogo)}else if(t===u.Njn&&(null!=w&&w.draftServiceSettings||null!=w&&w.serviceSettings)){var n=(null==w?void 0:w.draftServiceSettings)||(null==w?void 0:w.serviceSettings);i.setFieldValue("autoCloseMin",null==n?void 0:n.autoCloseMin),i.setFieldValue("showLogo",null==n?void 0:n.showLogo),i.setFieldValue("maxThreadCount",null==w?void 0:w.maxThreadCount),i.setFieldValue("timeoutRemindTime",null==w?void 0:w.timeoutRemindTime)}else if(t===u.aZD&&(null!=b&&b.draftServiceSettings||null!=b&&b.serviceSettings)){var r=(null==b?void 0:b.draftServiceSettings)||(null==b?void 0:b.serviceSettings);i.setFieldValue("autoCloseMin",null==r?void 0:r.autoCloseMin),i.setFieldValue("showLogo",null==r?void 0:r.showLogo)}}),[null==h?void 0:h.uid,null==w?void 0:w.uid,null==b?void 0:b.uid,null==U?void 0:U.uid]);return(0,p.jsxs)(d.A,{form:i,submitter:!1,style:{marginLeft:"20px"},children:[t===u.Njn&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(c.Z,{width:"md",name:"maxThreadCount",label:s.formatMessage({id:"agent.settings.max.thread"}),min:0,fieldProps:{onChange:function(e){t===u.Njn&&w&&k(r()(r()({},w),{},{maxThreadCount:e}))}}}),(0,p.jsx)(c.Z,{width:"md",name:"timeoutRemindTime",label:s.formatMessage({id:"agent.settings.timeout.remind",defaultMessage:"超时提醒时间"}),tooltip:s.formatMessage({id:"agent.settings.timeout.remind.tooltip",defaultMessage:"超过设定时间未回复客户将收到提醒"}),min:1,fieldProps:{addonAfter:s.formatMessage({id:"time.minute",defaultMessage:"分钟"}),onChange:function(e){t===u.Njn&&w&&k(r()(r()({},w),{},{timeoutRemindTime:e}))}}})]}),(0,p.jsx)(c.Z,{width:"md",name:"autoCloseMin",label:(0,p.jsxs)("span",{children:[s.formatMessage({id:"agent.settings.auto.close.time"}),(0,p.jsx)(S.Z,{type:"service",keys:["autoCloseMin"],live:t===u.Njn?null==w?void 0:w.serviceSettings:t===u._X4?null==h?void 0:h.serviceSettings:null==b?void 0:b.serviceSettings,draft:t===u.Njn?null==w?void 0:w.draftServiceSettings:t===u._X4?null==h?void 0:h.draftServiceSettings:null==b?void 0:b.draftServiceSettings})]}),tooltip:s.formatMessage({id:"agent.settings.auto.close.time.tooltip"}),min:1,fieldProps:{onChange:function(e){t===u.Njn&&w?k(r()(r()({},w),{},{serviceSettings:r()(r()({},w.serviceSettings),{},{autoCloseMin:e}),draftServiceSettings:r()(r()({},w.draftServiceSettings||{}),{},{autoCloseMin:e})})):t===u._X4&&h?x(r()(r()({},h),{},{serviceSettings:r()(r()({},h.serviceSettings),{},{autoCloseMin:e}),draftServiceSettings:r()(r()({},h.draftServiceSettings||{}),{},{autoCloseMin:e})})):t===u.aZD&&b&&y(r()(r()({},b),{},{serviceSettings:r()(r()({},b.serviceSettings),{},{autoCloseMin:e}),draftServiceSettings:r()(r()({},b.draftServiceSettings||{}),{},{autoCloseMin:e})}))}}}),(0,p.jsx)(g.Z,{name:"showLogo",width:"md",label:(0,p.jsxs)("span",{children:[s.formatMessage({id:"agent.settings.show.logo"}),(0,p.jsx)(S.Z,{type:"service",keys:["showLogo"],live:t===u.Njn?null==w?void 0:w.serviceSettings:t===u._X4?null==h?void 0:h.serviceSettings:null==b?void 0:b.serviceSettings,draft:t===u.Njn?null==w?void 0:w.draftServiceSettings:t===u._X4?null==h?void 0:h.draftServiceSettings:null==b?void 0:b.draftServiceSettings})]}),tooltip:s.formatMessage({id:"agent.settings.show.logo.tooltip"}),fieldProps:{onChange:function(e){console.log("onShowLogoChange = ".concat(e.target.checked))}},disabled:!0})]})}},28672:function(e,t,n){var i=n(90819),r=n.n(i),s=n(89933),o=n.n(s),a=n(73193),l=n.n(a),u=n(45332),d=n.n(u),c=n(99754),g=n(91733),v=n(18313),f=n(90170),S=n(34203),p=n(68992),m=n(89007),h=n(86772),w=n(62395),b=n(44194),x=n(91743),k=n(62134),y=n(83262),U=n(31549);t.Z=function(e){var t=e.type,n=m.A.useForm(),i=d()(n,1)[0],s=(0,w.useIntl)(),a=(0,c.Z)().translateString,u=(0,b.useState)(!1),j=d()(u,2),q=j[0],C=j[1],T=(0,g.z)((function(e){return{currentAgentSettings:e.currentAgentSettings,currentRobotSettings:e.currentRobotSettings,currentWorkgroupSettings:e.currentWorkgroupSettings,setCurrentAgentSettings:e.setCurrentAgentSettings,setCurrentRobotSettings:e.setCurrentRobotSettings,setCurrentWorkgroupSettings:e.setCurrentWorkgroupSettings}})),R=T.currentAgentSettings,F=T.currentRobotSettings,A=T.currentWorkgroupSettings,M=T.setCurrentAgentSettings,Z=T.setCurrentRobotSettings,N=T.setCurrentWorkgroupSettings,X=(0,b.useState)(""),K=d()(X,2),_=K[0],I=K[1],W=(0,b.useState)(""),L=d()(W,2),D=L[0],V=L[1],P=(0,b.useState)(""),E=d()(P,2),z=E[0],O=E[1],B=(0,b.useState)(""),J=d()(B,2),Q=J[0],Y=J[1];(0,b.useEffect)((function(){if(t===p._X4&&(null!=F&&F.draftServiceSettings||null!=F&&F.serviceSettings)){var e=(null==F?void 0:F.draftServiceSettings)||(null==F?void 0:F.serviceSettings);V(a(null==e?void 0:e.topTip)),Y(a(null==e?void 0:e.autoCloseTip)),C(!(null==e||!e.showTopTip)),i.setFieldValue("showTopTip",null==e?void 0:e.showTopTip)}else if(t===p.Njn&&(null!=R&&R.draftServiceSettings||null!=R&&R.serviceSettings)){var n=(null==R?void 0:R.draftServiceSettings)||(null==R?void 0:R.serviceSettings);V(a(null==n?void 0:n.topTip)),O(a(null==n?void 0:n.agentCloseTip)),Y(a(null==n?void 0:n.autoCloseTip));var r=(null==R?void 0:R.draftMessageLeaveSettings)||(null==R?void 0:R.messageLeaveSettings);I(a(null==r?void 0:r.messageLeaveTip)),C(!(null==n||!n.showTopTip)),i.setFieldValue("showTopTip",null==n?void 0:n.showTopTip)}else if(t===p.aZD&&(null!=A&&A.draftServiceSettings||null!=A&&A.serviceSettings)){var s=(null==A?void 0:A.draftServiceSettings)||(null==A?void 0:A.serviceSettings);V(a(null==s?void 0:s.topTip)),O(a(null==s?void 0:s.agentCloseTip)),Y(a(null==s?void 0:s.autoCloseTip));var o=(null==A?void 0:A.draftMessageLeaveSettings)||(null==A?void 0:A.messageLeaveSettings);I(a(null==o?void 0:o.messageLeaveTip)),C(!(null==s||!s.showTopTip)),i.setFieldValue("showTopTip",null==s?void 0:s.showTopTip)}}),[t,null==F?void 0:F.uid,null==R?void 0:R.uid,null==A?void 0:A.uid]);return(0,U.jsxs)(m.A,{form:i,submitter:!1,style:{marginLeft:"20px"},children:[(0,U.jsx)(h.Z,{name:"showTopTip",width:"md",label:(0,U.jsxs)("span",{children:[s.formatMessage({id:"agent.settings.show.top.tip"}),(0,U.jsx)(y.Z,{type:"service",keys:["showTopTip"],live:t===p.Njn?null==R?void 0:R.serviceSettings:t===p._X4?null==F?void 0:F.serviceSettings:null==A?void 0:A.serviceSettings,draft:t===p.Njn?null==R?void 0:R.draftServiceSettings:t===p._X4?null==F?void 0:F.draftServiceSettings:null==A?void 0:A.draftServiceSettings})]}),fieldProps:{onChange:function(e){var n;if(C(e.target.checked),e.target.checked)if(t===p._X4)V(a(null==F||null===(n=F.serviceSettings)||void 0===n?void 0:n.topTip));else if(t===p.Njn){var i;V(a(null==R||null===(i=R.serviceSettings)||void 0===i?void 0:i.topTip))}else if(t===p.aZD){var s;V(a(null==A||null===(s=A.serviceSettings)||void 0===s?void 0:s.topTip))}t===p.Njn&&R?M(l()(l()({},R),{},{serviceSettings:l()(l()({},R.serviceSettings),{},{showTopTip:e.target.checked})})):t===p._X4&&F?Z(l()(l()({},F),{},{serviceSettings:l()(l()({},F.serviceSettings),{},{showTopTip:e.target.checked})})):t===p.aZD&&A&&N(l()(l()({},A),{},{serviceSettings:l()(l()({},A.serviceSettings),{},{showTopTip:e.target.checked})})),o()(r()().mark((function n(){var i;return r()().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(n.prev=0,i={serviceSettings:{showTopTip:e.target.checked}},t!==p.Njn||!R){n.next=7;break}return n.next=5,(0,v.wU)(l()({uid:R.uid},i));case 5:n.next=15;break;case 7:if(t!==p._X4||!F){n.next=12;break}return n.next=10,(0,f.sK)(l()({uid:F.uid},i));case 10:n.next=15;break;case 12:if(t!==p.aZD||!A){n.next=15;break}return n.next=15,(0,S.Y2)(l()({uid:A.uid},i));case 15:n.next=20;break;case 17:n.prev=17,n.t0=n.catch(0),console.warn("showTopTip 即时保存失败(忽略):",n.t0);case 20:case"end":return n.stop()}}),n,null,[[0,17]])})))()}}}),q&&(0,U.jsx)(m.A.Item,{name:"topTip",label:(0,U.jsxs)("span",{children:[s.formatMessage({id:"agent.settings.top.tip"}),(0,U.jsx)(y.Z,{type:"service",keys:["topTip"],live:t===p.Njn?null==R?void 0:R.serviceSettings:t===p._X4?null==F?void 0:F.serviceSettings:null==A?void 0:A.serviceSettings,draft:t===p.Njn?null==R?void 0:R.draftServiceSettings:t===p._X4?null==F?void 0:F.draftServiceSettings:null==A?void 0:A.draftServiceSettings})]}),rules:[{required:!0,message:s.formatMessage({id:"agent.settings.top.tip.required"})}],children:(0,U.jsx)(x.Z,{placeholder:s.formatMessage({id:"agent.settings.top.tip.placeholder"}),value:D,toolbarKeys:(0,k.eD)(),style:{height:"200px",width:"600px"},maxLength:200,onChange:function(e){console.log("topTip onchange:",e),i.setFieldValue("topTip",e),t===p.Njn&&R?M(l()(l()({},R),{},{serviceSettings:l()(l()({},R.serviceSettings),{},{topTip:e}),draftServiceSettings:l()(l()({},R.draftServiceSettings||{}),{},{topTip:e})})):t===p._X4&&F?Z(l()(l()({},F),{},{serviceSettings:l()(l()({},F.serviceSettings),{},{topTip:e}),draftServiceSettings:l()(l()({},F.draftServiceSettings||{}),{},{topTip:e})})):t===p.aZD&&A&&N(l()(l()({},A),{},{serviceSettings:l()(l()({},A.serviceSettings),{},{topTip:e}),draftServiceSettings:l()(l()({},A.draftServiceSettings||{}),{},{topTip:e})}))}},"topTipEditor")}),t!==p._X4&&(0,U.jsx)(m.A.Item,{name:"messageLeaveTip",label:(0,U.jsxs)("span",{children:[s.formatMessage({id:"agent.settings.leave.msg"}),(0,U.jsx)(y.Z,{type:"messageLeave",keys:["messageLeaveTip"],live:t===p.Njn?null==R?void 0:R.messageLeaveSettings:null==A?void 0:A.messageLeaveSettings,draft:t===p.Njn?null==R?void 0:R.draftMessageLeaveSettings:null==A?void 0:A.draftMessageLeaveSettings})]}),rules:[{required:!0,message:s.formatMessage({id:"agent.settings.leave.msg.required"})}],children:(0,U.jsx)(x.Z,{placeholder:s.formatMessage({id:"agent.settings.leave.msg.placeholder"}),value:_,toolbarKeys:(0,k.eD)(),style:{height:"200px",width:"600px"},maxLength:200,onChange:function(e){console.log("messageLeaveTip onchange:",e),i.setFieldValue("messageLeaveTip",e),t===p.Njn&&R?M(l()(l()({},R),{},{messageLeaveSettings:l()(l()({},R.messageLeaveSettings),{},{messageLeaveTip:e}),draftMessageLeaveSettings:l()(l()({},R.draftMessageLeaveSettings||{}),{},{messageLeaveTip:e})})):t===p.aZD&&A&&N(l()(l()({},A),{},{messageLeaveSettings:l()(l()({},A.messageLeaveSettings),{},{messageLeaveTip:e}),draftMessageLeaveSettings:l()(l()({},A.draftMessageLeaveSettings||{}),{},{messageLeaveTip:e})}))}},"leaveMsgEditor")}),t!==p._X4&&(0,U.jsx)(m.A.Item,{name:"agentCloseTip",label:(0,U.jsxs)("span",{children:[s.formatMessage({id:"agent.settings.agent.close.tip"}),(0,U.jsx)(y.Z,{type:"service",keys:["agentCloseTip"],live:t===p.Njn?null==R?void 0:R.serviceSettings:null==A?void 0:A.serviceSettings,draft:t===p.Njn?null==R?void 0:R.draftServiceSettings:null==A?void 0:A.draftServiceSettings})]}),tooltip:s.formatMessage({id:"agent.settings.agent.close.tip.tooltip"}),rules:[{required:!0,message:s.formatMessage({id:"agent.settings.agent.close.tip.required"})}],children:(0,U.jsx)(x.Z,{placeholder:s.formatMessage({id:"agent.settings.agent.close.tip.placeholder"}),value:z,toolbarKeys:(0,k.eD)(),style:{height:"200px",width:"600px"},maxLength:200,onChange:function(e){console.log("agentCloseTip onchange:",e),i.setFieldValue("agentCloseTip",e),t===p.Njn&&R?M(l()(l()({},R),{},{serviceSettings:l()(l()({},R.serviceSettings),{},{agentCloseTip:e}),draftServiceSettings:l()(l()({},R.draftServiceSettings||{}),{},{agentCloseTip:e})})):t===p.aZD&&A&&N(l()(l()({},A),{},{serviceSettings:l()(l()({},A.serviceSettings),{},{agentCloseTip:e}),draftServiceSettings:l()(l()({},A.draftServiceSettings||{}),{},{agentCloseTip:e})}))}},"agentCloseTipEditor")}),(0,U.jsx)(m.A.Item,{name:"autoCloseTip",label:(0,U.jsxs)("span",{children:[s.formatMessage({id:"agent.settings.auto.close.tip"}),(0,U.jsx)(y.Z,{type:"service",keys:["autoCloseTip"],live:t===p.Njn?null==R?void 0:R.serviceSettings:t===p._X4?null==F?void 0:F.serviceSettings:null==A?void 0:A.serviceSettings,draft:t===p.Njn?null==R?void 0:R.draftServiceSettings:t===p._X4?null==F?void 0:F.draftServiceSettings:null==A?void 0:A.draftServiceSettings})]}),tooltip:s.formatMessage({id:"agent.settings.auto.close.tip.tooltip"}),rules:[{required:!0,message:s.formatMessage({id:"agent.settings.auto.close.tip.required"})}],children:(0,U.jsx)(x.Z,{placeholder:s.formatMessage({id:"agent.settings.auto.close.tip.placeholder"}),value:Q,toolbarKeys:(0,k.eD)(),style:{height:"200px",width:"600px"},maxLength:200,onChange:function(e){console.log("autoCloseTip onchange:",e),i.setFieldValue("autoCloseTip",e),t===p.Njn&&R?M(l()(l()({},R),{},{serviceSettings:l()(l()({},R.serviceSettings),{},{autoCloseTip:e}),draftServiceSettings:l()(l()({},R.draftServiceSettings||{}),{},{autoCloseTip:e})})):t===p._X4&&F?Z(l()(l()({},F),{},{serviceSettings:l()(l()({},F.serviceSettings),{},{autoCloseTip:e}),draftServiceSettings:l()(l()({},F.draftServiceSettings||{}),{},{autoCloseTip:e})})):t===p.aZD&&A&&N(l()(l()({},A),{},{serviceSettings:l()(l()({},A.serviceSettings),{},{autoCloseTip:e}),draftServiceSettings:l()(l()({},A.draftServiceSettings||{}),{},{autoCloseTip:e})}))}},"autoCloseTipEditor")})]})}},65448:function(e,t,n){var i=n(90819),r=n.n(i),s=n(89933),o=n.n(s),a=n(73193),l=n.n(a),u=n(45332),d=n.n(u),c=n(61489),g=n(99754),v=n(91733),f=n(68992),S=n(89007),p=n(50447),m=n(62395),h=n(44194),w=n(91743),b=n(62134),x=n(83262),k=n(77686),y=n(72309),U=n(54008),j=n(31549);t.Z=function(e){var t,n,i,s,a,u,q,C,T,R,F,A,M,Z,N,X,K,_,I,W,L,D,V,P,E,z,O,B,J,Q,Y,$,H,G,ee=e.type,te=S.A.useForm(),ne=d()(te,1)[0],ie=(0,m.useIntl)(),re=(0,g.Z)().translateString,se=(0,k.u)((function(e){return e.currentOrg})),oe=(0,h.useState)(),ae=d()(oe,2),le=ae[0],ue=ae[1],de=(0,h.useState)(),ce=d()(de,2),ge=ce[0],ve=ce[1],fe=(0,h.useState)(),Se=d()(fe,2),pe=Se[0],me=Se[1],he=(0,v.z)((function(e){return{currentRobotSettings:e.currentRobotSettings,currentAgentSettings:e.currentAgentSettings,currentWorkgroupSettings:e.currentWorkgroupSettings,setCurrentAgentSettings:e.setCurrentAgentSettings,setCurrentRobotSettings:e.setCurrentRobotSettings,setCurrentWorkgroupSettings:e.setCurrentWorkgroupSettings}})),we=he.currentRobotSettings,be=he.currentAgentSettings,xe=he.currentWorkgroupSettings,ke=he.setCurrentAgentSettings,ye=he.setCurrentRobotSettings,Ue=he.setCurrentWorkgroupSettings,je=(0,h.useState)(""),qe=d()(je,2),Ce=qe[0],Te=qe[1],Re=(0,h.useRef)(!1),Fe=(0,h.useCallback)((function(e){console.log("welcomeTip onchange:",e),ne.setFieldValue("welcomeTip",e),ee===f.Njn?(console.log("🔄 [Agent] Setting welcomeTip:",e),v.z.setState((function(t){return t.currentAgentSettings?l()(l()({},t),{},{currentAgentSettings:l()(l()({},t.currentAgentSettings),{},{serviceSettings:l()(l()({},t.currentAgentSettings.serviceSettings),{},{welcomeTip:e}),draftServiceSettings:l()(l()({},t.currentAgentSettings.draftServiceSettings||{}),{},{welcomeTip:e})})}):t}))):ee===f._X4?(console.log("🔄 [Robot] Setting welcomeTip:",e),v.z.setState((function(t){return t.currentRobotSettings?l()(l()({},t),{},{currentRobotSettings:l()(l()({},t.currentRobotSettings),{},{serviceSettings:l()(l()({},t.currentRobotSettings.serviceSettings),{},{welcomeTip:e}),draftServiceSettings:l()(l()({},t.currentRobotSettings.draftServiceSettings||{}),{},{welcomeTip:e})})}):t}))):ee===f.aZD&&(console.log("🔄 [Workgroup] Setting welcomeTip:",e),v.z.setState((function(t){return t.currentWorkgroupSettings?l()(l()({},t),{},{currentWorkgroupSettings:l()(l()({},t.currentWorkgroupSettings),{},{serviceSettings:l()(l()({},t.currentWorkgroupSettings.serviceSettings),{},{welcomeTip:e}),draftServiceSettings:l()(l()({},t.currentWorkgroupSettings.draftServiceSettings||{}),{},{welcomeTip:e})})}):t})))}),[ne,ee]),Ae=function(){var e=o()(r()().mark((function e(){var t,n,i,s,o,a,u,d,g,v,S,p,m,h,w,b,x,k,y;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c.yw.loading(ie.formatMessage({id:"loading",defaultMessage:"Loading"})),t={pageNumber:0,pageSize:50,type:f.QPQ,orgUid:null==se?void 0:se.uid},e.next=4,(0,U.AP)(t);case 4:n=e.sent,c.yw.destroy(),200===n.code?(ve(n),S=(null===(i=n.data)||void 0===i?void 0:i.content)||[],p=ee===f.Njn?(null==be||null===(s=be.draftServiceSettings)||void 0===s?void 0:s.welcomeKbUid)||(null==be||null===(o=be.serviceSettings)||void 0===o?void 0:o.welcomeKbUid):ee===f._X4?(null==we||null===(a=we.draftServiceSettings)||void 0===a?void 0:a.welcomeKbUid)||(null==we||null===(u=we.serviceSettings)||void 0===u?void 0:u.welcomeKbUid):(null==xe||null===(d=xe.draftServiceSettings)||void 0===d?void 0:d.welcomeKbUid)||(null==xe||null===(g=xe.serviceSettings)||void 0===g?void 0:g.welcomeKbUid),(m=p||pe||(null===(v=S[0])||void 0===v?void 0:v.uid))&&(me(m),ne.setFieldValue("welcomeKbUid",m),ee===f.Njn&&be?((null==be||null===(h=be.draftServiceSettings)||void 0===h?void 0:h.welcomeKbUid)||(null==be||null===(w=be.serviceSettings)||void 0===w?void 0:w.welcomeKbUid))!==m&&ke(l()(l()({},be),{},{serviceSettings:l()(l()({},be.serviceSettings),{},{welcomeKbUid:m}),draftServiceSettings:l()(l()({},be.draftServiceSettings||{}),{},{welcomeKbUid:m})})):ee===f._X4&&we?((null==we||null===(b=we.draftServiceSettings)||void 0===b?void 0:b.welcomeKbUid)||(null==we||null===(x=we.serviceSettings)||void 0===x?void 0:x.welcomeKbUid))!==m&&ye(l()(l()({},we),{},{serviceSettings:l()(l()({},we.serviceSettings),{},{welcomeKbUid:m}),draftServiceSettings:l()(l()({},we.draftServiceSettings||{}),{},{welcomeKbUid:m})})):ee===f.aZD&&xe&&((null==xe||null===(k=xe.draftServiceSettings)||void 0===k?void 0:k.welcomeKbUid)||(null==xe||null===(y=xe.serviceSettings)||void 0===y?void 0:y.welcomeKbUid))!==m&&Ue(l()(l()({},xe),{},{serviceSettings:l()(l()({},xe.serviceSettings),{},{welcomeKbUid:m}),draftServiceSettings:l()(l()({},xe.draftServiceSettings||{}),{},{welcomeKbUid:m})})),Me(m))):c.yw.error(n.message);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Me=function(){var e=o()(r()().mark((function e(t){var n,i;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c.yw.loading(ie.formatMessage({id:"loading",defaultMessage:"Loading"})),n={pageNumber:0,pageSize:50,orgUid:null==se?void 0:se.uid,kbUid:t||pe},e.next=4,(0,y.pf)(n);case 4:i=e.sent,c.yw.destroy(),200===i.code?ue(i):c.yw.error(i.message);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();(0,h.useEffect)((function(){null!=se&&se.uid&&Ae()}),[null==se?void 0:se.uid,ee,null==be?void 0:be.uid,null==be||null===(t=be.draftServiceSettings)||void 0===t?void 0:t.welcomeKbUid,null==be||null===(n=be.serviceSettings)||void 0===n?void 0:n.welcomeKbUid,null==we?void 0:we.uid,null==we||null===(i=we.draftServiceSettings)||void 0===i?void 0:i.welcomeKbUid,null==we||null===(s=we.serviceSettings)||void 0===s?void 0:s.welcomeKbUid,null==xe?void 0:xe.uid,null==xe||null===(a=xe.draftServiceSettings)||void 0===a?void 0:a.welcomeKbUid,null==xe||null===(u=xe.serviceSettings)||void 0===u?void 0:u.welcomeKbUid]),(0,h.useEffect)((function(){var e;if(ee===f._X4?e=(null==we?void 0:we.draftServiceSettings)||(null==we?void 0:we.serviceSettings):ee===f.Njn?e=(null==be?void 0:be.draftServiceSettings)||(null==be?void 0:be.serviceSettings):ee===f.aZD&&(e=(null==xe?void 0:xe.draftServiceSettings)||(null==xe?void 0:xe.serviceSettings)),e){var t=Array.isArray(e.welcomeFaqUids)?e.welcomeFaqUids:Array.isArray(e.welcomeFaqs)?e.welcomeFaqs.map((function(e){return null==e?void 0:e.uid})).filter(Boolean):[];ne.setFieldValue("welcomeFaqUids",t)}}),[ee,ne,null==le||null===(q=le.data)||void 0===q||null===(q=q.content)||void 0===q?void 0:q.length,null==we?void 0:we.uid,null==we||null===(C=we.draftServiceSettings)||void 0===C?void 0:C.welcomeFaqUids,null==we||null===(T=we.serviceSettings)||void 0===T?void 0:T.welcomeFaqUids,null==be?void 0:be.uid,null==be||null===(R=be.draftServiceSettings)||void 0===R?void 0:R.welcomeFaqUids,null==be||null===(F=be.serviceSettings)||void 0===F?void 0:F.welcomeFaqUids,null==xe?void 0:xe.uid,null==xe||null===(A=xe.draftServiceSettings)||void 0===A?void 0:A.welcomeFaqUids,null==xe||null===(M=xe.serviceSettings)||void 0===M?void 0:M.welcomeFaqUids]);var Ze=(0,h.useCallback)((function(e){me(e),Me(e),ee===f.Njn?v.z.setState((function(t){return t.currentAgentSettings?l()(l()({},t),{},{currentAgentSettings:l()(l()({},t.currentAgentSettings),{},{serviceSettings:l()(l()({},t.currentAgentSettings.serviceSettings),{},{welcomeKbUid:e}),draftServiceSettings:l()(l()({},t.currentAgentSettings.draftServiceSettings||{}),{},{welcomeKbUid:e})})}):t})):ee===f._X4?v.z.setState((function(t){return t.currentRobotSettings?l()(l()({},t),{},{currentRobotSettings:l()(l()({},t.currentRobotSettings),{},{serviceSettings:l()(l()({},t.currentRobotSettings.serviceSettings),{},{welcomeKbUid:e}),draftServiceSettings:l()(l()({},t.currentRobotSettings.draftServiceSettings||{}),{},{welcomeKbUid:e})})}):t})):ee===f.aZD&&v.z.setState((function(t){return t.currentWorkgroupSettings?l()(l()({},t),{},{currentWorkgroupSettings:l()(l()({},t.currentWorkgroupSettings),{},{serviceSettings:l()(l()({},t.currentWorkgroupSettings.serviceSettings),{},{welcomeKbUid:e}),draftServiceSettings:l()(l()({},t.currentWorkgroupSettings.draftServiceSettings||{}),{},{welcomeKbUid:e})})}):t}))}),[ee]);return(0,h.useEffect)((function(){var e;if(ee===f._X4?e=(null==we?void 0:we.draftServiceSettings)||(null==we?void 0:we.serviceSettings):ee===f.Njn?e=(null==be?void 0:be.draftServiceSettings)||(null==be?void 0:be.serviceSettings):ee===f.aZD&&(e=(null==xe?void 0:xe.draftServiceSettings)||(null==xe?void 0:xe.serviceSettings)),e){var t,n=re(e.welcomeTip);if(Ce!==n&&Te(n),e.welcomeKbUid)if(ne.setFieldValue("welcomeKbUid",e.welcomeKbUid),pe!==e.welcomeKbUid)me(e.welcomeKbUid),null!=ge&&null!==(t=ge.data)&&void 0!==t&&null!==(t=t.content)&&void 0!==t&&t.length&&Me(e.welcomeKbUid);var i=Array.isArray(e.welcomeFaqUids)?e.welcomeFaqUids:Array.isArray(e.welcomeFaqs)?e.welcomeFaqs.map((function(e){return null==e?void 0:e.uid})).filter(Boolean):[];ne.setFieldValue("welcomeFaqUids",i),Re.current=!0}}),[ee,null==we||null===(Z=we.draftServiceSettings)||void 0===Z?void 0:Z.welcomeTip,null==we||null===(N=we.draftServiceSettings)||void 0===N?void 0:N.welcomeKbUid,null==we||null===(X=we.draftServiceSettings)||void 0===X?void 0:X.welcomeFaqUids,null==we||null===(K=we.serviceSettings)||void 0===K?void 0:K.welcomeTip,null==we||null===(_=we.serviceSettings)||void 0===_?void 0:_.welcomeKbUid,null==we||null===(I=we.serviceSettings)||void 0===I?void 0:I.welcomeFaqUids,null==be||null===(W=be.draftServiceSettings)||void 0===W?void 0:W.welcomeTip,null==be||null===(L=be.draftServiceSettings)||void 0===L?void 0:L.welcomeKbUid,null==be||null===(D=be.draftServiceSettings)||void 0===D?void 0:D.welcomeFaqUids,null==be||null===(V=be.serviceSettings)||void 0===V?void 0:V.welcomeTip,null==be||null===(P=be.serviceSettings)||void 0===P?void 0:P.welcomeKbUid,null==be||null===(E=be.serviceSettings)||void 0===E?void 0:E.welcomeFaqUids,null==xe||null===(z=xe.draftServiceSettings)||void 0===z?void 0:z.welcomeTip,null==xe||null===(O=xe.draftServiceSettings)||void 0===O?void 0:O.welcomeKbUid,null==xe||null===(B=xe.draftServiceSettings)||void 0===B?void 0:B.welcomeFaqUids,null==xe||null===(J=xe.serviceSettings)||void 0===J?void 0:J.welcomeTip,null==xe||null===(Q=xe.serviceSettings)||void 0===Q?void 0:Q.welcomeKbUid,null==xe||null===(Y=xe.serviceSettings)||void 0===Y?void 0:Y.welcomeFaqUids,null==ge||null===($=ge.data)||void 0===$||null===($=$.content)||void 0===$?void 0:$.length,pe]),(0,j.jsxs)(S.A,{form:ne,submitter:!1,style:{marginLeft:"20px"},children:[(0,j.jsx)(S.A.Item,{name:"welcomeTip",label:(0,j.jsxs)("span",{children:[ie.formatMessage({id:"agent.settings.welcome.tip"}),(0,j.jsx)(x.Z,{type:"service",keys:["welcomeTip"],live:ee===f.Njn?null==be?void 0:be.serviceSettings:ee===f._X4?null==we?void 0:we.serviceSettings:null==xe?void 0:xe.serviceSettings,draft:ee===f.Njn?null==be?void 0:be.draftServiceSettings:ee===f._X4?null==we?void 0:we.draftServiceSettings:null==xe?void 0:xe.draftServiceSettings})]}),tooltip:ie.formatMessage({id:"agent.settings.welcome.tip"}),rules:[{required:!0,message:ie.formatMessage({id:"agent.settings.welcome.tip.required"})}],children:(0,j.jsx)(w.Z,{placeholder:ie.formatMessage({id:"agent.settings.welcome.tip.placeholder"}),value:Ce,toolbarKeys:(0,b.eD)(),style:{height:"200px",width:"600px"},maxLength:200,onChange:Fe})}),(0,j.jsx)(p.Z,{name:"welcomeKbUid",width:"md",label:(0,j.jsxs)("span",{children:[ie.formatMessage({id:"menu.kbase.select",defaultMessage:"选择欢迎语常见问题知识库"}),(0,j.jsx)(x.Z,{type:"service",keys:["welcomeKbUid"],live:ee===f.Njn?null==be?void 0:be.serviceSettings:ee===f._X4?null==we?void 0:we.serviceSettings:null==xe?void 0:xe.serviceSettings,draft:ee===f.Njn?null==be?void 0:be.draftServiceSettings:ee===f._X4?null==we?void 0:we.draftServiceSettings:null==xe?void 0:xe.draftServiceSettings})]}),options:null==ge||null===(H=ge.data)||void 0===H||null===(H=H.content)||void 0===H?void 0:H.map((function(e){return{label:re(e.name),value:e.uid}})),fieldProps:{onChange:Ze,allowClear:!0,placeholder:(0,j.jsx)(m.FormattedMessage,{id:"choose",defaultMessage:"Choose"})}}),(0,j.jsx)(p.Z,{name:"welcomeFaqUids",width:"md",label:(0,j.jsxs)("span",{children:[ie.formatMessage({id:"menu.kbase.faq.welcome"}),(0,j.jsx)(x.Z,{type:"service",keys:["welcomeFaqUids"],live:ee===f.Njn?null==be?void 0:be.serviceSettings:ee===f._X4?null==we?void 0:we.serviceSettings:null==xe?void 0:xe.serviceSettings,draft:ee===f.Njn?null==be?void 0:be.draftServiceSettings:ee===f._X4?null==we?void 0:we.draftServiceSettings:null==xe?void 0:xe.draftServiceSettings})]}),options:null==le||null===(G=le.data)||void 0===G||null===(G=G.content)||void 0===G?void 0:G.map((function(e){return{label:re(e.question),value:e.uid}})),fieldProps:{mode:"multiple",allowClear:!0,placeholder:(0,j.jsx)(m.FormattedMessage,{id:"choose",defaultMessage:"Choose"}),onChange:function(e){ee===f.Njn?v.z.setState((function(t){return t.currentAgentSettings?l()(l()({},t),{},{currentAgentSettings:l()(l()({},t.currentAgentSettings),{},{serviceSettings:l()(l()({},t.currentAgentSettings.serviceSettings),{},{welcomeFaqUids:e}),draftServiceSettings:l()(l()({},t.currentAgentSettings.draftServiceSettings||{}),{},{welcomeFaqUids:e})})}):t})):ee===f._X4?v.z.setState((function(t){return t.currentRobotSettings?l()(l()({},t),{},{currentRobotSettings:l()(l()({},t.currentRobotSettings),{},{serviceSettings:l()(l()({},t.currentRobotSettings.serviceSettings),{},{welcomeFaqUids:e}),draftServiceSettings:l()(l()({},t.currentRobotSettings.draftServiceSettings||{}),{},{welcomeFaqUids:e})})}):t})):ee===f.aZD&&v.z.setState((function(t){return t.currentWorkgroupSettings?l()(l()({},t),{},{currentWorkgroupSettings:l()(l()({},t.currentWorkgroupSettings),{},{serviceSettings:l()(l()({},t.currentWorkgroupSettings.serviceSettings),{},{welcomeFaqUids:e}),draftServiceSettings:l()(l()({},t.currentWorkgroupSettings.draftServiceSettings||{}),{},{welcomeFaqUids:e})})}):t}))}}})]})}},23968:function(e,t,n){n(76711),n(90819),n(89933),n(73193),n(45332),n(66675),n(48388),n(81997),n(91733),n(77686),n(68992),n(62395),n(44194),n(72309),n(54008),n(99754),n(87005),n(18313),n(90170),n(34203),n(83262),n(6677),n(94571),n(44635),n(31549)},57648:function(e,t,n){n(76711),n(90819),n(73193),n(89933),n(45332),n(18313),n(90170),n(34203),n(48388),n(91733),n(68992),n(62395),n(44194);var i=n(78380);n(83262),n(31549),i.Z.Option},83262:function(e,t,n){n.d(t,{Z:function(){return k}});var i=n(73193),r=n.n(i),s=n(44194),o=n(62954),a=n(33633),l=n(86222),u=n.n(l),d=n(89957),c=n.n(d),g=["welcomeFaqUids","faqUids","quickFaqUids","guessFaqUids","hotFaqUids","shortcutFaqUids","proactiveFaqUids","worktimeUids"],v=["welcomeFaqs","faqs","quickFaqs","guessFaqs","hotFaqs","shortcutFaqs","proactiveFaqs"];function f(e){return"[object Object]"===Object.prototype.toString.call(e)}function S(e,t){if(!e)return e;if(!t||0===t.length)return e;var n={};return t.forEach((function(t){Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])})),n}function p(e){if(!Array.isArray(e))return e;var t=e.slice();return t.every((function(e){return["string","number","boolean"].includes(c()(e))}))?t.map((function(e){return"string"==typeof e?e:String(e)})).sort():t}function m(e){var t=e&&f(e)?r()({},e):{};return v.forEach((function(e){t[e]&&(t[e.replace(/s$/,"Uids")]=function(e){if(Array.isArray(e))return e.map((function(e){return null==e?void 0:e.uid})).filter(Boolean).map(String)}(t[e]),delete t[e])})),g.forEach((function(e){t[e]&&(t[e]=p(t[e]))})),t}function h(e){var t=e&&f(e)?r()({},e):{};return t.worktimeUids&&(t.worktimeUids=p(t.worktimeUids)),delete t.worktimes,t}function w(e){var t=new WeakSet;return JSON.stringify(function e(n){if(null===n||"object"!==c()(n))return n;if(!t.has(n)){if(t.add(n),Array.isArray(n))return n.map((function(t){return e(t)}));var i,r=Object.keys(n).sort(),s={},o=u()(r);try{for(o.s();!(i=o.n()).done;){var a=i.value;s[a]=e(n[a])}}catch(e){o.e(e)}finally{o.f()}return s}}(e))}function b(e,t){return w(e)===w(t)}var x=n(31549),k=function(e){var t=e.hasDiff,n=e.type,i=void 0===n?"service":n,l=e.live,u=e.draft,d=e.keys,c=e.text,g=void 0===c?"草稿未发布":c,v=e.style;return(0,s.useMemo)((function(){if("boolean"==typeof t)return t;if(!l&&!u)return!1;switch(i){case"service":return function(e,t,n){return!b(S(m(e),n),S(m(t),n))}(l,u,d);case"messageLeave":return function(e,t,n){return!b(S(h(e),n),S(h(t),n))}(l,u,d);default:return function(e,t,n){return!b(S(e||{},n),S(t||{},n))}(l,u,d)}}),[t,i,l,u,d])?(0,x.jsx)(o.Z,{title:"string"==typeof g?g:"草稿与线上不一致",children:(0,x.jsx)(a.Z,{color:"orange",style:r()({marginLeft:8,height:20,lineHeight:"18px"},v),children:"Draft"})}):null}},91733:function(e,t,n){n.d(t,{z:function(){return a}});var i=n(68992),r=n(58063),s=n(66266),o=n(31403),a=(0,r.Ue)()((0,s.mW)((0,s.tJ)((0,o.n)((function(e){return{currentAgentSettings:null,currentRobotSettings:null,currentWorkgroupSettings:null,setCurrentAgentSettings:function(t){return e({currentAgentSettings:t})},setCurrentRobotSettings:function(t){return e({currentRobotSettings:t})},setCurrentWorkgroupSettings:function(t){return e({currentWorkgroupSettings:t})},clear:function(){return e({currentAgentSettings:null,currentRobotSettings:null,currentWorkgroupSettings:null})}}})),{name:i.rpR})))}}]);