"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[42858],{806368(e,n,t){t.d(n,{$5:()=>c,gT:()=>m,kW:()=>A,uK:()=>u,uu:()=>o});var i=t(487763),a=t(571766),s=t(29472),l=t(774366),r=t(588710),d=t(905233);const o=(e={},n={})=>(0,s.t9)(r.A2,r.lT,e,{...n,idField:r.RR}),c=e=>(0,s.vB)(a.aC,null,null,l.A.POST,r.FC,{},e,{fetchConfig:{getAllPostData:!0}}),A=e=>(0,s.vB)(a.aC,null,null,l.A.PUT,r.AU.replace(r.w4,e[d.d5.ID]),{},(0,i.A)(e,[d.d5.ID]),{fetchConfig:{getAllPostData:!0}}),u=e=>(0,s.vB)(a.aC,null,null,l.A.DELETE,r._U.replace(r.w4,e[d.Xs.ID]),{},(0,i.A)(e,[d.Xs.ID]),{}),m=e=>(0,s.vB)(a.aC,null,null,l.A.POST,r.Qw.replace(r.w4,e[d.nr.MAC]),{},(0,i.A)(e,[d.nr.MAC]),{})},905233(e,n,t){var i,a,s,l,r;t.d(n,{Ko:()=>i,Xs:()=>l,d5:()=>s,iV:()=>a,nr:()=>r}),function(e){e._ID="_id",e.NAME="name",e.MEMBER_DEVICE_MACS="member_device_macs"}(i||(i={})),function(e){e.NAME="name",e.MEMBER_DEVICE_MACS="member_device_macs"}(a||(a={})),function(e){e.ID="id",e.NAME="name",e.DEVICE_MAC_ADDITIONS="device_mac_additions",e.DEVICE_MAC_REMOVALS="device_mac_removals"}(s||(s={})),function(e){e.ID="id"}(l||(l={})),function(e){e.MAC="mac",e.DEVICE_TAG_ADDITIONS="device_tag_additions",e.DEVICE_TAG_REMOVALS="device_tag_removals"}(r||(r={}))},588710(e,n,t){t.d(n,{A2:()=>a,AU:()=>A,FC:()=>o,Qw:()=>c,RR:()=>s,_U:()=>u,lT:()=>d,w4:()=>l});var i=t(290454);const a="deviceTags",s="_id",l=`:${s}:`,r=`${i.w}/device-tags`,d=r,o=r,c=`${r}/device-tag-assignment/${l}`,A=`${r}/${l}`,u=`/v2/api/device-tags/${l}`},639197(e,n,t){t.d(n,{_:()=>d});var i=t(222102),a=t(656466),s=t(401042),l=t(806368);const r=(0,a.uh)((0,l.uu)()),d=(0,i.Mz)(r,s.kh)},368618(e,n,t){t.d(n,{Ai:()=>l,Ar:()=>r,Qv:()=>d,ZP:()=>o,aY:()=>s,p6:()=>a});var i=t(634002);const a="alarm-manager",s="control-plane",l=`${s}/integrations`,r=`${s}/backups`,d="admins",o=Object.values(i.Kr)},840557(e,n,t){t.d(n,{XU:()=>m,YQ:()=>E,aB:()=>u,g0:()=>I,jO:()=>_,tx:()=>A,yB:()=>c,yE:()=>M,zn:()=>h});var i=t(222102),a=t(947414),s=t(976458),l=t(634002),r=t(760417),d=t(368618);const o=(0,i.Mz)(s.kb,e=>e[l.C2.SWAI_ROUTES]||[]),c=(0,i.Mz)(o,e=>e.filter(e=>d.ZP.every(n=>!e[r.rR.PATH].startsWith(n)))),A=(0,i.Mz)(c,e=>e.filter(e=>!e[r.rR.IS_HIDDEN])),u=(0,i.Mz)(o,e=>e.filter(e=>e[r.rR.PATH].startsWith(l.Kr.SETTINGS))),m=(0,i.Mz)(u,e=>e.filter(e=>!e[r.rR.IS_HIDDEN])),E=(0,i.Mz)(o,e=>e.filter(e=>e[r.rR.PATH].startsWith(l.Kr.SYSLOG))),_=(0,i.Mz)(E,e=>e.filter(e=>!e[r.rR.IS_HIDDEN])),C=e=>(0,i.Mz)(o,n=>n.some(n=>n[r.rR.PATH].includes(e)&&!n[r.rR.IS_HIDDEN])),M=(0,i.Mz)(C(d.aY),e=>e),h=(0,i.Mz)(C(d.p6),e=>e),I=(0,i.Mz)(s.nx,e=>e[l.Y7.ROUTES_ADAPTER]||{[r.bh.ROUTES]:[],[r.bh.ADD_ROUTES_LISTENER]:a.P1,[r.bh.REMOVE_ROUTES_LISTENER]:a.P1,[r.bh.ON_ROUTE_CONTAINER_ADDED]:a.P1,[r.bh.ON_ROUTE_CONTAINER_REMOVED]:a.P1})},431682(e,n,t){t.d(n,{A:()=>A});var i=t(274934),a=t(247816),s=t(814557),l=t(309130),r=t(419284),d=t(100978),o=t(291508);const c=(0,a.A)(d.A,(0,o.A)("color"))`
  border-radius: ${s.Ay["desktop-radius-infinity"]};
  background: ${({color:e,theme:{themeName:n}})=>(0,r.b_)(e||s.Ay[`desktop-color-ublue-06-${n}`],.1)};
  padding: 2px ${l.kc};
`,A=({children:e,color:n})=>(0,i.jsx)(c,{color:n,children:e})},796091(e,n,t){t.d(n,{A:()=>r});var i=t(274934),a=t(833466),s=t(309130),l=t(100978);const r=e=>(0,i.jsx)(l.A,{paddingTop:s.YC,paddingBottom:s.YC,gap:s.Ln,rowGap:s.YC,flexWrap:"wrap",minHeight:a.b,alignItems:"center",...e})},89469(e,n,t){t.d(n,{A:()=>r});var i=t(274934),a=t(602086),s=t(309130),l=t(100978);const r=(0,a.forwardRef)((e,n)=>(0,i.jsx)(l.A,{ref:n,flexDirection:"column",gap:s.kc,width:"100%",...e}))},376892(e,n,t){t.d(n,{A:()=>l});var i=t(274934),a=t(938984),s=t(470070);const l=({id:e,children:n,values:t})=>(0,i.jsxs)(a.A,{color:"text-1",weight:"bold",size:"medium",children:[e?(0,i.jsx)(s.sA,{id:e,values:t}):null,n]})},795928(e,n,t){t.d(n,{qF:()=>K,UH:()=>F,Ay:()=>H});var i=t(274934),a=t(977872),s=t(602086),l=t(843871),r=t(247816),d=t(938984),o=t(950804),c=t(772754),A=t(309130),u=t(120197),m=t(100978),E=t(535322),_=t(205521),C=t(470070),M=t(956978),h=t(431682),I=t(570801),O=t(244745),v=t(843615),N=t(7130),p=t(623737),x=t(291157),D=t(954702),T=t(642687),b=t(244081),j=t(571766),g=t(611602),f=t(724081),S=t(897396),R=t(89469),k=t(639197),y=t(588710),P=t(905233),w=t(806368);const L=(0,r.A)(m.A)`
  flex-direction: column;
  > button {
    justify-content: flex-start;
    width: fit-content;
  }
  gap: ${A.kc};
`,V=(0,r.A)(m.A)`
  align-items: center;
  gap: ${A.kc};
`,B=({mac:e})=>{const n=(0,a.wA)(),[t,l]=(0,s.useState)(!1),[r,d]=(0,s.useState)(""),[o,A]=(0,s.useState)(!1),[u,m]=(0,s.useState)(!1),E=(0,a.d4)(k._),_=(0,s.useMemo)(()=>E.map(({[P.Ko.NAME]:e})=>e),[E]),M=(0,a.d4)(c.Qu),h=(0,s.useMemo)(()=>E.map(e=>({value:e[P.Ko._ID],label:e[P.Ko.NAME]})),[E]),I=(0,s.useMemo)(()=>E.reduce((n,t)=>(t[P.Ko.MEMBER_DEVICE_MACS].includes(e)&&n.push(t[P.Ko._ID]),n),[]),[E,e]),O=(0,s.useCallback)(t=>{n((0,w.gT)({[P.nr.MAC]:e,...(({added:e,removed:n})=>({[P.nr.DEVICE_TAG_ADDITIONS]:e,[P.nr.DEVICE_TAG_REMOVALS]:n}))((0,g.qk)(I,t))})).then(()=>{n((0,w.uu)()),l(!1)})},[n,I,e]),B=(0,s.useCallback)(e=>{l(e)},[]),F=(0,s.useCallback)(e=>()=>{e(),d("")},[]),z=(0,s.useCallback)(()=>{n((0,w.$5)({[P.iV.NAME]:r,[P.iV.MEMBER_DEVICE_MACS]:[e]})).then(e=>{n({type:j.xk,meta:{model:y.A2,extend:!0,fetchTime:Date.now(),id:e[P.Ko._ID],idField:y.RR},payload:{data:e}}),l(!1),d("")})},[n,e,r]),$=(0,s.useCallback)(({close:e})=>(0,i.jsxs)(V,{children:[(0,i.jsx)(T.A,{variant:"tertiary-neutral",onPress:F(e),children:(0,i.jsx)(C.sA,{id:"COMMON_ACTION_CANCEL"})}),(0,i.jsx)(T.A,{onPress:z,isDisabled:!r||o||u,children:(0,i.jsx)(C.sA,{id:"COMMON_ACTION_SAVE"})})]}),[F,z,r,o,u]),U=(0,s.useCallback)(({target:{value:e}})=>{d(e)},[]);return(0,s.useEffect)(()=>{A(_.includes(r)),m(r.startsWith(" ")||r.endsWith(" "))},[_,r]),(0,f.A)([(0,w.uu)(void 0,{crudCacheStrategy:{type:b.e.CACHE}})],(0,i.jsxs)(L,{children:[E.length?(0,i.jsx)(S.A,{options:h,label:I.length?(0,i.jsx)(C.sA,{id:"COMMON_DEVICE_TAGS"}):void 0,triggerButtonText:"COMMON_ACTION_EDIT",isFullWidth:!0,onChange:O,value:I}):null,M?(0,i.jsxs)(x.A,{isOpen:t,onOpenChange:B,children:[(0,i.jsx)(p.A,{children:(0,i.jsx)(D.A,{type:"button",fontSize:"medium",children:(0,i.jsx)(C.sA,{id:"DEVICE_CREATE_TAG"})})}),(0,i.jsx)(N.A,{actionButtons:$,placement:"bottom left",children:(0,i.jsx)(R.A,{width:300,children:(0,i.jsx)(v.A,{value:r,label:(0,i.jsx)(C.sA,{id:"DEVICE_TAG_NAME"}),variant:"secondary",width:"100%",onChange:U,invalid:o?(0,i.jsx)(C.sA,{id:"COMMON_PLEASE_ENTER_UNIQUE_NAME"}):u?(0,i.jsx)(C.sA,{id:"COMMON_VALIDATION_NO_LEADING_TRAILING_SPACES"}):void 0})})})]}):null]}))},F="general",z=(0,r.A)(m.A)`
  flex-direction: column;
`,$=(0,r.A)("div")`
  margin-bottom: ${A.Ln};
`,U=(0,l.bk)({enableReinitialize:!0,mapPropsToValues:({activeItem:{name:e,mac:n}={}})=>({name:e!==n?e:""}),validationSchema:({maxLength:e=128})=>o.A.object().shape({name:o.A.string().label("COMMON_NAME").max(e)}),handleSubmit:(e,{resetForm:n})=>{n({values:e})}}),K=({isUdmDevice:e,label:n="COMMON_NAME",hideBubbleWrapper:t=!1,hideDeviceTags:l=!1,mac:r})=>{const o=(0,a.d4)(c.JQ),_=(0,a.d4)(c.H2),M=(0,a.d4)(I.Io);return(0,i.jsxs)(z,{children:[(0,i.jsx)(t?s.Fragment:E.A,{children:(0,i.jsx)($,{children:(0,i.jsx)(O.A,{isUdmDevice:e,children:(0,i.jsx)(u.A,{label:n,variant:"secondary",name:"name",full:!0,disabled:e})})})}),o&&_&&!l?(0,i.jsx)(E.A,{type:E.I.ACCORDION,items:[{id:"device-tags",label:(0,i.jsxs)(m.A,{gap:A.YC,alignItems:"center",children:[(0,i.jsx)(C.sA,{id:"COMMON_DEVICE_TAGS"}),M?(0,i.jsx)(h.A,{children:(0,i.jsx)(d.A,{size:"medium",color:"ublue-06",children:(0,i.jsx)(C.sA,{id:"COMMON_FABRIC"})})}):null]}),openByDefault:!0,renderContent:()=>(0,i.jsx)(B,{mac:r})}]}):null]})},H=U(function({activeItem:e,setFormDirty:n,setFormInvalid:t,dirty:l,isValid:r,values:d,resetForm:o,label:c="COMMON_NAME",formName:A=F,hideBubbleWrapper:u=!1,hideDeviceTags:m=!1}){const E=(0,a.wA)(),C=(0,M.D6h)(e);return(0,s.useEffect)(()=>(E((0,_.uo)({[A]:()=>C?{}:d})),E((0,_.Oo)({[A]:()=>o({values:d})})),E((0,_.rW)({[A]:o})),()=>{E((0,_.uo)({[A]:null})),E((0,_.Oo)({[A]:null})),E((0,_.rW)({[A]:null}))}),[E,o,d,C,A]),(0,s.useEffect)(()=>{n(A,l),t(A,!r)},[n,l,t,r,A]),(0,i.jsx)(K,{isUdmDevice:C,label:c,hideBubbleWrapper:u,hideDeviceTags:m,mac:e.mac})})},594492(e,n,t){t.d(n,{A:()=>A});var i=t(274934),a=t(602086),s=t(599110),l=t(247816),r=t(309130),d=t(470070),o=t(291508);const c=(0,l.A)("footer",(0,o.A)("hasFormResetButton"))`
  display: flex;
  justify-content: ${({hasFormResetButton:e})=>e?"space-between":"flex-end"};
  padding: ${r.S2} ${r.fS};
  gap: ${r.kc};
`,A=({allowCancel:e,isDirty:n,isInvalid:t,isSubmitting:l,onFormSubmit:r,onFormReset:o,onFormCancel:A,className:u,submitButtonText:m,customButton:E,applyButton:_,applyButtonFirst:C,hideCancelButton:M,form:h})=>{const I=(0,a.useMemo)(()=>_||(0,i.jsx)(s.A,{name:"submit",variant:"primary",type:"submit",onClick:r,disabled:!n||t||l,form:h,children:(0,i.jsx)(d.sA,{id:m||"COMMON_ACTION_APPLY_CHANGES"})}),[_,h,n,t,l,r,m]);return(0,i.jsxs)(c,{className:u,hasFormResetButton:!!o,children:[C?I:E,M?null:(0,i.jsx)(s.A,{name:"cancel",variant:"default",type:"button",onClick:A,disabled:!e&&!n,children:(0,i.jsx)(d.sA,{id:"COMMON_ACTION_CANCEL"})}),o?(0,i.jsx)(s.A,{name:"reset",variant:"default",type:"button",onClick:o,disabled:!n,children:(0,i.jsx)(d.sA,{id:"COMMON_ACTION_RESET_TO_DEFAULT"})}):null,C?E:I]})}},115114(e,n,t){t.d(n,{A:()=>c});var i=t(274934),a=t(232932),s=t(247816),l=t(409844),r=t(594492);const d=(0,s.A)("div")`
  height: 66px;
`,o=l.AH`
  padding: 0px !important;
`,c=({isDirty:e,onFormSubmit:n,onFormCancel:t,isInvalid:s,...l})=>e?(0,i.jsx)(a.A,{children:(0,i.jsx)(r.A,{isDirty:e,onFormCancel:t,onFormSubmit:n,isInvalid:s,className:o,...l})}):(0,i.jsx)(d,{})},244745(e,n,t){t.d(n,{A:()=>E});var i=t(274934),a=t(977872),s=t(125799),l=t(308371),r=t(43506),d=t(502129),o=t(793442),c=t(470070),A=t(976458),u=t(840557),m=t(368618);const E=({children:e,isUdmDevice:n})=>{const t=(0,a.d4)(u.yE),E=(0,r.A)(m.aY),_=(0,a.d4)(A.TP);return(0,i.jsx)(s.A,{portal:!0,isInteractive:!0,description:n?(0,i.jsx)(c.sA,{id:"DEVICE_PROPERTIES_NAME_LINK_CONTROL_PLANE",values:{link:t?(0,i.jsx)(d.A,{to:E,children:(0,i.jsx)(c.sA,{id:"COMMON_CONTROL_PLANE"})}):(0,i.jsx)(o.A,{href:(0,l.ec)(_),id:"COMMON_CONTROL_PLANE"})}}):null,children:(0,i.jsx)("span",{children:e})})}},378767(e,n,t){t.d(n,{A:()=>l});var i=t(274934),a=t(977872),s=t(897166);const l=({children:e=null})=>(0,a.d4)(s.EL)?null:(0,i.jsx)(i.Fragment,{children:e})},308371(e,n,t){t.d(n,{$H:()=>a,SK:()=>i,ec:()=>s});const i=e=>e.replace("network","ADMINS"),a=e=>e.replace("network","applications"),s=e=>e.replace("network","console-settings")},772754(e,n,t){t.d(n,{As:()=>_,H2:()=>A,JQ:()=>r,Jc:()=>u,Qu:()=>d,cW:()=>m,lQ:()=>o,m7:()=>c,vs:()=>C,zp:()=>E});var i=t(222102),a=t(570801),s=t(167933),l=t(897166);const r=(0,i.Mz)(s.Y8,e=>e),d=(0,i.Mz)(a.Io,a.mn,a.aK,l.dK,l.IX,(e,n,t,i,a)=>e?n||t:i||a),o=(0,i.Mz)(a.Io,a.mn,a.aK,l.dK,l.IX,(e,n,t,i,a)=>e?n||t:i||a),c=(0,i.Mz)(a.Io,a.mn,a.aK,l.dK,l.IX,(e,n,t,i,a)=>e?n||t:i||a),A=(0,i.Mz)(a.Io,a.mn,a.aK,a.$7,l.dK,l.IX,(e,n,t,i,a,s)=>e?n||t||i:a||s),u=(0,i.Mz)(l.EL,e=>!e),m=u,E=u,_=u,C=u}}]);