const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./RawNetworkData-CtXYseB7.js","./index-a36IMXuN.js","./envs-CRUy-_iG.js","./index-CwXNofQJ.css","./useSearch-BULPL_5W.js","./DeviceImage-DIhbuI22.js","./index-CsCgDwc5.js","./defineProperty-CegpTSss.js","./DebouncedInput-Dvnvqm-L.js","./PowerSource-CSWJpU_d.js","./snakeCase-BMb4_GjJ.js","./_createCompounder-BuXEc9F7.js","./isObjectLike-BQssIl0N.js","./index-Bs7zcW7e.js","./Lqi-BErKiqkS.js","./index-CCf1BEwD.js","./DisplayValue-D9Ja0Su_.js","./RawNetworkMap-rI1m5JIj.js","./merge-Cd_RtVsp.js","./isObject--vsEa_js.js","./extends-CF3RwP-h.js"])))=>i.map(i=>d[i]);
import{C as M,E,G as T,r,j as a,N as R,M as L,A as z,J as A,S as I,u as F,a as p,I as h,m as x,a3 as f,s as D,F as m,a4 as g,B as P,a5 as O,Q as B,$ as w}from"./index-a36IMXuN.js";import{C as G}from"./CheckboxField-CwZ6yoAm.js";import{S as j}from"./SelectField-BQBsNhlB.js";import"./envs-CRUy-_iG.js";const V=r.lazy(async()=>await w(()=>import("./RawNetworkData-CtXYseB7.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url)),Y=r.lazy(async()=>await w(()=>import("./RawNetworkMap-rI1m5JIj.js"),__vite__mapDeps([17,1,2,3,18,12,19,20,6,13]),import.meta.url)),q=r.memo(({sourceIdx:s})=>{const{t}=F(["network","common"]),l=p(h(e=>e.networkMapIsLoading[s])),n=p(h(e=>e.networkMap[s])),i=p(e=>e.setNetworkMap),o=p(e=>e.setNetworkMapIsLoading),[c,v]=r.useState("raw"),[d,k]=r.useState(!1),[u,N]=r.useState(x.get(f,"data")),y=r.useCallback(e=>{e.target.value&&v(e.target.value)},[]),_=r.useCallback(e=>{e.target.value&&(x.set(f,e.target.value),N(e.target.value))},[]),b=r.useCallback(e=>{k(e.target.checked)},[]),C=r.useCallback(async()=>{i(s,void 0),o(s),await D(s,"bridge/request/networkmap",{type:c,routes:d})},[s,c,d,i,o]),S=r.useMemo(()=>{if(l)return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex flex-row justify-center items-center gap-2",children:a.jsx("span",{className:"loading loading-infinity loading-xl"})}),a.jsx("div",{className:"flex flex-row justify-center items-center gap-2",children:t(e=>e.loading,{ns:"common"})})]});if(n)switch(n.type){case"raw":return u==="data"?a.jsx(V,{sourceIdx:s,map:n.value}):a.jsx(Y,{sourceIdx:s,map:n.value});case"graphviz":return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"alert alert-info alert-soft mb-3",role:"alert",children:[a.jsx(m,{icon:g,size:"2xl"}),t(e=>e.copy_paste_on),a.jsx("a",{href:"https://dreampuf.github.io/GraphvizOnline",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://dreampuf.github.io/GraphvizOnline"}),a.jsx("a",{href:"https://edotor.net/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://edotor.net/"})]}),a.jsx("textarea",{className:"textarea w-full",rows:5,readOnly:!0,value:n.value})]});case"plantuml":return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"alert alert-info alert-soft mb-3",role:"alert",children:[a.jsx(m,{icon:g,size:"2xl"}),t(e=>e.copy_paste_on),a.jsx("a",{href:"https://editor.plantuml.com/uml/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://editor.plantuml.com/uml/"}),a.jsx("a",{href:"https://www.planttext.com/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://www.planttext.com/"})]}),a.jsx("textarea",{className:"textarea w-full",rows:5,readOnly:!0,value:n.value})]})}return a.jsxs("div",{className:"flex flex-col justify-center items-center gap-2",children:[a.jsx("p",{className:"max-w-prose",children:t(e=>e.begin_info_type)}),a.jsx("p",{className:"max-w-prose",children:t(e=>e.begin_info_routes)}),a.jsx("p",{className:"max-w-prose",children:t(e=>e.begin_info_display)})]})},[s,n,l,u,t]);return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex flex-row flex-wrap justify-center gap-3 mb-2",children:[a.jsxs(j,{name:"type",label:t(e=>e.type),value:c,onChange:y,children:[a.jsx("option",{value:"raw",children:t(e=>e.raw)}),a.jsx("option",{value:"graphviz",children:t(e=>e.graphviz)}),a.jsx("option",{value:"plantuml",children:t(e=>e.plantuml)})]}),a.jsx(G,{name:"enable_routes",label:t(e=>e.enable_routes),checked:d,onChange:b}),a.jsx("fieldset",{className:"fieldset self-end",children:a.jsxs(P,{className:"btn btn-outline btn-primary ms-3 me-6",onClick:C,title:t(n?e=>e.reload:e=>e.load),disabled:l,children:[n?a.jsx(m,{icon:O}):a.jsx(m,{icon:B}),t(n?e=>e.reload:e=>e.load)]})}),c==="raw"&&a.jsxs(j,{name:"display_type",label:t(e=>e.display_type),value:u,onChange:_,children:[a.jsx("option",{value:"data",children:t(e=>e.data)}),a.jsx("option",{value:"map",children:t(e=>e.map)})]})]}),S]})}),K=({isActive:s})=>s?"menu-active":void 0;function Q(){const s=M(),{sourceIdx:t}=E(),[l,n]=T(t);return r.useEffect(()=>{(!t||!n)&&s("/network/0",{replace:!0})},[t,n,s]),a.jsxs(a.Fragment,{children:[a.jsx(R,{children:L&&a.jsx("div",{className:"menu menu-horizontal flex-1",children:z.map((i,o)=>a.jsx("li",{children:a.jsx(A,{to:`/network/${o}`,className:K,children:a.jsx(I,{idx:o,alwaysShowName:!0})})},i))})}),a.jsx(q,{sourceIdx:l},t)]})}export{Q as default};
