import{ab as I,w as A,i as M,r as o,aA as C,aB as q,j as n,aC as y,aD as H,aE as U,aF as F,c as x}from"./index-Dbk1Plmn.js";import{u as z}from"./index-D3OXdV3z.js";function D(e){return I("/retrieve_graph_neighborhood",e)}function J(e){return A({queryKey:["graph-neighborhood",e],queryFn:()=>D(e),enabled:M()&&!!(e!=null&&e.node_id)})}var b="Switch",[G]=F(b),[L,O]=G(b),E=o.forwardRef((e,r)=>{const{__scopeSwitch:t,name:a,checked:s,defaultChecked:v,required:d,disabled:i,value:u="on",onCheckedChange:w,form:c,...g}=e,[l,p]=o.useState(null),m=C(r,f=>p(f)),S=o.useRef(!1),k=l?c||!!l.closest("form"):!0,[h,B]=q({prop:s,defaultProp:v??!1,onChange:w,caller:b});return n.jsxs(L,{scope:t,checked:h,disabled:i,children:[n.jsx(y.button,{type:"button",role:"switch","aria-checked":h,"aria-required":d,"data-state":R(h),"data-disabled":i?"":void 0,disabled:i,value:u,...g,ref:m,onClick:H(e.onClick,f=>{B(T=>!T),k&&(S.current=f.isPropagationStopped(),S.current||f.stopPropagation())})}),k&&n.jsx(_,{control:l,bubbles:!S.current,name:a,value:u,checked:h,required:d,disabled:i,form:c,style:{transform:"translateX(-100%)"}})]})});E.displayName=b;var N="SwitchThumb",P=o.forwardRef((e,r)=>{const{__scopeSwitch:t,...a}=e,s=O(N,t);return n.jsx(y.span,{"data-state":R(s.checked),"data-disabled":s.disabled?"":void 0,...a,ref:r})});P.displayName=N;var K="SwitchBubbleInput",_=o.forwardRef(({__scopeSwitch:e,control:r,checked:t,bubbles:a=!0,...s},v)=>{const d=o.useRef(null),i=C(d,v),u=z(t),w=U(r);return o.useEffect(()=>{const c=d.current;if(!c)return;const g=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(g,"checked").set;if(u!==t&&p){const m=new Event("click",{bubbles:a});p.call(c,t),c.dispatchEvent(m)}},[u,t,a]),n.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...s,tabIndex:-1,ref:i,style:{...s.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});_.displayName=K;function R(e){return e?"checked":"unchecked"}var j=E,Q=P;const W=o.forwardRef(({className:e,...r},t)=>n.jsx(j,{className:x("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...r,ref:t,children:n.jsx(Q,{className:x("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));W.displayName=j.displayName;export{W as S,J as u};
