const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ValueId-DdD47gVx.js","./index-DwzE-W2i.js","./index-B2zoqM3Y.css","./colors-DoZdCu1D.js","./ValueId-8KlLQyB0.css"])))=>i.map(i=>d[i]);
import{_,d as p,s as C,e as n,z as r,w as t,b as a,F as x,ar as y,H as k,G as S,u as T,U as D,V as c,h as m,f as o,K as f,R as g,T as q,k as V,t as U,D as N,at as A,ai as B,i as v,a7 as I,y as E}from"./index-DwzE-W2i.js";const R={components:{ValueID:p(()=>E(()=>import("./ValueId-DdD47gVx.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url))},props:{modelValue:Boolean,title:String,editedValue:Object,nodes:Array},watch:{modelValue(d){this.$refs.form&&this.$refs.form.resetValidation()}},computed:{_value:{get(){return this.modelValue},set(d){this.$emit("update:modelValue",d)}}},data(){return{valid:!0,required:d=>!!d||"This field is required",positive:d=>d>=0||"Value must be positive",validValue:[d=>!!d||"This field is required",d=>d&&d.writeable||"This value is Read Only"]}},methods:{async handleSave(){(await this.$refs.form.validate()).valid&&this.$emit("save")}}};function j(d,l,i,F,u,s){const b=C("ValueID");return r(),n(I,{modelValue:s._value,"onUpdate:modelValue":l[6]||(l[6]=e=>s._value=e),"max-width":"500px"},{default:t(()=>[a(x,null,{default:t(()=>[a(y,null,{default:t(()=>[...l[7]||(l[7]=[k("span",{class:"text-h5"},"Add association",-1)])]),_:1}),a(S,null,{default:t(()=>[a(T,{"grid-list-md":""},{default:t(()=>[a(D,{modelValue:u.valid,"onUpdate:modelValue":l[4]||(l[4]=e=>u.valid=e),ref:"form","validate-on":"lazy"},{default:t(()=>[a(c,null,{default:t(()=>[a(o,{cols:"12"},{default:t(()=>[a(f,{modelValue:i.editedValue.node,"onUpdate:modelValue":l[0]||(l[0]=e=>i.editedValue.node=e),label:"Node",required:"","return-object":"","item-title":"_name",rules:[u.required],"item-value":"id",items:i.nodes},null,8,["modelValue","rules","items"])]),_:1}),i.editedValue.node?(r(),n(o,{key:0,cols:"12"},{default:t(()=>[a(f,{modelValue:i.editedValue.value,"onUpdate:modelValue":l[1]||(l[1]=e=>i.editedValue.value=e),label:"Value",required:"","return-object":"","item-title":"label",rules:u.validValue,"item-value":"id",items:i.editedValue.node.values},{selection:t(({item:e})=>[V(U((e.raw.label||e.raw.id)+(e.raw.endpoint>1?" - Endpoint "+e.raw.endpoint:"")),1)]),item:t(({item:e,props:w})=>[a(g,q(w,{title:(e.raw.label||e.raw.id)+(e.raw.endpoint>0?" - Endpoint "+e.raw.endpoint:""),subtitle:e.raw.description||"No description available"}),null,16,["title","subtitle"])]),_:1},8,["modelValue","rules","items"])]),_:1})):m("",!0),i.editedValue.value?(r(),n(o,{key:1,cols:"12"},{default:t(()=>[a(b,{disable_send:"",modelValue:i.editedValue.value,"onUpdate:modelValue":l[2]||(l[2]=e=>i.editedValue.value=e)},null,8,["modelValue"])]),_:1})):m("",!0),a(o,{cols:"12"},{default:t(()=>[a(N,{modelValue:i.editedValue.timeout,"onUpdate:modelValue":l[3]||(l[3]=e=>i.editedValue.timeout=e),modelModifiers:{number:!0},label:"Timeout",hint:"Seconds to wait before send this value. Set to 0 to send immediately",suffix:"s",rules:[u.positive],required:"",type:"number"},null,8,["modelValue","rules"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1}),a(A,null,{default:t(()=>[a(B),a(v,{color:"blue-darken-1",variant:"text",onClick:l[5]||(l[5]=e=>d.$emit("close"))},{default:t(()=>[...l[8]||(l[8]=[V("Cancel",-1)])]),_:1}),a(v,{color:"blue-darken-1",variant:"text",onClick:s.handleSave},{default:t(()=>[...l[9]||(l[9]=[V("Save",-1)])]),_:1},8,["onClick"])]),_:1})]),_:1})]),_:1},8,["modelValue"])}const P=_(R,[["render",j]]);export{P as default};
