"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[30606],{815879(e,t,i){i.d(t,{A:()=>a});var n=i(602086),r=i(141992);const a=(0,i(272338).w)(e=>(0,n.createElement)("svg",(0,r.d)({viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em"},e),(0,n.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 3a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1H4Zm8 8a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-4Z",fill:"currentColor",className:e.twotonedclassname}),(0,n.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 4h4v4H4V4ZM3 4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4Zm9 8h4v4h-4v-4Zm-1 0a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1v-4Zm1.854-4.854L11.707 6H16v3.5a.5.5 0 0 0 1 0v-4a.5.5 0 0 0-.5-.5h-4.793l1.147-1.146a.5.5 0 0 0-.708-.708l-2 2a.5.5 0 0 0 0 .708l2 2a.5.5 0 0 0 .708-.708ZM8.293 15H3.5a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 1 0V14h4.293l-1.147-1.146a.5.5 0 0 1 .708-.708l2 2a.5.5 0 0 1 0 .708l-2 2a.5.5 0 0 1-.708-.708L8.293 15Z",fill:"currentColor",className:e.baseclassname}),(0,n.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 3a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1H4Zm7 9a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1v-4Zm1.854-4.854L11.707 6H16v3.5a.5.5 0 0 0 1 0v-4a.5.5 0 0 0-.5-.5h-4.793l1.147-1.146a.5.5 0 0 0-.708-.708l-2 2a.5.5 0 0 0 0 .708l2 2a.5.5 0 0 0 .708-.708ZM8.293 15H3.5a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 1 0V14h4.293l-1.147-1.146a.5.5 0 0 1 .708-.708l2 2a.5.5 0 0 1 0 .708l-2 2a.5.5 0 0 1-.708-.708L8.293 15Z",fill:"currentColor",className:e.fillclassname})))},258978(e,t,i){var n;i.d(t,{d:()=>n}),function(e){e.DOMAIN="DOMAIN",e.INTERNET="INTERNET",e.IP="IP",e.REGION="REGION"}(n||(n={}))},287196(e,t,i){i.d(t,{g:()=>s});var n=i(222102),r=i(430328),a=i(34118);const s=(0,r.WY)()((0,n.Mz)(a.GB,e=>e.reduce((e,t)=>("mac"in t&&e.push({mac:t.mac,ip:t.ip,display_name:t.display_name,network_id:t.network_id,oui:t.oui,fingerprint:t.fingerprint,type:t.type,unifi_device_info:t.unifi_device_info,is_wired:t.is_wired,hostname:t.hostname}),e),[])),e=>e)},535322(e,t,i){i.d(t,{A:()=>A,I:()=>n});var n,r=i(274934),a=i(814557),s=i(158885),d=i(247816),l=i(565527),o=i(309130),c=i(100978),m=i(291508);!function(e){e.ACCORDION="accordion",e.BUTTON_LIST="buttonList"}(n||(n={}));const h=(0,d.A)(c.A,(0,m.A)("marginBottom","isButtonList","margin","flex","width","padding","nested","background"))`
  background-color: ${({background:e,nested:t,theme:{themeName:i}})=>e||a.Ay[i===l.S.DARK?`desktop-color-neutral-${t?"00":"01"}-${l.S.DARK}`:`desktop-color-neutral-${t?"01":"00"}-${l.S.LIGHT}`]};
  padding: ${({isButtonList:e,padding:t})=>t||(e?`0 ${o.Ln}`:o.Ln)};
  margin-bottom: ${({marginBottom:e})=>e||o.Ln};
  ${({margin:e})=>e?`margin: ${e};`:""}
  border-radius: 8px;
  flex-direction: column;
  width: ${({width:e="100%"})=>e};
  flex: ${({flex:e=0})=>e};
  > :last-child {
    margin-bottom: 0;
  }
  thead {
    tr {
      height: 32px !important;
    }
    th {
      text-transform: none;
    }
  }
  ${({isButtonList:e})=>e?`\n    > div {\n      display: flex;\n      height: 48px;\n      border-bottom: ${({theme:{themeName:e}})=>a.Ay[`desktop-border-divider-${e}`]};\n      &:last-child {\n        border-bottom: none;\n      }\n    }\n  `:""}
`,u=(0,d.A)(s.A,(0,m.A)("marginBottom","margin","flex","padding","nested","background"))`
  background-color: ${({background:e,nested:t,theme:{themeName:i}})=>e||a.Ay[i===l.S.DARK?`desktop-color-neutral-${t?"00":"01"}-${l.S.DARK}`:`desktop-color-neutral-${t?"01":"00"}-${l.S.LIGHT}`]};
  margin-bottom: ${({theme:e,marginBottom:t})=>t||e.spacing["spacing-l"]};
  ${({margin:e})=>e?`margin: ${e};`:""}
  ${({padding:e})=>e?`padding: ${e};`:""}
  border-radius: 8px;
  flex-direction: column;
  flex: ${({flex:e=0})=>e};
  > :last-child {
    margin-bottom: 0;
  }
  thead {
    tr {
      height: 32px !important;
    }
    th {
      text-transform: none;
    }
  }
  > li {
    > div:first-child {
      background: ${({background:e,theme:{themeName:t}})=>e||a.Ay[t===l.S.DARK?`desktop-color-neutral-01-${l.S.DARK}`:`desktop-color-neutral-00-${l.S.LIGHT}`]};
      height: 48px;
      padding: 0 ${o.Ln};
    }
    > div:nth-child(2) {
      margin-bottom: 0;
      padding: 0;
      > div {
        padding: 0 ${o.Ln} ${o.Ln};
      }
    }
  }
`,A=({type:e,marginBottom:t,margin:i,padding:a,flex:s,width:d,nested:l,...o})=>"items"in o?(0,r.jsx)(u,{marginBottom:t,margin:i,padding:a,flex:s,nested:l,...o}):(0,r.jsx)(h,{nested:l,width:d,marginBottom:t,margin:i,padding:a,flex:s,isButtonList:e===n.BUTTON_LIST,...o,children:o.children})},737364(e,t,i){i.d(t,{A:()=>h});var n=i(274934),r=i(599110),a=i(309130),s=i(580988),d=i(100978),l=i(470070),o=i(421314),c=i(300626),m=i(174710);const h=({enabled:e,label:t,tooltipItems:i,neverShowListMarkers:h,limit:u=20,seeMoreCallback:A,isInteractive:g,title:p,showMatchOppositeIcon:M,listGap:O,iconProps:N})=>(0,n.jsxs)(d.A,{flex:1,overflow:"hidden",gap:a.YC,children:[M?(0,n.jsx)(s.A,{enabled:e}):null,(0,n.jsx)(c.A,{tooltip:(0,n.jsx)(m.A,{title:p,position:"top",isInteractive:Boolean(A)||g,items:i,showListMarkers:!h,maxItemCount:u,getItemKey:(e,t)=>t,renderItem:e=>e,listGap:O,renderShowMore:A?()=>(0,n.jsx)(r.A,{variant:"inline",onClick:A,children:(0,n.jsx)(l.sA,{id:"COMMON_SEE_MORE"})}):void 0,iconProps:N}),children:t?(0,n.jsx)(o.A,{color:e?"inherit":"disabled",children:t}):null})]})},174710(e,t,i){i.d(t,{A:()=>s});var n=i(274934),r=i(304151),a=i(158498);const s=function({items:e,getItemKey:t,renderItem:i,maxItemCount:s,renderShowMore:d,showListMarkers:l,title:o,position:c,isInteractive:m,cursorType:h,listGap:u,iconProps:A}){return(0,n.jsx)(r.A,{title:o,position:c,isInteractive:m,cursorType:h,description:(0,n.jsx)(a.A,{items:e,getItemKey:t,renderItem:i,maxItemCount:s,listGap:u,renderShowMore:d,showListMarkers:l}),iconProps:A})}},580988(e,t,i){i.d(t,{A:()=>o});var n=i(274934),r=i(125799),a=i(815879),s=i(309130),d=i(100978),l=i(470070);const o=({enabled:e})=>(0,n.jsx)(d.A,{opacity:e?void 0:s.xN,children:(0,n.jsx)(r.A,{description:(0,n.jsx)(l.sA,{id:"COMMON_MATCH_OPPOSITE"}),portal:!0,children:(0,n.jsx)(a.A,{size:"original"})})})},300626(e,t,i){i.d(t,{A:()=>s});var n=i(274934),r=i(309130),a=i(100978);const s=({children:e,tooltip:t})=>(0,n.jsxs)(a.A,{maxWidth:"100%",overflow:"hidden",gap:r.YC,alignItems:"center",children:[e?(0,n.jsx)(a.A,{flex:1,overflow:"hidden",children:e}):null,t]})},668336(e,t,i){i.d(t,{Ay:()=>A,JC:()=>u,nk:()=>h});var n=i(274934),r=i(309130),a=i(737364),s=i(470070),d=i(258978),l=i(887481),o=i(638644),c=i(100978),m=i(86635);const h={[d.d.INTERNET]:"COMMON_INTERNET",[d.d.DOMAIN]:"COMMON_DOMAINS",[d.d.IP]:"COMMON_IP_ADDRESSES",[d.d.REGION]:"COMMON_REGIONS"},u=e=>(0,n.jsxs)(c.A,{gap:r.YC,alignItems:"center",children:[(0,n.jsx)(m.A,{countryCode:e,width:16,height:16,style:{borderRadius:2,objectFit:"cover"}}),(0,l.qQ)(e.toUpperCase())]}),A=({route:e})=>{const{formatMessage:t}=(0,s.tz)(),i=(e=>{switch(e.matching_target){case d.d.INTERNET:return[];case d.d.DOMAIN:return e.domains.flatMap(e=>e.domain);case d.d.IP:return[...e.ip_addresses.flatMap(e=>e.ports.length>0?`${e.ip_or_subnet}:${e.ports.join(",")}`:`${e.ip_or_subnet}`),...e.ip_ranges.flatMap(e=>`${e.ip_start} - ${e.ip_stop}`)];case d.d.REGION:return e.regions.map(u);default:return[]}})(e);return 1===i.length?(0,n.jsx)(o.A,{enabled:e.enabled,children:i[0]}):i.length>1?(0,n.jsx)(a.A,{neverShowListMarkers:e.matching_target===d.d.REGION,enabled:e.enabled,label:`${i.length} ${t({id:h[e.matching_target]})}`,tooltipItems:i,limit:5}):(0,n.jsx)(o.A,{enabled:e.enabled,children:(0,n.jsx)(s.sA,{id:"COMMON_ANY"})})}},439937(e,t,i){i.d(t,{A:()=>d});var n=i(274934),r=i(977872),a=i(197571);const s=(e,t)=>t.find(t=>t._id===e)?.name,d=({network_id:e})=>(0,n.jsx)(n.Fragment,{children:s(e,(0,r.d4)(a.Ct))})},961906(e,t,i){i.d(t,{gE:()=>d,gI:()=>a,vi:()=>s});var n=i(556059),r=i(258978);const a={[r.d.DOMAIN]:"COMMON_DOMAIN",[r.d.INTERNET]:"COMMON_INTERNET",[r.d.IP]:"COMMON_IP_ADDRESS",[r.d.REGION]:"COMMON_REGION"},s=(e,t,i,r)=>{if(i.target_devices.some(e=>e.type===n.Q.ALL_CLIENTS)||!i.target_devices?.length)return 1;if(r.target_devices.some(e=>e.type===n.Q.ALL_CLIENTS)||!r.target_devices?.length)return-1;const a=i.target_devices?.length,s=r.target_devices?.length;return a===s?0:a>s?1:-1},d=(e,t,i,n)=>{if(i?.matching_target===r.d.INTERNET)return 1;if(n?.matching_target===r.d.INTERNET)return-1;const a=(i?.domains?.length||0)+(i?.ip_addresses?.length||0)+(i?.ip_ranges?.length||0)+(i?.regions?.length||0),s=(n?.domains?.length||0)+(n?.ip_addresses?.length||0)+(n?.ip_ranges?.length||0)+(n?.regions?.length||0);return a===s?0:a>s?1:-1}},376892(e,t,i){i.d(t,{A:()=>s});var n=i(274934),r=i(938984),a=i(470070);const s=({id:e,children:t,values:i})=>(0,n.jsxs)(r.A,{color:"text-1",weight:"bold",size:"medium",children:[e?(0,n.jsx)(a.sA,{id:e,values:i}):null,t]})},828196(e,t,i){i.d(t,{A:()=>c});var n=i(274934),r=i(938984),a=i(95032),s=i(247816),d=i(470070),l=i(664092);const o=(0,s.A)(r.A)`
  white-space: nowrap;
`,c=({id:e,color:t,values:i,children:r})=>(0,n.jsxs)(l.A,{children:[(0,n.jsx)(o,{color:"text-2",size:"medium",children:(0,n.jsx)(d.sA,{id:e,values:i})}),(0,n.jsx)(a.A,{color:t||"text-3",size:"medium",isTruncated:!0,children:r})]})},664092(e,t,i){i.d(t,{A:()=>o});var n=i(274934),r=i(247816),a=i(309130),s=i(100978),d=i(291508);const l=(0,r.A)(s.A,(0,d.A)("valueMaxWidth","keyMinWidth","compact"))`
  &:not(:last-child) {
    ${({compact:e})=>e?"":`margin-bottom: ${a.kc};`}
  }
  & > {
    &:nth-child(1) {
      min-width: ${({keyMinWidth:e})=>e}px;
    }
    &:nth-child(2) {
      max-width: ${({valueMaxWidth:e})=>e}px;
    }
  }
`,o=({children:e,valueMaxWidth:t=215,keyMinWidth:i=0,flexProps:r={},compact:s=!1})=>(0,n.jsx)(l,{width:"100%",justifyContent:"space-between",gap:a.kc,height:s?void 0:24,valueMaxWidth:t,keyMinWidth:i,compact:s,...r,children:e})},230606(e,t,i){i.r(t),i.d(t,{default:()=>F});var n,r=i(274934),a=i(977872),s=i(792929),d=i(112104),l=i(376892),o=i(535322),c=i(556059),m=i(423564),h=i(197571),u=i(938984),A=i(95032),g=i(470070);!function(e){e.NAME="name",e.SUBNET="subnet"}(n||(n={}));const p=[{id:n.NAME,label:(0,r.jsx)(g.sA,{id:"COMMON_NAME"}),renderCell:({name:e})=>(0,r.jsx)(A.A,{size:"medium",color:"inherit",isTruncated:!0,children:e})},{id:n.SUBNET,label:(0,r.jsx)(g.sA,{id:"COMMON_SUBNET"}),renderCell:({subnet:e})=>(0,r.jsx)(u.A,{size:"medium",color:"inherit",children:e})}],M=({trafficRoute:e})=>{const t=(0,a.d4)(h.WT),i=e.target_devices.filter(e=>e.type===c.Q.NETWORK).map(e=>{const i=t.find(t=>t._id===e.network_id);return i?{name:i.name,subnet:(0,m.mC)(i)}:void 0}).filter(Boolean),{rowLimit:n,renderFooter:u}=(0,d.A)(i.length,{label:{singular:"COMMON_NETWORK",plural:"COMMON_NETWORKS"},defaultCount:10});return i.length?(0,r.jsx)(o.A,{type:o.I.ACCORDION,items:[{id:"source-networks",openByDefault:!0,label:(0,r.jsx)(l.A,{id:"COMMON_SOURCE_NETWORKS"}),renderContent:()=>(0,r.jsx)(s.A,{items:i,disableColumnFilters:!0,disableTextPointer:!0,idField:"name",disableSort:!0,truncateHeaderCells:!0,columns:p,rowOffset:0,rowLimit:n,renderFooter:()=>u})}]}):null};var O,N=i(309130),_=i(100978),x=i(650632),C=i(287196),I=i(831433);!function(e){e.NAME="name",e.MAC="mac"}(O||(O={}));const f=[{id:O.NAME,label:(0,r.jsx)(g.sA,{id:"COMMON_NAME"}),renderCell:({name:e})=>(0,r.jsx)(u.A,{size:"medium",color:"inherit",children:e})},{id:O.MAC,label:(0,r.jsx)(g.sA,{id:"COMMON_MAC_ADDRESS"}),renderCell:({mac:e})=>(0,r.jsx)(u.A,{size:"medium",color:"inherit",children:e||(0,r.jsx)(g.sA,{id:"COMMON_FALLBACK"})})}],E=({trafficRoute:e})=>{const t=(0,a.d4)(C.g),i=e.target_devices.filter(e=>e.type===c.Q.CLIENT).map(e=>{const i=t.find(t=>t.mac===e.client_mac);if(i)return{name:(0,r.jsxs)(_.A,{gap:N.YC,alignItems:"center",children:[(0,r.jsx)(x.A,{client:i,height:20,width:20}),(0,I.tn)(i)]}),mac:i.mac}}).filter(Boolean),{rowLimit:n,renderFooter:m}=(0,d.A)(i.length,{label:{singular:"COMMON_DEVICE",plural:"COMMON_DEVICES"},defaultCount:10});return i.length?(0,r.jsx)(o.A,{type:o.I.ACCORDION,items:[{id:"source-clients",openByDefault:!0,label:(0,r.jsx)(l.A,{id:"COMMON_SOURCE_DEVICES"}),renderContent:()=>(0,r.jsx)(s.A,{items:i,disableColumnFilters:!0,disableTextPointer:!0,idField:"mac",disableSort:!0,columns:f,rowOffset:0,rowLimit:n,truncateHeaderCells:!0,renderFooter:()=>m})}]}):null};var v=i(599110),j=i(590979),b=i(449339),T=i(961906),R=i(439937),w=i(205521),S=i(258978),L=i(828196);const $=({trafficRoute:{_id:e,matching_target:t,network_id:i}})=>{const n=(0,a.wA)();return(0,r.jsxs)(o.A,{children:[(0,r.jsx)(L.A,{id:"COMMON_TRAFFIC_TYPE",children:(0,r.jsx)(g.sA,{id:t===S.d.INTERNET?"COMMON_ALL_TRAFFIC":"COMMON_SPECIFIC_TRAFFIC"})}),(0,r.jsx)(L.A,{id:"COMMON_TYPE",children:(0,r.jsx)(g.sA,{id:T.gI[t]})}),(0,r.jsx)(L.A,{id:"COMMON_INTERFACE",children:(0,r.jsx)(R.A,{network_id:i})}),(0,r.jsx)(_.A,{children:(0,r.jsx)(v.A,{type:"button",variant:"inline",onClick:()=>{n((0,w.XP)({type:b.H.POLICY_BASED_ROUTE,id:e}))},...j.A.addDataTestId(j.A.TestId.SIDE_PANEL_TRIGGER),children:(0,r.jsx)(u.A,{size:"medium",color:"inherit",children:(0,r.jsx)(g.sA,{id:"COMMON_VIEW_IN_SETTINGS"})})})})]})};var k,D=i(150025),y=i(668336);!function(e){e.DESTINATION="destination",e.PORT="port"}(k||(k={}));const P=[{id:k.PORT,label:(0,r.jsx)(g.sA,{id:"COMMON_PORT"}),renderCell:({port:e})=>e||(0,r.jsx)(g.sA,{id:"COMMON_FALLBACK"})}],B=({trafficRoute:e})=>{const t=(e=>{switch(e.matching_target){case S.d.INTERNET:return[];case S.d.DOMAIN:return e.domains.flatMap(e=>({destination:e.domain,id:e.domain}));case S.d.IP:return[...e.ip_addresses.flatMap(e=>({destination:e.ip_or_subnet,id:`${e.ip_or_subnet}:${e.ports.join(",")}`,port:e.ports[0]})),...e.ip_ranges.flatMap(e=>({destination:`${e.ip_start} - ${e.ip_stop}`,id:`${e.ip_start} - ${e.ip_stop}`}))];case S.d.REGION:return e.regions.map(e=>({destination:(0,y.JC)(e),id:e}));default:return[]}})(e),{rowLimit:i,renderFooter:n}=(0,d.A)(t.length,{label:{singular:D.g[e.matching_target],plural:y.nk[e.matching_target]},defaultCount:10});return t.length?(0,r.jsx)(o.A,{type:o.I.ACCORDION,items:[{id:"destinations",openByDefault:!0,label:(0,r.jsx)(l.A,{id:"COMMON_DESTINATION"}),renderContent:()=>{return(0,r.jsx)(s.A,{items:t,disableColumnFilters:!0,disableTextPointer:!0,disableSort:!0,columns:[...(a=D.g[e.matching_target],[{id:k.DESTINATION,label:(0,r.jsx)(g.sA,{id:a}),width:250,renderCell:({destination:e})=>e}]),...e.matching_target===S.d.IP?P:[]],rowOffset:0,rowLimit:i,renderFooter:()=>n,truncateHeaderCells:!0});var a}}]}):null},F=({activeItem:e})=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)($,{trafficRoute:e}),(0,r.jsx)(M,{trafficRoute:e}),(0,r.jsx)(E,{trafficRoute:e}),(0,r.jsx)(B,{trafficRoute:e})]})},638644(e,t,i){i.d(t,{A:()=>a});var n=i(274934),r=i(938984);const a=({enabled:e,color:t,children:i,...a})=>(0,n.jsx)(r.A,{color:!1===e?"disabled":t||"inherit",size:"inherit",...a,children:i})},150025(e,t,i){i.d(t,{g:()=>r});var n=i(258978);const r={ALL:"COMMON_ALL",[n.d.DOMAIN]:"COMMON_DOMAIN_NAME",[n.d.IP]:"COMMON_IP_ADDRESS",[n.d.INTERNET]:"COMMON_INTERNET",[n.d.REGION]:"COMMON_REGION"}},112104(e,t,i){i.d(t,{A:()=>c});var n=i(274934),r=i(602086),a=i(938984),s=i(599110),d=i(309130),l=i(100978),o=i(470070);const c=(e,t={})=>{const{formatMessage:i}=(0,o.tz)(),[c,m]=(0,r.useState)(!1),{defaultCount:h,label:{singular:u,plural:A}}=(0,r.useMemo)(()=>({defaultCount:t.defaultCount||6,label:{singular:i({id:t.label?.singular||"COMMON_DEVICE"}),plural:i({id:t.label?.plural||"COMMON_DEVICES"})}}),[t,i]),g=(0,r.useCallback)(()=>{m(e=>!e)},[]);return{rowLimit:e>h&&!c?h:e,renderFooter:e>h?(0,n.jsx)(l.A,{marginTop:d.kc,children:(0,n.jsxs)(a.A,{size:"medium",children:[(0,n.jsx)(o.sA,{id:"COMMON_ADV_TABLE_FOOTER",values:{length:e>h&&!c?h:e,total:e,singular:u,plural:A}}),(0,n.jsxs)(n.Fragment,{children:[" ",(0,n.jsxs)(s.A,{type:"button",variant:"inline",onClick:g,children:[(0,n.jsx)(o.sA,{id:"COMMON_SHOW"})," ",(0,n.jsx)(o.sA,{id:c?"COMMON_LESS":"COMMON_ALL"})]})]})]})}):null,setExpand:m}}}}]);