import{A as e,C as t,E as n,M as r,St as i,V as a,X as o,bt as s,cn as c,ft as l,lt as u,mn as d,ot as f,p,t as m,z as h}from"./_plugin-vue_export-helper-C0lsYS1a.js";import{J as g}from"./GxPagination-DaT0MOF0.js";import{a as _}from"./validate-C3ezFD8l.js";import{d as v,f as y,l as b,p as x,u as S}from"./api-C9iru3wz.js";var C={class:`intercom-room`},w={class:`text-sm text-gray-600 mb-2`},T={class:`chart-input`},E=m(r({__name:`IntercomRoom`,props:h({zxlPrdId:{},qType:{},defaultText:{},stopUpdateTextFocus:{type:Boolean},autoUpdateTextFocus:{type:Boolean},hiddenTip:{type:Boolean}},{loading:{},loadingModifiers:{}}),emits:h([`confim-successed`,`confim-failed`],[`update:loading`]),setup(r,{expose:d,emit:m}){let h=r,E=m,D=f(r,`loading`),O=s({placeholder:`请输入`,val:``}),k=i(),A=()=>k.value?.focus();return u(()=>h.defaultText,e=>{O.val=e||``,h.autoUpdateTextFocus&&a(()=>{A()})},{immediate:!0}),d({confimChartInput:async()=>{let e=h.zxlPrdId;D.value=!0;let t=null;try{if(/^module|function$/.test(h.qType)){let n=h.qType;t=await b(e,n,O.val)}else if(/^role$/.test(h.qType)){let n=h.qType;t=await x(e,n,O.val)}else if(/^businessRule$/.test(h.qType)){let n=await S(e,`bizRule`,O.val);if(n){let e=n.data||[];t={total:n.total,data:e.map(e=>({sort:e.sort,function:e.ruleTitle,explanation:e.ruleDesc}))}}}E(`confim-successed`,t)}catch(e){E(`confim-failed`,e),_({type:`warning`,message:e||`无返回值！`})}return D.value=!1,t},confimChartInputEntityField:async()=>{let e=h.zxlPrdId;D.value=!0;let t=null;try{/^entityField$/.test(h.qType)&&(h.qType,t=await v(e,`entity`,O.val))}catch(e){_({type:`warning`,message:e||`无返回值！`})}return D.value=!1,t},confimChartInputEnumItemList:async()=>{let e=h.zxlPrdId;D.value=!0;let t=null;try{/^fieldEnum$/.test(h.qType)&&(h.qType,t=await y(e,`fieldEnum`,O.val))}catch(e){_({type:`warning`,message:e||`无返回值！`})}return D.value=!1,t}}),(r,i)=>{let a=g;return o(),n(`div`,C,[l(t(`p`,w,c(`您将询问AI如下需求：`),512),[[p,!h.hiddenTip]]),i[1]||=t(`div`,{class:`chart-history`},null,-1),t(`div`,T,[e(a,{ref_key:`chartInputRef`,ref:k,type:`textarea`,modelValue:O.val,"onUpdate:modelValue":i[0]||=e=>O.val=e,autosize:{minRows:5,maxRows:10},autofocus:``,placeholder:O.placeholder,resize:`none`},null,8,[`modelValue`,`placeholder`])])])}}}),[[`__scopeId`,`data-v-596a13be`]]);export{E as t};