"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[23776],{151360:(e,t,i)=>{i.d(t,{A:()=>n});const n=(0,i(71479).A)("div",{shouldForwardProp:e=>"hidden"!==e&&"height"!==e})`
  /* Height animation from UIC <Accordion/> */
  transition:
    height 300ms cubic-bezier(0.7, 0, 0.3, 1),
    opacity 100ms ease-in;
  height: ${e=>e.height}px; // cannot animate to height: auto
  opacity: 1;
  ${e=>e.hidden&&"\n    visibility: hidden;\n    height: 0;\n    min-height: unset;\n    opacity: 0;\n  "}
`},224948:(e,t,i)=>{i.d(t,{A:()=>E});var n=i(296540),s=i(217439),a=i(71479),c=i(566723),l=i(294303),r=i(689965);const d=(0,a.A)("div")`
  margin-right: ${c.kc};
`,o=(0,a.A)("div")`
  margin-left: ${c.kc};
`,E=({icon:e,closeIcon:t,nested:i,children:a,...c})=>n.createElement(r.A,{nested:i,...c},n.createElement(l.A,null,n.createElement(d,null,e),n.createElement(s.A,{size:"medium"},a),t?n.createElement(o,null,t):null))},323572:(e,t,i)=>{i.d(t,{TG:()=>E,Ve:()=>d,Yl:()=>C,x_:()=>_,zK:()=>A,us:()=>I,jk:()=>h,p5:()=>u,RZ:()=>r,rA:()=>m,gM:()=>g,NA:()=>o,_F:()=>T});var n=i(691189),s=i(736318),a=i(294201),c=i(87485);const l="/api/s/{site}/cmd/sitemgr",r=(e={},t={})=>(0,n.t9)("autoIpsec","/v2/api/vpn/auto/sites",e,{idField:"id",...t}),d=e=>(0,n.Xj)(a.A.ADD_SITE_VPN,l,e),o=e=>(0,n.Xj)(a.A.REBUILD_SITE_VPN,l,e),E=e=>(0,n.Xj)(a.A.ADD_SITE,l,{desc:e}),m=e=>(0,n.Xj)(a.A.IMPORT_SITE,s.g1,{site_desc:e.newSiteName,backup_id:e.importedSiteId}),u=()=>(0,n.Xj)(a.A.EXPORT_SITE,s.g1),_=e=>(0,n.Xj)(a.A.DELETE_SITE,l,{site:e}),A=(e,t={})=>(0,n.Xj)(a.A.DELETE_SITE_VPN,l,{site:e.remote_site_id,name:e.name},t),h=(e,t={})=>(0,n.Xj)(a.A.ENABLE_SITE_VPN,l,{site:e.site,name:e.name},t),I=(e,t={})=>(0,n.Xj)(a.A.DISABLE_SITE_VPN,l,{site:e.site,name:e.name},t),T=e=>(0,n.Xj)(a.A.UPDATE_SITE,l,{desc:e}),C=(e,t={})=>(0,n.Xj)(a.A.DELETE_DEVICE,l,{macs:[].concat(e)},{...(0,c.rk)("COMMON_COMMAND_DELETE_DEVICE_TOAST_ERROR",{count:[].concat(e).length}),...t}),g=(e,t,i={})=>(0,n.Xj)(a.A.MOVE_DEVICE,l,{mac:e,site:t},i)},923776:(e,t,i)=>{i.r(t),i.d(t,{default:()=>f});var n=i(469733),s=i(296540),a=i(927099),c=i(617147),l=i(162420),r=i(742920),d=i(224948),o=i(151360),E=i(845030),m=i(675359),u=i(126457),_=i(699784),A=i(87485),h=i(83344),I=i(323572),T=i(602021),C=i(171073),g=i(822336),p=i(892145),S=i(238761),O=i(71479);const N="site-radio",v=(0,O.A)(S.A)`
  margin: 10px 0;

  max-height: 192px;
  overflow-y: auto;

  &::-webkit-scrollbar-thumb {
    /* Workaround to fix missing scrollbar if too many entries (~100+) */
    min-height: 20px;
  }

  .${N} {
    border-radius: ${g.Ay["desktop-radius-base"]};
    padding-left: 6px;
    padding-right: 6px;
  }
`,D=({sites:e,selectedSiteId:t,onSelect:i})=>{const[n,a]=(0,s.useState)(),c=(0,s.useMemo)(()=>e.filter(({desc:e})=>!n||e?.toLowerCase().includes(n.toLowerCase())).map(({desc:e,_id:n})=>({children:e,id:n,onChange:()=>i(n),checked:n===t,className:N})),[i,n,t,e]);return s.createElement(s.Fragment,null,e.length>6?s.createElement(p.A,{variant:"secondary",full:!0,value:n,onChange:(e,t)=>{a(t)},onClear:()=>{a(void 0)}}):null,s.createElement(v,{items:c,variant:"list",spacing:"flush"}))},k=(e,t)=>t.find(({_id:t})=>e===t),f=({mac:e,deviceName:t})=>{const i=(0,n.useDispatch)(),[g,p]=(0,s.useState)(null),S=(0,n.useSelector)(T.Gd),O=(0,n.useSelector)(T.n),N=(0,s.useCallback)(e=>{const t=k(e,O);t?e!==g?._id&&p(t):p(null)},[g,O]),v=(0,s.useCallback)(()=>{i((0,u.AS)())},[i]),f=(0,s.useCallback)(async()=>{if(!g)return;const n=k(g._id,O);if(!n)return i((0,m.ox)({type:r.C.danger,message:"DEVICE_ACTIONS_MOVE_ERROR_SITE_DOES_NOT_EXIST",values:{siteDesc:g.desc,deviceName:t}})),void v();const{failureToast:s}=(0,A.rk)("DEVICE_ACTIONS_MOVE_ERROR",{deviceName:t,siteDesc:n.desc});i((0,I.gM)(e,n._id)).then(()=>{i((0,C.XL)(e)),i((0,h.W)(e)),i((0,E.K5)()),v()}).catch(e=>i((0,m.ox)(s(null,e))))},[i,e,g,O,t,v]),V=(0,s.useMemo)(()=>[{type:"button",text:s.createElement(_.sA,{id:"COMMON_ACTION_CANCEL"}),onClick:v},{type:"button",text:s.createElement(_.sA,{id:"DEVICE_MOVE_TO_SITE_ACTION"}),onClick:f,variant:"primary",disabled:!g}],[v,f,g]),b=(0,s.useMemo)(()=>O.filter(e=>{return i=S,!((t=e)._id===i._id&&t.desc===i.desc);var t,i}),[S,O]);return s.createElement(c.A,{title:s.createElement(_.sA,{id:"DEVICE_ACTIONS_MOVE_TO_SITE"}),size:"small",onRequestClose:v,actions:V,isOpen:!0,allowOverflow:!0},s.createElement(D,{sites:b,selectedSiteId:g?._id,onSelect:N}),s.createElement(o.A,{hidden:!g,height:76},s.createElement(d.A,{icon:s.createElement(l.A,{variant:"twoTone",isActive:!0}),nested:!0},s.createElement(a.A,{size:"caption"},g?s.createElement(_.sA,{id:"DEVICE_MOVE_WARNING",values:{siteDesc:g.desc}}):null))))}}}]);