import{r as n,x as S,_ as b,d as h,j as e,F as R,l as m,at as w,I as F,R as k,C as I,t as j,bl as E,a as $}from"./main-BzPVmAp-.js";import{C as v}from"./index-7u0Bo8e4.js";import{C,S as D}from"./Table-kIlrKW-9.js";import{R as T}from"./ClearOutlined-EMDK-b4s.js";import"./index-SGIbgpRk.js";import"./Dropdown-Clv_Pvnt.js";import"./addEventListener-CzbSevz3.js";import"./index-BZ6Sq__j.js";var z={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M511.4 124C290.5 124.3 112 303 112 523.9c0 128 60.2 242 153.8 315.2l-37.5 48c-4.1 5.3-.3 13 6.3 12.9l167-.8c5.2 0 9-4.9 7.7-9.9L369.8 727a8 8 0 00-14.1-3L315 776.1c-10.2-8-20-16.7-29.3-26a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-7.5 7.5-15.3 14.5-23.4 21.2a7.93 7.93 0 00-1.2 11.1l39.4 50.5c2.8 3.5 7.9 4.1 11.4 1.3C854.5 760.8 912 649.1 912 523.9c0-221.1-179.4-400.2-400.6-399.9z"}}]},name:"undo",theme:"outlined"},A=function(d,l){return n.createElement(S,b({},d,{ref:l,icon:z}))},B=n.forwardRef(A);const M=({close:r,height:d,graphOpt:l,queryParams:t,...i})=>{const[a]=h.useForm(),[c,p]=n.useState([]);n.useEffect(()=>{t!=null&&t.nodes&&Array.isArray(t==null?void 0:t.nodes)&&p(t==null?void 0:t.nodes.map(o=>({value:o,name:o})))},[t==null?void 0:t.nodes]),n.useEffect(()=>{a.setFieldsValue(t==null?void 0:t.nodes_dict)},[]);const f=()=>{const o=a.getFieldsValue();console.log(o),l.updateQueryParam("nodes_dict",o)};return e.jsxs(v,{title:e.jsx(e.Fragment,{children:`${i==null?void 0:i.label}`}),styles:{body:{padding:0,height:"100%",overflowY:"auto"}},size:"small",extra:e.jsxs(R,{gap:"small",children:[e.jsx(m,{style:{cursor:"pointer"},onClick:()=>{(t==null?void 0:t.nodes_dict_condition)=="OR"?l.updateQueryParam("nodes_dict_condition","AND"):l.updateQueryParam("nodes_dict_condition","OR")},children:t==null?void 0:t.nodes_dict_condition}),e.jsx(w,{onClick:r})]}),style:{borderRadius:"12px",boxShadow:"0 4px 20px rgba(0,0,0,0.1)",padding:"0.5rem",overflow:"hidden",height:d},children:[e.jsx("div",{style:{marginTop:"1rem"}}),e.jsx(h.Provider,{onFormChange:f,children:e.jsx(h,{form:a,children:c.map((o,x)=>e.jsx(h.Item,{name:o.value,label:o.name,noStyle:!0,children:e.jsx(L,{title:o.name,label:o.value})},x))})})]})},L=({title:r,label:d,value:l,onChange:t})=>{const[i,a]=n.useState(!1),[c,p]=n.useState(""),[f,o]=n.useState(!1),[x,u]=n.useState([]),g=async()=>{o(!0);const s=await $.post("/entity/query-nodes",{label:d,keyword:c});u(s.data),o(!1)};return n.useEffect(()=>{g()},[c]),e.jsx(e.Fragment,{children:e.jsxs(v,{size:"small",loading:f,title:r,style:{marginBottom:"1rem"},extra:e.jsxs(D,{children:[e.jsx(j,{title:"Search",children:e.jsx(E,{style:{cursor:"pointer"},onClick:()=>{a(!i),i&&p("")}})}),e.jsx(j,{title:"Clear Selection",children:e.jsx(T,{style:{cursor:"pointer"},onClick:()=>{t(void 0)}})}),e.jsx(j,{title:"Refresh",children:e.jsx(B,{style:{cursor:"pointer"},onClick:g})})]}),children:[i&&e.jsx(F.Search,{allowClear:!0,onSearch:s=>p(s),style:{marginBottom:"0.5rem"}}),e.jsx("div",{style:{overflowY:"auto",maxHeight:"240px"},children:e.jsx(C.Group,{style:{width:"100%"},value:l,onChange:t,children:e.jsx(k,{children:x&&x.length>0&&x.filter(s=>c?s.entity_name.includes(c):!0).map((s,_)=>e.jsx(I,{span:24,style:{marginTop:"0.3em"},children:e.jsx(C,{value:s.entity_id,children:s.entity_name})},_))})})})]})})};export{M as default};
