import{J as La,d as je,k as Qe,l as Vt,p as ga,r as Rt,o as oe,x as Le,z as Ee,F as Je,h as Lt,A as St,u as Ie,b as W,a as _e,c as We,t as et,D as ya,B as nt,M as zt,q as ka,G as Ea,H as Sa,m as $t,X as Pa,a0 as Fa,w as Ua}from"./vue.1703796278973.js";import{z as Ba,B as Ga,C as Ya,Y as ba,a7 as qa,cF as Ha,I as Wt,aK as Va,K as jt,aE as za,aF as $a,M as Wa,aI as ja,aV as Qa,aP as Ka,a0 as Za,cA as fa,aL as Xa,W as Ja,r as ha,aJ as en,a5 as Ta,a6 as Aa,aR as tn,D as an,a2 as nn}from"./index.17037962789732.js";import"./index.170379627897325.js";import"./index.170379627897316.js";import"./index.170379627897317.js";import"./index.1703796278973312.js";import"./index.170379627897318.js";import"./index.170379627897319.js";import"./index.170379627897314.js";import"./index.170379627897315.js";import"./index.170379627897338.js";import"./index.170379627897332.js";import{_ as bt}from"./_plugin-vue_export-helper.1703796278973.js";import"./index.170379627897337.js";import"./index.1703796278973310.js";import"./index.1703796278973305.js";import"./index.1703796278973301.js";import"./index.1703796278973302.js";import"./index.1703796278973303.js";import"./index.170379627897339.js";import"./index.1703796278973304.js";import"./index.1703796278973320.js";import{u as Ia}from"./product.17037962789738.js";import{h as rn}from"./moment.1703796278973.js";import{x as Oa}from"./system.1703796278973.js";import"./index.170379627897320.js";import"./index.170379627897336.js";import{i as on,j as sn}from"./product.17037962789737.js";import{b as ln,c as cn}from"./dayjs.min.1703796278973.js";import"./index.170379627897322.js";import"./index.170379627897323.js";const Da=La({id:"ruleEditor",state:()=>({state:{model:"simple",code:"",log:[]}}),actions:{set(D,K){this.state[D]=K}}}),_n={class:"editor-box"},dn={class:"top"},un={class:"left"},pn=["onClick"],mn={class:"right"},gn={key:0},En={class:"editor"},Sn=je({name:"Editor"}),bn=je({...Sn,props:{mode:null,id:null,value:null},emits:["change","update:value"],setup(D,{expose:K,emit:ve}){const Z=D,pe=Qe(),P=[{key:"add",value:"+"},{key:"subtract",value:"-"},{key:"multiply",value:"*"},{key:"divide",value:"/"},{key:"parentheses",value:"()"},{key:"cubic",value:"^"},{key:"dayu",value:">"},{key:"dayudengyu",value:">="},{key:"dengyudengyu",value:"=="},{key:"xiaoyudengyu",value:"<="},{key:"xiaoyu",value:"<"},{key:"jiankuohao",value:"<>"},{key:"andand",value:"&&"},{key:"huohuo",value:"||"},{key:"fei",value:"!"},{key:"and",value:"&"},{key:"huo",value:"|"},{key:"bolang",value:"~"}],de=Vt({get:()=>Z.value||"",set:t=>{ve("update:value",t)}}),c=Qe(!1);ga(()=>{setTimeout(()=>{c.value=!0},100)});const s=t=>{var a;(a=pe.value)==null||a.insert(t)},e=()=>{Z.id&&ve("change","advance")};return K({addOperatorValue:s}),(t,a)=>{const n=Rt("AIcon"),r=Ba,i=Ga,o=Ya,l=ba,_=qa;return oe(),Le("div",_n,[Ee("div",dn,[Ee("div",un,[(oe(!0),Le(Je,null,Lt(Ie(P).filter((d,p)=>p<=3),d=>(oe(),Le("span",{key:d.key,onClick:p=>s(d.value)},St(d.value),9,pn))),128)),Ee("span",null,[W(o,null,{overlay:_e(()=>[W(i,null,{default:_e(()=>[(oe(!0),Le(Je,null,Lt(Ie(P).filter((d,p)=>p>6),d=>(oe(),We(r,{key:d.key,onClick:p=>s(d.value)},{default:_e(()=>[et(St(d.value),1)]),_:2},1032,["onClick"]))),128))]),_:1})]),default:_e(()=>[W(n,{type:"MoreOutlined"})]),_:1})])]),Ee("div",mn,[D.mode!=="advance"?(oe(),Le("span",gn,[W(l,{title:D.id?"设置属性规则":"请先输入标识"},{default:_e(()=>[W(n,{type:"FullscreenOutlined",class:ya(D.id?"":"disabled"),onClick:e},null,8,["class"])]),_:1},8,["title"])])):nt("",!0)])]),Ee("div",En,[Ie(c)?(oe(),We(_,{key:0,"model-value":Ie(de),"onUpdate:model-value":a[0]||(a[0]=d=>zt(de)?de.value=d:null),theme:"vs",ref_key:"editor",ref:pe,language:"javascript"},null,8,["model-value"])):nt("",!0)])])}}});const wa=bt(bn,[["__scopeId","data-v-50a34a8f"]]),Ca=D=>(Ea("data-v-b8e7eb1f"),D=D(),Sa(),D),fn={class:"debug-container"},hn={class:"left"},Tn={class:"header"},Cn=Ca(()=>Ee("div",{class:"title"},[et(" 属性赋值 "),Ee("div",{class:"description"},"请对上方规则使用的属性进行赋值")],-1)),vn=Ca(()=>Ee("a",{style:{"margin-left":"75px"}},"发送数据",-1)),Rn=[vn],Nn={class:"right"},On={class:"header"},yn=Ca(()=>Ee("div",{class:"title"},[Ee("div",null,"运行结果")],-1)),An={class:"action"},In={class:"log"},Dn=je({name:"Debug"}),wn=je({...Dn,props:{virtualRule:Object,id:String},setup(D){const K=D,ve=Qe(!0),Z=Qe([]),pe=[{title:"属性ID",dataIndex:"id",key:"id"},{title:"当前值",dataIndex:"current",key:"current"},{title:"上一值",dataIndex:"last",key:"last"},{title:"",key:"action"}],P=()=>{Z.value.push({})},de=p=>{Z.value.splice(p,1)},c=Qe(),s=Qe(new Date().getTime()),e=Ia(),t=Da(),a=()=>{var S,m,E;const p=e.current.metadata||"{}",u=JSON.parse(p).properties||[],g=Z.value.map(b=>{var C;const T=u.find(v=>v.id===b.id);return{...b,type:(C=T==null?void 0:T.valueType)==null?void 0:C.type}});if(c.value&&((m=(S=c.value).unsubscribe)==null||m.call(S)),!((E=K.virtualRule)!=null&&E.script)){ve.value=!0,Wa.warning("请编辑规则");return}c.value=Oa(`virtual-property-debug-${K.id}-${new Date().getTime()}`,"/virtual-property-debug",{virtualId:`${s.value}-virtual-id`,property:K.id,virtualRule:{...K.virtualRule},properties:g||[]}),c.value.subscribe(b=>{var T;t.state.log.push({time:new Date().getTime(),content:JSON.stringify(b.payload)}),((T=K.virtualRule)==null?void 0:T.type)!=="window"&&o()})},n=Qe(),r=async()=>{var S,m;n.value&&((m=(S=n.value).unsubscribe)==null||m.call(S));const p=e.current.metadata||"{}",u=JSON.parse(p).properties||[],g=Z.value.map(E=>{var T;const b=u.find(C=>C.id===E.id);return{...E,type:(T=b==null?void 0:b.valueType)==null?void 0:T.type}});n.value=Oa(`virtual-property-debug-${K.id}-${new Date().getTime()}`,"/virtual-property-debug",{virtualId:`${s.value}-virtual-id`,property:K.id,virtualRule:{...K.virtualRule},properties:g||[]}),n.value.subscribe(E=>{})},i=()=>{ve.value=!1,a()},o=()=>{var p,u;ve.value=!0,c.value&&((u=(p=c.value).unsubscribe)==null||u.call(p))},l=()=>{t.set("log",[])};ka(()=>{var p,u;c.value&&((u=(p=c.value).unsubscribe)==null||u.call(p)),l()});const _=Qe();return(()=>{const p=e.current.metadata||"{}",u=JSON.parse(p).properties||[];_.value=u.filter(g=>g.id!==K.id).map(g=>({label:g.name,value:g.id}))})(),(p,u)=>{var f;const g=Ha,S=Wt,m=Rt("AIcon"),E=Va,b=jt,T=ba,C=za,v=$a;return oe(),Le("div",fn,[Ee("div",hn,[Ee("div",Tn,[Ee("div",null,[Cn,!Ie(ve)&&((f=D.virtualRule)==null?void 0:f.type)==="window"?(oe(),Le("div",{key:0,class:"action",onClick:r},Rn)):nt("",!0)])]),W(E,{columns:pe,"data-source":Ie(Z),pagination:!1,bordered:"",size:"small"},{bodyCell:_e(({column:h,record:R,index:O})=>[h.key==="id"?(oe(),We(g,{key:0,options:Ie(_),value:R.id,"onUpdate:value":y=>R.id=y,size:"small",style:{width:"130px"}},null,8,["options","value","onUpdate:value"])):nt("",!0),h.key==="current"?(oe(),We(S,{key:1,value:R.current,"onUpdate:value":y=>R.current=y,size:"small"},null,8,["value","onUpdate:value"])):nt("",!0),h.key==="last"?(oe(),We(S,{key:2,value:R.last,"onUpdate:value":y=>R.last=y,size:"small"},null,8,["value","onUpdate:value"])):nt("",!0),h.key==="action"?(oe(),We(m,{key:3,type:"DeleteOutlined",onClick:y=>de(O)},null,8,["onClick"])):nt("",!0)]),_:1},8,["data-source"]),W(b,{type:"dashed",block:"",style:{"margin-top":"5px"},onClick:P},{icon:_e(()=>[W(m,{type:"PlusOutlined"})]),default:_e(()=>[et(" 添加条目 ")]),_:1})]),Ee("div",Nn,[Ee("div",On,[yn,Ee("div",An,[Ee("div",null,[Ie(ve)?(oe(),Le("a",{key:0,onClick:i}," 开始运行 ")):(oe(),Le("a",{key:1,onClick:o}," 停止运行 "))]),Ee("div",null,[Ee("a",{onClick:l}," 清空 ")])])]),Ee("div",In,[W(v,null,{default:_e(()=>[(oe(!0),Le(Je,null,Lt(Ie(t).state.log,h=>(oe(),We(C,{label:Ie(rn)(h.time).format("HH:mm:ss"),key:h.time,span:3},{default:_e(()=>[W(T,{placement:"top",title:h.content},{default:_e(()=>[et(St(h.content),1)]),_:2},1032,["title"])]),_:2},1032,["label"]))),128))]),_:1})])])])}}});const xn=bt(wn,[["__scopeId","data-v-b8e7eb1f"]]);function xa(D,K,ve){const Z=ja.cloneDeep(D),pe=P=>{P.forEach(de=>{var c;if(de.visible=Mn(K,de,ve),de.children&&pe(de.children),!de.visible&&((c=de.children)!=null&&c.length)){const s=!de.children.some(e=>e.visible);de.visible=!s}})};return pe(Z),Ma(Z)}function Mn(D,K,ve){return K[ve].includes(D)}function Ma(D){return D.filter(K=>(K.children&&(K.children=Ma(K.children)),K.visible))}const Ln=[{children:[{children:[],name:"加",id:"operator-1"},{children:[],name:"减",id:"operator-2"},{children:[],name:"乘",id:"operator-3"},{children:[],name:"除",id:"operator-4"},{children:[],name:"括号",id:"operator-5"},{children:[],name:"按位异或",id:"operator-6"}],name:"操作符",id:"operator"},{children:[{children:[],name:"if",id:"if"},{children:[],name:"for",id:"for"},{children:[],name:"while",id:"while"}],name:"控制语句",id:"control"}],kn=xa(Ln,"操作","name");console.log(JSON.stringify(kn),"mytree");var ma={},Pn={get exports(){return ma},set exports(D){ma=D}};(function(D,K){(function(ve,Z){D.exports=Z(Qa)})(typeof self<"u"?self:cn,function(ve){return(()=>{var Z={7679:function(c,s){var e,t,a;(function(n,r){t=[],e=r,a=typeof e=="function"?e.apply(s,t):e,a===void 0||(c.exports=a)})(typeof self<"u"&&self,function(){function n(){var r=Object.getOwnPropertyDescriptor(document,"currentScript");if(!r&&"currentScript"in document&&document.currentScript||r&&r.get!==n&&document.currentScript)return document.currentScript;try{throw new Error}catch(b){var i,o,l,_=/.*at [^(]*\((.*):(.+):(.+)\)$/gi,d=/@([^@]*):(\d+):(\d+)\s*$/gi,p=_.exec(b.stack)||d.exec(b.stack),u=p&&p[1]||!1,g=p&&p[2]||!1,S=document.location.href.replace(document.location.hash,""),m=document.getElementsByTagName("script");u===S&&(i=document.documentElement.outerHTML,o=new RegExp("(?:[^\\n]+?\\n){0,"+(g-2)+"}[^<]*