(window.webpackJsonpunifiNetworkUi=window.webpackJsonpunifiNetworkUi||[]).push([[14],{2821:function(e,t,a){"use strict";var n=a(0),l=a.n(n),i=a(3),r=a(1671),c=a(5),o=a(34);const s=Object(i.c)(c.a)`
  border-bottom: 1px ${({theme:e})=>e.colors.border} solid;
  box-sizing: border-box;

  @media ${o.a.VIEWPORT_M_UP} {
    padding: 0 ${({theme:e})=>e.space[4]}px;
  }
`,d=Object(i.c)(r.a)`
  bottom: -1px;
`;t.a=({isLoading:e,children:t,...a})=>l.a.createElement(s,Object.assign({},a,{flex:"none",className:"base-control-panel",position:"relative",alignItems:"center",justifyContent:"space-between",height:50}),t,l.a.createElement(d,{isLoading:e,placement:"bottom"}))},2822:function(e,t,a){"use strict";var n=a(0),l=a.n(n),i=a(3),r=a(5),c=a(1),o=a(47),s=a(481),d=a(2821),u=a(2823),m=a(2832),b=a(31),p=a(179);const O=Object(i.c)(o.a,{shouldForwardProp:e=>"addMargin"!==e})`
  font-size: 14px;
  ${({addMargin:e})=>e&&"margin-left: 50%;"}
  position: absolute;
  transform: translateX(-50%);
  left: 50%;
`;t.a=({routes:e=[],hideFilterButton:t=!1,isLoading:a,children:n,filterTitleLabel:i,filtersActive:o,title:v,leftContent:E,isDisplayOptionsDisabled:g})=>{const f=(null==e?void 0:e.length)>1,h=!f&&1===e.length;return l.a.createElement(d.a,{isLoading:a},E&&E,f&&l.a.createElement(u.a,{routes:e}),h&&l.a.createElement(O,{weight:"bold"},e[0].label),v&&l.a.createElement(O,{weight:"bold",addMargin:t&&!E},l.a.createElement(c.b,{id:v})),l.a.createElement(r.a,{height:"100%",flex:f||v||h?"none":1,alignItems:"center",justifyContent:"flex-end",marginLeft:"auto"},n,!t&&l.a.createElement(p.a,{condition:g,wrapper:e=>l.a.createElement(s.a,{position:"bottom",width:"208px",portal:!0,message:l.a.createElement(b.p,null,l.a.createElement(c.b,{id:"COMMON_DISPLAY_OPTS_DISABLED"}))},e)},l.a.createElement(m.a,{disabled:g,filterTitleLabel:i,filtersActive:o}))))}},2823:function(e,t,a){"use strict";var n=a(0),l=a.n(n),i=a(3),r=a(25),c=a(807);var o=({items:e,...t})=>{const{params:a,path:n}=Object(r.n)(),i=Object(r.l)(),o=Object(r.k)(),s=e.find(({path:e})=>e===n)||((e,{pathname:t})=>e.find(({path:e})=>new RegExp(e.replace(/\/:\w+\?.*/g,"/?.*").replace(/:\w+/g,"\\w+").replace(/\//g,"\\$&")).test(t)))(e,i);return l.a.createElement(c.a,Object.assign({tabs:e,selectedTab:null==s?void 0:s.id,onSelectTab:({path:e,params:t={}})=>o.push(Object(r.i)(e,{...a,...t}))},t))};const s=Object(i.c)(o)`
  height: 100%;
  position: absolute;
  left: 0;
  right: 0;
  div,
  button {
    height: 100% !important;
  }
`;t.a=({routes:e})=>{const t=Object(n.useMemo)(()=>e&&e.map(({id:e,label:t,disabled:a,path:n,...l})=>({id:e,label:t,disabled:"function"==typeof a?a(l):a,path:n})),[e]);return t?l.a.createElement(s,{selectedTabBold:!0,items:t}):null}},2824:function(e,t,a){"use strict";a.d(t,"b",(function(){return n.a})),a.d(t,"a",(function(){return r})),a.d(t,"d",(function(){return c})),a.d(t,"e",(function(){return m})),a.d(t,"c",(function(){return b.a}));a(2821);var n=a(2828),l=a(3),i=a(173);var r=Object(l.c)(i.a)`
  padding-left: ${({theme:e})=>e.space[3]}px;
  padding-right: ${({theme:e})=>e.space[3]}px;
  color: ${({theme:e})=>e.colors.subtlerText};
  &:hover {
    color: ${({theme:e})=>e.colors.mediumText};
  }
`;var c=Object(l.c)("span")`
  border-right: 1px ${({theme:e})=>e.colors.border} solid;
  margin: 0 ${({theme:e})=>e.space[4]}px;
  position: relative;
  height: 100%;
  display: block;
`,o=a(0),s=a.n(o),d=a(807);const u=l.a`
  align-items: center;
  display: flex;
  height: 100%;
  width: auto;
  justify-content: flex-end;
  overflow-x: unset;

  > div {
    margin: initial;
  }
`;function m(e){return s.a.createElement(d.a,Object.assign({className:u},e))}a(2823),a(2822);var b=a(2826)},2826:function(e,t,a){"use strict";var n=a(0),l=a.n(n),i=a(3),r=a(1),c=a(47),o=a(2600);const s=Object(i.c)(c.a)`
  line-height: 24px;
  color: ${({theme:e})=>e.motifPalette.text01};
`,d=Object(i.c)("div",{shouldForwardProp:e=>"toggleStyle"!==e})`
  justify-content: space-between;
  margin-top: ${({toggleStyle:e})=>{var t;return null!==(t=null==e?void 0:e.marginTop)&&void 0!==t?t:8}}px;
  margin-right: ${({toggleStyle:e})=>{var t;return null!==(t=null==e?void 0:e.marginRight)&&void 0!==t?t:0}}px;
  margin-bottom: ${({toggleStyle:e})=>{var t;return null!==(t=null==e?void 0:e.marginBottom)&&void 0!==t?t:0}}px;
  margin-left: ${({toggleStyle:e})=>{var t;return null!==(t=null==e?void 0:e.marginLeft)&&void 0!==t?t:0}}px;
  width: auto !important;

  label {
    margin-left: 0;
  }
`;t.a=({checked:e,disabled:t,id:a,onChange:n,text:i,toggleStyle:c})=>l.a.createElement(d,{toggleStyle:c},l.a.createElement(o.a,{checked:e,id:a,onChange:n,disabled:t},"string"==typeof i?l.a.createElement(s,{size:"body"},l.a.createElement(r.b,{id:i})):i))},2828:function(e,t,a){"use strict";var n=a(0),l=a.n(n),i=a(1),r=a(4),c=a(20);const o=e=>{var t;return null===(t=null==e?void 0:e.filters)||void 0===t?void 0:t.isFilterOpen};var s=a(1192),d=a(3),u=a(2769),m=a(3116),b=a(3108),p=a(464),O=a(3059);const v=Object(d.c)(O.a)`
  padding: 24px;
`;var E=({columns:e,columnLabels:t,tableType:a,hidden:o=[]})=>{var s;const d=Object(r.useDispatch)(),u=(null===(s=Object(r.useSelector)(Object(c.B)(a)))||void 0===s?void 0:s.initialColumns)||[],m=Object(n.useMemo)(()=>Object.values(e).every(e=>u.includes(e)),[u]),b=Object(n.useCallback)(()=>{const t=m||(null==u?void 0:u.length)?[]:Object.values(e);d(Object(c.L)(a,{initialColumns:t},!0))},[d,m,a,u]),p=Object(n.useMemo)(()=>[{full:!0,id:"showAllFields",checked:m||!!(null==u?void 0:u.length)&&"mixed",children:l.a.createElement(i.b,{id:"COMMON_ALL"}),onChange:b}].concat(Object.values(e).filter(e=>!o.includes(e)).map(e=>({full:!0,id:e,checked:u.includes(e),children:(null==t?void 0:t[e])?l.a.createElement(i.a,{id:t[e]}):e,onChange:({target:{checked:t}})=>{const n=t?[...u,e]:u.filter(t=>t!==e);d(Object(c.L)(a,{initialColumns:n},!0))}}))),[u,a]);return l.a.createElement(v,{spacing:"flush",items:p,variant:"list"})};const g=Object(d.c)(u.a)`
  width: 258px !important;
`;var f;!function(e){e.COLUMNS="columns",e.FILTERS="filters"}(f||(f={}));var h=({filterTitleLabel:e,isOpen:t,onClose:a,columnTabProps:o,renderFilterDrawerContent:s,footerProps:d,side:u="left"})=>{var O;const[v,h]=Object(n.useState)(f.FILTERS),{tableType:j}=o||{tableType:null},_=Object(r.useDispatch)(),C=(null===(O=Object(r.useSelector)(Object(c.B)(j)))||void 0===O?void 0:O.initialColumns)||[],T=d&&v===f.COLUMNS,S=Object(n.useMemo)(()=>{var e,t;return T&&Object(p.a)(null===(t=null===(e=null===c.c||void 0===c.c?void 0:c.c.tables)||void 0===e?void 0:e[j])||void 0===t?void 0:t.initialColumns,C)},[T,j,C]),y=Object(n.useCallback)(()=>{var e,t,a;const n=[...null!==(a=null===(t=null===(e=null===c.c||void 0===c.c?void 0:c.c.tables)||void 0===e?void 0:e[j])||void 0===t?void 0:t.initialColumns)&&void 0!==a?a:[]];_(Object(c.L)(j,{initialColumns:n},!0))},[_,j]),M=Object(n.useCallback)(({id:e})=>h(e),[h]),w=o?l.a.createElement(m.a,{onSelectTab:M,tabs:[{id:f.FILTERS,label:l.a.createElement(i.b,{id:"COMMON_CONTROL_PANEL_FILTERS"}),render:s},{id:f.COLUMNS,label:l.a.createElement(i.b,{id:"COMMON_CONTROL_PANEL_COLUMNS"}),render:()=>l.a.createElement(E,{columns:o.columns,hidden:o.hidden,columnLabels:o.columnLabels,tableType:j})}]}):s(),A=Object(n.useMemo)(()=>T?{label:l.a.createElement(i.b,{id:"COMMON_CONTROL_PANEL_FILTER_FOOTER_RESTORE_COLUMNS"}),onClick:y,disabled:S}:d,[T,d,S,y]),I=Object(n.useCallback)(()=>{a(),h(f.FILTERS)},[a,h]);return l.a.createElement(g,{in:t,renderHeader:()=>null,onClose:a,side:u},t&&l.a.createElement(b.a,{footerProps:A,headerProps:{label:e},onClose:I},w))},j=a(2822);t.a=Object(i.e)(({routes:e=[],hideFilterButton:t=!1,isLoading:a,children:i,filterFooterProps:d,columnTabProps:u,renderFilterDrawerContent:m,filterTitleLabel:b,filtersActive:p,title:O,onClose:v,intl:E,leftContent:g,isDisplayOptionsDisabled:f})=>{var _;const C=Object(r.useDispatch)(),T=Object(r.useSelector)(o),S=(null===(_=Object(r.useSelector)(Object(c.B)(null==u?void 0:u.tableType)))||void 0===_?void 0:_.initialColumns)||[],y=E.formatMessage({id:b||"COMMON_CONTROL_PANEL_FILTER_TITLE"});Object(n.useEffect)(()=>()=>{C(Object(s.b)(!1))},[]);const M=Object(n.useCallback)(()=>{C(Object(s.b)(!1)),null==v||v(),(null==u?void 0:u.tableType)&&C(Object(c.L)(u.tableType,{initialColumns:S}))},[C,v,null==u?void 0:u.tableType,S]);return l.a.createElement(l.a.Fragment,null,l.a.createElement(h,{isOpen:T,filterTitleLabel:y,onClose:M,columnTabProps:u,renderFilterDrawerContent:()=>T&&m,footerProps:d,side:"right"}),l.a.createElement(j.a,{leftContent:g,routes:e,hideFilterButton:t,isLoading:a,filterTitleLabel:y,filtersActive:p,title:O,isDisplayOptionsDisabled:f},i))})},2832:function(e,t,a){"use strict";var n=a(0),l=a.n(n),i=a(3),r=a(4),c=a(3117),o=a(34),s=a(5),d=a(1192);const u=Object(i.c)(c.a,{shouldForwardProp:e=>"disabled"!==e})`
  pointer-events: ${({disabled:e})=>e?"none":"auto"};
  opacity: ${({disabled:e})=>e?.45:1};
  cursor: ${({disabled:e})=>e?"default":"pointer"};
  padding: 0 8px 0 0;
  z-index: 5;

  // Hides the text element on smaller screens
  button div > span {
    display: none;
  }

  button svg {
    margin-right: 0;
  }

  button {
    padding: 0 8px;
  }

  @media ${o.a.VIEWPORT_M_UP} {
    button {
      padding: 0 16px;
    }

    button svg {
      margin-right: 4px;
    }

    button div > span {
      display: inline-block;
    }
  }
`;t.a=({filterTitleLabel:e,filtersActive:t,items:a,disabled:n})=>{const i=Object(r.useDispatch)();return l.a.createElement(s.a,{height:"100%"},l.a.createElement(u,{disabled:n,title:e,onClick:()=>!n&&i(Object(d.b)(!0)),filtersActive:t}),a)}},2833:function(e,t,a){"use strict";a.d(t,"a",(function(){return n}));const n=(e,t)=>{const a=Object.keys(e||{}),n=Object.keys(t||{});return a.length===n.length&&n.every(a=>e[a]&&e[a].length===t[a].length&&t[a].every(t=>e[a].includes(t)))}},2958:function(e,t){},2969:function(e,t){},3100:function(e,t,a){"use strict";a.r(t);var n=a(0),l=a.n(n),i=a(25),r=a(4),c=a(29),o=a(168),s=a(89),d=a(256),u=a(867),m=a(22),b=a(362),p=a(441),O=a(16),v=a(8),E=a(2604),g=a(3),f=a(495),h=a(1),j=a(807),_=a(2824),C=a(2833),T=a(398),S=a(194),y=a(20),M=a(123),w=a(75),A=a(2618),I=a(185),k=a(99),N=a(958),x=a(866);const D=g.a`
  align-items: center;
  display: flex;
  height: 100%;
  justify-content: flex-end;
  overflow-x: unset !important;

  > div {
    margin: initial;
  }
`,L=Object(g.c)(I.a)`
  text-transform: uppercase;
`,R=Object(g.c)("div")`
  display: flex;
  align-items: center;
  white-space: nowrap;
`,F=Object(g.c)(j.a,{shouldForwardProp:e=>"hasCustomRange"!==e})`
  @media (max-width: 720px) {
    padding: 0;
  }
  ${({hasCustomRange:e})=>e?"@media (max-width: 1075px) {\n    & > * > button {\n      display: none;\n      &:nth-last-of-type(1) {\n        display: flex;\n      }\n    }\n  }":"@media (max-width: 870px) {\n    & > * > button {\n      display: none;\n      &:nth-last-of-type(1) {\n        display: flex;\n      }\n    }\n  }"}
`,P=g.a`
  background-color: transparent !important;
`,H=(e,t)=>{const a=e.map(e=>({id:e.id,label:l.a.createElement(L,{size:"small",message:e.message,values:e.messageValues})}));return t&&a.push({id:"Custom",className:P,label:t}),a};var B=({tabsVariant:e})=>{const t=Object(r.useDispatch)(),a=Object(r.useSelector)(x.n),i=Object(r.useSelector)(O.selectLocaleSettings),c=Object(r.useSelector)(y.J),o=Object(r.useSelector)(x.d),s=Object(r.useSelector)(w.d),d=Object(k.d)(c,i,s),[u,m]=Object(n.useState)(null===o.preset?"Custom":o.preset),b=Object(n.useCallback)(e=>{t(Object(N.d)(e))},[t]),p=Object(n.useCallback)(e=>{const t=a.find(t=>t.id===e);t&&b({...t.getRange(new Date),preset:e}),m(e)},[a,b]);Object(n.useEffect)(()=>{o.preset||m("Custom")},[o.preset]);const v=Object(n.useMemo)(()=>o.preset?null:l.a.createElement(R,null,l.a.createElement(A.a,{start:o.startDate,end:o.endDate,timezone:d})),[o,d]);return l.a.createElement(F,{tabs:H(a,v),selectedTab:u,onSelectTab:({id:e})=>p(e),className:D,variant:e,hasCustomRange:!o.preset})},U=a(1672),$=a(1032),G=a(2760),z=a(613),V=a(3073),W=a(79),K=a(35),Y=a(183),Z=a(1675);const J=Object(g.c)("div")`
  padding: 24px;
`,q=Object(g.c)("div")`
  margin-bottom: 16px;
`,X=Object(g.c)(G.a)`
  > div {
    color: inherit !important;
  }

  > div:last-of-type {
    padding-bottom: 17px;
  }

  span {
    font-size: 12px;
  }
`,Q=["<"+Object(Y.a)(1e6),Object(Y.a)(1e9)],ee=e=>Object(Y.a)(e);var te=Object(h.e)(({intl:e})=>{const t=Object(r.useDispatch)(),a=Object(r.useSelector)(x.l),c=Object(r.useSelector)(x.j),o=Object(r.useSelector)(O.selectIpsSettings),[s,d]=Object(n.useState)(o.ips_mode!==O.IpsMode.DISABLED),u=Object(r.useSelector)(O.selectDpiSettings),[m,b]=Object(n.useState)(u.enabled),p=Object(n.useMemo)(()=>Object(Z.c)(c,e),[c,e]),{threatPage:v}=Object(i.m)(),E=v===$.a.MAP;Object(n.useEffect)(()=>{d(o.ips_mode!==O.IpsMode.DISABLED)},[o.ips_mode]);const g=Object(n.useCallback)(e=>{t(Object(T.h)({name:S.a.THREAT_MANAGEMENT,value:e})),t(Object(y.L)(M.a.THREAT_MANAGEMENT_EVENT_TIMELINE,{filters:e}))},[t]),f=Object(n.useCallback)(({value:e})=>{g(Object.assign({},a,{client:e}))},[g,a]),j=Object(n.useCallback)(e=>{g(Object.assign({},a,{transferSizeEnabled:e.target.checked}))},[g,a]),C=Object(n.useCallback)(e=>{g(Object.assign({},a,{transferSizeMin:e.target.value}))},[g,a]),w=Object(n.useCallback)(e=>{const n=e.target.checked;if(n&&!m)return b(!0),void t(Object(O.saveSettings)({...u,enables:!0}));g(Object.assign({},a,{traffic:n}))},[g,a,m,t,u]),A=Object(n.useCallback)(e=>{const n=e.target.checked;if(o.ips_mode===O.IpsMode.DISABLED)t(Object(W.a)({title:n?"TM_ENABLE_IDS":"TM_DISABLE_IDS",message:n?"TM_ENABLE_IDS_DESC":"TM_DISABLE_IDS_DESC",confirmButtonProps:n?{text:l.a.createElement(h.b,{id:"COMMON_ACTION_ENABLE"})}:{text:l.a.createElement(h.b,{id:"COMMON_ACTION_DISABLE"}),variant:"danger"},onConfirm:()=>{d(n),t(Object(O.saveSettings)({...o,ips_mode:n?O.IpsMode.IPS:O.IpsMode.DISABLED})),t(Object(K.e)())},onCancel:()=>{t(Object(K.e)())}}));else{const e={threats:n};e.severity=n?[...U.d.severity]:[],g(Object.assign({},a,e))}},[t,o,a,g]);return l.a.createElement(J,null,l.a.createElement(q,null,l.a.createElement(z.a,{placeholder:e.formatMessage({id:"TM_SELECT_CLIENT"}),options:p,renderOption:V.a,renderSelectedOption:V.b,arrowSize:"medium",inputProps:{style:{height:60}},searchable:!0,maxHeight:450,width:208,onChange:f,value:a.client})),!E&&l.a.createElement(_.c,{checked:m&&a.traffic,onChange:w,id:"traffic",text:"TM_TRAFFIC_ANALYSIS",toggleStyle:{marginTop:4,marginBottom:16}}),l.a.createElement(_.c,{checked:s&&a.threats,onChange:A,id:"threats",text:"TM_THREAT_SEVERITY",toggleStyle:{marginTop:4,marginBottom:16}}),l.a.createElement(_.c,{checked:null==a?void 0:a.transferSizeEnabled,onChange:j,id:"transferSizeEnabled",text:"TM_TRANSFER_SIZE",toggleStyle:{marginTop:4,marginBottom:16}}),l.a.createElement(X,{value:a.transferSizeMin,onChange:C,min:1e6,max:1e9,step:100,segments:1,segmentLabels:Q,withValueIndicator:a.transferSizeEnabled&&a.transferSizeMin>U.d.transferSizeMin,formatValueIndicatorContent:ee,valueIndicatorPosition:"bottom",disabled:!(null==a?void 0:a.transferSizeEnabled)}))});const ae=Object(g.c)("div")`
  position: absolute;
  left: 0;
  right: 0;
`;var ne=()=>{const e=Object(n.useRef)(null),t=Object(r.useDispatch)(),a=Object(i.k)(),{threatPage:c}=Object(i.m)(),o=c===$.a.MAP,s=c||U.e[$.a.TIMELINE],d=Object(m.a)("/ips"),u=Object(n.useCallback)(e=>{a.push(`${d}/${U.e[e.id]}`)},[]),b=Object(m.q)(e),p=Object(r.useSelector)(x.l),O=Object(n.useMemo)(()=>Object(C.a)(p,U.d),[p]),v=Object(n.useCallback)(()=>{t(Object(T.g)({name:S.a.THREAT_MANAGEMENT})),t(Object(y.L)(M.a.THREAT_MANAGEMENT_EVENT_TIMELINE,{filters:Object(f.a)(U.d)}))},[t]);return l.a.createElement("div",{ref:e},l.a.createElement(_.b,{isLoading:!1,hideFilterButton:b>U.a-(o?178:0)+66,renderFilterDrawerContent:l.a.createElement(te,null),filterFooterProps:{label:l.a.createElement(h.b,{id:"COMMON_CONTROL_PANEL_FILTER_FOOTER_RESTORE_DEFAULTS"}),onClick:v,disabled:O},filtersActive:!O},l.a.createElement(ae,null,l.a.createElement(j.a,{tabs:U.f,selectedTab:s,onSelectTab:u})),l.a.createElement(B,{tabsVariant:"tertiary"})))},le=a(2788),ie=a(1670),re=a(1637),ce=a(173),oe=a(10),se=a(288),de=a(549),ue=a(76),me=a(92),be=a(5),pe=a(1195),Oe=a(169),ve=a(947),Ee=a(149),ge=a(356),fe=a(428),he=a(107),je=a(474),_e=a(2600),Ce=a(47),Te=a(170),Se=a(36),ye=a(241);const Me=Object(g.c)(be.a)`
  border-radius: 8px;
  border: 1px solid ${({theme:e})=>e.motifPalette.neutral04};
  padding: 10px 16px;
  height: 90px;
  margin-bottom: 16px;
  background: ${({theme:e})=>e.motifPalette.ui01}CD;
`,we=Object(g.c)(be.a)`
  height: 90px;
  margin-bottom: 16px;
`,Ae=Object(g.c)("div")`
  align-self: center;
  width: 100%;

  > div > div > div {
    padding: 10px 16px;
    border: 1px solid ${({theme:e})=>e.motifPalette.neutral04};
    border-radius: 8px;
    height: 90px;
    width: 280px;
    background: ${({theme:e})=>e.motifPalette.ui01}CD;
    box-shadow: none !important;

    &:after {
      display: none !important;
    }
  }

  ul {
    border: 0 !important;
  }
`,Ie=Object(g.c)(je.a)`
  margin-right: 8px;
`,ke=Object(g.c)(_e.a)`
  width: 100%;
`,Ne=Object(g.c)("div",{shouldForwardProp:e=>"chipChecked"!==e&&"isDark"!==e})`
  > div {
    transform: none !important;
    margin: 0 !important;
    ${({chipChecked:e,theme:t,isDark:a})=>e?`\n      background: ${t.motifPalette[a?"uBlue10":"uBlue01"]};\n      border-color: ${t.motifPalette[a?"uBlue10":"uBlue01"]};\n\n      &:hover {\n        background: ${t.motifPalette[a?"uBlue09":"uBlue02"]};\n        border-color: ${t.motifPalette[a?"uBlue09":"uBlue02"]};\n      }\n    `:`\n      background: ${t.motifPalette.neutral02};\n      border-color: ${t.motifPalette.neutral02};\n\n      &:hover {\n        background: ${t.motifPalette.neutral03};\n        border-color: ${t.motifPalette.neutral03};\n      }\n    `}
  }
`,xe=Object(g.c)(G.a)`
  > div {
    color: inherit !important;
  }

  > div:last-of-type {
    padding-bottom: 17px;
  }

  span {
    font-size: 12px;
  }
`,De=["<"+Object(Y.a)(1e6),Object(Y.a)(1e9)],Le=e=>Object(Y.a)(e);var Re=Object(h.e)(({intl:e,isMap:t})=>{const a=Object(n.useRef)(null),i=Object(m.q)(a),c=Object(r.useDispatch)(),o=Object(r.useSelector)(x.l),s=Object(r.useSelector)(x.j),d=Object(n.useMemo)(()=>Object(Z.c)(s,e),[s,e]),u=Object(r.useSelector)(O.selectIpsSettings),[b,p]=Object(n.useState)(u.ips_mode!==O.IpsMode.DISABLED),v=Object(r.useSelector)(O.selectDpiSettings),[E,g]=Object(n.useState)(v.enabled),f=Object(r.useSelector)(y.q),j=Object(r.useSelector)(Object(Te.f)(Te.a.LIMIT_IPS_CATEGORIES));Object(n.useEffect)(()=>{p(u.ips_mode!==O.IpsMode.DISABLED),g(v.enabled)},[u.ips_mode,v.enabled]);const _=Object(n.useCallback)(e=>{c(Object(T.h)({name:S.a.THREAT_MANAGEMENT,value:e})),c(Object(y.L)(M.a.THREAT_MANAGEMENT_EVENT_TIMELINE,{filters:e}))},[c]),C=Object(n.useCallback)(({value:e})=>{_(Object.assign({},o,{client:e}))},[_,o]),w=Object(n.useCallback)(e=>{_(Object.assign({},o,{transferSizeEnabled:e.target.checked}))},[_,o]),A=Object(n.useCallback)(e=>{_(Object.assign({},o,{transferSizeMin:e.target.value}))},[_,o]),I=Object(n.useCallback)(e=>{const t=e.target.checked;if(t&&!E)return g(!0),void c(Object(O.saveSettings)({...v,enables:!0}));_(Object.assign({},o,{traffic:t}))},[_,o,E,c,v]),k=Object(n.useCallback)(()=>{I({target:{checked:!(E&&o.traffic)}})},[o.traffic,I,E]),N=Object(n.useCallback)(e=>{const t=e.target.checked,a=j?ye.k:ye.i;if(u.ips_mode===O.IpsMode.DISABLED)c(Object(W.a)({title:t?"TM_ENABLE_IDS":"TM_DISABLE_IDS",message:t?"TM_ENABLE_IDS_DESC":"TM_DISABLE_IDS_DESC",confirmButtonProps:t?{text:l.a.createElement(h.b,{id:"COMMON_ACTION_ENABLE"})}:{text:l.a.createElement(h.b,{id:"COMMON_ACTION_DISABLE"}),variant:"danger"},onConfirm:()=>{p(t),c(Object(O.saveSettings)({...u,ips_mode:t?O.IpsMode.IPS:O.IpsMode.DISABLED,enabled_categories:a[Se.b.THREE]})),c(Object(K.e)())},onCancel:()=>{c(Object(K.e)())}}));else{const e={threats:t};e.severity=t?[...U.d.severity]:[],_(Object.assign({},o,e))}},[j,u,c,_,o]),D=Object(n.useCallback)((e,t)=>{const a={severity:[...o.severity]};a.severity[e]=t,a.severity.includes(!0)||(a.threats=!1),a.severity.slice(1).includes(!0)&&!o.threats&&(a.threats=!0),_(Object.assign({},o,a))},[o,_]);return l.a.createElement("div",{ref:a},l.a.createElement(be.a,{justifyContent:"space-between",flexWrap:"wrap"},i>=U.a-(t?178:0)&&l.a.createElement(l.a.Fragment,null,l.a.createElement(we,{width:280,alignSelf:"flex-start"},l.a.createElement(Ae,null,l.a.createElement(z.a,{placeholder:e.formatMessage({id:"TM_SELECT_CLIENT"}),options:d,renderOption:V.a,renderSelectedOption:V.b,arrowSize:"medium",inputProps:{style:{height:90}},searchable:!0,maxHeight:450,width:280,onChange:C,value:o.client}))),l.a.createElement(be.a,{flexWrap:"wrap"},!t&&l.a.createElement(Me,{width:178,alignSelf:"flex-end",flexDirection:"column",marginRight:16},l.a.createElement(be.a,{marginBottom:8},l.a.createElement(ke,{checked:E&&o.traffic,onChange:I,size:"small"},l.a.createElement(h.a,{id:"TM_TRAFFIC_ANALYSIS"}))),l.a.createElement(be.a,{flex:"1",justifyContent:"space-between"},l.a.createElement(Ne,{chipChecked:E&&o.traffic,isDark:f},l.a.createElement(re.a,{width:"auto",onClick:k,label:l.a.createElement(be.a,{alignItems:"center"},l.a.createElement(Ie,{variant:"info"}),l.a.createElement(Ce.a,{weight:"bold"},l.a.createElement(h.a,{id:"COMMON_TRAFFIC"})))})))),l.a.createElement(Me,{width:445,alignSelf:"flex-end",flexDirection:"column",marginRight:16},l.a.createElement(be.a,{marginBottom:8},l.a.createElement(ke,{checked:b&&o.threats,onChange:N,size:"small"},l.a.createElement(h.a,{id:"TM_THREAT_SEVERITY"}))),l.a.createElement(be.a,{flex:"1",justifyContent:"space-between"},l.a.createElement(Ne,{chipChecked:b&&o.threats&&o.severity[4],isDark:f},l.a.createElement(re.a,{width:"auto",onClick:()=>D(4,!(b&&o.threats&&o.severity[4])),label:l.a.createElement(be.a,{alignItems:"center"},l.a.createElement(Ie,{variant:"success"}),l.a.createElement(Ce.a,{weight:"bold"},l.a.createElement(h.a,{id:"TM_KNOWN"})))})),l.a.createElement(Ne,{chipChecked:b&&o.threats&&o.severity[2],isDark:f},l.a.createElement(re.a,{width:"auto",onClick:()=>D(2,!(b&&o.threats&&o.severity[2])),label:l.a.createElement(be.a,{alignItems:"center"},l.a.createElement(Ie,{variant:"warning"}),l.a.createElement(Ce.a,{weight:"bold"},l.a.createElement(h.a,{id:"TM_UNKNOWN"})))})),l.a.createElement(Ne,{chipChecked:b&&o.threats&&o.severity[1],isDark:f},l.a.createElement(re.a,{width:"auto",onClick:()=>D(1,!(b&&o.threats&&o.severity[1])),label:l.a.createElement(be.a,{alignItems:"center"},l.a.createElement(Ie,{variant:"danger"}),l.a.createElement(Ce.a,{weight:"bold"},l.a.createElement(h.a,{id:"TM_CONCERNING"})))})),l.a.createElement(Ne,{chipChecked:b&&o.threats&&o.severity[3],isDark:f},l.a.createElement(re.a,{width:"auto",onClick:()=>D(3,!(b&&o.threats&&o.severity[3])),label:l.a.createElement(be.a,{alignItems:"center"},l.a.createElement(Ie,{variant:"neutral"}),l.a.createElement(Ce.a,{weight:"bold"},l.a.createElement(h.a,{id:"TM_BLOCKED"})))})))),l.a.createElement(Me,{width:282,alignSelf:"flex-end",flexDirection:"column"},l.a.createElement(be.a,{marginBottom:8},l.a.createElement(ke,{checked:o.transferSizeEnabled,onChange:w,size:"small"},l.a.createElement(h.a,{id:"TM_TRANSFER_SIZE"}))),l.a.createElement(be.a,{flex:"1"},l.a.createElement(xe,{value:o.transferSizeMin,onChange:A,min:1e6,max:1e9,step:100,segments:1,segmentLabels:De,withValueIndicator:o.transferSizeEnabled&&o.transferSizeMin>U.d.transferSizeMin,formatValueIndicatorContent:Le,valueIndicatorPosition:"bottom",disabled:!(null==o?void 0:o.transferSizeEnabled)})))))))}),Fe=a(48),Pe=a(2601),He=a(3110),Be=a(203);const Ue=e=>3+Math.min(8-(1e9-e)/1e6/125|0,8),$e={[ve.c.DAY]:[{value:60,label:"60 min"},{value:45,label:"45 min"},{value:30,label:"30 min"},{value:15,label:"15 min"},{value:0,label:"0 min"}],[ve.c.WEEK]:[{value:24,label:"24.00hr"},{value:18,label:"18.00hr"},{value:12,label:"12.00hr"},{value:6,label:"6.00hr"},{value:0,label:"0hr"}]};var Ge;!function(e){e.THREAT="threat",e.TRAFFIC="traffic",e.OVERALL="overall"}(Ge||(Ge={}));const ze=Object(g.c)(Ce.a)`
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid ${({theme:e})=>e.motifPalette.ui11};
  width: 100%;
  position: relative;
  cursor: pointer;
`,Ve=Object(g.c)("div")`
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 212px;
`,We=Object(g.c)(be.a)`
  margin-bottom: 8px;

  span:nth-child(2) {
    max-width: 150px;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
  }
`,Ke=Object(g.c)(Ce.a)`
  color: ${Fe.a["purple-1"]};
`,Ye=Object(g.c)(oe.g)`
  position: absolute;
  right: 0;
  top: 5px;
`,Ze=Object(g.c)(je.a)`
  margin-right: 4px;
`,Je=({timeFormat:e,handleOpen:t,item:a,activeDot:n})=>{var i,r,o,s,d,u,m;if(!a)return null;const b=(null===(i=a.http)||void 0===i?void 0:i.hostname)||a.inner_alert_signature,p=n.type===Ge.THREAT&&(null===(o=null===(r=null==n?void 0:n.id)||void 0===r?void 0:r.toString)||void 0===o?void 0:o.call(r))===b;return l.a.createElement(l.a.Fragment,null,p&&l.a.createElement("div",{className:"ignore-body-click"},l.a.createElement(ze,{size:"body",weight:"bold",onClick:()=>t(a,Ge.THREAT),className:"ignore-body-click"},l.a.createElement(Ve,{className:"ignore-body-click"},(null===(s=a.http)||void 0===s?void 0:s.hostname)||a.inner_alert_signature||l.a.createElement(h.b,{id:"TM_UNKNOWN"})),l.a.createElement(Ye,{size:"small"}))),l.a.createElement(We,{justifyContent:"space-between"},l.a.createElement(Ce.a,null,l.a.createElement(h.b,{id:"TM_SERVICE"})),l.a.createElement(Ce.a,null,(null===(d=a.http)||void 0===d?void 0:d.hostname)||a.inner_alert_signature||l.a.createElement(h.b,{id:"COMMON_HYPHEN"}))),l.a.createElement(We,{justifyContent:"space-between"},l.a.createElement(Ce.a,null,l.a.createElement(h.b,{id:"COMMON_DATE_TIME"})),l.a.createElement(Ce.a,null,Object(c.format)(a.time,`${de.a}, ${e}`))),l.a.createElement(We,{justifyContent:"space-between"},l.a.createElement(Ce.a,null,l.a.createElement(h.b,{id:"COMMON_WORD_IP"})),l.a.createElement(Ce.a,null,a.dest_ip)),l.a.createElement(We,{justifyContent:"space-between"},l.a.createElement(Ce.a,null,l.a.createElement(h.b,{id:"TM_ACTIVITY"})),l.a.createElement(Ce.a,null,Object(Y.a)(((null===(u=a.flow)||void 0===u?void 0:u.bytes_toclient)||0)+((null===(m=a.flow)||void 0===m?void 0:m.bytes_toserver)||0)))))},qe=({timeFormat:e,handleOpen:t,item:a,total:n,traffic:i,activeDot:r,openedPpId:o,xValue:s,isLast24H:d})=>{var u,m,b,p;if(!a)return null;const O=r.type===Ge.TRAFFIC&&(null===(m=null===(u=null==r?void 0:r.id)||void 0===u?void 0:u.toString)||void 0===m?void 0:m.call(u))===(null==s?void 0:s.toString())||(null==o?void 0:o.toString())===(null==s?void 0:s.toString());return l.a.createElement(l.a.Fragment,null,O&&(null===(b=a.traffic_breakdown)||void 0===b?void 0:b.length)>0?l.a.createElement("div",{className:"ignore-body-click"},l.a.createElement(ze,{size:"body",weight:"bold",onClick:()=>t(a,Ge.TRAFFIC,i),className:"ignore-body-click"},l.a.createElement(h.b,{id:"TM_TRAFFIC_ANALYSIS"}),l.a.createElement(Ye,{size:"small"}))):null,l.a.createElement(We,{justifyContent:"space-between"},l.a.createElement(Ce.a,null,l.a.createElement(h.b,{id:"TM_TIME"})),l.a.createElement(Ce.a,null,Object(c.format)(O&&d&&a.start_timestamp||(null==i?void 0:i.start_timestamp)||a.start_timestamp,e)," ","-"," ",Object(c.format)(O&&d&&a.end_timestamp||(null==i?void 0:i.end_timestamp)||a.end_timestamp,e))),O&&(null==n?void 0:n.identified)>0&&l.a.createElement(We,{justifyContent:"space-between"},l.a.createElement(Ce.a,null,l.a.createElement(h.b,{id:"COMMON_IDENTIFIED_TRAFFIC"})),l.a.createElement(Ce.a,null,Object(Y.a)((null==n?void 0:n.identified)||0))),l.a.createElement(We,{justifyContent:"space-between"},l.a.createElement(Ce.a,null,l.a.createElement(h.b,{id:"COMMON_STATUS_DOWNLOAD"})),l.a.createElement(Ke,null,Object(Y.a)((O?null==n?void 0:n.axisDown:null==n?void 0:n.down)||0))),l.a.createElement(We,{justifyContent:"space-between"},l.a.createElement(Ce.a,null,l.a.createElement(h.b,{id:"COMMON_STATUS_UPLOAD"})),l.a.createElement(Ce.a,{color:"info"},Object(Y.a)((O?null==n?void 0:n.axisUp:null==n?void 0:n.up)||0))),((null==n?void 0:n.clients)>0||(null==i?void 0:i.client_count)>0)&&l.a.createElement(We,{justifyContent:"space-between"},l.a.createElement(Ce.a,null,l.a.createElement(h.b,{id:"COMMON_CLIENTS"})),l.a.createElement(Ce.a,null,null!==(p=null==n?void 0:n.clients)&&void 0!==p?p:null==i?void 0:i.client_count)))},Xe=({item:e,handleOpen:t})=>{var a;if(!e)return null;const n=Math.max(...null!==(a=null==e?void 0:e.threats)&&void 0!==a?a:[0])>0;return l.a.createElement(l.a.Fragment,null,l.a.createElement("div",{className:"ignore-body-click"},l.a.createElement(ze,{size:"body",weight:"bold",onClick:()=>t(e),className:"ignore-body-click"},l.a.createElement(h.b,{id:"TM_DETAILED_VIEW"}),l.a.createElement(Ye,{size:"small"}))),!!e.traffic&&l.a.createElement(l.a.Fragment,null,l.a.createElement(We,{justifyContent:"space-between"},l.a.createElement(Ce.a,{weight:"bold"},l.a.createElement(h.b,{id:"COMMON_TRAFFIC"}))),l.a.createElement(We,{justifyContent:"space-between"},l.a.createElement(Ce.a,null,l.a.createElement(h.b,{id:"COMMON_IDENTIFIED_TRAFFIC"})),l.a.createElement(Ce.a,null,Object(Y.a)(e.traffic.identified))),l.a.createElement(We,{justifyContent:"space-between"},l.a.createElement(Ce.a,null,l.a.createElement(h.b,{id:"COMMON_STATUS_DOWNLOAD"})),l.a.createElement(Ke,null,Object(Y.a)(e.traffic.down))),l.a.createElement(We,{justifyContent:"space-between"},l.a.createElement(Ce.a,null,l.a.createElement(h.b,{id:"COMMON_STATUS_UPLOAD"})),l.a.createElement(Ce.a,{color:"info"},Object(Y.a)(e.traffic.up))),e.traffic.clients&&l.a.createElement(We,{justifyContent:"space-between"},l.a.createElement(Ce.a,null,l.a.createElement(h.b,{id:"COMMON_CLIENTS"})),l.a.createElement(Ce.a,null,e.traffic.clients)),e.traffic.events&&l.a.createElement(We,{justifyContent:"space-between"},l.a.createElement(Ce.a,null,l.a.createElement(h.b,{id:"TM_EVENTS"})),l.a.createElement(Ce.a,null,e.traffic.events))),n&&l.a.createElement(l.a.Fragment,null,l.a.createElement(We,{justifyContent:"space-between"},l.a.createElement(Ce.a,{weight:"bold"},l.a.createElement(h.b,{id:"TM_THREATS"}))),e.threats.map((e,t)=>e<1?null:l.a.createElement(We,{justifyContent:"space-between",key:t.toString()},l.a.createElement(be.a,{alignItems:"center"},l.a.createElement(Ze,{variant:o.m[t]}),l.a.createElement(Ce.a,null,l.a.createElement(h.b,{id:["TM_CONCERNING","TM_CONCERNING","TM_UNKNOWN","TM_KNOWN","TM_BLOCKED"][t]}))),l.a.createElement(Ce.a,null,e)))))};var Qe=Object(h.e)(({intl:e})=>{var t,a,s;const d=Object(m.n)(),u=Object(n.useRef)(),b=Object(m.q)(u)||window.innerWidth-200,p=Object(r.useSelector)(x.k),v=Object(r.useSelector)(x.l),E=Object(r.useSelector)(O.selectIpsSettings),{endDate:g,startDate:f,preset:h}=Object(r.useSelector)(x.d),j=Object(r.useSelector)(se.c),_=Object(r.useSelector)(y.E),C=Object(r.useSelector)(x.f),{site:T,dataId:S}=Object(i.m)(),{pathname:M}=Object(i.l)(),w=Object(i.k)(),A=Object(r.useDispatch)(),[I,D]=Object(n.useState)({view:null,type:null,id:null}),L=Object(n.useCallback)(e=>{var t,a,n,l,i,r,c,o;"div"===(null===(a=null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.nodeName)||void 0===a?void 0:a.toLowerCase())&&"foreignObject"===(null===(l=null===(n=null==e?void 0:e.target)||void 0===n?void 0:n.parentNode)||void 0===l?void 0:l.nodeName)||(null===(o=null===(c=null===(r=null===(i=null==e?void 0:e.target)||void 0===i?void 0:i.parentNode)||void 0===r?void 0:r.classList)||void 0===c?void 0:c.contains)||void 0===o?void 0:o.call(c,"ignore-body-click"))||I.id&&D({view:null,type:null,id:null})},[I]);Object(n.useEffect)(()=>(document.body.addEventListener("click",L),()=>{document.body.removeEventListener("click",L)}),[L]),Object(n.useEffect)(()=>{(null==I?void 0:I.view)&&I.view!==h&&L()},[h,I.view,L]);const R=h===Oe.a["1W"]?ve.c.WEEK:ve.c.DAY,F=R!==ve.c.WEEK,P=Object(n.useMemo)(()=>F&&h!==Oe.a["24_HOURS"]?v.client?Object(ve.f)(v.client,f.getTime()):Object(ve.i)(f.getTime()):v.client?Object(ve.g)(v.client,R):Object(ve.h)(R),[R,F,h,f,v.client]),H=Object(r.useSelector)(P),B=Object(c.addHours)(Object(c.startOfHour)(g),1),$=F?((e,t,a,n)=>{const l=e.getDate()===(new Date).getDate();return Array(25).fill(1).map((t,i)=>{const r=Object(c.subHours)(e,i).getTime(),o=0===i&&l?n.formatMessage({id:"COMMON_GRANUALITY_0"}):Object(c.format)(r,a);return{label:i%2==0?o:null,value:r}}).reverse()})(B,0,_,e):((e,t,a)=>{const n=Object(k.f)(),l=Object(Be.findTimeZone)(n),i=Object(Be.findTimeZone)(a),r=new Date(e),o=Object(Be.getUTCOffset)(r,l),s=Object(Be.getUTCOffset)(r,i),d=e=>{const t=e+6e4*o.offset-6e4*s.offset;return Object(c.format)(t,"ddd")},u=[];for(let c=e-864e5;c<t+864e5;c+=864e5)u.push({value:c,label:c<e||c>t?null:d(c)});return u})(null===(t=null==H?void 0:H[0])||void 0===t?void 0:t.start_timestamp,null===(a=null==H?void 0:H[H.length-1])||void 0===a?void 0:a.end_timestamp,j),G=v.transferSizeEnabled&&v.transferSizeMin>U.d.transferSizeMin?v.transferSizeMin:0,[z,V]=Object(n.useMemo)(()=>{var e;const t=[],a={};if(F){v.traffic&&H.forEach((e,a)=>{let[n,l]=e.network_usage.reduce(([e,t],{rx_bytes:a,tx_bytes:n})=>[e+(null!=a?a:0),t+(null!=n?n:0)],[0,0]);C&&([n,l]=[l,n]),e.network_usage.forEach((i,r)=>{var o,s,u;if(i.rx_bytes+i.tx_bytes<G)return;const m=new Date(h===Oe.a["24_HOURS"]?e.start_timestamp:i.start_timestamp),b=Object(c.startOfHour)(m),p=I.type===Ge.TRAFFIC&&(null===(s=null===(o=null==I?void 0:I.id)||void 0===o?void 0:o.toString)||void 0===s?void 0:s.call(o))===(null===(u=b.getTime())||void 0===u?void 0:u.toString());let O=d.motifPalette.uBlue06;(I.id&&(I.type!==Ge.TRAFFIC||!p)||!I.id&&S&&S!==b.getTime().toString())&&(O=d.motifPalette.neutral04);const v=h===Oe.a["24_HOURS"]?1+new Date(i.start_timestamp).getMinutes()+m.getTime()%(a+r)%4:$e[R][0].value;if(i.rx_bytes+i.tx_bytes===0)return;const E=C?i.tx_bytes:i.rx_bytes,g=C?i.rx_bytes:i.tx_bytes;t.push({id:i.start_timestamp.toString(),x:b.getTime(),y:v,r:Ue(i.rx_bytes+i.tx_bytes),color:O,item:e,traffic:i,total:{identified:h===Oe.a["24_HOURS"]?e.identified_bytes:0,down:E,up:g,clients:i.client_count,axisDown:h===Oe.a["24_HOURS"]?n:E,axisUp:h===Oe.a["24_HOURS"]?l:g},type:Ge.TRAFFIC})})});const a=!I.type&&S,n=a&&p.find(({_id:e})=>a===e),l=I.type?I.type===Ge.THREAT&&I.id:(null===(e=null==n?void 0:n.http)||void 0===e?void 0:e.hostname)||(null==n?void 0:n.inner_alert_signature);p.forEach(e=>{var a,n,i;const{inner_alert_severity:r,time:s,flow:u,_id:m}=e,b=(null===(a=e.http)||void 0===a?void 0:a.hostname)||e.inner_alert_signature;let p=E.ips_mode!==O.IpsMode.DISABLED&&d.motifPalette[o.m[r]]||d.motifPalette.neutral04;!I.type&&!S||l&&l===b||(p=d.motifPalette.neutral04),t.push({id:m,x:Object(c.startOfHour)(new Date(s)).getTime(),y:new Date(s).getMinutes(),r:Ue((null!==(n=null==u?void 0:u.bytes_toclient)&&void 0!==n?n:0)+(null!==(i=null==u?void 0:u.bytes_toserver)&&void 0!==i?i:0)),color:p,item:e,type:Ge.THREAT})})}else{if(v.traffic){const e=H.reduce((e,t)=>{var a,n;const l=t.start_timestamp;let i=d.motifPalette.uBlue06;!I.id||I.type===Ge.OVERALL&&(null===(n=null===(a=I.id)||void 0===a?void 0:a.toString)||void 0===n?void 0:n.call(a))===l.toString()||(i=d.motifPalette.neutral04),e[l]||(e[l]={id:l+"-daily-dpi",x:l,y:$e[R][0].value,color:i,item:t,total:{identified:0,down:0,up:0},type:Ge.TRAFFIC});let[r,c]=t.network_usage.reduce(([e,t],{rx_bytes:a,tx_bytes:n})=>[e+(null!=a?a:0),t+(null!=n?n:0)],[0,0]);return C&&([r,c]=[c,r]),e[l].total.identified+=t.identified_bytes,e[l].total.down+=r,e[l].total.up+=c,e},{});Object.entries(e).forEach(([e,n])=>{a[e]||(a[e]={start_timestamp:Number(e),traffic:{identified:n.total.identified,down:n.total.down,up:n.total.up,clients:n.total.clients},threats:[0,0,0,0,0]}),n.total.down+n.total.up!==0?t.push(n):delete a[e].traffic})}const e=p.reduce((e,t)=>{var n,l,i,r,o,s,d,u;const m=Object(c.startOfDay)(new Date(t.time)).getTime(),b=Object(c.startOfHour)(new Date(t.time)).getTime();return a[m]||(a[m]={start_timestamp:Number(m),threats:[0,0,0,0,0]}),a[m].threats[t.inner_alert_severity]+=1,e[b]?(e[b].r+=(null!==(s=null===(o=t.flow)||void 0===o?void 0:o.bytes_toclient)&&void 0!==s?s:0)+(null!==(u=null===(d=t.flow)||void 0===d?void 0:d.bytes_toserver)&&void 0!==u?u:0),e[b].color=""+Math.min(Number(e[b].color),t.inner_alert_severity),e[b].text=""+((Number(e[b].text)||1)+1)):e[b]={id:b+"-threats",x:m,y:new Date(b).getHours(),r:(null!==(l=null===(n=t.flow)||void 0===n?void 0:n.bytes_toclient)&&void 0!==l?l:0)+(null!==(r=null===(i=t.flow)||void 0===i?void 0:i.bytes_toserver)&&void 0!==r?r:0),color:""+t.inner_alert_severity,type:Ge.THREAT,item:t},e},{});Object.values(e).forEach(e=>{var a,n;let l=E.ips_mode!==O.IpsMode.DISABLED&&d.motifPalette[o.m[Number(e.color)]]||d.motifPalette.neutral04;(I.id&&(I.type!==Ge.OVERALL||(null===(n=null===(a=I.id)||void 0===a?void 0:a.toString)||void 0===n?void 0:n.call(a))!==e.x.toString())||!I.id&&S&&S!==e.x.toString())&&(l=d.motifPalette.neutral04),t.push({...e,r:Math.max(Ue(e.r),e.text?8:4),color:l})})}return[t.filter(({x:e})=>{var t,a;return e>=(null===(t=$[1])||void 0===t?void 0:t.value)&&e<(null===(a=$.slice(-1)[0])||void 0===a?void 0:a.value)}),a]},[p,H,F,E.ips_mode,d,null===(s=$[1])||void 0===s?void 0:s.value,S,R,G,v.traffic,I,C]),W=Object(n.useCallback)((e,t,a)=>{var n;let l;if("_id"in e)l=e._id;else{if(!("start_timestamp"in e&&(null===(n=e.traffic_breakdown)||void 0===n?void 0:n.length)&&(null==a?void 0:a.start_timestamp)))return;l=Object(c.startOfHour)(new Date(a.start_timestamp)).getTime()}L();const r=Object(i.i)("/:site/ips/properties/:id/:panel",{id:l,site:T,panel:t===Ge.THREAT?he.a.DETAILS:he.a.OVERVIEW});r!==M&&(w.push(r),A(Object(ue.g)({type:t===Ge.THREAT?me.c.THREAT_EVENT:me.c.TRAFFIC_STATS,id:l})))},[A,w,M,T,L]),K=Object(n.useCallback)(e=>{const t=e["catname"in e?"time":"start_timestamp"],a=new Date(t),n=Object(c.subMilliseconds)(Object(c.addHours)(a,24),1);A(Object(N.d)({startDate:a,endDate:n,preset:null}))},[A]),Y=Object(n.useCallback)(({item:e})=>F?null:l.a.createElement(Xe,{item:V[Number(e.x)],handleOpen:K}),[F,V,K]),Z=Object(n.useMemo)(()=>F?((e,t,a,n,i)=>({item:r})=>{switch(r.type){case Ge.THREAT:return l.a.createElement(Je,{timeFormat:e,item:r.item,handleOpen:t,activeDot:a});case Ge.TRAFFIC:return l.a.createElement(qe,{timeFormat:e,item:r.item,traffic:Ge.TRAFFIC in r&&r.traffic,total:r.total,handleOpen:t,activeDot:a,openedPpId:n,xValue:r.x,isLast24H:i===Oe.a["24_HOURS"]});default:return null}})(_,W,I,S,h):Y,[_,W,F,Y,I.id,S,h]),J=Object(n.useCallback)(({item:e})=>{var t,a,n;const l={view:h,type:null,id:null};F?"catname"in e.item?(l.type=Ge.THREAT,l.id=(null===(a=null===(t=e.item)||void 0===t?void 0:t.http)||void 0===a?void 0:a.hostname)||(null===(n=e.item)||void 0===n?void 0:n.inner_alert_signature),S&&W(e.item,Ge.THREAT)):(l.type=Ge.TRAFFIC,l.id=e.x,S&&W(e.item,Ge.TRAFFIC,e.traffic)):(l.type=Ge.OVERALL,l.id=e.x),!S&&D(l)},[F,W,S,h]);return l.a.createElement("div",{ref:u},l.a.createElement(Pe.a,{xAxis:$,yAxis:$e[R],width:b,height:360,margin:[20,50,30,0],yAxisLabelSpacing:b,renderChartElements:e=>l.a.createElement(He.a,{data:z,getCoordinates:e,renderTooltipContents:F||I.id?Z:void 0,tooltipInteractive:!0,portaledTooltip:!0,tooltipWidth:265,width:b,height:360,onClick:J})}))});const et=Object(g.c)("div")`
  margin-left: ${({theme:e})=>e.spacing["spacing-s"]};
`,tt=Object(g.c)(oe.r)`
  color: ${({theme:e})=>e.motifPalette.success};
`,at=Object(g.c)("div")`
  > div,
  > div > div {
    overflow: visibile !important;
  }

  margin-bottom: 24px;
`,nt=Object(g.c)("div",{shouldForwardProp:e=>"chipChecked"!==e&&"isDark"!==e})`
  > div {
    transform: none !important;
    margin: 0 8px 0 0 !important;
    ${({chipChecked:e,theme:t,isDark:a})=>e?`\n      background: ${t.motifPalette[a?"uBlue10":"uBlue01"]};\n      border-color: ${t.motifPalette[a?"uBlue10":"uBlue01"]};\n\n      &:hover {\n        background: ${t.motifPalette[a?"uBlue09":"uBlue02"]};\n        border-color: ${t.motifPalette[a?"uBlue09":"uBlue02"]};\n      }\n    `:`\n      background: ${t.motifPalette.neutral02};\n      border-color: ${t.motifPalette.neutral02};\n\n      &:hover {\n        background: ${t.motifPalette.neutral03};\n        border-color: ${t.motifPalette.neutral03};\n      }\n    `}
  }
`;var lt;!function(e){e.TRAFFIC="traffic",e.THREATS="threats"}(lt||(lt={}));var it=()=>{const[e,t]=Object(n.useState)(lt.TRAFFIC),a=Object(r.useDispatch)(),o=Object(r.useSelector)(x.k),d=Object(r.useSelector)(x.e),u=Object(r.useSelector)(se.c),m=Object(r.useSelector)(y.E),{preset:b,startDate:p}=Object(r.useSelector)(x.d),E=Object(r.useSelector)(O.selectIpsSettings),g=Object(r.useSelector)(x.i),f=Object(r.useSelector)(x.l),{site:j}=Object(i.m)(),{pathname:_}=Object(i.l)(),C=Object(i.k)(),T=Object(r.useSelector)(y.q),S=b===Oe.a["1W"]?ve.c.WEEK:ve.c.DAY,w=S!==ve.c.WEEK,A=e===lt.TRAFFIC,I=!f.threats||f.severity.every(e=>!e),D=Object(n.useMemo)(()=>w&&b!==Oe.a["24_HOURS"]?f.client?Object(ve.f)(f.client,p.getTime()):Object(ve.i)(p.getTime()):f.client?Object(ve.g)(f.client,S):Object(ve.h)(S),[S,w,b,p,f.client]),L=Object(r.useSelector)(D),R=Object(n.useMemo)(()=>{const e=o.slice();return d.forEach(t=>e.push(Object.assign({},t))),e.sort((e,t)=>t.timestamp-e.timestamp)},[o,d]),F=Object(n.useMemo)(()=>{const e=[];return w?b?L.forEach(t=>{var a,n,i,r;const c=null===(a=t.traffic_breakdown)||void 0===a?void 0:a[0];if(!c)return;const[o,s,d]=(null===(n=null==c?void 0:c.usage_by_app)||void 0===n?void 0:n.reduce(([e,t,a],{bytes_received:n,bytes_transmitted:l,packets_received:i,packets_transmitted:r})=>[e+(null!=n?n:0),t+(null!=l?l:0),a+(null!=i?i:0)+(null!=r?r:0)],[0,0,0]))||[0,0,0];o+s!==0&&e.unshift({id:""+t.start_timestamp,dateTime:Object(k.e)(new Date(t.start_timestamp),u,m),service:(null===(i=null==c?void 0:c.usage_by_app)||void 0===i?void 0:i.length)||0,dataUsage:Object(Y.a)(o+s),dataUsageRaw:o+s,packets:Object(le.a)(d,{spacer:" "}),down:Object(Y.a)(o),up:Object(Y.a)(s),start_timestamp:t.start_timestamp,children:null===(r=null==c?void 0:c.usage_by_app)||void 0===r?void 0:r.map(e=>{const t=Object(ge.getCompoundId)({cat:e.category,app:e.application}),{name:a,iconFileName:n}=Ee.a[t]||{name:null,iconFileName:null};return{id:`child-${c.start_timestamp}-${e.application}-${e.category}`,dateTime:" ",service:l.a.createElement(be.a,{alignItems:"center"},l.a.createElement(fe.a,{name:a,iconFileName:n}),a||l.a.createElement(h.b,{id:"COMMON_UNKNOWN"})),dataUsage:Object(Y.a)(e.bytes_received+e.bytes_transmitted),dataUsageRaw:e.bytes_received+e.bytes_transmitted,packets:Object(le.a)(e.packets_received+e.packets_transmitted,{spacer:" "}),down:Object(Y.a)(e.bytes_received),up:Object(Y.a)(e.bytes_transmitted),start_timestamp:c.start_timestamp}})})}):L.forEach(t=>{t.traffic_breakdown.forEach(t=>{var a,n;const[i,r,c]=(null===(a=t.usage_by_app)||void 0===a?void 0:a.reduce(([e,t,a],{bytes_received:n,bytes_transmitted:l,packets_received:i,packets_transmitted:r})=>[e+(null!=n?n:0),t+(null!=l?l:0),a+(null!=i?i:0)+(null!=r?r:0)],[0,0,0]))||[0,0,0];i+r!==0&&e.unshift({id:""+t.start_timestamp,dateTime:Object(k.e)(new Date(t.start_timestamp),u,m),service:(null===(n=null==t?void 0:t.usage_by_app)||void 0===n?void 0:n.length)||0,dataUsage:Object(Y.a)(i+r),dataUsageRaw:i+r,packets:Object(le.a)(c,{spacer:" "}),down:Object(Y.a)(i),up:Object(Y.a)(r),start_timestamp:t.start_timestamp,children:t.usage_by_app.map(e=>{const a=Object(ge.getCompoundId)({cat:e.category,app:e.application}),{name:n,iconFileName:i}=Ee.a[a]||{name:null,iconFileName:null};return{id:`child-${t.start_timestamp}-${e.application}-${e.category}`,dateTime:" ",service:l.a.createElement(be.a,{alignItems:"center"},l.a.createElement(fe.a,{name:n,iconFileName:i}),n||l.a.createElement(h.b,{id:"COMMON_UNKNOWN"})),dataUsage:Object(Y.a)(e.bytes_received+e.bytes_transmitted),dataUsageRaw:e.bytes_received+e.bytes_transmitted,packets:Object(le.a)(e.packets_received+e.packets_transmitted,{spacer:" "}),down:Object(Y.a)(e.bytes_received),up:Object(Y.a)(e.bytes_transmitted),start_timestamp:t.start_timestamp}})})})}):L.forEach(t=>{var a,n;if(!(null===(a=t.traffic_breakdown)||void 0===a?void 0:a.length))return;const[l,i,r,c]=(null===(n=t.traffic_breakdown.flatMap(({usage_by_app:e})=>e))||void 0===n?void 0:n.reduce(([e,t,a,n],{bytes_received:l,bytes_transmitted:i,packets_received:r,packets_transmitted:c,category:o,application:s})=>(n[Object(ge.getCompoundId)({cat:o,app:s})]=1,[e+(null!=l?l:0),t+(null!=i?i:0),a+(null!=r?r:0)+(null!=c?c:0),n]),[0,0,0,{}]))||[0,0,0,{}],o=t.traffic_breakdown.reduce((e,t)=>{var a;const[n,l,i,r]=t.usage_by_app.reduce(([e,t,a,n],{bytes_received:l,bytes_transmitted:i,packets_received:r,packets_transmitted:c,category:o,application:s})=>(n[Object(ge.getCompoundId)({cat:o,app:s})]=1,[e+(null!=l?l:0),t+(null!=i?i:0),a+(null!=r?r:0)+(null!=c?c:0),n]),[0,0,0,{}])||[0,0,0,{}];return n+l===0||e.push({id:"child-"+t.start_timestamp,dateTime:Object(k.e)(new Date(t.start_timestamp),u,m),service:null!==(a=Object.keys(r).length)&&void 0!==a?a:0,dataUsage:Object(Y.a)(n+l),packets:Object(le.a)(i,{spacer:" "}),down:Object(Y.a)(n),up:Object(Y.a)(l),start_timestamp:t.start_timestamp}),e},[]).reverse();0!==o.length&&e.unshift({id:""+t.start_timestamp,dateTime:Object(k.e)(new Date(t.start_timestamp),u,de.a),service:Object.keys(c).length||0,dataUsage:Object(Y.a)(l+i),dataUsageRaw:l+i,packets:Object(le.a)(r,{spacer:" "}),down:Object(Y.a)(l),up:Object(Y.a)(i),start_timestamp:t.start_timestamp,children:o})}),e.forEach(e=>e.children.sort((e,t)=>t.dataUsageRaw-e.dataUsageRaw)),e},[L,u,m,w,b]),P=e===lt.THREATS?R:F;Object(n.useEffect)(()=>{const e=Math.ceil((Date.now()-new Date(p).getTime())/36e5);a(Object(s.fetchOfflineClients)({queryParams:{withinHours:e}},{crudCacheStrategy:{type:v.a.CACHE}}))},[a,p]);const H=Object(n.useCallback)(e=>{const t=Object(c.startOfHour)(new Date(e.start_timestamp)).getTime(),n=Object(i.i)("/:site/ips/properties/:id",{id:t,site:j});n!==_&&(C.push(n),a(Object(ue.g)({type:me.c.TRAFFIC_STATS,id:t})))},[a,C,_,j]),B=Object(n.useCallback)(e=>{const t=Object(i.i)("/:site/ips/properties/:id/:panel",{id:e._id,site:j,panel:"honeypot"===e.type?he.a.OVERVIEW:he.a.DETAILS});t!==_&&(C.push(t),a(Object(ue.g)({type:"honeypot"===e.type?me.c.HONEYPOT_ALERT:me.c.THREAT_EVENT,id:e._id})))},[a,C,_,j]),$=Object(n.useCallback)(()=>{a(Object(W.a)({title:"TM_ENABLE_IDS",message:"TM_ENABLE_IDS_DESC",confirmButtonProps:{text:l.a.createElement(h.b,{id:"COMMON_ACTION_ENABLE"})},onConfirm:()=>{a(Object(O.saveSettings)({...E,ips_mode:O.IpsMode.IPS})),a(Object(K.e)())},onCancel:()=>{a(Object(K.e)())}}))},[a,E]),G=Object(n.useCallback)(({from:e,rowsPerPage:t})=>l.a.createElement(be.a,{overflow:"auto",marginTop:8},A?l.a.createElement(ie.a,{items:F,idField:"id",columns:U.g,rowHeight:48,onRowClick:H,disableColumnFilters:!0}):l.a.createElement(ie.a,{items:R,rowLimit:t,rowOffset:e,idField:"_id",columns:Object(U.c)(u,de.a,m),rowHeight:48,onRowClick:B,disableColumnFilters:!0})),[A,R,F,u,m,B,H]);return l.a.createElement(be.a,{flexDirection:"column",height:"100%",paddingBottom:32,overflow:"auto"},l.a.createElement(be.a,{flexDirection:"column",padding:"38px 32px 0"},l.a.createElement(Re,null),l.a.createElement(Qe,null)),l.a.createElement(be.a,{marginTop:24,padding:"0 32px"},l.a.createElement(nt,{chipChecked:A,isDark:T},l.a.createElement(re.a,{width:"auto",onClick:()=>t(lt.TRAFFIC),label:`Traffic (${F.length})`})),l.a.createElement(nt,{chipChecked:!A,isDark:T},l.a.createElement(re.a,{width:"auto",onClick:()=>t(lt.THREATS),label:`Threats (${R.length})`}))),l.a.createElement(at,null,(null==P?void 0:P.length)?l.a.createElement(pe.a,{section:"TM_EVENTS",itemCount:P.length,tableType:A?M.a.THREAT_MANAGEMENT_EVENT_TIMELINE_TRAFFIC:M.a.THREAT_MANAGEMENT_EVENT_TIMELINE,onRenderTable:G,onPageChanged:A?void 0:e=>a(Object(N.e)(e)),pageNumber:A?1:g}):A?l.a.createElement(be.a,{alignItems:"center",marginTop:"24px",marginLeft:"32px"},l.a.createElement("div",null,l.a.createElement(oe.cb,{isActive:!0})),l.a.createElement(et,null,l.a.createElement(h.b,{id:"TM_NO_DPI_DATA"}))):E.ips_mode===O.IpsMode.DISABLED||I?l.a.createElement(be.a,{alignItems:"center",marginTop:"24px",marginLeft:"32px"},l.a.createElement("div",null,l.a.createElement(oe.cb,{isActive:!0})),l.a.createElement(et,null,!I&&l.a.createElement(l.a.Fragment,null,l.a.createElement(h.b,{id:"COMMON_ACTION_ENABLE"})," ",l.a.createElement(ce.a,{variant:"inline",onClick:$},l.a.createElement(h.b,{id:"TM_IDS"}))," "),l.a.createElement(h.b,{id:I?"TM_NO_THREATS_DISPLAYED":"TM_FOR_FULL_ANALYSIS"}))):l.a.createElement(be.a,{alignItems:"center",marginTop:"24px",marginLeft:"32px"},l.a.createElement("div",null,l.a.createElement(tt,{variant:"twoTone"})),l.a.createElement(et,null,l.a.createElement(h.b,{id:"TM_NO_THREATS"})))))},rt=a(6),ct=a(2611),ot=a(3109),st=a(2979),dt=a(126),ut=a(1677);const mt=["#000","#F6898B","#f9ca7a","#e5e7ed","#89e0a2"],bt=(e,t)=>["case",["==",["get","severity"],4],e?t.motifPalette[o.m[4]]:mt[4],["==",["get","severity"],3],e?t.motifPalette.ui03:mt[3],["==",["get","severity"],2],e?t.motifPalette[o.m[2]]:mt[2],e?t.motifPalette[o.m[1]]:mt[1]],pt=[4,1e3,5,1e4,6,1e5,7,5e5,8,1e6,9,2e6,10,3e6,11,5e6,12,7e6,13,8e6,14,1e7,15,3e7,16,5e7,17,7e7,18,9e7,19,1e8,20,3e8,21,5e8,22,8e8,23,1e9,24],Ot={CA:[155],US:[154],RU:[49],IS:[189],GL:[175],NO:[54],FI:[56],SE:[55],KI:[194],MX:[156],EC:[137],GT:[118],SV:[117],FO:[225],IM:[223],GG:[222],JE:[221],CV:[219],KY:[212],JM:[211],AI:[209],PR:[208],VI:[206],AG:[204],MS:[203],DM:[201],LC:[200],BB:[199],VC:[198],TT:[196],PM:[188],TC:[185],BS:[184],CW:[182],GM:[165],MR:[163],VE:[159],PA:[158],BZ:[157],GW:[152],GH:[151],TG:[150],BF:[149],PT:[140],CO:[138],HN:[136],CU:[135],DZ:[122],DO:[114],HT:[113],SN:[100],ML:[99],CI:[97],NL:[95],LR:[85],GN:[84],SL:[83],GB:[80],IE:[79],ES:[68],BR:[46],NI:[31],CR:[30],EH:[29],MA:[28],GY:[25],SR:[24],FR:[23],BH:[247],AX:[224],MT:[220],ST:[218],LK:[181],CY:[172,169,168,8,7],KZ:[171,43],IN:[170,9],GQ:[164],YE:[162],EG:[161],NE:[148],GA:[147],CM:[146],NP:[144],JO:[143],TM:[142],MD:[141],UG:[133],BA:[132],ME:[131],AF:[130],AD:[129],BD:[128],KW:[116],TD:[115],BG:[110],SA:[107],QA:[106],SI:[105],HR:[104],BJ:[102],NG:[101],RS:[98],LI:[96],IR:[94],CH:[93],IT:[92],IQ:[91],AT:[90],ER:[89],DJ:[88],SD:[87,15],CF:[86],GR:[81],PL:[78],SK:[77],HU:[76],RO:[75],TN:[74],LY:[73],DK:[72],AM:[71],KG:[70],TR:[67],XK:[66],AZ:[65],AL:[64],MK:[63],GE:[62],BE:[61],AE:[60],LU:[59],LV:[53],EE:[52],DE:[51],CZ:[50],MN:[48],LT:[45],TJ:[44],UZ:[42],OM:[41],BY:[36],UA:[35],BT:[34],CD:[33],CG:[32],SO:[22,16],SY:[21],PK:[18],KE:[17],ET:[14],LB:[13],PS:[12],IL:[11],CN:[10],SG:[228],JP:[187],TW:[186],PH:[180],HK:[166],MM:[127],BN:[120],TH:[111],LA:[69],KH:[58],VN:[57],KP:[27],MY:[2],ID:[1],NU:[242],WS:[233],TO:[231],PF:[191],NZ:[177],CL:[3],FK:[240],PY:[139],UY:[47],AR:[6],PE:[5],BO:[4],KM:[217],MU:[216],HM:[214],SC:[193],TF:[192],MG:[179],LS:[145],RW:[126],BI:[125],SZ:[124],MZ:[123],ZW:[109],BW:[108],AO:[103],ZM:[82],ZA:[38],NA:[37],TZ:[20],MW:[19],AU:[174],TL:[119],KR:[26],GS:[239],MP:[246],GU:[245],FM:[238],AQ:[173],SB:[234],NC:[178],PG:[160],VU:[241],FJ:[176],VG:[210],BL:[207],KN:[205],GD:[197],AW:[183],MF:[39],SH:[215],BM:[213],MV:[236],IO:[227],SM:[112],PW:[244],AS:[243],WF:[232],MH:[195],NF:[229],NR:[237],CK:[230],UM:[202],MO:[251],PN:[190],SX:[40]},vt=Object(g.c)("div")`
  position: absolute;
  top: 38px;
  left: 32px;
  right: 32px;
  z-index: 10;
`;const Et=(e,t)=>(a,n,l)=>{n&&e.forEach(e=>{const i={id:n,source:e,sourceLayer:ut.c.POLYGON_SOURCE_LAYER};a.setFeatureState(i,{[t]:l})})},gt=Et([ut.e.clickFills,ut.e.clickOutlines],"clicked"),ft=Et([ut.e.blockFills,ut.e.blockOutlines],"blocked");var ht=({apiKey:e,blockedCountries:t,geoIpDisabled:a,width:i,height:c,isUdm:o,setClickedCountry:s})=>{const d=Object(n.useRef)(null),[u,b]=Object(n.useState)(),[p,O]=Object(n.useState)(((e,t)=>({width:e,height:t,latitude:37.79135735681293,longitude:-28.29720149912995,pitch:0,bearing:0,zoom:2}))(i,c)),[v,E]=Object(n.useState)(),[g,f]=Object(n.useState)(!1),h=Object(r.useSelector)(dt.a),j=Object(r.useSelector)(x.g),_=Object(m.n)(),C=Object(r.useSelector)(x.k),T=Object(r.useSelector)(x.l),S=T.transferSizeEnabled&&T.transferSizeMin>U.d.transferSizeMin,y=Object(n.useMemo)(()=>({type:"FeatureCollection",features:C.filter(({dstipGeo:e,usgipGeo:t})=>(null==e?void 0:e.longitude)&&e.latitude||(null==t?void 0:t.longitude)&&t.latitude).map(e=>{var t,a,n,l,i,r,c;const o=(null!==(a=null===(t=null==e?void 0:e.flow)||void 0===t?void 0:t.bytes_toclient)&&void 0!==a?a:0)+(null===(n=null==e?void 0:e.flow)||void 0===n?void 0:n.bytes_toserver),s=e.inner_alert_severity;return{type:"Feature",properties:{id:e._id,activity:o,severity:s,color:_.motifPalette[s]},geometry:{type:"Point",coordinates:[(null===(l=e.dstipGeo)||void 0===l?void 0:l.longitude)||(null===(i=e.usgipGeo)||void 0===i?void 0:i.longitude),(null===(r=e.dstipGeo)||void 0===r?void 0:r.latitude)||(null===(c=e.usgipGeo)||void 0===c?void 0:c.latitude)]},clusterProperties:{severity:["min",["get","severity"]],activity:["+",["get","activity"]]}}})}),[C,_]),M=Object(n.useMemo)(()=>({id:"clusters",type:"circle",source:"events",filter:["has","point_count"],paint:{"circle-color":bt(S,_),"circle-stroke-width":1,"circle-stroke-color":bt(S,_),"circle-radius":S?["step",["get","activity"],...pt]:["step",["get","point_count"],12,9,14,20,15,30,16,40,17,50,18,80,20,100,22,150,23,300,24,500,25,750,26,1e3,27,2e3,28]}}),[S,_]),w=Object(n.useMemo)(()=>({id:"cluster-count",type:"symbol",source:"events",filter:["has","point_count"],layout:{"text-field":"{point_count_abbreviated}","text-size":S?0:12}}),[S]),A=Object(n.useMemo)(()=>({id:"unclustered-point",type:"circle",source:"events",filter:["!",["has","point_count"]],paint:{"circle-color":bt(S,_),"circle-radius":["step",["get","activity"],...pt],"circle-stroke-width":1,"circle-stroke-color":bt(S,_)}}),[S,_]);Object(n.useEffect)(()=>{var e;if(!g)return;const t=null===(e=d.current)||void 0===e?void 0:e.getMap();["clusters","cluster-count","unclustered-point"].forEach(e=>{t.getLayer(e)&&t.removeLayer(e)}),t.getSource("events")&&t.removeSource("events"),t.addSource("events",{type:"geojson",cluster:!0,clusterRadius:30,data:y}).addLayer(M).addLayer(w).addLayer(A)},[y,M,w,A,g]);const I=Object(n.useCallback)(()=>{var e;gt(null===(e=d.current)||void 0===e?void 0:e.getMap(),u,!1),b(void 0)},[u]),k=Object(n.useCallback)(e=>{var t,a,n,l,i,r;if(!g)return;const c=null===(t=d.current)||void 0===t?void 0:t.getMap().queryRenderedFeatures([e.x,e.y]);if(c.length){const e=null===(a=null==c?void 0:c.find)||void 0===a?void 0:a.call(c,e=>e.source===ut.e.clickFills),t=null===(n=null==c?void 0:c.find)||void 0===n?void 0:n.call(c,e=>"events"===e.source);if(t){d.current.getMap().getSource("events").getClusterExpansionZoom(t.id,(e,a)=>{e||O({...p,longitude:t.geometry.coordinates[0],latitude:t.geometry.coordinates[1],zoom:Math.min(a||12,15),transitionDuration:300})})}else if(e){const t=null===(l=null==e?void 0:e.properties)||void 0===l?void 0:l.NAME,a=(o=e,m=t,ut.d[m]?ut.d[m]:o.properties.ISO_A2),n=e.id;u&&u===n||gt(null===(i=d.current)||void 0===i?void 0:i.getMap(),n,!0),u!==n&&gt(null===(r=d.current)||void 0===r?void 0:r.getMap(),u,!1),b(n),s(a)}else I(),s("")}var o,m},[u,I,p,s,g]),N=Object(n.useCallback)(({viewState:e})=>{O(e)},[]),D=Object(n.useCallback)(({x:e,y:t})=>{var a;const n=null===(a=d.current)||void 0===a?void 0:a.getMap();if(!(e&&t&&n&&g))return;const[l]=n.queryRenderedFeatures([e,t],{layers:[ut.e.clickFills]}),i=l&&l.id;i&&i!==v?(gt(n,i,!0),gt(n,v,!1),E(i)):!i&&v&&(gt(n,v,!1),E(void 0))},[v,g]),L=Object(n.useCallback)(()=>{var e,t,a;const n=null===(e=d.current)||void 0===e?void 0:e.getMap(),{layers:l}=n.getStyle(),i=null===(a=null===(t=l.filter(e=>"symbol"===e.type))||void 0===t?void 0:t[0])||void 0===a?void 0:a.id;Object.entries(ut.b).forEach(([e,t])=>n.addSource(e,t)),ut.a.forEach(e=>n.addLayer(e,i))},[]),R=Object(n.useCallback)((e,t)=>{var a;return ft(null===(a=d.current)||void 0===a?void 0:a.getMap(),e,t)},[]),F=Object(n.useCallback)((e,t)=>{e.forEach(e=>{var a;null===(a=Ot[e])||void 0===a||a.forEach(e=>R(e,t))})},[R]),P=Object(n.useCallback)(()=>{a||F(t,!0)},[a,t,F]),H=Object(n.useCallback)(()=>{var e;const t=null===(e=d.current)||void 0===e?void 0:e.getMap();t.loadImage(`${h}/trafficInspector/stripes_${_.themeName}.png`,(e,a)=>{t.addImage("pattern",a)}),L(),t.once("idle",()=>{P(),f(!0)})},[L,P]),B=Object(n.useCallback)(()=>v?"pointer":"grab",[v]);return l.a.createElement(l.a.Fragment,null,l.a.createElement(l.a.Fragment,null,l.a.createElement(vt,null,l.a.createElement(Re,{isMap:!0}))),l.a.createElement(ot.a,{controller:!0,onClick:k,viewState:p,onHover:D,getCursor:B,maxZoom:15,onViewStateChange:N},l.a.createElement(st.a,{onLoad:H,ref:d,attributionControl:!1,mapboxApiAccessToken:e,mapStyle:j,minZoom:2,maxZoom:15})))},jt=a(408);const _t=Object(g.c)("div")`
  margin-bottom: 24px;
  position: relative;
  height: 100%;
  display: flex;
  flex: 1;
  width: 100%;
`;var Ct=({setClickedCountry:e})=>{const t=Object(n.useRef)(),a=Object(m.q)(t)||window.innerWidth-50,i=Object(m.e)(t)||window.innerHeight-102,c=Object(r.useSelector)(p.c),o=Object(r.useSelector)(w.l),s=Object(r.useSelector)(rt.selectIsUsg),d=function(e){var t,a;const{geo_ip_filtering_block:n,geo_ip_filtering_countries:l,geo_ip_filtering_enabled:i}=e;if(!i)return[];const r=null!==(a=null===(t=null==l?void 0:l.split)||void 0===t?void 0:t.call(l,","))&&void 0!==a?a:[],c=jt.a.length;if("allow"===n){const e=[];for(let t=0;t<c;t+=1)r.indexOf(jt.a[t].countryCode)<0&&e.push(jt.a[t].countryCode);return e}return r}(Object(r.useSelector)(O.selectUsgSettings)),u=Object(r.useSelector)(ct.a);return Object(m.g)([Object(rt.fetchDevices)(void 0,{crudCacheStrategy:{type:v.a.CACHE}}),Object(p.a)(void 0,{type:v.a.CACHE})],l.a.createElement(_t,{innerRef:t},l.a.createElement(ht,{apiKey:c,geoIpDisabled:s&&!u,isUdm:o,blockedCountries:d,width:a,height:i,setClickedCountry:e})))},Tt=a(626);const St=Object(g.c)("div")`
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  max-height: 310px;
  z-index: 10;
  background: ${({theme:e})=>e.motifPalette.ui01};
`,yt=Object(g.c)("div")`
  padding-bottom: 20px;
  overflow-x: auto;
  overflow-y: visible;
  max-height: 310px;
`,Mt=Object(g.c)(be.a)`
  position: absolute;
  height: 40px;
  width: 40px;
  right: 0;
  top: 3px;
  cursor: pointer;
  z-index: 10;
`;var wt=({country:e,setCountry:t})=>{var a,c;const o=Object(r.useDispatch)(),d=Object(r.useSelector)(x.k),u=Object(r.useSelector)(se.c),m=Object(r.useSelector)(y.H),{preferences:{timeFormat:b}}=Object(r.useSelector)(y.J),p=Object(r.useSelector)(x.d),O=Object(Tt.a)(b,m),{site:E}=Object(i.m)(),{pathname:g}=Object(i.l)(),f=Object(i.k)(),h=Object(n.useCallback)(e=>{if(e.parent)return;const t=Object(i.i)("/:site/ips/map/properties/:id/details",{id:e._id,site:E});t!==g&&(f.push(t),o(Object(ue.g)({type:me.c.THREAT_EVENT,id:e._id})))},[o,f,g,E]);Object(n.useEffect)(()=>{const e=Math.ceil((Date.now()-new Date(p.startDate).getTime())/36e5);o(Object(s.fetchOfflineClients)({queryParams:{withinHours:e}},{crudCacheStrategy:{type:v.a.CACHE}}))},[o,p.startDate]);const j=Object(n.useMemo)(()=>{var t,a;const n=d.filter(t=>{var a,n;return((null===(a=null==t?void 0:t.dstipGeo)||void 0===a?void 0:a.country_code)||(null===(n=null==t?void 0:t.usgipGeo)||void 0===n?void 0:n.country_code))===e}),l={country_name:"-",...null===(t=n[0])||void 0===t?void 0:t.usgipGeo,...null===(a=n[0])||void 0===a?void 0:a.dstipGeo},i=new Set(n.map(({http:e,inner_alert_signature:t})=>(null==e?void 0:e.hostname)||t||"-")).size,r=new Set(n.map(({catname:e})=>e||"-")).size,c=n.reduce((e,{flow:t})=>{var a,n;return e+(null!==(a=null==t?void 0:t.bytes_toclient)&&void 0!==a?a:0)+(null!==(n=null==t?void 0:t.bytes_toserver)&&void 0!==n?n:0)},0);return[{parent:!0,_id:"table-for-"+l.country_name,children:n,dstipGeo:l,totalServices:i,totalCategories:r,totalActivity:c}]},[d,e]),_=null===(c=null===(a=j[0])||void 0===a?void 0:a.children)||void 0===c?void 0:c.length,C=Object(n.useCallback)(()=>t(""),[t]);return Object(n.useEffect)(()=>{_||C()},[_,C]),_?l.a.createElement(St,null,l.a.createElement(Mt,{justifyContent:"center",alignItems:"center",onClick:C},l.a.createElement(oe.z,null)),l.a.createElement(yt,null,l.a.createElement(ie.a,{items:j,idField:"_id",columns:Object(U.b)(u,de.a,O),rowHeight:48,onRowClick:h,disableColumnFilters:!0}))):null};var At=()=>{const[e,t]=Object(n.useState)("");return l.a.createElement(l.a.Fragment,null,l.a.createElement(be.a,{height:"100%",width:"100%"},l.a.createElement(Ct,{setClickedCountry:t})),!!e&&l.a.createElement(wt,{country:e,setCountry:t}))};t.default=()=>{const e=Object(r.useDispatch)(),t=Object(r.useSelector)(x.l),{preset:a,startDate:g}=Object(r.useSelector)(x.d);return Object(n.useEffect)(()=>{e(Object(x.a)())},[e,a,g,t.client]),Object(n.useEffect)(()=>{e(Object(o.e)(void 0,{crudCacheStrategy:{type:v.a.CACHE}})),e(Object(p.a)(void 0,{type:v.a.CACHE})),e(Object(s.fetchClients)(void 0,{crudCacheStrategy:{type:v.a.CACHE}})),e(Object(s.fetchOfflineClients)({queryParams:{withinHours:s.OfflineClientTimeFrame.WEEK}},{crudCacheStrategy:{type:v.a.CACHE}})),e(Object(s.fetchBlockedClients)(void 0,{crudCacheStrategy:{type:v.a.CACHE}}));const t=new Date;e(Object(o.d)(Object(c.startOfDay)(Object(c.subDays)(t,7)),t,{crudCacheStrategy:{type:v.a.CACHE}}))},[e]),Object(m.g)([Object(d.c)("threatManagement"),Object(O.fetchSettings)({type:v.a.CACHE})],l.a.createElement(b.a,{path:["/:site/ips/properties/:dataId?","/:site/ips/:threatPage?","/:site/ips/:threatPage?/properties/:dataId?/:panel?"]},l.a.createElement(u.a,null,l.a.createElement(ne,null),l.a.createElement(i.g,null,l.a.createElement(b.a,{path:"/:site/ips/"+U.e[$.a.MAP],component:At}),l.a.createElement(b.a,{component:it})),l.a.createElement(b.a,{path:["/:site/ips/properties/:id/:panel?","/:site/ips/:threatPage/properties/:id/:panel?"]},l.a.createElement(E.a,null)))),{trackingName:"threat-management"})}}}]);