zigbee2mqtt-windfront 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/assets/About-CnEelo-p.js +1 -0
- package/dist/assets/About-CnEelo-p.js.br +0 -0
- package/dist/assets/{Availability-Jxv3jj-f.js → Availability-eX8lfQfx.js} +1 -1
- package/dist/assets/Availability-eX8lfQfx.js.br +0 -0
- package/dist/assets/Bind-o8FYzqyR.js +1 -0
- package/dist/assets/Bind-o8FYzqyR.js.br +0 -0
- package/dist/assets/Bridge-DtIUyQK3.js +1 -0
- package/dist/assets/Bridge-DtIUyQK3.js.br +0 -0
- package/dist/assets/{CheckboxField-aJECTtGJ.js → CheckboxField-_a_6gFF3.js} +1 -1
- package/dist/assets/CheckboxField-_a_6gFF3.js.br +0 -0
- package/dist/assets/{ClusterSinglePicker-Ckri6Ml1.js → ClusterSinglePicker-C0xsDw10.js} +1 -1
- package/dist/assets/ClusterSinglePicker-C0xsDw10.js.br +0 -0
- package/dist/assets/Clusters-BNTr3hkG.js +1 -0
- package/dist/assets/Clusters-BNTr3hkG.js.br +0 -0
- package/dist/assets/Dashboard-BS_vO7N3.js +1 -0
- package/dist/assets/Dashboard-BS_vO7N3.js.br +0 -0
- package/dist/assets/{DashboardFeatureWrapper-DZDafjVF.js → DashboardFeatureWrapper-Bncctj9I.js} +1 -1
- package/dist/assets/DashboardFeatureWrapper-Bncctj9I.js.br +3 -0
- package/dist/assets/{DebouncedInput-hrRL_knE.js → DebouncedInput-BLPot7Mg.js} +1 -1
- package/dist/assets/DebouncedInput-BLPot7Mg.js.br +0 -0
- package/dist/assets/DevConsole-DHHECfbv.js +1 -0
- package/dist/assets/DevConsole-DHHECfbv.js.br +0 -0
- package/dist/assets/DevConsole-ECDWDfHy.js +1 -0
- package/dist/assets/DevConsole-ECDWDfHy.js.br +0 -0
- package/dist/assets/{DeviceCard-C2NVxg8O.js → DeviceCard-CRb4NJAX.js} +1 -1
- package/dist/assets/DeviceCard-CRb4NJAX.js.br +0 -0
- package/dist/assets/{DeviceControlEditName-B_UgBTKk.js → DeviceControlEditName-B6YiCrFj.js} +1 -1
- package/dist/assets/DeviceControlEditName-B6YiCrFj.js.br +0 -0
- package/dist/assets/DeviceInfo-B6BBQZpy.js +1 -0
- package/dist/assets/DeviceInfo-B6BBQZpy.js.br +0 -0
- package/dist/assets/DevicePage-DIomA7F1.js +2 -0
- package/dist/assets/DevicePage-DIomA7F1.js.br +0 -0
- package/dist/assets/{DevicePicker-Dt0o_iaP.js → DevicePicker-D3HXeQ14.js} +1 -1
- package/dist/assets/DevicePicker-D3HXeQ14.js.br +0 -0
- package/dist/assets/DeviceSettings-Bpa_M6hS.js +1 -0
- package/dist/assets/DeviceSettings-Bpa_M6hS.js.br +0 -0
- package/dist/assets/DeviceSpecificSettings-OWRXYzH3.js +1 -0
- package/dist/assets/DeviceSpecificSettings-OWRXYzH3.js.br +0 -0
- package/dist/assets/Devices-DoUEGfhQ.js +1 -0
- package/dist/assets/Devices-DoUEGfhQ.js.br +0 -0
- package/dist/assets/DevicesPage-DO1z726A.js +1 -0
- package/dist/assets/DevicesPage-DO1z726A.js.br +0 -0
- package/dist/assets/{DisplayValue-CjZXHxIO.js → DisplayValue-VitUEjoj.js} +1 -1
- package/dist/assets/DisplayValue-VitUEjoj.js.br +0 -0
- package/dist/assets/Donate-BIW-l4zE.js +1 -0
- package/dist/assets/Donate-BIW-l4zE.js.br +0 -0
- package/dist/assets/{EndpointPicker-CX9S9S7k.js → EndpointPicker-DeJqJAPG.js} +1 -1
- package/dist/assets/EndpointPicker-DeJqJAPG.js.br +2 -0
- package/dist/assets/Exposes-DDw30MYN.js +1 -0
- package/dist/assets/Exposes-DDw30MYN.js.br +0 -0
- package/dist/assets/{Feature-DhPZqYWh.js → Feature-D7QUsVH9.js} +1 -1
- package/dist/assets/Feature-D7QUsVH9.js.br +0 -0
- package/dist/assets/Frontend-DS_kNSKc.js +1 -0
- package/dist/assets/Frontend-DS_kNSKc.js.br +0 -0
- package/dist/assets/GroupPage-BFPW652M.js +2 -0
- package/dist/assets/GroupPage-BFPW652M.js.br +0 -0
- package/dist/assets/GroupSettings-lq1P8lgr.js +1 -0
- package/dist/assets/GroupSettings-lq1P8lgr.js.br +0 -0
- package/dist/assets/Groups-csZPV_zo.js +1 -0
- package/dist/assets/Groups-csZPV_zo.js.br +0 -0
- package/dist/assets/GroupsPage-DljIMT_F.js +1 -0
- package/dist/assets/GroupsPage-DljIMT_F.js.br +0 -0
- package/dist/assets/HomePage-YI8-o4ql.js +1 -0
- package/dist/assets/HomePage-YI8-o4ql.js.br +0 -0
- package/dist/assets/{InputField-TubacR8F.js → InputField-BeSPAw7s.js} +1 -1
- package/dist/assets/InputField-BeSPAw7s.js.br +2 -0
- package/dist/assets/{LastSeen-DjUuaYXi.js → LastSeen-CKC6dVii.js} +1 -1
- package/dist/assets/LastSeen-CKC6dVii.js.br +0 -0
- package/dist/assets/LogsPage-CU53OVG0.js +1 -0
- package/dist/assets/LogsPage-CU53OVG0.js.br +0 -0
- package/dist/assets/{Lqi-BNx2QV2z.js → Lqi--o34CIaN.js} +1 -1
- package/dist/assets/Lqi--o34CIaN.js.br +0 -0
- package/dist/assets/NetworkPage-75e8wPsV.js +2 -0
- package/dist/assets/NetworkPage-75e8wPsV.js.br +0 -0
- package/dist/assets/{NumberField-B10BRlkz.js → NumberField-CenGWKiG.js} +1 -1
- package/dist/assets/NumberField-CenGWKiG.js.br +0 -0
- package/dist/assets/OtaPage-BIfDyCBa.js +1 -0
- package/dist/assets/OtaPage-BIfDyCBa.js.br +0 -0
- package/dist/assets/{PowerSource-CT5LulZX.js → PowerSource-DMP1v8Hj.js} +1 -1
- package/dist/assets/PowerSource-DMP1v8Hj.js.br +0 -0
- package/dist/assets/{RawNetworkData-uldf8APR.js → RawNetworkData-CsHA0EUW.js} +2 -2
- package/dist/assets/RawNetworkData-CsHA0EUW.js.br +0 -0
- package/dist/assets/{RawNetworkMap-CAdhahgm.js → RawNetworkMap-Dbu1KKlw.js} +2 -2
- package/dist/assets/RawNetworkMap-Dbu1KKlw.js.br +0 -0
- package/dist/assets/{RecallRemove-CLsmJI45.js → RecallRemove-C9FFSOpk.js} +1 -1
- package/dist/assets/RecallRemove-C9FFSOpk.js.br +0 -0
- package/dist/assets/Reporting-CycklZRx.js +1 -0
- package/dist/assets/Reporting-CycklZRx.js.br +0 -0
- package/dist/assets/Scene-BnOv_GcP.js +1 -0
- package/dist/assets/Scene-BnOv_GcP.js.br +0 -0
- package/dist/assets/{SelectField-CboFEeLv.js → SelectField-rhV0VUR9.js} +1 -1
- package/dist/assets/SelectField-rhV0VUR9.js.br +1 -0
- package/dist/assets/Settings-DJXqumih.js +1 -0
- package/dist/assets/Settings-DJXqumih.js.br +0 -0
- package/dist/assets/{SettingsList-BXXsCJCy.js → SettingsList-BRIQr68H.js} +1 -1
- package/dist/assets/SettingsList-BRIQr68H.js.br +0 -0
- package/dist/assets/SettingsPage-v5XX2Pgm.js +2 -0
- package/dist/assets/SettingsPage-v5XX2Pgm.js.br +0 -0
- package/dist/assets/State-BrMd6uzF.js +1 -0
- package/dist/assets/State-BrMd6uzF.js.br +0 -0
- package/dist/assets/{Table-CK8_rY6Z.js → Table-OEC1UqWW.js} +1 -1
- package/dist/assets/Table-OEC1UqWW.js.br +0 -0
- package/dist/assets/{TextareaField-Cb3faakR.js → TextareaField-DJXyoGrs.js} +1 -1
- package/dist/assets/TextareaField-DJXyoGrs.js.br +0 -0
- package/dist/assets/Tools-BSOzqbOg.js +1 -0
- package/dist/assets/Tools-BSOzqbOg.js.br +0 -0
- package/dist/assets/TouchlinkPage-ALSzb43I.js +1 -0
- package/dist/assets/TouchlinkPage-ALSzb43I.js.br +0 -0
- package/dist/assets/{VendorLink-CQWJDUO2.js → VendorLink-BCotC9rc.js} +1 -1
- package/dist/assets/VendorLink-BCotC9rc.js.br +0 -0
- package/dist/assets/{_createCompounder-COpq92ed.js → _createCompounder-BmfrG4o5.js} +1 -1
- package/dist/assets/_createCompounder-BmfrG4o5.js.br +0 -0
- package/dist/assets/{capitalize-JuEfl3u2.js → capitalize-BLdk1W85.js} +1 -1
- package/dist/assets/capitalize-BLdk1W85.js.br +0 -0
- package/dist/assets/envs-DXl2ikyY.js +1 -0
- package/dist/assets/index-BvTgMHtW.css +1 -0
- package/dist/assets/index-BvTgMHtW.css.br +0 -0
- package/dist/assets/index-DxU0bziW.js +635 -0
- package/dist/assets/index-DxU0bziW.js.br +0 -0
- package/dist/assets/{index-CUIfkU6p.js → index-i4IlTA7W.js} +1 -1
- package/dist/assets/index-i4IlTA7W.js.br +0 -0
- package/dist/assets/{jszip.min-1QgvwwzN.js → jszip.min-EyGmW6o1.js} +1 -1
- package/dist/assets/jszip.min-EyGmW6o1.js.br +0 -0
- package/dist/assets/snakeCase-CXwqbiGB.js +1 -0
- package/dist/assets/snakeCase-CXwqbiGB.js.br +0 -0
- package/dist/index.html +3 -2
- package/dist/index.html.br +0 -0
- package/package.json +6 -6
- package/dist/assets/About-Bwc-SnjR.js +0 -1
- package/dist/assets/About-Bwc-SnjR.js.br +0 -0
- package/dist/assets/Availability-Jxv3jj-f.js.br +0 -0
- package/dist/assets/Bind-CCmoXBga.js +0 -1
- package/dist/assets/Bind-CCmoXBga.js.br +0 -0
- package/dist/assets/Bridge-B00gjrw-.js +0 -1
- package/dist/assets/Bridge-B00gjrw-.js.br +0 -0
- package/dist/assets/CheckboxField-aJECTtGJ.js.br +0 -0
- package/dist/assets/ClusterSinglePicker-Ckri6Ml1.js.br +0 -0
- package/dist/assets/Clusters-C4Yp-rHe.js +0 -1
- package/dist/assets/Clusters-C4Yp-rHe.js.br +0 -0
- package/dist/assets/Dashboard-CjpyYRjt.js +0 -1
- package/dist/assets/Dashboard-CjpyYRjt.js.br +0 -0
- package/dist/assets/DashboardFeatureWrapper-DZDafjVF.js.br +0 -0
- package/dist/assets/DebouncedInput-hrRL_knE.js.br +0 -0
- package/dist/assets/DevConsole-B4vldyLk.js +0 -1
- package/dist/assets/DevConsole-B4vldyLk.js.br +0 -0
- package/dist/assets/DevConsole-FoMbBemz.js +0 -1
- package/dist/assets/DevConsole-FoMbBemz.js.br +0 -0
- package/dist/assets/DeviceCard-C2NVxg8O.js.br +0 -0
- package/dist/assets/DeviceControlEditName-B_UgBTKk.js.br +0 -0
- package/dist/assets/DeviceInfo-D7K10Qfz.js +0 -1
- package/dist/assets/DeviceInfo-D7K10Qfz.js.br +0 -0
- package/dist/assets/DevicePage-BuRX-zbG.js +0 -2
- package/dist/assets/DevicePage-BuRX-zbG.js.br +0 -0
- package/dist/assets/DevicePicker-Dt0o_iaP.js.br +0 -0
- package/dist/assets/DeviceSettings-DPEQ0NWl.js +0 -1
- package/dist/assets/DeviceSettings-DPEQ0NWl.js.br +0 -0
- package/dist/assets/DeviceSpecificSettings-B5ywqTh7.js +0 -1
- package/dist/assets/DeviceSpecificSettings-B5ywqTh7.js.br +0 -0
- package/dist/assets/Devices-DAG6vs0G.js +0 -1
- package/dist/assets/Devices-DAG6vs0G.js.br +0 -0
- package/dist/assets/DevicesPage-BgcI1RZT.js +0 -1
- package/dist/assets/DevicesPage-BgcI1RZT.js.br +0 -0
- package/dist/assets/DisplayValue-CjZXHxIO.js.br +0 -0
- package/dist/assets/Donate-BI8FFOLc.js +0 -1
- package/dist/assets/Donate-BI8FFOLc.js.br +0 -0
- package/dist/assets/EndpointPicker-CX9S9S7k.js.br +0 -0
- package/dist/assets/Exposes-CZ40iv73.js +0 -1
- package/dist/assets/Exposes-CZ40iv73.js.br +0 -0
- package/dist/assets/Feature-DhPZqYWh.js.br +0 -0
- package/dist/assets/Frontend-D8k0f0AR.js +0 -1
- package/dist/assets/Frontend-D8k0f0AR.js.br +0 -0
- package/dist/assets/GroupPage-H559xYGM.js +0 -2
- package/dist/assets/GroupPage-H559xYGM.js.br +0 -0
- package/dist/assets/GroupSettings-CEzY10KG.js +0 -1
- package/dist/assets/GroupSettings-CEzY10KG.js.br +0 -0
- package/dist/assets/Groups-QvxyfbK9.js +0 -1
- package/dist/assets/Groups-QvxyfbK9.js.br +0 -0
- package/dist/assets/GroupsPage-DQRrJ45C.js +0 -1
- package/dist/assets/GroupsPage-DQRrJ45C.js.br +0 -0
- package/dist/assets/HomePage-Dqztw8Hc.js +0 -1
- package/dist/assets/HomePage-Dqztw8Hc.js.br +0 -0
- package/dist/assets/InputField-TubacR8F.js.br +0 -0
- package/dist/assets/LastSeen-DjUuaYXi.js.br +0 -0
- package/dist/assets/LogsPage-DrJ3t-Cv.js +0 -1
- package/dist/assets/LogsPage-DrJ3t-Cv.js.br +0 -0
- package/dist/assets/Lqi-BNx2QV2z.js.br +0 -0
- package/dist/assets/NetworkPage-C4sfYTKz.js +0 -2
- package/dist/assets/NetworkPage-C4sfYTKz.js.br +0 -0
- package/dist/assets/NumberField-B10BRlkz.js.br +0 -0
- package/dist/assets/OtaPage-M9j8HXqi.js +0 -1
- package/dist/assets/OtaPage-M9j8HXqi.js.br +0 -0
- package/dist/assets/PowerSource-CT5LulZX.js.br +0 -0
- package/dist/assets/RawNetworkData-uldf8APR.js.br +0 -0
- package/dist/assets/RawNetworkMap-CAdhahgm.js.br +0 -0
- package/dist/assets/RecallRemove-CLsmJI45.js.br +0 -0
- package/dist/assets/Reporting-Bo6_VF2b.js +0 -1
- package/dist/assets/Reporting-Bo6_VF2b.js.br +0 -0
- package/dist/assets/Scene-BXVtU8op.js +0 -1
- package/dist/assets/Scene-BXVtU8op.js.br +0 -0
- package/dist/assets/SelectField-CboFEeLv.js.br +0 -0
- package/dist/assets/Settings-B5wIMTA9.js +0 -1
- package/dist/assets/Settings-B5wIMTA9.js.br +0 -0
- package/dist/assets/SettingsList-BXXsCJCy.js.br +0 -0
- package/dist/assets/SettingsPage-DnvMw2Gc.js +0 -2
- package/dist/assets/SettingsPage-DnvMw2Gc.js.br +0 -0
- package/dist/assets/State--9WxnrT8.js +0 -1
- package/dist/assets/State--9WxnrT8.js.br +0 -0
- package/dist/assets/Table-CK8_rY6Z.js.br +0 -0
- package/dist/assets/TextareaField-Cb3faakR.js.br +0 -0
- package/dist/assets/Tools-DdvQNnDA.js +0 -1
- package/dist/assets/Tools-DdvQNnDA.js.br +0 -0
- package/dist/assets/TouchlinkPage-DGFmsjIH.js +0 -1
- package/dist/assets/TouchlinkPage-DGFmsjIH.js.br +0 -0
- package/dist/assets/VendorLink-CQWJDUO2.js.br +0 -0
- package/dist/assets/_createCompounder-COpq92ed.js.br +0 -0
- package/dist/assets/capitalize-JuEfl3u2.js.br +0 -0
- package/dist/assets/index-CUIfkU6p.js.br +0 -0
- package/dist/assets/index-Cs-KexR1.js +0 -635
- package/dist/assets/index-Cs-KexR1.js.br +0 -0
- package/dist/assets/index-vRya9HWu.css +0 -1
- package/dist/assets/index-vRya9HWu.css.br +0 -0
- package/dist/assets/jszip.min-1QgvwwzN.js.br +0 -0
- package/dist/assets/snakeCase-XNTmpa2i.js +0 -1
- package/dist/assets/snakeCase-XNTmpa2i.js.br +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ap as Ox,aa as po,aq as lo,r as $,j as fe,ar as GU,b as xg,t as HU,F as ni,Y as VU,B as ts,as as WU,at as XU,au as jU,av as qU,aw as YU,ax as ZU,ay as KU,az as JU,aA as QU,aB as Qc,aC as $U,aD as eO,aE as tO,aF as Nv,s as qa,aG as HS,aH as VS,aI as WS,aJ as XS}from"./index-
|
|
1
|
+
import{ap as Ox,aa as po,aq as lo,r as $,j as fe,ar as GU,b as xg,t as HU,F as ni,Y as VU,B as ts,as as WU,at as XU,au as jU,av as qU,aw as YU,ax as ZU,ay as KU,az as JU,aA as QU,aB as Qc,aC as $U,aD as eO,aE as tO,aF as Nv,s as qa,aG as HS,aH as VS,aI as WS,aJ as XS}from"./index-DxU0bziW.js";import{E as yl,Z as ti,N as tm}from"./index-BN7eS8uY.js";import"./envs-DXl2ikyY.js";/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2010-2025 Three.js Authors
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
@@ -4230,4 +4230,4 @@ vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse;
|
|
|
4230
4230
|
top: 50%;
|
|
4231
4231
|
left: 50%;
|
|
4232
4232
|
transform: translate(-50%, -50%);
|
|
4233
|
-
}`)),document.head.appendChild(i)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var lA,cA;function D3(i,e=[]){const t=e.length;for(const n of i){const r=e.indexOf(n);if(r>-1){const s=[...e.slice(r),n].map(a=>a.data.id);throw new Error(`Invalid Graph: Circular node path detected: ${s.join(" -> ")}.`)}t>n.depth&&(n.depth=t,D3(n.out,[...e,n]))}}function U3(i,e){let t=!1;const n=i.reduce((a,o)=>({...a,[o.id]:{data:o,out:[],depth:-1,ins:[]}}),{});try{for(const a of e){const o=a.source,l=a.target;if(!n.hasOwnProperty(o))throw new Error(`Missing source Node ${o}`);if(!n.hasOwnProperty(l))throw new Error(`Missing target Node ${l}`);const c=n[o],f=n[l];f.ins.push(c),c.out.push(f)}D3(Object.values(n))}catch{t=!0}const r=Object.keys(n).map(a=>n[a].depth),s=Math.max(...r);return{invalid:t,depths:n,maxDepth:s||1}}const uA=["radialin","radialout"];function lW({nodes:i,edges:e,mode:t="lr",nodeLevelRatio:n=2}){const{depths:r,maxDepth:s,invalid:a}=U3(i,e);if(a)return null;const o=uA.includes(t)?1:5,l=i.length/s*n*o;if(t){const c=(m,y)=>x=>m?(r[x.id].depth-s/2)*l*(y?-1:1):void 0,f=c(["lr","rl"].includes(t),t==="rl"),d=c(["td","bu"].includes(t),t==="td"),p=c(["zin","zout"].includes(t),t==="zout");i.forEach(m=>{m.fx=f(m),m.fy=d(m),m.fz=p(m)})}return uA.includes(t)?Hk(c=>{const f=r[c.id];return(t==="radialin"?s-f.depth:f.depth)*l}).strength(1):null}function cW(i){return new Promise((e,t)=>{let n;function r(){n?e(n):(n=i.step(),r())}r()})}function od(i){const e=[],t=[];return i.forEachNode((n,r)=>{e.push({...r,id:n,radius:r.size||1})}),i.forEachEdge((n,r)=>{t.push({...r,id:n})}),{nodes:e,edges:t}}function uW(){const i=L=>()=>L;let t=L=>L.index,n=[],r=[],s,a,o=[100,100],l=i(1),c=i(-1),f=i(100),d=i(.1),p={},m=.1,y=.001,x=[],_=[0,0],g,b=L=>L.cluster,S="treemap",E=!0,w=.1;function T(L){if(!E)return T;S==="force"&&(g.tick(),O());for(let F=0,V=n.length,W,G=L*w;F<V;++F)W=n[F],W.vx+=(p[b(W)].x-W.x)*G,W.vy+=(p[b(W)].y-W.y)*G}function R(){n&&(S==="treemap"?H():z())}T.initialize=function(L){n=L,R()};function U(L){let F=b(L.source),V=b(L.target);return F<=V?F+"~"+V:V+"~"+F}function C(L){let F=new Map,V={};return L.forEach(function(W){F.has(b(W))||F.set(b(W),{count:0,sumforceNodeSize:0})}),L.forEach(function(W){V=F.get(b(W)),V.count=V.count+1,V.sumforceNodeSize=V.sumforceNodeSize+Math.PI*(l(W)*l(W))*1.3,F.set(b(W),V)}),F}function D(L){let F=new Map,V=[];return L.forEach(function(W){let G=U(W),Z;F.has(G)?Z=F.get(G):Z=0,Z+=1,F.set(G,Z)}),F.forEach(function(W,G){let Z,Q;Z=G.split("~")[0],Q=G.split("~")[1],Z!==void 0&&Q!==void 0&&V.push({source:Z,target:Q,count:W})}),V}function I(){let L=[],F=[],V=new Map,W,G,Z,Q,j;Q=C(n),j=D(r);for(W of Q.keys())Z=Q.get(W),L.push({id:W,size:Z.count,r:Math.sqrt(Z.sumforceNodeSize/Math.PI)}),V.set(W,G);return j.forEach(function(ee){let pe=V.get(ee.source),le=V.get(ee.target);pe!==void 0&&le!==void 0&&F.push({source:pe,target:le,count:ee.count})}),{nodes:L,links:F}}function P(){let L=[],F,V,W;W=C(T.nodes());for(F of W.keys())V=W.get(F),L.push({id:F,size:V.count});return{id:"clustersTree",children:L}}function O(){return p.none={x:0,y:0},x.forEach(function(L){S==="treemap"?p[L.data.id]={x:L.x0+(L.x1-L.x0)/2-_[0],y:L.y0+(L.y1-L.y0)/2-_[1]}:p[L.id]={x:L.x-_[0],y:L.y-_[1]}}),p}function H(){let L=TG().size(T.size());a=o0(P()).sum(F=>F.radius).sort(function(F,V){return V.height-F.height||V.value-F.value}),x=L(a).leaves(),O()}function J(){let L=0;n.length!==0&&r.forEach(function(F){let V,W;if(n){if(V=F.source,W=F.target,typeof F.source!="object"&&(V=n.find(G=>G.id===F.source)),typeof F.target!="object"&&(W=n.find(G=>G.id===F.target)),V===void 0||W===void 0)throw Error("Error setting links, couldnt find nodes for a link (see it on the console)");F.source=V,F.target=W,F.index=L++}})}function z(){let L;!n||!n.length||(J(),L=I(),s.size>0&&L.nodes.forEach(F=>{var V,W,G,Z;F.fx=(W=(V=s.get(F.id))==null?void 0:V.position)==null?void 0:W.x,F.fy=(Z=(G=s.get(F.id))==null?void 0:G.position)==null?void 0:Z.y}),g=$C(L.nodes).force("x",ox(o[0]/2).strength(.1)).force("y",lx(o[1]/2).strength(.1)).force("collide",jC(F=>F.r).iterations(4)).force("charge",eR().strength(c)).force("links",qC(L.nodes.length?L.links:[]).distance(f).strength(d)),x=g.nodes(),O())}return T.template=function(L){return arguments.length?(S=L,R(),T):S},T.groupBy=function(L){return arguments.length?typeof L=="string"?(b=function(F){return F[L]},T):(b=L,T):b},T.enableGrouping=function(L){return arguments.length?(E=L,T):E},T.strength=function(L){return arguments.length?(w=L,T):w},T.getLinkStrength=function(L){return E?b(L.source)===b(L.target)?typeof m=="function"?m(L):m:typeof y=="function"?y(L):y:typeof m=="function"?m(L):m},T.id=function(L){return arguments.length?(t=L,T):t},T.size=function(L){return arguments.length?(o=L,T):o},T.linkStrengthInterCluster=function(L){return arguments.length?(y=L,T):y},T.linkStrengthIntraCluster=function(L){return arguments.length?(m=L,T):m},T.nodes=function(L){return arguments.length?(n=L,T):n},T.links=function(L){return arguments.length?(L===null?r=[]:r=L,R(),T):r},T.template=function(L){return arguments.length?(S=L,R(),T):S},T.forceNodeSize=function(L){return arguments.length?(l=typeof L=="function"?L:i(+L),R(),T):l},T.nodeSize=T.forceNodeSize,T.forceCharge=function(L){return arguments.length?(c=typeof L=="function"?L:i(+L),R(),T):c},T.forceLinkDistance=function(L){return arguments.length?(f=typeof L=="function"?L:i(+L),R(),T):f},T.forceLinkStrength=function(L){return arguments.length?(d=typeof L=="function"?L:i(+L),R(),T):d},T.offset=function(L){return arguments.length?(_=typeof L=="function"?L:i(+L),T):_},T.getFocis=O,T.setClusters=function(L){return s=L,T},T}function no({graph:i,nodeLevelRatio:e=2,mode:t=null,dimensions:n=2,nodeStrength:r=-250,linkDistance:s=50,clusterStrength:a=.5,linkStrengthInterCluster:o=.01,linkStrengthIntraCluster:l=.5,forceLinkDistance:c=100,forceLinkStrength:f=.1,clusterType:d="force",forceCharge:p=-700,getNodePosition:m,drags:y,clusters:x,clusterAttribute:_,forceLayout:g}){const{nodes:b,edges:S}=od(i),w=n===2&&S.length>25?r*2:r;let T,R;g==="forceDirected2d"?(T=ox(),R=lx()):(T=ox(600).strength(.05),R=lx(600).strength(.05));const U=$C().force("center",R5(0,0)).force("link",qC()).force("charge",eR().strength(w)).force("x",T).force("y",R).force("z",Vk()).force("collide",jC(P=>P.radius+10)).force("dagRadial",lW({nodes:b,edges:S,mode:t,nodeLevelRatio:e})).stop();let C;if(_){let P=p;if(b!=null&&b.length){const O=Math.ceil(b.length/200);P=p*O}C=uW().setClusters(x).strength(a).template(d).groupBy(O=>O.data[_]).links(S).size([100,100]).linkStrengthInterCluster(o).linkStrengthIntraCluster(l).forceLinkDistance(c).forceLinkStrength(f).forceCharge(P).forceNodeSize(O=>O.radius)}let D=U.numDimensions(n).nodes(b);if(C&&(D=D.force("group",C)),s){let P=D.force("link");P&&(P.id(O=>O.id).links(S).distance(s),C&&(P=P.strength((C==null?void 0:C.getLinkStrength)??.1)))}const I=new Map(b.map(P=>[P.id,P]));return{step(){for(;U.alpha()>.01;)U.tick();return!0},getNodePosition(P){var O,H;if(m){const J=m(P,{graph:i,drags:y,nodes:b,edges:S});if(J)return J}return(O=y==null?void 0:y[P])!=null&&O.position?(H=y==null?void 0:y[P])==null?void 0:H.position:I.get(P)}}}function hW({graph:i,radius:e,drags:t,getNodePosition:n}){const r=RG(i,{scale:e}),{nodes:s,edges:a}=od(i);return{step(){return!0},getNodePosition(o){var l,c;if(n){const f=n(o,{graph:i,drags:t,nodes:s,edges:a});if(f)return f}return(l=t==null?void 0:t[o])!=null&&l.position?(c=t==null?void 0:t[o])==null?void 0:c.position:r==null?void 0:r[o]}}}const fW={td:{x:"x",y:"y",factor:-1},lr:{x:"y",y:"x",factor:1}};function hA({graph:i,drags:e,mode:t="td",nodeSeparation:n=1,nodeSize:r=[50,50],getNodePosition:s}){const{nodes:a,edges:o}=od(i),{depths:l}=U3(a,o),c=Object.keys(l).map(x=>l[x]),f=pG().id(x=>x.data.id).parentId(x=>{var _,g,b;return(b=(g=(_=x.ins)==null?void 0:_[0])==null?void 0:g.data)==null?void 0:b.id})(c),p=bG().separation(()=>n).nodeSize(r)(o0(f)).descendants(),m=fW[t],y=new Map(a.map(x=>{const{x:_,y:g}=p.find(b=>b.data.id===x.id);return[x.id,{...x,[m.x]:_*m.factor,[m.y]:g*m.factor,z:0}]}));return{step(){return!0},getNodePosition(x){var _,g;if(s){const b=s(x,{graph:i,drags:e,nodes:a,edges:o});if(b)return b}return(_=e==null?void 0:e[x])!=null&&_.position?(g=e==null?void 0:e[x])==null?void 0:g.position:y.get(x)}}}function dW({graph:i,margin:e,drags:t,getNodePosition:n,ratio:r,gridSize:s,maxIterations:a}){const{nodes:o,edges:l}=od(i),c=IG(i,{maxIterations:a,inputReducer:(f,d)=>({...d,x:d.x||0,y:d.y||0}),settings:{ratio:r,margin:e,gridSize:s}});return{step(){return!0},getNodePosition(f){var d,p;if(n){const m=n(f,{graph:i,drags:t,nodes:o,edges:l});if(m)return m}return(d=t==null?void 0:t[f])!=null&&d.position?(p=t==null?void 0:t[f])==null?void 0:p.position:c==null?void 0:c[f]}}}function pW({graph:i,drags:e,iterations:t,...n}){WG.assign(i);const r=GG(i,{iterations:t,settings:n});return{step(){return!0},getNodePosition(s){var a;return((a=e==null?void 0:e[s])==null?void 0:a.position)||(r==null?void 0:r[s])}}}function mW({graph:i,drags:e,getNodePosition:t}){const{nodes:n,edges:r}=od(i);return{step(){return!0},getNodePosition(s){return t(s,{graph:i,drags:e,nodes:n,edges:r})}}}const gW=["forceDirected2d","treeTd2d","treeLr2d","radialOut2d","treeTd3d","treeLr3d","radialOut3d","forceDirected3d"];function vW({type:i,...e}){if(gW.includes(i)){const{nodeStrength:t,linkDistance:n,nodeLevelRatio:r}=e;if(i==="forceDirected2d")return no({...e,dimensions:2,nodeLevelRatio:r||2,nodeStrength:t||-250,linkDistance:n,forceLayout:i});if(i==="treeTd2d")return no({...e,mode:"td",dimensions:2,nodeLevelRatio:r||5,nodeStrength:t||-250,linkDistance:n||50,forceLayout:i});if(i==="treeLr2d")return no({...e,mode:"lr",dimensions:2,nodeLevelRatio:r||5,nodeStrength:t||-250,linkDistance:n||50,forceLayout:i});if(i==="radialOut2d")return no({...e,mode:"radialout",dimensions:2,nodeLevelRatio:r||5,nodeStrength:t||-500,linkDistance:n||100,forceLayout:i});if(i==="treeTd3d")return no({...e,mode:"td",dimensions:3,nodeLevelRatio:r||2,nodeStrength:t||-500,linkDistance:n||50});if(i==="treeLr3d")return no({...e,mode:"lr",dimensions:3,nodeLevelRatio:r||2,nodeStrength:t||-500,linkDistance:n||50,forceLayout:i});if(i==="radialOut3d")return no({...e,mode:"radialout",dimensions:3,nodeLevelRatio:r||2,nodeStrength:t||-500,linkDistance:n||100,forceLayout:i});if(i==="forceDirected3d")return no({...e,dimensions:3,nodeLevelRatio:r||2,nodeStrength:t||-250,linkDistance:n,forceLayout:i})}else if(i==="circular2d"){const{radius:t}=e;return hW({...e,radius:t||300})}else{if(i==="hierarchicalTd")return hA({...e,mode:"td"});if(i==="hierarchicalLr")return hA({...e,mode:"lr"});if(i==="nooverlap"){const{graph:t,maxIterations:n,ratio:r,margin:s,gridSize:a,...o}=e;return dW({graph:t,margin:s||10,maxIterations:n||50,ratio:r||10,gridSize:a||20,...o})}else if(i==="forceatlas2"){const{graph:t,iterations:n,gravity:r,scalingRatio:s,...a}=e;return pW({type:"forceatlas2",graph:t,...a,scalingRatio:s||100,gravity:r||10,iterations:n||50})}else if(i==="custom")return mW({...e})}throw new Error(`Layout ${i} not found.`)}function O3({nodeCount:i,nodePosition:e,labelType:t,camera:n}){return(r,s)=>{var a;if(n&&e&&((a=n==null?void 0:n.position)==null?void 0:a.z)/(n==null?void 0:n.zoom)-(e==null?void 0:e.z)>6e3)return!1;if(t==="all")return!0;if(t==="nodes"&&r==="node")return!0;if(t==="edges"&&r==="edge")return!0;if(t==="auto"&&r==="node"){if(s>7)return!0;if(n&&e&&n.position.z/n.zoom-e.z<3e3)return!0}return!1}}function L3(i,e){switch(e){case"above":return i;case"below":return-i;case"inline":case"natural":default:return 0}}const sb=typeof window>"u";function yW({graph:i}){const e=YG(i);return{ranks:e,getSizeForNode:t=>e[t]*80}}function _W({graph:i}){const e=KG.degreeCentrality(i);return{ranks:e,getSizeForNode:t=>e[t]*20}}function xW({graph:i,attribute:e,defaultSize:t}){const n=new Map;return e?i.forEachNode((r,s)=>{var a;const o=(a=s.data)==null?void 0:a[e];isNaN(o)&&console.warn(`Attribute ${o} is not a number for node ${s.id}`),n.set(r,o||0)}):console.warn("Attribute sizing configured but no attribute provided"),{getSizeForNode:r=>!e||!n?t:n.get(r)}}const fA={pagerank:yW,centrality:_W,attribute:xW,none:({defaultSize:i})=>({getSizeForNode:e=>i})};function bW({type:i,...e}){var t;const n=(t=fA[i])==null?void 0:t.call(fA,e);if(!n&&i!=="default")throw new Error(`Unknown sizing strategy: ${i}`);const{graph:r,minSize:s,maxSize:a}=e,o=new Map;let l,c;if(r.forEachNode((f,d)=>{let p;i==="default"?p=d.size||e.defaultSize:p=n.getSizeForNode(f),(l===void 0||p<l)&&(l=p),(c===void 0||p>c)&&(c=p),o.set(f,p)}),i!=="none"){const f=hR().domain([l,c]).rangeRound([s,a]);for(const[d,p]of o)o.set(d,f(p))}return o}function SW(i,e,t){i.clear();const n=new Set;for(const r of e)try{n.has(r.id)||(i.addNode(r.id,r),n.add(r.id))}catch(s){console.error(`[Graph] Error adding node '${r.id}`,s)}for(const r of t)if(!(!n.has(r.source)||!n.has(r.target)))try{i.addEdge(r.source,r.target,r)}catch(s){console.error(`[Graph] Error adding edge '${r.source} -> ${r.target}`,s)}return i}function EW({graph:i,layout:e,sizingType:t,labelType:n,sizingAttribute:r,defaultNodeSize:s,minNodeSize:a,maxNodeSize:o,clusterAttribute:l}){const c=[],f=[],d=new Map,p=bW({graph:i,type:t,attribute:r,minSize:a,maxSize:o,defaultSize:s}),m=i.nodes().length,y=O3({nodeCount:m,labelType:n});return i.forEachNode((x,_)=>{const g=e.getNodePosition(x),{data:b,fill:S,icon:E,label:w,size:T,...R}=_,U=p.get(_.id),C=y("node",U),I=(i.inboundNeighbors(_.id)||[]).map(O=>i.getNodeAttributes(O)),P={..._,size:U,labelVisible:C,label:w,icon:E,fill:S,cluster:l?b[l]:void 0,parents:I,data:{...R,...b??{}},position:{...g,x:g.x||0,y:g.y||0,z:g.z||1}};d.set(_.id,P),c.push(P)}),i.forEachEdge((x,_)=>{const g=d.get(_.source),b=d.get(_.target);if(g&&b){const{data:S,id:E,label:w,size:T,...R}=_,U=y("edge",T);f.push({..._,id:E,label:w,labelVisible:U,size:T,data:{...R,id:E,...S||{}}})}}),{nodes:c,edges:f}}const _r={mass:10,tension:1e3,friction:300,precision:.1};function N3(i,e,t){const n=e.getLength(),r=i==="end"?n:n/2,s=i==="end"?t/2:0,a=(r-s)/n,o=e.getPointAt(a),l=e.getTangentAt(a);return[o,l]}function I3(i){return[i+6,2+i/1.5]}const dA=.7;function P3(i,e,t=0){const n=new K(i.x,i.y||0,i.z||0),r=new K(e.x,e.y||0,e.z||0),s=new K().addVectors(n,r).divideScalar(2);return s.setLength(s.length()+t)}function MW(i,e,t=-1){const n=i.clone(),r=e.clone(),s=new K().subVectors(r,n),a=s.length(),o=s.clone().normalize(),l=new K().subVectors(r,n).divideScalar(2),c=Math.abs(o.x)%1,f=new K(-o.y,o.x-c*o.z,c*o.y).normalize(),d=new K().add(n).add(l).add(f.multiplyScalar(a/4).multiplyScalar(t));return[i,d,e]}function Gf(i,e,t,n,r,s){const a=pA(i,t,e),o=pA(t,i,n);return r?new Xg(...MW(a,o,s)):new i1(a,o)}function Hf(i){return new K(i.position.x,i.position.y,i.position.z||0)}function pA(i,e,t){const n=i.distanceTo(e);return i.clone().add(e.clone().sub(i).multiplyScalar(t/n))}function mA(i,e){return{...i,position:{...i.position,x:i.position.x+e.x,y:i.position.y+e.y,z:i.position.z+e.z}}}function wW({edge:i,edges:e,curved:t}){let n=t,r;const s=e.filter(a=>a.target===i.target&&a.source===i.source).map(a=>a.id);if(s.length>1){n=!0;const a=s.indexOf(i.id);s.length===2?r=a===0?dA:-.7:r=(a-Math.floor(s.length/2))*dA}return{curved:n,curveOffset:r}}function Vf(i){let e=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,s=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY;for(let o of i)e=Math.min(e,o.position.x),t=Math.max(t,o.position.x),n=Math.min(n,o.position.y),r=Math.max(r,o.position.y),s=Math.min(s,o.position.z),a=Math.max(a,o.position.z);return{height:r-n,width:t-e,minX:e,maxX:t,minY:n,maxY:r,minZ:s,maxZ:a,x:(t+e)/2,y:(r+n)/2,z:(a+s)/2}}function TW(i,e){return e?i.reduce((t,n)=>{const r=n.data[e];return r&&t.set(r,[...t.get(r)||[],n]),t},new Map):new Map}function AW({nodes:i,clusterAttribute:e}){const t=new Map;if(e){const n=TW(i,e);for(const[r,s]of n){const a=Vf(s);t.set(r,{label:r,nodes:s,position:a})}}return t}function CW(i,e,t){return mV.bidirectional(i,e,t)}const gA=i=>i.tagName!=="INPUT"&&i.tagName!=="SELECT"&&i.tagName!=="TEXTAREA"&&!i.isContentEditable,z3=({actives:i=[],selections:e=[],collapsedNodeIds:t=[],theme:n})=>eV(r=>{var s,a,o;return{theme:{...n,edge:{...n==null?void 0:n.edge,label:{...(s=n==null?void 0:n.edge)==null?void 0:s.label,fontSize:((o=(a=n==null?void 0:n.edge)==null?void 0:a.label)==null?void 0:o.fontSize)??6}}},edges:[],nodes:[],collapsedNodeIds:t,clusters:new Map,panning:!1,draggingIds:[],actives:i,edgeContextMenus:new Set,edgeMeshes:[],selections:e,hoveredNodeId:null,drags:{},graph:new cn({multi:!0}),setTheme:l=>r(c=>({...c,theme:l})),setClusters:l=>r(c=>({...c,clusters:l})),setEdgeContextMenus:l=>r(c=>({...c,edgeContextMenus:l})),setEdgeMeshes:l=>r(c=>({...c,edgeMeshes:l})),setPanning:l=>r(c=>({...c,panning:l})),setDrags:l=>r(c=>({...c,drags:l})),addDraggingId:l=>r(c=>({...c,draggingIds:[...c.draggingIds,l]})),removeDraggingId:l=>r(c=>({...c,draggingIds:c.draggingIds.filter(f=>f!==l)})),setActives:l=>r(c=>({...c,actives:l})),setSelections:l=>r(c=>({...c,selections:l})),setHoveredNodeId:l=>r(c=>({...c,hoveredNodeId:l})),setNodes:l=>r(c=>({...c,nodes:l,centerPosition:Vf(l)})),setEdges:l=>r(c=>({...c,edges:l})),setNodePosition:(l,c)=>r(f=>{var d,p;const m=f.nodes.find(b=>b.id===l),y=Hf(m),_=new K(c.x,c.y,c.z).sub(y),g=[...f.nodes];if((d=f.selections)!=null&&d.includes(l))(p=f.selections)==null||p.forEach(b=>{const S=f.nodes.find(E=>E.id===b);if(S){const E=f.nodes.indexOf(S);g[E]=mA(S,_)}});else{const b=f.nodes.indexOf(m);g[b]=mA(m,_)}return{...f,drags:{...f.drags,[l]:m},nodes:g}}),setCollapsedNodeIds:(l=[])=>r(c=>({...c,collapsedNodeIds:l})),setClusterPosition:(l,c)=>r(f=>{const d=new Map(f.clusters),p=d.get(l);if(p){const m=p.position,y=new K(c.x-m.x,c.y-m.y,c.z-(m.z??0)),x=[...f.nodes],_={...f.drags};x.forEach((S,E)=>{S.cluster===l&&(x[E]={...S,position:{...S.position,x:S.position.x+y.x,y:S.position.y+y.y,z:S.position.z+(y.z??0)}},_[S.id]=S)});const g=x.filter(S=>S.cluster===l),b=Vf(g);return d.set(l,{...p,position:b}),{...f,drags:{..._,[l]:p},clusters:d,nodes:x}}return f})}}),F3=z3({}),B3=sb?null:$.createContext(F3),RW=({children:i,store:e=F3})=>sb?i:lo.createElement(B3.Provider,{value:e},i),tt=i=>{const e=$.useContext(B3);return fR(e,iV(i))};function k3({nodeId:i,nodes:e,edges:t,currentHiddenNodes:n,currentHiddenEdges:r}){const s=[],a=[],o=n.map(m=>m.id),l=r.map(m=>m.id),c=t.filter(m=>m.source===i),f=c.map(m=>m.target);a.push(...c);for(const m of f){const y=t.filter(_=>_.target===m&&_.source!==i);let x=!1;if((y.length===0||y.length>0&&!o.includes(m)&&y.map(g=>g.id).every(g=>l.includes(g)))&&(x=!0),x){const _=e.find(b=>b.id===m);_&&s.push(_);const g=k3({nodeId:m,nodes:e,edges:t,currentHiddenEdges:a,currentHiddenNodes:s});a.push(...g.hiddenEdges),s.push(...g.hiddenNodes)}}const d=Object.values(a.reduce((m,y)=>({...m,[y.id]:y}),{})),p=Object.values(s.reduce((m,y)=>({...m,[y.id]:y}),{}));return{hiddenEdges:d,hiddenNodes:p}}const DW=({collapsedIds:i,nodes:e,edges:t})=>{const n=[],r=[];for(const c of i){const{hiddenEdges:f,hiddenNodes:d}=k3({nodeId:c,nodes:e,edges:t,currentHiddenEdges:r,currentHiddenNodes:n});n.push(...d),r.push(...f)}const s=n.map(c=>c.id),a=r.map(c=>c.id),o=e.filter(c=>!s.includes(c.id)),l=t.filter(c=>!a.includes(c.id));return{visibleNodes:o,visibleEdges:l}},UW=({layoutType:i,sizingType:e,labelType:t,sizingAttribute:n,clusterAttribute:r,selections:s,nodes:a,edges:o,actives:l,collapsedNodeIds:c,defaultNodeSize:f,maxNodeSize:d,minNodeSize:p,layoutOverrides:m,constrainDragging:y})=>{const x=tt(G=>G.graph),_=tt(G=>G.clusters),g=tt(G=>G.nodes),b=tt(G=>G.setClusters),S=tt(G=>G.collapsedNodeIds),E=tt(G=>G.setEdges),w=tt(G=>G.nodes),T=tt(G=>G.setNodes),R=tt(G=>G.setSelections),U=tt(G=>G.setActives),C=tt(G=>G.drags),D=tt(G=>G.setDrags),I=tt(G=>G.setCollapsedNodeIds),P=$.useRef(!1),O=$.useRef(null),H=Kn(G=>G.camera),J=$.useRef(C),z=$.useRef([]);$.useEffect(()=>{var G;if(!r)return;const Z=g.map(j=>j.id),Q=a.find(j=>!Z.includes(j.id));if(Q){const j=Q.data[r],ee=_.get(j),pe={...J.current};(G=ee==null?void 0:ee.nodes)==null||G.forEach(le=>pe[le.id]=void 0),J.current=pe,D(pe)}},[g,a,r,_,D]);const{visibleEdges:L,visibleNodes:F}=$.useMemo(()=>DW({collapsedIds:S,nodes:a,edges:o}),[S,a,o]),V=$.useCallback(G=>{const Z={...J.current};G.forEach(Q=>Z[Q.id]=Q),J.current=Z,D(Z)},[D]),W=$.useCallback(async G=>{O.current=G||vW({...m,type:i,graph:x,drags:J.current,clusters:z==null?void 0:z.current,clusterAttribute:r}),await cW(O.current);const Z=EW({graph:x,layout:O.current,sizingType:e,labelType:t,sizingAttribute:n,maxNodeSize:d,minNodeSize:p,defaultNodeSize:f,clusterAttribute:r}),Q=AW({nodes:Z.nodes,clusterAttribute:r});y&&Q.forEach(j=>{var ee,pe;const le=z.current.get(j.label);(le==null?void 0:le.nodes.length)===j.nodes.length&&(j.position=((pe=(ee=z.current)==null?void 0:ee.get(j.label))==null?void 0:pe.position)??j.position)}),E(Z.edges),T(Z.nodes),b(Q),r&&V(Z.nodes)},[m,i,r,e,t,n,d,p,f,E,T,b]);return $.useEffect(()=>{J.current=C},[C,r,W]),$.useEffect(()=>{z.current=_},[_]),$.useEffect(()=>{const G=w.map(Q=>({...Q,labelVisible:O3({nodeCount:w==null?void 0:w.length,labelType:t,camera:H,nodePosition:Q==null?void 0:Q.position})("node",Q==null?void 0:Q.size)}));G.some((Q,j)=>Q.labelVisible!==w[j].labelVisible)&&T(G)},[H,H.zoom,H.position.z,T,w,t]),$.useEffect(()=>{P.current&&R(s)},[s,R]),$.useEffect(()=>{P.current&&U(l)},[l,U]),$.useEffect(()=>{async function G(){P.current=!1,SW(x,F,L),await W(),requestAnimationFrame(()=>P.current=!0)}G()},[F,L]),$.useEffect(()=>{P.current&&I(c)},[c,I]),$.useEffect(()=>{P.current&&(J.current={},D({}),W())},[i,W,D]),$.useEffect(()=>{P.current&&W(O.current)},[e,n,t,W]),{updateLayout:W}},Wf=({text:i,fontSize:e=7,fontUrl:t,color:n="#2A6475",opacity:r=1,stroke:s,active:a,ellipsis:o=75,rotation:l})=>{const c=o&&!a?iW(i,o):i,f=$.useMemo(()=>new $e(n),[n]),d=$.useMemo(()=>s?new $e(s):void 0,[s]);return fe.jsx(g3,{position:[0,0,1],children:fe.jsx(J9,{font:t,fontSize:e,color:f,fillOpacity:r,textAlign:"center",outlineWidth:s?1:0,outlineColor:d,depthOffset:0,maxWidth:100,overflowWrap:"break-word",rotation:l,children:c})})},G3=({draggable:i,set:e,position:t,bounds:n,onDragStart:r,onDragEnd:s})=>{const a=Kn(_=>_.camera),o=Kn(_=>_.raycaster),l=Kn(_=>_.size),c=Kn(_=>_.gl),{mouse2D:f,mouse3D:d,offset:p,normal:m,plane:y}=$.useMemo(()=>({mouse2D:new ke,mouse3D:new K,offset:new K,normal:new K,plane:new la}),[]),x=$.useMemo(()=>c.domElement.getBoundingClientRect(),[c.domElement]);return t9({onDragStart:({event:_})=>{const{eventObject:g,point:b}=_;g.getWorldPosition(p).sub(b),d.copy(b),r()},onDrag:({xy:_,buttons:g,cancel:b})=>{if(g!==1){b();return}const S=(_[0]-((x==null?void 0:x.left)??0))/l.width*2-1,E=-((_[1]-((x==null?void 0:x.top)??0))/l.height)*2+1;f.set(S,E),o.setFromCamera(f,a),a.getWorldDirection(m).negate(),y.setFromNormalAndCoplanarPoint(m,d),o.ray.intersectPlane(y,d);const w=new K(t.x,t.y,t.z).copy(d).add(p);if(n){const T=new K((n.minX+n.maxX)/2,(n.minY+n.maxY)/2,(n.minZ+n.maxZ)/2),R=(n.maxX-n.minX)/2,U=w.clone().sub(T);U.length()>R&&(U.normalize().multiplyScalar(R),w.copy(T).add(U))}return e(w)},onDragEnd:s},{drag:{enabled:i,threshold:10}})},ab=({sensitivity:i=7,interval:e=50,timeout:t=0,disabled:n,onPointerOver:r,onPointerOut:s})=>{const a=$.useRef(!1),o=$.useRef(null),l=$.useRef(0),c=$.useRef({x:null,y:null,px:null,py:null}),f=$.useCallback(_=>{c.current.x=_.clientX,c.current.y=_.clientY},[]),d=$.useCallback(_=>{o.current=clearTimeout(o.current);const{px:g,x:b,py:S,y:E}=c.current;Math.abs(g-b)+Math.abs(S-E)<i?(l.current=1,r(_)):(c.current.px=b,c.current.py=E,o.current=setTimeout(()=>d(_),e))},[e,r,i]),p=$.useCallback(()=>{clearTimeout(o.current),typeof window<"u"&&document.removeEventListener("mousemove",f,!1)},[f]),m=$.useCallback(_=>{n||(a.current=!0,p(),l.current!==1&&(c.current.px=_.pointer.x,c.current.py=_.pointer.y,typeof window<"u"&&document.addEventListener("mousemove",f,!1),o.current=setTimeout(()=>d(_),t)))},[p,d,n,f,t]),y=$.useCallback(_=>{o.current=clearTimeout(o.current),l.current=0,s(_)},[s]),x=$.useCallback(_=>{a.current=!1,p(),l.current===1&&(o.current=setTimeout(()=>y(_),t))},[p,y,t]);return{pointerOver:m,pointerOut:x}},H3=$.createContext({controls:null,resetControls:()=>{},zoomIn:()=>{},zoomOut:()=>{},dollyIn:()=>{},dollyOut:()=>{},panLeft:()=>{},panRight:()=>{},panUp:()=>{},panDown:()=>{},freeze:()=>{},unFreeze:()=>{}}),_0=()=>{const i=$.useContext(H3);if(i===void 0)throw new Error("`useCameraControls` hook must be used within a `ControlsProvider` component");return i},OW=({outerRadius:i,innerRadius:e,padding:t,normalizedFill:n,normalizedStroke:r,opacity:s,animated:a,theme:o})=>{var l;const{opacity:c}=yr({from:{opacity:0},to:{opacity:s},config:{..._r,duration:a?void 0:0}});return fe.jsxs(fe.Fragment,{children:[fe.jsxs("mesh",{children:[fe.jsx("ringGeometry",{attach:"geometry",args:[i,0,128]}),fe.jsx(zn.meshBasicMaterial,{attach:"material",color:n,transparent:!0,depthTest:!1,opacity:(l=o.cluster)!=null&&l.fill?c:0,side:In,fog:!0})]}),fe.jsxs("mesh",{children:[fe.jsx("ringGeometry",{attach:"geometry",args:[i,e+t,128]}),fe.jsx(zn.meshBasicMaterial,{attach:"material",color:r,transparent:!0,depthTest:!1,opacity:c,side:In,fog:!0})]})]})},LW=({animated:i,position:e,padding:t=40,labelFontUrl:n,disabled:r,radius:s=2,nodes:a,label:o,onClick:l,onPointerOver:c,onPointerOut:f,draggable:d=!1,onDragged:p,onRender:m})=>{var y,x,_,g,b,S,E;const w=tt(ie=>ie.theme),T=Math.max(e.width,e.height)/2,R=T-s+t,[U,C]=$.useState(!1),D=tt(ie=>ie.centerPosition),I=tt(ie=>ie.nodes),P=_0(),O=tt(ie=>ie.draggingIds),H=O.includes(o),J=O.length>0,z=tt(ie=>{var be;return(be=ie.actives)==null?void 0:be.some(k=>a.some(re=>re.id===k))}),L=tt(ie=>ie.hoveredNodeId),F=tt(ie=>{var be;return(be=ie.selections)==null?void 0:be.some(k=>a.some(re=>re.id===k))}),W=tt(ie=>{var be;return((be=ie.selections)==null?void 0:be.length)>0})?F||U||z?(y=w.cluster)==null?void 0:y.selectedOpacity:(x=w.cluster)==null?void 0:x.inactiveOpacity:(_=w.cluster)==null?void 0:_.opacity,G=$.useMemo(()=>{var ie,be;const k=[0,-R,2],re=(be=(ie=w.cluster)==null?void 0:ie.label)==null?void 0:be.offset;return re?[k[0]-re[0],k[1]-re[1],k[2]-re[2]]:k},[R,(b=(g=w.cluster)==null?void 0:g.label)==null?void 0:b.offset]),{circlePosition:Z}=yr({from:{circlePosition:[D.x,D.y,-1]},to:{circlePosition:e?[e.x,e.y,-1]:[0,0,-1]},config:{..._r,duration:i&&!J?void 0:0}}),Q=$.useMemo(()=>{var ie;return new $e((ie=w.cluster)==null?void 0:ie.stroke)},[(S=w.cluster)==null?void 0:S.stroke]),j=$.useMemo(()=>{var ie;return new $e((ie=w.cluster)==null?void 0:ie.fill)},[(E=w.cluster)==null?void 0:E.fill]),ee=tt(ie=>ie.addDraggingId),pe=tt(ie=>ie.removeDraggingId),le=tt(ie=>ie.setClusterPosition),ce=G3({draggable:d&&!L,position:{x:e.x,y:e.y,z:-1},set:ie=>le(o,ie),onDragStart:()=>{ee(o),C(!0)},onDragEnd:()=>{pe(o),C(!1);const ie=I.filter(be=>be.cluster===o);p==null||p({nodes:ie,label:o})}});El(U&&!J&&l!==void 0,"pointer"),El(U&&d&&!H&&l===void 0,"grab"),El(H,"grabbing");const{pointerOver:Le,pointerOut:Me}=ab({disabled:r,onPointerOver:ie=>{C(!0),P.freeze(),c==null||c({nodes:a,label:o},ie)},onPointerOut:ie=>{C(!1),P.unFreeze(),f==null||f({nodes:a,label:o},ie)}});return $.useMemo(()=>{var ie,be,k;return w.cluster&&fe.jsx(zn.group,{userData:{id:o,type:"cluster"},position:Z,onPointerOver:Le,onPointerOut:Me,onClick:re=>{!r&&!H&&(l==null||l({nodes:a,label:o},re))},...ce(),children:m?m({label:{position:G,text:o,opacity:W,fontUrl:n},opacity:W,outerRadius:R,innerRadius:T,padding:t,theme:w}):fe.jsxs(fe.Fragment,{children:[fe.jsx(OW,{outerRadius:R,innerRadius:T,padding:t,normalizedFill:j,normalizedStroke:Q,opacity:W,animated:i,theme:w}),((ie=w.cluster)==null?void 0:ie.label)&&fe.jsx(zn.group,{position:G,children:fe.jsx(Wf,{text:o,opacity:W,fontUrl:n,stroke:w.cluster.label.stroke,active:!1,color:(be=w.cluster)==null?void 0:be.label.color,fontSize:((k=w.cluster)==null?void 0:k.label.fontSize)??12})})]})})},[w,Z,Le,Me,R,j,T,t,Q,G,o,W,n,r,l,a,ce,H,m,i])},NW=({animated:i,color:e="#D8E6EA",length:t,opacity:n=.5,position:r,rotation:s,size:a=1,onActive:o,onContextMenu:l})=>{const c=$.useMemo(()=>new $e(e),[e]),f=$.useRef(null),d=tt(_=>_.draggingIds.length>0),p=tt(_=>_.centerPosition),[{pos:m,arrowOpacity:y}]=yr(()=>({from:{pos:p?[p.x,p.y,p.z]:[0,0,0],arrowOpacity:0},to:{pos:[r.x,r.y,r.z],arrowOpacity:n},config:{..._r,duration:i&&!d?void 0:0}}),[i,d,n,r]),x=$.useCallback(()=>{var _;const g=new K(0,1,0);(_=f.current)==null||_.quaternion.setFromUnitVectors(g,s)},[s,f]);return $.useEffect(()=>x(),[x]),fe.jsxs(zn.mesh,{position:m,ref:f,scale:[1,1,1],onPointerOver:()=>o(!0),onPointerOut:()=>o(!1),onPointerDown:_=>{_.nativeEvent.buttons===2&&(_.stopPropagation(),l())},children:[fe.jsx("cylinderGeometry",{args:[0,a,t,20,1,!0],attach:"geometry"}),fe.jsx(zn.meshBasicMaterial,{attach:"material",color:c,depthTest:!1,opacity:y,transparent:!0,side:In,fog:!0})]})},IW=({curveOffset:i,animated:e,color:t="#000",curve:n,curved:r=!1,id:s,opacity:a=1,size:o=1,onContextMenu:l,onClick:c,onPointerOver:f,onPointerOut:d})=>{const p=$.useRef(null),m=tt(b=>b.draggingIds.length>0),y=$.useMemo(()=>new $e(t),[t]),x=tt(b=>b.centerPosition),_=$.useRef(!1),{lineOpacity:g}=yr({from:{lineOpacity:0},to:{lineOpacity:a},config:{..._r,duration:e?void 0:0}});return yr(()=>{const b=n.getPoint(0),S=n.getPoint(1);return{from:{fromVertices:_.current?[S==null?void 0:S.x,S==null?void 0:S.y,(S==null?void 0:S.z)||0]:[x==null?void 0:x.x,x==null?void 0:x.y,(x==null?void 0:x.z)||0],toVertices:[b==null?void 0:b.x,b==null?void 0:b.y,(b==null?void 0:b.z)||0]},to:{fromVertices:[b==null?void 0:b.x,b==null?void 0:b.y,(b==null?void 0:b.z)||0],toVertices:[S==null?void 0:S.x,S==null?void 0:S.y,(S==null?void 0:S.z)||0]},onChange:E=>{const{fromVertices:w,toVertices:T}=E.value,R=new K(...w),U=new K(...T),C=Gf(R,0,U,0,r,i);p.current.copy(new Rl(C,20,o/2,5,!1))},config:{..._r,duration:e&&!m?void 0:0}}},[e,m,n,o]),$.useEffect(()=>{_.current=!0},[]),fe.jsxs("mesh",{userData:{id:s,type:"edge"},onPointerOver:f,onPointerOut:d,onClick:c,onPointerDown:b=>{b.nativeEvent.buttons===2&&(b.stopPropagation(),l())},children:[fe.jsx("tubeGeometry",{attach:"geometry",ref:p}),fe.jsx(zn.meshBasicMaterial,{attach:"material",opacity:g,fog:!0,transparent:!0,depthTest:!1,color:y})]})},vA=3,PW=({animated:i,arrowPlacement:e="end",contextMenu:t,disabled:n,labelPlacement:r="inline",id:s,interpolation:a,labelFontUrl:o,onContextMenu:l,onClick:c,onPointerOver:f,onPointerOut:d})=>{const p=tt(be=>be.theme),m=tt(be=>be.draggingIds.length>0),[y,x]=$.useState(!1),[_,g]=$.useState(!1),b=tt(be=>be.edges),S=b.find(be=>be.id===s),{target:E,source:w,label:T,labelVisible:R=!1,size:U=1,fill:C}=S,D=tt(be=>be.nodes.find(k=>k.id===w)),I=tt(be=>be.nodes.find(k=>k.id===E)),P=(U+p.edge.label.fontSize)/2,[O,H]=$.useMemo(()=>I3(U),[U]),{curveOffset:J,curved:z}=$.useMemo(()=>wW({edge:S,edges:b,curved:a==="curved"}),[S,b,a]),[L,F,V]=$.useMemo(()=>{const be=Hf(D),k=D.size,re=Hf(I),te=I.size;let we=Gf(be,k,re,te,z,J);const[se,Re]=N3(e,we,O);return e==="end"&&(we=Gf(be,k,se,0,z,J)),[we,se,Re]},[D,I,z,J,e,O]),W=$.useMemo(()=>{let be=P3(D.position,I.position,L3(P,r));if(z){const k=new K().subVectors(be,L.getPoint(.5));switch(r){case"above":k.y=k.y-vA;break;case"below":k.y=k.y+vA;break}be=be.sub(k)}return be},[D.position,I.position,P,r,z,L]),G=tt(be=>{var k;return(k=be.selections)==null?void 0:k.includes(s)}),Z=tt(be=>{var k;return(k=be.selections)==null?void 0:k.length}),Q=tt(be=>{var k;return(k=be.actives)==null?void 0:k.includes(s)}),j=tt(be=>be.centerPosition),ee=Z?G||Q?p.edge.selectedOpacity:p.edge.inactiveOpacity:p.edge.opacity,[{labelPosition:pe}]=yr(()=>({from:{labelPosition:j?[j.x,j.y,j.z]:[0,0,0]},to:{labelPosition:[W.x,W.y,W.z]},config:{..._r,duration:i&&!m?void 0:0}}),[W,i,m]),le=$.useMemo(()=>new Ui(0,0,r==="natural"?0:Math.atan((I.position.y-D.position.y)/(I.position.x-D.position.x))),[I.position.x,I.position.y,D.position.x,D.position.y,r]);El(y&&!m&&c!==void 0,"pointer");const{pointerOver:ce,pointerOut:Le}=ab({disabled:n,onPointerOver:be=>{x(!0),f==null||f(S,be)},onPointerOut:be=>{x(!1),d==null||d(S,be)}}),Me=$.useMemo(()=>e!=="none"&&fe.jsx(NW,{animated:i,color:G||y||Q?p.arrow.activeFill:C||p.arrow.fill,length:O,opacity:ee,position:F,rotation:V,size:H,onActive:x,onContextMenu:()=>{n||(g(!0),l==null||l(S))}}),[C,y,i,O,e,F,V,H,n,S,Q,G,l,ee,p.arrow.activeFill,p.arrow.fill]),ge=$.useMemo(()=>R&&T&&fe.jsx(zn.group,{position:pe,onContextMenu:()=>{n||(g(!0),l==null||l(S))},onPointerOver:ce,onPointerOut:Le,children:fe.jsx(Wf,{text:T,ellipsis:15,fontUrl:o,stroke:p.edge.label.stroke,color:G||y||Q?p.edge.label.activeColor:p.edge.label.color,opacity:ee,fontSize:p.edge.label.fontSize,rotation:le})}),[y,n,S,Q,G,T,o,pe,le,R,l,Le,ce,ee,p.edge.label.activeColor,p.edge.label.color,p.edge.label.fontSize,p.edge.label.stroke]),ie=$.useMemo(()=>_&&t&&fe.jsx(nb,{prepend:!0,center:!0,position:W,children:t({data:S,onClose:()=>g(!1)})}),[_,t,W,S]);return fe.jsxs("group",{children:[fe.jsx(IW,{curveOffset:J,animated:i,color:G||y||Q?p.edge.activeFill:C||p.edge.fill,curve:L,curved:z,id:s,opacity:ee,size:U,onClick:be=>{n||c==null||c(S,be)},onPointerOver:ce,onPointerOut:Le,onContextMenu:()=>{n||(g(!0),l==null||l(S))}}),Me,ge,ie]})},yA=new Ea(0,0,0);function zW(i,e){const t=$.useRef(null),n=tt(c=>c.theme);tt(c=>{t.current=c});const r=$.useRef(new Map);$.useRef(new Ea(0,0,0));const s=$.useRef(null),a=e==="curved",o=$.useCallback(c=>{const f=[],d=r.current,{nodes:p}=t.current,m=new Map(p.map(x=>[x.id,x])),y=n.edge.label.fontSize;return i!=="none"&&!s.current&&(s.current=new bu(0,1,1,20,1,!0)),c.forEach(x=>{const{target:_,source:g,size:b=1}=x,S=m.get(g),E=m.get(_);if(!S||!E)return;const w=`${S.position.x},${S.position.y},${E.position.x},${E.position.y},${b}`;if(d.has(w)){f.push(d.get(w));return}const T=Hf(S),R=S.size+y,U=Hf(E),C=E.size+y;let D=Gf(T,R,U,C,a),I=new Rl(D,20,b/2,5,!1);if(i==="none"){f.push(I),d.set(w,I);return}const[P,O]=I3(b),H=s.current.clone();H.scale(O,P,O);const[J,z]=N3(i,D,P),L=new _i;if(L.setFromUnitVectors(new K(0,1,0),z),H.applyQuaternion(L),H.translate(J.x,J.y,J.z),i&&i==="end"){const V=Gf(T,R,J,0,a);I=new Rl(V,20,b/2,5,!1)}const F=Vp([I,H]);f.push(F),d.set(w,F)}),f},[i,a,n.edge.label.fontSize]),l=$.useCallback((c,f)=>{const d=o(c),p=o(f);return Vp([p.length?Vp(p):yA,d.length?Vp(d):yA],!0)},[o]);return{getGeometries:o,getGeometry:l}}function FW(i,e,t){const n=$.useRef(i);$.useEffect(()=>{n.current=i},[i]);const r=tt(d=>d.edgeContextMenus),s=tt($.useCallback(d=>d.setEdgeContextMenus,[])),a=$.useRef(!1),o=$.useCallback(()=>{a.current=!0},[]),l=$.useRef(!1),c=$.useCallback(()=>{l.current=!0},[]),f=$.useCallback((d,p)=>{const{onClick:m,onContextMenu:y,onPointerOver:x,onPointerOut:_}=n.current;if(m&&a.current&&!t){a.current=!1;for(const g of p)m(g)}if((e||y)&&l.current&&!t){l.current=!1;const g=new Set(r);let b=!1;for(const S of p)r.has(S.id)||(g.add(S.id),b=!0,y==null||y(S));b&&s(g)}x&&p.filter(b=>!d.includes(b)).forEach(b=>{x(b)}),_&&d.filter(b=>!p.includes(b)).forEach(b=>{_(b)})},[e,t,r,s]);return{handleClick:o,handleContextMenu:c,handleIntersections:f}}function BW(i,e){const t=$.useRef(i),n=$.useRef(null);$.useEffect(()=>{t.current=i;const a=i.getAttribute("position");n.current=new Float32Array(a.array.length)},[i]);const r=$.useCallback(()=>{const a=t.current.getAttribute("position");return{from:new Float32Array(a.array.length),to:a.array}},[]),s=$.useCallback(a=>{const o=n.current;o.set(a);const l=new en(o,3,!1);t.current.setAttribute("position",l),l.needsUpdate=!0},[]);yr(()=>{if(!e)return null;const a=r();return{from:{positions:a.from},to:{positions:a.to},onChange:o=>{s(o.value.positions)},config:{..._r,duration:e?void 0:0}}},[e,r,s])}function kW(i,e,t){const[{activeOpacity:n,inactiveOpacity:r}]=yr(()=>({from:{activeOpacity:0,inactiveOpacity:0},to:{activeOpacity:e?t.edge.selectedOpacity:t.edge.opacity,inactiveOpacity:e?t.edge.inactiveOpacity:t.edge.opacity},config:{..._r,duration:i?void 0:0}}),[i,e,t]);return{activeOpacity:n,inactiveOpacity:r}}const GW=({animated:i,color:e,contextMenu:t,edge:n,labelFontUrl:r,labelPlacement:s="inline",opacity:a})=>{const o=tt(D=>D.theme),{target:l,source:c,label:f,labelVisible:d=!1,size:p=1}=n,m=tt(D=>D.nodes),[y,x]=$.useMemo(()=>[m.find(D=>D.id===c),m.find(D=>D.id===l)],[m,c,l]),_=tt(D=>D.draggingIds.length>0),g=$.useMemo(()=>(p+o.edge.label.fontSize)/2,[p,o.edge.label.fontSize]),b=$.useMemo(()=>P3(y.position,x.position,L3(g,s)),[y.position,x.position,g,s]),S=tt(D=>D.edgeContextMenus),E=tt(D=>D.setEdgeContextMenus),[{labelPosition:w}]=yr(()=>({from:{labelPosition:[0,0,0]},to:{labelPosition:[b.x,b.y,b.z]},config:{..._r,duration:i&&!_?void 0:0}}),[b,i,_]),T=$.useCallback(D=>{S.delete(D),E(new Set(S))},[S,E]),R=$.useMemo(()=>s==="natural"?new Ui(0,0,0):new Ui(0,0,Math.atan2(x.position.y-y.position.y,x.position.x-y.position.x)),[s,x.position.y,x.position.x,y.position.y,y.position.x]),U=$.useMemo(()=>({prepend:!0,center:!0,position:b}),[b]),C=$.useMemo(()=>({text:f,ellipsis:15,fontUrl:r,stroke:o.edge.label.stroke,color:e,opacity:a,fontSize:o.edge.label.fontSize,rotation:R}),[f,r,o.edge.label.stroke,e,a,o.edge.label.fontSize,R]);return fe.jsxs("group",{children:[d&&f&&fe.jsx(zn.group,{position:w,children:fe.jsx(Wf,{...C})}),t&&S.has(n.id)&&fe.jsx(nb,{...U,children:t({data:n,onClose:()=>T(n.id)})})]})},HW=({interpolation:i="linear",arrowPlacement:e="end",labelPlacement:t="inline",animated:n,contextMenu:r,disabled:s,edges:a,labelFontUrl:o,onClick:l,onContextMenu:c,onPointerOut:f,onPointerOver:d})=>{const p=tt(W=>W.theme),{getGeometries:m,getGeometry:y}=zW(e,i),x=tt(W=>W.draggingIds),_=tt(W=>W.edgeMeshes),g=tt(W=>W.setEdgeMeshes),b=tt(W=>W.actives||[]),S=tt(W=>W.selections||[]),[E,w,T,R]=$.useMemo(()=>{const W=[],G=[],Z=[],Q=[];return a.forEach(j=>{if(x.includes(j.source)||x.includes(j.target)){S.includes(j.id)||b.includes(j.id)?Z.push(j):Q.push(j);return}S.includes(j.id)||b.includes(j.id)?W.push(j):G.push(j)}),[W,G,Z,Q]},[a,b,S,x]),U=!!S.length,C=$.useMemo(()=>y(E,w),[y,E,w]),{activeOpacity:D,inactiveOpacity:I}=kW(n,U,p);BW(C,n),$.useEffect(()=>{if(x.length===0){const G=m(a).map(Z=>new pn(Z));g(G)}},[m,g,a,x.length]);const P=$.useRef(new pn),O=$.useRef(new pn),H=$.useCallback(W=>{if(!W.camera)return[];const G=W.intersectObjects(_);return G.length?G.map(Z=>a[_.indexOf(Z.object)]):[]},[_,a]),{handleClick:J,handleContextMenu:z,handleIntersections:L}=FW({onClick:l,onContextMenu:c,onPointerOut:f,onPointerOver:d},r,s),F=$.useRef([]),V=$.useRef([]);return r0(W=>{if(P.current.geometry=C,s)return;const G=F.current;if((x.length||x.length===0&&G!==null)&&(O.current.geometry=y(T,R)),F.current=x,x.length)return;const Z=V.current,Q=H(W.raycaster);L(Z,Q),Q.join()!==Z.join()&&(O.current.geometry=y(Q,[])),V.current=Q}),fe.jsxs("group",{onClick:J,onContextMenu:z,children:[fe.jsxs("mesh",{ref:P,children:[fe.jsx(zn.meshBasicMaterial,{attach:"material-0",color:p.edge.fill,depthTest:!1,fog:!0,opacity:I,side:In,transparent:!0}),fe.jsx(zn.meshBasicMaterial,{attach:"material-1",color:p.edge.activeFill,depthTest:!1,fog:!0,opacity:D,side:In,transparent:!0})]}),fe.jsxs("mesh",{ref:O,children:[fe.jsx(zn.meshBasicMaterial,{attach:"material-0",color:p.edge.fill,depthTest:!1,fog:!0,opacity:I,side:In,transparent:!0}),fe.jsx(zn.meshBasicMaterial,{attach:"material-1",color:p.edge.activeFill,depthTest:!1,fog:!0,opacity:D,side:In,transparent:!0})]}),a.map(W=>fe.jsx(GW,{animated:n,contextMenu:r,color:p.edge.label.color,disabled:s,edge:W,labelFontUrl:o,labelPlacement:t},W.id))]})},VW=({color:i="#D8E6EA",size:e=1,opacity:t=.5,animated:n,strokeWidth:r=5,innerRadius:s=4,segments:a=25})=>{const o=$.useMemo(()=>new $e(i),[i]),{ringSize:l,ringOpacity:c}=yr({from:{ringOpacity:0,ringSize:[1e-5,1e-5,1e-5]},to:{ringOpacity:t,ringSize:[e/2,e/2,1]},config:{..._r,duration:n?void 0:0}}),f=r/10,d=s+f;return fe.jsx(g3,{position:[0,0,1],children:fe.jsxs(zn.mesh,{scale:l,children:[fe.jsx("ringGeometry",{attach:"geometry",args:[s,d,a]}),fe.jsx(zn.meshBasicMaterial,{attach:"material",color:o,transparent:!0,depthTest:!1,opacity:c,side:In,fog:!0})]})})},WW=({color:i,id:e,size:t,selected:n,opacity:r=1,animated:s})=>{const{scale:a,nodeOpacity:o}=yr({from:{scale:[1e-5,1e-5,1e-5],nodeOpacity:0},to:{scale:[t,t,t],nodeOpacity:r},config:{..._r,duration:s?void 0:0}}),l=$.useMemo(()=>new $e(i),[i]),c=tt(f=>f.theme);return fe.jsxs(fe.Fragment,{children:[fe.jsxs(zn.mesh,{userData:{id:e,type:"node"},scale:a,children:[fe.jsx("sphereGeometry",{attach:"geometry",args:[1,25,25]}),fe.jsx(zn.meshPhongMaterial,{attach:"material",side:In,transparent:!0,fog:!0,opacity:o,color:l,emissive:l,emissiveIntensity:.7})]}),fe.jsx(VW,{opacity:n?.5:0,size:t,animated:s,color:n?c.ring.activeFill:c.ring.fill})]})},XW=({image:i,id:e,size:t,opacity:n=1,animated:r})=>{const s=$.useMemo(()=>new Q2().load(i),[i]),{scale:a,spriteOpacity:o}=yr({from:{scale:[1e-5,1e-5,1e-5],spriteOpacity:0},to:{scale:[t,t,t],spriteOpacity:n},config:{..._r,duration:r?void 0:0}});return fe.jsx(zn.sprite,{userData:{id:e,type:"node"},scale:a,children:fe.jsx(zn.spriteMaterial,{attach:"material",opacity:o,fog:!0,depthTest:!1,transparent:!0,side:In,children:fe.jsx("primitive",{attach:"map",object:s,minFilter:Pn})})})},jW=({animated:i,disabled:e,id:t,draggable:n=!1,labelFontUrl:r,contextMenu:s,onClick:a,onDoubleClick:o,onPointerOver:l,onDragged:c,onPointerOut:f,onContextMenu:d,renderNode:p,constrainDragging:m})=>{var y,x,_;const g=_0(),b=tt(ne=>ne.theme),S=tt(ne=>ne.nodes.find(ve=>ve.id===t)),E=tt(ne=>ne.edges),w=tt(ne=>ne.draggingIds),T=tt(ne=>ne.collapsedNodeIds),R=tt(ne=>ne.addDraggingId),U=tt(ne=>ne.removeDraggingId),C=tt(ne=>ne.setHoveredNodeId),D=tt(ne=>ne.setNodePosition),I=tt(ne=>ne.setCollapsedNodeIds),P=tt(ne=>ne.collapsedNodeIds.includes(t)),O=tt(ne=>{var ve;return(ve=ne.actives)==null?void 0:ve.includes(t)}),H=tt(ne=>{var ve;return(ve=ne.selections)==null?void 0:ve.includes(t)}),J=tt(ne=>{var ve;return((ve=ne.selections)==null?void 0:ve.length)>0}),z=tt(ne=>ne.centerPosition),L=tt(ne=>ne.clusters.get(S.cluster)),F=w.includes(t),V=w.length>0,{position:W,label:G,subLabel:Z,size:Q=7,labelVisible:j=!0}=S,ee=$.useRef(null),[pe,le]=$.useState(!1),[ce,Le]=$.useState(!1),Me=pe||H||O,ge=J?Me?b.node.selectedOpacity:b.node.inactiveOpacity:b.node.opacity,ie=$.useMemo(()=>E.filter(ve=>ve.source===t).length>0||P,[E,t,P]),be=$.useCallback(()=>{ie&&I(P?T.filter(ne=>ne!==t):[...T,t])},[ie,T,t,P,I]),[{nodePosition:k,labelPosition:re,subLabelPosition:te}]=yr(()=>({from:{nodePosition:z?[z.x,z.y,0]:[0,0,0],labelPosition:[0,-(Q+7),2],subLabelPosition:[0,-(Q+14),2]},to:{nodePosition:W?[W.x,W.y,Me?W.z+1:W.z]:[0,0,0],labelPosition:[0,-(Q+7),2],subLabelPosition:[0,-(Q+14),2]},config:{..._r,duration:i&&!V?void 0:0}}),[F,W,i,Q,Me]),we=G3({draggable:n,position:W,bounds:m?L==null?void 0:L.position:void 0,set:ne=>D(t,ne),onDragStart:()=>{R(t),le(!0)},onDragEnd:()=>{U(t),c==null||c(S)}});El(pe&&!V&&a!==void 0,"pointer"),El(pe&&n&&!F&&a===void 0,"grab"),El(F,"grabbing");const se=Me||F,Re=se?b.node.activeFill:S.fill||b.node.fill,{pointerOver:xe,pointerOut:de}=ab({disabled:e||F,onPointerOver:ne=>{g.freeze(),le(!0),l==null||l(S,ne),C(t)},onPointerOut:ne=>{g.unFreeze(),le(!1),f==null||f(S,ne),C(null)}}),We=$.useMemo(()=>p?p({id:t,color:Re,size:Q,active:se,opacity:ge,animated:i,selected:H,node:S}):fe.jsx(fe.Fragment,{children:S.icon?fe.jsx(XW,{id:t,image:S.icon||"",size:Q+8,opacity:ge,animated:i,color:Re,node:S,active:se,selected:H}):fe.jsx(WW,{id:t,size:Q,opacity:ge,animated:i,color:Re,node:S,active:se,selected:H})}),[p,t,Re,Q,se,ge,i,H,S]),X=$.useMemo(()=>{var ne,ve,ye;return j&&(j||H||pe)&&G&&fe.jsxs(fe.Fragment,{children:[fe.jsx(zn.group,{position:re,children:fe.jsx(Wf,{text:G,fontUrl:r,opacity:ge,stroke:b.node.label.stroke,active:H||pe||F||O,color:H||pe||F||O?b.node.label.activeColor:b.node.label.color})}),Z&&fe.jsx(zn.group,{position:te,children:fe.jsx(Wf,{text:Z,fontUrl:r,fontSize:5,opacity:ge,stroke:(ne=b.node.subLabel)==null?void 0:ne.stroke,active:H||pe||F||O,color:H||pe||F||O?(ve=b.node.subLabel)==null?void 0:ve.activeColor:(ye=b.node.subLabel)==null?void 0:ye.color})})]})},[pe,O,F,H,G,r,re,j,ge,Z,te,b.node.label.activeColor,b.node.label.color,b.node.label.stroke,(y=b.node.subLabel)==null?void 0:y.activeColor,(x=b.node.subLabel)==null?void 0:x.color,(_=b.node.subLabel)==null?void 0:_.stroke]),B=$.useMemo(()=>ce&&s&&fe.jsx(nb,{prepend:!0,center:!0,children:s({data:S,canCollapse:ie,isCollapsed:P,onCollapse:be,onClose:()=>Le(!1)})}),[ce,s,S,ie,P,be]);return fe.jsxs(zn.group,{renderOrder:1,userData:{id:t,type:"node"},ref:ee,position:k,onPointerOver:xe,onPointerOut:de,onClick:ne=>{!e&&!F&&(a==null||a(S,{canCollapse:ie,isCollapsed:P},ne))},onDoubleClick:ne=>{!e&&!F&&(o==null||o(S,ne))},onContextMenu:()=>{e||(Le(!0),d==null||d(S,{canCollapse:ie,isCollapsed:P,onCollapse:be}))},...we(),children:[We,B,X]})};function V3(i,e){const t=e.position.z;i<t?i-=t:i+=t;const n=e.fov/e.zoom*Math.PI/180;return 2*Math.tan(n/2)*Math.abs(i)}function qW(i,e){return V3(i,e)*e.aspect}function _A(i,e){var t,n,r,s;const a=qW(1,i),o=V3(1,i),l={x0:((t=i==null?void 0:i.position)==null?void 0:t.x)-a/2,x1:((n=i==null?void 0:i.position)==null?void 0:n.x)+a/2,y0:((r=i==null?void 0:i.position)==null?void 0:r.y)-o/2,y1:((s=i==null?void 0:i.position)==null?void 0:s.y)+o/2};return(e==null?void 0:e.x)>l.x0&&(e==null?void 0:e.x)<l.x1&&(e==null?void 0:e.y)>l.y0&&(e==null?void 0:e.y)<l.y1}function xA(i,e){return e.reduce((t,n)=>Math.abs(n-i%Math.PI)<Math.abs(t-i%Math.PI)?n:t)}function YW(i,e){const t=xA(i,[0,Math.PI]),n=xA(e,[Math.PI/2,3*Math.PI/2]);return{horizontalRotation:t-i%Math.PI,verticalRotation:n-e%Math.PI}}const Qp=50,ZW=({animated:i,disabled:e,layoutType:t})=>{const n=tt(x=>x.nodes),[r,s]=$.useState(!1),a=Kn(x=>x.invalidate),{controls:o}=_0(),l=Kn(x=>x.camera),c=$.useRef(!1),f=$.useCallback(async(x,_)=>{const g=(_==null?void 0:_.animated)!==void 0?_==null?void 0:_.animated:!0,b=(_==null?void 0:_.centerOnlyIfNodesNotInView)!==void 0?_==null?void 0:_.centerOnlyIfNodesNotInView:!1;if(!c.current||!b||b&&(x!=null&&x.some(S=>!_A(l,S.position)))){const{x:S,y:E,z:w}=Vf(x);await o.setTarget(S,E,w,g),r||s(!0),a()}},[a,o,n]),d=$.useCallback(async(x,_={animated:!0,fitOnlyIfNodesNotInView:!1})=>{const{fitOnlyIfNodesNotInView:g}=_;if(!g||g&&(x!=null&&x.some(b=>!_A(l,b.position)))){const{minX:b,maxX:S,minY:E,maxY:w,minZ:T,maxZ:R}=Vf(x);if(!t.includes("3d")){const{horizontalRotation:U,verticalRotation:C}=YW(o==null?void 0:o.azimuthAngle,o==null?void 0:o.polarAngle);o==null||o.rotate(U,C,!0)}await(o==null?void 0:o.zoomTo(1,_==null?void 0:_.animated)),await(o==null?void 0:o.fitToBox(new Jn(new K(b,E,T),new K(S,w,R)),_==null?void 0:_.animated,{cover:!1,paddingLeft:Qp,paddingRight:Qp,paddingBottom:Qp,paddingTop:Qp}))}},[l,o,t]),p=$.useCallback(x=>{let _=null;return x!=null&&x.length&&(_=x.reduce((g,b)=>{const S=n.find(E=>E.id===b);if(S)g.push(S);else throw new Error(`Attempted to center ${b} but it was not found in the nodes`);return g},[])),_},[n]),m=$.useCallback((x,_)=>{const g=p(x);f(g||n,{animated:i,centerOnlyIfNodesNotInView:_==null?void 0:_.centerOnlyIfNodesNotInView})},[i,f,p,n]),y=$.useCallback(async(x,_)=>{const g=p(x);await d(g||n,{animated:i,..._})},[i,d,p,n]);return $.useLayoutEffect(()=>{async function x(){o&&(n!=null&&n.length)&&(c.current||(await f(n,{animated:!1}),await d(n,{animated:!1}),c.current=!0))}x()},[o,f,n,i,l,d]),{centerNodes:f,centerNodesById:m,fitNodesInViewById:y,isCentered:r}},KW=$.forwardRef(({onNodeClick:i,onNodeDoubleClick:e,onNodeContextMenu:t,onEdgeContextMenu:n,onEdgeClick:r,onEdgePointerOver:s,onEdgePointerOut:a,onNodePointerOver:o,onNodePointerOut:l,onClusterClick:c,onNodeDragged:f,onClusterDragged:d,onClusterPointerOver:p,onClusterPointerOut:m,contextMenu:y,animated:x,disabled:_,draggable:g,constrainDragging:b=!1,edgeLabelPosition:S,edgeArrowPosition:E,edgeInterpolation:w="linear",labelFontUrl:T,renderNode:R,onRenderCluster:U,...C},D)=>{const{layoutType:I,clusterAttribute:P}=C,O=Kn(ce=>ce.gl),H=Kn(ce=>ce.scene),J=Kn(ce=>ce.camera),{updateLayout:z}=UW({...C,constrainDragging:b});if(P&&!(I==="forceDirected2d"||I==="forceDirected3d"))throw new Error("Clustering is only supported for the force directed layouts.");const L=tt(ce=>ce.graph),F=tt(ce=>ce.nodes),V=tt(ce=>ce.edges),W=tt(ce=>[...ce.clusters.values()]),{centerNodesById:G,fitNodesInViewById:Z,isCentered:Q}=ZW({animated:x,disabled:_,layoutType:I});$.useImperativeHandle(D,()=>({centerGraph:G,fitNodesInView:Z,graph:L,renderScene:()=>O.render(H,J)}),[G,Z,L,O,H,J]);const j=$.useCallback(ce=>{f==null||f(ce),P&&z()},[P,f,z]),ee=$.useMemo(()=>F.map(ce=>fe.jsx(jW,{id:ce==null?void 0:ce.id,labelFontUrl:T,draggable:g,constrainDragging:b,disabled:_,animated:x,contextMenu:y,renderNode:R,onClick:i,onDoubleClick:e,onContextMenu:t,onPointerOver:o,onPointerOut:l,onDragged:j},ce==null?void 0:ce.id)),[b,x,y,_,g,T,F,i,t,e,j,l,o,R]),pe=$.useMemo(()=>x?V.map(ce=>fe.jsx(PW,{id:ce.id,disabled:_,animated:x,labelFontUrl:T,labelPlacement:S,arrowPlacement:E,interpolation:w,contextMenu:y,onClick:r,onContextMenu:n,onPointerOver:s,onPointerOut:a},ce.id)):fe.jsx(HW,{edges:V,disabled:_,animated:x,labelFontUrl:T,labelPlacement:S,arrowPlacement:E,interpolation:w,contextMenu:y,onClick:r,onContextMenu:n,onPointerOver:s,onPointerOut:a}),[x,y,_,E,w,S,V,T,r,n,a,s]),le=$.useMemo(()=>W.map(ce=>fe.jsx(LW,{animated:x,disabled:_,draggable:g,labelFontUrl:T,onClick:c,onPointerOver:p,onPointerOut:m,onDragged:d,onRender:U,...ce},ce.label)),[x,W,_,g,T,c,m,p,d,U]);return Q&&fe.jsxs($.Fragment,{children:[pe,ee,le]})});di.install({THREE:{MOUSE:SA,Vector2:ke,Vector3:K,Vector4:kt,Quaternion:_i,Matrix4:bt,Spherical:fC,Box3:Jn,Sphere:ri,Raycaster:y1,MathUtils:{DEG2RAD:(lA=Km)==null?void 0:lA.DEG2RAD,clamp:(cA=Km)==null?void 0:cA.clamp}}});IC({ThreeCameraControls:di});const $p={ARROW_LEFT:37,ARROW_UP:38,ARROW_RIGHT:39,ARROW_DOWN:40},JW=$.forwardRef(({mode:i="rotate",children:e,animated:t,disabled:n,minDistance:r=1e3,maxDistance:s=5e4},a)=>{const o=$.useRef(null),l=Kn(O=>O.camera),c=Kn(O=>O.gl),f=i==="orbit",d=tt(O=>O.setPanning),p=tt(O=>O.draggingIds.length>0),m=$.useRef(0),[y,x]=$.useState(!1);r0((O,H)=>{var J,z;(J=o.current)!=null&&J.enabled&&((z=o.current)==null||z.update(H)),f&&(o.current.azimuthAngle+=20*H*Km.DEG2RAD)},-1),$.useEffect(()=>()=>{var O;return(O=o.current)==null?void 0:O.dispose()},[]);const _=$.useCallback(()=>{var O;(O=o.current)==null||O.zoom(l.zoom/2,t)},[t,l.zoom]),g=$.useCallback(()=>{var O;(O=o.current)==null||O.zoom(-l.zoom/2,t)},[t,l.zoom]),b=$.useCallback(O=>{var H;(H=o.current)==null||H.dolly(O,t)},[t]),S=$.useCallback(O=>{var H;(H=o.current)==null||H.dolly(O,t)},[t]),E=$.useCallback(O=>{var H;f||(H=o.current)==null||H.truck(-.03*O.deltaTime,0,t)},[t,f]),w=$.useCallback(O=>{var H;f||(H=o.current)==null||H.truck(.03*O.deltaTime,0,t)},[t,f]),T=$.useCallback(O=>{var H;f||(H=o.current)==null||H.truck(0,.03*O.deltaTime,t)},[t,f]),R=$.useCallback(O=>{var H;f||(H=o.current)==null||H.truck(0,-.03*O.deltaTime,t)},[t,f]),U=$.useCallback(O=>{O.code==="Space"&&(i==="rotate"?o.current.mouseButtons.left=di.ACTION.TRUCK:o.current.mouseButtons.left=di.ACTION.ROTATE)},[i]),C=$.useCallback(O=>{O.code==="Space"&&(i==="rotate"?o.current.mouseButtons.left=di.ACTION.ROTATE:o.current.mouseButtons.left=di.ACTION.TRUCK)},[i]),[D,I]=$.useState(null);$.useEffect(()=>{sb||I({leftKey:new Jp($p.ARROW_LEFT,100),rightKey:new Jp($p.ARROW_RIGHT,100),upKey:new Jp($p.ARROW_UP,100),downKey:new Jp($p.ARROW_DOWN,100)})},[]),$.useEffect(()=>(!n&&D&&(D.leftKey.addEventListener("holding",w),D.rightKey.addEventListener("holding",E),D.upKey.addEventListener("holding",T),D.downKey.addEventListener("holding",R),window.addEventListener("keydown",U),window.addEventListener("keyup",C)),()=>{D&&(D.leftKey.removeEventListener("holding",w),D.rightKey.removeEventListener("holding",E),D.upKey.removeEventListener("holding",T),D.downKey.removeEventListener("holding",R),window.removeEventListener("keydown",U),window.removeEventListener("keyup",C))}),[n,U,C,R,w,E,T,D]),$.useEffect(()=>{n?(o.current.mouseButtons.left=di.ACTION.NONE,o.current.mouseButtons.middle=di.ACTION.NONE,o.current.mouseButtons.wheel=di.ACTION.NONE):(o.current.mouseButtons.left=di.ACTION.TRUCK,o.current.mouseButtons.middle=di.ACTION.TRUCK,o.current.mouseButtons.wheel=di.ACTION.DOLLY)},[n]),$.useEffect(()=>{const O=()=>d(!0),H=()=>d(!1),J=o.current;return J&&(J.addEventListener("control",O),J.addEventListener("controlend",H)),()=>{J&&(J.removeEventListener("control",O),J.removeEventListener("controlend",H))}},[o,d]),$.useEffect(()=>{p?(o.current.mouseButtons.left=di.ACTION.NONE,o.current.touches.one=di.ACTION.NONE):i==="rotate"?(o.current.mouseButtons.left=di.ACTION.ROTATE,o.current.touches.one=di.ACTION.TOUCH_ROTATE):(o.current.touches.one=di.ACTION.TOUCH_TRUCK,o.current.mouseButtons.left=di.ACTION.TRUCK)},[p,i]);const P=$.useMemo(()=>({controls:o.current,zoomIn:()=>_(),zoomOut:()=>g(),dollyIn:(O=1e3)=>b(O),dollyOut:(O=-1e3)=>S(O),panLeft:(O=100)=>w({deltaTime:O}),panRight:(O=100)=>E({deltaTime:O}),panDown:(O=100)=>R({deltaTime:O}),panUp:(O=100)=>T({deltaTime:O}),resetControls:O=>{var H;return(H=o.current)==null?void 0:H.reset(O)},freeze:()=>{o.current.truckSpeed&&(m.current=o.current.truckSpeed),o.current.truckSpeed=0},unFreeze:()=>o.current.truckSpeed=m.current}),[_,g,w,E,R,T,o.current]);return $.useImperativeHandle(a,()=>P),fe.jsxs(H3.Provider,{value:P,children:[fe.jsx("threeCameraControls",{ref:O=>{o.current=O,y||x(!0)},args:[l,c.domElement],smoothTime:.1,minDistance:r,dollyToCursor:!0,maxDistance:s}),e]})}),QW={canvas:{background:"#fff"},node:{fill:"#7CA0AB",activeFill:"#1DE9AC",opacity:1,selectedOpacity:1,inactiveOpacity:.2,label:{color:"#2A6475",stroke:"#fff",activeColor:"#1DE9AC"},subLabel:{color:"#ddd",stroke:"transparent",activeColor:"#1DE9AC"}},lasso:{border:"1px solid #55aaff",background:"rgba(75, 160, 255, 0.1)"},ring:{fill:"#D8E6EA",activeFill:"#1DE9AC"},edge:{fill:"#D8E6EA",activeFill:"#1DE9AC",opacity:1,selectedOpacity:1,inactiveOpacity:.1,label:{stroke:"#fff",color:"#2A6475",activeColor:"#1DE9AC",fontSize:6}},arrow:{fill:"#D8E6EA",activeFill:"#1DE9AC"},cluster:{stroke:"#D8E6EA",opacity:1,selectedOpacity:1,inactiveOpacity:.1,label:{stroke:"#fff",color:"#2A6475"}}};function P_(i,e,t){e=Array.isArray(e)?e:[e];const n=[],r=[];for(const s of e){const a=[...i.inEdgeEntries(s)??[],...i.outEdgeEntries(s)??[]];if(a)for(const o of a){const l=o.attributes.id;if(t==="in"?o.target===s&&!r.includes(l)&&r.push(l):t==="out"?o.source===s&&!r.includes(l)&&r.push(l):r.includes(l)||r.push(l),t==="out"||t==="all"){const c=o.target;n.includes(c)||n.push(c)}(t==="in"||t==="all")&&(n.includes(o.source)||n.push(o.source))}}return{nodes:n,edges:r}}function em(i,e,t){const{offsetX:n,offsetY:r}=i,{width:s,height:a}=t;e.set(n/s*2-1,-(r/a)*2+1)}function $W(i){const e=document.createElement("div");return e.style.pointerEvents="none",e.style.border=i.lasso.border,e.style.backgroundColor=i.lasso.background,e.style.position="fixed",e}const eX=({children:i,type:e="none",onLasso:t,onLassoEnd:n,disabled:r})=>{var s;const a=tt(P=>P.theme),o=Kn(P=>P.camera),l=Kn(P=>P.gl),c=Kn(P=>P.setEvents),f=Kn(P=>P.size),d=Kn(P=>P.get),p=Kn(P=>P.scene),m=_0(),y=tt(P=>P.actives),x=tt(P=>P.setActives),_=tt(P=>P.edges),g=tt(P=>P.edgeMeshes),b=$.useRef(null),S=$.useRef(null),E=$.useRef($W(a)),w=$.useRef(null),T=$.useRef(!1),R=$.useRef(d().events.enabled),U=$.useRef((s=m.controls)==null?void 0:s.enabled),C=$.useCallback(P=>{if(T.current){const[O,H,J]=w.current;J.x=Math.max(O.x,P.clientX),J.y=Math.max(O.y,P.clientY),H.x=Math.min(O.x,P.clientX),H.y=Math.min(O.y,P.clientY),E.current.style.left=`${H.x}px`,E.current.style.top=`${H.y}px`,E.current.style.width=`${J.x-H.x}px`,E.current.style.height=`${J.y-H.y}px`,em(P,b.current.endPoint,f),em(P,S.current.endPoint,f);const z=[],L=S.current.select().sort(V=>V.uuid).map(V=>_[g.indexOf(V)].id);z.push(...L);const F=b.current.select().sort(V=>V.uuid).filter(V=>{var W,G;return V.isMesh&&((W=V.userData)==null?void 0:W.id)&&(((G=V.userData)==null?void 0:G.type)===e||e==="all")}).map(V=>V.userData.id);z.push(...F),requestAnimationFrame(()=>{x(z),t==null||t(z)}),document.addEventListener("pointermove",C,{passive:!0,capture:!0,once:!0})}},[f,_,g,e,x,t]),D=$.useCallback(()=>{var P;T.current&&(c({enabled:R.current}),T.current=!1,(P=E.current.parentElement)==null||P.removeChild(E.current),m.controls.enabled=U.current,n==null||n(y),document.removeEventListener("pointermove",C),document.removeEventListener("pointerup",D))},[c,m.controls,n,y,C]),I=$.useCallback(P=>{var O,H;if(P.shiftKey){R.current=d().events.enabled,U.current=(O=m.controls)==null?void 0:O.enabled,b.current=new zT(o,p);const J=new Pg;g.length&&J.add(...g),S.current=new zT(o,J),w.current=[new ke,new ke,new ke];const[z]=w.current;m.controls.enabled=!1,c({enabled:!1}),T.current=!0,(H=l.domElement.parentElement)==null||H.appendChild(E.current),E.current.style.left=`${P.clientX}px`,E.current.style.top=`${P.clientY}px`,E.current.style.width="0px",E.current.style.height="0px",z.x=P.clientX,z.y=P.clientY,em(P,b.current.startPoint,f),em(P,S.current.startPoint,f),document.addEventListener("pointermove",C,{passive:!0,capture:!0,once:!0}),document.addEventListener("pointerup",D,{passive:!0})}},[o,m.controls,g,d,l.domElement.parentElement,C,D,p,c,f]);return $.useEffect(()=>{if(!(r||e==="none"))return typeof window<"u"&&(document.addEventListener("pointerdown",I,{passive:!0}),document.addEventListener("pointermove",C,{passive:!0}),document.addEventListener("pointerup",D,{passive:!0})),()=>{typeof window<"u"&&(document.removeEventListener("pointerdown",I),document.removeEventListener("pointermove",C),document.removeEventListener("pointerup",D))}},[e,r,I,C,D]),fe.jsx("group",{children:i})},tX="_canvas_670zp_1",nX={canvas:tX},iX={alpha:!0,antialias:!0},rX={position:[0,0,1e3],near:5,far:5e4,fov:10},sX=$.forwardRef(({cameraMode:i="pan",layoutType:e="forceDirected2d",sizingType:t="default",labelType:n="auto",theme:r=QW,animated:s=!0,defaultNodeSize:a=7,minNodeSize:o=5,maxNodeSize:l=15,lassoType:c="none",glOptions:f={},edges:d,children:p,nodes:m,minDistance:y,maxDistance:x,onCanvasClick:_,disabled:g,onLasso:b,onLassoEnd:S,...E},w)=>{var T,R;const U=$.useRef(null),C=$.useRef(null),D=$.useRef(null);$.useImperativeHandle(w,()=>({centerGraph:(L,F)=>{var V;return(V=U.current)==null?void 0:V.centerGraph(L,F)},fitNodesInView:(L,F)=>{var V;return(V=U.current)==null?void 0:V.fitNodesInView(L,F)},zoomIn:()=>{var L;return(L=C.current)==null?void 0:L.zoomIn()},zoomOut:()=>{var L;return(L=C.current)==null?void 0:L.zoomOut()},dollyIn:L=>{var F;return(F=C.current)==null?void 0:F.dollyIn(L)},dollyOut:L=>{var F;return(F=C.current)==null?void 0:F.dollyOut(L)},panLeft:()=>{var L;return(L=C.current)==null?void 0:L.panLeft()},panRight:()=>{var L;return(L=C.current)==null?void 0:L.panRight()},panDown:()=>{var L;return(L=C.current)==null?void 0:L.panDown()},panUp:()=>{var L;return(L=C.current)==null?void 0:L.panUp()},resetControls:L=>{var F;return(F=C.current)==null?void 0:F.resetControls(L)},getControls:()=>{var L;return(L=C.current)==null?void 0:L.controls},getGraph:()=>{var L;return(L=U.current)==null?void 0:L.graph},exportCanvas:()=>(U.current.renderScene(),D.current.toDataURL()),freeze:()=>{var L;return(L=C.current)==null?void 0:L.freeze()},unFreeze:()=>{var L;return(L=C.current)==null?void 0:L.unFreeze()}}));const{selections:I,actives:P,collapsedNodeIds:O}=E,H=d.length+m.length>400?!1:s,J=$.useMemo(()=>({...f,...iX}),[f]),z=$.useRef(z3({selections:I,actives:P,theme:r,collapsedNodeIds:O})).current;return fe.jsx("div",{className:nX.canvas,children:fe.jsx(C5,{legacy:!0,linear:!0,ref:D,flat:!0,gl:J,camera:rX,onPointerMissed:_,children:fe.jsxs(RW,{store:z,children:[((T=r.canvas)==null?void 0:T.background)&&fe.jsx("color",{attach:"background",args:[r.canvas.background]}),fe.jsx("ambientLight",{intensity:1}),p,((R=r.canvas)==null?void 0:R.fog)&&fe.jsx("fog",{attach:"fog",args:[r.canvas.fog,4e3,9e3]}),fe.jsx(JW,{mode:i,ref:C,disabled:g,minDistance:y,maxDistance:x,animated:s,children:fe.jsx(eX,{disabled:g,type:c,onLasso:b,onLassoEnd:S,children:fe.jsx($.Suspense,{children:fe.jsx(KW,{ref:U,disabled:g,animated:H,edges:d,nodes:m,layoutType:e,sizingType:t,labelType:n,defaultNodeSize:a,minNodeSize:o,maxNodeSize:l,...E})})})})]})})})}),aX=({selections:i=[],nodes:e=[],actives:t=[],focusOnSelect:n=!0,type:r="single",pathHoverType:s="out",pathSelectionType:a="direct",ref:o,disabled:l,onSelection:c})=>{const[f,d]=$.useState([]),[p,m]=$.useState(t),[y,x]=$.useState(i),[_,g]=$.useState(!1),b=r==="multi"||r==="multiModifier",S=$.useCallback(L=>{if(!l&&L){L=Array.isArray(L)?L:[L];const F=L.filter(V=>!y.includes(V));if(F.length){const V=[...y,...F];c==null||c(V),x(V)}}},[l,y,c]),E=$.useCallback(L=>{if(!l&&L){L=Array.isArray(L)?L:[L];const F=y.filter(V=>!L.includes(V));c==null||c(F),x(F)}},[l,y,c]),w=$.useCallback((L=[])=>{l||(L=Array.isArray(L)?L:[L],m([]),x(L),c==null||c(L))},[l,c]),T=$.useCallback(L=>{y.includes(L)?E(L):b?S(L):w(L)},[S,w,y,b,E]),R=$.useCallback(L=>{if(b?r==="multiModifier"?_?S(L.id):w(L.id):S(L.id):w(L.id),n===!0||n==="singleOnly"&&!_){if(!o.current)throw new Error("No ref found for the graph canvas.");const F=o.current.getGraph(),{nodes:V}=P_(F,[L.id],a);o.current.fitNodesInView([L.id,...V],{fitOnlyIfNodesNotInView:!0})}},[S,w,n,b,_,a,o,r]),U=$.useCallback((L,F)=>{const V=o.current.getGraph();if(!V)throw new Error("Graph is not initialized");const W=CW(V,L,F);w([L,F]);const G=[];for(let Z=0;Z<W.length-1;Z++){const Q=W[Z],j=W[Z+1],ee=V.getEdgeAttributes(Q,j);ee&&G.push(ee.id)}m([...W.map(Z=>Z),...G])},[w,o]),C=$.useCallback(L=>{const F=L.target,V=gA(F),W=L.metaKey||L.ctrlKey;V&&W&&g(!0)},[]),D=$.useCallback(L=>{const F=L.target,V=gA(F),W=["Meta","Control"].includes(L.key);V&&W&&g(!1)},[]);$.useEffect(()=>(typeof window<"u"&&(window.addEventListener("keydown",C),window.addEventListener("keyup",D)),()=>{typeof window<"u"&&(window.removeEventListener("keydown",C),window.removeEventListener("keyup",D))}),[C,D]);const I=$.useCallback(L=>{if(L.button!==2&&(y.length||p.length)&&(w(),g(!1),n&&y.length===1)){if(!o.current)throw new Error("No ref found for the graph canvas.");o.current.fitNodesInView([],{fitOnlyIfNodesNotInView:!0})}},[w,n,p.length,y.length,o]),P=$.useCallback(L=>{m(L)},[]),O=$.useCallback(L=>{w(L)},[w]),H=$.useCallback(L=>{if(s){const F=o.current.getGraph();if(!F)throw new Error("No ref found for the graph canvas.");const{nodes:V,edges:W}=P_(F,[L.id],s);d([...V,...W])}},[s,o]),J=$.useCallback(()=>{s&&d([])},[s]);return $.useEffect(()=>{var L;if(a!=="direct"&&y.length>0){const F=(L=o.current)==null?void 0:L.getGraph();if(F){const{nodes:V,edges:W}=P_(F,y,a);m([...V,...W])}}},[y,a,o]),{actives:$.useMemo(()=>[...p,...f],[p,f]),onNodeClick:R,onNodePointerOver:H,onNodePointerOut:J,onLasso:P,onLassoEnd:O,selectNodePaths:U,onCanvasClick:I,selections:y,clearSelections:w,addSelection:S,removeSelection:E,toggleSelection:T,setSelections:x}},oX=""+new URL("NotoSans-Regular-D96CXwz4.ttf",import.meta.url).href,lX=$.memo(({data:i,onCollapse:e,isCollapsed:t,canCollapse:n,onClose:r})=>{const{t:s}=xg(["network","zigbee","common"]);let a;if(i.parent){const o=i.parent.lastIndexOf(` - ${s("children")}`);a=o>-1?i.parent.slice(0,o):i.parent}return fe.jsx("div",{className:"card bg-base-100 shadow-sm",children:fe.jsxs("div",{className:"card-body",children:[fe.jsx("h2",{className:"card-title",children:i.friendlyName}),fe.jsx("span",{children:i.type}),fe.jsx("span",{title:s("zigbee:ieee_address"),children:i.ieeeAddr}),fe.jsxs("span",{title:s("zigbee:network_address_hex"),className:"justify-self-end",children:[HU(i.networkAddress,4)," | ",fe.jsx("span",{title:s("zigbee:network_address_dec"),children:i.networkAddress})]}),a&&fe.jsxs("span",{children:[s("parent"),": ",a]}),i.failed&&i.failed.length>0&&fe.jsxs("div",{className:"badge badge-ghost",children:[fe.jsx(ni,{icon:VU,className:"text-error",beatFade:!0}),s("common:failed"),": ",i.failed]}),fe.jsxs("div",{className:"card-actions justify-end mt-2",children:[n&&fe.jsx(ts,{className:"btn btn-square btn-primary",onClick:e,children:fe.jsx(ni,{icon:t?WU:XU})}),fe.jsx(ts,{className:"btn btn-square btn-neutral",onClick:r,children:fe.jsx(ni,{icon:jU})})]})]})})}),bA=$.memo(i=>{const{label:e,icon:t,onChange:n,onSubmit:r,defaultValue:s,...a}=i,[o,l]=$.useState(s);$.useEffect(()=>{l(s)},[s]);const c=$.useCallback(d=>{l(d.target.value?d.target.valueAsNumber:""),n==null||n(d)},[n]),f=$.useCallback(d=>{r==null||r(o,!d.target.validationMessage)},[r,o]);return fe.jsxs("div",{className:"flex flex-row flex-wrap items-center gap-2 bg-base-100 rounded-box px-2 pb-1",title:e,children:[fe.jsx(ni,{icon:t}),fe.jsxs("div",{className:"",children:[fe.jsx("input",{className:"range range-xs",onChange:c,onTouchEnd:f,onMouseUp:f,...a,type:"range",value:o}),fe.jsxs("div",{className:"flex justify-between px-1 mt-1 text-xs",children:[fe.jsx("span",{children:i.min}),fe.jsx("span",{children:o}),fe.jsx("span",{children:i.max})]})]})]})}),cX=$.memo(({graphRef:i,layoutType:e,onLayoutTypeChange:t,labelType:n,onLabelTypeChange:r,nodeStrength:s,onNodeStrengthChange:a,linkDistance:o,onLinkDistanceChange:l,nodes:c,showParents:f,setShowParents:d,showChildren:p,setShowChildren:m,showSiblings:y,setShowSiblings:x})=>{const{t:_}=xg("network"),g=$.useMemo(()=>{const E=c.map(w=>[w.id,w.data.type!=="Coordinator"?`${w.data.type[0]} - ${w.label}`:w.label]);return E.sort(([,w],[,T])=>w.localeCompare(T)),E.map(([w,T])=>fe.jsx("option",{value:w,children:T},w))},[c]),b=$.useCallback(()=>{i.current&&qU(i.current.exportCanvas(),`network-map-${Date.now()}.png`)},[i]),S=$.useCallback(E=>{var w,T;if(E.target.value){const R=[E.target.value];(w=i.current)==null||w.centerGraph(R),(T=i.current)==null||T.fitNodesInView(R)}},[i]);return fe.jsxs(fe.Fragment,{children:[fe.jsxs("div",{className:"absolute z-9 top-0 left-0 p-1 flex flex-row flex-wrap gap-1 items-start",children:[fe.jsx(ts,{title:_("download_image"),className:"btn btn-square btn-neutral btn-sm",onClick:b,children:fe.jsx(ni,{icon:YU})}),fe.jsx(ts,{title:_("reset_controls"),className:"btn btn-square btn-neutral btn-sm",onClick:()=>{var E;(E=i.current)==null||E.resetControls()},children:fe.jsx(ni,{icon:ZU})}),fe.jsx(ts,{title:_("fit_view"),className:"btn btn-square btn-neutral btn-sm",onClick:()=>{var E,w;(E=i.current)==null||E.centerGraph(),(w=i.current)==null||w.fitNodesInView()},children:fe.jsx(ni,{icon:KU})}),fe.jsx(ts,{title:_("zoom_in"),className:"btn btn-square btn-neutral btn-sm",onClick:()=>{var E;(E=i.current)==null||E.zoomIn()},children:fe.jsx(ni,{icon:JU})}),fe.jsx(ts,{title:_("zoom_out"),className:"btn btn-square btn-neutral btn-sm",onClick:()=>{var E;(E=i.current)==null||E.zoomOut()},children:fe.jsx(ni,{icon:QU})}),fe.jsx(ts,{className:`btn btn-square btn-neutral btn-sm ${f?"":"btn-outline"}`,item:!f,onClick:d,title:_("parent"),children:fe.jsx(ni,{icon:Qc,style:{color:yl[ti.NeighborIsParent]}})}),fe.jsx(ts,{className:`btn btn-square btn-neutral btn-sm ${p?"":"btn-outline"}`,item:!p,onClick:m,title:_("child"),children:fe.jsx(ni,{icon:Qc,style:{color:yl[ti.NeighborIsAChild]}})}),fe.jsx(ts,{className:`btn btn-square btn-neutral btn-sm ${y?"":"btn-outline"}`,item:!y,onClick:x,title:_("sibling"),children:fe.jsx(ni,{icon:Qc,style:{color:yl[ti.NeighborIsASibling]}})}),fe.jsxs("select",{className:"select select-sm w-36",title:_("find_node"),defaultValue:"",onChange:S,children:[fe.jsx("option",{value:"",children:_("find_node")}),g]})]}),fe.jsxs("div",{className:"absolute z-9 top-0 right-0 p-1 flex flex-row flex-wrap gap-1 items-start justify-end",children:[fe.jsxs("select",{className:"select select-sm w-36",title:_("layout_type"),value:e,onChange:t,children:[fe.jsx("option",{value:"",disabled:!0,children:_("layout_type")}),fe.jsx("option",{value:"forceDirected2d",children:"forceDirected2d"}),fe.jsx("option",{value:"forceDirected3d",children:"forceDirected3d"}),fe.jsx("option",{value:"radialOut2d",children:"radialOut2d"}),fe.jsx("option",{value:"radialOut3d",children:"radialOut3d"})]}),fe.jsxs("select",{className:"select select-sm w-36",title:_("label_type"),value:n,onChange:r,children:[fe.jsx("option",{value:"",disabled:!0,children:_("label_type")}),fe.jsx("option",{value:"all",children:"all"}),fe.jsx("option",{value:"auto",children:"auto"}),fe.jsx("option",{value:"none",children:"none"}),fe.jsx("option",{value:"nodes",children:"nodes"}),fe.jsx("option",{value:"edges",children:"edges"})]})]}),fe.jsxs("div",{className:"absolute z-9 bottom-0 left-0 p-1 flex flex-row flex-wrap gap-1 items-end",children:[fe.jsx(bA,{name:"node_strength",label:_("node_strength"),icon:$U,onSubmit:(E,w)=>w&&typeof E=="number"&&a(E),min:-1e3,max:-100,step:10,defaultValue:s}),fe.jsx(bA,{name:"link_distance",label:_("link_distance"),icon:eO,onSubmit:(E,w)=>w&&typeof E=="number"&&l(E),min:10,max:200,step:5,defaultValue:o})]}),fe.jsx("div",{className:"absolute z-9 bottom-0 right-0 p-1 flex flex-row flex-wrap gap-1 items-end justify-end",children:fe.jsx(ts,{title:_("scroll_to_top"),className:"btn btn-primary btn-sm ml-auto",onClick:()=>{window.scrollTo(0,0)},children:fe.jsx(ni,{icon:tO})})})]})}),uX=$.memo(()=>{const{t:i}=xg("network");return fe.jsxs("details",{className:"collapse collapse-arrow bg-white text-black rounded-b-none",children:[fe.jsx("summary",{className:"collapse-title font-semibold",children:i("legend")}),fe.jsxs("div",{className:"collapse-content text-sm",children:[fe.jsxs("div",{className:"flex flex-row flex-wrap gap-3 mb-2",children:[fe.jsxs("div",{children:[fe.jsxs("p",{children:[i("nodes"),":"]}),fe.jsxs("ul",{className:"list-none list-inside",children:[fe.jsxs("li",{style:{color:tm.Coordinator},children:[fe.jsx(ni,{icon:Nv})," Coordinator"]}),fe.jsxs("li",{style:{color:tm.Router},children:[fe.jsx(ni,{icon:Nv})," Router"]}),fe.jsxs("li",{style:{color:tm.EndDevice},children:[fe.jsx(ni,{icon:Nv})," EndDevice"]})]})]}),fe.jsxs("div",{children:[fe.jsxs("p",{children:[i("edges"),":"]}),fe.jsxs("ul",{className:"list-none list-inside",children:[fe.jsxs("li",{style:{color:yl[ti.NeighborIsParent]},children:[fe.jsx(ni,{icon:Qc})," ",i("parent")]}),fe.jsxs("li",{style:{color:yl[ti.NeighborIsAChild]},children:[fe.jsx(ni,{icon:Qc})," ",i("child")]}),fe.jsxs("li",{style:{color:yl[ti.NeighborIsASibling]},children:[fe.jsx(ni,{icon:Qc})," ",i("sibling")]})]})]})]}),fe.jsx("p",{children:i("legend_node_siblings")}),fe.jsx("p",{children:i("legend_node_size")}),fe.jsx("p",{children:i("legend_node_select")}),fe.jsx("p",{children:i("legend_node_fold")}),fe.jsx("p",{children:i("legend_edge_toggle")}),fe.jsx("p",{className:"text-xs mt-2",children:"Known issues:"}),fe.jsxs("ul",{className:"list-disc list-inside text-xs",children:[fe.jsxs("li",{children:['If you cannot see labels (names/LQIs) after the map has finished loading, zoom-in sufficiently, switch the "',i("label_type"),'" value to something else, then back to the one you want']}),fe.jsx("li",{children:"Edge colors are currently not working"})]})]})]})}),EX=$.memo(({map:i})=>{const{t:e}=xg("network"),[t,n]=$.useState(qa.get(HS,"forceDirected2d")),[r,s]=$.useState(qa.get(VS,"all")),[a,o]=$.useState(qa.get(WS,-750)),[l,c]=$.useState(qa.get(XS,50)),[f,d]=$.useState(!0),[p,m]=$.useState(!0),[y,x]=$.useState(!0),_=$.useRef(null),[g,b]=$.useMemo(()=>{var z,L;const I=[],P=[],O=[];for(const F of i.nodes){const V=i.links.find(G=>G.relationship===ti.NeighborIsParent&&G.target.ieeeAddr===F.ieeeAddr);let W=V?(z=i.nodes.find(G=>G.ieeeAddr===V.source.ieeeAddr))==null?void 0:z.friendlyName:void 0;if(!V){const G=i.links.find(Z=>Z.relationship===ti.NeighborIsAChild&&Z.source.ieeeAddr===F.ieeeAddr);W=G?(L=i.nodes.find(Z=>Z.ieeeAddr===G.target.ieeeAddr))==null?void 0:L.friendlyName:void 0,W&&(W+=` - ${e("children")}`)}I.push({id:F.ieeeAddr,data:{...F,parent:W},label:F.friendlyName,labelVisible:!0,fill:tm[F.type]})}const H=new Map;for(const F of i.links){if(!f&&F.relationship===ti.NeighborIsParent||!p&&F.relationship===ti.NeighborIsAChild||!y&&F.relationship===ti.NeighborIsASibling)continue;if(F.relationship===ti.NeighborIsASibling){const W=H.get(F.source.ieeeAddr);(!W||F.depth<W.depth||F.linkquality>W.linkquality||W.linkquality===F.linkquality&&F.depth<W.depth)&&H.set(F.source.ieeeAddr,F);continue}const V=i.links.find(W=>W.source.ieeeAddr===F.target.ieeeAddr&&W.target.ieeeAddr===F.source.ieeeAddr);F.relationship===ti.NeighborIsAChild&&(V==null?void 0:V.relationship)===ti.NeighborIsParent||O.push([F,V])}for(const[,F]of H){const V=i.links.find(W=>W.source.ieeeAddr===F.target.ieeeAddr&&W.target.ieeeAddr===F.source.ieeeAddr);O.push([F,V])}const J=[];for(const[F,V]of O)J.includes(F)||F.relationship===ti.NeighborIsASibling&&((V==null?void 0:V.relationship)===ti.NeighborIsParent||(V==null?void 0:V.relationship)===ti.NeighborIsAChild)||P.push({id:`${F.source.ieeeAddr}-${F.target.ieeeAddr}-${F.relationship}`,data:F,label:V?`${F.linkquality} / ${V.linkquality??"?"}`:`${F.linkquality}`,size:F.relationship===ti.NeighborIsParent||F.relationship===ti.NeighborIsAChild?1.5:.75,labelVisible:!0,source:F.source.ieeeAddr,target:F.target.ieeeAddr,fill:yl[F.relationship]});return[I,P]},[i,f,p,y,e]),{selections:S,actives:E,onNodeClick:w,onCanvasClick:T}=aX({ref:_,nodes:g,type:"single",pathSelectionType:"out",focusOnSelect:!1}),R=$.useCallback(I=>{var P,O,H;I.target.value&&(qa.set(HS,I.target.value),n(I.target.value),(P=_.current)==null||P.resetControls(),(O=_.current)==null||O.centerGraph(),(H=_.current)==null||H.fitNodesInView())},[]),U=$.useCallback(I=>{I.target.value&&(qa.set(VS,I.target.value),s(I.target.value))},[]),C=$.useCallback(I=>{qa.set(WS,I),o(I)},[]),D=$.useCallback(I=>{qa.set(XS,I),c(I)},[]);return fe.jsxs(fe.Fragment,{children:[fe.jsx(uX,{}),fe.jsxs("div",{className:"relative h-screen",children:[fe.jsx(cX,{graphRef:_,layoutType:t,onLayoutTypeChange:R,labelType:r,onLabelTypeChange:U,nodeStrength:a,onNodeStrengthChange:C,linkDistance:l,onLinkDistanceChange:D,nodes:g,showParents:f,setShowParents:d,showChildren:p,setShowChildren:m,showSiblings:y,setShowSiblings:x}),fe.jsx(sX,{ref:_,nodes:g,edges:b,clusterAttribute:t.startsWith("forceDirected")?"parent":void 0,selections:S,actives:E,onCanvasClick:T,onNodeClick:w,layoutType:t,layoutOverrides:{nodeStrength:a,linkDistance:l},sizingType:"centrality",labelType:r,labelFontUrl:oX,edgeLabelPosition:"natural",lassoType:"node",cameraMode:t.endsWith("3d")?"rotate":"pan",draggable:!0,animated:!1,contextMenu:({data:{data:I},onCollapse:P,isCollapsed:O,canCollapse:H,onClose:J})=>I.friendlyName?fe.jsx(lX,{data:I,onCollapse:P,isCollapsed:O,canCollapse:H,onClose:J}):null})]})]})});export{EX as default};
|
|
4233
|
+
}`)),document.head.appendChild(i)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var lA,cA;function D3(i,e=[]){const t=e.length;for(const n of i){const r=e.indexOf(n);if(r>-1){const s=[...e.slice(r),n].map(a=>a.data.id);throw new Error(`Invalid Graph: Circular node path detected: ${s.join(" -> ")}.`)}t>n.depth&&(n.depth=t,D3(n.out,[...e,n]))}}function U3(i,e){let t=!1;const n=i.reduce((a,o)=>({...a,[o.id]:{data:o,out:[],depth:-1,ins:[]}}),{});try{for(const a of e){const o=a.source,l=a.target;if(!n.hasOwnProperty(o))throw new Error(`Missing source Node ${o}`);if(!n.hasOwnProperty(l))throw new Error(`Missing target Node ${l}`);const c=n[o],f=n[l];f.ins.push(c),c.out.push(f)}D3(Object.values(n))}catch{t=!0}const r=Object.keys(n).map(a=>n[a].depth),s=Math.max(...r);return{invalid:t,depths:n,maxDepth:s||1}}const uA=["radialin","radialout"];function lW({nodes:i,edges:e,mode:t="lr",nodeLevelRatio:n=2}){const{depths:r,maxDepth:s,invalid:a}=U3(i,e);if(a)return null;const o=uA.includes(t)?1:5,l=i.length/s*n*o;if(t){const c=(m,y)=>x=>m?(r[x.id].depth-s/2)*l*(y?-1:1):void 0,f=c(["lr","rl"].includes(t),t==="rl"),d=c(["td","bu"].includes(t),t==="td"),p=c(["zin","zout"].includes(t),t==="zout");i.forEach(m=>{m.fx=f(m),m.fy=d(m),m.fz=p(m)})}return uA.includes(t)?Hk(c=>{const f=r[c.id];return(t==="radialin"?s-f.depth:f.depth)*l}).strength(1):null}function cW(i){return new Promise((e,t)=>{let n;function r(){n?e(n):(n=i.step(),r())}r()})}function od(i){const e=[],t=[];return i.forEachNode((n,r)=>{e.push({...r,id:n,radius:r.size||1})}),i.forEachEdge((n,r)=>{t.push({...r,id:n})}),{nodes:e,edges:t}}function uW(){const i=L=>()=>L;let t=L=>L.index,n=[],r=[],s,a,o=[100,100],l=i(1),c=i(-1),f=i(100),d=i(.1),p={},m=.1,y=.001,x=[],_=[0,0],g,b=L=>L.cluster,S="treemap",E=!0,w=.1;function T(L){if(!E)return T;S==="force"&&(g.tick(),O());for(let F=0,V=n.length,W,G=L*w;F<V;++F)W=n[F],W.vx+=(p[b(W)].x-W.x)*G,W.vy+=(p[b(W)].y-W.y)*G}function R(){n&&(S==="treemap"?H():z())}T.initialize=function(L){n=L,R()};function U(L){let F=b(L.source),V=b(L.target);return F<=V?F+"~"+V:V+"~"+F}function C(L){let F=new Map,V={};return L.forEach(function(W){F.has(b(W))||F.set(b(W),{count:0,sumforceNodeSize:0})}),L.forEach(function(W){V=F.get(b(W)),V.count=V.count+1,V.sumforceNodeSize=V.sumforceNodeSize+Math.PI*(l(W)*l(W))*1.3,F.set(b(W),V)}),F}function D(L){let F=new Map,V=[];return L.forEach(function(W){let G=U(W),Z;F.has(G)?Z=F.get(G):Z=0,Z+=1,F.set(G,Z)}),F.forEach(function(W,G){let Z,Q;Z=G.split("~")[0],Q=G.split("~")[1],Z!==void 0&&Q!==void 0&&V.push({source:Z,target:Q,count:W})}),V}function I(){let L=[],F=[],V=new Map,W,G,Z,Q,j;Q=C(n),j=D(r);for(W of Q.keys())Z=Q.get(W),L.push({id:W,size:Z.count,r:Math.sqrt(Z.sumforceNodeSize/Math.PI)}),V.set(W,G);return j.forEach(function(ee){let pe=V.get(ee.source),le=V.get(ee.target);pe!==void 0&&le!==void 0&&F.push({source:pe,target:le,count:ee.count})}),{nodes:L,links:F}}function P(){let L=[],F,V,W;W=C(T.nodes());for(F of W.keys())V=W.get(F),L.push({id:F,size:V.count});return{id:"clustersTree",children:L}}function O(){return p.none={x:0,y:0},x.forEach(function(L){S==="treemap"?p[L.data.id]={x:L.x0+(L.x1-L.x0)/2-_[0],y:L.y0+(L.y1-L.y0)/2-_[1]}:p[L.id]={x:L.x-_[0],y:L.y-_[1]}}),p}function H(){let L=TG().size(T.size());a=o0(P()).sum(F=>F.radius).sort(function(F,V){return V.height-F.height||V.value-F.value}),x=L(a).leaves(),O()}function J(){let L=0;n.length!==0&&r.forEach(function(F){let V,W;if(n){if(V=F.source,W=F.target,typeof F.source!="object"&&(V=n.find(G=>G.id===F.source)),typeof F.target!="object"&&(W=n.find(G=>G.id===F.target)),V===void 0||W===void 0)throw Error("Error setting links, couldnt find nodes for a link (see it on the console)");F.source=V,F.target=W,F.index=L++}})}function z(){let L;!n||!n.length||(J(),L=I(),s.size>0&&L.nodes.forEach(F=>{var V,W,G,Z;F.fx=(W=(V=s.get(F.id))==null?void 0:V.position)==null?void 0:W.x,F.fy=(Z=(G=s.get(F.id))==null?void 0:G.position)==null?void 0:Z.y}),g=$C(L.nodes).force("x",ox(o[0]/2).strength(.1)).force("y",lx(o[1]/2).strength(.1)).force("collide",jC(F=>F.r).iterations(4)).force("charge",eR().strength(c)).force("links",qC(L.nodes.length?L.links:[]).distance(f).strength(d)),x=g.nodes(),O())}return T.template=function(L){return arguments.length?(S=L,R(),T):S},T.groupBy=function(L){return arguments.length?typeof L=="string"?(b=function(F){return F[L]},T):(b=L,T):b},T.enableGrouping=function(L){return arguments.length?(E=L,T):E},T.strength=function(L){return arguments.length?(w=L,T):w},T.getLinkStrength=function(L){return E?b(L.source)===b(L.target)?typeof m=="function"?m(L):m:typeof y=="function"?y(L):y:typeof m=="function"?m(L):m},T.id=function(L){return arguments.length?(t=L,T):t},T.size=function(L){return arguments.length?(o=L,T):o},T.linkStrengthInterCluster=function(L){return arguments.length?(y=L,T):y},T.linkStrengthIntraCluster=function(L){return arguments.length?(m=L,T):m},T.nodes=function(L){return arguments.length?(n=L,T):n},T.links=function(L){return arguments.length?(L===null?r=[]:r=L,R(),T):r},T.template=function(L){return arguments.length?(S=L,R(),T):S},T.forceNodeSize=function(L){return arguments.length?(l=typeof L=="function"?L:i(+L),R(),T):l},T.nodeSize=T.forceNodeSize,T.forceCharge=function(L){return arguments.length?(c=typeof L=="function"?L:i(+L),R(),T):c},T.forceLinkDistance=function(L){return arguments.length?(f=typeof L=="function"?L:i(+L),R(),T):f},T.forceLinkStrength=function(L){return arguments.length?(d=typeof L=="function"?L:i(+L),R(),T):d},T.offset=function(L){return arguments.length?(_=typeof L=="function"?L:i(+L),T):_},T.getFocis=O,T.setClusters=function(L){return s=L,T},T}function no({graph:i,nodeLevelRatio:e=2,mode:t=null,dimensions:n=2,nodeStrength:r=-250,linkDistance:s=50,clusterStrength:a=.5,linkStrengthInterCluster:o=.01,linkStrengthIntraCluster:l=.5,forceLinkDistance:c=100,forceLinkStrength:f=.1,clusterType:d="force",forceCharge:p=-700,getNodePosition:m,drags:y,clusters:x,clusterAttribute:_,forceLayout:g}){const{nodes:b,edges:S}=od(i),w=n===2&&S.length>25?r*2:r;let T,R;g==="forceDirected2d"?(T=ox(),R=lx()):(T=ox(600).strength(.05),R=lx(600).strength(.05));const U=$C().force("center",R5(0,0)).force("link",qC()).force("charge",eR().strength(w)).force("x",T).force("y",R).force("z",Vk()).force("collide",jC(P=>P.radius+10)).force("dagRadial",lW({nodes:b,edges:S,mode:t,nodeLevelRatio:e})).stop();let C;if(_){let P=p;if(b!=null&&b.length){const O=Math.ceil(b.length/200);P=p*O}C=uW().setClusters(x).strength(a).template(d).groupBy(O=>O.data[_]).links(S).size([100,100]).linkStrengthInterCluster(o).linkStrengthIntraCluster(l).forceLinkDistance(c).forceLinkStrength(f).forceCharge(P).forceNodeSize(O=>O.radius)}let D=U.numDimensions(n).nodes(b);if(C&&(D=D.force("group",C)),s){let P=D.force("link");P&&(P.id(O=>O.id).links(S).distance(s),C&&(P=P.strength((C==null?void 0:C.getLinkStrength)??.1)))}const I=new Map(b.map(P=>[P.id,P]));return{step(){for(;U.alpha()>.01;)U.tick();return!0},getNodePosition(P){var O,H;if(m){const J=m(P,{graph:i,drags:y,nodes:b,edges:S});if(J)return J}return(O=y==null?void 0:y[P])!=null&&O.position?(H=y==null?void 0:y[P])==null?void 0:H.position:I.get(P)}}}function hW({graph:i,radius:e,drags:t,getNodePosition:n}){const r=RG(i,{scale:e}),{nodes:s,edges:a}=od(i);return{step(){return!0},getNodePosition(o){var l,c;if(n){const f=n(o,{graph:i,drags:t,nodes:s,edges:a});if(f)return f}return(l=t==null?void 0:t[o])!=null&&l.position?(c=t==null?void 0:t[o])==null?void 0:c.position:r==null?void 0:r[o]}}}const fW={td:{x:"x",y:"y",factor:-1},lr:{x:"y",y:"x",factor:1}};function hA({graph:i,drags:e,mode:t="td",nodeSeparation:n=1,nodeSize:r=[50,50],getNodePosition:s}){const{nodes:a,edges:o}=od(i),{depths:l}=U3(a,o),c=Object.keys(l).map(x=>l[x]),f=pG().id(x=>x.data.id).parentId(x=>{var _,g,b;return(b=(g=(_=x.ins)==null?void 0:_[0])==null?void 0:g.data)==null?void 0:b.id})(c),p=bG().separation(()=>n).nodeSize(r)(o0(f)).descendants(),m=fW[t],y=new Map(a.map(x=>{const{x:_,y:g}=p.find(b=>b.data.id===x.id);return[x.id,{...x,[m.x]:_*m.factor,[m.y]:g*m.factor,z:0}]}));return{step(){return!0},getNodePosition(x){var _,g;if(s){const b=s(x,{graph:i,drags:e,nodes:a,edges:o});if(b)return b}return(_=e==null?void 0:e[x])!=null&&_.position?(g=e==null?void 0:e[x])==null?void 0:g.position:y.get(x)}}}function dW({graph:i,margin:e,drags:t,getNodePosition:n,ratio:r,gridSize:s,maxIterations:a}){const{nodes:o,edges:l}=od(i),c=IG(i,{maxIterations:a,inputReducer:(f,d)=>({...d,x:d.x||0,y:d.y||0}),settings:{ratio:r,margin:e,gridSize:s}});return{step(){return!0},getNodePosition(f){var d,p;if(n){const m=n(f,{graph:i,drags:t,nodes:o,edges:l});if(m)return m}return(d=t==null?void 0:t[f])!=null&&d.position?(p=t==null?void 0:t[f])==null?void 0:p.position:c==null?void 0:c[f]}}}function pW({graph:i,drags:e,iterations:t,...n}){WG.assign(i);const r=GG(i,{iterations:t,settings:n});return{step(){return!0},getNodePosition(s){var a;return((a=e==null?void 0:e[s])==null?void 0:a.position)||(r==null?void 0:r[s])}}}function mW({graph:i,drags:e,getNodePosition:t}){const{nodes:n,edges:r}=od(i);return{step(){return!0},getNodePosition(s){return t(s,{graph:i,drags:e,nodes:n,edges:r})}}}const gW=["forceDirected2d","treeTd2d","treeLr2d","radialOut2d","treeTd3d","treeLr3d","radialOut3d","forceDirected3d"];function vW({type:i,...e}){if(gW.includes(i)){const{nodeStrength:t,linkDistance:n,nodeLevelRatio:r}=e;if(i==="forceDirected2d")return no({...e,dimensions:2,nodeLevelRatio:r||2,nodeStrength:t||-250,linkDistance:n,forceLayout:i});if(i==="treeTd2d")return no({...e,mode:"td",dimensions:2,nodeLevelRatio:r||5,nodeStrength:t||-250,linkDistance:n||50,forceLayout:i});if(i==="treeLr2d")return no({...e,mode:"lr",dimensions:2,nodeLevelRatio:r||5,nodeStrength:t||-250,linkDistance:n||50,forceLayout:i});if(i==="radialOut2d")return no({...e,mode:"radialout",dimensions:2,nodeLevelRatio:r||5,nodeStrength:t||-500,linkDistance:n||100,forceLayout:i});if(i==="treeTd3d")return no({...e,mode:"td",dimensions:3,nodeLevelRatio:r||2,nodeStrength:t||-500,linkDistance:n||50});if(i==="treeLr3d")return no({...e,mode:"lr",dimensions:3,nodeLevelRatio:r||2,nodeStrength:t||-500,linkDistance:n||50,forceLayout:i});if(i==="radialOut3d")return no({...e,mode:"radialout",dimensions:3,nodeLevelRatio:r||2,nodeStrength:t||-500,linkDistance:n||100,forceLayout:i});if(i==="forceDirected3d")return no({...e,dimensions:3,nodeLevelRatio:r||2,nodeStrength:t||-250,linkDistance:n,forceLayout:i})}else if(i==="circular2d"){const{radius:t}=e;return hW({...e,radius:t||300})}else{if(i==="hierarchicalTd")return hA({...e,mode:"td"});if(i==="hierarchicalLr")return hA({...e,mode:"lr"});if(i==="nooverlap"){const{graph:t,maxIterations:n,ratio:r,margin:s,gridSize:a,...o}=e;return dW({graph:t,margin:s||10,maxIterations:n||50,ratio:r||10,gridSize:a||20,...o})}else if(i==="forceatlas2"){const{graph:t,iterations:n,gravity:r,scalingRatio:s,...a}=e;return pW({type:"forceatlas2",graph:t,...a,scalingRatio:s||100,gravity:r||10,iterations:n||50})}else if(i==="custom")return mW({...e})}throw new Error(`Layout ${i} not found.`)}function O3({nodeCount:i,nodePosition:e,labelType:t,camera:n}){return(r,s)=>{var a;if(n&&e&&((a=n==null?void 0:n.position)==null?void 0:a.z)/(n==null?void 0:n.zoom)-(e==null?void 0:e.z)>6e3)return!1;if(t==="all")return!0;if(t==="nodes"&&r==="node")return!0;if(t==="edges"&&r==="edge")return!0;if(t==="auto"&&r==="node"){if(s>7)return!0;if(n&&e&&n.position.z/n.zoom-e.z<3e3)return!0}return!1}}function L3(i,e){switch(e){case"above":return i;case"below":return-i;case"inline":case"natural":default:return 0}}const sb=typeof window>"u";function yW({graph:i}){const e=YG(i);return{ranks:e,getSizeForNode:t=>e[t]*80}}function _W({graph:i}){const e=KG.degreeCentrality(i);return{ranks:e,getSizeForNode:t=>e[t]*20}}function xW({graph:i,attribute:e,defaultSize:t}){const n=new Map;return e?i.forEachNode((r,s)=>{var a;const o=(a=s.data)==null?void 0:a[e];isNaN(o)&&console.warn(`Attribute ${o} is not a number for node ${s.id}`),n.set(r,o||0)}):console.warn("Attribute sizing configured but no attribute provided"),{getSizeForNode:r=>!e||!n?t:n.get(r)}}const fA={pagerank:yW,centrality:_W,attribute:xW,none:({defaultSize:i})=>({getSizeForNode:e=>i})};function bW({type:i,...e}){var t;const n=(t=fA[i])==null?void 0:t.call(fA,e);if(!n&&i!=="default")throw new Error(`Unknown sizing strategy: ${i}`);const{graph:r,minSize:s,maxSize:a}=e,o=new Map;let l,c;if(r.forEachNode((f,d)=>{let p;i==="default"?p=d.size||e.defaultSize:p=n.getSizeForNode(f),(l===void 0||p<l)&&(l=p),(c===void 0||p>c)&&(c=p),o.set(f,p)}),i!=="none"){const f=hR().domain([l,c]).rangeRound([s,a]);for(const[d,p]of o)o.set(d,f(p))}return o}function SW(i,e,t){i.clear();const n=new Set;for(const r of e)try{n.has(r.id)||(i.addNode(r.id,r),n.add(r.id))}catch(s){console.error(`[Graph] Error adding node '${r.id}`,s)}for(const r of t)if(!(!n.has(r.source)||!n.has(r.target)))try{i.addEdge(r.source,r.target,r)}catch(s){console.error(`[Graph] Error adding edge '${r.source} -> ${r.target}`,s)}return i}function EW({graph:i,layout:e,sizingType:t,labelType:n,sizingAttribute:r,defaultNodeSize:s,minNodeSize:a,maxNodeSize:o,clusterAttribute:l}){const c=[],f=[],d=new Map,p=bW({graph:i,type:t,attribute:r,minSize:a,maxSize:o,defaultSize:s}),m=i.nodes().length,y=O3({nodeCount:m,labelType:n});return i.forEachNode((x,_)=>{const g=e.getNodePosition(x),{data:b,fill:S,icon:E,label:w,size:T,...R}=_,U=p.get(_.id),C=y("node",U),I=(i.inboundNeighbors(_.id)||[]).map(O=>i.getNodeAttributes(O)),P={..._,size:U,labelVisible:C,label:w,icon:E,fill:S,cluster:l?b[l]:void 0,parents:I,data:{...R,...b??{}},position:{...g,x:g.x||0,y:g.y||0,z:g.z||1}};d.set(_.id,P),c.push(P)}),i.forEachEdge((x,_)=>{const g=d.get(_.source),b=d.get(_.target);if(g&&b){const{data:S,id:E,label:w,size:T,...R}=_,U=y("edge",T);f.push({..._,id:E,label:w,labelVisible:U,size:T,data:{...R,id:E,...S||{}}})}}),{nodes:c,edges:f}}const _r={mass:10,tension:1e3,friction:300,precision:.1};function N3(i,e,t){const n=e.getLength(),r=i==="end"?n:n/2,s=i==="end"?t/2:0,a=(r-s)/n,o=e.getPointAt(a),l=e.getTangentAt(a);return[o,l]}function I3(i){return[i+6,2+i/1.5]}const dA=.7;function P3(i,e,t=0){const n=new K(i.x,i.y||0,i.z||0),r=new K(e.x,e.y||0,e.z||0),s=new K().addVectors(n,r).divideScalar(2);return s.setLength(s.length()+t)}function MW(i,e,t=-1){const n=i.clone(),r=e.clone(),s=new K().subVectors(r,n),a=s.length(),o=s.clone().normalize(),l=new K().subVectors(r,n).divideScalar(2),c=Math.abs(o.x)%1,f=new K(-o.y,o.x-c*o.z,c*o.y).normalize(),d=new K().add(n).add(l).add(f.multiplyScalar(a/4).multiplyScalar(t));return[i,d,e]}function Gf(i,e,t,n,r,s){const a=pA(i,t,e),o=pA(t,i,n);return r?new Xg(...MW(a,o,s)):new i1(a,o)}function Hf(i){return new K(i.position.x,i.position.y,i.position.z||0)}function pA(i,e,t){const n=i.distanceTo(e);return i.clone().add(e.clone().sub(i).multiplyScalar(t/n))}function mA(i,e){return{...i,position:{...i.position,x:i.position.x+e.x,y:i.position.y+e.y,z:i.position.z+e.z}}}function wW({edge:i,edges:e,curved:t}){let n=t,r;const s=e.filter(a=>a.target===i.target&&a.source===i.source).map(a=>a.id);if(s.length>1){n=!0;const a=s.indexOf(i.id);s.length===2?r=a===0?dA:-.7:r=(a-Math.floor(s.length/2))*dA}return{curved:n,curveOffset:r}}function Vf(i){let e=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,s=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY;for(let o of i)e=Math.min(e,o.position.x),t=Math.max(t,o.position.x),n=Math.min(n,o.position.y),r=Math.max(r,o.position.y),s=Math.min(s,o.position.z),a=Math.max(a,o.position.z);return{height:r-n,width:t-e,minX:e,maxX:t,minY:n,maxY:r,minZ:s,maxZ:a,x:(t+e)/2,y:(r+n)/2,z:(a+s)/2}}function TW(i,e){return e?i.reduce((t,n)=>{const r=n.data[e];return r&&t.set(r,[...t.get(r)||[],n]),t},new Map):new Map}function AW({nodes:i,clusterAttribute:e}){const t=new Map;if(e){const n=TW(i,e);for(const[r,s]of n){const a=Vf(s);t.set(r,{label:r,nodes:s,position:a})}}return t}function CW(i,e,t){return mV.bidirectional(i,e,t)}const gA=i=>i.tagName!=="INPUT"&&i.tagName!=="SELECT"&&i.tagName!=="TEXTAREA"&&!i.isContentEditable,z3=({actives:i=[],selections:e=[],collapsedNodeIds:t=[],theme:n})=>eV(r=>{var s,a,o;return{theme:{...n,edge:{...n==null?void 0:n.edge,label:{...(s=n==null?void 0:n.edge)==null?void 0:s.label,fontSize:((o=(a=n==null?void 0:n.edge)==null?void 0:a.label)==null?void 0:o.fontSize)??6}}},edges:[],nodes:[],collapsedNodeIds:t,clusters:new Map,panning:!1,draggingIds:[],actives:i,edgeContextMenus:new Set,edgeMeshes:[],selections:e,hoveredNodeId:null,drags:{},graph:new cn({multi:!0}),setTheme:l=>r(c=>({...c,theme:l})),setClusters:l=>r(c=>({...c,clusters:l})),setEdgeContextMenus:l=>r(c=>({...c,edgeContextMenus:l})),setEdgeMeshes:l=>r(c=>({...c,edgeMeshes:l})),setPanning:l=>r(c=>({...c,panning:l})),setDrags:l=>r(c=>({...c,drags:l})),addDraggingId:l=>r(c=>({...c,draggingIds:[...c.draggingIds,l]})),removeDraggingId:l=>r(c=>({...c,draggingIds:c.draggingIds.filter(f=>f!==l)})),setActives:l=>r(c=>({...c,actives:l})),setSelections:l=>r(c=>({...c,selections:l})),setHoveredNodeId:l=>r(c=>({...c,hoveredNodeId:l})),setNodes:l=>r(c=>({...c,nodes:l,centerPosition:Vf(l)})),setEdges:l=>r(c=>({...c,edges:l})),setNodePosition:(l,c)=>r(f=>{var d,p;const m=f.nodes.find(b=>b.id===l),y=Hf(m),_=new K(c.x,c.y,c.z).sub(y),g=[...f.nodes];if((d=f.selections)!=null&&d.includes(l))(p=f.selections)==null||p.forEach(b=>{const S=f.nodes.find(E=>E.id===b);if(S){const E=f.nodes.indexOf(S);g[E]=mA(S,_)}});else{const b=f.nodes.indexOf(m);g[b]=mA(m,_)}return{...f,drags:{...f.drags,[l]:m},nodes:g}}),setCollapsedNodeIds:(l=[])=>r(c=>({...c,collapsedNodeIds:l})),setClusterPosition:(l,c)=>r(f=>{const d=new Map(f.clusters),p=d.get(l);if(p){const m=p.position,y=new K(c.x-m.x,c.y-m.y,c.z-(m.z??0)),x=[...f.nodes],_={...f.drags};x.forEach((S,E)=>{S.cluster===l&&(x[E]={...S,position:{...S.position,x:S.position.x+y.x,y:S.position.y+y.y,z:S.position.z+(y.z??0)}},_[S.id]=S)});const g=x.filter(S=>S.cluster===l),b=Vf(g);return d.set(l,{...p,position:b}),{...f,drags:{..._,[l]:p},clusters:d,nodes:x}}return f})}}),F3=z3({}),B3=sb?null:$.createContext(F3),RW=({children:i,store:e=F3})=>sb?i:lo.createElement(B3.Provider,{value:e},i),tt=i=>{const e=$.useContext(B3);return fR(e,iV(i))};function k3({nodeId:i,nodes:e,edges:t,currentHiddenNodes:n,currentHiddenEdges:r}){const s=[],a=[],o=n.map(m=>m.id),l=r.map(m=>m.id),c=t.filter(m=>m.source===i),f=c.map(m=>m.target);a.push(...c);for(const m of f){const y=t.filter(_=>_.target===m&&_.source!==i);let x=!1;if((y.length===0||y.length>0&&!o.includes(m)&&y.map(g=>g.id).every(g=>l.includes(g)))&&(x=!0),x){const _=e.find(b=>b.id===m);_&&s.push(_);const g=k3({nodeId:m,nodes:e,edges:t,currentHiddenEdges:a,currentHiddenNodes:s});a.push(...g.hiddenEdges),s.push(...g.hiddenNodes)}}const d=Object.values(a.reduce((m,y)=>({...m,[y.id]:y}),{})),p=Object.values(s.reduce((m,y)=>({...m,[y.id]:y}),{}));return{hiddenEdges:d,hiddenNodes:p}}const DW=({collapsedIds:i,nodes:e,edges:t})=>{const n=[],r=[];for(const c of i){const{hiddenEdges:f,hiddenNodes:d}=k3({nodeId:c,nodes:e,edges:t,currentHiddenEdges:r,currentHiddenNodes:n});n.push(...d),r.push(...f)}const s=n.map(c=>c.id),a=r.map(c=>c.id),o=e.filter(c=>!s.includes(c.id)),l=t.filter(c=>!a.includes(c.id));return{visibleNodes:o,visibleEdges:l}},UW=({layoutType:i,sizingType:e,labelType:t,sizingAttribute:n,clusterAttribute:r,selections:s,nodes:a,edges:o,actives:l,collapsedNodeIds:c,defaultNodeSize:f,maxNodeSize:d,minNodeSize:p,layoutOverrides:m,constrainDragging:y})=>{const x=tt(G=>G.graph),_=tt(G=>G.clusters),g=tt(G=>G.nodes),b=tt(G=>G.setClusters),S=tt(G=>G.collapsedNodeIds),E=tt(G=>G.setEdges),w=tt(G=>G.nodes),T=tt(G=>G.setNodes),R=tt(G=>G.setSelections),U=tt(G=>G.setActives),C=tt(G=>G.drags),D=tt(G=>G.setDrags),I=tt(G=>G.setCollapsedNodeIds),P=$.useRef(!1),O=$.useRef(null),H=Kn(G=>G.camera),J=$.useRef(C),z=$.useRef([]);$.useEffect(()=>{var G;if(!r)return;const Z=g.map(j=>j.id),Q=a.find(j=>!Z.includes(j.id));if(Q){const j=Q.data[r],ee=_.get(j),pe={...J.current};(G=ee==null?void 0:ee.nodes)==null||G.forEach(le=>pe[le.id]=void 0),J.current=pe,D(pe)}},[g,a,r,_,D]);const{visibleEdges:L,visibleNodes:F}=$.useMemo(()=>DW({collapsedIds:S,nodes:a,edges:o}),[S,a,o]),V=$.useCallback(G=>{const Z={...J.current};G.forEach(Q=>Z[Q.id]=Q),J.current=Z,D(Z)},[D]),W=$.useCallback(async G=>{O.current=G||vW({...m,type:i,graph:x,drags:J.current,clusters:z==null?void 0:z.current,clusterAttribute:r}),await cW(O.current);const Z=EW({graph:x,layout:O.current,sizingType:e,labelType:t,sizingAttribute:n,maxNodeSize:d,minNodeSize:p,defaultNodeSize:f,clusterAttribute:r}),Q=AW({nodes:Z.nodes,clusterAttribute:r});y&&Q.forEach(j=>{var ee,pe;const le=z.current.get(j.label);(le==null?void 0:le.nodes.length)===j.nodes.length&&(j.position=((pe=(ee=z.current)==null?void 0:ee.get(j.label))==null?void 0:pe.position)??j.position)}),E(Z.edges),T(Z.nodes),b(Q),r&&V(Z.nodes)},[m,i,r,e,t,n,d,p,f,E,T,b]);return $.useEffect(()=>{J.current=C},[C,r,W]),$.useEffect(()=>{z.current=_},[_]),$.useEffect(()=>{const G=w.map(Q=>({...Q,labelVisible:O3({nodeCount:w==null?void 0:w.length,labelType:t,camera:H,nodePosition:Q==null?void 0:Q.position})("node",Q==null?void 0:Q.size)}));G.some((Q,j)=>Q.labelVisible!==w[j].labelVisible)&&T(G)},[H,H.zoom,H.position.z,T,w,t]),$.useEffect(()=>{P.current&&R(s)},[s,R]),$.useEffect(()=>{P.current&&U(l)},[l,U]),$.useEffect(()=>{async function G(){P.current=!1,SW(x,F,L),await W(),requestAnimationFrame(()=>P.current=!0)}G()},[F,L]),$.useEffect(()=>{P.current&&I(c)},[c,I]),$.useEffect(()=>{P.current&&(J.current={},D({}),W())},[i,W,D]),$.useEffect(()=>{P.current&&W(O.current)},[e,n,t,W]),{updateLayout:W}},Wf=({text:i,fontSize:e=7,fontUrl:t,color:n="#2A6475",opacity:r=1,stroke:s,active:a,ellipsis:o=75,rotation:l})=>{const c=o&&!a?iW(i,o):i,f=$.useMemo(()=>new $e(n),[n]),d=$.useMemo(()=>s?new $e(s):void 0,[s]);return fe.jsx(g3,{position:[0,0,1],children:fe.jsx(J9,{font:t,fontSize:e,color:f,fillOpacity:r,textAlign:"center",outlineWidth:s?1:0,outlineColor:d,depthOffset:0,maxWidth:100,overflowWrap:"break-word",rotation:l,children:c})})},G3=({draggable:i,set:e,position:t,bounds:n,onDragStart:r,onDragEnd:s})=>{const a=Kn(_=>_.camera),o=Kn(_=>_.raycaster),l=Kn(_=>_.size),c=Kn(_=>_.gl),{mouse2D:f,mouse3D:d,offset:p,normal:m,plane:y}=$.useMemo(()=>({mouse2D:new ke,mouse3D:new K,offset:new K,normal:new K,plane:new la}),[]),x=$.useMemo(()=>c.domElement.getBoundingClientRect(),[c.domElement]);return t9({onDragStart:({event:_})=>{const{eventObject:g,point:b}=_;g.getWorldPosition(p).sub(b),d.copy(b),r()},onDrag:({xy:_,buttons:g,cancel:b})=>{if(g!==1){b();return}const S=(_[0]-((x==null?void 0:x.left)??0))/l.width*2-1,E=-((_[1]-((x==null?void 0:x.top)??0))/l.height)*2+1;f.set(S,E),o.setFromCamera(f,a),a.getWorldDirection(m).negate(),y.setFromNormalAndCoplanarPoint(m,d),o.ray.intersectPlane(y,d);const w=new K(t.x,t.y,t.z).copy(d).add(p);if(n){const T=new K((n.minX+n.maxX)/2,(n.minY+n.maxY)/2,(n.minZ+n.maxZ)/2),R=(n.maxX-n.minX)/2,U=w.clone().sub(T);U.length()>R&&(U.normalize().multiplyScalar(R),w.copy(T).add(U))}return e(w)},onDragEnd:s},{drag:{enabled:i,threshold:10}})},ab=({sensitivity:i=7,interval:e=50,timeout:t=0,disabled:n,onPointerOver:r,onPointerOut:s})=>{const a=$.useRef(!1),o=$.useRef(null),l=$.useRef(0),c=$.useRef({x:null,y:null,px:null,py:null}),f=$.useCallback(_=>{c.current.x=_.clientX,c.current.y=_.clientY},[]),d=$.useCallback(_=>{o.current=clearTimeout(o.current);const{px:g,x:b,py:S,y:E}=c.current;Math.abs(g-b)+Math.abs(S-E)<i?(l.current=1,r(_)):(c.current.px=b,c.current.py=E,o.current=setTimeout(()=>d(_),e))},[e,r,i]),p=$.useCallback(()=>{clearTimeout(o.current),typeof window<"u"&&document.removeEventListener("mousemove",f,!1)},[f]),m=$.useCallback(_=>{n||(a.current=!0,p(),l.current!==1&&(c.current.px=_.pointer.x,c.current.py=_.pointer.y,typeof window<"u"&&document.addEventListener("mousemove",f,!1),o.current=setTimeout(()=>d(_),t)))},[p,d,n,f,t]),y=$.useCallback(_=>{o.current=clearTimeout(o.current),l.current=0,s(_)},[s]),x=$.useCallback(_=>{a.current=!1,p(),l.current===1&&(o.current=setTimeout(()=>y(_),t))},[p,y,t]);return{pointerOver:m,pointerOut:x}},H3=$.createContext({controls:null,resetControls:()=>{},zoomIn:()=>{},zoomOut:()=>{},dollyIn:()=>{},dollyOut:()=>{},panLeft:()=>{},panRight:()=>{},panUp:()=>{},panDown:()=>{},freeze:()=>{},unFreeze:()=>{}}),_0=()=>{const i=$.useContext(H3);if(i===void 0)throw new Error("`useCameraControls` hook must be used within a `ControlsProvider` component");return i},OW=({outerRadius:i,innerRadius:e,padding:t,normalizedFill:n,normalizedStroke:r,opacity:s,animated:a,theme:o})=>{var l;const{opacity:c}=yr({from:{opacity:0},to:{opacity:s},config:{..._r,duration:a?void 0:0}});return fe.jsxs(fe.Fragment,{children:[fe.jsxs("mesh",{children:[fe.jsx("ringGeometry",{attach:"geometry",args:[i,0,128]}),fe.jsx(zn.meshBasicMaterial,{attach:"material",color:n,transparent:!0,depthTest:!1,opacity:(l=o.cluster)!=null&&l.fill?c:0,side:In,fog:!0})]}),fe.jsxs("mesh",{children:[fe.jsx("ringGeometry",{attach:"geometry",args:[i,e+t,128]}),fe.jsx(zn.meshBasicMaterial,{attach:"material",color:r,transparent:!0,depthTest:!1,opacity:c,side:In,fog:!0})]})]})},LW=({animated:i,position:e,padding:t=40,labelFontUrl:n,disabled:r,radius:s=2,nodes:a,label:o,onClick:l,onPointerOver:c,onPointerOut:f,draggable:d=!1,onDragged:p,onRender:m})=>{var y,x,_,g,b,S,E;const w=tt(ie=>ie.theme),T=Math.max(e.width,e.height)/2,R=T-s+t,[U,C]=$.useState(!1),D=tt(ie=>ie.centerPosition),I=tt(ie=>ie.nodes),P=_0(),O=tt(ie=>ie.draggingIds),H=O.includes(o),J=O.length>0,z=tt(ie=>{var be;return(be=ie.actives)==null?void 0:be.some(k=>a.some(re=>re.id===k))}),L=tt(ie=>ie.hoveredNodeId),F=tt(ie=>{var be;return(be=ie.selections)==null?void 0:be.some(k=>a.some(re=>re.id===k))}),W=tt(ie=>{var be;return((be=ie.selections)==null?void 0:be.length)>0})?F||U||z?(y=w.cluster)==null?void 0:y.selectedOpacity:(x=w.cluster)==null?void 0:x.inactiveOpacity:(_=w.cluster)==null?void 0:_.opacity,G=$.useMemo(()=>{var ie,be;const k=[0,-R,2],re=(be=(ie=w.cluster)==null?void 0:ie.label)==null?void 0:be.offset;return re?[k[0]-re[0],k[1]-re[1],k[2]-re[2]]:k},[R,(b=(g=w.cluster)==null?void 0:g.label)==null?void 0:b.offset]),{circlePosition:Z}=yr({from:{circlePosition:[D.x,D.y,-1]},to:{circlePosition:e?[e.x,e.y,-1]:[0,0,-1]},config:{..._r,duration:i&&!J?void 0:0}}),Q=$.useMemo(()=>{var ie;return new $e((ie=w.cluster)==null?void 0:ie.stroke)},[(S=w.cluster)==null?void 0:S.stroke]),j=$.useMemo(()=>{var ie;return new $e((ie=w.cluster)==null?void 0:ie.fill)},[(E=w.cluster)==null?void 0:E.fill]),ee=tt(ie=>ie.addDraggingId),pe=tt(ie=>ie.removeDraggingId),le=tt(ie=>ie.setClusterPosition),ce=G3({draggable:d&&!L,position:{x:e.x,y:e.y,z:-1},set:ie=>le(o,ie),onDragStart:()=>{ee(o),C(!0)},onDragEnd:()=>{pe(o),C(!1);const ie=I.filter(be=>be.cluster===o);p==null||p({nodes:ie,label:o})}});El(U&&!J&&l!==void 0,"pointer"),El(U&&d&&!H&&l===void 0,"grab"),El(H,"grabbing");const{pointerOver:Le,pointerOut:Me}=ab({disabled:r,onPointerOver:ie=>{C(!0),P.freeze(),c==null||c({nodes:a,label:o},ie)},onPointerOut:ie=>{C(!1),P.unFreeze(),f==null||f({nodes:a,label:o},ie)}});return $.useMemo(()=>{var ie,be,k;return w.cluster&&fe.jsx(zn.group,{userData:{id:o,type:"cluster"},position:Z,onPointerOver:Le,onPointerOut:Me,onClick:re=>{!r&&!H&&(l==null||l({nodes:a,label:o},re))},...ce(),children:m?m({label:{position:G,text:o,opacity:W,fontUrl:n},opacity:W,outerRadius:R,innerRadius:T,padding:t,theme:w}):fe.jsxs(fe.Fragment,{children:[fe.jsx(OW,{outerRadius:R,innerRadius:T,padding:t,normalizedFill:j,normalizedStroke:Q,opacity:W,animated:i,theme:w}),((ie=w.cluster)==null?void 0:ie.label)&&fe.jsx(zn.group,{position:G,children:fe.jsx(Wf,{text:o,opacity:W,fontUrl:n,stroke:w.cluster.label.stroke,active:!1,color:(be=w.cluster)==null?void 0:be.label.color,fontSize:((k=w.cluster)==null?void 0:k.label.fontSize)??12})})]})})},[w,Z,Le,Me,R,j,T,t,Q,G,o,W,n,r,l,a,ce,H,m,i])},NW=({animated:i,color:e="#D8E6EA",length:t,opacity:n=.5,position:r,rotation:s,size:a=1,onActive:o,onContextMenu:l})=>{const c=$.useMemo(()=>new $e(e),[e]),f=$.useRef(null),d=tt(_=>_.draggingIds.length>0),p=tt(_=>_.centerPosition),[{pos:m,arrowOpacity:y}]=yr(()=>({from:{pos:p?[p.x,p.y,p.z]:[0,0,0],arrowOpacity:0},to:{pos:[r.x,r.y,r.z],arrowOpacity:n},config:{..._r,duration:i&&!d?void 0:0}}),[i,d,n,r]),x=$.useCallback(()=>{var _;const g=new K(0,1,0);(_=f.current)==null||_.quaternion.setFromUnitVectors(g,s)},[s,f]);return $.useEffect(()=>x(),[x]),fe.jsxs(zn.mesh,{position:m,ref:f,scale:[1,1,1],onPointerOver:()=>o(!0),onPointerOut:()=>o(!1),onPointerDown:_=>{_.nativeEvent.buttons===2&&(_.stopPropagation(),l())},children:[fe.jsx("cylinderGeometry",{args:[0,a,t,20,1,!0],attach:"geometry"}),fe.jsx(zn.meshBasicMaterial,{attach:"material",color:c,depthTest:!1,opacity:y,transparent:!0,side:In,fog:!0})]})},IW=({curveOffset:i,animated:e,color:t="#000",curve:n,curved:r=!1,id:s,opacity:a=1,size:o=1,onContextMenu:l,onClick:c,onPointerOver:f,onPointerOut:d})=>{const p=$.useRef(null),m=tt(b=>b.draggingIds.length>0),y=$.useMemo(()=>new $e(t),[t]),x=tt(b=>b.centerPosition),_=$.useRef(!1),{lineOpacity:g}=yr({from:{lineOpacity:0},to:{lineOpacity:a},config:{..._r,duration:e?void 0:0}});return yr(()=>{const b=n.getPoint(0),S=n.getPoint(1);return{from:{fromVertices:_.current?[S==null?void 0:S.x,S==null?void 0:S.y,(S==null?void 0:S.z)||0]:[x==null?void 0:x.x,x==null?void 0:x.y,(x==null?void 0:x.z)||0],toVertices:[b==null?void 0:b.x,b==null?void 0:b.y,(b==null?void 0:b.z)||0]},to:{fromVertices:[b==null?void 0:b.x,b==null?void 0:b.y,(b==null?void 0:b.z)||0],toVertices:[S==null?void 0:S.x,S==null?void 0:S.y,(S==null?void 0:S.z)||0]},onChange:E=>{const{fromVertices:w,toVertices:T}=E.value,R=new K(...w),U=new K(...T),C=Gf(R,0,U,0,r,i);p.current.copy(new Rl(C,20,o/2,5,!1))},config:{..._r,duration:e&&!m?void 0:0}}},[e,m,n,o]),$.useEffect(()=>{_.current=!0},[]),fe.jsxs("mesh",{userData:{id:s,type:"edge"},onPointerOver:f,onPointerOut:d,onClick:c,onPointerDown:b=>{b.nativeEvent.buttons===2&&(b.stopPropagation(),l())},children:[fe.jsx("tubeGeometry",{attach:"geometry",ref:p}),fe.jsx(zn.meshBasicMaterial,{attach:"material",opacity:g,fog:!0,transparent:!0,depthTest:!1,color:y})]})},vA=3,PW=({animated:i,arrowPlacement:e="end",contextMenu:t,disabled:n,labelPlacement:r="inline",id:s,interpolation:a,labelFontUrl:o,onContextMenu:l,onClick:c,onPointerOver:f,onPointerOut:d})=>{const p=tt(be=>be.theme),m=tt(be=>be.draggingIds.length>0),[y,x]=$.useState(!1),[_,g]=$.useState(!1),b=tt(be=>be.edges),S=b.find(be=>be.id===s),{target:E,source:w,label:T,labelVisible:R=!1,size:U=1,fill:C}=S,D=tt(be=>be.nodes.find(k=>k.id===w)),I=tt(be=>be.nodes.find(k=>k.id===E)),P=(U+p.edge.label.fontSize)/2,[O,H]=$.useMemo(()=>I3(U),[U]),{curveOffset:J,curved:z}=$.useMemo(()=>wW({edge:S,edges:b,curved:a==="curved"}),[S,b,a]),[L,F,V]=$.useMemo(()=>{const be=Hf(D),k=D.size,re=Hf(I),te=I.size;let we=Gf(be,k,re,te,z,J);const[se,Re]=N3(e,we,O);return e==="end"&&(we=Gf(be,k,se,0,z,J)),[we,se,Re]},[D,I,z,J,e,O]),W=$.useMemo(()=>{let be=P3(D.position,I.position,L3(P,r));if(z){const k=new K().subVectors(be,L.getPoint(.5));switch(r){case"above":k.y=k.y-vA;break;case"below":k.y=k.y+vA;break}be=be.sub(k)}return be},[D.position,I.position,P,r,z,L]),G=tt(be=>{var k;return(k=be.selections)==null?void 0:k.includes(s)}),Z=tt(be=>{var k;return(k=be.selections)==null?void 0:k.length}),Q=tt(be=>{var k;return(k=be.actives)==null?void 0:k.includes(s)}),j=tt(be=>be.centerPosition),ee=Z?G||Q?p.edge.selectedOpacity:p.edge.inactiveOpacity:p.edge.opacity,[{labelPosition:pe}]=yr(()=>({from:{labelPosition:j?[j.x,j.y,j.z]:[0,0,0]},to:{labelPosition:[W.x,W.y,W.z]},config:{..._r,duration:i&&!m?void 0:0}}),[W,i,m]),le=$.useMemo(()=>new Ui(0,0,r==="natural"?0:Math.atan((I.position.y-D.position.y)/(I.position.x-D.position.x))),[I.position.x,I.position.y,D.position.x,D.position.y,r]);El(y&&!m&&c!==void 0,"pointer");const{pointerOver:ce,pointerOut:Le}=ab({disabled:n,onPointerOver:be=>{x(!0),f==null||f(S,be)},onPointerOut:be=>{x(!1),d==null||d(S,be)}}),Me=$.useMemo(()=>e!=="none"&&fe.jsx(NW,{animated:i,color:G||y||Q?p.arrow.activeFill:C||p.arrow.fill,length:O,opacity:ee,position:F,rotation:V,size:H,onActive:x,onContextMenu:()=>{n||(g(!0),l==null||l(S))}}),[C,y,i,O,e,F,V,H,n,S,Q,G,l,ee,p.arrow.activeFill,p.arrow.fill]),ge=$.useMemo(()=>R&&T&&fe.jsx(zn.group,{position:pe,onContextMenu:()=>{n||(g(!0),l==null||l(S))},onPointerOver:ce,onPointerOut:Le,children:fe.jsx(Wf,{text:T,ellipsis:15,fontUrl:o,stroke:p.edge.label.stroke,color:G||y||Q?p.edge.label.activeColor:p.edge.label.color,opacity:ee,fontSize:p.edge.label.fontSize,rotation:le})}),[y,n,S,Q,G,T,o,pe,le,R,l,Le,ce,ee,p.edge.label.activeColor,p.edge.label.color,p.edge.label.fontSize,p.edge.label.stroke]),ie=$.useMemo(()=>_&&t&&fe.jsx(nb,{prepend:!0,center:!0,position:W,children:t({data:S,onClose:()=>g(!1)})}),[_,t,W,S]);return fe.jsxs("group",{children:[fe.jsx(IW,{curveOffset:J,animated:i,color:G||y||Q?p.edge.activeFill:C||p.edge.fill,curve:L,curved:z,id:s,opacity:ee,size:U,onClick:be=>{n||c==null||c(S,be)},onPointerOver:ce,onPointerOut:Le,onContextMenu:()=>{n||(g(!0),l==null||l(S))}}),Me,ge,ie]})},yA=new Ea(0,0,0);function zW(i,e){const t=$.useRef(null),n=tt(c=>c.theme);tt(c=>{t.current=c});const r=$.useRef(new Map);$.useRef(new Ea(0,0,0));const s=$.useRef(null),a=e==="curved",o=$.useCallback(c=>{const f=[],d=r.current,{nodes:p}=t.current,m=new Map(p.map(x=>[x.id,x])),y=n.edge.label.fontSize;return i!=="none"&&!s.current&&(s.current=new bu(0,1,1,20,1,!0)),c.forEach(x=>{const{target:_,source:g,size:b=1}=x,S=m.get(g),E=m.get(_);if(!S||!E)return;const w=`${S.position.x},${S.position.y},${E.position.x},${E.position.y},${b}`;if(d.has(w)){f.push(d.get(w));return}const T=Hf(S),R=S.size+y,U=Hf(E),C=E.size+y;let D=Gf(T,R,U,C,a),I=new Rl(D,20,b/2,5,!1);if(i==="none"){f.push(I),d.set(w,I);return}const[P,O]=I3(b),H=s.current.clone();H.scale(O,P,O);const[J,z]=N3(i,D,P),L=new _i;if(L.setFromUnitVectors(new K(0,1,0),z),H.applyQuaternion(L),H.translate(J.x,J.y,J.z),i&&i==="end"){const V=Gf(T,R,J,0,a);I=new Rl(V,20,b/2,5,!1)}const F=Vp([I,H]);f.push(F),d.set(w,F)}),f},[i,a,n.edge.label.fontSize]),l=$.useCallback((c,f)=>{const d=o(c),p=o(f);return Vp([p.length?Vp(p):yA,d.length?Vp(d):yA],!0)},[o]);return{getGeometries:o,getGeometry:l}}function FW(i,e,t){const n=$.useRef(i);$.useEffect(()=>{n.current=i},[i]);const r=tt(d=>d.edgeContextMenus),s=tt($.useCallback(d=>d.setEdgeContextMenus,[])),a=$.useRef(!1),o=$.useCallback(()=>{a.current=!0},[]),l=$.useRef(!1),c=$.useCallback(()=>{l.current=!0},[]),f=$.useCallback((d,p)=>{const{onClick:m,onContextMenu:y,onPointerOver:x,onPointerOut:_}=n.current;if(m&&a.current&&!t){a.current=!1;for(const g of p)m(g)}if((e||y)&&l.current&&!t){l.current=!1;const g=new Set(r);let b=!1;for(const S of p)r.has(S.id)||(g.add(S.id),b=!0,y==null||y(S));b&&s(g)}x&&p.filter(b=>!d.includes(b)).forEach(b=>{x(b)}),_&&d.filter(b=>!p.includes(b)).forEach(b=>{_(b)})},[e,t,r,s]);return{handleClick:o,handleContextMenu:c,handleIntersections:f}}function BW(i,e){const t=$.useRef(i),n=$.useRef(null);$.useEffect(()=>{t.current=i;const a=i.getAttribute("position");n.current=new Float32Array(a.array.length)},[i]);const r=$.useCallback(()=>{const a=t.current.getAttribute("position");return{from:new Float32Array(a.array.length),to:a.array}},[]),s=$.useCallback(a=>{const o=n.current;o.set(a);const l=new en(o,3,!1);t.current.setAttribute("position",l),l.needsUpdate=!0},[]);yr(()=>{if(!e)return null;const a=r();return{from:{positions:a.from},to:{positions:a.to},onChange:o=>{s(o.value.positions)},config:{..._r,duration:e?void 0:0}}},[e,r,s])}function kW(i,e,t){const[{activeOpacity:n,inactiveOpacity:r}]=yr(()=>({from:{activeOpacity:0,inactiveOpacity:0},to:{activeOpacity:e?t.edge.selectedOpacity:t.edge.opacity,inactiveOpacity:e?t.edge.inactiveOpacity:t.edge.opacity},config:{..._r,duration:i?void 0:0}}),[i,e,t]);return{activeOpacity:n,inactiveOpacity:r}}const GW=({animated:i,color:e,contextMenu:t,edge:n,labelFontUrl:r,labelPlacement:s="inline",opacity:a})=>{const o=tt(D=>D.theme),{target:l,source:c,label:f,labelVisible:d=!1,size:p=1}=n,m=tt(D=>D.nodes),[y,x]=$.useMemo(()=>[m.find(D=>D.id===c),m.find(D=>D.id===l)],[m,c,l]),_=tt(D=>D.draggingIds.length>0),g=$.useMemo(()=>(p+o.edge.label.fontSize)/2,[p,o.edge.label.fontSize]),b=$.useMemo(()=>P3(y.position,x.position,L3(g,s)),[y.position,x.position,g,s]),S=tt(D=>D.edgeContextMenus),E=tt(D=>D.setEdgeContextMenus),[{labelPosition:w}]=yr(()=>({from:{labelPosition:[0,0,0]},to:{labelPosition:[b.x,b.y,b.z]},config:{..._r,duration:i&&!_?void 0:0}}),[b,i,_]),T=$.useCallback(D=>{S.delete(D),E(new Set(S))},[S,E]),R=$.useMemo(()=>s==="natural"?new Ui(0,0,0):new Ui(0,0,Math.atan2(x.position.y-y.position.y,x.position.x-y.position.x)),[s,x.position.y,x.position.x,y.position.y,y.position.x]),U=$.useMemo(()=>({prepend:!0,center:!0,position:b}),[b]),C=$.useMemo(()=>({text:f,ellipsis:15,fontUrl:r,stroke:o.edge.label.stroke,color:e,opacity:a,fontSize:o.edge.label.fontSize,rotation:R}),[f,r,o.edge.label.stroke,e,a,o.edge.label.fontSize,R]);return fe.jsxs("group",{children:[d&&f&&fe.jsx(zn.group,{position:w,children:fe.jsx(Wf,{...C})}),t&&S.has(n.id)&&fe.jsx(nb,{...U,children:t({data:n,onClose:()=>T(n.id)})})]})},HW=({interpolation:i="linear",arrowPlacement:e="end",labelPlacement:t="inline",animated:n,contextMenu:r,disabled:s,edges:a,labelFontUrl:o,onClick:l,onContextMenu:c,onPointerOut:f,onPointerOver:d})=>{const p=tt(W=>W.theme),{getGeometries:m,getGeometry:y}=zW(e,i),x=tt(W=>W.draggingIds),_=tt(W=>W.edgeMeshes),g=tt(W=>W.setEdgeMeshes),b=tt(W=>W.actives||[]),S=tt(W=>W.selections||[]),[E,w,T,R]=$.useMemo(()=>{const W=[],G=[],Z=[],Q=[];return a.forEach(j=>{if(x.includes(j.source)||x.includes(j.target)){S.includes(j.id)||b.includes(j.id)?Z.push(j):Q.push(j);return}S.includes(j.id)||b.includes(j.id)?W.push(j):G.push(j)}),[W,G,Z,Q]},[a,b,S,x]),U=!!S.length,C=$.useMemo(()=>y(E,w),[y,E,w]),{activeOpacity:D,inactiveOpacity:I}=kW(n,U,p);BW(C,n),$.useEffect(()=>{if(x.length===0){const G=m(a).map(Z=>new pn(Z));g(G)}},[m,g,a,x.length]);const P=$.useRef(new pn),O=$.useRef(new pn),H=$.useCallback(W=>{if(!W.camera)return[];const G=W.intersectObjects(_);return G.length?G.map(Z=>a[_.indexOf(Z.object)]):[]},[_,a]),{handleClick:J,handleContextMenu:z,handleIntersections:L}=FW({onClick:l,onContextMenu:c,onPointerOut:f,onPointerOver:d},r,s),F=$.useRef([]),V=$.useRef([]);return r0(W=>{if(P.current.geometry=C,s)return;const G=F.current;if((x.length||x.length===0&&G!==null)&&(O.current.geometry=y(T,R)),F.current=x,x.length)return;const Z=V.current,Q=H(W.raycaster);L(Z,Q),Q.join()!==Z.join()&&(O.current.geometry=y(Q,[])),V.current=Q}),fe.jsxs("group",{onClick:J,onContextMenu:z,children:[fe.jsxs("mesh",{ref:P,children:[fe.jsx(zn.meshBasicMaterial,{attach:"material-0",color:p.edge.fill,depthTest:!1,fog:!0,opacity:I,side:In,transparent:!0}),fe.jsx(zn.meshBasicMaterial,{attach:"material-1",color:p.edge.activeFill,depthTest:!1,fog:!0,opacity:D,side:In,transparent:!0})]}),fe.jsxs("mesh",{ref:O,children:[fe.jsx(zn.meshBasicMaterial,{attach:"material-0",color:p.edge.fill,depthTest:!1,fog:!0,opacity:I,side:In,transparent:!0}),fe.jsx(zn.meshBasicMaterial,{attach:"material-1",color:p.edge.activeFill,depthTest:!1,fog:!0,opacity:D,side:In,transparent:!0})]}),a.map(W=>fe.jsx(GW,{animated:n,contextMenu:r,color:p.edge.label.color,disabled:s,edge:W,labelFontUrl:o,labelPlacement:t},W.id))]})},VW=({color:i="#D8E6EA",size:e=1,opacity:t=.5,animated:n,strokeWidth:r=5,innerRadius:s=4,segments:a=25})=>{const o=$.useMemo(()=>new $e(i),[i]),{ringSize:l,ringOpacity:c}=yr({from:{ringOpacity:0,ringSize:[1e-5,1e-5,1e-5]},to:{ringOpacity:t,ringSize:[e/2,e/2,1]},config:{..._r,duration:n?void 0:0}}),f=r/10,d=s+f;return fe.jsx(g3,{position:[0,0,1],children:fe.jsxs(zn.mesh,{scale:l,children:[fe.jsx("ringGeometry",{attach:"geometry",args:[s,d,a]}),fe.jsx(zn.meshBasicMaterial,{attach:"material",color:o,transparent:!0,depthTest:!1,opacity:c,side:In,fog:!0})]})})},WW=({color:i,id:e,size:t,selected:n,opacity:r=1,animated:s})=>{const{scale:a,nodeOpacity:o}=yr({from:{scale:[1e-5,1e-5,1e-5],nodeOpacity:0},to:{scale:[t,t,t],nodeOpacity:r},config:{..._r,duration:s?void 0:0}}),l=$.useMemo(()=>new $e(i),[i]),c=tt(f=>f.theme);return fe.jsxs(fe.Fragment,{children:[fe.jsxs(zn.mesh,{userData:{id:e,type:"node"},scale:a,children:[fe.jsx("sphereGeometry",{attach:"geometry",args:[1,25,25]}),fe.jsx(zn.meshPhongMaterial,{attach:"material",side:In,transparent:!0,fog:!0,opacity:o,color:l,emissive:l,emissiveIntensity:.7})]}),fe.jsx(VW,{opacity:n?.5:0,size:t,animated:s,color:n?c.ring.activeFill:c.ring.fill})]})},XW=({image:i,id:e,size:t,opacity:n=1,animated:r})=>{const s=$.useMemo(()=>new Q2().load(i),[i]),{scale:a,spriteOpacity:o}=yr({from:{scale:[1e-5,1e-5,1e-5],spriteOpacity:0},to:{scale:[t,t,t],spriteOpacity:n},config:{..._r,duration:r?void 0:0}});return fe.jsx(zn.sprite,{userData:{id:e,type:"node"},scale:a,children:fe.jsx(zn.spriteMaterial,{attach:"material",opacity:o,fog:!0,depthTest:!1,transparent:!0,side:In,children:fe.jsx("primitive",{attach:"map",object:s,minFilter:Pn})})})},jW=({animated:i,disabled:e,id:t,draggable:n=!1,labelFontUrl:r,contextMenu:s,onClick:a,onDoubleClick:o,onPointerOver:l,onDragged:c,onPointerOut:f,onContextMenu:d,renderNode:p,constrainDragging:m})=>{var y,x,_;const g=_0(),b=tt(ne=>ne.theme),S=tt(ne=>ne.nodes.find(ve=>ve.id===t)),E=tt(ne=>ne.edges),w=tt(ne=>ne.draggingIds),T=tt(ne=>ne.collapsedNodeIds),R=tt(ne=>ne.addDraggingId),U=tt(ne=>ne.removeDraggingId),C=tt(ne=>ne.setHoveredNodeId),D=tt(ne=>ne.setNodePosition),I=tt(ne=>ne.setCollapsedNodeIds),P=tt(ne=>ne.collapsedNodeIds.includes(t)),O=tt(ne=>{var ve;return(ve=ne.actives)==null?void 0:ve.includes(t)}),H=tt(ne=>{var ve;return(ve=ne.selections)==null?void 0:ve.includes(t)}),J=tt(ne=>{var ve;return((ve=ne.selections)==null?void 0:ve.length)>0}),z=tt(ne=>ne.centerPosition),L=tt(ne=>ne.clusters.get(S.cluster)),F=w.includes(t),V=w.length>0,{position:W,label:G,subLabel:Z,size:Q=7,labelVisible:j=!0}=S,ee=$.useRef(null),[pe,le]=$.useState(!1),[ce,Le]=$.useState(!1),Me=pe||H||O,ge=J?Me?b.node.selectedOpacity:b.node.inactiveOpacity:b.node.opacity,ie=$.useMemo(()=>E.filter(ve=>ve.source===t).length>0||P,[E,t,P]),be=$.useCallback(()=>{ie&&I(P?T.filter(ne=>ne!==t):[...T,t])},[ie,T,t,P,I]),[{nodePosition:k,labelPosition:re,subLabelPosition:te}]=yr(()=>({from:{nodePosition:z?[z.x,z.y,0]:[0,0,0],labelPosition:[0,-(Q+7),2],subLabelPosition:[0,-(Q+14),2]},to:{nodePosition:W?[W.x,W.y,Me?W.z+1:W.z]:[0,0,0],labelPosition:[0,-(Q+7),2],subLabelPosition:[0,-(Q+14),2]},config:{..._r,duration:i&&!V?void 0:0}}),[F,W,i,Q,Me]),we=G3({draggable:n,position:W,bounds:m?L==null?void 0:L.position:void 0,set:ne=>D(t,ne),onDragStart:()=>{R(t),le(!0)},onDragEnd:()=>{U(t),c==null||c(S)}});El(pe&&!V&&a!==void 0,"pointer"),El(pe&&n&&!F&&a===void 0,"grab"),El(F,"grabbing");const se=Me||F,Re=se?b.node.activeFill:S.fill||b.node.fill,{pointerOver:xe,pointerOut:de}=ab({disabled:e||F,onPointerOver:ne=>{g.freeze(),le(!0),l==null||l(S,ne),C(t)},onPointerOut:ne=>{g.unFreeze(),le(!1),f==null||f(S,ne),C(null)}}),We=$.useMemo(()=>p?p({id:t,color:Re,size:Q,active:se,opacity:ge,animated:i,selected:H,node:S}):fe.jsx(fe.Fragment,{children:S.icon?fe.jsx(XW,{id:t,image:S.icon||"",size:Q+8,opacity:ge,animated:i,color:Re,node:S,active:se,selected:H}):fe.jsx(WW,{id:t,size:Q,opacity:ge,animated:i,color:Re,node:S,active:se,selected:H})}),[p,t,Re,Q,se,ge,i,H,S]),X=$.useMemo(()=>{var ne,ve,ye;return j&&(j||H||pe)&&G&&fe.jsxs(fe.Fragment,{children:[fe.jsx(zn.group,{position:re,children:fe.jsx(Wf,{text:G,fontUrl:r,opacity:ge,stroke:b.node.label.stroke,active:H||pe||F||O,color:H||pe||F||O?b.node.label.activeColor:b.node.label.color})}),Z&&fe.jsx(zn.group,{position:te,children:fe.jsx(Wf,{text:Z,fontUrl:r,fontSize:5,opacity:ge,stroke:(ne=b.node.subLabel)==null?void 0:ne.stroke,active:H||pe||F||O,color:H||pe||F||O?(ve=b.node.subLabel)==null?void 0:ve.activeColor:(ye=b.node.subLabel)==null?void 0:ye.color})})]})},[pe,O,F,H,G,r,re,j,ge,Z,te,b.node.label.activeColor,b.node.label.color,b.node.label.stroke,(y=b.node.subLabel)==null?void 0:y.activeColor,(x=b.node.subLabel)==null?void 0:x.color,(_=b.node.subLabel)==null?void 0:_.stroke]),B=$.useMemo(()=>ce&&s&&fe.jsx(nb,{prepend:!0,center:!0,children:s({data:S,canCollapse:ie,isCollapsed:P,onCollapse:be,onClose:()=>Le(!1)})}),[ce,s,S,ie,P,be]);return fe.jsxs(zn.group,{renderOrder:1,userData:{id:t,type:"node"},ref:ee,position:k,onPointerOver:xe,onPointerOut:de,onClick:ne=>{!e&&!F&&(a==null||a(S,{canCollapse:ie,isCollapsed:P},ne))},onDoubleClick:ne=>{!e&&!F&&(o==null||o(S,ne))},onContextMenu:()=>{e||(Le(!0),d==null||d(S,{canCollapse:ie,isCollapsed:P,onCollapse:be}))},...we(),children:[We,B,X]})};function V3(i,e){const t=e.position.z;i<t?i-=t:i+=t;const n=e.fov/e.zoom*Math.PI/180;return 2*Math.tan(n/2)*Math.abs(i)}function qW(i,e){return V3(i,e)*e.aspect}function _A(i,e){var t,n,r,s;const a=qW(1,i),o=V3(1,i),l={x0:((t=i==null?void 0:i.position)==null?void 0:t.x)-a/2,x1:((n=i==null?void 0:i.position)==null?void 0:n.x)+a/2,y0:((r=i==null?void 0:i.position)==null?void 0:r.y)-o/2,y1:((s=i==null?void 0:i.position)==null?void 0:s.y)+o/2};return(e==null?void 0:e.x)>l.x0&&(e==null?void 0:e.x)<l.x1&&(e==null?void 0:e.y)>l.y0&&(e==null?void 0:e.y)<l.y1}function xA(i,e){return e.reduce((t,n)=>Math.abs(n-i%Math.PI)<Math.abs(t-i%Math.PI)?n:t)}function YW(i,e){const t=xA(i,[0,Math.PI]),n=xA(e,[Math.PI/2,3*Math.PI/2]);return{horizontalRotation:t-i%Math.PI,verticalRotation:n-e%Math.PI}}const Qp=50,ZW=({animated:i,disabled:e,layoutType:t})=>{const n=tt(x=>x.nodes),[r,s]=$.useState(!1),a=Kn(x=>x.invalidate),{controls:o}=_0(),l=Kn(x=>x.camera),c=$.useRef(!1),f=$.useCallback(async(x,_)=>{const g=(_==null?void 0:_.animated)!==void 0?_==null?void 0:_.animated:!0,b=(_==null?void 0:_.centerOnlyIfNodesNotInView)!==void 0?_==null?void 0:_.centerOnlyIfNodesNotInView:!1;if(!c.current||!b||b&&(x!=null&&x.some(S=>!_A(l,S.position)))){const{x:S,y:E,z:w}=Vf(x);await o.setTarget(S,E,w,g),r||s(!0),a()}},[a,o,n]),d=$.useCallback(async(x,_={animated:!0,fitOnlyIfNodesNotInView:!1})=>{const{fitOnlyIfNodesNotInView:g}=_;if(!g||g&&(x!=null&&x.some(b=>!_A(l,b.position)))){const{minX:b,maxX:S,minY:E,maxY:w,minZ:T,maxZ:R}=Vf(x);if(!t.includes("3d")){const{horizontalRotation:U,verticalRotation:C}=YW(o==null?void 0:o.azimuthAngle,o==null?void 0:o.polarAngle);o==null||o.rotate(U,C,!0)}await(o==null?void 0:o.zoomTo(1,_==null?void 0:_.animated)),await(o==null?void 0:o.fitToBox(new Jn(new K(b,E,T),new K(S,w,R)),_==null?void 0:_.animated,{cover:!1,paddingLeft:Qp,paddingRight:Qp,paddingBottom:Qp,paddingTop:Qp}))}},[l,o,t]),p=$.useCallback(x=>{let _=null;return x!=null&&x.length&&(_=x.reduce((g,b)=>{const S=n.find(E=>E.id===b);if(S)g.push(S);else throw new Error(`Attempted to center ${b} but it was not found in the nodes`);return g},[])),_},[n]),m=$.useCallback((x,_)=>{const g=p(x);f(g||n,{animated:i,centerOnlyIfNodesNotInView:_==null?void 0:_.centerOnlyIfNodesNotInView})},[i,f,p,n]),y=$.useCallback(async(x,_)=>{const g=p(x);await d(g||n,{animated:i,..._})},[i,d,p,n]);return $.useLayoutEffect(()=>{async function x(){o&&(n!=null&&n.length)&&(c.current||(await f(n,{animated:!1}),await d(n,{animated:!1}),c.current=!0))}x()},[o,f,n,i,l,d]),{centerNodes:f,centerNodesById:m,fitNodesInViewById:y,isCentered:r}},KW=$.forwardRef(({onNodeClick:i,onNodeDoubleClick:e,onNodeContextMenu:t,onEdgeContextMenu:n,onEdgeClick:r,onEdgePointerOver:s,onEdgePointerOut:a,onNodePointerOver:o,onNodePointerOut:l,onClusterClick:c,onNodeDragged:f,onClusterDragged:d,onClusterPointerOver:p,onClusterPointerOut:m,contextMenu:y,animated:x,disabled:_,draggable:g,constrainDragging:b=!1,edgeLabelPosition:S,edgeArrowPosition:E,edgeInterpolation:w="linear",labelFontUrl:T,renderNode:R,onRenderCluster:U,...C},D)=>{const{layoutType:I,clusterAttribute:P}=C,O=Kn(ce=>ce.gl),H=Kn(ce=>ce.scene),J=Kn(ce=>ce.camera),{updateLayout:z}=UW({...C,constrainDragging:b});if(P&&!(I==="forceDirected2d"||I==="forceDirected3d"))throw new Error("Clustering is only supported for the force directed layouts.");const L=tt(ce=>ce.graph),F=tt(ce=>ce.nodes),V=tt(ce=>ce.edges),W=tt(ce=>[...ce.clusters.values()]),{centerNodesById:G,fitNodesInViewById:Z,isCentered:Q}=ZW({animated:x,disabled:_,layoutType:I});$.useImperativeHandle(D,()=>({centerGraph:G,fitNodesInView:Z,graph:L,renderScene:()=>O.render(H,J)}),[G,Z,L,O,H,J]);const j=$.useCallback(ce=>{f==null||f(ce),P&&z()},[P,f,z]),ee=$.useMemo(()=>F.map(ce=>fe.jsx(jW,{id:ce==null?void 0:ce.id,labelFontUrl:T,draggable:g,constrainDragging:b,disabled:_,animated:x,contextMenu:y,renderNode:R,onClick:i,onDoubleClick:e,onContextMenu:t,onPointerOver:o,onPointerOut:l,onDragged:j},ce==null?void 0:ce.id)),[b,x,y,_,g,T,F,i,t,e,j,l,o,R]),pe=$.useMemo(()=>x?V.map(ce=>fe.jsx(PW,{id:ce.id,disabled:_,animated:x,labelFontUrl:T,labelPlacement:S,arrowPlacement:E,interpolation:w,contextMenu:y,onClick:r,onContextMenu:n,onPointerOver:s,onPointerOut:a},ce.id)):fe.jsx(HW,{edges:V,disabled:_,animated:x,labelFontUrl:T,labelPlacement:S,arrowPlacement:E,interpolation:w,contextMenu:y,onClick:r,onContextMenu:n,onPointerOver:s,onPointerOut:a}),[x,y,_,E,w,S,V,T,r,n,a,s]),le=$.useMemo(()=>W.map(ce=>fe.jsx(LW,{animated:x,disabled:_,draggable:g,labelFontUrl:T,onClick:c,onPointerOver:p,onPointerOut:m,onDragged:d,onRender:U,...ce},ce.label)),[x,W,_,g,T,c,m,p,d,U]);return Q&&fe.jsxs($.Fragment,{children:[pe,ee,le]})});di.install({THREE:{MOUSE:SA,Vector2:ke,Vector3:K,Vector4:kt,Quaternion:_i,Matrix4:bt,Spherical:fC,Box3:Jn,Sphere:ri,Raycaster:y1,MathUtils:{DEG2RAD:(lA=Km)==null?void 0:lA.DEG2RAD,clamp:(cA=Km)==null?void 0:cA.clamp}}});IC({ThreeCameraControls:di});const $p={ARROW_LEFT:37,ARROW_UP:38,ARROW_RIGHT:39,ARROW_DOWN:40},JW=$.forwardRef(({mode:i="rotate",children:e,animated:t,disabled:n,minDistance:r=1e3,maxDistance:s=5e4},a)=>{const o=$.useRef(null),l=Kn(O=>O.camera),c=Kn(O=>O.gl),f=i==="orbit",d=tt(O=>O.setPanning),p=tt(O=>O.draggingIds.length>0),m=$.useRef(0),[y,x]=$.useState(!1);r0((O,H)=>{var J,z;(J=o.current)!=null&&J.enabled&&((z=o.current)==null||z.update(H)),f&&(o.current.azimuthAngle+=20*H*Km.DEG2RAD)},-1),$.useEffect(()=>()=>{var O;return(O=o.current)==null?void 0:O.dispose()},[]);const _=$.useCallback(()=>{var O;(O=o.current)==null||O.zoom(l.zoom/2,t)},[t,l.zoom]),g=$.useCallback(()=>{var O;(O=o.current)==null||O.zoom(-l.zoom/2,t)},[t,l.zoom]),b=$.useCallback(O=>{var H;(H=o.current)==null||H.dolly(O,t)},[t]),S=$.useCallback(O=>{var H;(H=o.current)==null||H.dolly(O,t)},[t]),E=$.useCallback(O=>{var H;f||(H=o.current)==null||H.truck(-.03*O.deltaTime,0,t)},[t,f]),w=$.useCallback(O=>{var H;f||(H=o.current)==null||H.truck(.03*O.deltaTime,0,t)},[t,f]),T=$.useCallback(O=>{var H;f||(H=o.current)==null||H.truck(0,.03*O.deltaTime,t)},[t,f]),R=$.useCallback(O=>{var H;f||(H=o.current)==null||H.truck(0,-.03*O.deltaTime,t)},[t,f]),U=$.useCallback(O=>{O.code==="Space"&&(i==="rotate"?o.current.mouseButtons.left=di.ACTION.TRUCK:o.current.mouseButtons.left=di.ACTION.ROTATE)},[i]),C=$.useCallback(O=>{O.code==="Space"&&(i==="rotate"?o.current.mouseButtons.left=di.ACTION.ROTATE:o.current.mouseButtons.left=di.ACTION.TRUCK)},[i]),[D,I]=$.useState(null);$.useEffect(()=>{sb||I({leftKey:new Jp($p.ARROW_LEFT,100),rightKey:new Jp($p.ARROW_RIGHT,100),upKey:new Jp($p.ARROW_UP,100),downKey:new Jp($p.ARROW_DOWN,100)})},[]),$.useEffect(()=>(!n&&D&&(D.leftKey.addEventListener("holding",w),D.rightKey.addEventListener("holding",E),D.upKey.addEventListener("holding",T),D.downKey.addEventListener("holding",R),window.addEventListener("keydown",U),window.addEventListener("keyup",C)),()=>{D&&(D.leftKey.removeEventListener("holding",w),D.rightKey.removeEventListener("holding",E),D.upKey.removeEventListener("holding",T),D.downKey.removeEventListener("holding",R),window.removeEventListener("keydown",U),window.removeEventListener("keyup",C))}),[n,U,C,R,w,E,T,D]),$.useEffect(()=>{n?(o.current.mouseButtons.left=di.ACTION.NONE,o.current.mouseButtons.middle=di.ACTION.NONE,o.current.mouseButtons.wheel=di.ACTION.NONE):(o.current.mouseButtons.left=di.ACTION.TRUCK,o.current.mouseButtons.middle=di.ACTION.TRUCK,o.current.mouseButtons.wheel=di.ACTION.DOLLY)},[n]),$.useEffect(()=>{const O=()=>d(!0),H=()=>d(!1),J=o.current;return J&&(J.addEventListener("control",O),J.addEventListener("controlend",H)),()=>{J&&(J.removeEventListener("control",O),J.removeEventListener("controlend",H))}},[o,d]),$.useEffect(()=>{p?(o.current.mouseButtons.left=di.ACTION.NONE,o.current.touches.one=di.ACTION.NONE):i==="rotate"?(o.current.mouseButtons.left=di.ACTION.ROTATE,o.current.touches.one=di.ACTION.TOUCH_ROTATE):(o.current.touches.one=di.ACTION.TOUCH_TRUCK,o.current.mouseButtons.left=di.ACTION.TRUCK)},[p,i]);const P=$.useMemo(()=>({controls:o.current,zoomIn:()=>_(),zoomOut:()=>g(),dollyIn:(O=1e3)=>b(O),dollyOut:(O=-1e3)=>S(O),panLeft:(O=100)=>w({deltaTime:O}),panRight:(O=100)=>E({deltaTime:O}),panDown:(O=100)=>R({deltaTime:O}),panUp:(O=100)=>T({deltaTime:O}),resetControls:O=>{var H;return(H=o.current)==null?void 0:H.reset(O)},freeze:()=>{o.current.truckSpeed&&(m.current=o.current.truckSpeed),o.current.truckSpeed=0},unFreeze:()=>o.current.truckSpeed=m.current}),[_,g,w,E,R,T,o.current]);return $.useImperativeHandle(a,()=>P),fe.jsxs(H3.Provider,{value:P,children:[fe.jsx("threeCameraControls",{ref:O=>{o.current=O,y||x(!0)},args:[l,c.domElement],smoothTime:.1,minDistance:r,dollyToCursor:!0,maxDistance:s}),e]})}),QW={canvas:{background:"#fff"},node:{fill:"#7CA0AB",activeFill:"#1DE9AC",opacity:1,selectedOpacity:1,inactiveOpacity:.2,label:{color:"#2A6475",stroke:"#fff",activeColor:"#1DE9AC"},subLabel:{color:"#ddd",stroke:"transparent",activeColor:"#1DE9AC"}},lasso:{border:"1px solid #55aaff",background:"rgba(75, 160, 255, 0.1)"},ring:{fill:"#D8E6EA",activeFill:"#1DE9AC"},edge:{fill:"#D8E6EA",activeFill:"#1DE9AC",opacity:1,selectedOpacity:1,inactiveOpacity:.1,label:{stroke:"#fff",color:"#2A6475",activeColor:"#1DE9AC",fontSize:6}},arrow:{fill:"#D8E6EA",activeFill:"#1DE9AC"},cluster:{stroke:"#D8E6EA",opacity:1,selectedOpacity:1,inactiveOpacity:.1,label:{stroke:"#fff",color:"#2A6475"}}};function P_(i,e,t){e=Array.isArray(e)?e:[e];const n=[],r=[];for(const s of e){const a=[...i.inEdgeEntries(s)??[],...i.outEdgeEntries(s)??[]];if(a)for(const o of a){const l=o.attributes.id;if(t==="in"?o.target===s&&!r.includes(l)&&r.push(l):t==="out"?o.source===s&&!r.includes(l)&&r.push(l):r.includes(l)||r.push(l),t==="out"||t==="all"){const c=o.target;n.includes(c)||n.push(c)}(t==="in"||t==="all")&&(n.includes(o.source)||n.push(o.source))}}return{nodes:n,edges:r}}function em(i,e,t){const{offsetX:n,offsetY:r}=i,{width:s,height:a}=t;e.set(n/s*2-1,-(r/a)*2+1)}function $W(i){const e=document.createElement("div");return e.style.pointerEvents="none",e.style.border=i.lasso.border,e.style.backgroundColor=i.lasso.background,e.style.position="fixed",e}const eX=({children:i,type:e="none",onLasso:t,onLassoEnd:n,disabled:r})=>{var s;const a=tt(P=>P.theme),o=Kn(P=>P.camera),l=Kn(P=>P.gl),c=Kn(P=>P.setEvents),f=Kn(P=>P.size),d=Kn(P=>P.get),p=Kn(P=>P.scene),m=_0(),y=tt(P=>P.actives),x=tt(P=>P.setActives),_=tt(P=>P.edges),g=tt(P=>P.edgeMeshes),b=$.useRef(null),S=$.useRef(null),E=$.useRef($W(a)),w=$.useRef(null),T=$.useRef(!1),R=$.useRef(d().events.enabled),U=$.useRef((s=m.controls)==null?void 0:s.enabled),C=$.useCallback(P=>{if(T.current){const[O,H,J]=w.current;J.x=Math.max(O.x,P.clientX),J.y=Math.max(O.y,P.clientY),H.x=Math.min(O.x,P.clientX),H.y=Math.min(O.y,P.clientY),E.current.style.left=`${H.x}px`,E.current.style.top=`${H.y}px`,E.current.style.width=`${J.x-H.x}px`,E.current.style.height=`${J.y-H.y}px`,em(P,b.current.endPoint,f),em(P,S.current.endPoint,f);const z=[],L=S.current.select().sort(V=>V.uuid).map(V=>_[g.indexOf(V)].id);z.push(...L);const F=b.current.select().sort(V=>V.uuid).filter(V=>{var W,G;return V.isMesh&&((W=V.userData)==null?void 0:W.id)&&(((G=V.userData)==null?void 0:G.type)===e||e==="all")}).map(V=>V.userData.id);z.push(...F),requestAnimationFrame(()=>{x(z),t==null||t(z)}),document.addEventListener("pointermove",C,{passive:!0,capture:!0,once:!0})}},[f,_,g,e,x,t]),D=$.useCallback(()=>{var P;T.current&&(c({enabled:R.current}),T.current=!1,(P=E.current.parentElement)==null||P.removeChild(E.current),m.controls.enabled=U.current,n==null||n(y),document.removeEventListener("pointermove",C),document.removeEventListener("pointerup",D))},[c,m.controls,n,y,C]),I=$.useCallback(P=>{var O,H;if(P.shiftKey){R.current=d().events.enabled,U.current=(O=m.controls)==null?void 0:O.enabled,b.current=new zT(o,p);const J=new Pg;g.length&&J.add(...g),S.current=new zT(o,J),w.current=[new ke,new ke,new ke];const[z]=w.current;m.controls.enabled=!1,c({enabled:!1}),T.current=!0,(H=l.domElement.parentElement)==null||H.appendChild(E.current),E.current.style.left=`${P.clientX}px`,E.current.style.top=`${P.clientY}px`,E.current.style.width="0px",E.current.style.height="0px",z.x=P.clientX,z.y=P.clientY,em(P,b.current.startPoint,f),em(P,S.current.startPoint,f),document.addEventListener("pointermove",C,{passive:!0,capture:!0,once:!0}),document.addEventListener("pointerup",D,{passive:!0})}},[o,m.controls,g,d,l.domElement.parentElement,C,D,p,c,f]);return $.useEffect(()=>{if(!(r||e==="none"))return typeof window<"u"&&(document.addEventListener("pointerdown",I,{passive:!0}),document.addEventListener("pointermove",C,{passive:!0}),document.addEventListener("pointerup",D,{passive:!0})),()=>{typeof window<"u"&&(document.removeEventListener("pointerdown",I),document.removeEventListener("pointermove",C),document.removeEventListener("pointerup",D))}},[e,r,I,C,D]),fe.jsx("group",{children:i})},tX="_canvas_670zp_1",nX={canvas:tX},iX={alpha:!0,antialias:!0},rX={position:[0,0,1e3],near:5,far:5e4,fov:10},sX=$.forwardRef(({cameraMode:i="pan",layoutType:e="forceDirected2d",sizingType:t="default",labelType:n="auto",theme:r=QW,animated:s=!0,defaultNodeSize:a=7,minNodeSize:o=5,maxNodeSize:l=15,lassoType:c="none",glOptions:f={},edges:d,children:p,nodes:m,minDistance:y,maxDistance:x,onCanvasClick:_,disabled:g,onLasso:b,onLassoEnd:S,...E},w)=>{var T,R;const U=$.useRef(null),C=$.useRef(null),D=$.useRef(null);$.useImperativeHandle(w,()=>({centerGraph:(L,F)=>{var V;return(V=U.current)==null?void 0:V.centerGraph(L,F)},fitNodesInView:(L,F)=>{var V;return(V=U.current)==null?void 0:V.fitNodesInView(L,F)},zoomIn:()=>{var L;return(L=C.current)==null?void 0:L.zoomIn()},zoomOut:()=>{var L;return(L=C.current)==null?void 0:L.zoomOut()},dollyIn:L=>{var F;return(F=C.current)==null?void 0:F.dollyIn(L)},dollyOut:L=>{var F;return(F=C.current)==null?void 0:F.dollyOut(L)},panLeft:()=>{var L;return(L=C.current)==null?void 0:L.panLeft()},panRight:()=>{var L;return(L=C.current)==null?void 0:L.panRight()},panDown:()=>{var L;return(L=C.current)==null?void 0:L.panDown()},panUp:()=>{var L;return(L=C.current)==null?void 0:L.panUp()},resetControls:L=>{var F;return(F=C.current)==null?void 0:F.resetControls(L)},getControls:()=>{var L;return(L=C.current)==null?void 0:L.controls},getGraph:()=>{var L;return(L=U.current)==null?void 0:L.graph},exportCanvas:()=>(U.current.renderScene(),D.current.toDataURL()),freeze:()=>{var L;return(L=C.current)==null?void 0:L.freeze()},unFreeze:()=>{var L;return(L=C.current)==null?void 0:L.unFreeze()}}));const{selections:I,actives:P,collapsedNodeIds:O}=E,H=d.length+m.length>400?!1:s,J=$.useMemo(()=>({...f,...iX}),[f]),z=$.useRef(z3({selections:I,actives:P,theme:r,collapsedNodeIds:O})).current;return fe.jsx("div",{className:nX.canvas,children:fe.jsx(C5,{legacy:!0,linear:!0,ref:D,flat:!0,gl:J,camera:rX,onPointerMissed:_,children:fe.jsxs(RW,{store:z,children:[((T=r.canvas)==null?void 0:T.background)&&fe.jsx("color",{attach:"background",args:[r.canvas.background]}),fe.jsx("ambientLight",{intensity:1}),p,((R=r.canvas)==null?void 0:R.fog)&&fe.jsx("fog",{attach:"fog",args:[r.canvas.fog,4e3,9e3]}),fe.jsx(JW,{mode:i,ref:C,disabled:g,minDistance:y,maxDistance:x,animated:s,children:fe.jsx(eX,{disabled:g,type:c,onLasso:b,onLassoEnd:S,children:fe.jsx($.Suspense,{children:fe.jsx(KW,{ref:U,disabled:g,animated:H,edges:d,nodes:m,layoutType:e,sizingType:t,labelType:n,defaultNodeSize:a,minNodeSize:o,maxNodeSize:l,...E})})})})]})})})}),aX=({selections:i=[],nodes:e=[],actives:t=[],focusOnSelect:n=!0,type:r="single",pathHoverType:s="out",pathSelectionType:a="direct",ref:o,disabled:l,onSelection:c})=>{const[f,d]=$.useState([]),[p,m]=$.useState(t),[y,x]=$.useState(i),[_,g]=$.useState(!1),b=r==="multi"||r==="multiModifier",S=$.useCallback(L=>{if(!l&&L){L=Array.isArray(L)?L:[L];const F=L.filter(V=>!y.includes(V));if(F.length){const V=[...y,...F];c==null||c(V),x(V)}}},[l,y,c]),E=$.useCallback(L=>{if(!l&&L){L=Array.isArray(L)?L:[L];const F=y.filter(V=>!L.includes(V));c==null||c(F),x(F)}},[l,y,c]),w=$.useCallback((L=[])=>{l||(L=Array.isArray(L)?L:[L],m([]),x(L),c==null||c(L))},[l,c]),T=$.useCallback(L=>{y.includes(L)?E(L):b?S(L):w(L)},[S,w,y,b,E]),R=$.useCallback(L=>{if(b?r==="multiModifier"?_?S(L.id):w(L.id):S(L.id):w(L.id),n===!0||n==="singleOnly"&&!_){if(!o.current)throw new Error("No ref found for the graph canvas.");const F=o.current.getGraph(),{nodes:V}=P_(F,[L.id],a);o.current.fitNodesInView([L.id,...V],{fitOnlyIfNodesNotInView:!0})}},[S,w,n,b,_,a,o,r]),U=$.useCallback((L,F)=>{const V=o.current.getGraph();if(!V)throw new Error("Graph is not initialized");const W=CW(V,L,F);w([L,F]);const G=[];for(let Z=0;Z<W.length-1;Z++){const Q=W[Z],j=W[Z+1],ee=V.getEdgeAttributes(Q,j);ee&&G.push(ee.id)}m([...W.map(Z=>Z),...G])},[w,o]),C=$.useCallback(L=>{const F=L.target,V=gA(F),W=L.metaKey||L.ctrlKey;V&&W&&g(!0)},[]),D=$.useCallback(L=>{const F=L.target,V=gA(F),W=["Meta","Control"].includes(L.key);V&&W&&g(!1)},[]);$.useEffect(()=>(typeof window<"u"&&(window.addEventListener("keydown",C),window.addEventListener("keyup",D)),()=>{typeof window<"u"&&(window.removeEventListener("keydown",C),window.removeEventListener("keyup",D))}),[C,D]);const I=$.useCallback(L=>{if(L.button!==2&&(y.length||p.length)&&(w(),g(!1),n&&y.length===1)){if(!o.current)throw new Error("No ref found for the graph canvas.");o.current.fitNodesInView([],{fitOnlyIfNodesNotInView:!0})}},[w,n,p.length,y.length,o]),P=$.useCallback(L=>{m(L)},[]),O=$.useCallback(L=>{w(L)},[w]),H=$.useCallback(L=>{if(s){const F=o.current.getGraph();if(!F)throw new Error("No ref found for the graph canvas.");const{nodes:V,edges:W}=P_(F,[L.id],s);d([...V,...W])}},[s,o]),J=$.useCallback(()=>{s&&d([])},[s]);return $.useEffect(()=>{var L;if(a!=="direct"&&y.length>0){const F=(L=o.current)==null?void 0:L.getGraph();if(F){const{nodes:V,edges:W}=P_(F,y,a);m([...V,...W])}}},[y,a,o]),{actives:$.useMemo(()=>[...p,...f],[p,f]),onNodeClick:R,onNodePointerOver:H,onNodePointerOut:J,onLasso:P,onLassoEnd:O,selectNodePaths:U,onCanvasClick:I,selections:y,clearSelections:w,addSelection:S,removeSelection:E,toggleSelection:T,setSelections:x}},oX=""+new URL("NotoSans-Regular-D96CXwz4.ttf",import.meta.url).href,lX=$.memo(({data:i,onCollapse:e,isCollapsed:t,canCollapse:n,onClose:r})=>{const{t:s}=xg(["network","zigbee","common"]);let a;if(i.parent){const o=i.parent.lastIndexOf(` - ${s("children")}`);a=o>-1?i.parent.slice(0,o):i.parent}return fe.jsx("div",{className:"card bg-base-100 shadow-sm",children:fe.jsxs("div",{className:"card-body",children:[fe.jsx("h2",{className:"card-title",children:i.friendlyName}),fe.jsx("span",{children:i.type}),fe.jsx("span",{title:s("zigbee:ieee_address"),children:i.ieeeAddr}),fe.jsxs("span",{title:s("zigbee:network_address_hex"),className:"justify-self-end",children:[HU(i.networkAddress,4)," | ",fe.jsx("span",{title:s("zigbee:network_address_dec"),children:i.networkAddress})]}),a&&fe.jsxs("span",{children:[s("parent"),": ",a]}),i.failed&&i.failed.length>0&&fe.jsxs("div",{className:"badge badge-ghost",children:[fe.jsx(ni,{icon:VU,className:"text-error",beatFade:!0}),s("common:failed"),": ",i.failed]}),fe.jsxs("div",{className:"card-actions justify-end mt-2",children:[n&&fe.jsx(ts,{className:"btn btn-square btn-primary",onClick:e,children:fe.jsx(ni,{icon:t?WU:XU})}),fe.jsx(ts,{className:"btn btn-square btn-neutral",onClick:r,children:fe.jsx(ni,{icon:jU})})]})]})})}),bA=$.memo(i=>{const{label:e,icon:t,onChange:n,onSubmit:r,defaultValue:s,...a}=i,[o,l]=$.useState(s);$.useEffect(()=>{l(s)},[s]);const c=$.useCallback(d=>{l(d.target.value?d.target.valueAsNumber:""),n==null||n(d)},[n]),f=$.useCallback(d=>{r==null||r(o,!d.target.validationMessage)},[r,o]);return fe.jsxs("div",{className:"flex flex-row flex-wrap items-center gap-2 bg-base-100 rounded-box px-2 pb-1",title:e,children:[fe.jsx(ni,{icon:t}),fe.jsxs("div",{className:"",children:[fe.jsx("input",{className:"range range-xs",onChange:c,onTouchEnd:f,onMouseUp:f,...a,type:"range",value:o}),fe.jsxs("div",{className:"flex justify-between px-1 mt-1 text-xs",children:[fe.jsx("span",{children:i.min}),fe.jsx("span",{children:o}),fe.jsx("span",{children:i.max})]})]})]})}),cX=$.memo(({graphRef:i,layoutType:e,onLayoutTypeChange:t,labelType:n,onLabelTypeChange:r,nodeStrength:s,onNodeStrengthChange:a,linkDistance:o,onLinkDistanceChange:l,nodes:c,showParents:f,setShowParents:d,showChildren:p,setShowChildren:m,showSiblings:y,setShowSiblings:x})=>{const{t:_}=xg("network"),g=$.useMemo(()=>{const E=c.map(w=>[w.id,w.data.type!=="Coordinator"?`${w.data.type[0]} - ${w.label}`:w.label]);return E.sort(([,w],[,T])=>w.localeCompare(T)),E.map(([w,T])=>fe.jsx("option",{value:w,children:T},w))},[c]),b=$.useCallback(()=>{i.current&&qU(i.current.exportCanvas(),`network-map-${Date.now()}.png`)},[i]),S=$.useCallback(E=>{var w,T;if(E.target.value){const R=[E.target.value];(w=i.current)==null||w.centerGraph(R),(T=i.current)==null||T.fitNodesInView(R)}},[i]);return fe.jsxs(fe.Fragment,{children:[fe.jsxs("div",{className:"absolute z-9 top-0 left-0 p-1 flex flex-row flex-wrap gap-1 items-start",children:[fe.jsx(ts,{title:_("download_image"),className:"btn btn-square btn-neutral btn-sm",onClick:b,children:fe.jsx(ni,{icon:YU})}),fe.jsx(ts,{title:_("reset_controls"),className:"btn btn-square btn-neutral btn-sm",onClick:()=>{var E;(E=i.current)==null||E.resetControls()},children:fe.jsx(ni,{icon:ZU})}),fe.jsx(ts,{title:_("fit_view"),className:"btn btn-square btn-neutral btn-sm",onClick:()=>{var E,w;(E=i.current)==null||E.centerGraph(),(w=i.current)==null||w.fitNodesInView()},children:fe.jsx(ni,{icon:KU})}),fe.jsx(ts,{title:_("zoom_in"),className:"btn btn-square btn-neutral btn-sm",onClick:()=>{var E;(E=i.current)==null||E.zoomIn()},children:fe.jsx(ni,{icon:JU})}),fe.jsx(ts,{title:_("zoom_out"),className:"btn btn-square btn-neutral btn-sm",onClick:()=>{var E;(E=i.current)==null||E.zoomOut()},children:fe.jsx(ni,{icon:QU})}),fe.jsx(ts,{className:`btn btn-square btn-neutral btn-sm ${f?"":"btn-outline"}`,item:!f,onClick:d,title:_("parent"),children:fe.jsx(ni,{icon:Qc,style:{color:yl[ti.NeighborIsParent]}})}),fe.jsx(ts,{className:`btn btn-square btn-neutral btn-sm ${p?"":"btn-outline"}`,item:!p,onClick:m,title:_("child"),children:fe.jsx(ni,{icon:Qc,style:{color:yl[ti.NeighborIsAChild]}})}),fe.jsx(ts,{className:`btn btn-square btn-neutral btn-sm ${y?"":"btn-outline"}`,item:!y,onClick:x,title:_("sibling"),children:fe.jsx(ni,{icon:Qc,style:{color:yl[ti.NeighborIsASibling]}})}),fe.jsxs("select",{className:"select select-sm w-36",title:_("find_node"),defaultValue:"",onChange:S,children:[fe.jsx("option",{value:"",children:_("find_node")}),g]})]}),fe.jsxs("div",{className:"absolute z-9 top-0 right-0 p-1 flex flex-row flex-wrap gap-1 items-start justify-end",children:[fe.jsxs("select",{className:"select select-sm w-36",title:_("layout_type"),value:e,onChange:t,children:[fe.jsx("option",{value:"",disabled:!0,children:_("layout_type")}),fe.jsx("option",{value:"forceDirected2d",children:"forceDirected2d"}),fe.jsx("option",{value:"forceDirected3d",children:"forceDirected3d"}),fe.jsx("option",{value:"radialOut2d",children:"radialOut2d"}),fe.jsx("option",{value:"radialOut3d",children:"radialOut3d"})]}),fe.jsxs("select",{className:"select select-sm w-36",title:_("label_type"),value:n,onChange:r,children:[fe.jsx("option",{value:"",disabled:!0,children:_("label_type")}),fe.jsx("option",{value:"all",children:"all"}),fe.jsx("option",{value:"auto",children:"auto"}),fe.jsx("option",{value:"none",children:"none"}),fe.jsx("option",{value:"nodes",children:"nodes"}),fe.jsx("option",{value:"edges",children:"edges"})]})]}),fe.jsxs("div",{className:"absolute z-9 bottom-0 left-0 p-1 flex flex-row flex-wrap gap-1 items-end",children:[fe.jsx(bA,{name:"node_strength",label:_("node_strength"),icon:$U,onSubmit:(E,w)=>w&&typeof E=="number"&&a(E),min:-1e3,max:-100,step:10,defaultValue:s}),fe.jsx(bA,{name:"link_distance",label:_("link_distance"),icon:eO,onSubmit:(E,w)=>w&&typeof E=="number"&&l(E),min:10,max:200,step:5,defaultValue:o})]}),fe.jsx("div",{className:"absolute z-9 bottom-0 right-0 p-1 flex flex-row flex-wrap gap-1 items-end justify-end",children:fe.jsx(ts,{title:_("scroll_to_top"),className:"btn btn-primary btn-sm ml-auto",onClick:()=>{window.scrollTo(0,0)},children:fe.jsx(ni,{icon:tO})})})]})}),uX=$.memo(()=>{const{t:i}=xg("network");return fe.jsxs("details",{className:"collapse collapse-arrow bg-white text-black rounded-b-none",children:[fe.jsx("summary",{className:"collapse-title font-semibold",children:i("legend")}),fe.jsxs("div",{className:"collapse-content text-sm",children:[fe.jsxs("div",{className:"flex flex-row flex-wrap gap-3 mb-2",children:[fe.jsxs("div",{children:[fe.jsxs("p",{children:[i("nodes"),":"]}),fe.jsxs("ul",{className:"list-none list-inside",children:[fe.jsxs("li",{style:{color:tm.Coordinator},children:[fe.jsx(ni,{icon:Nv})," Coordinator"]}),fe.jsxs("li",{style:{color:tm.Router},children:[fe.jsx(ni,{icon:Nv})," Router"]}),fe.jsxs("li",{style:{color:tm.EndDevice},children:[fe.jsx(ni,{icon:Nv})," EndDevice"]})]})]}),fe.jsxs("div",{children:[fe.jsxs("p",{children:[i("edges"),":"]}),fe.jsxs("ul",{className:"list-none list-inside",children:[fe.jsxs("li",{style:{color:yl[ti.NeighborIsParent]},children:[fe.jsx(ni,{icon:Qc})," ",i("parent")]}),fe.jsxs("li",{style:{color:yl[ti.NeighborIsAChild]},children:[fe.jsx(ni,{icon:Qc})," ",i("child")]}),fe.jsxs("li",{style:{color:yl[ti.NeighborIsASibling]},children:[fe.jsx(ni,{icon:Qc})," ",i("sibling")]})]})]})]}),fe.jsx("p",{children:i("legend_node_siblings")}),fe.jsx("p",{children:i("legend_node_size")}),fe.jsx("p",{children:i("legend_node_select")}),fe.jsx("p",{children:i("legend_node_fold")}),fe.jsx("p",{children:i("legend_edge_toggle")}),fe.jsx("p",{className:"text-xs mt-2",children:"Known issues:"}),fe.jsxs("ul",{className:"list-disc list-inside text-xs",children:[fe.jsxs("li",{children:['If you cannot see labels (names/LQIs) after the map has finished loading, zoom-in sufficiently, switch the "',i("label_type"),'" value to something else, then back to the one you want']}),fe.jsx("li",{children:"Edge colors are currently not working"})]})]})]})}),MX=$.memo(({map:i})=>{const{t:e}=xg("network"),[t,n]=$.useState(qa.get(HS,"forceDirected2d")),[r,s]=$.useState(qa.get(VS,"all")),[a,o]=$.useState(qa.get(WS,-750)),[l,c]=$.useState(qa.get(XS,50)),[f,d]=$.useState(!0),[p,m]=$.useState(!0),[y,x]=$.useState(!0),_=$.useRef(null),[g,b]=$.useMemo(()=>{var z,L;const I=[],P=[],O=[];for(const F of i.nodes){const V=i.links.find(G=>G.relationship===ti.NeighborIsParent&&G.target.ieeeAddr===F.ieeeAddr);let W=V?(z=i.nodes.find(G=>G.ieeeAddr===V.source.ieeeAddr))==null?void 0:z.friendlyName:void 0;if(!V){const G=i.links.find(Z=>Z.relationship===ti.NeighborIsAChild&&Z.source.ieeeAddr===F.ieeeAddr);W=G?(L=i.nodes.find(Z=>Z.ieeeAddr===G.target.ieeeAddr))==null?void 0:L.friendlyName:void 0,W&&(W+=` - ${e("children")}`)}I.push({id:F.ieeeAddr,data:{...F,parent:W},label:F.friendlyName,labelVisible:!0,fill:tm[F.type]})}const H=new Map;for(const F of i.links){if(!f&&F.relationship===ti.NeighborIsParent||!p&&F.relationship===ti.NeighborIsAChild||!y&&F.relationship===ti.NeighborIsASibling)continue;if(F.relationship===ti.NeighborIsASibling){const W=H.get(F.source.ieeeAddr);(!W||F.depth<W.depth||F.linkquality>W.linkquality||W.linkquality===F.linkquality&&F.depth<W.depth)&&H.set(F.source.ieeeAddr,F);continue}const V=i.links.find(W=>W.source.ieeeAddr===F.target.ieeeAddr&&W.target.ieeeAddr===F.source.ieeeAddr);F.relationship===ti.NeighborIsAChild&&(V==null?void 0:V.relationship)===ti.NeighborIsParent||O.push([F,V])}for(const[,F]of H){const V=i.links.find(W=>W.source.ieeeAddr===F.target.ieeeAddr&&W.target.ieeeAddr===F.source.ieeeAddr);O.push([F,V])}const J=[];for(const[F,V]of O)J.includes(F)||F.relationship===ti.NeighborIsASibling&&((V==null?void 0:V.relationship)===ti.NeighborIsParent||(V==null?void 0:V.relationship)===ti.NeighborIsAChild)||P.push({id:`${F.source.ieeeAddr}-${F.target.ieeeAddr}-${F.relationship}`,data:F,label:V?`${F.linkquality} / ${V.linkquality??"?"}`:`${F.linkquality}`,size:F.relationship===ti.NeighborIsParent||F.relationship===ti.NeighborIsAChild?1.5:.75,labelVisible:!0,source:F.source.ieeeAddr,target:F.target.ieeeAddr,fill:yl[F.relationship]});return[I,P]},[i,f,p,y,e]),{selections:S,actives:E,onNodeClick:w,onCanvasClick:T}=aX({ref:_,nodes:g,type:"single",pathSelectionType:"out",focusOnSelect:!1}),R=$.useCallback(I=>{var P,O,H;I.target.value&&(qa.set(HS,I.target.value),n(I.target.value),(P=_.current)==null||P.resetControls(),(O=_.current)==null||O.centerGraph(),(H=_.current)==null||H.fitNodesInView())},[]),U=$.useCallback(I=>{I.target.value&&(qa.set(VS,I.target.value),s(I.target.value))},[]),C=$.useCallback(I=>{qa.set(WS,I),o(I)},[]),D=$.useCallback(I=>{qa.set(XS,I),c(I)},[]);return fe.jsxs(fe.Fragment,{children:[fe.jsx(uX,{}),fe.jsxs("div",{className:"relative h-screen",children:[fe.jsx(cX,{graphRef:_,layoutType:t,onLayoutTypeChange:R,labelType:r,onLabelTypeChange:U,nodeStrength:a,onNodeStrengthChange:C,linkDistance:l,onLinkDistanceChange:D,nodes:g,showParents:f,setShowParents:d,showChildren:p,setShowChildren:m,showSiblings:y,setShowSiblings:x}),fe.jsx(sX,{ref:_,nodes:g,edges:b,clusterAttribute:t.startsWith("forceDirected")?"parent":void 0,selections:S,actives:E,onCanvasClick:T,onNodeClick:w,layoutType:t,layoutOverrides:{nodeStrength:a,linkDistance:l},sizingType:"centrality",labelType:r,labelFontUrl:oX,edgeLabelPosition:"natural",lassoType:"node",cameraMode:t.endsWith("3d")?"rotate":"pan",draggable:!0,animated:!1,contextMenu:({data:{data:I},onCollapse:P,isCollapsed:O,canCollapse:H,onClose:J})=>I.friendlyName?fe.jsx(lX,{data:I,onCollapse:P,isCollapsed:O,canCollapse:H,onClose:J}):null})]})]})});export{MX as default};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ab as y,r as i,b as v,W as N,j as a,B as k,Q as C}from"./index-
|
|
1
|
+
import{ab as y,r as i,b as v,W as N,j as a,B as k,Q as C}from"./index-DxU0bziW.js";import{D as T}from"./DashboardFeatureWrapper-Bncctj9I.js";import{b as g,F as I,g as M}from"./Feature-D7QUsVH9.js";import{I as S}from"./InputField-BeSPAw7s.js";import{S as R}from"./SelectField-rhV0VUR9.js";function A(s){if(y(s)){const e=[];for(const c in s.endpoints){const t=s.endpoints[c];for(const o of t.scenes)e.push({...o})}return e}return s.scenes}const L=["schedule_","_mode","_options","_startup","_type","inching_"],D=["effect"],$=["state","color_temp","color","transition","brightness"],j=(s,e)=>{if(s){if($.includes(s))return!0;for(const c of L)if(s.includes(c))return!1;if(D.includes(s))return!1}return e===g.ALL||e===g.SET||e===g.STATE_SET};function F(s,e={}){const{property:c,name:t,access:o}=s;if("features"in s&&s.features&&s.features.length>0){const n=[],d=c?e[c]:e;for(const m of s.features){const l=F(m,d);l&&!n.some(u=>u.property===l.property)&&n.push(l)}return n.length>0||j(t,o)?{...s,features:n}:void 0}return j(t,o)?{...s}:void 0}const V=i.memo(s=>{const{target:e,deviceState:c}=s,{t}=v("scene"),{sendMessage:o}=i.useContext(N),[n,d]=i.useState(0),[m,l]=i.useState(""),u=i.useMemo(()=>A(e),[e]),f=i.useMemo(()=>{var _;const r=[];if(y(e))for(const E of((_=e.definition)==null?void 0:_.exposes)??[]){const x=F(E,c);x&&r.push(x)}return r},[e,c]),b=i.useCallback(async r=>{await o(`${e.friendly_name}/set`,r)},[o,e]),h=i.useCallback(async()=>{const r={ID:n,name:m||`Scene ${n}`};await o(`${e.friendly_name}/set`,{scene_store:r})},[o,e,n,m]),p=i.useMemo(()=>n>=0&&n<=255&&!u.find(r=>r.id===n),[n,u]);return a.jsxs(a.Fragment,{children:[a.jsx("h2",{className:"text-lg font-semibold",children:t("add_update_header")}),a.jsxs("div",{className:"mb-3",children:[a.jsx(S,{name:"scene_id",label:t("scene_id"),type:"number",value:n,onChange:r=>!!r.target.value&&d(r.target.valueAsNumber),min:0,max:255}),a.jsx(S,{name:"scene_name",label:t("scene_name"),type:"text",value:m,placeholder:`Scene ${n}`,onChange:r=>l(r.target.value)}),f.length>0&&a.jsx("div",{className:"card card-border bg-base-200 shadow my-2",children:a.jsx("div",{className:"card-body",children:f.map(r=>a.jsx(I,{feature:r,device:e,deviceState:c,onChange:b,featureWrapperClass:T,minimal:!0,parentFeatures:[]},M(r)))})})]}),a.jsx(k,{disabled:!p,onClick:h,className:"btn btn-primary",children:t("store")})]})}),w=i.memo(s=>{const{t:e}=v("scene"),{onSceneSelected:c,scenes:t=[],value:o}=s;return t.length>0?a.jsxs(R,{name:"scene_picker",label:e("scene_name"),value:(o==null?void 0:o.id)??"",onChange:n=>!n.target.validationMessage&&!!n.target.value&&c(Number.parseInt(n.target.value,10)),children:[a.jsx("option",{value:"",disabled:!0,children:e("select_scene")}),t.map(n=>a.jsxs("option",{value:n.id,children:[n.id,": ",n.name]},n.id))]}):a.jsx(S,{name:"scene_picker",label:e("scene_id"),type:"number",value:(o==null?void 0:o.id)??"",onChange:n=>!n.target.validationMessage&&!!n.target.value&&c(n.target.valueAsNumber),min:0,max:255})}),z=i.memo(s=>{const{target:e}=s,{sendMessage:c}=i.useContext(N),{t}=v(["scene","common"]),[o,n]=i.useState({id:0,name:"Scene 0"}),[d,m]=i.useState(!0),l=i.useMemo(()=>A(e),[e]),u=i.useCallback(p=>{m(!1);const r=l.find(_=>_.id===p);n(r!==void 0?r:{id:p,name:`Scene ${p}`})},[l]),f=i.useCallback(async()=>await c(`${e.friendly_name}/set`,{scene_recall:o.id}),[c,e.friendly_name,o.id]),b=i.useCallback(async()=>await c(`${e.friendly_name}/set`,{scene_remove:o.id}),[c,e.friendly_name,o.id]),h=i.useCallback(async()=>await c(`${e.friendly_name}/set`,{scene_remove_all:""}),[c,e.friendly_name]);return a.jsxs(a.Fragment,{children:[a.jsx("h2",{className:"text-lg font-semibold",children:t("manage_scenes_header")}),a.jsx("div",{className:"mb-3",children:a.jsx(w,{onSceneSelected:u,value:d?void 0:o,scenes:l})}),a.jsxs("div",{className:"join join-horizontal",children:[a.jsx(k,{disabled:d,onClick:f,className:"btn btn-success join-item",children:t("recall")}),a.jsx(C,{disabled:d,onClick:b,className:"btn btn-error join-item",title:t("remove"),modalDescription:t("common:dialog_confirmation_prompt"),modalCancelLabel:t("common:cancel"),children:t("remove")}),a.jsx(C,{onClick:h,className:"btn btn-error btn-outline join-item",title:t("remove_all"),modalDescription:t("common:dialog_confirmation_prompt"),modalCancelLabel:t("common:cancel"),children:t("remove_all")})]})]})});export{V as A,z as R,F as g};
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as n,b as j,ac as R,j as t,B as N,Q as k,W as w}from"./index-DxU0bziW.js";import{I as C}from"./InputField-BeSPAw7s.js";import{C as E,A as y}from"./ClusterSinglePicker-C0xsDw10.js";import{E as S}from"./EndpointPicker-DeJqJAPG.js";import"./envs-DXl2ikyY.js";import"./SelectField-rhV0VUR9.js";const q=["maximum_report_interval","minimum_report_interval","reportable_change","endpoint","cluster","attribute"],A=n.memo(l=>{const{rule:r,device:o,onApply:a}=l,[e,u]=n.useState({rule:r}),{t:s}=j(["zigbee","common"]);n.useEffect(()=>{u({rule:r})},[r]);const c=n.useCallback(i=>{e.rule.endpoint=i,u({rule:e.rule})},[e]),_=n.useCallback(i=>{e.rule.cluster=i,u({rule:e.rule})},[e]),g=n.useCallback(i=>{e.rule.attribute=i,u({rule:e.rule})},[e]),p=n.useCallback(i=>{const{name:m,valueAsNumber:d}=i.target;e.rule[m]=d,u({rule:e.rule})},[e]),v=n.useCallback(()=>{a({...e.rule,maximum_report_interval:65535})},[e,a]),x=n.useMemo(()=>R(o),[o]),f=n.useMemo(()=>{const i=new Set,m=new Set;e.rule.cluster&&m.add(e.rule.cluster);const d=o.endpoints[Number.parseInt(e.rule.endpoint,10)];if(d){for(const b of d.clusters.output)m.add(b);for(const b of d.clusters.input)m.has(b)||i.add(b)}return[{name:"available",clusters:m},{name:"possible",clusters:i}]},[o.endpoints,e.rule.endpoint,e.rule.cluster]),h=n.useMemo(()=>q.every(i=>e.rule[i]!==void 0&&e.rule[i]!==""),[e]);return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex flex-row flex-wrap gap-2",children:[t.jsx(S,{label:s("endpoint"),disabled:!r.isNew,values:x,value:e.rule.endpoint,onChange:c,required:!0}),t.jsx(E,{label:s("cluster"),disabled:!e.rule.endpoint,clusters:f,value:e.rule.cluster,onChange:_,required:!0}),t.jsx(y,{label:s("attribute"),disabled:!e.rule.cluster,value:e.rule.attribute,cluster:e.rule.cluster,device:o,onChange:g,required:!0}),t.jsx(C,{name:"minimum_report_interval",label:s("min_rep_interval"),type:"number",value:e.rule.minimum_report_interval,onChange:p,required:!0}),t.jsx(C,{name:"maximum_report_interval",label:s("max_rep_interval"),type:"number",value:e.rule.maximum_report_interval,onChange:p,required:!0}),t.jsx(C,{name:"reportable_change",label:s("min_rep_change"),type:"number",value:e.rule.reportable_change,onChange:p,required:!0}),t.jsxs("fieldset",{className:"fieldset",children:[t.jsx("legend",{className:"fieldset-legend",children:s("actions")}),t.jsxs("div",{className:"join join-horizontal",children:[t.jsx(N,{className:"btn btn-primary join-item",item:e.rule,onClick:a,disabled:!h,children:s("common:apply")}),e.rule.isNew?null:t.jsx(k,{title:s("common:disable"),className:"btn btn-error join-item",onClick:v,modalDescription:s("common:dialog_confirmation_prompt"),modalCancelLabel:s("common:cancel"),children:s("common:disable")})]})]})]}),t.jsx("div",{className:"divider"})]})}),I=l=>{const r=[];for(const o in l.endpoints){const a=l.endpoints[o];for(const e of a.configured_reportings)r.push({...e,endpoint:o})}return r},M=l=>`${l.isNew}-${l.endpoint}-${l.cluster}-${l.attribute}`;function z(l){const{device:r}=l,{sendMessage:o}=n.useContext(w),[a,e]=n.useState({isNew:r.ieee_address,reportable_change:0,minimum_report_interval:60,maximum_report_interval:3600,endpoint:"",cluster:"",attribute:""}),u=n.useMemo(()=>I(r),[r]);n.useEffect(()=>{e({isNew:r.ieee_address,reportable_change:0,minimum_report_interval:60,maximum_report_interval:3600,endpoint:"",cluster:"",attribute:""})},[r.ieee_address]);const s=n.useCallback(async c=>{const{cluster:_,endpoint:g,attribute:p,minimum_report_interval:v,maximum_report_interval:x,reportable_change:f}=c;await o("bridge/request/device/configure_reporting",{id:r.ieee_address,endpoint:g,cluster:_,attribute:p,minimum_report_interval:v,maximum_report_interval:x,reportable_change:f,option:{}})},[o,r.ieee_address]);return t.jsx("div",{className:"flex flex-col",children:[...u,a].map(c=>t.jsx(A,{rule:c,device:r,onApply:s},M(c)))})}export{z as default};
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,j as e}from"./index-DxU0bziW.js";import{A as s,R as m}from"./RecallRemove-C9FFSOpk.js";import"./envs-DXl2ikyY.js";import"./DashboardFeatureWrapper-Bncctj9I.js";import"./Feature-D7QUsVH9.js";import"./DisplayValue-VitUEjoj.js";import"./_createCompounder-BmfrG4o5.js";import"./capitalize-BLdk1W85.js";import"./InputField-BeSPAw7s.js";import"./SelectField-rhV0VUR9.js";function u(t){const i=a(r=>r.deviceStates[t.device.friendly_name]??{});return e.jsxs("div",{className:"flex flex-row flex-wrap justify-around items-start gap-3 my-2",children:[e.jsx("div",{children:e.jsx(s,{target:t.device,deviceState:i})}),e.jsx("div",{children:e.jsx(m,{target:t.device,deviceState:i})})]})}export{u as default};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as d,j as e}from"./index-
|
|
1
|
+
import{r as d,j as e}from"./index-DxU0bziW.js";const n=d.memo(s=>{const{label:l,detail:a,onChange:t,children:r,...c}=s;return e.jsxs("fieldset",{className:"fieldset",children:[l&&e.jsx("legend",{className:"fieldset-legend",children:l}),e.jsx("select",{className:`select${s.required?" validator":""}`,onChange:t,...c,children:r}),a&&e.jsx("span",{className:"label",children:a})]})});export{n as S};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
���p[����M2��
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as n,W as d,a as f,b as p,j as e,F as b,I as u,bV as g,B as x}from"./index-DxU0bziW.js";import{S as l}from"./SettingsList-BRIQr68H.js";import"./envs-DXl2ikyY.js";import"./CheckboxField-_a_6gFF3.js";import"./InputField-BeSPAw7s.js";import"./NumberField-CenGWKiG.js";import"./SelectField-rhV0VUR9.js";const r="main",h=[r,"frontend","mqtt","serial","availability","ota","advanced","homeassistant"];function N(){const{sendMessage:o}=n.useContext(d),a=f(t=>t.bridgeInfo),[s,m]=n.useState(r),{t:i}=p("settings"),c=n.useCallback(async t=>{s===r?await o("bridge/request/options",{options:t}):await o("bridge/request/options",{options:{[s]:t}})},[o,s]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"alert alert-info alert-soft mb-3",role:"alert",children:[e.jsx(b,{icon:u,size:"2xl"}),e.jsx("a",{href:g,target:"_blank",rel:"noreferrer",className:"link link-hover",children:i("common:read_the_docs_info")})]}),e.jsxs("div",{className:"tabs tabs-border",children:[h.map(t=>e.jsx(x,{className:`tab${s===t?" tab-active":""}`,"aria-current":"page",item:t,onClick:m,children:i(t)},t)),e.jsx("div",{className:"tab-content block h-full bg-base-100 p-3",children:s===r?e.jsx(l,{schema:a.config_schema,data:a.config,set:c,rootOnly:!0}):e.jsx(l,{schema:a.config_schema.properties[s],data:a.config[s],set:c})})]})]})}export{N as default};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as b,j as s,B as p,F as g,x as C,bW as w,aM as N,b as v}from"./index-
|
|
1
|
+
import{r as b,j as s,B as p,F as g,x as C,bW as w,aM as N,b as v}from"./index-DxU0bziW.js";import{C as V}from"./CheckboxField-_a_6gFF3.js";import{I as $}from"./InputField-BeSPAw7s.js";import{N as S}from"./NumberField-CenGWKiG.js";import{S as h}from"./SelectField-rhV0VUR9.js";const A=b.memo(a=>{const{defaultValues:n,label:c,detail:o,type:i,onSubmit:f}=a,[t,u]=b.useState(n||[]);b.useEffect(()=>{u(n||[])},[n]);const d=b.useCallback(()=>{t.length>0?u([...t,""]):u([""])},[t]),e=b.useCallback(()=>f(i==="number"?t.filter(l=>typeof l=="number"):t.filter(l=>!!l)),[i,t,f]);return s.jsxs("fieldset",{className:"fieldset gap-2",children:[c&&s.jsx("legend",{className:"fieldset-legend",children:c}),s.jsx("div",{className:"flex flex-row flex-wrap gap-2",children:t.map((l,r)=>s.jsxs("div",{className:"join min-w-xs",children:[s.jsx("input",{className:"input join-item",onBlur:m=>{const x=Array.from(t);x[r]=i==="number"?m.target.value?m.target.valueAsNumber:"":m.target.value,u(x)},type:i,defaultValue:Number.isNaN(l)?"":l}),s.jsx(p,{className:"btn btn-error btn-outline join-item",onClick:()=>{const m=Array.from(t);m.splice(r,1),u(m)},children:s.jsx(g,{icon:C})})]},`${l}-${r}`))}),s.jsxs("div",{className:"flex flex-row flex-wrap gap-2 items-center mt-1",children:[s.jsx(p,{onClick:d,className:"btn btn-sm btn-square btn-success ms-2",children:s.jsx(g,{icon:w})}),s.jsx(p,{onClick:e,className:"btn btn-sm btn-square btn-primary",children:s.jsx(g,{icon:N})}),o&&s.jsx("p",{className:"label",children:o})]})]})}),F=b.memo(a=>{const{names:n,label:c,detail:o,defaultsChecked:i,onSubmit:f}=a,[t,u]=b.useState(i||[]);b.useEffect(()=>{u(i||[])},[i]);const d=b.useCallback(l=>{let r=Array.from(t);l.target.checked?r.push(l.target.name):r=r.filter(m=>m!==l.target.name),u(r)},[t]),e=b.useCallback(()=>f(t),[t,f]);return s.jsxs("fieldset",{className:"fieldset gap-2",children:[c&&s.jsx("legend",{className:"fieldset-legend",children:c}),s.jsx("div",{className:"flex flex-row flex-wrap gap-2",children:n.map(l=>s.jsxs("label",{className:"label",children:[s.jsx("input",{name:l,className:"checkbox",type:"checkbox",onChange:d,checked:t.includes(l)}),l]},l))}),s.jsxs("div",{className:"flex flex-row flex-wrap gap-2 items-center mt-1",children:[s.jsx(p,{onClick:e,className:"btn btn-sm btn-square btn-primary",children:s.jsx(g,{icon:N})}),s.jsx("span",{className:"label",children:o})]})]})}),E=(a,n,c,o,i,f,t)=>{let u=n.type;if(Array.isArray(u))u=u.find(e=>e!=="null");else if(n.oneOf)return;const d=`${i}-${a}-${n.type}-${n.title}`;switch(u){case"boolean":return s.jsx(V,{name:a,label:a,detail:t,onChange:e=>!e.target.validationMessage&&o({[a]:e.target.checked}),required:f,defaultChecked:c??!1},d);case"integer":case"number":return n.enum?s.jsxs(h,{name:a,label:a,detail:t,onChange:e=>!e.target.validationMessage&&o({[a]:Number.parseInt(e.target.value,10)}),required:f,defaultValue:c??"",children:[s.jsx("option",{value:"",disabled:!0,children:"-"}),n.enum.map(e=>s.jsx("option",{value:e,children:e},e))]},d):s.jsx(S,{name:a,label:a,detail:t,onSubmit:(e,l)=>l&&o({[a]:e===""?null:e}),min:n.minimum,max:n.maximum,required:f,defaultValue:c??""},d);case"string":return n.enum?s.jsxs(h,{name:a,label:a,detail:t,onChange:e=>!e.target.validationMessage&&o({[a]:e.target.value}),required:f,defaultValue:c??"",children:[s.jsx("option",{value:"",disabled:!0,children:"-"}),n.enum.map(e=>s.jsx("option",{value:e,children:e},e))]},d):s.jsx($,{name:a,label:a,detail:t,type:"text",onBlur:e=>!e.target.validationMessage&&o({[a]:e.target.value}),required:f,defaultValue:c??""},d);case"array":{const e=n.items;if(e&&typeof e=="object"&&"type"in e){if(e.enum)return s.jsx(F,{names:e.enum,label:a,detail:t,onSubmit:l=>o({[a]:l}),defaultsChecked:c??[]});if(e.type==="string"||e.type==="number")return s.jsx(A,{defaultValues:c??[],label:a,detail:t,onSubmit:l=>o({[a]:l}),type:e.type})}}}},j=(a,n,c,o,i,f=[],t=!1)=>{var e;const u=[],d=[];for(const l in n){const r=n[l];if(!(typeof r=="boolean"||r.readOnly))if(r.properties)t||d.push(s.jsxs("div",{className:"list",children:[s.jsx("h3",{className:"list-row text-lg",children:r.title||l}),j(a,r.properties,c[l]||{},async m=>o({[l]:m}),i+1,r.required)]},`${i}-${l}`));else{const m=(e=r.oneOf)==null?void 0:e.find(x=>typeof x=="object"&&x.properties);if(m)(l!=="log_syslog"||c.log_output.includes("syslog"))&&d.push(s.jsxs("div",{className:"list",children:[s.jsx("h3",{className:"list-row text-lg",children:m.title||r.title||l}),j(a,m.properties,c[l]||{},async x=>o({[l]:x}),i+1,m.required)]},`${i}-${l}`));else{const x=E(l,r,c[l],o,i,f.includes(l),r.description?a(r.description,{defaultValue:r.description}):void 0);x&&u.push(s.jsx("div",{className:`list-row${i!==0?` ps-${4+i*4}`:""}`,children:x},`${i}-${l}`))}}}return d.length>0?u.concat(d):u};function y({schema:a,data:n,set:c,rootOnly:o}){const{t:i}=v("settingsSchemaDescriptions");return s.jsx("div",{className:"list bg-base-100",children:a.properties&&j(i,a.properties,n,c,0,a.required,o)})}export{y as S};
|
|
Binary file
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./About-CnEelo-p.js","./index-DxU0bziW.js","./envs-DXl2ikyY.js","./index-BvTgMHtW.css","./snakeCase-CXwqbiGB.js","./_createCompounder-BmfrG4o5.js","./Frontend-DS_kNSKc.js","./CheckboxField-_a_6gFF3.js","./InputField-BeSPAw7s.js","./NumberField-CenGWKiG.js","./SelectField-rhV0VUR9.js","./Settings-DJXqumih.js","./SettingsList-BRIQr68H.js","./Tools-BSOzqbOg.js","./index-i4IlTA7W.js","./Bridge-DtIUyQK3.js","./DevConsole-DHHECfbv.js","./TextareaField-DJXyoGrs.js","./Donate-BIW-l4zE.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u,d as _,b as d,r as a,j as s,N as o,F as n,e as b,a5 as x,k as j,a6 as g,a7 as p,q as v,a8 as N,_ as r}from"./index-DxU0bziW.js";import"./envs-DXl2ikyY.js";const T=a.lazy(async()=>await r(()=>import("./About-CnEelo-p.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)),f=a.lazy(async()=>await r(()=>import("./Frontend-DS_kNSKc.js"),__vite__mapDeps([6,1,2,3,7,8,9,10]),import.meta.url)),E=a.lazy(async()=>await r(()=>import("./Settings-DJXqumih.js"),__vite__mapDeps([11,1,2,3,12,7,8,9,10]),import.meta.url)),y=a.lazy(async()=>await r(()=>import("./Tools-BSOzqbOg.js"),__vite__mapDeps([13,1,2,3,14]),import.meta.url)),h=a.lazy(async()=>await r(()=>import("./Bridge-DtIUyQK3.js"),__vite__mapDeps([15,1,2,3]),import.meta.url)),A=a.lazy(async()=>await r(()=>import("./DevConsole-DHHECfbv.js"),__vite__mapDeps([16,1,2,3,8,10,17]),import.meta.url)),D=a.lazy(async()=>await r(()=>import("./Donate-BIW-l4zE.js"),__vite__mapDeps([18,1,2,3]),import.meta.url));function I(){const c=u(),{tab:i}=_(),{t}=d(["settings","navbar"]);a.useEffect(()=>{i||c("/settings/about",{replace:!0})},[i,c]);const l=a.useMemo(()=>{switch(i){case"about":return s.jsx(T,{});case"frontend":return s.jsx(f,{});case"settings":return s.jsx(E,{});case"tools":return s.jsx(y,{});case"bridge":return s.jsx(h,{});case"dev-console":return s.jsx(A,{});case"donate":return s.jsx(D,{})}return s.jsx(s.Fragment,{})},[i]),e=({isActive:m})=>m?"tab tab-active":"tab";return s.jsx(s.Fragment,{children:s.jsxs("div",{className:"tabs tabs-border",children:[s.jsxs(o,{to:"/settings/about",className:e,children:[s.jsx(n,{icon:b,className:"me-2"}),t("about")]}),s.jsxs(o,{to:"/settings/frontend",className:e,children:[s.jsx(n,{icon:x,className:"me-2"}),t("frontend")]}),s.jsxs(o,{to:"/settings/settings",className:e,children:[s.jsx(n,{icon:j,className:"me-2"}),t("settings")]}),s.jsxs(o,{to:"/settings/tools",className:e,children:[s.jsx(n,{icon:g,className:"me-2"}),t("tools")]}),s.jsxs(o,{to:"/settings/bridge",className:e,children:[s.jsx(n,{icon:p,className:"me-2"}),t("bridge")]}),s.jsxs(o,{to:"/settings/dev-console",className:e,children:[s.jsx(n,{icon:v,className:"me-2"}),t("dev_console")]}),s.jsxs(o,{to:"/settings/donate",className:e,children:[s.jsx(n,{icon:N,className:"me-2"}),t("donate")]}),s.jsx("div",{className:"tab-content block h-full bg-base-100 p-3",children:l})]})})}export{I as default};
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o,j as l}from"./index-DxU0bziW.js";import"./envs-DXl2ikyY.js";function u(e){const{device:a}=e,s=o(r=>r.deviceStates[a.friendly_name]??{}),t=JSON.stringify(s,null,4),n=Math.max(10,(t.match(/\n/g)||"").length+1);return l.jsx("textarea",{className:"textarea w-full",rows:n,readOnly:!0,value:t})}export{u as default};
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as H,b as Re,j as F,F as we,f as ve}from"./index-
|
|
1
|
+
import{r as H,b as Re,j as F,F as we,f as ve}from"./index-DxU0bziW.js";import{D as he}from"./DebouncedInput-BLPot7Mg.js";/**
|
|
2
2
|
* table-core
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) TanStack
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,j as e}from"./index-
|
|
1
|
+
import{r as i,j as e}from"./index-DxU0bziW.js";const x=i.memo(a=>{const{label:s,detail:l,onChange:t,onBlur:r,...d}=a;return e.jsxs("fieldset",{className:"fieldset",children:[s&&e.jsx("legend",{className:"fieldset-legend",children:s}),e.jsx("textarea",{className:`textarea${a.required?" validator":""}`,onChange:t,onBlur:r,...d}),l&&e.jsx("div",{className:"label",children:l})]})});export{x as T};
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as i,W as x,b as f,j as a,B as l,A as w,a as p,a4 as k,av as _,Q as h,bX as C,bY as y,bZ as N}from"./index-DxU0bziW.js";import{g as v}from"./index-i4IlTA7W.js";import"./envs-DXl2ikyY.js";async function S(r){return await new Promise((s,o)=>{const n=new FileReader;n.onloadend=()=>s(n.result),n.onerror=d=>o(d),n.readAsDataURL(r)})}async function z(r){const s=await fetch(r);if(s.ok){const o=await s.blob();return await S(o)}return Promise.reject(s.status)}function B(r){const[s,o]=i.useState("none"),{devices:n}=r,[d,m]=i.useState({}),{sendMessage:t}=i.useContext(x),{t:c}=f("settings"),b=i.useCallback(async e=>{m(j=>({...j,[e.ieee_address]:"init"}));const u=v(e),g=await z(u);return await t("bridge/request/device/options",{id:e.ieee_address,options:{icon:g}}),m(j=>({...j,[e.ieee_address]:"done"})),!0},[t]);switch(i.useEffect(()=>{if(s==="start"){for(const e of n)e.type!=="Coordinator"&&b(e).catch(u=>{console.error("Error localising image",u),m(g=>({...g,[e.ieee_address]:"error"}))}).then();o("inprogress")}},[s,n,b]),s){case"none":return a.jsx(l,{className:"btn btn-primary join-item",onClick:()=>o("start"),children:c("localise_images")});case"inprogress":return a.jsx("ul",{className:"menu menu-xs bg-base-200 max-w-xs w-full join-item",children:n.map(e=>a.jsxs("li",{className:"flex-row justify-between items-center border-b py-0.5",children:[e.friendly_name,a.jsx("span",{className:"badge badge-xs",children:c(`common:${d[e.ieee_address]}`)})]},e.ieee_address))});case"done":return a.jsx("div",{children:c("common:unknown")})}return a.jsx("div",{children:c("zigbee:unknown")})}function D(){const r=w(),{sendMessage:s}=i.useContext(x),o=p(e=>e.bridgeInfo),n=p(e=>e.backup),d=p(e=>e.preparingBackup),m=p(e=>e.devices),{t}=f(["settings","common"]),c=i.useCallback(()=>{const e=k(new Date).replace(/[\s_:]/g,"-"),u=`z2m-backup.${o.version}.${e}.zip`;_(`data:application/zip;base64,${n}`,u)},[n,o.version]),b=i.useCallback(async()=>{const e=prompt(t("enter_install_code"));e&&await s("bridge/request/install_code/add",{value:e})},[s,t]);return a.jsxs("div",{className:"join join-vertical",children:[a.jsx(h,{className:"btn btn-error join-item mb-2",onClick:async()=>await s("bridge/request/restart",""),title:t("restart_zigbee2mqtt"),modalDescription:t("common:dialog_confirmation_prompt"),modalCancelLabel:t("common:cancel"),children:t("restart_zigbee2mqtt")}),a.jsx(l,{className:"btn btn-primary join-item",onClick:async()=>await C(y.getState(),"state.json"),children:t("download_state")}),d?a.jsx(l,{className:"btn btn-primary join-item disabled",children:a.jsx("span",{className:"loading loading-dots loading-xl"})}):n?a.jsx(l,{className:"btn btn-primary join-item",onClick:c,children:t("download_z2m_backup")}):a.jsx(l,{className:"btn btn-primary join-item",onClick:async()=>{r(N()),await s("bridge/request/backup","")},children:t("request_z2m_backup")}),a.jsx(l,{className:"btn btn-primary join-item",onClick:b,children:t("add_install_code")}),a.jsx(B,{devices:m})]})}export{D as default};
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,W as _,A as C,a as o,b as I,T as P,U as w,V as N,j as s,L as T,B as m,F as k,X as x,Y as F,Z as v}from"./index-DxU0bziW.js";import{T as S}from"./Table-OEC1UqWW.js";import"./envs-DXl2ikyY.js";import"./DebouncedInput-BLPot7Mg.js";function B(){const{sendMessage:i}=t.useContext(_),a=C(),b=o(e=>e.touchlinkDevices),d=o(e=>e.devices),c=o(e=>e.touchlinkIdentifyInProgress),l=o(e=>e.touchlinkResetInProgress),h=o(e=>e.touchlinkScanInProgress),u=c||l,{t:n}=I(["touchlink","common","zigbee"]),p=t.useCallback(async()=>{a(P({inProgress:!0,devices:[]})),await i("bridge/request/touchlink/scan","")},[i,a]),g=t.useCallback(async e=>{a(w(!0)),await i("bridge/request/touchlink/identify",e)},[i,a]),f=t.useCallback(async e=>{a(N(!0)),await i("bridge/request/touchlink/factory_reset",e)},[i,a]),j=t.useMemo(()=>[{header:n("zigbee:ieee_address"),accessorFn:e=>e.ieee_address,cell:({row:{original:e}})=>d.find(r=>r.ieee_address===e.ieee_address)?s.jsx(T,{to:`/device/${e.ieee_address}/info`,className:"link link-hover",children:e.ieee_address}):e.ieee_address,sortingFn:(e,r)=>e.original.ieee_address.localeCompare(r.original.ieee_address)},{header:n("common:friendly_name"),accessorFn:e=>{var r;return(r=d.find(y=>y.ieee_address===e.ieee_address))==null?void 0:r.friendly_name}},{id:"channel",header:n("zigbee:channel"),accessorFn:e=>e.channel},{id:"actions",header:"",cell:({row:{original:e}})=>s.jsxs("div",{className:"join join-horizontal",children:[s.jsx(m,{disabled:u,item:e,title:n("identify"),className:"btn btn-primary join-item",onClick:g,children:s.jsx(k,{icon:c?x:F,spin:c})}),s.jsx(m,{disabled:u,item:e,title:n("factory_reset"),className:"btn btn-error join-item",onClick:f,children:s.jsx(k,{icon:l?x:v,spin:l})})]}),enableSorting:!1,enableColumnFilter:!1}],[c,l,u,d,n,g,f]);return h?s.jsx("div",{className:"flex flex-row justify-center items-center gap-2",children:s.jsx("span",{className:"loading loading-infinity loading-xl"})}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-row flex-wrap justify-center items-center gap-2 mb-3",children:s.jsx(m,{className:"btn btn-primary",onClick:p,disabled:h,children:n("scan")})}),s.jsx(S,{id:"touchlink-devices",columns:j,data:b})]})}export{B as default};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,b as s,j as l,L as a,ah as d}from"./index-
|
|
1
|
+
import{r as i,b as s,j as l,L as a,ah as d}from"./index-DxU0bziW.js";const r=e=>{const o="[/| |:]",n=new RegExp(o,"g");return e.replace(n,"_")},f=i.memo(({device:e})=>{const{t:o}=s("zigbee");let n=e.model_id||o("unknown"),t=d;if(e.supported&&e.definition){const p=[encodeURIComponent(e.definition.vendor.toLowerCase()),encodeURIComponent(e.definition.model.toLowerCase())].join("-");t=`https://www.zigbee2mqtt.io/devices/${encodeURIComponent(r(e.definition.model))}.html#${encodeURIComponent(r(p))}`,n=e.definition.model}return l.jsx(a,{target:"_blank",rel:"noopener noreferrer",to:t,className:"link link-hover",children:n})}),c=i.memo(({device:e})=>{const{t:o}=s("zigbee");let n=o("unsupported"),t=d;return e.supported&&e.definition&&(t=`https://www.zigbee2mqtt.io/supported-devices/#v=${encodeURIComponent(e.definition.vendor)}`,n=e.definition.vendor),l.jsx(a,{target:"_blank",rel:"noopener noreferrer",to:t,className:"link link-hover",children:n})});export{f as M,c as V};
|
|
Binary file
|