import{J as v,k as b}from"./vue.1703796278973.js";import{d as w}from"./scene.17037962789732.js";import{r as k}from"./utils.1703796278973.js";import{V as r}from"./index.17037962789732.js";import{i as S}from"./isArray.1703796278973.js";const f=s=>{const a=["when","then","terms","actions"];return s?s.map(e=>(e&&(e.key=k(),Object.keys(e).some(o=>{a.includes(o)&&S(e[o])&&(e[o]=f(e[o]))})),e)):[]},l=[{when:[{terms:[{column:void 0,value:{source:"fixed",value:void 0},termType:void 0,key:"params_1",type:"and"}],type:"and",key:"terms_1"}],key:"branches_1",shakeLimit:{enabled:!1,time:1,threshold:1,alarmFirst:!1},then:[]}],i={trigger:{},when:[{terms:[{terms:[["","eq","","and"]]}]}]},L=v("scene",()=>{const s=b({trigger:{type:""},options:i,branches:l,description:"",name:"",id:void 0}),a={},e=()=>{s.value={trigger:{type:""},options:r(i),branches:r(l),description:"",name:"",id:void 0}};return{data:s,productCache:a,getDetail:async y=>{var p,d,g,u;e();const h=await w(y);if(h.success){const n=h.result,m=n.triggerType;let t=n.branches;if(!t)t=r(l),m==="device"?t.push(null):t[0].when.length=[];else{const c=t.length;m==="device"&&(c===1&&((d=(p=t[0])==null?void 0:p.when)!=null&&d.length)||c>1&&((u=(g=t[c-1])==null?void 0:g.when)!=null&&u.length))&&t.push(null)}console.log(t),s.value={...n,trigger:n.trigger||{},branches:r(f(t)),options:n.options?{...r(i),...n.options}:r(i)}}},refresh:e}});export{L as u};
