"use strict";var H=Object.create;var h=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var M=Object.getPrototypeOf;var N=Object.prototype.hasOwnProperty;var r=(e,t)=>h(e,"name",{value:t,configurable:true});var Q=(e,t)=>{for(var s in t)h(e,s,{get:t[s],enumerable:true})};var P=(e,t,s,u)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let o of K(t))if(!N.call(e,o)&&o!==s)h(e,o,{get:()=>t[o],enumerable:!(u=J(t,o))||u.enumerable})}return e};var a=(e,t,s)=>(s=e!=null?H(M(e)):{},P(t||!e||!e.__esModule?h(s,"default",{value:e,enumerable:true}):s,e));var U=e=>P(h({},"__esModule",{value:true}),e);var X={};Q(X,{default:()=>W});module.exports=U(X);var i=require("react/jsx-runtime");var b=a(require("@mui/material/Button"));var $=a(require("@mui/material/Checkbox"));var p=a(require("@mui/material/Grid"));var w=a(require("@mui/material/List"));var z=a(require("@mui/material/ListItemButton"));var R=a(require("@mui/material/ListItemIcon"));var A=a(require("@mui/material/ListItemText"));var y=require("mobx-react");var E=require("react");function C(e,t){return e.filter(s=>!t.includes(s))}r(C,"not");function T(e,t){return e.filter(s=>t.includes(s))}r(T,"intersection");function V(e){const{value:t,actions:s,stores:u}=e;const{editSandboxService:o}=s.app;const{sandboxServices:v}=u.app;const{all:L}=u.services;const m=v[t].services;const B=new Set;L.forEach(c=>{let n=false;v.forEach(l=>{if(l.services.includes(c.id)){n=true}});if(!n){B.add(c.id)}});const x=[...B];const[d,g]=(0,E.useState)([]);const j=r(c=>()=>{const n=d.indexOf(c);const l=[...d];if(n===-1){l.push(c)}else{l.splice(n,1)}g(l)},"handleToggle");const f=v[t].id;const I=T(d,m);const S=T(d,x);const k=r(c=>{const n=L.find(l=>l.id===c);if(!n){return null}return n},"getServiceInfo");const G=r(c=>(0,i.jsx)(w.default,{dense:true,component:"div",role:"list",children:c.map(n=>{const l=`transfer-list-item-${n}-label`;return(0,i.jsxs)(z.default,{role:"listitem",onClick:j(n),children:[(0,i.jsxs)(R.default,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[(0,i.jsx)($.default,{checked:d.includes(n),tabIndex:-1,disableRipple:true,inputProps:{"aria-labelledby":l}}),(0,i.jsx)("img",{src:k(n)?.icon,alt:k(n)?.name,width:15,height:15})]}),(0,i.jsx)(A.default,{id:l,primary:k(n)?.name})]},`${f}-${n}-li`)})},`${f}-${t}-transferlist`),"customList");function D(){o({id:f,services:[]});g([])}r(D,"handleAllRight");function O(){o({id:f,services:C(m,I)});g(C(d,I))}r(O,"handleCheckedRight");function q(){o({id:f,services:[...m,...S]});g(C(d,S))}r(q,"handleCheckedLeft");function F(){o({id:f,services:[...m,...x]});g([])}r(F,"handleAllLeft");return(0,i.jsxs)(p.default,{container:true,spacing:2,justifyContent:"center",alignItems:"center",children:[(0,i.jsx)(p.default,{item:true,children:G(m)}),(0,i.jsx)(p.default,{item:true,children:(0,i.jsxs)(p.default,{container:true,direction:"column",alignItems:"center",children:[(0,i.jsx)(b.default,{sx:{my:.5},variant:"outlined",size:"small",onClick:()=>F(),disabled:x.length===0,"aria-label":"move all left",children:"\u226A"}),(0,i.jsx)(b.default,{sx:{my:.5},variant:"outlined",size:"small",onClick:()=>q(),disabled:S.length===0,"aria-label":"move selected left",children:"<"}),(0,i.jsx)(b.default,{sx:{my:.5},variant:"outlined",size:"small",onClick:()=>O(),disabled:I.length===0,"aria-label":"move selected right",children:">"}),(0,i.jsx)(b.default,{sx:{my:.5},variant:"outlined",size:"small",onClick:()=>D(),disabled:m.length===0,"aria-label":"move all right",children:"\u226B"})]})}),(0,i.jsx)(p.default,{item:true,children:G(x)})]})}r(V,"SandboxTransferList");var W=(0,y.inject)("stores","actions")((0,y.observer)(V));
