"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[57569],{27307:(e,a,t)=>{t.d(a,{A:()=>o});var i=t(296540),l=t(313615),n=t(725508),s=t(734707);const o=({name:e,className:a,children:t=null,id:o,iconWidth:r,iconHeight:c,size:d="small",variant:E="link",iconSize:m="medium",Icon:u=n.A,omitIconSvgMargin:_=!1,disabled:A=!1,...T})=>{const I=(0,i.useCallback)(e=>e.currentTarget.parentNode.parentNode.childNodes[0].click(),[]);return i.createElement(l.A,{id:o||e,...T},i.createElement(s.Ay,{name:e,size:d,type:"button",variant:E,wrapClassName:a,onClick:I,Icon:u,iconProps:{omitSvgMargin:_,isActive:!0,...r&&{width:r},...c&&{height:c},disabled:A},iconSize:m,disabled:A},t))}},93710:(e,a,t)=>{t.d(a,{A2:()=>i,RR:()=>n,UE:()=>o,gI:()=>l,iP:()=>r,md:()=>s});const i="sites",l="/v2/api/sites/overview",n="id",s=20;var o;!function(e){e.ASCENDING="ASCENDING",e.DESCENDING="DESCENDING"}(o||(o={}));const r={searchText:"",sortByField:void 0,sortDirection:void 0,pageSize:1e4,pageNumber:0}},155791:(e,a,t)=>{t.d(a,{A:()=>n});var i=t(296540),l=t(629318);const n=(0,t(51946).w)(e=>(0,i.createElement)("svg",(0,l.d)({viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em"},e),(0,i.createElement)("path",{d:"M16 3H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1Z",fill:"currentColor",className:e.twotonedclassname}),(0,i.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m9.633 6.113-2.12 2.121a.5.5 0 1 0 .706.708l1.267-1.268V16.5a.5.5 0 0 0 1 0V7.673l1.268 1.269a.5.5 0 0 0 .707-.708l-2.12-2.121a.502.502 0 0 0-.708 0ZM3 14a1 1 0 0 0 1 1h3v-1H4V4h12v10h-3v1h3a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10Z",fill:"currentColor",className:e.baseclassname}),(0,i.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.962 17.004a.75.75 0 0 1-.75-.75V8.57l-.479.479a.747.747 0 0 1-1.06 0 .75.75 0 0 1 0-1.061L9.44 6.22A.737.737 0 0 1 9.97 6l.072.003a.737.737 0 0 1 .47.217l1.768 1.768a.752.752 0 0 1 .001 1.06.751.751 0 0 1-1.062 0l-.507-.506v7.71a.75.75 0 0 1-.75.75ZM3 14a1 1 0 0 0 1 1h3v-1.5H4.5v-9h11v9H13V15h3a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10Z",fill:"currentColor",className:e.fillclassname})))},323572:(e,a,t)=>{t.d(a,{TG:()=>E,Ve:()=>c,Yl:()=>N,x_:()=>_,zK:()=>A,us:()=>I,jk:()=>T,p5:()=>u,RZ:()=>r,rA:()=>m,gM:()=>v,NA:()=>d,_F:()=>C});var i=t(691189),l=t(736318),n=t(294201),s=t(87485);const o="/api/s/{site}/cmd/sitemgr",r=(e={},a={})=>(0,i.t9)("autoIpsec","/v2/api/vpn/auto/sites",e,{idField:"id",...a}),c=e=>(0,i.Xj)(n.A.ADD_SITE_VPN,o,e),d=e=>(0,i.Xj)(n.A.REBUILD_SITE_VPN,o,e),E=e=>(0,i.Xj)(n.A.ADD_SITE,o,{desc:e}),m=e=>(0,i.Xj)(n.A.IMPORT_SITE,l.g1,{site_desc:e.newSiteName,backup_id:e.importedSiteId}),u=()=>(0,i.Xj)(n.A.EXPORT_SITE,l.g1),_=e=>(0,i.Xj)(n.A.DELETE_SITE,o,{site:e}),A=(e,a={})=>(0,i.Xj)(n.A.DELETE_SITE_VPN,o,{site:e.remote_site_id,name:e.name},a),T=(e,a={})=>(0,i.Xj)(n.A.ENABLE_SITE_VPN,o,{site:e.site,name:e.name},a),I=(e,a={})=>(0,i.Xj)(n.A.DISABLE_SITE_VPN,o,{site:e.site,name:e.name},a),C=e=>(0,i.Xj)(n.A.UPDATE_SITE,o,{desc:e}),N=(e,a={})=>(0,i.Xj)(n.A.DELETE_DEVICE,o,{macs:[].concat(e)},{...(0,s.rk)("COMMON_COMMAND_DELETE_DEVICE_TOAST_ERROR",{count:[].concat(e).length}),...a}),v=(e,a,t={})=>(0,i.Xj)(n.A.MOVE_DEVICE,o,{mac:e,site:a},t)},457569:(e,a,t)=>{t.r(a),t.d(a,{default:()=>f});var i=t(300477),l=t(469733),n=t(296540),s=t(271856),o=t(927099),r=t(438628),c=t(155791),d=t(71479),E=t(132196),m=t(742920),u=t(977178),_=t(566723),A=t(294303),T=t(675359),I=t(126457),C=t(699784),N=t(93710),v=t(734264),p=t(323572),h=t(367370),S=t(721778),O=t(441652),M=t(27307),g=t(705426);const D="upload-site-file",R=(0,d.A)("div")`
  max-width: ${336}px;
  overflow: hidden;
  text-overflow: ellipsis;
`,f=({onClose:e})=>{const{formatMessage:a}=(0,C.tz)(),t=(0,l.useDispatch)(),d=(0,n.useRef)(null),{updateNotification:f}=(0,l.useSelector)(u.o),[w,b]=(0,n.useState)(""),[P,k]=(0,n.useState)(""),[L,V]=(0,n.useState)(null),[x,H]=(0,n.useState)(!1),[U,y]=(0,n.useState)(!1),j=(0,n.useCallback)(()=>{L&&(t((0,O.ho)(L.backup_id)),V(null)),t((0,I.AS)()),e?.()},[e,t,L]),B=(0,n.useCallback)(()=>{d.current&&(d.current.value="")},[]),F=(0,n.useCallback)(({target:{value:e}})=>{b(e)},[b]),X=(0,n.useCallback)((e,l)=>{"current"in l&&(d.current=l.current);const n=d.current?.files[0];if(!n)return;y(!0);const s=n.name||"network_site_file",o=(0,i.A)();t((0,T.ox)({id:o,renderTitle:()=>a({id:"COMMON_UPLOADING_FILES"}),downloads:[{id:D,filename:s,progress:0,status:a({id:"COMMON_FILE_UPLOADING"}),onCancel:()=>{t((0,T.uU)(o)),y(!1),B()}}],duration:0,notificationType:"DownloadsToast"})),t((0,O.kI)(n)).then(e=>{f({id:o,title:a({id:"COMMON_UPLOADED_FILES"}),downloads:[{id:D,files:[{filename:s,progress:100,status:a({id:"COMMON_FILE_UPLOADED"})}],onCancel:()=>{}}],duration:2e3,notificationType:"DownloadsToast"});const i=e?.data?.[0]||{};i.purpose===S.L.APPLICATION_BACKUP?(t((0,T.ox)({icon:m.C.warning,message:"COMMON_SITE_SWITCHER_IMPORT_SITE_BACKUP_UPLOADED"})),L&&t((0,O.ho)(i.backup_id))):(V(i),k(n?.name))}).catch(e=>{t((0,T.uU)(o)),B(),t((0,T.ox)({errorMessage:e.msg,errorValues:{...e,fileName:P},icon:m.C.danger,message:"COMMON_SITE_SWITCHED_IMPORT_SITE_ERROR"}))}).finally(()=>{y(!1)})},[t,P,a,B,f,L]),z=(0,n.useCallback)(()=>{H(!0),t(L?(0,p.rA)({newSiteName:w,importedSiteId:L?.backup_id}):(0,p.TG)(w)).then(()=>{t((0,v.R)(N.iP)),t((0,h.N)())}).catch(()=>{t((0,T.ox)({type:m.C.danger,message:"COMMON_SITE_SWITCHER_ADD_SITE_ERROR",values:{name:w}}))}).finally(()=>{j(),H(!1)})},[t,j,L,w]),G=(0,n.useCallback)(()=>{x||j()},[x,j]);return n.createElement(g.A,{title:n.createElement(C.sA,{id:"COMMON_SITE_SWITCHER_ADD_NEW_SITE"}),onRequestClose:G,size:"small",actions:[{type:"button",text:n.createElement(C.sA,{id:"COMMON_ACTION_CANCEL"}),onClick:j,disabled:x},{type:"button",text:n.createElement(C.sA,{id:"COMMON_ACTION_ADD"}),onClick:z,variant:"primary",disabled:!w||x,loader:x?"loading":void 0}],headerClassName:E.AH`
        svg {
          pointer-events: ${x?"none":"cursor"};
        }
      `},n.createElement(r.A,{full:!0,variant:"secondary",label:a({id:"COMMON_SITE_SWITCHER_SITE_NAME"}),onChange:F,value:w,disabled:x}),n.createElement(A.A,{marginTop:_.xO},n.createElement(s.A,{width:220,description:n.createElement(o.A,{centered:!0},n.createElement(C.sA,{id:"COMMON_SITE_SWITCHER_IMPORT_SITE_TOOLTIP"})),portal:!0},n.createElement(M.A,{name:"import-site",size:"large",variant:"inline",iconSize:"original",Icon:c.A,onChange:X,disabled:U||x},n.createElement(R,null,P.length>0?P:n.createElement(C.sA,{id:"COMMON_SITE_SWITCHER_IMPORT_SITE"}))))))}},725508:(e,a,t)=>{t.d(a,{A:()=>n});var i=t(296540),l=t(629318);const n=(0,t(51946).w)(e=>(0,i.createElement)("svg",(0,l.d)({viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em"},e),(0,i.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 3a1 1 0 0 1 1-1h7a1 1 0 0 1 .707.293l3 3A1 1 0 0 1 16 6v11a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V3Z",fill:"currentColor",className:e.twotonedclassname}),(0,i.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 2a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V6a1 1 0 0 0-.293-.707l-3-3A1 1 0 0 0 12 2H5Zm0 15V3h6.999v2a1 1 0 0 0 1 1h2L15 17H5Z",fill:"currentColor",className:e.baseclassname}),(0,i.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.999 2a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V6a1 1 0 0 0-.293-.707l-3-3A1 1 0 0 0 12 2H5Zm10 4.5h-2.5a1 1 0 0 1-1-1V3L15 6.5Z",fill:"currentColor",className:e.fillclassname})))},734264:(e,a,t)=>{t.d(a,{R:()=>r});var i=t(717905),l=t(691189),n=t(887831),s=t(935822),o=t(93710);const r=({searchText:e,sortByField:a,sortDirection:t,pageSize:r=o.md,pageNumber:c},d={},E={})=>(0,l.sU)(o.A2,o.gI,{data:{searchText:e,sortByField:a,sortDirection:t,pageSize:r,pageNumber:c},...d},{method:n.A.POST,idField:o.RR,fetchConfig:{getAllPostResponse:!0},additionalPayloadSelectors:{[i.bI.PAGE_NUMBER]:{},[i.bI.TOTAL_PAGE_COUNT]:{},[i.bI.TOTAL_ELEMENT_COUNT]:{}},compareFunction:s.G,...E})},935822:(e,a,t)=>{t.d(a,{G:()=>i});const i=({data:e},{data:a})=>e.searchText===a.searchText&&e.sortByField===a.sortByField&&e.sortDirection===a.sortDirection}}]);