import{V as x,I as g}from"./index.17037962789732.js";import"./index.170379627897314.js";import"./index.170379627897315.js";import{P as O}from"./index.170379627897387.js";import"./Double.vue_vue_type_script_setup_true_name_DoubleParamsDropdown_lang.1703796278973.js";import{h as _}from"./index.1703796278973317.js";import{d as V,k as f,l as p,w as k,o as I,c as S,a as T,b as w,u as o,M as d}from"./vue.1703796278973.js";const U=V({__name:"FunctionItem",props:{data:{type:Object,default:()=>{}},builtInList:{type:Array,default:()=>[]},value:{type:String},source:{type:String,default:"fixed"}},emits:["update:value","update:source","change"],setup(v,{emit:s}){const u=v,l=f(),n=f(),m=p(()=>{var e,t;return[{label:"手动输入",component:(t=(e=u.data)==null?void 0:e.valueType)==null?void 0:t.type,key:"fixed"},{label:"内置参数",component:"tree",key:"upper"}]}),y=p(()=>{var r;const e=((r=u.data)==null?void 0:r.valueType)||"int",t=e==null?void 0:e.type;return t==="boolean"?[{label:e.trueText||!0,value:e.trueValue||!0,id:String(e.trueValue||!0)},{label:e.falseText||!1,value:e.falseValue||!1,id:String(e.falseValue||!1)}]:t==="enum"?e==null?void 0:e.elements.map(a=>({label:a.text,value:a.value,id:a.value})):[]}),c=(e,t)=>{if(e&&t){const r=t.filter(a=>{if(a.children){const i=c(e,a.children);return a.children=i,!!i.length}else if(a.type===e)return!0;return!1});return _(r)}return t||[]},b=p(()=>{var e;return c((e=u.data.valueType)==null?void 0:e.type,x(u==null?void 0:u.builtInList))}),h=()=>{s("update:value",l.value),s("update:source",n.value),s("change",{source:n.value,value:l.value})};return k(()=>{l.value=u.value,n.value=u.source||"fixed"}),(e,t)=>{const r=g;return I(),S(o(O),{options:o(y),tabsOptions:o(m),metricOptions:o(b),value:o(l),"onUpdate:value":t[0]||(t[0]=a=>d(l)?l.value=a:null),source:o(n),"onUpdate:source":t[1]||(t[1]=a=>d(n)?n.value=a:null),onSelect:h,valueName:"id"},{default:T(({label:a})=>[w(r,{value:a,readonly:"",placeholder:"请选择"},null,8,["value"])]),_:1},8,["options","tabsOptions","metricOptions","value","source"])}}});export{U as _};
