"use strict";var M=Object.create;var m=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var D=Object.getPrototypeOf;var E=Object.prototype.hasOwnProperty;var d=(e,t)=>m(e,"name",{value:t,configurable:true});var F=(e,t)=>{for(var n in t)m(e,n,{get:t[n],enumerable:true})};var v=(e,t,n,i)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let a of w(t))if(!E.call(e,a)&&a!==n)m(e,a,{get:()=>t[a],enumerable:!(i=R(t,a))||i.enumerable})}return e};var l=(e,t,n)=>(n=e!=null?M(D(e)):{},v(t||!e||!e.__esModule?m(n,"default",{value:e,enumerable:true}):n,e));var N=e=>v(m({},"__esModule",{value:true}),e);var z={};F(z,{default:()=>V});module.exports=N(z);var o=require("react/jsx-runtime");var h=l(require("@mui/icons-material/AddCircle"));var S=l(require("@mui/icons-material/Delete"));var c=require("@mui/material");var p=l(require("@mui/material/Box"));var g=l(require("@mui/material/Tab"));var y=l(require("@mui/material/Tabs"));var u=require("mobx-react");var C=require("react");var x=require("react-intl");var P=l(require("./SandboxTransferList"));const W=require("../../preload-safe-debug")("Ferdium:Settings");const j=(0,x.defineMessages)({addCustomSandbox:{id:"sandbox.addCustomSandbox",defaultMessage:"Add a custom sandbox"}});function q(e){const{children:t,value:n,index:i,...a}=e;return(0,o.jsx)("div",{role:"tabpanel",hidden:n!==i,id:`vertical-tabpanel-${i}`,"aria-labelledby":`vertical-tab-${i}`,style:{width:"100%"},...a,children:n===i&&(0,o.jsx)(p.default,{sx:{p:3},children:t})})}d(q,"TabPanel");function G(e){return{id:`vertical-tab-${e}`,"aria-controls":`vertical-tabpanel-${e}`}}d(G,"a11yProps");function L(e){const[t,n]=(0,C.useState)(0);const i=(0,x.useIntl)();const{stores:a,actions:f}=e;const{sandboxServices:b}=a.app;const{addSandboxService:T,editSandboxService:I,deleteSandboxService:B}=f.app;const $=d((r,s)=>{W("handleChange",r,s);n(s)},"handleChange");const k=d(()=>{T();n(b.length-1)},"handleAddTab");return(0,o.jsxs)(p.default,{sx:{display:"flex",height:"100%",flexDirection:"column"},children:[(0,o.jsx)(c.Button,{variant:"outlined",startIcon:(0,o.jsx)(h.default,{}),onClick:k,sx:{width:"fit-content",display:"flex",margin:"8px",justifyContent:"center",alignItems:"center"},children:i.formatMessage(j.addCustomSandbox)}),(0,o.jsxs)(p.default,{sx:{flexGrow:1,display:b.length===0?"none":"flex"},children:[(0,o.jsx)(y.default,{orientation:"vertical",variant:"scrollable",value:t,onChange:$,"aria-label":"Vertical tabs sandbox",sx:{borderRight:1,borderColor:"divider",minWidth:"20%",maxWidth:"20%"},children:b?.map((r,s)=>(0,o.jsx)(g.default,{label:r.name,...G(s)},r.id))}),b?.map((r,s)=>(0,o.jsxs)(q,{value:t,index:s,children:[(0,o.jsxs)(p.default,{sx:{display:"flex",alignItems:"center"},children:[(0,o.jsx)(c.TextField,{id:`text-${r.id}`,variant:"outlined",value:r.name,onChange:A=>{I({id:r.id,name:A.target.value})}}),(0,o.jsx)(c.IconButton,{onClick:()=>{B({id:r.id});n(t?t-1:0)},"aria-label":"delete",color:"error",children:(0,o.jsx)(S.default,{})})]}),(0,o.jsx)(P.default,{value:t,actions:f,stores:a})]},`${r.id}-tabpanel`))]})]})}d(L,"SandboxServiceTabs");var V=(0,u.inject)("stores","actions")((0,u.observer)(L));
