import{ds as h,dt as v,du as x,m as r,dv as g,dw as q,_ as w}from"./index-share-B6-9kT2P.js";import{d as _,aP as m,aQ as R,r as z,f as E,w as P,M as B,O as C,a1 as F,R as d,$ as A,a2 as $,a4 as V,n as b}from"./vue-CrDyBScg.js";import{e as k}from"./element-plus-BbvtkfL8.js";const M={class:"intercom-room"},U={class:"text-sm text-gray-600 mb-2"},D={class:"chart-input"},L=_({__name:"IntercomRoom",props:m({zxlPrdId:{},qType:{},defaultText:{},stopUpdateTextFocus:{type:Boolean},autoUpdateTextFocus:{type:Boolean},hiddenTip:{type:Boolean}},{loading:{},loadingModifiers:{}}),emits:m(["confim-successed","confim-failed"],["update:loading"]),setup(c,{expose:f,emit:y}){const t=c,u=y,o=R(c,"loading"),n=z({placeholder:"请输入",val:""}),p=E(),I=()=>p.value?.focus();return P(()=>t.defaultText,s=>{n.val=s||"",t.autoUpdateTextFocus&&b(()=>{I()})},{immediate:!0}),f({confimChartInput:async()=>{const s=t.zxlPrdId;o.value=!0;let e=null;try{if(/^module|function$/.test(t.qType)){const a=t.qType;e=await h(s,a,n.val)}else if(/^role$/.test(t.qType)){const a=t.qType;e=await v(s,a,n.val)}else if(/^businessRule$/.test(t.qType)){const l=await x(s,"bizRule",n.val);if(l){const T=l.data||[];e={total:l.total,data:T.map(i=>({sort:i.sort,function:i.ruleTitle,explanation:i.ruleDesc}))}}}u("confim-successed",e)}catch(a){u("confim-failed",a),r({type:"warning",message:a||"无返回值！"})}return o.value=!1,e},confimChartInputEntityField:async()=>{const s=t.zxlPrdId;o.value=!0;let e=null;try{if(/^entityField$/.test(t.qType)){const a=t.qType;e=await g(s,"entity",n.val)}}catch(a){r({type:"warning",message:a||"无返回值！"})}return o.value=!1,e},confimChartInputEnumItemList:async()=>{const s=t.zxlPrdId;o.value=!0;let e=null;try{if(/^fieldEnum$/.test(t.qType)){const a=t.qType;e=await q(s,"fieldEnum",n.val)}}catch(a){r({type:"warning",message:a||"无返回值！"})}return o.value=!1,e}}),(s,e)=>{const a=k;return C(),B("div",M,[F(d("p",U,A("您将询问AI如下需求："),512),[[$,!t.hiddenTip]]),e[1]||(e[1]=d("div",{class:"chart-history"},null,-1)),d("div",D,[V(a,{ref_key:"chartInputRef",ref:p,type:"textarea",modelValue:n.val,"onUpdate:modelValue":e[0]||(e[0]=l=>n.val=l),autosize:{minRows:5,maxRows:10},autofocus:"",placeholder:n.placeholder,resize:"none"},null,8,["modelValue","placeholder"])])])}}}),H=w(L,[["__scopeId","data-v-596a13be"]]);export{H as I};
