const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./RawNetworkData-Xk75QL3K.js","./index-vDL8KyrI.js","./index-KcXdcCUK.css","./DeviceImage-BpknBFw1.js","./index-C4Y7ujGQ.js","./DebouncedInput-DpBqTOhq.js","./PowerSource-DFW6CjuU.js","./snakeCase-B_0CeYWc.js","./_createCompounder-Bmfmbzn9.js","./Lqi-C8sPb_IK.js","./DisplayValue-CvjefE6V.js","./index-C2eewgcx.js","./RawNetworkMap-CwUz_5FO.js","./RawNetworkMap-DkxkTem6.css"])))=>i.map(i=>d[i]);
import{y as _,r as s,W as C,b as N,a as m,z,j as e,F as l,A as d,B as R,C as T,k as E,_ as x}from"./index-vDL8KyrI.js";import{C as F}from"./CheckboxField-m1WCeVZk.js";import{S as h}from"./SelectField-apZm61cq.js";const M=s.lazy(async()=>await x(()=>import("./RawNetworkData-Xk75QL3K.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]),import.meta.url)),S=s.lazy(async()=>await x(()=>import("./RawNetworkMap-CwUz_5FO.js"),__vite__mapDeps([12,1,2,11,3,4,13]),import.meta.url));function L(){const p=_(),{sendMessage:u}=s.useContext(C),{t:r}=N(["network","common"]),n=m(t=>t.networkMapIsLoading),a=m(t=>t.networkMap),[o,f]=s.useState("raw"),[i,g]=s.useState(!1),[c,j]=s.useState("data"),w=s.useCallback(t=>{t.target.value&&f(t.target.value)},[]),y=s.useCallback(t=>{t.target.value&&j(t.target.value)},[]),v=s.useCallback(t=>{g(t.target.checked)},[]),k=s.useCallback(async()=>{p(z()),await u("bridge/request/networkmap",{type:o,routes:i})},[o,i,p,u]),b=s.useMemo(()=>{if(n)return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-row justify-center items-center gap-2",children:e.jsx("span",{className:"loading loading-infinity loading-xl"})}),e.jsx("div",{className:"flex flex-row justify-center items-center gap-2",children:r("loading")})]});if(a)switch(a.type){case"raw":return c==="data"?e.jsx(M,{map:a.value}):e.jsx(S,{map:a.value});case"graphviz":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"alert alert-info alert-soft mb-3",role:"alert",children:[e.jsx(l,{icon:d,size:"2xl"}),r("copy_paste_on"),e.jsx("a",{href:"https://dreampuf.github.io/GraphvizOnline",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://dreampuf.github.io/GraphvizOnline"}),e.jsx("a",{href:"https://edotor.net/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://edotor.net/"})]}),e.jsx("textarea",{className:"textarea w-full",rows:5,readOnly:!0,value:a.value})]});case"plantuml":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"alert alert-info alert-soft mb-3",role:"alert",children:[e.jsx(l,{icon:d,size:"2xl"}),r("copy_paste_on"),e.jsx("a",{href:"https://editor.plantuml.com/uml/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://editor.plantuml.com/uml/"}),e.jsx("a",{href:"https://www.planttext.com/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://www.planttext.com/"})]}),e.jsx("textarea",{className:"textarea w-full",rows:5,readOnly:!0,value:a.value})]})}return null},[a,n,c,r]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-row justify-center gap-3 mb-3",children:[e.jsxs(h,{name:"type",label:r("type"),value:o,onChange:w,children:[e.jsx("option",{value:"raw",children:"raw"}),e.jsx("option",{value:"graphviz",children:"graphviz"}),e.jsx("option",{value:"plantuml",children:"plantuml"})]}),e.jsx(F,{name:"enable_routes",label:r("enable_routes"),checked:i,onChange:v}),e.jsx(R,{className:"btn btn-primary btn-square self-center ms-3 me-6",onClick:k,title:r(a?"reload":"load"),disabled:n,children:a?e.jsx(l,{icon:T}):e.jsx(l,{icon:E})}),(a==null?void 0:a.type)==="raw"&&e.jsxs(h,{name:"display_type",label:r("display_type"),value:c,onChange:y,children:[e.jsx("option",{value:"data",children:"data"}),e.jsx("option",{value:"map",children:"map"})]})]}),b]})}export{L as default};
