import{a$ as h,w as b,N as j,u as v,r as m,y as D,H as f,e as t,D as I,f as k,L as w,A as R,g as C,l as A,eq as L,P as o}from"./index-_6SmYgWK.js";import{T as E}from"./Table-DcZ35doG.js";import{c as T}from"./config-DpuVAZLd.js";/**
 * @license @tabler/icons-react v3.31.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var N=h("outline","book-2","IconBook2",[["path",{d:"M19 4v16h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12z",key:"svg-0"}],["path",{d:"M19 16h-12a2 2 0 0 0 -2 2",key:"svg-1"}],["path",{d:"M9 8h6",key:"svg-2"}]]);/**
 * @license @tabler/icons-react v3.31.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var _=h("outline","pencil","IconPencil",[["path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4",key:"svg-0"}],["path",{d:"M13.5 6.5l4 4",key:"svg-1"}]]);const S=({show:d,dialogProps:e,onCancel:g})=>{var c;const x=document.getElementById("portal"),r=b(),s=j(),a=v(T.getNodeConfig),p=n=>{const i=L.find(l=>l.name===n.name);return i?t.jsx(i.icon,{size:24,color:"white"}):null};m.useEffect(()=>{e.data&&a.request(e.data)},[e]),m.useEffect(()=>(r(d?{type:D}:{type:f}),()=>r({type:f})),[d,r]);const y=d?t.jsxs(I,{onClose:g,open:d,fullWidth:!0,maxWidth:"md","aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[t.jsx(k,{sx:{fontSize:"1rem"},id:"alert-dialog-title",children:e.data&&e.data.name&&e.data.label&&t.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.data.color&&!e.data.icon?t.jsx("div",{style:{...s.typography.commonAvatar,...s.typography.largeAvatar,borderRadius:"15px",backgroundColor:e.data.color,cursor:"grab",display:"flex",justifyContent:"center",alignItems:"center",background:e.data.color,marginRight:10},children:p(e.data)}):t.jsx("div",{style:{width:50,height:50,marginRight:10,borderRadius:"50%",backgroundColor:"white",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},children:t.jsx("img",{style:{width:"100%",height:"100%",padding:7,borderRadius:"50%",objectFit:"contain"},alt:e.data.name,src:`${w}/api/v1/node-icon/${e.data.name}`})}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",marginLeft:10},children:[e.data.label,t.jsxs("div",{style:{display:"flex",flexDirection:"row"},children:[t.jsx("div",{style:{display:"flex",flexDirection:"row",width:"max-content",borderRadius:15,background:"rgb(254,252,191)",padding:5,paddingLeft:10,paddingRight:10,marginTop:5,marginBottom:5},children:t.jsx("span",{style:{color:"rgb(116,66,16)",fontSize:"0.825rem"},children:e.data.id})}),e.data.version&&t.jsx("div",{style:{display:"flex",flexDirection:"row",width:"max-content",borderRadius:15,background:"#e9edc9",padding:5,paddingLeft:10,paddingRight:10,marginTop:5,marginLeft:10,marginBottom:5},children:t.jsxs("span",{style:{color:"#606c38",fontSize:"0.825rem"},children:["version ",e.data.version]})}),e.data.badge&&t.jsx("div",{style:{display:"flex",flexDirection:"row",width:"max-content",borderRadius:15,background:e.data.badge==="DEPRECATING"?"#ffe57f":"#52b69a",padding:5,paddingLeft:10,paddingRight:10,marginTop:5,marginLeft:10,marginBottom:5},children:t.jsx("span",{style:{color:e.data.badge!=="DEPRECATING"?"white":"inherit",fontSize:"0.825rem"},children:e.data.badge})}),e.data.tags&&e.data.tags.length&&e.data.tags.map((n,i)=>t.jsx("div",{style:{display:"flex",flexDirection:"row",width:"max-content",borderRadius:15,background:"#cae9ff",padding:5,paddingLeft:10,paddingRight:10,marginTop:5,marginLeft:10,marginBottom:5},children:t.jsx("span",{style:{color:"#023e7d",fontSize:"0.825rem"},children:n.toLowerCase()})},i))]})]}),t.jsx("div",{style:{flex:1}}),e.data.documentation&&t.jsx(R,{variant:"outlined",color:"primary",title:"Open Documentation",onClick:()=>{window.open(e.data.documentation,"_blank","noopener,noreferrer")},startIcon:t.jsx(N,{}),children:"Documentation"})]})}),t.jsxs(C,{children:[((c=e.data)==null?void 0:c.description)&&t.jsx("div",{style:{padding:10,marginBottom:10},children:t.jsx("span",{children:e.data.description})}),a.data&&a.data.length>0&&t.jsx(E,{rows:a.data.map(n=>{const{node:i,nodeId:l,...u}=n;return u}),columns:Object.keys(a.data[0]).slice(-3)})]})]}):null;return A.createPortal(y,x)};S.propTypes={show:o.bool,dialogProps:o.object,onCancel:o.func};export{_ as I,S as N};
