import{B as e,R as t,S as n,St as r,T as i,Y as a,at as o,bt as s,cn as c,ct as l,f as u,ft as d,j as f,k as p}from"./vue.runtime.esm-bundler-DpGzKKN4.js";import"./GxPagination-DOexUzbO.js";import{m}from"./vnode-DU8g6Rf7.js";import{t as h}from"./_plugin-vue_export-helper-CnS4QQza.js";import{a as g}from"./validate-CTyV86Nm.js";import{d as _,f as v,l as y,p as b,u as x}from"./api-9aKmC5UF.js";var S={class:`intercom-room`},C={class:`text-sm text-gray-600 mb-2`},w={class:`chart-input`},T=h(f({__name:`IntercomRoom`,props:t({zxlPrdId:{},qType:{},defaultText:{},stopUpdateTextFocus:{type:Boolean},autoUpdateTextFocus:{type:Boolean},hiddenTip:{type:Boolean}},{loading:{},loadingModifiers:{}}),emits:t([`confim-successed`,`confim-failed`],[`update:loading`]),setup(t,{expose:f,emit:h}){let T=t,E=h,D=o(t,`loading`),O=s({placeholder:`请输入`,val:``}),k=r(),A=()=>k.value?.focus();return l(()=>T.defaultText,t=>{O.val=t||``,T.autoUpdateTextFocus&&e(()=>{A()})},{immediate:!0}),f({confimChartInput:async()=>{let e=T.zxlPrdId;D.value=!0;let t=null;try{if(/^module|function$/.test(T.qType)){let n=T.qType;t=await y(e,n,O.val)}else if(/^role$/.test(T.qType)){let n=T.qType;t=await b(e,n,O.val)}else if(/^businessRule$/.test(T.qType)){let n=await x(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),g({type:`warning`,message:e||`无返回值！`})}return D.value=!1,t},confimChartInputEntityField:async()=>{let e=T.zxlPrdId;D.value=!0;let t=null;try{/^entityField$/.test(T.qType)&&(T.qType,t=await _(e,`entity`,O.val))}catch(e){g({type:`warning`,message:e||`无返回值！`})}return D.value=!1,t},confimChartInputEnumItemList:async()=>{let e=T.zxlPrdId;D.value=!0;let t=null;try{/^fieldEnum$/.test(T.qType)&&(T.qType,t=await v(e,`fieldEnum`,O.val))}catch(e){g({type:`warning`,message:e||`无返回值！`})}return D.value=!1,t}}),(e,t)=>{let r=m;return a(),i(`div`,S,[d(n(`p`,C,c(`您将询问AI如下需求：`),512),[[u,!T.hiddenTip]]),t[1]||=n(`div`,{class:`chart-history`},null,-1),n(`div`,w,[p(r,{ref_key:`chartInputRef`,ref:k,type:`textarea`,modelValue:O.val,"onUpdate:modelValue":t[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{T as t};